<?php
# Name: PHP版程氏专题CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_label.php");
include_once("../loginstate.php");
SystemPer('0_1');
$ac=CS_Request("ac");
$op=CS_Request("op");
if(empty($ac)) $ac='main';
?>
<!doctype html>
<html>
<head>
<meta charset="gbk">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>chshdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<link href="../../public/css/webox.css" rel="stylesheet" />
<script type="text/javascript" src="../res/js/ajax.js"></script>
<script language="javascript" src="../res/js/jquery.js"></script>
<script src="../../public/js/webox.js"></script>
<script language="javascript">

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
 
function chgclass(id,cid){
	$.get("../ajax/ajax.php?ac=chgclasslist&id="+id+"&cid="+cid+"&sid=1",function(R){
		$("#class_"+id).html(R);												
	})
}
	
function savechgclass(cid,id){
	$.get("../ajax/ajax.php?ac=savecls&id="+id+"&cid="+cid+"&sid=3",function(R){
		$("#class_"+id).html(R);													  
	});
}
  
function ShowStar(level,ids){
		   var htmlStr=""
			if(level==0){level=0}
			if (level>0){htmlStr+="<img src='../res/images/starno.gif' border='0' style='cursor:pointer;margin-left:2px;' title='取消推荐' onclick='EditReco("+ids+",0)'/>"}
			for(i=1;i<=level;i++){
			htmlStr+= "<img src='../res/images/star0.gif' border='0' style='cursor:pointer;margin-left:2px;'  title='推荐为"+i+"星级' id='star"+ids+"_"+i+"' onclick='EditReco("+ids+","+i+")' />"}
			for(j=level+1;j<=5;j++){
			htmlStr+= "<img src='../res/images/star1.gif' border='0' style='cursor:pointer;margin-left:2px;'  title='推荐为"+j+"星级' id='star"+ids+"_"+j+"' onclick='EditReco("+ids+","+j+")' />"
	}
		   $("#CS_Reco"+ids).html(htmlStr);
		   }
		   
function EditReco(ids,level){
  $.get("../ajax/ajax.php?id="+ids+"&sid=3&tid="+level+"&ac=editreco", 
	  function(obj){
		  if(obj=='ok'){
			  ShowStar(level,ids);
		  }else{
			  $("#CS_Reco"+ids).html("<font color='red'>Error!</font>");		
		  }
	  }
  );
} 

function Htmlgo(id,url){
	$.get(''+url+'&id='+id,function (R){
		if(R!='no'){
			$('#html_'+id).remove();
		}				   
	});
}

