<form action="" method="get" name="search" id="search"  onsubmit="return ajax_list();" >
<input type="hidden" name="action" id="action" value="message_list" />
<input type="hidden" name="uid" id="uid" value="<tpl> $uid </tpl>" />
<table  class="from_table">
	<tr>
		<th width="77"><tpl> $langSysSpaceSelectType </tpl>：</th>
		<td width="360">
			<select style=" *vertical-align:-3px;" name="search_type" id="search_type">
				<option value=""><tpl> $langSysSpaceNoType </tpl></option>			
				<option value="send" <tpl> if $condition.search_type eq 'send' </tpl> selected <tpl> /if </tpl> ><tpl> $langSysSpaceMessageSend </tpl></option>
				<option value="receive" <tpl> if $condition.search_type eq 'receive' </tpl> selected <tpl> /if </tpl> ><tpl> $langSysSpaceMessageReceive </tpl></option>
			</select>		
			<input type="text" name="keywords" id="keywords"  class="txtinput_short" value="<tpl> $condition.keywords </tpl>" />			
		</td> 
	</tr>
	<tr>
		<th style=" height:35px"></th>
		<td height="50">	
			<span class="btn_left"><input type="submit" name="submit"  class="btn_submit" value="<tpl> $langSysSearch </tpl>" /></span>
			<span class="btn_left"><input type="reset" name="reset"  class="btn_submit" value="<tpl> $langSpaceReset </tpl>" /></span>
		</td>
		</tr>
	
</table>
</form>
<tpl> if $message_array[0].messageid neq '' </tpl>
<form action="javascript:void(null);" id="messagelist" name="messagelist" method="post">
	<table  width="680" class="from_table2">
		<tr class="supplylist">
			<th width="50" align="left" style="text-align:left"><tpl> $langSysSpaceSelect </tpl></th>
			<th width="100" align="left" style="text-align:left"><tpl> $langSysSpaceState </tpl></th>
			<th width="230" align="left" style="text-align:left"><tpl> $langSysSpaceMessageContent </tpl></th>
			<th width="150" align="left" style="text-align:left"><tpl> $langSysSpaceSendDate </tpl></th>
			<th width="80" align="left" style="text-align:left"><tpl> $langCOperation </tpl></th>			
		</tr>
		<div id="liststylealignleft">
		<tpl> section name=i loop=$message_array </tpl>
		<tr>
			<td width="50" ><input type="checkbox" name="messageid[]" value="<tpl> $message_array[i].messageid </tpl>" /></td>
			<td class="supplylist" width="130">
				<tpl> if $message_array[i].send eq $uid </tpl>
					<tpl> $langSysSpaceMessageSend </tpl>
				<tpl> else </tpl>
					<tpl> $langSysSpaceMessageReceive </tpl>
				<tpl> /if </tpl>
			</td>
		  <td class="supplylist" width="100"><a href="javascript:void(null);" onclick="ajax_view( 'action=view_message&messageid=<tpl> $message_array[i].messageid </tpl>&uid=<tpl> $uid </tpl>' )"><tpl> $message_array[i].subject </tpl></a></td>
		  <td><tpl> $message_array[i].dateline </tpl></td>
		  <td><a href="javascript:void(null);" onclick="ajax_view( 'action=view_message&messageid=<tpl> $message_array[i].messageid </tpl>&uid=<tpl> $uid </tpl>' )"><tpl> $langSpaceBlogView </tpl></a></td>
		</tr>
		<tpl> /section </tpl>
		</div>
		<tr>
			<td colspan="10">  
				<span class="btn_left"><input type="button" value="<tpl> $langSupplyControlSel </tpl>" id="control_seclect" name="control_seclect" class="btn_submit" /> </span>
				<span class="btn_left"> <input type="button" value="<tpl> $errSpaceDel </tpl>" id="comment_del" name="comment_del"  class="btn_submit" /></span>			
				<span class="btn_left"> <input type="button" value="<tpl> $langSysSpaceBack </tpl>" id="back" name="back"  class="btn_submit"  onclick="ajax_list_back( 'action=ajax_list' )"/></span>			
				<span class="btn_marginright"><tpl> $page_list </tpl></span>
			</td>
		</tr>
  </table>
</form>
<tpl> else </tpl>
  <div class="table-5-bottom"><div class="p-left"><span style="float:left; padding-right:2px; padding-top:7px;"><tpl> $langSysCNoThing </tpl></span>
   <span class="btn_left"> <input type="button" value="<tpl> $langSysSpaceClickBack </tpl>" class="btn_submit"  onclick="ajax_list_back( 'action=ajax_list' )"/></span>	
  </div></div>
<tpl> /if </tpl>
<div id="question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langCConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div> 
<script language="javascript">
var question = $('#question')[0];
$(document).ready(function() {
	//控制选择
	$('#control_seclect').click(
		function(){
			$('#messagelist input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	)
	
	var options = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
						if(msg.type == '1'){
							ShowDiv = "result_content";
							getPageContent("../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=message_list&keywords=<tpl> $condition.keywords </tpl>&search_type=<tpl> $condition.search_type </tpl><tpl>if $space_array|@count neq 1</tpl>&curpage=<tpl> $curpage</tpl><tpl>/if</tpl>");
						}
					},
		type:      'post',
		dataType:  'json'
	};
	$("#comment_del").click(function(){
		$.blockUI(question, { width: '275px' });
	});
	
	$('#yes').click(function() {
		$.unblockUI();
		$('#messagelist').attr("action", "../app/<tpl> $app_module.app_module_sign </tpl>/system.php?action=del_message");
		$('#messagelist').ajaxSubmit(options);
	});
	$('#no').click($.unblockUI);
});
//搜索
function ajax_list(){
	/*取表单参数*/
	var queryString=$("#search").formSerialize();
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: queryString,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideMessage();
			$("#result_content").html(msg);
			hideLoading();
		}
	});
	return false;
}
//查看
function ajax_view ( str ) {
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: str,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;		
}
//返回空间列表
function ajax_list_back ( str ) {
	$.ajax({
		url: "../app/<tpl> $app_module.app_module_sign </tpl>/system.php",
		data: str,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			$('#result_content').html(msg);
		}
	});
	return false;	
}
</script>