
<!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
$tid=addslashes($_GET[tid]);
$nid=addslashes($_GET[vid]);
$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.v_pic=''";
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."%'";
$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_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";
//echo $sqlStr;die();
 $sql="select * from sea_topic where id=$tid";
	$dsql->SetQuery($sql);
	$dsql->Execute('al') ;
	while($row=$dsql->GetObject('al'))
	{
	$ts=$row->news;
    $intopic=explode("ttttt",$ts);
	}
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0"  class="tb_style">
    <tr>
    <td width="100%" colspan="8" class="td_title">&nbsp;专题已含新闻列表：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#CC6600">【点击后面 x 将新闻从专题中移出】</font></td>
    </tr>
</table>

<div style="background-color:#CCFFFF; margin:auto;width:99%;padding-top:5px; padding-bottom:5px;">

<?php
	echo "<a href=?action=topicdelall&tid=$tid><font color=red>【X全部清除X】</font></a><br>";
if($ts !=="")
{
	$t=str_replace('ttttt',',',$ts);
    $sql="select * from sea_news where n_id IN ($t)";
	$dsql->SetQuery($sql);
	$dsql->Execute('al') ;
	while($row=$dsql->GetObject('al'))
	{
	echo "<a href=?action=topicdel&nid=$row->n_id&tid=$tid>$row->n_title X</a>&nbsp;&nbsp;&nbsp;";
	}
}
else
{echo "该专题暂无数据";}
?>
</div>
<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="?tid=<?php echo $tid ?>" method="post" >
<tr class="thead"><th colspan="15">
 全站待选新闻列表：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#CC6600">【点击 插入数据 即增加新闻到专题】</font>
<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="btn"  />&nbsp;
<select  onchange="self.location.href='?type='+this.options[this.selectedIndex].value+'&tid=<?php echo $tid ?>'">
<option value="">按文章分类查看</option>
<?php makeTypeOption(0,"&nbsp;|&nbsp;",1)?>
</select></th></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="10">关键字  <font color=red> <?php echo $keyword;?> </font>   的记录如下</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 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="newslistform" action="?action=topicaddall&tid=<?php echo $tid ?>">
<?php

$dsql->SetQuery($sqlStr);
$dsql->Execute('video_list');
while($row=$dsql->GetObject('video_list'))
{
$n_id=$row->n_id;
$contentUrl=getArticleLink($row->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:center">
			<?php
			if(in_array($n_id,$intopic))
			{ 
			echo "X";
			}
			else
			{
			echo "<input type=checkbox value=$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 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">
			<?php
			if(in_array($n_id,$intopic))
			{
			echo "已存在";
			}
			else
			{
			echo "<a href=?action=topicadd&nid=$n_id&tid=$tid>插入数据</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" style="width:120px" value="批量插入数据" class="rb1" />
			</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>
