<%@ page language="C#" autoeventwireup="true" inherits="ims.web.maint, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!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" id="maint">
<head runat="server">
    <title>系统维护</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s1" runat="server" AsyncPostBackTimeout="1200" EnablePageMethods="true">
        <Scripts>
            <asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/>
            <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/>
        </Scripts>
    </asp:ScriptManager>
    <div id="tabs" class="ui-tabs">
        <ul>
            <li><a href="#clear">系统清理</a></li>
            <li><a href="#bak">系统备份和还原</a></li>
            <li><a href="#other">其它操作</a></li>
        </ul>
        <div id="clear">
            <div id="loading1" class="hide"><img class="promptIcon" src="images/loading.gif" alt="" />正在处理，请稍候…</div>
            <span id="options">
                <ul>
                    <li>清理：<asp:CheckBox ID="cbCleanFiles" runat="server" Text="垃圾文件" /></li>
                    <li>　　　<asp:CheckBox ID="cbDelThumbs" runat="server" Text="缩略图缓存" /></li>
                    <li>　　　<asp:CheckBox ID="cbDelInactiveAnonys" runat="server" Checked="true" Text="匿名用户" /><img src="images/what.gif" title="说明" onclick="What('anonyUser')" class="what" /></li>
                    <li>　　　<asp:CheckBox ID="cbLog" runat="server" Text="用户操作日志" /></li>
                </ul>
                <br />
                <asp:UpdatePanel ID="upClean" UpdateMode="conditional" RenderMode="inline" runat="server">
                <ContentTemplate>
                    <asp:Button ID="btnExe" runat="server" OnClick="ExeClean" OnClientClick="return doClean();" CssClass="btn" Width="66" Text="开始清理" />
                </ContentTemplate>
                </asp:UpdatePanel>
            </span>
        </div>
        <div id="bak">
            <div class="hide" id="loading2"><img src="images/loading.gif" class="promptIcon" alt="" />正在处理，请稍候……</div>
            <asp:UpdatePanel ID="upBackup" UpdateMode="conditional" RenderMode="Block" runat="server">
            <ContentTemplate>
                <asp:Button ID="btnBackup" ToolTip="生成并下载系统备份文件" OnClick="BackupAll" OnClientClick="setUpg(true,'loading2','upBackup');" CssClass="btn" runat="server" Width="42" Text="备份" />&nbsp;
                <input type="button" value="自动备份…" style="width:78px" class="btn" onclick="ShowPop('ab_popup');" />&nbsp;
                <input type="button" id="upload" onclick="return false;" class="btn" style="width:42px" value="还原" />
                <span id="fuArea"><input id="fileToUpload" type="file" contenteditable="false" title="选择一个备份文件用来还原系统" onchange="return ajaxFileUpload();" class="fu" name="fileToUpload" /></span>
            </ContentTemplate>
                <Triggers><asp:AsyncPostBackTrigger ControlID="btnDb" EventName="Click" /></Triggers>
            </asp:UpdatePanel>
        </div>
        <div id="other">
            <div id="loading3" class="hide"><img class="promptIcon" src="images/loading.gif" alt="" />正在执行，请稍候…</div>
            <div id="btns3">
            <asp:Button ID="btnCloseSys" OnClick="CloseSystem" runat="server" Text="关闭系统" CssClass="btn" Width="66" ToolTip="停止系统的运行。&#13;注意：关闭后只能通过移除系统根目录下的app_offline.htm文件来恢复系统的运行。" OnClientClick="return confirm('关闭系统后只能通过移除系统根目录下的app_offline.htm文件才能恢复系统的运行！\n确定要关闭系统吗？');" />
            <asp:Button ID="btnRestartApp" OnClick="RestartApp" runat="server" CssClass="btn" Width="90" OnClientClick="setUpg(true,'loading3','btns3');" Text="重新启动系统" />
            <asp:Button ID="btnSwitchDatabase" runat="server" OnClick="SwitchDatabase" OnClientClick="return confirm('切换数据库，相当于切换到另一套独立的系统，当前的用户和数据不会自动转移。\n\n确定要切换数据库吗？');" CssClass="btn" Width="78" Text="切换数据库" />
            <asp:Button ID="btnDbZip" runat="server" OnClick="ZipDatabase" OnClientClick="return confirm('确定要压缩数据库吗？');" CssClass="btn" Width="78" Text="压缩数据库" />
            <asp:Button ID="viewSysLog" runat="server" Width="114" Text="查看系统运行日志" CssClass="btn" />
            <asp:Button ID="viewErrLog" runat="server" OnClientClick="return toPopup('ErrorLog.txt');" Width="114" Text="查看系统错误日志" CssClass="btn" />
            <asp:Button ID="btnJs" runat="server" OnClick="ShowPluginJs" Width="90" Text="编辑外挂脚本" CssClass="btn" />
            <asp:Button ID="btnDb" ToolTip="点击下载系统数据库及调试信息" OnClick="BackupDB" OnClientClick="setUpg(true,'loading3','btns3');" CssClass="btn" runat="server" Width="90" Text="下载调试数据" />
            </div>
        </div>
    </div>
    <ims:Pop runat="server" ID="ab" Title=" " Width="420" OnOkClick="SaveAutoBackup" OnOkClientClick="return preSave();" HideOnOkClientClick="false" HelpSubject="autoBackup" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <asp:CheckBox runat="server" ID="cbAutoBackup" onclick="autoBackupToggled();" Text="启用自动备份" />
            <div class="sepline2"></div>
            <div style="padding-left:15px">
            存储位置： <asp:TextBox runat="server" ID="tbTarget" Width="253" ToolTip="输入服务器上的备份文件存储路径，或网络共享文件夹路径"></asp:TextBox><br />
            备份时机： 从 <asp:TextBox runat="server" ID="tbStart" Width="115" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"></asp:TextBox> 起，每 <asp:TextBox runat="server" ID="tbFqcy" Width="24" Text="1"></asp:TextBox> <asp:DropDownList runat="server" ID="ddlTimeUnit"></asp:DropDownList> 一次
            <div class="sepline2"></div>
            <asp:CheckBox runat="server" ID="cbKeep" Text="仅保留最近" /><asp:DropDownList runat="server" ID="ddlKeep">
                    <asp:ListItem Value="1">1</asp:ListItem>
                    <asp:ListItem Value="2">2</asp:ListItem>
                    <asp:ListItem Value="3">3</asp:ListItem>
                    <asp:ListItem Selected="True" Value="5">5</asp:ListItem>
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="20">20</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                    <asp:ListItem Value="500">500</asp:ListItem>
                </asp:DropDownList> 个备份　<a href="###" class="u" onclick="__doPostBack('lbShowBaks', '');">查看备份文件</a>
            </div>
            <div class="sepline2 mtop_l"></div>
            <div class="gray middle"><img src="images/info.gif" /> 请确保服务器的 <asp:Label runat="server" ID="account"></asp:Label> 帐户对存储位置有“修改”权限。</div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="baks" Title="备份文件列表" ShowOkButton="false" CanelButtonText="关闭" Width="400" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <div runat="server" id="msg" class="mtop_l red indent"></div>
            <asp:ListBox runat="server" ID="ddlBaks"></asp:ListBox>
            <div class="right mtop_s mright_s"><a href="#" runat="server" class="u" id="aSysLog">查看系统日志</a></div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="js" Title="编辑外挂脚本" Width="585" OnOkClick="SaveJs" OnOkClientClick="UpdateEditorElement();" OkButtonText="保存" HelpSubject="jsplugin" CustomCss="noline" ShowProgress="false">
        <ContentTemplate>
            <asp:TextBox runat="server" TextMode="MultiLine" Rows="12" ID="tbJs"></asp:TextBox>
            <div class="notezone">外挂脚本用于对系统进行一些自定义处理，其基于jQuery框架，每个页面都会载入运行。</div>
        </ContentTemplate>
    </ims:Pop>
    <asp:LinkButton runat="server" ID="lbShowBaks" CssClass="hide" OnClick="ShowBaks"></asp:LinkButton>
    <script src="js/comm.js"></script><script src="js/maint.js"></script>
    </form>
</body>
</html>

