Ignore:
Timestamp:
12/13/11 13:05:05 (12 years ago)
Author:
brunocosta
Message:

Ticket #2377 - Alteração das pesquisas para adaptação ao LDAP para nuvem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/js/QuickCatalogSearch.js

    r5102 r5246  
    6666                                title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>" 
    6767 
     68                        if (preferences.cloud_ldap) 
     69                        { 
     70                             title_innerHTML += "<font color='BLACK' nowrap> ("+get_lang('Showing only the results found in your organization')+".)</font>"; 
     71                        } 
     72 
    6873                        var title = document.createElement("SPAM"); 
    6974                        title.id = 'window_QuickCatalogSearch_title'; 
     
    98103                        butt.onclick = func_add_contact; 
    99104                        el_A.appendChild(butt); 
     105                        if(preferences.cloud_ldap) 
     106                        { 
     107                            var butt = document.createElement('BUTTON'); 
     108                            butt.id = "QuickCatalogSearch_button_search"; 
     109                            var buttext = document.createTextNode(get_lang("Advanced search")); 
     110                            butt.appendChild(buttext); 
     111                            butt.onclick = function(){openListUsers("1");QuickCatalogSearch.close_QuickSearch_window(data.field, data.ID);}; 
     112                            el_A.appendChild(butt); 
     113                        } 
    100114 
    101115                if (document.getElementById('select_QuickCatalogSearch') == null){ 
     
    321335                        win = this.arrayWin[el.id]; 
    322336                        win.open(); 
     337                        Element('search_for').value = ""; 
     338                        if(this.search){ 
     339                            Element('search_for').value = this.search; 
     340                            write_msg("No user found by this search in you organization"); 
     341                            this.search = null; 
     342                        } 
    323343                        return;          
    324344                } 
     
    344364                                           '<table border="0" cellpading="0" cellspacing="0">'+ 
    345365                                           '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+'&nbsp;:</td></tr>'+ 
    346                                         '<tr><td><select style="display:none;width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+ 
    347                                         '<select id="select_organization" style="width:150px" name="select_organization"></select>&nbsp;'+    
     366                                        '<tr><td><select style="display:none;width:100px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+ 
     367                                        '<select id="select_organization" style="width:100px" name="select_organization" onchange="javascript:QuickCatalogSearch.update_organizations_sub();" ></select>&nbsp;'+ 
     368                                        '<select id="select_organization_sub" style="width:100px;display:none;" name="select_organization_sub"></select>&nbsp;'+ 
    348369                                        '<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>'+ 
    349370                                           '<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;'+ 
     
    386407                }; 
    387408 
    388                 win = new dJSWin({                       
     409                if(this.search){ 
     410                    Element('search_for').value = this.search; 
     411                    this.search = null; 
     412                    write_msg("No user found by this search in you organization"); 
     413                } 
     414                win = new dJSWin({ 
    389415                        id: 'win_'+el.id, 
    390416                        content_id: el.id, 
     
    495521                                } 
    496522                        } 
     523                        if(preferences.cloud_ldap) 
     524                            QuickCatalogSearch.update_organizations_sub(); 
    497525                }                
    498                 cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org);                
    499         } 
     526                cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org); 
     527        } 
     528 
     529        emQuickCatalogSearch.prototype.update_organizations_sub = function(){ 
     530                while(Element('select_organization_sub').options.length > 0) { 
     531                        Element('select_organization_sub').remove(0); 
     532                } 
     533                var handler_org = function(data){ 
     534                        Element('select_organization_sub').style.display = ''; 
     535                        Element('select_organization_sub').options[0] = new Option(get_lang('all'),'all'); 
     536                        if (data != null){ 
     537                                //var user_organization = Element('user_organizations').value; 
     538                                for(x = 0; x < data.length; x++) { 
     539                                        Element('select_organization_sub').options[x+1] = new Option(data[x].toUpperCase(),data[x]); 
     540//                                      if(user_organization.toUpperCase() == data[x].toUpperCase()) 
     541                                         
     542                                } 
     543                        Element('select_organization_sub').options[0].selected = true; 
     544                        } 
     545                        
     546                } 
     547                cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value+"&organization="+Element('select_organization').value, handler_org); 
     548        } 
     549 
    500550 
    501551        emQuickCatalogSearch.prototype.changeOptions = function(type){   
     
    566616                        return false; 
    567617                } 
    568                 var organization = Element('select_organization').value;                 
     618                var organization = Element('select_organization').value; 
     619                var organization_sub = Element('select_organization_sub').value; 
    569620                var search               = itemSearch ? Element('search_for').value : ''; 
    570621                var catalog              = Element('select_catalog').value; 
     
    641692 
    642693                Element('msg_search').style.visibility = 'visible'; 
    643                 cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search+"&catalog="+catalog, handler_searchResults); 
     694                cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&organization_sub="+organization_sub+"&search_for="+search+"&catalog="+catalog, handler_searchResults); 
    644695        } 
    645696 
Note: See TracChangeset for help on using the changeset viewer.