<%@ page language="C#" autoeventwireup="true" inherits="ims.web.templets, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<%@ Register Src="~/UserControls/FileUploader.ascx" TagName="Uploader" TagPrefix="ims" %>
<!DOCTYPE html>
<html id="templets">
<head runat="server"><title></title><meta http-equiv="X-UA-Compatible" content="IE=edge" /></head>
<body class="waiting">
    <div class="hide"><img src="images/loading.gif" />处理中，请稍候 …</div>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s1" runat="server" EnablePageMethods="true" AsyncPostBackTimeout="900" OnAsyncPostBackError="AsyncError" />
    <asp:UpdatePanel ID="upDirs" runat="server" ChildrenAsTriggers="false" OnPreRender="AttMouseEvent" UpdateMode="conditional" RenderMode="Block" />
    <asp:UpdatePanel ID="objsDiv" runat="server" EnableViewState="false" ChildrenAsTriggers="false" OnPreRender="AttMouseEvent" UpdateMode="conditional" RenderMode="Block" />
    <asp:HiddenField ID="curFolderId" runat="server" />
    <asp:HiddenField ID="curTempletId" runat="server" />
    <asp:HiddenField ID="selectedTids" runat="server" />
    <asp:HiddenField ID="pasteSource" runat="server" />
    <div class="menu" id="objMenu">
        <a href="#" runat="server" onserverclick="ShowData" id="Open">打开</a>
        <a accesskey="A" href="#" runat="server" id="appendData" onclick="toAddData()">添加　　　 Alt+A</a>
        <a accesskey="S" href="#" runat="server" id="Search" onclick="return Search();">搜索 　　　Alt+S</a>
        <a accesskey="D" href="#" onclick="return design()" runat="server" id="design">设计 　　　Alt+D</a>
        <a accesskey="E" href="#" runat="server" id="export" onserverclick="ExportTemplet">导出　　　 Alt+E</a>
        <div></div>
        <a accesskey="T" href="#" onclick="return setSource()" runat="server" id="cut">剪切　　　 Alt+T</a>
        <a accesskey="C" href="#" onclick="return setSource()" runat="server" id="copy">复制　　　 Alt+C</a>
        <a accesskey="X" href="#" onclick="return del()" runat="server" id="del">删除 　　　Alt+X</a>
        <a accesskey="N" href="#" onclick="return rename()" runat="server" id="rename">重命名　　 Alt+N</a>
        <a accesskey="B" href="#" id="fastFilter" runat="server" onserverclick="ShowFastFilter">筛选　　　 Alt+B</a>
        <a accesskey="F" href="#" id="filtersAdmin" runat="server">过滤器　　 Alt+F</a>
        <a href="#" id="shortcut" runat="server" onserverclick="AddShortcut" onclick="shortcutAdded()">添加快捷方式</a>
        <div></div>
        <a accesskey="M" href="#" runat="server" id="dataManage" onserverclick="ShowDataManage">数据管理　 Alt+M</a>
        <a accesskey="P" href="#" runat="server" onserverclick="ShowPower" id="showPower">权限 　　　Alt+P</a>
        <a accesskey="R" href="#" runat="server" onserverclick="ShowAttributes" id="showAttributes">属性 　　　Alt+R</a>
    </div>
    <div class="menu" runat="server" id="folderMenu">
        <a accesskey="O" href="#" onclick="return openFolder()">打开 　　　Alt+O</a>
        <a accesskey="C" href="#" onclick="return setSource()" id="cutFolder">剪切　　　 Alt+C</a>
        <a accesskey="D" href="#" onclick="return confirm('确定删除该文件夹吗？');" id="delFolder" runat="server" onserverclick="DelFolder">删除 　　　Alt+D</a>
        <a accesskey="N" href="#" onclick="return renameFolder()" id="renameDir">重命名　　 Alt+N</a>
    </div>
    <div class="menu" id="bodyMenu" runat="server">
        <span runat="server" id="forTemplet">
        <a accesskey="A" href="#" onclick="return addTemplet()">添加模板　 　Alt+A</a>
        <a accesskey="S" href="#" onclick="return showMsPop();" runat="server" id="ams" onserverclick="ShowMsPop">添加主从模板 Alt+S</a>
        <a accesskey="L" href="#" onclick="return What('addFlow','如何添加流程？')" runat="server" id="aAddFlow">添加流程　 　Alt+L</a>
        <a accesskey="I" href="#" runat="server" onserverclick="showRestore" id="import">导入模板　　 Alt+I</a>
        <a accesskey="E" href="#" runat="server" id="exportSelected" onclick="return setSelected()" onserverclick="ExportTemplet">导出选中模板 Alt+E</a>
        </span>
        <a accesskey="B" href="#" runat="server" id="backupSelected" onclick="return setSelected()" onserverclick="DataBackup">备份选中数据 Alt+B</a>
        <a accesskey="F" href="#" runat="server" id="operaAll" onserverclick="ExportOrBackupAll">导出所有模板 Alt+F</a>
        <a accesskey="R" href="#" runat="server" id="restore" onserverclick="showRestore">从备份中恢复 Alt+R</a>
        <div></div>
        <a accesskey="T" href="#" onclick="return setSource()" runat="server" id="cutSelected">剪切选中模板 Alt+T</a>
        <a accesskey="P" href="#" runat="server" id="paste" onserverclick="Paste">粘贴　 　　　Alt+P</a>
        <a accesskey="C" href="#" id="addfolder" runat="server" onclick="return addFolder();">新建文件夹　 Alt+C</a>
        <a href="#" onclick="return CanelEvent();" onmouseover="showSubMenu('sub_sort')" onmouseout="hideSubMenu('sub_sort')" id="aSort" class="hasSubMenus">排序</a>
        <a accesskey="F" href="###" id="find" onclick="showFind();">查找</a>
        <a accesskey="G" href="#" onclick="return back();">返回　　　　 Alt+G</a>
    </div>
    <asp:UpdatePanel ID="sub_sort" runat="server" RenderMode="inline" UpdateMode="conditional" class="menu" onmouseout="hideSubMenu(this)">
    <ContentTemplate>
        <a accesskey="N" href="#" runat="server" id="byName" onserverclick="Sort">名称　 　　　Alt+N</a>
        <a accesskey="T" href="#" runat="server" id="byTime" onserverclick="Sort">创建时间 　　Alt+T</a>
        <a accesskey="C" href="#" runat="server" id="byCustom" onserverclick="Sort" title="即手工拖动调整的排序">自定义　 　　Alt+C</a>
     </ContentTemplate>
    </asp:UpdatePanel>
    <div class="menu" id="sub_filters"></div>
    <div id="filters" runat="server"></div>
    <ims:Pop runat="server" ID="power" OnOkClick="savePowers" Width="458" HideOnOkClientClick="false" OnClientUpdated="setReadCond();" HelpSubject="power">
    <ContentTemplate>
        <div runat="server" id="powerAs"><asp:CheckBox runat="server" ID="cbPowerAs" Text="引用" /><asp:DropDownList runat="server" ID="ddlPowerFrom" onchange="fromChanged();"></asp:DropDownList><label for="power_cbPowerAs"> 的权限设置</label><img src="images/what.gif" title="说明" onclick="What('PowerRef')" class="what" /></div>
        <div id="setArea">
        <div runat="server" id="dataOpera">
            <b>流程外操作表单数据</b>：<asp:DropDownList runat="server" ID="ddlDataOpera" onchange="alertPrompt();"><asp:ListItem Value="Disable">不允许</asp:ListItem><asp:ListItem Value="Readonly">只读</asp:ListItem><asp:ListItem Value="Enable">允许</asp:ListItem></asp:DropDownList>
            <div class="ui-corner-all">该模板已绑定流程，由流程参与者在流程中填写表单。通常不允许在流程外操作；若允许，则按下面设置的权限控制。</div>
        </div>
        <fieldset class="mbottom_s"><legend>角色：<asp:DropDownList ID="roles" runat="server" AutoPostBack="true" OnSelectedIndexChanged="InitPower"></asp:DropDownList></legend>
            <div style="padding:0.5em 3px 3px 0">
            <asp:CheckBox runat="server" ID="cbFullPower" Text="完全控制" />
            <div id="rwPower">
                <div id="readPower"><b>浏览权限：</b><asp:DropDownList runat="server" ID="ddlReadPower"></asp:DropDownList> <asp:CheckBox runat="server" ID="cbReadCond" Text="仅允许浏览符合条件的记录：" /><a href="#" onclick="return ShowFilter(this,'ReadCond');">设置条件</a><img src="images/what.gif" title="如何设置浏览权限？" onclick="What('SecLevel')" class="what" /></div>
                <b>编辑权限：</b><asp:RadioButton runat="server" ID="rbNo" GroupName="editPower" Text="无" /><asp:RadioButton runat="server" ID="rbAll" GroupName="editPower" Text="全部字段" /><asp:RadioButton runat="server" ID="rbSome" GroupName="editPower" Text="指定字段" />
                <span id="enFields"><asp:CheckBoxList runat="server" CssClass="colorText" ID="cblFields" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:CheckBoxList>　<img src='images/selectall.gif' class='slt' title='全选/全不选' onclick="SelectAll('enFields');" /><img src='images/revselect.gif' class='slt' title='反选' onclick="RevSelect('enFields');" />
                </span>
                <div id="spanOptions" class="mbottom_s">
                    <div class="sepline2"></div>
                    <asp:CheckBox runat="server" ID="cbEnAdd" Text="允许添加记录" /><br />
                    <asp:CheckBox runat="server" ID="cbProtOthers" Text="禁止编辑或删除他人添加的记录" /><br />
                    <asp:CheckBox runat="server" ID="cbEditCond" Text="仅允许编辑或删除符合条件的记录：" /><a href="#" onclick="return ShowFilter(this,'EditCond');">设置条件</a>
                    <div class="sepline2"></div>
                </div>
                <div runat="server" id="divMent"><b>评论权限：</b><asp:CheckBox runat="server" ID="cbReadMent" Text="查看评论" /><asp:CheckBox runat="server" ID="cbWriteMent" Text="发表评论" /><asp:CheckBox runat="server" ID="cbAdminMent" Text="删除评论" /></div>
                <div id="divHide" class="mtop_s"><b>其它选项：</b><asp:CheckBox runat="server" ID="cbHide" Text="隐藏该模板项" /><img src="images/what.gif" title="解释" onclick="What('HideTemplet')" class="what" /></div>
            </div>
            </div>
        </fieldset>
        <table><tr><td><asp:CheckBox runat="server" ID="cbApplyToAll" Text="为所有角色设置以上权限" /></td><td class="right"><a href="#" onclick="return listPower();">查看权限列表</a></td></tr></table>
        </div>
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat ="server" ID="attr" OnOkClick="saveAttributes" HelpSubject="templetAttrs" OnClientUpdated="makeTabs();" HideOnOkClientClick="false" Width="486" CustomCss="noline">
    <ContentTemplate>
        <div id="tabs" class="ui-tabs mtop_s">
            <ul>
                <li><a href="#normal">常规</a></li>
                <li><a href="#attr_relation">关系</a></li>
                <li runat="server" id="liFlow"><a href="#attr_wfArea">流程</a></li>
                <li><a href="#protect">数据保护</a></li>
                <li><a href="#attr_remind">提醒</a></li>
                <li runat="server" id="liBuild"><a href="#attr_build">生成</a></li>
                <li runat="server" id="liOpr"><a href="#attr_divOpr">自定义操作</a></li>
            </ul>
            <div id="normal">
                统计信息： 　　<asp:Literal runat="server" ID="fCount"></asp:Literal> 个字段，<asp:Literal runat="server" ID="rCount"></asp:Literal> 条记录
                <div class="sepline"></div>
                默认视图： 　　<asp:DropDownList runat="server" ID="ddlViews"></asp:DropDownList><br />
                默认排序方式： <asp:DropDownList runat="server" ID="ddlSort"></asp:DropDownList> <asp:DropDownList runat="server" ID="ddlfx"><asp:ListItem Value="ASC">从小到大</asp:ListItem><asp:ListItem Value="DESC">从大到小</asp:ListItem></asp:DropDownList>
                <div runat="server" id="divDir">
                    默认保存目录： <asp:RadioButton ID="rbDir" GroupName="DefaultDir" Text="" runat="server" /><a id="aDefaultDir" runat="server" href="#" title="点击选择目录" onclick="return showDirTree(true);" onserverclick="DirChanged"></a>
                    <asp:RadioButton ID="rbNone" GroupName="DefaultDir" Text="不关联到目录" runat="server" /><img src="images/what.gif" title="查看解释" onclick="What('DefaultDir')" class="what" />
                </div>
                <div class="sepline"></div>
                缩略图字段： 　<asp:DropDownList runat="server" ID="ddlThumb"></asp:DropDownList><br />
                标识字段： 　　<asp:DropDownList ID="fieldList_m" runat="server"></asp:DropDownList><img src="images/what.gif" title="查看解释" onclick="What('FirstIden')" class="what" />
                <div class="mtop_s" title="主要用于缩略图上鼠标悬浮显示">概要字段： 　　<a href="#" onclick="return showfs('attr_cblViews');">设置</a><img src="images/what.gif" title="查看解释" onclick="What('hoverFields')" class="what" /></div><asp:CheckBoxList runat="server" ID="cblViews" RepeatLayout="Flow" RepeatDirection="Horizontal" CssClass="colorText"></asp:CheckBoxList>
                联合主键字段： <a href="#" onclick="return showfs('attr_uKeys');">设置</a><img src="images/what.gif" title="查看解释" onclick="What('unionKeys')" class="what" /><asp:CheckBoxList runat="server" ID="uKeys" RepeatLayout="Flow" RepeatDirection="Horizontal" CssClass="colorText"></asp:CheckBoxList>
                <div class="sepline"></div>
                <div runat="server" id="aboutEshop">
                    <asp:CheckBox ID="cbEShop" AutoPostBack="true" OnCheckedChanged="cbEShop_changed" OnLoad="cbEShop_changed" runat="server" Text="启用电子商务功能" />
                    <asp:Literal ID="lblPrice" runat="server" Text=" - 价格字段："></asp:Literal><asp:DropDownList runat="server" ID="ddlPrice"></asp:DropDownList>
                </div>
                <asp:CheckBox runat="server" ID="cbComment" onclick="mentChanged(this)" Text="允许评论" /><span id="aboutMent">：
                    <asp:CheckBox runat="server" ID="cbAdminBySelf" Text="允许修改或删除自己的评论" />
                    <asp:CheckBox runat="server" ID="cbAdminOwn" Text="允许记录创建者删除该记录的评论" />
                </span>
            </div>
            <div runat="server" id="relation">
                <asp:UpdatePanel ID="upChildren" runat="server" UpdateMode="conditional" RenderMode="Block">
                <ContentTemplate>
                    <div runat="server" id="subArea"></div>
                    <div id="divAddSub" runat="server" class="footBtnArea"><a href="#" onclick="return ShowPop('sub_popup');">添加子模板</a><img src="images/what.gif" title="什么是子模板？" onclick="return showHelp('masterSlave');" class="what" /></div>
                    <asp:Button runat="server" ID="btnDel" OnClick="DelRelation" CssClass="hide" /><asp:Button runat="server" ID="btnSync" OnClick="Sync" CssClass="hide" />
                </ContentTemplate>
                </asp:UpdatePanel>
                <div runat="server" id="parent" class="corner"></div>
            </div>
            <div runat="server" id="wfArea">
                <a href="###" runat="server" id="aFlow" onclick="designFlow();"></a> <img src="images/del.gif" title="删除流程" onclick="delFlow();" runat="server" class="pointer" id="imgDel" />
            </div>
            <div id="protect">
                <fieldset><legend>保护方式</legend>
                    <asp:CheckBox runat="server" ID="cbDisRead" Text="禁止浏览" />　<asp:CheckBox runat="server" ID="cbDisEdit" Text="禁止编辑" />　<asp:CheckBox runat="server" ID="cbDisDel" Text="禁止删除" />
                </fieldset>
                <div class="mtop_s">
                    <asp:CheckBox runat="server" ID="cbRange" Text="仅保护符合条件的记录：" /><a href="javascript:void(0);" onclick="return ShowFilter(this);">设置条件</a>
                </div><br />
                <fieldset><legend>其它选项</legend>
                    <asp:CheckBox runat="server" ID="cbDisAdd" Text="禁止添加/导入数据" />　<asp:CheckBox runat="server" ID="cbDisExport" Text="禁止导出/备份数据" />
                </fieldset><br />
                <fieldset><legend>例外（指定的角色不受以上限制）：</legend>
                    <asp:CheckBoxList runat="server" ID="cblRoles" RepeatLayout="Flow" RepeatDirection="Horizontal"></asp:CheckBoxList>　<img src='images/selectall.gif' class='slt' title='全选/全不选' onclick="SelectAll('exclude');" /><img src='images/revselect.gif' class='slt' title='反选' onclick="RevSelect('exclude');" />
                </fieldset>
            </div>
            <asp:UpdatePanel ID="remind" runat="server" UpdateMode="conditional">
            <ContentTemplate>
            <div runat="server" id="divReminds"></div>
            <div runat="server" id="divAddRem" class="footBtnArea"><a href="#" onclick="return ShowPop('rem_popup');">添加提醒</a></div>
            <asp:Button runat="server" ID="btnRemind" OnClick="OperaRemind" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="build" runat="server" UpdateMode="conditional">
            <ContentTemplate>
                <div runat="server" id="divGeners"></div>
                <div runat="server" id="divAddGener" class="footBtnArea"><a href="#" onclick="return ShowPop('gen_popup');">添加生成方法</a><img src="images/what.gif" title="查看解释" onclick="What('Build')" class="what" /></div>
                <asp:Button runat="server" ID="btnBuild" OnClick="OperaBuilder" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="divOpr" runat="server" UpdateMode="conditional">
            <ContentTemplate>
                <ul runat="server" id="oprs"></ul>
                <div runat="server" id="divAddOpr" class="footBtnArea"><a href="#" id="aAddOpr" runat="server" onserverclick="ShowOpr">添加自定义操作</a><img src="images/what.gif" title="查看解释" onclick="What('CustomOpera')" class="what" /></div>
                <asp:Button runat="server" ID="btnOpr" OnClick="OperaOpr" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="opr" Title="自定义操作" OnOkClick="SaveOpr" HideOnOkClientClick="false" ShowProgress="false" Width="450">
        <ContentTemplate>
            <table class="fixedLayout comm">
                <tr><td class="oprKey">名称：</td><td><asp:TextBox runat="server" ID="tbOprName"></asp:TextBox></td></tr>
                <tr><td class="oprKey">动作：</td>
                    <td>
                        <ul id="actions">
                            <li><asp:DropDownList runat="server" ID="fs1" onchange="FiledsChged(this);"></asp:DropDownList> 设为： <asp:TextBox runat="server" ID="tbValue1" CssClass="tbValue"></asp:TextBox></li>
                            <li class="hide" runat="server" id="li2"><asp:DropDownList runat="server" ID="fs2" onchange="FiledsChged(this);"></asp:DropDownList> 设为： <asp:TextBox runat="server" ID="tbValue2" CssClass="tbValue"></asp:TextBox></li>
                            <li class="hide" runat="server" id="li3"><asp:DropDownList runat="server" ID="fs3" onchange="FiledsChged(this);"></asp:DropDownList> 设为： <asp:TextBox runat="server" ID="tbValue3" CssClass="tbValue"></asp:TextBox></li>
                            <li class="hide" runat="server" id="li4"><asp:DropDownList runat="server" ID="fs4" onchange="FiledsChged(this);"></asp:DropDownList> 设为： <asp:TextBox runat="server" ID="tbValue4" CssClass="tbValue"></asp:TextBox></li>
                            <li class="hide" runat="server" id="li5"><asp:DropDownList runat="server" ID="fs5" onchange="FiledsChged(this);"></asp:DropDownList> 设为： <asp:TextBox runat="server" ID="tbValue5" CssClass="tbValue"></asp:TextBox></li>
                        </ul>
                        <div id="addopr" runat="server"><img src="images/add.png" class="pointer" title="添加动作" onclick="addAction();" id="addAct" /></div>
                    </td>
                </tr>
                <tr><td class="oprKey">授权：</td><td><asp:TextBox runat="server" ID="oprRoles" TextMode="MultiLine" Rows="4" Width="99%" acfid="RoleName" chars=";；,，、"></asp:TextBox></td></tr>
                <tr><td></td><td><asp:CheckBox runat="server" ID="cbOprOnly" Text="仅用于符合条件的记录：" /><a href="javascript:void(0);" class="u" onclick="return ShowFilter(this,'OprCond');">设置条件</a></td></tr>
            </table>
            <div class="sepline2 mtop_l mbottom_s"></div>
            动作设置可使用变量：<asp:DropDownList runat="server" ID="ddlVars" onchange="$('#fieldTag').text($(this).val());"></asp:DropDownList> <span id="fieldTag"></span>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="gen" Title="添加生成规则" Width="430" OnOkClick="AddGenerator" HideOnOkClientClick="false" OnOkClientClick="return preAddGenerator();" ShowProgress="false">
        <ContentTemplate>
            <b>&nbsp;源数据</b>：<asp:DropDownList runat="server" ID="ddlSource" AutoPostBack="true" OnSelectedIndexChanged="GenerSourceChanged"></asp:DropDownList>
            <div runat="server" id="mapArea" class="mtop_m">
                <fieldset><legend>添加字段映射：</legend>
                    <div class="padbox">
                        源字段：<asp:DropDownList runat="server" ID="mapSrc"></asp:DropDownList><br />
                        映射到：<asp:DropDownList runat="server" ID="mapTarget"></asp:DropDownList>
                        <input type="button" class="btn" value="添加映射" onclick="addMap();" />
                    </div>
                </fieldset>
                <fieldset class="mtop_m"><legend>字段映射：</legend>
                    <ul id="maps" runat="server"></ul>
                    <div id="mapMsg">请添加字段映射</div>
                </fieldset>
            </div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="sub" OnOkClick="AddRelation" Width="430" HideOnOkClientClick="false" HelpSubject="masterSlave" OnOkClientClick="return preAddSub();" ShowProgress="false">
        <ContentTemplate>
            <fieldset runat="server" id="subZone"><legend>选择子模板：<asp:DropDownList runat="server" ID="ddlChildren" AutoPostBack="true" OnDataBound="FillRelatedFields" OnSelectedIndexChanged="FillRelatedFields"></asp:DropDownList></legend>
            <div class="padbox" runat="server" id="union">
            关联：<asp:DropDownList runat="server" ID="ddlSubFields"></asp:DropDownList>关联到当前<asp:DropDownList runat="server" ID="ddlCurFields"></asp:DropDownList><br />
            选项：<asp:CheckBox runat="server" ID="cbUpdate" Text="同步更新关联字段" ToolTip="确定在更新当前模板关联字段时是否同步更新子模板中的关联字段" />&nbsp;<asp:CheckBox runat="server" ID="cbDel" Checked="true"
            ToolTip="确定删除记录时是否同步删除子模板中相关联的记录" Text="同步删除关联记录" />&nbsp;<asp:CheckBox runat="server" ID="cbAdd"
            ToolTip="添加主记录时在子模板中同步添加一条关联记录。仅适用于一对一关系。" onclick="promptSynAdd();" Text="同步添加关联记录" />
            </div>
            <p runat="server" id="unionMsg" class="mtop_m indent gray"></p>
            </fieldset>
            <p runat="server" id="subMsg" class="mtop_l indent red"></p>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="rem" Width="430" OnOkClick="AddRemind" OnOkClientClick="return preAddRemind();" HideOnOkClientClick="false" ShowProgress="false">
        <ContentTemplate>
            <div style="line-height:22px">
            名称： <asp:TextBox runat="server" ID="tbRemindName" Width="195"></asp:TextBox><br />
            提醒方式： <input type="checkbox" id="cbMsg" runat="server" checked="checked" value="4" /><label for="rem_cbMsg">消息</label><input type="checkbox" runat="server" value="1" id="cbMail" /><label for="rem_cbMail">邮件</label><input type="checkbox" runat="server" value="2" id="cbSms" /><label for="rem_cbSms">短信</label><input type="checkbox" runat="server" value="8" id="cbWx" /><label for="rem_cbWx">微信</label>， <a href="#" onclick="return ShowFilter(null,'RemindCond');" class="u">提醒条件</a>，<a href="#" runat="server" onclick="return showExer();" id="aExer" class="u">提醒对象</a><br />
            检查时机： <asp:RadioButton runat="server" ID="rbLoop" Checked="true" onclick="setFqcy();" GroupName="fqcy" /><span id="loop" onclick="loopClicked();">从 <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> 检查一次</span><br />
            　　　　　 <asp:RadioButton runat="server" ID="rbUpdate" GroupName="fqcy" onclick="setFqcy();" Text="" /><asp:DropDownList runat="server" ID="ddlTime" onfocus="$('#rem_rbUpdate').click();setFqcy();"><asp:ListItem Value="6">添加或更新</asp:ListItem><asp:ListItem Value="2">添加</asp:ListItem><asp:ListItem Value="4">更新</asp:ListItem></asp:DropDownList><label for="rem_rbUpdate"> 数据时</label>
            </div>
        </ContentTemplate>
    </ims:Pop>
    <div id="audient" runat="server" class="pop noline" style="width:555px" ShowProgress="false">
        <div class="head">
            <div class="title Default">提醒对象</div><div class="close" onclick="HideDialog();">×</div>
        </div>
        <div class="body">
            <fieldset><legend onclick="modeChanged();"><input id="rbAssigned" type="radio" value="1" name="range" checked="checked" /><label for="rbAssigned">以下用户</label><input id="rbAllbut" name="range" type="radio" value="4" /><label for="rbAllbut">所有用户中排除以下用户</label><input id="rbInField" name="range" type="radio" value="5" /><label for="rbInField">指定字段中的对象</label></legend>
                <div class="padbox">
                    <div id="divUsers">
                        <input type="checkbox" id="cbUser" /><label for="cbUser">用户：</label><asp:TextBox runat="server" id="tbUsers" acfid="UserName" chars=";；,，、" ondblclick="showUserTree(this.id);" ToolTip="双击弹出用户选择窗口。多项之间以逗号、分号或顿号分隔" /><br />
                        <input type="checkbox" id="cbRole" /><label for="cbRole">角色：</label><asp:TextBox runat="server" id="tbRoles" acfid="RoleName" chars=";；,，、" ToolTip="多项之间以逗号、分号或顿号分隔" /><br />
                        <input type="checkbox" id="cbUnit" /><label for="cbUnit">机构：</label><asp:TextBox runat="server" id="tbUnits" acfid="UnitNameWithID" chars=";；,，、" ondblclick="showUserTree(this.id,true);" ToolTip="双击弹出机构选择窗口。多项之间以逗号、分号或顿号分隔" /> <input type="checkbox" id="cbRector" value="1" checked="checked" /><label for="cbRector">负责人</label> <input type="checkbox" id="cbDirectly" value="2" /><label for="cbDirectly">直属成员</label> <input type="checkbox" id="cbIndirect" value="4" /><label for="cbIndirect">非直属成员</label><br />
                    </div>
                    <asp:UpdatePanel ID="divFields" runat="server" UpdateMode="conditional" RenderMode="Block" />
                </div>
            </fieldset>
            排除：<asp:TextBox runat="server" id="tbNoUsers" acfid="UserName" ToolTip="双击弹出用户选择窗口。多项之间以逗号、分号或顿号分隔" chars=";；,，、" ondblclick="showUserTree(this.id);" />
        </div>
        <div class="btnArea">
            <input type="button" value="确定" id="btnAssign" onclick="exerAssigned();" class="btn" />
            <input type="button" class="btn" value="取消" onclick="HideDialog();" />
        </div>
    </div>
    <ims:Pop runat="server" ID="ff" OnOkClick="doFilter" OnClientCanel="$('#curFilterTid').val('');" CustomButtonA_Text="保存为快捷方式" CustomButtonA_OnClick="SaveSC();" OnOkClientClick="return checkCond();" OnClientUpdated="InitFilter('ff_popup');" Width="450" HideOnOkClientClick="false" HelpSubject="fastFilter" ShowProgress="false">
    <ContentTemplate>
        <asp:HiddenField ID="curFilterTid" runat="server" />
        <ul runat="server" id="ulFilter" class="notfocus"></ul>
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="dm" ShowOkButton="false" OnClientUpdated="dmUpdated();" CanelButtonText="关闭" Width="414" CustomCss="noline">
    <ContentTemplate>
        <fieldset runat="server" id="fsData"><legend>数据管理</legend>
            <div class="pad">
                <asp:Button ID="backup" runat="server" class="btn" OnClick="DataBackup" Text="备份" />
                <asp:Button ID="clearAll" runat="server" OnClientClick="return confirm('该操作将会清空所有基于此模板的数据，且不可恢复。请务必慎重!\n确定要全部清空吗？');" OnClick="ClearAll" CssClass="btn" Text="清空"></asp:Button>
                <asp:Button ID="removeTo" runat="server" OnClick="RemoveTo" OnClientClick="return showDirTree()" CssClass="btn" Text="移到指定目录"></asp:Button>
            </div>
        </fieldset>
        <fieldset runat="server" id="fsIO"><legend>数据交换</legend>
            <div class="pad">
                <input runat="server" type="button" id="uploadXls" onclick="return false;" class="btn" value="导入Excel" />
                <asp:Button ID="btnToExcel" runat="server" class="btn" OnClick="ToExcel" ToolTip="将数据导出到一个Excel文件" Text="导出Excel" />
                <asp:Button ID="excel" runat="server" class="btn" OnClick="MakeExcelTemplet" ToolTip="下载Excel表单以批量录入可供导入的数据" Text="下载Excel表单" />
            </div>
        </fieldset>
        <div id="fu" runat="server"><input id="xlsToUpload" type="file" contenteditable="false" title="从一个Excel文件或包含Excel文件的ZIP文件包导入，并用于更新或追加数据" onchange="return toImport();" name="xlsToUpload" /></div>
        <fieldset runat="server" id="update" onkeydown="return enterTo('dm_btnUpdate');">
            <legend>批量更新 <asp:DropDownList ID="forUpdate" runat="server" AutoPostBack="true" OnSelectedIndexChanged="SetEditControls"></asp:DropDownList><span id="spanValue" class="hide"> 为 <asp:DropDownList runat="server" ID="ddlValue" onchange="valueChanged();"></asp:DropDownList></span>：</legend>
            <div style="padding:2px" runat="server" id="editArea">
            <asp:TextBox ID="_tb" runat="server" Width="99%" Visible="false"></asp:TextBox>
            <span runat="server" id="ddlspan" visible="false"><asp:Literal runat="server" ID="ddltext"></asp:Literal><asp:DropDownList ID="_ddl" runat="server"></asp:DropDownList></span>
            <asp:CheckBox ID="_cb" runat="server" Visible="false" />
            <asp:CheckBoxList ID="_cbl" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" Width="100%" Visible="false"></asp:CheckBoxList>
            <asp:RadioButtonList ID="_rbl" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" Width="100%" Visible="false"></asp:RadioButtonList>
            <asp:TextBox runat="server" ID="_ck" Width="99%" CssClass="ck" TextMode="MultiLine" Visible="false"></asp:TextBox>
            <ims:Uploader runat="server" ID="_uploader" Visible="false" />
            <table ID="_hl" runat="server" style="table-layout:fixed;width:98%" visible="false">
                <tr><td style="width:60px">链接文字：</td><td><asp:TextBox ID="_tbText" runat="server" Width="99%"></asp:TextBox></td></tr>
                <tr><td>链接地址：</td><td><asp:TextBox ID="_tbUrl" runat="server" Width="99%"></asp:TextBox></td></tr>
            </table>
            </div>
            <div id="buMsg" class="padcenter gray hide"></div>
        </fieldset>
        <table runat="server" id="updateFilter"><tr><td>
            <asp:CheckBox runat="server" ID="cbFilter" Text="仅更新符合条件的记录：" /><a href="javascript:void(0);" class="u" onclick="return ShowFilter(this);">设置条件</a>
        </td><td class="right">
            <asp:Button ID="btnUpdate" runat="server" Text="更新" OnClick="BatchUpdate" OnClientClick="return doConfirm();" CssClass="btn" />
        </td></tr></table>
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="seek" Title="查找" OkButtonText="查找" OnOkClick="BindAll" OnOkClientClick="return toFind();" HelpSubject="FindTemplet" HideOnOkClientClick="false" ShowProgress="false">
        <ContentTemplate>
            <div class="footBtnArea">名称包含：<input type="text" id="tbFind" acfid="Templet" onkeydown="return keyChanged();" /></div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="res" OnClientCanel="InitRestore();" Width="360" ShowOkButton="false" ShowCancelButton="false" ShowProgress="false">
    <ContentTemplate>
        <div class="mtop_l center">
        <div id="loading1" class="hide middle"><img src="images/loading.gif" />　正在处理，请稍候…</div>
        <span id="uploadArea">
            指定文件：<input id="fileToUpload" type="file" name="fileToUpload" />
            <div class="center mtop_l">
                <input type="button" id="upload" class="btn" onclick="return ajaxFileUpload();" runat="server" value="导入" />
                <input type="button" class="btn" onclick="HideDialog();" value="取消" />
            </div>
        </span>
        </div>
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="importMode" ShowCancelButton="false" ShowOkButton="false" Title="导入Excel - 操作模式" Width="280" ShowProgress="false">
        <ContentTemplate>
            <div class="center mtop_l">
                <input type="button" value="导入数据" title="将Excel中的数据追加进来" class="btn" onclick="xlsUpload(false);HideDialog();" />
                <input type="button" value="更新数据" title="用Excel中的数据更新现有记录（根据ID匹配）" class="btn" onclick="xlsUpload(true); HideDialog();" />
                <input type="button" value="取消" class="btn" onclick="HideDialog();" />
            </div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="ms" Title="添加主从模板" OnOkClientClick="return preAdd();" CustomCss="noline" OnOkClick="AddTemplets" HideOnOkClientClick="false" Width="450" ShowProgress="false">
        <ContentTemplate>
            <fieldset class="mbottom_s"><legend>主模板</legend>
                <div class="padbox">
                    模板名称： <asp:TextBox runat="server" ID="tbMain"></asp:TextBox><br />
                    关联字段： <asp:TextBox runat="server" ID="tbKeyName"></asp:TextBox>， 类型： <asp:DropDownList runat="server" ID="keyType" onchange="keyTypeChanged();"><asp:ListItem Value="Text">文本</asp:ListItem><asp:ListItem Value="AutoNumber">自动编号</asp:ListItem></asp:DropDownList>
                    <fieldset id="nubmerRule" class="hide mtop_s"><legend>编号组成：</legend>
                        <asp:CheckBox runat="server" ID="cbPrefix" Text="前缀："></asp:CheckBox><asp:TextBox runat="server" ID="tbPrefix" MaxLength="110"></asp:TextBox><br />
                        <asp:CheckBox runat="server" ID="cbRandom" onchange="switchNo();" Text="随机字符串"></asp:CheckBox><br />
                        <div id="divNo">
                            <asp:CheckBox runat="server" ID="cbTime" Text="时间字符串："></asp:CheckBox><asp:TextBox runat="server" ID="tbTime" MaxLength="20"></asp:TextBox><img src="images/what.gif" title="查看解释" onclick="What('DateFormat')" class="what" /><br />
                            <asp:CheckBox runat="server" ID="cbSerial" Text="顺序号："></asp:CheckBox>位数:<asp:TextBox runat="server" ID="tbSerial" Width="32" MaxLength="2"></asp:TextBox> 初始值:<asp:TextBox runat="server" ID="tbInitValue" MaxLength="9" Width="48"></asp:TextBox> 递增:<asp:TextBox runat="server" ID="tbStep" MaxLength="4" Width="32"></asp:TextBox>，重置周期:<asp:DropDownList runat="server" ID="ddlLoop"></asp:DropDownList>
                        </div>
                        <asp:CheckBox runat="server" ID="cbSuffix" Text="后缀："></asp:CheckBox><asp:TextBox runat="server" ID="tbSuffix" MaxLength="110"></asp:TextBox>              
                    </fieldset>
                </div>
            </fieldset>
            <fieldset class="mtop_m"><legend>子模板</legend>
                <div class="padbox">
                    模板名称：<asp:TextBox runat="server" ID="tbChildren" Width="350" ToolTip="可输入多个子模板，以逗号分隔"></asp:TextBox>
                </div>
            </fieldset>
            <div class="right"><a href="#" class="u" onclick="return showHelp('masterSlave');">什么是主从模板？</a></div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="rps" Width="450" CustomCss="noline" ShowOkButton="false" HelpSubject="power" CanelButtonText="关闭">
        <ContentTemplate>
            <asp:PlaceHolder runat="server" ID="phPowers"></asp:PlaceHolder>
        </ContentTemplate>
    </ims:Pop>
    <input type="button" id="Updater" runat="server" onserverclick="BindAll" class="hide" /><asp:Button runat="server" ID="btnOpera" CssClass="hide" OnClick="ExeOpera" />
    <script src="js/comm.js"></script><script src="js/templets.js"></script>
    </form>
</body>
</html>