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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="java.io.InputStream" %>
  3. <%@ page import="java.util.*" %>
  4. <%@ page import="cn.js.fan.db.*" %>
  5. <%@ page import="cn.js.fan.util.*" %>
  6. <%@ page import="com.redmoon.oa.dept.*" %>
  7. <%@ page import="com.redmoon.oa.flow.*" %>
  8. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9. <html>
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  12. <title></title>
  13. <LINK href="../../common.css" type=text/css rel=stylesheet>
  14. <LINK href="default.css" type=text/css rel=stylesheet>
  15. <script>
  16. function form1_onsubmit() {
  17. form1.type.value = form1.seltype.value;
  18. form1.root_code.value = window.parent.dirmainFrame.getRootCode();
  19. }
  20. function selTemplate(id)
  21. {
  22. if (form1.templateId.value!=id) {
  23. form1.templateId.value = id;
  24. }
  25. }
  26. function enableSelType() {
  27. if (confirm("如果该项中已经含有内容,则更改以后会造成问题,您要强制更改吗?")) {
  28. form1.seltype.disabled = false;
  29. }
  30. }
  31. function getDepts() {
  32. return form1.depts.value;
  33. }
  34. function openWinDepts() {
  35. var ret = showModalDialog('../dept_multi_sel.jsp',window.self,'dialogWidth:480px;dialogHeight:320px;status:no;help:no;')
  36. if (ret==null)
  37. return;
  38. form1.deptNames.value = "";
  39. form1.depts.value = "";
  40. for (var i=0; i<ret.length; i++) {
  41. if (form1.deptNames.value=="") {
  42. form1.depts.value += ret[i][0];
  43. form1.deptNames.value += ret[i][1];
  44. }
  45. else {
  46. form1.depts.value += "," + ret[i][0];
  47. form1.deptNames.value += "," + ret[i][1];
  48. }
  49. }
  50. if (form1.depts.value.indexOf("<%=DeptDb.ROOTCODE%>")!=-1) {
  51. form1.depts.value = "<%=DeptDb.ROOTCODE%>";
  52. form1.deptNames.value = "全部";
  53. }
  54. }
  55. </script>
  56. </head>
  57. <body>
  58. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  59. <%
  60. if (!privilege.isUserPrivValid(request, "admin.flow")) {
  61.     out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  62. return;
  63. }
  64. %>
  65. <%
  66. String parent_code = ParamUtil.get(request, "parent_code");
  67. if (parent_code.equals(""))
  68. parent_code = "root";
  69. String parent_name = ParamUtil.get(request, "parent_name");
  70. String code = ParamUtil.get(request, "code");
  71. String name = ParamUtil.get(request, "name");
  72. String description = ParamUtil.get(request, "description");
  73. String op = ParamUtil.get(request, "op");
  74. boolean isHome = false;
  75. int type = 0;
  76. if (op.equals(""))
  77. op = "AddChild";
  78. Leaf leaf = null;
  79. if (op.equals("modify")) {
  80. Directory dir = new Directory();
  81. leaf = dir.getLeaf(code);
  82. name = leaf.getName();
  83. description = leaf.getDescription();
  84. type = leaf.getType();
  85. isHome = leaf.getIsHome();
  86. }
  87. %>
  88. <TABLE 
  89. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  90. cellSpacing=0 cellPadding=3 width="95%" align=center>
  91.   <!-- Table Head Start-->
  92.   <TBODY>
  93.     <TR>
  94.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%">目录增加或修改</TD>
  95.     </TR>
  96.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  97.       <TD align="center" style="PADDING-LEFT: 10px"><table class="frame_gray" width="474" border="0" cellpadding="0" cellspacing="1">
  98.         <tr>
  99.           <td width="470" align="center"><table width="98%">
  100.             <form name="form1" method="post" action="flow_dir_top.jsp?op=<%=op%>" target="dirmainFrame" onClick="return form1_onsubmit()">
  101.               <tr>
  102.                 <td width="78" rowspan="8" align="left" valign="top"><br>
  103.                   当前结点:<br>
  104.                     <font color=blue><%=parent_name.equals("")?"根结点":parent_name%></font> </td>
  105.                 <td width="312" align="left"> 编码:
  106.                     <input name="code" value="<%=code%>" <%=op.equals("modify")?"readonly":""%>>                </td>
  107.               </tr>
  108.               <tr>
  109.                 <td align="left">名称:
  110.                     <input name="name" value="<%=name%>"></td>
  111.               </tr>
  112.               <tr>
  113.                 <td align="left">描述:
  114.                     <input name="description" value="<%=description%>">
  115.                     <input type=hidden name=parent_code value="<%=parent_code%>">                    </td>
  116.               </tr>
  117.               <tr>
  118.                 <td align="left">
  119. <%
  120. String disabled = "";
  121. if (op.equals("modify") && leaf.getType()>=1)
  122. disabled = "true";
  123. %>
  124. 类型:
  125.                   <select name="seltype">
  126.                     <option value="<%=Leaf.TYPE_NONE%>">分类</option>
  127.                     <option value="<%=Leaf.TYPE_LIST%>" <%=op.equals("AddChild")?"selected":""%>>流程</option>
  128.                   </select>
  129.   <script>
  130.   <%if (op.equals("modify")) {%>
  131.   form1.seltype.value = "<%=type%>"
  132.   <%}%>
  133.   form1.seltype.disabled = "<%=disabled%>"
  134.   </script>
  135.   <input type=hidden name=root_code value="">
  136.   <input type=hidden name="type" value="<%=type%>">
  137.                   <input type=hidden name="templateId" class="singleboarder" value="<%=op.equals("modify")?""+leaf.getTemplateId():"-1"%>" size=3 readonly>
  138. &nbsp; </td>
  139.               </tr>
  140.               <tr>
  141.                 <td align="left"><span class="unnamed2">
  142.                   <%if (op.equals("modify")) {%>
  143.                   <script>
  144.   var bcode = "<%=leaf.getCode()%>";
  145.       </script>
  146. 父结点:
  147. <select name="parentCode">
  148. <%
  149. Leaf rootlf = leaf.getLeaf("root");
  150. DirectoryView dv = new DirectoryView(rootlf);
  151. dv.ShowDirectoryAsOptionsWithCode(out, rootlf, rootlf.getLayer());
  152. %>
  153. </select>
  154. <script>
  155. form1.parentCode.value = "<%=leaf.getParentCode()%>";
  156. </script>
  157. <%}%>
  158.                 </span></td>
  159.               </tr>
  160.               
  161.               <tr>
  162.                 <td align="left">
  163. <%
  164. boolean canEditForm = true;
  165. if (op.equals("modify")) {
  166. WorkflowDb wfd = new WorkflowDb();
  167. int count = wfd.getWorkflowCountOfType(leaf.getCode());
  168. FormDb fd = new FormDb();
  169. fd = fd.getFormDb(StrUtil.getNullString(leaf.getFormCode()));
  170. if (leaf.getType()==Leaf.TYPE_LIST) {
  171. if (count>0) {
  172. canEditForm = false;
  173. %>
  174. 表单:<%=fd.getName()%>&nbsp;(流程数量现有<%=count%>个)
  175. <input name="formCode" value="<%=leaf.getFormCode()%>" type="hidden">
  176. <%}
  177. else
  178. canEditForm = true;
  179. }
  180. else
  181. canEditForm = false;
  182. }
  183. if (canEditForm) {%>
  184.                   表单:<select name="formCode">
  185.                     <%
  186. String flowTypeCode = "";
  187. if (op.equals("modify"))
  188. flowTypeCode = leaf.getParentCode();
  189. else
  190. flowTypeCode = parent_code;
  191. FormDb fd = new FormDb();
  192. String sql = "select code from form where flowTypeCode=" + StrUtil.sqlstr(flowTypeCode) + " and isFlow=1 order by orders asc";
  193. Iterator ir = fd.list(sql).iterator();
  194. while (ir.hasNext()) {
  195. fd = (FormDb)ir.next();
  196. %>
  197.                     <option value="<%=fd.getCode()%>"><%=fd.getName()%></option>
  198.                     <%
  199. }
  200. %>
  201.                   </select>
  202.                   <%if (op.equals("modify")) {%>
  203.                   <script>
  204. form1.formCode.value = "<%=leaf.getFormCode()%>";
  205. </script>
  206.                   <%}%>
  207.         <%}%>
  208.       <input type="hidden" name="isHome" value="true">
  209.                   <input type="hidden" name="pluginCode" value="default">   </td>
  210.               </tr>
  211.               <tr>
  212.                 <td align="left">能够发起此流程的部门:(空表示所有部门)<br>
  213.                     <input type="hidden" name="depts" value="<%=op.equals("modify")?leaf.getDept():""%>">
  214.           <textarea name="deptNames" cols="45" rows="5" readOnly wrap="yes" id="deptNames"><%
  215.   if (op.equals("modify")) {
  216.   String[] arydepts = StrUtil.split(leaf.getDept(), ",");     
  217.   int len = 0;
  218.   String deptNames = "";
  219.   if (arydepts!=null) {
  220. len = arydepts.length;
  221. DeptDb dd = new DeptDb();
  222. for (int i=0; i<len; i++) {
  223. if (deptNames.equals("")) {
  224. dd = dd.getDeptDb(arydepts[i]);
  225. deptNames = dd.getName();
  226. }
  227. else {
  228. dd = dd.getDeptDb(arydepts[i]);
  229. deptNames += "," + dd.getName();
  230. }
  231. }
  232.   }   
  233.      out.print(deptNames);
  234.   }
  235.   %>
  236.   </textarea>
  237.           <span class="TableData">
  238.           <input class="SmallButton" title="添加部门" onClick="openWinDepts()" type="button" value="添 加" name="button">
  239.           <input class="SmallButton" title="清空部门" onClick="form1.deptNames.value='';form1.depts.value=''" type="button" value="清 空" name="button">
  240.           </span></td>
  241.               </tr>
  242.               <tr>
  243.                 <td align="center"><input name="Submit" type="submit" value="提交">
  244.                   &nbsp;&nbsp;&nbsp;
  245.                   <input name="Submit" type="reset" value="重置">
  246.                   &nbsp;&nbsp;&nbsp;
  247.                   <input type="button" value="强制类型修改" onClick="enableSelType()"></td>
  248.               </tr>
  249.             </form>
  250.           </table></td>
  251.         </tr>
  252.       </table>
  253.       </TD>
  254.     </TR>
  255.     <!-- Table Body End -->
  256.     <!-- Table Foot -->
  257.     <TR>
  258.       <TD class=tfoot align=right><DIV align=right> </DIV></TD>
  259.     </TR>
  260.     <!-- Table Foot -->
  261.   </TBODY>
  262. </TABLE>
  263. </body>
  264. </html>