Changeset 752


Ignore:
Timestamp:
04/17/09 16:34:36 (15 years ago)
Author:
niltonneto
Message:

Resolve #453 e #454 (duplicado).

Files:
2 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • tags/expressoMail1_2/1.233/inc/class.db_functions.inc.php

    r673 r752  
    1010        var $db; 
    1111        var $user_id; 
     12        var $related_ids;  
    1213         
    1314        function db_functions(){ 
     
    3031                $result = array(); 
    3132                $stringDropDownContacts = '';            
    32                 // Traz primeiro os usuarios que compartilharam com o usuario logado: 
    33                 $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1'; 
    34                 // Somente do usuario logado 
    35                 $query_related = 'A.id_owner ='.$this -> user_id; 
    36                 if (!$this->db->query($query)) 
    37                 return null;                     
    38                 while($this->db->next_record()){ 
    39                         $row = $this->db->row(); 
    40                         $result[] = $row['id_related']; 
    41                 } 
    42                 $ids_related = implode(",",$result); 
    43  
    44                 // Se houver contatos compartilhados então altera a query. 
    45                 if($ids_related)                 
    46                         $query_related = '(A.id_owner ='.$this -> user_id.' or A.id_owner in ('.$ids_related.'))'; 
     33                 
     34                $query_related = $this->get_query_related('A.id_owner'); // field name for owner 
    4735                         
    4836                // Traz os contatos pessoais e compartilhados 
     
    5038                        'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
    5139                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    52                         'and B.id_typeof_contact_connection = 1 and '.$query_related.' group by '.  
    53                         'A.names_ordered,C.connection_value     order by A.names_ordered'; 
    54  
     40                        'and B.id_typeof_contact_connection = 1 and ('.$query_related.') group by '.  
     41                        'A.names_ordered,C.connection_value     order by lower(A.names_ordered)'; 
     42                 
    5543        if (!$this->db->query($query)) 
    5644                return null; 
     
    7159                return $stringDropDownContacts; 
    7260        } 
    73          
     61        // Get Related Ids for sharing contacts or groups. 
     62        function get_query_related($field_name){                 
     63                $query_related = $field_name .'='.$this -> user_id; 
     64                // Only at first time, it gets all related ids... 
     65                if(!$this->related_ids) { 
     66                        $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1';          
     67                        if (!$this->db->query($query)){ 
     68                return $query_related; 
     69                        } 
     70                         
     71                        while($this->db->next_record()){ 
     72                                $row = $this->db->row(); 
     73                                $result[] = $row['id_related']; 
     74                        } 
     75                        if($result) 
     76                                $this->related_ids = implode(",",$result); 
     77                } 
     78                if($this->related_ids) 
     79                        $query_related .= ' or '.$field_name.' in ('.$this->related_ids.')'; 
     80                 
     81                return $query_related; 
     82        } 
    7483        function get_cc_groups()  
    7584        { 
     
    7786                $stringDropDownContacts = '';                    
    7887                $result = array(); 
    79                 $query = 'select title, short_name from phpgw_cc_groups where owner ='.$this -> user_id.' order by title'; 
     88                $query_related = $this->get_query_related('owner'); // field name for 'owner'            
     89                $query = 'select title, short_name, owner from phpgw_cc_groups where '.$query_related.' order by lower(title)'; 
     90 
    8091                // Executa a query  
    8192                if (!$this->db->query($query)) 
     
    8495                while($this->db->next_record()) 
    8596                        $result[] = $this->db->row(); 
    86                 // Se houver grupos .... 
     97 
     98                // Se houver grupos ....                                 
    8799                if (count($result) != 0)  
    88                 {        
    89                         foreach($result as $group) 
    90                                 $stringDropDownContacts .=  $group['title']. ';' . $group['short_name'] . ','; 
     100                { 
     101                        // Create Ldap Object, if exists related Ids for sharing groups. 
     102                        if($this->related_ids){ 
     103                                $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids']= array(); 
     104                                include_once("class.ldap_functions.inc.php"); 
     105                                $ldap = new ldap_functions(); 
     106                        } 
     107                        foreach($result as $group){ 
     108                                // Searching uid (LDAP), if exists related Ids for sharing groups. 
     109                                // Save into user session. It will used before send mail (verify permission). 
     110                                if(!$_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']] && $ldap){                                        
     111                                        $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']] = $ldap -> uidnumber2uid($group['owner']); 
     112                                } 
     113                                if($this->user_id != $group['owner']) 
     114                                        $owneruid = "::".$_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']]; 
     115 
     116                                $stringDropDownContacts .=  $group['title']. ';' . ($group['short_name'].$owneruid) . ','; 
     117                        } 
    91118                        //Retira ultima virgula. 
    92119                        $stringDropDownContacts = substr($stringDropDownContacts,0,(strlen($stringDropDownContacts) - 1)); 
    93120                } 
    94121                else 
    95                         return null; 
    96                          
     122                        return null;             
    97123                return $stringDropDownContacts; 
    98124        } 
     
    100126        function getContactsByGroupAlias($alias) 
    101127        { 
     128                list($alias,$uid) = explode("::",$alias);                
     129                $cc_related_ids = $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'];             
     130                // Explode personal group, If exists related ids (the user has permission to send email). 
     131                if(is_array($cc_related_ids) && $uid){ 
     132                        $owner =  array_search($uid,$cc_related_ids);                    
     133                } 
    102134                 
    103135                $query = "select C.id_connection, A.names_ordered, C.connection_value from phpgw_cc_contact A, ". 
     
    105137                "A.id_contact = B.id_contact and B.id_connection = C.id_connection ". 
    106138                "and B.id_typeof_contact_connection = 1 and ". 
    107                 "A.id_owner =".$this -> user_id." and ".                         
     139                "A.id_owner =".($owner ? $owner : $this->user_id)." and ".                       
    108140                "D.id_group = E.id_group and ". 
    109                 "D.id_connection = C.id_connection and E.short_name = '".$alias. 
    110                 "' order by A.names_ordered"; 
     141                "D.id_connection = C.id_connection and E.short_name = '".$alias."'"; 
    111142 
    112143                if (!$this->db->query($query)) 
     
    136167 
    137168                                $alias = substr($array_addrs[$i], strpos($array_addrs[$i],'<'), strpos($array_addrs[$i],'>'));                           
    138                                 $alias = str_replace('<','', str_replace('>','',$alias));                                                                        
     169                                $alias = str_replace('<','', str_replace('>','',$alias)); 
     170                                                                                         
    139171                                $arrayContacts = $this -> getContactsByGroupAlias($alias); 
    140172 
  • tags/expressoMail1_2/1.233/inc/class.ldap_functions.inc.php

    r657 r752  
    612612                return false; 
    613613        } 
     614        function uidnumber2uid($uidnumber) 
     615        { 
     616                // do not follow the referral 
     617                $this->ldapRootConnect(false); 
     618                if ($this->ds) 
     619                { 
     620                        $filter="(&(phpgwAccountType=u)(uidnumber=$uidnumber))"; 
     621                        $justthese = array("uid"); 
     622                        $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 
     623                        if(!$sr) 
     624                                return false; 
     625                        $info = ldap_get_entries($this->ds, $sr); 
     626                        return $info[0]["uid"][0]; 
     627                } 
     628                return false; 
     629        } 
    614630        function getSharedUsersFrom($params){ 
    615631                $filter = ''; 
  • trunk/contactcenter/inc/class.bo_contactcenter.inc.php

    r498 r752  
    350350                        if($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['shared_contacts']){ 
    351351                                $this->tree[2] = array('type' => 'sql'); 
    352                                 $this->tree['branches'][2] = array('name' => lang('Shared'), 
    353                                                                                 'type'       => 'catalog', 
    354                                                                                 'class'      => 'bo_shared_catalog_manager', 
     352                                $this->tree['branches'][2] = array( 
     353                                                                                'name' => lang('Shared'), 
     354                                                                                'type'       => 'mixed_catalog_group', 
     355                                                                                'class'      => 'bo_shared_people_manager', 
    355356                                                                                'icon'       => 'people-mini.png', 
    356                                                                                 'sub_branch' => false); 
     357                                                                                'sub_branch' => array(  
     358                                                                                        0 =>    array(   
     359                                                                                                'name'  => lang('People'), 
     360                                                                                                'type'  => 'catalog', 
     361                                                                                                'class' => 'bo_shared_people_manager', 
     362                                                                                                'icon'  => 'people-mini.png', 
     363                                                                                                'sub_branch' => False 
     364                                                                                        ), 
     365                                                                                        1 =>    array(   
     366                                                                                                'name'  => lang('Groups'), 
     367                                                                                                'type'  => 'catalog', 
     368                                                                                                'class' => 'bo_shared_group_manager', 
     369                                                                                                'icon'  => 'people-mini.png', 
     370                                                                                                'sub_branch' => False 
     371                                                                                        ) 
     372                                                                                ) 
     373                                                        ); 
    357374                                unset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['shared_contacts']); 
    358375                        } 
     
    419436                                        $i++; 
    420437                                } 
    421                         } 
    422                          
     438                        }        
    423439                        $GLOBALS['phpgw']->session->appsession('bo_contactcenter.tree','contactcenter',$this->tree); 
    424440                        return $this->tree['branches']; 
     
    599615                                        $level = $this->get_level_by_branch($catalog, $this->tree['branches']); 
    600616                                        $catalog =& $this->get_catalog_tree($level); 
    601  
     617                                 
    602618                                case 'catalog': 
    603619                                case 'catalog_group': 
  • trunk/contactcenter/inc/class.so_group.inc.php

    r702 r752  
    2626                function select($id = '') 
    2727                { 
    28                         $query = 'SELECT id_group,title,short_name FROM phpgw_cc_groups WHERE owner = '.$this->owner; 
    29                          
     28                        $query = 'SELECT id_group,title,short_name FROM phpgw_cc_groups '; 
    3029                        if($id != '') 
    31                                 $query .= ' AND id_group ='.$id; 
     30                                $query .= 'WHERE id_group ='.$id; 
    3231                         
    3332                        $query .= ' ORDER BY title'; 
     
    4443                                $return[] = $this->db->row();  
    4544                        } 
    46          
    4745                         
    4846                        return $return; 
     
    189187                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    190188                        'and B.id_typeof_contact_connection = 1 and '. 
    191                         'A.id_owner ='.$this->owner.' and D.id_connection = C.id_connection and D.id_group = '.$idGroup. 
     189                        //'A.id_owner ='.$this->owner.' and'. 
     190                        ' D.id_connection = C.id_connection and D.id_group = '.$idGroup. 
    192191                        ' order by A.names_ordered'; 
    193192                                                 
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r702 r752  
    7070                        if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 
    7171                                $this -> typeContact = 'groups'; 
    72                         else if($this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 
    73                                 $this -> typeContact = 'shared'; 
     72                        else if($this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 
     73                                $this -> typeContact = 'shared_groups'; 
     74                        else if($this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager') 
     75                                $this -> typeContact = 'shared_contacts'; 
    7476                        else 
    7577                                $this -> typeContact = 'contacts'; 
     
    150152                        /* Messages */ 
    151153                        $GLOBALS['phpgw']->template->set_var('cc_msg_not_allowed',lang('Not Allowed')); 
     154                        $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function'));                         
    152155                        $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); 
    153156                        $GLOBALS['phpgw']->template->set_var('cc_msg_err_no_room',lang('No Room for Cards! Increase your browser area.')); 
     
    583586                                switch ($this->page_info['actual_catalog']['class']) 
    584587                                { 
    585                                         case 'bo_shared_catalog_manager': 
     588                                        case 'bo_shared_people_manager': 
     589                                        case 'bo_people_catalog': 
    586590                                                $field_name = 'id_contact'; 
    587591 
     
    593597                                                                        'type'  => 'iLIKE', 
    594598                                                                        'value' => $letter !== 'all' ? $letter.'%' : '%' 
    595                                                                 ) 
     599                                                                )                                                                
    596600                                                        ); 
    597                                                 } 
    598                                                 else 
    599                                                 { 
    600                                                         $find_restric[0] = array( 
    601                                                                 0 => array( 
    602                                                                         'type'  => 'branch', 
    603                                                                         'value' => 'OR', 
    604                                                                         'sub_branch' => array( 
    605                                                                                 0 => array( 
    606                                                                                         'field' => 'contact.names_ordered', 
    607                                                                                         'type'  => 'LIKE', 
    608                                                                                         'value' => '0%' 
    609                                                                                 ), 
    610                                                                                 1 => array( 
    611                                                                                         'field' => 'contact.names_ordered', 
    612                                                                                         'type'  => 'LIKE', 
    613                                                                                         'value' => '1%' 
    614                                                                                 ), 
    615                                                                                 2 => array( 
    616                                                                                         'field' => 'contact.names_ordered', 
    617                                                                                         'type'  => 'LIKE', 
    618                                                                                         'value' => '2%' 
    619                                                                                 ), 
    620                                                                                 3 => array( 
    621                                                                                         'field' => 'contact.names_ordered', 
    622                                                                                         'type'  => 'LIKE', 
    623                                                                                         'value' => '3%' 
    624                                                                                 ), 
    625                                                                                 4 => array( 
    626                                                                                         'field' => 'contact.names_ordered', 
    627                                                                                         'type'  => 'LIKE', 
    628                                                                                         'value' => '4%' 
    629                                                                                 ), 
    630                                                                                 5 => array( 
    631                                                                                         'field' => 'contact.names_ordered', 
    632                                                                                         'type'  => 'LIKE', 
    633                                                                                         'value' => '5%' 
    634                                                                                 ), 
    635                                                                                 6 => array( 
    636                                                                                         'field' => 'contact.names_ordered', 
    637                                                                                         'type'  => 'LIKE', 
    638                                                                                         'value' => '6%' 
    639                                                                                 ), 
    640                                                                                 7 => array( 
    641                                                                                         'field' => 'contact.names_ordered', 
    642                                                                                         'type'  => 'LIKE', 
    643                                                                                         'value' => '7%' 
    644                                                                                 ), 
    645                                                                                 8 => array( 
    646                                                                                         'field' => 'contact.names_ordered', 
    647                                                                                         'type'  => 'LIKE', 
    648                                                                                         'value' => '8%' 
    649                                                                                 ), 
    650                                                                                 9 => array( 
    651                                                                                         'field' => 'contact.names_ordered', 
    652                                                                                         'type'  => 'LIKE', 
    653                                                                                         'value' => '9%' 
    654                                                                                 ) 
    655                                                                         ) 
    656                                                                 ) 
    657                                                         ); 
    658                                                 } 
    659                                                  
    660                                                 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 
    661                                                  
    662                                                 $find_other[0] = array( 
    663                                                         'order'  => 'contact.names_ordered' 
    664                                                 ); 
    665                                                  
    666                                                 break; 
    667                                         case 'bo_people_catalog': 
    668                                                 $field_name = 'id_contact'; 
    669  
    670                                                 if ($letter !== 'number') 
    671                                                 { 
    672                                                         $find_restric[0] = array( 
    673                                                                 0 => array( 
    674                                                                         'field' => 'contact.names_ordered', 
    675                                                                         'type'  => 'iLIKE', 
    676                                                                         'value' => $letter !== 'all' ? $letter.'%' : '%' 
    677                                                                 ), 
    678                                                                 1 => array( 
    679                                                                         'field' => 'contact.id_owner', 
    680                                                                         'type'  => '=', 
    681                                                                         'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
    682                                                                 ) 
    683                                                         ); 
     601                                                        if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){                                                          
     602                                                                $find_restric[0][1] = array( 
     603                                                                                'field' => 'contact.id_owner', 
     604                                                                                'type'  => '=', 
     605                                                                                'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
     606                                                                ); 
     607                                                        } 
    684608                                                } 
    685609                                                else 
     
    741665                                                                                ), 
    742666                                                                        ), 
    743                                                                 ), 
    744                                                                 1 => array( 
    745                                                                         'field' => 'contact.id_owner', 
    746                                                                         'type'  => '=', 
    747                                                                         'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
    748                                                                 ), 
     667                                                                ) 
    749668                                                        ); 
    750669                                                } 
     670 
     671                                                if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){                                                          
     672                                                        $find_restric[0][1]     = array( 
     673                                                                'field' => 'contact.id_owner', 
     674                                                                'type'  => '=', 
     675                                                                'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
     676                                                        ); 
     677                                                } 
     678                                                 
    751679                                                 
    752680                                                $find_field[0] = array('contact.id_contact','contact.names_ordered'); 
    753681                                                 
    754682                                                $find_other[0] = array( 
    755                                                         //'offset' => (($page-1)*$this->page_info['n_cards']), 
    756                                                         //'limit'  => $this->page_info['n_cards'], 
    757683                                                        'order'  => 'contact.names_ordered' 
    758684                                                ); 
     
    985911 
    986912                                        case 'bo_group_manager': 
    987                                          
     913                                        case 'bo_shared_group_manager': 
     914                                                                                                 
    988915                                                $field_name = 'id_group'; 
    989916                                                 
     
    1009936                                                } 
    1010937                                                 
    1011                                                 array_push($find_restric[0],  array( 
     938                                                if($this->page_info['actual_catalog']['class'] == 'bo_group_manager'){ 
     939                                                        array_push($find_restric[0],  array( 
    1012940                                                                                        'field' => 'group.owner', 
    1013941                                                                                        'type'  => '=', 
    1014942                                                                                        'value' => $GLOBALS['phpgw_info']['user']['account_id']                                                                          
    1015                                                                 ) 
    1016                                                 ); 
     943                                                                        ) 
     944                                                        ); 
     945                                                } 
    1017946                                                 
    1018947                                                $find_field[0] = array('group.id_group','group.title','group.short_name');                                               
    1019948                                                $find_other[0] = array( 
    1020949                                                        'order'  => 'group.title' 
    1021                                                 ); 
    1022                                                  
     950                                                );                                               
    1023951                                                break; 
    1024                                                  
     952                                         
    1025953                                        case 'bo_catalog_group_catalog': 
    1026954                                                $this->page_info['actual_entries'] = false; 
     
    1038966                                 
    1039967                                $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 
     968                                 
    1040969                                $n_entries = count($result); 
    1041970                                 
     
    1052981                                if (!$result) 
    1053982                                { 
     983                                         
    1054984                                        $this->page_info['actual_entries'] = false; 
    1055985                                         
     
    1068998                                        foreach ($result as $id => $value) 
    1069999                                        { 
    1070                                                 if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     1000                                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    10711001                                                        $this->page_info['actual_entries'][] = $value[$field_name]; 
    10721002                                                else 
    1073                                                         $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms']); 
     1003                                                        $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms'],2=>$value['owner']); 
    10741004                                        }  
    10751005                                        //print_r($this->page_info['actual_entries']); 
     
    11361066                                                5 => 'cc_alias', 
    11371067                                                6 => 'cc_id', 
    1138                                                 7 => 'cc_forwarding_address' 
     1068                                                7 => 'cc_forwarding_address'                                             
    11391069                                        ) 
    11401070                                ); 
     
    11471077                                //echo 'ID_I: '.$id_i.'<br>'; 
    11481078                                //echo 'ID_F: '.$id_f.'<br>'; 
    1149                                 ///---------------- Correção Temporária PHP5 -----------------------/// 
     1079                                 
    11501080                                $ids = array(); 
    11511081                                $perms = array(); 
     1082                                $owners = array(); 
    11521083                                $array_temp = array();                   
    1153                                                                  
     1084                                 
    11541085                                foreach($this->page_info['actual_entries'] as $key=>$tmp){ 
    11551086                                                $array_temp[] = $tmp;                            
     
    11581089                                for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
    11591090                                { 
    1160                                         if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     1091                                        if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    11611092                                                $ids[] = $array_temp[$i]; 
    11621093                                        else { 
    11631094                                                $ids[] = $array_temp[$i][0]; 
    11641095                                                $perms[] = $array_temp[$i][1]; 
     1096                                                $owners[] = $array_temp[$i][2]; 
    11651097                                        } 
    11661098                                        //$perms[] = $array_temp[$i]; 
    11671099                                } 
    11681100                                 
     1101                                 
     1102                                // Carrega o nome completo dos donos dos objetos (contatos e grupos); 
     1103                                $owner_names = array(); 
     1104                                                         
     1105                                if($owners) { 
     1106                                        $filter = "(|"; 
     1107                                        foreach($owners as $i => $owner) { 
     1108                                                $filter .= "(uidNumber=".$owner.")"; 
     1109                                        } 
     1110                                        $filter .= ")"; 
     1111                                         
     1112                                        if(!$this->bo->catalog->src_info) { 
     1113                                                $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
     1114                                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
     1115                                        } 
     1116                                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false);                              
     1117                                        $dn=$this->bo->catalog->src_info['dn']; 
     1118                                        $justThese = array("cn","uidnumber","uid"); 
     1119                                        $sr = ldap_search($ds,$dn, $filter,$justThese);                                                          
     1120                                        $info = ldap_get_entries($ds, $sr); 
     1121                                        ldap_close($ds);                                                                                         
     1122                                        for($z = 0; $z < $info['count']; $z++) { 
     1123                                                $owner_names[$info[$z]['uidnumber'][0]] = array("cn" => $info[$z]['cn'][0], "uid" => $info[$z]['uid'][0]); 
     1124                                        }                                
     1125                                } 
    11691126                                /// Original 
    11701127                                //for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
     
    11751132                                 
    11761133                                $fields = $this->bo->catalog->get_fields(false); 
    1177  
    1178                                 if( $this->typeContact == 'groups') { 
     1134                                if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') { 
    11791135                                        $final = array( 
    11801136                                                0 => (int)$this->page_info['n_pages'], 
     
    11871143                                                )                                                
    11881144                                        );                                       
    1189                                          
    11901145                                        $groups =& $this->bo->catalog->get_multiple_entries($ids,$fields); 
    1191                                          
     1146                                                                                                                         
    11921147                                        $i = 0; 
    11931148                                        // contatos do grupo 
    11941149                                        $boGroups = CreateObject('contactcenter.bo_group');                                      
    11951150                                        $contacts = array(); 
    1196                                         foreach($groups as $group)              { 
    1197                                                                                  
     1151                                         
     1152                                        foreach($groups as $group)              {        
    11981153                                                $final[3][$i][0] = $group['title'] ? $group['title'] : 'none'; 
    11991154                                                $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none';                                                 
     
    12011156                                                $contacts = $boGroups -> get_contacts_by_group($group['id_group']); 
    12021157                                                $final[3][$i][3] = $contacts; 
     1158                                                $final[3][$i][4] = $perms[$i]; 
     1159                                                if($this->typeContact == 'shared_groups'){ 
     1160                                                        $final[3][$i][5] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 
     1161                                                        $final[3][$i][6] = $owner_names[$owners[$i]]['uid']; 
     1162                                                }                                                
    12031163                                                $i++;                                                    
    12041164                                        } 
     
    12101170                                        $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 
    12111171                                         
    1212                                         $final[5] = '<span class="link"  onclick="'.$lnk_compose; 
    1213                                         $final[10] = 'groups';                                                                                                                                                                                                                           
     1172                                        $final[5] = '<span class="link"  onclick="'.$lnk_compose;                                        
     1173                                        $final[10] = $this->typeContact;                                                                                                                                                                                                                 
    12141174                                        $this->save_session();                                   
    12151175                                        echo serialize($final); 
     
    13011261                                                        $final[3][$i][7] = array(); 
    13021262                                                         
    1303                                                 if($this->page_info['actual_catalog']['class']=='bo_shared_catalog_manager') { 
     1263                                                if($this->page_info['actual_catalog']['class']=='bo_shared_people_manager') { 
    13041264                                                        $final[3][$i][8] = $perms[$i]; 
     1265                                                        $final[3][$i][9] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 
    13051266                                                } 
    13061267 
     
    13731334                                } 
    13741335                        } 
    1375                         $data['contact_list'] = $contact_options; 
    1376                         $data['result'] = 'ok';                                                          
     1336                        $data['contact_list'] = $contact_options;                        
     1337                        $data['result'] = 'ok'; 
     1338                                                                                         
    13771339                        echo serialize($data);                   
    13781340                }                
     
    23152277                        if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
    23162278                                $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
    2317                                 $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     2279                                $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 
     2280                                $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    23182281                        { 
    23192282 
     
    23492312                                if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
    23502313                                        $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
    2351                                         $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     2314                                        $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' &&                                     
     2315                                        $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager' ) 
    23522316                                { 
    23532317                                        /* 
     
    23952359                        if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 
    23962360                                $this->page_info['actual_catalog']['class'] == 'bo_group_manager' || 
    2397                                 $this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 
     2361                                $this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager' || 
     2362                                $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager'        ) 
    23982363                        { 
    23992364                                // Get only this attributes: dn, cn for external catalogs, 
     
    24272392            foreach ($ids as $e_info) 
    24282393            { 
    2429                                 if($this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 
     2394                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    24302395                        $ids_f[] = $e_info[$id_field]; 
    24312396                else 
  • trunk/contactcenter/js/cc.js

    r503 r752  
    188188function editSharedContact (id){ 
    189189        openFullAdd(); 
    190         populateFullEdit(id,'bo_shared_catalog_manager'); 
     190        populateFullEdit(id,'bo_shared_people_manager'); 
    191191} 
    192192/************ Edit Group *************/ 
     
    194194        populateEditGroup(id);   
    195195} 
     196 
     197function editSharedGroup(id){ 
     198        populateEditGroup(id, 'shared');         
     199} 
     200 
    196201/* 
    197202        Updates all the constant fields in the 
     
    317322                options_contact_list.innerHTML = select_contact_list; 
    318323 
    319                 if(data['id_group']) { 
    320                  
     324                if(data['id_group']) {           
     325                        Element('title').value =  data['title']; 
    321326                        if(data['contact_in_list']) {                                    
    322327                                for(i = 0; i < data['contact_in_list'].length; i++) {                            
     
    325330                                        option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')';                               
    326331                                        Element('contact_in_list').options[Element('contact_in_list').options.length] = option; 
    327                                 } 
    328                         }                
    329                          
    330                         Element('title').value =  data['title']; 
     332                                }                
     333                        } 
    331334                } 
    332335                                 
     
    341344        id = typeof(id) == 'undefined' ? id = 0 :  id; 
    342345         
    343         ccAddGroup.clear(true);                  
     346        ccAddGroup.clear(true);                          
    344347        Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 
    345348} 
     
    18501853        } 
    18511854         
    1852         if(type == 'groups') 
    1853                 return populateGroupsInCards(data); 
     1855        if(type == 'groups' || type == 'shared_groups') 
     1856                return populateGroupsInCards(data,type); 
    18541857         
    18551858        var pos = 0; 
     
    19041907                                                                        Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 
    19051908                                                                } 
     1909                                                                if(data[3][pos][9]) 
     1910                                                                        Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][9]+"</i></font></span>";   
    19061911                                                                break; 
    19071912                                                         
     
    19731978                                                } 
    19741979                                        } 
    1975                                 } 
    1976                                 if (type == "shared") { 
     1980                                }                                
     1981                                if (type == "shared_contacts") { 
    19771982                                        if (data[3][pos][8] & 4)  
    19781983                                                eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedContact(Element('"+id+"' + ':cc_id').value);};"); 
     
    19881993                                                }; 
    19891994                                } 
     1995                                 
     1996                                 
     1997                                 
    19901998                                if (--ncards == 0) 
    19911999                                { 
     
    20002008} 
    20012009 
    2002 function populateGroupsInCards(data) 
     2010function populateGroupsInCards(data,type) 
    20032011{        
    20042012        var pos = 0; 
     
    20322040                                                                        Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 
    20332041                                                                } 
     2042                                                                if(data[3][pos][5]) 
     2043                                                                        Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][5]+"</i></font></span>"; 
    20342044                                                                break; 
    20352045                                                         
     
    20372047                                                                if (data[3][pos][k].length > (CC_visual == 'table'  ? 50 : 20)) 
    20382048                                                                { 
    2039                                                                         Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k] +'\')">'+adjustString(data[3][pos][k], (CC_visual == 'table'  ? 50 : 20))+'</span>'; 
     2049                                                                        Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+'::'+data[3][pos][6] +'\')">'+adjustString(data[3][pos][k], (CC_visual == 'table'  ? 50 : 20))+'</span>'; 
    20402050                                                                        Element(id+':'+data[2][k]).title = data[3][pos][k]; 
    20412051                                                                } 
    20422052                                                                else 
    20432053                                                                { 
    2044                                                                         Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k] + '\')">'+data[3][pos][k]+'</span>'; 
     2054                                                                        Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+(data[3][pos][6] ? '::'+data[3][pos][6] : "") + '\')">'+data[3][pos][k]+'</span>'; 
    20452055                                                                } 
    20462056                                                                break; 
     
    20732083                                } 
    20742084         
     2085                                if (type == "shared_groups") { 
     2086                                        /* Edição de grupos compartilhados está com problema. Desabilitado temporariamente. 
     2087                                        if (data[3][pos][4] & 4) 
     2088                                                eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedGroup(Element('"+id+"' + ':cc_id').value);};"); 
     2089                                        else 
     2090                                        */  
     2091                                        document.getElementById(id + ':cc_card_edit').onclick = function(){     alert(Element('cc_msg_unavailable').value); }; 
     2092                                         
     2093                                        if (data[3][pos][4] & 8)  
     2094                                                eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value,'groups');};"); 
     2095                                        else  
     2096                                                document.getElementById(id + ':cc_card_remove').onclick = function(){ 
     2097                                                        alert(Element('cc_msg_not_allowed').value); 
     2098                                                }; 
     2099                                }                                
     2100                                 
     2101                                 
    20752102                                if (--ncards == 0) 
    20762103                                { 
     
    21392166function getCardHTML (id, type) 
    21402167{ 
    2141                 if(type == 'groups') { 
     2168                if(type == 'groups' || type == 'shared_groups') { 
    21422169                        html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 
    21432170            '<div style="border: 0px solid #999; position: relative;">' +  
     
    21472174                                '<span id="' + id + ':cc_title" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 
    21482175                                '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + 
    2149                                 '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_title\').innerHTML" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
     2176                                '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
    21502177                                '<input id="' + id + ':cc_id" type="hidden">' + 
    21512178                        '</div>' + '</td>'; 
     
    21842211                        else 
    21852212                                bg = "this.style.background=\'#EEEEEE\'"; 
    2186                         if(type == 'groups') { 
     2213                        if(type == 'groups' || type == 'shared_groups') { 
    21872214                                html_card = '<tr width="40%" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + 
    21882215                                        '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1"></span>' + 
    21892216                                        '<span id="' + id + ':cc_title"></span></td>' + 
    2190                                         '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_title\').innerHTML"  id="' + id + ':cc_short_name"></span></td>' + 
     2217                                        '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'"  id="' + id + ':cc_short_name"></span></td>' + 
    21912218                                        '<td align="left" width="55px">'+ 
    21922219                                        '<img  title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style=" cursor: pointer; cursor: hand; z-index: 1;width: 18px; height: 18px;"  onclick="editGroup(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_card_edit.png">' + 
     
    22012228                                html_card = '<tr  style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' +                                        
    22022229                                        '<span valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="' + id + ':cc_name"></span></td>' + 
    2203                                         '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' + 
     2230                                        '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_mail"></span></td>' + 
    22042231                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' +          
    22052232                                        ( ccTree.catalog_perms == 1 ? 
     
    22452272                        html_cards += ''; 
    22462273                } 
    2247                 if((ccTree.catalog_perms & 2) && type != 'groups' && type!='shared') 
     2274                if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 
    22482275                        html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 
    22492276        }        
     
    22842311                        html_cards += '</tr>'; 
    22852312                } 
    2286                 if((ccTree.catalog_perms & 2) && type != 'groups' && type!='shared') 
     2313                if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 
    22872314                        html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 
    22882315        }        
  • trunk/contactcenter/templates/default/index.tpl

    r499 r752  
    1414<!-- JS MESSAGES --> 
    1515<input id="cc_msg_not_allowed" type="hidden" value="{cc_msg_not_allowed}"> 
     16<input id="cc_msg_unavailable" type="hidden" value="{cc_msg_unavailable}"> 
    1617<input id="cc_msg_no_cards" type="hidden" value="{cc_msg_no_cards}"> 
    1718<input id="cc_msg_err_no_room" type="hidden" value="{cc_msg_err_no_room}"> 
Note: See TracChangeset for help on using the changeset viewer.