add_upload_file.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:7k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page import="com.vnex.intranet.pub.BaseJdbcDAO" %>
  2. <%@ page import="com.vnex.intranet.util.TimeStamp" %>
  3. <%@ page import="java.io.File" %>
  4. <%
  5.     int archiveId = Integer.parseInt(request.getParameter("archiveId"));
  6.     String sendDate = TimeStamp.formatCalendar(TimeStamp.YMD, TimeStamp.convertTimestampToCalendar(BaseJdbcDAO.getDBSystemDate()));
  7. %>
  8. <HTML>
  9. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  10. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  11. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_archives.js"></script>
  12. <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
  13. <script language="JavaScript" src="/vnex/validate.js"></script>
  14. <script language=javascript>
  15.  function checkChar(str)
  16.  {
  17.     var i,j,strTemp;
  18.     strTemp=""<>/\'%&+-";
  19.     for (i=0;i<str.length;i++)
  20.     {
  21.       j=strTemp.indexOf(str.charAt(i));
  22.       if (j!=-1)
  23.       {
  24.         return false;
  25.       }
  26.     }
  27.     return true;
  28.  }
  29. function isDataValid(form)
  30. {
  31. if (form.sourceFile.value == "")
  32. {
  33. alert("源文件不能为空!");
  34. form.sourceFile.focus();
  35. return false;
  36. }
  37. if (form.fileName.value == "")
  38. {
  39. alert("文件名不能为空!");
  40. form.fileName.focus();
  41. return false;
  42. }
  43. if(!checkChar(form.fileName.value))
  44. {
  45.     alert("文件名称中不要加入"<>/\'%&+-这样的字符");
  46. form.fileName.focus();
  47.     return false;
  48. }
  49. if (form.fileTitle.value.length == 0)
  50. {
  51. alert("标题不能为空!");
  52. form.fileTitle.focus();
  53. return false;
  54. }
  55. str = form.fileTitle.value;
  56. if (str.substring(0,1) == " ")
  57. {
  58. alert("标题开头不能是空格!");
  59. form.fileTitle.focus();
  60. return false;
  61. }
  62. if (form.fileSummary.value.length > 125)
  63. {
  64. alert("文件的摘要必须小于125个文字!");
  65. form.fileSummary.focus();
  66. return false;
  67. }
  68. if (form.others.value.length > 250)
  69. {
  70. alert("备注必须小于250个文字!");
  71. form.fileSummary.focus();
  72. return false;
  73. }
  74. return true;
  75. }
  76. function uploadDoc(form)
  77. {
  78.    if (! isDataValid(form))
  79.     return false;
  80.    form.encoding="multipart/form-data";
  81.    form.action="/mainctrl/archive/uploadFile?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
  82.    form.submit();
  83. }
  84. function toDetail(form)
  85. {
  86. form.action="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
  87. form.submit();
  88. }
  89. function fileSelected(form)
  90. {
  91.    var sname = form.sourceFile.value;
  92.    sname = sname.substring(sname.lastIndexOf("\")+1);
  93.    if(sname.indexOf(".") != -1)
  94.       sname = sname.substring(0, sname.indexOf("."));
  95.    form.fileName.value = sname;
  96. }
  97. </script>
  98. <DIV align=center>
  99. <form name="form1" method="post">
  100.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  101.     <TBODY> 
  102.       <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  103.       <TR> 
  104.         <TD colSpan=3 align="center"><br>
  105.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  106.             <tr> 
  107.               <td align="center" colspan="2" bgcolor="#FFFFFF"> 
  108.                 <table width="600" border="0" cellspacing="0" cellpadding="0">
  109.                   <tr bgcolor="#666666"> 
  110.                       <td colspan="2"><font class="strongw"><a href="/mainctrl/home/index"><font color="#ffffff">首页</font></a>&gt;&gt;<a href="/mainctrl/archive/todayArchives"><font color="#ffffff">档案管理</font></a>&gt;&gt;<a href="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>"><font color="#ffffff">档案信息</font></a>&gt;&gt;增加文件</font>
  111.                       </td>
  112.                   </tr>
  113.                 </table>
  114.                 <table class=title border="0" cellpadding="2" cellspacing="1" width="600">
  115.                      <tr bgcolor="#fafafa"> 
  116.                         <td width="14%"> 
  117.                           <div align="left"><strong>&nbsp;源文件:</strong></div>
  118.                         </td>
  119.                         <td width="86%"> 
  120.                           <div align="left"> 
  121.                             <input type="file" name="sourceFile" size="30" class="text" onchange="fileSelected(this.form)">
  122.                           </div>
  123.                         </td>
  124.                     </tr>
  125.                     <tr bgcolor="#e0e0e0"> 
  126.                         <td width="14%"> 
  127.                            <div align="left"><strong>&nbsp;文件名:</strong></div>
  128.                         </td>
  129.                         <td width="86%"> 
  130.                            <div align="left"> 
  131.                             <input type="text" name="fileName" size="30" maxlength=50 class="text">&nbsp;*&nbsp;(注:带*为必填内容)
  132.                            </div>
  133.                         </td>
  134.                     </tr>
  135.                     <tr bgcolor="#fafafa"> 
  136.                         <td width="14%"> 
  137.                           <div align="left"><strong>&nbsp;标题:</strong></div>
  138.                         </td>
  139.                         <td width="84%"> 
  140.                            <div align="left"> 
  141.                              <input type="text" name="fileTitle" size="30" maxlength=250 class="text">&nbsp;*
  142.                            </div>
  143.                         </td>
  144.                     </tr>
  145.                     <tr bgcolor="#e0e0e0"> 
  146.                         <td width="14%"> 
  147.                          <div align="left"><strong>&nbsp;概要:</strong></div>
  148.                         </td>
  149.                         <td width="86%"> 
  150.                           <div align="left"> 
  151.                             <textarea rows="5" name="fileSummary" cols="59" wrap="VIRTUAL"></textarea>
  152.                           </div>
  153.                         </td>
  154.                     </tr>
  155.                     <tr bgcolor="#fafafa"> 
  156.                         <td width="14%"> 
  157.                           <div align="left"><strong>&nbsp;上传日期:</strong></div>
  158.                         </td>
  159.                         <td width="86%"> 
  160.                           <div align="left"><%=sendDate%></div>
  161.                         </td>
  162.                     </tr>
  163.                     <tr bgcolor="#e0e0e0"> 
  164.                         <td width="14%"> 
  165.                            <div align="left"><strong>&nbsp;备注:</strong></div>
  166.                         </td>
  167.                         <td width="86%" valign="top"> 
  168.                            <div align="left"> 
  169.                            <textarea name="others" cols="59" wrap="VIRTUAL" rows="5"></textarea>
  170.                            </div>
  171.                         </td>
  172.                     </tr>
  173.                     <tr bgcolor="#fafafa">
  174.                        <td colspan="2" align="center" height="30">
  175.   <input onClick="uploadDoc(this.form)" type="button" value="上传" name="B21" class="text">
  176.   &nbsp;&nbsp;
  177.   <input type="reset" value="重置" name="B212" class="text">
  178.   &nbsp;&nbsp;
  179.   <input onClick="toDetail(this.form)" type="button" value="返回" name="B213" class="text">
  180.                        </td>
  181.                     </tr>
  182.                </table>
  183.              </td>
  184.           </tr>
  185.        </table>
  186.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  187.        </TD>
  188.      </TR>
  189.      <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  190.     </TBODY> 
  191.   </TABLE>
  192.     <BR>
  193.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  194. </form>
  195. </DIV>
  196. </BODY>
  197. </HTML>