Ignore:
Timestamp:
11/13/09 13:40:27 (14 years ago)
Author:
niltonneto
Message:

Ticket #745 - Corrigido problema que não respeita configuração do módulo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/templates/classic/js/edit_exmail.js

    r1587 r1639  
    2121var agt = navigator.userAgent.toLowerCase(); 
    2222var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false; 
    23          
    2423/* 
    2524        Semelhante a função get_avaiable_users, porém trás apenas usuários, ignorando os grupos... 
     
    5554} 
    5655 
    57 function get_available_users(filter,autoSearch) 
    58 //function get_available_users(path,context,type) 
    59 { 
    60         text= document.getElementById("cal_input_searchUser"); 
    61          
    62         var handler_get_available_users = function(data) 
    63         {        
    64                 select_available_users = document.getElementById('user_list_in'); 
     56var handler_get_available_users = function(data) 
     57{        
     58        select_available_users = Element('user_list_in'); 
     59         
     60        for(var i=0; i<select_available_users.options.length; i++){ 
     61                select_available_users.options[i] = null; 
     62                i--; 
     63        } 
     64        var options = '###'; 
     65        if (data) { 
     66                if(data.groups && data.groups.length > 0) { 
     67                        data.groups = '<option  value="-1" disabled>------------------- '+Element("txt_groups").value+' ------------------ </option>' + data.groups; 
     68                }                
     69                if(data.users && data.users.length > 0) { 
     70                        data.users = '<option  value="-1" disabled>------------------- '+Element("txt_users").value+' ------------------ </option>' + data.users; 
     71                } 
     72                options +=  data.groups && data.groups.length > 0 ? data.groups : ''; 
     73                options +=  data.users  && data.users.length  > 0 ? data.users  : ''; 
    6574                 
    66                 for(var i=0; i<select_available_users.options.length; i++){ 
    67                         select_available_users.options[i] = null; 
    68                         i--; 
    69                 } 
    70                 var options = '###'; 
    71                 if (data) { 
    72                         if(data.groups && data.groups.length > 0) { 
    73                                 data.groups = '<option  value="-1" disabled>------------------- '+document.getElementById("txt_groups").value+' ------------------ </option>' + data.groups; 
    74                         } 
    75                          
    76                         if(data.users && data.users.length > 0) { 
    77                                 data.users = '<option  value="-1" disabled>------------------- '+document.getElementById("txt_users").value+' ------------------ </option>' + data.users; 
    78                         } 
    79                         options +=  data.groups && data.groups.length > 0 ? data.groups : ''; 
    80                         options +=  data.users  && data.users.length  > 0 ? data.users  : ''; 
    81                          
    82                         if(is_firefox_0) 
    83                                 fixBugInnerSelect(select_available_users,options); 
    84                         else 
    85                                 select_available_users.innerHTML = options; 
    86  
    87                         select_available_users.outerHTML = select_available_users.outerHTML; 
    88                         select_available_users.disabled = false; 
    89                         select_available_users_clone = document.getElementById('user_list_in').cloneNode(true); 
    90                         //document.getElementById('cal_input_searchUser').value = ''; 
    91                 } 
    92         }        
    93                 context = document.getElementById('combo_org').value; 
    94                 cExecute ('expressoMail1_2'+'.ldap_functions.search_users&filter='+filter+'&context='+context+'&type=search', handler_get_available_users); 
    95                  
    96                 if((autoSearch == 'True') && (!text.value)){ 
    97                         var search = " "; 
    98                         get_available_users(search); 
    99                 } 
    100                 //cExecute (path+'.ldap_functions.get_available_users&context='+context+'&type='+type, handler_get_available_users); 
    101 } 
    102  
    103 function optionFinderTimeout(obj,numMin){ 
    104                 var oWait = document.getElementById("cal_span_searching"); 
    105                 clearTimeout(finderTimeout); 
    106                 if (obj.value.length >= numMin){                                 
    107                         oWait.innerHTML = 'Buscando...'; 
    108                         finderTimeout = setTimeout("optionFinder('"+obj.id+"','"+numMin+"')",500); 
    109                 }else { 
    110                         oWait.innerHTML = 'Mínimo de '+numMin+' letras para pesquisa'; 
    111                         var select_available_users_tmp = document.getElementById('user_list_in'); 
    112                         for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    113                         select_available_users_tmp.options[i--] = null; 
    114                 } 
    115 } 
    116          
    117 function optionFinder(id,numMin){ 
    118          
    119                 var oWait = document.getElementById("cal_span_searching"); 
    120                 var oText = document.getElementById(id); 
     75                if(is_firefox_0) 
     76                        fixBugInnerSelect(select_available_users,options); 
     77                else 
     78                        select_available_users.innerHTML = options; 
     79 
     80                select_available_users.outerHTML = select_available_users.outerHTML; 
     81                select_available_users.disabled = false; 
     82                select_available_users_clone = Element('user_list_in').cloneNode(true);          
     83        } 
     84}        
     85 
     86function get_available_users(module,context,type, autoSearch){ 
     87        Element('cal_input_searchUser').value = ''; 
     88        if(autoSearch != 'True'){ 
     89                return true; 
     90        } 
     91        var context = document.getElementById('combo_org').value;        
     92        cExecute (module+'.ldap_functions.get_available_users&context='+context+'&type='+type, handler_get_available_users); 
     93} 
     94 
     95function optionFinderTimeout(obj, numMin, type, autoSearch){ 
     96        var oWait = Element("cal_span_searching"); 
     97        oWait.innerHTML = 'Buscando...'; 
     98        clearTimeout(finderTimeout);             
     99         
     100        if(autoSearch == "True"){ 
     101                finderTimeout = setTimeout("optionFinderLocal('"+obj.id+"')",500); 
     102        } 
     103        else if (obj.value.length >= numMin){ 
     104                finderTimeout = setTimeout("optionFinderLdap('"+obj.id+"','"+numMin+"','"+type+"')",500); 
     105        }else { 
     106                oWait.innerHTML = 'Mínimo de '+numMin+' letras para pesquisa'; 
     107                var select_available_users_tmp = document.getElementById('user_list_in'); 
     108                for(var i = 0;i < select_available_users_tmp.options.length; i++) 
     109                select_available_users_tmp.options[i--] = null; 
     110        } 
     111} 
     112// Pesquisa Javascript 
     113function optionFinderLocal(id){ 
     114        var oText = Element(id); 
     115        var oWait = Element("cal_span_searching"); 
     116        var select_available_users_tmp = Element('user_list_in'); 
     117        for(var i = 0;i < select_available_users_tmp.options.length; i++) 
     118                select_available_users_tmp.options[i--] = null; 
     119        var RegExp_name = new RegExp("\\b"+oText.value, "i"); 
     120 
     121        for(i = 0; i < select_available_users_clone.length; i++){ 
     122                if (RegExp_name.test(select_available_users_clone[i].text) || select_available_users_clone[i].value =="-1") 
     123                { 
     124                        sel = select_available_users_tmp.options; 
     125                        option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); 
     126                        if( select_available_users_clone[i].value == "-1") option.disabled = true; 
     127                        sel[sel.length] = option; 
     128                } 
     129        } 
     130        oWait.innerHTML = '&nbsp;';      
     131} 
     132 
     133// Pesquisa LDAP 
     134function optionFinderLdap(id,numMin, type){ 
     135                var oWait = Element("cal_span_searching"); 
     136                var oText = Element(id); 
    121137                         
    122138                if (oText.value.length < numMin) { 
     
    127143                } 
    128144                 
    129                 if (oText.value.length >= numMin) { 
    130                         get_available_users(oText.value); 
    131                  
    132                         var select_available_users_tmp = document.getElementById('user_list_in'); 
    133                         for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    134                                 select_available_users_tmp.options[i--] = null; 
    135                         var RegExp_name = new RegExp("\\b"+oText.value, "i"); 
    136          
     145                if (oText.value.length >= numMin){ 
     146                        var context = document.getElementById('combo_org').value; 
     147                        cExecute ('expressoMail1_2.ldap_functions.search_users&context='+(context)+'&type='+(type == '' ? 'list' : 'search')+'&filter='+oText.value, handler_get_available_users); 
    137148                        oWait.innerHTML = '&nbsp;'; 
    138149                } 
    139150} 
    140         function autoOptionFinder(){ 
    141                 var oWait = document.getElementById("cal_span_searching"); 
    142                 var oText = document.getElementById(id); 
    143                 var select_available_users_tmp = document.getElementById('user_list_in'); 
    144                 for(var i = 0;i < select_available_users_tmp.options.length; i++) 
    145                         select_available_users_tmp.options[i--] = null; 
    146                 var RegExp_name = new RegExp("\\b   ", "i"); 
    147                 oWait.innerHTML = '&nbsp;'; 
    148         } 
    149151 
    150152function add_user() 
     
    427429        } 
    428430}; 
    429  
Note: See TracChangeset for help on using the changeset viewer.