<%@ page language="C#" autoeventwireup="true" inherits="V5Shop.Admin.Email_EmailContent_Operate, V5Shop.Shop.Config" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="control/PageBottom.ascx" TagName="PageBottom" TagPrefix="uc1" %>
<%@ Register Assembly="V5Shop.Control" Namespace="V5Shop.Control" TagPrefix="cc1" %>
<!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>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <link href="css/css_list.css" rel="stylesheet" type="text/css" />
    <link href="css/control.css" rel="stylesheet" type="text/css" />

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

    <script type="text/javascript" src="editor/fckeditor.js"></script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="OperateTitle">
            <div>
                <asp:Label ID="lblAdd" runat="server" Text="【 邮件内容添加 】"></asp:Label>
                <asp:Label ID="lblEdit" runat="server" Text="【 邮件内容编辑 】" Visible="false"></asp:Label>
                <a href="Email_EmailContent_Manage.aspx" title="返回邮件内容列表">返回列表</a>
            </div>
        </div>
        <div>
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" id="OperateTable">
                <tr>
                    <td align="right" bgcolor="#FFFFFF" style="height: 30px; width: 20%;">
                        <asp:Label ID="lblCategoryID" runat="server" Text="邮件类别："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left" style="height: 30px">
                        &nbsp;<asp:DropDownList ID="ddlCategoryID" runat="server" Width="150px">
                        </asp:DropDownList><span class="NeedMsg">*</span>&nbsp;
                        <asp:Button ID="btnManage" runat="server" CssClass="button" Text="管理" CausesValidation="False"
                            OnClick="btnManage_Click" /></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#FFFFFF" style="height: 30px; width: 20%;">
                        <asp:Label ID="lblTitle" runat="server" Text="邮件标题："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left" style="height: 30px">
                        <asp:TextBox ID="txtTitle" runat="server" MaxLength="150" Width="300px"></asp:TextBox>
                        <span class="NeedMsg">*</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtTitle"
                            runat="server" ErrorMessage="不能为空"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#FFFFFF" style="height: 30px; width: 20%;">
                        <cc1:HelpCtrl ID="HelpCtrl1" runat="server" FontColor="red" Header="邮件变量" ImageURL="images/help.gif"
                            Text="系统内置可自动识别的变量。如{user.Name}在邮件发送时会被自动替换为会员名称。注意：群发邮件暂不支持邮件变量，请勿修改变量格式，以免影响发送。" />
                        <asp:Label ID="lblTemplate" runat="server" Text="变量："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left" style="height: 30px" id="tdEmailVariableTable"
                        runat="server">
                        <input type="button" value="邮件常量" name="cc" id="cc" class="button" onClick="OpenDialogEmail('Email_EmailContent_Operate_Dialog.aspx?tabid=0',650,550)"/>
                    </td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#FFFFFF" style="height: 48px; width: 20%;">
                        <asp:Label ID="lblDescription" runat="server" Text="描述："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left" style="height: 48px">
                        <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Width="300px" Height="60px"></asp:TextBox>
                        <span class="NeedMsg">*</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="txtDescription"
                            runat="server" ErrorMessage="不能为空"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td width="20%" height="30" align="right" bgcolor="#FFFFFF">
                        <asp:Label ID="lblContent" runat="server" Text="邮件内容："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left">
                        <cc1:FCKeditor ID="FCKeditor1" runat="server" width="600px"></cc1:FCKeditor></td>
                </tr>
                <tr>
                    <td width="20%" height="30" align="right" bgcolor="#FFFFFF">
                        <asp:Label ID="lblIsAct" runat="server" Text="是否启用："></asp:Label>
                    </td>
                    <td bgcolor="#FFFFFF" align="left">
                        <input id="cbIsAct" type="checkbox" runat="server" name="cbIsAct" value="1" class="checkbox" /></td>
                </tr>
                <tr>
                    <td align="right" bgcolor="#FFFFFF" style="width: 20%; height: 30px;">
                    </td>
                    <td bgcolor="#FFFFFF" align="left" style="height: 30px">
                        <asp:Button ID="btnAdd" runat="server" Text="确定" OnClick="btnAdd_Click" meta:resourcekey="btnAddResource1"
                            CssClass="button" />
                        <asp:Button ID="btnEdit" runat="server" Text="更新" OnClick="btnEdit_Click" Visible="False"
                            meta:resourcekey="btnEditResource1" CssClass="button" />
                        <input id="iptReset" runat="server" type="reset" value="重置" class="button" />
                        <input id="btnReturn" runat="server" type="button" value="返回列表" onclick="window.location.href='Email_EmailContent_Manage.aspx'"
                            class="button" />
                    </td>
                </tr>
            </table>

            <script type="text/javascript">
            //加TABLE样式
            InitTrClass();
           //打开标签选择对话框
            function OpenDialogEmail(url, w, h){
                if (navigator.appVersion.indexOf("MSIE") == -1){
                    this.returnAction=function(strResult){
                        if(strResult!=null){
                            var oEditor = FCKeditorAPI.GetInstance('FCKeditor1'); 
                            oEditor.InsertHtml(strResult) 
                        }
                    }
                    window.open(url + '&d=' + Date(),'newWin','modal=yes,width='+w+',height='+h+',top=200,left=300,resizable=no,scrollbars=no');
                    return;
                }else{
                    var GetValue = showModalDialog(url + '&d=' + Date(), null, 'dialogWidth:'+w+'px; dialogHeight:'+h+'px;');
                    if (GetValue != null) {
                        var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
                        if(GetValue.indexOf("###") != -1){
                            var htmltext = oEditor.EditorDocument.selection.createRange().htmlText;
                            if(typeof(htmltext) != "undefined" && htmltext != "")
                                oEditor.InsertHtml(GetValue.replace("###", htmltext));
                        }else{
                            oEditor.InsertHtml(GetValue);
                        }
                    } 
                }
            }
            </script>

        </div>
    </form>
    <uc1:PageBottom ID="PageBottom1" runat="server" />
</body>
</html>
