<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title><!--{$UUDEV_PAGE_TITLE}--></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{include file=elements/header.css.html}-->
<!--{include file=elements/header.js.html type=common}-->
<!--{include file=elements/header.js.html type=date}-->
<!--{include file=elements/header.js.html type=popbox}-->
</head>
<body>
<div id="outside">
	<!--{include file=frame/top.html}-->
	<div id="mainareaContent">
		<!--{include file=frame/left.html}-->
		<div id="rightContent">
			<div id="topContent">
				<div class="sitmap">
					<span class="r"><!--{include file="elements/uuadvad.html"}--></span>互动社区&nbsp;&gt;&nbsp;留言管理&nbsp;&gt;&nbsp;内容管理
				</div>
			</div>
			<div class="tabcontent">
				<a href="index.php?r=MessageBoard.messagelist" class="nolink">内管管理</a>
				<a href="index.php?r=SiteSet.messageboardset" class="link">属性设置</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent2">
					<form name="searchForm" action="index.php" method="get" onSubmit="setDisabled('button', window.document);">
						<input type="hidden" name="r" value="MessageBoard.messagelist"/>
						<input type="hidden" id="channel_id" name="channel_id" value="<!--{$channel_id}-->"/>
						<input type="hidden" id="status" name="status" value="<!--{$status}-->"/>
						<input type="hidden" id="orderby" name="orderby" value="<!--{$orderby}-->"/>
						<div class="searchbar">
							发布时间&nbsp;<input type="text" class="date" id="begin_date" name="begin_date" value="<!--{$begin_date}-->"/>-<input type="text" class="date" id="end_date" name="end_date" value="<!--{$end_date}-->"/>
							&nbsp;<button type="submit" class="but2font">查询</button>
						</div>
					</form>
					<div class="operation">
						<button type="button" class="but4font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&status=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定审核通过？')">审核通过</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&top_flag=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定置顶？')">置顶</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&top_flag=0&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定消顶？')">消顶</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&extract_flag=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定加精？')">加精</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&extract_flag=0&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定消精？')">消精</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.delete&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
					</div>
					<table class="tbl_list" width="100%" cellpadding="0" cellspacing="0" border="0">
						<tr class="thead">
							<td width="5%"><input type="checkbox" class="checkall"/></td>
							<td width="10%">标题</td>
							<td width="20%">内容</td>
							<td width="15%">站长回复</td>
							<td width="10%"><select onChange="$('#channel_id').val(this.value);document.forms['searchForm'].submit();">
								<option>频道</option>
								<!--{foreach from=$channel item=item name=channellist}-->
								<option value="<!--{$item.id}-->" <!--{if $item.id eq $channel_id}-->selected<!--{/if}-->><!--{$item.channel_text}--></option>
								<!--{/foreach}-->
							</select></td>
							<td width="10%"><select onChange="$('#status').val(this.value);document.forms['searchForm'].submit();">
								<option value="">状态</option>
								<option value="1" <!--{if $status eq 1}-->selected<!--{/if}-->>已审核</option>
								<option value="2" <!--{if $status eq 2}-->selected<!--{/if}-->>待审核</option>
							</select></td>
							<td width="10%">发布者</td>
							<td width="10%">
								<!--{if $orderby eq create_date0}-->
								<a class="link" onClick="$('#orderby').val('create_date1');document.forms['searchForm'].submit();">发布时间↑</a>
								<!--{elseif $orderby eq create_date1}-->
								<a class="link" onClick="$('#orderby').val('create_date0');document.forms['searchForm'].submit();">发布时间↓</a>
								<!--{else}-->
								<a class="link" onClick="$('#orderby').val('create_date0');document.forms['searchForm'].submit();">发布时间↓</a><!--{/if}-->
							</td>
							<td width="10%">操作</td>
						</tr>
						<!--{foreach from=$datalist item=item name=list}-->
						<tr onMouseOver="chgTrColor(this)" onMouseOut="chgTrColor(this)">
							<td><input type="checkbox" class="checkid" name="recordId" value="<!--{$item.id}-->"/></td>
							<td><!--{if $item.top_flag eq 1}-->[顶]<!--{/if}--><!--{if $item.extract_flag eq 1}-->[精]<!--{/if}--><!--{$item.message_title}--></td>
							<td><!--{$item.message_text|cutstrCN:"0":"20"}--></td>
							<td><!--{$item.reply_message|cutstrCN:"0":"20"}--></td>
							<td>
								<!--{foreach from=$channel item=data name=channel}-->
								<!--{if $data.id eq $item.channel_id}--><!--{$data.channel_text}--><!--{/if}-->
								<!--{/foreach}-->
							</td>
							<td><!--{if $item.status eq 1}-->已审核<!--{elseif $item.status eq 2}-->待审核<!--{/if}--></td>
							<td>
								<!--{if !empty($item.create_user_id)}-->
								<a href="index.php?r=User.update&userId=<!--{$item.create_user_id}-->&returnParams=<!--{$returnParams}-->"><!--{$item.create_user_pet_name}--></a>
								<!--{else}--><!--{$item.create_user_pet_name}--><!--{/if}-->
							</td>
							<td><!--{$item.create_date|date_format:"%Y-%m-%d"}--></td>
							<td><a href="javascript:show('<!--{$item.id}-->')">查看</a>
								<!--{if $item.status eq 2}-->
								<a href="javascript:check('<!--{$item.id}-->', '<!--{$returnParams}-->')">审核</a>
								<!--{elseif $item.status eq 1}-->
								<a href="javascript:edit('<!--{$item.id}-->', '<!--{$returnParams}-->')">回复</a><!--{/if}-->
							</td>
						</tr>
						<!--{foreachelse}-->
						<tr><td colspan="9">没有对应数据</td></tr>
						<!--{/foreach}-->
					</table>
					<div class="operation">
						<button type="button" class="but4font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&status=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定审核通过？')">审核通过</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&top_flag=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定置顶？')">置顶</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&top_flag=0&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定消顶？')">消顶</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&extract_flag=1&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定加精？')">加精</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.updatestatus&extract_flag=0&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定消精？')">消精</button>
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=MessageBoard.delete&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
					</div>
					<div class="page"><!--{$pager}--></div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
