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

电子政务应用

开发平台:

Java

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  4. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  5. <script language="javascript" src="/vnex/validate.js" ></script>
  6. <script language="JavaScript">
  7. function isValidChar(str)
  8. {
  9.   var i,j,strTemp;
  10.   strTemp="<>";
  11.   for (i=0;i<str.length;i++)
  12.   {
  13.     j=strTemp.indexOf(str.charAt(i));
  14.     if (j!=-1)
  15.     {
  16.       return false;
  17.     }
  18.   }
  19.   return true;
  20. }
  21. function selectt(selectedIndex)
  22. {
  23.   str = document.myform.group.options[selectedIndex].text;
  24.   document.myform.groupName.value = str;
  25. }
  26. function delGroups(selectedIndex)
  27. {
  28.   if(document.myform.group.selectedIndex<=-1)
  29.   {
  30.     alert("请选择要删除的组。");
  31.     return false;
  32.   }
  33.   if(!confirm("是否确定删除?"))
  34.   {
  35.     return false;
  36.   }
  37.  document.myform.action = "/mainctrl/addressbook/groupList?removeGroup=ok";
  38.   document.myform.submit();
  39. }
  40. function addGroup()
  41. {
  42.   if (!stripWhitespace(document.myform.groupName.value) || document.myform.groupName.value=="")
  43. {
  44.   alert("组名不能为空。");
  45.   document.myform.groupName.focus();
  46.   return false;
  47. }
  48. if(!isValidChar(myform.groupName.value))
  49.   {
  50.     alert("输入内容不能包括 < > 这些特殊字符。");
  51.     return false;
  52.   }
  53.  document.myform.action = "/mainctrl/addressbook/groupList?createGroup=ok";
  54.   document.myform.submit();
  55. }
  56. function updataGroup()
  57. {
  58.   if(document.myform.group.selectedIndex<=-1)
  59.   {
  60.     alert("请选择要修改的组。");
  61.     return false;
  62.   }
  63.   if (!stripWhitespace(document.myform.groupName.value) || document.myform.groupName.value=="")
  64. {
  65.   alert("组名不能为空。");
  66.   document.myform.groupName.focus();
  67.   return false;
  68. }
  69. if(!isValidChar(myform.groupName.value))
  70.   {
  71.     alert("输入内容不能包括 < > 这些特殊字符。");
  72.     return false;
  73.   }
  74.   document.myform.action = "/mainctrl/addressbook/groupList?modifyGroup=ok";
  75.   document.myform.submit();
  76. }
  77. </script>
  78. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_person.js"></script>
  79. <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
  80. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  81. <%@ page import="com.vnex.intranet.addresslist.value.*"%>
  82. <%@ page import="com.vnex.intranet.addresslist.proxy.*"%>
  83. <%@ page import="com.vnex.intranet.util.*"%>
  84. <%@ page import="java.util.*" %>
  85. <%@ page import="java.sql.*" %>
  86. <%@ taglib uri="/vnex.tld" prefix="vnex"%>
  87. <%@ taglib uri="/vnex_addresslist.tld" prefix="addresslist"%>
  88. <jsp:useBean id="groupProxy" class="com.vnex.intranet.addresslist.proxy.AddressGroupProxyBean" scope="application" />
  89. <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
  90. <DIV align=center>
  91. <form name="myform" method="post" action="">
  92. <%
  93.   ContactGroupValueBean cgvb = new ContactGroupValueBean();
  94.   Collection coll = null;
  95.   String condition = "";
  96.   
  97.   int empId = BusinessName.getEmpId();
  98.   condition = "emp_id="+empId+" order by emp_id DESC";
  99.   String pageTo = "/mainctrl/addressbook/groupList?";
  100.   if( request.getParameter("createGroup")!=null && request.getParameter("createGroup").equals("ok") )
  101.   {
  102.     if( request.getParameter("groupName")!=null && !request.getParameter("groupName").equals("") )
  103.     {
  104.        int flag = 0;
  105.        coll = groupProxy.getGroupList(condition);
  106.        if(coll != null && coll.size() != 0)
  107.      {
  108.        Iterator it = coll.iterator();
  109.        while( it.hasNext() )
  110.        {
  111.          cgvb = (ContactGroupValueBean)it.next();
  112.          if( cgvb.getGroupName().equals(request.getParameter("groupName").trim()) )
  113.          {
  114.            flag = 1;
  115.          }
  116.        }
  117.        }
  118.        if(flag==0)
  119.        {
  120.          cgvb.setGroupName(request.getParameter("groupName")); 
  121.          cgvb.setEmpId(empId);
  122.          groupProxy.createGroup(cgvb);
  123.        }
  124.     }
  125.   }
  126.   
  127.   if( request.getParameter("removeGroup")!=null && request.getParameter("removeGroup").equals("ok") )
  128.   {
  129.     String[] str = null;
  130.     int[] groupIds = null;
  131.     if( request.getParameter("group")!=null && !request.getParameter("group").equals("") )
  132.     {
  133.       str = request.getParameterValues("group");
  134.       groupIds = new int[str.length];
  135.       for(int i=0; i<str.length; i++)
  136.       {
  137.         groupIds[i] = Integer.parseInt( str[i] );
  138.       }
  139.       groupProxy.removeGroup(groupIds);
  140.     }
  141.   }
  142.   
  143.   if( request.getParameter("modifyGroup")!=null && request.getParameter("modifyGroup").equals("ok") )
  144.   {
  145.     if( request.getParameter("groupName")!=null && !request.getParameter("groupName").equals("") )
  146.     {
  147.        int flag = 0;
  148.        coll = groupProxy.getGroupList(condition);
  149.        if(coll != null && coll.size() != 0)
  150.      {
  151.        Iterator it = coll.iterator();
  152.        while( it.hasNext() )
  153.        {
  154.          cgvb = (ContactGroupValueBean)it.next();
  155.          if( cgvb.getGroupName().equals(request.getParameter("groupName").trim()) )
  156.          {
  157.            flag = 1;
  158.          }
  159.        }
  160.        }
  161.        if(flag==0)
  162.        {
  163.          cgvb.setGroupId( Integer.parseInt(request.getParameter("group")) );
  164.          cgvb.setGroupName(request.getParameter("groupName")); 
  165.          groupProxy.modifyGroup(cgvb);
  166.        }
  167.     }
  168.   }
  169.  
  170. %>
  171.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  172.      <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  173.     <TR> 
  174.         <TD colSpan=3 align="center"><br>
  175.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  176.             <tr> 
  177.               <td align="center" colspan="2" bgcolor="#FFFFFF"> 
  178.                 <table width="600" border="0" cellspacing="0" cellpadding="0">
  179.                   <tr bgcolor="#666666"> 
  180.                       <td colspan="2"><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;<a href="/mainctrl/addressbook/home"><font color="#ffffff">个人通讯录</font></a>&gt;&gt;组管理</font>
  181.                       </td>
  182.                   </tr>
  183.                 </table>
  184.                 <table class=title border="0" cellpadding="2" cellspacing="1" width="600">
  185.                   <tr bgcolor="#fafafa">
  186.                     <td colspan="2"> 
  187.                      <font class="strong">&nbsp;添加新组(不可以重名)</font>&nbsp;
  188.                      <input type="text" name="groupName" size="20" maxlength="20" class="text">&nbsp;&nbsp;
  189.                      <input type="button" name="createGroupp" value="添加保存" class="text" onClick="addGroup()" style="width:60px">&nbsp;&nbsp;
  190.                      <input type="button" name="modifyGroupp" value="修改保存" class="text" onClick="updataGroup()" style="width:60px">
  191.                     </td>
  192.                  </tr>
  193.                 </table>
  194.                 <table class=title border="0" cellpadding="2" cellspacing="1" width="600">
  195.                   <tr bgcolor="#e0e0e0">
  196.                     <td width="13%">&nbsp;<strong>组名:</strong></td>
  197.                     <td width="87%">
  198.                     <select size="5" name="group" onChange="selectt(group.selectedIndex)" class="text" style="width:300">
  199.                     <addresslist:groupList queryStr="<%=condition%>">
  200.                     <vnex:items paging="true">
  201.                         <option value="<addresslist:groupAttribute attribute="group_id" />">
  202.                           <addresslist:groupAttribute attribute="group_name"/>
  203.                         </option>
  204.                     </vnex:items>
  205.                     </addresslist:groupList>
  206.                     </select>
  207.                     &nbsp;<input type="button" name="Button2" value="删除" onClick="delGroups(group.selectedIndex)" class="text">
  208.                     </td>
  209.                   </tr>
  210.                   <tr bgcolor="#fafafa" height="30">
  211.                     <td colspan="2" align="center">
  212.                       <input type="button" name="Button3" value="返回" onClick="location='/mainctrl/addressbook/home'" class="text">
  213.                     </td>
  214.                   </tr>
  215.                 </table>
  216.                </td>
  217.               </tr>
  218.              </table>
  219.              <br>
  220.              <br>
  221.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  222.        </TD>
  223.     </TR>
  224.     <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  225.    </TABLE>
  226.     <br>
  227.    <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  228. </form></DIV>
  229. </BODY></HTML>