<%@ page language="C#" masterpagefile="~/HL_Admin/AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_Email, HoWaveIMSV5.0" title="邮件列表管理" validaterequest="false" %>
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="ftb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<div style="width:100%">
<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:600px; dialogHeight:300px; help: yes; scroll: yes; status: no');      
      break;
  }   
}
</script>
<fieldset style="width:100%; margin:5px;">
   <legend>发送邮件管理</legend>
   <div style="width:100%"><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>
   <div style="width:100%">
      <asp:Panel ID="Sendlist" runat="server" Width="100%" EnableViewState="false">
         <div class="Messagebox">
           <div class="MessageboxTitle">邮件列表</div>
           <div class="MessageboxContent">
             <table width="100%" border="0">            
              <tr>
               <td width="20%" align="right">收件人选择：</td>
               <td align="left">
                  <asp:RadioButtonList ID="SendtoSelect" runat="server" RepeatDirection="Horizontal" EnableViewState="true">
                    <asp:ListItem Text="所有会员" Value="all" />
                    <asp:ListItem Text="指定会员组" Value="group" />
                    <asp:ListItem Text="指定会员名" Value="username" />
                    <asp:ListItem Text="指定Email" Value="email" />
                  </asp:RadioButtonList><br />
                  <div id="select_1" style="display:none;">
                     <asp:CheckBoxList ID="SendGroup" runat="server" RepeatDirection="Horizontal" RepeatColumns="3"  EnableViewState="true">
                       <asp:ListItem Text="未验证用户" Value="0"/>
                       <asp:ListItem Text="注册会员" Value="1"/>
                       <asp:ListItem Text="VIP会员" Value="2"/>
                       <asp:ListItem Text="商业客户" Value="3"/>
                       <asp:ListItem Text="代理商" Value="4"/>                                     
                       <asp:ListItem Text="公司职员" Value="5"/>
                     </asp:CheckBoxList>
                  </div>
                  <div id="select_2" style="display:none;"><asp:TextBox ID="SendUserList" runat="server" Width="300px" /><=【<a id="ShowUserList" href="javascript:void(0)" runat="server">用户列表</a>】</div>
                  <div id="select_3" style="display:none;"><asp:TextBox ID="SendEmailList" runat="server" Width="300px" />多个Email间请用<span style="color:Red">英文逗号隔开</span></div>
               </td>
            </tr>
            <tr>
               <td align="right">邮件主题：</td>
               <td align="left"><asp:TextBox ID="EmailTitle" runat="server" Width="300px" />
                   <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请填写邮件主题" ControlToValidate="EmailTitle" /></td>
            </tr>
             <tr>
               <td align="right">邮件内容：</td>
               <td align="left"><ftb:freetextbox id="EmailContent" runat="server" width="550px" Height="300px"></ftb:freetextbox>
                   <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请填写邮件内容" ControlToValidate="EmailContent" /></td>
            </tr>
             <tr>
               <td align="right">发件人：</td>
               <td align="left"><asp:TextBox ID="EmailSender" runat="server"  Text="恒浪网络"/>
                   <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="请填写发件人" ControlToValidate="EmailSender" /></td>
            </tr>
             <tr>
               <td align="right">发件人Email：</td>
               <td align="left"><asp:TextBox ID="SenderEmailAddress" runat="server"  Text="info@howave.net"/>
                   <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="请填写发件人EMAIL" ControlToValidate="SenderEmailAddress"/></td>
            </tr>
            <tr>
               <td  colspan="2" align="center"><asp:Button ID="SendEmailButton" runat="server" Text="发送" OnClick="SendEmailButton_Click" /></td>
               
            </tr>
         </table>
         </div>
         <div style="text-align:left;">
            注意：发送邮件前请先确认已经设置了邮件发送的配置，否则不能发送成功-----><a href="admin_Config.aspx">现在去设置邮件发送配置</a>
         </div>
        </div> 
         
      </asp:Panel>
   </div>
   <asp:Panel ID="MailList" runat="server" Width="100%" EnableViewState="false">
      <div class="Messagebox">
         <div class="MessageboxTitle">邮件列表批量导出文本</div>
         <div class="MessageboxContent">
            <table  style="width:100%;">
               <tr>
                  <td style="text-align: right; width: 267px;">
                      邮件列表导出到文本：</td>
                  <td style="width: 155px">
                      导出
                      <asp:DropDownList ID="Group" runat="server" AppendDataBoundItems="True" DataSourceID="ObjectDataSource1" DataTextField="GroupName" DataValueField="GroupType"  EnableViewState="true">
                         <asp:ListItem Text="全部会员" Value="all" />
                         
                      </asp:DropDownList></td>
                  <td style="text-align: left">到<asp:TextBox ID="MailTxtName" runat="server" Text="maillist.txt"  Width="200px"/>
                      <asp:Button ID="Button1" runat="server" Text="开始" OnClick="Button1_Click" /></td>
               </tr>
            </table>
         </div>
      </div>   
   </asp:Panel>  
   <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="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>
    <asp:Panel ID="SearchEmail" runat="server" Width="100%" Visible="false">
      <div class="Messagebox">
         <div class="MessageboxTitle">查找用户资料</div>
         <div class="MessageboxContent">
             查找:<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" />
             <br /><br />
             <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>
            
         </div>
        </div>  
   </asp:Panel>
</fieldset>  
</div>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetGroups"  TypeName="GroupBLL"/>
<script type="text/javascript" language="javascript">
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='+document.getElementById(ctlName).value,'','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');
    if (arr != null){
       document.getElementById(ctlName).value=arr;
    }
}
</script>
</asp:Content>

