Changeset 1280 for trunk/contactcenter


Ignore:
Timestamp:
08/05/09 18:20:55 (15 years ago)
Author:
eduardoalex
Message:

Ticket #453 - Edição de grupos compartilhados.

Location:
trunk/contactcenter
Files:
4 edited

Legend:

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

    r702 r1280  
    3636                } 
    3737                 
    38                 function get_all_contacts($field = false){ 
     38                function get_all_contacts($field = false,$owner=null){ 
    3939                 
    40                         $result = $this-> so -> selectAllContacts($field); 
     40                        $result = $this-> so -> selectAllContacts($field,$owner); 
    4141                        return $result; 
    4242                } 
  • trunk/contactcenter/inc/class.so_group.inc.php

    r752 r1280  
    107107                } 
    108108                 
    109                  
    110                 function selectAllContacts( $field = false ) 
    111                 { 
    112                                                  
    113                         $query = 'select C.id_connection, A.id_contact, A.names_ordered, C.connection_value , B.id_typeof_contact_connection from phpgw_cc_contact A,'. 
    114                         'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
    115                         'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 
    116                         'A.id_owner ='.$this->owner.' and C.connection_is_default = true '; 
     109                //Owner = null means the owner setted on constructor. 
     110                function selectAllContacts( $field = false ,$shared_from=null) 
     111                { 
     112                        if($shared_from==null) {                 
     113                                $query = 'select C.id_connection, A.id_contact, A.names_ordered, C.connection_value , B.id_typeof_contact_connection from phpgw_cc_contact A,'. 
     114                                'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
     115                                'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 
     116                                'A.id_owner ='.$this->owner.' and C.connection_is_default = true '; 
     117                        } 
     118                        else { 
     119                                $sub_query = 'select A.id_related from phpgw_cc_contact_rels A,phpgw_acl B 
     120                                                          where B.acl_location!=\'run\' and A.id_contact = B.acl_location::bigint and A.id_related = B.acl_account and  
     121                                                          B.acl_appname = \'contactcenter\' and B.acl_rights & 1 <> 0  
     122                                                          and A.id_typeof_contact_relation=1 and A.id_contact = '.$shared_from.' and A.id_related='.$this->owner; 
     123                                 
     124                                $query = 'select C.id_connection, A.id_contact, A.names_ordered, C.connection_value , B.id_typeof_contact_connection from phpgw_cc_contact A,'. 
     125                                'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
     126                                'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 
     127                                'A.id_owner in ('.$shared_from.',('.$sub_query.'))'. 
     128                                ' and C.connection_is_default = true '; 
     129                        } 
    117130 
    118131                        if ( $field == 'only_email' ) 
     
    256269                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    257270                        'and B.id_typeof_contact_connection = 1 and '. 
    258                         'A.id_owner ='.$this->owner.' and D.id_connection = C.id_connection and D.id_group = '.$id_group. 
     271                        //'A.id_owner ='.$this->owner.' and D.id_connection = C.id_connection and D.id_group = '.$id_group. 
     272                        ' D.id_connection = C.id_connection and D.id_group = '.$id_group. //If I have the group ID, why ask about owner? 
    259273                        ' order by A.names_ordered'; 
    260274                                                 
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r962 r1280  
    312312                                 
    313313                                case 'get_group': 
    314                                         return $this->get_group_data($_GET['id']); 
     314                                        return $this->get_group_data($_GET['id'],isset($_GET['shared_from'])?$_GET['shared_from']:null); 
    315315                                         
    316316                                case 'get_contact_full_add_const': 
     
    11601160                                                        $final[3][$i][5] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 
    11611161                                                        $final[3][$i][6] = $owner_names[$owners[$i]]['uid']; 
     1162                                                        $final[3][$i][7] = $owners[$i]; //uidNumber 
    11621163                                                }                                                
    11631164                                                $i++;                                                    
     
    13131314                 
    13141315                */               
    1315                 function get_group_data($id) 
     1316                function get_group_data($id,$shared_from=null) 
    13161317                { 
    13171318                        $this->bo->catalog = CreateObject('contactcenter.bo_group_manager'); 
     
    13261327                        $boGroup = CreateObject('contactcenter.bo_group'); 
    13271328                                                 
    1328                         $all_contacts = $boGroup->get_all_contacts('only_email'); 
     1329                        $all_contacts = $boGroup->get_all_contacts('only_email',$shared_from); 
    13291330                         
    13301331                        $contact_options = ""; 
  • trunk/contactcenter/js/cc.js

    r880 r1280  
    195195} 
    196196 
    197 function editSharedGroup(id){ 
    198         populateEditGroup(id, 'shared');         
     197function editSharedGroup(id,shared){ 
     198        populateEditSharedGroup(id, shared);     
    199199} 
    200200 
     
    312312function populateEditGroup (id) 
    313313{ 
     314        populateEditSharedGroup(id,false); 
     315} 
     316 
     317function populateEditSharedGroup(id,shared) { 
    314318        var handler = function(responseText) 
    315319        {                        
     
    345349         
    346350        ccAddGroup.clear(true);                          
    347         Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 
     351        if(!shared) 
     352                Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 
     353        else 
     354                Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id+'&shared_from='+shared, 'GET', handler); 
    348355} 
    349356 
     
    20842091         
    20852092                                if (type == "shared_groups") { 
    2086                                         /* Edição de grupos compartilhados está com problema. Desabilitado temporariamente. 
     2093                                         
    20872094                                        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                                          
     2095                                                eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedGroup(Element('"+id+"' + ':cc_id').value,"+data[3][pos][7]+");};"); 
     2096                                        else  
     2097                                                document.getElementById(id + ':cc_card_edit').onclick = function(){     alert(Element('cc_msg_not_allowed').value); }; 
     2098                                                                                 
    20932099                                        if (data[3][pos][4] & 8)  
    20942100                                                eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value,'groups');};"); 
Note: See TracChangeset for help on using the changeset viewer.