DocumentLink.jsp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:10k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312"%>
  2. <%@ page import="com.gforce.gfoa.*,com.gforce.currency.*,java.util.*,java.net.*" %>
  3. <jsp:include page="/CheckLogin.jsp" flush="true"/> <% Session m_session = new Session(session); %>
  4. <%
  5. Request m_request = new Request(request);
  6. int iUserID = m_session.GetInt("UserID");
  7. int intDocumentID = m_request.GetInt("ID");
  8. int iTypesID = m_request.GetInt("TypesID");
  9. int iSysDirID = m_request.GetInt("SysDirID");
  10. if(intDocumentID<1)
  11. {
  12. %>
  13. <script language="JavaScript" type="text/JavaScript">
  14. alert("请选择正确的文档,修改失败!");
  15. history.back();
  16. </script>
  17. <%
  18. }
  19. else
  20. {
  21. Vector vt = DocumentManager.getByIDRecord(intDocumentID);
  22. if(vt.size() == 1)
  23. {
  24. %>
  25. <html>
  26. <head>
  27. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
  28. <title>文档管理-- GForce OA 2.0</title>
  29. <link href="../css/txt.jsp" rel="stylesheet" type="text/css">
  30. <SCRIPT language="JavaScript" src="/Calendar/PopUpCalendarDlg.js"></SCRIPT>
  31. <script language="JavaScript" src="/js/changestyle.js"></script>
  32. <script language="JavaScript" type="text/javascript">
  33. function CheckEditDocument()
  34. {
  35.     if(document.EditDocument.DocumentName.value=="")
  36.     {
  37.         alert("请输入名称!");
  38.         document.EditDocument.DocumentName.focus();
  39.         return false;
  40.     }
  41. <%
  42. Vector vtFields = DocFieldsManager.getByDocTypeRecord(iTypesID);
  43. if(vtFields.size()>0)
  44. {
  45.    for (int i=0; i<vtFields.size(); i++)
  46.    {
  47.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("STR"))
  48.         {
  49. //字符串类型输入框,表单输入框名称为字段ID。
  50.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  51.            {
  52.            out.println("if(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  53.            out.println("{");
  54.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  55.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  56.            out.println("return false;");
  57.            out.println("}");
  58.            }
  59.         }else
  60.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("NUM"))
  61.         {
  62. //数值类型输入框,表单输入框名称为字段ID。
  63.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  64.            {
  65.            out.println("if(isNaN(parseInt(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value)))");
  66.            out.println("{");
  67.            out.println("alert("请输入正确的"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  68.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".select();");
  69.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  70.            out.println("return false;");
  71.            out.println("}");
  72.            }
  73.           else
  74.            {
  75.            out.println("if(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value.length>0)");
  76.            out.println("if(isNaN(parseInt(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value)))");
  77.            out.println("{");
  78.            out.println("alert("请输入正确的"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  79.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  80.            out.println("return false;");
  81.            out.println("}");
  82.            }
  83.         }else
  84.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("DATE"))
  85.         {
  86. //日期类型输入框,表单输入框名称为字段ID。
  87.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  88.            {
  89.            out.println("if(!isDate(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value))");
  90.            out.println("{");
  91.            out.println("alert("日期格式错误,请按照“2002-02-18”重新输入!");");
  92.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  93.            out.println("return false;");
  94.            out.println("}");
  95.            }
  96.           else
  97.            {
  98.            out.println("if(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value.length>0)");
  99.            out.println("if(!isDate(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value))");
  100.            out.println("{");
  101.            out.println("alert("日期格式错误,请按照“2002-02-18”重新输入!");");
  102.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  103.            out.println("return false;");
  104.            out.println("}");
  105.            }
  106.         }else
  107.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("TEXT"))
  108.         {
  109. //备注类型输入框,表单输入框名称为字段ID。
  110.          if (((Vector)vtFields.get(i)).get(1).toString().indexOf("(必填)")>=0)
  111.            {
  112.            out.println("if(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  113.            out.println("{");
  114.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  115.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  116.            out.println("return false;");
  117.            out.println("}");
  118.            }
  119.         }else
  120.      if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("ACC"))
  121.         {
  122. //附件类型输入框,表单输入框名称为字段ID。
  123.          if ((((Vector)vtFields.get(i)).get(1).toString()).indexOf("(必填)")>=0)
  124.            {
  125.            out.println("if(document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".value=="")");
  126.            out.println("{");
  127.            out.println("alert("请输入"+((Vector)vtFields.get(i)).get(1).toString()+"!");");
  128.            out.println("document.EditDocument.Name"+((Vector)vtFields.get(i)).get(0).toString()+".focus();");
  129.            out.println("return false;");
  130.            out.println("}");
  131.            }
  132.         }else
  133.         {
  134. //未知类型。
  135.         out.println("未知类型");
  136.         }
  137.    }
  138. }
  139. %>
  140. }
  141. </script>
  142. </head>
  143. <body bgcolor="<%=m_session.GetString("BackColor")%>" leftmargin="0" topmargin="0">
  144. <table width="100%" height="100%" border="0" align="center" cellspacing="0">
  145.     <tr>
  146.         <td align="center" valign="top"><p>&nbsp;</p>
  147.             <form name="EditDocument" action="/Operation/EditDocumentAction.jsp?SysDirID=<%=iSysDirID%>&TypesID=<%=iTypesID%>" method="post" onSubmit="javascript:return CheckEditDocument();">
  148.         <table  border="0" cellpadding="0" cellspacing="2" width="90%">
  149.           <tr>
  150.             <td width="30%" align="right" valign="middle"><font color="#0A0A0A">名称:</font></td>
  151.             <td align="left" valign="middle">
  152.                      <%=((Vector)vt.get(0)).get(1).toString()%>
  153.                     </td>
  154.                 </tr>
  155.                 <tr>
  156.             <td width="30%" align="right" valign="middle"><font color="#0A0A0A">内容:</font></td>
  157.             <td align="left" valign="middle"> <%=((Vector)vt.get(0)).get(2).toString()%>
  158.             </td>
  159.                 </tr>
  160. <%
  161. vtFields = DocFieldsManager.getByDocTypeRecord(iTypesID);
  162. if(vtFields.size() > 0)
  163. {
  164.   for (int i=0; i<vtFields.size(); i++)
  165.   {
  166.     String strFieldValue = FieldsValueManager.getFieldValueByID(intDocumentID,Integer.parseInt(((Vector)vtFields.get(i)).get(0).toString()));
  167.     String strFieldType = ((Vector)vtFields.get(i)).get(3).toString();
  168.     out.println("<tr>");
  169.     out.println("<td align="right" valign="middle"><font color="#0A0A0A">"+((Vector)vtFields.get(i)).get(1).toString()+":</font></td>");
  170.     out.println("<td align="left" valign="middle" nowrap>");
  171.     if(strFieldValue.length()>0)
  172.     {
  173.       if (strFieldType.equalsIgnoreCase("STR"))
  174.       {
  175.       //字符串类型输入框,表单输入框名称为字段ID。
  176.         out.println(strFieldValue);
  177.       }
  178.       else if(strFieldType.equalsIgnoreCase("NUM"))
  179.       {
  180.       //数值类型输入框,表单输入框名称为字段ID。
  181.         out.println(strFieldValue);
  182.       }
  183.       else if (strFieldType.equalsIgnoreCase("DATE"))
  184.       {
  185.         //日期类型输入框,表单输入框名称为字段ID。
  186.         out.println(StringNew.GetDateString(strFieldValue,"yyyy年MM月dd日"));
  187.       }
  188.       else if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("TEXT"))
  189.       {
  190.         //备注类型输入框,表单输入框名称为字段ID。
  191.         out.println(strFieldValue);
  192.       }
  193.       else if (((Vector)vtFields.get(i)).get(3).toString().equalsIgnoreCase("ACC"))
  194.       {
  195.         //附件类型输入框,表单输入框名称为字段ID。
  196.            out.println("<a href="" + strFieldValue.substring(0,strFieldValue.lastIndexOf("/")+1) + URLEncoder.encode(strFieldValue.substring(strFieldValue.lastIndexOf("/")+1),"UTF8") + "" target="_blank">");
  197.            out.println(strFieldValue.substring(strFieldValue.lastIndexOf("/")+1));
  198.            out.println("</a>(点击附件名称下载附件)");
  199.       }
  200.     }
  201.     else
  202.     {
  203.       out.println("&nbsp;");
  204.     }
  205.     out.println("</td></tr>");
  206.   }
  207. }
  208. %>
  209.                 <tr>
  210.             <td width="30%" align="right" valign="middle">&nbsp;</td>
  211.             <td align="left" valign="middle"> <br>
  212.               <br>
  213.                     </td>
  214.                 </tr>
  215.                 <tr>
  216.             <td width="30%" align="right" valign="middle">&nbsp;</td>
  217.             <td align="right" valign="middle">
  218.               <input type="button" value="关闭" onclick="window.close();">
  219.                    </td>
  220.                 </tr>
  221.             </table>
  222.             </form>
  223.         </td>
  224. <!--
  225. -->
  226.     </tr>
  227. </table>
  228. </body>
  229. </html>
  230. <%
  231. }
  232. else
  233. {
  234. %>
  235. <script language="JavaScript" type="text/JavaScript">
  236. alert("该记录已经被删除或者您没有权限修改此记录,修改失败!");
  237. history.back();
  238. </script>
  239. <%
  240. }
  241. }
  242. %>