Ignore:
Timestamp:
11/03/11 13:24:14 (13 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo ExpressoAdmin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/js/jscode/maillists.js

    r3351 r5133  
    11countFiles = 0; 
     2 
     3function Element(id){ 
     4   return document.getElementById( id ); 
     5} 
     6 
    27function validate_fields(type) 
    38{ 
     
    157162} 
    158163 
    159 function get_available_users(context, recursive,listSearch) 
    160 { 
    161         //Impede chamada recursiva na raiz das organizações 
    162         if(document.getElementById("autosearch").value == "true"){ 
    163                 if ((recursive) && (document.forms[0].ldap_context.value == document.getElementById('ea_combo_org_maillists').value)) 
    164                 { 
    165                         alert(get_lang('It is not allow select all users from the root organization') + '.'); 
    166                         document.getElementById('ea_check_allUsers').checked = false; 
     164function get_available_users(context, recursive) 
     165{ 
     166//      var sentence = Element('ea_input_searchUser').value; 
     167//  
     168//      var url = '$this.ldap_functions.get_available_users_and_maillist&context=' 
     169//                  + Element('ea_combo_org_maillists').value 
     170//                  + '&sentence=' + sentence 
     171//                  + '&denied_uidnumber=' + document.forms[0].uidnumber.value; 
     172//  
     173//      var fillHandler = function( fill ){ 
     174//  
     175//      Element('ea_select_available_users').innerHTML = fill; 
     176//  
     177//      return( fill !== "" ); 
     178//     } 
     179//  
     180//      userFinder( sentence, fillHandler, url, 'ea_span_searching' ); 
    167181                         
    168                         // Limpa select 
    169                         select_available_users = document.getElementById('ea_select_available_users'); 
    170                         select_available_users.innerHTML = ' '; 
    171                         select_available_users.outerHTML = select_available_users.outerHTML; 
    172                         return; 
    173                 } 
    174         cExecute ('$this.ldap_functions.get_available_users_and_maillist&context='+context+'&recursive='+recursive+'&denied_uidnumber='+document.forms[0].uidnumber.value+'&listSearch='+listSearch, handler_get_available_users); 
    175         }else 
    176                 document.getElementById('ea_input_searchUser').value = ''; 
     182        var url = '$this.ldap_functions.get_available_users_and_maillist&denied_uidnumber=' + document.forms[0].uidnumber.value; 
     183         
     184        optionFind( 'ea_input_searchUser', 'ea_select_available_users', url, 
     185                    'ea_combo_org_maillists', 'ea_span_searching' ); 
    177186} 
    178187 
     
    301310 
    302311// Funcoes 
    303 /*function optionFinderTimeout(obj) 
    304 { 
    305         clearTimeout(finderTimeout);     
    306         var oWait = document.getElementById("ea_span_searching"); 
    307         oWait.innerHTML = get_lang('Searching') + '...'; 
    308         finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500); 
    309 }*/ 
    310  
    311 function optionFinderTimeout(obj, numMin, type, autoSearch,listSearch){ 
    312         var oWait = document.getElementById("ea_span_searching"); 
    313         oWait.innerHTML = 'Buscando...'; 
    314         clearTimeout(finderTimeout);             
    315          
    316         if(autoSearch == "True"){ 
    317                 finderTimeout = setTimeout("optionFinderLocal('"+obj.id+"')",600); 
    318         } 
    319         else if (obj.value.length >= numMin){ 
    320                 finderTimeout = setTimeout("optionFinderLdap('"+obj.id+"','"+numMin+"','"+type+"','"+listSearch+"')",600); 
    321         }else { 
    322                 oWait.innerHTML = 'Mínimo de '+numMin+' letras para pesquisa'; 
    323                 var select_available_users_tmp = document.getElementById('ea_select_available_users'); 
    324                 for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    325                 select_available_users_tmp.options[i--] = null; 
    326         } 
    327 } 
    328 var handler_get_available_users = function(data) 
    329         { 
    330                 select_available_users = document.getElementById('ea_select_available_users'); 
    331                  
    332                 //Limpa o select 
    333                 for(var i=0; i<select_available_users.options.length; i++) 
    334                 { 
    335                         select_available_users.options[i] = null; 
    336                         i--; 
    337                 } 
    338  
    339                 if ((data) && (data.length > 0)) 
    340                 { 
    341                         // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 
    342                         select_available_users.innerHTML = '&nbsp;' + data; 
    343                         select_available_users.outerHTML = select_available_users.outerHTML; 
    344                          
    345                         select_available_users.disabled = false; 
    346                         select_available_users_clone = document.getElementById('ea_select_available_users').cloneNode(true); 
    347                         //document.getElementById('ea_input_searchUser').value = ''; 
    348                 } 
    349          
    350         } 
    351 // Pesquisa LDAP 
    352 function optionFinderLdap(id,numMin, type,listSearch){ 
    353         var oWait = document.getElementById("ea_span_searching"); 
    354         var oText = document.getElementById(id); 
    355          
    356         if (oText.value.length < numMin) { 
    357                 oWait.innerHTML = ''; 
    358                 var select_available_users_tmp = document.getElementById('ea_select_available_users'); 
    359                 for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    360                         select_available_users_tmp.options[i--] = null; 
    361         } 
    362          
    363         if (oText.value.length >= numMin){ 
    364                 var context = document.getElementById('ea_combo_org_maillists').value; 
    365                 recursive = document.getElementById("ea_check_allUsers").checked; 
    366                 cExecute ('$this.ldap_functions.search_available_users_and_maillist&context='+(context)+'&recursive='+(recursive)+'&type='+(type == '' ? 'list' : 'search')+'&filter='+oText.value+'&listSearch='+listSearch, handler_get_available_users); 
    367                 oWait.innerHTML = '&nbsp;'; 
    368         } 
    369 } 
    370  
    371 function optionFinderLocal(id) { 
    372         var oWait = document.getElementById("ea_span_searching"); 
    373         var oText = document.getElementById(id); 
    374                  
    375         //Limpa todo o select 
    376         var select_available_users_tmp = document.getElementById('ea_select_available_users') 
    377  
    378         for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    379                 select_available_users_tmp.options[i--] = null; 
    380  
    381         var RegExp_name = new RegExp("\\b"+oText.value, "i"); 
    382          
    383         //Inclui usuário começando com a pesquisa 
    384         for(i = 0; i < select_available_users_clone.length; i++){ 
    385                 if ( RegExp_name.test(select_available_users_clone[i].text) || (select_available_users_clone[i].value == -1) ) 
    386                 { 
    387                         sel = select_available_users_tmp.options; 
    388                         option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); 
    389  
    390                         if (select_available_users_clone[i].value == -1) 
    391                                 option.disabled = true; 
    392  
    393                         sel[sel.length] = option; 
    394                 } 
    395         } 
    396         oWait.innerHTML = '&nbsp;'; 
     312function optionFinderTimeout(obj, event) 
     313{ 
     314    if( event && event.keyCode !== 13 ) 
     315        return; 
     316         
     317        optionFinder( obj.id ); 
     318} 
     319function optionFinder(id) { 
     320        get_available_users(); 
    397321}                        
    398322 
Note: See TracChangeset for help on using the changeset viewer.