<!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="X-UA-Compatible" content="IE=7" />
<link href="skin/css/style.css" rel="stylesheet" type="text/css" />
<title>添加采集项目</title>
<script src="skin/js/common.js" type="text/javascript"></script>
<script src="skin/js/main.js" type="text/javascript"></script>
<style type="text/css">
input {
	height:12px;
}
.txt {
	width:250px;
}
.tb2 td {
	padding:2px 5px 2px 5px;
	height:25px;
	text-align:left;
}
.tb2 .thc {
	text-align:center;
	line-height:30px;
	background-color: #F5F7F8;
	font-size:18px;
	font-weight:bold;
	color:#000
}
.tb2 .thr {
	text-align:center;
	height:20px
}
.label {
	padding:0;
	width:150px;
	text-align:right;
	border-right:1px solid #DEEFFA;
}
.rb1 {
	height:22px
}
.red {
	color:red
}
.blue {
	color:blue
}
form, fieldset {
	margin:0;
	padding:0
}
.tb td {
	text-align:left;
}
</style>
</head>
<body>
<div class="r_main">
  <div class="r_content">
    <div class="r_content_1" align=center>
      <table class="tb" border="0" cellspacing="0" cellpadding="0">
        <tr class="thead">
          <th colspan="4">自定义分类</th>
        </tr>
        <tr>
          <td>ID</td>
          <td>要转换的分类名</td>
          <td>影射到系统分类</td>
          <td>操作</td>
        </tr>
        <form action="?action=customersavecls" method="post" name="form1">
          <?php
$numPerPage=20;
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
if($cofrom==1)
$row = $dsql->GetOne("select count(*) as dd from `duomi_co_cls` where cotype=1");
else
$row = $dsql->GetOne("select count(*) as dd from `duomi_co_cls` where cotype=0");
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
if($cofrom==1)
$sqlStr="select id,clsname,sysclsid from `duomi_co_cls`  where cotype=1 limit $limitstart,$numPerPage";
else
$sqlStr="select id,clsname,sysclsid from `duomi_co_cls`  where cotype=0 limit $limitstart,$numPerPage";
if($TotalResult==0){
?>
          <tr>
            <td colspan="4" align="center">没找到自定义分类</td>
          </tr>
          <?php
}else{
$dsql->SetQuery($sqlStr);
$dsql->Execute('customercls');
while($row=$dsql->GetObject('customercls'))
{
$id=$row->id;
?>
          <tr>
            <td><input type="checkbox" value="<?php echo $id;?>" name="e_id[]" class="checkbox"/>
              <?php echo $id;?></td>
            <td><input type="text" name="clsname<?php echo $id;?>" value="<?php echo $row->clsname;?>" /></td>
            <td><select name="tid<?php echo $id;?>">
                <option value="">请选择数据分类</option>
                <?php if($cofrom==1) makeTypeOptionSelected(0,"&nbsp;|&nbsp;","",$row->sysclsid,1);else makeTypeOptionSelected(0,"&nbsp;|&nbsp;","",$row->sysclsid); ?>
              </select></td>
            <td><a href="?action=customerdelcls&id=<?php echo $id;?>">删除</a></td>
          </tr>
          <?php 
}
}
?>
          <tr>
            <td colspan="4"><div class="cuspages">
                <div class="pages">
                  <label>全选
                  <input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'input','e_id[]')" />
                  </label>
                  <label>反选
                  <input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('input','e_id[]')" />
                  </label>
                  <input type="submit" value="批量删除" onclick="if(confirm('确定要删除吗')){this.form.action='?action=customerdelallcls';}else{return false}" class="rb1"/>
                  &nbsp;&nbsp;
                  <input type="submit" value="批量修改选中分类" name="Submit" class="rb1" onclick="this.form.action='?action=customersavecls';"/>
                  页次<?php echo $page;?>/<?php echo $TotalPage;?> 每页<?php echo $numPerPage;?>总收录数据条<?php echo $TotalResult;?> <a href="?action=customercls&page=1">首页</a> <a href="?action=customercls&page=<?php echo $page-1;?>">上一页</a> <a href="?action=customercls&page=<?php echo $page+1;?>">下一页</a> <a href="?action=customercls&page=<?php echo $TotalPage;?>">尾页</a>
                  <input type="text" class="txt" id="toPage" value="<?php echo $page;?>" style="width:30px"/>
                  <button onclick="location.href='?action=customercls&page='+$('toPage').value">跳转</button>
                </div>
              </div></td>
          </tr>
        </form>
        <tr class="thead">
          <th colspan="4"></th>
        </tr>
        <form action="?action=customernewcls" method="post" name="form2">
          <tr>
            <td>添加</td>
            <td><input type="text" name="clsname" value="" /></td>
            <td><select name="tid" id="tid">
                <option value="">请选择数据分类</option>
                <?php if($cofrom==1) makeTypeOption(0,"&nbsp;|&nbsp;",1); else makeTypeOption(0,"&nbsp;|&nbsp;"); ?>
              </select></td>
            <td><input type="submit" value="确定" name="Submit" class="rb1"/></td>
          </tr>
        </form>
      </table>
    </div>
  </div>
</div>
<div class="bottom">
  <table width="100%" cellspacing="5">
    <tr>
      <td align="center"><?php echo $cfg_powerby?></td>
    </tr>
  </table>
</div>
</body>
</html>
