<!--{template 'head'}-->
<script language="JavaScript">
function modify( commentid)
{
	if( $('pass_'+commentid).innerHTML=='取消')
		var is_pass = 0;
	else
		var is_pass = 1;
	var link = "system.php?sys=comment&channelid={$channelid}&action=pass&is_pass="+is_pass+"&commentid="+commentid;
	AJAX.request( link,
	{
		method		: 'get',
		onComplete	: function(json)
		{
			var json = evaljson(json);
			if( json[0] == 1)
			{
				if( is_pass==0)  $('pass_'+commentid).innerHTML='<font color=red>批准</font>';
				else  $('pass_'+commentid).innerHTML='取消';
			}
			else
			{
				alert( lang[json.message]);
			}
			rm.Close();
		}
	});
}
function del( commentid)
{
	var link = "system.php?sys=comment&channelid={$channelid}&action=del&commentid="+commentid;
	AJAX.request( link,
	{
		method		: 'get',
		onComplete	: function(json)
		{
			var json = evaljson(json);
			if( json[0] == 1){
				colorFocus($('item-'+commentid), cs, ce, 'backgroundColor', function(){
					if($('item-'+commentid)!= null) $('item-'+commentid).parentNode.removeChild($('item-'+commentid));
					<!--{if $api}-->parent.qmeCms.dialogView.iframeOnload();<!--{/if}-->
				});			
			}else{
				alert( lang[json.message]);
			}
			rm.Close();
		}
	});
}
setSubject("{$channelname}栏目管理");
</script>
<!--{if $api}-->
<style type="text/css">
html{overflow:hidden}
</style>
<script type="text/javascript">
window.onload = function(){
	parent.qmeCms.dialogView.iframeOnload();
}
</script>
 <!--{/if}-->
<script type="text/javascript">
setSubject("{$channelname} >> <a href=\"system.php?sys=comment&channelid={$channelid}&action=manage\">评论管理</a> <!--{if $subject}--> >> <!--{echo addslashes(qbase::substrs(strip_tags($subject), 40))}--> <!--{/if}-->");
</script>
<form name="form" method="GET" action="system.php">
<table cellpadding="2" cellspacing="1" border="0" align=center width=100% class="tableborder" >
  <tr>
     <td class="tablerow"><b>管理选项：</b>
	<input name='is_pass' id="is_pass_2" type='radio' value='2' onclick="location='system.php?sys=comment&channelid={$channelid}&api={$api}&action=manage&is_pass=2&id={$id}'"<!--{if $is_pass=='2' or empty($is_pass)}--> checked<!--{/if}-->><label for="is_pass_2">所有评论</label>&nbsp;&nbsp;
	<input id="is_pass_1"  <!--{if $is_pass==1}--> checked<!--{/if}--> name='is_pass' type='radio' value='1' onclick="location='system.php?sys=comment&api={$api}&channelid={$channelid}&action=manage&is_pass=1&id={$id}'" ><label for="is_pass_1">已审核的评论</label>&nbsp;&nbsp;
	<input id="is_pass_0"  name='is_pass' type='radio' value='0' onclick="location='system.php?sys=comment&channelid={$channelid}&api={$api}&action=manage&is_pass=0&id={$id}'"<!--{if $is_pass==0}--> checked<!--{/if}-->><label for="is_pass_0">未审核的评论</label>&nbsp;&nbsp;&nbsp;&nbsp;
     </td>
     <td class="tablerow">
	 <!--{if $api == 0}-->
	<input type="hidden" name="sys" value="comment">
	<input type="hidden" name="channelid" value="{$channelid}">
	<input type="hidden" name="action" value="manage">
	<input name='keyword' id='keyword' type=text class="f-text"  size='20' value='{$keyword}'>
	<select name=type id='type'>
		<option value='1' selected>评论用户名</option>
		<option value='2'>评论内容</option>
		<option value='3'>I P 地址</option>
	</select>
	<input name='submit' type='submit' value='评论搜索' class="f-button" / >
	<!--{/if}-->
     </td>
  </tr>
