<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_Email, mallz" title="邮件列表管理" validaterequest="false" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
<script type="text/javascript">
function Show(id,action){
  var recdata=false;
  switch (action){     
      case "Show":
      recdata=showModalDialog('Admin_AddPassport.aspx?Action=Show&UserID='+id,'','dialogWidth:800px; dialogHeight:450px; help: yes; scroll: yes; status: no');      
      break;
  }   
}
function SelectSendType(ctlname){
  for(var i=1;i<4;i++){
    if((document.getElementById(ctlname+"_"+i)).checked){
     document.getElementById("select_"+i).style.display="";
    }
    else{
     document.getElementById("select_"+i).style.display="none";
    }
  }
}
function SelectUser(ctlName){
    var arr=showModalDialog('Admin_SourceList.aspx?TypeSelect=UserList&DefaultValue='+escape(document.getElementById(ctlName).value),'','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');
    if (arr != null){
       document.getElementById(ctlName).value=arr;
    }
}
</script>

<table class="adminheading">
    <tr>
        <th valign="middle" class="massemail"  align="left">发送邮件管理</th>                  
        <td align="right">
            <div style="width:400px"><a href="Admin_Email.aspx">发送邮件列表</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="Admin_Email.aspx?Action=Export">导出邮件列表</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="Admin_Email.aspx?Action=SearchEmail">查找</a></div>
        </td>
        <td class="rtdw"></td> 
    </tr>
 </table> 
 
    

<table class="nick" ID="Sendlist" runat="server" cellspacing="1" cellpadding="1" width="100%" border="0">
    <tbody>
        <tr>
            <td class="tit" colspan="2"><strong>邮件列表</strong></td>
        </tr>
        <tr>
            <td class="ltd">
                <div style="WIDTH: 90px">收件人选择：</div>
            </td>
            <td class="rtd">
                <asp:RadioButtonList id="SendtoSelect" runat="server" EnableViewState="true" RepeatDirection="Horizontal">
                    <asp:ListItem Text="所有会员" Value="all" />
                    <asp:ListItem Text="指定会员组" Value="group" />
                    <asp:ListItem Text="指定会员名" Value="username" />
                    <asp:ListItem Text="指定Email" Value="email" />
                </asp:RadioButtonList>
                <div style="DISPLAY: none" id="select_1">
                    <asp:CheckBoxList ID="SendGroup" runat="server" DataTextField="GroupName" DataValueField="GroupID" EnableViewState="true" RepeatDirection="Horizontal" RepeatColumns="3">
                    </asp:CheckBoxList>
                </div>
                <div style="DISPLAY: none" id="select_2">
                    <asp:TextBox id="SendUserList" runat="server" Width="300px"/>&lt;=【<a id="ShowUserList" href="javascript:void(0)" runat="server">用户列表</a>】
                </div>
                <div style="DISPLAY: none" id="select_3">
                    <asp:TextBox id="SendEmailList" runat="server" Width="300px"/>多个Email间请用<span style="COLOR: red">英文逗号隔开</span>
                </div>
            </td>
        </tr>
        <tr>
            <td class="ltd">邮件主题：</td>
            <td class="rtd"><asp:TextBox id="EmailTitle" runat="server" Width="300px"/> 
            <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="请填写邮件主题" ControlToValidate="EmailTitle"/>
            </td>
        </tr>
        <tr>
            <td class="ltd">邮件内容：</td>
            <td class="rtd">
            <asp:TextBox ID="EmailContent" runat="server" style="display:none;" />
            <iframe src="../Editor/Editor.aspx?ID=ctl00_ContentPlaceHolder1_EmailContent" height="300" width="100%" frameborder="0"></iframe>
            </td>
        </tr>
        <tr>
            <td class="ltd">发件人：</td>
            <td class="rtd">
                <asp:TextBox id="EmailSender" runat="server" />
                <asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="请填写发件人" ControlToValidate="EmailSender"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="ltd">发件人Email：</td>
            <td class="rtd">
                <asp:TextBox id="SenderEmailAddress" runat="server"  Text="info@mall-z.com"/> 
                <asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server" ErrorMessage="请填写发件人EMAIL" ControlToValidate="SenderEmailAddress"/>
            </td>
        </tr>
        <tr><td colspan="2" class="btm">
        <asp:Button id="SendEmailButton" onclick="SendEmailButton_Click" runat="server" Text="发 送" /><br />
        <div style="margin-top:10px; WORD-SPACING: 2px; LINE-HEIGHT: 15px; TEXT-ALIGN: center">注意：发送邮件前请先确认已经设置了邮件发送的配置，否则不能发送成功 —&gt; <a href="admin_Config.aspx?id=3">设置邮件配置</a> </div>
        </td></tr>
    </tbody>
