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

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="com.vnex.intranet.calendar.value.*"%>
  3. <%@ page import="com.vnex.intranet.calendar.proxy.*"%>
  4. <%@ page import="com.vnex.intranet.util.*"%>
  5. <%@ page import="com.vnex.intranet.communication.util.*"%>
  6. <%@ page import="java.util.*" %>
  7. <%@ page import="java.sql.*" %>
  8. <jsp:useBean id="calendarProxy" class="com.vnex.intranet.calendar.proxy.CalendarProxyBean" scope="application" />
  9. <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
  10. <%@ taglib uri="/vnex.tld" prefix="vnex" %>
  11. <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
  12. <%@ taglib uri="/vnex_hr.tld" prefix="hr" %>
  13. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  14. <HTML>
  15. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  16. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  17. <script Language="JavaScript" src="/vnex/intranet/calendar/Popup.js"></script>
  18. <script language="javascript" src="/vnex/validate.js" ></script>
  19. <script language=JavaScript>
  20. function changeIt()
  21. {
  22.   document.myform.action = "/mainctrl/calendar/getCalendarList?search=ok&back=ok";
  23.   document.myform.submit();
  24. }
  25. function linkTask(taskId)
  26. {
  27.   document.myform.action = "/mainctrl/calendar/detailCalendar?taskId="+taskId;
  28.   document.myform.submit();
  29. }
  30. function searchTask()
  31. {
  32.   document.myform.action = "/mainctrl/calendar/getCalendarList?search=ok&start=1";
  33.   document.myform.submit();
  34. }
  35. function removeTasks()
  36. {
  37.   if( document.myform.calendarIds==null )
  38.   {
  39.     alert("没有要删除的任务。");
  40.     return false;
  41.   }
  42.   if( document.myform.own.value=="false" )
  43.   {
  44.     alert("不能删除别人的任务。");
  45.     return false;
  46.   }
  47.   if( !isChecked(document.myform.calendarIds) )
  48.   {
  49.     alert("请选择要删除的任务。");
  50.     return false;
  51.   }
  52.   if(!confirm("是否确定删除?"))
  53.   {
  54.     return false;
  55.   }
  56.  document.myform.action = "/mainctrl/calendar/removeCalendarSuccess";
  57.   document.myform.submit();
  58. }
  59. function modifyTask()
  60. {
  61.   if( document.myform.own.value=="false" )
  62.   {
  63.     alert("不能修改别人的任务。");
  64.     return false;
  65.   }
  66.  if( !isCheckedOne(document.myform.calendarIds) )
  67.   {
  68.     alert("请选择一个要修改的任务。");
  69.     return false;
  70.   }
  71.  document.myform.action = "/mainctrl/calendar/modifyCalendar?type=0";
  72.   document.myform.submit();
  73. }
  74. function createTask()
  75. {
  76.   document.myform.action = "/mainctrl/calendar/createCalendar";
  77.   document.myform.submit();
  78. }
  79. function CheckAll(form)
  80. {
  81.   for (var i=0;i<form.elements.length;i++)
  82.   {
  83.     var e = form.elements[i];
  84.     if (e.name != 'chkall')
  85.        e.checked = form.chkall.checked;
  86.   }
  87. }
  88. </script>
  89. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_person.js"></script>
  90. <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
  91. <DIV align=center>
  92. <form name="myform" method="post" action="">
  93. <%
  94.   Collection coll = null;
  95.   String condition = "";
  96.   
  97.   int empId = 0;
  98.   
  99.   String ssd = "";
  100.   String sed = "";
  101.   
  102.   Timestamp sStartDate = null;
  103.   Timestamp sEndDate = null;
  104.   
  105. if( request.getParameter("search")!=null && request.getParameter("search").equals("ok") )
  106. {
  107.   if(request.getParameter("back")!=null && request.getParameter("back").equals("ok"))
  108.   {
  109.     empId = Integer.parseInt( request.getParameter("ssempId") );
  110.     if(request.getParameter("ssStartDate")!=null && !request.getParameter("ssStartDate").equals(""))
  111.     {
  112.       ssd = request.getParameter("ssStartDate");
  113.       sStartDate = TimeStamp.toTimestamp(ssd+" 00:00:00");
  114.     }
  115.     if(request.getParameter("ssEndDate")!=null && !request.getParameter("ssEndDate").equals(""))
  116.     {
  117.       sed = request.getParameter("ssEndDate");
  118.       sEndDate = TimeStamp.toTimestamp(sed+" 23:59:59");
  119.     }
  120.   }
  121.   if( request.getParameter("empId")!=null && !request.getParameter("empId").equals("") && !request.getParameter("empId").equals("0"))
  122.   {
  123.     empId = Integer.parseInt( request.getParameter("empId") );
  124.   }
  125.   if(request.getParameter("sStartDate")!=null && !request.getParameter("sStartDate").equals(""))
  126.   {
  127.     ssd = request.getParameter("sStartDate");
  128.     sStartDate = TimeStamp.toTimestamp(ssd+" 00:00:00");
  129.   }
  130.   if(request.getParameter("sEndDate")!=null && !request.getParameter("sEndDate").equals(""))
  131.   {
  132.     sed = request.getParameter("sEndDate");
  133.     sEndDate = TimeStamp.toTimestamp(sed+" 23:59:59");
  134.   }
  135.   //是不是自己的任务
  136.   if(empId!=BusinessName.getEmpId() && empId!=0)
  137.   {
  138.     condition = condition+ " and task_visible=1 ";
  139.     out.println("<input type=hidden name=own value=false>");
  140.   }
  141.   else
  142.   {
  143.     out.println("<input type=hidden name=own value=true>");
  144.   }
  145.   if(empId!=0)
  146.   {
  147.     if(ssd!=null && !ssd.equals(""))
  148.     {
  149.       coll = calendarProxy.getCalendarList(empId, condition, sStartDate, sEndDate);
  150.     }
  151.     else
  152.     {
  153.       coll = calendarProxy.getCalendarList(empId, condition);
  154.     }
  155.   }
  156.   else
  157.   {
  158.     if(ssd!=null && !ssd.equals(""))
  159.     {
  160.       coll = calendarProxy.getCalendarList(BusinessName.getEmpId(), condition, sStartDate, sEndDate);
  161.     }
  162.     else
  163.     {
  164.       coll = calendarProxy.getCalendarList(BusinessName.getEmpId(), condition);
  165.     }
  166.   }
  167. }
  168. else
  169. {
  170.   out.println("<input type=hidden name=own value=true>");
  171.   coll = calendarProxy.getCalendarList(BusinessName.getEmpId());
  172. }
  173. %>
  174.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  175.     <TBODY> 
  176.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  177.     <TR> 
  178.         <TD colSpan=3 align="center" class="iframestyle" valign="top"> <!--菜单开始 --> 
  179.           <br>
  180.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  181.             <tr valign="top"> 
  182.               <td bgcolor="#fafafa"> 
  183.                 <table width="600" border="0" cellspacing="0" cellpadding="0">
  184.                   <tr bgcolor="#666666"> 
  185.                     <td><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;<a href="/mainctrl/personal/main"><font color="#FFFFFF">个人办公</font></a>&gt;&gt;日程安排</font>
  186.                     </td>
  187.                   </tr>
  188.                   <tr bgcolor="#fafafa"> 
  189.                     <td height="30">
  190.                       <font class="strong">&nbsp;选择部门:</font>
  191. <%
  192.         String deptId = "0";
  193.         if(request.getParameter("deptId") != null)
  194.         {
  195.               deptId = request.getParameter("deptId");
  196.         }
  197.         int deptId2 = Integer.parseInt(deptId);
  198. %>
  199.                     <org:DivisionList>
  200.                       <select name="deptId" onChange="changeIt()">
  201.                         <option value="0" selected>全部部门</option>
  202.                          <vnex:items select='<%= deptId %>'>
  203.                         <option value="<org:DivisionAttribute attribute="id"/>" <org:DivisionAttribute attribute="isSelected"/>>
  204.                          <org:DivisionAttribute attribute="levelStr"/>+<org:DivisionAttribute attribute="name"/>
  205.                         </option>
  206.                          </vnex:items>
  207.                       </select>
  208.                     </org:DivisionList>
  209.                       <font class="strong">选择员工:</font>
  210.                      <select name="empId" size="1">
  211.                        <option value="0">-请选择-</option>
  212.                        <hr:EmployeeList divisionId='<%= deptId2%>'>
  213.                         <vnex:items> 
  214.                         <option value="<hr:EmployeeAttribute attribute="id" />" 
  215.                         <hr:EmployeeAttribute attribute="isSelected"/> > <hr:EmployeeAttribute attribute='<%= null %>' /> 
  216.                         </option>
  217.                         </vnex:items>
  218.                        </hr:EmployeeList>
  219.                        
  220.                      </select>
  221.                      &nbsp;<input type="button" name="search" value="查询" onClick="return searchTask()" class="text">
  222.                      &nbsp;&nbsp;<input type="button" name="search" value="高级查询" onClick="location='/mainctrl/calendar/searchCalendar'" class="text" style="width:60px">
  223.                      </td>
  224.                    </tr>
  225.                  </table>     
  226.                  <table class=title width="600" border="0" cellspacing="1" cellpadding="0">
  227.                     <tr>
  228.                       <td bgcolor="#fafafa" height="30" colspan="6">
  229.                         &nbsp; <input type="button" name="Submit22" value="新建"  onClick="createTask()" class="text">
  230.                         &nbsp;&nbsp;<input type="button" name="Button" value="删除" onClick="return removeTasks()" class="text">  
  231.                       </td>
  232.                     </tr>
  233.                   <tr> 
  234.                     <td>
  235.                       <table cellpadding="0" width="100%" cellspacing="0" align="center">
  236.                         <tbody>
  237.                         <tr bgcolor="#cccccc"> 
  238.                           <td colspan="6"> 
  239.                             <table width="600" border="0" cellpadding="2" cellspacing="1" class="title">
  240.                               <tr align="center"> 
  241.                                 <td width="7%"><font class="strong">选择</font></td>
  242.                                 <td width="25%"><font class="strong">任务</font></td>
  243.                                 <td width="20%"><font class="strong">开始日期</font></td>
  244.                                 <td width="20%"><font class="strong">截止日期</font></td>
  245.                                 <td width="10%"><font class="strong">重要度</font></td>
  246.                                 <td width="15%"><font class="strong">创建人</font></td>
  247.                               </tr>
  248. <%
  249.   CalendarValueBean cvb = null;
  250.   
  251.   int start = 1;
  252.   if ( request.getParameter("start") !=null )
  253.   {
  254.     start = Integer.parseInt( request.getParameter("start") );
  255.   }
  256.   int rowPerPage = com.vnex.intranet.system.loader.ConfigParaLoader.getParameterByInt("rowNum");
  257.   int size = coll.size();
  258.   String action = null;
  259.   if( empId!=0 )
  260.   {
  261.     action = "/mainctrl/calendar/getCalendarList?search=ok&empId="+empId;
  262.   }
  263.   else
  264.   {
  265.     action = "/mainctrl/calendar/getCalendarList?";
  266.   }
  267.   
  268.   if(ssd!=null && !ssd.equals(""))
  269.   {
  270.     action += "&sStartDate=" + ssd;
  271.   }
  272.   
  273.   if(sed!=null && !sed.equals(""))
  274.   {
  275.     action += "&sEndDate=" + sed + "&search=ok";
  276.   }
  277.   String nav = NavBar.makeNavbar(start, size, rowPerPage, action);
  278.   int i = 0;
  279.      if(coll != null && coll.size() != 0)
  280.      {
  281.        Iterator it = coll.iterator();
  282.        int flag = 0;
  283.        String bgcolor = null;
  284.        while( it.hasNext() && i < size && i < ( start+rowPerPage-1) )
  285.        {
  286.            i++;
  287.            cvb = (CalendarValueBean)it.next();
  288.            if ( i < start ) continue;
  289.            if( flag%2==0 )
  290.            {
  291.              bgcolor = "#e0e0e0";
  292.            }
  293.            else
  294.            {
  295.              bgcolor = "#fafafa";
  296.            }
  297.            
  298.            Timestamp startDate = cvb.getStartDate();
  299.            Timestamp endDate = cvb.getEndDate();
  300.            Calendar cd = TimeStamp.convertTimestampToCalendar(startDate);
  301.            int sYear = cd.get(Calendar.YEAR);
  302.            int sMonth = cd.get(Calendar.MONTH) + 1;
  303.            int sDay = cd.get(Calendar.DAY_OF_MONTH);
  304.            int sHour = cd.get(Calendar.HOUR_OF_DAY);
  305.            int sMinute = cd.get(Calendar.MINUTE);
  306.            cd = TimeStamp.convertTimestampToCalendar(endDate);
  307.            int eYear = cd.get(Calendar.YEAR);
  308.            int eMonth = cd.get(Calendar.MONTH) + 1;
  309.            int eDay = cd.get(Calendar.DAY_OF_MONTH);
  310.            int eHour = cd.get(Calendar.HOUR_OF_DAY);
  311.            int eMinute = cd.get(Calendar.MINUTE);
  312. %>
  313.                               <tr>
  314.                                 <td bgcolor="<%= bgcolor%>" width="7%" align="center"> 
  315.                                   <input type="checkbox" name="calendarIds" value="<%= cvb.getTaskId()%>">
  316.                                 </td>
  317.                                 <td bgcolor="<%= bgcolor%>" width="25%" align="center"><a href="JavaScript:linkTask(<%= cvb.getTaskId()%>)">
  318.                                 <%
  319.                                   String fontColor = "#000000";
  320.                                   if(cvb.getTaskImport().equals("0"))
  321.                                     fontColor = "#000000";
  322.                                   else if(cvb.getTaskImport().equals("1"))
  323.                                     fontColor = "#000080";
  324.                                   else if(cvb.getTaskImport().equals("2"))
  325.                                     fontColor = "#336600";
  326.                                   else if(cvb.getTaskImport().equals("3"))
  327.                                     fontColor = "#800000";
  328.                                 %>
  329.                                   <font color="<%= fontColor%>"><%= FieldUtil.filterScriptTag(cvb.getTaskName())%></font>
  330.                                 </a></td>
  331.                                 <td bgcolor="<%= bgcolor%>" width="20%" align="center"><%= sYear%>-<%= sMonth%>-<%= sDay%> <%= sHour%>:<% if(sMinute==0) out.print(sMinute+"0"); else out.print(sMinute);%></td>    
  332.                                 <td bgcolor="<%= bgcolor%>" width="20%" align="center"><%= eYear%>-<%= eMonth%>-<%= eDay%> <%= eHour%>:<% if(eMinute==0) out.print(eMinute+"0"); else out.print(eMinute);%></td>
  333.                                 <td bgcolor="<%= bgcolor%>" width="10%" align="center">
  334.                                 <% 
  335.                                   if(cvb.getTaskImport().equals("0"))
  336.                                     out.print("不指定");
  337.                                   else if(cvb.getTaskImport().equals("1"))
  338.                                     out.print("低");
  339.                                   else if(cvb.getTaskImport().equals("2"))
  340.                                     out.print("中");
  341.                                   else if(cvb.getTaskImport().equals("3"))
  342.                                     out.print("高");
  343.                                 %>
  344.                                 </td>
  345.                                 <td bgcolor="<%= bgcolor%>" width="15%" align="center"><%= cvb.getCreatorName()%></td>
  346.                               </tr>
  347. <%
  348.            flag++;
  349.          }
  350.        }
  351.   out.println("<input type=hidden name=ssempId value=""+empId+"">");
  352.   out.println("<input type=hidden name=ssStartDate value=""+ssd+"">");
  353.   out.println("<input type=hidden name=ssEndDate value=""+sed+"">");
  354.   out.println("<input type=hidden name=start value=""+start+"">");
  355. %>
  356. <%
  357.   if(size!=0)
  358.   {
  359. %>
  360.                               <tr> 
  361.                                 <td bgcolor="#fafafa" width="7%" align="center"> 
  362.                                   <input type="checkbox" name="chkall" value="on" onclick="CheckAll(this.form)">
  363.                                 </td>
  364.                                 <td bgcolor="#fafafa" colspan="5">&nbsp;&nbsp;全选</td>
  365.                               </tr>
  366. <%
  367.   }
  368. %>
  369.                               <tr bgcolor="#e0e0e0">
  370.                                 <td colspan="6">
  371.                                   &nbsp;&nbsp;<%= nav %>
  372.                                 </td>
  373.                               </tr>
  374.                             </table>
  375.                             </td>    
  376.                         </tr>
  377.                         </tbody> 
  378.                       </table>
  379.                     </td>
  380.                   </tr>
  381.                 </table>
  382.               </td>
  383.             </tr>
  384.           </table>
  385.           <!--个人信息结束 --> 
  386.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  387.        </TD>
  388.     </TR>
  389.     <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  390.     </TBODY> 
  391.   </TABLE>
  392.   <BR>
  393.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  394. </form></DIV>
  395. </BODY></HTML>