<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Admin_MessageList.aspx.vb" Inherits="TourEx.Web.Admin_MessageList" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="Css/Style.css"/>
<script language="javascript" src="../Sys/Js/jquery.js"></script>
<script type="text/javascript" src="../Sys/Js/CreateSelect.js"></script>
</head>
<body>
<form runat="server" id="TourExForm">
<ul class="tools">
	<li class="add" p="63"><span><a href="Admin_Message.aspx">添加</a></span></li>
	<li class="save" p="64"><span><a href="javascript:void(0);" onclick="Save(0);return false;">保存</a></span></li>
	<li class="del" p="65"><span><a href="javascript:void(0);" onclick="Del(0);return false;">删除</a></span></li>
</ul>
<div style="display:none"><asp:Label ID="navIgation" runat="server" Text=""></asp:Label></div>
</form>
    <form id="BatchSubmit" name="BatchSubmit" method="post" action="?act=edit" style="display: none">
    </form>
<asp:Repeater ID="Repeater" runat="server">
    <HeaderTemplate>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabBox">
            <tr class="tabTitleMain">
                <td width="65" class="selectAll">
                    <a href="javascript:void(0);" onclick="$('input[name=\'M_ID\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));">全选</a>
                </td>
                <td width="50">对象</td>
                <td>标题</td>
                <td width="100">排序</td>
                <td width="100">操作</td>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr class="tabTextMain" id="From_<%#Eval("M_ID")%>" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#F4F7FA';">
            <td><input name="M_ID" id="M_ID_<%#Eval("M_ID")%>" type="checkbox" value="<%#Eval("M_ID")%>" /></td>
            <td><a href="?UserId=<%#Eval("M_UserId")%>"><%#IIf(Eval("M_UserID") > 1, Eval("U_Name"), "全部会员")%></a></td>
            <td><input id="M_Title_<%#Eval("M_ID")%>" name="M_Title_<%#Eval("M_ID")%>" type="text" value="<%#Eval("M_Title")%>" ovalue="<%#Eval("M_Title")%>" class="formTitle" style="width:200px;"/></td>
            <td>
                <input id="M_OrderID_<%#Eval("M_ID")%>" name="M_OrderID_<%#Eval("M_ID")%>" type="text" value="<%#Eval("M_OrderId")%>" ovalue="<%#Eval("M_OrderId")%>" onkeyup="this.value=this.value.replace(/\D/g,'');" size="6" maxlength="6" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="formTitle"/>
            </td>
            <td width="100">
                <a href="javascript:void(0);" onclick="Save(<%#Eval("M_ID")%>);return false;" p="64">保存</a>
                <a href="Admin_Message.aspx?id=<%#Eval("M_ID")%>" p="64">编辑</a> 
                <a href="javascript:void(0);" onclick="Del(<%#Eval("M_ID")%>);return false;" p="65">删除</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
        <asp:Label ID="lblEmpty" Text="暂无" runat="server" Visible="<%#Boolean.Parse((Repeater.Items.Count = 0).ToString())%>"
            Width="100%" Style="text-align: center">     
        </asp:Label>
    </FooterTemplate>
</asp:Repeater>
<webdiyer:AspNetPager ID="TourExPage" runat="server" UrlPaging="true" ShowPageIndexBox="Never"
    PageIndexBoxType="DropDownList" TextBeforePageIndexBox=""
    PageSize="20" OnPageChanged="BindData" EnableTheming="true" FirstPageText="首页"
    LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" CssClass="page" 
        PagingButtonSpacing="" CurrentPageButtonClass="current" 
    CurrentPageButtonStyle="">
</webdiyer:AspNetPager>
<script type="text/javascript">
 <!--//
 var AP='<%=TourEx.BLL.GetSession("AdminPermissions") %>';
 if(AP!='')
 {
    if(AP.indexOf(',63,')==-1)$('*[p="63"]').remove();
    if(AP.indexOf(',64,')==-1)$('*[p="64"]').remove();
    if(AP.indexOf(',65,')==-1)$('*[p="65"]').remove();
 }

 function Save(ID)
 {
 	var M_IDs=ID==0?$('input[name="M_ID"]'):$('#M_ID_'+ID);
	var M_Title,M_O;
	$('#BatchSubmit').html('');
	for(var i=0;i<M_IDs.length;i++)
	{
		M_Title = $.trim($('#M_Title_'+M_IDs[i].value).val());
		$('#M_Title_'+M_IDs[i].value).val(M_Title);
		if(M_Title==''){alert('请填写标题！');return;}
		M_O=$('#M_OrderID_'+M_IDs[i].value).val();
		if(M_Title!=$('#M_Title_'+M_IDs[i].value).attr('ovalue') || M_O!=$('#M_OrderID_'+M_IDs[i].value).attr('ovalue'))
		{
			M_IDs[i].checked=true;
			$('#From_'+M_IDs[i].value).clone().prependTo("#BatchSubmit");
			$('#M_Title_'+M_IDs[i].value,'#BatchSubmit').val(M_Title);
			$('#M_OrderID_'+M_IDs[i].value,'#BatchSubmit').val(M_O);
		}
	}
 	if($('#BatchSubmit').html()==''){alert('数据没有改动过，无需保存！');return;}
	$('input[name="M_ID"]','#BatchSubmit').attr('checked',true);
	$('#BatchSubmit').submit();
 }
 function Del(ID)
 {
 	var Url='?Act=del&';
	var IDs;
	if(ID>0)
	{
		Url +='M_ID='+ID;
	}else{
 		IDs = $("input[name='M_ID']").serialize().replace(/&M_ID=/g,',');
		if(IDs==''){alert('请选择您要删除的帮助！');return;}
		Url +=IDs;
	}
	if(confirm('您确定删除吗！')){location=Url;}
 }
 
$(function(){
CreateSelect("CategoryList","CategoryId",$('#CategoryId').val() ,3,"选择分类","","MessageCategory","../");
});
//-->
</script>

</body>
</html>
