1 | function emQuickCatalogSearch () |
---|
2 | { |
---|
3 | this.arrayWin = new Array(); |
---|
4 | this.el; |
---|
5 | this.cc_contacts = new Array(); |
---|
6 | this.cc_groups = new Array(); |
---|
7 | } |
---|
8 | |
---|
9 | emQuickCatalogSearch.prototype.showList = function(data, begin, end){ |
---|
10 | id = '1'; |
---|
11 | _this = this; |
---|
12 | |
---|
13 | var title = get_lang('Select a name') + ':'; |
---|
14 | var el = document.createElement("DIV"); |
---|
15 | el.style.visibility = "hidden"; |
---|
16 | el.style.position = "absolute"; |
---|
17 | el.style.left = "0px"; |
---|
18 | el.style.top = "0px"; |
---|
19 | el.style.width = "0px"; |
---|
20 | el.style.height = "0px"; |
---|
21 | el.id = 'window_QuickCatalogSearch'; |
---|
22 | document.body.appendChild(el); |
---|
23 | el.innerHTML = ""; |
---|
24 | |
---|
25 | if (data.quickSearch_only_in_userSector) |
---|
26 | title += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>" |
---|
27 | |
---|
28 | el.innerHTML = " <b><font color='BLUE' nowrap>"+title+"</font></b><br> "; |
---|
29 | |
---|
30 | if (document.getElementById('select_QuickCatalogSearch') == null){ |
---|
31 | var cmb = document.createElement("SELECT"); |
---|
32 | cmb.id = "select_QuickCatalogSearch"; |
---|
33 | cmb.style.width = "585px"; |
---|
34 | cmb.size = "12"; |
---|
35 | cmb.onkeypress = function (e) |
---|
36 | { |
---|
37 | if (is_ie) |
---|
38 | { |
---|
39 | if ((window.event.keyCode) == 13) |
---|
40 | { |
---|
41 | QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end); |
---|
42 | } |
---|
43 | else if ((window.event.keyCode) == 27) |
---|
44 | { |
---|
45 | QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID); |
---|
46 | } |
---|
47 | } |
---|
48 | else |
---|
49 | { |
---|
50 | if ((e.keyCode) == 13) |
---|
51 | { |
---|
52 | QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end); |
---|
53 | } |
---|
54 | else if ((e.keyCode) == 27) |
---|
55 | { |
---|
56 | QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID); |
---|
57 | } |
---|
58 | } |
---|
59 | }; |
---|
60 | el.appendChild(cmb); |
---|
61 | |
---|
62 | var space = document.createElement('SPAN'); |
---|
63 | space.innerHTML = "<BR> "; |
---|
64 | el.appendChild(space); |
---|
65 | |
---|
66 | var butt = document.createElement('BUTTON'); |
---|
67 | var buttext = document.createTextNode('OK'); |
---|
68 | butt.id = "QuickCatalogSearch_button_ok"; |
---|
69 | butt.appendChild(buttext); |
---|
70 | butt.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);}; |
---|
71 | el.appendChild(butt); |
---|
72 | |
---|
73 | var space = document.createElement('SPAN'); |
---|
74 | space.innerHTML = " "; |
---|
75 | el.appendChild(space); |
---|
76 | |
---|
77 | var butt = document.createElement('BUTTON'); |
---|
78 | butt.id = "QuickCatalogSearch_button_close"; |
---|
79 | var buttext = document.createTextNode(get_lang('Close')); |
---|
80 | butt.appendChild(buttext); |
---|
81 | butt.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);}; |
---|
82 | el.appendChild(butt); |
---|
83 | } |
---|
84 | else{ |
---|
85 | var cmb = document.getElementById('select_QuickCatalogSearch'); |
---|
86 | cmb.onkeypress = function (e) |
---|
87 | { |
---|
88 | if (is_ie) |
---|
89 | { |
---|
90 | if ((window.event.keyCode) == 13) |
---|
91 | { |
---|
92 | QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end); |
---|
93 | } |
---|
94 | else if ((window.event.keyCode) == 27) |
---|
95 | { |
---|
96 | QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID); |
---|
97 | } |
---|
98 | } |
---|
99 | else |
---|
100 | { |
---|
101 | if ((e.keyCode) == 13) |
---|
102 | { |
---|
103 | QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end); |
---|
104 | } |
---|
105 | else if ((e.keyCode) == 27) |
---|
106 | { |
---|
107 | QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID); |
---|
108 | } |
---|
109 | } |
---|
110 | }; |
---|
111 | |
---|
112 | |
---|
113 | for (i=0; i<cmb.length; i++) |
---|
114 | cmb.options[i--] = null; |
---|
115 | |
---|
116 | var butt_ok = document.getElementById("QuickCatalogSearch_button_ok"); |
---|
117 | var butt_close = document.getElementById("QuickCatalogSearch_button_close"); |
---|
118 | butt_ok.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);}; |
---|
119 | butt_close.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);}; |
---|
120 | } |
---|
121 | |
---|
122 | for (i=0; i<data.length; i++){ |
---|
123 | var Op = document.createElement("OPTION"); |
---|
124 | Op.text = data[i].cn + ' (' + data[i].mail + ')'; |
---|
125 | if (data[i].phone != '') |
---|
126 | Op.text += ' (tel: ' + data[i].phone + ')'; |
---|
127 | Op.value = '"' + data[i].cn + '" ' + '<' + data[i].mail + '>'; |
---|
128 | cmb.options.add(Op); |
---|
129 | } |
---|
130 | cmb.options[0].selected = true; |
---|
131 | _this.showWindow(el); |
---|
132 | } |
---|
133 | |
---|
134 | emQuickCatalogSearch.prototype.showWindow = function (div) |
---|
135 | { |
---|
136 | if(! div) { |
---|
137 | alert(get_lang('The list has no participant.')); |
---|
138 | return; |
---|
139 | } |
---|
140 | |
---|
141 | if(! this.arrayWin[div.id]) { |
---|
142 | div.style.width = "600px"; |
---|
143 | div.style.height = "230px"; |
---|
144 | var title = get_lang('The results were found in the Global Catalog')+':'; |
---|
145 | var wHeight = div.offsetHeight + "px"; |
---|
146 | var wWidth = div.offsetWidth + "px"; |
---|
147 | div.style.width = div.offsetWidth - 5; |
---|
148 | |
---|
149 | win = new dJSWin({ |
---|
150 | id: 'QuickCatalogSearch_'+div.id, |
---|
151 | content_id: div.id, |
---|
152 | width: wWidth, |
---|
153 | height: wHeight, |
---|
154 | title_color: '#3978d6', |
---|
155 | bg_color: '#eee', |
---|
156 | title: title, |
---|
157 | title_text_color: 'white', |
---|
158 | button_x_img: '../phpgwapi/images/winclose.gif', |
---|
159 | border: true }); |
---|
160 | |
---|
161 | this.arrayWin[div.id] = win; |
---|
162 | win.draw(); |
---|
163 | } |
---|
164 | else { |
---|
165 | win = this.arrayWin[div.id]; |
---|
166 | } |
---|
167 | //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = ""; |
---|
168 | win.open(); |
---|
169 | document.getElementById('select_QuickCatalogSearch').focus(); |
---|
170 | } |
---|
171 | |
---|
172 | emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){ |
---|
173 | cm = document.getElementById('select_QuickCatalogSearch'); |
---|
174 | option_selected = cm.options[cm.selectedIndex].value + ", "; |
---|
175 | emailList = document.getElementById(field + "_" + ID).value; |
---|
176 | |
---|
177 | new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length); |
---|
178 | document.getElementById(field + "_" + ID).value = new_emailList; |
---|
179 | document.getElementById(field + "_" + ID).focus(); |
---|
180 | |
---|
181 | //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none"; |
---|
182 | this.arrayWin['window_QuickCatalogSearch'].close(); |
---|
183 | } |
---|
184 | |
---|
185 | emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){ |
---|
186 | //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none"; |
---|
187 | document.getElementById(field + "_" + ID).focus(); |
---|
188 | this.arrayWin['window_QuickCatalogSearch'].close(); |
---|
189 | } |
---|
190 | |
---|
191 | emQuickCatalogSearch.prototype.close_window = function(id) { |
---|
192 | this.arrayWin[id].close(); |
---|
193 | var group_values = Element('list_values'); |
---|
194 | var user_values = Element('user_values'); |
---|
195 | } |
---|
196 | emQuickCatalogSearch.prototype.showCatalogList = function (border_id){ |
---|
197 | var el = Element('catalog_list'); |
---|
198 | |
---|
199 | if(el) { |
---|
200 | Element('border_id').value = border_id; |
---|
201 | win = this.arrayWin[el.id]; |
---|
202 | win.open(); |
---|
203 | return; |
---|
204 | } |
---|
205 | var border_input = document.createElement("INPUT"); |
---|
206 | border_input.type = 'hidden'; |
---|
207 | border_input.id = 'border_id'; |
---|
208 | border_input.value = border_id; |
---|
209 | document.body.appendChild(border_input); |
---|
210 | el = document.createElement("DIV"); |
---|
211 | el.id = 'catalog_list'; |
---|
212 | document.body.appendChild(el); |
---|
213 | el.style.visibility = "hidden"; |
---|
214 | el.style.position = "absolute"; |
---|
215 | el.style.width = "495px"; |
---|
216 | el.style.height = is_ie ? "360px" : "375px"; |
---|
217 | el.style.left = "0px"; |
---|
218 | el.style.top = "0px"; |
---|
219 | el.innerHTML = "<table border='0' cellpading='0' cellspacing='0' width='100%'>"+ |
---|
220 | "<tr><td id='td1' style='cursor:pointer' align='center' onclick='QuickCatalogSearch.select_div(\"tab1\")'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab1\");'>"+get_lang('Global Catalog')+"</a></td>"+ |
---|
221 | "<td id='td2' style='background:#cecece;cursor:pointer' onclick='QuickCatalogSearch.select_div(\"tab2\")' align='center'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab2\");'>"+get_lang('Personal Catalog')+"</a></td></tr>"+ |
---|
222 | '</table>'+ |
---|
223 | '<div id="tab1" align="center"><br>'+ |
---|
224 | '<table border="0" cellpading="0" cellspacing="0">'+ |
---|
225 | '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+' :</td></tr>'+ |
---|
226 | '<tr><td><select id="select_organization" name="select_organization"></select> '+ |
---|
227 | '<input type="text" id="search_for" name="search_for" value="" size="17" maxlength="20"/> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'"> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+ |
---|
228 | '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+' <input type="radio" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+' '+ |
---|
229 | '<span style="visibility:hidden;background:#cc4444" id=msg_search> <font face="Verdana" size="1" color="WHITE">'+get_lang('Search in Catalog')+'...</font> </span></td></tr>'+ |
---|
230 | '<tr><td>'+ |
---|
231 | '<span id="list_span"><select multiple style="display:none;width:400px" size="14" id="list_values"></select></span>'+ |
---|
232 | '<span id="user_span"><select multiple style="width:400px" size="14" id="user_values"></select></span>'+ |
---|
233 | '</td></tr>'+ |
---|
234 | '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+': <input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to\')"> '+ |
---|
235 | '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc\')"> '+ |
---|
236 | '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco\')">'+ |
---|
237 | '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+ |
---|
238 | '</table>'+ |
---|
239 | '</div>'+ |
---|
240 | '<div style="display:none" id="tab2" align="center">'+ |
---|
241 | '<br><br><br>'+ |
---|
242 | '<table border="0" cellpading="0" cellspacing="0">'+ |
---|
243 | '<tr><td>'+get_lang("Select the type of contact that you want to view")+' :</td></tr>'+ |
---|
244 | '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="p"/>' + get_lang('People') + ' <input type="radio" name="type" value="g" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)"/>' + get_lang('Groups') + ' '+ |
---|
245 | '<tr><td>'+ |
---|
246 | '<span id="personal_span"><select multiple style="width:400px" size="14" id="list_personal"></select></span>'+ |
---|
247 | '<span id="groups_span"><select multiple style="display:none;width:400px" size="14" id="list_groups"></select></span>'+ |
---|
248 | '</td></tr>'+ |
---|
249 | '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+': <input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to1\')"> '+ |
---|
250 | '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc1\')"> '+ |
---|
251 | '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco1\')">'+ |
---|
252 | '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+ |
---|
253 | '</table>'+ |
---|
254 | '</div>'; |
---|
255 | |
---|
256 | var title = get_lang('Search in the Global Catalog'); |
---|
257 | var wHeight = el.offsetHeight - (is_ie ? 10 : 0) + "px"; |
---|
258 | var wWidth = el.offsetWidth + "px"; |
---|
259 | el.style.width = el.offsetWidth; |
---|
260 | |
---|
261 | Element('search_for').onkeypress = function (e) { |
---|
262 | if ((is_ie && (window.event.keyCode == 13)) || (!is_ie && e.keyCode == 13)) { |
---|
263 | QuickCatalogSearch.searchCatalogList(true); |
---|
264 | } |
---|
265 | }; |
---|
266 | |
---|
267 | win = new dJSWin({ |
---|
268 | id: 'win_'+el.id, |
---|
269 | content_id: el.id, |
---|
270 | width: wWidth, |
---|
271 | height: wHeight, |
---|
272 | title_color: '#3978d6', |
---|
273 | bg_color: '#eee', |
---|
274 | title: title, |
---|
275 | title_text_color: 'white', |
---|
276 | button_x_img: '../phpgwapi/images/winclose.gif', |
---|
277 | border: true }); |
---|
278 | |
---|
279 | this.arrayWin[el.id] = win; |
---|
280 | win.draw(); |
---|
281 | win.open(); |
---|
282 | |
---|
283 | var handler_organizations = function(data){ |
---|
284 | var user_organization = Element('user_organization').value; |
---|
285 | |
---|
286 | for(i = 0; i < data.length; i++) { |
---|
287 | Element('select_organization').options[i] = new Option(data[i],data[i]); |
---|
288 | if(user_organization.toUpperCase() == data[i].toUpperCase()) |
---|
289 | Element('select_organization').options[i].selected = true; |
---|
290 | } |
---|
291 | } |
---|
292 | cExecute ("$this.ldap_functions.get_organizations&referral=true", handler_organizations); |
---|
293 | |
---|
294 | var handler_cc_contacts= function(data){ |
---|
295 | if(data && data.length > 0){ |
---|
296 | var aux = data.split(","); |
---|
297 | for(var i=0; i< aux.length; i++){ |
---|
298 | QuickCatalogSearch.cc_contacts[QuickCatalogSearch.cc_contacts.length] = aux[i]; |
---|
299 | } |
---|
300 | } |
---|
301 | } |
---|
302 | cExecute("$this.db_functions.get_cc_contacts",handler_cc_contacts); |
---|
303 | |
---|
304 | var handler_cc_groups = function(data){ |
---|
305 | if(data && data.length > 0){ |
---|
306 | var aux = data.split(","); |
---|
307 | for(var i=0; i < data.length; i++){ |
---|
308 | QuickCatalogSearch.cc_groups[QuickCatalogSearch.cc_groups.length] = aux[i]; |
---|
309 | } |
---|
310 | } |
---|
311 | } |
---|
312 | cExecute("$this.db_functions.get_cc_groups",handler_cc_groups); |
---|
313 | |
---|
314 | } |
---|
315 | |
---|
316 | emQuickCatalogSearch.prototype.select_div = function(element){ |
---|
317 | if(element == 'tab1'){ |
---|
318 | Element('tab1').style.display = ''; |
---|
319 | Element('tab2').style.display = 'none'; |
---|
320 | Element('td1').style.background = '#eee'; |
---|
321 | Element('td2').style.background = '#cecece'; |
---|
322 | } |
---|
323 | if(element == 'tab2'){ |
---|
324 | Element('tab1').style.display = 'none'; |
---|
325 | Element('tab2').style.display = ''; |
---|
326 | Element('td1').style.background = '#cecece'; |
---|
327 | Element('td2').style.background = '#eee'; |
---|
328 | |
---|
329 | } |
---|
330 | } |
---|
331 | |
---|
332 | emQuickCatalogSearch.prototype.load_catalog = function(){ |
---|
333 | |
---|
334 | var _this = this; |
---|
335 | var content = new Array; |
---|
336 | var select = Element('list_personal').style.display == 'none'? Element('list_groups'): Element('list_personal'); |
---|
337 | |
---|
338 | if(Element('list_personal').style.display == 'none'){ |
---|
339 | content = _this.cc_groups; |
---|
340 | }else{ |
---|
341 | content = _this.cc_contacts; |
---|
342 | } |
---|
343 | if(select.options.length > 0){ |
---|
344 | for(var i=0; i < select.options.length; i++){ |
---|
345 | select.options[i] = null; |
---|
346 | i--; |
---|
347 | } |
---|
348 | } |
---|
349 | for(var i=0; i < content.length; i++){ |
---|
350 | if(content[i] != undefined){ |
---|
351 | var aux = content[i].split(";"); |
---|
352 | var opt = new Option(aux[0] + ' (' + aux[1] + ')','"' + aux[0] + '" ' + '<' + aux[1] + '>',false,false); |
---|
353 | select[select.length] = opt; |
---|
354 | } |
---|
355 | } |
---|
356 | content.splice(0,(content.lenght)); |
---|
357 | } |
---|
358 | |
---|
359 | emQuickCatalogSearch.prototype.changeOptions = function(type){ |
---|
360 | |
---|
361 | switch(type){ |
---|
362 | case 'u': |
---|
363 | Element('list_values').style.display = 'none'; |
---|
364 | Element('user_values').style.display = ''; |
---|
365 | break; |
---|
366 | |
---|
367 | case 'l': |
---|
368 | Element('user_values').style.display = 'none'; |
---|
369 | Element('list_values').style.display = ''; |
---|
370 | break; |
---|
371 | |
---|
372 | case 'p': |
---|
373 | Element('list_personal').style.display = ''; |
---|
374 | Element('list_groups').style.display = 'none' |
---|
375 | QuickCatalogSearch.load_catalog(); |
---|
376 | break; |
---|
377 | |
---|
378 | case 'g': |
---|
379 | Element('list_personal').style.display = 'none'; |
---|
380 | Element('list_groups').style.display = '' |
---|
381 | QuickCatalogSearch.load_catalog(); |
---|
382 | break; |
---|
383 | } |
---|
384 | |
---|
385 | } |
---|
386 | |
---|
387 | emQuickCatalogSearch.prototype.addContacts = function(field) { |
---|
388 | |
---|
389 | var border_id = Element('border_id').value; |
---|
390 | var select = Element('user_values').style.display == 'none' ? Element('list_values') : Element('user_values'); |
---|
391 | if(field == "to1" || field == "cc1" || field == "cco1"){ |
---|
392 | field = field.substr(0,field.length - 1); |
---|
393 | var select = Element('list_personal').style.display == 'none' ? Element('list_groups') : Element('list_personal'); |
---|
394 | } |
---|
395 | var fieldOpener = Element(field+"_"+border_id); |
---|
396 | var not_selected = true; |
---|
397 | for (i = 0 ; i < select.length ; i++) { |
---|
398 | if (select.options[i].selected && select.options[i].value != '-1') { |
---|
399 | if(fieldOpener.value.length > 0 && (fieldOpener.value.lastIndexOf(',') != (fieldOpener.value.length -1))){ |
---|
400 | fieldOpener.value += ","; |
---|
401 | } |
---|
402 | fieldOpener.value += select.options[i].value + ","; |
---|
403 | not_selected = false; |
---|
404 | select.options[i].selected = false; |
---|
405 | } |
---|
406 | } |
---|
407 | |
---|
408 | if(not_selected) |
---|
409 | return false; |
---|
410 | |
---|
411 | if(field != 'to'){ |
---|
412 | a_link = Element("a_"+field+"_link_"+border_id); |
---|
413 | if(a_link) |
---|
414 | a_link.onclick(); |
---|
415 | } |
---|
416 | } |
---|
417 | |
---|
418 | emQuickCatalogSearch.prototype.searchCatalogList = function (itemSearch){ |
---|
419 | |
---|
420 | if(itemSearch && Element('search_for').value.length == 0){ |
---|
421 | alert(get_lang('No data to search')); |
---|
422 | Element('search_for').focus(); |
---|
423 | return false; |
---|
424 | } |
---|
425 | var organization = Element('select_organization').value; |
---|
426 | var search = itemSearch ? Element('search_for').value : ''; |
---|
427 | var max_result = 2000; |
---|
428 | |
---|
429 | var handler_searchResults = function(data){ |
---|
430 | |
---|
431 | Element('msg_search').style.visibility = 'hidden'; |
---|
432 | if(data.error){ |
---|
433 | alert(get_lang('More than %1 results. Please, try to refine your search.',max_result)); |
---|
434 | return false; |
---|
435 | } |
---|
436 | |
---|
437 | var group = Element('list_span'); |
---|
438 | var user = Element('user_span'); |
---|
439 | if(is_ie){ |
---|
440 | group.innerHTML = ''; |
---|
441 | user.innerHTML = ''; |
---|
442 | } |
---|
443 | else { |
---|
444 | group = Element('list_values'); |
---|
445 | user = Element('user_values'); |
---|
446 | for(var i = 0;i < group.options.length; i++) |
---|
447 | group.options[i--] = null; |
---|
448 | for(var i = 0;i < user.options.length; i++) |
---|
449 | user.options[i--] = null; |
---|
450 | } |
---|
451 | |
---|
452 | var arr = new Array(max_result); |
---|
453 | var display = Element('type').value == 'l'? 'display:none;' : ''; |
---|
454 | |
---|
455 | for(i = 0; data.groups && i < data.groups.length; i++) { |
---|
456 | if(is_ie) |
---|
457 | arr[i] = '<option value="'+'"'+data.groups[i].name+'" <'+data.groups[i].email+'>">'+data.groups[i].name+' ('+data.groups[i].email+')'+'</option>'; |
---|
458 | else |
---|
459 | group.options[i] = new Option(data.groups[i].name+' ('+data.groups[i].email+')','"'+data.groups[i].name+'" <'+data.groups[i].email+'>'); |
---|
460 | } |
---|
461 | |
---|
462 | if(is_ie) |
---|
463 | group.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="list_values">'+ arr.join() +'</select>'; |
---|
464 | |
---|
465 | arr = new Array(max_result); |
---|
466 | display = display ? "" : "display:none;"; |
---|
467 | |
---|
468 | for(i = 0; data.users && i < data.users.length; i++) { |
---|
469 | if(is_ie) |
---|
470 | arr[i] = '<option value="'+'"'+data.users[i].name+'" <'+data.users[i].email+'>">'+data.users[i].name+' ('+data.users[i].email+')'+'</option>'; |
---|
471 | else |
---|
472 | user.options[i] = new Option(data.users[i].name+' ('+data.users[i].email+')','"'+data.users[i].name+'" <'+data.users[i].email+'>'); |
---|
473 | } |
---|
474 | |
---|
475 | if(is_ie) |
---|
476 | user.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="user_values">'+ arr.join() +'</select>'; |
---|
477 | } |
---|
478 | |
---|
479 | Element('msg_search').style.visibility = 'visible'; |
---|
480 | cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search, handler_searchResults); |
---|
481 | } |
---|
482 | |
---|
483 | |
---|
484 | /* Build the Object */ |
---|
485 | var QuickCatalogSearch; |
---|
486 | QuickCatalogSearch = new emQuickCatalogSearch(); |
---|