Ignore:
Timestamp:
02/18/11 16:31:00 (13 years ago)
Author:
niltonneto
Message:

Ticket #1515 - Modificado chamada inicial para retornar preferencias para o Javascript.

Location:
branches/2.2/contactcenter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/contactcenter/inc/class.ui_data.inc.php

    r3688 r3795  
    2424                var $so_group; 
    2525                var $typeContact; 
     26                var $preferences; 
    2627 
    2728                var $page_info = array( 
     
    8081                        else 
    8182                                $this -> typeContact = 'contacts'; 
     83                        $this->preferences = $_SESSION['phpgw_info']['user']['preferences']['contactcenter']; 
    8284                } 
    8385 
     
    330332                                        return $this->get_photo($_GET['id']); 
    331333 
    332                                 case 'get_visible_all_ldap': 
    333                                         echo $this->get_visible_all_ldap(); 
     334                                case 'get_init_values': 
     335                                        echo serialize(array("visible_all_ldap" => $this->get_visible_all_ldap(), "preferences" => $this->preferences)); 
    334336                                        return; 
    335337 
     
    14631465 
    14641466                                $i = 0; 
     1467                                if (!is_array($this->preferences)) 
     1468                                { 
     1469                                        $this->preferences['personCardEmail'] = 1; 
     1470                                        $this->preferences['personCardPhone'] = 2; 
     1471                                } 
    14651472                                foreach($contacts as $index => $contact) 
    14661473                                { 
     
    14951502 
    14961503                                                //Para exibir o celular empresarial do empregado 
    1497                                                 if ($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && !$external && $final[3][$i][10] != 'none') 
     1504                                                if ($this->preferences['voip_enabled'] && !$external && $final[3][$i][10] != 'none') 
    14981505                                                            $final[3][$i][10] = "<a title=\"".lang("Call Mobile")."\" href=\"#\" onclick=\"connectVoip('".$final[3][$i][10]."', 'mob')\">".$final[3][$i][10]."</a>"; 
    14991506 
    1500                                                 /* Select the correct Email and Telephone to be shown */ 
    1501                                                 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 
    1502  
    1503                                                 if (!is_array($preferences)) 
    1504                                                 { 
    1505                                                         $preferences['personCardEmail'] = 1; 
    1506                                                         $preferences['personCardPhone'] = 2; 
    1507                                                 } 
    15081507                                                if ($contact['connections']) 
    15091508                                                { 
     
    15121511                                                        foreach($contact['connections'] as $conn_info) 
    15131512                                                        { 
    1514                                                                 if ($conn_info['id_type'] == $preferences['personCardEmail'] and !$default_email_found) 
     1513                                                                if ($conn_info['id_type'] == $this->preferences['personCardEmail'] and !$default_email_found) 
    15151514                                                                { 
    15161515                                                                        if ($conn_info['connection_is_default']) 
     
    15201519                                                                        $final[3][$i][4] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 
    15211520                                                                } 
    1522                                                                 else if ($conn_info['id_type'] == $preferences['personCardPhone'] and !$default_phone_found) 
     1521                                                                else if ($conn_info['id_type'] == $this->preferences['personCardPhone'] and !$default_phone_found) 
    15231522                                                                { 
    15241523                                                                        if ($conn_info['connection_is_default']) 
     
    15311530                                                                        //      $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'ramal')\">".$conn_info['connection_value']."</a>"; 
    15321531 
    1533                                                                         if (!($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['telephone_number'] == $conn_info['connection_value']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && $conn_info['connection_value'] && preg_match('/^\([0-9]{2}\)[0-9]{4}\-[0-9]{4}$/',$conn_info['connection_value'])==1 && !$external){ 
     1532                                                                        if (!($this->preferences['telephone_number'] == $conn_info['connection_value']) && $this->preferences['contactcenter']['voip_enabled'] && $conn_info['connection_value'] && preg_match('/^\([0-9]{2}\)[0-9]{4}\-[0-9]{4}$/',$conn_info['connection_value'])==1 && !$external){ 
    15341533                                                                                $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'com')\">".$conn_info['connection_value']."</a>"; 
    15351534                                                                         
     
    33173316                        } 
    33183317 
    3319                         $prefs = ExecMethod('contactcenter.ui_preferences.get_preferences'); 
    3320  
    33213318                        $jsCode = array(); 
    33223319                        $count = 0; 
     
    33543351 
    33553352                                                        foreach ($value as $connection)         { 
    3356                                                                 if ($connection['id_type'] == $prefs['personCardEmail'])        { 
     3353                                                                if ($connection['id_type'] == $this->preferences['personCardEmail'])    { 
    33573354                                                                        $jsCode[] = '_this.entries.options[_this.entries.options.length] = new Option("'.$name.' <'.$connection['connection_value'].'>", "'.$count.'");'; 
    33583355                                                                        $count++; 
  • branches/2.2/contactcenter/js/ccMain.js

    r3644 r3795  
    11var last_id = 0;         
    2  
     2var preferences = null; 
    33function openwindow(url){        
    44        var window_features =   "scrollbars=yes,resizable=yes,location=no,menubar=no," +  
     
    4343                try 
    4444                { 
    45                         function ViewLdap(data) 
     45                        function handlerInitValues(sdata) 
    4646                        { 
    47                                 if( boolData = eval(data) ) 
     47                                var data = unserialize(sdata); 
     48                                preferences = data.preferences; 
     49                                if( boolData = eval(data.visible_all_ldap) ) 
    4850                                { 
    4951                                        ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); 
     
    6264                        } 
    6365 
    64                         Connector.newRequest('ViewLdap', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_visible_all_ldap', 'GET', ViewLdap);             
     66                        Connector.newRequest('handlerInitValues', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_init_values', 'GET', handlerInitValues);                
    6567                         
    6668                        ccTree.Connector = Connector;                                            
Note: See TracChangeset for help on using the changeset viewer.