Changeset 381


Ignore:
Timestamp:
07/30/08 16:54:18 (16 years ago)
Author:
niltonneto
Message:

Ver Ocorrência #275 do Trac;

Location:
trunk/expressoMail1_2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.ldap_functions.inc.php

    r371 r381  
    150150                                        $return = array(); 
    151151                                        $return['status'] = false; 
    152                                         $return['error'] = "many results"; 
     152                                        $return['error'] = "many results";                                       
    153153                                        return $return; 
    154154                                } 
     
    393393                $error = False; 
    394394                 
    395                 $this->ldapConnect(false,$catalog); 
     395                $this->ldapConnect(true,$catalog); 
    396396                 
    397397                $params['organization'] == 'all' ? $user_context = $this->ldap_context :$user_context = $this->branch."=".$params['organization'].",".$this->ldap_context;               
     
    410410                        } 
    411411                         
    412                         $sr=@ldap_search($this->ds, $user_context, $filter, $justthese, 0, $this->max_result+1); 
     412                        $sr=@ldap_search($this->ds, $user_context, $filter, $justthese, 0, $max_result+1); 
    413413                        if(!$sr) 
    414414                                return null; 
    415415                        $count_entries = ldap_count_entries($this->ds,$sr); 
    416                         if ($count_entries > $this->max_result){ 
     416                        if ($count_entries > $max_result){ 
    417417                                $info = null; 
    418                                 $error = True;                                           
     418                                $error = True;                                   
    419419                        } 
    420420                        else 
     
    430430                                        //aqui eh feita a concatenacao do departamento ao cn; 
    431431                                        $u_tmp[$info[$i]["mail"][0]] = utf8_decode($info[$i]["cn"][0]). '%' . $info[$i]["ou"][0]; 
    432                                 else 
     432                                if((!$catalog==0)||(strtoupper($info[$i]["phpgwaccounttype"][0]) == 'L') && ($info[$i]["phpgwaccountvisible"][0] != '-1'))                                                       
    433433                                        $g_tmp[$info[$i]["mail"][0]] = utf8_decode($info[$i]["cn"][0]); 
    434434                        }                                                                                
     
    655655                         
    656656                        if($entry) {                                             
    657                                 $obj =  array("cn" => utf8_decode(ldap_get_values($ds, $entry, "cn")), 
     657                                $obj =  array("cn" => utf8_decode(current(ldap_get_values($ds, $entry, "cn"))), 
    658658                                                  "email" => $params['email'], 
    659659                                                  "uid" => ldap_get_values($ds, $entry, "uid"), 
  • trunk/expressoMail1_2/index.php

    r373 r381  
    2828                'nonavbar' => False, 
    2929                'currentapp' => 'expressoMail1_2', 
    30                 'update_version'        => '1.230', 
     30                'update_version'        => '1.231', 
    3131                'enable_nextmatchs_class' => True 
    3232        ); 
  • trunk/expressoMail1_2/js/QuickCatalogSearch.js

    r353 r381  
    1010                id = '1'; 
    1111                _this = this; 
    12  
    1312                var el = document.createElement("DIV"); 
    1413                el.style.visibility = "hidden"; 
     
    236235                                           '<table border="0" cellpading="0" cellspacing="0">'+ 
    237236                                           '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+'&nbsp;:</td></tr>'+ 
    238                                         '<tr><td><select style="width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+ 
    239                                         '<select id="select_organization" style="width:100px" name="select_organization"></select>&nbsp;'+    
    240                                         '<input type="text" id="search_for" name="search_for" value="" size="30" maxlength="20"/>&nbsp;<input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'">&nbsp;<input style="display:none" type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+ 
    241                                            //'<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+'&nbsp;&nbsp;<input type="radio" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+ 
     237                                        '<tr><td><select style="display:none;width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select>&nbsp'+ 
     238                                        '<select id="select_organization" style="width:150px" name="select_organization"></select>&nbsp;'+    
     239                                        '<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>'+ 
     240                                           '<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;'+ 
    242241                                           '<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>'+ 
    243242                                           '<tr><td>'+ 
    244                                            '<span id="list_span"><select multiple style="display:none;width:450px" size="14" id="list_values"></select></span>'+ 
     243                                           '<span id="list_span"><select multiple style="display:none;width:580px" size="14" id="list_values"></select></span>'+ 
    245244                                           '<span id="user_span"><select multiple style="width:580px" size="14" id="user_values"></select></span>'+ 
    246245                                           '</td></tr>'+ 
     
    255254                                           '<table border="0" cellpading="0" cellspacing="0">'+ 
    256255                                           '<tr><td>'+get_lang("Select the type of contact that you want to view")+'&nbsp;:</td></tr>'+ 
    257                                            '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" 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;'+ 
     256                                           '<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;'+ 
    258257                                           '<tr><td>'+ 
    259                                            '<span id="personal_span"><select multiple style="width:400px" size="14" id="list_personal"></select></span>'+ 
    260                                            '<span id="groups_span"><select multiple style="display:none;width:400px" size="14" id="list_groups"></select></span>'+ 
     258                                           '<span id="personal_span"><select multiple style="width:580px" size="14" id="list_personal"></select></span>'+ 
     259                                           '<span id="groups_span"><select multiple style="display:none;width:580px" size="14" id="list_groups"></select></span>'+ 
    261260                                           '</td></tr>'+ 
    262261                                           '<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;'+ 
     
    295294 
    296295                var handler_catalogs = function(data){ 
    297                         var user_catalog = "Catalogo Geral"; 
    298  
    299                         if(data.length <= 1)  
    300                                 Element('select_catalog').style.display = 'none'; 
    301                         else { 
     296                        var user_catalog = get_lang("Global Catalog"); 
     297                        if(data.length > 1) { 
     298                                Element('select_catalog').style.display = ''; 
    302299                                for(i = 0; i < data.length; i++) {               
    303300                                        Element('select_catalog').options[i] = new Option(data[i],i); 
     
    380377                } 
    381378                var handler_org = function(data){ 
    382                         Element('select_organization').options[0] = new Option(get_lang('all'),'all'); 
     379                        Element('select_organization').options[0] = new Option(get_lang('all'),'all'); 
    383380                        if (data != null){ 
    384                          
    385                         for(x = 0; x < data.length; x++) { 
    386                                 Element('select_organization').options[x+1] = new Option(data[x].toUpperCase(),data[x]); 
    387                                 } 
    388                         } 
    389                          
     381                                var user_organization = Element('user_organization').value; 
     382                                for(x = 0; x < data.length; x++) { 
     383                                        Element('select_organization').options[x+1] = new Option(data[x].toUpperCase(),data[x]); 
     384                                        if(user_organization.toUpperCase() == data[x].toUpperCase()) 
     385                                                Element('select_organization').options[x+1].selected = true; 
     386                                } 
     387                        } 
    390388                }                
    391389                cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org);                
     
    461459                var search               = itemSearch ? Element('search_for').value : ''; 
    462460                var catalog              = Element('select_catalog').value; 
    463                 var max_result   = 300; 
     461                var max_result  = 300; 
    464462 
    465463                var handler_searchResults = function(data){ 
    466  
    467464                        Element('msg_search').style.visibility = 'hidden'; 
    468465                        if(data.error){ 
    469466                                alert(get_lang('More than %1 results. Please, try to refine your search.',max_result)); 
    470467                                return false; 
    471                         } 
     468                        }else if(data.users.length == 0 && data.groups.length == 0){ 
     469                                alert(get_lang('None result was found.')); 
     470                        } 
     471 
    472472                         
    473473                        var group = Element('list_span'); 
     
    487487 
    488488                        var arr         = new Array(max_result); 
    489                         var display     = Element('type').value == 'l'? 'display:none;' : ''; 
    490  
    491                         for(i = 0; data.groups && i < data.groups.length; i++) {                         
     489 
     490                        for(i = 0; data.groups && i < data.groups.length; i++) { 
     491                                // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento. 
    492492                                if(is_ie) 
    493493                                        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>'; 
     
    496496                        } 
    497497         
     498                         
    498499                        if(is_ie) 
    499                                 group.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="list_values">'+ arr.join() +'</select>'; 
     500                                group.innerHTML = '<select multiple style="display:none;width:580px" size="14" id="list_values">'+ arr.join() +'</select>'; 
    500501 
    501502                        arr = new Array(max_result); 
    502                         display = display ? "" : "display:none;"; 
    503                          
    504                         for(i = 0; data.users && i < data.users.length; i++) {                   
     503                         
     504                        for(i = 0; data.users && i < data.users.length; i++) { 
     505                        /*******************************************************************************************/ 
     506                        /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela, 
     507                        ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o 
     508                        resultado apresentado em tela sera exibido de maneira mais apresentavel; 
     509                        */ 
     510                                //verifica se departamento eh null ou nao; 
     511                                var department = data.users[i].department ? " - " + data.users[i].department : ""; 
     512                                //verifica se email eh null ou nao; 
     513                                var email = data.users[i].email ? data.users[i].email : ""; 
     514 
     515                                // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento. 
    505516                                if(is_ie) 
    506                                         arr[i] = '<option value="'+'&quot;'+data.users[i].name+'&quot; &lt;'+data.users[i].email+'&gt;">'+data.users[i].name+' ('+data.users[i].email+')'+'</option>'; 
     517                                        arr[i] = '<option value="'+'&quot;'+data.users[i].name+'&quot; &lt;'+email+'&gt;">'+data.users[i].name+' ('+email+')'+department+'</option>'; 
    507518                                else { 
    508                                 /*******************************************************************************************/ 
    509                                 /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela, 
    510                                 ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o 
    511                                 resultado apresentado em tela sera exibido de maneira mais apresentavel; 
    512                                 */ 
    513                                         //verifica se departamento eh null ou nao; 
    514                                         var departamento_nulo = 'false'; 
    515                                         if((data.users[i].department == null) || (data.users[i].department == '')) { 
    516                                                 data.users[i].department = ''; 
    517                                                 departamento_nulo = 'true'; 
    518                                         } 
    519                                         else { 
    520                                                 data.users[i].department = ' - ' + data.users[i].department; 
    521                                         } 
    522  
    523                                         //verifica se email eh null ou nao; 
    524                                         if((data.users[i].email == null) || (data.users[i].email == '')) { 
    525                                                 if(departamento_nulo = 'true') { 
    526                                                         data.users[i].email = ''; 
    527                                                 } 
    528                                                 else { 
    529                                                         data.users[i].email = ' - '; 
    530                                                 } 
    531                                         } 
    532                                         else { 
    533                                                 data.users[i].email = ' (' + data.users[i].email + ') '; 
    534                                         } 
    535  
    536                                         user.options[i] = new Option(data.users[i].name+data.users[i].email+data.users[i].department,'"'+data.users[i].name+'" <'+data.users[i].email+'>'); // incluido data.users[i].department para exibir setor na opcao "Pesquisar" do email; 
     519                                        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; 
    537520                                } 
    538521                        } 
    539522         
    540523                        if(is_ie) 
    541                                 user.innerHTML = '<select multiple style="'+display+'width:400px" size="14" id="user_values">'+ arr.join() +'</select>'; 
     524                                user.innerHTML = '<select multiple style="width:580px" size="14" id="user_values">'+ arr.join() +'</select>'; 
     525 
     526                        // Display entries found. 
     527                        var type = (data.groups.length > 0 && data.users.length == 0) ? 'l' : 'u'; 
     528                        Element("type_"+type).checked = true; 
     529                        QuickCatalogSearch.changeOptions(type); 
    542530                } 
    543531 
  • trunk/expressoMail1_2/js/common_functions.js

    r365 r381  
    662662 
    663663function exist_className(obj, className){ 
    664         if ( obj.className.indexOf(className) != -1 ) 
     664        if ( obj && obj.className.indexOf(className) != -1 ) 
    665665                return true; 
    666666        return false; 
  • trunk/expressoMail1_2/setup/setup.inc.php

    r373 r381  
    1212        $setup_info['expressoMail1_2']['name']          = 'expressoMail1_2'; 
    1313        $setup_info['expressoMail1_2']['title']         = 'ExpressoMail 1.2'; 
    14         $setup_info['expressoMail1_2']['version']       = '1.230'; 
     14        $setup_info['expressoMail1_2']['version']       = '1.231'; 
    1515        $setup_info['expressoMail1_2']['app_order']     = 2; 
    1616//      $setup_info['expressoMail1_2']['tables'][]      = 'phpgw_expressoMail1_2'; 
Note: See TracChangeset for help on using the changeset viewer.