<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_Message, WebApp_deploy" title="短信息管理" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script src="Js/Function.js" type="text/javascript"></script> 
<script type="text/javascript">
function FControl(ctlName)        
{            
   var rowIndex=document.getElementById(ctlName).selectedIndex;
   
   switch (rowIndex){
      case 1:
         document.getElementById('Sendto').style.display="";
         document.getElementById('SendtoGroup').style.display="none";
         break;
      case 2:
         document.getElementById('Sendto').style.display="none";
         document.getElementById('SendtoGroup').style.display="";
         break;
      default:
         document.getElementById('Sendto').style.display="none";
         document.getElementById('SendtoGroup').style.display="none";
         break;            
   }
}
function SelectUser(ctlName){
    var arr=showModalDialog('Admin_SourceList.aspx?TypeSelect=UserList&DefaultValue='+document.getElementById(ctlName).value,'','dialogWidth:800px; dialogHeight:450px; help: no; scroll: yes; status: no');
    if (arr != null){
       document.getElementById(ctlName).value=arr;
    }
}

function ShowDiv(objid){
    document.getElementById(objid).style.display="";
}
function HiddenDiv(objid){
    document.getElementById(objid).style.display="none";
}
</script>
   
    
    
      <table class="adminheading">
         <tr>
            <th valign="middle" class="inbox"> 短信息管理</th>                  
            <td align="right">              
               <div style="width:75px; text-align:center; cursor:pointer;">
                   <a href="Admin_Message.aspx?action=add">发布短消息</a>
               </div>
             </td> 
             <td class="rtdw"></td>
         </tr>
      </table> 

<asp:Panel ID="panel_List" runat="server">
         <asp:GridView id="GridView1" runat="server" CssClass="adminlist"  OnDataBound="GridView1_DataBound" EnableViewState="false" AutoGenerateColumns="False" DataKeyNames="MessageID" >
                <Columns>
                   <asp:TemplateField>
                       <ItemTemplate>                                        
                          <input name="chk_select" value='<%# Eval("MessageID") %>' type="checkbox" />                                        
                       </ItemTemplate>
                       <HeaderTemplate>
                           <input id="chkAll" onclick="SelectAllCheckboxes(this);" runat="server" type="checkbox" />                                     
                       </HeaderTemplate>
                       <ItemStyle Width="50px" />
                    </asp:TemplateField>                  
                    <asp:BoundField DataField="Sender" SortExpression="Sender" HeaderText="发送人" ItemStyle-Width="100px"/>
                    <asp:BoundField DataField="Receiver" SortExpression="Receiver" HeaderText="收信人" ItemStyle-Width="100px"/>
                    <asp:TemplateField HeaderText="标题" ItemStyle-HorizontalAlign="Left" >
                        <ItemTemplate>
                            <asp:Label ID="Title" runat="server" Text='<%#Eval("Title") %>' style="position:absolute;" class="msg_tit" />
                            <asp:Label ID="Content" runat="server" Text='<%#Eval("Content") %>' onmouseover="return ShowDiv(this.id)" onmouseout="return HiddenDiv(this.id)" style="position:absolute; background-color:#fff; z-index:2; padding:5px; text-align:left; border:1px #ccc solid; width:300px;display:none; height:100px;" />
                        </ItemTemplate>
                    </asp:TemplateField>                
                    <asp:BoundField DataField="SendTime" SortExpression="SendTime" HeaderText="发送时间" ItemStyle-Width="150px"/>
                    <asp:BoundField DataField="IsRead" SortExpression="IsRead" HeaderText="状态" ItemStyle-Width="50px"/>
                    <asp:TemplateField HeaderText="操作" ItemStyle-Width="50px">
                      <ItemTemplate>
                        <asp:LinkButton ID="cl" runat="server" OnCommand="Dele_Message" CommandArgument='<%#Eval("MessageID") %>' OnClientClick="{if(confirm('确定删除吗？')) return true;return false;}" Text="删除"  />
                      </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle HorizontalAlign="Center" height="15" />
                <EmptyDataTemplate>
                    <tr>
                      <th scope="col">编号ID</th><th scope="col">发送人</th><th scope="col">收信人</th><th scope="col">标题</th><th scope="col">内容</th><th scope="col">发送时间</th><th scope="col">已读</th><th scope="col">操作</th>
                    </tr>
                    <tr><td colspan="8">暂无短消息！</td></tr>
                </EmptyDataTemplate>
         </asp:GridView>

        
        <div class="page"><asp:Label ID="PagePanel" runat="server" /></div>
        <div class="div_btm"> 
        <asp:Button ID="DeleteMessageButton" runat="server" Text="批量删除" OnCommand="DeleteMessageButton_Click" CausesValidation="false" OnClientClick="if(confirm('确定删除吗？')) return true; return false;"  />
	</div>
</asp:Panel>

<asp:Panel ID="Panel_Add" Visible="false" runat="server" CssClass="popupControl">

     <table width="100%" class="nick">
        <tr>
             <td class="tit" colspan="2"><strong>发布网站短消息</strong></td> 
         </tr>
         <tr>
             <td class="ltd">选择接收方：</td>
             <td class="rtd">
                <table cellspacing=0 cellpadding=0>
                   <tr>
                      <td>
                         <asp:DropDownList ID="Receiver" runat="server" >
                            <asp:ListItem Text="所有会员" Value="All"/>
                            <asp:ListItem Text="指定会员名" Value="Users" />
                            <asp:ListItem Text="指定会员组" Value="Group" />
                         </asp:DropDownList>
                      </td>
                      <td>
                         <div id="Sendto" style="display:none">
                             <asp:TextBox ID="SendName" runat="server" Width="200px" />
                           <a href="javascript:void(0)" id="ShowUser" runat="server">[会员列表]</a> 
                         </div>
                         <div id="SendtoGroup" style="display:none">
                             <asp:CheckBoxList ID="SendGroup" runat="server" DataTextField="GroupName" DataValueField="GroupID" RepeatDirection="Horizontal" RepeatColumns="3" />
                         </div> 
                      </td>
                   </tr>
                </table> 
             </td>
          </tr>
          <tr>
             <td class="ltd">消息发送人：</td>
             <td class="rtd">
                <asp:TextBox ID="Sender" runat="server"/>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                   ErrorMessage="请填写发送人" ControlToValidate="Sender"/> 
             </td>
         </tr>
         <tr>
             <td  class="ltd">短消息标题：</td>
             <td  class="rtd">
                 <asp:TextBox ID="mtitle"  runat="server" Width="250" />
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                   ErrorMessage="请输入消息标题" ControlToValidate="mtitle"/>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                   ErrorMessage="请填写内容" ControlToValidate="Content"/> 
             </td>
         </tr>
         <tr>
             <td  class="ltd">短消息内容：</td>
             <td  class="rtd">                        
             <asp:TextBox ID="Content" runat="server" TextMode="MultiLine" Height="200px" Width="400px"/></td>
         </tr>                    
         <tr>
            <td colspan="2" class="btm">
               <asp:Button ID="LinkButton1" runat="server" CausesValidation="True" OnCommand="Add_OnClick" Text="发 布"/>
               <input type="button" onclick="location.href='Admin_Message.aspx'" value="返 回" />
            </td>
         </tr>                  
     </table>

  </asp:Panel>


</asp:Content>