
<!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 name="robots" content="noindex,nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<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"> 
select {font-size:12px;}
</style>
</head>
<body>
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后台首页&nbsp;&raquo;&nbsp;数据&nbsp;&raquo;&nbsp;新闻管理 ';</script>
<?php
$numPerPage=20;
if(empty($order)) $order="n_addtime";
$orderStr= " order by d.$order desc";
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$whereStr="  ";
if ($action=="nullpic") $whereStr.=" and d.n_pic=''";
if ($action=="errpic") $whereStr.=" and d.n_pic like '%err'";
if ($n_recycled=="ok") $whereStr.=" and d.n_recycled=1";
if ($n_commend=="ok") $whereStr.=" and d.n_commend>0";
if (!empty($type)) $whereStr.=" and d.tid in (".getTypeId($type).")";
if (!empty($keyword)) $whereStr.=" and d.n_title like '%".$keyword."%' or d.n_keyword like '%".$keyword."%' or d.n_author like '%".$keyword."%' or d.n_id = '$keyword'";
$whereorder = str_replace("where order","order",str_replace("where and","and",$whereStr.$orderStr));
$csqlStr="select count(*) as dd from `sea_news` d where d.n_recycled=0 ".$whereorder;
if ($n_recycled=="ok")$csqlStr="select count(*) as dd from `sea_news` d where d.n_recycled=1 ".$whereorder;
$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 d.n_id,d.n_title,d.n_pic,d.n_hit,0,d.tid,d.n_addtime,d.n_commend,t.tname from sea_news d left join `sea_type` t on t.tid=d.tid where d.n_recycled=0 ".$whereorder." limit $limitstart,$numPerPage";
if ($n_recycled=="ok") $sqlStr="select d.n_id,d.n_title,d.n_hit,0,d.tid,d.n_addtime,d.n_commend,t.tname from sea_news d left join `sea_type` t on t.tid=d.tid  where 1=1 ".$whereorder." limit $limitstart,$numPerPage";

?>
<div class="r_main">
<div class="r_content">
	<div class="r_content_1"><span class="td_border" style="text-align:center"><?php echo $n_id;?></span>
<table class="tb_style" border="0" cellspacing="0" cellpadding="0">
<tr>
<form action="?" method="post" >
<tr class="thead"><th colspan="15">新闻管理&nbsp;&nbsp;<input  name="keyword" type="text" id="keyword" size="25" placeholder="新闻id/名称/作者/关键词..">
<select name="type" id="type"  ><option value="">请选择文章分类</option>
<?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
</select>
<input type="submit" name="selectBtn" value="查询或重置" class="btn"  />&nbsp;
<select  onchange="self.location.href='?type='+this.options[this.selectedIndex].value+'&n_commend='">
<option value="">按文章分类查看</option>
<?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
</select></th></tr>
</form>

