add_upload_file_data.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:6k
源码类别:
电子政务应用
开发平台:
Java
- <%@ page import="com.vnex.intranet.pub.BaseJdbcDAO" %>
- <%@ page import="com.vnex.intranet.util.TimeStamp" %>
- <%@ page import="java.io.File" %>
- <%
- int archiveId = Integer.parseInt(request.getParameter("archiveId"));
- String sendDate = TimeStamp.formatCalendar(TimeStamp.YMD, TimeStamp.convertTimestampToCalendar(BaseJdbcDAO.getDBSystemDate()));
- %>
- <script language="JavaScript" src="/vnex/util/validate.js"></script>
- <script language=javascript>
- function checkChar(str)
- {
- var i,j,strTemp;
- strTemp=""<>/\'%&+-";
- for (i=0;i<str.length;i++)
- {
- j=strTemp.indexOf(str.charAt(i));
- if (j!=-1)
- {
- return false;
- }
- }
- return true;
- }
- function isDataValid(form)
- {
- if (form.sourceFile.value == "")
- {
- alert("源文件不能为空!");
- return false;
- }
- if (form.fileName.value == "")
- {
- alert("文件名不能为空!");
- return false;
- }
- if(!checkChar(form.fileName.value))
- {
- alert("文件名称中不要加入"<>/\'%&+-这样的字符");
- return false;
- }
- if (form.fileTitle.value.length == 0)
- {
- alert("标题不能为空!");
- return false;
- }
- str = form.fileTitle.value;
- if (str.substring(0,1) == " ")
- {
- alert("标题开头不能是空格!");
- return false;
- }
- if (form.fileSummary.value.length > 125)
- {
- alert("文件的摘要必须小于125个文字!");
- return false;
- }
- if (form.others.value.length > 250)
- {
- alert("备注必须小于250个文字!");
- return false;
- }
- return true;
- }
- function uploadDoc(form)
- {
- if (! isDataValid(form))
- return false;
- form.encoding="multipart/form-data";
- form.action="/mainctrl/archive/uploadFile?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
- form.submit();
- }
- function toDetail(form)
- {
- form.action="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>&isToday=<%=request.getParameter("isToday")%>";
- form.submit();
- }
- function fileSelected(form)
- {
- var sname = form.sourceFile.value;
- sname = sname.substring(sname.lastIndexOf("\")+1);
- if(sname.indexOf(".") != -1)
- sname = sname.substring(0, sname.indexOf("."));
- form.fileName.value = sname;
- }
- </script>
- <table width="600" border="0" cellpadding="5" cellspacing="1" class="iframestyle">
- <tr>
- <td colspan="2" bgcolor="#ffffff"> <a href="/mainctrl/archive/todayArchives">档案管理</a>>><a href="/mainctrl/archive/archiveDetail?archiveId=<%=archiveId%>">档案信息</a>>>增加文件
- </td>
- </tr>
- <tr>
- <td colspan="2" height="4" bgcolor="#666666"><font class="strongw">增加文件</font></td>
- </tr>
- <tr bgcolor="#FFFFFF">
- <td align="center" colspan="2">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td>
- <table width="100%" border="0">
- <tr>
- <td width="14%">
- <div align="left">源文件:</div>
- </td>
- <td width="86%">
- <div align="left">
- <input type="file" name="sourceFile" size="30" class="text" onchange="fileSelected(this.form)">
- </div>
- </td>
- </tr>
- <tr>
- <td width="14%">
- <div align="left">文件名:</div>
- </td>
- <td width="86%">
- <div align="left">
- <input type="text" name="fileName" size="30" maxlength=50 class="text">
- </div>
- </td>
- </tr>
- <tr>
- <td width="14%">
- <div align="left">标题:</div>
- </td>
- <td width="84%">
- <div align="left">
- <input type="text" name="fileTitle" size="30" maxlength=250 class="text">
- </div>
- </td>
- </tr>
- <tr>
- <td width="14%" valign="top">
- <div align="left">概要:</div>
- </td>
- <td width="86%">
- <div align="left">
- <textarea rows="10" name="fileSummary" cols="49" wrap="VIRTUAL"></textarea>
- </div>
- </td>
- </tr>
- <tr>
- <td width="14%">
- <div align="left">上传日期:</div>
- </td>
- <td width="86%">
- <div align="left"><%=sendDate%></div>
- </td>
- </tr>
- <tr>
- <td width="14%" valign="top">
- <div align="left">备注:</div>
- </td>
- <td width="86%" valign="top">
- <div align="left">
- <textarea name="others" cols="49" wrap="VIRTUAL" rows="3"></textarea>
- </div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <p>
- <input onClick="uploadDoc(this.form)" type="button" value=" 上 传 " name="B21" class="button">
-
- <input type="reset" value=" 重 置 " name="B212" class="button">
- <input onClick="toDetail(this.form)" type="button" value=" 返 回 " name="B213" class="button">
-
- </p>