<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="SysTemplateEdit.aspx.cs" Inherits="OAWeb.Sys.SysTemplateEdit" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlace" runat="server">
    <script src="/js/jquery.form.js" type="text/javascript"></script>
    <div class="page_main">
        <div class="page_content">
            <table cellpadding="0" cellspacing="0" border="0" class="table_form">
                <tr>
                    <td class="title">
                        <em style="float: left">
                            <img src="/images/08.gif" />
                        </em>
                        <h1>
                            模板定制
                        </h1>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="form_submit">
                            <table cellpadding="0" cellspacing="1" border="0" class="table_form2">
                                <tr>
                                    <td class="data_title2 ">
                                        <span class="red">1.标签使用说明：</span> <span class="tip01">把光标移动到要添加标签的位置，点击要添加的标签，如果控件存在样式则把"样式名"修改为指定的样式名称,<br />
                                            事例： &lt;span&gt;<{密码控件,red}>&lt;/span&gt;前台显示为&lt;span&gt;&lt;input name="txtPassword"
                                            type="password" class="red" /&gt;"&lt;/span&gt;</span><br />
                                        <span class="red">2.注意事项：</span> <span class="tip01">模板自带的脚本必须存在，控件必须放在form中</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="data_title2">
                                        <asp:PlaceHolder ID="pnlSearch" runat="server">模板类型：<asp:DropDownList ID="ddlTemplateType"
                                            runat="server">
                                            <asp:ListItem Value="user">会员模板</asp:ListItem>
                                            <asp:ListItem Value="agent">经销商模板</asp:ListItem>
                                            <asp:ListItem Value="sys" Selected="True">系统模板</asp:ListItem>
                                        </asp:DropDownList>
                                            <asp:DropDownList ID="dllTemplateCode" runat="server">
                                                <asp:ListItem Value="login" Selected="True">登录页</asp:ListItem>
                                                <asp:ListItem Value="register">注册页</asp:ListItem>
                                                <asp:ListItem Value="PageTop">内页头部</asp:ListItem>
                                                <asp:ListItem Value="PageFoot">内页尾部</asp:ListItem>
                                            </asp:DropDownList>
                                        </asp:PlaceHolder>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="data_title2">
                                        表单标签：<span class="insert_tags"><%=LoadTagData() %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtHtml" runat="server" TextMode="MultiLine" Width="99%" CssClass=" width400 "
                                            Height="400px"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                                        <input id="btnImgSave" type="button" value=" 模板图片 " class="btn_77px" />
                                        <input id="btnCssSave" type="button" value=" 模板样式 " class="btn_77px" />
                                        <input id="btnInitSave" type="button" value=" 初始化 " class="btn_77px" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            function Search() {
                window.location.href = "?<%=ddlTemplateType.UniqueID %>=" + $("#<%=ddlTemplateType.ClientID %>").val()
                + "&<%=dllTemplateCode.UniqueID %>=" + $("#<%=dllTemplateCode.ClientID %>").val();
            }
            $("#<%=ddlTemplateType.ClientID %>").change(function () {
                Search();
            })
            $("#<%=dllTemplateCode.ClientID %>").change(function () {
                Search();
            })
            $(".field_tags").live("click", function () {
                var txt = document.getElementById("<%=txtHtml.ClientID %>");
                insertAtCursor(txt, $(this).attr("t"));
            })
            $("#btnSave").click(function () {
                FormPostAjax("/Sys/SysTemplateEdit.aspx?op=Save&r=" + Math.random(), "ok", function () { window.location.href = window.location.href; });
                return false;
            })
            $("#btnImgSave").click(function () {
                var q = "?r=" + Math.random();
                q += "&t=" + $("#<%=ddlTemplateType.ClientID %>").val();
                return OpenDialog('/Sys/SysTemplatePicList.aspx' + q, '模板图片');
            })
            $("#btnCssSave").click(function () {
                var q = "?r=" + Math.random();
                q += "&t=" + $("#<%=ddlTemplateType.ClientID %>").val();
                q += "&c=" + $("#<%=dllTemplateCode.ClientID %>").val();
                return OpenDialog('/Sys/SysTemplateCssEdit.aspx' + q, '模板样式');
            })
            $("#btnInitSave").click(function () {
                FormPostAjax("/Sys/SysTemplateEdit.aspx?op=Init&r=" + Math.random(), "ok", function () { window.location.href = window.location.href; });
            })
        })
    </script>
</asp:Content>
