{include "header.inc.html"}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.post.name}</strong><br />
		<span class="english">{$lang.admin.post.name_en}</span> </span> </div>
	</div>
 <div class="container">
 <table class="table-ca table_1" >
 <tr>
<th class="w30">编号</th>{if $postConfig.login}<th class="w40">会员</th>{/if}{if $postConfig.title}<th class="w220">标题</th>{/if}<th class="w600">内容</th>{if $postConfig.reply}<th class="w30">回复</th><th class="w30">审核</th>{/if}{if $postConfig.article}<th class="w50">关联文章</th>{/if}{if $postConfig.goods}<th class="w50">文联商品</th>{/if}<th class="w130">时间</th><th class="w30">操作</th>
 </tr>
{post limit=10 parentId=0 order="id desc"}
<tr>
<td>{$item.id}</td>{if $postConfig.login}<td>{$item.userId}</td>{/if}{if $postConfig.title}<td>{$item.title}</td>{/if}<td>
<span class="none">姓名：<b>{$item.name}</b>  QQ号码：<b>{$item.qq}</b>  个人主页：<b>{$item.homepage}</b><br /></span>
{if $item.mobile}联系电话：<b>{$item.mobile}</b> {/if}{if $item.email}邮箱：<b>{$item.email}</b> {/if}<br>
{$item.content}	
<div class="clr"></div>
		{post parentId=$item.id  name="replay" pager="false"}
		<div class="replay">
		{$replay.content}
		({$replay.postName}: {$item.posttime|date_format:"Y-m-d H:i"}) <a href="javascript:void(0)" class="delPost" sid="{$replay.id}">删除</a>
		</div>
		{/post}
</td>{if $postConfig.reply}<td><a href="javascript:void(0)" class="newReply">回复</a></td><td><img class="smodtoggle" name="iStatus" sid="{$item.id}" src="{$basePath}static/images/{if $item.iStatus==1}yes{else}no{/if}.gif"></td>{/if}
{if $postConfig.article}<td>{$item.articleId}</td>{/if}{if $postConfig.goods}<td><a href="{$baseUrl}goods/view/id/{$item.goodsId}" target="_blank">{$item.goodsId}</a></td>{/if}
<td>{$item.posttime|date_format:"Y-m-d H:i:s"}</td><td><a href="javascript:void(0)" class="delBtn" sid="{$item.id}">删除</></td>
</tr>
{/post}
</table>
<div class="page">
	<div class="pagin fr">{pager allCount=$allCount url='/qkadmin/goods/page/page' number="false"}</div>
</div>
</div>

<div id="postDialog" class="none">
	<div class="layer_global_cont p_layer_con">
		<strong class="icon_hint_succeed p_icon_hint"><span>提示</span></strong>
		<div class="p_content_con" style="width: 360px;">
			<h3 class="hint_succeed_pop">
			 <strong>回复编号为 <span id="postId"></span> 的留言/评论</strong>
			</h3>
			<div class="part_1"><p><textarea id="postContent" style="width:350px;height:100px"></textarea></p></div>
			<div class="hint hide"></div>
		</div>
	</div>
	<div class="global_tip_button" style="left: 0px; bottom: 0px; position: absolute;"><button class="bt_tip_normal" id="postSubmit">确定回复</button> <button class="bt_tip_normal" id="close">关闭</button></div>
</div>
<script type="text/javascript">
$(function(){
	$(".delPost").click(function(){
		if(!confirm(lang[4])){ return false; }
		var id = $(this).attr("sid");
		var obj = $(this);
		$.ajax({ type:'POST',url:"{$adminUrl}post",data:"inajax=1&act=del&id="+id,dataType:'json',success:function(json){ if(json.success){ $(obj).parent().remove(); }else{ alert(json.message); } } })
	});
	$(".delBtn").click(function(){
		if(!confirm(lang[4])){ return false; }
		var id = $(this).attr("sid");
		var obj = $(this);
		$.ajax({ type:'POST',url:"{$adminUrl}post",data:"inajax=1&act=del&id="+id,dataType:'json',success:function(json){ if(json.success){ $(obj).parent("td").parent("tr").remove(); }else{ alert(json.message); } } })
	});
	$(".newReply").click(function(){
		var tds = $(this).parent("td").parent("tr").find("td");
		var id = tds.eq(0).text();
		var postDialog = $("#postDialog").dialog({ width:500,height:220,title:'添加回复',resizable:false,dialogClass:'layer_global_main' });
		//alert(id);
		$("#postId").html(id);
		$("#postSubmit").unbind().click(function(){
			var content = $("textarea#postContent").val();
			var sdata = "inajax=1&act=replay&id="+id+"&content="+content;
			$.ajax({
				type:"POST",
				url:"./",
				data:sdata,
				dataType:"json",
				success:function(data){
					if(data.success){
						var html = '<div class="replay">'+content+'('+data.data.adminName+':'+data.data.posttime+')</div>';
						tds.eq(3).append(html);
						postDialog.dialog('destroy');
					}else{
						alert(data.message);
					}
				}
			});
		});
		$("button#close").click(function(){
			postDialog.dialog('destroy');
		});
	});
//$(".newReply").eq(2).trigger("click");


});
</script>
</div><!--.content_box-->
{literal}
<script type="text/javascript">
$(function(){
	$("#tInfo").find("tr").each(function(index){
		if(index>0){
			$(this).find("td").eq(2).css({"text-align":"left"});
			$(this).find("td").eq(3).css({"text-align":"left"});
			$(this).find("td").find(".replay").css({"background-color":"#F6F6F6","border-top":"1px #fff solid","padding-left":"5px"});
		}
	});

});
</script>
{/literal}

{include "footer.inc.html"}