department_training_plan_maintain.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:15k
源码类别:
电子政务应用
开发平台:
Java
- <%
- /**
- * $RCSfile: department_training_plan_maintain.jsp $
- * $Revision: 1.0 $
- * Date: 2001/05/17 16:59:46 $
- * /training/maintain
- */
- %>
- <%@ page errorPage="/vnex/ErrorPage.jsp" %>
- <%@ page import="com.vnex.intranet.hr.util.*" %>
- <%@ page import="com.vnex.intranet.hr.value.*" %>
- <%@ page import="java.util.*"%>
- <%@ taglib uri="/vnex.tld" prefix="vnex" %>
- <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
- <%@ page import="com.vnex.intranet.organization.value.*"%>
- <%@ page import="com.vnex.intranet.organization.proxy.*"%>
- <%@ page import="com.vnex.intranet.pub.BaseJdbcDAO" %>
- <%@ page import="com.vnex.intranet.util.FieldUtil" %>
- <jsp:useBean id="organizationProxy" scope="Application" class="com.vnex.intranet.organization.proxy.OrganizationProxyBean" />
- <jsp:useBean id="dvalue" scope="Application" class="com.vnex.intranet.organization.value.DivisionValueBean" />
- <jsp:useBean id="trainingProxy" class="com.vnex.intranet.hr.process.HRTrainingProcessBean" scope="page" />
- <jsp:useBean id="BusinessName" class="com.vnex.intranet.pub.BusinessSession" scope="session" />
- <%
- //initial a training bean
- HRTrainingValueBean tmpHRTrainingValueBean = new HRTrainingValueBean();
- int trainId = -1;
- String pageFlow = "";
- String startDate = "";
- String endDate = "";
- String current = BaseJdbcDAO.getDBSystemDate().toString();
- current = current.substring(0, current.indexOf(" "));
- String operation = "create";
- boolean before = true;
- // judgement if page flow is from create training.
- if ( request.getParameter("pageFlow") !=null && request.getParameter("pageFlow").equals(HRPayAndTrainingConstant.TRAINCREATEPAGEFLOW))
- {
- pageFlow = ( String )request.getParameter("pageFlow");
- }
- // judgement if page flow is from create training.
- if ( request.getParameter("pageFlow") !=null && request.getParameter("pageFlow").equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW))
- {
- pageFlow = ( String )request.getParameter("pageFlow");
- trainId = Integer.parseInt((String)request.getParameter("trainId"));
- tmpHRTrainingValueBean = trainingProxy.getTraining( trainId );
- startDate = tmpHRTrainingValueBean.getTrain_startdate().toString();
- endDate = tmpHRTrainingValueBean.getTrain_enddate().toString();
- startDate = startDate.substring(0, startDate.indexOf(" "));
- endDate = endDate.substring(0, endDate.indexOf(" "));
- operation = "modify";
- int result = startDate.compareTo(current);
- if(result < 0)
- before = false;
- }
- %>
- <!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/menu/dockmenu_hr.js"></script>
- <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
- <script language="JavaScript" src="/vnex/util/popup.js"></script>
- <script language="JavaScript" src="/vnex/util/popSelect.js"></script>
- <script language="JavaScript" src="/vnex/util/strUtil.js"></script>
- <script language="Javascript">
- function isCompleteData(form)
- {
- if(isEmpty(form.train_name.value) || isEmptyStr(form.train_name.value))
- {
- alert("请输入培训标题");
- form.train_name.focus();
- return false;
- }
- else
- {
- if(isContainInvalidChar(form.train_name.value, "'"))
- {
- alert("培训标题中不能含有单引号");
- form.train_name.focus();
- return false;
- }
- }
- if(isEmpty(form.train_teacher.value) || isEmptyStr(form.train_teacher.value))
- {
- alert("请输入培训人");
- form.train_teacher.focus();
- return false;
- }
- if(isEmpty(form.train_address.value) || isEmptyStr(form.train_address.value))
- {
- alert("请输入培训地点");
- form.train_address.focus();
- return false;
- }
- if(isEmpty(form.train_type.value) || isEmptyStr(form.train_type.value))
- {
- form.train_type.value="";
- }
- if(isEmpty(form.startDate.value))
- {
- alert("请选择培训起始时间");
- form.startDate.focus();
- return false;
- }
- else
- {
- if("<%=operation%>" == "create" && form.startDate.value < "<%=current%>")
- {
- alert("培训起始时间应在本日之后!");
- form.startDate.focus();
- return false;
- }
- }
- if(isEmpty(form.endDate.value))
- {
- alert("请选择培训结束时间");
- form.endDate.focus();
- return false;
- }
- /*else
- {
- if(form.endDate.value < "<%=current%>")
- {
- alert("结束时间应在本日之前");
- form.endDate.focus();
- return false;
- }
- }*/
- if(form.startDate.value > form.endDate.value)
- {
- alert("结束时间必须在开始时间之后");
- form.startDate.focus();
- return false;
- }
- if("<%=operation%>" == "modify" && form.startDate.value != "<%=startDate%>")
- {
- if(form.startDate.value < "<%=current%>")
- {
- alert("请不要把起始时间修改到本日之前");
- form.startDate.value="<%=startDate%>";
- return false;
- }
- }
- return true;
- }
- function createTraining(form)
- {
- if(isCompleteData(form))
- {
- checkAll(form.trainArray);
- form.action="/mainctrl/training/main?pageFlow=<%=HRPayAndTrainingConstant.TRAINCREATEPAGEFLOW%>";
- form.submit();
- }
- }
- function modifyTraining(form)
- {
- if(isCompleteData(form))
- {
- checkAll(form.trainArray);
- form.action="/mainctrl/training/modifyTraining?trainId=<%=request.getParameter("trainId")%>";
- form.submit();
- }
- }
- function delAllSelOpts( mSelObj )
- {
- for( var i = 0; i < mSelObj.options.length; i++ )
- {
- var oriLen = mSelObj.options.length;
- if ( mSelObj.options[i].selected ){
- mSelObj.options[i] = null;
- if(i < oriLen-1) i--;
- }
- }
- /*
- if( mSelObj.options.length == 0 )
- {
- var opt = new Option();
- opt.text = "";
- mSelObj.options[0] = opt;
- }
- */
- }
- //check all elements of a mutiple select options
- function checkAll( selObj )
- {
- for(var i=0;i<selObj.options.length;i++)
- {
- var val = selObj.options[i].value;
- if(val.indexOf(";") != -1)
- val = val.substring(0, val.indexOf(";"));
- selObj.options[i].value=val;
- selObj.options[i].selected = true;
- }
- deleteDuplicatedSelect(selObj);
- }
- function deleteDuplicatedSelect(selObj)
- {
- for(i=0;i<selObj.options.length;i++)
- {
- for(j=i+1;j<selObj.options.length;j++)
- {
- if(selObj.options[i].value==selObj.options[j].value)
- selObj.options[j].selected=false;
- }
- }
- }
- function checkStatus(form)
- {
- if(form.dd_train_id.value==16 && form.startDate.value > "<%=current%>")
- {
- alert("起始时间尚在本日之后,不能将本培训置为完成状态");
- form.dd_train_id.value=15;
- }
- }
- </script>
- <DIV align=center>
- <form name="maintain" method=POST>
- <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">
- <br>
- <!--休假事件表开始 -->
- <table width="600" border="1" cellspacing="1" bordercolor="#666666">
- <tr>
- <td>
- <table class=title cellspacing=1 cellpadding=2 border=0 width="600">
- <tr>
- <td bgcolor="#666666"><font class="strongw">
- <a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>>>
- <a href="/mainctrl/hr/main"><font color="#FFFFFF">人力资源</font></a>>>
- <a href="/mainctrl/training/main"><font color="#ffffff">员工培训</font></a>>>
- 培训维护</font></td>
- </tr>
- </table>
- <table class=title cellspacing=1 cellpadding=2 width="600" border=0>
- <input type="hidden" name="train_id" value="<%=tmpHRTrainingValueBean.getTrain_id()%>">
- <tr bgcolor="#fafafa">
- <td width="26%"><strong> 部门名称:</strong></td>
- <td width="74%"><%=BusinessName.getDeptName()%>
- <input type="hidden" name="train_division" value="<%=BusinessName.getDeptName()%>">
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="26%"><strong> 培训主题:</strong></td>
- <td width="74%">
- <input type="text" name="train_name" value="<%=FieldUtil.filterQuotTag(tmpHRTrainingValueBean.getTrain_name())%>" size="40" maxlength="40" class="text"> * (注:带*为必填内容)
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="26%"><strong> 主讲:</strong></td>
- <td width="74%">
- <input type="text" name="train_teacher" value="<%=tmpHRTrainingValueBean.getTrain_teacher()%>" size="40" maxlength="40" class="text"> *
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="26%"><strong> 地点:</strong></td>
- <td width="74%">
- <input type="text" name="train_address" value="<%=tmpHRTrainingValueBean.getTrain_address()%>" size="40" maxlength="40" class="text"> *
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="26%"><strong> 培训方式:</strong></td>
- <td width="74%">
- <input type="text" name="train_type" value="<%=tmpHRTrainingValueBean.getTrain_type()%>" size="40" maxlength="10" class="text">
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="26%"><strong> 状态:</strong></td>
- <td width="74%">
- <%
- if( pageFlow.equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW) )
- {
- %>
- <select name="dd_train_id" onchange="checkStatus(this.form)">
- <%
- TrainType aTrainType = new TrainType();
- ArrayList typeList1 = aTrainType.getAllEType();
- for (int i = 0;i<typeList1.size() ;i++) {
- aTrainType = ( TrainType )typeList1.get(i);
- if( aTrainType.getTypeId() == tmpHRTrainingValueBean.getDd_train_id() )
- {
- out.println("<option value = " + aTrainType.getTypeId() + " Selected>" + aTrainType.getTypeName() + "</option>");
- }
- else
- {
- out.println("<option value = " + aTrainType.getTypeId() + ">" + aTrainType.getTypeName() + "</option>");
- }
- }
- %>
- </select>
- <%
- }
- else
- {
- %>
- 新增
- <%}%>
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="26%"><strong> 培训时间:</strong></td>
- <td width="74%">从
- <input type="text" class="text" name="startDate" readonly size="24" value="<%=startDate%>">
- *
- <% if(before)
- {%>
- <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择培训起始日期" onClick="fPopUpCalendarDlg(startDate);return false">
- <% }%>
- 至
- <input type="text" class="text" name="endDate" readonly size="24" value="<%=endDate%>"> *
- <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择培训结束日期" onClick="fPopUpCalendarDlg(endDate);return false">
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="26%"><strong> 参加人员:</strong></td>
- <td>
- <input type="hidden" name="updated" value="false">
- <input type="hidden" name="tempHidden" value="">
- <select size="7" name="trainArray" multiple style="width:200px">
- <%
- if(pageFlow.equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW))
- {
- Collection tmpPerson = tmpHRTrainingValueBean.getPersons();
- if(tmpPerson != null)
- {
- Iterator it = tmpPerson.iterator();
- while(it.hasNext())
- {
- HRTempBean tmpHRTempBean = ( HRTempBean )it.next();
- String tmpString = String.valueOf(tmpHRTempBean.getTmp_id());
- out.println("<option value = " + tmpString + ">" + tmpHRTempBean.getTmp_name() + " "+tmpHRTempBean.getTmp_decription()+"</option>");
- }
- }
- }
- %>
- </select>
- <input type="button" name="Submit1" value="按部门选择" class="file" onClick="javascript:addList( trainArray)" style="width:70px">
-
- <input type="button" name="Submit2" style="width:60px" value="分组选择" class="file" onClick="javascript:addGroupList(trainArray )" >
-
- <input type="button" name="Submit2" value="删除" class="text" onclick="delAllSelOpts(trainArray)">
- </td>
- </tr>
- <tr bgcolor="#fafafa" align="center" height="30">
- <td colspan="2">
- <%
- if( pageFlow.equals( HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW ) )
- {
- %>
- <input type="button" value="保存" name="B1" onclick="return modifyTraining(this.form)" class=text>
- <%
- }
- else
- {
- %>
- <input type="button" value="保存" name="B1" onclick="return createTraining(this.form)" class=text>
- <%
- }
- %>
- <input type="reset" value="重置" name="B4" class="text">
- <input type="button" value="放弃" name="B3" class="text" onclick="history.back()">
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <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>