<?php
if($TotalResult==0){
    if(!empty($keyword)){
    echo "<tr><td colspan='10'><div style='height: 22px;line-height: 22px;background-color: #daebf7;padding-left: 5px;color: #0d78be;'>关键字  <font color=red>".$keyword."</font>   没有记录</div></td></tr>";
    }
}else{
	if(!empty($keyword)){
?>
  <tr ><td colspan="10"><div style="height: 22px;line-height: 22px;background-color: #daebf7;padding-left: 5px;color: #0d78be;">关键字 <font color=red> <?php echo $keyword;?> </font> 的记录如下：</div></td></tr>
<?php
	}
}
?>
  <tr bgcolor="#f5fafe">
	<td height="30" align="center" bgcolor="#FFFFFF" class="td_btop3">&nbsp;ID<a href="?order=n_id&type=<?php echo $type;?>&page=<?php echo $page;?>&n_commend=<?php echo $n_commend;?>"><img src="img/minus.gif" title="按ID排序" /></a></td>
	<td bgcolor="#FFFFFF" class="td_btop3">标题</td>
	<td width="10%" bgcolor="#FFFFFF" class="td_btop3">图片位置</td>
	<td bgcolor="#FFFFFF" class="td_btop3">人气<a href="?order=n_hit&type=<?php echo $type;?>&page=<?php echo $page;?>&n_commend=<?php echo $n_commend;?>"><img src="img/minus.gif" title="按人气排序" /></a></td>
	<td bgcolor="#FFFFFF" class="td_btop3">数据类别</td>
	<td bgcolor="#FFFFFF" class="td_btop3">推荐星级<a href="?order=n_commend&type=<?php echo $type;?>&page=<?php echo $page;?>&n_commend=<?php echo $n_commend;?>"><img src="img/minus.gif" title="按推荐星级排序" /></a></td>
	<td bgcolor="#FFFFFF" class="td_btop3">时间<a href="?order=n_addtime&type=<?php echo $type;?>&page=<?php echo $page;?>&n_commend=<?php echo $n_commend;?>"><img src="img/minus.gif" title="按时间排序" /></a></td>
    <?php if($cfg_runmode2=='0'){?><td bgcolor="#FFFFFF" class="td_btop3">生成</td><?php }?>
	<td align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>
  </tr><form method="post" name="videolistform">
<?php

$dsql->SetQuery($sqlStr);
$dsql->Execute('video_list');
while($row=$dsql->GetObject('video_list'))
{
$n_id=$row->n_id;
$tid=$row->tid;
$contentUrl=getArticleLink($tid,$n_id,'');
?>
  <tr bgcolor="#FFF" style="background-color:#FFF" onmouseover="style.backgroundColor='#E6F2FB'" onmouseout="style.backgroundColor='#FFF'">
	<td height="30" class="td_border" style="text-align:left"><input type="checkbox" value="<?php echo $n_id;?>" name="e_id[]" class="checkbox" /><?php echo $n_id; ?></td>
	<td class="td_border"><a href="<?php echo $contentUrl;?>" target="_blank"><?php echo $row->n_title;?></a></td>
	<td class="td_border"><?php if(strpos($row->n_pic,'uploads/')===0)echo "本地";elseif(strpos($row->n_pic,$app_ftpurl)!==false)echo "FTP服务器";elseif(strpos($row->n_pic,'#err')!==false)echo "下载图片时发生错误";elseif(empty($row->n_pic))echo "空";else echo "远程地址"; ?></td>
	<td class="td_border"><?php echo $row->n_hit;?></td>
	<td class="td_border"><a href="?type=<?php echo $row->tid;?>&order=<?php echo $order;?>"><?php if($row->tname){echo $row->tname;}else{echo "<font color=red >数据分类错误</font>";}?></a></td>
	<td id="star<?php echo $n_id;?>" class="td_border"><script>starView(<?php echo $row->n_commend;?>,<?php echo $n_id;?>,1)</script></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>
    <?php if($cfg_runmode2=='0'){?><td class="td_border"><?php isNewsMake($n_id,$contentUrl);?></td><?php }?>
	<td class="td_border" align="center"><a href="?action=edit&id=<?php echo $n_id;?>">编辑</a> <a href="?action=del&id=<?php echo $n_id;?>" onClick="return confirm('确定要删除吗')">删除</a> <a href="?action=<?php echo $n_recycled=='ok'?'restore':'hide' ?>&id=<?php echo $n_id;?>"><?php echo $n_recycled=='ok'?'还原':'隐藏' ?></a></td>
  </tr>
<?php }?>

