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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import = "java.net.URLEncoder"%>
  3. <%@ page import = "java.util.*"%>
  4. <%@ page import = "cn.js.fan.util.*"%>
  5. <%@ page import = "com.redmoon.oa.flow.*"%>
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  10. <title>创建表单</title>
  11. <link href="../common.css" rel="stylesheet" type="text/css">
  12. <script language="JavaScript" type="text/JavaScript">
  13. <!--
  14. function MM_preloadImages() { //v3.0
  15.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  16.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  17.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  18. }
  19. function setFormContent(htmlCode) {
  20. divContent.innerHTML = htmlCode;
  21. }
  22. function getFormContent() {
  23. return divContent.innerHTML;
  24. }
  25. function form1_onsubmit() {
  26. form1.content.value = getFormContent();
  27. }
  28. function openFormWin() {
  29. var preWin=window.open('../editor_full/flow_form.jsp?op=edit','','left=0,top=0,width=750,height=482,resizable=1,scrollbars=1, status=1, toolbar=0, menubar=0');
  30. }
  31. //-->
  32. </script>
  33. <style type="text/css">
  34. <!--
  35. .style2 {font-size: 14px}
  36. -->
  37. </style>
  38. </head>
  39. <body background="" leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
  40. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  41. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  42. <%
  43. if (!privilege.isUserPrivValid(request, "admin.flow")) {
  44.     out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  45. return;
  46. }
  47. String flowTypeCode = ParamUtil.get(request, "flowTypeCode");
  48. String op = ParamUtil.get(request, "op");
  49. if (op.equals("add")) {
  50. FormMgr ftm = new FormMgr();
  51. boolean re = false;
  52. try {
  53. re = ftm.create(request);
  54. if (re) {
  55. if (!flowTypeCode.equals("-1"))
  56. out.print(StrUtil.Alert_Redirect("创建成功!", "form_m.jsp?flowTypeCode=" + StrUtil.UrlEncode(flowTypeCode)));
  57. else {
  58. out.print(StrUtil.Alert_Redirect("创建成功!", "form_m.jsp?isFlow=0"));
  59. }
  60. }
  61. else {
  62. out.print(StrUtil.Alert("创建失败!"));
  63. }
  64. }
  65. catch (ErrMsgException e) {
  66. out.print(StrUtil.Alert(e.getMessage() + " 请检查是否有重复的编码或者编码使用了数据库的关键字!"));
  67. }
  68. }
  69. %>
  70. <table width="494" height="89" border="0" align="center" cellpadding="0" cellspacing="0">
  71.   <tr> 
  72.     <td height="23" valign="bottom" class="right-title">&nbsp;&nbsp;<span> 创建表单</span></td>
  73.   </tr>
  74.   <tr> 
  75.     <td valign="top">
  76. <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="tableframe">
  77. <form id=form1 name=form1 action="?op=add" method=post onSubmit="return form1_onsubmit()">
  78.       <tr>
  79.         <td height="100" align="center" class="p14"><table width="98%"  border="0" cellpadding="5" cellspacing="0" class="p14">
  80.           <tr>
  81.             <td width="20%" >编码 </td>
  82.             <td width="80%" ><input type="text" name="code" maxlength="18"></td>
  83.           </tr>
  84.           <tr>
  85.             <td >名称</td>
  86.             <td ><input type="text" name="name"></td>
  87.           </tr>
  88.           <tr>
  89.             <td >流程类型</td>
  90.             <td >
  91. <%
  92. // -1表示非流程所用的表单
  93. if (!flowTypeCode.equals("") && !flowTypeCode.equals("-1")) {
  94. Leaf lf = new Leaf();
  95. lf = lf.getLeaf(flowTypeCode);
  96. %>
  97. <%=lf.getName()%><input name="flowTypeCode" type="hidden" value="<%=flowTypeCode%>">
  98. <%} else {
  99. %>
  100. <select name="flowTypeCode" onChange="if(this.options[this.selectedIndex].value=='root'){alert(this.options[this.selectedIndex].text+' 不能被选择!'); return false;}">
  101. <option value="-1">无</option>
  102.                 <%
  103. Leaf rootlf = new Leaf();
  104. rootlf = rootlf.getLeaf("root");
  105. DirectoryView dv = new DirectoryView(rootlf);
  106. dv.ShowFlowTypeAsOptionsWithCode(out, rootlf, rootlf.getLayer());
  107. %>
  108.               </select>
  109. <%}%>
  110.             </td>
  111.           </tr>
  112.           <tr>
  113.             <td >内容</td>
  114.             <td ><input type="hidden" name="content" value=''></td>
  115.           </tr>
  116.         </table>
  117.             <a href="#" onClick="openFormWin()">编辑表单</a></td>
  118.       </tr>
  119.       <tr>
  120.         <td align="center"><input type="submit" name="next" value="添加新的表单"></td>
  121.       </tr>
  122.       <tr>
  123.         <td align="center"><table width="90%" align="center">
  124.           <tr>
  125.             <td><strong>以下为表单内容:</strong></td>
  126.           </tr>
  127.           <tr>
  128.             <td><div id="divContent" name="divContent"></div></td>
  129.           </tr>
  130.         </table></td>
  131.       </tr>
  132. </form>
  133.     </table></td>
  134.   </tr>
  135. </table>
  136. <br>
  137. <br>
  138. </body>
  139. </html>