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

电子政务应用

开发平台:

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. <script language="JavaScript" src="/vnex/util/validate.js"></script>
  9. <script language=javascript>
  10.  function checkChar(str)
  11.  {
  12.     var i,j,strTemp;
  13.     strTemp=""<>/\'%&+-";
  14.     for (i=0;i<str.length;i++)
  15.     {
  16.       j=strTemp.indexOf(str.charAt(i));
  17.       if (j!=-1)
  18.       {
  19.         return false;
  20.       }
  21.     }
  22.     return true;
  23.  }
  24. function isDataValid(form)
  25. {
  26. if (form.sourceFile.value == "")
  27. {
  28. alert("源文件不能为空!");
  29. return false;
  30. }
  31. if (form.fileName.value == "")
  32. {
  33. alert("文件名不能为空!");
  34. return false;
  35. }
  36. if(!checkChar(form.fileName.value))
  37. {
  38.     alert("文件名称中不要加入"<>/\'%&+-这样的字符");
  39.     return false;
  40. }
  41. if (form.fileTitle.value.length == 0)
  42. {
  43. alert("标题不能为空!");
  44. return false;
  45. }
  46. str = form.fileTitle.value;
  47. if (str.substring(0,1) == " ")
  48. {
  49. alert("标题开头不能是空格!");
  50. return false;
  51. }
  52. if (form.fileSummary.value.length > 125)
  53. {
  54. alert("文件的摘要必须小于125个文字!");
  55. return false;
  56. }
  57. if (form.others.value.length > 250)
  58. {
  59. alert("备注必须小于250个文字!");
  60. return false;
  61. }
  62. return true;
  63. }
  64. function uploadDoc(form)
  65. {
  66.    if (! isDataValid(form))
  67.     return false;
  68.    form.encoding="multipart/form-data";
  69.    form.action="/mainctrl/archive/uploadFile?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
  70.    form.submit();
  71. }
  72. function toDetail(form)
  73. {
  74. form.action="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
  75. form.submit();
  76. }
  77. function fileSelected(form)
  78. {
  79.    var sname = form.sourceFile.value;
  80.    sname = sname.substring(sname.lastIndexOf("\")+1);
  81.    if(sname.indexOf(".") != -1)
  82.       sname = sname.substring(0, sname.indexOf("."));
  83.    form.fileName.value = sname;
  84. }
  85. </script>
  86. <table width="600" border="0" cellpadding="5" cellspacing="1" class="iframestyle">
  87.    <tr>
  88.      <td colspan="2" bgcolor="#ffffff">&nbsp;&nbsp;<a href="/mainctrl/archive/todayArchives">档案管理</a>&gt;&gt;<a href="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>">档案信息</a>&gt;&gt;增加文件&nbsp;
  89.      </td>
  90.    </tr>
  91.    <tr> 
  92.       <td colspan="2" height="4" bgcolor="#666666"><font class="strongw">增加文件</font></td>
  93.    </tr>
  94.    <tr bgcolor="#FFFFFF"> 
  95.       <td align="center" colspan="2">
  96.          <table width="100%" border="0" cellspacing="0" cellpadding="0">
  97.             <tr>
  98.                <td>
  99.                   <table width="100%" border="0">
  100.                      <tr> 
  101.                         <td width="14%"> 
  102.                           <div align="left">源文件:</div>
  103.                         </td>
  104.                         <td width="86%"> 
  105.                           <div align="left"> 
  106.                             <input type="file" name="sourceFile" size="30" class="text" onchange="fileSelected(this.form)">
  107.                           </div>
  108.                         </td>
  109.                     </tr>
  110.                     <tr> 
  111.                         <td width="14%"> 
  112.                            <div align="left">文件名:</div>
  113.                         </td>
  114.                         <td width="86%"> 
  115.                            <div align="left"> 
  116.                             <input type="text" name="fileName" size="30" maxlength=50 class="text">
  117.                            </div>
  118.                         </td>
  119.                     </tr>
  120.                     <tr> 
  121.                         <td width="14%"> 
  122.                           <div align="left">标题:</div>
  123.                         </td>
  124.                         <td width="84%"> 
  125.                            <div align="left"> 
  126.                              <input type="text" name="fileTitle" size="30" maxlength=250 class="text">
  127.                            </div>
  128.                         </td>
  129.                     </tr>
  130.                     <tr> 
  131.                         <td width="14%" valign="top"> 
  132.                          <div align="left">概要:</div>
  133.                         </td>
  134.                         <td width="86%"> 
  135.                           <div align="left"> 
  136.                             <textarea rows="10" name="fileSummary" cols="49" wrap="VIRTUAL"></textarea>
  137.                           </div>
  138.                         </td>
  139.                     </tr>
  140.                     <tr> 
  141.                         <td width="14%"> 
  142.                           <div align="left">上传日期:</div>
  143.                         </td>
  144.                         <td width="86%"> 
  145.                           <div align="left"><%=sendDate%></div>
  146.                         </td>
  147.                     </tr>
  148.                     <tr> 
  149.                         <td width="14%" valign="top"> 
  150.                            <div align="left">备注:</div>
  151.                         </td>
  152.                         <td width="86%" valign="top"> 
  153.                            <div align="left"> 
  154.                            <textarea name="others" cols="49" wrap="VIRTUAL" rows="3"></textarea>
  155.                            </div>
  156.                         </td>
  157.                     </tr>
  158.                </table>
  159.              </td>
  160.           </tr>
  161.        </table>
  162.      </td>
  163.    </tr>
  164. </table>         
  165. <p> 
  166.   <input onClick="uploadDoc(this.form)" type="button" value=" 上 传 " name="B21" class="button">
  167.   &nbsp;&nbsp;
  168.   <input type="reset" value=" 重 置 " name="B212" class="button">&nbsp;&nbsp;
  169.   <input onClick="toDetail(this.form)" type="button" value=" 返 回 " name="B213" class="button">
  170.   &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  171. </p>