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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="java.util.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="cn.js.fan.web.*"%>
  5. <%@ page import="com.redmoon.oa.flow.*"%>
  6. <%@ page import="com.redmoon.oa.pvg.*"%>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8. <html xmlns="http://www.w3.org/1999/xhtml">
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  11. <link rel="stylesheet" type="text/css" href="../common.css">
  12. <title>预定义流程列表</title>
  13. <script>
  14. function findObj(theObj, theDoc)
  15. {
  16.   var p, i, foundObj;
  17.   
  18.   if(!theDoc) theDoc = document;
  19.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  20.   {
  21.     theDoc = parent.frames[theObj.substring(p+1)].document;
  22.     theObj = theObj.substring(0,p);
  23.   }
  24.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  25.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  26.     foundObj = theDoc.forms[i][theObj];
  27.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  28.     foundObj = findObj(theObj,theDoc.layers[i].document);
  29.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  30.   
  31.   return foundObj;
  32. }
  33. var GetDate=""; 
  34. function SelectDate(ObjName,FormatDate){
  35. var PostAtt = new Array;
  36. PostAtt[0]= FormatDate;
  37. PostAtt[1]= findObj(ObjName);
  38. GetDate = showModalDialog("util/calendar/calendar.htm", PostAtt ,"dialogWidth:286px;dialogHeight:221px;status:no;help:no;");
  39. }
  40. function SetDate()
  41. findObj(ObjName).value = GetDate; 
  42. }
  43. </script>
  44. <style type="text/css">
  45. <!--
  46. .STYLE3 {color: #FFFFFF}
  47. -->
  48. </style>
  49. </head>
  50. <body>
  51. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  52. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  53. <%
  54. String priv = "admin.flow";
  55. if (!privilege.isUserPrivValid(request, priv))
  56. {
  57. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  58. return;
  59. }
  60. String dirCode = ParamUtil.get(request, "dirCode");
  61. if (dirCode.equals("")) {
  62. out.print(StrUtil.p_center("请选择流程类型!"));
  63. return;
  64. }
  65. Leaf lf = new Leaf();
  66. lf = lf.getLeaf(dirCode);
  67. if (lf==null || !lf.isLoaded()) {
  68. out.print(SkinUtil.makeErrMsg(request, "节点不存在!"));
  69. return;
  70. }
  71. // 如果是分类节点,则重定向至表单处理页面
  72. if (lf.getType()==lf.TYPE_NONE) {
  73. response.sendRedirect("form_m.jsp?flowTypeCode=" + StrUtil.UrlEncode(lf.getCode()));
  74. return;
  75. }
  76. LeafPriv lp = new LeafPriv(dirCode);
  77. if (!(lp.canUserSee(privilege.getUser(request)))) {
  78. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  79. return;
  80. }
  81. WorkflowPredefineDb fd = new WorkflowPredefineDb();
  82. String op = ParamUtil.get(request, "op");
  83. if (op.equals("del")) {
  84. WorkflowPredefineMgr ftm = new WorkflowPredefineMgr();
  85. boolean re = false;
  86. try {
  87. re = ftm.del(request);
  88. }
  89. catch (ErrMsgException e) {
  90. out.print(StrUtil.Alert(e.getMessage()));
  91. }
  92. if (re) {
  93. out.print(StrUtil.Alert("删除成功!"));
  94. }
  95. else {
  96. out.print(StrUtil.Alert("删除失败!"));
  97. }
  98. }
  99. if (op.equals("setDefault")) {
  100. int id = ParamUtil.getInt(request, "id");
  101. fd = fd.getWorkflowPredefineDb(id);
  102. fd.setDefaultFlow(true);
  103. if (fd.save())
  104. out.print(StrUtil.Alert("操作成功!"));
  105. else
  106. out.print(StrUtil.Alert("操作失败!"));
  107. }
  108. %>
  109. <table width="646" height="89" border="0" align="center" cellpadding="0" cellspacing="0" class="tableframe">
  110.   <tr>
  111.     <td height="23" class="right-title">&nbsp;&nbsp;<%=lf.getName()%>&nbsp;预定义流程管理</td>
  112.   </tr>
  113.   <tr>
  114.     <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  115.       <form action="?" method="post">
  116.         <tr>
  117.           <td height="100" align="center" class="p14"><br />
  118.                 <table width="98%" cellpadding="0" cellspacing="1">
  119.                   <tr>
  120.                     <td width="11%" height="25" align="center" bgcolor="#5286BD" ><span class="STYLE3">默认</span></td>
  121.                     <td width="36%" align="center" bgcolor="#5286BD" ><span class="STYLE3">名称</span></td>
  122.                     <td width="31%" align="center" bgcolor="#5286BD" class="STYLE3" >类别</td>
  123.                     <td width="22%" height="25" align="center" bgcolor="#5286BD" ><span class="STYLE3">操作</span></td>
  124.                   </tr>
  125.               </table>
  126.         <%
  127. WorkflowPredefineDb ftd = new WorkflowPredefineDb();
  128. String sql = "select id from flow_predefined where typeCode=" + StrUtil.sqlstr(dirCode);
  129. Iterator ir = ftd.list(sql).iterator();
  130. Directory dir = new Directory();
  131. while (ir.hasNext()) {
  132. ftd = (WorkflowPredefineDb) ir.next();
  133. %>
  134.                 <table width="98%"  border="0" cellpadding="5" cellspacing="1" class="p14">
  135.                   <tr>
  136.                     <td width="11%" align="center" bgcolor="#F9F9F9" ><input type="checkbox" name="isDefault" value="true" onclick="setDefault(this, '<%=ftd.getId()%>', '<%=dirCode%>')" <%=ftd.isDefaultFlow()?"checked":""%>/></td>
  137.                     <td width="36%" bgcolor="#F9F9F9" ><%=ftd.getTitle()%></td>
  138.                     <td width="31%" bgcolor="#F9F9F9" ><%=dir.getLeaf(ftd.getTypeCode()).getName()%></td>
  139.                     <td width="22%" align="center" bgcolor="#F9F9F9" ><a href="flow_predefine_init.jsp?op=edit&id=<%=ftd.getId()%>">修改</a>&nbsp;&nbsp;<a href="#" onclick="if (window.confirm('您确定要删除类型吗?')) window.location.href='flow_predefine_list.jsp?op=del&dirCode=<%=StrUtil.UrlEncode(dirCode)%>&id=<%=ftd.getId()%>'">删除</a></td>
  140.                   </tr>
  141.               </table>
  142.         <%}%>
  143.                 <br />
  144.           </td>
  145.         </tr>
  146.         <tr>
  147.           <td align="center"><a href="flow_predefine_init.jsp?flowTypeCode=<%=StrUtil.UrlEncode(dirCode)%>">增加预定义流程</a></td>
  148.         </tr>
  149.       </form>
  150.     </table></td>
  151.   </tr>
  152. </table>
  153. <br />
  154. <br />
  155. </body>
  156. <script>
  157. function setDefault(chkObj, id, typeCode) {
  158. if (!chkObj.checked) {
  159. alert("请选择您需要置为默认的预定义流程!");
  160. chkObj.checked = true;
  161. }
  162. if (chkObj.checked) {
  163. window.location.href = "flow_predefine_list.jsp?op=setDefault&id=" + id + "&dirCode=" + typeCode;
  164. }
  165. }
  166. </script>
  167. </html>