<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="smstemplateedit.aspx.cs" Inherits="FangPage.Admin.smstemplateedit" %>

<%@ Register Assembly="FangPage.Control" Namespace="FangPage.Control" TagPrefix="cc1" %>
<%@ Register TagPrefix="uc1" TagName="TextareaResize" Src="UserControls/TextareaResize.ascx" %>
<!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 id="Head1" runat="server">
    <title>编辑短信模板</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="styles/style.css" type="text/css" rel="stylesheet" />
    <style type="text/css">
     body{
            background-image: url(images/main_bg.gif);
            background-repeat: repeat-x;
            background-color: #CEE7FC;
        }
     </style>
    <meta content="MSHTML 6.00.3790.0" name="GENERATOR" />

    <script language="javascript" type="text/javascript" src="js/main.js"></script>

</head>
<body leftmargin="5" topmargin="5" rightmargin="5" bottommargin="5">
    <form id="Form1" runat="server">
    <table class="TdBg" cellspacing="1" cellpadding="0" width="100%" border="0">
        <tbody>
            <tr valign="middle">
                <td class="Tdimg" style="padding-left: 10px" height="28" colspan="2">
                    <img height="18" src="images/bbs_find.gif" width="18" align="absMiddle" border="0">
                    <strong>编辑短信模板</strong>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    模板名称：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:TextBox ID="templatename" runat="server" Width="300"></cc1:TextBox>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    接收对象：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <input type="radio" name="sendtype" onclick="changelayer('custom');" <%if(sendtype==0){%> checked="checked" <%} %> value="0" />&nbsp;自定义&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="sendtype" onclick="changelayer('user');" <%if(sendtype==1){%> checked="checked" <%} %> value="1" />&nbsp;用户&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="sendtype" onclick="changelayer('usergroup');" <%if(sendtype==2){%> checked="checked" <%} %> value="2" />&nbsp;用户组
                </td>
            </tr>
            <tr class="TdBgL" id="custom">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    接收短信手机号码：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:TextBox ID="customlist" runat="server" CanBeNull="可为空" RequiredFieldType="暂无校验" Width="400" Height="40" TextMode="MultiLine"></cc1:TextBox>多个手机号码以分号(;)进行分割
                </td>
            </tr>
            <tr class="TdBgL" id="user" style="display: none">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    接收短信用户名称：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:TextBox ID="usernamelist" runat="server" CanBeNull="可为空" RequiredFieldType="暂无校验" Width="400" Height="40" TextMode="MultiLine"></cc1:TextBox>多个用户以分号(;)进行分割
                </td>
            </tr>
            <tr class="TdBgL" id="usergroup1" style="display: none">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    接收短信的用户组：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:SmartTreeView ID="TreeView1" runat="server" ShowLines="True" 
                    AllowCascadeCheckbox="True">
                </cc1:SmartTreeView>
                </td>
            </tr>
            <tr class="TdBgL" id="usergroup2" style="display: none">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    导出用户手机号码：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <input type="hidden" name="flag" id="flag" /><a href = "#" onclick="document.getElementById('flag').value=1;Form1.submit()">导出所有选中用户组用户的手机号码</a>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    短信内容：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px;
                    height: 200px;" align="center">
                    <textarea id="Content" name="Content" runat="server" style="height: 200px; width: 99%;"></textarea>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 150px;" height="22" align="right">
                    状态：
                </td>
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                    <cc1:RadioButtonList ID="status" runat="server" RepeatColumns="2">
                        <asp:ListItem Value="1" Selected="True">启用</asp:ListItem>
                        <asp:ListItem Value="0" >未启用</asp:ListItem>
                    </cc1:RadioButtonList>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 10px; width: 150px;" height="35" align="right">
                    &nbsp;
                </td>
                <td style="padding-left: 10px;">
                    <cc1:Button ID="Button1" runat="server" Text="保 存" OnClick="Button1_Click" />&nbsp;&nbsp;
                    <button class="ManagerButton" type="button" onclick="javascript:window.location.href='smstemplates.aspx';">
                        <img src="images/arrow_undo.gif" />返 回</button>
                </td>
            </tr>
        </tbody>
    </table>
   <script type="text/javascript">
        function changelayer(objectname)
        {
            if(objectname == "user")
            {
                document.getElementById("user").style.display = 'block';
                document.getElementById("usernamelist").focus();
                document.getElementById("usergroup1").style.display = 'none';
                document.getElementById("usergroup2").style.display = 'none';
                document.getElementById("custom").style.display = 'none';
            }
            else if(objectname == "usergroup")
            {
                document.getElementById("usergroup1").style.display = 'block';
                document.getElementById("usergroup2").style.display = 'block';
                document.getElementById("user").style.display = 'none';
                document.getElementById("custom").style.display = 'none';
            }
            else
            {
                document.getElementById("custom").style.display = 'block';
                document.getElementById("customlist").focus();
                document.getElementById("user").style.display = 'none';
                document.getElementById("usergroup1").style.display = 'none';
                document.getElementById("usergroup2").style.display = 'none';
            }
        }
        
        function changeonlayer(objectname)
        {
            if(objectname == "1")
            {
                document.getElementById("custom")
                changelayer("user");
            }
            else if(objectname == "2")
            {
                changelayer("usergroup");
            }
            else
            {
                changelayer("custom");
                
            }
        }
        
        changeonlayer(<%=sendtype%>);
        
    </script>
    </form>
</body>
</html>