</table>
</form>
<form method="post" id="myForm" name="form" action="system.php?sys=comment&channelid={$channelid}">
<table cellpadding="0" cellspacing="0" class="tableborder" id="mytable">
	<tr>
		<th colspan=6>评论管理</th>
	</tr>
	<tr align="center">
		<td width="35" class="tablerowhighlight">选中</td>
		<td width="32" class="tablerowhighlight">头像</td>
		<td width="60" class="tablerowhighlight">姓名</td>
		<td width="350" class="tablerowhighlight">内容</td>
		<td width="120" class="tablerowhighlight">发表时间</td>
		<td width="180" class="tablerowhighlight">管理操作</td>
	</tr>
	<!--{if $comments}-->
	<!--{loop $comments $comment}-->
	<tr class="item" height=27 id="item-{$comment[commentid]}">
		<td class="tablerowl">
			<input type="checkbox" onclick="try{event.cancelBubble=true;}catch(e){event.stopPropagation();}" name="commentid[]"  id="ids_{$comment[commentid]}" value="{$comment[commentid]}">
			<input type="hidden" name="aid[]"  id="aid[]" value="{$comment[id]}" />
		</td>
		<td class="tablerowl" style="padding:0;">
			<!--{if $comment['uid']}-->
			<a href="###"><img alt="{$comment['username']}" title="{$comment['username']}" onerror="this.src='{W_P}images/avatar_32.jpeg';" src="<!--{echo qbase::avatar($comment['uid'],32);}-->" /></a>
			<!--{else}-->
			<a href="###"><img alt="网友" title="网友" src="{W_P}images/avatar_32.jpeg" /></a>
			<!--{/if}-->
		</td>
		<td align="center"><!--{echo $comment['username'] ? $comment['username'] : '游客'}--></td>
		<td align="left" style="padding-left:5px;" title="IP: <!--{echo long2ip($comment[ip])}-->">{$comment[content]}</td>
		<td align="center">{$comment[addtime]}</td>
		<td align="center">
			<!--{if $comment[is_pass]==1}--><a href='javascript:modify({$comment[commentid]});' id='pass_{$comment[commentid]}'>取消</a><!--{else}--><a href='javascript:modify({$comment[commentid]});' id='pass_{$comment[commentid]}'><font color=red>批准</font></a><!--{/if}-->  <!--{if $api == 0}-->| <a href='system.php?sys=comment&channelid={$channelid}&id={$comment[id]}&api={$api}'>同主题评论</a><!--{/if}--> | <a href="{W_P}index.php?ac=comment&channelid={$comment['channelid']}&id={$comment['id']}#comment-{$comment['commentid']}" target="_blank">查看</a> | <a href='javascript:del({$comment[commentid]});'>删除</a>
		</td>
	</tr>
	<!--{/loop}-->
	<!--{else}-->
	<tr class="item" height=27>
		<td align="center" colspan="6">
			<p style="padding:12px;">没有找到相关评论</p>
		</td>
	</tr>
	<!--{/if}-->
	<tr>
		<td  class="tablerowl">
			<input name='chkall' type='checkbox' id='chkall' onclick='checkall(this.form)' value='checkbox'>
		</td>
		<td colspan=5  class="tablerow manage_act">
			<input type="hidden" name="many" value="确定" class="f-button" / >
			<input name='submit2' type='submit' value='批准选定的评论' onClick="$('myForm').action='system.php?sys=comment&api={$api}&channelid={$channelid}&action=is_pass&is_pass=1&id={$id}'" class="f-button" / >
			<input name='submit3' type='submit' value='取消批准选定的评论' onClick="$('myForm').action='system.php?sys=comment&api={$api}&channelid={$channelid}&action=is_pass&is_pass=0&id={$id}'" class="f-button" / >
			<input name="submit1" type="submit"  value="删除选定的评论" onClick="$('myForm').action='system.php?sys=comment&api={$api}&channelid={$channelid}&action=del&id={$id}'" class="f-button" / >
		</td>
	</tr>
	<tr>
		<td  class="tablerowl">

		</td>
		<td colspan=5  class="tablerow" align=center>
			<!--{eval new pager($total,$pagesize);}-->
		</td>
	</tr>
</table>
</form>
<script language=javascript>
	selectChecked( 'type', '{$type}');
</script>
<script type="text/javascript">
	function wl( url){if( url){ window.location=url;};}
	var rm = new qmeCms.rightMenu('mytable');
	rm.AddItem("通过/取消 审核","modify(rm.id)");
	rm.AddItem("删除评论","del(rm.id)");
	domReady(function(){
		rm.Setup();
	});
</script>
<!--{template 'foot'}-->