<%@ page language="C#" autoeventwireup="true" inherits="ims.wxadmin, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="wxadmin">
<head runat="server">
    <title>微信设置</title><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width,initial-scale=1">
    <script src="js/comm.js"></script><script src="js/wxadmin.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s1" runat="server" OnAsyncPostBackError="AsyncError">
        <CompositeScript Path="js/msajax.js" ScriptMode="Release">
            <Scripts>
                <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" /><asp:ScriptReference Name="MicrosoftAjax.js" /><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" />
            </Scripts>
        </CompositeScript>
    </asp:ScriptManager>
    <div id="tabs" class="ui-tabs nobg noborder">
        <ul>
            <li><a href="#qys">微信应用</a></li>
            <li><a href="#autoreply">自动回复</a></li>
            <li><a href="#options">选项</a></li>
        </ul>
        <div id="qys">
            <asp:UpdatePanel ID="upApps" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
            <ContentTemplate>
                <table runat="server" id="apps" class="hr mtop_n">
                    <tr><th style="width:34px">序号</th><th>应用名称</th><th style="width:52px">ID</th><th style="width:70px">设为默认</th><th style="width:32px">删除</th></tr>
                </table>
                <asp:Button runat="server" CssClass="hide" ID="btnOpera" OnClick="OperaApp" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <div class="footBtnArea">
                <asp:Button runat="server" ID="btnAdd" OnClick="AddApp" Text="添加应用" CssClass="btn" />
                <input type="button" onclick="showHelp('weixin');" value="帮助" class="btn pconly" />
                <input type="button" onclick="back();" value="返回" class="btn" />
            </div>
        </div>
        <div id="autoreply">
            <div id="rpls" class="ui-tabs nobg noborder mtop_n">
                <ul>
                    <li><a href="#subsc">被关注时回复</a></li>
                    <li><a href="#strict">关键词回复|全匹配</a></li>
                    <li title="半匹配，即用户输入包含关键字就匹配"><a href="#fuzzy">关键词回复|半匹配</a></li>
                </ul>
                <div id="subsc">
                    <asp:TextBox runat="server" ID="tbSubscribe" TextMode="MultiLine" Rows="4"></asp:TextBox>
                    <div class="footBtnArea">
                        <asp:Button runat="server" ID="btnSubscribe" OnClick="SaveSubscribeReply" CssClass="btn" Text="保存" />
                    </div>
                </div>
                <asp:UpdatePanel ID="strict" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <table class="hr">
                        <tr><th style="width:6.2em">关键词</th><th>回复内容</th><th style="width:2.5em">删除</th></tr>
                        <asp:PlaceHolder runat="server" ID="phStrict"></asp:PlaceHolder>
                    </table>
                    <div class="footBtnArea"><button type="button" class="btn" onclick="return addReplies('Strict');">添加</button></div>
                </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdatePanel ID="fuzzy" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <table class="hr">
                        <tr><th style="width:6.2em">关键词</th><th>回复内容</th><th style="width:2.5em">删除</th></tr>
                        <asp:PlaceHolder runat="server" ID="phFuzzy"></asp:PlaceHolder>
                    </table>
                    <div class="footBtnArea"><button type="button" class="btn" onclick="return addReplies('Fuzzy');">添加</button></div>
                </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
        <div id="options">
            <asp:CheckBox runat="server" ID="cbAcceptFile" Text="接收微信客户端发来的文件，存入目录：" /><asp:UpdatePanel ID="upDir" class="vmiddle" runat="server" RenderMode="Inline" UpdateMode="conditional">
                <ContentTemplate><a id="aDir" runat="server" href="#" title="点击选择目录" CausesValidation="false" onclick="return showDirTree(true);" onserverclick="DirChanged"></a></ContentTemplate>
            </asp:UpdatePanel>
            <div class="footBtnArea">
                <br />
                <asp:Button runat="server" ID="btnSave" OnClick="SaveOptions" Text="保存选项" CssClass="btn" />
                <asp:Button runat="server" ID="btnMl" OnClick="ToMakeLink" Text="生成微信免登录链接" ToolTip="用作企业微信的菜单链接" CssClass="btn" />
            </div>
        </div>
    </div>
    
    <ims:Pop runat="server" ID="app" Title="添加应用" OnOkClick="Save" Width="495" OnClientUpdated="InitByType();" HideOnOkClientClick="false">
        <ContentTemplate>
            <table id="appTable" class="comm">
                <tr>
                    <td class="right" style="width:110px">名称：</td><td><asp:TextBox runat="server" ID="tbName" Width="150"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="right">类型：</td><td><asp:DropDownList runat="server" ID="ddlType" onchange="InitByType();"><asp:ListItem Value="Work" Selected="True">企业微信</asp:ListItem><asp:ListItem Value="Service">服务号</asp:ListItem><asp:ListItem Value="Subscribe">订阅号</asp:ListItem></asp:DropDownList></td>
                </tr>
                <tr>
                    <td class="right" id="tdAppid">CorpID：</td><td><asp:TextBox runat="server" ID="tbCorpid" Width="150"></asp:TextBox></td>
                </tr>
                <tr id="trAgentid">
                    <td class="right">AgentId：</td><td><asp:TextBox runat="server" ID="tbID" Width="150"></asp:TextBox></td>
                </tr>
                <tr id="trAccount">
                    <td class="right">Account：</td><td><asp:TextBox runat="server" ID="tbAccount" Width="150"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="right" id="tdSecret">Secret：</td><td><asp:TextBox runat="server" ID="tbSecret"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="right">Token：</td><td><asp:TextBox runat="server" ID="tbToken"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="right">EncodingAESKey：</td><td><asp:TextBox runat="server" ID="tbAesKey"></asp:TextBox></td>
                </tr>
            </table>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="ml" Title="生成企业微信免登录链接" OnClientUpdated="hideAlert();" Width="420" HideOnOkClientClick="false" OkButtonText="生成" OnOkClick="MakeLink" CanelButtonText="关闭">
        <ContentTemplate>
            微信应用：<asp:DropDownList runat="server" ID="ddlLink"></asp:DropDownList><br />
            链接地址：<asp:TextBox runat="server" ID="tbLink" Width="77%"></asp:TextBox>
            <div class="green pointer mtop_m" runat="server" id="divLink" title="点击复制" onclick="toCopy(this)"></div>
            <div class="mtop_n note lightarea">该链接用作企业微信的菜单链接，用户点击时自动登录系统。对于服务号/订阅号，用户绑定账户时会自动登录。</div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="ar" Title="编辑关键词回复" Width="420" OnOkClick="OperaReplies" OnOkClientClick="return saveReply();">
        <ContentTemplate>
            <table class="fixedLayout">
                <tr><td style="width:4.2em" class="right">关键词：</td><td><asp:TextBox MaxLength="30" runat="server" ID="tbKey"></asp:TextBox></td></tr>
                <tr><td colspan="2" style="height:4px;overflow:hidden"></td></tr>
                <tr><td class="vtop right">回复：</td><td><asp:TextBox runat="server" ID="tbReply" TextMode="MultiLine" Rows="6" Height="120"></asp:TextBox></td></tr>
            </table>
        </ContentTemplate>
    </ims:Pop>
    </form>
</body>
</html>