<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="save" content="history"> 
<title><?php echo V('-:tpl/title');?>管理后台</title>
<link href="<?php echo W_BASE_URL;?>css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/admin.js"></script>
<script>
function disable_comment(cid, name, uid, text, created_at) {
		var comment_info = {
					'cid': cid,
					'name': name,
					'uid': uid,
					'text': text,
					'created_at': created_at
					}
		$.post('<?php echo URL('admin/disabled_comment.disable');?>', comment_info, function(json) {
				json = eval('(' + json + ')');
				if (json.state == 'succ') {
					alert('已成功删除');
					window.location.reload();
				} else {
					alert('删除失败');
				}
		})
}
function search() {
	if (checkForm($('#url').get(0))) {
		var url = buildModulePath('admin/disabled_comment','search', 'url=' + encodeURIComponent($('#url').val()));
		window.location.href = url;
	}
	
}
$(function() {
	$('#url').blur(function() {
		checkForm(this);
	})

})
</script>
</head>
<body>
   <?php include  APP::tplFile("admin/header.php", false);?>
     <div class="wrap">
        <div class="position">当前位置：微博管理<em>></em>屏蔽回复<em>></em><strong>添加屏蔽项</strong></div>
        <!--搜索结果列表-->
        <div class="cr_form">
            <table width="92%" cellspacing="0">
                <tr>
                    <td width="320" class="tbtitle" ><label for="url"><em>*</em>微博地址：</label></td>
                    <td></td>
                </tr>
                <tr class="from_row">
                    <td>
                        <input type="text" name="url" id="url" class="insert_text" valid="required" value="<?php echo V('g:url');?>" />
                    </td>
                    <td><div class="mes_tips" id="url_msg">请输入要屏蔽的评论所属微博详细页网址，此微博全部评论信息将显示在下方。</div></td>
                </tr>
                <tr>
                    <td colspan="2" class="cr_formop"><span class="button"><input type="submit" value="搜索" onclick="search()"></span></td>
                </tr>
           </table>
        </div>
        <div class="cr_list">
            <table cellspacing="0">
        		<?php if ($info && is_array($info)) { ?>
                <tr>
                        <th width="100" style="text-align:center">昵称</th>
                        <th style="text-align:center" >评论内容</th>
                        <th width="150" style="text-align:center">发布时间</th>
                        <th width="100" style="text-align:center">操作</th>
                </tr>
                <?php foreach ($info as $key=>$item) {?>
                <tr <?php if ($key %2) {?> class="rowbg"<?php }?>>
                        <td><?php echo $item['user']['name'];?></td>
                        <td style="text-align:left"><?php echo $item['text'];?></td>
                        <td ><?php echo date('Y-m-d H:i:s', strtotime($item['created_at']))?></td>
                        <td><a href="javascript: disable_comment('<?php echo $item['id'];?>','<?php echo $item['user']['name'];?>','<?php echo $item['user']['id'];?>','<?php echo $item['text'];?>','<?php echo strtotime($item['created_at']);?>')">屏蔽该评论</a></td>
                </tr>
                <?php }?>
				<?php } elseif(V('r:url')) {?>
					<tr><td colspan="4">没有搜索到任何结果</td></tr>
				<?php }?>
           </table>
     </div>  
       </div>
</body>
</html>
