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

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.visual.*"%>
  6. <%@ page import="com.redmoon.oa.flow.*"%>
  7. <link href="common.css" rel="stylesheet" type="text/css">
  8. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  9. <%
  10. String priv="read";
  11. if (!privilege.isUserPrivValid(request,priv))
  12. {
  13. // out.print(SkinUtil.makeErrMsg(request, SkinUtil.LoadString(request, "pvg_invalid")));
  14. // return;
  15. }
  16. String myname = privilege.getUser( request );
  17. String op = ParamUtil.get(request, "op");
  18. String formCode = ParamUtil.get(request, "formCode");
  19. if (formCode.equals("")) {
  20. out.print(SkinUtil.makeErrMsg(request, "编码不能为空!"));
  21. return;
  22. }
  23. int id = ParamUtil.getInt(request, "id");
  24. FormMgr fm = new FormMgr();
  25. FormDb fd = fm.getFormDb(formCode);
  26. com.redmoon.oa.visual.FormDAOMgr fdm = new com.redmoon.oa.visual.FormDAOMgr(fd);
  27. if (op.equals("saveformvalue")) {
  28. boolean re = false;
  29. try {
  30. re = fdm.update(application, request);
  31. }
  32. catch (ErrMsgException e) {
  33. out.print(StrUtil.Alert(e.getMessage()));
  34. }
  35. if (re) {
  36. out.print(StrUtil.Alert_Redirect("保存成功!", request.getRequestURL() + "?id=" + id + "&formCode=" + StrUtil.UrlEncode(formCode)));
  37. return;
  38. }
  39. // out.print(StrUtil.Alert_Back("保存成功!"));
  40. }
  41. if (op.equals("delAttach")) {
  42. int attachId = ParamUtil.getInt(request, "attachId");
  43. com.redmoon.oa.visual.Attachment att = new com.redmoon.oa.visual.Attachment(attachId);
  44. att.del();
  45. }
  46. %>
  47. <title>智能设计-编辑内容</title>
  48. <script src="<%=Global.getRootPath()%>/inc/flow_dispose_js.jsp"></script>
  49. <script src="<%=Global.getRootPath()%>/inc/flow_js.jsp"></script>
  50. <script>
  51. function setradio(myitem,v)
  52. {
  53.      var radioboxs = document.all.item(myitem);
  54.      if (radioboxs!=null)
  55.      {
  56.        for (i=0; i<radioboxs.length; i++)
  57.           {
  58.             if (radioboxs[i].type=="radio")
  59.               {
  60.                  if (radioboxs[i].value==v)
  61.   radioboxs[i].checked = true;
  62.               }
  63.           }
  64.      }
  65. }
  66. function SubmitResult() {
  67. // 检查是否已选择意见
  68. if (getradio("resultValue")==null || getradio("resultValue")=="") {
  69. alert("您必须选择一项意见!");
  70. return false;
  71. }
  72. visualForm.op.value='finish';
  73. visualForm.submit();
  74. }
  75. // 控件完成上传后,调用Operate()
  76. function Operate() {
  77. // alert(redmoonoffice.ReturnMessage);
  78. }
  79. function openWin(url,width,height)
  80. {
  81.   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);
  82. }
  83. var attachCount = 1;
  84. function AddAttach() {
  85. updiv.innerHTML += "<table width=100%><tr>文件&nbsp;<input type='file' name='filename" + attachCount + "' style='width:300px'><td></td></tr></table>";
  86. attachCount += 1;
  87. }
  88. </script>
  89. <br />
  90. <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  91.   <tr>
  92.     <td align="left" class="right-title">&nbsp;编辑<%=fd.getName()%>记录  </td>
  93.   </tr>
  94.   <tr>
  95.     <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  96. <form action="?op=saveformvalue&id=<%=id%>&formCode=<%=StrUtil.UrlEncode(formCode)%>" name="visualForm" method="post" enctype="multipart/form-data">
  97.         <tr>
  98.           <td align="left">
  99.   <table width="100%">
  100.             <tr>
  101.               <td><%
  102. com.redmoon.oa.visual.Render rd = new com.redmoon.oa.visual.Render(request, id, fd);
  103. out.print(rd.rend());
  104.   %></td>
  105.             </tr>
  106.           </table>
  107.   </td>
  108.         </tr>
  109.         <tr>
  110.           <td align="left">文件&nbsp;<input type="file" name="filename" style="width: 300px">
  111.               &nbsp;&nbsp;
  112.               <input name="button" type="button" onclick="AddAttach()" value="增加附件" />
  113.   <div id=updiv name=updiv></div>          </td>
  114.         </tr>
  115.         <tr>
  116.           <td align="left"><%
  117. com.redmoon.oa.visual.FormDAO fdao = fdm.getFormDAO(id);
  118. Iterator ir = fdao.getAttachments().iterator();
  119.   while (ir.hasNext()) {
  120.    com.redmoon.oa.visual.Attachment am = (com.redmoon.oa.visual.Attachment) ir.next(); %>
  121.             <table width="82%"  border="0" cellpadding="0" cellspacing="0">
  122.               <tr>
  123.                 <td width="5%" height="31" align="right"><img src="<%=Global.getRootPath()%>/images/attach.gif" /></td>
  124.                 <td>&nbsp; <a target=_blank href="<%=Global.getRootPath()%>/visual_getfile.jsp?attachId=<%=am.getId()%>"><%=am.getName()%></a>&nbsp;&nbsp;<a href="?op=delAttach&id=<%=id%>&formCode=<%=StrUtil.UrlEncode(formCode)%>&attachId=<%=am.getId()%>">删除</a><br />                </td>
  125.                 </tr>
  126.             </table>
  127.             <%}
  128.   %></td>
  129.         </tr>
  130.         <tr>
  131.           <td height="30" align="center"><input name="id" value="<%=id%>" type="hidden">
  132.           <input type="submit" name="Submit" value=" 修 改 " />
  133.             &nbsp;&nbsp;</td>
  134.         </tr>
  135.       </form>
  136.     </table>
  137.         <br /></td>
  138.   </tr>
  139. </table>