SelectUser.jsp
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:12k
源码类别:
OA系统
开发平台:
Java
- <%@ page contentType="text/html; charset=GB2312"%>
- <%@ page import="com.gforce.gfoa.*,com.gforce.currency.*,java.util.*" %>
- <% Session m_session = new Session(session); %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
- <title>短信息-- GForce OA 2.0</title>
- <link href="/css/txt.jsp" rel="stylesheet" type="text/css">
- <style type="text/css">
- <!--
- div {
- font-size: 12px;
- line-height: normal;
- }
- a {
- font-size: 12px;
- line-height: normal;
- color: #000000;
- }
- td {
- font-size: 12px;
- }
- -->
- </style>
- </head>
- <SCRIPT LANGUAGE="JavaScript">
- <!--
- var jsArray = new Array();
- <%
- Vector vt = DepartmentManager.getDepartmentTreeData();
- int i=0;
- for(int j=0;j<vt.size();j++,i++)
- {
- String strFartherID = ((Vector)vt.get(j)).get(2).toString();
- strFartherID = strFartherID.substring(0,strFartherID.length()-1);
- strFartherID = strFartherID.substring(strFartherID.lastIndexOf("_")+1);
- out.println("jsArray[" + i+ "] = new Array("" + ((Vector)vt.get(j)).get(0).toString() + "","" + ((Vector)vt.get(j)).get(1).toString() + "","" + strFartherID + "","" + ((Vector)vt.get(j)).get(2).toString() + "");");
- }
- out.println("var maxdept=" + i);
- vt = UserManager.getUserTreeData();
- for(int j=0;j<vt.size();j++,i++)
- {
- String strStation=((Vector)vt.get(j)).get(4).toString();
- String strDepartmentID=((Vector)vt.get(j)).get(2).toString();
- if(strStation.trim().equalsIgnoreCase(""))
- {
- strStation="_0_";
- strDepartmentID="0";
- }
- else
- {
- strStation+=strDepartmentID + "_";
- }
- out.println("jsArray[" + i + "] = new Array("" + ((Vector)vt.get(j)).get(0).toString() + "","" + ((Vector)vt.get(j)).get(1).toString() + "","" + strDepartmentID + "","" + strStation + "");");
- }
- %>
- function hasfile(shangjiid)
- {
- for(var i = maxdept;i<jsArray.length;i++)
- {
- if(jsArray[i][3].indexOf("_" + shangjiid.toString() + "_" )>=0)
- {
- return true;
- }
- }
- return false;
- }
- function isfilesallchecked(shangjiid)
- {
- for(var i = maxdept;i<jsArray.length;i++)
- {
- if(jsArray[i][3].indexOf("_" + shangjiid.toString() + "_" )>=0)
- {
- if(eval("document.all.user_" + jsArray[i][0] + ".checked==false"))
- {
- return false;
- }
- }
- }
- return true;
- }
- function showtree(jibie,shangjiid,bline)
- {
- if(jibie==0)
- {
- document.write("<div id="t" + jibie + "_" + shangjiid +"" style="display:">");
- }
- else
- {
- document.write("<div id="t" + jibie + "_" + shangjiid +"" style="display:none">");
- }
- var i,notislast,j,haschild;
- notislast=false;
- haschild=false;
- for(i=0;i<jsArray.length;i++)
- {
- if(jsArray[i][2]==shangjiid.toString())
- {
- var j,maxorder=0;
- haschild=false;
- for(j=0;j<jsArray.length;j++)
- {
- if((jsArray[j][2]==shangjiid.toString())&&maxorder<j)
- {
- maxorder=j;
- }
- }
- if(i<maxdept)
- {
- for(j=0;j<jsArray.length;j++)
- {
- if(jsArray[j][2]==jsArray[i][0])
- {
- haschild=true;
- break;
- }
- }
- }
- bline = bline.substr(0,jibie);
- for(j=0;j<bline.length;j++)
- if(bline.substr(j,1)=="1")
- document.write("<img align="absbottom" src="/images/tree/i.gif" border=0>");
- else
- document.write("<img align="absbottom" src="/images/tree/white.gif" border=0>");
- if(maxorder>i)
- {
- if(haschild)
- {
- if(hasfile(parseInt(jsArray[i][0])))
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/tplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""></a><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="clickdept(" + jsArray[i][0] + ",this.checked);unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- else
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/tplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + "">" + jsArray[i][1] + "</a><br>");
- }
- bline += "1".toString();
- showtree(jibie + 1,jsArray[i][0],bline);
- }
- else
- {
- if(i<maxdept)
- document.write("<img align="absbottom" src="/images/tree/t.gif" border=0><img align="absbottom" src="/images/tree/folderclosed.gif" border=0>" + jsArray[i][1] + "<br>");
- else
- document.write("<img align="absbottom" src="/images/tree/t.gif" border=0><img align="absbottom" src="/images/tree/book.gif" border=0><input id="user_" + jsArray[i][0] + "" type="checkbox" name="userid" value="" + jsArray[i][0] + "" onclick="unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- }
- else
- {
- if(haschild)
- {
- if(hasfile(parseInt(jsArray[i][0])))
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/lplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""></a><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="clickdept(" + jsArray[i][0] + ",this.checked);unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- else
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/lplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + "">" + jsArray[i][1] + "</a><br>");
- }
- bline += "0".toString();
- showtree(jibie + 1,jsArray[i][0],bline);
- }
- else
- {
- if(i<maxdept)
- document.write("<img align="absbottom" src="/images/tree/l.gif" border=0><img align="absbottom" src="/images/tree/folderclosed.gif" border=0>" + jsArray[i][1] + "<br>");
- else
- document.write("<img align="absbottom" src="/images/tree/l.gif" border=0><img align="absbottom" src="/images/tree/book.gif" border=0><input id="user_" + jsArray[i][0] + "" type="checkbox" name="userid" value="" + jsArray[i][0] + "" onclick="unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- }
- }
- }
- document.write("</div>");
- }
- function clicktree(jibie,shangjiID)
- {
- if(shangjiID>0)
- if(eval("t" + jibie + "_" + shangjiID).style.display=="none")
- {
- eval("t" + jibie + "_" + shangjiID).style.display="";
- if(eval("document.n" + jibie + "_" + shangjiID).src.toLowerCase().indexOf("/images/tree/tplus.gif")>=0)
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/tminus.gif";
- else
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/lminus.gif";
- eval("document.f" + jibie + "_" + shangjiID).src="/images/tree/folderopen.gif";
- }
- else
- {
- eval("t" + jibie + "_" + shangjiID).style.display="none";
- if(eval("document.n" + jibie + "_" + shangjiID).src.toLowerCase().indexOf("/images/tree/tminus.gif")>=0)
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/tplus.gif";
- else
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/lplus.gif";
- eval("document.f" + jibie + "_" + shangjiID).src="/images/tree/folderclosed.gif";
- }
- }
- function clickdept(deptid,isselected)
- {
- with(document.selectuser)
- {
- for(var i=0;i<jsArray.length;i++)
- {
- if(jsArray[i][3].indexOf("_"+deptid.toString()+"_")>=0)
- {
- if(i<maxdept)
- {
- if(hasfile(jsArray[i][0]))
- {
- eval("dept_" + jsArray[i][0] + "").checked = isselected;
- }
- }
- else
- {
- checkuser(jsArray[i][0],isselected);
- }
- }
- }
- }
- }
- function selectcurrentuser(useridstring)
- {
- with(document.selectuser)
- {
- for(var i=maxdept;i<jsArray.length;i++)
- {
- if(useridstring.indexOf(","+jsArray[i][0]+",")>=0)
- {
- checkuser(jsArray[i][0],true);
- }
- }
- for(var i=0;i<maxdept;i++)
- {
- if(hasfile(jsArray[i][0]))
- {
- eval("document.selectuser.dept_" + jsArray[i][0]).checked = isfilesallchecked(jsArray[i][0]);
- }
- }
- selectall.checked = isfilesallchecked(0);
- }
- }
- function checkuser(useridvalue,isselected)
- {
- with(document.selectuser)
- {
- try
- {
- eval("document.all.user_" + useridvalue + ".checked=isselected");
- }
- catch (ex)
- {
- }
- }
- }
- function unselect(fatherids,isselected)
- {
- var fatherArray = new Array();
- fatherArray = (fatherids+"").split("_");
- document.selectuser.selectall.checked = isfilesallchecked("0");
- for(var i=1;i<fatherArray.length-1;i++)
- {
- if(i==1)
- {
- document.selectuser.selectall.checked = isfilesallchecked(fatherArray[i]);
- }
- else
- {
- eval("document.selectuser.dept_" + fatherArray[i]).checked = isfilesallchecked(fatherArray[i]);
- }
- }
- }
- function ckeckall()
- {
- clickdept(0,document.selectuser.selectall.checked);
- }
- function returnvalue()
- {
- var userids="",usernames="";
- for(var i = maxdept;i<jsArray.length;i++)
- {
- if(eval("document.all.user_" + jsArray[i][0] + ".checked==true"))
- {
- userids+="," + jsArray[i][0];
- usernames += "," + jsArray[i][1];
- }
- }
- if(userids.length>0)
- {
- userids=userids.substr(1);
- usernames=usernames.substr(1);
- window.returnValue=userids + "|!|" + usernames;
- window.close();
- return false;
- }
- else
- {
- alert("请选择用户!");
- return false;
- }
- }
- //-->
- </SCRIPT>
- <BODY BGCOLOR="<%=m_session.GetString("BackColor")%>" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td>
- <form name="selectuser" method="post" action="">
- <img src="/images/tree/folderopen.gif" width="18" height="18" align="absbottom"><input type="checkbox" name="selectall" value="" onclick="ckeckall();">全部选择/取消<br>
- <script language="JavaScript">
- showtree(0,0,"");
- </script>
- </form>
- </td>
- </tr>
- </table>
- </body>
- </html>