function del(_id){ 
  if (confirm("确定删除吗？")){
    window.location='?op=del&id='+_id;
    return true;
  }else{
     return false;
  }		
}
</script>
</head>
<body>
<div class="wrap">
<?php
   //修改\增加
   if($ac=='edit'){
        global $db;
   	$CS_ID=CS_Request("id");
        if($CS_ID){
	   $row=$db->getrow("SELECT * FROM ".Getdbname('topic')." Where CS_ID='".$CS_ID."'");
	   if($row){
		$Arr=array($row['CS_Name'],$row['CS_Color'],$row['CS_AliasName'],$row['CS_Pic'],$row['CS_Tags'],$row['CS_CID'],$row['CS_Year'],$row['CS_Reco'],$row['CS_Yuyan'],$row['CS_Diqu'],$row['CS_Fxgs'],$row['CS_Hits'],$row['CS_Yhits'],$row['CS_Zhits'],$row['CS_Rhits'],$row['CS_Template'],$row['CS_Title'],$row['CS_Keywords'],$row['CS_Description'],$row['CS_Content'],$row['CS_User']);
                $title="编辑专题";
	   }
        }else{
		$Arr=array('','','','','','',date('Y'),'0','','','','0','0','0','0','topic-dance-show.html','','','','','');
                $title="填加专题";
        }
?>
<script type="text/javascript">
$(document).ready(function(){
	$("#adddance").click(function(){
		var CS_Name=document.getElementById('CS_Namea').value;
		var CS_CID=document.getElementById('CS_CIDa').value;
		var CS_User=document.getElementById('CS_User').value;
		var CS_PlayUrl=document.getElementById('CS_PlayUrl').value;
	if(CS_Name==""){
		$("#Msg").text("请填写专题名称！").css("color","red");
		return false;
		}
	else if(CS_CID=="0"){
		$("#Msg").text("请填写专题英文别名！").css("color","red");
		return false;
		}
	else if(CS_User==""){
		$("#Msg").text("请填写专题所属会员！").css("color","red");
		return false;
		}
	else if(CS_PlayUrl==""){
		$("#Msg").text("请填写专题标签！").css("color","red");
		return false;
		}
	});
});
</script>
<div class="nav">
	<ul class="cc">
		<li><a href="topic.php">专题列表</a></li>
		<li class="current"><a href="topic.php?ac=edit"><?php echo $title?></a></li>
		<li><a href="topic.php?op=sh">专题审核</a></li>
		<li><a href="topic.php?op=tid">推荐的专题</a></li>
	</ul>
</div>
<form class="J_ajaxForm" data-role="edit" name="form" action="topic.php?ac=edit&op=editdata" method="post">
<div class="h_a"><?php echo $title?></div>
<div class="table_full">
	<table width="100%" class="J_check_wrap">
		<col class="th" />
		<col width="400" />
		<col />
		<tr><input name="id" type="hidden" value="<?php echo $CS_ID?>" />
			<th>专题名称</th>
			<td id="CS_Name">
				<input id="CS_Namea" name="CS_Name" value="<?php echo $Arr[0]?>" type="text" class="input input_hd length_5">&nbsp;
				<input type="checkbox" name="CS_AddTime" class="checkbox" value="1" checked="checked"/>
				更新时间
			</td>
			<td><div class="fun_tips">填写专题名称</div></td>
		</tr>
		<tr>
			<th>名称颜色</th>
			<td>
			<select class="select_2" name="CS_Color" >
  			<?php if(empty($Arr[1])){?>
  			<option  value="">选择颜色</option>
 			 <?php }else{?>
  			<option style="background-color:<?php echo $Arr[1]?>;color: <?php echo $Arr[1]?>" value="<?php echo $Arr[1]?>"></option>
  			<?php }?>
 			 <option style="background-color:#00FF00;color: #00FF00" value="#00FF00">绿色</option>
  			<option style="background-color:#0000CC;color: #0000CC" value="#0000CC">深蓝</option>
  			<option style="background-color:#FFFF00;color: #FFFF00" value="#FFFF00">黄色</option>
  			<option style="background-color:#FF33CC;color: #FF33CC" value="#FF33CC">粉红</option>
  			<option style="background-color:#FF0000;color: #FF0000" value="#FF0000">红色</option>
  			<option style="background-color:#660099;color: #660099" value="#660099">紫色</option>
 			 <option style="background-color:#FFFFFF;color: #FFFFFF" value="">无色</option>									
			</select>
			</td>
			<td><div class="fun_tips">选择名称颜色</div></td>
		</tr>
		<tr>
			<th>英文名称</th>
			<td id="CS_Name">
				<input id="CS_AliasName" name="CS_AliasName" value="<?php echo $Arr[2]?>" type="text" class="input input_hd length_5">&nbsp;
			</td>
			<td><div class="fun_tips">填写专题英文名称</div></td>
		</tr>
		<tr>
			<th>专题图片</th>
			<td>
				<input name="CS_Pic" id="CS_Pic" value="<?php echo $Arr[3]?>" type="text" class="input input_hd length_4">
                                &nbsp;<input class="btn" type="button" onclick="Popsboxif('上传图片',470,100,'../upload.php?ac=dance');" value="上传图片" />
			</td>
			<td><div class="fun_tips">填写专题图片,比如视频舞曲的图片</div></td>
		</tr>
		<tr>
			<th>专题标签</th>
			<td>
				<input name="CS_Tags" id="CS_Tags" value="<?php echo $Arr[4]?>" type="text" class="input input_hd length_4">
                                &nbsp;<input class="btn" type="button" onclick="Popsboxif('选择标签',530,380,'../../public/tags.php?f=form.CS_Tags');" value="选择标签" />
			</td>
			<td><div class="fun_tips">填写专题图片,比如视频舞曲的图片</div></td>
		</tr>
		<tr>
			<th>专题分类</th>
			<td>
				<select class="select_2" name="CS_CID" id="CS_CIDa">
                                                <option value="0">选择分类</option>
            					 <?php
              						$sqlclass="select * from ".Getdbname('class')." where CS_YID=0 and CS_SID=2 and CS_FID=0";
									$results=$db->query($sqlclass);
									if($results){
										while ($row3=$db->fetch_array($results)){
                                                                                    if($row3['CS_ID']==$Arr[3]){
										         echo "<option value='".$row3['CS_ID']."' selected='selected'>".$row3['CS_Name']."</option>";
                                                                                    }else{
										         echo "<option value='".$row3['CS_ID']."' >".$row3['CS_Name']."</option>";
                                                                                    }
		                                                                     //处理此分类下的子分类
		                                                                     $sql2="select * from ".Getdbname('class')." where CS_FID=".$row3['CS_ID']."";
		                                                                     $class2=$db->query($sql2);
		                                                                     if($class2){
			                                                                     while($row2=$db->fetch_array($class2)){
                                                                                               if($row2['CS_ID']==$Arr[5]){
										                    echo "<option value='".$row2['CS_ID']."' selected='selected'>├ ".$row2['CS_Name']."</option>";
                                                                                               }else{
										                    echo "<option value='".$row2['CS_ID']."' >├ ".$row2['CS_Name']."</option>";
                                                                                               }
			                                                                     }
		                                                                     }
										}
									}
			  
			  			 ?>            
                                         </select>&nbsp;&nbsp;所属会员：<input id="CS_User" name="CS_User" value="<?php echo $Arr[20]?>" type="text" class="input input_hd length_2">
			</td>
			<td><div class="fun_tips">选择专题分类</div></td>
		</tr>
		<tr>
			<th>发行年份</th>
			<td>
				<input name="CS_Year" value="<?php echo $Arr[6]?>" type="text" class="input input_hd length_2">
                                &nbsp;&nbsp;推荐星际：
				         <select class="select_2" name="CS_Reco">
                                                <option value="0">不推荐</option>
                                                <option value="1" <?php if($Arr[7]==1) echo "selected='selected'";?>>一星际</option>
                                                <option value="2" <?php if($Arr[7]==2) echo "selected='selected'";?>>二星际</option>
                                                <option value="3" <?php if($Arr[7]==3) echo "selected='selected'";?>>三星际</option>
                                                <option value="4" <?php if($Arr[7]==4) echo "selected='selected'";?>>四星际</option>
                                                <option value="5" <?php if($Arr[7]==5) echo "selected='selected'";?>>五星际</option>           
                                         </select>
			</td>
			<td><div class="fun_tips">选择发行年份、推荐星际</div></td>
		</tr>
		<tr>
			<th>专题语言</th>
			<td>
				<select class="select_2" name="CS_Yuyan"><option value="国语" <?php if($Arr[8]=="国语"){echo 'selected';}?>>国语</option><option value="粤语" <?php if($Arr[8]=="粤语"){echo 'selected';}?>>粤语</option><option value="英语" <?php if($Arr[8]=="英语"){echo 'selected';}?>>英语</option><option value="日语" <?php if($Arr[8]=="日语"){echo 'selected';}?>>日语</option><option value="韩语" <?php if($Arr[8]=="韩语"){echo 'selected';}?>>韩语</option><option value="其他" <?php if($Arr[8]=="其他"){echo 'selected';}?>>其他</option></select>
                                &nbsp;专题地区：<select class="select_2" name="CS_Diqu"><option value="大陆" <?php if($Arr[9]=="大陆"){echo 'selected';}?>>大陆</option><option value="港台" <?php if($Arr[9]=="港台"){echo 'selected';}?>>港台</option><option value="欧美" <?php if($Arr[9]=="欧美"){echo 'selected';}?>>欧美</option><option value="日韩" <?php if($Arr[9]=="日韩"){echo 'selected';}?>>日韩</option><option value="其他" <?php if($Arr[9]=="其他"){echo 'selected';}?>>其他</option></select>
			</td>
			<td><div class="fun_tips">填写专题语言、地区</div></td>
		</tr>
		<tr>
			<th>发行公司</th>
			<td>
				<input name="CS_Fxgs" value="<?php echo $Arr[10]?>" type="text" class="input input_hd length_5">
			</td>
			<td><div class="fun_tips">填写专题发行公司</div></td>
		</tr>
		<tr>
			<th>人气</th>
			<td>
				总：<input name="CS_Hits" value="<?php echo $Arr[11]?>" type="text" class="input input_hd length_1">
                                &nbsp;月：<input name="CS_Yhits" value="<?php echo $Arr[12]?>" type="text" class="input input_hd length_1">
                                &nbsp;周：<input name="CS_Zhits" value="<?php echo $Arr[13]?>" type="text" class="input input_hd length_1">
                                &nbsp;日：<input name="CS_Rhits" value="<?php echo $Arr[14]?>" type="text" class="input input_hd length_1">
			</td>
			<td><div class="fun_tips">填写专题人气</div></td>
		</tr>
		<tr>
			<th>专题模版</th>
			<td>
				<input name="CS_Template" id="CS_Template" value="<?php echo $Arr[15]?>" type="text" class="input input_hd length_4">
                                &nbsp;&nbsp;<input class="btn" type="button" value="浏览" style="width:60px" onclick="Popsboxif('选择模版',450,400,'../skins/skin_re.php');"/>
			</td>
			<td><div class="fun_tips">专题内容页模版</div></td>
		</tr>
		<tr>
			<th>SEO标题</th>
			<td>
				<input type="text" name="CS_Title" class="input length_5" value="<?php echo $Arr[16]?>">
                        </td>
			<td><div class="fun_tips">SEO标题-title</div></td>
		</tr>
		<tr>
			<th>SEO关键词</th>
			<td>
				<input type="text" name="CS_Keywords" class="input length_5" value="<?php echo $Arr[17]?>">
                        </td>
			<td><div class="fun_tips">SEO关键词-Keywords</div></td>
		</tr>
		<tr>
			<th>SEO介绍</th>
			<td>
				<input type="text" name="CS_Description" class="input length_5" value="<?php echo $Arr[18]?>">
                        </td>
			<td><div class="fun_tips">SEO介绍-Description</div></td>
		</tr>
		<tr>
			<th>专题简介</th>
			<td>
				<textarea class="length_6" name="CS_Content"><?php echo $Arr[19]?></textarea>

			</td>
			<td><div class="fun_tips">专题简介</div></td>
		</tr>
</div>
<div class="btn_wrap">
	<div class="btn_wrap_pd">
		<button type="submit" id="adddance" class="btn btn_submit mr10 J_ajax_submit_btn">提交</button>
                <div class="tips_error" id="Msg"></div>
	</div>
</div>
<?php
         //增加、修改
         if($op=='editdata'){
		global $db;
		$CS_ID=CS_Request("id");
		$CS_Name=CS_Request("CS_Name");
		$CS_Color=CS_Request("CS_Color");
		$CS_Pic=CS_Request("CS_Pic");
		$CS_CID=CS_Request("CS_CID");
		$CS_AliasName=CS_Request("CS_AliasName");
		$CS_User=CS_Request("CS_User");
		$CS_Year=CS_Request("CS_Year");
		$CS_Yuyan=CS_Request("CS_Yuyan");
		$CS_Diqu=CS_Request("CS_Diqu");
		$CS_Reco=CS_Request("CS_Reco");
		$CS_Hits=CS_Request("CS_Hits");
		$CS_Yhits=CS_Request("CS_Yhits");
		$CS_Zhits=CS_Request("CS_Zhits");
		$CS_Rhits=CS_Request("CS_Rhits");
		$CS_Template=CS_Request("CS_Template");
		$CS_Content=CS_Request("CS_Content");
		$CS_AddTime=CS_Request("CS_AddTime");
		$CS_Tags=$_POST["CS_Tags"];
    		$CS_Title=CS_Request("CS_Title");
    		$CS_Keywords=CS_Request("CS_Keywords");
    	        $CS_Description=CS_Request("CS_Description");
    	        $CS_Fxgs=CS_Request("CS_Fxgs");
                if(empty($CS_Name)||empty($CS_CID)||empty($CS_User)||empty($CS_Tags)||empty($CS_AliasName)){
                          echo '<script>$("#Msg").text("抱歉，资料不完整!").css("color","red");</script>';
                          exit("<script>setTimeout(\"history.back(1);\",20000);</script>");
                }
		//判断增加还是修改
                if($CS_ID){
                       if($CS_AddTime==1){
		            $sql="update ".Getdbname('topic')." set CS_Fxgs='".$CS_Fxgs."',CS_Tags='".$CS_Tags."',CS_AddTime='".date('Y-m-d H:i:s')."',CS_Name='".$CS_Name."',CS_Color='".$CS_Color."',CS_Pic='".$CS_Pic."',CS_CID=".$CS_CID.",CS_AliasName='".$CS_AliasName."',CS_Diqu='".$CS_Diqu."',CS_Yuyan='".$CS_Yuyan."',CS_User='".$CS_User."',CS_Year='".$CS_Year."',CS_Reco=".$CS_Reco.",CS_Hits=".$CS_Hits.",CS_Yhits=".$CS_Yhits.",CS_Zhits=".$CS_Zhits.",CS_Rhits=".$CS_Rhits.",CS_Template='".$CS_Template."',CS_Content='".$CS_Content."',CS_Title='".$CS_Title."',CS_Keywords='".$CS_Keywords."',CS_Description='".$CS_Description."' where CS_ID=".$CS_ID;
                       }else{
		            $sql="update ".Getdbname('topic')." set CS_Tags='".$CS_Tags."',CS_Name='".$CS_Name."',CS_Color='".$CS_Color."',CS_Pic='".$CS_Pic."',CS_CID=".$CS_CID.",CS_AliasName='".$CS_AliasName."',CS_Diqu='".$CS_Diqu."',CS_Yuyan='".$CS_Yuyan."',CS_User='".$CS_User."',CS_Year='".$CS_Year."',CS_Reco=".$CS_Reco.",CS_Hits=".$CS_Hits.",CS_Yhits=".$CS_Yhits.",CS_Zhits=".$CS_Zhits.",CS_Rhits=".$CS_Rhits.",CS_Template='".$CS_Template."',CS_Content='".$CS_Content."',CS_Title='".$CS_Title."',CS_Keywords='".$CS_Keywords."',CS_Description='".$CS_Description."' where CS_ID=".$CS_ID;
                       }
                }else{
		            $sql="Insert ".Getdbname('topic')."  (CS_SID,CS_Tags,CS_Name,CS_Color,CS_Pic,CS_CID,CS_AliasName,CS_Diqu,CS_Yuyan,CS_Fxgs,CS_User,CS_Year,CS_Reco,CS_Hits,CS_Yhits,CS_Zhits,CS_Rhits,CS_Template,CS_Content,CS_AddTime,CS_Title,CS_Keywords,CS_Description) values (2,'".$CS_Tags."','".$CS_Name."','".$CS_Color."','".$CS_Pic."',".$CS_CID.",'".$CS_AliasName."','".$CS_Diqu."','".$CS_Yuyan."','".$CS_Fxgs."','".$CS_User."','".$CS_Year."',".$CS_Reco.",".$CS_Hits.",".$CS_Yhits.",".$CS_Zhits.",".$CS_Rhits.",'".$CS_Template."','".$CS_Content."','".date('Y-m-d H:i:s')."','".$CS_Title."','".$CS_Keywords."','".$CS_Description."')";
                }

		if($db->query($sql)){
                    echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,数据操作成功!").css("color","#026E12");</script>';
	            echo "<script>setTimeout(\"window.location='topic.php'\",2000);</script>";
		}else{
                    echo '<script>$("#Msg").text("抱歉，操作失败!").css("color","red");</script>';
	            echo "<script>setTimeout(\"history.back(1);\",2000);</script>";
                }
         }
   }

   //专题主列表
   if($ac=='main'){
                $op=CS_Request("op");
                $key=CS_Request("key");
                $cid=CS_Request("cid");
		global $db;
                $sql="select * from ".Getdbname('topic')." where ";
                if($cid){
                      $sql.="cs_cid=".$cid." and ";
                }
                if($op=="sh"){
                      $sql.="cs_yid=1 ";
                }elseif($op=="tid"){
                      $sql.="cs_reco>1 ";
                }else{
                      $sql.="cs_yid=0 and cs_sid=2 ";
                }
                if($key){
                      $sql.="and (CS_Name like '%".$key."%' or CS_Tags like '%".$key."%') ";
                }
                $sql.=" order by CS_AddTime desc";
		$dancenum=$db->num_rows($db->query($sql));
		$Arr=getpagerow($sql,20);//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$adminnum=$db->num_rows($result);

?>
<div class="nav">
	<ul class="cc">
		<li<?php if($ac=="main") echo ' class="current"';?>><a href="topic.php">专题列表</a></li>
		<li<?php if($ac=="edit") echo ' class="current"';?>><a href="topic.php?ac=edit">添加专题</a></li>
		<li<?php if($op=="sh") echo ' class="current"';?>><a href="topic.php?op=sh">专题审核</a></li>
		<li<?php if($op=="tid") echo ' class="current"';?>><a href="topic.php?op=tid">推荐的专题</a></li>
	</ul>
</div>
	<div class="h_a">搜索</div>	<form method="get" action="topic.php">
	<div class="search_type cc mb10">
		<div class="ul_wrap">
			<ul class="cc">
				<li>
					<label>关键字：</label><input name="key" value="" type="text" class="input length_3" placeholder="支持专题名称和作者搜索">&nbsp;&nbsp;<button class="btn mr20" type="submit">搜索</button>
				</li>
				<li>
					<label>按分类：</label><select class="select_3" onchange="MM_jumpMenu('self',this,0)">
                                                <option value="topic.php">选择分类</option>
            					 <?php
              						$sqlclass="select * from ".Getdbname('class')." where CS_SID=2 ";
									$results=$db->query($sqlclass);
									if($results){
										while ($row3=$db->fetch_array($results)){
										    echo "<option value='?cid=".$row3['CS_ID']."' >".$row3['CS_Name']."</option>";
										}
									}
			  
			  			 ?>             
                                         </select>
				</li>
			</ul>
		</div>
	</div>
</form>
<form class="J_ajaxForm" action="topic.php?op=delall" method="post" name="formb">
<div class="table_list">
<?php
	if($adminnum==0){
                echo "<table width=\"100%\">
				<tbody>
					<tr><td class=\"tac\">啊哦，没有符合条件的内容！</td></tr>
				</tbody>
		</table>";

        }else{
                echo "<table width=\"100%\" id=\"dellist\">
		<thead>
			<tr>
				<td><label>选</label></td>
				<td>名称</td>
				<td><span>歌曲</span></td>
				<td><span>会员</span></td>
				<td><span>日人气</span></td>
				<td><span>总人气</span></td>
				<td><span>专题分类</span></td>
				<td><span>推荐星际</span></td>
				<td><span>审核</span></td>
				<td><span>发布时间</span></td>
				<td>编辑/删除</td>
			</tr>
		</thead>";
        }
        if($result){
	     while ($row = $db ->fetch_array($result)){
                $class=$db->getrow("select CS_Name from ".Getdbname('class')." where CS_ID=".$row['CS_CID']."");
			if(date("Y-m-d",strtotime($row['CS_AddTime']))==date('Y-m-d')){
				$addtime="<font color=red>".date("Y-m-d",strtotime($row['CS_AddTime']))."</font>";
			}else{
				$addtime=date("Y-m-d",strtotime($row['CS_AddTime']));
			}
			if($row['CS_YID']==1){
                                $shenhe='<a href="topic.php?op=shenhe&id='.$row["CS_ID"].'&yid=0" title="点击审核专题"><img src="../res/images/no.gif"/></a>';
                        }else{
                                $shenhe='<a title="点击取消审核该专题" href="topic.php?op=shenhe&id='.$row["CS_ID"].'&yid=1"><img src="../res/images/yes.gif"/></a>';
                        }
			$dance=$db->getRow("select count(CS_ID) as dcount from ".Getdbname('dance')." where CS_TID=".$row["CS_ID"]."");
                        if($op!="sh" && CS_Webmode==3){
		             $html=HtmlShow($row['CS_ID'],'../html/html_topic.php?ac=ids&id='.$row['CS_ID'].'',LinkUrl('show','zj','id',$row['CS_CID'],$row['CS_ID']));
                        }else{
		             $html='';
                        }
                  echo "<tr>
				<td><input type=\"checkbox\" class=\"J_check\" name=\"CS_ID[]\" value=\"".$row['CS_ID']."\" id=\"CS_ID\"/>&nbsp;".$row['CS_ID']."</td>
				<td><a href=\"".LinkUrl('show','zj','id',$row['CS_CID'],$row['CS_ID'])."\" target=\"play\"><font color=".$row['CS_Color'].">".getlen('len',35,$row['CS_Name'])."</font></a>".$html."</td>
				<td>".$dance['dcount']."首</td>
				<td><a href=\"".userlink('index',getuser('uid',$row['CS_User']))."\" target=\"user\">".$row['CS_User']."</a></td>
				<td>".$row['CS_Rhits']."</td>
				<td>".$row['CS_Hits']."</td>
				<td><span id=\"class_".$row['CS_ID']."\">".$class['CS_Name']."<img src=\"../res/images/edit.gif\" title=\"修改分类\" onclick=\"chgclass(".$row['CS_ID'].",".$row['CS_CID'].")\" style=\"cursor:pointer\"></span></td>
				<td id=\"CS_Reco".$row['CS_ID']."\"><script language=\"javascript\">ShowStar(".$row['CS_Reco'].",".$row['CS_ID'].")</script></td>
				<td>".$shenhe."</td>
				<td>".$addtime."</td>
				<td><a href=\"?ac=edit&id=".$row['CS_ID']."\">编辑</a> &nbsp;&nbsp;<a style=\"cursor:pointer;\"  onclick=\"del(".$row['CS_ID'].")\">删除</a></td>
			</tr>";
             }
        }
?>
	</table>
			<div class="p10">
				<div class="pages">
				     <?php if($dancenum>20) echo $Arr[0];?>
                                </div>
			</div>
</div>
<div class="btn_wrap">
	<div class="btn_wrap_pd">
                <label class="mr20"><input type="checkbox" class="J_check_all" id="chkall" onClick="return CheckAll(this.form)" value="on">全选</label>
		<input name="button1" type="button" class="btn J_ajax_submit_btn" value="批量删除" onClick="DelInfo(this.form)">
            <?php if(CS_Webmode==3){ ?>
		<input name="button2" type="button" class="btn btn_submit J_ajax_submit_btn" value="批量生成" onClick="MarkInfo(this.form,'topic')">
            <?php } ?>
            <?php if($op=="sh"){ ?>
		<input name="button1" type="button" class="btn btn_submit J_ajax_submit_btn" value="批量审核" onClick="SHInfo(this.form,'topic')">
            <?php } ?>
                <div class="tips_error" id="Msg"></div>
	</div>
</div>
</form>
<?php
          //审核
          if($op=='shenhe'){
		global $db;
		$CS_ID=CS_Request("id");
		$CS_YID=CS_Request("yid");
                $sql="update ".Getdbname('topic')." set CS_YID=".$CS_YID." where CS_ID=".$CS_ID;
		if($db->query($sql)){
			echo "<script>window.location='javascript:history.go(-1);';</script>";
		}
          }

          //批量审核
          if($op=='plsh'){
		global $db;
		$CS_ID=CS_Request("id");
                $sql="update ".Getdbname('topic')." set CS_YID=0 where CS_ID in (".$CS_ID.")";
		if($db->query($sql)){
                        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,审核成功!").css("color","#026E12");</script>';
	                echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
		}
          }

          //删除
          if($op=='del'){
		global $db;
		$CS_ID=CS_Request("id");
		$sqlstr="select count(CS_ID) as vcount from ".Getdbname('dance')." where CS_TID=$CS_ID";
			$row=$db->getRow($sqlstr);
			if($row){
				if($row['vcount']>0){
                          	 echo '<script>$("#Msg").text("抱歉,该专题下有数据不能删除！").css("color","red");</script>';
                          	 exit();
				}
			}
                $clsid=$db->Getrow("select CS_CID from ".Getdbname('topic')." where CS_ID=".$CS_ID."");
                $sql="delete from ".Getdbname('topic')." where CS_ID=".$CS_ID;
		if($db->query($sql)){
			if(CS_Webmode==3){
				$fileurl=LinkUrl('show','zj','id',$clsid['CS_CID'],$Arr[$i]);
				$fileurl="../../".substr($fileurl,strlen(CS_WebPath));
				if(file_exists($fileurl)){
					unlink($fileurl);
				}	
			}
                        $db->query("delete from ".Getdbname('dt')." where CS_DID=".$CS_ID." and CS_CID=4");
                        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,删除成功!").css("color","#026E12");</script>';
	                echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
		}
          }

          //批量删除
          if($op=='delall'){
		global $db;
		$CS_ID=CS_RequestBox("CS_ID");
	        $Arr=explode(',',$CS_ID);
		for($i=0;$i<count($Arr);$i++){
			$sqlstr="select count(CS_ID) as vcount from ".Getdbname('dance')." where CS_TID=$CS_ID";
			$row=$db->getRow($sqlstr);
			if($row){
				if($row['vcount']>0){
                          	 echo '<script>$("#Msg").text("抱歉,ID为'.$CS_ID.'的专题下有数据不能删除！").css("color","red");</script>';
                          	 exit();
				}
			}
			if(CS_Webmode==3){
		          $clsid=$db->Getrow("select CS_CID from ".Getdbname('topic')." where CS_ID=".$Arr[$i]."");
				$fileurl=LinkUrl('show','zj','id',$clsid['CS_CID'],$Arr[$i]);
				$fileurl="../../".substr($fileurl,strlen(CS_WebPath));
				if(file_exists($fileurl)){
					unlink($fileurl);
				}	
			}
			$db->query("delete from ".Getdbname('dt')." where CS_DID=".$Arr[$i]." and CS_CID=4");
		}
                        echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,删除成功!").css("color","#026E12");</script>';
	                echo "<script>setTimeout(\"window.location='javascript:history.go(-1);'\",2000);</script>";
          }
   }
?>
</div>
</body>
</html>