code
stringlengths 1
2.01M
| repo_name
stringlengths 3
62
| path
stringlengths 1
267
| language
stringclasses 231
values | license
stringclasses 13
values | size
int64 1
2.01M
|
|---|---|---|---|---|---|
<div class="elements">
<h3 class="ui-widget-header widgets">
<div class="title">Tìm kiếm</div>
</h3>
<div class="tim_kiem">
<input type="text" id="key" value="" placeholder="Nhập tiêu đề tin tức"
style="margin: 5px;"/>
<img src="../upload/images/search_icon.gif"/>
</div>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/tim_kiem.php
|
Hack
|
gpl3
| 352
|
<div class="elements">
<h3 class="ui-widget-header widgets">
<div class="title"><a href="#">Tin tức IDJ</a></div>
</h3>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/tin_tuc_IDJ.php
|
Hack
|
gpl3
| 148
|
<div class="elements">
<h3 class="ui-widget-header widgets">
<div class="title">Các chuyên mục hay</div>
</h3>
<div class="tin_noi_bat">
<ul class="danh_muc">
<li class="menu"><a href="#" class="text">Tin tức kinh tế</a></li>
<li class="menu"><a href="#" class="text">Chứng khoán</a></li>
<li class="menu"><a href="#" class="text">Sống thành công</a></li>
<li class="menu"><a href="#" class="text">Khởi sự doanh nghiệp</a></li>
<li class="menu"><a href="#" class="text">Kinh doanh thành công</a></li>
<li class="menu"><a href="#" class="text">Đàm phán trong KD</a></li>
<li class="menu"><a href="#" class="text">Những bài học kinh điển</a></li>
<li class="menu"><a href="#" class="text">Doanh nhân và đời sống</a></li>
</ul>
</div>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/cac_chuyen_muc_hay.php
|
Hack
|
gpl3
| 945
|
<div class="elements">
<h3 class="ui-widget-header widgets">
<div class="title">Tìm kiếm cơ hội khác</div>
</h3>
<div id="accordion1">
<h3><a href="#">Mua các DN ngoài mục đang mời</a></h3>
<ul>
<li class="menu"><a href="#" class="text">Danh sách đã đăng kí</a></li>
<li class="menu"><a href="#" class="text">Đăng kí</a></li>
</ul>
<h3><a href="#">Đăng ký đầu tư ngoài danh mục đang mời</a></h3>
<ul>
<li class="menu"><a href="#" class="text">Danh sách đã đăng kí</a></li>
<li class="menu"><a href="#" class="text">Đăng kí</a></li>
</ul>
<h3><a href="#">Đăng ký cho vay ngoài danh mục đang mời</a></h3>
<ul>
<li class="menu"><a href="#" class="text">Danh sách đã đăng kí</a></li>
<li class="menu"><a href="#" class="text">Đăng kí</a></li>
</ul>
<h3><a href="#">Tìm đối tác</a></h3>
<ul>
<li class="menu"><a href="#" class="text">Danh sách đã đăng kí</a></li>
<li class="menu"><a href="#" class="text">Đăng kí</a></li>
</ul>
</div>
<script type="text/javascript">
$(function () {
$("#accordion1").accordion({
autoHeight :false,
animated :'easeOutBounce',
active :1000,
navigation :true,
collapsible:true
});
});
</script>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/tim_kiem_co_hoi_khac.php
|
Hack
|
gpl3
| 1,601
|
<div class="top_menu">
<div class="demo-container">
<div class="blue">
<ul id="mega-menu-4" class="mega-menu">
<li><a href="index.php">Trang chủ</a></li>
<li><a href="#">Giới thiệu</a>
<ul>
<li><a href="#">Giới thiệu về IDJ Group</a></li>
<li><a href="#">Dịch vụ của IDJ Connection</a></li>
</ul>
</li>
<li><a href="#">Cách giao dịch qua IDJ</a>
<ul>
<li><a href="#">Bán, mời đầu tư, vay vốn, tìm đối tác</a></li>
<li><a href="#">Mua, đầu tư, cho vay, đối tác, thuê</a></li>
<li><a href="#">Cho thuê tài sản</a></li>
</ul>
</li>
<li><a href="#">IDJ tuyển dụng</a></li>
<li><a href="#">Tin tức</a>
<ul>
<li><a href="#">Tin tức từ IDJ</a></li>
<li><a href="#">Báo chí viết về IDJ</a></li>
<li><a href="#">Thông tin cho kiều bào</a></li>
</ul>
</li>
<li><a href="#">Liên hệ</a></li>
<li><a href="#">English</a></li>
</ul>
<script type="text/javascript">
$('#mega-menu-4').dcMegaMenu({
rowItems:'3',
speed :'fast',
effect :'fade'
});
</script>
</div>
</div>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/top_menu.php
|
Hack
|
gpl3
| 1,708
|
<div class="elements">
<h3 class="ui-widget-header widgets">
<div class="title">Quảng cáo</div>
</h3>
<div class="quang_cao">
<img src="../upload/images/quang_cao_01.jpg" />
<img src="../upload/images/quang_cao_02.gif" />
<img src="../upload/images/quang_cao_03.gif" />
<img src="../upload/images/quang_cao_04.gif" />
</div>
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/quang_cao.php
|
Hack
|
gpl3
| 400
|
<div class="footer">
<b>CÔNG TY ĐẦU TƯ VÀ PHÁT TRIỂN ĐÔ THỊ QUỐC TẾ IDJ</b><br />
<b>Tp.Hà Nội:</b> Tầng 16 Charmvit Tower, Số 117 Trần Duy Hưng, Cầu Giấy, Hà Nội<br />
Điện thoại: (84-4) 3555.8866 * Fax: (84-4) 3555.8669<br />
<b>Tp.Hồ Chí Minh:</b> Lầu 1, Tòa nhà Mỹ Vinh, 250 Nguyễn Thị Minh Khai, Phường 6, Quận 3, HCM<br />
Điện thoại: (84-8) 3933.0589 Fax: (84-8) 6291.1557
</div>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/widgets/footer.php
|
Hack
|
gpl3
| 510
|
<?php
require_once 'database.php';
require_once '../DTO/DOANHNGHIEP_DTO.php';
class xl_doanh_nghiep extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from doanh_nghiep limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai($vi_tri, $so_luong, $ma_loai, $ma_lhkd)
{
//$ma_loai tuong ung voi ma loai phieu trong table loai_phieu
//$ma_lhkd trong table loai_hinh_kinh_doanh
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "SELECT dn . *, lhkd.ten_loai
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = '$ma_loai'
AND lhkd.ma = '$ma_lhkd'
LIMIT $vi_tri, $so_luong ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai_all($vi_tri, $so_luong, $ma_loai)
{
//$ma_loai tuong ung voi ma loai phieu trong table loai_phieu
//$ma_lhkd trong table loai_hinh_kinh_doanh
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "SELECT dn . *
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = '$ma_loai'
LIMIT $vi_tri, $so_luong ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from doanh_nghiep";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_theo_loai($ma_loai, $ma_lhkd)
{
$sql = "SELECT count(dn.ma)
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = '$ma_loai'
AND lhkd.ma = '$ma_lhkd' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from doanh_nghiep where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function kt_email($email)
{
$sql = "select * from doanh_nghiep where email = '$email'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from doanh_nghiep where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(DOANHNGHIEP_DTO $info)
{
$info->ten_dn = stripslashes($info->ten_dn);
$info->ten_dn = addslashes($info->ten_dn);
$info->dia_chi = stripslashes($info->dia_chi);
$info->dia_chi = addslashes($info->dia_chi);
$info->dien_thoai = stripslashes($info->dien_thoai);
$info->dien_thoai = addslashes($info->dien_thoai);
$info->email = stripslashes($info->email);
$info->email = addslashes($info->email);
$info->website = stripslashes($info->website);
$info->website = addslashes($info->website);
$info->ten_giam_doc = stripslashes($info->ten_giam_doc);
$info->ten_giam_doc = addslashes($info->ten_giam_doc);
$info->ma_so_thue = stripslashes($info->ma_so_thue);
$info->ma_so_thue = addslashes($info->ma_so_thue);
$info->gioi_thieu = stripslashes($info->gioi_thieu);
$info->gioi_thieu = addslashes($info->gioi_thieu);
$sql = "INSERT INTO doanh_nghiep ( ten_dn , dia_chi , dien_thoai , ma_so_thue , email , website , gioi_thieu , trang_thai , loai_hinh_dn , tinh_trang_dn , gia , thong_tin_rieng , dia_phuong_quan_tam )
VALUES (
'$info->ten_dn',
'$info->dia_chi',
'$info->dien_thoai',
'$info->ma_so_thue',
'$info->email',
'$info->website',
'$info->gioi_thieu',
'$info->trang_thai',
'$info->loai_hinh_dn',
'$info->tinh_trang_dn',
'$info->gia',
'$info->thong_tin_rieng',
'$info->dia_phuong_quan_tam'
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql ="UPDATE doanh_nghiep SET ho_ten= '$ho_ten', ngay_sinh= '$ngay_sinh', gioi_tinh= '$gioi_tinh', dia_chi= '$dia_chi', dien_thoai= '$dien_thoai', email= '$email', vi_tri_ung_tuyen= '$vi_tri_ung_tuyen', tu_gioi_thieu= '$tu_gioi_thieu', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from doanh_nghiep where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $dien_thoai like %tu_khoa% or $email like %tu_khoa% or $vi_tri_ung_tuyen like %tu_khoa% or $tu_gioi_thieu like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_doanh_nghiep.php
|
PHP
|
gpl3
| 6,387
|
<?php
require_once("database.php");
class xl_hoa_don extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from hoa_don limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from hoa_don";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_theo_ngay($ngay)
{
$from = date("$ngay 0:0:0");
$to = date("$ngay 23:59:59");
$sql = "select count(*) from hoa_don where '$from' <= ngay_tao and ngay_tao <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from hoa_don where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xem_code($code)
{
$code = stripslashes($code);
$code = addslashes($code);
$sql = "select * from hoa_don where code = '$code'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from hoa_don where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($code,$ho_ten, $gioi_tinh, $ngay_sinh, $dia_chi, $email, $dien_thoai, $ngay_tao, $trang_thai, $ghi_chu, $tong_tien, $ho_ten_nguoi_nhan, $dia_chi_nguoi_nhan, $dien_thoai_nguoi_nhan, $ma_cuoc_phi_van_chuyen, $ma_phuong_thuc_thanh_toan)
{
$code = stripslashes($code);
$code = addslashes($code);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$email = stripslashes($email);
$email = addslashes($email);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$ghi_chu = stripslashes($ghi_chu);
$ghi_chu = addslashes($ghi_chu);
$tong_tien = intval($tong_tien);
$ho_ten_nguoi_nhan = stripslashes($ho_ten_nguoi_nhan);
$ho_ten_nguoi_nhan = addslashes($ho_ten_nguoi_nhan);
$dia_chi_nguoi_nhan = stripslashes($dia_chi_nguoi_nhan);
$dia_chi_nguoi_nhan = addslashes($dia_chi_nguoi_nhan);
$dien_thoai_nguoi_nhan = stripslashes($dien_thoai_nguoi_nhan);
$dien_thoai_nguoi_nhan = addslashes($dien_thoai_nguoi_nhan);
$ma_cuoc_phi_van_chuyen = stripslashes($ma_cuoc_phi_van_chuyen);
$ma_cuoc_phi_van_chuyen = addslashes($ma_cuoc_phi_van_chuyen);
$ma_phuong_thuc_thanh_toan = stripslashes($ma_phuong_thuc_thanh_toan);
$ma_phuong_thuc_thanh_toan = addslashes($ma_phuong_thuc_thanh_toan);
$sql = "INSERT INTO hoa_don(code,ho_ten,gioi_tinh,ngay_sinh,dia_chi,email,dien_thoai,ngay_tao,trang_thai,ghi_chu,tong_tien,ho_ten_nguoi_nhan,dia_chi_nguoi_nhan,dien_thoai_nguoi_nhan,ma_cuoc_phi_van_chuyen,ma_phuong_thuc_thanh_toan) VALUES ('$code','$ho_ten','$gioi_tinh','$ngay_sinh','$dia_chi','$email','$dien_thoai','$ngay_tao','$trang_thai','$ghi_chu','$tong_tien','$ho_ten_nguoi_nhan','$dia_chi_nguoi_nhan','$dien_thoai_nguoi_nhan','$ma_cuoc_phi_van_chuyen','$ma_phuong_thuc_thanh_toan')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma,$code,$ho_ten, $gioi_tinh, $ngay_sinh, $dia_chi, $email, $dien_thoai, $ngay_tao, $trang_thai, $ghi_chu, $tong_tien, $ho_ten_nguoi_nhan, $dia_chi_nguoi_nhan, $dien_thoai_nguoi_nhan, $ma_cuoc_phi_van_chuyen, $ma_phuong_thuc_thanh_toan)
{
$ma = intval($ma);
$code = stripslashes($code);
$code = addslashes($code);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$email = stripslashes($email);
$email = addslashes($email);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$ghi_chu = stripslashes($ghi_chu);
$ghi_chu = addslashes($ghi_chu);
$tong_tien = intval($tong_tien);
$ho_ten_nguoi_nhan = stripslashes($ho_ten_nguoi_nhan);
$ho_ten_nguoi_nhan = addslashes($ho_ten_nguoi_nhan);
$dia_chi_nguoi_nhan = stripslashes($dia_chi_nguoi_nhan);
$dia_chi_nguoi_nhan = addslashes($dia_chi_nguoi_nhan);
$dien_thoai_nguoi_nhan = stripslashes($dien_thoai_nguoi_nhan);
$dien_thoai_nguoi_nhan = addslashes($dien_thoai_nguoi_nhan);
$ma_cuoc_phi_van_chuyen = stripslashes($ma_cuoc_phi_van_chuyen);
$ma_cuoc_phi_van_chuyen = addslashes($ma_cuoc_phi_van_chuyen);
$ma_phuong_thuc_thanh_toan = stripslashes($ma_phuong_thuc_thanh_toan);
$ma_phuong_thuc_thanh_toan = addslashes($ma_phuong_thuc_thanh_toan);
$sql ="UPDATE hoa_don SET code= '$code', ho_ten= '$ho_ten', gioi_tinh= '$gioi_tinh', ngay_sinh= '$ngay_sinh', dia_chi= '$dia_chi', email= '$email', dien_thoai= '$dien_thoai', ngay_tao= '$ngay_tao', trang_thai= '$trang_thai', ghi_chu= '$ghi_chu', tong_tien= '$tong_tien', ho_ten_nguoi_nhan= '$ho_ten_nguoi_nhan', dia_chi_nguoi_nhan= '$dia_chi_nguoi_nhan', dien_thoai_nguoi_nhan= '$dien_thoai_nguoi_nhan', ma_cuoc_phi_van_chuyen= '$ma_cuoc_phi_van_chuyen', ma_phuong_thuc_thanh_toan= '$ma_phuong_thuc_thanh_toan' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_tong_tien($ma, $tong_tien)
{
$ma = intval($ma);
$tong_tien = intval($tong_tien);
$sql ="UPDATE hoa_don SET tong_tien= '$tong_tien' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from hoa_don where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $email like %tu_khoa% or $dien_thoai like %tu_khoa% or $ghi_chu like %tu_khoa% or $ho_ten_nguoi_nhan like %tu_khoa% or $dia_chi_nguoi_nhan like %tu_khoa% or $dien_thoai_nguoi_nhan like %tu_khoa% or $ma_cuoc_phi_van_chuyen like %tu_khoa% or $ma_phuong_thuc_thanh_toan like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_hoa_don.php
|
PHP
|
gpl3
| 5,855
|
<?php
require_once("database.php");
require_once '../DTO/THONGTINVON_DTO.php';
class xl_thong_tin_von extends database
{
function danh_sach_theo_loai( $vi_tri, $so_luong, $ma_loai, $ma_lhkd )
{
$sql = "SELECT dn . *, ttv.ma as ma_von, ttv.von_huy_dong
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp,thong_tin_von ttv
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND pdk.ma_von = ttv.ma
AND lp.ma = '$ma_loai'
AND lhkd.ma = '$ma_lhkd'
LIMIT $vi_tri, $so_luong ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai_all( $vi_tri, $so_luong, $ma_loai )
{
$sql = "SELECT dn . *, ttv.ma as ma_von, ttv.von_huy_dong
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp,thong_tin_von ttv
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND pdk.ma_von = ttv.ma
AND lp.ma = '$ma_loai'
LIMIT $vi_tri, $so_luong ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function xem_chi_tiet($ma)
{
$ma = intval($ma);
//$sql = "select * from thong_tin_von where ma = '$ma'";
$sql = "SELECT dn . *, ttv.ma as ma_von, ttv.von_huy_dong
FROM doanh_nghiep dn, loai_hinh_kinh_doanh lhkd, phieu_dang_ky pdk, loai_phieu lp,thong_tin_von ttv
WHERE dn.loai_hinh_dn = lhkd.ma
AND pdk.ma_dn = dn.ma
AND pdk.loai_phieu = lp.ma
AND pdk.ma_von = ttv.ma
AND ttv.ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function danh_sach_tim_kiem($key, $vi_tri, $so_luong)
{
$sql = "select * from thong_tin_von where ten like '%$key%' limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_ban_chay()
{
$sql = "SELECT sp.*, ct.ma_thong_tin_von, sum(ct.so_luong) tong_so_luong
FROM thong_tin_von sp, chi_tiet_hoa_don ct
WHERE sp.ma = ct.ma_thong_tin_von
GROUP BY ct.ma_thong_tin_von
ORDER BY tong_so_luong DESC
LIMIT 0, 10";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_cung_loai($ma, $ma_loai_thong_tin_von)
{
$sql = "select * from thong_tin_von where ma_loai_thong_tin_von = $ma_loai_thong_tin_von and ma != $ma ORDER BY RAND() limit 0, 6";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_thong_tin_von_moi()
{
$sql = "select * from thong_tin_von where thong_tin_von_moi = 1 ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from thong_tin_von limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
//function danh_sach()
//{
// $sql = "select * from thong_tin_von ";
// $this->setQuery($sql);
// return $this->loadAllRow();
//}
function so_luong($ma_loai_thong_tin_von)
{
$sql = "select count(*) from thong_tin_von where ma_loai_thong_tin_von = '$ma_loai_thong_tin_von' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from thong_tin_von where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(ThongTinVonDTO $info)
{
$info->muc_lai_suat = addslashes($info->muc_lai_suat);
$info->muc_lai_suat = intval($info->muc_lai_suat);
$info->thoi_han = addslashes($info->thoi_han);
$info->thoi_han = intval($info->thoi_han);
$info->von_huy_dong = addslashes($info->von_huy_dong);
$info->von_huy_dong = intval($info->von_huy_dong);
$info->tai_khoan_the_chap = addslashes($info->tai_khoan_the_chap);
$info->tai_khoan_the_chap = intval($info->tai_khoan_the_chap);
$sql = "INSERT INTO thong_tin_von VALUES
(
'$info->thoi_han',
'$info->muc_lai_suat',
'$info->von_huy_dong',
'$info->tai_khoan_the_chap',
0
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $ma_loai_thong_tin_von, $mo_ta_tom_tat, $mo_ta_chi_tiet, $don_gia, $hinh, $thong_tin_von_moi, $so_lan_xem, $ngay_tao, $trang_thai)
{
$ma = intval($ma);
$ten = addslashes($ten);
$ma_loai_thong_tin_von = intval($ma_loai_thong_tin_von);
$mo_ta_tom_tat = addslashes($mo_ta_tom_tat);
$mo_ta_chi_tiet = addslashes($mo_ta_chi_tiet);
$don_gia = intval($don_gia);
$hinh = addslashes($hinh);
$so_lan_xem = intval($so_lan_xem);
$sql ="UPDATE thong_tin_von SET ten= '$ten', ma_loai_thong_tin_von= '$ma_loai_thong_tin_von', mo_ta_tom_tat= '$mo_ta_tom_tat', mo_ta_chi_tiet= '$mo_ta_chi_tiet', don_gia= '$don_gia', hinh= '$hinh', thong_tin_von_moi= '$thong_tin_von_moi', so_lan_xem= '$so_lan_xem', ngay_tao= '$ngay_tao', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE thong_tin_von SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_thong_tin_von_moi($ma)
{
$ma = intval($ma);
$sql = "UPDATE thong_tin_von SET thong_tin_von_moi = 1 - thong_tin_von_moi WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from thong_tin_von where $ten like %tu_khoa% or $mo_ta_tom_tat like %tu_khoa% or $mo_ta_chi_tiet like %tu_khoa% or $hinh like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_thong_tin_von.php
|
PHP
|
gpl3
| 6,180
|
<?php
require_once("database.php");
class xl_ho_tro_truc_tuyen extends database
{
function danh_sach($ten, $loai_ho_tro, $vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from ho_tro_truc_tuyen where 1 = 1 ";
if(!empty($ten)) {
$sql .= " and ho_ten like '%$ten%' ";
}
if($loai_ho_tro != -1) {
$sql .= " and loai_ho_tro = '$loai_ho_tro' ";
}
$sql .= " limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong($ten, $loai_ho_tro)
{
$sql = "select count(*) from ho_tro_truc_tuyen where 1 = 1 ";
if(!empty($ten)) {
$sql .= " and ho_ten like '%$ten%' ";
}
if($loai_ho_tro != -1) {
$sql .= " and loai_ho_tro = '$loai_ho_tro' ";
}
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from ho_tro_truc_tuyen where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from ho_tro_truc_tuyen where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ho_ten, $loai_ho_tro, $nick_chat, $trang_thai, $thu_tu_hien_thi)
{
$ho_ten = addslashes($ho_ten);
$nick_chat = addslashes($nick_chat);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql = "INSERT INTO ho_tro_truc_tuyen(ho_ten,loai_ho_tro,nick_chat,trang_thai,thu_tu_hien_thi) VALUES ('$ho_ten','$loai_ho_tro','$nick_chat','$trang_thai','$thu_tu_hien_thi')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $loai_ho_tro, $nick_chat, $trang_thai, $thu_tu_hien_thi)
{
$ma = intval($ma);
$ho_ten = addslashes($ho_ten);
$nick_chat = addslashes($nick_chat);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql = "UPDATE ho_tro_truc_tuyen SET ho_ten= '$ho_ten', loai_ho_tro= '$loai_ho_tro', nick_chat= '$nick_chat', trang_thai= '$trang_thai', thu_tu_hien_thi= '$thu_tu_hien_thi' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE ho_tro_truc_tuyen SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_loai_ho_tro($ma)
{
$ma = intval($ma);
$sql = "UPDATE ho_tro_truc_tuyen SET loai_ho_tro = 1 - loai_ho_tro WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from ho_tro_truc_tuyen where $ho_ten like %tu_khoa% or $nick_chat like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_ho_tro_truc_tuyen.php
|
PHP
|
gpl3
| 2,795
|
<?php
require_once 'database.php';
require_once '../DTO/KHACHHANG_DTO.php';
class xl_khach_hang extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from khach_hang limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from khach_hang";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from khach_hang where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function kt_email($email)
{
$sql = "select * from khach_hang where email = '$email'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from khach_hang where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them_giaodien(KHACHHANG_DTO $info)
{
$info->ho_ten = stripslashes($info->ho_ten);
$info->ho_ten = addslashes($info->ho_ten);
$info->dien_thoai = stripslashes($info->dien_thoai);
$info->dien_thoai = addslashes($info->dien_thoai);
$info->email = stripslashes($info->email);
$info->email = addslashes($info->email);
$info->chuc_vu = stripslashes($info->chuc_vu);
$info->chuc_vu = addslashes($info->chuc_vu);
$sql = "INSERT INTO khach_hang(ho_ten,dien_thoai,email,chuc_vu ) VALUES (
'$info->ho_ten',
'$info->dien_thoai',
'$info->email',
'$info->chuc_vu'
)";
$this->setQuery($sql);
return $this->query();
}
function them(KHACHHANG_DTO $info)
{
$info->ho_ten = stripslashes($info->ho_ten);
$info->ho_ten = addslashes($info->ho_ten);
$info->dia_chi = stripslashes($info->dia_chi);
$info->dia_chi = addslashes($info->dia_chi);
$info->dien_thoai = stripslashes($info->dien_thoai);
$info->dien_thoai = addslashes($info->dien_thoai);
$info->email = stripslashes($info->email);
$info->email = addslashes($info->email);
$info->chuc_vu = stripslashes($info->chuc_vu);
$info->chuc_vu = addslashes($info->chuc_vu);
$info->thong_tin_them = stripslashes($info->thong_tin_them);
$info->thong_tin_them = addslashes($info->thong_tin_them);
$sql = "INSERT INTO khach_hang VALUES (
'$info->ho_ten',
'$info->ngay_sinh',
'$info->dia_chi',
'$info->dien_thoai',
'$info->email',
'$info->chuc_vu',
'$info->thong_tin_them',
'$info->trang_thai',
'$info->ma_phieu_dk'
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql ="UPDATE khach_hang SET ho_ten= '$ho_ten', ngay_sinh= '$ngay_sinh', gioi_tinh= '$gioi_tinh', dia_chi= '$dia_chi', dien_thoai= '$dien_thoai', email= '$email', vi_tri_ung_tuyen= '$vi_tri_ung_tuyen', tu_gioi_thieu= '$tu_gioi_thieu', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from khach_hang where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $dien_thoai like %tu_khoa% or $email like %tu_khoa% or $vi_tri_ung_tuyen like %tu_khoa% or $tu_gioi_thieu like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_khach_hang.php
|
PHP
|
gpl3
| 4,834
|
<?php
require_once("database.php");
class xl_cau_hinh extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from cau_hinh limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from cau_hinh";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($tu_khoa)
{
$tu_khoa = stripslashes($tu_khoa);
$tu_khoa = addslashes($tu_khoa);
$sql = "select * from cau_hinh where tu_khoa = '$tu_khoa'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($tu_khoa)
{
$tu_khoa = stripslashes($tu_khoa);
$tu_khoa = addslashes($tu_khoa);
$sql = "delete from cau_hinh where tu_khoa = '$tu_khoa'";
$this->setQuery($sql);
return $this->query();
}
function them($noi_dung)
{
$noi_dung = stripslashes($noi_dung);
$noi_dung = addslashes($noi_dung);
$sql = "INSERT INTO cau_hinh(noi_dung) VALUES ('$noi_dung')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($tu_khoa, $noi_dung)
{
$tu_khoa = stripslashes($tu_khoa);
$tu_khoa = addslashes($tu_khoa);
$noi_dung = stripslashes($noi_dung);
$noi_dung = addslashes($noi_dung);
$sql ="UPDATE cau_hinh SET noi_dung= '$noi_dung' WHERE tu_khoa = '$tu_khoa'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from cau_hinh where $noi_dung like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_cau_hinh.php
|
PHP
|
gpl3
| 1,606
|
<?php
require_once("database.php");
class xl_loai_san_pham extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from loai_san_pham limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_all()
{
$sql = "select * from loai_san_pham ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from loai_san_pham";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from loai_san_pham where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xem_ten_loai_cha($ma)
{
$ma = intval($ma);
$sql = "select ten from loai_san_pham where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from loai_san_pham where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ten, $mo_ta, $ma_loai_cha, $thu_tu_hien_thi)
{
$ten = addslashes($ten);
$mo_ta = addslashes($mo_ta);
$ma_loai_cha = intval($ma_loai_cha);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql = "INSERT INTO loai_san_pham(ten,mo_ta,ma_loai_cha,thu_tu_hien_thi) VALUES ('$ten','$mo_ta','$ma_loai_cha','$thu_tu_hien_thi')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $mo_ta, $ma_loai_cha, $thu_tu_hien_thi)
{
$ma = intval($ma);
$ten = addslashes($ten);
$mo_ta = addslashes($mo_ta);
$ma_loai_cha = intval($ma_loai_cha);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql ="UPDATE loai_san_pham SET ten= '$ten', mo_ta= '$mo_ta', ma_loai_cha= '$ma_loai_cha', thu_tu_hien_thi= '$thu_tu_hien_thi' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from loai_san_pham where $ten like %tu_khoa% or $mo_ta like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_san_pham.php
|
PHP
|
gpl3
| 2,172
|
<?php
require_once '../config.php';
error_reporting(1);
class database {
var $_sql = '';
var $_connection = '';
var $_cursor = null;
function database()
{
//$this->_connection = @mysql_connect( 'localhost', 'root', '');
$this->_connection = @mysql_connect( DB_HOST,DB_USER ,DB_PASS );
if (!$this->_connection )
{
die( "Khong the ket noi MySQL" );
}
mysql_query('SET NAMES UTF8', $this->_connection);
$db = DB_NAME;
if ($db != '' && !mysql_select_db( $db, $this->_connection ))
{
die ( "Khong the mo CSDL $db: ".mysql_error() );
}
}
function get_error()
{
return mysql_error();
}
function setQuery( $sql)
{
$this->_sql = $sql;
}
function query()
{
$this->_cursor = mysql_query( $this->_sql, $this->_connection );
return $this->_cursor;
}
/* This method loads the first row returned by the query.*/
function loadRow() {
if (!($cur = $this->query())) {
return null;
}
$ret = null;
if ($row = mysql_fetch_assoc( $cur )) {
$ret = $row;
}
mysql_free_result( $cur );
return $ret;
}
/**
* This method loads the first field of the first row returned by the query.
*
* @return The value returned in the query or null if the query failed.
*/
function loadResult() {
if (!($cur = $this->query())) {
return null;
}
$ret = null;
if ($row = mysql_fetch_row( $cur )) {
$ret = $row[0];
}
mysql_free_result( $cur );
return $ret;
}
/**
* Load a list of database rows
*/
function loadAllRow() {
if (!($cur = $this->query())) {
return null;
}
$array = array();
while ($row = mysql_fetch_assoc( $cur ))
{
// ketqua = mang ket qua
$array[] = $row;
}
mysql_free_result( $cur );
return $array;
}
function disconnect()
{
mysql_close( $this->_connection );
}
#Tra ve id sau khi insert xong. Chi su dung cho bang co khoa chinh la kieu int va tu dong tang.
function getInsert_id() {
return mysql_insert_id();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/database.php
|
PHP
|
gpl3
| 2,059
|
<?php
require_once("database.php");
class xl_loai_du_an extends database
{
function danh_sach()
{
$sql = "select * from loai_du_an";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai($vi_tri, $so_luong, $ma_phieu, $ma_lda)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "SELECT da . *
FROM du_an da, loai_du_an lda, phieu_dang_ky pdk, loai_phieu lp
WHERE da.loai_dua_an = lda.ma
AND pdk.ma_dn = da.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = $ma_phieu
AND lda.ma = $ma_lda
LIMIT $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from du_an";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from du_an where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from du_an where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(DUAN_DTO $info)
{
$info->ten_du_an = stripslashes($info->ten_du_an);
$info->ten_du_an = addslashes($info->ten_du_an);
$info->dia_chi = stripslashes($info->dia_chi);
$info->dia_chi = addslashes($info->dia_chi);
$info->von_dau_tu = stripslashes($info->von_dau_tu);
$info->von_dau_tu = addslashes($info->von_dau_tu);
$info->loai_dua_an = stripslashes($info->loai_dua_an);
$info->loai_dua_an = addslashes($info->loai_dua_an);
$info->thong_tin_chi_tiet = stripslashes($info->thong_tin_chi_tiet);
$info->thong_tin_chi_tiet = addslashes($info->thong_tin_chi_tiet);
$sql = "INSERT INTO du_an VALUES ( '$info->ten_du_an',
'$info->dia_chi ',
'$info->von_dau_tu' ,
'$info->loai_dua_an' ,
'$info->thong_tin_chi_tiet' ,
'$info->tinh_trang_cap_phep' ,
'$info->ngay_cap_phep ' ,
'$info->thoi_gian_du_kien_cp' ,
0
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql ="UPDATE du_an SET ho_ten= '$ho_ten', ngay_sinh= '$ngay_sinh', gioi_tinh= '$gioi_tinh', dia_chi= '$dia_chi', dien_thoai= '$dien_thoai', email= '$email', vi_tri_ung_tuyen= '$vi_tri_ung_tuyen', tu_gioi_thieu= '$tu_gioi_thieu', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from du_an where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $dien_thoai like %tu_khoa% or $email like %tu_khoa% or $vi_tri_ung_tuyen like %tu_khoa% or $tu_gioi_thieu like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_du_an.php
|
PHP
|
gpl3
| 3,967
|
<?php
require_once("database.php");
require_once '../DTO/TAISAN_DTO.php';
class xl_loai_tai_san extends database
{
function danh_sach_theo_loai( $vi_tri, $so_luong,$ma_loai_tai_san)
{
$sql = "SELECT ts . *
FROM tai_san ts, loai_tai_san lts
WHERE ts.loai_tai_san = lts.ma
AND lts.ma= '$ma_loai_tai_san'
LIMIT 0 , 30";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_tim_kiem($key, $vi_tri, $so_luong)
{
$sql = "select * from tai_san where ten like '%$key%' limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_ban_chay()
{
$sql = "SELECT sp.*, ct.ma_tai_san, sum(ct.so_luong) tong_so_luong
FROM tai_san sp, chi_tiet_hoa_don ct
WHERE sp.ma = ct.ma_tai_san
GROUP BY ct.ma_tai_san
ORDER BY tong_so_luong DESC
LIMIT 0, 10";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_cung_loai($ma, $ma_loai_tai_san)
{
$sql = "select * from tai_san where ma_loai_tai_san = $ma_loai_tai_san and ma != $ma ORDER BY RAND() limit 0, 6";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_tai_san_moi()
{
$sql = "select * from tai_san where tai_san_moi = 1 ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from tai_san limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_all()
{
$sql = "select * from loai_tai_san ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong($ma_loai_tai_san)
{
$sql = "select count(*) from tai_san where ma_loai_tai_san = '$ma_loai_tai_san' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from tai_san where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from tai_san where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(TAISAN_DTO $info)
{
$info->ten_tai_san = addslashes($info->ten_tai_san);
$info->ten_tai_san = intval($info->ten_tai_san);
$info->dia_chi = addslashes($info->dia_chi);
$info->dia_chi = intval($info->dia_chi);
$info->gia = addslashes($info->gia);
$info->gia = intval($info->gia);
$info->thong_tin_chi_tiet = addslashes($info->thong_tin_chi_tiet);
$info->thong_tin_chi_tiet = intval($info->thong_tin_chi_tiet);
$sql = "INSERT INTO tai_san VALUES
(
'$info->ten_tai_san',
'$info->dia_chi',
'$info->gia',
'$info->loai_tai_san',
'$info->thong_tin_chi_tiet',
0
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $ma_loai_tai_san, $mo_ta_tom_tat, $mo_ta_chi_tiet, $don_gia, $hinh, $tai_san_moi, $so_lan_xem, $ngay_tao, $trang_thai)
{
$ma = intval($ma);
$ten = addslashes($ten);
$ma_loai_tai_san = intval($ma_loai_tai_san);
$mo_ta_tom_tat = addslashes($mo_ta_tom_tat);
$mo_ta_chi_tiet = addslashes($mo_ta_chi_tiet);
$don_gia = intval($don_gia);
$hinh = addslashes($hinh);
$so_lan_xem = intval($so_lan_xem);
$sql ="UPDATE tai_san SET ten= '$ten', ma_loai_tai_san= '$ma_loai_tai_san', mo_ta_tom_tat= '$mo_ta_tom_tat', mo_ta_chi_tiet= '$mo_ta_chi_tiet', don_gia= '$don_gia', hinh= '$hinh', tai_san_moi= '$tai_san_moi', so_lan_xem= '$so_lan_xem', ngay_tao= '$ngay_tao', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE tai_san SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_tai_san_moi($ma)
{
$ma = intval($ma);
$sql = "UPDATE tai_san SET tai_san_moi = 1 - tai_san_moi WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from tai_san where $ten like %tu_khoa% or $mo_ta_tom_tat like %tu_khoa% or $mo_ta_chi_tiet like %tu_khoa% or $hinh like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_tai_san.php
|
PHP
|
gpl3
| 4,738
|
<?php
class pager
{
/***********************************************************************************
* Ham int findStart (int limit)
* Tra ve dong bat dau cua trang duoc chon dua tren trang lay duoc va bien limit
***********************************************************************************/
function tim_vi_tri_bat_dau($so_mau_tin_tren_mot_trang)
{
if ((!isset($_GET['page'])) || ($_GET['page'] == "1"))
{
$start = 0;
$_GET['page'] = 1;
}
else
{
$start = ($_GET['page']-1) * $so_mau_tin_tren_mot_trang;
}
return $start;
}
/***********************************************************************************
* Ham int findPages (int count, int limit)
* Tra ve so luong trang can thiet dua tren tong so dong co trong table va limit
***********************************************************************************/
function tim_tong_so_trang($tong_so_mau_tin, $so_mau_tin_tren_mot_trang)
{
return ceil($tong_so_mau_tin / $so_mau_tin_tren_mot_trang);
}
function in_bo_nut($tong_so_trang)
{
if (empty($_GET['page'])) $curpage = 1;
else $curpage = $_GET['page'];
$page_list = "";
$query_string = $this->deleteParam($_SERVER['QUERY_STRING'], 'page');
/* In trang dau tien va nhung link toi trang truoc neu can */
if (($curpage != 1) && ($curpage))
{
echo " <a class=\"number\" href=\"".$_SERVER['PHP_SELF']."?".$query_string."page=1\" title=\"Trang đầu\"><<</a> ";
} else {
echo " <a class=\"number disable\" title=\"Trang đầu\"><<</a> ";
}
if (($curpage-1) > 0)
{
echo "<a class=\"number\" href=\"".$_SERVER['PHP_SELF']."?".$query_string."page=".($curpage-1)."\" title=\"Về trang trước\"><</a> ";
} else {
echo "<a class=\"number disable\" title=\"Về trang trước\"><</a> ";
}
/* In ra danh sach cac trang va lam cho trang hien tai dam hon va mat link o chan*/
$vt_dau = max($curpage - 3, 1);
$vt_sau = min($curpage + 3, $tong_so_trang);
if ($vt_dau > 1) echo '... ';
for ($i=$vt_dau; $i<=$vt_sau; $i++)
{
if ($i == $curpage)
{
echo "<a class=\"number current\"><b>".$i."</b></a>";
}
else
{
echo "<a class=\"number\" href=\"".$_SERVER['PHP_SELF']."?".$query_string."page=".$i."\" title=\"Trang ".$i."\">".$i."</a>";
}
echo " ";
}
if ($vt_sau < $tong_so_trang) echo '... ';
/* In linh cua trang tiep theo va trang cuoi cung neu can*/
if (($curpage+1) <= $tong_so_trang)
{
echo "<a class=\"number\" href=\"".$_SERVER['PHP_SELF']."?".$query_string."page=".($curpage+1)."\" title=\"Đến trang sau\">></a> ";
} else {
echo "<a class=\"number disable\" title=\"Đến trang sau\">></a> ";
}
if (($curpage != $tong_so_trang) && ($tong_so_trang != 0))
{
echo "<a class=\"number\" href=\"".$_SERVER['PHP_SELF']."?".$query_string."page=".$tong_so_trang."\" title=\"Trang cuối\">>></a> ";
} else {
echo "<a class=\"number disable\" title=\"Trang cuối\">>></a> ";
}
}
/***********************************************************************************
* Ham: string pageList (int curpage, int pages)
* Tra ve danh sach trang theo dinh dang "Trang dau tien < [cac trang] > Trang cuoi cung"
***********************************************************************************/
private function deleteParam($query_string, $param)
{
//////xử lý giữ tham số trên url
if($query_string!='')
{
$query_string = preg_replace('/(^'.$param.'=[\da-zA-Z]*&)|(&?'.$param.'=[\da-zA-Z]*)|/', '', $query_string);
if($query_string)
$query_string = "$query_string&";
}
//////xử lý giữ tham số trên url
return $query_string;
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/pager.php
|
PHP
|
gpl3
| 3,824
|
<?php
require_once("database.php");
class xl_tuyen_dung extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from tuyen_dung limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from tuyen_dung";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from tuyen_dung where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function kt_email($email)
{
$sql = "select * from tuyen_dung where email = '$email'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from tuyen_dung where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql = "INSERT INTO tuyen_dung(ho_ten,ngay_sinh,gioi_tinh,dia_chi,dien_thoai,email,vi_tri_ung_tuyen,tu_gioi_thieu,trang_thai) VALUES ('$ho_ten','$ngay_sinh','$gioi_tinh','$dia_chi','$dien_thoai','$email','$vi_tri_ung_tuyen','$tu_gioi_thieu','$trang_thai')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql ="UPDATE tuyen_dung SET ho_ten= '$ho_ten', ngay_sinh= '$ngay_sinh', gioi_tinh= '$gioi_tinh', dia_chi= '$dia_chi', dien_thoai= '$dien_thoai', email= '$email', vi_tri_ung_tuyen= '$vi_tri_ung_tuyen', tu_gioi_thieu= '$tu_gioi_thieu', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from tuyen_dung where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $dien_thoai like %tu_khoa% or $email like %tu_khoa% or $vi_tri_ung_tuyen like %tu_khoa% or $tu_gioi_thieu like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_tuyen_dung.php
|
PHP
|
gpl3
| 3,203
|
<?php
require_once("database.php");
require_once '../DTO/TAISAN_DTO.php';
class xl_tai_san extends database
{
function danh_sach_theo_loai( $vi_tri, $so_luong,$ma_loai_tai_san)
{
$sql = "SELECT ts . *
FROM tai_san ts, loai_tai_san lts
WHERE ts.loai_tai_san = lts.ma
AND lts.ma= '$ma_loai_tai_san'
LIMIT 0 , 30";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_tim_kiem($key, $vi_tri, $so_luong)
{
$sql = "select * from tai_san where ten like '%$key%' limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_ban_chay()
{
$sql = "SELECT sp.*, ct.ma_tai_san, sum(ct.so_luong) tong_so_luong
FROM tai_san sp, chi_tiet_hoa_don ct
WHERE sp.ma = ct.ma_tai_san
GROUP BY ct.ma_tai_san
ORDER BY tong_so_luong DESC
LIMIT 0, 10";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_cung_loai($ma, $ma_loai_tai_san)
{
$sql = "select * from tai_san where ma_loai_tai_san = $ma_loai_tai_san and ma != $ma ORDER BY RAND() limit 0, 6";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_tai_san_moi()
{
$sql = "select * from tai_san where tai_san_moi = 1 ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from tai_san limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_all()
{
$sql = "select * from tai_san ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong($ma_loai_tai_san)
{
$sql = "select count(*) from tai_san where ma_loai_tai_san = '$ma_loai_tai_san' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from tai_san where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from tai_san where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(TAISAN_DTO $info)
{
$info->ten_tai_san = addslashes($info->ten_tai_san);
$info->ten_tai_san = intval($info->ten_tai_san);
$info->dia_chi = addslashes($info->dia_chi);
$info->dia_chi = intval($info->dia_chi);
$info->gia = addslashes($info->gia);
$info->gia = intval($info->gia);
$info->thong_tin_chi_tiet = addslashes($info->thong_tin_chi_tiet);
$info->thong_tin_chi_tiet = intval($info->thong_tin_chi_tiet);
$sql = "INSERT INTO tai_san VALUES
(
'$info->ten_tai_san',
'$info->dia_chi',
'$info->gia',
'$info->loai_tai_san',
'$info->thong_tin_chi_tiet',
0
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $ma_loai_tai_san, $mo_ta_tom_tat, $mo_ta_chi_tiet, $don_gia, $hinh, $tai_san_moi, $so_lan_xem, $ngay_tao, $trang_thai)
{
$ma = intval($ma);
$ten = addslashes($ten);
$ma_loai_tai_san = intval($ma_loai_tai_san);
$mo_ta_tom_tat = addslashes($mo_ta_tom_tat);
$mo_ta_chi_tiet = addslashes($mo_ta_chi_tiet);
$don_gia = intval($don_gia);
$hinh = addslashes($hinh);
$so_lan_xem = intval($so_lan_xem);
$sql ="UPDATE tai_san SET ten= '$ten', ma_loai_tai_san= '$ma_loai_tai_san', mo_ta_tom_tat= '$mo_ta_tom_tat', mo_ta_chi_tiet= '$mo_ta_chi_tiet', don_gia= '$don_gia', hinh= '$hinh', tai_san_moi= '$tai_san_moi', so_lan_xem= '$so_lan_xem', ngay_tao= '$ngay_tao', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE tai_san SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_tai_san_moi($ma)
{
$ma = intval($ma);
$sql = "UPDATE tai_san SET tai_san_moi = 1 - tai_san_moi WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from tai_san where $ten like %tu_khoa% or $mo_ta_tom_tat like %tu_khoa% or $mo_ta_chi_tiet like %tu_khoa% or $hinh like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_tai_san.php
|
PHP
|
gpl3
| 4,728
|
<?php
require_once("database.php");
class xl_chi_tiet_hoa_don extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from chi_tiet_hoa_don limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from chi_tiet_hoa_don";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from chi_tiet_hoa_don where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xem_hoa_don($ma)
{
$ma = intval($ma);
$sql = "select * from chi_tiet_hoa_don where ma_hoa_don = '$ma' ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from chi_tiet_hoa_don where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ma_hoa_don, $ma_san_pham, $ten_san_pham, $so_luong, $don_gia, $thanh_tien)
{
$ma_hoa_don = intval($ma_hoa_don);
$ma_san_pham = intval($ma_san_pham);
$ten_san_pham = stripslashes($ten_san_pham);
$ten_san_pham = addslashes($ten_san_pham);
$so_luong = intval($so_luong);
$don_gia = intval($don_gia);
$thanh_tien = intval($thanh_tien);
$sql = "INSERT INTO chi_tiet_hoa_don(ma_hoa_don,ma_san_pham,ten_san_pham,so_luong,don_gia,thanh_tien) VALUES ('$ma_hoa_don','$ma_san_pham','$ten_san_pham','$so_luong','$don_gia','$thanh_tien')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ma_hoa_don, $ma_san_pham, $ten_san_pham, $so_luong, $don_gia, $thanh_tien)
{
$ma = intval($ma);
$ma_hoa_don = intval($ma_hoa_don);
$ma_san_pham = intval($ma_san_pham);
$ten_san_pham = stripslashes($ten_san_pham);
$ten_san_pham = addslashes($ten_san_pham);
$so_luong = intval($so_luong);
$don_gia = intval($don_gia);
$thanh_tien = intval($thanh_tien);
$sql ="UPDATE chi_tiet_hoa_don SET ma_hoa_don= '$ma_hoa_don', ma_san_pham= '$ma_san_pham', ten_san_pham= '$ten_san_pham', so_luong= '$so_luong', don_gia= '$don_gia', thanh_tien= '$thanh_tien' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from chi_tiet_hoa_don where $ten_san_pham like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_chi_tiet_hoa_don.php
|
PHP
|
gpl3
| 2,463
|
<?php
require_once 'database.php';
require_once '../DTO/DOANHNGHIEP_DTO.php';
class xl_loai_phieu extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from doanh_nghiep limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function lay_ma($string)
{
$string = stripslashes($string);
$string = addslashes($string);
$sql = "select ma from loai_phieu where ten_loai='$string'";
$this->setQuery($sql);
$row = $this->loadRow();
return $row['ma'];
}
}
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_phieu.php
|
PHP
|
gpl3
| 700
|
<?php
require_once("database.php");
class xl_san_pham extends database
{
function danh_sach_theo_loai($ma_loai_san_pham, $vi_tri, $so_luong)
{
$sql = "select * from san_pham where ma_loai_san_pham = '$ma_loai_san_pham' limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_tim_kiem($key, $vi_tri, $so_luong)
{
$sql = "select * from san_pham where ten like '%$key%' limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_ban_chay()
{
$sql = "SELECT sp.*, ct.ma_san_pham, sum(ct.so_luong) tong_so_luong
FROM san_pham sp, chi_tiet_hoa_don ct
WHERE sp.ma = ct.ma_san_pham
GROUP BY ct.ma_san_pham
ORDER BY tong_so_luong DESC
LIMIT 0, 10";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_cung_loai($ma, $ma_loai_san_pham)
{
$sql = "select * from san_pham where ma_loai_san_pham = $ma_loai_san_pham and ma != $ma ORDER BY RAND() limit 0, 6";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_san_pham_moi()
{
$sql = "select * from san_pham where san_pham_moi = 1 ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from san_pham limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_all()
{
$sql = "select * from san_pham ";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong($ma_loai_san_pham)
{
$sql = "select count(*) from san_pham where ma_loai_san_pham = '$ma_loai_san_pham' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from san_pham where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from san_pham where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ten, $ma_loai_san_pham, $mo_ta_tom_tat, $mo_ta_chi_tiet, $don_gia, $hinh, $san_pham_moi, $so_lan_xem, $ngay_tao, $trang_thai)
{
$ten = addslashes($ten);
$ma_loai_san_pham = intval($ma_loai_san_pham);
$mo_ta_tom_tat = addslashes($mo_ta_tom_tat);
$mo_ta_chi_tiet = addslashes($mo_ta_chi_tiet);
$don_gia = intval($don_gia);
$hinh = addslashes($hinh);
$so_lan_xem = intval($so_lan_xem);
$sql = "INSERT INTO san_pham(ten,ma_loai_san_pham,mo_ta_tom_tat,mo_ta_chi_tiet,don_gia,hinh,san_pham_moi,so_lan_xem,ngay_tao,trang_thai) VALUES ('$ten','$ma_loai_san_pham','$mo_ta_tom_tat','$mo_ta_chi_tiet','$don_gia','$hinh','$san_pham_moi','$so_lan_xem','$ngay_tao','$trang_thai')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $ma_loai_san_pham, $mo_ta_tom_tat, $mo_ta_chi_tiet, $don_gia, $hinh, $san_pham_moi, $so_lan_xem, $ngay_tao, $trang_thai)
{
$ma = intval($ma);
$ten = addslashes($ten);
$ma_loai_san_pham = intval($ma_loai_san_pham);
$mo_ta_tom_tat = addslashes($mo_ta_tom_tat);
$mo_ta_chi_tiet = addslashes($mo_ta_chi_tiet);
$don_gia = intval($don_gia);
$hinh = addslashes($hinh);
$so_lan_xem = intval($so_lan_xem);
$sql ="UPDATE san_pham SET ten= '$ten', ma_loai_san_pham= '$ma_loai_san_pham', mo_ta_tom_tat= '$mo_ta_tom_tat', mo_ta_chi_tiet= '$mo_ta_chi_tiet', don_gia= '$don_gia', hinh= '$hinh', san_pham_moi= '$san_pham_moi', so_lan_xem= '$so_lan_xem', ngay_tao= '$ngay_tao', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE san_pham SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_san_pham_moi($ma)
{
$ma = intval($ma);
$sql = "UPDATE san_pham SET san_pham_moi = 1 - san_pham_moi WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from san_pham where $ten like %tu_khoa% or $mo_ta_tom_tat like %tu_khoa% or $mo_ta_chi_tiet like %tu_khoa% or $hinh like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_san_pham.php
|
PHP
|
gpl3
| 4,390
|
<?php
require_once("database.php");
class xl_quan_tri extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from quan_tri limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from quan_tri";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from quan_tri where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function dang_nhap($ten_dang_nhap, $mat_khau)
{
$ten_dang_nhap = stripslashes($ten_dang_nhap);
$ten_dang_nhap = addslashes($ten_dang_nhap);
$mat_khau = stripslashes($mat_khau);
$mat_khau = addslashes($mat_khau);
$mat_khau = md5($mat_khau);
$sql = "select * from quan_tri where ten_dang_nhap = '$ten_dang_nhap' and mat_khau = '$mat_khau' ";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from quan_tri where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ho_ten, $ten_dang_nhap, $mat_khau, $email, $ngay_tao, $lan_dang_nhap_cuoi, $trang_thai)
{
$ho_ten = addslashes($ho_ten);
$ten_dang_nhap = addslashes($ten_dang_nhap);
$mat_khau = addslashes($mat_khau);
$email = addslashes($email);
$sql = "INSERT INTO quan_tri(ho_ten,ten_dang_nhap,mat_khau,email,ngay_tao,lan_dang_nhap_cuoi,trang_thai) VALUES ('$ho_ten','$ten_dang_nhap','$mat_khau','$email','$ngay_tao','$lan_dang_nhap_cuoi','$trang_thai')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ten_dang_nhap, $mat_khau, $email, $ngay_tao, $lan_dang_nhap_cuoi, $trang_thai)
{
$ma = intval($ma);
$ho_ten = addslashes($ho_ten);
$ten_dang_nhap = addslashes($ten_dang_nhap);
$mat_khau = addslashes($mat_khau);
$email = addslashes($email);
$sql ="UPDATE quan_tri SET ho_ten= '$ho_ten', ten_dang_nhap= '$ten_dang_nhap', mat_khau= '$mat_khau', email= '$email', ngay_tao= '$ngay_tao', lan_dang_nhap_cuoi= '$lan_dang_nhap_cuoi', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from quan_tri where $ho_ten like %tu_khoa% or $ten_dang_nhap like %tu_khoa% or $mat_khau like %tu_khoa% or $email like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_quan_tri.php
|
PHP
|
gpl3
| 2,561
|
<?php
require_once("database.php");
class xl_loai_bai_viet extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from loai_bai_viet limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_all()
{
$sql = "select * from loai_bai_viet";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from loai_bai_viet";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from loai_bai_viet where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function kiem_tra_co_con($ma)
{
$ma = intval($ma);
$sql = "select * from loai_bai_viet where ma_loai_cha = '$ma'";
$this->setQuery($sql);
$row = $this->loadRow();
if($row != NULL)
return true;
else
return false;
}
function xem_ten_loai_cha($ma)
{
$ma = intval($ma);
$sql = "select ten from loai_bai_viet where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from loai_bai_viet where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ten, $mo_ta, $ma_loai_cha, $thu_tu_hien_thi)
{
$ten = stripslashes($ten);
$ten = addslashes($ten);
$mo_ta = stripslashes($mo_ta);
$mo_ta = addslashes($mo_ta);
$ma_loai_cha = intval($ma_loai_cha);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql = "INSERT INTO loai_bai_viet(ten,mo_ta,ma_loai_cha,thu_tu_hien_thi) VALUES ('$ten','$mo_ta','$ma_loai_cha','$thu_tu_hien_thi')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ten, $mo_ta, $ma_loai_cha, $thu_tu_hien_thi)
{
$ma = intval($ma);
$ten = stripslashes($ten);
$ten = addslashes($ten);
$mo_ta = stripslashes($mo_ta);
$mo_ta = addslashes($mo_ta);
$ma_loai_cha = intval($ma_loai_cha);
$thu_tu_hien_thi = intval($thu_tu_hien_thi);
$sql ="UPDATE loai_bai_viet SET ten= '$ten', mo_ta= '$mo_ta', ma_loai_cha= '$ma_loai_cha', thu_tu_hien_thi= '$thu_tu_hien_thi' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from loai_bai_viet where $ten like %tu_khoa% or $mo_ta like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_bai_viet.php
|
PHP
|
gpl3
| 2,560
|
<?php
require_once("database.php");
require_once '../DTO/DUAN_DTO.php';
class xl_du_an extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from du_an limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai($vi_tri, $so_luong, $ma_phieu, $ma_lda)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "SELECT da . *
FROM du_an da, loai_du_an lda, phieu_dang_ky pdk, loai_phieu lp
WHERE da.loai_dua_an = lda.ma
AND pdk.ma_da = da.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = $ma_phieu
AND lda.ma = $ma_lda
LIMIT $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai_all($vi_tri, $so_luong, $ma_phieu)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "SELECT da . *
FROM du_an da, loai_du_an lda, phieu_dang_ky pdk, loai_phieu lp
WHERE da.loai_dua_an = lda.ma
AND pdk.ma_da = da.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = $ma_phieu
LIMIT $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function xem_chi_tiet($ma)
{
$ma = intval($ma);
$sql = "select * from du_an where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function so_luong()
{
$sql = "select count(*) from du_an";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_theo_loai( $ma_phieu, $ma_lda)
{
$sql = "SELECT da . *
FROM du_an da, loai_du_an lda, phieu_dang_ky pdk, loai_phieu lp
WHERE da.loai_dua_an = lda.ma
AND pdk.ma_dn = da.ma
AND pdk.loai_phieu = lp.ma
AND lp.ma = $ma_phieu
AND lda.ma = $ma_lda ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from du_an where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from du_an where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them(DUAN_DTO $info)
{
$info->ten_du_an = stripslashes($info->ten_du_an);
$info->ten_du_an = addslashes($info->ten_du_an);
$info->dia_chi = stripslashes($info->dia_chi);
$info->dia_chi = addslashes($info->dia_chi);
$info->von_dau_tu = stripslashes($info->von_dau_tu);
$info->von_dau_tu = addslashes($info->von_dau_tu);
$info->loai_dua_an = stripslashes($info->loai_dua_an);
$info->loai_dua_an = addslashes($info->loai_dua_an);
$info->thong_tin_chi_tiet = stripslashes($info->thong_tin_chi_tiet);
$info->thong_tin_chi_tiet = addslashes($info->thong_tin_chi_tiet);
$sql = "INSERT INTO du_an VALUES ( '$info->ten_du_an',
'$info->dia_chi ',
'$info->von_dau_tu' ,
'$info->loai_dua_an' ,
'$info->thong_tin_chi_tiet' ,
'$info->tinh_trang_cap_phep' ,
'$info->ngay_cap_phep ' ,
'$info->thoi_gian_du_kien_cp' ,
0
)";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $ngay_sinh, $gioi_tinh, $dia_chi, $dien_thoai, $email, $vi_tri_ung_tuyen, $tu_gioi_thieu, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$email = stripslashes($email);
$email = addslashes($email);
$vi_tri_ung_tuyen = stripslashes($vi_tri_ung_tuyen);
$vi_tri_ung_tuyen = addslashes($vi_tri_ung_tuyen);
$tu_gioi_thieu = stripslashes($tu_gioi_thieu);
$tu_gioi_thieu = addslashes($tu_gioi_thieu);
$sql ="UPDATE du_an SET ho_ten= '$ho_ten', ngay_sinh= '$ngay_sinh', gioi_tinh= '$gioi_tinh', dia_chi= '$dia_chi', dien_thoai= '$dien_thoai', email= '$email', vi_tri_ung_tuyen= '$vi_tri_ung_tuyen', tu_gioi_thieu= '$tu_gioi_thieu', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
//$sql = "select * from du_an where $ho_ten like %tu_khoa% or $dia_chi like %tu_khoa% or $dien_thoai like %tu_khoa% or $email like %tu_khoa% or $vi_tri_ung_tuyen like %tu_khoa% or $tu_gioi_thieu like %tu_khoa%";
//$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_du_an.php
|
PHP
|
gpl3
| 5,316
|
<?php
require_once("database.php");
class xl_bai_viet extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from bai_viet limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function danh_sach_theo_loai($ma_loai, $vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from bai_viet where ma_loai_bai_viet = $ma_loai limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong($ma_loai)
{
$sql = "select count(*) from bai_viet where ma_loai_bai_viet = '$ma_loai' ";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from bai_viet where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from bai_viet where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ma_loai_bai_viet, $ma_nguoi_dung, $tieu_de, $noi_dung_tom_tat, $noi_dung_chi_tiet, $ngay_tao, $so_lan_xem, $trang_thai, $hinh)
{
$ma_loai_bai_viet = intval($ma_loai_bai_viet);
$ma_nguoi_dung = intval($ma_nguoi_dung);
$tieu_de = stripslashes($tieu_de);
$tieu_de = addslashes($tieu_de);
$noi_dung_tom_tat = stripslashes($noi_dung_tom_tat);
$noi_dung_tom_tat = addslashes($noi_dung_tom_tat);
$noi_dung_chi_tiet = stripslashes($noi_dung_chi_tiet);
$noi_dung_chi_tiet = addslashes($noi_dung_chi_tiet);
$so_lan_xem = intval($so_lan_xem);
$hinh = stripslashes($hinh);
$hinh = addslashes($hinh);
$sql = "INSERT INTO bai_viet(ma_loai_bai_viet,ma_nguoi_dung,tieu_de,noi_dung_tom_tat,noi_dung_chi_tiet,ngay_tao,so_lan_xem,trang_thai,hinh) VALUES ('$ma_loai_bai_viet','$ma_nguoi_dung','$tieu_de','$noi_dung_tom_tat','$noi_dung_chi_tiet','$ngay_tao','$so_lan_xem','$trang_thai','$hinh')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ma_loai_bai_viet, $ma_nguoi_dung, $tieu_de, $noi_dung_tom_tat, $noi_dung_chi_tiet, $ngay_tao, $so_lan_xem, $trang_thai, $hinh)
{
$ma = intval($ma);
$ma_loai_bai_viet = intval($ma_loai_bai_viet);
$ma_nguoi_dung = intval($ma_nguoi_dung);
$tieu_de = stripslashes($tieu_de);
$tieu_de = addslashes($tieu_de);
$noi_dung_tom_tat = stripslashes($noi_dung_tom_tat);
$noi_dung_tom_tat = addslashes($noi_dung_tom_tat);
$noi_dung_chi_tiet = stripslashes($noi_dung_chi_tiet);
$noi_dung_chi_tiet = addslashes($noi_dung_chi_tiet);
$so_lan_xem = intval($so_lan_xem);
$hinh = stripslashes($hinh);
$hinh = addslashes($hinh);
$sql ="UPDATE bai_viet SET ma_loai_bai_viet= '$ma_loai_bai_viet', ma_nguoi_dung= '$ma_nguoi_dung', tieu_de= '$tieu_de', noi_dung_tom_tat= '$noi_dung_tom_tat', noi_dung_chi_tiet= '$noi_dung_chi_tiet', ngay_tao= '$ngay_tao', so_lan_xem= '$so_lan_xem', trang_thai= '$trang_thai', hinh= '$hinh' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat_trang_thai($ma)
{
$ma = intval($ma);
$sql = "UPDATE bai_viet SET trang_thai = 1 - trang_thai WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from bai_viet where $tieu_de like %tu_khoa% or $noi_dung_tom_tat like %tu_khoa% or $noi_dung_chi_tiet like %tu_khoa% or $hinh like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_bai_viet.php
|
PHP
|
gpl3
| 3,587
|
<?php
require_once("database.php");
class xl_bo_dem extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from bo_dem limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong_hom_nay()
{
$from = date('Y-m-d 0:0:0');
$to = date('Y-m-d 23:59:59');
$sql = "select count(*) from bo_dem where '$from' <= thoi_gian and thoi_gian <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_hom_qua()
{
$from = date('Y-m-d 0:0:0', strtotime('-1 days') );
$to = date('Y-m-d 23:59:59' , strtotime('-1 days'));
$sql = "select count(*) from bo_dem where '$from' <= thoi_gian and thoi_gian <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_tuan_nay()
{
$x = date('w');
$from = date('Y-m-d 0:0:0', strtotime("-$x days"));
$to = date('Y-m-d 23:59:59');
$sql = "select count(*) from bo_dem where '$from' <= thoi_gian and thoi_gian <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_thang_nay()
{
$from = date('Y-m-1 0:0:0');
$to = date('Y-m-d 23:59:59');
$sql = "select count(*) from bo_dem where '$from' <= thoi_gian and thoi_gian <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong_theo_ngay($ngay)
{
$from = date("$ngay 0:0:0");
$to = date("$ngay 23:59:59");
$sql = "select count(*) from bo_dem where '$from' <= thoi_gian and thoi_gian <= '$to'";
$this->setQuery($sql);
return $this->loadResult();
}
function so_luong()
{
$sql = "select count(*) from bo_dem";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from bo_dem where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from bo_dem where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($dia_chi_ip, $trinh_duyet, $thoi_gian, $url)
{
$dia_chi_ip = stripslashes($dia_chi_ip);
$dia_chi_ip = addslashes($dia_chi_ip);
$trinh_duyet = stripslashes($trinh_duyet);
$trinh_duyet = addslashes($trinh_duyet);
$url = stripslashes($url);
$url = addslashes($url);
$sql = "INSERT INTO bo_dem(dia_chi_ip,trinh_duyet,thoi_gian,url) VALUES ('$dia_chi_ip','$trinh_duyet','$thoi_gian','$url')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $dia_chi_ip, $trinh_duyet, $thoi_gian, $url)
{
$ma = intval($ma);
$dia_chi_ip = stripslashes($dia_chi_ip);
$dia_chi_ip = addslashes($dia_chi_ip);
$trinh_duyet = stripslashes($trinh_duyet);
$trinh_duyet = addslashes($trinh_duyet);
$url = stripslashes($url);
$url = addslashes($url);
$sql ="UPDATE bo_dem SET dia_chi_ip= '$dia_chi_ip', trinh_duyet= '$trinh_duyet', thoi_gian= '$thoi_gian', url= '$url' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from bo_dem where $dia_chi_ip like %tu_khoa% or $trinh_duyet like %tu_khoa% or $url like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_bo_dem.php
|
PHP
|
gpl3
| 3,349
|
<?php
require_once("database.php");
class xl_thanh_vien extends database
{
function danh_sach($vi_tri, $so_luong)
{
$vi_tri = intval($vi_tri);
$so_luong = intval($so_luong);
$sql = "select * from thanh_vien limit $vi_tri, $so_luong";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from thanh_vien";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
$ma = intval($ma);
$sql = "select * from thanh_vien where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from thanh_vien where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function them($ho_ten, $username, $mat_khau, $dia_chi, $email, $dien_thoai, $ten_cong_ty, $ma_so_thue, $trang_thai)
{
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$username = stripslashes($username);
$username = addslashes($username);
$mat_khau = stripslashes($mat_khau);
$mat_khau = addslashes($mat_khau);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$email = stripslashes($email);
$email = addslashes($email);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$ten_cong_ty = stripslashes($ten_cong_ty);
$ten_cong_ty = addslashes($ten_cong_ty);
$ma_so_thue = intval($ma_so_thue);
$trang_thai = intval($trang_thai);
$sql = "INSERT INTO thanh_vien(ho_ten,username,mat_khau,dia_chi,email,dien_thoai,ten_cong_ty,ma_so_thue,trang_thai) VALUES ('$ho_ten','$username','$mat_khau','$dia_chi','$email','$dien_thoai','$ten_cong_ty','$ma_so_thue','$trang_thai')";
$this->setQuery($sql);
return $this->query();
}
function cap_nhat($ma, $ho_ten, $username, $mat_khau, $dia_chi, $email, $dien_thoai, $ten_cong_ty, $ma_so_thue, $trang_thai)
{
$ma = intval($ma);
$ho_ten = stripslashes($ho_ten);
$ho_ten = addslashes($ho_ten);
$username = stripslashes($username);
$username = addslashes($username);
$mat_khau = stripslashes($mat_khau);
$mat_khau = addslashes($mat_khau);
$dia_chi = stripslashes($dia_chi);
$dia_chi = addslashes($dia_chi);
$email = stripslashes($email);
$email = addslashes($email);
$dien_thoai = stripslashes($dien_thoai);
$dien_thoai = addslashes($dien_thoai);
$ten_cong_ty = stripslashes($ten_cong_ty);
$ten_cong_ty = addslashes($ten_cong_ty);
$ma_so_thue = intval($ma_so_thue);
$trang_thai = intval($trang_thai);
$sql ="UPDATE thanh_vien SET ho_ten= '$ho_ten', username= '$username', mat_khau= '$mat_khau', dia_chi= '$dia_chi', email= '$email', dien_thoai= '$dien_thoai', ten_cong_ty= '$ten_cong_ty', ma_so_thue= '$ma_so_thue', trang_thai= '$trang_thai' WHERE ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
function tim_kiem ($tu_khoa)
{
$sql = "select * from thanh_vien where $ho_ten like %tu_khoa% or $username like %tu_khoa% or $mat_khau like %tu_khoa% or $dia_chi like %tu_khoa% or $email like %tu_khoa% or $dien_thoai like %tu_khoa% or $ten_cong_ty like %tu_khoa%";
$this->setQuery($sql);
return $this->loadAllRow();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_thanh_vien.php
|
PHP
|
gpl3
| 3,299
|
<?php
require_once 'database.php';
//require_once '../DTO/KHACHHANG_DTO.php';
class xl_loai_hinh_kinh_doanh extends database
{
function danh_sach()
{
$sql = "select * from loai_hinh_kinh_doanh";
$this->setQuery($sql);
return $this->loadAllRow();
}
function so_luong()
{
$sql = "select count(*) from khach_hang";
$this->setQuery($sql);
return $this->loadResult();
}
function xem($ma)
{
//$ma = intval($ma);
$sql = "select * from loai_hinh_kinh_doanh where ma = '$ma'";
$this->setQuery($sql);
return $this->loadRow();
}
function kt_email($email)
{
$sql = "select * from khach_hang where email = '$email'";
$this->setQuery($sql);
return $this->loadRow();
}
function xoa($ma)
{
$ma = intval($ma);
$sql = "delete from khach_hang where ma = '$ma'";
$this->setQuery($sql);
return $this->query();
}
}
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/classes/xl_loai_hinh_kinh_doanh.php
|
PHP
|
gpl3
| 1,177
|
/*
------------------------------
Impromptu
------------------------------
*/
.jqifade {
position : absolute;
background-color : #777777;
}
div.jqi {
width : 400px;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
font-size : 11px;
text-align : left;
border : solid 1px #eeeeee;
border-radius : 10px;
-moz-border-radius : 10px;
-webkit-border-radius : 10px;
padding : 7px;
}
div.jqi .jqicontainer {
font-weight : bold;
}
div.jqi .jqiclose {
position : absolute;
top : 4px;
right : -2px;
width : 18px;
cursor : default;
color : #bbbbbb;
font-weight : bold;
}
div.jqi .jqimessage {
padding : 10px;
line-height : 20px;
color : #444444;
}
div.jqi .jqibuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #eeeeee;
background-color : #f4f4f4;
}
div.jqi button {
padding : 3px 10px;
margin : 0 10px;
background-color : #2F6073;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.jqi button:hover {
background-color : #728A8C;
}
div.jqi button.jqidefaultbutton {
background-color : #BF5E26;
}
.jqiwarning .jqi .jqibuttons {
background-color : #BF5E26;
}
.jqi .jqiarrow {
position : absolute;
height : 0;
width : 0;
line-height : 0;
font-size : 0;
border : solid 10px transparent;
}
.jqi .jqiarrowtl {
left : 10px;
top : -20px;
border-bottom-color : #ffffff;
}
.jqi .jqiarrowtc {
left : 50%;
top : -20px;
border-bottom-color : #ffffff;
margin-left : -10px;
}
.jqi .jqiarrowtr {
right : 10px;
top : -20px;
border-bottom-color : #ffffff;
}
.jqi .jqiarrowbl {
left : 10px;
bottom : -20px;
border-top-color : #ffffff;
}
.jqi .jqiarrowbc {
left : 50%;
bottom : -20px;
border-top-color : #ffffff;
margin-left : -10px;
}
.jqi .jqiarrowbr {
right : 10px;
bottom : -20px;
border-top-color : #ffffff;
}
.jqi .jqiarrowlt {
left : -20px;
top : 10px;
border-right-color : #ffffff;
}
.jqi .jqiarrowlm {
left : -20px;
top : 50%;
border-right-color : #ffffff;
margin-top : -10px;
}
.jqi .jqiarrowlb {
left : -20px;
bottom : 10px;
border-right-color : #ffffff;
}
.jqi .jqiarrowrt {
right : -20px;
top : 10px;
border-left-color : #ffffff;
}
.jqi .jqiarrowrm {
right : -20px;
top : 50%;
border-left-color : #ffffff;
margin-top : -10px;
}
.jqi .jqiarrowrb {
right : -20px;
bottom : 10px;
border-left-color : #ffffff;
}
/*
------------------------------
impromptu
------------------------------
*/
.impromptuwarning .impromptu {
background-color : #aaaaaa;
}
.impromptufade {
position : absolute;
background-color : #ffffff;
}
div.impromptu {
position : absolute;
background-color : #cccccc;
padding : 10px;
width : 300px;
text-align : left;
}
div.impromptu .impromptuclose {
float : right;
margin : -35px -10px 0 0;
cursor : pointer;
color : #213e80;
}
div.impromptu .impromptucontainer {
background-color : #213e80;
padding : 5px;
color : #ffffff;
font-weight : bold;
}
div.impromptu .impromptumessage {
background-color : #415ea0;
padding : 10px;
}
div.impromptu .impromptubuttons {
text-align : center;
padding : 5px 0 0 0;
}
div.impromptu button {
padding : 3px 10px 3px 10px;
margin : 0 10px;
}
/*
------------------------------
columns ex
------------------------------
*/
.colsJqifadewarning .colsJqi {
background-color : #b0be96;
}
.colsJqifade {
position : absolute;
background-color : #ffffff;
}
div.colsJqi {
position : absolute;
background-color : #d0dEb6;
padding : 10px;
width : 400px;
text-align : left;
}
div.colsJqi .colsJqiclose {
float : right;
margin : -35px -10px 0 0;
cursor : pointer;
color : #bbbbbb;
}
div.colsJqi .colsJqicontainer {
background-color : #e0eEc6;
padding : 5px;
color : #ffffff;
font-weight : bold;
height : 160px;
}
div.colsJqi .colsJqimessage {
background-color : #c0cEa6;
padding : 10px;
width : 280px;
height : 140px;
float : left;
}
div.colsJqi .jqibuttons {
text-align : center;
padding : 5px 0 0 0;
}
div.colsJqi button {
background : url(../images/button_bg.jpg) top left repeat-x #ffffff;
border : solid #777777 1px;
font-size : 12px;
padding : 3px 10px 3px 10px;
margin : 5px 5px 5px 10px;
width : 75px;
}
div.colsJqi button:hover {
border : solid #aaaaaa 1px;
}
/*
------------------------------
brown theme
------------------------------
*/
.brownJqiwarning .brownJqi {
background-color : #cccccc;
}
.brownJqifade {
position : absolute;
background-color : #ffffff;
}
div.brownJqi {
position : absolute;
background-color : transparent;
padding : 10px;
width : 300px;
text-align : left;
}
div.brownJqi .brownJqiclose {
float : right;
margin : -20px 0 0 0;
cursor : pointer;
color : #777777;
font-size : 11px;
}
div.brownJqi .brownJqicontainer {
position : relative;
background-color : transparent;
border : solid 1px #5F5D5A;
color : #ffffff;
font-weight : bold;
}
div.brownJqi .brownJqimessage {
position : relative;
background-color : #F7F6F2;
border-top : solid 1px #C6B8AE;
border-bottom : solid 1px #C6B8AE;
}
div.brownJqi .brownJqimessage h3 {
background : url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
margin : 0;
padding : 7px 0 7px 15px;
color : #4D4A47;
}
div.brownJqi .brownJqimessage p {
padding : 10px;
color : #777777;
}
div.brownJqi .brownJqimessage img.helpImg {
position : absolute;
bottom : -25px;
left : 10px;
}
div.brownJqi .brownJqibuttons {
text-align : right;
}
div.brownJqi button {
background : url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
border : solid #777777 1px;
font-size : 12px;
padding : 3px 10px 3px 10px;
margin : 5px 5px 5px 10px;
}
div.brownJqi button:hover {
border : solid #aaaaaa 1px;
}
/*
*------------------------
* clean blue ex
*------------------------
*/
.cleanbluewarning .cleanblue {
background-color : #acb4c4;
}
.cleanbluefade {
position : absolute;
background-color : #aaaaaa;
}
div.cleanblue {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
width : 300px;
font-size : 11px;
text-align : left;
border : solid 1px #213e80;
}
div.cleanblue .cleanbluecontainer {
background-color : #ffffff;
border-top : solid 14px #213e80;
padding : 5px;
font-weight : bold;
}
div.cleanblue .cleanblueclose {
float : right;
width : 18px;
cursor : default;
margin : -19px -12px 0 0;
color : #ffffff;
font-weight : bold;
}
div.cleanblue .cleanbluemessage {
padding : 10px;
line-height : 20px;
font-size : 11px;
color : #333333;
}
div.cleanblue .cleanbluebuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #eeeeee;
background-color : #f4f4f4;
}
div.cleanblue button {
padding : 3px 10px;
margin : 0 10px;
background-color : #314e90;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.cleanblue button:hover {
border : solid 1px #d4d4d4;
}
/*
*------------------------
* Ext Blue Ex
*------------------------
*/
.extbluewarning .extblue {
border : 1px red solid;
}
.extbluefade {
position : absolute;
background-color : #ffffff;
}
div.extblue {
border : 1px #6289B6 solid;
position : absolute;
background-color : #CAD8EA;
padding : 0;
width : 300px;
text-align : left;
}
div.extblue .extblueclose {
background-color : #CAD8EA;
margin : 2px -2px 0 0;
cursor : pointer;
color : red;
text-align : right;
}
div.extblue .extbluecontainer {
background-color : #CAD8EA;
padding : 0 5px 5px 5px;
color : #000000;
font : normal 11px Verdana;
}
div.extblue .extbluemessage {
background-color : #CAD8EA;
padding : 0;
margin : 0 15px 15px 15px;
}
div.extblue .extbluebuttons {
text-align : center;
padding : 0px 0 0 0;
}
div.extblue button {
padding : 1px 4px;
margin : 0 10px;
background-color : #cccccc;
font-weight : normal;
font-family : Verdana;
font-size : 10px;
}
/*
*------------------------
* smooth Ex
*------------------------
*/
.jqismoothfade {
position : absolute;
background-color : #333333;
}
div.jqismooth {
width : 350px;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
font-size : 11px;
text-align : left;
border : solid 3px #e2e8e6;
-moz-border-radius : 10px;
-webkit-border-radius : 10px;
padding : 7px;
}
div.jqismooth .jqismoothcontainer {
font-weight : bold;
}
div.jqismooth .jqismoothclose {
position : absolute;
top : 0;
right : 0;
width : 18px;
cursor : default;
text-align : center;
padding : 2px 0 4px 0;
color : #727876;
font-weight : bold;
background-color : #e2e8e6;
-moz-border-radius-bottomLeft : 5px;
-webkit-border-bottom-left-radius : 5px;
border-left : solid 1px #e2e8e6;
border-bottom : solid 1px #e2e8e6;
}
div.jqismooth .jqismoothmessage {
padding : 10px;
line-height : 20px;
color : #444444;
}
div.jqismooth .jqismoothbuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #e2e8e6;
background-color : #f2f8f6;
}
div.jqismooth button {
padding : 3px 10px;
margin : 0 10px;
background-color : #2F6073;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.jqismooth button:hover {
background-color : #728A8C;
}
div.jqismooth button.jqismoothdefaultbutton {
background-color : #BF5E26;
}
.jqismoothwarning .jqismooth .jqismoothbuttons {
background-color : #BF5E26;
}
/*
------------------------------
Impromptu
------------------------------
*/
.jqifade {
position : absolute;
background-color : #777777;
}
div.jqi {
width : 400px;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
font-size : 11px;
text-align : left;
border : solid 1px #eeeeee;
border-radius : 10px;
-moz-border-radius : 10px;
-webkit-border-radius : 10px;
padding : 7px;
}
div.jqi .jqicontainer {
font-weight : bold;
}
div.jqi .jqiclose {
position : absolute;
top : 4px;
right : -2px;
width : 18px;
cursor : default;
color : #bbbbbb;
font-weight : bold;
}
div.jqi .jqimessage {
padding : 10px;
line-height : 20px;
color : #444444;
}
div.jqi .jqibuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #eeeeee;
background-color : #f4f4f4;
}
div.jqi button {
padding : 3px 10px;
margin : 0 10px;
background-color : #2F6073;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.jqi button:hover {
background-color : #728A8C;
}
div.jqi button.jqidefaultbutton {
background-color : #BF5E26;
}
.jqiwarning .jqi .jqibuttons {
background-color : #BF5E26;
}
.jqi .jqiarrow {
position : absolute;
height : 0;
width : 0;
line-height : 0;
font-size : 0;
border : solid 10px transparent;
}
.jqi .jqiarrowtl {
left : 10px;
top : -20px;
border-bottom-color : #ffffff;
}
.jqi .jqiarrowtc {
left : 50%;
top : -20px;
border-bottom-color : #ffffff;
margin-left : -10px;
}
.jqi .jqiarrowtr {
right : 10px;
top : -20px;
border-bottom-color : #ffffff;
}
.jqi .jqiarrowbl {
left : 10px;
bottom : -20px;
border-top-color : #ffffff;
}
.jqi .jqiarrowbc {
left : 50%;
bottom : -20px;
border-top-color : #ffffff;
margin-left : -10px;
}
.jqi .jqiarrowbr {
right : 10px;
bottom : -20px;
border-top-color : #ffffff;
}
.jqi .jqiarrowlt {
left : -20px;
top : 10px;
border-right-color : #ffffff;
}
.jqi .jqiarrowlm {
left : -20px;
top : 50%;
border-right-color : #ffffff;
margin-top : -10px;
}
.jqi .jqiarrowlb {
left : -20px;
bottom : 10px;
border-right-color : #ffffff;
}
.jqi .jqiarrowrt {
right : -20px;
top : 10px;
border-left-color : #ffffff;
}
.jqi .jqiarrowrm {
right : -20px;
top : 50%;
border-left-color : #ffffff;
margin-top : -10px;
}
.jqi .jqiarrowrb {
right : -20px;
bottom : 10px;
border-left-color : #ffffff;
}
/*
------------------------------
impromptu
------------------------------
*/
.impromptuwarning .impromptu {
background-color : #aaaaaa;
}
.impromptufade {
position : absolute;
background-color : #ffffff;
}
div.impromptu {
position : absolute;
background-color : #cccccc;
padding : 10px;
width : 300px;
text-align : left;
}
div.impromptu .impromptuclose {
float : right;
margin : -35px -10px 0 0;
cursor : pointer;
color : #213e80;
}
div.impromptu .impromptucontainer {
background-color : #213e80;
padding : 5px;
color : #ffffff;
font-weight : bold;
}
div.impromptu .impromptumessage {
background-color : #415ea0;
padding : 10px;
}
div.impromptu .impromptubuttons {
text-align : center;
padding : 5px 0 0 0;
}
div.impromptu button {
padding : 3px 10px 3px 10px;
margin : 0 10px;
}
/*
------------------------------
columns ex
------------------------------
*/
.colsJqifadewarning .colsJqi {
background-color : #b0be96;
}
.colsJqifade {
position : absolute;
background-color : #ffffff;
}
div.colsJqi {
position : absolute;
background-color : #d0dEb6;
padding : 10px;
width : 400px;
text-align : left;
}
div.colsJqi .colsJqiclose {
float : right;
margin : -35px -10px 0 0;
cursor : pointer;
color : #bbbbbb;
}
div.colsJqi .colsJqicontainer {
background-color : #e0eEc6;
padding : 5px;
color : #ffffff;
font-weight : bold;
height : 160px;
}
div.colsJqi .colsJqimessage {
background-color : #c0cEa6;
padding : 10px;
width : 280px;
height : 140px;
float : left;
}
div.colsJqi .jqibuttons {
text-align : center;
padding : 5px 0 0 0;
}
div.colsJqi button {
background : url(../images/button_bg.jpg) top left repeat-x #ffffff;
border : solid #777777 1px;
font-size : 12px;
padding : 3px 10px 3px 10px;
margin : 5px 5px 5px 10px;
width : 75px;
}
div.colsJqi button:hover {
border : solid #aaaaaa 1px;
}
/*
------------------------------
brown theme
------------------------------
*/
.brownJqiwarning .brownJqi {
background-color : #cccccc;
}
.brownJqifade {
position : absolute;
background-color : #ffffff;
}
div.brownJqi {
position : absolute;
background-color : transparent;
padding : 10px;
width : 300px;
text-align : left;
}
div.brownJqi .brownJqiclose {
float : right;
margin : -20px 0 0 0;
cursor : pointer;
color : #777777;
font-size : 11px;
}
div.brownJqi .brownJqicontainer {
position : relative;
background-color : transparent;
border : solid 1px #5F5D5A;
color : #ffffff;
font-weight : bold;
}
div.brownJqi .brownJqimessage {
position : relative;
background-color : #F7F6F2;
border-top : solid 1px #C6B8AE;
border-bottom : solid 1px #C6B8AE;
}
div.brownJqi .brownJqimessage h3 {
background : url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
margin : 0;
padding : 7px 0 7px 15px;
color : #4D4A47;
}
div.brownJqi .brownJqimessage p {
padding : 10px;
color : #777777;
}
div.brownJqi .brownJqimessage img.helpImg {
position : absolute;
bottom : -25px;
left : 10px;
}
div.brownJqi .brownJqibuttons {
text-align : right;
}
div.brownJqi button {
background : url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
border : solid #777777 1px;
font-size : 12px;
padding : 3px 10px 3px 10px;
margin : 5px 5px 5px 10px;
}
div.brownJqi button:hover {
border : solid #aaaaaa 1px;
}
/*
*------------------------
* clean blue ex
*------------------------
*/
.cleanbluewarning .cleanblue {
background-color : #acb4c4;
}
.cleanbluefade {
position : absolute;
background-color : #aaaaaa;
}
div.cleanblue {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
width : 300px;
font-size : 11px;
text-align : left;
border : solid 1px #213e80;
}
div.cleanblue .cleanbluecontainer {
background-color : #ffffff;
border-top : solid 14px #213e80;
padding : 5px;
font-weight : bold;
}
div.cleanblue .cleanblueclose {
float : right;
width : 18px;
cursor : default;
margin : -19px -12px 0 0;
color : #ffffff;
font-weight : bold;
}
div.cleanblue .cleanbluemessage {
padding : 10px;
line-height : 20px;
font-size : 11px;
color : #333333;
}
div.cleanblue .cleanbluebuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #eeeeee;
background-color : #f4f4f4;
}
div.cleanblue button {
padding : 3px 10px;
margin : 0 10px;
background-color : #314e90;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.cleanblue button:hover {
border : solid 1px #d4d4d4;
}
/*
*------------------------
* Ext Blue Ex
*------------------------
*/
.extbluewarning .extblue {
border : 1px red solid;
}
.extbluefade {
position : absolute;
background-color : #ffffff;
}
div.extblue {
border : 1px #6289B6 solid;
position : absolute;
background-color : #CAD8EA;
padding : 0;
width : 300px;
text-align : left;
}
div.extblue .extblueclose {
background-color : #CAD8EA;
margin : 2px -2px 0 0;
cursor : pointer;
color : red;
text-align : right;
}
div.extblue .extbluecontainer {
background-color : #CAD8EA;
padding : 0 5px 5px 5px;
color : #000000;
font : normal 11px Verdana;
}
div.extblue .extbluemessage {
background-color : #CAD8EA;
padding : 0;
margin : 0 15px 15px 15px;
}
div.extblue .extbluebuttons {
text-align : center;
padding : 0px 0 0 0;
}
div.extblue button {
padding : 1px 4px;
margin : 0 10px;
background-color : #cccccc;
font-weight : normal;
font-family : Verdana;
font-size : 10px;
}
/*
*------------------------
* smooth Ex
*------------------------
*/
.jqismoothfade {
position : absolute;
background-color : #333333;
}
div.jqismooth {
width : 350px;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
position : absolute;
background-color : #ffffff;
font-size : 11px;
text-align : left;
border : solid 3px #e2e8e6;
-moz-border-radius : 10px;
-webkit-border-radius : 10px;
padding : 7px;
}
div.jqismooth .jqismoothcontainer {
font-weight : bold;
}
div.jqismooth .jqismoothclose {
position : absolute;
top : 0;
right : 0;
width : 18px;
cursor : default;
text-align : center;
padding : 2px 0 4px 0;
color : #727876;
font-weight : bold;
background-color : #e2e8e6;
-moz-border-radius-bottomLeft : 5px;
-webkit-border-bottom-left-radius : 5px;
border-left : solid 1px #e2e8e6;
border-bottom : solid 1px #e2e8e6;
}
div.jqismooth .jqismoothmessage {
padding : 10px;
line-height : 20px;
color : #444444;
}
div.jqismooth .jqismoothbuttons {
text-align : right;
padding : 5px 0 5px 0;
border : solid 1px #e2e8e6;
background-color : #f2f8f6;
}
div.jqismooth button {
padding : 3px 10px;
margin : 0 10px;
background-color : #2F6073;
border : solid 1px #f4f4f4;
color : #ffffff;
font-weight : bold;
font-size : 12px;
}
div.jqismooth button:hover {
background-color : #728A8C;
}
div.jqismooth button.jqismoothdefaultbutton {
background-color : #BF5E26;
}
.jqismoothwarning .jqismooth .jqismoothbuttons {
background-color : #BF5E26;
}
|
10-ptud-v1
|
trunk/ 10-ptud-v1/css/examples.css
|
CSS
|
gpl3
| 25,297
|
li.menu {
margin-bottom : 5px;
list-style : disc
}
a.text {
color : #2E6E9E;
text-decoration : none;
font-size: 12px
}
.ui-accordion .ui-accordion-header a {
font-size : 12px;
}
.ui-widget-header {
margin-bottom: 2px;
margin-top: 5px;
-webkit-border-radius : 5px;
-moz-border-radius : 5px;
border-radius : 5px;
}
.tin_noi_bat, .quang_cao, .tim_kiem{
-webkit-border-radius : 5px;
-moz-border-radius : 5px;
border-radius : 5px;
border: 1px;
border-color: #C5DBEC;
border-style: solid;
background-color: #E1EFFB;
}
.quang_cao {
-webkit-border-radius : 5px;
-moz-border-radius : 5px;
border-radius : 5px;
border : 1px;
border-color : #C5DBEC;
border-style : solid;
background-color : #E1EFFB;
text-align: center;
padding: 5px 5px;
}
.quang_cao img{
padding: 3px 3px;
}
.danh_muc{
padding-left: 25px;
}
|
10-ptud-v1
|
trunk/ 10-ptud-v1/css/general.css
|
CSS
|
gpl3
| 1,055
|
body, span {
font-family : tahoma, sans-serif;
width : 1000px;
margin : 0 auto;
height : auto;
line-height : 2em;
}
.outer {
margin : 0 auto;
}
.left {
width : 200px;
float : left;
}
.widgets {
height : 30px;
vertical-align : middle;
}
.title {
padding-top : 5px;
text-align : center;
}
.center {
width : 600px;
float : left;
padding-top : 5px;
}
.right {
width : 200px;
float : left;
}
.elements {
-webkit-border-radius : 7px;
-moz-border-radius : 7px;
border-radius : 7px;
border : 1px;
border-color : #C5DBEC;
border-style : solid;
padding : 2px 7px 6px 7px;
margin-top : 7px;
}
.footer {
float : left;
width : 100%;
text-align : center;
color : #355CCC;
margin : 10px 7px;
border : 1px;
border-color : #C5DBEC;
border-style : solid;
padding : 5px 5px;
}
.catogory {
padding : 2px 5px 3px 5px;
}
.title_catogory {
color : #CC3300;
padding : 3px 3px;
}
.title_article {
padding-bottom : 7px;
padding-left : 3px;
}
.title_article a {
color : #000000;
text-decoration : none;
font-weight : bold;
}
.title_article a:hover {
text-decoration : underline;
}
.content_article {
width : 100%;
float : left;
padding-left : 3px;
}
.content_article .hinh {
width : 112px;
float : left;
height : 75px;
}
.content_article .text {
width : 470px;
float : left;
}
.tin_cung_loai {
padding-top : 70px;
}
.tin_cung_loai ul {
padding-left : 17px;
}
.tin_cung_loai ul li {
list-style : disc
}
.tin_cung_loai ul li a {
color : #000000;
text-decoration : none;
}
.tin_cung_loai ul li a:hover {
text-decoration : underline;
}
.phan_cach {
margin-top : -10px;
padding-left : 4px;
}
.phan_cach hr {
width : 470px;
height : 1px;
color : #000000;
float : left;
}
.phan_cach a {
padding-left : 7px;
text-decoration : none;
color : #000000;
}
.phan_cach a:hover {
text-decoration : underline;
}
.start {
font-weight : bold;
font-size : 12px;
color : #b3000a;
line-height : 24px;
font-family : tahoma;
height : 24px;
background-color : #EFEFEF;
margin : 2px 7px 10px 7px;
}
.pageTitle {
color : #FFFFFF;
font-family : Verdana, Tahoma, Arial;
font-size : 8pt;
text-transform : uppercase;
font-weight : bold;
width: 400px;
float: left;
padding-top: 3px;
}
.style1 {
color : #FF0000;
font-weight : bold;
}
.style2 {
color : #0000FF;
font-weight : bold;
}
.frame {
color : #0000FF;
font-family : Verdana, Arial, Helvetica, sans-serif;
font-size : 11px;
font-weight : bold;
margin : 1px 20px 0 5px;
padding-bottom : 1px;
}
.rg_textbox {
background-color : #FFFFFF;
border-color : #538BA6;
border-right : 0 solid #538BA6;
border-style : solid solid dotted;
border-width : 0 0 1px;
color : #000080;
font-family : Arial, Tahoma, Verdana, Helvetica;
font-size : 12px;
}
|
10-ptud-v1
|
trunk/ 10-ptud-v1/css/common.css
|
CSS
|
gpl3
| 3,624
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mua bán doanh nghiệp</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br />
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif" /></div>
<div class="pageTitle">
CƠ HỘI MUA DOANH NGHIỆP :: DN SẢN XUẤT
</div>
</td>
</tr>
</tbody>
</table>
<br />
<table width="98%" cellspacing="1" cellpadding="5" border="0" bgcolor="#CCCCCC" align="center">
<tbody>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Mã doanh nghiệp:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText">BSX58</td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Doanh nghiệp cần bán :</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText">Chuyển nhượng DN chuyên sản xuất, gia công hàng may
mặc
xuất khẩu.
</td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Giá bán (VNĐ):</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><a
href="index.php?frame=dnghiep&mode=detail&id=579" class="detail_cohoi">Xem chi tiết</a></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Địa phương:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText">Phú Thọ</td>
</tr>
<tr>
<td width="21%" valign="top" bgcolor="#FFFFFF" class="ProductTextField">Thông tin chi tiết:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText">
<div align="justify"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">Công ty hoạt động ngày 1/1/2010 có trụ sở tại TP Việt Trì - Phú Thọ. </span>
</div>
<div align="justify"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"></span> </div>
<div align="justify" class="im"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">Diện tích đất 11.460m2, sở hữu toàn bộ khuôn viên gồm: Nhà xưởng, nhà xe, nhà ăn ca, nhà phụ trợ...</span>
</div>
<div align="justify" class="im"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"></span> </div>
<div align="justify"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">Công ty ở trung tâm thành phố Việt Trì, gần đường đại lộ Nguyễn Tất Thành - giao thông thuận lợi.</span>
</div>
<div align="justify"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"><br>Nay do chủ doanh nghiệp muốn chuyển đổi lĩnh vực kinh doanh nên có nhu cầu chuyển nhượng lại toàn bộ hệ thống bao gồm: 11.460m2 đất (đất thuê 49 năm, đã sử dụng 03 năm còn lại 46 năm ), nhà xưởng, hệ thống máy móc, quy trình sản xuất cũng như toàn bộ lượng khách hàng, công nhân cho những nhà đầu tư thực sự tâm huyết để phát triển lĩnh vực này.</span>
</div>
<div align="justify" class="im"><br><span
style="FONT-FAMILY: Arial; FONT-SIZE: 10pt; FONT-WEIGHT: bold">Tổng giá trị muốn chuyển nhượng: 34.650.000.000 VNĐ</span><br><br><span
style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">LH: 0979.540.360 (Thảo)</span></div>
</td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center" colspan="2">
<a href="index.php?frame=dnghiep&mode=mua&id=579">
<img border="0" src="../upload/images/giaodich.gif">
</a>
</td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/doanh_nghiep/chi_tiet.php
|
PHP
|
gpl3
| 5,417
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mua bán doanh nghiệp</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br/>
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif" /></div>
<div class="pageTitle">
CƠ HỘI MUA DOANH NGHIỆP :: DN SẢN XUẤT
</div>
</td>
</tr>
</tbody>
</table>
<br/>
<form style="display:inline" method="post" action="index.php?frame=dnghiep&danhmucid=8" name="frmSearch2">
<table width="98%">
<tbody>
<tr>
<td bgcolor="#F8F8F8" class="normal_font">
<img src="../upload/images/search_icon.gif">
<input style="width:180px" size="25" class="input" value="" name="keyword2">
<input type="submit" class="button" value="Tìm nhanh" name="button">
<font color="red">Tìm theo mã, tên hoặc theo địa phương</font></td>
</tr>
</tbody>
</table>
</form>
<br/>
<table width="590px" cellspacing="1" border="1" align="center" cellpading="2"
style="border-collapse: collapse; margin: 0 auto">
<tbody>
<tr height="22" bgcolor="#355cb4">
<th width="28">Stt</th>
<th width="67">Mã DN</th>
<th width="528">Doanh nghiệp cần bán</th>
<th width="111" align="center">Giá bán (VNĐ)</th>
<th width="122">Địa phương</th>
<th width="81">Xem</th>
</tr>
<tr bgcolor="#ffffff">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center">1</div>
</td>
<td width="67" class="ProductCart">
BSX58
</td>
<td width="528" align="center" class="ProductCart">
<div align="left"><a href="chi_tiet.php" class="detail_cohoi">Chuyển nhượng DN chuyên sản xuất, gia công hàng may mặc xuất khẩu.</a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<a href="index.php?frame=dnghiep&mode=detail&id=579" class="detail_cohoi">Xem chi tiết</a>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center">Phú Thọ</div>
</td>
<td width="81" align="center">
<a href="index.php?frame=dnghiep&mode=detail&id=579" class="detail_cohoi">Chi tiết</a></td>
</tr>
<tr bgcolor="#ffffff">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center">2</div>
</td>
<td width="67" class="ProductCart">
BSX21
</td>
<td width="528" align="center" class="ProductCart">
<div align="left"><a href="index.php?frame=dnghiep&mode=detail&id=544" class="detail_cohoi">Chuyển
nhượng
DN
KD
các
SP
về
vật
liệu
xây
dựng</a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<a href="index.php?frame=dnghiep&mode=detail&id=544" class="detail_cohoi">Xem chi tiết</a>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center">Tp. Hồ Chí Minh</div>
</td>
<td width="81" align="center">
<a href="index.php?frame=dnghiep&mode=detail&id=544" class="detail_cohoi">Chi tiết</a></td>
</tr>
<tr bgcolor="#ffffff">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center">3</div>
</td>
<td width="67" class="ProductCart">
BSX20
</td>
<td width="528" align="center" class="ProductCart">
<div align="left"><a href="index.php?frame=dnghiep&mode=detail&id=570" class="detail_cohoi">Cần
chuyển
nhượng
đất
và
nhà
xưởng
tại
Q.
Hà
Đông</a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<a href="index.php?frame=dnghiep&mode=detail&id=570" class="detail_cohoi">Xem chi tiết</a>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center">Hà Nội</div>
</td>
<td width="81" align="center">
<a href="index.php?frame=dnghiep&mode=detail&id=570" class="detail_cohoi">Chi tiết</a></td>
</tr>
<tr bgcolor="#ffffff">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center">4</div>
</td>
<td width="67" class="ProductCart">
BSX123
</td>
<td width="528" align="center" class="ProductCart">
<div align="left"><a href="index.php?frame=dnghiep&mode=detail&id=529" class="detail_cohoi">Chuyển
nhượng
lại
toàn
bộ
diện
tích
đất
rộng
16.000m2
và
nhà
xưởng
tại
Hưng
Yên</a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<a href="index.php?frame=dnghiep&mode=detail&id=529" class="detail_cohoi">Xem chi tiết</a>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center">Hà Nội</div>
</td>
<td width="81" align="center">
<a href="index.php?frame=dnghiep&mode=detail&id=529" class="detail_cohoi">Chi tiết</a></td>
</tr>
<tr bgcolor="#ffffff">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center">5</div>
</td>
<td width="67" class="ProductCart">
BSX28
</td>
<td width="528" align="center" class="ProductCart">
<div align="left"><a href="index.php?frame=dnghiep&mode=detail&id=569" class="detail_cohoi">Chuyển
toàn
bộ
Đất
và
nhà
xưởng
trên
Đất
tại
Bắc
Ninh</a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<a href="index.php?frame=dnghiep&mode=detail&id=569" class="detail_cohoi">Xem chi tiết</a>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center">Bắc Ninh</div>
</td>
<td width="81" align="center">
<a href="index.php?frame=dnghiep&mode=detail&id=569" class="detail_cohoi">Chi tiết</a></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/doanh_nghiep/danh_sach.php
|
PHP
|
gpl3
| 13,571
|
<?php
require_once '../classes/xl_thong_tin_von.php';
$ma_p = $_GET['ma_p'];
$ma_lhkd = $_GET['ma_lhkd'];
$xl_dn = new xl_thong_tin_von();
if($ma_lhkd =='all')
$thong_tin_von = $xl_dn->danh_sach_theo_loai_all(0,10,$ma_p);
else
$thong_tin_von = $xl_dn->danh_sach_theo_loai(0,10, $ma_p, $ma_lhkd);
$stt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>..:: CƠ HỘI CHO VAY VỐN :: BẤT ĐỘNG SẢN ::..</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br/>
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif"/></div>
<div class="pageTitle">
CƠ HỘI CHO VAY VỐN :: BẤT ĐỘNG SẢN
</div>
</td>
</tr>
</tbody>
</table>
<br/>
<?php if(count($thong_tin_von)==0)
echo "<p align='center'>Đang cập nhật thông tin. Xin mời bạn quay lại sau. </p>";
else { ?>
<form style="display:inline" method="post" action="index.php?frame=dnghiep&danhmucid=8" name="frmSearch2">
<table width="98%">
<tbody>
<tr>
<td bgcolor="#F8F8F8" class="normal_font">
<img src="../upload/images/search_icon.gif">
<input style="width:180px" size="25" class="input" value="" name="keyword2">
<input type="submit" class="button" value="Tìm nhanh" name="button">
<font color="red"><b>Tìm theo mã, tên hoặc theo địa phương</b></font></td>
</tr>
</tbody>
</table>
</form>
<br/>
<table width="590px" cellspacing="1" border="2" align="center" cellpading="2"
style="border-collapse: collapse; margin: 0 auto">
<tbody>
<tr height="30" bgcolor="#99FF33" style="text-align:center;" >
<th width="28">STT</th>
<th width="67">Mã VV</th>
<th width="528">Doanh Nghiệp Cần Vay Vốn</th>
<th width="111" align="center">Vốn Cần Vay (VNĐ)</th>
<th width="122">Địa Phương</th>
<th width="81">Xem</th>
</tr>
<?php foreach($thong_tin_von as $row_von){ $stt++; ?>
<tr bgcolor="#ffffff" style="text-align:center;">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center"><?php echo $stt ?></div>
</td>
<td width="67" class="ProductCart" style="text-align:center;">
<?php echo $row_von['ma_von'] ?>
</td>
<td width="528" align="center" class="">
<div align="left"><a href="chi_tiet_dnvv.php?ma_von=<?php echo $row_von['ma_von'] ?>" class="mau_tieu_de" style="text-decoration: none;"><?php echo $row_von['gioi_thieu'] ?></a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<?php echo number_format($row_von['von_huy_dong']) ?>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center"><?php echo $row_von['dia_chi'] ?></div>
</td>
<td width="81" align="center">
<a href="chi_tiet_dnvv.php?ma_von=<?php echo $row_von['ma_von'] ?>" class="detail_cohoi">Chi tiết</a></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/danh_sach_dnvv.php
|
PHP
|
gpl3
| 5,865
|
<?php
require_once '../classes/xl_doanh_nghiep.php';
//require_once '../classes/xl_loai_hinh_kinh_doanh.php';
$ma_p = $_GET['ma_p'];
$ma_lhkd = $_GET['ma_lhkd'];
$xl_dn = new xl_doanh_nghiep();
if($ma_lhkd =='all')
$doanh_nghiep = $xl_dn->danh_sach_theo_loai_all(0,10,$ma_p);
else
$doanh_nghiep = $xl_dn->danh_sach_theo_loai(0,10, $ma_p, $ma_lhkd);
$stt = 0;
$ten_loai = 'aaa';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Mua bán doanh nghiệp</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br/>
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif"/></div>
<div class="pageTitle">
CƠ HỘI MUA DOANH NGHIỆP :: <?php echo $ten_loai ?>
</div>
</td>
</tr>
</tbody>
</table>
<br/>
<?php if(count($doanh_nghiep)==0)
echo "<p align='center'>Đang cập nhật thông tin. Xin mời bạn quay lại sau. </p>";
else { ?>
<form style="display:inline" method="post" action="index.php?frame=dnghiep&danhmucid=8" name="frmSearch2">
<table width="98%">
<tbody>
<tr>
<td bgcolor="#F8F8F8" class="normal_font">
<img src="../upload/images/search_icon.gif">
<input style="width:180px" size="25" class="input" value="" name="keyword2">
<input type="submit" class="button" value="Tìm nhanh" name="button">
<font color="red"><b>Tìm theo mã, tên hoặc theo địa phương</b></font></td>
</tr>
</tbody>
</table>
</form>
<br/>
<table width="590px" cellspacing="1" border="2" align="center" cellpading="2"
style="border-collapse: collapse; margin: 0 auto">
<tbody>
<tr height="30" bgcolor="#99FF33" style="text-align:center;" >
<th width="28">STT</th>
<th width="67">Mã DN</th>
<th width="528">Doanh Nghiệp Cần Bán</th>
<th width="111" align="center">Giá Bán (VNĐ)</th>
<th width="122">Địa Phương</th>
<th width="81">Xem</th>
</tr>
<?php foreach($doanh_nghiep as $row){ $stt++; ?>
<tr bgcolor="#ffffff" style="text-align:center;">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center"><?php echo $stt ?></div>
</td>
<td width="67" class="ProductCart" style="text-align:center;">
<?php echo $row['ma'] ?>
</td>
<td width="528" align="center" class="">
<div align="left"><a href="chi_tiet_mdn.php?ma_dn=<?php echo $row['ma'] ?>" class="mau_tieu_de" style="text-decoration: none;"><?php echo $row['gioi_thieu'] ?></a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<?php echo number_format($row['gia']) ?>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center"><?php echo $row['dia_chi'] ?></div>
</td>
<td width="81" align="center">
<a href="chi_tiet_mdn.php?ma_dn=<?php echo $row['ma'] ?>" class="detail_cohoi">Chi tiết</a></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/danh_sach_mdn.php
|
PHP
|
gpl3
| 5,858
|
<?php
require_once '../classes/xl_doanh_nghiep.php';
$ma_dn = $_GET['ma_dn'];
$xl_dn = new xl_doanh_nghiep();
$chitiet = $xl_dn->xem($ma_dn);
//$stt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mua bán doanh nghiệp</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br />
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif" /></div>
<div class="pageTitle">
CƠ HỘI MUA DOANH NGHIỆP :: DN SẢN XUẤT
</div>
</td>
</tr>
</tbody>
</table>
<br />
<table width="98%" cellspacing="1" cellpadding="5" border="0" bgcolor="#CCCCCC" align="center">
<tbody>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Mã doanh nghiệp:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet['ma'] ?></a></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Doanh nghiệp cần bán :</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet['gioi_thieu'] ?> </td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Giá bán (VNĐ):</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"> <?php echo number_format($chitiet['gia']) ?></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Địa phương:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet['dia_chi'] ?></td>
</tr>
<tr>
<td width="21%" valign="top" bgcolor="#FFFFFF" class="ProductTextField">Thông tin chi tiết:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet['thong_tin_rieng'] ?> </td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center" colspan="2">
<a href="index.php?frame=dnghiep&mode=mua&id=579">
<img border="0" src="../upload/images/giaodich.gif">
</a>
</td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/chi_tiet_mdn.php
|
PHP
|
gpl3
| 3,582
|
<?php
require_once '../classes/xl_thong_tin_von.php';
$ma_von = $_GET['ma_von'];
$xl_von = new xl_thong_tin_von();
$chitiet_von = $xl_von->xem_chi_tiet($ma_von);
//$stt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>..:: CƠ HỘI CHO VAY VỐN :: BẤT ĐỘNG SẢN ::..</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br />
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif" /></div>
<div class="pageTitle">
CƠ HỘI CHO VAY VỐN :: BẤT ĐỘNG SẢN
</div>
</td>
</tr>
</tbody>
</table>
<br />
<table width="98%" cellspacing="1" cellpadding="5" border="0" bgcolor="#CCCCCC" align="center">
<tbody>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Mã vốn:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_von['ma_von'] ?></a></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Doanh nghiệp cần vay vốn :</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_von['gioi_thieu'] ?> </td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Vốn cần vay (VNĐ):</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"> <?php echo number_format($chitiet_von['von_huy_dong']) ?></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Địa phương:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_von['dia_chi'] ?></td>
</tr>
<tr>
<td width="21%" valign="top" bgcolor="#FFFFFF" class="ProductTextField">Thông tin chi tiết:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_von['thong_tin_rieng'] ?> </td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center" colspan="2">
<a href="index.php?frame=dnghiep&mode=mua&id=579">
<img border="0" src="../upload/images/giaodich.gif">
</a>
</td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/chi_tiet_dnvv.php
|
PHP
|
gpl3
| 3,669
|
<?php
require_once '../classes/xl_du_an.php';
$ma_da = $_GET['ma_da'];
$xl_da = new xl_du_an();
$chitiet_du_an = $xl_da->xem_chi_tiet($ma_da);
//$stt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>..:: CƠ HỘI ĐẦU TƯ VÀO DỰ ÁN ::..</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br />
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif" /></div>
<div class="pageTitle">
CƠ HỘI ĐẦU TƯ VÀO DỰ ÁN :: BẤT ĐỘNG SẢN
</div>
</td>
</tr>
</tbody>
</table>
<br />
<table width="98%" cellspacing="1" cellpadding="5" border="0" bgcolor="#CCCCCC" align="center">
<tbody>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Mã dự án:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_du_an['ma'] ?></a></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Dự án cần đầu tư :</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_du_an['ten_du_an'] ?> </td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Vốn đầu tư (VNĐ):</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"> <?php echo number_format($chitiet_du_an['von_dau_tu']) ?></td>
</tr>
<tr>
<td width="21%" bgcolor="#FFFFFF" class="ProductTextField">Địa phương:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_du_an['dia_chi'] ?></td>
</tr>
<tr>
<td width="21%" valign="top" bgcolor="#FFFFFF" class="ProductTextField">Thông tin chi tiết:</td>
<td width="79%" bgcolor="#FFFFFF" class="ProductText"><?php echo $chitiet_du_an['thong_tin_chi_tiet'] ?> </td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center" colspan="2">
<a href="index.php?frame=dnghiep&mode=mua&id=579">
<img border="0" src="../upload/images/giaodich.gif">
</a>
</td>
</tr>
<tr>
<td height="7" bgcolor="#FFFFFF" colspan="2"></td>
</tr>
</tbody>
</table>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/chi_tiet_dadt.php
|
PHP
|
gpl3
| 3,654
|
<?php
/**
* Created by JetBrains PhpStorm.
* User: MINHKHANG
* Date: 12/9/12
* Time: 1:49 AM
* To change this template use File | Settings | File Templates.
*/
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/index.php
|
PHP
|
gpl3
| 172
|
<?php
require_once '../classes/xl_du_an.php';
$ma_p = $_GET['ma_p'];
$ma_lda = $_GET['ma_lda'];
$xl_du_an = new xl_du_an();
if($ma_lda =='all')
$du_an = $xl_du_an->danh_sach_theo_loai_all(0,10,$ma_p);
else
$du_an = $xl_du_an->danh_sach_theo_loai(0,10, $ma_p, $ma_lda);
$stt = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>..:: CƠ HỘI ĐẦU TƯ VÀO DỰ ÁN ::..</title>
<?php
include('../widgets/js_css.php');
?>
</head>
<body>
<div class="outer">
<?php
include('../widgets/banner.php');
include('../widgets/top_menu.php');
?>
<div class="left">
<?php
include('../widgets/co_hoi.php');
include('../widgets/tim_kiem_co_hoi_khac.php');
include('../widgets/cac_chuyen_muc_hay.php');
include('../widgets/quang_cao.php');
include('../widgets/tim_kiem.php');
?>
</div>
<div class="center">
<br/>
<table width="98%" cellspacing="0" cellpadding="0" border="0" align="center" id="table5">
<tbody>
<tr>
<td height="20" bgcolor="#5FA703">
<div style="width: 30px; float: left; padding-left: 2px;"><img src="../upload/images/icon_02.gif"/></div>
<div class="pageTitle">
CƠ HỘI ĐẦU TƯ VÀO DỰ ÁN :: BẤT ĐỘNG SẢN
</div>
</td>
</tr>
</tbody>
</table>
<br/>
<?php if(count($du_an)==0)
echo "<p align='center'>Đang cập nhật thông tin. Xin mời bạn quay lại sau. </p>";
else { ?>
<form style="display:inline" method="post" action="index.php?frame=dnghiep&danhmucid=8" name="frmSearch2">
<table width="98%">
<tbody>
<tr>
<td bgcolor="#F8F8F8" class="normal_font">
<img src="../upload/images/search_icon.gif">
<input style="width:180px" size="25" class="input" value="" name="keyword2">
<input type="submit" class="button" value="Tìm nhanh" name="button">
<font color="red"><b>Tìm theo mã, tên hoặc theo địa phương</b></font></td>
</tr>
</tbody>
</table>
</form>
<br/>
<table width="590px" cellspacing="1" border="2" align="center" cellpading="2"
style="border-collapse: collapse; margin: 0 auto">
<tbody>
<tr height="30" bgcolor="#99FF33" style="text-align:center;" >
<th width="28">STT</th>
<th width="67">Mã DA</th>
<th width="528">Dự Án Cần Đầu Tư</th>
<th width="111" align="center">Vốn Đầu Tư (VNĐ)</th>
<th width="122">Địa Phương</th>
<th width="81">Xem</th>
</tr>
<?php foreach($du_an as $row_du_an){ $stt++; ?>
<tr bgcolor="#ffffff" style="text-align:center;">
<td width="28" align="right"
style="PADDING-RIGHT: 5px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
class="ProductCart">
<div align="center"><?php echo $stt ?></div>
</td>
<td width="67" class="ProductCart" style="text-align:center;">
<?php echo $row_du_an['ma'] ?>
</td>
<td width="528" align="center" class="">
<div align="left"><a href="chi_tiet_dadt.php?ma_da=<?php echo $row_du_an['ma'] ?>" class="mau_tieu_de" style="text-decoration: none;"><?php echo $row_du_an['ten_du_an'] ?></a>
</div>
<div align="center"></div>
</td>
<td width="111" align="right" class="ProductPrice">
<?php echo number_format($row_du_an['von_dau_tu']) ?>
</td>
<td width="122" align="right" class="ProductPrice">
<div align="center"><?php echo $row_du_an['dia_chi'] ?></div>
</td>
<td width="81" align="center">
<a href="chi_tiet_dadt.php?ma_da=<?php echo $row_du_an['ma'] ?>" class="detail_cohoi">Chi tiết</a></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
<div class="right">
<?php
include('../widgets/dang_ky.php');
include('../widgets/thue_cho_thue.php');
include('../widgets/tin_tuc_IDJ.php');
include('../widgets/doi_tac.php');
?>
</div>
<?php
include('../widgets/footer.php');
?>
</div>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/co_hoi/danh_sach_dadt.php
|
PHP
|
gpl3
| 5,814
|
<?php
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'doanh_nghiep');
define ('DB_USER', 'root');
define ('DB_PASS', '');
define ('ADMIN_LIMIT', 20);
define ('USER_LIMIT', 6);
define ('SALT','ILYAYE33');
//loai phieu dang ky
define ('ban_dn','Bán doanh nghiệp');
define ('tim_td','Tìm nguồn tín dụng');
define ('tim_ndt','Tìm nhà đầu tư');
define ('cho_thue','Cho thuê');
define ('gd_mua','Giao dịch mua DN');
define ('gd_dt','Giao dịch đầu tư dự án');
define ('gd_vv','Giao dịch vay vốn');
define ('mua_ndm','Mua DN ngoài danh mục');
define ('dautu_ndm','Đầu tư ngoài danh mục');
define ('chovay_ndm','Cho vay ngoài danh mục');
define ('tim_dt_ndm','Tìm đối tác ngoài danh mục');
?>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/config.php
|
PHP
|
gpl3
| 804
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="0; url=trang_chu/index.php" />
<!--0 la so giay.-->
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
|
10-ptud-v1
|
trunk/ 10-ptud-v1/index.php
|
Hack
|
gpl3
| 431
|
html, body, h1, h2, h3, h4 {
margin: 0;
padding: 0;
}
h1 img {
display: block;
}
img {
border: 0;
}
a {
color: #990000;
font-weight: bold;
text-decoration: none;
}
a:hover {
color: #FFA405;
text-decoration: underline;
}
.left {
float: left;
}
.right {
float: right;
}
.more {
text-align: right;
}
.clear {
clear: both;
}
body {
background: #000;
text-align: center;
font: 11px arial, sans-serif;
color: #312F1A;
}
/** layout **/
#wrapper {
text-align: left;
margin: 20px auto;
width: 714px;
position: relative;
}
#header {
background: top center url(images/logo.jpg) no-repeat;
padding-top: 51px;
width: 252px;
position: relative;
}
/** Header **/
h1 {
color: #FDE7C2;
background: #991111;
border: 2px solid #C4B888;
padding: 8px;
text-align: center;
font: 25px "Times new roman", sans-serif;
font-style: italic;
font-weight: normal;
margin: 0 0 2px 21px;
}
#search {
width: 148px;
background: #E8E7DA url(images/search_top.jpg) no-repeat;
text-align: center;
position: absolute;
bottom: -1px;
left: 558px;
padding: 6px 0;
}
#search .text {
width: 63px;
}
/** Body **/
#body {
position: relative;
width: 100%;
}
#nav {
position: absolute;
top: 0;
left: 0;
width: 252px;
padding-top: 292px;
background: url(images/pic_1.jpg) no-repeat;
}
#nav ul {
background: bottom right #991111 url(images/nav_bot.jpg) no-repeat;
margin: 0 7px 0 28px;
padding: 5px 20px 15px 20px;
}
#nav li {
list-style: none;
background: bottom left url(images/dots.jpg) repeat-x;
}
#nav a {
color: #FDE7C2;
font: 18px "times new roman", serif;
font-style: italic;
background: #991111;
padding-right: 8px;
}
/** content **/
#content {
background: #E8E7DA bottom right url(images/body_bottom_right.jpg) no-repeat;
width: 462px;
margin-left: 254px;
min-height: 278px;
}
#content .main, #content .main2 {
float: right;
width: 250px;
margin-top: 14px;
padding-right: 28px;
}
#content .main {
padding-bottom: 1em;
border-bottom: 1px solid #D6D3BA;
}
#content .main p, #content .main2 p {
margin: 0em 1em 0 0;
}
#content .main2 .right {
margin-left: 18px;
}
#content .main .clear, #content .main2 .clear {
height: 20px;
margin-bottom: -10px;
}
#treasure_box {
float: right;
width: 134px;
border-left: 1px solid #D6D3BA;
padding: 12px;
background: top right url(images/bogy_top_right.jpg) no-repeat;
}
#treasure_box span {
float: left;
width: 12px;
font-size: 9px;
clear: both;
margin-top: 3px;
}
#treasure_box p {
float: left;
width: 110px;
margin: 0 0 0.6em 0;
padding: 0 0 0 1em;
line-height: 1.3;
}
#treasure_box .clear {
height: 10px;
}
h2 {
font: italic 22px "Times new roman", serif;
color: #991111;
margin: 0 0 0.5em 0;
}
/** Footer **/
#footer {
color: #E8E7DA;
margin: 2px 0 0 275px;
}
#privacy {
position: absolute;
right: 8px;
width: 148px;
padding: 4px 0;
text-align: center;
background: #E8E7DA bottom left url(images/footer_tab.jpg) no-repeat;
}
#privacy a {
color: #000;
font-weight: normal;
}
|
069ka3-update-box
|
trunk/sanju/update_box/style.css
|
CSS
|
mit
| 3,270
|
/*
Credit: http://www.templatemo.com
*/
body {
margin: 0px;
padding: 0px;
color: #c2bead;
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
line-height: 1.5em;
background-color: #2f2e28;
background-image: url(images/templatemo_body.jpg);
background-repeat: repeat-y;
background-position: left;
}
a, a:link, a:visited { color: #34baf9; text-decoration: none; }
a:hover { color: #CCFF00; text-decoration: underline; }
p { margin: 0 0 10px 0; padding: 0; }
img { border: none; }
h1, h2, h3, h4, h5, h6 { color: #e2c934; }
h1 { font-size: 24px; font-weight: normal; margin: 0 0 30px 0; padding: 5px 0; }
h2 { font-size: 20px; font-weight: normal; margin: 0 0 30px 0; font-weight: normal; }
h3 { font-size: 16px; margin: 0 0 15px 0; padding: 0; padding: 0; font-weight: normal; }
h4 { font-size: 14px; margin: 0 0 15px 0; padding: 0; }
.cleaner { clear: both; width: 100%; height: 0px; font-size: 0px; }
.cleaner_h10 { clear: both; width:100%; height: 10px; }
.cleaner_h20 { clear: both; width:100%; height: 20px; }
.cleaner_h30 { clear: both; width:100%; height: 30px; }
.cleaner_h40 { clear: both; width:100%; height: 40px; }
.cleaner_h50 { clear: both; width:100%; height: 50px; }
.cleaner_h60 { clear: both; width:100%; height: 60px; }
.float_l { float: left; }
.float_r { float: right; }
.image_wrapper { display: inline-block; border: 1px solid #000; background: #333; padding: 4px; margin-bottom: 10px; }
.image_fl { float: left; margin: 3px 15px 0 0; }
.image_fr { float: right; margin: 3px 0 0 15px; }
blockquote { font-style: italic; margin: 0 0 0 10px;}
cite { font-weight: bold; color:#333; }
cite span { color: #666; }
em { color: #f9a834; }
.tmo_list { margin: 20px 0 20px 20px; padding: 0; list-style: none; }
.tmo_list li { background: transparent url(images/templatemo_list.png) no-repeat; margin:0 0 20px; padding: 0 0 0 20px; line-height: 1em; }
.tmo_list li a { color: #fff; }
.tmo_list li a:hover { color: #ff4301; }
.btn_more a {
display: inline-block;
font-weight: bold;
color: #dcd9cb;
}
.btn_more a span {
font-size: 16px;
}
.btn_more a:hover {
color: #CCFF00;
text-decoration: none;
}
.service_list { margin: 40px 0 0 30px; padding: 0; list-style: none; }
.service_list li { margin: 0; padding: 0; }
.service_list li a { display: block; height: 25px; margin-bottom: 20px; padding-left: 35px; }
.service_list li .service_one { background: url(images/onebit_08.png) center left no-repeat; }
.service_list li .service_two { background: url(images/onebit_11.png) center left no-repeat; }
.service_list li .service_three { background: url(images/onebit_17.png) center left no-repeat; }
.service_list li .service_four { background: url(images/onebit_21.png) center left no-repeat; }
.service_list li .service_five { background: url(images/onebit_12.png) center left no-repeat; }
#contact_form { padding: 0; }
#contact_form form { margin: 0px; padding: 0px; }
#contact_form form .input_field { width: 440px; padding: 8px; background: #333028; border: 1px solid #886; color: #FFF; }
#contact_form form label { display: block; width: 100px; margin-right: 10px; font-size: 14px; margin-bottom: 3px; }
#contact_form form textarea {
width: 440px;
height: 120px;
padding: 8px;
background: #333028;
font-family: Arial, Helvetica, sans-serif;
border: 1px solid #886;
color: #FFF;
}
#contact_form form .submit_btn {
color: #886;
background: #333028;
border: 1px solid #886;
padding: 10px 20px;
margin-right: 140px;
font-size: 15px;
}
#gallery_container {
clear: both;
margin-top: 30px;
padding-right: 40px;
width: 480px;
height: 320px;
overflow: auto;
}
#gallery_container .gallery_box {
clear: both;
display: block;
padding: 0;
margin: 0 0 40px 0;
}
.gallery_box img {
float: left;
width: 120px;
height: 100px;
padding: 4px;
background: #fff;
border: 1px solid #ccc;
margin: 3px 30px 0 0;
}
#templatemo_footer {
clear: both;
width: 600px;
padding: 20px 0;
text-align: center;
}
|
069ka3-update-box
|
trunk/sanju/update_box/templatemo_style.css
|
CSS
|
mit
| 4,119
|
/**
* jQuery.ScrollTo
* Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* Date: 2/19/2008
*
* @projectDescription Easy element scrolling using jQuery.
* Tested with jQuery 1.2.1. On FF 2.0.0.11, IE 6, Opera 9.22 and Safari 3 beta. on Windows.
*
* @author Ariel Flesler
* @version 1.3.3
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
* The different options for target are:
* - A number position (will be applied to all axes).
* - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
* - A jQuery/DOM element ( logically, child of the element to scroll )
* - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
* - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object} settings Hash of settings, optional.
* @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
* @option {Number} duration The OVERALL length of the animation.
* @option {String} easing The easing method for the animation.
* @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
* @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
* @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
* @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
* @option {Function} onAfter Function to be called after the scrolling ends.
* @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @example $('div').scrollTo( 340 );
*
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
* $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
* alert('scrolled!!');
* }});
*
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { offset:-20 } );
*
* Notes:
* - jQuery.scrollTo will make the whole window scroll, it accepts the same arguments as jQuery.fn.scrollTo.
* - If you are interested in animated anchor navigation, check http://jquery.com/plugins/project/LocalScroll.
* - The options margin, offset and over are ignored, if the target is not a jQuery object or a DOM element.
* - The option 'queue' won't be taken into account, if only 1 axis is given.
*/
;(function( $ ){
var $scrollTo = $.scrollTo = function( target, duration, settings ){
$scrollTo.window().scrollTo( target, duration, settings );
};
$scrollTo.defaults = {
axis:'y',
duration:1
};
//returns the element that needs to be animated to scroll the window
$scrollTo.window = function(){
return $( $.browser.safari ? 'body' : 'html' );
};
$.fn.scrollTo = function( target, duration, settings ){
if( typeof duration == 'object' ){
settings = duration;
duration = 0;
}
settings = $.extend( {}, $scrollTo.defaults, settings );
duration = duration || settings.speed || settings.duration;//speed is still recognized for backwards compatibility
settings.queue = settings.queue && settings.axis.length > 1;//make sure the settings are given right
if( settings.queue )
duration /= 2;//let's keep the overall speed, the same.
settings.offset = both( settings.offset );
settings.over = both( settings.over );
return this.each(function(){
var elem = this, $elem = $(elem),
t = target, toff, attr = {},
win = $elem.is('html,body');
switch( typeof t ){
case 'number'://will pass the regex
case 'string':
if( /^([+-]=)?\d+(px)?$/.test(t) ){
t = both( t );
break;//we are done
}
t = $(t,this);// relative selector, no break!
case 'object':
if( t.is || t.style )//DOM/jQuery
toff = (t = $(t)).offset();//get the real position of the target
}
$.each( settings.axis.split(''), function( i, axis ){
var Pos = axis == 'x' ? 'Left' : 'Top',
pos = Pos.toLowerCase(),
key = 'scroll' + Pos,
act = elem[key],
Dim = axis == 'x' ? 'Width' : 'Height',
dim = Dim.toLowerCase();
if( toff ){//jQuery/DOM
attr[key] = toff[pos] + ( win ? 0 : act - $elem.offset()[pos] );
if( settings.margin ){//if it's a dom element, reduce the margin
attr[key] -= parseInt(t.css('margin'+Pos)) || 0;
attr[key] -= parseInt(t.css('border'+Pos+'Width')) || 0;
}
attr[key] += settings.offset[pos] || 0;//add/deduct the offset
if( settings.over[pos] )//scroll to a fraction of its width/height
attr[key] += t[dim]() * settings.over[pos];
}else
attr[key] = t[pos];//remove the unnecesary 'px'
if( /^\d+$/.test(attr[key]) )//number or 'number'
attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );//check the limits
if( !i && settings.queue ){//queueing each axis is required
if( act != attr[key] )//don't waste time animating, if there's no need.
animate( settings.onAfterFirst );//intermediate animation
delete attr[key];//don't animate this axis again in the next iteration.
}
});
animate( settings.onAfter );
function animate( callback ){
$elem.animate( attr, duration, settings.easing, callback && function(){
callback.call(this, target);
});
};
function max( Dim ){
var el = win ? $.browser.opera ? document.body : document.documentElement : elem;
return el['scroll'+Dim] - el['client'+Dim];
};
});
};
function both( val ){
return typeof val == 'object' ? val : { top:val, left:val };
};
})( jQuery );// JavaScript Document
|
069ka3-update-box
|
trunk/sanju/update_box/js/jquery.scrollTo-1.3.3.js
|
JavaScript
|
mit
| 6,525
|
/**
* jQuery.LocalScroll
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/10/2008
*
* @projectDescription Animated scrolling navigation, using anchors.
* http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html
* @author Ariel Flesler
* @version 1.2.5
*
* @id jQuery.fn.localScroll
* @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @example $('ul.links').localScroll();
*
* @example $('ul.links').localScroll({ filter:'.animated', duration:400, axis:'x' });
*
* @example $.localScroll({ target:'#pane', axis:'xy', queue:true, event:'mouseover' });
*
* Notes:
* - The plugin requires jQuery.ScrollTo.
* - The hash of settings, is passed to jQuery.ScrollTo, so the settings are valid for that plugin as well.
* - jQuery.localScroll can be used if the desired links, are all over the document, it accepts the same settings.
* - If the setting 'lazy' is set to true, then the binding will still work for later added anchors.
* - The setting 'speed' is deprecated, use 'duration' instead.
* - If onBefore returns false, the event is ignored.
**/
;(function( $ ){
var URI = location.href.replace(/#.*/,'');//local url without hash
var $localScroll = $.localScroll = function( settings ){
$('body').localScroll( settings );
};
//Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option.
//@see http://www.freewebs.com/flesler/jQuery.ScrollTo/
$localScroll.defaults = {//the defaults are public and can be overriden.
duration:1000, //how long to animate.
axis:'y',//which of top and left should be modified.
event:'click',//on which event to react.
stop:true//avoid queuing animations
/*
lock:false,//ignore events if already animating
lazy:false,//if true, links can be added later, and will still work.
target:null, //what to scroll (selector or element). Keep it null if want to scroll the whole window.
filter:null, //filter some anchors out of the matched elements.
hash: false//if true, the hash of the selected link, will appear on the address bar.
*/
};
//if the URL contains a hash, it will scroll to the pointed element
$localScroll.hash = function( settings ){
settings = $.extend( {}, $localScroll.defaults, settings );
settings.hash = false;//can't be true
if( location.hash )
setTimeout(function(){ scroll( 0, location, settings ); }, 0 );//better wrapped with a setTimeout
};
$.fn.localScroll = function( settings ){
settings = $.extend( {}, $localScroll.defaults, settings );
return ( settings.persistent || settings.lazy )
? this.bind( settings.event, function( e ){//use event delegation, more links can be added later.
var a = $([e.target, e.target.parentNode]).filter(filter)[0];//if a valid link was clicked.
a && scroll( e, a, settings );//do scroll.
})
: this.find('a')//bind concretely, to each matching link
.filter( filter ).bind( settings.event, function(e){
scroll( e, this, settings );
}).end()
.end();
function filter(){//is this a link that points to an anchor and passes a possible filter ? href is checked to avoid a bug in FF.
return !!this.href && !!this.hash && this.href.replace(this.hash,'') == URI && (!settings.filter || $(this).is( settings.filter ));
};
};
function scroll( e, link, settings ){
var id = link.hash.slice(1),
elem = document.getElementById(id) || document.getElementsByName(id)[0];
if ( elem ){
e && e.preventDefault();
var $target = $( settings.target || $.scrollTo.window() );//if none specified, then the window.
if( settings.lock && $target.is(':animated') ||
settings.onBefore && settings.onBefore.call(link, e, elem, $target) === false ) return;
if( settings.stop )
$target.queue('fx',[]).stop();//remove all its animations
$target
.scrollTo( elem, settings )//do scroll
.trigger('notify.serialScroll',[elem]);//notify serialScroll about this change
if( settings.hash )
$target.queue(function(){
location = link.hash;
});
}
};
})( jQuery );
|
069ka3-update-box
|
trunk/sanju/update_box/js/jquery.localscroll-1.2.5.js
|
JavaScript
|
mit
| 4,356
|
// when the DOM is ready...
$(document).ready(function () {
var $panels = $('#slider .scrollContainer > div');
var $container = $('#slider .scrollContainer');
// if false, we'll float all the panels left and fix the width
// of the container
var horizontal = false;
// float the panels left if we're going horizontal
if (horizontal) {
$panels.css({
'float' : 'left',
'position' : 'relative' // IE fix to ensure overflow is hidden
});
// calculate a new width for the container (so it holds all panels)
$container.css('width', $panels[0].offsetWidth * $panels.length);
}
// collect the scroll object, at the same time apply the hidden overflow
// to remove the default scrollbars that will appear
var $scroll = $('#slider .scroll').css('overflow', 'hidden');
// apply our left + right buttons
$scroll
.before('<img class="scrollButtons left" src="" />')
.after('<img class="scrollButtons right" src="" />');
// handle nav selection
function selectNav() {
$(this)
.parents('ul:first')
.find('a')
.removeClass('selected')
.end()
.end()
.addClass('selected');
}
$('#slider .navigation').find('a').click(selectNav);
// go find the navigation link that has this target and select the nav
function trigger(data) {
var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
selectNav.call(el);
}
if (window.location.hash) {
trigger({ id : window.location.hash.substr(1) });
} else {
$('ul.navigation a:first').click();
}
// offset is used to move to *exactly* the right place, since I'm using
// padding on my example, I need to subtract the amount of padding to
// the offset. Try removing this to get a good idea of the effect
var offset = parseInt((horizontal ?
$container.css('paddingTop') :
$container.css('paddingLeft'))
|| 0) * -1;
var scrollOptions = {
target: $scroll, // the element that has the overflow
// can be a selector which will be relative to the target
items: $panels,
navigation: '.navigation a',
// selectors are NOT relative to document, i.e. make sure they're unique
prev: 'img.left',
next: 'img.right',
// allow the scroll effect to run both directions
axis: 'xy',
onAfter: trigger, // our final callback
offset: offset,
// duration of the sliding effect
duration: 500,
// easing - can be used with the easing plugin:
// http://gsgd.co.uk/sandbox/jquery/easing/
easing: 'swing'
};
// apply serialScroll to the slider - we chose this plugin because it
// supports// the indexed next and previous scroll along with hooking
// in to our navigation.
$('#slider').serialScroll(scrollOptions);
// now apply localScroll to hook any other arbitrary links to trigger
// the effect
$.localScroll(scrollOptions);
// finally, if the URL has a hash, move the slider in to position,
// setting the duration to 1 because I don't want it to scroll in the
// very first page load. We don't always need this, but it ensures
// the positioning is absolutely spot on when the pages loads.
scrollOptions.duration = 1;
$.localScroll.hash(scrollOptions);
});
|
069ka3-update-box
|
trunk/sanju/update_box/js/coda-slider.js
|
JavaScript
|
mit
| 3,634
|
/**
* jQuery.serialScroll
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/20/2008
*
* @projectDescription Animated scrolling of series.
* @author Ariel Flesler
* @version 1.2.1
*
* @id jQuery.serialScroll
* @id jQuery.fn.serialScroll
* @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
*
* Notes:
* - The plugin requires jQuery.ScrollTo.
* - The hash of settings, is passed to jQuery.ScrollTo, so its settings can be used as well.
*/
;(function( $ ){
var $serialScroll = $.serialScroll = function( settings ){
$.scrollTo.window().serialScroll( settings );
};
//Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option.
//@see http://flesler.webs/jQuery.ScrollTo/
$serialScroll.defaults = {//the defaults are public and can be overriden.
duration:1000, //how long to animate.
axis:'x', //which of top and left should be scrolled
event:'click', //on which event to react.
start:0, //first element (zero-based index)
step:1, //how many elements to scroll on each action
lock:true,//ignore events if already animating
cycle:true, //cycle endlessly ( constant velocity )
constant:true //use contant speed ?
/*
navigation:null,//if specified, it's a selector a collection of items to navigate the container
target:null, //if specified, it's a selector to the element to be scrolled.
interval:0, //it's the number of milliseconds to automatically go to the next
lazy:false,//go find the elements each time (allows AJAX or JS content, or reordering)
stop:false, //stop any previous animations to avoid queueing
force:false,//force the scroll to the first element on start ?
jump: false,//if true, when the event is triggered on an element, the pane scrolls to it
items:null, //selector to the items (relative to the matched elements)
prev:null, //selector to the 'prev' button
next:null, //selector to the 'next' button
onBefore: function(){}, //function called before scrolling, if it returns false, the event is ignored
exclude:0 //exclude the last x elements, so we cannot scroll past the end
*/
};
$.fn.serialScroll = function( settings ){
settings = $.extend( {}, $serialScroll.defaults, settings );
var event = settings.event, //this one is just to get shorter code when compressed
step = settings.step, // idem
lazy = settings.lazy;//idem
return this.each(function(){
var
context = settings.target ? this : document, //if a target is specified, then everything's relative to 'this'.
$pane = $(settings.target || this, context),//the element to be scrolled (will carry all the events)
pane = $pane[0], //will be reused, save it into a variable
items = settings.items, //will hold a lazy list of elements
active = settings.start, //active index
auto = settings.interval, //boolean, do auto or not
nav = settings.navigation, //save it now to make the code shorter
timer; //holds the interval id
if( !lazy )//if not lazy, go get the items now
items = getItems();
if( settings.force )
jump( {}, active );//generate an initial call
// Button binding, optionall
$(settings.prev||[], context).bind( event, -step, move );
$(settings.next||[], context).bind( event, step, move );
// Custom events bound to the container
if( !pane.ssbound )//don't bind more than once
$pane
.bind('prev.serialScroll', -step, move ) //you can trigger with just 'prev'
.bind('next.serialScroll', step, move ) //for example: $(container).trigger('next');
.bind('goto.serialScroll', jump ); //for example: $(container).trigger('goto', [4] );
if( auto )
$pane
.bind('start.serialScroll', function(e){
if( !auto ){
clear();
auto = true;
next();
}
})
.bind('stop.serialScroll', function(){//stop a current animation
clear();
auto = false;
});
$pane.bind('notify.serialScroll', function(e, elem){//let serialScroll know that the index changed externally
var i = index(elem);
if( i > -1 )
active = i;
});
pane.ssbound = true;//avoid many bindings
if( settings.jump )//can't use jump if using lazy items and a non-bubbling event
(lazy ? $pane : getItems()).bind( event, function( e ){
jump( e, index(e.target) );
});
if( nav )
nav = $(nav, context).bind(event, function( e ){
e.data = Math.round(getItems().length / nav.length) * nav.index(this);
jump( e, this );
});
function move( e ){
e.data += active;
jump( e, this );
};
function jump( e, button ){
if( !isNaN(button) ){//initial or special call from the outside $(container).trigger('goto',[index]);
e.data = button;
button = pane;
}
var
pos = e.data, n,
real = e.type, //is a real event triggering ?
$items = settings.exclude ? getItems().slice(0,-settings.exclude) : getItems(),//handle a possible exclude
limit = $items.length,
elem = $items[pos],
duration = settings.duration;
if( real )//real event object
e.preventDefault();
if( auto ){
clear();//clear any possible automatic scrolling.
timer = setTimeout( next, settings.interval );
}
if( !elem ){ //exceeded the limits
n = pos < 0 ? 0 : limit - 1;
if( active != n )//we exceeded for the first time
pos = n;
else if( !settings.cycle )//this is a bad case
return;
else
pos = limit - n - 1;//invert, go to the other side
elem = $items[pos];
}
if( !elem || real && active == pos || //could happen, save some CPU cycles in vain
settings.lock && $pane.is(':animated') || //no animations while busy
real && settings.onBefore && //callback returns false ?
settings.onBefore.call(button, e, elem, $pane, getItems(), pos) === false ) return;
if( settings.stop )
$pane.queue('fx',[]).stop();//remove all its animations
if( settings.constant )
duration = Math.abs(duration/step * (active - pos ));//keep constant velocity
$pane
.scrollTo( elem, duration, settings )//do scroll
.trigger('notify.serialScroll',[pos]);//in case serialScroll was called on this elem more than once.
};
function next(){//I'll use the namespace to avoid conflicts
$pane.trigger('next.serialScroll');
};
function clear(){
clearTimeout(timer);
};
function getItems(){
return $( items, pane );
};
function index( elem ){
if( !isNaN(elem) ) return elem;//number
var $items = getItems(), i;
while(( i = $items.index(elem)) == -1 && elem != pane )//see if it matches or one of its ancestors
elem = elem.parentNode;
return i;
};
});
};
})( jQuery );
|
069ka3-update-box
|
trunk/sanju/update_box/js/jquery.serialScroll-1.2.1.js
|
JavaScript
|
mit
| 7,165
|
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
|
069ka3-update-box
|
trunk/sanju/update_box/js/jquery.easing.1.3.js
|
JavaScript
|
mit
| 8,097
|
<?php
include "dbaction/user_add.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
function sure(){
if (confirm("Are you sure you want to delete this user?")){
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<div class="container">
<p>Entry of Members</p>
<?php
echo "<pre>";
print_r($users);
echo "</pre>";
?>
<?php
//step 1 (connection)
$con=mysql_connect("localhost", "root", "");
//step 2 (database)
mysql_select_db("update_box");
//step 3 SQL/get result
$sql="SELECT * from `users`";
$result = mysql_query($sql);
?>
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th></th>
<th>firstname</th>
<th>midname</th>
<th>lastname</th>
<th>Username</th>
<th>email</th>
<th>address</th>
<th>phone</th>
<th>date_of_birth</th>
<th>about</th>
<th>Usertype</th>
<th>created_at</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
//step 4 (grab/process result of query)
$i=0;
while($row = mysql_fetch_assoc($result)){
$i++;
echo "</pre>";
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $id; ?></td>
<td><?php echo $row['first_name'];?></td>
<td><?php echo $row['mid_name'];?></td>
<td><?php echo $row['last_name'];?></td>
<td><?php echo $row['username'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['address'];?></td>
<td><?php echo $row['phone'];?></td>
<td><?php echo $row['dob'];?></td>
<td><?php echo $row['about'];?></td>
<td><?php echo $row['user_type'];?></td>
<td><?php echo $row['created_at'];?></td>
<td>
<a href="">view</a>
<a onclick="# "href="dbaction/edit.php?id=<?php echo $row['id'];?>">edit</a>
<a onclick="return sure()" href="dbaction/user_delete.php?id=<?php echo $row['id'];?>">delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<h3>ADD NEW USER </h3>
<form class="form-horizontal" action="" method="POST">
<div class="control-group <?php if($first_name_error ){echo 'error';}?> ">
<label class="control-label" for="firstname">firstname</label>
<div class="controls">
<input type="text" name="firstname" value="<?php if(isset($first_name)) echo $first_name; ?>" id="inputtext" >
<?php if ($firstname_error) {?>
<span class="help_inline"><?php echo $first_name_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($mid_name_error ){echo 'error';}?> ">
<label class="control-label" for="mid_name">mid_name</label>
<div class="controls">
<input type="text" name="midname" value="<?php if(isset($mid_name)) echo $mid_name; ?>" id="inputtext" >
<?php if ($mid_name_error) {?>
<span class="help_inline"><?php echo $mid_name_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($last_name_error ){echo 'error';}?> ">
<label class="control-label" for="last_name">last_name</label>
<div class="controls">
<input type="text" name="lastname" value="<?php if(isset($last_name)) echo $last_name; ?>" id="inputtext" >
<?php if ($last_name_error) {?>
<span class="help_inline"><?php echo $last_name_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($username_error ){echo 'error';}?> ">
<label class="control-label" for="username">Username</label>
<div class="controls">
<input type="text" name="username" value="<?php if(isset($username)) echo $username; ?>" id="inputtext" >
<?php if ($username_error) {?>
<span class="help_inline"><?php echo $username_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($email_error ){echo 'error';}?> ">
<label class="control-label " for="email">Email</label>
<div class="controls">
<input type="text" name="email" value="<?php if(isset($email)) echo $email; ?> " id="inputtext" >
<?php if ($email_error) {?>
<span class="help_inline"><?php echo $email_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($password_error ){echo 'error';}?> ">
<label class="control-label" for="password">password</label>
<div class="controls">
<input type="password" name="password" value="" id="inputPassword" >
<?php if ($password_error) {?>
<span class="help_inline"><?php echo $password_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($address_error ){echo 'error';}?> ">
<label class="control-label" for="address">address</label>
<div class="controls">
<input type="text" name="address" value="<?php if(isset($address)) echo $address; ?>" id="inputtext" >
<?php if ($address_error) {?>
<span class="help_inline"><?php echo $address_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($phone_error ){echo 'error';}?> ">
<label class="control-label" for="phone">phone</label>
<div class="controls">
<input type="text" name="phone" value="<?php if(isset($phone)) echo $phone; ?>" id="inputtext" >
<?php if ($phone_error) {?>
<span class="help_inline"><?php echo $phone_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group <?php if($dob_error ){echo 'error';}?> ">
<label class="control-label" for="dob">date_of_birth</label>
<div class="controls">
<input type="text" name="dob" value="<?php if(isset($dob)) echo $dob; ?>" id="inputtext" >
<?php if ($dobe_error) {?>
<span class="help_inline"><?php echo $dob_error ;?></span>
<?php }?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="about">about</label>
<div class="controls">
<input type="text" name="username" value="<?php if(isset($about)) echo $about; ?>" id="inputtext" >
<?php if ($about_error) {?>
<span class="help_inline"><?php echo $about_error ;?></span>
<?php }?>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<input name="submit" type="submit" value="Add user" class="btn" />
</div>
</div>
</form>
<?php
//step 5 (close connection)
mysql_close($con);
?>
</body>
</html>
|
069ka3-update-box
|
trunk/sanju/update_box/update.php
|
PHP
|
mit
| 6,767
|
<?php
session_start();
$_SESSION['login']=0;
$_SESSION['username']="";
session_destroy();
header("location:index.php");
?>
|
069ka3-update-box
|
trunk/sanju/update_box/logout.php
|
PHP
|
mit
| 155
|
<?php
session_start();
if (!$_SESSION['login']) header ("location: login.php");
include "dbaction/user_add.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mini Social - free website template</title>
<meta name="keywords" content="mini social, free download, website templates, CSS, HTML" />
<meta name="description" content="Mini Social is a free website template from templatemo.com" />
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/coda-slider.css" type="text/css" media="screen" charset="utf-8" />
<script src="js/jquery-1.2.6.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-1.3.3.js" type="text/javascript"></script>
<script src="js/jquery.localscroll-1.2.5.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.serialScroll-1.2.1.js" type="text/javascript" charset="utf-8"></script>
<script src="js/coda-slider.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.easing.1.3.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function sure(){
if(confirm("Are you sure to delete this user?")){
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<div id="slider">
<div id="templatemo_sidebar">
<div id="templatemo_header">
<a href="http://www.templatemo.com" target="_parent"><img src="images/templatemo_logo.png" alt="Mini Social" /></a>
</div> <!-- end of header -->
<ul class="navigation">
<li><a href="#home">Home<span class="ui_icon home"></span></a></li>
<li><a href="#aboutus">Friends<span class="ui_icon aboutus"></span></a></li>
<li><a href="#services">Message<span class="ui_icon services"></span></a></li>
<li><a href="#gallery">Profile<span class="ui_icon gallery"></span></a></li>
<li><a href="#contactus">Contact Us<span class="ui_icon contactus"></span></a></li>
<li><a href="logout.php">Log-out<?php echo $_SESSION['username']?><span class="ui_icon contactus"></span></a></li>
</ul>
</div> <!-- end of sidebar -->
<div id="templatemo_main">
<ul id="social_box">
<li><a href="#"><img src="images/music.png" alt="music" /></a></li>
<li><a href="#"><img src="images/write.png" alt="status" /></a></li>
<li><a href="#"><img src="images/photo.png" alt="photo" /></a></li>
<li><a href="#"><img src="images/video.png" alt="video" /></a></li>
</ul>
<div id="content">
<!-- scroll -->
<div class="scroll">
<div class="scrollContainer">
<div class="panel" id="home">
<h1>Introducing Mini Social website</h1>
<div class="image_wrapper image_fl"><img src="images/templatemo_image_01.jpg" alt="image" /></div>
<p><em>Nullam at erat ipsum, quis tincidunt mauris. Nunc sit amet sapien eget eros iaculis hendrerit quis a enim. Validate <a href="http://validator.w3.org/check?uri=referer" rel="nofollow">XHTML</a> & <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="nofollow">CSS</a>.</em></p>
<p>Mini Social is a <a href="http://www.templatemo.com/page/1" target="_parent">Free CSS Template</a> is provided by <a href="http://www.templatemo.com" target="_parent">templatemo.com</a>. You may use this template in your websites. Credits go to <a href="http://www.photovaco.com" target="_blank">PhotoVaco</a> for photos, <a href="http://jwloh.deviantart.com/art/Social-me-90694011" target="_blank">Social.me</a> and <a href="http://www.wefunction.com" target="_blank">WeFunction</a> for icons used in this template.</p>
<div class="cleaner_h40"></div>
<h2>Our Background</h2>
<p><em>Donec ac eros ac nunc blandit hendrerit. Vestibulum tincidunt, odio at ultricies sollicitudin, ante felis luctus justo, non venenatis quam mauris non tortor.</em></p>
<p>Mauris ligula tortor, congue laoreet rutrum eget, suscipit nec augue. In congue consectetur est, sit amet hendrerit velit adipiscing eget. Curabitur iaculis, erat pharetra porttitor sollicitudin, turpis lectus placerat arcu, ac mattis eros sem ut metus.</p>
<div class="btn_more"><a href="#aboutus">More <span>»</span></a></div>
</div> <!-- end of home -->
<div class="panel" id="aboutus">
<h1>Friends</h1>
<div class="image_wrapper image_fl"><img src="images/friends.jpg" alt="image" /></div>
<p>Friends list</p>
</div>
<div class="panel" id="services">
<h1>Message</h1>
<p>message from friends</p>
</div>
<div class="panel" id="gallery">
<h1>Profile</h1>
<div id="gallery_container">
<div class="gallery">
<img src="images/gallery/image_01.jpg" align ="right" alt="01" />
<h4>Your Activity</h4>
<a href="#" /><h2>about</h2></a></br>
<a href="#" /><h2>photo</h2></a></br>
<a href="#" /><h2>music</h2></a></br>
<a href="#" /><h2>status</h2></a></br>
<div class="cleaner"></div>
</div>
<div class="cleaner"></div>
</div>
</div>
<div class="panel" id="contactus">
<h1>Feel free to send us a message</h1>
<div id="contact_form">
<form method="post" name="contact" action="#contactus">
<label for="author">Your Name:</label> <input type="text" id="author" name="author" class="required input_field" />
<div class="cleaner_h10"></div>
<label for="email">Your Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" />
<div class="cleaner_h10"></div>
<label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea>
<div class="cleaner_h10"></div>
<input type="submit" class="submit_btn" name="submit" id="submit" value="Send" />
<input type="reset" class="submit_btn" name="reset" id="reset" value="Reset" />
</form>
</div>
</div>
</div>
</div>
<!-- end of scroll -->
</div> <!-- end of content -->
<div id="templatemo_footer">
Copyright © 2048 <a href="#">Your Company Name</a> | <a href="http://www.iwebsitetemplate.com" target="_parent">Website Templates</a> by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
</div> <!-- end of templatemo_footer -->
</div> <!-- end of main -->
</div>
<div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body>
</html>
|
069ka3-update-box
|
trunk/sanju/update_box/index.php
|
PHP
|
mit
| 8,305
|
<?php
//step 1 (connection)
$con=mysql_connect("localhost", "root", "");
//step 2 (database)
mysql_select_db("test");
//step 3 SQL/get result
$id=$_GET['id'];
$sql="delete from `users` where `id` =$id ";
mysql_query($sql);
//echo "User id ".$_GET['id']." deleted";
header("location: ../array_database.php");
?>
|
069ka3-update-box
|
trunk/sanju/update_box/dbaction/user_delete.php
|
PHP
|
mit
| 372
|
<?php
if(isset($_POST['submit'])){
$first_name = trim($_POST["first_name"]);
$mid_name = trim($_POST["mid_name"]);
$last_name = trim($_POST["last_name"]);
$username = trim($_POST["username"]);
$password = trim($_POST["password"]);
$email = trim($_POST["email"]);
$address = trim($_POST["address"]);
$phone = trim($_POST["phone"]);
$dob = trim($_POST["dob"]);
$about = trim($_POST["about"]);
if ($first_name==''){
$error=true;
$first_name_error="please provide firstname";
}
if ($last_name==''){
$error=true;
$last_name_error="please provide lastname";
}
if ($username==''){
$error=true;
$username_error="please provide username";
}
if ($password=='' ){
$error=true;
$password_error="please provide password";
}else{
$password = md5($_POST["password"]);
}
if ($email==''){
$error=true;
$email_error="please provide email";
}
if ($address==''){
$error=true;
$address_error="please provide address";
}
if ($phone==''){
$error=true;
$username_error="please provide phone number";
}
if ($dob==''){
$error=true;
$dob_error="please provide date of birth";
}
if ($about==''){
$error=true;
$username_error="please provide somthing about you";
}
//if ($username!="" && $password!="" && $email!=""){
if (!isset($error)){
$con=mysql_connect("localhost", "root", "");
mysql_select_db("update_box");
$sql = INSERT INTO `update_box`.`users` (`id`, `first_name`, `mid_name`, `last_name`, `username`, `password`, `email`, `address`, `phone`, `dob`, `about`, `created_at`)
VALUES ('$id', '$first_name', '$mid_name', '$last_name', '$username', '$password', '$email', '$address', '$phone', DATE('$dob'), '$about', CURDATE('$created_at'));
mysql_query($sql);
header("location: update.php");
}
}
?>
|
069ka3-update-box
|
trunk/sanju/update_box/dbaction/user_add.php
|
PHP
|
mit
| 2,003
|
<?php
session_start();
$username = $_POST['username']; $password = $_POST['password'];
if ($_POST['submit'] && ($username !="" && $password !="" )) {
$password = md5($_POST['password']);
$con = mysql_connect("localhost", "root", "");
mysql_select_db("update_box");
$sql = "select * from `users` where `username` = '$username' and `password` = '$password'";
$result = mysql_query($sql);
$count_result = mysql_num_rows($result);
if ($count_result == 1 ) {
//echo "Login Success!";
//set session
$_SESSION['login'] = 1;
$_SESSION['username'] = $username;
//redirect to database
header ("location: update.php");
}else {
echo "Login failed!";
}
} else {
echo "Please provide username & password!";
}
?>
<!DOCTYPE html PUBLIC>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Your Site</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Your Site</h1>
</div>
<div id="body">
<div id="nav">
<div id="nav-bot">
<ul>
<li><a href="#">About</a></li>
</ul>
</div>
</div>
<div id="content">
<div id="treasure_box">
<h2>Treasure Box</h2>
<form class="form-signin" method="POST">
<h2 class="form-signin-heading">Please sign in</h2>
Username: <input name="username" value="" type="text" class="input-block-level" >
Password: <input name="password" value="" type="password" class="input-block-level" >
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
</label>
<button class="btn btn-large btn-primary" name="submit" type="submit">Sign in</button>
</form>
</div>
<div class="main">
<h2>Haven't got the account Yet???</h2>
</div>
<div class="main2">
<h2>Your treasure box is waiting for u.... </h2>
<a href="#">Click here to create your account.</a>
</div>
<div class="clear"> </div>
</div>
</div>
</body>
</html>
|
069ka3-update-box
|
trunk/sanju/update_box/login.php
|
PHP
|
mit
| 2,368
|
#slider {
position: relative;
width: 890px;
padding: 20px 10px 0 70px;
}
#templatemo_sidebar {
float: left;
width: 270px;
}
#templatemo_main {
float: right;
padding-top: 50px;
width: 600px;
}
#templatemo_header {
margin-left: 10px;
width: 230px;
height: 114px;
text-align: center;
padding: 80px 0 0 0;
background: url(../images/templatemo_header.jpg) no-repeat top left;
}
#social_box {
display: block;
width: 550px;
height: 48px;
padding: 16px 0px 16px 50px;
margin-bottom: 20px;
background: url(../images/templatemo_social_box.jpg) no-repeat;
}
#social_box li {
display: block;
float: left;
padding: 0;
margin: 0;
}
#social_box li a {
width: 48px;
height: 48px;
margin-right: 60px;
}
#content {
height: 455px;
width: 600px;
background: url(../images/templatemo_content.jpg) no-repeat;
}
.scroll {
height: 455px;
width: 600px;
overflow: auto;
/* overflow-x: hidden; */
position: relative;
clear: left;
}
.scrollContainer div.panel {
padding: 30px;
height: 395px;
width: 540px;
}
ul.navigation {
width: 270px;
list-style: none;
margin: 0;
padding: 0;
text-align: left;
}
ul.navigation li {
display: inline-block;
margin: 0px;
padding: 0;
}
ul.navigation a {
display: block;
width: 190px;
height: 33px;
padding: 12px 0 0 80px;
margin-bottom: 5px;
color: #8a8980;
font-size: 16px;
font-weight: normal;
text-decoration: none;
position: relative;
}
ul.navigation a .ui_icon { position: absolute; top: 0; left: 15px; width: 40px; height: 40px; }
ul.navigation a .home { background: url(../images/templatemo_home.png) no-repeat; }
ul.navigation a .aboutus { background: url(../images/templatemo_aboutus.png) no-repeat; }
ul.navigation a .services { background: url(../images/templatemo_services.png) no-repeat; }
ul.navigation a .gallery { background: url(../images/templatemo_portfolio.png) no-repeat; }
ul.navigation a .contactus { background: url(../images/templatemo_contact.png) no-repeat; }
ul.navigation a:hover, ul.navigation a.selected {
color: #201f1b;
background: url(../images/templatemo_menu_hover.png) no-repeat left;
}
ul.navigation a:hover .home, ul.navigation a.selected .home {
background: url(../images/templatemo_home_hover.png) no-repeat;
}
ul.navigation a:hover .aboutus, ul.navigation a.selected .aboutus {
background: url(../images/templatemo_aboutus_hover.png) no-repeat;
}
ul.navigation a:hover .services, ul.navigation a.selected .services {
background: url(../images/templatemo_services_hover.png) no-repeat;
}
ul.navigation a:hover .gallery, ul.navigation a.selected .gallery {
background: url(../images/templatemo_portfolio_hover.png) no-repeat;
}
ul.navigation a:hover .contactus, ul.navigation a.selected .contactus {
background: url(../images/templatemo_contact_hover.png) no-repeat;
}
ul.navigation a:focus {
outline: none;
}
.scrollButtons {
position: absolute;
top: 300px;
cursor: pointer;
width: 0;
height: 0;
}
.scrollButtons.left {
left: -50px;
}
.scrollButtons.right {
right: -50px;
}
.hide {
display: none;
}
|
069ka3-update-box
|
trunk/sanju/update_box/css/coda-slider.css
|
CSS
|
mit
| 3,257
|
<?php
session_start();
if (!$_SESSION['login']) header ("location: login.php");
include "dbaction/user_add.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PHP Course</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</style>
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="assets/ico/favicon.png">
<script type="text/javascript">
function sure(){
if (confirm("Are you sure delete this user ?")){
return true;
}else {
return false;
}
}
</script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">PHP Course</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">Users</a></li>
<li><a href="#contact">Photos</a></li>
<li><a href="#contact">Videos</a></li>
<li><a href="#contact">Feedback</a></li>
<li><a href="logout.php">Logout - <?php echo $_SESSION['username']; ?></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<h1>PHP / MySql</h1>
<p>Basic CRUD oparations on Database</p>
<br/>
<?php
//Step - 1 (Connection)
$con = mysql_connect("localhost", "root", "");
//Step - 2 (Database)
mysql_select_db("update_box");
//Step - 3 (SQL / Get result)
$sql = "SELECT * from `users`";
$result = mysql_query($sql);
?>
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th>Username</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
//Step - 4 (Grab / Process result of query)
$i=0;
while ($row = mysql_fetch_assoc($result)) {
$i++;
//echo "<pre>";print_r($row);echo "</pre>";
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['username'];?></td>
<td><?php echo $row['email'];?></td>
<td>
<a href="">View</a> |
<a href="dbactions/user_edit.php?id=<?php echo $row['id']; ?>">Edit</a> |
<a onclick="return sure()" href="dbactions/user_delete.php?id=<?php echo $row['id']; ?>">Delete</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
<?php
//Step - 5 (Close connection)
mysql_close($con);
?>
<h3>Add New Users</h3>
<form class="form-horizontal" action="" method="POST">
<div class="control-group <?php if ($username_error) { echo 'error'; } ?> ">
<label class="control-label" for="first_name">Username</label>
<div class="controls">
<input type="text" name="username" value="<?php if (isset($username)) echo $username; ?>">
<?php if ($username_error) { ?>
<span class="help-inline"><?php echo $username_error; ?></span>
<?php } ?>
</div>
</div>
<div class="control-group <?php if ($password_error) { echo 'error'; } ?>">
<label class="control-label" for="username">Password</label>
<div class="controls">
<input type="password" id="password" name="password" value="" >
<?php if ($password_error) { ?>
<span class="help-inline"><?php echo $password_error; ?></span>
<?php } ?>
</div>
</div>
<div class="control-group <?php if ($email_error) { echo 'error'; } ?>">
<label class="control-label" for="last_name">Email</label>
<div class="controls">
<input type="text" id="email" name="email" value="<?php if (isset($email)) echo $email; ?>">
<?php if ($email_error) { ?>
<span class="help-inline"><?php echo $email_error; ?></span>
<?php } ?>
</div>
</div>
<div class="control-group">
<div class="controls">
<input name="submit" value="Add User" type="submit" class="btn" />
</div>
</div>
</form>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-alert.js"></script>
<script src="assets/js/bootstrap-modal.js"></script>
<script src="assets/js/bootstrap-dropdown.js"></script>
<script src="assets/js/bootstrap-scrollspy.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script src="assets/js/bootstrap-tooltip.js"></script>
<script src="assets/js/bootstrap-popover.js"></script>
<script src="assets/js/bootstrap-button.js"></script>
<script src="assets/js/bootstrap-collapse.js"></script>
<script src="assets/js/bootstrap-carousel.js"></script>
<script src="assets/js/bootstrap-typeahead.js"></script>
</body>
</html>
|
069ka3-update-box
|
trunk/sanju/update_box/data.php
|
PHP
|
mit
| 6,852
|
<?php
session_start();
if (!$_SESSION['login']) header ("location: login.php");
include "dbaction/user_add.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mini Social - free website template</title>
<meta name="keywords" content="mini social, free download, website templates, CSS, HTML" />
<meta name="description" content="Mini Social is a free website template from templatemo.com" />
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/coda-slider.css" type="text/css" media="screen" charset="utf-8" />
<script src="js/jquery-1.2.6.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-1.3.3.js" type="text/javascript"></script>
<script src="js/jquery.localscroll-1.2.5.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.serialScroll-1.2.1.js" type="text/javascript" charset="utf-8"></script>
<script src="js/coda-slider.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.easing.1.3.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
function sure(){
if(confirm("Are you sure to delete this user?")){
return true;
}else{
return false;
}
}
</script>
</head>
<body>
<div id="slider">
<div id="templatemo_sidebar">
<div id="templatemo_header">
<a href="http://www.templatemo.com" target="_parent"><img src="images/templatemo_logo.png" alt="Mini Social" /></a>
</div> <!-- end of header -->
<ul class="navigation">
<li><a href="#home">Home<span class="ui_icon home"></span></a></li>
<li><a href="#aboutus">Friends<span class="ui_icon aboutus"></span></a></li>
<li><a href="#services">Message<span class="ui_icon services"></span></a></li>
<li><a href="#gallery">Profile<span class="ui_icon gallery"></span></a></li>
<li><a href="#contactus">Contact Us<span class="ui_icon contactus"></span></a></li>
<li><a href="logout.php">Log-out<?php echo $_SESSION['username']?><span class="ui_icon contactus"></span></a></li>
</ul>
</div> <!-- end of sidebar -->
<div id="templatemo_main">
<ul id="social_box">
<li><a href="#"><img src="images/music.png" alt="music" /></a></li>
<li><a href="#"><img src="images/write.png" alt="status" /></a></li>
<li><a href="#"><img src="images/photo.png" alt="photo" /></a></li>
<li><a href="#"><img src="images/video.png" alt="video" /></a></li>
</ul>
<div id="content">
<!-- scroll -->
<div class="scroll">
<div class="scrollContainer">
<div class="panel" id="home">
<h1>Introducing Mini Social website</h1>
<div class="image_wrapper image_fl"><img src="images/templatemo_image_01.jpg" alt="image" /></div>
<p><em>Nullam at erat ipsum, quis tincidunt mauris. Nunc sit amet sapien eget eros iaculis hendrerit quis a enim. Validate <a href="http://validator.w3.org/check?uri=referer" rel="nofollow">XHTML</a> & <a href="http://jigsaw.w3.org/css-validator/check/referer" rel="nofollow">CSS</a>.</em></p>
<p>Mini Social is a <a href="http://www.templatemo.com/page/1" target="_parent">Free CSS Template</a> is provided by <a href="http://www.templatemo.com" target="_parent">templatemo.com</a>. You may use this template in your websites. Credits go to <a href="http://www.photovaco.com" target="_blank">PhotoVaco</a> for photos, <a href="http://jwloh.deviantart.com/art/Social-me-90694011" target="_blank">Social.me</a> and <a href="http://www.wefunction.com" target="_blank">WeFunction</a> for icons used in this template.</p>
<div class="cleaner_h40"></div>
<h2>Our Background</h2>
<p><em>Donec ac eros ac nunc blandit hendrerit. Vestibulum tincidunt, odio at ultricies sollicitudin, ante felis luctus justo, non venenatis quam mauris non tortor.</em></p>
<p>Mauris ligula tortor, congue laoreet rutrum eget, suscipit nec augue. In congue consectetur est, sit amet hendrerit velit adipiscing eget. Curabitur iaculis, erat pharetra porttitor sollicitudin, turpis lectus placerat arcu, ac mattis eros sem ut metus.</p>
<div class="btn_more"><a href="#aboutus">More <span>»</span></a></div>
</div> <!-- end of home -->
<div class="panel" id="aboutus">
<h1>Friends</h1>
<div class="image_wrapper image_fl"><img src="images/friends.jpg" alt="image" /></div>
<p>Friends list</p>
</div>
<div class="panel" id="services">
<h1>Message</h1>
<p>message from friends</p>
</div>
<div class="panel" id="gallery">
<h1>Profile</h1>
<div id="gallery_container">
<div class="gallery">
<img src="images/gallery/image_01.jpg" align ="right" alt="01" />
<h4>Your Activity</h4>
<a href="#" /><h2>about</h2></a></br>
<a href="#" /><h2>photo</h2></a></br>
<a href="#" /><h2>music</h2></a></br>
<a href="#" /><h2>status</h2></a></br>
<div class="cleaner"></div>
</div>
<div class="cleaner"></div>
</div>
</div>
<div class="panel" id="contactus">
<h1>Feel free to send us a message</h1>
<div id="contact_form">
<form method="post" name="contact" action="#contactus">
<label for="author">Your Name:</label> <input type="text" id="author" name="author" class="required input_field" />
<div class="cleaner_h10"></div>
<label for="email">Your Email:</label> <input type="text" id="email" name="email" class="validate-email required input_field" />
<div class="cleaner_h10"></div>
<label for="text">Message:</label> <textarea id="text" name="text" rows="0" cols="0" class="required"></textarea>
<div class="cleaner_h10"></div>
<input type="submit" class="submit_btn" name="submit" id="submit" value="Send" />
<input type="reset" class="submit_btn" name="reset" id="reset" value="Reset" />
</form>
</div>
</div>
</div>
</div>
<!-- end of scroll -->
</div> <!-- end of content -->
<div id="templatemo_footer">
Copyright © 2048 <a href="#">Your Company Name</a> | <a href="http://www.iwebsitetemplate.com" target="_parent">Website Templates</a> by <a href="http://www.templatemo.com" target="_parent">Free CSS Templates</a>
</div> <!-- end of templatemo_footer -->
</div> <!-- end of main -->
</div>
<div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body>
</html>
|
069ka3-update-box
|
trunk/sanju/update_box/wait.php
|
PHP
|
mit
| 8,305
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.maps.SingleColorTrackPathPainter;
import com.google.android.maps.MapView;
import android.graphics.Canvas;
import android.graphics.Path;
import android.location.Location;
import android.test.AndroidTestCase;
/**
* Tests for the MyTracks map overlay.
*
* @author Bartlomiej Niechwiej
* @author Vangelis S.
*/
public class MapOverlayTest extends AndroidTestCase {
private Canvas canvas;
private MockMyTracksOverlay myTracksOverlay;
private MapView mockView;
@Override
protected void setUp() throws Exception {
super.setUp();
canvas = new Canvas();
myTracksOverlay = new MockMyTracksOverlay(getContext());
// Enable drawing.
myTracksOverlay.setTrackDrawingEnabled(true);
// Set a TrackPathPainter with a MockPath.
myTracksOverlay.setTrackPathPainter(new SingleColorTrackPathPainter(getContext()) {
@Override
public Path newPath() {
return new MockPath();
}
});
mockView = null;
}
public void testAddLocation() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
location.setLongitude(20);
myTracksOverlay.addLocation(location);
assertEquals(1, myTracksOverlay.getNumLocations());
assertEquals(0, myTracksOverlay.getNumWaypoints());
location.setLatitude(20);
location.setLongitude(30);
myTracksOverlay.addLocation(location);
assertEquals(2, myTracksOverlay.getNumLocations());
assertEquals(0, myTracksOverlay.getNumWaypoints());
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
// Draw and make sure that we don't lose any point.
myTracksOverlay.draw(canvas, mockView, false);
assertEquals(2, myTracksOverlay.getNumLocations());
assertEquals(0, myTracksOverlay.getNumWaypoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
assertTrue(myTracksOverlay.getTrackPathPainter().getLastPath() instanceof MockPath);
MockPath path = (MockPath) myTracksOverlay.getTrackPathPainter().getLastPath();
assertEquals(2, path.totalPoints);
myTracksOverlay.draw(canvas, mockView, true);
assertEquals(2, myTracksOverlay.getNumLocations());
assertEquals(0, myTracksOverlay.getNumWaypoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
}
public void testClearPoints() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
location.setLongitude(20);
myTracksOverlay.addLocation(location);
assertEquals(1, myTracksOverlay.getNumLocations());
myTracksOverlay.clearPoints();
assertEquals(0, myTracksOverlay.getNumLocations());
// Same after drawing on canvas.
final int locations = 100;
for (int i = 0; i < locations; ++i) {
myTracksOverlay.addLocation(location);
}
assertEquals(locations, myTracksOverlay.getNumLocations());
myTracksOverlay.draw(canvas, mockView, false);
myTracksOverlay.draw(canvas, mockView, true);
myTracksOverlay.clearPoints();
assertEquals(0, myTracksOverlay.getNumLocations());
}
public void testAddWaypoint() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
location.setLongitude(20);
Waypoint waypoint = new Waypoint();
waypoint.setLocation(location);
myTracksOverlay.addWaypoint(waypoint);
assertEquals(1, myTracksOverlay.getNumWaypoints());
assertEquals(0, myTracksOverlay.getNumLocations());
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
final int waypoints = 10;
for (int i = 0; i < waypoints; ++i) {
waypoint = new Waypoint();
waypoint.setLocation(location);
myTracksOverlay.addWaypoint(waypoint);
}
assertEquals(1 + waypoints, myTracksOverlay.getNumWaypoints());
assertEquals(0, myTracksOverlay.getNumLocations());
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
}
public void testClearWaypoints() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
location.setLongitude(20);
Waypoint waypoint = new Waypoint();
waypoint.setLocation(location);
myTracksOverlay.addWaypoint(waypoint);
assertEquals(1, myTracksOverlay.getNumWaypoints());
myTracksOverlay.clearWaypoints();
assertEquals(0, myTracksOverlay.getNumWaypoints());
}
public void testDrawing() {
Location location = new Location("gps");
location.setLatitude(10);
for (int i = 0; i < 40; ++i) {
location.setLongitude(20 + i);
Waypoint waypoint = new Waypoint();
waypoint.setLocation(location);
myTracksOverlay.addWaypoint(waypoint);
}
for (int i = 0; i < 100; ++i) {
location = new Location("gps");
location.setLatitude(20 + i / 2);
location.setLongitude(150 - i);
myTracksOverlay.addLocation(location);
}
// Shadow.
myTracksOverlay.draw(canvas, mockView, true);
// We don't expect to do anything if
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
assertEquals(40, myTracksOverlay.getNumWaypoints());
assertEquals(100, myTracksOverlay.getNumLocations());
// No shadow.
myTracksOverlay.draw(canvas, mockView, false);
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
assertTrue(myTracksOverlay.getTrackPathPainter().getLastPath() instanceof MockPath);
MockPath path = (MockPath) myTracksOverlay.getTrackPathPainter().getLastPath();
assertEquals(40, myTracksOverlay.getNumWaypoints());
assertEquals(100, myTracksOverlay.getNumLocations());
assertEquals(100, path.totalPoints);
// TODO: Check the points from the path (and the segments).
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/MapOverlayTest.java
|
Java
|
asf20
| 6,474
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services;
import android.content.Context;
import android.test.AndroidTestCase;
import java.text.DateFormat;
import java.util.Date;
/**
* Tests {@link DefaultTrackNameFactory}
*
* @author Matthew Simmons
*/
public class DefaultTrackNameFactoryTest extends AndroidTestCase {
/**
* A version of the factory which allows us to supply our own answer as to
* whether a timestamp-based track name should be used.
*/
private static class MockDefaultTrackNameFactory
extends DefaultTrackNameFactory {
private final boolean useTimestamp;
MockDefaultTrackNameFactory(Context context, boolean useTimestamp) {
super(context);
this.useTimestamp = useTimestamp;
}
@Override
protected boolean useTimestampTrackName() {
return useTimestamp;
}
}
private static final long TIMESTAMP = 1288213406000L;
public void testTimestampTrackName() {
DefaultTrackNameFactory factory =
new MockDefaultTrackNameFactory(getContext(), true);
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
assertEquals(formatter.format(new Date(TIMESTAMP)),
factory.newTrackName(1, TIMESTAMP));
}
public void testIncrementingTrackName() {
DefaultTrackNameFactory factory =
new MockDefaultTrackNameFactory(getContext(), false);
assertEquals("Track 1", factory.newTrackName(1, TIMESTAMP));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/DefaultTrackNameFactoryTest.java
|
Java
|
asf20
| 2,059
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.tasks;
import static com.google.android.testing.mocking.AndroidMock.capture;
import static com.google.android.testing.mocking.AndroidMock.eq;
import static com.google.android.testing.mocking.AndroidMock.expect;
import static com.google.android.testing.mocking.AndroidMock.same;
import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.testing.mocking.AndroidMock;
import com.google.android.testing.mocking.UsesMocks;
import android.content.Context;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.speech.tts.TextToSpeech.OnUtteranceCompletedListener;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.test.AndroidTestCase;
import java.util.HashMap;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import org.easymock.Capture;
/**
* Tests for {@link StatusAnnouncerTask}.
* WARNING: I'm not responsible if your eyes start bleeding while reading this
* code. You have been warned. It's still better than no test, though.
*
* @author Rodrigo Damazio
*/
public class StatusAnnouncerTaskTest extends AndroidTestCase {
// Use something other than our hardcoded value
private static final Locale DEFAULT_LOCALE = Locale.KOREAN;
private static final String ANNOUNCEMENT = "I can haz cheeseburger?";
private Locale oldDefaultLocale;
private StatusAnnouncerTask task;
private StatusAnnouncerTask mockTask;
private Capture<OnInitListener> initListenerCapture;
private Capture<PhoneStateListener> phoneListenerCapture;
private TextToSpeechDelegate ttsDelegate;
private TextToSpeechInterface tts;
/**
* Mockable interface that we delegate TTS calls to.
*/
interface TextToSpeechInterface {
int addEarcon(String earcon, String packagename, int resourceId);
int addEarcon(String earcon, String filename);
int addSpeech(String text, String packagename, int resourceId);
int addSpeech(String text, String filename);
boolean areDefaultsEnforced();
String getDefaultEngine();
Locale getLanguage();
int isLanguageAvailable(Locale loc);
boolean isSpeaking();
int playEarcon(String earcon, int queueMode,
HashMap<String, String> params);
int playSilence(long durationInMs, int queueMode,
HashMap<String, String> params);
int setEngineByPackageName(String enginePackageName);
int setLanguage(Locale loc);
int setOnUtteranceCompletedListener(OnUtteranceCompletedListener listener);
int setPitch(float pitch);
int setSpeechRate(float speechRate);
void shutdown();
int speak(String text, int queueMode, HashMap<String, String> params);
int stop();
int synthesizeToFile(String text, HashMap<String, String> params,
String filename);
}
/**
* Subclass of {@link TextToSpeech} which delegates calls to the interface
* above.
* The logic here is stupid and the author is ashamed of having to write it
* like this, but basically the issue is that TextToSpeech cannot be mocked
* without running its constructor, its constructor runs async operations
* which call other methods (and then if the methods are part of a mock we'd
* have to set a behavior, but we can't 'cause the object hasn't been fully
* built yet).
* The logic is that calls made during the constructor (when tts is not yet
* set) will go up to the original class, but after tts is set we'll forward
* them all to the mock.
*/
private class TextToSpeechDelegate
extends TextToSpeech implements TextToSpeechInterface {
public TextToSpeechDelegate(Context context, OnInitListener listener) {
super(context, listener);
}
@Override
public int addEarcon(String earcon, String packagename, int resourceId) {
if (tts == null) {
return super.addEarcon(earcon, packagename, resourceId);
}
return tts.addEarcon(earcon, packagename, resourceId);
}
@Override
public int addEarcon(String earcon, String filename) {
if (tts == null) {
return super.addEarcon(earcon, filename);
}
return tts.addEarcon(earcon, filename);
}
@Override
public int addSpeech(String text, String packagename, int resourceId) {
if (tts == null) {
return super.addSpeech(text, packagename, resourceId);
}
return tts.addSpeech(text, packagename, resourceId);
}
@Override
public int addSpeech(String text, String filename) {
if (tts == null) {
return super.addSpeech(text, filename);
}
return tts.addSpeech(text, filename);
}
@Override
public Locale getLanguage() {
if (tts == null) {
return super.getLanguage();
}
return tts.getLanguage();
}
@Override
public int isLanguageAvailable(Locale loc) {
if (tts == null) {
return super.isLanguageAvailable(loc);
}
return tts.isLanguageAvailable(loc);
}
@Override
public boolean isSpeaking() {
if (tts == null) {
return super.isSpeaking();
}
return tts.isSpeaking();
}
@Override
public int playEarcon(String earcon, int queueMode,
HashMap<String, String> params) {
if (tts == null) {
return super.playEarcon(earcon, queueMode, params);
}
return tts.playEarcon(earcon, queueMode, params);
}
@Override
public int playSilence(long durationInMs, int queueMode,
HashMap<String, String> params) {
if (tts == null) {
return super.playSilence(durationInMs, queueMode, params);
}
return tts.playSilence(durationInMs, queueMode, params);
}
@Override
public int setLanguage(Locale loc) {
if (tts == null) {
return super.setLanguage(loc);
}
return tts.setLanguage(loc);
}
@Override
public int setOnUtteranceCompletedListener(
OnUtteranceCompletedListener listener) {
if (tts == null) {
return super.setOnUtteranceCompletedListener(listener);
}
return tts.setOnUtteranceCompletedListener(listener);
}
@Override
public int setPitch(float pitch) {
if (tts == null) {
return super.setPitch(pitch);
}
return tts.setPitch(pitch);
}
@Override
public int setSpeechRate(float speechRate) {
if (tts == null) {
return super.setSpeechRate(speechRate);
}
return tts.setSpeechRate(speechRate);
}
@Override
public void shutdown() {
if (tts == null) {
super.shutdown();
return;
}
tts.shutdown();
}
@Override
public int speak(
String text, int queueMode, HashMap<String, String> params) {
if (tts == null) {
return super.speak(text, queueMode, params);
}
return tts.speak(text, queueMode, params);
}
@Override
public int stop() {
if (tts == null) {
return super.stop();
}
return tts.stop();
}
@Override
public int synthesizeToFile(String text, HashMap<String, String> params,
String filename) {
if (tts == null) {
return super.synthesizeToFile(text, params, filename);
}
return tts.synthesizeToFile(text, params, filename);
}
}
@UsesMocks({
StatusAnnouncerTask.class,
StringUtils.class,
})
@Override
protected void setUp() throws Exception {
super.setUp();
oldDefaultLocale = Locale.getDefault();
Locale.setDefault(DEFAULT_LOCALE);
// Eww, the effort required just to mock TextToSpeech is insane
final AtomicBoolean listenerCalled = new AtomicBoolean();
OnInitListener blockingListener = new OnInitListener() {
@Override
public void onInit(int status) {
synchronized (this) {
listenerCalled.set(true);
notify();
}
}
};
ttsDelegate = new TextToSpeechDelegate(getContext(), blockingListener);
// Wait for all async operations done in the constructor to finish.
synchronized (blockingListener) {
while (!listenerCalled.get()) {
// Releases the synchronized lock until we're woken up.
blockingListener.wait();
}
}
// Phew, done, now we can start forwarding calls
tts = AndroidMock.createMock(TextToSpeechInterface.class);
initListenerCapture = new Capture<OnInitListener>();
phoneListenerCapture = new Capture<PhoneStateListener>();
// Create a partial forwarding mock
mockTask = AndroidMock.createMock(StatusAnnouncerTask.class, getContext());
task = new StatusAnnouncerTask(getContext()) {
@Override
protected TextToSpeech newTextToSpeech(Context ctx,
OnInitListener onInitListener) {
return mockTask.newTextToSpeech(ctx, onInitListener);
}
@Override
protected String getAnnouncement(TripStatistics stats) {
return mockTask.getAnnouncement(stats);
}
@Override
protected void listenToPhoneState(
PhoneStateListener listener, int events) {
mockTask.listenToPhoneState(listener, events);
}
};
}
@Override
protected void tearDown() {
Locale.setDefault(oldDefaultLocale);
}
public void testStart() {
doStart();
OnInitListener ttsInitListener = initListenerCapture.getValue();
assertNotNull(ttsInitListener);
expect(tts.isLanguageAvailable(DEFAULT_LOCALE))
.andStubReturn(TextToSpeech.LANG_AVAILABLE);
expect(tts.setLanguage(DEFAULT_LOCALE))
.andReturn(TextToSpeech.LANG_AVAILABLE);
expect(tts.setSpeechRate(StatusAnnouncerTask.TTS_SPEECH_RATE))
.andReturn(TextToSpeech.SUCCESS);
AndroidMock.replay(tts);
ttsInitListener.onInit(TextToSpeech.SUCCESS);
AndroidMock.verify(mockTask, tts);
}
public void testStart_languageNotSupported() {
doStart();
OnInitListener ttsInitListener = initListenerCapture.getValue();
assertNotNull(ttsInitListener);
expect(tts.isLanguageAvailable(DEFAULT_LOCALE))
.andStubReturn(TextToSpeech.LANG_NOT_SUPPORTED);
expect(tts.setLanguage(Locale.ENGLISH))
.andReturn(TextToSpeech.LANG_AVAILABLE);
expect(tts.setSpeechRate(StatusAnnouncerTask.TTS_SPEECH_RATE))
.andReturn(TextToSpeech.SUCCESS);
AndroidMock.replay(tts);
ttsInitListener.onInit(TextToSpeech.SUCCESS);
AndroidMock.verify(mockTask, tts);
}
public void testStart_notReady() {
doStart();
OnInitListener ttsInitListener = initListenerCapture.getValue();
assertNotNull(ttsInitListener);
AndroidMock.replay(tts);
ttsInitListener.onInit(TextToSpeech.ERROR);
AndroidMock.verify(mockTask, tts);
}
public void testShutdown() {
// First, start
doStart();
AndroidMock.verify(mockTask);
AndroidMock.reset(mockTask);
// Then, shut down
PhoneStateListener phoneListener = phoneListenerCapture.getValue();
mockTask.listenToPhoneState(
same(phoneListener), eq(PhoneStateListener.LISTEN_NONE));
tts.shutdown();
AndroidMock.replay(mockTask, tts);
task.shutdown();
AndroidMock.verify(mockTask, tts);
}
public void testRun() throws Exception {
// Expect service data calls
TripStatistics stats = new TripStatistics();
// Expect announcement building call
expect(mockTask.getAnnouncement(same(stats))).andStubReturn(ANNOUNCEMENT);
// Put task in "ready" state
startTask(TextToSpeech.SUCCESS);
// Expect actual announcement call
expect(tts.speak(
eq(ANNOUNCEMENT), eq(TextToSpeech.QUEUE_FLUSH),
AndroidMock.<HashMap<String, String>>isNull()))
.andReturn(TextToSpeech.SUCCESS);
// Run the announcement
AndroidMock.replay(tts);
task.runWithStatistics(stats);
AndroidMock.verify(mockTask, tts);
}
public void testRun_notReady() throws Exception {
// Put task in "not ready" state
startTask(TextToSpeech.ERROR);
// Run the announcement
AndroidMock.replay(tts);
task.runWithStatistics(null);
AndroidMock.verify(mockTask, tts);
}
public void testRun_duringCall() throws Exception {
startTask(TextToSpeech.SUCCESS);
expect(tts.isSpeaking()).andStubReturn(false);
// Run the announcement
AndroidMock.replay(tts);
PhoneStateListener phoneListener = phoneListenerCapture.getValue();
phoneListener.onCallStateChanged(TelephonyManager.CALL_STATE_OFFHOOK, null);
task.runWithStatistics(null);
AndroidMock.verify(mockTask, tts);
}
public void testRun_ringWhileSpeaking() throws Exception {
startTask(TextToSpeech.SUCCESS);
expect(tts.isSpeaking()).andStubReturn(true);
expect(tts.stop()).andReturn(TextToSpeech.SUCCESS);
AndroidMock.replay(tts);
// Update the state to ringing - this should stop the current announcement.
PhoneStateListener phoneListener = phoneListenerCapture.getValue();
phoneListener.onCallStateChanged(TelephonyManager.CALL_STATE_RINGING, null);
// Run the announcement - this should do nothing.
task.runWithStatistics(null);
AndroidMock.verify(mockTask, tts);
}
public void testRun_whileRinging() throws Exception {
startTask(TextToSpeech.SUCCESS);
expect(tts.isSpeaking()).andStubReturn(false);
// Run the announcement
AndroidMock.replay(tts);
PhoneStateListener phoneListener = phoneListenerCapture.getValue();
phoneListener.onCallStateChanged(TelephonyManager.CALL_STATE_RINGING, null);
task.runWithStatistics(null);
AndroidMock.verify(mockTask, tts);
}
public void testRun_noService() throws Exception {
startTask(TextToSpeech.SUCCESS);
// Run the announcement
AndroidMock.replay(tts);
task.run(null);
AndroidMock.verify(mockTask, tts);
}
public void testRun_noStats() throws Exception {
// Expect service data calls
startTask(TextToSpeech.SUCCESS);
// Run the announcement
AndroidMock.replay(tts);
task.runWithStatistics(null);
AndroidMock.verify(mockTask, tts);
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with time zero.
*/
public void testGetAnnounceTime_time_zero() {
long time = 0; // 0 seconds
assertEquals("0 minutes 0 seconds", task.getAnnounceTime(time));
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with time one.
*/
public void testGetAnnounceTime_time_one() {
long time = 1 * 1000; // 1 second
assertEquals("0 minutes 1 second", task.getAnnounceTime(time));
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with singular
* numbers with the hour unit.
*/
public void testGetAnnounceTime_singular_has_hour() {
long time = (1 * 60 * 60 * 1000) + (1 * 60 * 1000) + (1 * 1000); // 1 hour 1 minute 1 second
assertEquals("1 hour 1 minute", task.getAnnounceTime(time));
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with plural numbers
* with the hour unit.
*/
public void testGetAnnounceTime_plural_has_hour() {
long time = (2 * 60 * 60 * 1000) + (2 * 60 * 1000) + (2 * 1000); // 2 hours 2 minutes 2 seconds
assertEquals("2 hours 2 minutes", task.getAnnounceTime(time));
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with singular
* numbers without the hour unit.
*/
public void testGetAnnounceTime_singular_no_hour() {
long time = (1 * 60 * 1000) + (1 * 1000); // 1 minute 1 second
assertEquals("1 minute 1 second", task.getAnnounceTime(time));
}
/**
* Tests {@link StatusAnnouncerTask#getAnnounceTime(long)} with plural numbers
* without the hour unit.
*/
public void testGetAnnounceTime_plural_no_hour() {
long time = (2 * 60 * 1000) + (2 * 1000); // 2 minutes 2 seconds
assertEquals("2 minutes 2 seconds", task.getAnnounceTime(time));
}
private void startTask(int state) {
AndroidMock.resetToNice(tts);
AndroidMock.replay(tts);
doStart();
OnInitListener ttsInitListener = initListenerCapture.getValue();
ttsInitListener.onInit(state);
AndroidMock.resetToDefault(tts);
}
private void doStart() {
mockTask.listenToPhoneState(capture(phoneListenerCapture),
eq(PhoneStateListener.LISTEN_CALL_STATE));
expect(mockTask.newTextToSpeech(
same(getContext()), capture(initListenerCapture)))
.andStubReturn(ttsDelegate);
AndroidMock.replay(mockTask);
task.start();
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/tasks/StatusAnnouncerTaskTest.java
|
Java
|
asf20
| 17,180
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.tasks;
import com.google.android.apps.mytracks.services.tasks.PeriodicTask;
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerFactory;
import com.google.android.apps.mytracks.services.tasks.StatusAnnouncerTask;
import com.google.android.apps.mytracks.util.ApiFeatures;
import android.media.AudioManager;
import android.speech.tts.TextToSpeech;
import android.test.AndroidTestCase;
/**
* Tests for {@link StatusAnnouncerFactory}.
* These tests require Donut+ to run.
*
* @author Rodrigo Damazio
*/
public class StatusAnnouncerFactoryTest extends AndroidTestCase {
/**
* Mock version of the {@link ApiFeatures} class.
*/
private class MockApiFeatures extends ApiFeatures {
private boolean hasTts;
public void setHasTextToSpeech(boolean hasTts) {
this.hasTts = hasTts;
}
@Override
public boolean hasTextToSpeech() {
return hasTts;
}
}
private MockApiFeatures apiFeatures;
@Override
protected void setUp() throws Exception {
super.setUp();
apiFeatures = new MockApiFeatures();
}
public void testCreate() {
apiFeatures.setHasTextToSpeech(true);
PeriodicTaskFactory factory =
new StatusAnnouncerFactory(apiFeatures);
PeriodicTask task = factory.create(getContext());
assertTrue(task instanceof StatusAnnouncerTask);
}
public void testCreate_notAvailable() {
apiFeatures.setHasTextToSpeech(false);
PeriodicTaskFactory factory =
new StatusAnnouncerFactory(apiFeatures);
PeriodicTask task = factory.create(getContext());
assertNull(task);
}
public void testGetVolumeStream() {
apiFeatures.setHasTextToSpeech(true);
StatusAnnouncerFactory factory =
new StatusAnnouncerFactory(apiFeatures);
assertEquals(
TextToSpeech.Engine.DEFAULT_STREAM,
factory.getVolumeStream());
}
public void testGetVolumeStream_notAvailable() {
apiFeatures.setHasTextToSpeech(false);
StatusAnnouncerFactory factory =
new StatusAnnouncerFactory(apiFeatures);
assertEquals(
AudioManager.USE_DEFAULT_STREAM_TYPE,
factory.getVolumeStream());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/tasks/StatusAnnouncerFactoryTest.java
|
Java
|
asf20
| 2,784
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services;
import static com.google.android.apps.mytracks.Constants.RESUME_TRACK_EXTRA_NAME;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.MyTracksProvider;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.apps.mytracks.util.ApiFeatures;
import com.google.android.maps.mytracks.R;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.location.Location;
import android.os.IBinder;
import android.test.RenamingDelegatingContext;
import android.test.ServiceTestCase;
import android.test.mock.MockContentResolver;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
/**
* Tests for the MyTracks track recording service.
*
* @author Bartlomiej Niechwiej
*
* TODO: The original class, ServiceTestCase, has a few limitations, e.g.
* it's not possible to properly shutdown the service, unless tearDown()
* is called, which prevents from testing multiple scenarios in a single
* test (see runFunctionTest for more details).
*/
public class TrackRecordingServiceTest
extends ServiceTestCase<TrackRecordingService> {
private Context context;
private MyTracksProviderUtils providerUtils;
private SharedPreferences sharedPreferences;
/*
* In order to support starting and binding to the service in the same
* unit test, we provide a workaround, as the original class doesn't allow
* to bind after the service has been previously started.
*/
private boolean bound;
private Intent serviceIntent;
public TrackRecordingServiceTest() {
super(TrackRecordingService.class);
}
/**
* A context wrapper with the user provided {@link ContentResolver}.
*
* TODO: Move to test utils package.
*/
public static class MockContext extends ContextWrapper {
private final ContentResolver contentResolver;
public MockContext(ContentResolver contentResolver, Context base) {
super(base);
this.contentResolver = contentResolver;
}
@Override
public ContentResolver getContentResolver() {
return contentResolver;
}
}
/**
* A mock class that forces API level < 5 to make sure we can workaround a bug
* in ServiceTestCase (throwing a NPE).
* See http://code.google.com/p/android/issues/detail?id=12122 for more
* details.
*/
private static class MockApiFeatures extends ApiFeatures {
@Override
protected int getApiLevel() {
return 4;
}
}
@Override
protected IBinder bindService(Intent intent) {
if (getService() != null) {
if (bound) {
throw new IllegalStateException(
"Service: " + getService() + " is already bound");
}
bound = true;
serviceIntent = intent.cloneFilter();
return getService().onBind(intent);
} else {
return super.bindService(intent);
}
}
@Override
protected void shutdownService() {
if (bound) {
assertNotNull(getService());
getService().onUnbind(serviceIntent);
bound = false;
}
super.shutdownService();
}
@Override
protected void setUp() throws Exception {
super.setUp();
ApiFeatures.injectInstance(new MockApiFeatures());
MockContentResolver mockContentResolver = new MockContentResolver();
RenamingDelegatingContext targetContext = new RenamingDelegatingContext(
getContext(), getContext(), "test.");
context = new MockContext(mockContentResolver, targetContext);
MyTracksProvider provider = new MyTracksProvider();
provider.attachInfo(context, null);
mockContentResolver.addProvider(MyTracksProviderUtils.AUTHORITY, provider);
setContext(context);
providerUtils = MyTracksProviderUtils.Factory.get(context);
sharedPreferences = context.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
// Let's use default values.
sharedPreferences.edit().clear().apply();
// Disable auto resume by default.
updateAutoResumePrefs(0, -1);
// No recording track.
Editor editor = sharedPreferences.edit();
editor.putLong(context.getString(R.string.recording_track_key), -1);
editor.apply();
}
@SmallTest
public void testStartable() {
startService(createStartIntent());
assertNotNull(getService());
}
@MediumTest
public void testBindable() {
IBinder service = bindService(createStartIntent());
assertNotNull(service);
}
@MediumTest
public void testResumeAfterReboot_shouldResume() throws Exception {
// Insert a dummy track and mark it as recording track.
createDummyTrack(123, System.currentTimeMillis(), true);
// Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(0, 10);
// Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent();
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
startService(startIntent);
assertNotNull(getService());
// We expect to resume the previous track.
assertTrue(getService().isRecording());
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertEquals(123, service.getRecordingTrackId());
}
// TODO: shutdownService() has a bug and doesn't set mServiceCreated
// to false, thus preventing from a second call to onCreate().
// Report the bug to Android team. Until then, the following tests
// and checks must be commented out.
//
// TODO: If fixed, remove "disabled" prefix from the test name.
@MediumTest
public void disabledTestResumeAfterReboot_simulateReboot() throws Exception {
updateAutoResumePrefs(0, 10);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
// Simulate recording a track.
long id = service.startNewTrack();
assertTrue(service.isRecording());
assertEquals(id, service.getRecordingTrackId());
shutdownService();
assertEquals(id, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), -1));
// Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent();
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
startService(startIntent);
assertNotNull(getService());
assertTrue(getService().isRecording());
}
@MediumTest
public void testResumeAfterReboot_noRecordingTrack() throws Exception {
// Insert a dummy track and mark it as recording track.
createDummyTrack(123, System.currentTimeMillis(), false);
// Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(0, 10);
// Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent();
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
startService(startIntent);
assertNotNull(getService());
// We don't expect to resume the previous track, because it was stopped.
assertFalse(getService().isRecording());
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testResumeAfterReboot_expiredTrack() throws Exception {
// Insert a dummy track last updated 20 min ago.
createDummyTrack(123, System.currentTimeMillis() - 20 * 60 * 1000, true);
// Clear the number of attempts and set the timeout to 10 min.
updateAutoResumePrefs(0, 10);
// Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent();
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
startService(startIntent);
assertNotNull(getService());
// We don't expect to resume the previous track, because it has expired.
assertFalse(getService().isRecording());
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testResumeAfterReboot_tooManyAttempts() throws Exception {
// Insert a dummy track.
createDummyTrack(123, System.currentTimeMillis(), true);
// Set the number of attempts to max.
updateAutoResumePrefs(
TrackRecordingService.MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS, 10);
// Start the service in "resume" mode (simulates the on-reboot action).
Intent startIntent = createStartIntent();
startIntent.putExtra(RESUME_TRACK_EXTRA_NAME, true);
startService(startIntent);
assertNotNull(getService());
// We don't expect to resume the previous track, because there were already
// too many attempts.
assertFalse(getService().isRecording());
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testRecording_noTracks() throws Exception {
List<Track> tracks = providerUtils.getAllTracks();
assertTrue(tracks.isEmpty());
ITrackRecordingService service = bindAndGetService(createStartIntent());
// Test if we start in no-recording mode by default.
assertFalse(service.isRecording());
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testRecording_oldTracks() throws Exception {
createDummyTrack(123, -1, false);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testRecording_orphanedRecordingTrack() throws Exception {
// Just set recording track to a bogus value.
setRecordingTrack(256);
// Make sure that the service will not start recording and will clear
// the bogus track.
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
assertEquals(-1, service.getRecordingTrackId());
}
/**
* Synchronous/waitable broadcast receiver to be used in testing.
*/
private class BlockingBroadcastReceiver extends BroadcastReceiver {
private static final long MAX_WAIT_TIME_MS = 10000;
private List<Intent> receivedIntents = new ArrayList<Intent>();
public List<Intent> getReceivedIntents() {
return receivedIntents;
}
@Override
public void onReceive(Context ctx, Intent intent) {
Log.d("MyTracksTest", "Got broadcast: " + intent);
synchronized (receivedIntents) {
receivedIntents.add(intent);
receivedIntents.notifyAll();
}
}
public boolean waitUntilReceived(int receiveCount) {
long deadline = System.currentTimeMillis() + MAX_WAIT_TIME_MS;
synchronized (receivedIntents) {
while (receivedIntents.size() < receiveCount) {
try {
// Wait releases synchronized lock until it returns
receivedIntents.wait(500);
} catch (InterruptedException e) {
// Do nothing
}
if (System.currentTimeMillis() > deadline) {
return false;
}
}
}
return true;
}
}
@MediumTest
public void testStartNewTrack_noRecording() throws Exception {
// NOTICE: due to the way Android permissions work, if this fails,
// uninstall the test apk then retry - the test must be installed *after*
// My Tracks (go figure).
// Reference: http://code.google.com/p/android/issues/detail?id=5521
BlockingBroadcastReceiver startReceiver = new BlockingBroadcastReceiver();
String startAction = context.getString(R.string.track_started_broadcast_action);
context.registerReceiver(startReceiver, new IntentFilter(startAction));
List<Track> tracks = providerUtils.getAllTracks();
assertTrue(tracks.isEmpty());
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
long id = service.startNewTrack();
assertTrue(id >= 0);
assertTrue(service.isRecording());
Track track = providerUtils.getTrack(id);
assertNotNull(track);
assertEquals(id, track.getId());
assertEquals(sharedPreferences.getString(context.getString(R.string.default_activity_key), ""),
track.getCategory());
assertEquals(id, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), -1));
assertEquals(id, service.getRecordingTrackId());
// Verify that the start broadcast was received.
assertTrue(startReceiver.waitUntilReceived(1));
List<Intent> receivedIntents = startReceiver.getReceivedIntents();
assertEquals(1, receivedIntents.size());
Intent broadcastIntent = receivedIntents.get(0);
assertEquals(startAction, broadcastIntent.getAction());
assertEquals(id, broadcastIntent.getLongExtra(
context.getString(R.string.track_id_broadcast_extra), -1));
context.unregisterReceiver(startReceiver);
}
@MediumTest
public void testStartNewTrack_alreadyRecording() throws Exception {
createDummyTrack(123, -1, true);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertTrue(service.isRecording());
// Starting a new track when there is a recording should just return -1L.
long newTrack = service.startNewTrack();
assertEquals(-1L, newTrack);
assertEquals(123, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), 0));
assertEquals(123, service.getRecordingTrackId());
}
@MediumTest
public void testEndCurrentTrack_alreadyRecording() throws Exception {
// See comment above if this fails randomly.
BlockingBroadcastReceiver stopReceiver = new BlockingBroadcastReceiver();
String stopAction = context.getString(R.string.track_stopped_broadcast_action);
context.registerReceiver(stopReceiver, new IntentFilter(stopAction));
createDummyTrack(123, -1, true);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertTrue(service.isRecording());
// End the current track.
service.endCurrentTrack();
assertFalse(service.isRecording());
assertEquals(-1, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), 0));
assertEquals(-1, service.getRecordingTrackId());
// Verify that the stop broadcast was received.
assertTrue(stopReceiver.waitUntilReceived(1));
List<Intent> receivedIntents = stopReceiver.getReceivedIntents();
assertEquals(1, receivedIntents.size());
Intent broadcastIntent = receivedIntents.get(0);
assertEquals(stopAction, broadcastIntent.getAction());
assertEquals(123, broadcastIntent.getLongExtra(
context.getString(R.string.track_id_broadcast_extra), -1));
context.unregisterReceiver(stopReceiver);
}
@MediumTest
public void testEndCurrentTrack_noRecording() throws Exception {
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
// Ending the current track when there is no recording should not result in any error.
service.endCurrentTrack();
assertEquals(-1, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), 0));
assertEquals(-1, service.getRecordingTrackId());
}
@MediumTest
public void testIntegration_completeRecordingSession() throws Exception {
List<Track> tracks = providerUtils.getAllTracks();
assertTrue(tracks.isEmpty());
fullRecordingSession();
}
@MediumTest
public void testInsertStatisticsMarker_noRecordingTrack() throws Exception {
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
try {
service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
fail("Expecting IllegalStateException");
} catch (IllegalStateException e) {
// Expected.
}
}
@MediumTest
public void testInsertStatisticsMarker_validLocation() throws Exception {
createDummyTrack(123, -1, true);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertTrue(service.isRecording());
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
assertEquals(2, service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS));
Waypoint wpt = providerUtils.getWaypoint(1);
assertEquals(getContext().getString(R.string.marker_statistics_icon_url),
wpt.getIcon());
assertEquals(getContext().getString(R.string.marker_type_statistics),
wpt.getName());
assertEquals(Waypoint.TYPE_STATISTICS, wpt.getType());
assertEquals(123, wpt.getTrackId());
assertEquals(0.0, wpt.getLength());
assertNotNull(wpt.getLocation());
assertNotNull(wpt.getStatistics());
// TODO check the rest of the params.
// TODO: Check waypoint 2.
}
@MediumTest
public void testInsertWaypointMarker_noRecordingTrack() throws Exception {
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
try {
service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER);
fail("Expecting IllegalStateException");
} catch (IllegalStateException e) {
// Expected.
}
}
@MediumTest
public void testInsertWaypointMarker_validWaypoint() throws Exception {
createDummyTrack(123, -1, true);
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertTrue(service.isRecording());
assertEquals(1, service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER));
Waypoint wpt = providerUtils.getWaypoint(1);
assertEquals(getContext().getString(R.string.marker_waypoint_icon_url),
wpt.getIcon());
assertEquals(getContext().getString(R.string.marker_type_waypoint),
wpt.getName());
assertEquals(Waypoint.TYPE_WAYPOINT, wpt.getType());
assertEquals(123, wpt.getTrackId());
assertEquals(0.0, wpt.getLength());
assertNotNull(wpt.getLocation());
assertNull(wpt.getStatistics());
}
@MediumTest
public void testWithProperties_noAnnouncementFreq() throws Exception {
functionalTest(R.string.announcement_frequency_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultAnnouncementFreq() throws Exception {
functionalTest(R.string.announcement_frequency_key, 1);
}
@MediumTest
public void testWithProperties_noMaxRecordingDist() throws Exception {
functionalTest(R.string.max_recording_distance_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultMaxRecordingDist() throws Exception {
functionalTest(R.string.max_recording_distance_key, 5);
}
@MediumTest
public void testWithProperties_noMinRecordingDist() throws Exception {
functionalTest(R.string.min_recording_distance_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultMinRecordingDist() throws Exception {
functionalTest(R.string.min_recording_distance_key, 2);
}
@MediumTest
public void testWithProperties_noSplitFreq() throws Exception {
functionalTest(R.string.split_frequency_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultSplitFreqByDist() throws Exception {
functionalTest(R.string.split_frequency_key, 5);
}
@MediumTest
public void testWithProperties_defaultSplitFreqByTime() throws Exception {
functionalTest(R.string.split_frequency_key, -2);
}
@MediumTest
public void testWithProperties_noMetricUnits() throws Exception {
functionalTest(R.string.metric_units_key, (Object) null);
}
@MediumTest
public void testWithProperties_metricUnitsEnabled() throws Exception {
functionalTest(R.string.metric_units_key, true);
}
@MediumTest
public void testWithProperties_metricUnitsDisabled() throws Exception {
functionalTest(R.string.metric_units_key, false);
}
@MediumTest
public void testWithProperties_noMinRecordingInterval() throws Exception {
functionalTest(R.string.min_recording_interval_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultMinRecordingInterval()
throws Exception {
functionalTest(R.string.min_recording_interval_key, 3);
}
@MediumTest
public void testWithProperties_noMinRequiredAccuracy() throws Exception {
functionalTest(R.string.min_required_accuracy_key, (Object) null);
}
@MediumTest
public void testWithProperties_defaultMinRequiredAccuracy() throws Exception {
functionalTest(R.string.min_required_accuracy_key, 500);
}
@MediumTest
public void testWithProperties_noSensorType() throws Exception {
functionalTest(R.string.sensor_type_key, (Object) null);
}
@MediumTest
public void testWithProperties_zephyrSensorType() throws Exception {
functionalTest(R.string.sensor_type_key,
context.getString(R.string.sensor_type_value_zephyr));
}
private ITrackRecordingService bindAndGetService(Intent intent) {
ITrackRecordingService service = ITrackRecordingService.Stub.asInterface(
bindService(intent));
assertNotNull(service);
return service;
}
private Track createDummyTrack(long id, long stopTime, boolean isRecording) {
Track dummyTrack = new Track();
dummyTrack.setId(id);
dummyTrack.setName("Dummy Track");
TripStatistics tripStatistics = new TripStatistics();
tripStatistics.setStopTime(stopTime);
dummyTrack.setStatistics(tripStatistics);
addTrack(dummyTrack, isRecording);
return dummyTrack;
}
private void updateAutoResumePrefs(int attempts, int timeoutMins) {
Editor editor = sharedPreferences.edit();
editor.putInt(context.getString(
R.string.auto_resume_track_current_retry_key), attempts);
editor.putInt(context.getString(
R.string.auto_resume_track_timeout_key), timeoutMins);
editor.apply();
}
private Intent createStartIntent() {
Intent startIntent = new Intent();
startIntent.setClass(context, TrackRecordingService.class);
return startIntent;
}
private void addTrack(Track track, boolean isRecording) {
assertTrue(track.getId() >= 0);
providerUtils.insertTrack(track);
assertEquals(track.getId(), providerUtils.getTrack(track.getId()).getId());
setRecordingTrack(isRecording ? track.getId() : -1);
}
private void setRecordingTrack(long id) {
Editor editor = sharedPreferences.edit();
editor.putLong(context.getString(R.string.recording_track_key), id);
editor.apply();
}
// TODO: We support multiple values for readability, however this test's
// base class doesn't properly shutdown the service, so it's not possible
// to pass more than 1 value at a time.
private void functionalTest(int resourceId, Object ...values)
throws Exception {
final String key = context.getString(resourceId);
for (Object value : values) {
// Remove all properties and set the property for the given key.
Editor editor = sharedPreferences.edit();
editor.clear();
if (value instanceof String) {
editor.putString(key, (String) value);
} else if (value instanceof Long) {
editor.putLong(key, (Long) value);
} else if (value instanceof Integer) {
editor.putInt(key, (Integer) value);
} else if (value instanceof Boolean) {
editor.putBoolean(key, (Boolean) value);
} else if (value == null) {
// Do nothing, as clear above has already removed this property.
}
editor.apply();
fullRecordingSession();
}
}
private void fullRecordingSession() throws Exception {
ITrackRecordingService service = bindAndGetService(createStartIntent());
assertFalse(service.isRecording());
// Start a track.
long id = service.startNewTrack();
assertTrue(id >= 0);
assertTrue(service.isRecording());
Track track = providerUtils.getTrack(id);
assertNotNull(track);
assertEquals(id, track.getId());
assertEquals(id, sharedPreferences.getLong(
context.getString(R.string.recording_track_key), -1));
assertEquals(id, service.getRecordingTrackId());
// Insert a few points, markers and statistics.
long startTime = System.currentTimeMillis();
for (int i = 0; i < 30; i++) {
Location loc = new Location("gps");
loc.setLongitude(35.0f + i / 10.0f);
loc.setLatitude(45.0f - i / 5.0f);
loc.setAccuracy(5);
loc.setSpeed(10);
loc.setTime(startTime + i * 10000);
loc.setBearing(3.0f);
service.recordLocation(loc);
if (i % 10 == 0) {
service.insertWaypoint(WaypointCreationRequest.DEFAULT_STATISTICS);
} else if (i % 7 == 0) {
service.insertWaypoint(WaypointCreationRequest.DEFAULT_MARKER);
}
}
// Stop the track. Validate if it has correct data.
service.endCurrentTrack();
assertFalse(service.isRecording());
assertEquals(-1, service.getRecordingTrackId());
track = providerUtils.getTrack(id);
assertNotNull(track);
assertEquals(id, track.getId());
TripStatistics tripStatistics = track.getStatistics();
assertNotNull(tripStatistics);
assertTrue(tripStatistics.getStartTime() > 0);
assertTrue(tripStatistics.getStopTime() >= tripStatistics.getStartTime());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java
|
Java
|
asf20
| 26,567
|
package com.google.android.apps.mytracks.services.sensors;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.services.sensors.ant.AntDirectSensorManager;
import com.google.android.apps.mytracks.services.sensors.ant.AntSrmBridgeSensorManager;
import com.google.android.maps.mytracks.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
public class SensorManagerFactoryTest extends AndroidTestCase {
private SharedPreferences sharedPreferences;
@Override
protected void setUp() throws Exception {
super.setUp();
sharedPreferences = getContext().getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
// Let's use default values.
sharedPreferences.edit().clear().apply();
}
@SmallTest
public void testDefaultSettings() throws Exception {
assertNull(SensorManagerFactory.getSensorManager(getContext()));
}
@SmallTest
public void testCreateZephyr() throws Exception {
assertClassForName(ZephyrSensorManager.class, R.string.sensor_type_value_zephyr);
}
@SmallTest
public void testCreateAnt() throws Exception {
assertClassForName(AntDirectSensorManager.class, R.string.sensor_type_value_ant);
}
@SmallTest
public void testCreateAntSRM() throws Exception {
assertClassForName(AntSrmBridgeSensorManager.class, R.string.sensor_type_value_srm_ant_bridge);
}
private void assertClassForName(Class<?> c, int i) {
sharedPreferences.edit()
.putString(getContext().getString(R.string.sensor_type_key),
getContext().getString(i))
.apply();
SensorManager sm = SensorManagerFactory.getSensorManager(getContext());
assertNotNull(sm);
assertTrue(c.isInstance(sm));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/SensorManagerFactoryTest.java
|
Java
|
asf20
| 1,863
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import android.test.AndroidTestCase;
public class AntStartupMessageTest extends AndroidTestCase {
public void testParse() {
byte[] rawMessage = {
0x12,
};
AntStartupMessage message = new AntStartupMessage(rawMessage);
assertEquals(0x12, message.getMessage());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntStartupMessageTest.java
|
Java
|
asf20
| 949
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import com.dsi.ant.AntDefine;
import com.dsi.ant.AntMesg;
import android.test.AndroidTestCase;
public class AntChannelResponseMessageTest extends AndroidTestCase {
public void testParse() {
byte[] rawMessage = {
0,
AntMesg.MESG_EVENT_ID,
AntDefine.EVENT_RX_SEARCH_TIMEOUT
};
AntChannelResponseMessage message = new AntChannelResponseMessage(rawMessage);
assertEquals(0, message.getChannelNumber());
assertEquals(AntMesg.MESG_EVENT_ID, message.getMessageId());
assertEquals(AntDefine.EVENT_RX_SEARCH_TIMEOUT, message.getMessageCode());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntChannelResponseMessageTest.java
|
Java
|
asf20
| 1,249
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import android.test.AndroidTestCase;
public class AntChannelIdMessageTest extends AndroidTestCase {
public void testParse() {
byte[] rawMessage = {
0, // channel number
0x34, 0x12, // device number
(byte) 0xaa, // device type id
(byte) 0xbb, // transmission type
};
AntChannelIdMessage message = new AntChannelIdMessage(rawMessage);
assertEquals(0, message.getChannelNumber());
assertEquals(0x1234, message.getDeviceNumber());
assertEquals((byte) 0xaa, message.getDeviceTypeId());
assertEquals((byte) 0xbb, message.getTransmissionType());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntChannelIdMessageTest.java
|
Java
|
asf20
| 1,268
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import android.test.AndroidTestCase;
public class AntMessageTest extends AndroidTestCase {
private static class TestAntMessage extends AntMessage {
public static short decodeShort(byte low, byte high) {
return AntMessage.decodeShort(low, high);
}
}
public void testDecode() {
assertEquals(0x1234, TestAntMessage.decodeShort((byte) 0x34, (byte) 0x12));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntMessageTest.java
|
Java
|
asf20
| 1,039
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import android.content.Context;
import android.test.AndroidTestCase;
import android.test.MoreAsserts;
public class AntSensorManagerTest extends AndroidTestCase {
private class TestAntSensorManager extends AntSensorManager {
public TestAntSensorManager(Context context) {
super(context);
}
public byte messageId;
public byte[] messageData;
@Override
protected void setupAntSensorChannels() {}
@SuppressWarnings("deprecation")
@Override
public void handleMessage(byte[] rawMessage) {
super.handleMessage(rawMessage);
}
@SuppressWarnings("hiding")
@Override
public boolean handleMessage(byte messageId, byte[] messageData) {
this.messageId = messageId;
this.messageData = messageData;
return true;
}
}
private TestAntSensorManager sensorManager;
@Override
protected void setUp() throws Exception {
super.setUp();
sensorManager = new TestAntSensorManager(getContext());
}
public void testSimple() {
byte[] rawMessage = {
0x03, // length
0x12, // message id
0x11, 0x22, 0x33, // body
};
byte[] expectedBody = { 0x11, 0x22, 0x33 };
sensorManager.handleMessage(rawMessage);
assertEquals((byte) 0x12, sensorManager.messageId);
MoreAsserts.assertEquals(expectedBody, sensorManager.messageData);
}
public void testTooShort() {
byte[] rawMessage = {
0x53, // length
0x12 // message id
};
sensorManager.handleMessage(rawMessage);
assertEquals(0, sensorManager.messageId);
assertNull(sensorManager.messageData);
}
public void testLengthWrong() {
byte[] rawMessage = {
0x53, // length
0x12, // message id
0x34, // body
};
sensorManager.handleMessage(rawMessage);
assertEquals(0, sensorManager.messageId);
assertNull(sensorManager.messageData);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntSensorManagerTest.java
|
Java
|
asf20
| 2,587
|
/*
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.services.sensors.ant;
import com.dsi.ant.AntMesg;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.Sensor;
import com.google.android.maps.mytracks.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
public class AntDirectSensorManagerTest extends AndroidTestCase {
private SharedPreferences sharedPreferences;
private AntDirectSensorManager manager;
public void setUp() {
sharedPreferences = getContext().getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
// Let's use default values.
sharedPreferences.edit().clear().apply();
manager = new AntDirectSensorManager(getContext());
}
@SuppressWarnings("deprecation")
@SmallTest
public void testBroadcastData() {
manager.setDeviceNumberHRM((short) 42);
byte[] buff = new byte[11];
buff[0] = 9;
buff[1] = AntMesg.MESG_BROADCAST_DATA_ID;
buff[2] = 0; // HRM CHANNEL
buff[10] = (byte) 220;
manager.handleMessage(buff);
Sensor.SensorDataSet sds = manager.getSensorDataSet();
assertNotNull(sds);
assertTrue(sds.hasHeartRate());
assertEquals(Sensor.SensorState.SENDING,
sds.getHeartRate().getState());
assertEquals(220, sds.getHeartRate().getValue());
assertFalse(sds.hasCadence());
assertFalse(sds.hasPower());
}
@SuppressWarnings("deprecation")
@SmallTest
public void testChannelId() {
byte[] buff = new byte[11];
buff[0] = 9;
buff[1] = AntMesg.MESG_CHANNEL_ID_ID;
buff[3] = 42;
manager.handleMessage(buff);
assertEquals(42, manager.getDeviceNumberHRM());
assertEquals(42,
sharedPreferences.getInt(
getContext().getString(R.string.ant_heart_rate_sensor_id_key), -1));
assertNull(manager.getSensorDataSet());
}
@SuppressWarnings("deprecation")
@SmallTest
public void testResponseEvent() {
assertEquals(Sensor.SensorState.NONE, manager.getSensorState());
byte[] buff = new byte[5];
buff[0] = 3; // length
buff[1] = AntMesg.MESG_RESPONSE_EVENT_ID;
buff[2] = 0; // channel
buff[3] = AntMesg.MESG_UNASSIGN_CHANNEL_ID;
buff[4] = 0; // code
manager.handleMessage(buff);
assertEquals(Sensor.SensorState.DISCONNECTED, manager.getSensorState());
assertNull(manager.getSensorDataSet());
}
// TODO: Test timeout too.
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ant/AntDirectSensorManagerTest.java
|
Java
|
asf20
| 3,098
|
package com.google.android.apps.mytracks.services.sensors;
import java.util.Arrays;
import com.google.android.apps.mytracks.content.Sensor;
import junit.framework.TestCase;
public class PolarMessageParserTest extends TestCase {
PolarMessageParser parser = new PolarMessageParser();
// A complete and valid Polar HxM packet
// FE08F701D1001104FE08F702D1001104
private final byte[] originalBuf =
{(byte) 0xFE, 0x08, (byte) 0xF7, 0x01, (byte) 0xD1, 0x00, 0x11, 0x04, (byte) 0xFE, 0x08,
(byte) 0xF7, 0x02, (byte) 0xD1, 0x00, 0x11, 0x04};
private byte[] buf;
public void setUp() {
buf = Arrays.copyOf(originalBuf, originalBuf.length);
}
public void testIsValid() {
assertTrue(parser.isValid(buf));
}
public void testIsValid_invalidHeader() {
// Invalidate header.
buf[0] = 0x03;
assertFalse(parser.isValid(buf));
}
public void testIsValid_invalidCheckbyte() {
// Invalidate checkbyte.
buf[2] = 0x03;
assertFalse(parser.isValid(buf));
}
public void testIsValid_invalidSequence() {
// Invalidate sequence.
buf[3] = 0x11;
assertFalse(parser.isValid(buf));
}
public void testParseBuffer() {
buf[5] = 70;
Sensor.SensorDataSet sds = parser.parseBuffer(buf);
assertTrue(sds.hasHeartRate());
assertTrue(sds.getHeartRate().getState() == Sensor.SensorState.SENDING);
assertEquals(70, sds.getHeartRate().getValue());
}
public void testFindNextAlignment_offset() {
// The first 4 bytes are garbage
buf = new byte[originalBuf.length + 4];
buf[0] = 4;
buf[1] = 2;
buf[2] = 4;
buf[3] = 2;
// Then the valid message.
System.arraycopy(originalBuf, 0, buf, 4, originalBuf.length);
assertEquals(4, parser.findNextAlignment(buf));
}
public void testFindNextAlignment_invalid() {
buf[0] = 0;
assertEquals(-1, parser.findNextAlignment(buf));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/PolarMessageParserTest.java
|
Java
|
asf20
| 1,870
|
package com.google.android.apps.mytracks.services.sensors;
import com.google.android.apps.mytracks.content.Sensor;
import junit.framework.TestCase;
public class ZephyrMessageParserTest extends TestCase {
ZephyrMessageParser parser = new ZephyrMessageParser();
public void testIsValid() {
byte[] smallBuf = new byte[59];
assertFalse(parser.isValid(smallBuf));
// A complete and valid Zephyr HxM packet
byte[] buf = { 2,38,55,26,0,49,101,80,0,49,98,100,42,113,120,-53,-24,-60,-123,-61,117,-69,42,-75,74,-78,51,-79,27,-83,28,-88,28,-93,29,-98,25,-103,26,-108,26,-113,59,-118,0,0,0,0,0,0,-22,3,125,1,48,0,96,4,30,0 };
// Make buffer invalid
buf[0] = buf[58] = buf[59] = 0;
assertFalse(parser.isValid(buf));
buf[0] = 0x02;
assertFalse(parser.isValid(buf));
buf[58] = 0x1E;
assertFalse(parser.isValid(buf));
buf[59] = 0x03;
assertTrue(parser.isValid(buf));
}
public void testParseBuffer() {
byte[] buf = new byte[60];
// Heart Rate (-1 =^ 255 unsigned byte)
buf[12] = -1;
// Battery Level
buf[11] = 51;
// Cadence (=^ 255*16 strides/min)
buf[56] = -1;
buf[57] = 15;
Sensor.SensorDataSet sds = parser.parseBuffer(buf);
assertTrue(sds.hasHeartRate());
assertTrue(sds.getHeartRate().getState() == Sensor.SensorState.SENDING);
assertEquals(255, sds.getHeartRate().getValue());
assertTrue(sds.hasBatteryLevel());
assertTrue(sds.getBatteryLevel().getState() == Sensor.SensorState.SENDING);
assertEquals(51, sds.getBatteryLevel().getValue());
assertTrue(sds.hasCadence());
assertTrue(sds.getCadence().getState() == Sensor.SensorState.SENDING);
assertEquals(255, sds.getCadence().getValue());
}
public void testFindNextAlignment() {
byte[] buf = new byte[60];
assertEquals(-1, parser.findNextAlignment(buf));
buf[10] = 0x03;
buf[11] = 0x02;
assertEquals(10, parser.findNextAlignment(buf));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/services/sensors/ZephyrMessageParserTest.java
|
Java
|
asf20
| 1,945
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.content;
import com.google.android.apps.mytracks.content.WaypointCreationRequest.WaypointType;
import android.os.Parcel;
import android.test.AndroidTestCase;
/**
* Tests for the WaypointCreationRequest class.
* {@link WaypointCreationRequest}
*
* @author Sandor Dornbush
*/
public class WaypointCreationRequestTest extends AndroidTestCase {
public void testTypeParceling() {
WaypointCreationRequest original = WaypointCreationRequest.DEFAULT_MARKER;
Parcel p = Parcel.obtain();
original.writeToParcel(p, 0);
p.setDataPosition(0);
WaypointCreationRequest copy = WaypointCreationRequest.CREATOR.createFromParcel(p);
assertEquals(original.getType(), copy.getType());
assertNull(copy.getName());
assertNull(copy.getDescription());
assertNull(copy.getIconUrl());
}
public void testAllAttributesParceling() {
WaypointCreationRequest original =
new WaypointCreationRequest(WaypointType.MARKER, "name", "description", "img.png");
Parcel p = Parcel.obtain();
original.writeToParcel(p, 0);
p.setDataPosition(0);
WaypointCreationRequest copy = WaypointCreationRequest.CREATOR.createFromParcel(p);
assertEquals(original.getType(), copy.getType());
assertEquals("name", copy.getName());
assertEquals("description", copy.getDescription());
assertEquals("img.png", copy.getIconUrl());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/content/WaypointCreationRequestTest.java
|
Java
|
asf20
| 2,005
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.content;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils.LocationFactory;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils.LocationIterator;
import com.google.android.apps.mytracks.services.TrackRecordingServiceTest.MockContext;
import android.content.Context;
import android.location.Location;
import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;
import android.test.mock.MockContentResolver;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* A unit test for {@link MyTracksProviderUtilsImpl}.
*
* @author Bartlomiej Niechwiej
*/
public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
private Context context;
private MyTracksProviderUtils providerUtils;
@Override
protected void setUp() throws Exception {
super.setUp();
MockContentResolver mockContentResolver = new MockContentResolver();
RenamingDelegatingContext targetContext = new RenamingDelegatingContext(
getContext(), getContext(), "test.");
context = new MockContext(mockContentResolver, targetContext);
MyTracksProvider provider = new MyTracksProvider();
provider.attachInfo(context, null);
mockContentResolver.addProvider(MyTracksProviderUtils.AUTHORITY, provider);
setContext(context);
providerUtils = MyTracksProviderUtils.Factory.get(context);
}
public void testLocationIterator_noPoints() {
testIterator(1, 0, 1, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
public void testLocationIterator_customFactory() {
final Location location = new Location("test_location");
final AtomicInteger counter = new AtomicInteger();
testIterator(1, 15, 4, false, new LocationFactory() {
@Override
public Location createLocation() {
counter.incrementAndGet();
return location;
}
});
// Make sure we were called exactly as many times as we had track points.
assertEquals(15, counter.get());
}
public void testLocationIterator_nullFactory() {
try {
testIterator(1, 15, 4, false, null);
fail("Expecting IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected.
}
}
public void testLocationIterator_noBatchAscending() {
testIterator(1, 50, 100, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
testIterator(2, 50, 50, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
public void testLocationIterator_noBatchDescending() {
testIterator(1, 50, 100, true, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
testIterator(2, 50, 50, true, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
public void testLocationIterator_batchAscending() {
testIterator(1, 50, 11, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
testIterator(2, 50, 25, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
public void testLocationIterator_batchDescending() {
testIterator(1, 50, 11, true, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
testIterator(2, 50, 25, true, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
public void testLocationIterator_largeTrack() {
testIterator(1, 20000, 2000, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
}
private List<Location> testIterator(long trackId, int numPoints, int batchSize,
boolean descending, LocationFactory locationFactory) {
long lastPointId = initializeTrack(trackId, numPoints);
((MyTracksProviderUtilsImpl) providerUtils).setDefaultCursorBatchSize(batchSize);
List<Location> locations = new ArrayList<Location>(numPoints);
LocationIterator it = providerUtils.getLocationIterator(trackId, -1, descending, locationFactory);
try {
while (it.hasNext()) {
Location loc = it.next();
assertNotNull(loc);
locations.add(loc);
// Make sure the IDs are returned in the right order.
assertEquals(descending ? lastPointId - locations.size() + 1
: lastPointId - numPoints + locations.size(), it.getLocationId());
}
assertEquals(numPoints, locations.size());
} finally {
it.close();
}
return locations;
}
private long initializeTrack(long id, int numPoints) {
Track track = new Track();
track.setId(id);
track.setName("Test: " + id);
track.setNumberOfPoints(numPoints);
providerUtils.insertTrack(track);
track = providerUtils.getTrack(id);
assertNotNull(track);
Location[] locations = new Location[numPoints];
for (int i = 0; i < numPoints; ++i) {
Location loc = new Location("test");
loc.setLatitude(37.0 + (double) i / 10000.0);
loc.setLongitude(57.0 - (double) i / 10000.0);
loc.setAccuracy((float) i / 100.0f);
loc.setAltitude(i * 2.5);
locations[i] = loc;
}
providerUtils.bulkInsertTrackPoints(locations, numPoints, id);
// Load all inserted locations.
long lastPointId = -1;
int counter = 0;
LocationIterator it = providerUtils.getLocationIterator(id, -1, false,
MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
try {
while (it.hasNext()) {
it.next();
lastPointId = it.getLocationId();
counter++;
}
} finally {
it.close();
}
assertTrue(numPoints == 0 || lastPointId > 0);
assertEquals(numPoints, track.getNumberOfPoints());
assertEquals(numPoints, counter);
return lastPointId;
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImplTest.java
|
Java
|
asf20
| 6,171
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.content;
import static com.google.android.testing.mocking.AndroidMock.anyInt;
import static com.google.android.testing.mocking.AndroidMock.capture;
import static com.google.android.testing.mocking.AndroidMock.eq;
import static com.google.android.testing.mocking.AndroidMock.expect;
import static com.google.android.testing.mocking.AndroidMock.isA;
import static com.google.android.testing.mocking.AndroidMock.leq;
import static com.google.android.testing.mocking.AndroidMock.same;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils.LocationFactory;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils.LocationIterator;
import com.google.android.apps.mytracks.content.TrackDataHub.ListenerDataType;
import com.google.android.apps.mytracks.content.TrackDataListener.ProviderState;
import com.google.android.apps.mytracks.services.TrackRecordingServiceTest.MockContext;
import com.google.android.maps.mytracks.R;
import com.google.android.testing.mocking.AndroidMock;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.location.Location;
import android.location.LocationListener;
import android.provider.BaseColumns;
import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;
import android.test.mock.MockContentResolver;
import java.lang.reflect.Constructor;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import org.easymock.Capture;
import org.easymock.IAnswer;
/**
* Tests for {@link TrackDataHub}.
*
* @author Rodrigo Damazio
*/
public class TrackDataHubTest extends AndroidTestCase {
private static final long TRACK_ID = 42L;
private static final int TARGET_POINTS = 50;
private MyTracksProviderUtils providerUtils;
private TrackDataHub hub;
private TrackDataListeners listeners;
private DataSourcesWrapper dataSources;
private SharedPreferences prefs;
private TrackDataListener listener1;
private TrackDataListener listener2;
private Capture<OnSharedPreferenceChangeListener> preferenceListenerCapture =
new Capture<SharedPreferences.OnSharedPreferenceChangeListener>();
private MockContext context;
private float declination;
@Override
protected void setUp() throws Exception {
super.setUp();
MockContentResolver mockContentResolver = new MockContentResolver();
RenamingDelegatingContext targetContext = new RenamingDelegatingContext(
getContext(), getContext(), "test.");
context = new MockContext(mockContentResolver, targetContext);
prefs = context.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
providerUtils = AndroidMock.createMock("providerUtils", MyTracksProviderUtils.class);
dataSources = AndroidMock.createNiceMock("dataSources", DataSourcesWrapper.class);
listeners = new TrackDataListeners();
hub = new TrackDataHub(context, listeners, prefs, providerUtils, TARGET_POINTS) {
@Override
protected DataSourcesWrapper newDataSources() {
return dataSources;
}
@Override
protected void runInListenerThread(Runnable runnable) {
// Run everything in the same thread.
runnable.run();
}
@Override
protected float getDeclinationFor(Location location, long timestamp) {
return declination;
}
};
listener1 = AndroidMock.createStrictMock("listener1", TrackDataListener.class);
listener2 = AndroidMock.createStrictMock("listener2", TrackDataListener.class);
}
@Override
protected void tearDown() throws Exception {
AndroidMock.reset(dataSources);
// Expect everything to be unregistered.
if (preferenceListenerCapture.hasCaptured()) {
dataSources.unregisterOnSharedPreferenceChangeListener(preferenceListenerCapture.getValue());
}
dataSources.removeLocationUpdates(isA(LocationListener.class));
dataSources.unregisterSensorListener(isA(SensorEventListener.class));
dataSources.unregisterContentObserver(isA(ContentObserver.class));
AndroidMock.expectLastCall().times(3);
AndroidMock.replay(dataSources);
hub.stop();
hub = null;
super.tearDown();
}
public void testTrackListen() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
Track track = new Track();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expect(providerUtils.getTrack(TRACK_ID)).andStubReturn(track);
expectStart();
dataSources.registerContentObserver(
eq(TracksColumns.CONTENT_URI), eq(false), capture(observerCapture));
// Expect the initial loading.
// Both listeners (registered before and after start) should get the same data.
listener1.onTrackUpdated(track);
listener2.onTrackUpdated(track);
replay();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.TRACK_UPDATES));
hub.start();
hub.registerTrackDataListener(listener2, EnumSet.of(ListenerDataType.TRACK_UPDATES));
verifyAndReset();
ContentObserver observer = observerCapture.getValue();
expect(providerUtils.getTrack(TRACK_ID)).andStubReturn(track);
// Now expect an update.
listener1.onTrackUpdated(track);
listener2.onTrackUpdated(track);
replay();
observer.onChange(false);
verifyAndReset();
// Unregister one, get another update.
expect(providerUtils.getTrack(TRACK_ID)).andStubReturn(track);
listener2.onTrackUpdated(track);
replay();
hub.unregisterTrackDataListener(listener1);
observer.onChange(false);
verifyAndReset();
// Unregister the other, expect internal unregistration
dataSources.unregisterContentObserver(observer);
replay();
hub.unregisterTrackDataListener(listener2);
observer.onChange(false);
verifyAndReset();
}
private static class FixedSizeCursorAnswer implements IAnswer<Cursor> {
private final int size;
public FixedSizeCursorAnswer(int size) {
this.size = size;
}
@Override
public Cursor answer() throws Throwable {
MatrixCursor cursor = new MatrixCursor(new String[] { BaseColumns._ID });
for (long i = 1; i <= size; i++) {
cursor.addRow(new Object[] { i });
}
return cursor;
}
}
private static class FixedSizeLocationIterator implements LocationIterator {
private final long startId;
private final Location[] locs;
private final Set<Integer> splitIndexSet = new HashSet<Integer>();
private int currentIdx = -1;
public FixedSizeLocationIterator(long startId, int size) {
this(startId, size, null);
}
public FixedSizeLocationIterator(long startId, int size, int... splitIndices) {
this.startId = startId;
this.locs = new Location[size];
for (int i = 0; i < size; i++) {
Location loc = new Location("gps");
loc.setLatitude(-15.0 + i / 1000.0);
loc.setLongitude(37 + i / 1000.0);
loc.setAltitude(i);
locs[i] = loc;
}
if (splitIndices != null) {
for (int splitIdx : splitIndices) {
splitIndexSet.add(splitIdx);
Location splitLoc = locs[splitIdx];
splitLoc.setLatitude(100.0);
splitLoc.setLongitude(200.0);
}
}
}
public void expectLocationsDelivered(TrackDataListener listener) {
for (int i = 0; i < locs.length; i++) {
if (splitIndexSet.contains(i)) {
listener.onSegmentSplit();
} else {
listener.onNewTrackPoint(locs[i]);
}
}
}
public void expectSampledLocationsDelivered(
TrackDataListener listener, int sampleFrequency, boolean includeSampledOut) {
for (int i = 0; i < locs.length; i++) {
if (splitIndexSet.contains(i)) {
listener.onSegmentSplit();
} else if (i % sampleFrequency == 0) {
listener.onNewTrackPoint(locs[i]);
} else if (includeSampledOut) {
listener.onSampledOutTrackPoint(locs[i]);
}
}
}
@Override
public boolean hasNext() {
return currentIdx < (locs.length - 1);
}
@Override
public Location next() {
currentIdx++;
return locs[currentIdx];
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@Override
public long getLocationId() {
return startId + currentIdx;
}
@Override
public void close() {
// Do nothing
}
}
public void testWaypointListen() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
Waypoint wpt1 = new Waypoint(),
wpt2 = new Waypoint(),
wpt3 = new Waypoint(),
wpt4 = new Waypoint();
Location loc = new Location("gps");
loc.setLatitude(10.0);
loc.setLongitude(8.0);
wpt1.setLocation(loc);
wpt2.setLocation(loc);
wpt3.setLocation(loc);
wpt4.setLocation(loc);
expect(providerUtils.getWaypointsCursor(
eq(TRACK_ID), leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS)))
.andStubAnswer(new FixedSizeCursorAnswer(2));
expect(providerUtils.createWaypoint(isA(Cursor.class)))
.andReturn(wpt1)
.andReturn(wpt2)
.andReturn(wpt1)
.andReturn(wpt2);
expectStart();
dataSources.registerContentObserver(
eq(WaypointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
// Expect the initial loading.
// Both listeners (registered before and after start) should get the same data.
listener1.clearWaypoints();
listener1.onNewWaypoint(wpt1);
listener1.onNewWaypoint(wpt2);
listener1.onNewWaypointsDone();
listener2.clearWaypoints();
listener2.onNewWaypoint(wpt1);
listener2.onNewWaypoint(wpt2);
listener2.onNewWaypointsDone();
replay();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.WAYPOINT_UPDATES));
hub.start();
hub.registerTrackDataListener(listener2, EnumSet.of(ListenerDataType.WAYPOINT_UPDATES));
verifyAndReset();
ContentObserver observer = observerCapture.getValue();
expect(providerUtils.getWaypointsCursor(
eq(TRACK_ID), leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS)))
.andStubAnswer(new FixedSizeCursorAnswer(3));
expect(providerUtils.createWaypoint(isA(Cursor.class)))
.andReturn(wpt1)
.andReturn(wpt2)
.andReturn(wpt3);
// Now expect an update.
listener1.clearWaypoints();
listener2.clearWaypoints();
listener1.onNewWaypoint(wpt1);
listener2.onNewWaypoint(wpt1);
listener1.onNewWaypoint(wpt2);
listener2.onNewWaypoint(wpt2);
listener1.onNewWaypoint(wpt3);
listener2.onNewWaypoint(wpt3);
listener1.onNewWaypointsDone();
listener2.onNewWaypointsDone();
replay();
observer.onChange(false);
verifyAndReset();
// Unregister one, get another update.
expect(providerUtils.getWaypointsCursor(
eq(TRACK_ID), leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS)))
.andStubAnswer(new FixedSizeCursorAnswer(4));
expect(providerUtils.createWaypoint(isA(Cursor.class)))
.andReturn(wpt1)
.andReturn(wpt2)
.andReturn(wpt3)
.andReturn(wpt4);
// Now expect an update.
listener2.clearWaypoints();
listener2.onNewWaypoint(wpt1);
listener2.onNewWaypoint(wpt2);
listener2.onNewWaypoint(wpt3);
listener2.onNewWaypoint(wpt4);
listener2.onNewWaypointsDone();
replay();
hub.unregisterTrackDataListener(listener1);
observer.onChange(false);
verifyAndReset();
// Unregister the other, expect internal unregistration
dataSources.unregisterContentObserver(observer);
replay();
hub.unregisterTrackDataListener(listener2);
observer.onChange(false);
verifyAndReset();
}
public void testPointsListen() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expectStart();
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 10, 5);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(10L);
listener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.start();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Register a second listener - it will get the same points as the previous one
locationIterator = new FixedSizeLocationIterator(1, 10, 5);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(10L);
listener2.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener2);
listener2.onNewTrackPointsDone();
replay();
hub.start();
hub.registerTrackDataListener(listener2, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Deliver more points - should go to both listeners, without clearing.
ContentObserver observer = observerCapture.getValue();
locationIterator = new FixedSizeLocationIterator(11, 10, 1);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(11L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(20L);
locationIterator.expectLocationsDelivered(listener1);
locationIterator.expectLocationsDelivered(listener2);
listener1.onNewTrackPointsDone();
listener2.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
// Unregister listener1, switch tracks to ensure data is cleared/reloaded.
locationIterator = new FixedSizeLocationIterator(101, 10);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID + 1), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID + 1)).andReturn(110L);
listener2.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener2);
listener2.onNewTrackPointsDone();
replay();
hub.unregisterTrackDataListener(listener1);
hub.loadTrack(TRACK_ID + 1);
verifyAndReset();
}
public void testPointsListen_beforeStart() {
}
public void testPointsListen_reRegister() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expectStart();
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 10, 5);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(10L);
listener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.start();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Unregister
ContentObserver observer = observerCapture.getValue();
dataSources.unregisterContentObserver(observer);
replay();
hub.unregisterTrackDataListener(listener1);
verifyAndReset();
// Register again, except only points since unregistered.
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
locationIterator = new FixedSizeLocationIterator(11, 10);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(11L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(20L);
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Deliver more points - should still be incremental.
locationIterator = new FixedSizeLocationIterator(21, 10, 1);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(21L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(30L);
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
}
public void testPointsListen_reRegisterTrackChanged() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expectStart();
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 10, 5);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(10L);
listener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.start();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Unregister
ContentObserver observer = observerCapture.getValue();
dataSources.unregisterContentObserver(observer);
replay();
hub.unregisterTrackDataListener(listener1);
verifyAndReset();
// Register again after track changed, expect all points.
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
locationIterator = new FixedSizeLocationIterator(1, 10);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID + 1), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID + 1)).andReturn(10L);
listener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.loadTrack(TRACK_ID + 1);
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
}
public void testPointsListen_largeTrackSampling() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expectStart();
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 200, 4, 25, 71, 120);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(200L);
listener1.clearTrackPoints();
listener2.clearTrackPoints();
locationIterator.expectSampledLocationsDelivered(listener1, 4, false);
locationIterator.expectSampledLocationsDelivered(listener2, 4, true);
listener1.onNewTrackPointsDone();
listener2.onNewTrackPointsDone();
replay();
hub.registerTrackDataListener(listener1,
EnumSet.of(ListenerDataType.POINT_UPDATES));
hub.registerTrackDataListener(listener2,
EnumSet.of(ListenerDataType.POINT_UPDATES, ListenerDataType.SAMPLED_OUT_POINT_UPDATES));
hub.start();
verifyAndReset();
}
public void testPointsListen_resampling() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
prefs.edit().putLong("recordingTrack", TRACK_ID)
.putLong("selectedTrack", TRACK_ID).apply();
expectStart();
dataSources.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), eq(false), capture(observerCapture));
// Deliver 30 points (no sampling happens)
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 30, 5);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(30L);
listener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(listener1);
listener1.onNewTrackPointsDone();
replay();
hub.start();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.POINT_UPDATES));
verifyAndReset();
// Now deliver 30 more (incrementally sampled)
ContentObserver observer = observerCapture.getValue();
locationIterator = new FixedSizeLocationIterator(31, 30);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(31L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(60L);
locationIterator.expectSampledLocationsDelivered(listener1, 2, false);
listener1.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
// Now another 30 (triggers resampling)
locationIterator = new FixedSizeLocationIterator(1, 90);
expect(providerUtils.getLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class)))
.andReturn(locationIterator);
expect(providerUtils.getLastLocationId(TRACK_ID)).andReturn(90L);
listener1.clearTrackPoints();
locationIterator.expectSampledLocationsDelivered(listener1, 2, false);
listener1.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
}
public void testLocationListen() {
// TODO
}
public void testCompassListen() throws Exception {
AndroidMock.resetToDefault(listener1);
Sensor compass = newSensor();
expect(dataSources.getSensor(Sensor.TYPE_ORIENTATION)).andReturn(compass);
Capture<SensorEventListener> listenerCapture = new Capture<SensorEventListener>();
dataSources.registerSensorListener(capture(listenerCapture), same(compass), anyInt());
Capture<LocationListener> locationListenerCapture = new Capture<LocationListener>();
dataSources.requestLocationUpdates(capture(locationListenerCapture));
SensorEvent event = newSensorEvent();
event.sensor = compass;
// First, get a dummy heading update.
listener1.onCurrentHeadingChanged(0.0);
// Then, get a heading update without a known location (thus can't calculate declination).
listener1.onCurrentHeadingChanged(42.0f);
// Also expect location updates which are not relevant to us.
listener1.onProviderStateChange(isA(ProviderState.class));
AndroidMock.expectLastCall().anyTimes();
replay();
hub.registerTrackDataListener(listener1,
EnumSet.of(ListenerDataType.COMPASS_UPDATES, ListenerDataType.LOCATION_UPDATES));
hub.start();
SensorEventListener sensorListener = listenerCapture.getValue();
LocationListener locationListener = locationListenerCapture.getValue();
event.values[0] = 42.0f;
sensorListener.onSensorChanged(event);
verifyAndReset();
// Expect the heading update to include declination.
listener1.onCurrentHeadingChanged(52.0);
// Also expect location updates which are not relevant to us.
listener1.onProviderStateChange(isA(ProviderState.class));
AndroidMock.expectLastCall().anyTimes();
listener1.onCurrentLocationChanged(isA(Location.class));
AndroidMock.expectLastCall().anyTimes();
replay();
// Now try injecting a location update, triggering a declination update.
Location location = new Location("gps");
location.setLatitude(10.0);
location.setLongitude(20.0);
location.setAltitude(30.0);
declination = 10.0f;
locationListener.onLocationChanged(location);
sensorListener.onSensorChanged(event);
verifyAndReset();
listener1.onCurrentHeadingChanged(52.0);
replay();
// Now try changing the known declination - it should still return the old declination, since
// updates only happen sparsely.
declination = 20.0f;
sensorListener.onSensorChanged(event);
verifyAndReset();
}
private Sensor newSensor() throws Exception {
Constructor<Sensor> constructor = Sensor.class.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
}
private SensorEvent newSensorEvent() throws Exception {
Constructor<SensorEvent> constructor = SensorEvent.class.getDeclaredConstructor(int.class);
constructor.setAccessible(true);
return constructor.newInstance(3);
}
public void testDisplayPreferencesListen() throws Exception {
String metricUnitsKey = context.getString(R.string.metric_units_key);
String speedKey = context.getString(R.string.report_speed_key);
prefs.edit()
.putBoolean(metricUnitsKey, true)
.putBoolean(speedKey, true)
.apply();
Capture<OnSharedPreferenceChangeListener> listenerCapture =
new Capture<OnSharedPreferenceChangeListener>();
dataSources.registerOnSharedPreferenceChangeListener(capture(listenerCapture));
expect(listener1.onUnitsChanged(true)).andReturn(false);
expect(listener2.onUnitsChanged(true)).andReturn(false);
expect(listener1.onReportSpeedChanged(true)).andReturn(false);
expect(listener2.onReportSpeedChanged(true)).andReturn(false);
replay();
hub.registerTrackDataListener(listener1, EnumSet.of(ListenerDataType.DISPLAY_PREFERENCES));
hub.start();
hub.registerTrackDataListener(listener2, EnumSet.of(ListenerDataType.DISPLAY_PREFERENCES));
verifyAndReset();
expect(listener1.onReportSpeedChanged(false)).andReturn(false);
expect(listener2.onReportSpeedChanged(false)).andReturn(false);
replay();
prefs.edit()
.putBoolean(speedKey, false)
.apply();
OnSharedPreferenceChangeListener listener = listenerCapture.getValue();
listener.onSharedPreferenceChanged(prefs, speedKey);
AndroidMock.verify(dataSources, providerUtils, listener1, listener2);
AndroidMock.reset(dataSources, providerUtils, listener1, listener2);
expect(listener1.onUnitsChanged(false)).andReturn(false);
expect(listener2.onUnitsChanged(false)).andReturn(false);
replay();
prefs.edit()
.putBoolean(metricUnitsKey, false)
.apply();
listener.onSharedPreferenceChanged(prefs, metricUnitsKey);
verifyAndReset();
}
private void expectStart() {
dataSources.registerOnSharedPreferenceChangeListener(capture(preferenceListenerCapture));
}
private void replay() {
AndroidMock.replay(dataSources, providerUtils, listener1, listener2);
}
private void verifyAndReset() {
AndroidMock.verify(listener1, listener2, dataSources, providerUtils);
AndroidMock.reset(listener1, listener2, dataSources, providerUtils);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/content/TrackDataHubTest.java
|
Java
|
asf20
| 29,093
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import android.graphics.Path;
import android.graphics.PointF;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Assert;
/**
* Elements for Tests for the MyTracks map overlay.
*
* @author Bartlomiej Niechwiej
* @author Vangelis S.
*
* A mock class that intercepts {@code Path}'s and records calls to
* {@code #moveTo()} and {@code #lineTo()}.
*/
public class MockPath extends Path {
/** A list of disjoined path segments. */
public final List<List<PointF>> segments = new LinkedList<List<PointF>>();
/** The total number of points in this path. */
public int totalPoints;
private List<PointF> currentSegment;
@Override
public void lineTo(float x, float y) {
super.lineTo(x, y);
Assert.assertNotNull(currentSegment);
currentSegment.add(new PointF(x, y));
totalPoints++;
}
@Override
public void moveTo(float x, float y) {
super.moveTo(x, y);
segments.add(currentSegment =
new ArrayList<PointF>(Arrays.asList(new PointF(x, y))));
totalPoints++;
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/MockPath.java
|
Java
|
asf20
| 1,734
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.Projection;
import android.graphics.Point;
/**
* Elements for Tests for the MyTracks map overlay.
*
* @author Bartlomiej Niechwiej
* @author Vangelis S.
*
* A mock {@code Projection} that acts as the identity matrix.
*/
public class MockProjection implements Projection {
@Override
public Point toPixels(GeoPoint in, Point out) {
return out;
}
@Override
public float metersToEquatorPixels(float meters) {
return meters;
}
@Override
public GeoPoint fromPixels(int x, int y) {
return new GeoPoint(y, x);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/MockProjection.java
|
Java
|
asf20
| 1,255
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.maps;
import android.location.Location;
/**
* Tests for the MyTracks track path descriptors and painters.
*
* @author Vangelis S.
*/
public class TrackPathDescriptorDynamicSpeedTest extends TrackPathPainterTestCase {
public void testDynamicSpeedTrackPathDescriptor() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
for (int i = 0; i < 100; ++i) {
location = new Location("gps");
location.setLatitude(20 + i / 2);
location.setLongitude(150 - i);
myTracksOverlay.addLocation(location);
}
TrackPathPainter painter = new DynamicSpeedTrackPathPainter(
getContext(), new DynamicSpeedTrackPathDescriptor(getContext()));
myTracksOverlay.setTrackPathPainter(painter);
int startLocationIdx = 0;
Boolean alwaysVisible = true;
assertNotNull(painter);
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
myTracksOverlay.getPoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
painter.drawTrack(canvas);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/maps/TrackPathDescriptorDynamicSpeedTest.java
|
Java
|
asf20
| 1,811
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.maps;
import android.location.Location;
/**
* Tests for the MyTracks track path descriptors and painters.
*
* @author Vangelis S.
*/
public class TrackPathDescriptorFixedSpeedTest extends TrackPathPainterTestCase {
public void testFixedSpeedTrackPathDescriptor() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
for (int i = 0; i < 100; ++i) {
location = new Location("gps");
location.setLatitude(20 + i / 2);
location.setLongitude(150 - i);
myTracksOverlay.addLocation(location);
}
TrackPathPainter painter = new DynamicSpeedTrackPathPainter(
getContext(), new FixedSpeedTrackPathDescriptor(getContext()));
myTracksOverlay.setTrackPathPainter(painter);
int startLocationIdx = 0;
Boolean alwaysVisible = true;
assertNotNull(painter);
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
myTracksOverlay.getPoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
painter.drawTrack(canvas);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/maps/TrackPathDescriptorFixedSpeedTest.java
|
Java
|
asf20
| 1,795
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.maps;
import android.location.Location;
/**
* Tests for the MyTracks track path descriptors and painters.
*
* @author Vangelis S.
*/
public class TrackPathPainterSingleColorTest extends TrackPathPainterTestCase {
public void testSimpeColorTrackPathPainter() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
for (int i = 0; i < 100; ++i) {
location = new Location("gps");
location.setLatitude(20 + i / 2);
location.setLongitude(150 - i);
myTracksOverlay.addLocation(location);
}
TrackPathPainter painter = new SingleColorTrackPathPainter(getContext());
myTracksOverlay.setTrackPathPainter(painter);
int startLocationIdx = 0;
Boolean alwaysVisible = true;
assertNotNull(painter);
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
myTracksOverlay.getPoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
painter.drawTrack(canvas);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/maps/TrackPathPainterSingleColorTest.java
|
Java
|
asf20
| 1,731
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.maps;
import com.google.android.apps.mytracks.MockMyTracksOverlay;
import com.google.android.maps.MapView;
import android.graphics.Canvas;
import android.test.AndroidTestCase;
/**
* Tests for the MyTracks track path descriptors and painters.
*
* @author Vangelis S.
*/
public class TrackPathPainterTestCase extends AndroidTestCase {
protected Canvas canvas;
protected MockMyTracksOverlay myTracksOverlay;
protected MapView mockView;
@Override
protected void setUp() throws Exception {
super.setUp();
canvas = new Canvas();
myTracksOverlay = new MockMyTracksOverlay(getContext());
// Enable drawing.
myTracksOverlay.setTrackDrawingEnabled(true);
mockView = null;
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/maps/TrackPathPainterTestCase.java
|
Java
|
asf20
| 1,343
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.maps;
import com.google.android.apps.mytracks.Constants;
import com.google.android.maps.mytracks.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.location.Location;
/**
* Tests for the MyTracks track path painter factory.
*
* @author Vangelis S.
*/
public class TrackPathPainterFactoryTest extends TrackPathPainterTestCase {
public void testTrackPathPainterFactory() throws Exception {
Location location = new Location("gps");
location.setLatitude(10);
for (int i = 0; i < 100; ++i) {
location = new Location("gps");
location.setLatitude(20 + i / 2);
location.setLongitude(150 - i);
myTracksOverlay.addLocation(location);
}
Context context = getContext();
SharedPreferences prefs = context.getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
if (prefs == null) {
return;
}
testTrackPathPainterFactorySpecific(context, prefs, R.string.display_track_color_value_none,
SingleColorTrackPathPainter.class);
testTrackPathPainterFactorySpecific(context, prefs, R.string.display_track_color_value_fixed,
DynamicSpeedTrackPathPainter.class);
testTrackPathPainterFactorySpecific(context, prefs, R.string.display_track_color_value_dynamic,
DynamicSpeedTrackPathPainter.class);
}
private <T> void testTrackPathPainterFactorySpecific(Context context, SharedPreferences prefs,
int track_color_mode, Class <?> c) {
prefs.edit().putString(context.getString(R.string.track_color_mode_key),
context.getString(track_color_mode)).apply();
int startLocationIdx = 0;
Boolean alwaysVisible = true;
TrackPathPainter painter = TrackPathPainterFactory.getTrackPathPainter(context);
myTracksOverlay.setTrackPathPainter(painter);
assertNotNull(painter);
assertTrue(c.isInstance(painter));
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
myTracksOverlay.getPoints());
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
painter.drawTrack(canvas);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/maps/TrackPathPainterFactoryTest.java
|
Java
|
asf20
| 2,862
|
// Copyright 2009 Google Inc. All Rights Reserved.
package com.google.android.apps.mytracks.stats;
import com.google.android.apps.mytracks.Constants;
import android.location.Location;
import junit.framework.TestCase;
/**
* Test the the function of the TripStatisticsBuilder class.
*
* @author Sandor Dornbush
*/
public class TripStatisticsBuilderTest extends TestCase {
private TripStatisticsBuilder builder = null;
@Override
protected void setUp() throws Exception {
super.setUp();
builder = new TripStatisticsBuilder(System.currentTimeMillis());
}
public void testAddLocationSimple() throws Exception {
builder = new TripStatisticsBuilder(1000);
TripStatistics stats = builder.getStatistics();
assertEquals(0.0, builder.getSmoothedElevation());
assertEquals(Double.POSITIVE_INFINITY, stats.getMinElevation());
assertEquals(Double.NEGATIVE_INFINITY, stats.getMaxElevation());
assertEquals(0.0, stats.getMaxSpeed());
assertEquals(Double.POSITIVE_INFINITY, stats.getMinGrade());
assertEquals(Double.NEGATIVE_INFINITY, stats.getMaxGrade());
assertEquals(0.0, stats.getTotalElevationGain());
assertEquals(0, stats.getMovingTime());
assertEquals(0.0, stats.getTotalDistance());
for (int i = 0; i < 100; i++) {
Location l = new Location("test");
l.setAccuracy(1.0f);
l.setLongitude(45.0);
// Going up by 5 meters each time.
l.setAltitude(i);
// Moving by .1% of a degree latitude.
l.setLatitude(i * .001);
l.setSpeed(11.1f);
// Each time slice is 10 seconds.
long time = 1000 + 10000 * i;
l.setTime(time);
boolean moving = builder.addLocation(l, time);
assertEquals((i != 0), moving);
stats = builder.getStatistics();
assertEquals(10000 * i, stats.getTotalTime());
assertEquals(10000 * i, stats.getMovingTime());
assertEquals(i, builder.getSmoothedElevation(),
Constants.ELEVATION_SMOOTHING_FACTOR / 2);
assertEquals(0.0, stats.getMinElevation());
assertEquals(i, stats.getMaxElevation(),
Constants.ELEVATION_SMOOTHING_FACTOR / 2);
assertEquals(i, stats.getTotalElevationGain(),
Constants.ELEVATION_SMOOTHING_FACTOR);
if (i > Constants.SPEED_SMOOTHING_FACTOR) {
assertEquals(11.1f, stats.getMaxSpeed(), 0.1);
}
if ((i > Constants.GRADE_SMOOTHING_FACTOR)
&& (i > Constants.ELEVATION_SMOOTHING_FACTOR)) {
assertEquals(0.009, stats.getMinGrade(), 0.0001);
assertEquals(0.009, stats.getMaxGrade(), 0.0001);
}
// 1 degree = 111 km
// 1 timeslice = 0.001 degree = 111 m
assertEquals(111.0 * i, stats.getTotalDistance(), 100);
}
}
/**
* Test that elevation works if the user is stable.
*/
public void testElevationSimple() throws Exception {
for (double elevation = 0; elevation < 1000; elevation += 10) {
builder = new TripStatisticsBuilder(System.currentTimeMillis());
for (int j = 0; j < 100; j++) {
assertEquals(0.0, builder.updateElevation(elevation));
assertEquals(elevation, builder.getSmoothedElevation());
TripStatistics data = builder.getStatistics();
assertEquals(elevation, data.getMinElevation());
assertEquals(elevation, data.getMaxElevation());
assertEquals(0.0, data.getTotalElevationGain());
}
}
}
public void testElevationGain() throws Exception {
for (double i = 0; i < 1000; i++) {
double expectedGain;
if (i < (Constants.ELEVATION_SMOOTHING_FACTOR - 1)) {
expectedGain = 0;
} else if (i < Constants.ELEVATION_SMOOTHING_FACTOR) {
expectedGain = 0.5;
} else {
expectedGain = 1.0;
}
assertEquals(expectedGain,
builder.updateElevation(i));
assertEquals(i, builder.getSmoothedElevation(), 20);
TripStatistics data = builder.getStatistics();
assertEquals(0.0, data.getMinElevation(), 0.0);
assertEquals(i, data.getMaxElevation(),
Constants.ELEVATION_SMOOTHING_FACTOR);
assertEquals(i, data.getTotalElevationGain(),
Constants.ELEVATION_SMOOTHING_FACTOR);
}
}
public void testGradeSimple() throws Exception {
for (double i = 0; i < 1000; i++) {
// The value of the elevation does not matter. This is just to fill the
// buffer.
builder.updateElevation(i);
builder.updateGrade(100, 100);
if ((i > Constants.GRADE_SMOOTHING_FACTOR)
&& (i > Constants.ELEVATION_SMOOTHING_FACTOR)) {
assertEquals(1.0, builder.getStatistics().getMaxGrade());
assertEquals(1.0, builder.getStatistics().getMinGrade());
}
}
for (double i = 0; i < 1000; i++) {
// The value of the elevation does not matter. This is just to fill the
// buffer.
builder.updateElevation(i);
builder.updateGrade(100, -100);
if ((i > Constants.GRADE_SMOOTHING_FACTOR)
&& (i > Constants.ELEVATION_SMOOTHING_FACTOR)) {
assertEquals(1.0, builder.getStatistics().getMaxGrade());
assertEquals(-1.0, builder.getStatistics().getMinGrade());
}
}
}
public void testGradeIgnoreShort() throws Exception {
for (double i = 0; i < 100; i++) {
// The value of the elevation does not matter. This is just to fill the
// buffer.
builder.updateElevation(i);
builder.updateGrade(1, 100);
assertEquals(Double.NEGATIVE_INFINITY, builder.getStatistics().getMaxGrade());
assertEquals(Double.POSITIVE_INFINITY, builder.getStatistics().getMinGrade());
}
}
public void testUpdateSpeedIncludeZero() {
for (int i = 0; i < 1000; i++) {
builder.updateSpeed(i + 1000, 0.0, i, 4.0);
assertEquals(0.0, builder.getStatistics().getMaxSpeed());
assertEquals((i + 1) * 1000, builder.getStatistics().getMovingTime());
}
}
public void testUpdateSpeedIngoreErrorCode() {
builder.updateSpeed(12345000, 128.0, 12344000, 0.0);
assertEquals(0.0, builder.getStatistics().getMaxSpeed());
assertEquals(1000, builder.getStatistics().getMovingTime());
}
public void testUpdateSpeedIngoreLargeAcceleration() {
builder.updateSpeed(12345000, 100.0, 12344000, 1.0);
assertEquals(0.0, builder.getStatistics().getMaxSpeed());
assertEquals(1000, builder.getStatistics().getMovingTime());
}
public void testUpdateSpeed() {
for (int i = 0; i < 1000; i++) {
builder.updateSpeed(i + 1000, 4.0, i, 4.0);
assertEquals((i + 1) * 1000, builder.getStatistics().getMovingTime());
if (i > Constants.SPEED_SMOOTHING_FACTOR) {
assertEquals(4.0, builder.getStatistics().getMaxSpeed());
}
}
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/stats/TripStatisticsBuilderTest.java
|
Java
|
asf20
| 6,773
|
/*
* Copyright 2009 Google Inc. All Rights Reserved.
*/
package com.google.android.apps.mytracks.stats;
import junit.framework.TestCase;
/**
* Test for the DoubleBuffer class.
*
* @author Sandor Dornbush
*/
public class DoubleBufferTest extends TestCase {
/**
* Tests that the constructor leaves the buffer in a valid state.
*/
public void testConstructor() {
DoubleBuffer buffer = new DoubleBuffer(10);
assertFalse(buffer.isFull());
assertEquals(0.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(0.0, averageAndVariance[0]);
assertEquals(0.0, averageAndVariance[1]);
}
/**
* Simple test with 10 of the same values.
*/
public void testBasic() {
DoubleBuffer buffer = new DoubleBuffer(10);
for (int i = 0; i < 9; i++) {
buffer.setNext(1.0);
assertFalse(buffer.isFull());
assertEquals(1.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(1.0, averageAndVariance[0]);
assertEquals(0.0, averageAndVariance[1]);
}
buffer.setNext(1);
assertTrue(buffer.isFull());
assertEquals(1.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(1.0, averageAndVariance[0]);
assertEquals(0.0, averageAndVariance[1]);
}
/**
* Tests with 5 entries of -10 and 5 entries of 10.
*/
public void testSplit() {
DoubleBuffer buffer = new DoubleBuffer(10);
for (int i = 0; i < 5; i++) {
buffer.setNext(-10);
assertFalse(buffer.isFull());
assertEquals(-10.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(-10.0, averageAndVariance[0]);
assertEquals(0.0, averageAndVariance[1]);
}
for (int i = 1; i < 5; i++) {
buffer.setNext(10);
assertFalse(buffer.isFull());
double expectedAverage = ((i * 10.0) - 50.0) / (i + 5);
assertEquals(buffer.toString(),
expectedAverage, buffer.getAverage(), 0.01);
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(expectedAverage, averageAndVariance[0]);
}
buffer.setNext(10);
assertTrue(buffer.isFull());
assertEquals(0.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(0.0, averageAndVariance[0]);
assertEquals(100.0, averageAndVariance[1]);
}
/**
* Tests that reset leaves the buffer in a valid state.
*/
public void testReset() {
DoubleBuffer buffer = new DoubleBuffer(10);
for (int i = 0; i < 100; i++) {
buffer.setNext(i);
}
assertTrue(buffer.isFull());
buffer.reset();
assertFalse(buffer.isFull());
assertEquals(0.0, buffer.getAverage());
double[] averageAndVariance = buffer.getAverageAndVariance();
assertEquals(0.0, averageAndVariance[0]);
assertEquals(0.0, averageAndVariance[1]);
}
/**
* Tests that if a lot of items are inserted the smoothing and looping works.
*/
public void testLoop() {
DoubleBuffer buffer = new DoubleBuffer(10);
for (int i = 0; i < 1000; i++) {
buffer.setNext(i);
assertEquals(i >= 9, buffer.isFull());
if (i > 10) {
assertEquals(i - 4.5, buffer.getAverage());
}
}
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/stats/DoubleBufferTest.java
|
Java
|
asf20
| 3,378
|
/**
* Copyright 2009 Google Inc. All Rights Reserved.
*/
package com.google.android.apps.mytracks.stats;
import junit.framework.TestCase;
import java.util.Random;
/**
* This class test the ExtremityMonitor class.
*
* @author Sandor Dornbush
*/
public class ExtremityMonitorTest extends TestCase {
public ExtremityMonitorTest(String name) {
super(name);
}
public void testInitialize() {
ExtremityMonitor monitor = new ExtremityMonitor();
assertEquals(Double.POSITIVE_INFINITY, monitor.getMin());
assertEquals(Double.NEGATIVE_INFINITY, monitor.getMax());
}
public void testSimple() {
ExtremityMonitor monitor = new ExtremityMonitor();
assertTrue(monitor.update(0));
assertTrue(monitor.update(1));
assertEquals(0.0, monitor.getMin());
assertEquals(1.0, monitor.getMax());
assertFalse(monitor.update(1));
assertFalse(monitor.update(0.5));
}
/**
* Throws a bunch of random numbers between [0,1] at the monitor.
*/
public void testRandom() {
ExtremityMonitor monitor = new ExtremityMonitor();
Random random = new Random(42);
for (int i = 0; i < 1000; i++) {
monitor.update(random.nextDouble());
}
assertTrue(monitor.getMin() < 0.1);
assertTrue(monitor.getMax() < 1.0);
assertTrue(monitor.getMin() >= 0.0);
assertTrue(monitor.getMax() > 0.9);
}
public void testReset() {
ExtremityMonitor monitor = new ExtremityMonitor();
assertTrue(monitor.update(0));
assertTrue(monitor.update(1));
monitor.reset();
assertEquals(Double.POSITIVE_INFINITY, monitor.getMin());
assertEquals(Double.NEGATIVE_INFINITY, monitor.getMax());
assertTrue(monitor.update(0));
assertTrue(monitor.update(1));
assertEquals(0.0, monitor.getMin());
assertEquals(1.0, monitor.getMax());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/stats/ExtremityMonitorTest.java
|
Java
|
asf20
| 1,813
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.stats;
import junit.framework.TestCase;
/**
* Tests for {@link TripStatistics}.
* This only tests non-trivial pieces of that class.
*
* @author Rodrigo Damazio
*/
public class TripStatisticsTest extends TestCase {
private TripStatistics statistics;
@Override
protected void setUp() throws Exception {
super.setUp();
statistics = new TripStatistics();
}
public void testSetBounds() {
// This is not a trivial setter, conversion happens in it
statistics.setBounds(12345, -34567, 56789, -98765);
assertEquals(12345, statistics.getLeft());
assertEquals(-34567, statistics.getTop());
assertEquals(56789, statistics.getRight());
assertEquals(-98765, statistics.getBottom());
}
public void testMerge() {
TripStatistics statistics2 = new TripStatistics();
statistics.setStartTime(1000L); // Resulting start time
statistics.setStopTime(2500L);
statistics2.setStartTime(3000L);
statistics2.setStopTime(4000L); // Resulting stop time
statistics.setTotalTime(1500L);
statistics2.setTotalTime(1000L); // Result: 1500+1000
statistics.setMovingTime(700L);
statistics2.setMovingTime(600L); // Result: 700+600
statistics.setTotalDistance(750.0);
statistics2.setTotalDistance(350.0); // Result: 750+350
statistics.setTotalElevationGain(50.0);
statistics2.setTotalElevationGain(850.0); // Result: 850+50
statistics.setMaxSpeed(60.0); // Resulting max speed
statistics2.setMaxSpeed(30.0);
statistics.setMaxElevation(1250.0);
statistics.setMinElevation(1200.0); // Resulting min elevation
statistics2.setMaxElevation(3575.0); // Resulting max elevation
statistics2.setMinElevation(2800.0);
statistics.setMaxGrade(15.0);
statistics.setMinGrade(-25.0); // Resulting min grade
statistics2.setMaxGrade(35.0); // Resulting max grade
statistics2.setMinGrade(0.0);
// Resulting bounds: -10000, 35000, 30000, -40000
statistics.setBounds(-10000, 20000, 30000, -40000);
statistics2.setBounds(-5000, 35000, 0, 20000);
statistics.merge(statistics2);
assertEquals(1000L, statistics.getStartTime());
assertEquals(4000L, statistics.getStopTime());
assertEquals(2500L, statistics.getTotalTime());
assertEquals(1300L, statistics.getMovingTime());
assertEquals(1100.0, statistics.getTotalDistance());
assertEquals(900.0, statistics.getTotalElevationGain());
assertEquals(60.0, statistics.getMaxSpeed());
assertEquals(-10000, statistics.getLeft());
assertEquals(30000, statistics.getRight());
assertEquals(35000, statistics.getTop());
assertEquals(-40000, statistics.getBottom());
assertEquals(1200.0, statistics.getMinElevation());
assertEquals(3575.0, statistics.getMaxElevation());
assertEquals(-25.0, statistics.getMinGrade());
assertEquals(35.0, statistics.getMaxGrade());
}
public void testGetAverageSpeed() {
statistics.setTotalDistance(1000.0);
statistics.setTotalTime(50000); // in milliseconds
assertEquals(20.0, statistics.getAverageSpeed());
}
public void testGetAverageMovingSpeed() {
statistics.setTotalDistance(1000.0);
statistics.setMovingTime(20000); // in milliseconds
assertEquals(50.0, statistics.getAverageMovingSpeed());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/stats/TripStatisticsTest.java
|
Java
|
asf20
| 3,920
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.services.ServiceUtils;
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
import com.google.android.maps.mytracks.R;
import android.app.Activity;
import android.app.Instrumentation.ActivityMonitor;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.Button;
import java.io.File;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* A unit test for {@link MyTracks} activity.
*
* @author Bartlomiej Niechwiej
*/
public class MyTracksTest extends ActivityInstrumentationTestCase2<MyTracks>{
private SharedPreferences sharedPreferences;
private TrackRecordingServiceConnection serviceConnection;
public MyTracksTest() {
super(MyTracks.class);
}
@Override
protected void tearDown() throws Exception {
clearSelectedAndRecordingTracks();
waitForIdle();
super.tearDown();
}
public void testInitialization_mainAction() {
// Make sure we can start MyTracks and the activity doesn't start recording.
assertInitialized();
// Check if not recording.
assertFalse(isRecording());
assertEquals(-1, getRecordingTrackId());
long selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
}
public void testInitialization_viewActionWithNoData() {
// Simulate start with ACTION_VIEW intent.
Intent startIntent = new Intent();
startIntent.setAction(Intent.ACTION_VIEW);
setActivityIntent(startIntent);
assertInitialized();
// Check if not recording.
assertFalse(isRecording());
assertEquals(-1, getRecordingTrackId());
long selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
}
public void testInitialization_viewActionWithValidData() throws Exception {
// Simulate start with ACTION_VIEW intent.
Intent startIntent = new Intent();
startIntent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(File.createTempFile("valid", ".gpx", getActivity().getFilesDir()));
// TODO: Add a valid GPX.
startIntent.setData(uri);
setActivityIntent(startIntent);
assertInitialized();
// Check if not recording.
assertFalse(isRecording());
assertEquals(-1, getRecordingTrackId());
long selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
// TODO: Finish this test.
}
public void testInitialization_viewActionWithInvalidData() throws Exception {
// Simulate start with ACTION_VIEW intent.
Intent startIntent = new Intent();
startIntent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(File.createTempFile("invalid", ".gpx", getActivity().getFilesDir()));
startIntent.setData(uri);
setActivityIntent(startIntent);
assertInitialized();
// Check if not recording.
assertFalse(isRecording());
assertEquals(-1, getRecordingTrackId());
long selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
// TODO: Finish this test.
}
public void testRecording_startAndStop() throws Exception {
assertInitialized();
// Check if not recording.
clearSelectedAndRecordingTracks();
waitForIdle();
assertFalse(isRecording());
assertEquals(-1, getRecordingTrackId());
long selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
// Start a new track.
getActivity().startRecording();
serviceConnection.bindIfRunning();
long recordingTrackId = awaitRecordingStatus(5000, true);
assertTrue(recordingTrackId >= 0);
// Wait until we are done and make sure that selectedTrack = recordingTrack.
waitForIdle();
assertEquals(recordingTrackId, getSharedPreferences().getLong(
getActivity().getString(R.string.recording_track_key), -1));
selectedTrackId = getSharedPreferences().getLong(
getActivity().getString(R.string.selected_track_key), -1);
assertEquals(recordingTrackId, selectedTrackId);
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
// Watch for MyTracksDetails activity.
ActivityMonitor monitor = getInstrumentation().addMonitor(
TrackDetails.class.getName(), null, false);
// Now, stop the track and make sure that it is still selected, but
// no longer recording.
getActivity().stopRecording();
// Check if we got back MyTracksDetails activity.
Activity activity = getInstrumentation().waitForMonitor(monitor);
assertTrue(activity instanceof TrackDetails);
// TODO: Update track name and other properties and test if they were
// properly saved.
// Simulate a click on Save button.
final Button save = (Button) activity.findViewById(R.id.trackdetails_save);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
save.performClick();
}
});
// Check the remaining properties.
recordingTrackId = awaitRecordingStatus(5000, false);
assertEquals(-1, recordingTrackId);
assertEquals(recordingTrackId, getRecordingTrackId());
assertEquals(recordingTrackId, getSharedPreferences().getLong(
getActivity().getString(R.string.recording_track_key), -1));
// Make sure this is the same track as the last recording track ID.
assertEquals(selectedTrackId, getActivity().getSelectedTrackId());
}
private void assertInitialized() {
assertNotNull(getActivity());
serviceConnection = new TrackRecordingServiceConnection(getActivity(), null);
}
/**
* Waits until the UI thread becomes idle.
*/
private void waitForIdle() throws InterruptedException {
// Note: We can't use getInstrumentation().waitForIdleSync() here.
final Object semaphore = new Object();
synchronized (semaphore) {
final AtomicBoolean isIdle = new AtomicBoolean();
getInstrumentation().waitForIdle(new Runnable() {
@Override
public void run() {
synchronized (semaphore) {
isIdle.set(true);
semaphore.notify();
}
}
});
while (!isIdle.get()) {
semaphore.wait();
}
}
}
/**
* Clears {selected,recording}TrackId in the {@link #getSharedPreferences()}.
*/
private void clearSelectedAndRecordingTracks() {
Editor editor = getSharedPreferences().edit();
editor.putLong(getActivity().getString(R.string.selected_track_key), -1);
editor.putLong(getActivity().getString(R.string.recording_track_key), -1);
editor.clear();
editor.apply();
}
/**
* Waits until the recording state changes to the given status.
*
* @param timeout the maximum time to wait, in milliseconds.
* @param isRecording the final status to await.
* @return the recording track ID.
*/
private long awaitRecordingStatus(long timeout, boolean isRecording)
throws TimeoutException, InterruptedException {
long startTime = System.nanoTime();
while (isRecording() != isRecording) {
if (System.nanoTime() - startTime > timeout * 1000000) {
throw new TimeoutException("Timeout while waiting for recording!");
}
Thread.sleep(20);
}
waitForIdle();
assertEquals(isRecording, isRecording());
return getRecordingTrackId();
}
private long getRecordingTrackId() {
return getSharedPreferences().getLong(getActivity().getString(R.string.recording_track_key), -1);
}
private SharedPreferences getSharedPreferences() {
if (sharedPreferences == null) {
sharedPreferences = getActivity().getSharedPreferences(
Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
}
return sharedPreferences;
}
private boolean isRecording() {
return ServiceUtils.isRecording(getActivity(),
serviceConnection.getServiceIfBound(), getSharedPreferences());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/MyTracksTest.java
|
Java
|
asf20
| 9,219
|
// Copyright 2010 Google Inc. All Rights Reserved.
package com.google.android.apps.mytracks.testing;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils.Factory;
import android.content.Context;
/**
* A fake factory for {@link MyTracksProviderUtils} which always returns a
* predefined instance.
*
* @author Rodrigo Damazio
*/
public class TestingProviderUtilsFactory extends Factory {
private MyTracksProviderUtils instance;
public TestingProviderUtilsFactory(MyTracksProviderUtils instance) {
this.instance = instance;
}
@Override
protected MyTracksProviderUtils newForContext(Context context) {
return instance;
}
public static Factory installWithInstance(MyTracksProviderUtils instance) {
Factory oldFactory = Factory.getInstance();
Factory factory = new TestingProviderUtilsFactory(instance);
MyTracksProviderUtils.Factory.overrideInstance(factory);
return oldFactory;
}
public static void restoreOldFactory(Factory factory) {
MyTracksProviderUtils.Factory.overrideInstance(factory);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/testing/TestingProviderUtilsFactory.java
|
Java
|
asf20
| 1,142
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.ChartValueSeries.ZoomSettings;
import com.google.android.maps.mytracks.R;
import android.graphics.Paint.Style;
import android.test.AndroidTestCase;
/**
* @author Sandor Dornbush
*/
public class ChartValueSeriesTest extends AndroidTestCase {
private ChartValueSeries series;
@Override
protected void setUp() throws Exception {
series = new ChartValueSeries(getContext(),
R.color.elevation_fill,
R.color.elevation_border,
new ZoomSettings(5, new int[] {100}),
R.string.stat_elevation);
}
public void testInitialConditions() {
assertEquals(0, series.getInterval());
assertEquals(1, series.getMaxLabelLength());
assertEquals(0, series.getMin());
assertEquals(0, series.getMax());
assertEquals(0.0, series.getSpread());
assertEquals(Style.STROKE, series.getPaint().getStyle());
assertEquals(getContext().getString(R.string.stat_elevation),
series.getTitle());
assertTrue(series.isEnabled());
}
public void testEnabled() {
series.setEnabled(false);
assertFalse(series.isEnabled());
}
public void testSmallUpdates() {
series.update(0);
series.update(10);
series.updateDimension();
assertEquals(100, series.getInterval());
assertEquals(3, series.getMaxLabelLength());
assertEquals(0, series.getMin());
assertEquals(100, series.getMax());
assertEquals(100.0, series.getSpread());
}
public void testBigUpdates() {
series.update(0);
series.update(901);
series.updateDimension();
assertEquals(100, series.getInterval());
assertEquals(5, series.getMaxLabelLength());
assertEquals(0, series.getMin());
assertEquals(1000, series.getMax());
assertEquals(1000.0, series.getSpread());
}
public void testNotZeroBasedUpdates() {
series.update(500);
series.update(1401);
series.updateDimension();
assertEquals(100, series.getInterval());
assertEquals(5, series.getMaxLabelLength());
assertEquals(500, series.getMin());
assertEquals(1500, series.getMax());
assertEquals(1000.0, series.getSpread());
}
public void testZoomSettings_invalidArgs() {
try {
new ZoomSettings(0, new int[] {10, 50, 100});
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK.
}
try {
new ZoomSettings(1, null);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK.
}
try {
new ZoomSettings(1, new int[] {});
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK.
}
try {
new ZoomSettings(1, new int[] {1, 3, 2});
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK.
}
}
public void testZoomSettings_minAligned() {
ZoomSettings settings = new ZoomSettings(5, new int[] {10, 50, 100});
assertEquals(10, settings.calculateInterval(0, 15));
assertEquals(10, settings.calculateInterval(0, 50));
assertEquals(50, settings.calculateInterval(0, 111));
assertEquals(50, settings.calculateInterval(0, 250));
assertEquals(100, settings.calculateInterval(0, 251));
assertEquals(100, settings.calculateInterval(0, 10000));
}
public void testZoomSettings_minNotAligned() {
ZoomSettings settings = new ZoomSettings(5, new int[] {10, 50, 100});
assertEquals(50, settings.calculateInterval(5, 55));
assertEquals(10, settings.calculateInterval(10, 60));
assertEquals(50, settings.calculateInterval(7, 250));
assertEquals(100, settings.calculateInterval(7, 257));
assertEquals(100, settings.calculateInterval(11, 10000));
// A regression test.
settings = new ZoomSettings(5, new int[] {5, 10, 20});
assertEquals(10, settings.calculateInterval(-37.14, -11.89));
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/ChartValueSeriesTest.java
|
Java
|
asf20
| 4,544
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.maps.MapView;
import com.google.android.maps.Projection;
import android.content.Context;
import android.graphics.Rect;
/**
* Elements for Tests for the MyTracks map overlay.
*
* @author Bartlomiej Niechwiej
* @author Vangelis S.
*
* A mock version of {@code MapOverlay} that does not use
* {@class MapView}.
*/
public class MockMyTracksOverlay extends MapOverlay {
private Projection mockProjection;
public MockMyTracksOverlay(Context context) {
super(context);
mockProjection = new MockProjection();
}
@Override
public Projection getMapProjection(MapView mapView) {
return mockProjection;
}
@Override
public Rect getMapViewRect(MapView mapView) {
return new Rect(0, 0, 100, 100);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/MockMyTracksOverlay.java
|
Java
|
asf20
| 1,404
|
/*
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.stats.TripStatistics;
import java.util.Vector;
import junit.framework.TestCase;
/**
* Tests for the Chart URL generator.
*
* @author Sandor Dornbush
*/
public class ChartURLGeneratorTest extends TestCase {
public void testgetChartUrl() {
Vector<Double> distances = new Vector<Double>();
Vector<Double> elevations = new Vector<Double>();
Track t = new Track();
TripStatistics stats = t.getStatistics();
stats.setMinElevation(0);
stats.setMaxElevation(2000);
stats.setTotalDistance(100);
distances.add(0.0);
elevations.add(10.0);
distances.add(10.0);
elevations.add(300.0);
distances.add(20.0);
elevations.add(800.0);
distances.add(50.0);
elevations.add(1900.0);
distances.add(75.0);
elevations.add(1200.0);
distances.add(90.0);
elevations.add(700.0);
distances.add(100.0);
elevations.add(70.0);
String chart = ChartURLGenerator.getChartUrl(distances,
elevations,
t,
"Title",
true);
assertEquals(
"http://chart.apis.google.com/chart?&chs=600x350&cht=lxy&"
+ "chtt=Title&chxt=x,y&chxr=0,0,0,0|1,0.0,2100.0,300&chco=009A00&"
+ "chm=B,00AA00,0,0,0&chg=100000,14.285714285714286,1,0&"
+ "chd=e:AAGZMzf.v.5l..,ATJJYY55kkVVCI",
chart);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/util/ChartURLGeneratorTest.java
|
Java
|
asf20
| 2,218
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.util;
import junit.framework.TestCase;
/**
* Tests the API feature detection code in {@link ApiFeatures}.
* This test requires Froyo+ to run.
*
* @author Rodrigo Damazio
*/
public class ApiFeaturesTest extends TestCase {
private TestableApiFeatures features;
private class TestableApiFeatures extends ApiFeatures {
private int apiLevel;
public void setApiLevel(int apiLevel) {
this.apiLevel = apiLevel;
}
@Override
protected int getApiLevel() {
return apiLevel;
}
}
@Override
protected void setUp() throws Exception {
super.setUp();
features = new TestableApiFeatures();
}
public void testHasTextToSpeech() {
features.setApiLevel(3);
assertFalse(features.hasTextToSpeech());
for (int i = 4; i <= 8; i++) {
features.setApiLevel(i);
assertTrue(features.hasTextToSpeech());
}
}
public void testGetApiAdapter() {
assertNotNull(features.getApiAdapter());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/util/ApiFeaturesTest.java
|
Java
|
asf20
| 1,599
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.util;
import com.google.android.apps.mytracks.Constants;
import android.os.Environment;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
/**
* Tests for {@link FileUtils}.
*
* @author Rodrigo Damazio
*/
public class FileUtilsTest extends TestCase {
private static final String ORIGINAL_NAME = "Swim\10ming-^across: the/ pacific (ocean).";
private static final String SANITIZED_NAME = "Swimming-across the pacific (ocean).";
private FileUtils fileUtils;
private Set<String> existingFiles;
@Override
protected void setUp() throws Exception {
super.setUp();
existingFiles = new HashSet<String>();
fileUtils = new FileUtils() {
@Override
protected boolean fileExists(File directory, String fullName) {
return existingFiles.contains(fullName);
}
};
}
public void testBuildExternalDirectoryPath() {
String expectedName = Environment.getExternalStorageDirectory()
+ File.separator
+ Constants.SDCARD_TOP_DIR
+ File.separator
+ "a"
+ File.separator
+ "b"
+ File.separator
+ "c";
String dirName = fileUtils.buildExternalDirectoryPath("a", "b", "c");
assertEquals(expectedName, dirName);
}
public void testSanitizeName() {
assertEquals(SANITIZED_NAME, fileUtils.sanitizeName(ORIGINAL_NAME));
}
public void testBuildUniqueFileName_someExist() {
existingFiles = new HashSet<String>();
existingFiles.add("Filename.ext");
existingFiles.add("Filename (1).ext");
existingFiles.add("Filename (2).ext");
existingFiles.add("Filename (3).ext");
existingFiles.add("Filename (4).ext");
String filename = fileUtils.buildUniqueFileName(null, "Filename", "ext");
assertEquals("Filename (5).ext", filename);
}
public void testBuildUniqueFileName_oneExists() {
existingFiles.add("Filename.ext");
String filename = fileUtils.buildUniqueFileName(null, "Filename", "ext");
assertEquals("Filename (1).ext", filename);
}
public void testBuildUniqueFileName_noneExists() {
String filename = fileUtils.buildUniqueFileName(null, "Filename", "ext");
assertEquals("Filename.ext", filename);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/util/FileUtilsTest.java
|
Java
|
asf20
| 2,871
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.util;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import junit.framework.TestCase;
/**
* Tests for {@link StringUtils}.
*
* @author Rodrigo Damazio
*/
public class StringUtilsTest extends TestCase {
public void testParseXmlDateTime() {
assertParseXmlDateTime("2010-05-04T03:02:01",
2010, 5, 4, 3, 2, 1, 0);
}
public void testParseXmlDateTime_fractional() {
assertParseXmlDateTime("2010-05-04T03:02:01.3",
2010, 5, 4, 3, 2, 1, 300);
assertParseXmlDateTime("2010-05-04T03:02:01.35",
2010, 5, 4, 3, 2, 1, 350);
assertParseXmlDateTime("2010-05-04T03:02:01.352",
2010, 5, 4, 3, 2, 1, 352);
assertParseXmlDateTime("2010-05-04T03:02:01.3525",
2010, 5, 4, 3, 2, 1, 352);
}
public void testParseXmlDateTime_timezone() {
assertParseXmlDateTime("2010-05-04T03:02:01Z",
2010, 5, 4, 3, 2, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01+00:00",
2010, 5, 4, 3, 2, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01-00:00",
2010, 5, 4, 3, 2, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01+01:00",
2010, 5, 4, 2, 2, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01+10:30",
2010, 5, 3, 16, 32, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01-09:30",
2010, 5, 4, 12, 32, 1, 0);
assertParseXmlDateTime("2010-05-04T03:02:01-05:00",
2010, 5, 4, 8, 2, 1, 0);
}
public void testParseXmlDateTime_fractionalAndTimezone() {
assertParseXmlDateTime("2010-05-04T03:02:01.352Z",
2010, 5, 4, 3, 2, 1, 352);
assertParseXmlDateTime("2010-05-04T03:02:01.47+00:00",
2010, 5, 4, 3, 2, 1, 470);
assertParseXmlDateTime("2010-05-04T03:02:01.5791+03:00",
2010, 5, 4, 0, 2, 1, 579);
assertParseXmlDateTime("2010-05-04T03:02:01.8-05:30",
2010, 5, 4, 8, 32, 1, 800);
}
private void assertParseXmlDateTime(String dateTime,
int year, int month, int day, int hour, int min, int second, int millis) {
long timestamp = StringUtils.parseXmlDateTime(dateTime);
GregorianCalendar calendar =
new GregorianCalendar(TimeZone.getTimeZone("UTC"));
calendar.set(year, month - 1, day, hour, min, second);
calendar.set(GregorianCalendar.MILLISECOND, millis);
assertEquals(calendar.getTimeInMillis(), timestamp);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/util/StringUtilsTest.java
|
Java
|
asf20
| 2,980
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.util;
import junit.framework.TestCase;
/**
* A unit test for {@link ChartsExtendedEncoder}.
*
* @author Bartlomiej Niechwiej
*/
public class ChartsExtendedEncoderTest extends TestCase {
public void testGetEncodedValue_validArguments() {
// Valid arguments.
assertEquals("AK", ChartsExtendedEncoder.getEncodedValue(10));
assertEquals("JO", ChartsExtendedEncoder.getEncodedValue(590));
assertEquals("AA", ChartsExtendedEncoder.getEncodedValue(0));
// 64^2 = 4096.
assertEquals("..", ChartsExtendedEncoder.getEncodedValue(4095));
}
public void testGetEncodedValue_invalidArguments() {
// Invalid arguments.
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(4096));
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(1234564096));
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(-10));
assertEquals("__", ChartsExtendedEncoder.getEncodedValue(-12324435));
}
public void testGetSeparator() {
assertEquals(",", ChartsExtendedEncoder.getSeparator());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/util/ChartsExtendedEncoderTest.java
|
Java
|
asf20
| 1,675
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.sendtogoogle;
import com.google.android.apps.mytracks.MyTracks;
import com.google.android.maps.mytracks.R;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.test.ActivityInstrumentationTestCase2;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
/**
* Tests {@link ResultDialogFactory}.
*
* @author Matthew Simmons
*/
public class ResultDialogFactoryTest extends ActivityInstrumentationTestCase2<MyTracks> {
public ResultDialogFactoryTest() {
super(MyTracks.class);
}
private List<SendResult> makeResults(SendResult... results) {
List<SendResult> resultsList = new ArrayList<SendResult>();
for (SendResult result : results) {
resultsList.add(result);
}
return resultsList;
}
private DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {}
};
private MyTracks myTracks;
protected void setUp() throws Exception {
super.setUp();
myTracks = getActivity();
};
public void testSuccess_noShare() {
List<SendResult> results = makeResults(new SendResult(SendType.MYMAPS, true),
new SendResult(SendType.DOCS, true));
AlertDialog dialog = ResultDialogFactory.makeDialog(
myTracks, results, clickListener, null, null);
dialog.show();
ListView listView = (ListView) dialog.findViewById(R.id.send_to_google_result_list);
ListAdapter listAdapter = listView.getAdapter();
assertEquals(2, listAdapter.getCount());
assertEquals(SendType.MYMAPS, ((SendResult) listAdapter.getItem(0)).getType());
assertEquals(SendType.DOCS, ((SendResult) listAdapter.getItem(1)).getType());
// Checking the return code of Dialog#getButton doesn't appear to be
// sufficient, as a Button will be returned even if it doesn't appear in
// the rendered dialog.
assertEquals(View.VISIBLE, dialog.getButton(AlertDialog.BUTTON_POSITIVE).getVisibility());
assertEquals(View.GONE, dialog.getButton(AlertDialog.BUTTON_NEUTRAL).getVisibility());
assertEquals(View.VISIBLE,
dialog.findViewById(R.id.send_to_google_result_comment).getVisibility());
assertEquals(View.GONE,
dialog.findViewById(R.id.send_to_google_result_error).getVisibility());
// TODO: Test correct listener invocation. Neither TouchUtils#clickView
// nor Button#performClick appear to cause listener invocation. This
// might be Android bug
// http://code.google.com/p/android/issues/detail?id=6564
}
public void testSuccess_share() {
List<SendResult> results = makeResults(
new SendResult(SendType.MYMAPS, true), new SendResult(SendType.DOCS, true));
AlertDialog dialog = ResultDialogFactory.makeDialog(
myTracks, results, clickListener, clickListener, null);
dialog.show();
assertEquals(View.VISIBLE, dialog.getButton(AlertDialog.BUTTON_POSITIVE).getVisibility());
assertEquals(View.VISIBLE, dialog.getButton(AlertDialog.BUTTON_NEGATIVE).getVisibility());
}
public void testFailure_noShare() {
List<SendResult> results = makeResults(new SendResult(SendType.MYMAPS, true),
new SendResult(SendType.DOCS, false));
AlertDialog dialog = ResultDialogFactory.makeDialog(
myTracks, results, clickListener, null, null);
dialog.show();
assertEquals(View.GONE,
dialog.findViewById(R.id.send_to_google_result_comment).getVisibility());
assertEquals(View.VISIBLE,
dialog.findViewById(R.id.send_to_google_result_error).getVisibility());
}
public void testFailure_share() {
List<SendResult> results = makeResults(new SendResult(SendType.MYMAPS, true),
new SendResult(SendType.DOCS, false));
AlertDialog dialog = ResultDialogFactory.makeDialog(
myTracks, results, clickListener, clickListener, null);
dialog.show();
assertEquals(View.VISIBLE, dialog.getButton(AlertDialog.BUTTON_POSITIVE).getVisibility());
assertEquals(View.VISIBLE, dialog.getButton(AlertDialog.BUTTON_NEGATIVE).getVisibility());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/ResultDialogFactoryTest.java
|
Java
|
asf20
| 4,822
|
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.sendtogoogle;
import com.google.android.maps.mytracks.R;
import android.content.Context;
import android.test.AndroidTestCase;
import android.view.LayoutInflater;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
/**
* Tests {@link ResultListAdapter}.
*
* @author Matthew Simmons
*/
public class ResultListAdapterTest extends AndroidTestCase {
private static class TestResultListAdapter extends ResultListAdapter {
public View contentView;
public int drawableId;
public int nameId;
public int urlId;
public TestResultListAdapter(Context context, List<SendResult> results) {
super(context, 0, results);
}
@Override
protected void setImage(View content, int drawableId) {
saveContentView(content);
this.drawableId = drawableId;
}
@Override
protected void setName(View content, int nameId) {
saveContentView(content);
this.nameId = nameId;
}
@Override
protected void setUrl(View content, int urlId) {
saveContentView(content);
this.urlId = urlId;
}
@SuppressWarnings("hiding")
private void saveContentView(View contentView) {
if (this.contentView == null) {
this.contentView = contentView;
} else {
AndroidTestCase.assertEquals(this.contentView, contentView);
}
}
}
private final SendType sendType = SendType.MYMAPS;
private View inflateContentView(int viewId) {
LayoutInflater layoutInflater
= (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return layoutInflater.inflate(viewId, null);
}
private List<SendResult> makeResult(SendType type, boolean success) {
List<SendResult> results = new ArrayList<SendResult>();
results.add(new SendResult(type, success));
return results;
}
public void testSuccess_createsNewView() {
TestResultListAdapter adapter = new TestResultListAdapter(getContext(),
makeResult(sendType, true));
adapter.getView(0, null, null);
assertEquals(R.drawable.success, adapter.drawableId);
assertEquals(sendType.getServiceName(), adapter.nameId);
assertEquals(sendType.getServiceUrl(), adapter.urlId);
}
public void testSuccess_reusesView() {
View contentView = inflateContentView(R.layout.send_to_google_result_list_item);
TestResultListAdapter adapter = new TestResultListAdapter(getContext(),
makeResult(sendType, true));
adapter.getView(0, contentView, null);
assertEquals(contentView, adapter.contentView);
assertEquals(R.drawable.success, adapter.drawableId);
assertEquals(sendType.getServiceName(), adapter.nameId);
assertEquals(sendType.getServiceUrl(), adapter.urlId);
}
public void testFailure() {
TestResultListAdapter adapter = new TestResultListAdapter(getContext(),
makeResult(sendType, false));
adapter.getView(0, null, null);
assertEquals(R.drawable.failure, adapter.drawableId);
assertEquals(sendType.getServiceName(), adapter.nameId);
assertEquals(sendType.getServiceUrl(), adapter.urlId);
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/io/sendtogoogle/ResultListAdapterTest.java
|
Java
|
asf20
| 3,737
|
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.docs;
import junit.framework.TestCase;
/**
* This class tests {@link DocsTagBuilder}
*
* @author Matthew Simmons
*/
public class DocsTagBuilderTest extends TestCase {
public void testAppend() {
assertEquals("<gsx:tag><![CDATA[value]]></gsx:tag>",
new DocsTagBuilder(false).append("tag", "value").build());
}
public void testMultiAppend() {
String actual = new DocsTagBuilder(false)
.append("tag1", "value1")
.append("tag2", "value2")
.build();
assertEquals("<gsx:tag1><![CDATA[value1]]></gsx:tag1>"
+ "<gsx:tag2><![CDATA[value2]]></gsx:tag2>", actual);
}
public void testAppendLargeUnits_imperial() {
assertEquals("<gsx:tag><![CDATA[62.14]]></gsx:tag>",
new DocsTagBuilder(false).appendLargeUnits("tag", 100.0).build());
}
public void testAppendLargeUnits_metric() {
assertEquals("<gsx:tag><![CDATA[100.00]]></gsx:tag>",
new DocsTagBuilder(true).appendLargeUnits("tag", 100.0).build());
}
public void testAppendSmallUnits_imperial() {
assertEquals("<gsx:tag><![CDATA[328]]></gsx:tag>",
new DocsTagBuilder(false).appendSmallUnits("tag", 100.0).build());
}
public void testAppendSmallUnits_metric() {
assertEquals("<gsx:tag><![CDATA[100]]></gsx:tag>",
new DocsTagBuilder(true).appendSmallUnits("tag", 100.0).build());
}
}
|
0000som143-mytracks
|
MyTracksTest/src/com/google/android/apps/mytracks/io/docs/DocsTagBuilderTest.java
|
Java
|
asf20
| 2,008
|