<%@ page language="C#" autoeventwireup="true" inherits="ims.templets, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="templets">
<head runat="server"><title></title><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="browsermode" content="application"><meta name="format-detection" content="telephone=no"></head>
<body class="waiting">
    <div class="hide"><div class="loadbar"><div></div><div></div><div></div><div></div><div></div></div></div>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s1" runat="server" EnablePageMethods="true" AsyncPostBackTimeout="900" 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>
    <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 href="#" runat="server" id="appendData" onclick="return toAddData()">添加</a>
        <a href="#" runat="server" id="Search" onclick="return Search();">搜索</a>
        <a href="#" onclick="return design()" runat="server" id="design">设计</a>
        <a href="#" runat="server" id="export" class="pconly" onserverclick="ExportTemplet">导出</a>
        <div></div>
        <a href="#" onclick="return setSource(this)" runat="server" id="cut">剪切</a>
        <a href="#" onclick="return setSource(this)" runat="server" id="copy">复制</a>
        <a href="#" onclick="return del()" runat="server" id="del">删除</a>
        <a href="#" onclick="return rename()" runat="server" id="rename">重命名</a>
        <a href="#" id="fastFilter" runat="server" onserverclick="ShowFastFilter">筛选</a>
        <a href="#" id="filtersAdmin" runat="server">过滤器</a>
        <a href="#" id="shortcut" runat="server" class="pconly" onserverclick="AddShortcut" onclick="shortcutAdded()">添加快捷方式</a>
        <div></div>
        <a href="#" runat="server" id="dataManage" onserverclick="ShowDataManage">数据管理</a>
        <a href="#" runat="server" onserverclick="ShowPower" id="showPower">权限</a>
        <a href="#" runat="server" onserverclick="ShowAttributes" id="showAttributes">设置</a>
    </div>
    <div class="menu" runat="server" id="folderMenu">
        <a href="#" onclick="return openFolder()">打开</a>
        <a href="#" onclick="return setSource(this)" id="cutFolder">剪切</a>
        <a href="#" onclick="return confirm('确定删除该文件夹吗？');" id="delFolder" runat="server" onserverclick="DelFolder">删除</a>
        <a href="#" onclick="return renameFolder()" id="renameDir">重命名</a>
    </div>
    <div class="menu" id="bodyMenu" runat="server">
        <span runat="server" id="forTemplet">
        <a href="#" onclick="return addTemplet()">添加模板</a>
        <a href="#" onclick="return showMsPop();" runat="server" id="ams" class="pconly" onserverclick="ShowMsPop">添加主从模板</a>
        <a href="#" onclick="return What('addFlow','如何添加流程？')" runat="server" class="pconly" id="aAddFlow">添加流程</a>
        <label runat="server" id="import" class="pconly">导入模板<input id="fileTemplet" name="fileTemplet" multiple="multiple" type="file" onchange="return ajaxFileUpload(true);" /></label>
        <a href="#" runat="server" id="exportSelected" class="pconly" onclick="return setSelected(this)" onserverclick="ExportTemplet">导出选中模板</a>
        </span>
        <a href="#" class="pconly" runat="server" id="backupSelected" onclick="return setSelected(this)" onserverclick="DataBackup">备份选中数据</a>
        <a href="#" class="pconly" runat="server" id="operaAll" onclick="return toEncrypt(this);" onserverclick="ExportOrBackupAll">导出所有模板</a>
        <label runat="server" class="pconly" id="restore">从备份中恢复<input id="fileData" name="fileData"  multiple="multiple" type="file" onchange="return ajaxFileUpload(false);" /></label>
        <div class="pconly"></div>
        <a href="#" onclick="return setSource(this)" runat="server" id="cutSelected">剪切选中模板</a>
        <a href="#" runat="server" id="paste" onserverclick="Paste">粘贴</a>
        <a href="#" id="addfolder" runat="server" onclick="return addFolder();">新建文件夹</a>
        <a href="###" id="find" onclick="showFind();">查找</a>
        <a href="#" onclick="return false;" onmouseover="showSubMenu(event,'sub_sort')" onmouseout="hideSubMenu(event,'sub_sort')" id="aSort" class="hasSubMenus">排序</a>
        <a href="#" id="aBack" class="pconly" onclick="return back();">返回</a>
    </div>
    <asp:UpdatePanel ID="sub_sort" runat="server" RenderMode="inline" UpdateMode="conditional" class="menu" onmouseout="hideSubMenu(event,this)">
    <ContentTemplate>
        <a href="#" runat="server" id="byName" onserverclick="Sort">名称</a>
        <a href="#" runat="server" id="byTime" onserverclick="Sort">创建时间</a>
        <a href="#" runat="server" id="byCustom" onserverclick="Sort" title="即手工拖动调整的排序">自定义</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" OnClientCanel="HideDialog('rps_popup');" 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><i title="说明" onclick="What('PowerRef')" class="what"></i></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="msgarea">该模板已绑定流程，由流程参与者在流程中填写表单。通常不允许在流程外操作；若允许，则按下面设置的权限控制。</div>
        </div>
        <fieldset><legend>角色：<asp:DropDownList ID="roles" runat="server" AutoPostBack="true" OnSelectedIndexChanged="InitPower"></asp:DropDownList></legend>
            <div class="padbox">
            <asp:CheckBox runat="server" ID="cbFullPower" Text="完全控制" />
            <div id="rwPower">
                <div id="readPower" class="middle"><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><i title="如何设置浏览权限？" onclick="What('SecLevel')" class="what"></i></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="green" ID="cblFields" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:CheckBoxList><button type="button" class="f-duoxuan btn smest outline" onclick="SelectAll(this,'enFields');">全选</button><button type="button" class="f-ok btn smest outline" onclick="RevSelect('enFields');">反选</button>
                </span>
                <div id="spanOptions">
                    <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');" class="vmiddle">设置条件</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 middle"><b>其它选项：</b><asp:CheckBox runat="server" ID="cbHide" Text="隐藏该模板" /><i title="解释" onclick="What('HideTemplet')" class="what"></i></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">
    <ContentTemplate>
        <div id="tabs" class="ui-tabs">
            <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> ，移动端：<asp:DropDownList runat="server" ID="mViews"></asp:DropDownList><br />
                <div runat="server" id="defFilter">默认过滤器： 　<asp:DropDownList runat="server" ID="ddlFilter"></asp:DropDownList><i title="查看解释" onclick="What('defFilter')" class="what"></i></div>
                默认排序方式： <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>&nbsp;
                    <asp:RadioButton ID="rbNone" GroupName="DefaultDir" Text="不关联目录" runat="server" /><i title="查看解释" onclick="What('DefaultDir')" class="what"></i>
                </div>
                <div class="sepline"></div>
                缩略图字段： 　<asp:DropDownList runat="server" ID="ddlThumb"></asp:DropDownList><br />
                标识字段： 　　<asp:DropDownList ID="fieldList_m" runat="server"></asp:DropDownList><i title="查看解释" onclick="What('FirstIden')" class="what"></i>
                <div id="ovfs" title="主要用于缩略图上鼠标悬浮显示">概要字段： 　　<a href="#" onclick="return showfs(this,'attr_cblViews');">设置</a><i title="查看解释" onclick="What('hoverFields')" class="what"></i></div><asp:CheckBoxList runat="server" ID="cblViews" RepeatLayout="Flow" RepeatDirection="Horizontal" CssClass="green"></asp:CheckBoxList>
                组合唯一字段： <a href="#" onclick="return showfs(this,'attr_uKeys');">设置</a><i title="查看解释" onclick="What('unionKeys')" class="what"></i><asp:CheckBoxList runat="server" ID="uKeys" RepeatLayout="Flow" RepeatDirection="Horizontal" CssClass="green"></asp:CheckBoxList>
                <div class="sepline"></div>
                <div class="middle notfocus" style="line-height:2rem"><asp:CheckBox runat="server" ID="cbValidator" CssClass="label0" Text="数据有效性验证" /><span id="forVator"><a href="#" title="设置条件。满足该条件才认为有效，否则不予保存" onclick="return ShowFilter(this,'Validator');">验证条件</a><span>　提示：</span><asp:TextBox runat="server" ToolTip="输入验证无效时的提示信息" ID="tbErr" Width="170px"></asp:TextBox></span></div>
                <asp:CheckBox runat="server" ID="cbCarryover" Text="启用数据结转" /><span id="forCo"><a href="#" class="vmiddle" id="aco" onclick="showCarryover();">结转方法</a></span>
                <div class="sepline"></div>
                <div runat="server" id="aboutEshop">
                    <asp:CheckBox ID="cbEShop" AutoPostBack="true" OnCheckedChanged="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>
            <asp:UpdatePanel ID="relation" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false" RenderMode="Block">
            <ContentTemplate>
                <div runat="server" id="subArea">
                    <div class="btitle"><span>子模板</span></div>
                    <ul class="withicon moveable" runat="server" id="ulSub" title="拖动项目排序"></ul>
                </div>
                <div runat="server" id="parent">
                    <div class="btitle"><span>父模板</span></div>
                    <ul class="withicon" runat="server" id="ulParent"></ul>
                </div>
                <div runat="server" id="uqArea">
                    <div class="btitle"><span>组合</span></div>
                    <ul class="withicon moveable" runat="server" id="ulUqs" title="拖动项目排序"></ul>
                </div>
                <div class="footBtnArea">
                    <span id="divAddSub" runat="server"><a href="#" runat="server" id="aAddrel" onserverclick="toAddRel">添加子模板</a><i title="什么是子模板？" onclick="return showHelp('masterSlave');" class="what"></i></span>
                    <span id="divAddUq" runat="server">　<a href="#" onclick="return toAddUnion();">添加组合</a><i title="什么是组合？" onclick="return showHelp('unionquery');" class="what"></i></span>
                </div>
                <asp:Button runat="server" ID="btnRelOpera" OnClick="RelationOpera" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <div runat="server" id="wfArea">
                <a href="###" runat="server" id="aFlow" onclick="designFlow();"></a><i class='del' title="删除流程" onclick="delFlow();" runat="server" id="imgDel"></i>
            </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="禁止导出/备份数据" /> <asp:CheckBox runat="server" ID="cbDisPrint" Text="禁止打印" />
                </fieldset><br />
                <fieldset><legend>例外(不受以上限制)： <button type="button" class="f-duoxuan btn smest outline" onclick="SelectAll(this,'attr_cblRoles');">全选</button><button type="button" class="f-ok btn smest outline" onclick="RevSelect('attr_cblRoles');">反选</button></legend>
                    <asp:CheckBoxList runat="server" ID="cblRoles" RepeatLayout="Table" RepeatColumns="3" RepeatDirection="Horizontal"></asp:CheckBoxList>
                </fieldset>
            </div>
            <asp:UpdatePanel ID="remind" runat="server" UpdateMode="conditional">
            <ContentTemplate>
            <ul class="withicon" runat="server" id="ulReminds"></ul>
            <div runat="server" id="divAddRem" class="footBtnArea"><a href="#" onclick="return addRemind();">添加提醒</a></div>
            <asp:Button runat="server" ID="btnRemind" OnClick="OperaRemind" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="build" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <ul class="withicon moveable" runat="server" id="ulGeners" title="拖动项目排序"></ul>
                <div runat="server" id="divAddGener" class="footBtnArea"><a href="#" runat="server" onserverclick="toAddGener">添加生成方法</a><i title="查看解释" onclick="return showHelp('generator');" class="what"></i></div>
                <asp:Button runat="server" ID="btnBuild" OnClick="OperaBuilder" CssClass="hide" />
            </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdatePanel ID="divOpr" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <ul runat="server" id="oprs" class="withicon moveable" title="拖动项目排序"></ul>
                <div runat="server" id="divAddOpr" class="footBtnArea"><a href="#" id="aAddOpr" runat="server" onserverclick="ShowOpr">添加自定义操作</a><i title="查看解释" onclick="return showHelp('customopera');" class="what"></i></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" HelpSubject="customopera" Width="465">
        <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"><i class="pointer f-add3 fb2 lightgreen" title="添加动作" onclick="addAction();" id="addAct"></i></div>
                    </td>
                </tr>
                <tr><td class="oprKey">提示：</td><td><asp:TextBox runat="server" ID="tbConfirm" Width="99%" ToolTip="输入操作提示"></asp:TextBox></td></tr>
                <tr><td class="oprKey">授权：</td><td><asp:TextBox runat="server" ID="oprRoles" TextMode="MultiLine" Rows="3" Width="99%" acfid="RoleName" chars=";；、,，"></asp:TextBox>
                    <br /><asp:CheckBox runat="server" ID="cbOprOnly" Text="仅用于符合条件的记录：" /><a href="#" class="vmiddle" onclick="return ShowFilter(this,'OprCond');">设置条件</a>
                    </td></tr>
            </table>
            <div class="greenarea infoico mtop_n">动作设置可用变量 <asp:DropDownList runat="server" ID="ddlVars" onchange="$('#fieldTag').text($(this).val());"></asp:DropDownList>：<span id="fieldTag"></span></div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="gen" Title="生成设置" Width="440" HelpSubject="generator" OnOkClick="AddGenerator" HideOnOkClientClick="false" OnOkClientClick="return preAddGenerator();">
        <ContentTemplate>
            <fieldset><legend>源数据：<asp:DropDownList runat="server" ID="ddlSource" AutoPostBack="true" OnSelectedIndexChanged="GenerSourceChanged"></asp:DropDownList></legend>
                <div class="padbox middle" title="设置条件后，只有满足条件的数据才用于生成">
                    <asp:CheckBox runat="server" ID="cbCond" Text="条件：" /><a runat="server" href="#" onclick="return ShowFilter(this,'GenCond',false,$('#gen_ddlSource').val());" id="aGenCond">设置条件</a>
                </div>
            </fieldset>
            <fieldset class="mtop_n"><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 small rd" value="添加映射" onclick="addMap();" />
                    <div class="sepMaps"></div>
                    <ul id="maps" runat="server" class="ulnormal"></ul>
                    <div id="mapMsg" runat="server" class="gray middle"></div>
                </div>
            </fieldset>
            <fieldset class="mtop_n"><legend>浏览源数据时，允许：</legend>
                <asp:CheckBoxList runat="server" ID="apply" RepeatLayout="UnorderedList"></asp:CheckBoxList>
            </fieldset>
            <asp:CheckBox runat="server" ID="cbToedit" Text="生成为编辑状态" /> <asp:CheckBox runat="server" ID="cbDelsrc" Text="生成后删除源数据" />
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="sub" OnOkClick="AddRelation" Width="465" HideOnOkClientClick="false" HelpSubject="masterSlave" OnOkClientClick="return preAddSub();">
        <ContentTemplate>
            <fieldset runat="server" id="subZone"><legend>选择子模板：<asp:DropDownList runat="server" ID="ddlChildren" AutoPostBack="true" OnDataBound="FillRelatedFields" OnSelectedIndexChanged="FillRelatedFields"></asp:DropDownList></legend>
            <div runat="server" id="union">
            <div>关联：<asp:DropDownList runat="server" ID="ddlSubFields"></asp:DropDownList> 关联到当前 <asp:DropDownList runat="server" ID="ddlCurFields"></asp:DropDownList></div>
            <div class="mtop_s">选项：<asp:CheckBox runat="server" ID="cbUpdate" Text="同步更新关联字段" ToolTip="确定在更新当前模板关联字段时是否同步更新子模板中的关联字段" />
                <asp:CheckBox runat="server" ID="cbDel" Checked="true" ToolTip="确定删除记录时是否同步删除子模板中相关联的记录" Text="同步删除关联记录" />
                <asp:CheckBox runat="server" ID="cbAdd" ToolTip="添加主记录时在子模板中同步添加一条关联记录。仅适用于一对一关系。" onclick="promptSynAdd();" Text="同步添加关联记录" /><br />
            <span class="hidden">选项：</span><asp:CheckBox runat="server" ID="cbRequired" Text="必须填写关联记录" ToolTip="要求填写主表记录时必须填写子表记录" />
                <asp:CheckBox runat="server" ID="cbProtect" Text="满足" /><label for="sub_cbProtect"><a runat="server" href="#" onclick="$('#sub_cbProtect').prop('checked',true);return ShowFilter(null,'LockCond');" class="abbr" title="设置条件" id="aMainCond">条件</a>时锁定关联记录</label></div>
            </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="adduq" Width="436" HideOnOkClientClick="false" HelpSubject="unionquery" OnOkClick="AddUnion">
        <ContentTemplate>
            <div runat="server" id="uqZone">
                <b>来源：</b> <asp:DropDownList runat="server" ID="ddlUqts" AutoPostBack="true" OnDataBound="FillUnionFields" OnSelectedIndexChanged="FillUnionFields"></asp:DropDownList><br />
                <div id="uqrel" runat="server">
                    <b>关联：</b><asp:DropDownList runat="server" ID="srcfs"></asp:DropDownList> 等于当前 <asp:DropDownList runat="server" ID="curfs"></asp:DropDownList>
                    <div id="more1" runat="server" class="hide"><b class="hidden">关联：</b><asp:DropDownList runat="server" ID="srcfs2"></asp:DropDownList> 等于当前 <asp:DropDownList runat="server" ID="curfs2"></asp:DropDownList></div>
                    <div id="more2" runat="server" class="hide"><b class="hidden">关联：</b><asp:DropDownList runat="server" ID="srcfs3"></asp:DropDownList> 等于当前 <asp:DropDownList runat="server" ID="curfs3"></asp:DropDownList></div>
                    <i class="f-rr f0 black" id="adduqCond" title="添加关联条件" onclick="addUnionCond();"></i>
                </div>
                <div id="fsDiv">
                    <b>组合：</b>
                    <div class="sepline2"></div>
                    <asp:CheckBoxList ToolTip="选择要组合的字段" runat="server" CssClass="green" ID="uqfs" RepeatLayout="Flow" RepeatDirection="Horizontal"></asp:CheckBoxList><span runat="server" id="joinMsg" class="red"></span>
                </div>
            </div>
            <p runat="server" id="uqMsg" class="mtop_l indent red"></p>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="rem" Width="430" OnOkClick="AddRemind" OnOkClientClick="return preAddRemind();" OnClientUpdated="setFqcy();" HideOnOkClientClick="false">
        <ContentTemplate>
            <div style="line-height:26px">
            　　名称： <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');" title="若无需条件，可不设条件">提醒条件</a>，<a href="#" runat="server" onclick="return showExer(this);" id="aExer">提醒对象</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({el:this,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"><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><br />
            　　选项： <asp:CheckBox runat="server" ID="cbIgnore" Checked="true" Text="已提醒的记录未修改就不再提醒" />
            </div>
            <div id="divCon">
            　　　　　 <asp:CheckBox runat="server" ID="cbCon" Text="单条记录则包含其所有字段数据" />
            </div>
            　　　　　 <asp:CheckBox runat="server" ID="cbSend" Text="附带发送：" /><asp:DropDownList runat="server" ID="ddlSend" AutoPostBack="true" OnSelectedIndexChanged="FillSend"><asp:ListItem Value="Report" Selected="True">报表</asp:ListItem><asp:ListItem Value="Chart">图表</asp:ListItem></asp:DropDownList>
            <asp:DropDownList runat="server" ID="ddlLays"></asp:DropDownList>
        </ContentTemplate>
    </ims:Pop>
    <div id="audient" runat="server" class="pop" style="width:555px">
        <div class="head">
            <div class="title Default">提醒对象</div><div class="close" onclick="HideDialog(this);"></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(this);" />
        </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="465" HideOnOkClientClick="false" HelpSubject="fastFilter">
    <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();" ShowCancelButton="false" Width="400">
    <ContentTemplate>
        <fieldset runat="server" id="fsData"><legend>数据管理</legend>
            <div class="padscenter">
                <asp:Button runat="server" ID="btnCo" CssClass="btn smaller" OnClick="DoCarryover" OnClientClick="return confirm('确定吗？');" Text="结转" />
                <asp:Button ID="backup" runat="server" class="btn smaller" OnClick="DataBackup" Text="备份" />
                <asp:Button ID="clearAll" runat="server" OnClientClick="return confirm('将清空所有数据(除了受保护的)，且不可恢复。请慎重!\n确定清空吗？');" OnClick="ClearAll" CssClass="btn smaller" Text="清空"></asp:Button>
                <asp:Button ID="removeTo" runat="server" OnClick="RemoveTo" OnClientClick="return showDirTree()" CssClass="btn smaller" Text="移到指定目录"></asp:Button>
            </div>
        </fieldset>
        <fieldset runat="server" id="fsIO"><legend>数据交换</legend>
            <div class="padscenter middle">
                <label runat="server" id="uploadXls" class="btn smaller" title="从Excel文件导入，用于更新或追加数据">导入Excel<input id="xlsfile" name="xlsfile" type="file" onchange="return ShowPop('importMode_popup');" /></label>
                <asp:Button ID="btnToExcel" runat="server" class="btn smaller" OnClick="ToExcel" ToolTip="将数据导出到一个Excel文件" Text="导出Excel" />
                <asp:Button ID="excel" runat="server" class="btn smaller" OnClick="MakeExcelTemplet" ToolTip="下载Excel表单，用以录入数据供导入" Text="下载Excel表单" />
            </div>
        </fieldset>
        <fieldset runat="server" id="update" onkeydown="return enterTo(event,'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 runat="server" id="editArea">
            <asp:TextBox ID="_tb" runat="server" Width="99%" CssClass="nobgborder" autocomplete="off" Visible="false"></asp:TextBox>
            <asp:DropDownList ID="_ddl" runat="server" visible="false"></asp:DropDownList>
            <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>
            <div id="_uploader" runat="server" visible="false"><div class="files" runat="server"></div><div class="icon"><input id="_f" name="_f" class="f" contenteditable="false" multiple="multiple" title="上传(可多选)" onchange="return toUpload(this);" type="file" /></div></div>
            <table ID="_hl" runat="server" style="table-layout:fixed;width:98%" visible="false">
                <tr><td style="width:4.5em">链接文字</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 class="vtop middle" title="仅更新符合条件的记录">
            <asp:CheckBox runat="server" ID="cbFilter" Text="更新条件：" /><a href="#" onclick="return ShowFilter(this);">设置条件</a>
        </td><td class="right">
            <asp:Button ID="btnUpdate" runat="server" Text=" 更新 " OnClick="BatchUpdate" OnClientClick="return doConfirm();" CssClass="btn smaller" />
        </td></tr></table>
        <br />
    </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="seek" Title="查找" Width="360" OkButtonText="查找" OnOkClick="BindAll" OnOkClientClick="return toFind();" HelpSubject="FindTemplet" HideOnOkClientClick="false">
        <ContentTemplate>
            <div class="mtop_n center">名称包含：<input type="text" id="tbFind" acfid="Templet" onkeydown="return keyChanged(event);" /></div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="importMode" ShowCancelButton="false" ShowOkButton="false" Title="导入Excel" Width="280">
        <ContentTemplate>
            <div class="center mtop_l">
                <input type="button" value="导入数据" title="将Excel中的数据追加进来" class="btn" onclick="xlsUpload(false);HideDialog(this);" />
                <input type="button" value="更新数据" title="用Excel中的数据更新现有记录" class="btn" onclick="xlsUpload(true);HideDialog(this);" />
                <input type="button" value="取消" class="btn" onclick="HideDialog(this);" />
            </div>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="ms" Title="添加主从模板" OnOkClientClick="return preAdd();" OnOkClick="AddTemplets" HideOnOkClientClick="false" Width="450">
        <ContentTemplate>
            <fieldset><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><i title="查看解释" onclick="What('DateFormat')" class="what"></i><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_n"><legend>子模板</legend>
                <div class="padbox">
                    模板名称：<asp:TextBox runat="server" ID="tbChildren" Width="80%" placeholder="可输入多个子模板，逗号分隔" ToolTip="可输入多个子模板，逗号分隔"></asp:TextBox>
                </div>
            </fieldset>
            <table><tr><td><asp:CheckBox runat="server" ID="cbOne" Text="一对一关系" /></td><td class="right"><a href="#" onclick="return showHelp('masterSlave');">什么是主从模板？</a></td></tr></table>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="rps" Width="450" ShowOkButton="false" HelpSubject="power" CanelButtonText="关闭">
        <ContentTemplate>
            <asp:PlaceHolder runat="server" ID="phPowers"></asp:PlaceHolder>
        </ContentTemplate>
    </ims:Pop>
    <ims:Pop runat="server" ID="co" Width="486" HelpSubject="carryover" HideOnOkClientClick="false" OnClientUpdated="setMoment();" OnOkClientClick="return preAddCo();" OnOkClick="SaveCarryover">
        <ContentTemplate>
            <asp:UpdatePanel runat="server" ID="upStat" RenderMode="Block" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <fieldset><legend><asp:CheckBox runat="server" ID="cbStat" Text="将统计结果结转到：" /><asp:DropDownList runat="server" ID="tsStat" onchange="autoCheck(this);" AutoPostBack="true" OnSelectedIndexChanged="StatToChanged"></asp:DropDownList></legend>
                        <div class="padbox">
                            源字段：<asp:DropDownList runat="server" ID="cosrc"></asp:DropDownList> <asp:DropDownList runat="server" ID="ddlFuns"></asp:DropDownList><br />
                            映射到：<asp:DropDownList runat="server" ID="cotar"></asp:DropDownList><input type="button" class="btn sec small" value="添加映射" onclick="addStatMap();" />
                            <div class="sepMaps"></div>
                            <ul id="statmaps" runat="server" class="ulnormal"></ul>
                            <div id="statMsg" class="gray middle"><span><i class="infoico"></i>请添加字段映射！</span></div>
                            <div class="sepMaps"></div>
                            <div id="divGroups">
                                <input type="checkbox" runat="server" id="cbGroup" /><label for="co_cbGroup" style="margin-right:0">分组统计：</label><asp:DropDownList runat="server" ID="ddlGroup"></asp:DropDownList><span class='arr_r'>➜</span><asp:DropDownList runat="server" ID="tarGroup"></asp:DropDownList><br />
                                <input type="checkbox" class="hidden" />二级分组：<asp:DropDownList runat="server" ID="ddlGroup2"></asp:DropDownList><span class='arr_r'>➜</span><asp:DropDownList runat="server" ID="tarGroup2"></asp:DropDownList><br />
                                <input type="checkbox" class="hidden" />三级分组：<asp:DropDownList runat="server" ID="ddlGroup3"></asp:DropDownList><span class='arr_r'>➜</span><asp:DropDownList runat="server" ID="tarGroup3"></asp:DropDownList>
                            </div>
                        </div>
                    </fieldset>
                </ContentTemplate>
                <Triggers><asp:AsyncPostBackTrigger ControlID="tsStat" EventName="SelectedIndexChanged" /></Triggers>
            </asp:UpdatePanel>
            <asp:UpdatePanel runat="server" ID="upList" RenderMode="Block" ChildrenAsTriggers="false" UpdateMode="Conditional" class="mtop_n">
                <ContentTemplate>
                    <fieldset><legend><asp:CheckBox runat="server" ID="cbList" Text="将源数据结转到：" /><asp:DropDownList runat="server" ID="tsList" onchange="autoCheck(this);" AutoPostBack="true" OnSelectedIndexChanged="ListToChanged"></asp:DropDownList></legend>
                        <div class="padbox">
                            源字段：<asp:DropDownList runat="server" ID="cosrcList"></asp:DropDownList><br />
                            映射到：<asp:DropDownList runat="server" ID="cotarList"></asp:DropDownList><input type="button" class="btn sec small" value="添加映射" onclick="addListMap();" />
                            <div class="sepMaps"></div>
                            <ul id="listmaps" runat="server" class="ulnormal"></ul>
                            <div id="listMsg" class="gray middle"><span><i class="infoico"></i>请添加字段映射！</span><a href="#" onclick="return autoMap('co_cosrcList','co_cotarList');">自动建立映射</a></div>
                        </div>
                    </fieldset>
                </ContentTemplate>
                <Triggers><asp:AsyncPostBackTrigger ControlID="tsList" EventName="SelectedIndexChanged" /></Triggers>
            </asp:UpdatePanel>
            <fieldset class="mtop_n"><legend>选项</legend>
                <div class="padbox notfocus">
                    <asp:CheckBox runat="server" ID="cbCocond" Text="结转条件：" /><a href="#" title="设置条件。满足该条件的才能结转" onclick="return ShowFilter(this,'CoCond');">设置</a><i title="说明" onclick="What('CoCond')" class="what"></i><br />
                    <asp:CheckBox runat="server" ID="cbMoment" Text="结转时机：" onchange="switchMoment();" />每
                    <asp:DropDownList runat="server" id="ddlMoment" onchange="setMoment();"></asp:DropDownList>
                    <asp:DropDownList runat="server" ID="ddlTimepos">
                        <asp:ListItem Value="Front">最前</asp:ListItem>
                        <asp:ListItem Value="Back">最后</asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox runat="server" ID="tbDays" Width="30"></asp:TextBox> <span id="mmtUnit">天</span>，<asp:CheckBox runat="server" ID="cbAuto" Text="自动结转" /><br />
                    <asp:CheckBox runat="server" ID="delCoTar" Text="结转前清空目标模板数据" /><br />
                    <asp:CheckBox runat="server" ID="delCoSrc" Text="结转后删除源数据" />
                    <div class="sepMaps"></div>
                    结转按钮文字：<asp:TextBox runat="server" ID="coBtnText" Width="72"></asp:TextBox>
                </div>
            </fieldset>
            <div runat="server" id="others">
                同步结转：<asp:CheckBoxList runat="server" ID="cblSyns" RepeatLayout="Flow" RepeatDirection="Horizontal"></asp:CheckBoxList>
            </div>
        </ContentTemplate>
    </ims:Pop>
    <ul id="curInfo" runat="server"></ul>
    <input type="button" id="Updater" runat="server" onserverclick="BindAll" class="hide" /><asp:Button runat="server" ID="btnOpera" CssClass="hide" OnClick="ExeOpera" /><asp:Button runat="server" ID="btnUq" CssClass="hide" OnClick="UqOpera" />
    <script src="js/comm.js"></script><script src="js/templets.js"></script>
    </form>
</body>
</html>