frameleft.jsp
9.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="weaver.common.util.taglib.TreeNode"%>
<%@ page import="weaver.hrm.company.CompanyComInfo"%>
<%@ page import="weaver.general.Util"%>
<%@ page import="weaver.hrm.company.SubCompanyComInfo"%>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="CheckSubCompanyRight" class="weaver.systeminfo.systemright.CheckSubCompanyRight" scope="page" />
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<HTML>
<HEAD>
<script src="/js/tree_wev8.js"></script>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
</HEAD>
<%
String rightStr = Util.null2String(request.getParameter("rightStr"));
CompanyComInfo cc = new CompanyComInfo();
SubCompanyComInfo scc = new SubCompanyComInfo();
List compayTreeList=new ArrayList();
cc.setTofirstRow();
if(cc.next()){
//总公司
int companyId = Util.getIntValue(cc.getCompanyid());
TreeNode companyNode=new TreeNode();
companyNode.setTitle("<font color= '#330000'>"+cc.getCompanyname()+"</font>");
companyNode.setLevel(new Integer(0));
companyNode.setIcon("companyIcon");
companyNode.setLinktype("js");
companyNode.setExpand("true");
companyNode.setLink("onSelectNode(0)");
compayTreeList.add(companyNode);
compayTreeList = scc.getSubCompanyTreeList(compayTreeList,"0",0,999,false,"subSignle",null,null);
int subCompanyIds[] = CheckSubCompanyRight.getSubComByUserRightId(user.getUID() ,rightStr) ;
HashMap hm = new HashMap();
for(int i=0; i<subCompanyIds.length ; i++){
hm.put(String.valueOf(subCompanyIds[i]),"true");
}
int maxLevel = 0;
for(int i=0; i<compayTreeList.size() ; i++){
TreeNode node = (TreeNode)compayTreeList.get(i);
if(node.getLevel().intValue() > maxLevel){
maxLevel = node.getLevel().intValue() ;
}
//System.out.println("Position:" + node.getPosition()+"\tLevel:"+node.getLevel()+"\t"+node.getTitle());
}
String str1;
String str2;
int pos1;
int pos2;
for(int i=maxLevel; i>=0;i--){
for(int j=compayTreeList.size()-1; j>0 ; j--){
TreeNode node = (TreeNode)compayTreeList.get(j);
if(node.getLevel().intValue() == i){
str1 = node.getTitle();
if(j==compayTreeList.size()-1||((TreeNode)compayTreeList.get(j)).getLevel().compareTo(((TreeNode)compayTreeList.get(j+1)).getLevel())>=0){
pos1 = str1.indexOf("value=");
if(pos1 != -1){
pos2 = str1.indexOf(">",pos1+1);
str2 = str1.substring(pos1+6,pos2);
//System.out.println("str2 = " + str2);
if(hm.get(str2)==null){
compayTreeList.remove(j);
}
}else{
compayTreeList.remove(j);
}
}else{
pos1 = str1.indexOf("value=");
if(pos1 != -1){
pos2 = str1.indexOf(">",pos1+1);
str2 = str1.substring(pos1+6,pos2);
//System.out.println("str2 = " + str2);
if(hm.get(str2)==null){
node.setTitle(str1.substring(0,str1.indexOf("<input")+6)+" style='display:none' "+ str1.substring(str1.indexOf("<input")+6));
}
}
}
}
//System.out.println("Position:" + node.getPosition()+"\tLevel:"+node.getLevel()+"\t"+node.getTitle());
}
}
for(int i=compayTreeList.size()-1; i>0 ; i--){
TreeNode node = (TreeNode)compayTreeList.get(i);
str1 = node.getNodeName() ;
node.setNodeName(str1.substring(0,str1.indexOf("_")+1 )+i );
str1 = node.getTitle() ;
pos1 = str1.indexOf("onRdioChick(");
if(pos1 != -1){
node.setTitle(str1.substring(0,pos1+12 )+i+str1.substring(str1.indexOf(")",pos1+12) ) );
}
pos1 = str1.indexOf("id=idIndex_");
if(pos1 != -1){
node.setTitle(str1.substring(0,pos1+11 )+i+str1.substring(str1.indexOf(" ",pos1+11) ) );
}
}
}
request.setAttribute("compayTreeList",compayTreeList);
%>
<script language="javaScript">
function doRightFrame(){
retStr = onSaveJavaScript();
subid = retStr.substring(0,retStr.indexOf("_"));
loc = parent.contentUrl+"";
//alert(loc);
if(loc.indexOf("subCompanyId=")!=-1){
n1 = loc.indexOf("subCompanyId=");
loc1 = loc.substring(0,n1+13);
n2 = loc.indexOf("&",n1+13)
if(n2 == -1){
//alert(loc1+subid);
parent.contentframe.location=loc1+subid;
}else{
loc2 = loc.substring(n2);
//alert(loc1+subid+loc2);
parent.contentframe.location=loc1+subid+loc2;
}
}else if(loc.indexOf("?")!=-1){
//alert(loc+"&subCompanyId="+subid);
parent.contentframe.location=loc+"&subCompanyId="+subid;
}else{
//alert(loc+"?subCompanyId="+subid);
parent.contentframe.location=loc+"?subCompanyId="+subid;
}
}
var oldIndex=-1;
function onSelectNode(nodeindex){
if (tree1.nodes[nodeindex].expanded) {
tree1.nodes[nodeindex].expand(false);
} else {
tree1.nodes[nodeindex].expand(true);
}
}
function onRdioChick(nodeindex){
//selectNodeAndChild(nodeindex,true)
oldIndex= nodeindex;
doRightFrame();
}
function selectNodeAndChild(nodeindex,state){
try {
if (state){
tree1.nodes[nodeindex].label.innerHTML= tree1.nodes[nodeindex].label.innerHTML.replace("#330000","#ff0000");
tree1.nodes[nodeindex].expand(true);
document.all("idIndex_"+nodeindex).checked=true;
} else {
tree1.nodes[nodeindex].label.innerHTML= tree1.nodes[nodeindex].label.innerHTML.replace("#ff0000","#330000");
tree1.nodes[nodeindex].expand(true);
document.all("idIndex_"+nodeindex).checked=true;
}
} catch(e){
}
}
function onSaveJavaScript(){
var returnStr="";
var len = document.forms[0].elements.length;
for (i = 0; i <len; i++){
if (document.forms[0].elements[i].name == 'subid' && document.forms[0].elements[i].checked ){
returnStr = document.forms[0].elements[i].value
returnId = document.forms[0].elements[i].id
nodeId = returnId.substring(returnId.indexOf("_")+1,returnId.length )
labelVale = tree1.nodes[nodeId].label.innerHTML;
returnName = labelVale.substring(labelVale.indexOf(">")+1,labelVale.indexOf("</FONT>"))
break ;
}
}
return returnStr +"_" + returnName;
}
</script>
<BODY>
<DIV align=right>
<script>
document.body.oncontextmenu=""
</script>
</DIV>
<table width=100% height=100% border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td ></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<FORM NAME=SearchForm STYLE="margin-bottom:0" action="SubcompanyBrowser1.jsp" method=post>
<TABLE ID=BrowseTable class="BroswerStyle" cellspacing="1" STYLE="margin-top:0">
<TR class=Line1><TH colspan="4" ></TH></TR>
<TR>
<TD colspan="4" >
<%if(compayTreeList.size()==0){%>
no content
<%}else{%>
<wea:tree nodes="compayTreeList" expandall="3" titleproperty="title" style="cursor: hand" />
<%}%>
</TD>
</TR>
</TABLE>
</FORM>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr> <td height="10" colspan="3"></td></tr>
</table>
</BODY>
</HTML>