source: sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/QuickCatalogSearch.js @ 3932

Revision 3932, 22.6 KB checked in by thiagoaos, 13 years ago (diff)

Ticket #1700 - Corrigido erro ao enviar email quando tem ", ," no campo destinatário.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
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                connector.loadScript("ccQuickAdd");
11               
12                id = '1';
13                _this = this;
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               
26                func_add_contact = function () {
27                        var select_QuickCatalogSearch = document.getElementById("select_QuickCatalogSearch");
28                        var contact_selected = select_QuickCatalogSearch.options[select_QuickCatalogSearch.selectedIndex].text;
29                       
30                        contact_selected = contact_selected.split('(');
31                       
32                        var first_and_last_name = contact_selected[0].split(" ");
33                       
34                        var data = [];
35                        data[0] = first_and_last_name[0];
36                        data[1] = first_and_last_name[0];
37                        data[2] = "";
38                       
39                        for (i=1; i < first_and_last_name.length; i++)
40                                data[2] += first_and_last_name[i] + " ";
41                       
42                        data[2] = data[2].replace(/\s*$/g,'');
43                        data[3] = contact_selected[1].substring(0, contact_selected[1].indexOf(")") );
44                       
45                        ccQuickAddOne.showList( data );                 
46                };             
47               
48                if (document.getElementById('select_QuickCatalogSearch') == null){
49
50                        var title_innerHTML = get_lang('Select a name') + ':';
51                        if (data.quickSearch_only_in_userSector)
52                                title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>"
53
54                        var title = document.createElement("SPAM");
55                        title.id = 'window_QuickCatalogSearch_title';
56                        title.innerHTML = "&nbsp;&nbsp;<b><font color='BLUE' nowrap>"+title_innerHTML+"</font></b><br>&nbsp;&nbsp;";
57                        el.appendChild(title);
58                       
59                        var cmb = document.createElement("SELECT");
60                        cmb.id = "select_QuickCatalogSearch";
61                        cmb.style.width = "685px";
62                        cmb.size = "12";
63                        cmb.onkeypress = function (e)
64                        {
65                                if (is_ie)
66                                {
67                                        if ((window.event.keyCode) == 13)
68                                        {
69                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
70                                        }
71                                        else if ((window.event.keyCode) == 27)
72                                        {
73                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
74                                        }
75                                }
76                                else
77                                {
78                                        if ((e.keyCode) == 13)
79                                        {
80                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
81                                        }
82                                        else if ((e.keyCode) == 27)
83                                        {
84                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
85                                        }
86                                }
87                        };
88                        el.appendChild(cmb);
89
90                        var space = document.createElement('SPAN');
91                        space.innerHTML = "<BR>&nbsp;&nbsp;";
92                        el.appendChild(space);
93
94                        var butt = document.createElement('BUTTON');
95                        var buttext = document.createTextNode('OK');
96                        butt.id = "QuickCatalogSearch_button_ok";
97                        butt.appendChild(buttext);
98                        butt.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);};
99                        el.appendChild(butt);
100
101                        var space = document.createElement('SPAN');
102                        space.innerHTML = "&nbsp;&nbsp;";
103                        el.appendChild(space);
104
105                        var butt = document.createElement('BUTTON');
106                        butt.id = "QuickCatalogSearch_button_close";
107                        var buttext = document.createTextNode(get_lang('Close'));
108                        butt.appendChild(buttext);
109                        butt.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);};
110                        el.appendChild(butt);
111                       
112                        var space = document.createElement('SPAN');
113                        space.innerHTML = "&nbsp;&nbsp;";
114                        el.appendChild(space);
115
116                        var butt = document.createElement('BUTTON');
117                        butt.id = "QuickCatalogSearch_button_add_contact";
118                        var buttext = document.createTextNode(get_lang("Add Contact"));
119                        butt.appendChild(buttext);
120                        butt.onclick = func_add_contact;
121                        el.appendChild(butt);                   
122                }
123                else{
124                        var title_innerHTML = get_lang('Select a name') + ':';
125                        if (data.quickSearch_only_in_userSector)
126                                title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>"
127
128                        var title = Element('window_QuickCatalogSearch_title');
129                        title.innerHTML = "&nbsp;&nbsp;<b><font color='BLUE' nowrap>"+title_innerHTML+"</font></b><br>&nbsp;&nbsp;";
130                       
131                        var cmb = document.getElementById('select_QuickCatalogSearch');
132                        cmb.onkeypress = function (e)
133                        {
134                                if (is_ie)
135                                {
136                                        if ((window.event.keyCode) == 13)
137                                        {
138                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
139                                        }
140                                        else if ((window.event.keyCode) == 27)
141                                        {
142                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
143                                        }
144                                }
145                                else
146                                {
147                                        if ((e.keyCode) == 13)
148                                        {
149                                                QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);
150                                        }
151                                        else if ((e.keyCode) == 27)
152                                        {
153                                                QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);
154                                        }
155                                }
156                        };
157
158                        for (i=0; i<cmb.length; i++)
159                                cmb.options[i--] = null;
160                       
161                        var butt_ok = document.getElementById("QuickCatalogSearch_button_ok");
162                        var butt_close = document.getElementById("QuickCatalogSearch_button_close");
163                        var butt_add_contact = document.getElementById("QuickCatalogSearch_button_add_contact");
164                        butt_ok.onclick = function () {QuickCatalogSearch.transfer_result(data.field, data.ID, begin, end);};
165                        butt_close.onclick = function () {QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);};
166                        butt_add_contact.onclick = func_add_contact;
167                }
168
169                for (i=0; i<data.length; i++){
170                        var Op = document.createElement("OPTION");
171                        Op.text = data[i].cn + ' (' + data[i].mail + ')';
172                        if (data[i].phone != '')
173                                Op.text += ' - ' + data[i].phone;
174                        if (data[i].ou != '')
175                                Op.text += ' - ' + data[i].ou; // adicionado "data[i].ou" para exibir setor (F9)
176                        Op.value = '"' + data[i].cn + '" ' + '<' + data[i].mail + '>';
177                        cmb.options.add(Op);
178                }
179                cmb.options[0].selected = true;
180                _this.showWindow(el);
181        }
182       
183        emQuickCatalogSearch.prototype.showWindow = function (div)
184        {
185                if(! div) {
186                        alert(get_lang('The list has no participant.'));
187                        return;
188                }
189                                                       
190                if(! this.arrayWin[div.id]) {
191                        div.style.width = "700px";
192                        div.style.height = "230px";
193                        var title = get_lang('The results were found in the Global Catalog')+':';
194                        var wHeight = div.offsetHeight + "px";
195                        var wWidth =  div.offsetWidth   + "px";
196                        div.style.width = div.offsetWidth - 5;
197
198                        win = new dJSWin({                     
199                                id: 'QuickCatalogSearch_'+div.id,
200                                content_id: div.id,
201                                width: wWidth,
202                                height: wHeight,
203                                title_color: '#3978d6',
204                                bg_color: '#eee',
205                                title: title,                                           
206                                title_text_color: 'white',
207                                button_x_img: '../phpgwapi/images/winclose.gif',
208                                border: true });
209                       
210                        this.arrayWin[div.id] = win;
211                        win.draw();
212                }
213                else {
214                        win = this.arrayWin[div.id];
215                }
216                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "";
217                win.open();
218                document.getElementById('select_QuickCatalogSearch').focus();
219        }
220       
221        emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){
222                cm = document.getElementById('select_QuickCatalogSearch');
223                option_selected = cm.options[cm.selectedIndex].value + ", ";
224                emailList = document.getElementById(field + "_" + ID).value;
225               
226                new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length);
227                document.getElementById(field + "_" + ID).value = new_emailList;
228                document.getElementById(field + "_" + ID).focus();
229               
230                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none";
231                this.arrayWin['window_QuickCatalogSearch'].close();
232        }
233       
234        emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){
235                //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none";
236                document.getElementById(field + "_" + ID).focus();
237                this.arrayWin['window_QuickCatalogSearch'].close();
238        }
239
240        emQuickCatalogSearch.prototype.close_window = function(id) {
241                this.arrayWin[id].close();
242                var group_values = Element('list_values');
243                var user_values = Element('user_values');       
244        }
245        emQuickCatalogSearch.prototype.showCatalogList = function (border_id){
246                var el = Element('catalog_list');
247
248                if(el) {
249                        Element('border_id').value = border_id;
250                        win = this.arrayWin[el.id];
251                        win.open();
252                        return;         
253                }
254                var border_input   = document.createElement("INPUT");
255                border_input.type  = 'hidden';
256                border_input.id    = 'border_id';
257                border_input.value = border_id;
258                document.body.appendChild(border_input);
259                el = document.createElement("DIV");             
260                el.id = 'catalog_list';
261                document.body.appendChild(el);                 
262                el.style.visibility = "hidden";
263                el.style.position = "absolute";
264                el.style.width = "700px";
265                el.style.height = is_ie ? "360px" : "375px";           
266                el.style.left = "0px";
267                el.style.top = "0px";                   
268                el.innerHTML = "<table border='0' cellpading='0' cellspacing='0' width='100%'>"+
269                                           "<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>"+
270                                           "<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>"+
271                                           '</table>'+
272                                           '<div id="tab1" align="center"><br>'+
273                                           '<table border="0" cellpading="0" cellspacing="0">'+
274                                           '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+'&nbsp;:</td></tr>'+
275                                        '<tr><td><select style="display:none;width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+
276                                        '<select id="select_organization" style="width:150px" name="select_organization"></select>&nbsp;'+   
277                                        '<input type="text" id="search_for" name="search_for" value="" size="30" maxlength="30"/>&nbsp;<input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'">&nbsp;<input style="display:visible" type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+
278                                           '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type_l" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+'&nbsp;&nbsp;<input type="radio" id="type_u" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
279                                           '<span style="visibility:hidden;background:#cc4444" id=msg_search>&nbsp;&nbsp;<font face="Verdana" size="1" color="WHITE">'+get_lang('Search in Catalog')+'...</font>&nbsp;</span></td></tr>'+
280                                           '<tr><td>'+
281                                           '<span id="list_span"><select multiple style="display:none;width:580px" size="14" id="list_values"></select></span>'+
282                                           '<span id="user_span"><select multiple style="width:580px" size="14" id="user_values"></select></span>'+
283                                           '</td></tr>'+
284                                           '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+':&nbsp;<input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to\')">&nbsp;'+
285                                           '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc\')">&nbsp;'+
286                                           '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco\')">'+
287                                           '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+
288                                           '</table>'+
289                                           '</div>'+
290                                           '<div style="display:none" id="tab2" align="center">'+
291                                           '<br><br><br>'+
292                                           '<table border="0" cellpading="0" cellspacing="0">'+
293                                           '<tr><td>'+get_lang("Select the type of contact that you want to view")+'&nbsp;:</td></tr>'+
294                                           '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" type="radio" name="type" value="p"/>' + get_lang('People') + '&nbsp;&nbsp;<input type="radio" name="type" value="g" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)"/>' + get_lang('Groups') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
295                                           '<tr><td>'+
296                                           '<span id="personal_span"><select multiple style="width:580px" size="14" id="list_personal"></select></span>'+
297                                           '<span id="groups_span"><select multiple style="display:none;width:580px" size="14" id="list_groups"></select></span>'+
298                                           '</td></tr>'+
299                                           '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+':&nbsp;<input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to1\')">&nbsp;'+
300                                           '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc1\')">&nbsp;'+
301                                           '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco1\')">'+
302                                           '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+
303                                           '</table>'+
304                                           '</div>';
305
306                var title = get_lang('Search in the Global Catalog');
307                var wHeight = el.offsetHeight - (is_ie ? 10 : 0) + "px";
308                var wWidth =  el.offsetWidth   + "px";
309                el.style.width = el.offsetWidth;
310               
311                Element('search_for').onkeypress = function (e) {
312                        if ((is_ie && (window.event.keyCode == 13)) || (!is_ie && e.keyCode == 13)) {
313                                QuickCatalogSearch.searchCatalogList(true);
314                        }
315                };
316
317                win = new dJSWin({                     
318                        id: 'win_'+el.id,
319                        content_id: el.id,
320                        width: wWidth,
321                        height: wHeight,
322                        title_color: '#3978d6',
323                        bg_color: '#eee',
324                        title: title,                                           
325                        title_text_color: 'white',
326                        button_x_img: '../phpgwapi/images/winclose.gif',
327                        border: true });
328                       
329                this.arrayWin[el.id] = win;             
330                win.draw();
331                win.open();
332
333                var handler_catalogs = function(data){
334                        var user_catalog = get_lang("Global Catalog");
335                        if(data.length > 1) {
336                                Element('select_catalog').style.display = '';
337                                for(i = 0; i < data.length; i++) {             
338                                        Element('select_catalog').options[i] = new Option(data[i],i);
339                                        if(user_catalog.toUpperCase() == data[i].toUpperCase())
340                                                Element('select_catalog').options[i].selected = true;
341                                }
342                        }
343                }
344                cExecute ("$this.ldap_functions.get_catalogs", handler_catalogs);               
345               
346                this.update_organizations();
347                var handler_cc_contacts= function(data){
348                        if(data && data.length > 0){
349                                var aux = data.split(",");
350                                for(var i=0; i< aux.length; i++){
351                                        QuickCatalogSearch.cc_contacts[QuickCatalogSearch.cc_contacts.length] = aux[i];                         
352                                }
353                        }
354                }
355                cExecute("$this.db_functions.get_cc_contacts",handler_cc_contacts);
356
357                var handler_cc_groups = function(data){
358                        if(data && data.length > 0){
359                                var aux = data.split(",");
360                                for(var i=0; i < data.length; i++){
361                                        QuickCatalogSearch.cc_groups[QuickCatalogSearch.cc_groups.length] = aux[i];                                                             
362                                }       
363                        }
364                }
365                cExecute("$this.db_functions.get_cc_groups",handler_cc_groups);
366       
367        }
368       
369        emQuickCatalogSearch.prototype.select_div = function(element){
370                if(element == 'tab1'){
371                   Element('tab1').style.display = '';
372                   Element('tab2').style.display = 'none';
373                   Element('td1').style.background = '#eee';   
374                   Element('td2').style.background = '#cecece';
375                }
376                if(element == 'tab2'){
377                   Element('tab1').style.display = 'none';
378                   Element('tab2').style.display = '';
379                   Element('td1').style.background = '#cecece';
380                   Element('td2').style.background = '#eee';               
381
382                }
383        }
384       
385        emQuickCatalogSearch.prototype.load_catalog = function(){
386       
387                var _this = this;
388                var content = new Array;
389                var select = Element('list_personal').style.display == 'none'? Element('list_groups'): Element('list_personal');
390               
391                if(Element('list_personal').style.display == 'none'){
392                        content = _this.cc_groups;
393                }else{
394                        content = _this.cc_contacts;
395                }
396                if(select.options.length > 0){
397                        for(var i=0; i < select.options.length; i++){
398                                select.options[i] = null;
399                                i--;
400                        }
401                }
402                for(var i=0; i < content.length; i++){
403                        if(content[i] != undefined){
404                                var aux = content[i].split(";");
405                                var opt = new Option(aux[0] + ' (' + aux[1] + ')','"' + aux[0] + '" ' + '<' + aux[1] + '>',false,false);
406                                select[select.length] = opt;
407                        }
408                }
409                content.splice(0,(content.lenght));
410        }
411
412        emQuickCatalogSearch.prototype.update_organizations = function(){
413                while(Element('select_organization').options.length > 0) {
414                        Element('select_organization').remove(0);
415                }
416                var handler_org = function(data){
417                        Element('select_organization').options[0] = new Option(get_lang('all'),'all');
418                        if (data != null){
419                                var user_organization = Element('user_organization').value;
420                                for(x = 0; x < data.length; x++) {
421                                        Element('select_organization').options[x+1] = new Option(data[x].toUpperCase(),data[x]);
422                                        if(user_organization.toUpperCase() == data[x].toUpperCase())
423                                                Element('select_organization').options[x+1].selected = true;
424                                }
425                        }
426                }               
427                cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org);               
428        }
429
430        emQuickCatalogSearch.prototype.changeOptions = function(type){ 
431
432                switch(type){
433                        case 'u':
434                                Element('list_values').style.display = 'none';
435                                Element('user_values').style.display = '';
436                                break;
437                       
438                        case 'l':               
439                                Element('user_values').style.display = 'none';
440                                Element('list_values').style.display = '';             
441                                break;
442
443                        case 'p':
444                                Element('list_personal').style.display = '';
445                                Element('list_groups').style.display = 'none'
446                                QuickCatalogSearch.load_catalog();                             
447                                break;
448                       
449                        case 'g':
450                                Element('list_personal').style.display = 'none';
451                                Element('list_groups').style.display = ''
452                                QuickCatalogSearch.load_catalog();
453                                break;
454                }
455
456        }
457
458        emQuickCatalogSearch.prototype.addContacts = function(field) {
459               
460                var border_id   = Element('border_id').value;
461                var select              = Element('user_values').style.display == 'none' ? Element('list_values') : Element('user_values');
462                if(field == "to1" || field == "cc1" || field == "cco1"){
463                        field = field.substr(0,field.length - 1);
464                        var select = Element('list_personal').style.display == 'none' ? Element('list_groups') : Element('list_personal');
465                }
466                var fieldOpener = Element(field+"_"+border_id);
467                var not_selected = true;
468               
469                fieldOpener.value = trim(fieldOpener.value);
470               
471                for (i = 0 ; i < select.length ; i++) {
472                        if (select.options[i].selected && select.options[i].value != '-1') {
473                                if(fieldOpener.value.length > 0 && (fieldOpener.value.lastIndexOf(',') != (fieldOpener.value.length - 1))){
474                                        fieldOpener.value += ",";
475                                }
476                                fieldOpener.value += select.options[i].value + ",";
477                                not_selected = false;
478                                select.options[i].selected = false;
479                        }
480                }
481               
482                if(not_selected)
483                        return false;
484                       
485                if(field != 'to'){
486                        a_link = Element("a_"+field+"_link_"+border_id);
487                        if(a_link)
488                                a_link.onclick();
489                }
490        }
491       
492        emQuickCatalogSearch.prototype.searchCatalogList = function (itemSearch){
493
494                if(itemSearch && Element('search_for').value.length < preferences.search_characters_number){
495                        alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number));
496                        Element('search_for').focus();
497                        return false;
498                }
499                var organization = Element('select_organization').value;               
500                var search               = itemSearch ? Element('search_for').value : '';
501                var catalog              = Element('select_catalog').value;
502                var max_result  = 400;
503
504                var handler_searchResults = function(data){
505                        Element('msg_search').style.visibility = 'hidden';
506                        if(data.error){
507                                alert(get_lang('More than %1 results. Please, try to refine your search.',max_result));
508                                return false;
509                        }else if(data.users.length == 0 && data.groups.length == 0){
510                                alert(get_lang('None result was found.'));
511                        }
512
513                       
514                        var group = Element('list_span');
515                        var user  = Element('user_span');       
516                        if(is_ie){
517                                group.innerHTML = '';
518                                user.innerHTML = '';
519                        }
520                        else {
521                                group = Element('list_values');
522                                user  = Element('user_values');
523                                for(var i = 0;i < group.options.length; i++)                           
524                                        group.options[i--] = null;
525                                for(var i = 0;i < user.options.length; i++)                             
526                                        user.options[i--] = null;
527                        }
528
529                        var arr         = new Array(max_result);
530
531                        for(i = 0; data.groups && i < data.groups.length; i++) {
532                                // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento.
533                                if(is_ie)
534                                        arr[i] = '<option value="'+'&quot;'+data.groups[i].name+'&quot; &lt;'+data.groups[i].email+'&gt;">'+data.groups[i].name+' ('+data.groups[i].email+')'+'</option>';
535                                else
536                                        group.options[i] = new Option(data.groups[i].name+' ('+data.groups[i].email+')','"'+data.groups[i].name+'" <'+data.groups[i].email+'>');
537                        }
538       
539                       
540                        if(is_ie)
541                                group.innerHTML = '<select multiple style="display:none;width:580px" size="14" id="list_values">'+ arr.join() +'</select>';
542
543                        arr = new Array(max_result);
544                       
545                        for(i = 0; data.users && i < data.users.length; i++) {
546                        /*******************************************************************************************/
547                        /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela,
548                        ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o
549                        resultado apresentado em tela sera exibido de maneira mais apresentavel;
550                        */
551                                //verifica se departamento eh null ou nao;
552                                var department = data.users[i].department ? " - " + data.users[i].department : "";
553                                //verifica se email eh null ou nao;
554                                var email = data.users[i].email ? data.users[i].email : "";
555
556                                // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento.
557                                if(is_ie)
558                                        arr[i] = '<option value="'+'&quot;'+data.users[i].name+'&quot; &lt;'+email+'&gt;">'+data.users[i].name+' ('+email+')'+department+'</option>';
559                                else {
560                                        user.options[i] = new Option(data.users[i].name+' ('+email+')'+department,'"'+data.users[i].name+'" <'+email+'>'); // incluido data.users[i].department para exibir setor na opcao "Pesquisar" do email;
561                                }
562                        }
563       
564                        if(is_ie)
565                                user.innerHTML = '<select multiple style="width:580px" size="14" id="user_values">'+ arr.join() +'</select>';
566
567                        // Display entries found.
568                        var type = (data.groups.length > 0 && data.users.length == 0) ? 'l' : 'u';
569                        Element("type_"+type).checked = true;
570                        QuickCatalogSearch.changeOptions(type);
571                }
572
573                Element('msg_search').style.visibility = 'visible';
574                cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search+"&catalog="+catalog, handler_searchResults);
575        }
576
577       
578/* Build the Object */
579        var QuickCatalogSearch;
580        QuickCatalogSearch = new emQuickCatalogSearch();
Note: See TracBrowser for help on using the repository browser.