function customRange(input){
	return {
		minDate : (input.id == "end_date" ? $("#begin_date").datepicker("getDate") : null),
		maxDate : (input.id == "begin_date" ? $("#end_date").datepicker("getDate") : null)
	}
}
$("#begin_date, #end_date").datepicker({
    beforeShow : customRange, buttonImageOnly : false
});
function show(id){
	$.popbox({title:"查看留言", content:popstr_search});
	$.ajax({
		type: "get",
		url: "index.php?r=MessageBoard.show&id="+id,
		cache: false,
		dataType: "json",
		success: function(data){
			str = "<form action=\"index.php?r=MessageBoard.edit\" method=\"post\">";
			str += "<input type=\"hidden\" name=\"data[MessageBoard][id]\" value=\""+id+"\"/>";
			str += "<table class=\"tbl_edit\" width=\"100%\"><tr>";
			str += "<td class=\"td_name\">标题</td>";
			str += "<td class=\"td_content\">";
			if (data.message_title != null) str += data.message_title;
			str += "</td>";
			str += "</tr><tr>";
			str += "<td class=\"td_name\">内容</td>";
			str += "<td class=\"td_content\">";
			if (data.message_text != null) str += data.message_text;
			str += "</td>";
			str += "</tr><tr>";
			str += "<td class=\"td_name\">站长回复</td>";
			str += "<td class=\"td_content\">";
			if (data.reply_message != null) str += data.reply_message;
			str += "</td></tr></table></form>";
			$.popbox.setcontent({title:"查看留言", content:str});
		}
	});
};
function check(id, returnParams){
	$.popbox({title:"审核回复内容", content:popstr_search});
	$.ajax({
		type: "get",
		url: "index.php?r=MessageBoard.edit&id="+id,
		cache: false,
		dataType: "json",
		success: function(data){
			str = "<form action=\"index.php?r=MessageBoard.edit\" method=\"post\">";
			str += "<input type=\"hidden\" name=\"returnParams\" value=\""+returnParams+"\"/>";
			str += "<input type=\"hidden\" name=\"data[MessageBoard][id]\" value=\""+id+"\"/>";
			str += "<table class=\"tbl_edit\" width=\"100%\"><tr>";
			str += "<td class=\"td_name\">审核</td>";
			str += "<td class=\"td_content\"><select name=\"data[MessageBoard][status]\">";
			str += "<option value=\"1\">审核通过</option>";
			str += "</select></td>";
			str += "</tr><tr>";
			str += "<td class=\"td_name\">站长回复</td>";
			str += "<td class=\"td_content\"><textarea class=\"textarea\" name=\"data[MessageBoard][reply_message]\">";
			if (data.reply_message != null) str += data.reply_message;
			str += "</textarea></td>";
			str += "</tr><tr>";
			str += "<td class=\"noborder\"></td>";
			str += "<td class=\"noborder\"><button type=\"submit\" class=\"butsubmit\">提交</button></td>";
			str += "</tr></table></form>";
			$.popbox.setcontent({title:"审核回复内容", content:str});
		}
	});
}
function edit(id, returnParams){
	$.popbox({title:"修改回复内容", content:popstr_search});
	$.ajax({
		type: "get",
		url: "index.php?r=MessageBoard.edit&id="+id,
		cache: false,
		dataType: "json",
		success: function(data){
			str = "<form action=\"index.php?r=MessageBoard.edit\" method=\"post\">";
			str += "<input type=\"hidden\" name=\"returnParams\" value=\""+returnParams+"\"/>";
			str += "<input type=\"hidden\" name=\"data[MessageBoard][id]\" value=\""+id+"\"/>";
			str += "<table class=\"tbl_edit\" width=\"100%\"><tr>";
			str += "<td class=\"td_name\">站长回复</td>";
			str += "<td class=\"td_content\"><textarea class=\"textarea\" name=\"data[MessageBoard][reply_message]\">";
			if (data.reply_message != null) str += data.reply_message;
			str += "</textarea></td>";
			str += "</tr><tr>";
			str += "<td class=\"noborder\"></td>";
			str += "<td class=\"noborder\"><button type=\"submit\" class=\"butsubmit\">提交</button></td>";
			str += "</tr></table></form>";
			$.popbox.setcontent({title:"修改回复内容", content:str});
		}
	});
}
</script>
</html>