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

OA系统

开发平台:

Java

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