</table>

<asp:Panel id="SendResult" runat="server" Width="100%" Visible="false">
      <div class="Messagebox">
         <div class="MessageboxTitle">邮件发送结果</div>
         <div class="MessageboxContent">
            一共发送邮件<asp:literal runat="server"  ID="Emailtotalsend"/>封<br />
            <div style="text-align:left; overflow:scroll;">
               <asp:literal runat="server" ID="EmailSuccess" /><br />
               <asp:Literal runat="server" ID="EmailSuccessList" /><br />
               <asp:literal runat="server" ID="EmailFail" /><br />
               <asp:Literal runat="server" ID="EmailFailList" />
            </div>    
         </div>
      </div>  
</asp:Panel> 



   <table ID="MailList" runat="server" class="nick">
                <tr>
                    <td class="tit" colspan="2">
                        <strong>邮件列表批量导出文本</strong>
                    </td>
                </tr>
                <tr>
                    <td class="ltd"><div style="width:120px; padding-top:5px;">邮件列表导出到文本：</div></td>
                    <td class="rtd">                     
                      <asp:ListBox ID="Group" Width="200px" SelectionMode="Multiple" runat="server"  DataTextField="GroupName" DataValueField="GroupID" >
                      </asp:ListBox>
                      <asp:Button ID="Button1" runat="server" Text="开始下载" OnClick="Button1_Click" />
                    </td>
               </tr>
    </table>

    
   <asp:Panel ID="ShowResult" runat="server" Width="100%" Visible="false" EnableViewState="false">
      <div class="Messagebox">
         <div class="MessageboxTitle">邮件列表导出结果</div>
         <div class="MessageboxContent">
           <asp:literal runat="server" ID="result" />
           <asp:HyperLink ID="txtUrl" runat="server" />
         </div>
        </div>  
   </asp:Panel>
   
    <asp:Panel ID="SearchEmail" runat="server" Width="100%" Visible="false">
      <table class="nick">
	<tr><td colspan="2" class="tit">查找用户资料</td></tr>
	<tr><td class="ltd">查找:</td>
	    <td class="rtd"><asp:TextBox ID="SearchKey" runat="server" />
             <asp:DropDownList ID="SearchType" runat="server">
                <asp:ListItem Text="请选择查找的类型" Value="-1" />
                <asp:ListItem Text="按用户名查找" Value="UserName" />
                <asp:ListItem Text="按邮箱地址查找" Value="Email" />                
             </asp:DropDownList>
             <asp:Button ID="SearchEmailButton" runat="server" Text="开始查找" OnClick="SearchEmailButton_Click" />
            </td>
	</tr>
        <tr><td colspan="2">
             <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="adminlist">
                 <Columns>
                     <asp:BoundField DataField="UserId" HeaderText="ID" />
                     <asp:BoundField DataField="UserName" HeaderText="用户名" />
                     <asp:BoundField DataField="Email" HeaderText="Email" />
                     <asp:TemplateField HeaderText="详细资料">
                        <ItemTemplate>
                          <a href="javascript:void(0)" onclick=<%# "Show("+Eval("UserID")+",'Show')" %>  runat="server">详细资料</a>
                        </ItemTemplate>
                       
                     </asp:TemplateField>
                 </Columns>
             </asp:GridView>
            </td></tr>
	</table>  
   </asp:Panel>

<table class="adminlist"></table>  

</asp:Content>

