<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!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>
<title>内容管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
<script language="javascript">
$(document).ready(function(){
	$('#stype').val('<?php echo $stype;?>');
});
</script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">内容管理</a></li>
			<?php if($catid && isfinalcatid($catid)){?><li><a href="?file=content&action=add&catid=<?php echo $catid;?>">添加内容</a></li><?php }?>		
		</ul>
	</div>
	<div class="main">
		<div class="search">
			<form action="?" method="get" name="search">
			<input type="hidden" name="file" value="<?php echo $file;?>"> 
			<input type="hidden" name="action" value="<?php echo $action;?>"> 
			<input type="hidden" name="field" value="<?php echo $field;?>"> 
			<input type="hidden" name="catid" value="<?php echo $catid;?>"> 
			<input type="hidden" name="fieldvalue" value="<?php echo $fieldvalue;?>"> 
				<fieldset>
					<legend>内容查找</legend>
						搜索条件：
						<select name="stype" id="stype">
							<option value="title">标题</option>
							<option value="id">ID</option>
							<option value="match">全文检索</option>
						</select>
						&nbsp;&nbsp;
						关键字：
						<input type="text" name="k" size="35" value="<?php echo $k?htmlspecialchars(stripslashes($k)):'';?>" />
						<input type="submit" class="button" value="开始查找" />
				</fieldset>
			</form>
		</div>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="40" class="firstcol">反选</th>
			<th width="53">排序</th>
			<th width="209">标题</th>
			<th width="50">状态</th>
			<th width="98">所属栏目</th>
			<th width="88">录入者</th>
			<th width="49">点击</th>
			<th width="53">评论</th>
			<th width="100">录入时间</th>
			<th width="60">操作</th>
		</tr>
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<input type="hidden" name="catid" value="<?php echo $catid;?>" />
		<input type="hidden" name="field" value="<?php echo $field;?>"> 
		<input type="hidden" name="fieldvalue" value="<?php echo $fieldvalue;?>"> 
		<?php if($result){foreach($result as $val){?>
		<tr>
			<td width="40" align="center">
			<input type="hidden" name="modelid[<?php echo $val['id'];?>]" value="<?php echo $val['modelid'];?>" />
			<input type="hidden" name="groupid[<?php echo $val['id'];?>]" value="<?php echo $val['groupid'];?>" />
			<input type="hidden" name="id[]" value="<?php echo $val['id'];?>" />
			<input type="hidden" name="catid[]" value="<?php echo $val['catid'];?>" />
			<input type="checkbox" name="checkedid[]" value="<?php echo $val['id'];?>" class="checkbox" />
			</td>
		  <td width="53" align="center"><input type="text" name="orderby[]" size="2" value="<?php echo $val['orderby'];?>" /></td>
			<td width="209" align="left"><a href="<?php echo $val['url'];?>" title="<?php echo $val['title'];?>" target="_blank"><?php echo htmlspecialchars(sub_string($val['title'],20));?></A><?php echo $val['thumb']?'[<font color="#ff0000">图</font>]':'';?>&nbsp;<?php echo $val['posid']?'[<font color="#33CC00">荐</font>]':'';?></td>
			<td width="50" align="center"><a href="?file=<?php echo $file;?>&action=<?php echo $action;?>&field=status&fieldvalue=<?php echo $val['status'];?>"><?php echo $val['status']?'通过':'<font color="#FF3300">待审</font>';?></a></td>
			<td width="98" align="center"><a href="?file=<?php echo $file;?>&action=<?php echo $action;?>&field=catid&fieldvalue=<?php echo $val['catid'];?>"><?php echo $val['catname'];?></a></td>
			<td width="88" align="center"><a href="?file=<?php echo $file;?>&action=<?php echo $action;?>&field=userid&fieldvalue=<?php echo $val['userid'];?>"><?php echo $val['username'];?></a></td>
			<td width="49" align="center"><font color="#FF0000"><b><?php echo $val['clicks'];?></b></font></td>
			<td width="53" align="center"><a title="管理该内容的评论" href="?file=content&action=comment&contentid=<?php echo $val['id'];?>">管理(<font color="#33CC00"><b><?php echo $val['comments'];?></b></font>)</a></td>
			<td width="100" align="center"><?php echo date('Y-m-d',$val['inputtime']);?></td>
			<td width="60" align="center"><a href="?file=content&action=edit&catid=<?php echo $val['catid'];?>&id=<?php echo $val['id'];?>">修改</a> <a href="show.php?id=<?php echo $val['id'];?>" target="_blank">查看</a></td>
		</tr>
		<?php }?>
		<tr>
			<td width="40" align="center">
			<input type="checkbox" name="chkall2" value="1" class="checkbox" onclick="check_all_bycheckedid(this)" /></td>
			<td colspan="9" align="left">
			<input type="button" value="排 序" name="do_order" class="button" onclick="this.form.submit();" />
			&nbsp;&nbsp;
			<input type="button" value="审 核"   name="do_pass" class="button" onclick="this.form.action='?file=<?php echo $file;?>&action=pass';this.form.submit();" />			 			&nbsp;&nbsp;
			<input type="button" value="待 审"   name="do_unpass" class="button" onclick="this.form.action='?file=<?php echo $file;?>&action=unpass';this.form.submit();" />			&nbsp;&nbsp;
			<input type="button" value="推 荐"   name="do_support" class="button" onclick="this.form.action='?file=<?php echo $file;?>&action=support';this.form.submit();" />			&nbsp;&nbsp;
			<input type="button" value="移 动" name="do_move" class="button" onclick="this.form.action='?file=<?php echo $file;?>&action=move';this.form.submit();" />
			&nbsp;&nbsp;
			<input type="button" value="删 除"   name="do_delete" class="button" onclick="if(confirm('确定进行删除操作吗？')){this.form.action='?file=<?php echo $file;?>&action=delete';this.form.submit();}" />
			</td>
		</tr>
		</form>
		<?php }else{?>
		<tr><td colspan="10">目前该栏目下尚未添加任何内容...</td></tr>	
		<?php }?>
		<tr>
			<td colspan="10"><?php echo $pages;?></td>
		</tr>
		</table>
	</div>
</div>
</body>
</html>