SearchByOrganByDec.jsp
11.8 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<%@ page import="weaver.general.Util"%>
<%@ page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="DepartmentComInfo"
class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="RoleComInfo" class="weaver.hrm.roles.RolesComInfo"
scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo"
class="weaver.hrm.company.SubCompanyComInfo" scope="page" />
<jsp:useBean id="CompanyComInfo"
class="weaver.hrm.company.CompanyComInfo" scope="page" />
<jsp:useBean id="ResourceComInfo"
class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="xssUtil" class="weaver.filter.XssUtil" scope="page" />
<HTML>
<HEAD>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
<link href="/css/deepTree_wev8.css" rel="stylesheet" type="text/css">
<!-- added by cyril on 2008-08-12 for td:9109 -->
<script type="text/javascript" src="/js/xtree_wev8.js"></script>
<script type="text/javascript" src="/js/xmlextras_wev8.js"></script>
<script type="text/javascript" src="/js/cxloadtree_wev8.js"></script>
<link type="text/css" rel="stylesheet" href="/css/xtree2_wev8.css" />
<!-- end by cyril on 2008-08-12 for td:9109 -->
<script type="text/javascript">
var dialog = null;
try{
dialog = parent.parent.parent.getDialog(parent.parent);
}catch(e){ }
</script>
</HEAD>
<%
String f_weaver_belongto_userid=Util.fromScreen(request.getParameter("f_weaver_belongto_userid"),user.getLanguage());
String f_weaver_belongto_usertype=Util.fromScreen(request.getParameter("f_weaver_belongto_usertype"),user.getLanguage());
String imagefilename = "/images/hdMaintenance_wev8.gif";
String titlename = SystemEnv.getHtmlLabelName(124, user.getLanguage());
String needfav = "1";
String needhelp = "";
ArrayList departments = Util.TokenizerString(Util.null2String(request.getParameter("departments")), ",");
ArrayList subcompanyids = Util.TokenizerString(Util.null2String(request.getParameter("subcompanyids")), ",");
String isall = Util.null2String(request.getParameter("isall"));
String onlyselfdept = Util.null2String(request.getParameter("onlyselfdept"));
int isdetail = Util.getIntValue(request.getParameter("isdetail"),0);
int isbill = Util.getIntValue(request.getParameter("isbill"),0);
int fieldid = Util.getIntValue(request.getParameter("fieldid"),0);
int detachable = Util.getIntValue(request.getParameter("detachable"),0);
String selectedids = Util.null2String(request.getParameter("selectedids"));
String isruledesign = Util.null2String(request.getParameter("isruledesign"));
int uid = user.getUID();
int beagenter = Util.getIntValue((String) session.getAttribute("beagenter_" + user.getUID()));
if (beagenter <= 0) {
beagenter = uid;
}
int tabid = 0;
String rem = null;
Cookie[] cks = request.getCookies();
for (int i = 0; i < cks.length; i++) {
if (cks[i].getName().equals("departmentmultiDecOrder" + uid)) {
rem = cks[i].getValue();
break;
}
}
String nodeid = null;
if (rem != null) {
String[] atts = Util.TokenizerString2(rem, "|");
if (atts.length > 1)
nodeid = atts[1];
}
boolean exist = false;
String tmpnodeid = "";
if (nodeid != null)
tmpnodeid = nodeid.substring(nodeid.lastIndexOf("_") + 1);
if (nodeid != null && nodeid.indexOf("com") > -1) {
if (isall.equals("true")) {
exist = SubCompanyComInfo.getIdIndexKey(tmpnodeid) < 0 ? false : true;
} else {
exist = subcompanyids.indexOf(tmpnodeid) > -1 ? true : false;
}
} else if (nodeid != null && nodeid.indexOf("dept") > -1) {
if (isall.equals("true")) {
exist = DepartmentComInfo.getIdIndexKey(tmpnodeid) < 0 ? false : true;
} else {
exist = subcompanyids.indexOf(DepartmentComInfo.getSubcompanyid1(tmpnodeid)) > -1 ? true : false;
}
}
if (!exist)
nodeid = null;
String deptid = ResourceComInfo.getDepartmentID("" + beagenter);
if (!deptid.equals("0")&&nodeid == null && (isall.equals("true") || departments.indexOf(deptid) > -1 || subcompanyids.indexOf(DepartmentComInfo.getSubcompanyid1(deptid)) > -1))
nodeid = "com_" + DepartmentComInfo.getSubcompanyid1(deptid);
String sqlwhere = Util.null2String(request.getParameter("sqlwhere"));
%>
<body onload="initTree()">
<form name="SearchForm" style="margin-bottom: 0"
action="MultiSelect.jsp" method="post" target="frame2">
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/leftMenuCommon.jsp"%>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
RCMenu += "{" + SystemEnv.getHtmlLabelName(826, user.getLanguage()) + ",javascript:document.SearchForm.btnok.click(),_self} ";
RCMenuHeight += RCMenuHeightStep;
%>
<BUTTON class=btn accessKey=O style="display: none" id="btnok"
onclick="btnok_onclick();">
<U>O</U>-<%=SystemEnv.getHtmlLabelName(826, user.getLanguage())%></BUTTON>
<%
RCMenu += "{" + SystemEnv.getHtmlLabelName(311, user.getLanguage()) + ",javascript:document.SearchForm.btnclear.click(),_self} ";
RCMenuHeight += RCMenuHeightStep;
%>
<BUTTON class=btn accessKey=2 style="display: none" id=btnclear
onclick="btnclear_onclick();">
<U>2</U>-<%=SystemEnv.getHtmlLabelName(311, user.getLanguage())%></BUTTON>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<script>
rightMenu.style.visibility='hidden'
</script>
<table width=100% class="ViewForm" valign="top"
style="margin-top: 0px;">
<!--######## Search Table Start########-->
<tr>
<td height=170>
<div id="deeptree" class="cxtree" CfgXMLSrc="/css/TreeConfig.xml"
style="height: 100%;" />
<td>
</tr>
</table>
<input class=inputstyle type="hidden" name="resourceids">
<input class="inputstyle" type="hidden" name="subcompanyid">
<input class="inputstyle" type="hidden" name="sqlwhere"
value='<%=xssUtil.put(sqlwhere)%>'>
<input class="inputstyle" type="hidden" id="showsubdept"
name="showsubdept">
<input class="inputstyle" type="hidden" name="tabid">
<input class="inputstyle" type="hidden" name="nodeid">
<input class="inputstyle" type="hidden" name="companyid">
<input class="inputstyle" type="hidden" name="departmentid">
<input class=inputstyle type=hidden name=selectedids id="selectedids" value="<%=selectedids%>">
<input class=inputstyle type=hidden name=fieldid value="<%=fieldid%>">
<input class=inputstyle type=hidden name=isdetail value="<%=isdetail%>">
<input class=inputstyle type=hidden name=isbill value="<%=isbill%>">
<input class=inputstyle type=hidden name=f_weaver_belongto_userid value="<%=f_weaver_belongto_userid%>">
<input class=inputstyle type=hidden name=f_weaver_belongto_usertype value="<%=f_weaver_belongto_usertype%>">
<input class=inputstyle type=hidden name=detachable value="1">
<!--########//Search Table End########-->
</FORM>
<!--
<SCRIPT LANGUAGE=VBS>
resourceids =""
resourcenames = ""
Sub btnclear_onclick()
window.parent.returnvalue = Array("","")
window.parent.close
End Sub
Sub btnok_onclick()
setResourceStr()
replaceStr()
window.parent.returnvalue = Array(resourceids,resourcenames)
window.parent.close
End Sub
Sub btnsub_onclick()
setResourceStr()
document.all("resourceids").value = resourceids.substring(1)
document.SearchForm.submit
End Sub
</SCRIPT> -->
<script language="javascript">
function initTree(){
cxtree_id = '<%=Util.null2String(nodeid)%>';
CXLoadTreeItem("", "/hrm/tree/DepartmentMultiXMLByDecOrder.jsp<%if(nodeid!=null){%>?init=true&nodeid=<%=nodeid%>&onlyselfdept=<%=onlyselfdept%><%}else{%>?onlyselfdept=<%=onlyselfdept%><%}%>&fieldid=<%=fieldid%>&isbill=<%=isbill%>&isdetail=<%=isdetail%>&detachable=1&f_weaver_belongto_userid=<%=f_weaver_belongto_userid%>&f_weaver_belongto_usertype=<%=f_weaver_belongto_usertype%>&isruledesign=<%=isruledesign%>");
var tree = new WebFXTree();
tree.add(cxtree_obj);
//document.write(tree);
document.getElementById('deeptree').innerHTML = tree;
cxtree_obj.expand();
//end by cyril on 2008-08-12 for td:9109
}
//to use xtree,you must implement top() and showcom(node) functions
function top1(){
<%if(nodeid!=null){%>
try{
deeptree.scrollTop=<%=nodeid%>.offsetTop;
deeptree.HighlightNode(<%=nodeid%>.parentElement);
deeptree.ExpandNode(<%=nodeid%>.parentElement);
setCookie("departmentmultiDecOrder<%=uid%>","<%=tabid%>|<%=nodeid%>");
}catch(e){
}
<%}%>
}
</script>
<script language="javascript">
var resourceids =""
var resourcenames = ""
function btnclear_onclick(){
if(dialog){
var returnjson = {id:"", name:""};
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.parent.returnValue = {id:"", name:""};
window.parent.parent.close();
}
}
function btnok_onclick(){
window.parent.frame2.btnok.click();
}
function btnok_onclick1(){
if(setResourceStr()){
replaceStr();
if(dialog){
var returnjson = {id:resourceids,name:resourcenames};
try{
dialog.callback(returnjson);
}catch(e){}
try{
dialog.close(returnjson);
}catch(e){}
}else{
window.parent.parent.returnValue = {id:resourceids,name:resourcenames};
window.parent.parent.close();
}
}
}
function showcom(node){
}
function check(node){
}
function setCookie(name,val){
var Then = new Date();
Then.setTime(Then.getTime() + 30*24*3600*1000 );
document.cookie = name+"="+val+";expires="+ Then.toGMTString() ;
}
function setResourceStr(){
var resourceids1 =""
var resourcenames1 = ""
try{
for(var i=0;i<parent.frame2.resourceArray.length;i++){
resourceids1 += ","+parent.frame2.resourceArray[i].split("~")[0] ;
resourcenames1 += ","+parent.frame2.resourceArray[i].split("~")[1] ;
}
resourceids=resourceids1
resourcenames=resourcenames1
}catch(err){}
return true;
}
function replaceStr(){
var re=new RegExp("[ ]*[|]*[|]","g");
resourcenames=resourcenames.replace(re,"|");
re=new RegExp("[|][^,]*","g");
resourcenames=resourcenames.replace(re,"");
}
function doSearch()
{
if(setResourceStr()){
jQuery("#selectedids").val(jQuery(parent.document).find("#frame2").contents().find("#systemIds").val());
document.all("resourceids").value = resourceids.substring(1) ;
if(jQuery(parent.document).find("#frame2").contents().find("#showsubdept").attr("checked")){
jQuery("#showsubdept").val("1") ;
}else{
jQuery("#showsubdept").val("0") ;
}
document.SearchForm.submit();
}
}
var companyid_ = -1;
function setCompany(id){
document.all("departmentid").value=""
document.all("subcompanyid").value=""
document.all("companyid").value=id
document.all("tabid").value=0
if(companyid_ == id && id != -1){
return;
}
companyid_ = id;
doSearch()
}
var subcompanyid_ = -1;
function setSubcompany(nodeid){
setCookie("departmentmultiDecOrder<%=uid%>","<%=tabid%>|"+nodeid);
subid=nodeid.substring(nodeid.lastIndexOf("_")+1)
document.all("companyid").value=""
document.all("departmentid").value=""
document.all("subcompanyid").value=subid
document.all("tabid").value=0
document.all("nodeid").value=nodeid
if(subcompanyid_ == nodeid && nodeid != -1){
return;
}
subcompanyid_ = nodeid;
doSearch()
}
var departmentid_ = -1;
function setDepartment(nodeid){
setCookie("departmentmultiDecOrder<%=uid%>","<%=tabid%>|"+nodeid);
deptid=nodeid.substring(nodeid.lastIndexOf("_")+1)
document.all("subcompanyid").value=""
document.all("companyid").value=""
document.all("departmentid").value=deptid
document.all("tabid").value=0
document.all("nodeid").value=nodeid
if(departmentid_ == nodeid && nodeid != -1){
return;
}
departmentid_ = nodeid;
doSearch()
}
</script>
</BODY>
</HTML>