Changeset 880


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.

Location:
trunk/contactcenter
Files:
5 edited

Legend:

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

    r400 r880  
    132132                         
    133133                        $filter = $this->process_restrictions($rules, $trans_f); 
    134  
     134                        // Find objects where 'mail' attribute is not null. 
     135                        $filter = "(&".$filter."(mail=*))"; 
    135136                        if("ou" === strtolower(substr($this->src_info['context'], 0, 2)) || 
    136                                 (trim($rules[4]['value']) != "inetOrgPerson"))   
     137                                (trim($rules[0]['value']) == "phpgwAccount"))    
    137138                        {                        
    138139                                $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 
  • trunk/contactcenter/inc/class.bo_ldap_manager.inc.php

    r588 r880  
    4545                                                'acc'    => $data['cc_ldap_browse_dn0'], 
    4646                                                'pw'     => $data['cc_ldap_pw0'], 
    47                                                 'obj'    => 'inetOrgPerson', 
     47                                                'obj'    => 'phpgwAccount', 
    4848                                                'branch' => strtolower('ou'), 
    4949                                                'visible' => $data['cc_ldap_query_automatic'] 
  • 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"); 
  • trunk/contactcenter/js/cc.js

    r752 r880  
    19581958 
    19591959                                                        case 'cc_forwarding_address': 
    1960                                                                 var contacts = data[3][pos][k]; 
    1961                                                                                                                                  
    1962                                                                 if( !contacts) 
     1960                                                                var account_type = data[3][pos][k]; 
     1961                                                                                                                         
     1962                                                                if( !account_type) 
    19631963                                                                        break; 
    1964                                                                                                                                                                                                                                                                                                                                  
    1965                                                                 Element(id+':cc_icon_group').innerHTML =  '<span title="'+Element('cc_participants').value+'"  onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/people-mini.png" align="center">&nbsp;&nbsp;</span>'; 
     1964                                                                                                                                                                                                                                                                                                                                                                                                                                         
     1965                                                                Element(id+':cc_icon_group').innerHTML =  '<span title="'+Element('cc_participants').value+'"  onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\',null,null,null,\''+account_type+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/people-mini.png" align="center">&nbsp;&nbsp;</span>'; 
    19661966                                                                break; 
    19671967 
  • trunk/contactcenter/js/ccListParticipants.js

    r24 r880  
    1919 
    2020         
    21 cListParticipants.prototype.showList = function(id, contact, email, title){ 
     21cListParticipants.prototype.showList = function(id, contact, email, title, account_type){ 
    2222        _this = this; 
    2323         
    2424        id = id; 
    25          
     25 
    2626        div = document.getElementById(id+':cc_rectParticipants'); 
    2727        var el = document.createElement("DIV");                                                                  
     
    9393                                _this.showWindow(el); 
    9494                        }                
    95                                  
     95 
    9696                        if(div) 
    9797                                this.showWindow(div); 
    9898                        else 
    99                                 Connector.newRequest('get_catalog_participants_list', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_catalog_participants_list', 'POST', handler, 'id='+id); 
     99                                Connector.newRequest('get_catalog_participants_'+account_type , '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_catalog_participants_'+account_type, 'POST', handler, 'id='+id); 
    100100                } 
    101101        } 
Note: See TracChangeset for help on using the changeset viewer.