flow_dispose.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:32k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="java.util.*"%>
  4. <%@ page import="cn.js.fan.web.*"%>
  5. <%@ page import="com.redmoon.oa.person.*"%>
  6. <%@ page import="com.redmoon.oa.pvg.*"%>
  7. <%@ page import="com.redmoon.oa.dept.*"%>
  8. <%@ page import="com.redmoon.oa.flow.*"%>
  9. <%@ page import="com.redmoon.oa.task.TaskDb"%>
  10. <HTML>
  11. <head>
  12. <link href="common.css" rel="stylesheet" type="text/css">
  13. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  14. <%
  15. String priv="read";
  16. if (!privilege.isUserPrivValid(request,priv))
  17. {
  18. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  19. return;
  20. }
  21. String myname = privilege.getUser( request );
  22. long myActionId = ParamUtil.getLong(request, "myActionId");
  23. MyActionDb mad = new MyActionDb();
  24. mad = mad.getMyActionDb((long)myActionId);
  25. if (!mad.getUserName().equals(myname) && !mad.getProxyUserName().equals(myname)) {
  26. // 权限检查
  27. out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  28. return;
  29. }
  30. WorkflowActionDb wa = new WorkflowActionDb();
  31. int actionId = (int)mad.getActionId();
  32. wa = wa.getWorkflowActionDb(actionId);
  33. if ( wa==null ) {
  34. out.print(SkinUtil.makeErrMsg(request, "流程中的相应动作不存在!"));
  35. return;
  36. }
  37. if (wa.getStatus()!=wa.STATE_DOING && wa.getStatus()!=wa.STATE_RETURN) {
  38. mad.del();
  39. out.print(StrUtil.Alert_Back("流程中动作节点不处在正处理或被打回状态,可能已经有用户处理过了!"));
  40. return;
  41. }
  42. int flowId = wa.getFlowId();
  43. WorkflowMgr wfm = new WorkflowMgr();
  44. WorkflowDb wf = wfm.getWorkflowDb(flowId);
  45. String flag = wa.getFlag();
  46. String op = ParamUtil.get(request, "op");
  47. Leaf lf = new Leaf();
  48. lf = lf.getLeaf(wf.getTypeCode());
  49. if (op.equals("discard")) {
  50. boolean re = false;
  51. try {
  52. re = wfm.discard(request, flowId);
  53. }
  54. catch (ErrMsgException e) {
  55. out.print(StrUtil.Alert(e.getMessage()));
  56. }
  57. if (re)
  58. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "flow_list_doingorreturn.jsp"));
  59. }
  60. if (op.equals("modifyFlow")) {
  61.     String flowstring = ParamUtil.get(request, "flowstring");
  62. // System.out.print("flow_dispose.jsp flowstring=" + flowstring);
  63. boolean re = false;
  64. try {
  65. re = wf.modifyFlowString(request, flowstring);
  66. }
  67. catch (ErrMsgException e) {
  68. out.print(StrUtil.Alert(e.getMessage()));
  69. }
  70. }
  71. if (op.equals("delAttach")) {
  72. int doc_id = ParamUtil.getInt(request, "doc_id");
  73. int attach_id = ParamUtil.getInt(request, "attach_id");
  74. int page_num = ParamUtil.getInt(request, "page_num");
  75. Document doc = new Document();
  76. doc = doc.getDocument(doc_id);
  77. DocContent dc = doc.getDocContent(page_num);
  78. boolean re = dc.delAttachment(attach_id);
  79. if (re) {
  80. out.print(StrUtil.Alert_Redirect("删除成功!", "flow_dispose.jsp?myActionId=" + myActionId));
  81. }
  82. else
  83. out.print(StrUtil.Alert("删除失败!"));
  84. }
  85. String action = ParamUtil.get(request, "action");
  86. %>
  87. <title>处理流程</title>
  88. <script src="inc/flow_dispose.js"></script>
  89. <script src="inc/flow_js.jsp"></script>
  90. <script>
  91. function setradio(myitem,v)
  92. {
  93.      var radioboxs = document.all.item(myitem);
  94.      if (radioboxs!=null)
  95.      {
  96.        for (i=0; i<radioboxs.length; i++)
  97.           {
  98.             if (radioboxs[i].type=="radio")
  99.               {
  100.                  if (radioboxs[i].value==v)
  101.   radioboxs[i].checked = true;
  102.               }
  103.           }
  104.      }
  105. }
  106. var isXorRadiate = false;
  107. var isCondSatisfied = true;
  108. var hasCond = false;
  109. var action = "<%=action%>";
  110. function SubmitResult() {
  111. // 如果本节点是异或节点,且是条件鉴别节点,如果未满足条件,则在此提醒用户先保存结果,然后继续往下进行
  112. if (isXorRadiate && (hasCond && !isCondSatisfied) ) {
  113. alert("当前处理不满足往下进行的条件(具体条件请见流程图),请先点击保存,待满足条件后继续!");
  114. return;
  115. }
  116. // 如果是自动存档节点,则先保存表单,然后回到此页面,在onload的时候再FinishActoin
  117. <%if (flag.length()>=5 && flag.substring(4, 5).equals("2")) {%>
  118. if (action=="afterAutoSaveArchiveNodeCommit") {
  119. flowForm.op.value = "finish";
  120. }
  121. else
  122. flowForm.op.value = "AutoSaveArchiveNodeCommit";
  123. <%}else{%>
  124. // 如果是条件异或节点,则先保存表单,然后回到此页面,在onload的时候再FinishAction
  125. if (hasCond && action!="afterXorCondNodeCommit") {
  126. flowForm.op.value = "XorCondNodeCommit";
  127. }
  128. else
  129. flowForm.op.value='finish';
  130. <%}%>
  131. flowForm.flowstring.value = Designer.Workflow;
  132. // alert("hasCond=" + hasCond + " op=" + flowForm.op.value);
  133. <%if (flag.length()>=5 && flag.substring(4, 5).equals("2")) {%>   
  134. flowForm.formReportContent.value = hidFrame.getFormReportContent();
  135. <%}%>
  136. flowForm.submit();
  137. }
  138. function SubmitNotDelive() {
  139. // 如果本节点是异或聚合,办理完毕,但不转交
  140. window.location.href = "flow_dispose_do.jsp?myop=setFinishAndNotDelive&myActionId=<%=myActionId%>&actionId=<%=actionId%>";
  141. }
  142. // 编辑文件
  143. function editdoc(doc_id, file_id)
  144. {
  145. redmoonoffice.AddField("doc_id", doc_id);
  146. redmoonoffice.AddField("file_id", file_id);
  147. redmoonoffice.Open("http://<%=Global.server%>:<%=Global.port%>/<%=Global.virtualPath%>/flow_document_get.jsp?doc_id=" + doc_id + "&file_id=" + file_id);
  148. }
  149. // 审批文件,并作痕迹保留
  150. function ReviseByUserColor(user, colorindex, doc_id, file_id)
  151. {
  152. redmoonoffice.AddField("doc_id", doc_id);
  153. redmoonoffice.AddField("file_id", file_id);
  154. <%if (wa.isStart==0) {%>
  155. redmoonoffice.ReviseByUserColor("http://<%=Global.server%>:<%=Global.port%>/<%=Global.virtualPath%>/flow_document_get.jsp?doc_id=" + doc_id + "&file_id=" + file_id, user, colorindex);
  156. <%}else{%>
  157. editdoc(doc_id, file_id);
  158. <%}%>
  159. }
  160. function uploaddoc(doc_id, file_id) {
  161. redmoonoffice.Clear();
  162. redmoonoffice.AddField("doc_id", doc_id);
  163. redmoonoffice.AddField("file_id", file_id);
  164. redmoonoffice.UploadDoc();
  165. // alert(redmoonoffice.ReturnMessage);
  166. }
  167. function OfficeOperate() {
  168. // alert(redmoonoffice.ReturnMessage);
  169. }
  170. function openWin(url,width,height)
  171. {
  172.   var newwin=window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=50,left=120,width="+width+",height="+height);
  173. }
  174. function initTask(flowId, actionId) {
  175. openWin("task_flow_init.jsp?op=newflowtask&flowId=" + flowId + "&actionId=" + actionId, 700, 580);
  176. }
  177. function saveArchive(flowId, actionId) {
  178. openWin("flow_doc_archive_save.jsp?op=saveFromFlow&flowId=" + flowId + "&actionId=" + actionId);
  179. }
  180. function OpenModifyWin(internalName) {
  181. SelAction(internalName);
  182. if (Designer.Message=='no_node') {
  183. alert('节点已不存在!');
  184. return;
  185. }
  186. var isActionSelected = Designer.isActionSelected
  187. if (isActionSelected) {
  188. showModalDialog('flow_action_modify.jsp',window.self,'dialogWidth:480px;dialogHeight:300px;status:no;help:no;')
  189. }
  190. else
  191. alert("请选择一个动作!");
  192. }
  193. function Operate() {
  194.     var STATE_NOTDO = <%=WorkflowActionDb.STATE_NOTDO%>;
  195.     var STATE_IGNORED = <%=WorkflowActionDb.STATE_IGNORED%>;
  196. var STATE_DOING = <%=WorkflowActionDb.STATE_DOING%>;
  197.     var STATE_RETURN = <%=WorkflowActionDb.STATE_RETURN%>;
  198.     var STATE_FINISHED = <%=WorkflowActionDb.STATE_FINISHED%>;
  199. var checkState = getActionCheckState();
  200. if (checkState==STATE_FINISHED || checkState==STATE_DOING) {
  201. alert("动作已完成或者正在处理中时,不能被编辑!");
  202. return;
  203. }
  204. }
  205. function ModifyAction(user, title, clrindex, userRealName, jobCode, jobName, proxyJobCode, proxyJobName, proxyUserName, proxyUserRealName, fieldWrite, checkState, nodeMode, strategy) {
  206. Designer.ActionUser = user;
  207. Designer.ActionTitle = title;
  208. Designer.ActionColorIndex = clrindex;
  209. Designer.ActionUserRealName = userRealName;
  210. Designer.ActionJobCode = jobCode;
  211. Designer.ActionJobName = jobName;
  212. Designer.ActionProxyJobCode = proxyJobCode;
  213. Designer.ActionProxyJobName = proxyJobName;
  214. Designer.ActionProxyUserName = proxyUserName;
  215. Designer.ActionProxyUserRealName = proxyUserRealName;
  216. Designer.ActionFieldWrite = fieldWrite;
  217. Designer.ActionCheckState = checkState;
  218. Designer.ActionDept = Designer.ActionDept;
  219. Designer.ActionFlag = Designer.ActionFlag; // 如果不获取一次属性,在Designer.ModifyAction()中就不能初始化m_actionFlag的值,ActionDept也是如此
  220. Designer.ActionDeptMode = Number(nodeMode);
  221. Designer.ActionStrategy = strategy;
  222. Designer.ModifyAction();
  223. flowForm.isFlowModified.value = "1";
  224. /*
  225. if (confirm("您确定要保存修改过的流程吗?")) {
  226. form100.flowstring.value = Designer.Workflow;
  227. form100.submit();
  228. }
  229. */
  230. }
  231. function getActionUser() {
  232. return Designer.ActionUser;
  233. }
  234. function getActionTitle() {
  235. return Designer.ActionTitle;
  236. }
  237. function getActionColorIndex() {
  238. return Designer.ActionColorIndex;
  239. }
  240. function getActionUserRealName() {
  241. return Designer.ActionUserRealName;
  242. }
  243. function getActionCheckState() {
  244. return Designer.ActionCheckState;
  245. }
  246. function getActionJobCode() {
  247. return Designer.ActionJobCode;
  248. }
  249. function getActionJobName() {
  250. return Designer.ActionJobName;
  251. }
  252. function getActionProxyJobCode() {
  253. return Designer.ActionProxyJobCode;
  254. }
  255. function getActionProxyJobName() {
  256. return Designer.ActionProxyJobName;
  257. }
  258. function getActionProxyUserName() {
  259. return Designer.ActionProxyUserName;
  260. }
  261. function getActionProxyUserRealName() {
  262. return Designer.ActionProxyUserRealName;
  263. }
  264. function getActionFieldWrite() {
  265. return Designer.ActionFieldWrite;
  266. }
  267. function getActionDept() {
  268. return Designer.ActionDept;
  269. }
  270. function getActionNodeMode() {
  271. return Designer.ActionDeptMode;
  272. }
  273. function getActionStrategy() {
  274. return Designer.ActionStrategy;
  275. }
  276. function SelAction(internalName) {
  277. Designer.SelectAction(internalName);
  278. }
  279. function selPerson(internalName, userName, userRealName, nodeMode, isChecked) {
  280. Designer.SelectAction(internalName);
  281.     var STATE_NOTDO = <%=WorkflowActionDb.STATE_NOTDO%>;
  282.     var STATE_IGNORED = <%=WorkflowActionDb.STATE_IGNORED%>;
  283. var STATE_DOING = <%=WorkflowActionDb.STATE_DOING%>;
  284.     var STATE_RETURN = <%=WorkflowActionDb.STATE_RETURN%>;
  285.     var STATE_FINISHED = <%=WorkflowActionDb.STATE_FINISHED%>;
  286. var checkState = getActionCheckState();
  287. if (checkState==STATE_FINISHED || checkState==STATE_DOING) {
  288. alert("动作已完成或者正在处理中时,不能被编辑!");
  289. return;
  290. }
  291. var title = getActionTitle();
  292. var OfficeColorIndex = getActionColorIndex();
  293. var jobCode = getActionJobCode();
  294. var jobName = getActionJobName();
  295. var proxyJobCode = getActionProxyJobCode();
  296. var proxyJobName = getActionProxyJobName();
  297. var proxyUserName = getActionProxyUserName();
  298. var proxyUserRealName = getActionProxyUserRealName();
  299. var fieldWrite = getActionFieldWrite();
  300. var checkState = getActionCheckState();
  301. var dept = getActionDept();
  302. var strategy = getActionStrategy();
  303. var actionUserName = getActionUser();
  304. var actionUserRealName = getActionUserRealName();
  305. if (isChecked) {
  306. // 检查是否有重复,没有则加上userName及userRealName
  307. var userary = actionUserName.split(",");
  308. var len = userary.length;
  309. var isFound = false; 
  310. for (var i=0; i<len; i++) {
  311. if (userary[i]==userName) {
  312. isFound = true;
  313. break;
  314. }
  315. }
  316. if (!isFound) {
  317. if (actionUserName==null || actionUserName=="") {
  318. ;
  319. }
  320. else {
  321. userName = actionUserName + "," + userName;
  322. userRealName = actionUserRealName + "," + userRealName;
  323. }
  324. }
  325. }
  326. else {
  327. // 去除userName及userRealName
  328. var userary = actionUserName.split(",");
  329. var realnameary = actionUserRealName.split(",");
  330. var newary = new Array();
  331. var newrealnameary = new Array();
  332. var len = userary.length;
  333. var k = 0;
  334. for (var i=0; i<len; i++) {
  335. if (userary[i]!=userName) {
  336. newary[k] = userary[i];
  337. newrealnameary[k] = realnameary[i];
  338. k++;
  339. }
  340. }
  341. userName = "";
  342. userRealName = "";
  343. for (i=0; i<k; i++) {
  344. if (userName=="") {
  345. userName = newary[i];
  346. userRealName = newrealnameary[i];
  347. }
  348. else {
  349. userName += "," + newary[i];
  350. userRealName += "," + newrealnameary[i];
  351. }
  352. }
  353. }
  354. ModifyAction(userName, title, OfficeColorIndex, userRealName, jobCode, jobName, proxyJobCode, proxyJobName, proxyUserName, proxyUserRealName, fieldWrite, checkState, nodeMode, strategy);
  355. }
  356. function XorSelect(curInternalName, nextInternalName) {
  357. // if (confirm("您确定要选择该节点吗?")) {
  358. Designer.Message = "";
  359. Designer.SelectXorRadiateActionPath(curInternalName, nextInternalName);
  360. // alert("被忽略的动作节点有:" + Designer.Message);
  361. flowForm.isFlowModified.value = "1";
  362. flowForm.XorNextActionInternalName.value = nextInternalName;
  363. // flowForm_onsubmit(); // 保存节点
  364. // flowForm.submit();
  365. // }
  366. }
  367. var curInternalName, toInternalname
  368. var isCondSatisfied = false;
  369. var toActionName = "";
  370. function setSatisfiedAction()
  371. {
  372. // alert("节点 " + toActionName + " 满足预设的条件!");
  373. XorSelect(curInternalName, toInternalname);
  374. <%
  375. if (action.equals("afterXorCondNodeCommit")) {
  376. %>
  377. alert("节点 " + toActionName + " 满足预设的条件,点击确定继续!");
  378. SubmitResult();
  379. <%
  380. }
  381. %>
  382. }
  383. function checkDesignerInstalled() {
  384. var bCtlLoaded = false;
  385. try {
  386. if (typeof(Designer.ModifyAction)=="undefined")
  387. bCtlLoaded = false;
  388. if (typeof(Designer.ModifyAction)=="unknown") {
  389. bCtlLoaded = true;
  390. }
  391. }
  392. catch (ex) {
  393. }
  394. if (!bCtlLoaded) {
  395. if (confirm("您还没有安装流程控件!请点击确定按钮下载安装!")) {
  396. window.open("activex/oa_client.EXE");
  397. }
  398. }
  399. }
  400. function checkOfficeEditInstalled() {
  401. var bCtlLoaded = false;
  402. try {
  403. if (typeof(redmoonoffice.AddField)=="undefined")
  404. bCtlLoaded = false;
  405. if (typeof(redmoonoffice.AddField)=="unknown") {
  406. bCtlLoaded = true;
  407. }
  408. }
  409. catch (ex) {
  410. }
  411. if (!bCtlLoaded) {
  412. if (confirm("您还没有安装Office在线编辑控件!请点击确定按钮下载安装!")) {
  413. window.open("activex/oa_client.EXE");
  414. }
  415. }
  416. }
  417. function window_onload() {
  418. checkDesignerInstalled();
  419. checkOfficeEditInstalled();
  420. }
  421. </script>
  422. </head>
  423. <body onLoad="window_onload()">
  424.   <%
  425.    com.redmoon.oa.Config cfg = new com.redmoon.oa.Config();
  426. String canUserSeeDesignerWhenDispose = cfg.get("canUserSeeDesignerWhenDispose");
  427. String canUserModifyFlow = cfg.get("canUserModifyFlow");
  428. String mode = "user";
  429. if (canUserModifyFlow.equals("true"))
  430. mode = "user";
  431. else
  432. mode = "view";
  433.   %>
  434. <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  435.   <tr>
  436.     <td width="90%" align="left" class="right-title">&nbsp;&nbsp;&nbsp;处理流程&nbsp;-&nbsp;<%=wf.getTitle()%> ( <%=lf.getName()%> ) 
  437.     <%
  438. int doc_id = wf.getDocId();
  439. DocumentMgr dm = new DocumentMgr();
  440. Document doc = dm.getDocument(doc_id);
  441. %></td>
  442.     <td width="10%" align="left" class="right-title">
  443. <%if (canUserSeeDesignerWhenDispose.equals("true")) {%>
  444. <input name="btnShowDesigner" type="button" class="singleboarder" onClick="ShowDesigner()" value="显示流程" />
  445. <%}%>
  446. </td>
  447.   </tr>
  448.   <tr>
  449.     <td colspan="2">
  450. <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  451.       <tr>
  452.         <td width="100%" valign="top" class="main">
  453. <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  454.             <tr>
  455.               <td width="100%" colspan="3" align="center">
  456.   <object id="Designer" classid="CLSID:ADF8C3A0-8709-4EC6-A783-DD7BDFC299D7" codebase="<%=request.getContextPath()%>/activex/Designer.CAB" style="width:0px; height:0px">
  457.                   <param name="Workflow" value="<%=wf.getFlowString()%>" />
  458.                   <param name="Mode" value="<%=mode%>" />
  459.                   <!--debug user initiate complete-->
  460.                   <param name="CurrentUser" value="<%=privilege.getUser(request)%>" />
  461.               </object>
  462.   </td>
  463.             </tr>
  464.         </table></td>
  465.       </tr>
  466.     </table>
  467.       <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  468.       <form id="flowForm" name="flowForm" action="flow_dispose_do.jsp" onSubmit="return flowForm_onsubmit()" method="post" enctype="multipart/form-data">
  469.         <tr>
  470.           <td width="35%" align="center"><%
  471. Render rd = new Render(request, wf, doc);
  472. out.print(rd.rend(wa));
  473. %>
  474. <textarea name="flowstring" style="display:none"></textarea>
  475. <input name="returnBack" value="<%=wf.isReturnBack()?"true":"false"%>" type=hidden>
  476.                     <table width="70%" border="0" align="center" cellpadding="0" cellspacing="0">
  477.           <tr>
  478.             <td width="91%">文件&nbsp;<input type="file" name="filename" style="width: 300px" />
  479.         &nbsp;&nbsp;
  480.         <input name="button" type="button" onClick="AddAttach()" value="增加附件" /><div id="updiv" name="updiv"></div></td>
  481.             <td width="9%"><input type="hidden" name="flowId" value="<%=flowId%>" />
  482.               <input type="hidden" name="actionId" value="<%=actionId%>" />
  483.               <input type="hidden" name="myActionId" value="<%=myActionId%>" />
  484.               <input type="hidden" name="isFlowModified" value="0"/>
  485.   <input type="hidden" name="XorNextActionInternalName" value=""/>
  486.   <textarea name="formReportContent" style="display:none"></textarea>
  487.   </td>
  488.           </tr>
  489.         </table> </td>
  490.         </tr>
  491.         <tr>
  492.           <td align="center"><br />
  493.             <table width="60%" border="0" cellpadding="3" cellspacing="0" bgcolor="#E3E9EA">
  494.             <tr>
  495.               <td class="right-title">&nbsp;处理流程</td>
  496.             </tr>
  497.             <tr>
  498.               <td>
  499.   <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
  500.                   <tr>
  501.                     <td width="33%" valign="top"><strong>将转交给下列办理人员</strong>:<br>
  502. <%
  503. WorkflowRuler wr = new WorkflowRuler();
  504. Vector vto = wa.getLinkToActions();
  505. boolean flagXorRadiate = wa.isXorRadiate();
  506. if (flagXorRadiate) {
  507. out.print("(请选择某个动作节点后继续)");
  508. }
  509. %>
  510. </td>
  511.                     <td width="67%" valign="top">
  512. <%
  513. Iterator toir = vto.iterator();
  514. // 如果在后继节点的连接线上存在条件,则判别是否有符合条件的分支,如果有满足条件的,则自动运行,注意条件分支中应只有一个分支满足条件
  515. // 鉴别模型 Discriminator Choice
  516. WorkflowLinkDb linkMatched = null;
  517. StringBuffer condBuf = new StringBuffer();
  518. if (flagXorRadiate) {
  519. linkMatched = wa.matchNextBranch(condBuf);
  520. }
  521. String conds = condBuf.toString();
  522. boolean isCondSatisfied = linkMatched!=null?true:false;
  523. boolean hasCond = conds.equals("")?false:true; // 是否含有条件
  524. if (hasCond) {
  525. %>
  526. <script>
  527. hasCond = true;
  528. </script>
  529. <%
  530. }
  531. %>
  532. <script>
  533. <%
  534. if (flagXorRadiate)
  535. out.println("isXorRadiate=true;");
  536. else
  537. out.println("isXorRadiate=false;");
  538. if (isCondSatisfied)
  539. out.println("isCondSatisfied=true;");
  540. else
  541. out.println("isCondSatisfied=false;");
  542. %>
  543. </script>
  544. <%
  545. // 如果没有满足条件的,则不显示待选分支
  546. if (hasCond && !isCondSatisfied) {
  547. out.print("条件“" + StrUtil.toHtml(conds) + "”不匹配,请注意填写是否正确,重新填写后请点击保存按钮!");
  548. }
  549. else {
  550. int q = 0;
  551. while (toir.hasNext()) {
  552. q ++;
  553. WorkflowActionDb towa = (WorkflowActionDb)toir.next();
  554. String color = "";
  555. // 如果本节点是异或发散节点
  556. if (flagXorRadiate) {
  557. // 如果有节点被忽略,则说明有后继节点被选中
  558. if (towa.getStatus()==towa.STATE_IGNORED) {
  559. color = "#99CCCC";
  560. %>
  561. <script>flowForm.XorNextActionInternalName.value = "NODE_SELECTED";</script>
  562. <%
  563. }
  564. // 如果存在条件,且匹配结果不为空
  565. if (hasCond) {
  566. if (isCondSatisfied) {
  567. // 找到满足条件的节点,则在onload时的定时器中选择本节点
  568. if (towa.getInternalName().equals(linkMatched.getTo())) {
  569. %>
  570. <script>
  571. isCondSatisfied = true;
  572. curInternalName = "<%=wa.getInternalName()%>";
  573. toInternalname = "<%=towa.getInternalName()%>";
  574. toActionName = "<%=towa.getJobName()%>";
  575. // XorSelect('<%=wa.getInternalName()%>', '<%=towa.getInternalName()%>'); // 在这里选择无效,因为控件还不能显示,不支持选中节点
  576. </script>
  577. <%
  578. }
  579. else // 条件不满足,则继续寻找,不写出待选节点
  580. continue;
  581. }
  582. }
  583. else {
  584. %>
  585. <span style="background-color:#8888ff"><input name="XorActionSelected" type="radio" value="<%=towa.getInternalName()%>" onClick="XorSelect('<%=wa.getInternalName()%>', '<%=towa.getInternalName()%>')"></span>
  586. <% }
  587. }
  588. out.print("<font color='" + color + "'>" + towa.getJobName() + "</font>:");
  589. if (towa.getJobCode().equals(WorkflowActionDb.PRE_TYPE_USER_SELECT)) {%>
  590. <input type="button" value="选择用户" onClick="OpenModifyWin('<%=towa.getInternalName()%>')">
  591. <%}
  592. else {
  593. Iterator userir = null;
  594. try {
  595. Vector vuser = towa.matchActionUser(towa, wa);
  596. userir = vuser.iterator();
  597. }
  598. catch (ErrMsgException e) {
  599. out.print("<BR><font color=red>" + e.getMessage() + "</font>");
  600. return;
  601. }
  602. String[] userSelected = StrUtil.split(towa.getUserName(), ",");
  603. if (userSelected == null)
  604. userSelected = new String[0];
  605. int userSelectedLen = userSelected.length;
  606. int nodeMode = WorkflowActionDb.NODE_MODE_ROLE_SELECTED;
  607. if (towa.getNodeMode()==towa.NODE_MODE_USER_SELECTED || towa.getNodeMode()==towa.NODE_MODE_USER)
  608. nodeMode = towa.NODE_MODE_USER_SELECTED;
  609. while (userir.hasNext()) {
  610. UserDb ud = (UserDb)userir.next();
  611. String checked = "";
  612. for (int p=0; p<userSelectedLen; p++) {
  613. if (userSelected[p].equals(ud.getName())) {
  614. checked = "checked";
  615. break;
  616. }
  617. }
  618. String onclick = "onClick="selPerson('" + towa.getInternalName() + "', '" + ud.getName() + "', '" + ud.getRealName() + "', '" + nodeMode + "', this.checked)"";
  619. %>
  620. <input name="tmp_sel_person<%=q%>" type="checkbox" <%=checked%> value="<%=ud.getName()%>+<%=ud.getId()%>" <%=onclick%>>
  621. <%
  622. out.print(ud.getRealName());
  623. // if (checked.equals("checked"))
  624. // out.print("(<font color=red>已选</font>)");
  625. }
  626. }
  627. %>
  628. <!--// 不支持删除节点,这样需要对流程图重新解析,会带来用户同时处理并行节点时的图的同步问题
  629. <%if (wr.canUserDeleteAction(request, towa)) {%>
  630.    <a href="javascript:DeleteAction('<%=towa.getInternalName()%>')">[删除]</a>
  631. <%}%>
  632. -->
  633. <hr style="height:1px"/>
  634. <%}
  635. }
  636. // 如果匹配成功了,则flowString会被改写,因此这儿要重新获取一下以刷新Designer中的视图
  637. wf = wfm.getWorkflowDb(flowId);
  638. %>
  639. <textarea id="textareaFlowString" style="display:none"><%=wf.getFlowString()%></textarea>
  640. <script>
  641. Designer.Workflow = flowForm.textareaFlowString.value;
  642. </script>
  643. <%
  644. Vector returnv = wa.getLinkReturnActions();
  645. if (returnv.size()>0) {
  646. %>
  647.     打回至:
  648. <%}
  649. Iterator returnir = returnv.iterator();
  650. while (returnir.hasNext()) {
  651. WorkflowActionDb returnwa = (WorkflowActionDb)returnir.next();
  652. if (returnwa.getStatus()!=WorkflowActionDb.STATE_IGNORED) {
  653. %>
  654.        <input type="checkbox" name="returnId" value="<%=returnwa.getId()%>" checked="checked" />
  655.        <%=returnwa.getUserRealName()%>
  656. <% }
  657. }
  658. %>
  659.                       <br /></td>
  660.                   </tr>
  661.                 </table>
  662.                   </td>
  663.             </tr>
  664.           </table>
  665.             <br /></td>
  666.         </tr>
  667.         <tr>
  668.           <td height="30" align="center">
  669. <%
  670. if (com.redmoon.oa.sms.SMSFactory.isUseSMS()) {
  671. %>
  672. <input name="isToMobile" value="true" type="checkbox" checked="checked" />
  673. 短讯
  674. <%}%>
  675. <input name="isUseMsg" value="true" type="checkbox" checked />
  676.   消息提醒
  677.   <input type="hidden" name="op" value="saveformvalue" />
  678.           <input type="submit" name="Submit" value=" 保 存 " />
  679. <%
  680. if (wr.canUserStartFlow(request, wf)) {%>
  681. &nbsp;&nbsp;
  682. <input name="button" type=button onClick="SubmitResult()" value="开始流程" />
  683. <%}else{%>
  684.              <input type="button" name="Submit2" value="办理完毕" onClick="SubmitResult()" title="转交至下一个动作节点办理"/>
  685.             <%}%>
  686. &nbsp;
  687. <%
  688. // 如果该节点是异或节点,则如果其后续相邻节点中有已完成的节点,说明该节点曾被激活过,那么用户可以选择不往下继续
  689. if (wa.isXorAggregate()) {
  690. int accessedCount = wa.linkedFromActionsAccessedCount();
  691. if (accessedCount>=2) {
  692. %>
  693. <input type="button" onClick="SubmitNotDelive()" value="办理完毕(不转交)" title="置为办理完毕状态,但不转交下一个动作节点办理"/>
  694. <% }
  695. }%>
  696.             <%if (wa.isStart!=1) {%>
  697. <%if (returnv.size()>0) {%>
  698. <input name="button22" type="button" onClick="flowForm.op.value='return';flowForm.flowstring.value=Designer.Workflow;flowForm.submit()" value=" 打  回 " />
  699. <%}%>
  700.             <%}%>
  701.             &nbsp;&nbsp;
  702. <%
  703.   boolean hasTask = false;
  704.   if (wa.getTaskId()!=wa.NOTASK) {
  705.    TaskDb td = new TaskDb();
  706. td = td.getTaskDb(wa.getTaskId());
  707. if (td!=null && td.isLoaded()) {
  708. hasTask = true;
  709.   %>
  710.    <input type=button onClick="openWin('task_show.jsp?rootid=<%=td.getId()%>&showid=<%=td.getId()%>', 700, 580)" title="<%=td.getTitle()%>" value="查看任务">
  711.   <%
  712.    }
  713.   }
  714.   %>
  715.   <!--
  716.   <%
  717.   if (!hasTask) {
  718.   %>
  719. <input type="button" value="发起任务" onClick="initTask(<%=wf.getId()%>, <%=wa.getId()%>)"/>
  720.   <%}%>-->
  721. &nbsp;
  722. <%if (flag.length()>=3 && flag.substring(2, 3).equals("1")) {%>
  723. <input name="Submit22" type="button" onClick="window.location.href='?op=discard&myActionId=<%=myActionId%>'" value="放弃流程"/>
  724. <%}%>
  725. &nbsp;
  726. <%if (flag.length()>=4 && flag.substring(3, 4).equals("1")) {%>
  727. <input name="button" type=button onClick="window.location.href='flow_del.jsp?flow_id=<%=flowId%>'" value=" 删 除 " />
  728. <%}%>
  729. &nbsp;
  730. <%if (flag.length()>=5 && flag.substring(4, 5).equals("1")) {%>
  731. <input type="button" value=" 存 档 " onClick="saveArchive(<%=wf.getId()%>, <%=wa.getId()%>)">
  732. <%}%>
  733. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  734. <!--<input name="button2" type="button" onclick="openWin('flow_modify3.jsp?flowId=<%=flowId%>', 640, 480)" value=" 修改流程 " />--></td>
  735.         </tr>
  736.       </form>
  737.     </table>
  738.         <br />
  739.         <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#D6D7DE">
  740.           <tr>
  741.             <td align="left" background="images/top-right.gif" class="right-title">&nbsp;处理附件</td>
  742.           </tr>
  743.           <tr>
  744.             <td align="center" bgcolor="#E3E9EA"><object id="redmoonoffice" classid="CLSID:D01B1EDF-E803-46FB-B4DC-90F585BC7EEE" 
  745. codebase="<%=request.getContextPath()%>/activex/rmoffice.cab#version=2,0,0,1" width="316" height="43" viewastext="viewastext">
  746.                 <param name="Encode" value="utf-8" />
  747.                 <param name="BackColor" value="0000ff00" />
  748.                 <param name="Server" value="<%=Global.server%>" />
  749.                 <param name="Port" value="<%=Global.port%>" />
  750.                 <!--设置是否自动上传-->
  751.                 <param name="isAutoUpload" value="1" />
  752.                 <!--设置文件大小不超过1M-->
  753.                 <param name="MaxSize" value="<%=Global.FileSize%>" />
  754.                 <!--设置自动上传前出现提示对话框-->
  755.                 <param name="isConfirmUpload" value="1" />
  756.                 <!--设置IE状态栏是否显示信息-->
  757.                 <param name="isShowStatus" value="0" />
  758.                 <param name="PostScript" value="<%=Global.virtualPath%>/flow_document_check.jsp" />
  759.               </object>
  760.             <!--<input name="remsg" type="button" onclick='alert(redmoonoffice.ReturnMessage)' value="查看上传后的返回信息" />-->            </td>
  761.           </tr>
  762.       </table>
  763.       <span class="stable"> </span>
  764.         <%
  765.   if (doc!=null) {
  766.   java.util.Vector attachments = doc.getAttachments(1);
  767.   java.util.Iterator ir = attachments.iterator();
  768.   while (ir.hasNext()) {
  769.    Attachment am = (Attachment) ir.next(); %>
  770.         <table width="60%"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#D6D3CE" bgcolor="#E3E9EA">
  771.           <tr>
  772.             <td width="5%" height="31" align="right"><img src="images/attach.gif" /></td>
  773.             <td width="72%">&nbsp; <%=am.getName()%><br />            </td>
  774.             <td width="23%">
  775. <%
  776. String ext = StrUtil.getFileExt(am.getDiskName());
  777. if (ext.equals("doc") || ext.equals("xls")) {%>
  778. <%if (wa.isStart==1) {%>
  779.                 <input name="button" type="button" class="singleboarder" onClick="javascript:ReviseByUserColor('<%=myname%>', <%=wa.getOfficeColorIndex()%>, <%=doc_id%>, <%=am.getId()%>)" value="编 辑" />
  780.                 <%}else{%>
  781.                 <input name="button" type="button" class="singleboarder" onClick="javascript:ReviseByUserColor('<%=myname%>', <%=wa.getOfficeColorIndex()%>, <%=doc_id%>, <%=am.getId()%>)" value="审 批" />
  782.                 <%}%>
  783. <%}else{%>
  784. <a href="flow_getfile.jsp?attachId=<%=am.getId()%>&flowId=<%=flowId%>" target="_blank">查看</a>
  785. <%}%>
  786.               &nbsp;&nbsp;
  787.               <!--<input type=button class="singleboarder" onClick="javascript:uploaddoc(<%=doc_id%>, <%=am.getId()%>)" value="  上 传  ">-->
  788.               <%if (flag.length()>=6 && flag.substring(5, 6).equals("1")) {%>
  789.   &nbsp;
  790.               <a href="?op=delAttach&myActionId=<%=myActionId%>&flowId=<%=flowId%>&doc_id=<%=am.getDocId()%>&attach_id=<%=am.getId()%>&page_num=1">删除</a>
  791.   <%}%>     </td>
  792.           </tr>
  793.       </table>
  794.         <%}
  795.   }
  796.   %>
  797. <%if (flag.length()>=5 && flag.substring(4, 5).equals("2")) {%>   
  798.   <iframe id="hidFrame" src="flow_doc_archive_content.jsp?flowId=<%=flowId%>&actionId=<%=actionId%>" width=0 height=0></iframe>
  799. <%}%>
  800.       <br /></td>
  801.   </tr>
  802. </table>
  803. <table width=98% border="0" align="center" cellpadding="0" cellspacing="0">
  804. <form name=form100 action="?op=modifyFlow" method=post>
  805. <tr><td>
  806. <input name="flowstring" type="hidden">
  807. <input name="flowId" type="hidden" value="<%=flowId%>">
  808. <input name="myActionId" type="hidden" value="<%=myActionId%>">
  809. </td></tr>
  810. </form>
  811. </table>
  812. <br />
  813. </body>
  814. <script>
  815. function flowForm_onsubmit() {
  816. flowForm.flowstring.value = Designer.Workflow;
  817. }
  818. function DeleteAction(internalName) {
  819. if (!confirm("您确定要删除吗?")) {
  820. return;
  821. }
  822. SelAction(internalName);
  823. if (Designer.Message=='no_node') {
  824. alert('节点已不存在!');
  825. return;
  826. }
  827. Designer.DeleteAllSelected();
  828. SelAction(internalName);
  829. if (Designer.Message=='no_node') {
  830. alert("已从流程图中删除,请保存或者转交!");
  831. }
  832. flowForm.isFlowModified.value = "1";
  833. }
  834. var attachCount = 1;
  835. function AddAttach() {
  836. updiv.innerHTML += "<table width=100%><tr>文件&nbsp;<input type='file' name='filename" + attachCount + "' style='width:300px'><td></td></tr></table>";
  837. attachCount += 1;
  838. }
  839. function ShowDesigner() {
  840. if (Designer.style.width=="0px") {
  841. Designer.style.width = 740;
  842. Designer.style.height = 338;
  843. btnShowDesigner.value = "隐藏流程";
  844. }
  845. else {
  846. Designer.style.width = 0;
  847. Designer.style.height = 0;
  848. btnShowDesigner.value = "显示流程";
  849. }
  850. }
  851. // 利用定时器来选择路径,因为窗口load时,控件由于不能选择节点,因而无法进行路径的处理,但是放在body的onload事件中也有问题,因为当有图片找不着时,页面显示出来了,因为图片不能显示,致onload事件很久才能激发
  852. if (isCondSatisfied) {
  853. // 满足条件,则选定路径
  854. // setSatisfiedAction(); // 直接调用无效,需置于setTimeout中
  855. window.setTimeout("setSatisfiedAction()", 200);
  856. }
  857. // 如果是自动存档节点,则在保存返回本页后,自动转交下一步
  858. if (action=="afterAutoSaveArchiveNodeCommit") {
  859. window.setTimeout("SubmitResult()", 200);
  860. }
  861. </script>
  862. </html>