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

电子政务应用

开发平台:

Java

  1. <%
  2. /**
  3.  * $RCSfile: department_training_plan_maintain.jsp $
  4.  * $Revision: 1.0 $
  5.  * Date: 2001/05/17 16:59:46 $
  6.  * /training/maintain
  7.  */
  8. %>
  9. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  10. <%@ page import="com.vnex.intranet.hr.util.*" %>
  11. <%@ page import="com.vnex.intranet.hr.value.*" %> 
  12. <%@ page import="java.util.*"%>
  13. <%@ taglib uri="/vnex.tld" prefix="vnex" %>
  14. <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
  15. <%@ page import="com.vnex.intranet.organization.value.*"%>
  16. <%@ page import="com.vnex.intranet.organization.proxy.*"%>
  17. <%@ page import="com.vnex.intranet.pub.BaseJdbcDAO" %>
  18. <%@ page import="com.vnex.intranet.util.FieldUtil" %>
  19. <jsp:useBean id="organizationProxy" scope="Application" class="com.vnex.intranet.organization.proxy.OrganizationProxyBean" />
  20. <jsp:useBean id="dvalue" scope="Application" class="com.vnex.intranet.organization.value.DivisionValueBean" />
  21. <jsp:useBean id="trainingProxy" class="com.vnex.intranet.hr.process.HRTrainingProcessBean" scope="page" />
  22. <jsp:useBean id="BusinessName" class="com.vnex.intranet.pub.BusinessSession" scope="session" />
  23. <%
  24.      //initial a training bean
  25.      HRTrainingValueBean tmpHRTrainingValueBean = new HRTrainingValueBean();
  26.      int trainId = -1;
  27.      String pageFlow = "";
  28.      String startDate = "";
  29.      String endDate = "";
  30.      String current = BaseJdbcDAO.getDBSystemDate().toString();
  31.      current = current.substring(0, current.indexOf(" "));
  32.      String operation = "create";
  33.      boolean before = true;
  34.      
  35.      // judgement if page flow is from create training.
  36.      if ( request.getParameter("pageFlow") !=null && request.getParameter("pageFlow").equals(HRPayAndTrainingConstant.TRAINCREATEPAGEFLOW))
  37.      {
  38.         pageFlow = ( String )request.getParameter("pageFlow");
  39.      }
  40.       
  41.      // judgement if page flow is from create training.
  42.     if ( request.getParameter("pageFlow") !=null && request.getParameter("pageFlow").equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW))
  43.      {
  44.          pageFlow = ( String )request.getParameter("pageFlow");
  45.          trainId = Integer.parseInt((String)request.getParameter("trainId"));
  46.          
  47.          tmpHRTrainingValueBean = trainingProxy.getTraining( trainId ); 
  48.          
  49.          startDate = tmpHRTrainingValueBean.getTrain_startdate().toString();
  50.          endDate = tmpHRTrainingValueBean.getTrain_enddate().toString();
  51.          startDate = startDate.substring(0, startDate.indexOf(" "));
  52.          endDate = endDate.substring(0, endDate.indexOf(" "));
  53.          operation = "modify";
  54.          int result = startDate.compareTo(current);
  55.          if(result < 0)
  56.            before = false;
  57.      }
  58.      
  59. %>
  60. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  61. <HTML>
  62. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  63. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  64. <script language="JavaScript" src="/vnex/menu/dockmenu_hr.js"></script>
  65. <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
  66. <script language="JavaScript" src="/vnex/util/popup.js"></script>
  67. <script language="JavaScript" src="/vnex/util/popSelect.js"></script>
  68. <script language="JavaScript" src="/vnex/util/strUtil.js"></script>
  69. <script language="Javascript">
  70.     function isCompleteData(form)
  71.     {
  72.        if(isEmpty(form.train_name.value) || isEmptyStr(form.train_name.value))
  73.        {
  74.           alert("请输入培训标题");
  75.           form.train_name.focus();
  76.           return false;
  77.        }
  78.        else
  79.        {
  80.           if(isContainInvalidChar(form.train_name.value, "'"))
  81.           {
  82.              alert("培训标题中不能含有单引号");
  83.              form.train_name.focus();
  84.              return false;
  85.           }
  86.        }
  87.        if(isEmpty(form.train_teacher.value) || isEmptyStr(form.train_teacher.value))
  88.        {
  89.           alert("请输入培训人");
  90.           form.train_teacher.focus();
  91.           return false;
  92.        }
  93.        if(isEmpty(form.train_address.value) || isEmptyStr(form.train_address.value))
  94.        {
  95.           alert("请输入培训地点");
  96.           form.train_address.focus();
  97.           return false;
  98.        }
  99.        if(isEmpty(form.train_type.value) || isEmptyStr(form.train_type.value))
  100.        {
  101.           form.train_type.value="";
  102.    }
  103.        if(isEmpty(form.startDate.value))
  104.        {
  105.           alert("请选择培训起始时间");
  106.           form.startDate.focus();
  107.           return false;
  108.        }
  109.        else
  110.        {
  111.           if("<%=operation%>" == "create" && form.startDate.value < "<%=current%>")
  112.           {
  113.              alert("培训起始时间应在本日之后!");
  114.              form.startDate.focus();
  115.              return false;
  116.           }
  117.        }
  118.        if(isEmpty(form.endDate.value))
  119.        {
  120.           alert("请选择培训结束时间");
  121.           form.endDate.focus();
  122.           return false;
  123.        }
  124.        /*else
  125.        {
  126.           if(form.endDate.value < "<%=current%>")
  127.           {
  128.              alert("结束时间应在本日之前");
  129.              form.endDate.focus();
  130.              return false;
  131.           }
  132.        }*/
  133.        if(form.startDate.value > form.endDate.value)
  134.        {
  135.           alert("结束时间必须在开始时间之后");
  136.           form.startDate.focus();
  137.           return false;
  138.        }
  139.        if("<%=operation%>" == "modify" && form.startDate.value != "<%=startDate%>")
  140.        {
  141.           if(form.startDate.value < "<%=current%>")
  142.           {
  143.               alert("请不要把起始时间修改到本日之前");
  144.               form.startDate.value="<%=startDate%>";
  145.               return false;
  146.           }
  147.        }
  148.        return true;
  149.     }
  150.     function createTraining(form)
  151.     {
  152.         if(isCompleteData(form))
  153.         {
  154.   checkAll(form.trainArray);
  155.   form.action="/mainctrl/training/main?pageFlow=<%=HRPayAndTrainingConstant.TRAINCREATEPAGEFLOW%>";
  156.           form.submit();
  157.         }  
  158.     }
  159.     
  160.     function modifyTraining(form)
  161.     {
  162.         if(isCompleteData(form))
  163.         {
  164.   checkAll(form.trainArray);
  165.   form.action="/mainctrl/training/modifyTraining?trainId=<%=request.getParameter("trainId")%>";
  166.           form.submit();
  167.         }  
  168.     }
  169. function delAllSelOpts( mSelObj )
  170. {
  171.     
  172.     for( var i = 0; i < mSelObj.options.length; i++ )
  173.     {
  174.        var oriLen = mSelObj.options.length;
  175.        if ( mSelObj.options[i].selected ){
  176.          mSelObj.options[i] = null;
  177.          if(i < oriLen-1) i--;
  178.        }
  179.     }
  180.     /*
  181.     if( mSelObj.options.length == 0 )
  182.     {
  183.        var opt = new Option();
  184.        opt.text = "";
  185.        mSelObj.options[0] = opt;
  186.     }
  187.     */
  188. }
  189.     
  190. //check all elements of a mutiple select options
  191. function checkAll( selObj )
  192. {
  193.     for(var i=0;i<selObj.options.length;i++)
  194.     {   
  195.         var val = selObj.options[i].value;
  196.         if(val.indexOf(";") != -1)
  197.             val = val.substring(0, val.indexOf(";"));
  198.         selObj.options[i].value=val;
  199.         selObj.options[i].selected = true;
  200.     }   
  201.     deleteDuplicatedSelect(selObj);
  202. }
  203.   function deleteDuplicatedSelect(selObj)
  204.   {
  205.       for(i=0;i<selObj.options.length;i++)
  206.       {
  207.          for(j=i+1;j<selObj.options.length;j++)
  208.          {
  209.              if(selObj.options[i].value==selObj.options[j].value)
  210.                 selObj.options[j].selected=false;
  211.          }
  212.       }
  213.   }
  214.   function checkStatus(form)
  215.   {
  216.       if(form.dd_train_id.value==16 && form.startDate.value > "<%=current%>")
  217.       {
  218.          alert("起始时间尚在本日之后,不能将本培训置为完成状态");
  219.          form.dd_train_id.value=15;
  220.       }
  221.   }
  222. </script>
  223. <DIV align=center>
  224. <form name="maintain" method=POST>
  225.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  226.     <tbody>
  227.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  228.     <TR> 
  229.         <TD colSpan=3 align="center"> 
  230.           <br>
  231.           <!--休假事件表开始 -->
  232.            <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  233.             <tr>
  234.               <td> 
  235.                 <table class=title cellspacing=1 cellpadding=2 border=0 width="600">
  236.                   <tr> 
  237.                     <td bgcolor="#666666"><font class="strongw">
  238.                       <a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;
  239.                       <a href="/mainctrl/hr/main"><font color="#FFFFFF">人力资源</font></a>&gt;&gt;
  240.                       <a href="/mainctrl/training/main"><font color="#ffffff">员工培训</font></a>&gt;&gt;
  241.                       培训维护</font></td>
  242.                   </tr>
  243.                 </table>  
  244.                 <table class=title cellspacing=1 cellpadding=2 width="600" border=0>
  245.                 <input type="hidden" name="train_id" value="<%=tmpHRTrainingValueBean.getTrain_id()%>">
  246.       <tr bgcolor="#fafafa"> 
  247.         <td width="26%"><strong>&nbsp;部门名称:</strong></td>
  248.         <td width="74%"><%=BusinessName.getDeptName()%>
  249.         <input type="hidden" name="train_division" value="<%=BusinessName.getDeptName()%>"> 
  250.         </td>
  251.       </tr>
  252.       <tr bgcolor="#e0e0e0"> 
  253.         <td width="26%"><strong>&nbsp;培训主题:</strong></td>
  254.         <td width="74%"> 
  255.                 <input type="text" name="train_name" value="<%=FieldUtil.filterQuotTag(tmpHRTrainingValueBean.getTrain_name())%>" size="40" maxlength="40" class="text">&nbsp;*&nbsp;(注:带*为必填内容)
  256.         </td>
  257.       </tr>
  258.       <tr bgcolor="#fafafa"> 
  259.         <td width="26%"><strong>&nbsp;主讲:</strong></td>
  260.         <td width="74%"> 
  261.                 <input type="text" name="train_teacher" value="<%=tmpHRTrainingValueBean.getTrain_teacher()%>" size="40" maxlength="40" class="text">&nbsp;*
  262.         </td>
  263.       </tr>
  264.       <tr bgcolor="#e0e0e0"> 
  265.         <td width="26%"><strong>&nbsp;地点:</strong></td>
  266.         <td width="74%"> 
  267.                 <input type="text" name="train_address" value="<%=tmpHRTrainingValueBean.getTrain_address()%>" size="40" maxlength="40" class="text">&nbsp;*
  268.         </td>
  269.       </tr>
  270.       <tr bgcolor="#fafafa"> 
  271.         <td width="26%"><strong>&nbsp;培训方式:</strong></td>
  272.         <td width="74%"> 
  273.                 <input type="text" name="train_type" value="<%=tmpHRTrainingValueBean.getTrain_type()%>" size="40" maxlength="10" class="text">
  274.         </td>
  275.       </tr>
  276.       <tr bgcolor="#e0e0e0"> 
  277.         <td width="26%"><strong>&nbsp;状态:</strong></td>
  278.         <td width="74%"> 
  279.       <%
  280.      if( pageFlow.equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW) )
  281.      {
  282.   %> 
  283.           <select name="dd_train_id" onchange="checkStatus(this.form)">
  284.             <%     
  285.                             TrainType aTrainType = new TrainType();
  286.                             ArrayList typeList1 = aTrainType.getAllEType();
  287.                             
  288.                             for (int i = 0;i<typeList1.size() ;i++) {
  289.                                   aTrainType = ( TrainType )typeList1.get(i);
  290.                                   if( aTrainType.getTypeId() == tmpHRTrainingValueBean.getDd_train_id() )
  291.                                   {
  292.                                        out.println("<option value = " + aTrainType.getTypeId() + " Selected>" + aTrainType.getTypeName() + "</option>");     
  293.                                   }
  294.                                   else
  295.                                   {
  296.                                       out.println("<option value = " + aTrainType.getTypeId() + ">" + aTrainType.getTypeName() + "</option>");     
  297.                                   }     
  298.                             }     
  299.                                
  300.                         %> 
  301.           </select>
  302.       <%
  303.      }
  304.      else
  305.      {
  306.   %> 
  307.            新增
  308.      <%}%>
  309.          </td>
  310.        </tr>
  311.       <tr bgcolor="#fafafa"> 
  312.         <td width="26%"><strong>&nbsp;培训时间:</strong></td>
  313.         <td width="74%">从&nbsp;
  314.            <input type="text" class="text" name="startDate" readonly size="24" value="<%=startDate%>">
  315.            &nbsp;*
  316. <%       if(before)
  317.          {%>           
  318.            <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择培训起始日期" onClick="fPopUpCalendarDlg(startDate);return false">
  319. <%       }%>           
  320.            &nbsp;至&nbsp;
  321.            <input type="text" class="text" name="endDate" readonly size="24" value="<%=endDate%>">&nbsp;*
  322.            <img src="/vnex/util/datetime.gif" style="cursor:hand;" align="absmiddle" alt="选择培训结束日期" onClick="fPopUpCalendarDlg(endDate);return false">
  323.         </td>
  324.       </tr>
  325.       <tr bgcolor="#e0e0e0">
  326.          <td width="26%"><strong>&nbsp;参加人员:</strong></td>
  327.          <td>
  328.             <input type="hidden" name="updated" value="false">
  329.             <input type="hidden" name="tempHidden" value="">
  330.             <select size="7" name="trainArray" multiple style="width:200px">
  331.               <%     
  332.                  if(pageFlow.equals(HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW))
  333.                  {
  334.                            Collection tmpPerson = tmpHRTrainingValueBean.getPersons();
  335.                            if(tmpPerson != null)
  336.                            {
  337.                              Iterator it = tmpPerson.iterator();    
  338.                              while(it.hasNext())
  339.                              {
  340.                                HRTempBean tmpHRTempBean = ( HRTempBean )it.next();
  341.                                String tmpString = String.valueOf(tmpHRTempBean.getTmp_id());
  342.                                out.println("<option value = " + tmpString + ">" + tmpHRTempBean.getTmp_name() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+tmpHRTempBean.getTmp_decription()+"</option>");     
  343.                              }
  344.                            
  345.                            }
  346.                   }         
  347.               %>
  348.             </select>&nbsp;
  349.             <input type="button" name="Submit1" value="按部门选择" class="file" onClick="javascript:addList( trainArray)" style="width:70px">
  350.             &nbsp;&nbsp;
  351.             <input type="button" name="Submit2" style="width:60px" value="分组选择" class="file" onClick="javascript:addGroupList(trainArray )" >
  352.             &nbsp;&nbsp;
  353.             <input type="button" name="Submit2" value="删除" class="text" onclick="delAllSelOpts(trainArray)">
  354.          </td>
  355.        </tr>
  356.       <tr bgcolor="#fafafa" align="center" height="30">
  357.         <td colspan="2">
  358.   <%
  359.      if( pageFlow.equals( HRPayAndTrainingConstant.TRAINMODIFYPAGEFLOW ) )
  360.      {
  361.   %>
  362.       <input type="button" value="保存" name="B1" onclick="return modifyTraining(this.form)" class=text>
  363.       <%
  364.   }
  365.   else
  366.   {
  367.   %> 
  368.       <input type="button" value="保存" name="B1" onclick="return createTraining(this.form)" class=text>
  369.       <%
  370.   }
  371.   %>
  372.   &nbsp;&nbsp;<input type="reset" value="重置" name="B4" class="text">
  373.   &nbsp;&nbsp;<input type="button" value="放弃" name="B3" class="text" onclick="history.back()"> 
  374.  </td>
  375.       </tr> 
  376.     </table>
  377.     </td>
  378.     </tr>
  379.     </table>
  380.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  381.         </TD>
  382.     </TR>
  383.      <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  384.     </TBODY> 
  385.     </TABLE>
  386.   <BR>
  387.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  388.   </form></DIV>
  389. </BODY></HTML>