MutiJobActivitiesBrowser.jsp
14 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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="CustomerTypeComInfo" class="weaver.crm.Maint.CustomerTypeComInfo" scope="page" />
<jsp:useBean id="CountryComInfo" class="weaver.hrm.country.CountryComInfo" scope="page"/>
<jsp:useBean id="CityComInfo" class="weaver.hrm.city.CityComInfo" 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></HEAD>
<%
String jobactivitymark = Util.null2String(request.getParameter("jobactivitymark"));
String jobactivityname = Util.null2String(request.getParameter("jobactivityname"));
String sqlwhere = Util.null2String(request.getParameter("sqlwhere"));
String check_per = Util.null2String(request.getParameter("resourceids"));
String resourceids ="";
String resourcenames ="";
if (!check_per.equals("")) {
String strtmp = "select id,jobactivitymark from HrmJobActivities where id in ("+check_per+")";
RecordSet.executeSql(strtmp);
Hashtable ht = new Hashtable();
while(RecordSet.next()){
ht.put( Util.null2String(RecordSet.getString("id")), Util.null2String(RecordSet.getString("jobactivitymark")));
/*
if(check_per.indexOf(","+RecordSet.getString("id")+",")!=-1){
resourceids +="," + RecordSet.getString("id");
resourcenames += ","+RecordSet.getString("lastname");
}
*/
}
try{
StringTokenizer st = new StringTokenizer(check_per,",");
while(st.hasMoreTokens()){
String s = st.nextToken();
if(ht.containsKey(s)){//如果check_per中的已选的客户此时不存在会出错TD1612
resourceids +=","+s;
resourcenames += ","+ht.get(s).toString();
}
}
}catch(Exception e){
resourceids ="";
resourcenames ="";
}
}
int ishead = 0;
if(!sqlwhere.equals("")) ishead = 1;
if(!jobactivitymark.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where jobactivitymark like '%";
sqlwhere += Util.fromScreen2(jobactivitymark,user.getLanguage());
sqlwhere += "%'";
}
else{
sqlwhere += " and jobactivitymark like '%";
sqlwhere += Util.fromScreen2(jobactivitymark,user.getLanguage());
sqlwhere += "%'";
}
}
if(!jobactivityname.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where jobactivityname like '%";
sqlwhere += Util.fromScreen2(jobactivityname,user.getLanguage());
sqlwhere += "%'";
}
else{
sqlwhere += " and jobactivityname like '%";
sqlwhere += Util.fromScreen2(jobactivityname,user.getLanguage());
sqlwhere += "%'";
}
}
String sqltemp="select * from HrmJobActivities "+sqlwhere;
RecordSet.executeSql(sqltemp);
%>
<BODY>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<table width=100% height=100% border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td valign="top">
<!--########Shadow Table Start########-->
<TABLE class=Shadow>
<tr>
<td valign="top" colspan="2">
<FORM id=weaver NAME=SearchForm STYLE="margin-bottom:0" action="MutiJobActivitiesBrowser.jsp" method=post>
<input type="hidden" name="sqlwhere" value='<%=xssUtil.put(Util.null2String(request.getParameter("sqlwhere")))%>'>
<input type="hidden" name="pagenum" value=''>
<input type="hidden" name="resourceids" value="">
<!--##############Right click context menu buttons START####################-->
<DIV align=right style="display:none">
<%
BaseBean baseBean_self = new BaseBean();
int userightmenu_self = 1;
try{
userightmenu_self = Util.getIntValue(baseBean_self.getPropValue("systemmenu", "userightmenu"), 1);
}catch(Exception e){}
if(userightmenu_self == 1){
RCMenu += "{"+SystemEnv.getHtmlLabelName(197,user.getLanguage())+",javascript:doSearch(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(826,user.getLanguage())+",javascript:SearchForm.btnok.click(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(201,user.getLanguage())+",javascript:window.close(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
RCMenu += "{"+SystemEnv.getHtmlLabelName(311,user.getLanguage())+",javascript:SearchForm.btnclear.click(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
}
%>
<BUTTON class=btnSearch accessKey=S type=submit><U>S</U>-<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%></BUTTON>
<BUTTON class=btn accessKey=O id=btnok><U>O</U>-<%=SystemEnv.getHtmlLabelName(826,user.getLanguage())%></BUTTON>
<BUTTON class=btnReset accessKey=T type=reset><U>T</U>-<%=SystemEnv.getHtmlLabelName(201,user.getLanguage())%></BUTTON>
<BUTTON class=btn accessKey=2 id=btnclear><U>2</U>-<%=SystemEnv.getHtmlLabelName(311,user.getLanguage())%></BUTTON>
</DIV>
<!--##############Right click context menu buttons END//####################-->
<!--######## Search Table Start########-->
<table width=100% class=ViewForm valign="top">
<TR class=Spacing><TD class=Line1 colspan=4></TD></TR>
<TR>
<TD width=15%><%=SystemEnv.getHtmlLabelName(399,user.getLanguage())%></TD>
<TD width=35% class=field><input class=inputstyle name=jobactivitymark value="<%=jobactivitymark%>"></TD>
<TD width=15%><%=SystemEnv.getHtmlLabelName(85,user.getLanguage())%></TD>
<TD width=35% class=field><input class=inputstyle name=jobactivityname value="<%=jobactivityname%>"></TD>
</TR>
<TR class=Spacing><TD class=Line1 colspan=4></TD></TR>
</table>
<!--#################Search Table END//######################-->
<tr width="100%">
<td width="60%">
<!--############Browser Table START################-->
<TABLE class=BroswerStyle cellspacing="0" cellpadding="0">
<TR class=DataHeader>
<TH width=0% style="display:none"><%=SystemEnv.getHtmlLabelName(84,user.getLanguage())%></TH>
<TH width="50%"><%=SystemEnv.getHtmlLabelName(399,user.getLanguage())%></TH>
<TH width="50%"><%=SystemEnv.getHtmlLabelName(85,user.getLanguage())%></TH>
</tr>
<tr>
<td colspan="4" width="100%">
<div style="overflow-y:scroll;width:100%;height:350px">
<table width="100%" id="BrowseTable">
<%
int i=0;
int totalline=1;
if(RecordSet.last()){
do{
String ids = RecordSet.getString("id");
String jobactivitymarks = Util.toScreen(RecordSet.getString("jobactivitymark"),user.getLanguage());
String jobactivitynames = Util.toScreen(RecordSet.getString("jobactivityname"),user.getLanguage());
if(i==0){
i=1;
%>
<TR class=DataLight>
<%
}else{
i=0;
%>
<TR class=DataDark>
<%
}
%>
<TD style="display:none"><A HREF=#><%=ids%></A></TD>
<td width="50%"> <%=jobactivitymarks%></TD>
<TD width="50%"><%=jobactivitynames%>
</TD>
</TR>
<%
}while(RecordSet.previous());
}
%>
</table>
</div>
</td>
</tr>
</TABLE>
</td>
<!--##########Browser Table END//#############-->
<td width="40%" valign="top">
<!--########Select Table Start########-->
<table cellspacing="1" align="left" width="100%">
<tr>
<td align="center" valign="top" width="30%">
<img src="/images/arrow_u_wev8.gif" style="cursor:hand" title="<%=SystemEnv.getHtmlLabelName(15084,user.getLanguage())%>" onclick="javascript:upFromList();">
<br><br>
<img src="/images/arrow_all_wev8.gif" style="cursor:hand" title="<%=SystemEnv.getHtmlLabelName(17025,user.getLanguage())%>" onClick="javascript:addAllToList()">
<br><br>
<img src="/images/arrow_out_wev8.gif" style="cursor:hand" title="<%=SystemEnv.getHtmlLabelName(91,user.getLanguage())%>" onclick="javascript:deleteFromList();">
<br><br>
<img src="/images/arrow_all_out_wev8.gif" style="cursor:hand" title="<%=SystemEnv.getHtmlLabelName(16335,user.getLanguage())%>" onclick="javascript:deleteAllFromList();">
<br><br>
<img src="/images/arrow_d_wev8.gif" style="cursor:hand" title="<%=SystemEnv.getHtmlLabelName(15085,user.getLanguage())%>" onclick="javascript:downFromList();">
</td>
<td align="center" valign="top" width="70%">
<select size="15" name="srcList" multiple="true" style="width:100%;word-wrap:break-word" >
</select>
</td>
</tr>
</table>
<!--########//Select Table End########-->
</td>
</tr>
</FORM>
</td>
</tr>
</TABLE>
<!--##############Shadow Table END//######################-->
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
</BODY></HTML>
<SCRIPT LANGUAGE=VBS>
resourceids = "<%=resourceids%>"
resourcenames = "<%=resourcenames%>"
Sub btnclear_onclick()
window.parent.returnvalue = Array("","")
window.parent.close
End Sub
Sub btnok_onclick()
setResourceStr()
window.parent.returnvalue = Array(resourceids,resourcenames)
window.parent.close
End Sub
Sub btnsub_onclick()
setResourceStr()
document.all("resourceids").value = resourceids
document.SearchForm.submit
End Sub
</SCRIPT>
<script language="javascript" for="BrowseTable" event="onclick">
var e = window.event.srcElement ;
if(e.tagName == "TD" || e.tagName == "A"){
var newEntry = e.parentElement.cells(0).innerText+"~"+e.parentElement.cells(1).innerText ;
//alert(newEntry);
if(!isExistEntry(newEntry,resourceArray)){
addObjectToSelect(document.all("srcList"),newEntry);
reloadResourceArray();
}
}
</script>
<script language="javascript" for="BrowseTable" event="onmouseover">
var eventObj = window.event.srcElement ;
if(eventObj.tagName =='TD'){
var trObj = eventObj.parentElement ;
trObj.className ="Selected";
}else if (eventObj.tagName == 'A'){
var trObj = eventObj.parentElement.parentElement;
trObj.className = "Selected";
}
</script>
<script language="javascript" for="BrowseTable" event="onmouseout">
var eventObj = window.event.srcElement ;
if(eventObj.tagName =='TD'){
var trObj = eventObj.parentElement ;
if(trObj.rowIndex%2 == 0)
trObj.className ="DataLight";
else
trObj.className ="DataDark";
}else if (eventObj.tagName == 'A'){
var trObj = eventObj.parentElement.parentElement;
if(trObj%2 == 0)
trObj.className ="DataLight";
else
trObj.className ="DataDark";
}
</script>
<script language="javascript">
//var resourceids = "<%=resourceids%>"
//var resourcenames = "<%=resourcenames%>"
//Load
var resourceArray = new Array();
for(var i =1;i<resourceids.split(",").length;i++){
resourceArray[i-1] = resourceids.split(",")[i]+"~"+resourcenames.split(",")[i];
//alert(resourceArray[i-1]);
}
loadToList();
function loadToList(){
var selectObj = document.all("srcList");
for(var i=0;i<resourceArray.length;i++){
addObjectToSelect(selectObj,resourceArray[i]);
}
}
/**
加入一个object 到Select List
格式object ="1~董芳"
*/
function addObjectToSelect(obj,str){
//alert(obj.tagName+"-"+str);
if(obj.tagName != "SELECT") return;
var oOption = document.createElement("OPTION");
obj.options.add(oOption);
oOption.value = str.split("~")[0];
oOption.innerText = str.split("~")[1];
}
function isExistEntry(entry,arrayObj){
for(var i=0;i<arrayObj.length;i++){
if(entry == arrayObj[i].toString()){
return true;
}
}
return false;
}
function upFromList(){
var destList = document.all("srcList");
var len = destList.options.length;
for(var i = 0; i <= (len-1); i++) {
if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
if(i>0 && destList.options[i-1] != null){
fromtext = destList.options[i-1].text;
fromvalue = destList.options[i-1].value;
totext = destList.options[i].text;
tovalue = destList.options[i].value;
destList.options[i-1] = new Option(totext,tovalue);
destList.options[i-1].selected = true;
destList.options[i] = new Option(fromtext,fromvalue);
}
}
}
reloadResourceArray();
}
function addAllToList(){
var table =document.all("BrowseTable");
//alert(table.rows.length);
for(var i=0;i<table.rows.length;i++){
var str = table.rows(i).cells(0).innerText+"~"+table.rows(i).cells(1).innerText ;
if(!isExistEntry(str,resourceArray))
addObjectToSelect(document.all("srcList"),str);
}
reloadResourceArray();
}
function deleteFromList(){
var destList = document.all("srcList");
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
destList.options[i] = null;
}
}
reloadResourceArray();
}
function deleteAllFromList(){
var destList = document.all("srcList");
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if (destList.options[i] != null) {
destList.options[i] = null;
}
}
reloadResourceArray();
}
function downFromList(){
var destList = document.all("srcList");
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
if(i<(len-1) && destList.options[i+1] != null){
fromtext = destList.options[i+1].text;
fromvalue = destList.options[i+1].value;
totext = destList.options[i].text;
tovalue = destList.options[i].value;
destList.options[i+1] = new Option(totext,tovalue);
destList.options[i+1].selected = true;
destList.options[i] = new Option(fromtext,fromvalue);
}
}
}
reloadResourceArray();
}
//reload resource Array from the List
function reloadResourceArray(){
resourceArray = new Array();
var destList = document.all("srcList");
for(var i=0;i<destList.options.length;i++){
resourceArray[i] = destList.options[i].value+"~"+destList.options[i].text ;
}
//alert(resourceArray.length);
}
function setResourceStr(){
resourceids ="";
resourcenames = "";
for(var i=0;i<resourceArray.length;i++){
resourceids += ","+resourceArray[i].split("~")[0] ;
resourcenames += ","+resourceArray[i].split("~")[1] ;
}
//alert(resourceids+"--"+resourcenames);
document.all("resourceids").value = resourceids.substring(1)
}
function doSearch()
{
setResourceStr();
document.all("resourceids").value = resourceids.substring(1) ;
document.SearchForm.submit();
}
</script>