<%@ page language="C#" autoeventwireup="true" inherits="ims.web.flow, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="flow">
<head runat="server">
    <title>流程设计</title><meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body class="waiting" onbeforeunload="confirmExit();">
    <div class="hide"><img src="images/loading.gif" />处理中，请稍候 …</div>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server" OnAsyncPostBackError="AsyncError" />
        <asp:HiddenField runat="server" ID="nodeObjs" />
        <asp:UpdatePanel ID="btns" UpdateMode="conditional" runat="server">
        <ContentTemplate>
            <input type="button" id="btnNew" value="新建" title="创建一个新的流程" class="btn" onclick="createNew();" /><br />
            <input type="button" id="btnSave" value="保存" title="保存当前设计的流程" class="btn" runat="server" onserverclick="Save" onclick="return preSave();" /><br />
            <input type="button" onclick="return showHelp();" value="帮助" class="btn" />
        </ContentTemplate>
        </asp:UpdatePanel>
        
        <ul id="cutline" runat="server" visible="false">
            <li runat="server" id="flowTitle" class="pageTitle left mbottom_m"></li>
            <li><span class="squ Completed"></span>完成</li>
            <li><span class="squ Passed"></span>通过</li>
            <li><span class="squ Rejected"></span>拒绝</li>
            <li><span class="squ Received"></span>进行中</li>
            <li><span class="squ un"></span>未到达</li>
        </ul>

        <div class="menu" id="objMenu">
            <a accesskey="A" href="#" id="aAdd" onclick="return toAssign()">添加/指定下一步骤</a>
            <a accesskey="D" href="#" id="aDel" onclick="return delNode()">删除该步骤 　Alt+D</a>
            <div></div>
            <a accesskey="R" href="#" id="objAttr" onclick="return showAttrs()">属性　　 　　Alt+R</a>
        </div>
        <div class="menu" id="lineMenu">
            <a accesskey="C" href="#" onclick="return setCondition()">设置条件　　 Alt+C</a>
            <a accesskey="R" href="#" id="aDelCond" onclick="return delCond()">删除条件　　 Alt+R</a>
            <a accesskey="D" href="#" onclick="return delLine()">删除　　　　 Alt+D</a>
        </div>
        <div id="start" class="node start" runat="server"><div class='text'>开始</div><div class='hide nexts'></div></div>
        <asp:PlaceHolder runat="server" ID="phNodes"></asp:PlaceHolder>
        <div id="end" class="node end" runat="server"><div class='text'>结束</div></div>

        <div id="assign" class="pop" style="width:400px">
        <div class="head">
            <div class="title Default"><span id="curStep"></span> - 添加/指定下一步骤</div><div class="close" onclick="HideDialog();">×</div>
        </div>
            <div class="body">
                <input type="radio" checked="checked" name="way" id="rbNew" /><label for="rbNew">添加：</label><input type="text" onkeydown="return enterTo('btnAdd');" value="" id="tbNew" onfocus="$('#rbNew').prop('checked',true);" />
                <div id="selectStep">
                    <input type="radio" name="way" id="rbSelect" /><label for="rbSelect">指定：</label><select id="ddlNext" onclick="$('#rbSelect').prop('checked',true);"></select>
                </div>
            </div>
            <div class="btnArea">
                <input type="button" value="确定" id="btnAdd" onclick="assignNext();" class="btn" />
                <input type="button" class="btn" value="取消" onclick="HideDialog();" />
            </div>
        </div>
        <div id="attrs" class="pop noline" style="width:555px">
        <div class="head">
            <div class="title Default"></div><div class="close" onclick="HideDialog();">×</div>
        </div>
            <div class="body notfocus">
                <div id="tabs" class="ui-tabs">
                    <ul>
                        <li class="first"><a href="#normal">常规</a></li>
                        <li class="notend"><a href="#executor">处理者</a></li>
                        <li class="inner"><a href="#timeLimit">处理时限</a></li>
                        <li class="notend"><a href="#formPower">权限</a></li>
                        <li><a href="#notify">通知</a></li>
                        <li class="notstart"><a href="#evt">事件</a></li>
                    </ul>
                    <div id="normal">
                        <ul class="inner">
                            <li><b>步骤名称：</b> <input type="text" id="tbName" /></li>
                            <li><b>步骤类型：</b> <select id="ddlType" onchange="typeChanged();"><option value="1">审批/确认</option><option value="2">事务处理</option></select><span id="toVeto">， <input type="checkbox" id="cbToVeto" /><label for="cbToVeto">拒绝时否决流程</label></span></li>
                            <li><b>处理按钮文字：</b> <input type="text" id="tbText" />
                            <select id="ddlText1" onchange="setBtnText();"><option value="">-选择-</option><option value="完成">完成</option><option value="签收">签收</option><option value="已阅">已阅</option></select>
                            <span id="forText2" class="gray"><select id="ddlText2" onchange="setBtnText();"><option value="">-选择-</option><option value="同意/不同意">同意/不同意</option><option value="合格/不合格">合格/不合格</option><option value="是/否">是/否</option><option value="正确/错误">正确/错误</option></select> 格式：(肯定按钮)/(否定按钮)</span></li>
                            <li><b>多人协调方式：</b> <input type="text" id="tbLeast" title="输入大于0的整数" value="1" class="narrow" /><select id="ddlUnit"><option value="人">人</option><option value="%">%</option></select> <label for="rbPart">处理通过后认为通过</label></li>
                        </ul>
                        <div id="options">
                            <div class="sepline2 inner"></div>
                            <div id="forMerge">
                                <input type="checkbox" id="cbMerge" /><label for="cbMerge">待以下选中步骤都处理通过后才开始本步骤：</label>
                                <div id="toMerge"></div>
                            </div>
                            <div id="forMulti">
                                <input type="checkbox" id="cbManual" /><label for="cbManual" title="由处理人从该步骤的多个分支中选择下一步流向，忽略分支条件">由处理人从多个分支中选择下一步骤</label>( <input type="checkbox" id="cbMulti" /><label for="cbMulti">允许多选</label>)
                            </div>
                        </div>
                        <div runat="server" id="flowOptions">
                            <asp:CheckBox Text="发起流程时，指定计划完成时间" runat="server" ID="needPlanTime" /><br />
                            <asp:CheckBox Text="自动生成流程主题：" onclick="setSubject();" runat="server" ID="cbAutoSubject" /><asp:TextBox runat="server" ToolTip="输入主题生成模式，可使用字段或变量代码占位" ID="tbSt" Width="395"></asp:TextBox>
                            <div id="forSubject" class="box middle">
                                字段或变量代码查询：<asp:DropDownList runat="server" ID="ddlVars" onchange="ddlVarsChanged(this);"></asp:DropDownList>： <span id="varName"></span>
                            </div>
                        </div>
                        <div id="mentDiv">
                            <input type="checkbox" id="cbShowMent" /><label for="cbShowMent">在处理界面显示说明/备注：</label><textarea id="tbMent" rows="3" cols="20"></textarea>
                        </div>
                    </div>
                    <div id="executor">
                        <fieldset onclick="setSkip();"><legend><input type="radio" id="rbRange" name="exec" checked="checked" value="1" onclick="executorChanged();" /><label for="rbRange">以下用户</label><input type="radio" id="rbAssign" name="exec" value="2" onclick="executorChanged();" /><label for="rbAssign">交办人指定</label><input type="radio" id="rbAssignInRange" name="exec" value="3" onclick="executorChanged();" /><label for="rbAssignInRange">交办人在以下范围内指定</label><input type="radio" id="rbAllbut" name="exec" value="4" onclick="executorChanged();" /><label for="rbAllbut">所有用户中排除以下用户</label></legend>
                            <div id="divAssign">
                                <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 class="inner" id="related">
                                <input type="checkbox" id="cbRel" /><select id="ddlRel"><option value="1">交办人的</option><option value="2">发起人的</option></select>： <input type="checkbox" id="cbSelf" value="1" /><label for="cbSelf">本人</label> <input type="checkbox" id="cbLateral" value="2" /><label for="cbLateral">平级</label> <input type="checkbox" id="cbSuperior" value="4" /><label for="cbSuperior">上级</label> <input type="checkbox" id="cbDirectUnderling" value="8" /><label for="cbDirectUnderling">直接下级</label> <input type="checkbox" id="cbUnderling" value="16" /><label for="cbUnderling">所有下级</label>
                                <span runat="server" id="spanLevels"><br /><span class="hidden"><input type="checkbox" /><select><option>交办人的</option></select>： </span><input type="checkbox" id="cbLevel" value="32" /><asp:DropDownList runat="server" ID="ddlLevels"></asp:DropDownList><span class="subItems">的： <input type="checkbox" id="cbLevelRector" value="1" checked="checked" class="levelMember" /><label for="cbLevelRector">负责人</label> <input type="checkbox" class="levelMember" id="cbLevelDirectly" value="2" /><label for="cbLevelDirectly">直属成员</label></span></span>
                                <img src="images/what.gif" title="相关说明" onclick="What('Colleague')" class="what" />
                                </div>
                            </div>
                        </fieldset>
                        <div id="forSkip" class="mtop_s mbottom_l">
                            <input type="checkbox" id="cbSkip" /><label for="cbSkip">若交办人就是上述处理者或其上级，则跳过该步骤</label><img src="images/what.gif" title="解释" onclick="What('HigerSkip')" class="what" />
                        </div>
                        <div id="exclude"><b>排除：</b><span class="inner"><input type="checkbox" id="cbHandover" value="1" /><label for="cbHandover">交办人</label><input type="checkbox" id="cbStarter" value="2" /><label for="cbStarter">发起人</label></span><input type="checkbox" id="cbFixed" value="4" /><label for="cbFixed">指定用户：</label><asp:TextBox runat="server" id="tbNoUsers" acfid="UserName" ToolTip="双击弹出用户选择窗口。多项之间以逗号、分号或顿号分隔" chars=";；,，、" ondblclick="showUserTree(this.id);" /></div>
                    </div>
                    <div id="timeLimit">
                        <input type="radio" id="rbNone" name="limit" checked="checked" value="0" /><label for="rbNone">无</label><br />
                        <input type="radio" id="rbByPrev" name="limit" value="1" /><label for="rbByPrev">交办人指定</label><br />
                        <input type="radio" id="rbRelTime" name="limit" value="2" /><input type="text" id="tbTimeLimit" value="1" class="narrow" /><select id="ddlTimeUnit" onchange="timeUnitChanged();"><option value="1">天</option><option value="2">工作日</option><option value="3">小时</option><option value="4">分钟</option></select> <a href="#" id="aWorkday" onclick="return ShowMsgPop('操作路径：系统管理/系统设置/工作流/工作日设置。');">工作日设置</a><br />
                        <input type="radio" id="rbAbsTime" name="limit" value="3" /><label for="rbAbsTime">到期时间：</label><input type="text" id="tbTime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});" />
                        <div runat="server" id="timeLimitField"><input type="radio" id="rbField" name="limit" value="4" /><label for="rbField">字段</label><asp:DropDownList runat="server" ID="ddlTimeFields"></asp:DropDownList> <label for="rbField">为到期时间</label></div>
                    </div>
                    <div id="formPower">
                        <fieldset><legend>允许的操作</legend>
                            <div class="padbox">
                                <span class="inner"><input type="checkbox" id="cbBack" /><label for="cbBack" title="在处理前，回退到前面的某个步骤。与“撤回”操作不同，撤回是在处理后，从下一步骤（未处理的情况下）撤回到本步骤">回退流程</label></span>
                                <input type="checkbox" id="cbDelNot" /><label for="cbDelNot">删除未完成流程</label>
                                <input type="checkbox" id="cbDelYet" /><label for="cbDelYet">删除已完成流程</label>
                                <input type="checkbox" id="cbLayout" /><label for="cbLayout">版式管理</label>
                                <div runat="server" id="divMent">
                                    <input type="checkbox" id="cbMentRead" /><label for="cbMentRead">查看评论</label>
                                    <input type="checkbox" id="cbMentWrite" /><label for="cbMentWrite">发表评论</label>
                                    <input type="checkbox" id="cbMentDel" /><label for="cbMentDel">删除评论</label>
                                </div>
                            </div>
                        </fieldset><br />
                        <fieldset><legend>允许填写的：</legend>
                            <div class="padbox">
                            <span class="liSquare">字段：</span> <input type="radio" id="rbNoField" name="fieldPower" value="0" onclick="powerChanged();" /><label for="rbNoField">无</label>
                            <input type="radio" id="rbAllFields" name="fieldPower" value="1" checked="checked" onclick="powerChanged();" /><label for="rbAllFields">全部字段</label>
                            <input type="radio" id="rbSome" name="fieldPower" value="2" onclick="powerChanged();" /><label for="rbSome" id="lSome">指定字段</label>
                            <span id="divFields" runat="server" class="colorText">
                                <span runat="server" id="cblFields"></span>　<img src='images/selectall.gif' class='slt' title='全选/全不选' onclick="SelectAll('cblFields');" /><img src='images/revselect.gif' class='slt' title='反选' onclick="RevSelect('cblFields');" />
                            </span>
                            <div runat="server" id="subForm_write" class="liSquare">子表单： <span runat="server" id="cblSubforms_write"></span></div>
                            </div>
                        </fieldset><br />
                        <fieldset><legend>禁止查看的：</legend>
                            <div class="padbox">
                            <span class="liSquare">字段：</span> <input type="radio" id="rbNoField2" name="hidden" value="0" onclick="powerChanged2();" /><label for="rbNoField2">无</label>
                            <input type="radio" id="rbAllFields2" name="hidden" value="1" checked="checked" onclick="powerChanged2();" /><label for="rbAllFields2">全部字段</label>
                            <input type="radio" id="rbSome2" name="hidden" value="2" onclick="powerChanged2();" /><label for="rbSome2" id="lSome2">指定字段</label>
                            <span id="divFields2" runat="server" class="colorText">
                                <span runat="server" id="cblHidden"></span>　<img src='images/selectall.gif' class='slt' title='全选/全不选' onclick="SelectAll('cblHidden');" /><img src='images/revselect.gif' class='slt' title='反选' onclick="RevSelect('cblHidden');" />
                            </span>
                            <div runat="server" id="subForm_hide" class="liSquare">子表单： <span runat="server" id="cblSubforms_hide"></span></div>
                            </div>
                        </fieldset>
                        <div class="gray">注：允许填写的就允许查看，不受此设置影响。</div><div class="padbox"></div>
                    </div>
                    <div id="notify">
                        <fieldset><legend>通知方式</legend>
                            <div class="padbox">
                                <input type="checkbox" id="cbMsg" value="4" /><label for="cbMsg">消息</label><input type="checkbox" value="1" id="cbMail" /><label for="cbMail">邮件</label><input type="checkbox" value="2" id="cbSms" /><label for="cbSms">短信</label><input type="checkbox" value="8" id="cbWx" /><label for="cbWx">微信</label>
                            </div>
                        </fieldset><br />
                        <fieldset><legend>通知时机和对象</legend>
                            <div class="padbox" id="notiTo">
                                <ul>
                                    <li id="li1">
                                        <span id="spanText1">本步骤开始</span>后通知： <input type="checkbox" id="cbStarted_cerator" value="1" /><label for="cbStarted_cerator">流程发起人</label>  <span class="inner"><input type="checkbox" id="cbStarted_prev" value="2" /><label for="cbStarted_prev">交办人</label> <input type="checkbox" id="cbStarted_step" value="4" /><label for="cbStarted_step">本步骤处理人</label> </span><input type="checkbox" id="cbStarted_All" value="8" /><label for="cbStarted_All">流程参与人</label>
                                    </li>
                                    <li class="inner" id="li2">
                                        到期前<input type="text" id="tbBefore" value="1" class="narrow" /><select id="ddlTimeUnit2"><option value="1">天</option><option value="2">工作日</option><option value="3">小时</option><option value="4">分钟</option></select>通知： <input type="checkbox" id="cbBefore_cerator" value="1" /><label for="cbBefore_cerator">流程发起人</label> <input type="checkbox" id="cbBefore_prev" value="2" /><label for="cbBefore_prev">交办人</label> <input type="checkbox" id="cbBefore_step" value="4" /><label for="cbBefore_step">本步骤处理人</label> <input type="checkbox" id="cbBefore_All" value="8" /><label for="cbBefore_All">流程参与人</label>
                                    </li>
                                    <li class="inner" id="li3">
                                        到期后通知： <input type="checkbox" id="cbExpires_cerator" value="1" /><label for="cbExpires_cerator">流程发起人</label> <input type="checkbox" id="cbExpires_prev" value="2" /><label for="cbExpires_prev">交办人</label> <input type="checkbox" id="cbExpires_step" value="4" /><label for="cbExpires_step">本步骤处理人</label> <input type="checkbox" id="cbExpires_All" value="8" /><label for="cbExpires_All">流程参与人</label>
                                    </li>
                                    <li id="li4">
                                        <span id="spanText">处理完毕</span>后通知： <input type="checkbox" id="cbCompleted_cerator" value="1" /><label for="cbCompleted_cerator">流程发起人</label> <span class="inner"><input type="checkbox" id="cbCompleted_prev" value="2" /><label for="cbCompleted_prev">交办人</label> <input type="checkbox" id="cbCompleted_step" value="4" /><label for="cbCompleted_step">本步骤处理人</label> </span><input type="checkbox" id="cbCompleted_All" value="8" /><label for="cbCompleted_All">流程参与人</label>
                                    </li>
                                </ul>
                            </div>
                        </fieldset>
                    </div>
                    <div id="evt">
                        <fieldset><legend id="endTitle">处理完毕时，设置表单字段：</legend>
                            <ul class="square mtop_m">
                                <li><asp:DropDownList runat="server" CssClass="field" ID="ddlEnd1"></asp:DropDownList> 设置为：<asp:DropDownList runat="server" ID="ddlVarEnd1"></asp:DropDownList> <asp:TextBox runat="server" ID="tbEnd1" CssClass="tbValue"></asp:TextBox></li>
                                <li><asp:DropDownList runat="server" CssClass="field" ID="ddlEnd2"></asp:DropDownList> 设置为：<asp:DropDownList runat="server" ID="ddlVarEnd2"></asp:DropDownList> <asp:TextBox runat="server" ID="tbEnd2" CssClass="tbValue"></asp:TextBox></li>
                                <li><asp:DropDownList runat="server" CssClass="field" ID="ddlEnd3"></asp:DropDownList> 设置为：<asp:DropDownList runat="server" ID="ddlVarEnd3"></asp:DropDownList> <asp:TextBox runat="server" ID="tbEnd3" CssClass="tbValue"></asp:TextBox></li>
                                <li><asp:DropDownList runat="server" CssClass="field" ID="ddlEnd4"></asp:DropDownList> 设置为：<asp:DropDownList runat="server" ID="ddlVarEnd4"></asp:DropDownList> <asp:TextBox runat="server" ID="tbEnd4" CssClass="tbValue"></asp:TextBox></li>
                                <li><asp:DropDownList runat="server" CssClass="field" ID="ddlEnd5"></asp:DropDownList> 设置为：<asp:DropDownList runat="server" ID="ddlVarEnd5"></asp:DropDownList> <asp:TextBox runat="server" ID="tbEnd5" CssClass="tbValue"></asp:TextBox></li>
                            </ul>
                        </fieldset>
                        <div class="gray middle mtop_s">
                            <img src="images/info.gif" />"处理结果"对"是/否"类型字段，代表是否批准或完成；对其它类型，为处理动作的按钮文字
                        </div>
                    </div>
                </div>
                <table id="divQuery" class="hide"><tr><td id="startable" class="gray middle"><img src="images/info.gif" /> 以上处理者才能发起该流程</td><td class="right"><a href="#" onclick="return toPopup('userRelations.aspx');" class="u">用户从属关系查询</a></td></tr></table>
            </div>
            <div class="btnArea">
                <input type="button" runat="server" value="确定" id="btnOk" onclick="setAttrs();" class="btn" />
                <input type="button" class="btn" value="取消" runat="server" id="btnCancel" onclick="HideDialog();" />
            </div>
        </div>

        <div id="cond" class="pop" style="width:450px">
            <div class="head">
                <div class="title Default">设置流转条件</div><div class="close" onclick="HideDialog();">×</div>
            </div>
            <div id="flowCond">
                <input type="checkbox" onchange="setLogic();" id="cbAction" /><label for="cbAction">处理结果：</label><input type="radio" id="rbPass" value="1" onclick="setAction();" name="actions" /><label for="rbPass">通过</label><input type="radio" value="2" onclick="setAction();" name="actions" id="rbReject" /><label for="rbReject">拒绝</label><br />
                <div id="logic">
                    <div class="sepline2"></div>
                    <input type="radio" id="rbAnd" value="0" name="logic" /><label for="rbAnd">并且</label><input type="radio" name="logic" value="1" id="rbOr" /><label for="rbOr">或者</label>
                    <div class="sepline2"></div>
                </div>
                <input type="checkbox" onchange="setLogic();" id="cbCond" /><label for="cbCond">表单条件：</label><a href="javascript:void(0);" id="aCond" onclick="$('#cbCond').prop('checked',true);return ShowFilter();">设置条件</a>
            </div>
            <div class="btnArea">
                <input type="button" value="确定" onclick="saveCondition();" class="btn" />
                <input type="button" class="btn" value="取消" onclick="HideDialog();" />
            </div>
        </div>

        <script src="js/comm.js"></script><script src="js/raphael.js"></script><script src="js/flow.js"></script>
    </form>
</body>
</html>
