<!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}-->
<!--{include file=elements/header.js.html type=valid}-->
</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=User.userlist" class="link">会员列表</a>
				<a href="index.php?r=SiteSet.userset" class="link">属性设置</a>
				<a href="index.php?r=User.honourlist" class="link">会员头衔</a>
				<a href="index.php?r=SiteSet.experienceset" class="link">会员经验</a>
				<a href="index.php?r=User.forumroleimg" class="link">管理员身份勋章</a>
				<a href="index.php?r=User.albumlist" class="link">会员相册</a>
				<a href="index.php?r=User.listphotoframe" class="link">会员相框</a>
				<a href="index.php?r=User.msglist" class="nolink">会员消息</a>
				<a href="index.php?r=SiteSet.msgboxset" class="link">信箱设置</a>
			</div>
			<div id="secrightContent">
				<div class="tableContent2">
					<form id="searchForm" name="searchForm" action="index.php" method="get" onSubmit="setDisabled('button', window.document);">
						<input type="hidden" name="r" value="User.msglist"/>
						<input type="hidden" id="status" name="status" value="<!--{$status}-->"/>
						<input type="hidden" id="message_type" name="message_type" value="<!--{$message_type}-->">
						<div class="searchbar">
							发件人ID&nbsp;<input type="text" class="text" name="from_user_id" value="<!--{$from_user_id}-->"/>
							&nbsp;收件人ID&nbsp;<input type="text" class="text" name="user_id" value="<!--{$user_id}-->"/>
							&nbsp;消息内容&nbsp;<input type="text" class="text" name="keywords" value="<!--{$keywords}-->"/>
							&nbsp;<button type="submit" class="but2font">查询</button>
						</div>
					</form>
					<div class="operation">
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=User.deletemsg&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
						<button type="button" class="but5font" onClick="deletemore('<!--{$returnParams}-->')">按时间删除</button>
					</div>
					<table class="tbl_list" width="100%" cellpadding="0" cellspacing="0" border="0">
						<tr class="thead">
							<td ><input type="checkbox" class="checkall"/></td>
							<td >
								<select onChange="$('#message_type').val($(this).val());$('#searchForm').submit()">
									<option value="">类别</option>
									<option value="1" <!--{if $message_type eq 1}--> selected <!--{/if}-->>发出</option>
									<option value="2" <!--{if $message_type eq 2}--> selected <!--{/if}-->>系统</option>
								</select>
							</td>
							<td >发件人</td>
							<td >收件人</td>
							<td >消息内容</td>
							<td >发送时间</td>
							<td >操作</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.message_type eq 1}-->发出<!--{elseif $item.message_type eq 2 }-->系统<!--{elseif $item.message_type eq 3 }-->系统<!--{/if}--></td>
							<!--{if empty($item.from_user_id)}-->
								<td>[1000]系统消息</td>
							<!--{else}-->	
							<td>[<!--{$item.from_user_id}-->]<!--{$item.from_user_pet_name}--></td>
							<!--{/if}-->
							<td>[<!--{$item.user_id}-->]<!--{$item.pet_name}--></td>
							<td><!--{$item.message_content|cutstrCN:0:20}--></td>
							<td><!--{$item.create_date|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
							<td><a href="javascript:showMsgDetail('<!--{ $item.id }-->','<!--{$returnParams}-->', '<!--{$item.message_type}-->')">查看</a></td>
						</tr>
						<!--{foreachelse}-->
						<tr><td colspan="9">没有对应数据</td></tr>
						<!--{/foreach}-->
					</table>
					<div class="operation">
						<button type="button" class="but2font" onClick="batchOperate('index.php?r=User.deletemsg&returnParams=<!--{$returnParams}-->', 'recordId', 'ids', '确定删除？')">删除</button>
						<button type="button" class="but5font" onClick="deletemore('<!--{$returnParams}-->')">按时间删除</button>
					</div>
					<div class="page"><!--{$pager}--></div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script>
function deletemore(returnParams){
	$.popbox({title:"删除消息", content:popstr_search});
	$.ajax({
		type: "get",
		url: "index.php?r=User.delete_more_msg&returnParams="+returnParams,
		cache: false,
		success: function(data){
			$.popbox.setcontent({title:"删除消息", content:data});
		}
	});
}
function delete1(){
	var month = $("#slc_month").val();
	if (confirm("你确定要删除"+$("#slc_month").find("option:selected").text()+"的消息吗？")) {
		$.get("index.php?r=User.delete_more_msg",{type:"months",months:month},function(data){
			var dataObj=eval("("+data+")");
			if (dataObj.status == 1) {
				alert("删除数据成功！");
				window.location.reload();
			}
			if(dataObj.status==2){
				alert("删除失败，在该时间区间内未查询到任何数据！");
			}
			if(dataObj.status==0) {
				alert("删除数据失败！");
			}
		});
	}
}
function delete2(){
	var timefrom = $("#begin_date").val();
		var timeto = $("#end_date").val();
		if(timefrom =="" &&　timeto == ""){
			alert("请选择要删除的日期范围！");
			return false;
		}
		var cfm = "你确定要删除"+timefrom+"到"+timeto+"的消息吗？";
		if(timefrom == ""){
			cfm = "你确定要删除"+timeto+"以前的消息吗？";
		}
		
		if(confirm(cfm)){
			$.get("index.php?r=User.delete_more_msg",{type:"date",from:timefrom,to:timeto},function(data){
				var dataObj=eval("("+data+")");
				if(dataObj.status ==1){
					alert("删除数据成功！");
					window.location.reload();
				}
				if(dataObj.status==2){
					alert("删除失败，在该时间区间内未查询到任何数据！");
				}
				if(dataObj.status == 0){
					alert("删除数据失败！");
				}
			});
		}
}
function showMsgDetail(postId, returnParams, msgType){
	$.popbox({title:"消息内容", content:popstr_search});
	$.ajax({
		type: "GET",
		url: "index.php",
		cache:false,
		data: "r=User.msgdetailajax&id="+postId+"&returnParams="+encodeURIComponent(returnParams),
		success: function(data){
			if(msgType == 2){
				$.popbox.setcontent({title:"系统消息", content:data});
			}else{
				$.popbox.setcontent({title:"会员消息", content:data});
			}
		}
	});
}
</script>
</html>