Ignore:
Timestamp:
05/20/09 16:08:06 (15 years ago)
Author:
niltonneto
Message:

Ticket #480 - Inclusão dos grupos LDAP na busca do Catálogo Geral.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r752 r880  
    296296                                case 'get_catalog_participants_list': 
    297297                                        echo serialize($this->get_catalog_participants_list($_POST['id'])); 
     298                                        return; 
     299                                 
     300                                case 'get_catalog_participants_group': 
     301                                        echo serialize($this->get_catalog_participants_group($_POST['id'])); 
    298302                                        return; 
    299303 
     
    701705                                                                 * Restrict the returned contacts in a "first letter" search 
    702706                                                                 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 
    703                                                                  * phpgwAccountVisible != -1 and objectClass = inetOrgPerson 
     707                                                                 * phpgwAccountVisible != -1 
    704708                                                                 */ 
    705709                                                                1 => array( 
     
    717721                                                                        'type'  => '!=', 
    718722                                                                        'value' => '-1' 
    719                                                                 ), 
    720                                                                 4 => array( 
    721                                                                         'field' => 'contact.object_class', 
    722                                                                         'type'  => '=', 
    723                                                                         'value' => 'inetOrgPerson' 
    724                                                                 ), 
     723                                                                ) 
    725724                                                        ); 
    726725                                                        // If not external catalog get only phpgwAccountType = u ou l 
     
    745744                                                                                        'type'  => '=', 
    746745                                                                                        'value' => 'l' 
     746                                                                                        ), 
     747                                                                                        3 => array( 
     748                                                                                        'field' => 'contact.account_type', 
     749                                                                                        'type'  => '=', 
     750                                                                                        'value' => 'g' 
    747751                                                                                        ) 
    748752                                                                                ) 
     
    756760                                                                 * Restrict the returned contacts in a "first number" search 
    757761                                                                 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 
    758                                                                  * phpgwAccountVisible != -1 and objectClass = inetOrgPerson 
     762                                                                 * phpgwAccountVisible != -1 
    759763                                                                 */ 
    760764                                                                0 => array( 
     
    774778                                                                ), 
    775779                                                                3 => array( 
    776                                                                         'field' => 'contact.object_class', 
    777                                                                         'type'  => '=', 
    778                                                                         'value' => 'inetOrgPerson' 
    779                                                                 ), 
    780                                                                 4 => array( 
    781780                                                                        'type'  => 'branch', 
    782781                                                                        'value' => 'OR', 
     
    852851                                                                                'value' => 'i' 
    853852                                                                                ), 
    854                                                                                 /*1 => array( 
    855                                                                                 'field' => 'contact.account_type', 
    856                                                                                 'type'  => '=', 
    857                                                                                 'value' => 'g' 
    858                                                                                 ),*/ 
    859853                                                                                2 => array( 
    860854                                                                                'field' => 'contact.account_type', 
    861855                                                                                'type'  => '=', 
    862856                                                                                'value' => 'l' 
     857                                                                                ), 
     858                                                                                3 => array( 
     859                                                                                'field' => 'contact.account_type', 
     860                                                                                'type'  => '=', 
     861                                                                                'value' => 'g' 
    863862                                                                                ) 
     863                                                                                 
    864864                                                                        ) 
    865865                                                                ); 
     
    12571257                                                $final[3][$i][6] = $ids[$i]; 
    12581258 
    1259                                         //      If contact is a public list, then load the forwarding addresses. 
    1260                                                 if($contact['account_type'][0] == 'l') 
    1261                                                         $final[3][$i][7] = array(); 
     1259                                        //      If contact is a public list or a group, then load the forwarding addresses. 
     1260                                                if($contact['account_type'][0] == 'l' || $contact['account_type'][0] == 'g') 
     1261                                                        $final[3][$i][7] = ($contact['account_type'][0] == 'l' ? 'list' : 'group'); 
    12621262                                                         
    12631263                                                if($this->page_info['actual_catalog']['class']=='bo_shared_people_manager') { 
     
    23172317                                        /* 
    23182318                                         * Restrict the returned contacts search to objectClass = phpgwAccount, 
    2319                                          * must have attibute phpgwAccountStatus, phpgwAccountVisible != -1 and 
    2320                                          * objectClass = inetOrgPerson 
     2319                                         * must have attibute phpgwAccountStatus, phpgwAccountVisible != -1 
    23212320                                         */ 
    23222321                                        $rules = array( 
     
    23362335                                                        'value' => '-1' 
    23372336                                                ), 
    2338                                                 3 => array( 
    2339                                                         'field' => 'contact.object_class', 
    2340                                                         'type'  => '=', 
    2341                                                         'value' => 'inetOrgPerson' 
    2342                                                 ) 
    23432337                                        ); 
    23442338                                } 
     
    27622756                }        
    27632757                 
     2758                function get_catalog_participants_group($id)  
     2759                { 
     2760                        if(!$this->bo->catalog->src_info) { 
     2761                                $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
     2762                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
     2763                        }                        
     2764                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);                       
     2765                        $justThese = array("description","memberuid");                   
     2766                        $sr = ldap_read($ds,$id, "objectClass=*",$justThese);                                                    
     2767                        $info = ldap_get_entries($ds, $sr); 
     2768                        $member_uids = $info[0]['memberuid']; 
     2769                        $contact['names_ordered'] = $info[0]['description']; 
     2770                        $filter = "";                    
     2771                        for($z = 0; $z < count($member_uids); $z++) { 
     2772                                if($member_uids[$z]) 
     2773                                        $filter.="(uid=".$member_uids[$z].")";   
     2774                        } 
     2775                        $array_participants = array(); 
     2776                        if($filter) { 
     2777                                $filter = "(|".$filter.")"; 
     2778                                $dn=$this->bo->catalog->src_info['dn']; 
     2779                                $justThese = array("cn","mail"); 
     2780                                $sr = ldap_search($ds,$dn, $filter,$justThese);                                                          
     2781                                $info = ldap_get_entries($ds, $sr);                                                      
     2782                                for($z = 0; $z < $info['count']; $z++) { 
     2783                                        $participant =  '<font color=\'DARKBLUE\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;'.$info[$z]['cn'][0].'&quot; &lt;'.$info[$z]['mail'][0].'&gt;</font><br>'; 
     2784                                        $array_emails[$info[$z]['mail'][0]] = null;                                                              
     2785                                        array_push($array_participants, $participant);                                   
     2786                                } 
     2787                                ldap_close($ds); 
     2788                        }                        
     2789                        sort($array_participants); 
     2790                        $innerHTML = '';                         
     2791                        foreach($array_participants as $index => $participant){ 
     2792                                $innerHTML .= $participant; 
     2793                        } 
     2794                        $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML);                   
     2795                        echo serialize($return); 
     2796                } 
     2797 
    27642798                function get_catalog_participants_list($id)  
    27652799                { 
     
    27722806                        $array_participants = array(); 
    27732807                        $array_emails = array(); 
    2774                          
     2808 
    27752809                        $filter = null; 
    27762810                        for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) {                   
     
    27892823                                        $this->bo->catalog->src_info = $ldap->srcs[1]; 
    27902824                                } 
    2791                                 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);                               
     2825                                $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 
     2826                                 
    27922827                                $dn=$this->bo->catalog->src_info['dn']; 
    27932828                                $justThese = array("cn","mail"); 
Note: See TracChangeset for help on using the changeset viewer.