<tr><td height="30" colspan="11" class="td_border">&nbsp;全选<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[]')" /><input type="submit" value="<?php if($n_recycled=='ok'){?>数据还原<?php }else{ ?>批量删除<?php } ?>" onclick="<?php if($n_recycled=='ok'){?>if(confirm('确定要还原吗')){videolistform.action='?action=restoreall';}else{return false}<?php }else{ ?>if(confirm('确定要删除吗')){videolistform.action='?action=delall';}else{return false}<?php } ?>" class="rb1"  /> 
<input type="submit" value="<?php if($n_recycled=='ok'){?>永久删除<?php }else{ ?>批量生成<?php } ?>" class="rb1" onclick="<?php if($n_recycled=='ok'){?>if(confirm('确定要永久删除吗')){videolistform.action='?action=delall';}else{return false}<?php }else{ ?>videolistform.action='admin_makehtml.php?action=selectednews'<?php } ?>" />
<select name="movetype" id="movetype"  ><option value="">请选择目标分类</option>
<?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
</select>
<input type="submit" value="批量移动" class="rb1" onclick="if($('movetype').value==''){alert('请选择目标分类');return false;};if(confirm('确定要批量移动数据吗')){videolistform.action='?action=psettype'}else{return false;}"/>
<?php if($n_recycled!='ok'){?><input type="submit" style="width:90px" value="删除分类数据" class="rb1" onclick="if($('movetype').value==''){alert('请选择目标分类');return false;};if(confirm('谨慎操作，数据不可恢复\n确定要删除此分类的所有数据吗')){videolistform.action='?action=deltypedata'}else{return false;}"/><?php }?>
 <input type="submit" style="width:90px" value="同步新闻图片" class="rb1" onclick="if(confirm('同步图片需要消耗大量服务器资源，请在空闲时间执行。确认同步吗？')){videolistform.action='admin_datarelate.php?action=downnewspic&downtype=all';}else{return false;}"/>
</td>
</tr>
</form>
<tr><td height="30" colspan="11" class="td_border">
<?php if($n_recycled=="ok"){ ?>
<div class="cuspages"><div class="pages">
&nbsp;页次：<?php echo $page;?>/<?php echo $TotalPage;?>  每页<?php echo $numPerPage;?> 总收录数据<?php echo $TotalResult;?>条 <a href="?page=1&n_recycled=ok&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">首页</a> <a href="?page=<?php echo ($page-1);?>&n_recycled=ok&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">上一页</a> 
<?php echo makePageNumber($page, 10, $TotalPage, "videolist");?>
<a href="?page=<?php echo ($page+1);?>&n_recycled=ok&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">下一页</a> <a href="?page=<?php echo $TotalPage;?>&n_recycled=ok&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">尾页</a>&nbsp;&nbsp;跳转<input type="text" id="skip" value="" onkeyup="this.value=this.value.replace(/[^\d]+/,'')" style="width:40px"/>&nbsp;&nbsp;<input type="button" value="确 定" class="btn" onclick="location.href='?page='+ document.getElementById('skip').value +'&n_recycled=ok&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>';"/></div></div>
<?php
}else{ ?>
<div class="cuspages"><div class="pages">
&nbsp;页次：<?php echo $page;?>/<?php echo $TotalPage;?>  每页<?php echo $numPerPage;?> 总收录数据<?php echo $TotalResult;?>条 <a href="?page=1&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">首页</a> <a href="?page=<?php echo ($page-1);?>&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">上一页</a> 
<?php echo makePageNumber($page, 10, $TotalPage, "videolist");?>
<a href="?page=<?php echo ($page+1);?>&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">下一页</a> <a href="?page=<?php echo $TotalPage;?>&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>">尾页</a>&nbsp;&nbsp;跳转<input type="text" id="skip" value="" onkeyup="this.value=this.value.replace(/[^\d]+/,'')" style="width:40px"/>&nbsp;&nbsp;<input type="button" value="确 定" class="btn" onclick="location.href='?page='+ document.getElementById('skip').value +'&order=<?php echo $order;?>&type=<?php echo $type;?>&keyword=<?php echo $keyword;?>&n_commend=<?php echo $n_commend;?>&tid=<?php echo $tid;?>';"/></div></div>
<?php } ?>
</td>
</tr>

</table>
          </div>             
      </div>
      </div>

<script type='text/javascript'>alertUpdatePicNews();</script>
<?php
viewFoot();
?>

</body>
</html>
