Calendar_modify.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:24k
源码类别:
电子政务应用
开发平台:
Java
- <%@ page errorPage="/vnex/ErrorPage.jsp" %>
- <%@ page import="com.vnex.intranet.calendar.value.*"%>
- <%@ page import="com.vnex.intranet.calendar.proxy.*"%>
- <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
- <%@ page import="com.vnex.intranet.util.*"%>
- <%@ page import="com.vnex.intranet.upload.*"%>
- <%@ page import="java.util.*" %>
- <%@ page import="java.sql.*" %>
- <%@ taglib uri="/vnex.tld" prefix="vnex" %>
- <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
- <jsp:useBean id="calendarProxy" class="com.vnex.intranet.calendar.proxy.CalendarProxyBean" scope="application" />
- <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
- <jsp:useBean id="myUpload" scope="page" class="com.vnex.intranet.upload.SmartUpload" />
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
- <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
- <script Language="JavaScript" src="/vnex/intranet/calendar/Popup.js"></script>
- <script language="javascript" src="/vnex/validate.js" ></script>
- <script language=JavaScript>
- function check()
- {
- if (!stripWhitespace(document.myform.taskName.value) || document.myform.taskName.value=="" || document.myform.taskName.value.length>50)
- {
- alert("主题不能为空,并且少于50个字。");
- document.myform.taskName.focus();
- return false;
- }
- if(document.myform.StartDate.value=="" || document.myform.EndDate.value=="")
- {
- alert("开始日期和截止日期不能为空。");
- return false;
- }
- var startDate = document.myform.StartDate.value+document.myform.sHour.value+document.myform.sMinute.value;
- var endDate = document.myform.EndDate.value+document.myform.eHour.value+document.myform.eMinute.value;
- if(startDate>=endDate)
- {
- alert("截止日期必须大于开始日期。");
- return false;
- }
- if (document.myform.coadjutant.value.length>50)
- {
- alert("协助者应少于50个字。");
- document.myform.coadjutant.focus();
- return false;
- }
- if (document.myform.taskContent.value.length>500)
- {
- alert("详细内容应少于500个字。");
- document.myform.taskContent.focus();
- return false;
- }
- else
- return true;
- }
- function backTask()
- {
- myform.action = "/mainctrl/calendar/detailCalendar?own=true";
- myform.submit();
- }
- function modifyTask()
- {
- if( !check() )
- {
- return false;
- }
- myform.action= "/mainctrl/calendar/modifyCalendarSuccess";
- myform.submit();
- }
- function addkey()
- {
- var opt = new Option();
- var opt2 = new Option();
- if(!document.myform.file.value=="")
- {
- opt.value = document.myform.file.value;
- opt.text = document.myform.file.value;
- var flag1 = 1;
- for(var i=0;i<document.myform.attachments.length;i++)
- {
- if(document.myform.attachments.options[i].text==opt.text)
- {
- flag1 = 0;
- break;
- }
- }
- if(flag1==1)
- {
- document.myform.attachments.options[document.myform.attachments.length] = opt;
- }
- }
- }
- function delAllSelOpts()
- {
- for( var i = 0; i < document.myform.attachments.options.length; i++ )
- {
- var oriLen = document.myform.attachments.options.length;
- if ( document.myform.attachments.options[i].selected )
- {
- document.myform.attachments.options[i] = null;
- if(i < oriLen-1) i--;
- }
- }
- }
- function deleteDoc()
- {
- myform.action="/mainctrl/calendar/modifyCalendar?type=2";
- myform.submit();
- }
- function uploadDoc()
- {
- myform.action="/mainctrl/calendar/modifyCalendar?type=1";
- myform.encoding="multipart/form-data";
- myform.submit();
- }
- </script>
- <script language="JavaScript1.2" src="/vnex/menu/dockmenu_person.js"></script>
- <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
- <DIV align=center>
- <form name="myform" method="post" action="">
- <%
- int calendarId = -1;
- String str = "";
- CalendarValueBean calendarBean = null;
- if(session.getAttribute( "calendarBean" )!=null)
- {
- calendarBean = ( CalendarValueBean )session.getAttribute( "calendarBean" );
- }
- if( request.getParameter("type") !=null && request.getParameter("type").equals("0") )
- {
- if(request.getParameter("calendarIds")!=null && !request.getParameter("calendarIds").equals(""))
- calendarId = Integer.parseInt(request.getParameter("calendarIds"));
- calendarBean = calendarProxy.getCalendarDetail(calendarId);
- session.setAttribute( "calendarBean", calendarBean );
- }
- %>
- <%
- int sYear = 0;
- int sMonth = 0;
- int sDay = 0;
- int sHour = 0;
- int sMinute = 0;
- int eYear = 0;
- int eMonth = 0;
- int eDay = 0;
- int eHour = 0;
- int eMinute = 0;
- String taskName = null;
- String taskImport = null;
- String taskContent = null;
- String taskVisible = null;
- String coadjutant = null;
- String ssd = "";
- String sed = "";
- Timestamp startDate = null;
- Timestamp endDate = null;
- String root = ConfigParaLoader.getParameter("rootUrl");
- String attachURL = ConfigParaLoader.getParameter("calendarAttachmentUrl");
- if( request.getParameter("type") !=null && request.getParameter("type").equals("1") ) //上载
- {
- calendarBean = ( CalendarValueBean )session.getAttribute( "calendarBean" );
- attachURL += SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
- // Initialization
- myUpload.initialize( pageContext );
- myUpload.setTotalMaxFileSize( Integer.parseInt(ConfigParaLoader.getParameter("attachmentSize")) );
- // Upload
- myUpload.upload();
- myUpload.save( root + attachURL );
- //保存已有信息( 以下代码, 要根据自己的情况写)
- com.vnex.intranet.upload.Request multi = myUpload.getRequest();
- if(multi.getParameter("taskId")!=null && !multi.getParameter("taskId").equals(""))
- calendarId = Integer.parseInt(multi.getParameter("taskId"));
- if(multi.getParameter("StartDate")!=null && !multi.getParameter("StartDate").equals(""))
- {
- ssd = multi.getParameter("StartDate");
- ssd = ssd + " " + multi.getParameter("sHour") + ":" + multi.getParameter("sMinute") + ":00";
- startDate = TimeStamp.toTimestamp(ssd);
- }
- if(multi.getParameter("EndDate")!=null && !multi.getParameter("EndDate").equals(""))
- {
- sed = multi.getParameter("EndDate");
- sed = sed + " " + multi.getParameter("eHour") + ":" + multi.getParameter("eMinute") + ":00";
- endDate = TimeStamp.toTimestamp(sed);
- }
- if(multi.getParameter("taskName")!=null && !multi.getParameter("taskName").equals(""))
- {
- taskName = multi.getParameter("taskName");
- calendarBean.setTaskName(taskName);
- }
- if(multi.getParameter("taskImport")!=null && !multi.getParameter("taskImport").equals(""))
- {
- taskImport = multi.getParameter("taskImport");
- calendarBean.setTaskImport(taskImport);
- }
- if(multi.getParameter("taskContent")!=null && !multi.getParameter("taskContent").equals(""))
- {
- taskContent = multi.getParameter("taskContent");
- calendarBean.setTaskContent(taskContent);
- }
- if(multi.getParameter("taskVisible")!=null && !multi.getParameter("taskVisible").equals(""))
- {
- taskVisible = multi.getParameter("taskVisible");
- if(taskVisible.equals("true"))
- {
- calendarBean.setTaskVisible(true);
- }
- }
- else
- {
- calendarBean.setTaskVisible(false);
- }
- if(multi.getParameter("coadjutant")!=null && !multi.getParameter("coadjutant").equals(""))
- {
- coadjutant = multi.getParameter("coadjutant");
- calendarBean.setCoadjutant(coadjutant);
- }
- calendarBean.setStartDate(startDate);
- calendarBean.setEndDate(endDate);
- calendarBean.setCreatorId(BusinessName.getEmpId());
- Collection coll = calendarBean.getAttachments();
- com.vnex.intranet.upload.File myFile = myUpload.getFiles().getFile(0);
- if (!myFile.isMissing())
- {
- String url = attachURL +SubPathGenerater.getSeperator()+ myFile.getFileName();
- if( !coll.contains(url) )
- {
- coll.add(url);
- }
- }
- calendarBean.setAttachments(coll);
- if(multi.getParameter("ssempId")!=null)
- {
- out.println("<input type=hidden name=ssempId value=""+multi.getParameter("ssempId")+"">");
- }
- if(multi.getParameter("ssStartDate")!=null)
- {
- out.println("<input type=hidden name=ssStartDate value=""+multi.getParameter("ssStartDate")+"">");
- }
- if(multi.getParameter("ssEndDate")!=null)
- {
- out.println("<input type=hidden name=ssEndDate value=""+multi.getParameter("ssEndDate")+"">");
- }
- if(multi.getParameter("start")!=null)
- {
- out.println("<input type=hidden name=start value=""+multi.getParameter("start")+"">");
- }
- }
- //删除文件时的代码.
- if( request.getParameter("type")!=null && request.getParameter("type").equals("2") )
- {
- calendarBean = ( CalendarValueBean )session.getAttribute( "calendarBean" );
- //保存已有信息( 以下代码, 要根据自己的情况写)
- if(request.getParameter("taskId")!=null && !request.getParameter("taskId").equals(""))
- calendarId = Integer.parseInt(request.getParameter("taskId"));
- if(request.getParameter("StartDate")!=null && !request.getParameter("StartDate").equals(""))
- {
- ssd = request.getParameter("StartDate");
- ssd = ssd + " " + request.getParameter("sHour") + ":" + request.getParameter("sMinute") + ":00";
- startDate = TimeStamp.toTimestamp(ssd);
- }
- if(request.getParameter("EndDate")!=null && !request.getParameter("EndDate").equals(""))
- {
- sed = request.getParameter("EndDate");
- sed = sed + " " + request.getParameter("eHour") + ":" + request.getParameter("eMinute") + ":00";
- endDate = TimeStamp.toTimestamp(sed);
- }
- if(request.getParameter("taskName")!=null && !request.getParameter("taskName").equals(""))
- {
- taskName = request.getParameter("taskName");
- calendarBean.setTaskName(taskName);
- }
- if(request.getParameter("taskImport")!=null && !request.getParameter("taskImport").equals(""))
- {
- taskImport = request.getParameter("taskImport");
- calendarBean.setTaskImport(taskImport);
- }
- if(request.getParameter("taskContent")!=null && !request.getParameter("taskContent").equals(""))
- {
- taskContent = request.getParameter("taskContent");
- calendarBean.setTaskContent(taskContent);
- }
- if(request.getParameter("taskVisible")!=null && !request.getParameter("taskVisible").equals(""))
- {
- taskVisible = request.getParameter("taskVisible");
- if(taskVisible.equals("true"))
- {
- calendarBean.setTaskVisible(true);
- }
- }
- else
- {
- calendarBean.setTaskVisible(false);
- }
- calendarBean.setStartDate(startDate);
- calendarBean.setEndDate(endDate);
- calendarBean.setCreatorId(BusinessName.getEmpId());
- Collection dcoll = new ArrayList();
- if( request.getParameter("attachments")!=null && !request.getParameter("attachments").equals("") )
- {
- String url = request.getParameter("attachments");
- Collection coll = calendarBean.getAttachments();
- if(coll != null && coll.size() != 0)
- {
- Iterator it = coll.iterator();
- while( it.hasNext() )
- {
- str = (String)it.next();
- if( url.equals(str) )
- {
- //SubPathGenerater.deleteFile(root+str);
- dcoll.add(str);
- coll.remove(str);
- break;
- }
- }//end while
- }//end if
- }
- session.setAttribute( "delCalAtta", dcoll );
- }
- %>
- <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
- <TBODY>
- <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
- <TR>
- <TD colSpan=3 align="center" class="iframestyle" valign="top"> <!--菜单开始 -->
- <!--分隔线结束 --> <!--个人信息开始 --> <br>
- <table width="600" border="1" cellspacing="1" bordercolor="#666666" class="iframestyle">
- <tr valign="top">
- <td bgcolor="#fafafa">
- <table width="600" border="0" cellspacing="0" cellpadding="0">
- <tr valign="top" bgcolor="#666666">
- <td colspan="2"><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>>><a href="/mainctrl/personal/main"><font color="#FFFFFF">个人办公</font></a>>><a href="/mainctrl/calendar/getCalendarList"><font color="#FFFFFF">日程安排</font></a>>>修改任务</font>
- </td>
- </tr>
- <table cellpadding="2" width="100%" cellspacing="1" align="center" class="title">
- <tbody>
- <tr bgcolor="#fafafa">
- <td width="17%"><font class="strong"> 主题:</font></td>
- <td width="83%"><input type="text" name="taskName" class="text" size="20" value="<%= FieldUtil.filterQuotTag(calendarBean.getTaskName())%>"> * (注:带*为必填内容)</td>
- </tr>
- <%
- startDate = calendarBean.getStartDate();
- endDate = calendarBean.getEndDate();
- ssd = MyDateFormat.myDate(startDate);
- Calendar cd = Calendar.getInstance();
- if(startDate!=null)
- {
- cd = TimeStamp.convertTimestampToCalendar(startDate);
- }
- sHour = cd.get(Calendar.HOUR_OF_DAY);
- sMinute = cd.get(Calendar.MINUTE);
- sed = MyDateFormat.myDate(endDate);
- if(endDate!=null)
- {
- cd = TimeStamp.convertTimestampToCalendar(endDate);
- }
- eHour = cd.get(Calendar.HOUR_OF_DAY);
- eMinute = cd.get(Calendar.MINUTE);
- %>
- <tr bgcolor="#e0e0e0">
- <td width="17%"><font class="strong"> 开始时间:</font></td>
- <td width="83%" >日期:
- <input type="text" name="StartDate" class=text size="20" value="<%= ssd%>" readonly> <img src="/vnex/intranet/calendar/datetime.gif" style="cursor:hand;" align="absmiddle" alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(StartDate);return false">
- 时刻:
- <select name="sHour" size="1">
- <%
- for(int i=0; i<=23; i++)
- {
- if( sHour==i )
- {
- if(i<=9)
- {
- out.println("<option selected value=0"+i+">"+i+"</option>");
- }
- else
- {
- out.println("<option selected value="+i+">"+i+"</option>");
- }
- }
- else
- {
- if(i<=9)
- {
- out.println("<option value=0"+i+">"+i+"</option>");
- }
- else
- {
- out.println("<option value="+i+">"+i+"</option>");
- }
- }
- }
- %>
- </select>
- :
- <select name="sMinute" size="1">
- <option value="00" <% if(sMinute==0) out.print("selected"); %>>00</option>
- <option value="15" <% if(sMinute==15) out.print("selected"); %>>15</option>
- <option value="30" <% if(sMinute==30) out.print("selected"); %>>30</option>
- <option value="45" <% if(sMinute==45) out.print("selected"); %>>45</option>
- </select> *
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="17%"><font class="strong"> 截止时间:</font></td>
- <td width="83%">日期:
- <input type="text" name="EndDate" class=text size="20" value="<%= sed%>" readonly> <img src="/vnex/intranet/calendar/datetime.gif" style="cursor:hand;" align="absmiddle" alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(EndDate);return false">
- 时刻: <select name="eHour" size="1">
- <%
- for(int i=0; i<=23; i++)
- {
- if( eHour==i )
- {
- if(i<=9)
- {
- out.println("<option selected value=0"+i+">"+i+"</option>");
- }
- else
- {
- out.println("<option selected value="+i+">"+i+"</option>");
- }
- }
- else
- {
- if(i<=9)
- {
- out.println("<option value=0"+i+">"+i+"</option>");
- }
- else
- {
- out.println("<option value="+i+">"+i+"</option>");
- }
- }
- }
- %>
- </select>
- :
- <select name="eMinute" size="1">
- <option value="00" <% if(eMinute==0) out.print("selected"); %>>00</option>
- <option value="15" <% if(eMinute==15) out.print("selected"); %>>15</option>
- <option value="30" <% if(eMinute==30) out.print("selected"); %>>30</option>
- <option value="45" <% if(eMinute==45) out.print("selected"); %>>45</option>
- </select> *
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="17%"><font class="strong"> 重要度:</font></td>
- <td width="83%">
- <select name="taskImport" class="button" size="1">
- <%
- str = calendarBean.getTaskImport();
- %>
- <option value="0"<% if( str.equals("0") ) out.print("selected"); %>>不指定</option>
- <option value="1" <% if( str.equals("1") ) out.print("selected"); %>>低</option>
- <option value="2" <% if( str.equals("2") ) out.print("selected"); %>>中</option>
- <option value="3" <% if( str.equals("3") ) out.print("selected"); %>>高</option>
- </select>
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="17%"><font class="strong"> 公开:</font></td>
- <td width="83%"><input type="checkbox" name="taskVisible" value="true" <% if( calendarBean.getTaskVisible() ) out.print("checked"); %>></td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td>
- <font class="strong"> 协助者:</font>
- </td>
- <td>
- <input type="text" name="coadjutant" class="text" size="24" value="<%= calendarBean.getCoadjutant()%>">
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="17%"><font class="strong"> 详细内容:</font></td>
- <td width="83%">
- <textarea name="taskContent" cols="50" rows="5"><%= calendarBean.getTaskContent()%></textarea>
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="17%"><font class="strong"> 附件:</font></td>
- <td width="83%" >
- <select size="3" name="attachments" style="width:300" class="text">
- <%
- Collection coll = calendarBean.getAttachments();
- if(coll != null && coll.size() != 0)
- {
- Iterator it = coll.iterator();
- while( it.hasNext() )
- {
- str = (String)it.next();
- int s = str.lastIndexOf(SubPathGenerater.getSeperator());
- String filename = str.substring(s+1);
- out.println( "<option value=""+str+"">"+filename+"</option>" );
- }
- }
- %>
- </select>
- <input type="button" value="删除附件" name="B29" class="text" onClick="deleteDoc()" style="width:60px">
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="17%" height="15"><font class="strong"> 上传附件:</font></td>
- <td width="83%">
- <input type="file" name="file" size="30" class="text">
-
- <input type="button" value="上传" name="B28" class="text" onClick="uploadDoc()">
- </td>
- </tr>
- <tr align="middle" bgcolor="#fafafa">
- <td colspan="2" height="30">
- <input type="button" name="Submit2" value="保存" onClick="return modifyTask()" class="text">
- <input type="reset" name="Reset" value="重置" class="text">
- <input type="button" name="submit121" value="放弃" class="text" onClick="backTask()">
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </table>
- <input type="hidden" name=taskId value="<%=calendarId %>">
- <%
- if(request.getParameter("ssempId")!=null)
- {
- out.println("<input type=hidden name=ssempId value=""+request.getParameter("ssempId")+"">");
- }
- if(request.getParameter("ssStartDate")!=null)
- {
- out.println("<input type=hidden name=ssStartDate value=""+request.getParameter("ssStartDate")+"">");
- }
- if(request.getParameter("ssEndDate")!=null)
- {
- out.println("<input type=hidden name=ssEndDate value=""+request.getParameter("ssEndDate")+"">");
- }
- if(request.getParameter("start")!=null)
- {
- out.println("<input type=hidden name=start value=""+request.getParameter("start")+"">");
- }
- %>
- <!--个人信息结束 -->
- <br>
- <br>
- <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
- </TD>
- </TR>
- <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
- </TBODY>
- </TABLE>
- <BR>
- <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
- </form></DIV>
- </BODY></HTML>