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

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="com.vnex.intranet.commoninfo.addresslist.value.*"%>
  3. <%@ page import="com.vnex.intranet.commoninfo.addresslist.proxy.*"%>
  4. <%@ page import="com.vnex.intranet.util.*"%>
  5. <%@ page import="java.util.*" %>
  6. <%@ page import="java.sql.*" %>
  7. <jsp:useBean id="addressListProxy" class="com.vnex.intranet.commoninfo.addresslist.proxy.AddressListProxyBean" scope="application" />
  8. <%
  9.   int companyId = 0;
  10.   if(request.getParameter("companyId")!=null && !request.getParameter("companyId").equals(""))
  11.     companyId = Integer.parseInt(request.getParameter("companyId"));
  12.   
  13.   String con = "";
  14.   String sDepartment = "";
  15.   String sEmployeName = "";
  16.   
  17.     CommonDBOperation cdb = new CommonDBOperation();
  18.     String DBProductName = cdb.getDBProduct();
  19.     if(DBProductName.startsWith("Oracle")) 
  20.     {
  21.       if(request.getParameter("back")!=null && request.getParameter("back").equals("ok"))
  22.       {
  23.         if(request.getParameter("ssDepartment")!=null && !request.getParameter("ssDepartment").equals(""))
  24.         {
  25.           sDepartment = request.getParameter("ssDepartment");
  26.           con = " and employe_department='"+sDepartment+"'";
  27.         }
  28.         if(request.getParameter("ssEmployeName")!=null && !request.getParameter("ssEmployeName").equals(""))
  29.         {
  30.           sEmployeName = request.getParameter("ssEmployeName");
  31.           con = con + " and employe_name like '%"+sEmployeName+"%'";
  32.         }
  33.       }
  34.       
  35.       if(request.getParameter("sDepartment")!=null && !request.getParameter("sDepartment").equals(""))
  36.       {
  37.         sDepartment = request.getParameter("sDepartment");
  38.         con = " and employe_department='"+sDepartment+"'";
  39.       }
  40.       if(request.getParameter("sEmployeName")!=null && !request.getParameter("sEmployeName").equals(""))
  41.       {
  42.         sEmployeName = request.getParameter("sEmployeName");
  43.         con = con + " and employe_name like '%"+sEmployeName+"%'";
  44.       }
  45.     }
  46.     else if(DBProductName.startsWith("Microsoft SQL Server"))
  47.     {
  48.       if(request.getParameter("back")!=null && request.getParameter("back").equals("ok"))
  49.       {
  50.         if(request.getParameter("ssDepartment")!=null && !request.getParameter("ssDepartment").equals(""))
  51.         {
  52.           sDepartment = request.getParameter("ssDepartment");
  53.           con = " and employe_department='"+cdb.changeCode(sDepartment)+"'";
  54.         }
  55.         if(request.getParameter("ssEmployeName")!=null && !request.getParameter("ssEmployeName").equals(""))
  56.         {
  57.           sEmployeName = request.getParameter("ssEmployeName");
  58.           con = con + " and employe_name like '%"+cdb.changeCode(sEmployeName)+"%'";
  59.         }
  60.       }
  61.       
  62.       if(request.getParameter("sDepartment")!=null && !request.getParameter("sDepartment").equals(""))
  63.       {
  64.         sDepartment = request.getParameter("sDepartment");
  65.         con = " and employe_department='"+cdb.changeCode(sDepartment)+"'";
  66.       }
  67.       if(request.getParameter("sEmployeName")!=null && !request.getParameter("sEmployeName").equals(""))
  68.       {
  69.         sEmployeName = request.getParameter("sEmployeName");
  70.         con = con + " and employe_name like '%"+cdb.changeCode(sEmployeName)+"%'";
  71.       }
  72.     }
  73.   
  74.   AddressListValueBean companyBeanD = new AddressListValueBean();
  75.   AddressListValueBean companyBean = new AddressListValueBean();
  76.   companyBeanD = addressListProxy.getAddressListDetail(companyId);
  77.   companyBean = addressListProxy.getAddressListDetail(companyId, con);
  78.   session.setAttribute("companyBean", companyBean);
  79.   if(request.getParameter("sstart")!=null)
  80.   {
  81.     session.setAttribute("start", request.getParameter("sstart"));
  82.   }
  83. %>
  84. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  85. <HTML>
  86. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  87. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  88. <script language="javascript" src="/vnex/validate.js" ></script>
  89. <script language=JavaScript>
  90. function isValidChar(str)
  91. {
  92.   var i,j,strTemp;
  93.   strTemp=""'<>/\";
  94.   for (i=0;i<str.length;i++)
  95.   {
  96.     j=strTemp.indexOf(str.charAt(i));
  97.     if (j!=-1)
  98.     {
  99.       return false;
  100.     }
  101.   }
  102.   return true;
  103. }
  104. function linkEmploye(employeId)
  105. {
  106.   document.myform.action = "/mainctrl/commoninfo/addresslist/modifyAddressEmploye?employeIds="+employeId;
  107.   document.myform.submit();
  108. }
  109. function removeCompanys()
  110. {
  111.  myform.action= "/mainctrl/commoninfo/addresslist/removeAddressListSuccess";
  112.   myform.submit();
  113. }
  114. function modifyCompany()
  115. {
  116.  myform.action= "/mainctrl/commoninfo/addresslist/modifyAddressList";
  117.   myform.submit();
  118. }
  119. function removeEmployes()
  120. {
  121.   if(document.myform.employeIds==null)
  122.   {
  123.     alert("没有要删除的职工。");
  124.     return false;
  125.   }
  126.   if( !isChecked(document.myform.employeIds) )
  127.   {
  128.     alert("请选择要删除的职工。");
  129.     return false;
  130.   }
  131.   if(!confirm("是否确定删除?"))
  132.   {
  133.     return false;
  134.   }
  135.  myform.action= "/mainctrl/commoninfo/addresslist/removeAddressEmployeSuccess";
  136.   myform.submit();
  137. }
  138. function searchEmploye()
  139. {
  140.   if(!isValidChar(myform.sEmployeName.value))
  141.   {
  142.     alert("查询职员姓名不能包括 " ' < > / \ 这些特殊字符。");
  143.     myform.sEmployeName.focus();
  144.     return false;
  145.   }
  146.  myform.action= "/mainctrl/commoninfo/addresslist/detailAddressList?start=1";
  147.   myform.submit();
  148. }
  149. function CheckAll(form)
  150. {
  151.   for (var i=0;i<form.elements.length;i++)
  152.   {
  153.     var e = form.elements[i];
  154.     if (e.name != 'chkall')
  155.        e.checked = form.chkall.checked;
  156.   }
  157. }
  158. </script>
  159. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_office.js"></script>
  160. <script language="JavaScript1.2" src="/vnex/menu/dockmenu.js"></script>
  161. <DIV align=center>
  162.   <form name="myform" method="post" action="">
  163.     <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  164.     <TBODY> 
  165.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  166.     <TR> 
  167.         <TD colSpan=3 align="center"> 
  168.           <!--个人信息开始 --><br>
  169.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  170.             <tr> 
  171.               <td> 
  172.                 <table width="600" border="0" cellspacing="0" cellpadding="2">
  173.                   <tr bgcolor="#666666">
  174.                     <td colspan="4" height="15"><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;<a href="/mainctrl/office/main"><font color="#FFFFFF">办公室管理</font></a>&gt;&gt;<a href="/mainctrl/commoninfo/addresslist/getAddressList"><font color="#FFFFFF">外部通讯录</font></a>&gt;&gt;显示通讯录详细信息</font></td>
  175.                   </tr>
  176.                 </table>
  177.                 <table border="0" cellpadding="0" cellspacing="0" width="600" class=title>
  178.                   <tr bgcolor="#e0e0e0" align="center"> 
  179.                     <td> 
  180.                       <table border="0" cellpadding="0" cellspacing="1" width="100%" class=title>
  181.                         <tr bgcolor="#e0e0e0"> 
  182.                           <td width="17%"><font class="strong">&nbsp;&nbsp;公司名称:</font></td>
  183.                           <td width="83%" colspan="5"><%= companyBean.getCompanyName()%></td>
  184.                         </tr>
  185.                         <tr bgcolor="#fafafa">
  186.                           <td width="17%"><font class="strong">&nbsp;&nbsp;地址:</font></td>
  187.                           <td width="83%" colspan="5"><%= companyBean.getCompanyAddress()%></td>
  188.                         </tr>
  189.                         <tr bgcolor="#e0e0e0">
  190.                           <td width="17%"><font class="strong">&nbsp;&nbsp;邮编:</font></td>
  191.                           <td width="16%"><% if(companyBean.getCompanyZip()!=0) out.println(companyBean.getCompanyZip()); %></td>
  192.                           <td width="17%"><font class="strong">&nbsp;&nbsp;电话:</font></td>
  193.                           <td width="16%"><%= companyBean.getCompanyTelephone()%></td>
  194.                           <td width="17%"><font class="strong">&nbsp;&nbsp;传真:</font></td>
  195.                           <td width="16%"><%= companyBean.getCompanyFax()%></td>
  196.                         </tr>
  197.                       </table>
  198.                     </td>
  199.                   </tr>
  200.                 </table>
  201.                 <table width="100%" border="0" cellspacing="1" cellpadding="2" class=title>
  202.                   <tr bgcolor="#fafafa"> 
  203.                     <td height="30" colspan="9"> 
  204.                       &nbsp;<font class="strong">选择部门:</font>
  205.                       <select name="sDepartment" style="width=100">
  206.                         <option value="">全部</option>
  207. <%
  208.   Collection col = companyBeanD.getEmployes();
  209.   AddressEmployeValueBean evb = null;
  210.   Vector vec = new Vector();
  211.   if(col != null && col.size() != 0)
  212.   {
  213.   Iterator it = col.iterator();
  214.   while( it.hasNext() )
  215.   {
  216.       evb = (AddressEmployeValueBean)it.next();
  217.       if( !vec.contains(evb.getEmployeDepartment()) )
  218.       {
  219.         vec.add(evb.getEmployeDepartment());
  220.       }
  221.     }
  222.   }
  223.   for(int i=0; i<vec.size(); i++)
  224.   {
  225.     if( vec.get(i)!=null )
  226.     {
  227.       if(sDepartment.equals( (String)vec.get(i) ))
  228.       {
  229.         out.println("<option value=""+FieldUtil.filterQuotTag((String)vec.get(i))+"" selected>" + (String)vec.get(i) + "</option>");
  230.       }
  231.       else
  232.       {
  233.         out.println("<option value=""+FieldUtil.filterQuotTag((String)vec.get(i))+"">" + (String)vec.get(i) + "</option>");
  234.       }
  235.     }
  236.   }
  237. %>
  238.                       </select>
  239.                         &nbsp;<font class="strong" >职员姓名:</font>
  240.                       <input type="text" name="sEmployeName" class="file" value="<%= sEmployeName%>">
  241.                       &nbsp;<input type="button" name="Button" value="查询" class="text" onClick="return searchEmploye()">
  242.                     </td>
  243.                   </tr>
  244.                   <tr bgcolor="#fafafa"> 
  245.                     <td colspan="9" height="30">
  246.                       &nbsp;<input type="button" name="Button2" value="新增员工" class="text" onClick="location='/mainctrl/commoninfo/addresslist/createAddressEmploye?companyId=<%= companyId%>'" style="width:60px">
  247.                       &nbsp;&nbsp;<input type="button" name="Button3" value="删除员工" class="text" onClick="return removeEmployes()" style="width:60px">
  248.                       &nbsp;&nbsp;<input type="button" name="Button522" value="返回" class="file" onClick="location='/mainctrl/commoninfo/addresslist/getAddressList?start=<%= (String)session.getAttribute("start")%>'">
  249.                     </td>
  250.                   </tr>
  251.                   <tr align="center"> 
  252.                     <td width="7%"><font class="strong">选择</font></td>
  253.                     <td width="10%"><font class="strong">姓名</font></td>
  254.                     <td width="9%"><font class="strong">部门</font></td>
  255.                     <td width="9%"><font class="strong">职务</font></td>
  256.                     <td width="9%"><font class="strong">分机</font></td>
  257.                     <td width="9%"><font class="strong">呼机</font></td>
  258.                     <td width="9%"><font class="strong">手机</font></td>
  259.                     <td width="12%"><font class="strong">办公室</font></td>
  260.                     <td width="26%"><font class="strong">Email</font></td>
  261.                   </tr>
  262. <%
  263.   Collection coll = companyBean.getEmployes();
  264.   AddressEmployeValueBean aevb = null;
  265.   
  266.   int start = 1;
  267.   if ( request.getParameter("start") !=null )
  268.   {
  269.     start = Integer.parseInt( request.getParameter("start") );
  270.   }
  271.   int rowPerPage = com.vnex.intranet.system.loader.ConfigParaLoader.getParameterByInt("rowNum");
  272.   int size = coll.size();
  273.   String action = "/mainctrl/commoninfo/addresslist/detailAddressList?companyId=" + companyId;
  274.   if(!sDepartment.equals(""))
  275.   {
  276.     action += "&sDepartment=" + sDepartment;
  277.   }
  278.   if(!sEmployeName.equals(""))
  279.   {
  280.     action += "&sEmployeName=" + sEmployeName;
  281.   }
  282.   String nav = NavBar.makeNavbar(start, size, rowPerPage, action);
  283.   int i = 0;
  284.      if(coll != null && coll.size() != 0)
  285.      {
  286.        Iterator it = coll.iterator();
  287.        int flag = 0;
  288.        String bgcolor = null;
  289.        while( it.hasNext() && i < size && i < ( start+rowPerPage-1) )
  290.        {
  291.            i++;
  292.            aevb = (AddressEmployeValueBean)it.next();
  293.            if ( i < start ) continue;
  294.            if( flag%2==0 )
  295.            {
  296.              bgcolor = "#e0e0e0";
  297.            }
  298.            else
  299.            {
  300.              bgcolor = "#fafafa";
  301.            }
  302. %>
  303.             <tr bgcolor="<%= bgcolor%>" align="center"> 
  304.               <td> 
  305.                 <input type="checkbox" name="employeIds" value="<%= aevb.getEmployeId()%>">
  306.               </td>
  307.               <td><a href="JavaScript:linkEmploye(<%= aevb.getEmployeId()%>)"><%= aevb.getEmployeName()%></a></td>
  308.               <td><%= aevb.getEmployeDepartment()%></td>
  309.               <td><%= aevb.getEmployeDuty()%></td>
  310.               <td><% if(aevb.getEmployeExtension()!=0) out.println(aevb.getEmployeExtension()); %></td>
  311.               <td><%= aevb.getEmployePager()%></td>
  312.               <td><%= aevb.getEmployeHandset()%></td>
  313.               <td><%= aevb.getEmployeOffice()%></td>
  314.               <td><a href="mailto:<%= aevb.getEmployeEmail()%>"><%= aevb.getEmployeEmail()%></a></td>
  315.             </tr>
  316. <%
  317.            flag++;
  318.          }
  319.        }
  320. %>            
  321. <%
  322.   if(size!=0)
  323.   {
  324. %>
  325.             <tr bgcolor="#fafafa"> 
  326.               <td align="center">
  327.                 <input type="checkbox" name="chkall" value="on" onclick="CheckAll(this.form)">
  328.               </td>
  329.               <td colspan="8"> 
  330.                  &nbsp;&nbsp;全选
  331.               </td>
  332.             </tr>
  333. <%
  334.   }
  335. %>
  336.             <tr bgcolor="#e0e0e0"> 
  337.               <td colspan="9">
  338.                 &nbsp;&nbsp;<%= nav %>
  339.               </td>
  340.             <input type="hidden" name="companyId" value="<%= companyId%>">
  341.             <input type="hidden" name="companyIds" value="<%= companyId%>">
  342. <%
  343.   out.println("<input type=hidden name=ssDepartment value=""+sDepartment+"">");
  344.   out.println("<input type=hidden name=ssEmployeName value=""+sEmployeName+"">");
  345.   out.println("<input type=hidden name=start value=""+start+"">");
  346. %>
  347.             </tr>
  348.                 </table>
  349.               </td>
  350.             </tr>
  351.           </table>
  352.           <br>
  353.           <br>
  354.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  355.        </TD>
  356.     </TR>
  357.     <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  358.     </TBODY> 
  359.   </TABLE>
  360.   <BR>
  361.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  362. </form></DIV>
  363. </BODY></HTML>