<!--<?php
print <<<EOT
--><script language="JavaScript">
var comment = {
		doCheckDel : function () {
			if(confirm("确定要删除所选评论吗？")){
				return true;
			}else{
				return false;
			}
		},
		doDelete : function(url){
			if(comment.doCheckDel()){
				setTimeout(function(){
					window.location.href = url;
				},100);
			}else{
				return false;
			}
		},
		doDeleCheck : function () {
			var form = getObj('formid');
			var ifcheck = false;
			for (var i=0;i<form.elements.length-1;i++){
				var e = form.elements[i];
				if(e.type == 'checkbox'){
					if(e.checked){
						ifcheck = true;
						break;
					}
				}
			}
			if(ifcheck) {
				if(comment.doCheckDel()) {
					comment.doSubmit();
				}
			}else{
				alert("请选择要删除的评论！")
				return false;
			}			
		},
		doSubmit : function() {
			setTimeout(function(){
				getObj('formid').submit();
			},0);
		}
};
</script>
<script language="JavaScript" src="js/date.js"></script>
<style type="text/css">
.mesPop span{display:none;border:1px solid #ccc;background:#fff;padding:5px 10px;color:#333;width:380px;}
.mesPop:hover{text-decoration:none;}
.mesPop:hover span{display:block; position:absolute;margin:16px 0 0 0;}
</style>
<div class="nav3 mb10">
	<ul class="cc">
		<li class="current"><a>评论管理</a></li>
	</ul>
</div>
<h2 class="h1">评论搜索</h2>
<!--
EOT;
$keyword = ($_viewer->keyword) ? stripslashes($_viewer->keyword) : '';
print <<<EOT
-->
<div class="admin_table mb10">
	<form action="{$_viewer->baseUrl}&action=run" method="post" />
	<input type="hidden" value="comment1" name="v" />
	<table width="100%">
		<tr class="tr1">
			<td class="td2">
				<input name="act_title" type="text" class="input input_wa mr10" value="{$keyword}" />
				<label class="mr10"><input name="type" type="radio" value="1"  {$_viewer->type[1]}/>内容</label>
				<label class="mr10"><input name="type" type="radio" value="2"  {$_viewer->type[2]}/>作者</label>
				<span class="mr10">发布时间：
				  <input type="text" name="startdate" value="{$_viewer->startdate}" id="postdate_s" onclick="javascript:ShowCalendar(this.id)">
				  至
				  <input type="text" name="enddate" id="postdate_e" value="{$_viewer->enddate}" onclick="javascript:ShowCalendar(this.id)">
				</span>
				<span class="btn2"><span><button type="submit">搜索</button></span></span>
			</td>
		</tr>
	</table>
	</form>
</div>
<h2 class="h1">评论列表</h2>
<div class="admin_table mb10">
<!--
EOT;
if($_viewer->comments){
print <<<EOT
--><form method="POST" action="{$_viewer->baseUrl}&action=deleteComments" name="FORM" id="formid">
	<input type="hidden" name="content" value="{$_viewer->search['content']}" />
	<input type="hidden" name="usename" value="{$_viewer->search['usename']}" />
	<input type="hidden" name="startdate" value="{$_viewer->search['startdate']}" />
	<input type="hidden" name="enddate" value="{$_viewer->search['enddate']}" />
	<input type="hidden" name="page" value="{$_viewer->search['page']}" />
	<input type="hidden" value="listv2" name="po" />
	<table width="100%">
		<tr class="tr2">
			<td width="60"><label><span OnClick="CheckAll(document.FORM)" style = "cursor:pointer;">全选</span></label></td>
			<td class="td2">发布者</td>
			<td class="td2" widht="250">内容</td>
			<td class="td2">发布时间</td>
			<td width="100">操作</td>
		</tr>
<!--
EOT;
foreach($_viewer->comments as $comment){
print <<<EOT
--><tr class="tr1">
			<td class="td2"><input type="checkbox" name="commentid[]" value="{$comment['commentid']}"></td>
			<td class="td2"><a href="u.php?uid={$comment['uid']}" target=_blank>{$comment['username']}</a></td>
			<td class="td2"><a href="{$comment['frontURL']}#x_comment_list" target="_blank"class="mesPop"><span>{$comment['content']}</span>{$comment['shortcontent']}</a>
			<td class="td2">{$comment['postdate']}</td>
			<td class="td2"><a href="javascript:;" onclick="comment.doDelete('{$_viewer->backUrl}&action=deleteComment&commentid={$comment['commentid']}');">[删除]</a></td>
		</tr>
<!--
EOT;
}
print <<<EOT
--><tr class="tr2">
			<td width="50"><input type="checkbox" onclick="PW.selectAll('commentid[]',this)" /><span OnClick="CheckAll(document.FORM)" style="cursor:pointer;"> 全选</span></td>
			<td><span class="bt2"><span><button type="button" onclick="comment.doDeleCheck()">批量删除</button></span></span></td>
			<td colspan="6">&nbsp;</td>
		</tr>
	</table>
</form>
<div class="cc">{$_viewer->pager}</div>
<!--
EOT;
}else{
print <<<EOT
--><div class="admin_tips">啊哦，没有你要的信息！</div>
<!--
EOT;
}
print <<<EOT
--></div>
<!--
EOT;
?>