<!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" />
<link href="img/style.css" rel="stylesheet" type="text/css" />
<title>添加采集项目</title>
<script src="js/common.js" type="text/javascript"></script>
<script src="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 bgcolor="#F7FBFF">
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后台首页&nbsp;&raquo;&nbsp;采集&nbsp;&raquo;&nbsp;自定义采集 ';</script>
<?php
$numPerPage=30;
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$whereStr=" where 1=1";
if (!empty($inbase)){
if ($inbase=='true')
$whereStr.=" and n_inbase ='1'";
elseif($inbase=='false')
$whereStr.=" and n_inbase ='0'";
}
if (!empty($type)){
if ($type=='false') $whereStr.=" and tid in (0)"; else $whereStr.=" and tid in (".getTypeId($type).")";
}

if (!empty($keyword)) $whereStr.=" and n_title like '%".$keyword."%' or n_author like '%".$keyword."%' ";

$csqlStr="select count(*) as dd from `sea_co_news` ".$whereStr;

$row = $dsql->GetOne($csqlStr);
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;
$sqlStr="select n_id,n_title,n_inbase,tid,tname,n_addtime from sea_co_news ".$whereStr." order by n_addtime desc limit $limitstart,$numPerPage";
$iMode="智能采集";
if(strpos($cfg_gatherset,'0')!==false)$iMode.='[分类识别]';
if(strpos($cfg_gatherset,'1')!==false)$iMode.='[不添加新影片]';
if(strpos($cfg_gatherset,'2')!==false)$iMode.='[只更新影片地址及状态]';
?>
<div class="r_main">
  <div class="r_content">
    <div class="r_content_1">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">
        <tr class="thead">
          <th colspan="5">&nbsp;<font color="#000000">管理临时库： </font><a href="?action=tempdatabase&inbase=true">显示已入库的</a> | <a href="?action=tempdatabase&inbase=false">显示未入库的</a> | <a href="?action=tempdatabase&type=false">显示未分类的</a> | <a href="?action=tempdatabase">显示所有</a></th>
          <th colspan="4">入库方式：<span class=red><?php echo $iMode;?></span> <a href="admin_config.php#rule">更改设置</a></th>
        </tr>
        <form action="?action=tempdatabase" method="post">
          <tr>
            <td align="left" colspan="9" height="40"> 关键字
              <input name="keyword" type="text" id="keyword" size="20">
              <select name="type" id="type">
                <option value="">请选择数据分类</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
              </select>
              <input type="submit" name="selectBtn"  value="查 询..." class="rb1" />
              &nbsp;
              <select onchange="self.location.href='?action=tempdatabase&type='+this.options[this.selectedIndex].value">
                <option value="">按数据分类查看</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
              </select></td>
          </tr>
        </form>
        <?php
if($TotalResult==0){
    if(!empty($keyword)){
    echo "<tr align='center'><td>关键字  <font color=red>\"".$keyword."\"</font>   没有记录</td></tr>";
    }
    }
else{
	if(!empty($keyword)){
?>
        <tr >
          <td colspan="9">关键字 <font color=red> <?php echo $keyword;?> </font> 的记录如下</td>
        </tr>
        <?php
        }
}
?>
        <tr>
          <td height="30" width="50" bgcolor="#FFFFFF" class="td_btop3">编号</td>
          <td bgcolor="#FFFFFF" class="td_btop3">影片名称</td>
          <td width="50" bgcolor="#FFFFFF" class="td_btop3">数据</td>
          <td width="80" bgcolor="#FFFFFF" class="td_btop3">绑定分类</td>
          <td width="80" bgcolor="#FFFFFF" class="td_btop3">采集分类名</td>
          <td width="60" bgcolor="#FFFFFF" class="td_btop3">采集时间</td>
          <td width="100" colspan="2" align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>
        </tr>
        <form method="post" name="tempdataform" action="?action=delallTempData">
          <?php
$dsql->SetQuery($sqlStr);
$dsql->Execute('temp_video_list');
while($row=$dsql->GetObject('temp_video_list'))
{
$n_id=$row->n_id;
?>
          <tr>
            <td height="30" class="td_border"><input type="checkbox" value="<?php echo $n_id;?>" name="e_id[]" class="checkbox" />
              <?php echo $n_id;?></td>
            <td class="td_border"><?php echo $row->n_title;?></td>
            <td class="td_border"><?php if($row->n_inbase) echo "已入库"; else echo "未入库";?></td>
            <td class="td_border"><?php if($row->tid!=0) echo getNewsTypeName($row->tid); else echo "<font color=red>没找到相关分类</font>";?></td>
            <td class="td_border">&nbsp;<?php echo $row->tname;?></td>
            <td class="td_border"><span title="<?php echo MyDate('Y-m-d H:i:s',$row->n_addtime);?>"><?php echo isCurrentDay($row->n_addtime);?></span></td>
            <td colspan="2" align="center" class="td_border"><a href="?action=editNews&id=<?php echo $n_id;?>">编辑</a> <a href="?action=delTempData&id=<?php echo $n_id;?>" onClick="return confirm('确定要删除吗')">删除</a></td>
          </tr>
          <?php }?>
          <tr>
            <td height="30" colspan="9" class="td_border">全选
              <input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'input','e_id[]')" />
              反选
              <input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('input','e_id[]')" />
              &nbsp;&nbsp;
              <input type="submit" value="批量删除" onclick="if(confirm('确定要批量删除吗')){return true}else{return false}" class="rb1" />
              
              <!--span class=red>没找到相关分类全导入到</span-->
              
              <select name="type" id="type">
                <option value="">请选择数据分类</option>
                <?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
              </select>
              &nbsp;
              <input type="submit" value="导入选中影片" onclick="this.form.action='?action=import';" class="rb1" style="width:85px"/>
              &nbsp;
              <input type="submit" value="导入全部影片" onclick="this.form.action='?action=import&smode=all';" class="rb1" style="width:85px"/>
              &nbsp;
              <input type="submit" value="导入未入库" onclick="this.form.action='?action=import&smode=noinbase';" class="rb1" style="width:85px"/></td>
          </tr>
          <tr>
            <td height="30" colspan="9" class="td_border"><div class="cuspages" style="float:right">
                <div class="pages">页次<?php echo $page;?>/<?php echo $TotalPage;?>每页<?php echo $numPerPage;?> &nbsp;&nbsp; 总收录数据条<?php echo $TotalResult;?> <a href="?action=tempdatabase&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&playfrom=<?php echo $playfrom;?>&page=1">首页</a> <a href="?action=tempdatabase&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&playfrom=<?php echo $playfrom;?>&page=<?php echo ($page-1);?>">上一页</a> <a href="?action=tempdatabase&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&playfrom=<?php echo $playfrom;?>&page=<?php echo ($page+1);?>">下一页</a> <a href="?action=tempdatabase&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&playfrom=<?php echo $playfrom;?>&page=<?php echo $TotalPage;?>">尾页</a> 转到
                  <input type="text" class="txt" id="toPage" value="1" style="width:30px"/>
                  <input type="button" value="跳转" onclick="location.href='?action=tempdatabase&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&playfrom=<?php echo $playfrom;?>&page='+$('toPage').value" class="rb1">
                </div>
              </div>
              入库方式：<span class=red><?php echo $iMode;?></span> &nbsp;&nbsp;<a href="?action=delallTempData&do=all" onclick="if(confirm('确定要删除所有吗')){return true;}else{return false;}"><u>清空临时库</u></a></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>
