Changeset 1599 for trunk/contactcenter


Ignore:
Timestamp:
11/06/09 09:58:04 (14 years ago)
Author:
rafaelraymundo
Message:

Ticket #719 - Adicionados campos para importacao de contatos no Outlook Express

Location:
trunk/contactcenter
Files:
2 edited

Legend:

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

    r1517 r1599  
    1414  \***************************************************************************/ 
    1515 
    16          
     16 
    1717        class ui_data 
    1818        { 
     
    2020                        'data_manager' => true, 
    2121                ); 
    22                  
     22 
    2323                var $bo; 
    2424                var $typeContact; 
    25                  
     25 
    2626                var $page_info = array( 
    2727                        'n_cards'          => 20, 
     
    3434                        'actual_catalog'   => false 
    3535                ); 
    36                  
     36 
    3737                /*! 
    38                  
     38 
    3939                        @function ui_data 
    4040                        @abstract The constructor. Sets the initial parameters and loads 
    4141                                the data saved in the session 
    4242                        @author Raphael Derosso Pereira 
    43                          
     43 
    4444                */ 
    4545                function ui_data() 
     
    4747                        $temp = $GLOBALS['phpgw']->session->appsession('ui_data.page_info','contactcenter'); 
    4848                        $temp2 = $GLOBALS['phpgw']->session->appsession('ui_data.all_entries','contactcenter'); 
    49                          
     49 
    5050                        $this->bo = CreateObject('contactcenter.bo_contactcenter'); 
    51                          
     51 
    5252                        if ($temp) 
    5353                        { 
     
    5959                                $this->all_entries = $temp2; 
    6060                        } 
    61                          
     61 
    6262                        if (!$this->page_info['actual_catalog']) 
    6363                        { 
     
    6565                                $this->page_info['actual_catalog'] = $catalogs[0]; 
    6666                        } 
    67                          
    68                         $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']);                        
    69                          
     67 
     68                        $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']); 
     69 
     70 
    7071                        if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 
    7172                                $this -> typeContact = 'groups'; 
     73/**rev 104**/ 
    7274                        else if($this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 
    7375                                $this -> typeContact = 'shared_groups'; 
    7476                        else if($this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager') 
    7577                                $this -> typeContact = 'shared_contacts'; 
     78/******/ 
    7679                        else 
    7780                                $this -> typeContact = 'contacts'; 
     
    7982 
    8083                /*! 
    81                  
     84 
    8285                        @function index 
    8386                        @abstract Builds the Main Page 
    8487                        @author Raphael Derosso Pereira 
    8588                        @author Jonas Goes 
    86                          
    87                 */               
     89 
     90                */ 
    8891                function index() 
    89                 {        
     92                { 
    9093                        if(!@is_object($GLOBALS['phpgw']->js)) 
    9194                        { 
     
    9699                        $GLOBALS['phpgw']->js->validate_file('venus','jsStructUtil'); 
    97100                        $GLOBALS['phpgw']->js->validate_file('venus','cssUtil'); 
    98                          
     101 
    99102//                      $GLOBALS['phpgw']->js->set_onload('setTimeout(\'updateCards()\',1000)'); 
    100103                        $GLOBALS['phpgw']->common->phpgw_header(); 
    101                          
     104 
    102105                        $GLOBALS['phpgw']->template->set_file(array('index' => 'index.tpl')); 
    103106                        $GLOBALS['phpgw']->template->set_var('cc_root_dir', $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/'); 
    104                          
     107 
    105108                        /* Quick Add */ 
    106109                        $GLOBALS['phpgw']->template->set_var('cc_qa_alias',lang('Alias').':'); 
     
    113116                        $GLOBALS['phpgw']->template->set_var('cc_qa_close',lang('Close')); 
    114117                        /* End Quick Add */ 
    115                          
     118 
    116119                        $cc_css_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/styles/cc.css'; 
    117120                        $cc_card_image_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/templates/default/images/card.png'; 
     
    119122                        $GLOBALS['phpgw']->template->set_var('cc_dtree_css', $cc_dtree_file); 
    120123                        $GLOBALS['phpgw']->template->set_var('cc_card_image',$cc_card_image_file); 
    121                          
     124 
    122125                        $GLOBALS['phpgw']->template->set_var('cc_personal',lang('Personal')); 
    123                          
     126 
     127/***rev 104***/ 
     128                        //$GLOBALS['phpgw']->template->set_var('cc_full_add',lang('Full Add')); 
    124129                        $GLOBALS['phpgw']->template->set_var('cc_full_add_button',lang('Full Add')); 
    125                         $GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared')); 
     130/******/ 
     131                        $GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared')); 
    126132                        $GLOBALS['phpgw']->template->set_var('cc_reset',lang('Reset')); 
    127                          
     133 
    128134                        $GLOBALS['phpgw']->template->set_var('cc_personal_data',lang('Personal Data')); 
    129135                        $GLOBALS['phpgw']->template->set_var('cc_addresses',lang('Addresses')); 
     
    134140                        $GLOBALS['phpgw']->template->set_var('cc_catalogs',lang('Catalogues')); 
    135141                        $GLOBALS['phpgw']->template->set_var('cc_group_add',lang('Group Add')); 
    136                          
     142 
    137143                        /* Panel */ 
    138144                        $GLOBALS['phpgw']->template->set_var('cc_panel_new',lang('New').'...'); 
     
    142148                        $GLOBALS['phpgw']->template->set_var('cc_btn_import_export', lang('Import/Export')); 
    143149                        $GLOBALS['phpgw']->template->set_var('cc_btn_new', lang("New...")); 
    144                          
     150 
    145151                        $GLOBALS['phpgw']->template->set_var('cc_panel_search_found',lang('Showing found entries')); 
    146152                        $GLOBALS['phpgw']->template->set_var('cc_panel_first_page',lang('First Page')); 
     
    150156                        $GLOBALS['phpgw']->template->set_var('cc_all',lang('all')); 
    151157                        /* End Panel */ 
    152                          
     158 
    153159                        /* Messages */ 
     160/**rev 104**/ 
    154161                        $GLOBALS['phpgw']->template->set_var('cc_msg_not_allowed',lang('Not Allowed')); 
    155                         $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function'));                         
     162                        $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function')); 
     163/*****/ 
    156164                        $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); 
    157165                        $GLOBALS['phpgw']->template->set_var('cc_msg_err_no_room',lang('No Room for Cards! Increase your browser area.')); 
     
    167175                        $GLOBALS['phpgw']->template->set_var('cc_empty',lang('Empty')); 
    168176                        /* End Messages */ 
    169                          
     177 
    170178                        $GLOBALS['phpgw']->template->set_var('cc_results',lang('Results')); 
    171179                        $GLOBALS['phpgw']->template->set_var('cc_is_my',lang('Is My')); 
     
    173181                        $GLOBALS['phpgw']->template->set_var('cc_btn_search',lang('Search')); 
    174182                        $GLOBALS['phpgw']->template->set_var('cc_add_relation',lang('Add Relation')); 
    175                         $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations'));                       
     183                        $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations')); 
    176184                        $GLOBALS['phpgw']->template->set_var('cc_msg_group',lang('Group')); 
    177185                        $GLOBALS['phpgw']->template->set_var('cc_msg_contact_full',lang('Contact [Full]')); 
     
    214222                        $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_cellphone', lang('Corporative Cellphone')); 
    215223                        $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_fax', lang('Corporative Fax')); 
    216                         $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_pager', lang('Corporative Pager'));                     
     224                        $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_pager', lang('Corporative Pager')); 
    217225                        $GLOBALS['phpgw']->template->set_var('cc_msg_work', lang('Work')); 
    218226                        $GLOBALS['phpgw']->template->set_var('cc_msg_fax', lang('Fax')); 
     
    234242                        $GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.')); 
    235243                        $GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name')); 
    236                          
     244 
    237245                        if($GLOBALS['phpgw_info']['server']['personal_contact_type']=='True'){ 
    238246                                $GLOBALS['phpgw']->template->set_var('cc_contact_type', 'advanced'); 
     
    241249                        } 
    242250                        $GLOBALS['phpgw']->template->parse('out','index'); 
    243                          
     251 
    244252                        $api = CreateObject('contactcenter.ui_api'); 
    245253                        $main = $api->get_full_add(); 
     
    252260                } 
    253261 
    254                  
     262 
    255263                /*! 
    256                  
     264 
    257265                        @function data_manager 
    258                         @abstract Calls the right method and passes to it the right  
     266                        @abstract Calls the right method and passes to it the right 
    259267                                parameters 
    260268                        @author Raphael Derosso Pereira 
    261                  
     269 
    262270                */ 
    263271                function data_manager() 
     
    268276                                case 'set_n_cards': 
    269277                                        return $this->set_n_cards((int)$_GET['ncards']); 
    270                                          
    271                                 case 'get_cards_data':                                   
     278 
     279                                case 'get_cards_data': 
    272280                                        $ids = false; 
    273281                                        // To support ldap catalogs using accentuation 
     
    276284                                                $ids = utf8_decode($this->search($_POST['data'])); 
    277285                                        } 
    278                                          
     286 
    279287                                        if(isset($_SESSION['ids'])) 
    280288                                                $ids = $_SESSION['ids']; 
    281                                          
    282                                         return $this->get_cards_data($_POST['letter'], $_POST['page'], $ids);                                            
     289 
     290                                        return $this->get_cards_data($_POST['letter'], $_POST['page'], $ids); 
     291 
    283292                                case 'get_cards_data_get': 
    284293                                        return $this->get_cards_data($_GET['letter'], $_GET['page'], unserialize(str_replace('\\"','"',$_GET['ids']))); 
     
    291300                                        echo $this->get_visible_all_ldap(); 
    292301                                        return; 
    293                                          
     302 
    294303                                /* Catalog Methods */ 
    295304                                case 'set_catalog': 
    296305                                        return $this->set_catalog($_GET['catalog']); 
    297                                          
     306 
    298307                                case 'get_catalog_tree': 
    299308                                        echo serialize($this->get_catalog_tree($_GET['level'])); 
     
    307316                                        echo serialize($this->get_catalog_participants_list($_POST['id'])); 
    308317                                        return; 
    309                                  
     318/**rev 104**/ 
    310319                                case 'get_catalog_participants_group': 
    311320                                        echo serialize($this->get_catalog_participants_group($_POST['id'])); 
    312321                                        return; 
    313  
     322/***/ 
    314323                                case 'get_catalog_add_contact': 
    315324                                        // To support ldap catalogs with accentuation 
    316325                                        echo serialize($this->get_catalog_add_contact(utf8_decode($_POST['id']))); 
    317326                                        return; 
    318                                          
     327 
    319328                                /* Full Add Methods */ 
    320329                                case 'get_full_data': 
     330                                        //return $this->get_full_data($_GET['id']); 
     331/**rev 104**/ 
    321332                                        return $this->get_full_data($_GET['id'],$_GET['catalog']); 
    322                                  
     333/****/ 
     334 
    323335                                case 'get_group': 
    324336                                        return $this->get_group_data($_GET['id'],isset($_GET['shared_from'])?$_GET['shared_from']:null); 
    325                                          
     337 
    326338                                case 'get_contact_full_add_const': 
    327339                                        return $this->get_contact_full_add_const(); 
     
    338350                                case 'get_states': 
    339351                                        return $this->get_states($_GET['country']); 
    340                                          
     352 
    341353                                case 'get_cities': 
    342354                                        return $this->get_cities($_GET['country'], $_GET['state'] ? $_GET['state'] : null); 
    343                                          
    344                                          
     355 
     356 
    345357                                /* Other Methods */ 
    346                                 case 'quick_add':                                                                                                                        
     358                                case 'quick_add': 
    347359                                        return $this->quick_add($_POST['add']); 
    348                                  
    349                                 case 'add_group':                                                                                                                        
     360 
     361                                case 'add_group': 
    350362                                        return $this->add_group($_POST['add']); 
    351                                                                          
     363 
    352364                                case 'remove_entry': 
    353365                                        return $this->remove_entry((int)$_GET['remove']); 
    354                                  
     366 
    355367                                case 'remove_all_entries': 
    356368                                        return $this->remove_all_entries(); 
    357369 
    358370                                case 'remove_group': 
    359                                                                                  
    360                                         return $this->remove_group((int)$_GET['remove']);                                        
     371 
     372                                        return $this->remove_group((int)$_GET['remove']); 
    361373 
    362374                                case 'search': 
     
    397409 
    398410                /*! 
    399                  
     411 
    400412                        @function set_n_cards 
    401413                        @abstract Informs the class the number of cards the page can show 
    402414                        @author Raphael Derosso Pereira 
    403                          
     415 
    404416                        @param integer $n_cards The number of cards 
    405                          
     417 
    406418                */ 
    407419                function set_n_cards($n_cards) 
     
    412424                                echo 1; 
    413425                        } 
    414                          
     426 
    415427                        $this->save_session(); 
    416428                } 
    417                                  
     429 
    418430                /*! 
    419                  
     431 
    420432                        @function set_catalog 
    421433                        @abstract Sets the current catalog selected by the user 
    422434                        @author Raphael Derosso Pereira 
    423                          
     435 
    424436                        @param string $id_catalog The sequence of IDs to reach the catalog 
    425437                                separated by commas 
    426                  
     438 
    427439                */ 
    428440                function set_catalog($id_catalog) 
     
    430442                        $id_catalog = str_replace('\\"', '"', $id_catalog); 
    431443                        $temp =& $this->bo->set_catalog($id_catalog); 
    432                          
     444 
    433445                        if ($temp) 
    434446                        { 
     
    437449                                $this->page_info['actual_catalog'] =& $temp; 
    438450                                $this->save_session(); 
    439                                  
     451 
    440452                                $catalog_info = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 
    441                                  
     453 
    442454                                if ($catalog_info['class'] === 'bo_global_ldap_catalog' || 
    443455                                    $catalog_info['class'] === 'bo_catalog_group_catalog') 
     
    449461                                        $perms = 15; 
    450462                                } 
    451                                  
     463 
    452464                                echo serialize(array( 
    453465                                        'status' => 'ok', 
     
    457469                                return; 
    458470                        } 
    459                          
     471 
    460472                        echo serialize(array( 
    461473                                'status' => 'ok', 
     
    463475                        )); 
    464476                } 
    465                  
    466                  
     477 
     478 
    467479                /*! 
    468                  
     480 
    469481                        @function get_catalog_tree 
    470482                        @abstract Returns the JS serialized array to used as the tree 
    471483                                level 
    472484                        @author Raphael Derosso Pereira 
    473             @author Mário César Kolling (error messages and timeout) 
    474                          
    475                         @param (string) $level The level to be taken  
    476                  
     485            @author Mï¿œrio Cï¿œsar Kolling (error messages and timeout) 
     486 
     487                        @param (string) $level The level to be taken 
     488 
    477489                */ 
    478490                function get_catalog_tree($level) 
     
    483495 
    484496                                $parent = '0'; 
    485                                  
     497 
    486498                                if (!($tree = $this->bo->get_catalog_tree($level))) 
    487499                                { 
     
    515527                                } 
    516528                        } 
    517                          
     529 
    518530                        $folderImageDir = $GLOBALS['phpgw']->common->image('contactcenter','globalcatalog-mini.png'); 
    519531                        $folderImageDir = substr($folderImageDir, 0, strpos($folderImageDir, 'globalcatalog-mini.png')); 
    520                          
     532 
    521533                        // Deals with error messages from the server and returns them to the browser 
    522534                        if ($tree['msg']) 
     
    546558                        } 
    547559                } 
    548                  
     560 
    549561                /*! 
    550                  
     562 
    551563                        @function get_actual_catalog 
    552564                        @abstract Returns the actual selected Catalog 
     
    555567                */ 
    556568                function get_actual_catalog() 
    557                 {                        
     569                { 
    558570                        $level = $this->bo->get_level_by_branch($this->bo->get_actual_catalog(), $this->bo->tree['branches'], '0'); 
    559                          
     571 
    560572                        if ($level) 
    561573                        { 
     
    571583                        ); 
    572584                } 
    573                  
     585 
    574586                /*! 
    575                  
     587 
    576588                        @function get_cards_data 
    577589                        @abstract Returns the information that is placed on the cards 
    578590                        @author Raphael Derosso Pereira 
    579                          
     591 
    580592                        @param string $letter The first letter to be searched 
    581                         @param (int)  $page The page to be taken  
     593                        @param (int)  $page The page to be taken 
    582594                        @param (str)  $ids The ids to be taken in case of search 
    583595 
     
    588600                { 
    589601                        if( $ids ) 
    590                                 $_SESSION['ids'] = $ids;                    
     602                                $_SESSION['ids'] = $ids; 
    591603 
    592604                        // It's an external catalog? 
     
    594606                        //echo $page."\n"; 
    595607                        if ($letter !== 'search' and ($letter != $this->page_info['actual_letter'] or 
    596                             ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or  
     608                            ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or 
    597609                            $this->page_info['changed'])) 
    598610                        { 
    599611                                unset($ids); 
    600612                                $this->page_info['changed'] = false; 
     613 
    601614                                switch ($this->page_info['actual_catalog']['class']) 
    602615                                { 
     616/**rev 104**/ 
    603617                                        case 'bo_shared_people_manager': 
     618/****/ 
    604619                                        case 'bo_people_catalog': 
    605620                                                $field_name = 'id_contact'; 
     621 
    606622                                                if ($letter !== 'number') 
    607623                                                { 
     
    611627                                                                        'type'  => 'iLIKE', 
    612628                                                                        'value' => $letter !== 'all' ? $letter.'%' : '%' 
    613                                                                 )                                                                
     629/**rev 104**/ 
     630        /*                                                      ), 
     631                                                                1 => array( 
     632                                                                        'field' => 'contact.id_owner', 
     633                                                                        'type'  => '=', 
     634                                                                        'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
     635        */ 
     636                                                                ) 
    614637                                                        ); 
    615638 
     
    617640                                                        $so_contact = CreateObject('contactcenter.so_contact',  $GLOBALS['phpgw_info']['user']['account_id']); 
    618641                                                        $relacionados = $so_contact->get_relations(); 
    619                                                          
    620                                                         $perms_relacao = array();                                
     642 
     643                                                        $perms_relacao = array(); 
    621644 
    622645                                                        foreach($relacionados as $uid_relacionado => $tipo_relacionamento) { 
     
    650673                                                                $n=$this->bo->catalog->src_info['dn']; 
    651674                                                                $apenasThese = array("cn","uidnumber","uid"); 
    652                                                                 $r = ldap_search($s,$n, $filtro,$apenasThese);                                         
     675                                                                $r = ldap_search($s,$n, $filtro,$apenasThese); 
    653676                                                                $infos = ldap_get_entries($s, $r); 
    654                                                                 ldap_close($s);                                                                        
     677                                                                ldap_close($s); 
    655678                                                                for($z = 0; $z < $infos['count']; $z++) { 
    656679                                                                        $prop_names[$infos[$z]['uidnumber'][0]] = array("cn" => $infos[$z]['cn'][0], "uid" => $infos[$z]['uid'][0]); 
     
    666689                                                                ); 
    667690                                                        } 
     691/****/ 
     692 
    668693                                                } 
    669694                                                else 
     
    725750                                                                                ), 
    726751                                                                        ), 
     752/**rev 104**/ 
     753/*                                                              ), 
     754                                                                1 => array( 
     755                                                                        'field' => 'contact.id_owner', 
     756                                                                        'type'  => '=', 
     757                                                                        'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
     758                                                                ), 
     759*/ 
    727760                                                                ) 
    728761                                                        ); 
     
    736769                                                        ); 
    737770                                                } 
    738                                                  
    739                                                  
     771/*****/ 
     772 
    740773                                                $find_field[0] = array('contact.id_contact','contact.names_ordered'); 
    741                                                  
     774 
    742775                                                $find_other[0] = array( 
     776/**rev 104**/ 
     777                                                        //'offset' => (($page-1)*$this->page_info['n_cards']), 
     778                                                        //'limit'  => $this->page_info['n_cards'], 
     779/*****/ 
    743780                                                        'order'  => 'contact.names_ordered' 
    744781                                                ); 
    745                                                  
     782 
    746783                                                break; 
    747                                          
     784 
    748785                                        case 'bo_global_ldap_catalog': 
    749                                          
     786 
    750787                                                $field_name = 'id_contact'; 
    751788 
     
    760797                                                                /* 
    761798                                                                 * Restrict the returned contacts in a "first letter" search 
     799/**rev 104 
    762800                                                                 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 
    763801                                                                 * phpgwAccountVisible != -1 
     
    767805                                                                        'type'  => '=', 
    768806                                                                        'value' => 'phpgwAccount' 
     807/**rev 104**/ 
     808                                                                //),/* 
    769809                                                                ), 
     810/****/ 
    770811                                                                2 => array( 
    771812                                                                        'field' => 'contact.account_status', 
    772813                                                                        'type'  => 'iLIKE', 
    773814                                                                        'value' => '%' 
     815/**rev 104**/ 
     816                                                                //),*/ 
     817                                                                //2 => array( 
    774818                                                                ), 
    775819                                                                3 => array( 
     820/*****/ 
    776821                                                                        'field' => 'contact.account_visible', 
    777822                                                                        'type'  => '!=', 
    778823                                                                        'value' => '-1' 
     824/**rev 104**/ 
     825        /*                                                      ), 
     826                                                                3 => array( 
     827                                                                        'field' => 'contact.object_class', 
     828                                                                        'type'  => '=', 
     829                                                                        'value' => 'inetOrgPerson' 
     830                                                                ), 
     831        */ 
    779832                                                                ) 
     833/*****/ 
     834 
    780835                                                        ); 
    781836                                                        // If not external catalog get only phpgwAccountType = u ou l 
     
    795850                                                                                        'type'  => '=', 
    796851                                                                                        'value' => 'i' 
     852/**rev 104**/ 
    797853                                                                                        ), 
    798854                                                                                        2 => array( 
    799855                                                                                        'field' => 'contact.account_type', 
    800856                                                                                        'type'  => '=', 
     857/****/ 
    801858                                                                                        'value' => 'l' 
     859/**rev 104**/ 
    802860                                                                                        ), 
    803861                                                                                        3 => array( 
     
    805863                                                                                        'type'  => '=', 
    806864                                                                                        'value' => 'g' 
     865/***/ 
    807866                                                                                        ) 
    808867                                                                                ) 
     
    815874                                                                /* 
    816875                                                                 * Restrict the returned contacts in a "first number" search 
     876/**rev 104 
    817877                                                                 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 
    818878                                                                 * phpgwAccountVisible != -1 
     
    822882                                                                        'type'  => '=', 
    823883                                                                        'value' => 'phpgwAccount' 
     884/**rev 104**/ 
     885                                                                //),/* 
    824886                                                                ), 
     887/****/ 
    825888                                                                1 => array( 
    826889                                                                        'field' => 'contact.account_status', 
    827890                                                                        'type'  => 'iLIKE', 
    828891                                                                        'value' => '%' 
     892/**rev 104**/ 
     893                                                                //),*/ 
     894                                                                //1 => array( 
    829895                                                                ), 
    830896                                                                2 => array( 
     897/*****/ 
    831898                                                                        'field' => 'contact.account_visible', 
    832899                                                                        'type'  => '!=', 
    833900                                                                        'value' => '-1' 
    834901                                                                ), 
     902/**rev 104**/ 
     903        /*                                                      2 => array( 
     904                                                                        'field' => 'contact.object_class', 
     905                                                                        'type'  => '=', 
     906                                                                        'value' => 'inetOrgPerson' 
     907                                                                ), 
     908        */ 
     909/****/ 
    835910                                                                3 => array( 
    836911                                                                        'type'  => 'branch', 
     
    905980                                                                                'field' => 'contact.account_type', 
    906981                                                                                'type'  => '=', 
     982/**rev 104**/ 
     983                                                                                //'value' => 'g' 
     984                                                                                //); 
     985                                                                                //1 => array( 
    907986                                                                                'value' => 'i' 
    908987                                                                                ), 
    909988                                                                                2 => array( 
     989/****/ 
    910990                                                                                'field' => 'contact.account_type', 
    911991                                                                                'type'  => '=', 
    912992                                                                                'value' => 'l' 
     993/**rev 104**/ 
    913994                                                                                ), 
    914995                                                                                3 => array( 
     
    917998                                                                                'value' => 'g' 
    918999                                                                                ) 
    919                                                                                  
     1000/****/ 
    9201001                                                                        ) 
    9211002                                                                ); 
     
    9281009                                                        // for non-external catalogs, used to restrict the attributes used in filters 
    9291010                                                        $find_field[0] = array('contact.id_contact','contact.names_ordered','contact.account_type', 
    930                                                                 'contact.object_class',/*'contact.account_status',*/'contact.account_visible'); 
     1011                                                                'contact.object_class','contact.account_visible'); 
    9311012                                                } 
    9321013                                                else 
     
    9361017                                                        $find_field[0] = array('contact.id_contact','contact.names_ordered'); 
    9371018                                                } 
    938                                                  
     1019 
    9391020                                                $find_other[0] = array( 
    9401021                                                        //'offset' => (($page-1)*$this->page_info['n_cards']), 
     
    9421023                                                        'order'  => 'contact.names_ordered' 
    9431024                                                ); 
    944                                                  
     1025 
    9451026                                                break; 
    946                                          
     1027 
    9471028                                        case 'bo_company_manager': 
    9481029                                                $field_name = 'id_company'; 
    949          
     1030 
    9501031                                                $find_field[0] = array('company.id_company','company.company_name'); 
    951                                                  
     1032 
    9521033                                                $find_other[0] = array( 
    9531034                                                        //'offset' => (($page-1)*$this->page_info['n_cards']), 
     
    9551036                                                        'order'  => 'company.company_name' 
    9561037                                                ); 
    957          
     1038 
    9581039                                                $find_restric[0] = array( 
    9591040                                                        0 => array( 
     
    9631044                                                        ) 
    9641045                                                ); 
    965                                                          
     1046 
    9661047                                                break; 
    9671048 
    9681049                                        case 'bo_group_manager': 
     1050/**rev 104**/ 
    9691051                                        case 'bo_shared_group_manager': 
    970                                                                                                  
     1052/****/ 
     1053 
    9711054                                                $field_name = 'id_group'; 
    972                                                  
     1055 
    9731056                                                if ($letter !== 'number')       { 
    974                                                          
     1057 
    9751058                                                        $find_restric[0] = array( 
    9761059                                                                0 => array( 
     
    9821065                                                } 
    9831066                                                 else { 
    984                                                          
     1067 
    9851068                                                        $find_restric[0] = array( 
    9861069                                                                0 => array( 
    9871070                                                                                        'field' => 'group.title', 
    9881071                                                                                        'type'  => 'LIKE', 
    989                                                                                         'value' => '0%'                                                                          
     1072                                                                                        'value' => '0%' 
    9901073                                                                ) 
    991                                                         );                                               
     1074                                                        ); 
    9921075                                                } 
    993                                                  
     1076/**rev 104**/ 
    9941077                                                if($this->page_info['actual_catalog']['class'] == 'bo_group_manager'){ 
     1078/****/ 
    9951079                                                        array_push($find_restric[0],  array( 
    9961080                                                                                        'field' => 'group.owner', 
    9971081                                                                                        'type'  => '=', 
    998                                                                                         'value' => $GLOBALS['phpgw_info']['user']['account_id']                                                                          
     1082                                                                                        'value' => $GLOBALS['phpgw_info']['user']['account_id'] 
    9991083                                                                        ) 
    10001084                                                        ); 
    10011085                                                } 
    1002                                                  
    1003                                                 $find_field[0] = array('group.id_group','group.title','group.short_name');                                               
     1086 
     1087                                                $find_field[0] = array('group.id_group','group.title','group.short_name'); 
    10041088                                                $find_other[0] = array( 
    10051089                                                        'order'  => 'group.title' 
    1006                                                 );                                               
     1090                                                ); 
    10071091                                                break; 
    1008                                          
     1092 
    10091093                                        case 'bo_catalog_group_catalog': 
    10101094                                                $this->page_info['actual_entries'] = false; 
    1011                                                  
     1095 
    10121096                                                $this->page_info['actual_letter'] = $letter; 
    10131097                                                $this->page_info['actual_page'] = 0; 
    1014                                                  
     1098 
    10151099                                                $this->save_session(); 
    10161100                                                $final[0] = 0; 
    10171101                                                $final[1] = $this->typeContact; 
    1018                                                 echo serialize($final);                                          
     1102                                                echo serialize($final); 
    10191103                                                return; 
    10201104 
     
    10231107                                $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 
    10241108                                $n_entries = count($result); 
    1025                                  
     1109 
    10261110                                if ($n_entries) 
    10271111                                { 
     
    10361120                                if (!$result) 
    10371121                                { 
    1038                                          
    10391122                                        $this->page_info['actual_entries'] = false; 
    1040                                          
     1123 
    10411124                                        $this->page_info['actual_letter'] = $letter; 
    10421125                                        $this->page_info['actual_page'] = 0; 
    1043                                          
    1044                                         $this->save_session();                           
     1126 
     1127                                        $this->save_session(); 
    10451128                                        $final[0] = 0; 
    10461129                                        $final[1] = $this->typeContact; 
    1047                                         echo serialize($final);                                                                                  
     1130                                        echo serialize($final); 
    10481131                                        return; 
    10491132                                } 
     
    10531136                                        foreach ($result as $id => $value) 
    10541137                                        { 
     1138/**rev 104**/ 
     1139                                        //      $this->page_info['actual_entries'][] = $value[$field_name]; 
     1140                                        //} 
    10551141                                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    10561142                                                        $this->page_info['actual_entries'][] = $value[$field_name]; 
    10571143                                                else 
    10581144                                                        $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms'],2=>$value['owner']); 
    1059                                         }  
     1145                                        } 
     1146/****/ 
    10601147                                        //print_r($this->page_info['actual_entries']); 
    10611148                                } 
     
    10661153                                if (!$ids) 
    10671154                                { 
     1155/**rev 104**/ 
    10681156                                        //error_log('!$ids e $this->page_info[\'actual_letter\'] != search'); 
     1157/*****/ 
    10691158                                        $this->page_info['actual_entries'] = false; 
    1070                                          
     1159 
    10711160                                        $this->page_info['actual_letter'] = $letter; 
    10721161                                        $this->page_info['actual_page'] = 0; 
    1073                                          
     1162 
    10741163                                        $this->save_session(); 
    10751164                                        $final[0] = 0; 
    10761165                                        $final[1] = $this -> typeContact; 
    1077                                         echo serialize($final);                                  
     1166                                        echo serialize($final); 
    10781167                                        return; 
    10791168                                } 
     
    10921181                                } 
    10931182                                else if ($ids) 
    1094                                 {                                
     1183                                { 
    10951184                                        $this->page_info['actual_letter']  = $letter; 
    10961185                                        $this->page_info['actual_entries'] = $ids; 
     
    11091198                                        $page = $this->page_info['n_pages']; 
    11101199                                } 
    1111                                  
     1200 
    11121201                                $final = array( 
    11131202                                        0 => (int)$this->page_info['n_pages'], 
     
    11211210                                                5 => 'cc_alias', 
    11221211                                                6 => 'cc_id', 
    1123                                                 7 => 'cc_forwarding_address'                                             
     1212                                                7 => 'cc_forwarding_address', 
     1213                                                8 => 'cc_empNumber', 
     1214                                                9 => 'cc_department', 
     1215                                                10 => 'cc_mobile' 
    11241216                                        ) 
    11251217                                ); 
    1126                                  
     1218 
    11271219                                //echo 'Page: '.$page.'<br>'; 
    11281220                                $id_i = (($page-1)*$this->page_info['n_cards']); 
    11291221                                $id_f = $id_i + $this->page_info['n_cards']; 
    11301222                                $n_entries = count($this->page_info['actual_entries']); 
    1131                                  
     1223 
    11321224                                //echo 'ID_I: '.$id_i.'<br>'; 
    11331225                                //echo 'ID_F: '.$id_f.'<br>'; 
    1134                                  
     1226                                ///---------------- Correᅵᅵo Temporï¿œria PHP5 -----------------------/// 
     1227 
    11351228                                $ids = array(); 
     1229/**rev 104**/ 
    11361230                                $perms = array(); 
    11371231                                $owners = array(); 
    1138                                 $array_temp = array();                   
    1139                                  
     1232/****/ 
     1233                                $array_temp = array(); 
     1234 
    11401235                                foreach($this->page_info['actual_entries'] as $key=>$tmp){ 
    1141                                                 $array_temp[] = $tmp;                            
    1142                                 } 
    1143                          
     1236                                        $array_temp[] = $tmp; 
     1237                                } 
     1238 
    11441239                                for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
    11451240                                { 
     1241/**rev 104**/ 
    11461242                                        if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
     1243                                        { 
     1244/****/ 
    11471245                                                $ids[] = $array_temp[$i]; 
    1148                                         else { 
     1246/**rev 104**/ 
     1247                                        }else { 
    11491248                                                $ids[] = $array_temp[$i][0]; 
    11501249                                                $perms[] = $array_temp[$i][1]; 
    11511250                                                $owners[] = $array_temp[$i][2]; 
     1251/****/ 
    11521252                                        } 
    1153                                         //$perms[] = $array_temp[$i]; 
    1154                                 } 
    1155                                  
     1253                                } 
     1254 
     1255/**rev 104**/ 
    11561256                                // Carrega o nome completo dos donos dos objetos (contatos e grupos); 
    11571257                                $owner_names = array(); 
    1158                                                          
     1258 
    11591259                                if($owners) { 
    11601260                                        $filter = "(|"; 
     
    11681268                                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
    11691269                                        } 
    1170                                         $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false);                              
     1270                                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false); 
    11711271                                        $dn=$this->bo->catalog->src_info['dn']; 
    11721272                                        $justThese = array("cn","uidnumber","uid"); 
    1173                                         $sr = ldap_search($ds,$dn, $filter,$justThese);                                                          
     1273                                        $sr = ldap_search($ds,$dn, $filter,$justThese); 
    11741274                                        $info = ldap_get_entries($ds, $sr); 
    1175                                         ldap_close($ds);                                                                                         
     1275                                        ldap_close($ds); 
    11761276                                        for($z = 0; $z < $info['count']; $z++) { 
    11771277                                                $owner_names[$info[$z]['uidnumber'][0]] = array("cn" => $info[$z]['cn'][0], "uid" => $info[$z]['uid'][0]); 
    1178                                         }                                
    1179                                 } 
     1278                                        } 
     1279                                } 
     1280 
     1281/*****/ 
     1282 
     1283 
    11801284                                /// Original 
    11811285                                //for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
     
    11841288                                //} 
    11851289                                /// 
     1290 
    11861291                                $fields = $this->bo->catalog->get_fields(false); 
     1292/**rev 104**/ 
     1293                                //if( $this->typeContact == 'groups') { 
    11871294                                if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') { 
     1295/****/ 
    11881296                                        $final = array( 
    11891297                                                0 => (int)$this->page_info['n_pages'], 
     
    11941302                                                        2 => 'cc_id', 
    11951303                                                        3 => 'cc_contacts' 
    1196                                                 )                                                
    1197                                         );                                       
     1304                                                ) 
     1305                                        ); 
     1306 
    11981307                                        $groups =& $this->bo->catalog->get_multiple_entries($ids,$fields); 
    1199                                                                                                                          
     1308 
    12001309                                        $i = 0; 
    12011310                                        // contatos do grupo 
    1202                                         $boGroups = CreateObject('contactcenter.bo_group');                                      
     1311                                        $boGroups = CreateObject('contactcenter.bo_group'); 
    12031312                                        $contacts = array(); 
    1204                                          
    1205                                         foreach($groups as $group)              {        
     1313                                        foreach($groups as $group)              { 
     1314 
    12061315                                                $final[3][$i][0] = $group['title'] ? $group['title'] : 'none'; 
    1207                                                 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none';                                                 
     1316                                                $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; 
    12081317                                                $final[3][$i][2] = $group['id_group'] ? $group['id_group'] : 'none'; 
    12091318                                                $contacts = $boGroups -> get_contacts_by_group($group['id_group']); 
     
    12171326                                                $i++;                                                    
    12181327                                        } 
    1219                                          
     1328 
    12201329                                        $this->page_info['actual_letter'] = $letter; 
    1221                                         $this->page_info['actual_page'] = $page;                                         
    1222                                          
    1223                                          
     1330                                        $this->page_info['actual_page'] = $page; 
     1331 
     1332 
    12241333                                        $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 
    1225                                          
    1226                                         $final[5] = '<span class="link"  onclick="'.$lnk_compose;                                        
    1227                                         $final[10] = $this->typeContact;                                                                                                                                                                                                                 
    1228                                         $this->save_session();                                   
     1334 
     1335                                        $final[5] = '<span class="link"  onclick="'.$lnk_compose; 
     1336/**rev 104**/ 
     1337                                        //$final[10] = 'groups'; 
     1338                                        $final[10] = $this->typeContact; 
     1339/******/ 
     1340                                        $this->save_session(); 
    12291341                                        echo serialize($final); 
    1230                                         return;                                  
    1231                                 } 
     1342                                        return; 
     1343                                } 
     1344/**rev 104**/ 
    12321345                                $final[10] = $this -> typeContact; 
    1233                                  
     1346/*****/ 
     1347 
    12341348                                $fields['photo'] = true; 
    12351349                                $fields['names_ordered'] = true; 
     
    12381352                                $fields['companies'] = 'default'; 
    12391353                                $fields['connections'] = 'default'; 
     1354 
     1355/**rev 104**/ 
     1356                                // ?aqui alterar a chamada desse mï¿œtodo para receber o base dn? 
     1357                                //$contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields); 
     1358 
    12401359                                // ?aqui alterar a chamada desse método para receber o base dn? 
    12411360                                if($external) 
     1361                                { 
    12421362                                        $contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields,false,true); 
    1243                                 else 
     1363                                } else{ 
    12441364                                        $contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields); 
    1245                                  
    1246                                  
     1365                                } 
     1366 
     1367/*******/ 
     1368 
     1369 
    12471370                                if (!is_array($contacts) or !count($contacts)) 
    12481371                                { 
     
    12521375                                        return; 
    12531376                                } 
    1254                                  
     1377 
    12551378                                $i = 0; 
    12561379                                foreach($contacts as $index => $contact) 
    12571380                                { 
    12581381                                        /* 
    1259                                          * TODO: Os timeouts de conexão foram retirados, ver se será necessário retornar essa funcionalidade, e, 
    1260                                          * neste caso, terminar a implementação das mensagens de retorno. 
     1382                                         * TODO: Os timeouts de conexï¿œo foram retirados, ver se serï¿œ necessï¿œrio retornar essa funcionalidade, e, 
     1383                                         * neste caso, terminar a implementaᅵᅵo das mensagens de retorno. 
    12611384                                         */ 
    12621385                                        if ($index !== 'error'){ 
    12631386                                                $final[3][$i][0] = $contact['companies']['company1']['company_name']?$contact['companies']['company1']['company_name']:'none'; 
     1387 
     1388/**rev 104**/ 
     1389                                                //$final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered'] : 'none'; 
     1390 
    12641391                                                if($this->page_info['actual_catalog']['class']!='bo_global_ldap_catalog'){ 
    12651392                                                        $final[3][$i][1] = $contact['names_ordered'] ? urldecode($contact['names_ordered'])  : 'none'; 
     
    12691396                                                        $final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered']  : 'none'; 
    12701397                                                } 
     1398 
     1399/********/ 
     1400 
    12711401                                                $final[3][$i][2] = $contact['companies']['company1']['title']? urldecode( $contact['companies']['company1']['title'] ) :'none'; 
     1402 
     1403                                                //Para exibir a matricula do empregado 
     1404                                                $final[3][$i][8] = $contact['companies']['company1']['empNumber']?$contact['companies']['company1']['empNumber']:'none'; 
     1405                                                //Para exibir o setor/lotacao do empregado 
     1406                                                $final[3][$i][9] = $contact['companies']['company1']['department']?$contact['companies']['company1']['department']:'none'; 
     1407                                                //Para exibir o celular empresarial do empregado 
     1408                                                $final[3][$i][10] = $contact['companies']['company1']['celPhone']?$contact['companies']['company1']['celPhone']:'none'; 
     1409 
     1410                                                //Para exibir o celular empresarial do empregado 
     1411                                                if ($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && !$external && $final[3][$i][10] != 'none') 
     1412                                                            $final[3][$i][10] = "<a title=\"".lang("Call Mobile")."\" href=\"#\" onclick=\"connectVoip('".$final[3][$i][10]."', 'mob')\">".$final[3][$i][10]."</a>"; 
    12721413 
    12731414                                                /* Select the correct Email and Telephone to be shown */ 
    12741415                                                $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 
    1275                                                  
     1416 
    12761417                                                if (!is_array($preferences)) 
    12771418                                                { 
     
    12991440                                                                                $default_phone_found = true; 
    13001441                                                                        } 
     1442 
     1443/**rev 104**/ 
     1444                                                                        //if ($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && !$external){ 
     1445                                                                        //      $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'ramal')\">".$conn_info['connection_value']."</a>"; 
     1446 
    13011447                                                                        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){ 
    13021448                                                                                $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'com')\">".$conn_info['connection_value']."</a>"; 
     1449                                                                         
     1450/*****/ 
    13031451                                                                        } 
    13041452                                                                        $final[3][$i][3] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 
     
    13061454                                                        } 
    13071455                                                } 
    1308                                                  
     1456 
    13091457                                                if (!$final[3][$i][3]) 
    13101458                                                { 
     
    13201468                                                $final[3][$i][6] = $ids[$i]; 
    13211469 
    1322                                         //      If contact is a public list or a group, then load the forwarding addresses. 
     1470/**rev 104**/ 
     1471        /*                              //      If contact is a public list, then load the forwarding addresses. 
     1472                                                if($contact['account_type'][0] == 'l') 
     1473                                                        $final[3][$i][7] = array(); 
     1474        */ 
     1475 
     1476                                                //If contact is a public list or a group, then load the forwarding addresses. 
    13231477                                                if($contact['account_type'][0] == 'l' || $contact['account_type'][0] == 'g') 
    13241478                                                        $final[3][$i][7] = ($contact['account_type'][0] == 'l' ? 'list' : 'group'); 
    13251479                                                         
    13261480                                                if($this->page_info['actual_catalog']['class']=='bo_shared_people_manager') { 
    1327                                                         $final[3][$i][8] = $perms[$i]; 
    1328                                                         $final[3][$i][9] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 
     1481                                                        $final[3][$i][11] = $perms[$i]; 
     1482                                                        $final[3][$i][12] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 
    13291483                                                } 
     1484/******/ 
    13301485 
    13311486                                                $final[4][$i] = $contact['photo'] ? 1  : 0; 
    1332                                         //      print_r($final[3][$i]); 
    1333                                         //      exit; 
    13341487                                                $i++; 
    13351488                                        } 
     
    13381491                                                // coloca mensagem de erro no vetor que retorna para o browser 
    13391492                                        } 
    1340                                          
    13411493                                } 
    13421494                                $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 
     
    13471499                                $final[9] = $count; 
    13481500 
     1501 
    13491502                                $this->page_info['actual_letter'] = $letter; 
    13501503                                $this->page_info['actual_page'] = $page; 
    1351                                  
    1352                                 $this->save_session();                           
     1504 
     1505                                $this->save_session(); 
    13531506                                echo serialize($final); 
    13541507                                return; 
    13551508                        } 
    1356                          
     1509 
    13571510                        $this->page_info['actual_letter'] = $letter; 
    13581511                        $this->page_info['actual_page'] = $page; 
    1359                          
     1512 
    13601513                        $this->save_session(); 
    1361                          
     1514 
    13621515                        $final[0] = 0; 
    13631516                        $final[1] = $this -> typeContact; 
    13641517                        echo serialize($final); 
    13651518                } 
    1366                  
     1519 
    13671520                function get_visible_all_ldap() 
    13681521                { 
    13691522                        $bo = CreateObject('contactcenter.bo_ldap_manager'); 
    13701523                        $ldap_query = $bo->srcs; 
    1371                         return $ldap_query[1]['visible'];        
     1524                        return $ldap_query[1]['visible']; 
    13721525                } 
    13731526 
    1374   
     1527 
    13751528                /*! 
    1376                  
     1529 
    13771530                        @function get_group_data 
    13781531                        @abstract Returns all the information of a given Group 
    13791532                        @author Nilton Emilio Buhrer Neto 
    1380                          
     1533 
    13811534                        @param (integer) $id The id to get information 
    1382                  
    1383                 */               
     1535 
     1536                */ 
    13841537                function get_group_data($id,$shared_from=null) 
    13851538                { 
     
    13941547                         
    13951548                        $boGroup = CreateObject('contactcenter.bo_group'); 
    1396                                                  
     1549 
    13971550                        $all_contacts = $boGroup->get_all_contacts('only_email',$shared_from); 
    13981551                         
     
    14031556                                } 
    14041557                        } 
    1405                         $data['contact_list'] = $contact_options;                        
    1406                         $data['result'] = 'ok'; 
    1407                                                                                          
     1558                        $data['contact_list'] = $contact_options; 
     1559                        $data['result'] = 'ok';                                                          
    14081560                        echo serialize($data);                   
    14091561                }                
    14101562                 
    14111563                /*! 
    1412                  
     1564 
    14131565                        @function get_full_data 
    14141566                        @abstract Returns all the information of a given Entry 
    14151567                        @author Raphael Derosso Pereira 
    1416                          
     1568 
    14171569                        @param (integer) $id The id to get information 
    1418                  
     1570 
    14191571                */ 
     1572/**rev 104**/ 
     1573                //function get_full_data($id) 
    14201574                function get_full_data($id,$catalog='bo_people_catalog') 
    14211575                { 
    14221576                        $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 
    1423                         $this->bo->catalog = CreateObject('contactcenter.'.$catalog);            
     1577/**rev 104**/ 
     1578                        //$this->bo->catalog = CreateObject('contactcenter.bo_people_catalog'); 
     1579                        $this->bo->catalog = CreateObject('contactcenter.'.$catalog); 
     1580/****/ 
    14241581                        $fields = $this->bo->catalog->get_fields(true); 
    14251582                        $fields['photo'] = false; 
     
    14541611                        } 
    14551612                        $datecount = 0; 
    1456                          
     1613 
    14571614                        $data['result'] = 'ok'; 
    14581615                        $data['cc_full_add_contact_id'] = $id; 
     
    14931650                                } 
    14941651                        } 
    1495                          
     1652//                      print_r($data); 
     1653//OBSERVAR cc_department 
    14961654                        /*Corporative*/ 
    14971655                        $data['personal']['cc_name_corporate'] = $entry['corporate_name']; 
     
    15001658                        $data['personal']['cc_name_corporate'] = $entry['corporate_name']; 
    15011659                        $data['personal']['cc_web_page'] = $entry['web_page']; 
    1502                          
    1503                          
     1660 
     1661 
    15041662                        /* Relations */ 
    1505                          
     1663 
    15061664                        echo serialize($data); 
    15071665                } 
     
    15401698                                return; 
    15411699                        } 
    1542                          
     1700 
    15431701                        echo 0; 
    15441702                } 
    1545                  
     1703 
    15461704                /*! 
    1547                  
     1705 
    15481706                        @function quick_add 
    15491707                        @abstract Adds a new Contact using the Quick Add interface 
    15501708                        @author Raphael Derosso Pereira 
    1551                          
     1709 
    15521710                        @param string $sdata Serialized data 
    15531711                */ 
    15541712                function quick_add($sdata) 
    15551713                { 
    1556                          
     1714 
    15571715                        $sdata = str_replace('\\"', '"', $sdata); 
    15581716                        $new_array = unserialize($sdata); 
    15591717                        $tdata = array(); 
    1560                          
     1718 
    15611719                        foreach($new_array as $tmp) 
    15621720                                $tdata[] = $tmp; 
    1563                          
     1721 
    15641722                        if (!$tdata) 
    15651723                        { 
     
    15681726                                        'status' => 'abort' 
    15691727                                )); 
    1570                                  
     1728 
    15711729                                return; 
    15721730                        } 
    1573                          
    1574                         // verifica se email já existe! 
     1731 
     1732                        // verifica se email jï¿œ existe! 
    15751733                        $boGroup = CreateObject('contactcenter.bo_group'); 
    15761734                        $contact = $boGroup->verify_contact($tdata[4]); 
    1577                                                                                                  
     1735 
    15781736                        if($contact) 
    1579                         {                                                        
     1737                        { 
    15801738                                $str_contact = "\r\n - ".implode("\r\n - ",$contact); 
    1581                                  
     1739 
    15821740                                echo serialize(array( 
    15831741                                        'msg'    => lang('Problems on adding your Contact. The email "%1" already exists in: %2',$tdata[4], $str_contact), 
    15841742                                        'status' => 'alreadyExists' 
    15851743                                )); 
    1586                                  
    1587                                 return;                  
     1744 
     1745                                return; 
    15881746                        } 
    15891747 
     
    16001758 
    16011759                        if ($boPeople ->quick_add($data)) 
    1602                         {                                
     1760                        { 
    16031761                                $this->page_info['changed'] = true; 
    1604                                  
     1762 
    16051763                                echo serialize(array( 
    16061764                                        'msg'    => lang('Entry added with success!'), 
     
    16161774                        } 
    16171775 
    1618                         $this->save_session();   
    1619                          
     1776                        $this->save_session(); 
     1777 
    16201778                } 
    16211779 
    16221780                /*! 
    1623                  
     1781 
    16241782                        @function add_group 
    16251783                        @abstract Adds a new Group using the Add Group interface 
    16261784                        @author Nilton Emilio Buhrer Neto 
    1627                          
     1785 
    16281786                        @param string $sdata Serialized data 
    16291787                */ 
     
    16331791                        $tdata = unserialize($sdata); 
    16341792                        $new_tdata = array(); 
    1635                          
     1793 
    16361794                        if (!$tdata) 
    16371795                        { 
     
    16401798                                        'status' => 'abort' 
    16411799                                )); 
    1642                                  
     1800 
    16431801                                return; 
    16441802                        } 
    1645                          
     1803 
    16461804                        foreach($tdata as $tmp) 
    16471805                                $new_tdata[] = $tmp; 
    1648                          
    1649                         $data['title'] = $new_tdata[0];                  
     1806 
     1807                        $data['title'] = $new_tdata[0]; 
    16501808                        $data['contact_in_list'] = $new_tdata[1]; 
    16511809                        $data['id_group'] = $new_tdata[2]; 
    1652                                                  
     1810 
    16531811                        $boGroup = CreateObject('contactcenter.bo_group_manager'); 
    16541812                        $id = $boGroup -> add_group($data); 
    1655                          
     1813 
    16561814                        if ($id) 
    16571815                        { 
    16581816                                $this->page_info['changed'] = true; 
    1659                                  
     1817 
    16601818                                echo serialize(array( 
    16611819                                        'msg'    => lang('Entry added with success!'), 
     
    16751833 
    16761834                /*! 
    1677                  
     1835 
    16781836                        @function remove_group 
    16791837                        @abstract Removes a group if the user has the right to do it 
    1680                         @author Nilton Emilio Buhrer Neto                        
     1838                        @author Nilton Emilio Buhrer Neto 
    16811839                        @param (integer) $id The id to be removed 
    1682                                  
     1840 
    16831841                */ 
    16841842                function remove_group($id) 
    1685                 {                                
    1686                                 $soGroup = CreateObject('contactcenter.so_group');                               
     1843                { 
     1844                                $soGroup = CreateObject('contactcenter.so_group'); 
    16871845                                $data = array ('id_group' => $id); 
    16881846                                if($soGroup -> delete($data)) { 
     
    16901848                                                'msg'    => lang('Removed Entry ID '.$id.'!'), 
    16911849                                                'status' => 'ok' 
    1692                                         ));                                                      
     1850                                        )); 
    16931851                                } 
    16941852                                else { 
     
    16991857                                } 
    17001858 
    1701                         $this->save_session();                           
     1859                        $this->save_session(); 
    17021860                } 
    17031861 
    17041862 
    17051863                function remove_all_entries (){ 
    1706                  
     1864 
    17071865                        $error = false; 
    17081866                        $this->all_entries = $this->bo->catalog->get_all_entries_ids(); 
     
    17121870                                if(!$result) { 
    17131871                                        $error = true; 
    1714                                         break;           
     1872                                        break; 
    17151873                                } 
    17161874                        } 
     
    17211879                                        'status' => 'ok' 
    17221880                                )); 
    1723                         }  
     1881                        } 
    17241882                        else { 
    17251883                                echo serialize(array( 
     
    17331891 
    17341892                /*! 
    1735                  
     1893 
    17361894                        @function remove_entry 
    17371895                        @abstract Removes an entry if the user has the right to do it 
    17381896                        @author Raphael Derosso Pereira 
    1739                          
     1897 
    17401898                        @param (integer) $id The id to be removed 
    1741                                  
     1899 
    17421900                */ 
    17431901                function remove_entry ($id) 
     
    17481906                                return; 
    17491907                        } 
    1750                          
     1908 
    17511909                        $this->page_info['changed'] = true; 
    17521910                        $result = $this->bo->catalog->remove_single_entry($id); 
    1753                          
     1911 
    17541912                        if ($result) 
    17551913                        { 
     
    17581916                                        unset($this->page_info['actual_entries'][$pos]); 
    17591917                                } 
    1760                                  
     1918 
    17611919                                $temp = false; 
    17621920                                reset($this->page_info['actual_entries']); 
     
    17651923                                        $temp[] = $t; 
    17661924                                } 
    1767                                  
     1925 
    17681926                                $this->page_info['actual_entries'] = $temp; 
    17691927 
     
    17801938                                )); 
    17811939                        } 
    1782                          
     1940 
    17831941                        $this->save_session(); 
    17841942                } 
    17851943 
    1786                  
     1944 
    17871945                /*! 
    1788                  
     1946 
    17891947                        @function post_full_add 
    17901948                        @abstract Saves all the information altered/entered in the Full Add 
     
    17961954                { 
    17971955                        $data =  $_POST['data']; 
    1798                         // Exceptions!!! utf8 special chars.  
     1956                        // Exceptions!!! utf8 special chars. 
    17991957                        $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 
    18001958                        $data = unserialize(str_replace('\\"', '"', $data)); 
     
    18231981                                        'status' => 'fatal' 
    18241982                                )); 
    1825                                  
     1983 
    18261984                                return; 
    18271985                        } 
     
    18371995                                $id_photo = '_new_'; 
    18381996                        } 
    1839                          
    1840                         /*  
    1841                          * Process Photo, if available  
     1997 
     1998                        /* 
     1999                         * Process Photo, if available 
    18422000                         */ 
    18432001                        $sleep_count = 0; 
     
    18562014                        } 
    18572015                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 
    1858                          
     2016 
    18592017                        if (isset($this->page_info['photos'][$id_photo])) 
    18602018                        { 
     
    18732031                                $this->save_session(); 
    18742032                        } 
    1875                          
     2033 
    18762034                        /* 
    18772035                         * Arrange Date so it gets inserted correctly 
    18782036                         */ 
    1879                           
     2037 
    18802038                        $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 
    1881                  
     2039 
    18822040                        $j = 0; 
    18832041                        for ($i = 0; $i < 5; $i+=2) 
     
    19122070                                        continue; 
    19132071                                } 
    1914                                  
     2072 
    19152073                                switch($field) 
    19162074                                { 
     
    19292087                                                /* Do Nothing. This is just to make sure no invalid field is passed */ 
    19302088                                                break; 
    1931                                          
     2089 
    19322090                                        case 'id_status': 
    19332091                                        case 'id_prefix': 
     
    19382096                                                } 
    19392097                                                break; 
    1940                                          
     2098 
    19412099                                        case 'birthdate_0': 
    19422100                                        case 'birthdate_1': 
    19432101                                        case 'birthdate_2': 
    1944                                          
     2102 
    19452103                                                switch($date[$datecount]['digit']) 
    19462104                                                { 
     
    19642122                                                        break; 
    19652123                                                } 
    1966                                                  
     2124 
    19672125                                                if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 
    19682126                                                { 
     
    19732131                                                        return; 
    19742132                                                } 
    1975                                                  
     2133 
    19762134                                                $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 
    19772135                                                break; 
     
    19962154                                                        { 
    19972155                                                                $index = 'address'.$type; 
    1998                                                                  
     2156 
    19992157                                                                $id_state = $this->bo->catalog->add_state($state_info); 
    20002158                                                                $data['addresses'][$index]['id_state'] = $id_state; 
     
    20142172                                                        { 
    20152173                                                                $index = 'address'.$type; 
    2016                                                                  
     2174 
    20172175                                                                $id_city = $this->bo->catalog->add_city($city_info); 
    20182176                                                                $data['addresses'][$index]['id_city'] = $id_city; 
     
    20552213                                ); 
    20562214                        } 
    2057                          
     2215 
    20582216                        eval($code); 
    20592217 
     
    20742232                { 
    20752233                        $data =  $_POST['data']; 
    2076                         // Exceptions!!! utf8 special chars.  
     2234                        // Exceptions!!! utf8 special chars. 
    20772235                        $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 
    20782236                        $data = unserialize(str_replace('\\"', '"', $data)); 
     
    21012259                                        'status' => 'fatal' 
    21022260                                )); 
    2103                                  
     2261 
    21042262                                return; 
    21052263                        } 
     
    21212279                                unset($data['owner']); 
    21222280                        } 
    2123                         /*  
    2124                          * Process Photo, if available  
     2281                        /* 
     2282                         * Process Photo, if available 
    21252283                         */ 
    21262284                        $sleep_count = 0; 
     
    21392297                        } 
    21402298                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 
    2141                          
     2299 
    21422300                        if (isset($this->page_info['photos'][$id_photo])) 
    21432301                        { 
     
    21562314                                $this->save_session(); 
    21572315                        } 
    2158                          
     2316 
    21592317                        /* 
    21602318                         * Arrange Date so it gets inserted correctly 
    21612319                         */ 
    2162                           
     2320 
    21632321                        $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 
    2164                  
     2322 
    21652323                        $j = 0; 
    21662324                        for ($i = 0; $i < 5; $i+=2) 
     
    21952353                                        continue; 
    21962354                                } 
    2197                                  
     2355 
    21982356                                switch($field) 
    21992357                                { 
     
    22082366                                                /* Do Nothing. This is just to make sure no invalid field is passed */ 
    22092367                                                break; 
    2210                                          
     2368 
    22112369                                        case 'id_status': 
    22122370                                        case 'id_prefix': 
     
    22172375                                                } 
    22182376                                                break; 
    2219                                          
     2377 
    22202378                                        case 'birthdate_0': 
    22212379                                        case 'birthdate_1': 
    22222380                                        case 'birthdate_2': 
    2223                                          
     2381 
    22242382                                                switch($date[$datecount]['digit']) 
    22252383                                                { 
     
    22432401                                                        break; 
    22442402                                                } 
    2245                                                  
     2403 
    22462404                                                if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 
    22472405                                                { 
     
    22522410                                                        return; 
    22532411                                                } 
    2254                                                  
     2412 
    22552413                                                $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 
    22562414                                                break; 
     
    22752433                                                        { 
    22762434                                                                $index = 'address'.$type; 
    2277                                                                  
     2435 
    22782436                                                                $id_state = $this->bo->catalog->add_state($state_info); 
    22792437                                                                $data['addresses'][$index]['id_state'] = $id_state; 
     
    22932451                                                        { 
    22942452                                                                $index = 'address'.$type; 
    2295                                                                  
     2453 
    22962454                                                                $id_city = $this->bo->catalog->add_city($city_info); 
    22972455                                                                $data['addresses'][$index]['id_city'] = $id_city; 
     
    23342492                                ); 
    23352493                        } 
    2336                          
     2494 
    23372495                        eval($code); 
    23382496 
     
    23492507} 
    23502508                /*! 
    2351                  
     2509 
    23522510                        @function post_photo 
    23532511                        @abstract Wrapper to post a photo without reload a page. 
     
    23592517                        //print_r($_FILES); 
    23602518                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'y')); 
    2361                          
     2519 
    23622520                        if (!is_array($_FILES) and is_array(!$_FILES['cc_pd_photo'])) 
    23632521                        { 
    23642522                                $this->page_info['photos'][$id]['status'] = 'no_upload'; 
    23652523                                $this->page_info['photos'][$id]['msg'] = lang('No Photos uploaded to Server.'); 
    2366                                  
     2524 
    23672525                                $this->save_session(); 
    23682526                                $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 
     
    23742532                                $this->page_info['photos'][$id]['status'] = 'no_GD_lib'; 
    23752533                                $this->page_info['photos'][$id]['msg'] = lang('Cannot manipulate Image. No Image added. Please, if you want to use images, ask the Administrator to install GD library.'); 
    2376                                  
     2534 
    23772535                                $this->save_session(); 
    23782536                                $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 
     
    24002558                                return; 
    24012559                        } 
    2402                          
     2560 
    24032561                        switch($_FILES['cc_pd_photo']['type']) 
    24042562                        { 
     
    24302588 
    24312589                                default: 
    2432                                          
     2590 
    24332591                                        $this->page_info['photos'][$id]['status'] = 'invalid_image'; 
    24342592                                        $this->page_info['photos'][$id]['msg'] = lang('The file must be an JPEG, PNG or GIF Image.'); 
     
    24432601                                        $this->page_info['photos'][$id]['status'] = 'invalid_file'; 
    24442602                                        $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 
    2445                                          
     2603 
    24462604                                        $this->save_session(); 
    24472605                                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 
    24482606                                        return; 
    24492607                        } 
    2450                          
     2608 
    24512609                        $img_size = getimagesize($_FILES['cc_pd_photo']['tmp_name']); 
    24522610                        $dst_img = imagecreatetruecolor(60, 80); 
    2453                          
     2611 
    24542612                        if (!imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, 60, 80, $img_size[0], $img_size[1])) 
    24552613                        { 
    24562614                                $this->page_info['photos'][$id]['status'] = 'invalid_file'; 
    24572615                                $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 
    2458                                  
     2616 
    24592617                                $this->save_session(); 
    24602618                                $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 
    24612619                                return; 
    24622620                        } 
    2463                          
     2621 
    24642622                        ob_start(); 
    24652623                        imagepng($dst_img); 
     
    24712629 
    24722630                        $this->save_session(); 
    2473                  
     2631 
    24742632                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 
    24752633 
     
    24922650                        $fields = $this->bo->catalog->get_fields(false); 
    24932651                        $fields['photo'] = true; 
    2494                          
     2652 
    24952653                        $contact = $this->bo->catalog->get_single_entry($id, $fields); 
    24962654 
     
    25012659                                return; 
    25022660                        } 
    2503                          
     2661 
    25042662                        header('Content-type: image/jpeg'); 
    25052663                        $photo = imagecreatefromstring ($contact['photo']); 
     
    25132671                        return; 
    25142672                } 
    2515                  
     2673 
    25162674                /*! 
    2517                  
     2675 
    25182676                        @function get_states 
    25192677                        @abstract Echos a serialized array containing all the states for the given country 
     
    25372695                                return; 
    25382696                        } 
    2539                          
     2697 
    25402698                        $result = array( 
    25412699                                'msg'    => lang('States Successfully retrieved!'), 
    25422700                                'status' => 'ok' 
    25432701                        ); 
    2544                          
     2702 
    25452703                        foreach ($states as $state_info) 
    25462704                        { 
     
    25812739                                return; 
    25822740                        } 
    2583                          
     2741 
    25842742                        $result = array( 
    25852743                                'msg'    => lang('Cities Successfully retrieved!'), 
    25862744                                'status' => 'ok' 
    25872745                        ); 
    2588                          
     2746 
    25892747                        foreach ($cities as $city_info) 
    25902748                        { 
    25912749                                $result['data'][$city_info['id_city']] = $city_info['name']; 
    25922750                        } 
    2593                          
     2751 
    25942752                        echo serialize($result); 
    25952753                } 
     
    25972755 
    25982756                /*! 
    2599                  
     2757 
    26002758                        @function search 
    26012759                        @abstract Echos a serialized array containing the IDs 
    26022760                                of the entries that matches the search argument 
    26032761                        @author Raphael Derosso Pereira 
    2604                         @author Mário César Kolling (external catalogs) 
     2762                        @author Mï¿œrio Cï¿œsar Kolling (external catalogs) 
    26052763 
    26062764                        @param string $str_data A serialized array with two informations: 
     
    26172775                        // It's an external catalog? 
    26182776                        $external = $this->bo->is_external($this->page_info['actual_catalog']); 
    2619                          
    2620             if (!is_array($data) || !$data['search_for'] || !is_array($data['fields'])) 
    2621             { 
    2622                 echo serialize(array(                                                                                                    
    2623                    'msg'    => lang('Invalid parameters'),                                                                              
    2624                     'status' => 'abort' 
    2625                 )); 
    2626              
    2627                 return array('error' => lang('Invalid parameters'));                                                                                                                  
    2628             }    
    2629  
    2630              
     2777 
     2778                        if (!is_array($data) || !$data['search_for'] || !is_array($data['fields'])) 
     2779                        { 
     2780                                echo serialize(array( 
     2781                                        'msg'    => lang('Invalid parameters'), 
     2782                                        'status' => 'abort' 
     2783                                )); 
     2784 
     2785                                return array('error' => lang('Invalid parameters')); 
     2786                        } 
     2787 
     2788 
    26312789                        /* 
    26322790                         * TODO: look into the database to discover the database's encoding and convert the search_for field accordingly 
     
    26342792                        // Support search parameters with accentuation 
    26352793                        if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
     2794/**rev 104**/ 
     2795                                //$this->page_info['actual_catalog']['class'] != 'bo_group_manager') 
    26362796                                $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
    26372797                                $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 
    26382798                                $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
     2799/****/ 
    26392800                        { 
    26402801 
    26412802                                $data['search_for'] = utf8_encode($data['search_for']); 
    26422803                        } 
    2643              
    2644             $rules  = array();                                                                                                           
    2645              
    2646              
    2647             if ($data['search_for'] === '*')                                                                                             
    2648             { 
    2649                 $rules = array(                                                                                                          
    2650                     0 => array(                                                                                                          
    2651                         'field' => $data['fields']['search'],                                                                            
    2652                         'type'  => 'LIKE', 
    2653                         'value' => '%' 
    2654                     )    
    2655                 );   
    2656             }    
    2657             else                                                                                                                         
    2658             { 
    2659                 $names = explode(' ', $data['search_for']);                                                                              
    2660                  
    2661                 if (!is_array($names))                                                                                                   
    2662                 { 
    2663                     echo serialize(array(                                                                                                
    2664                         'msg'    => lang('Invalid Search Parameter'),                                                                    
    2665                         'status' => 'abort' 
    2666                     )); 
    2667   
    2668                 } 
     2804 
     2805                        $rules  = array(); 
     2806 
     2807                        if ($data['search_for'] === '*') 
     2808                        { 
     2809                                $rules = array( 
     2810                                        0 => array( 
     2811                                                'field' => $data['fields']['search'], 
     2812                                                'type'  => 'LIKE', 
     2813                                                'value' => '%' 
     2814                                        ) 
     2815                                ); 
     2816                        } 
     2817                        else 
     2818                        { 
     2819                                $names = explode(' ', $data['search_for']); 
     2820 
     2821                                if (!is_array($names)) 
     2822                                { 
     2823                                        echo serialize(array( 
     2824                                                'msg'    => lang('Invalid Search Parameter'), 
     2825                                                'status' => 'abort' 
     2826                                        )); 
     2827 
     2828                                } 
    26692829 
    26702830                                if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 
     2831/**rev 104**/ 
     2832                                        //$this->page_info['actual_catalog']['class'] != 'bo_group_manager') 
    26712833                                        $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 
    2672                                         $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' &&                                     
     2834                                        $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 
    26732835                                        $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager' ) 
     2836/*****/ 
    26742837                                { 
    26752838                                        /* 
     
    26882851                                                        'value' => '%' 
    26892852                                                ), 
     2853/**rev 104**/ 
     2854                                                /// 
     2855                                                //1 => array( 
    26902856                                                2 => array( 
     2857/*****/ 
    26912858                                                        'field' => 'contact.account_visible', 
    26922859                                                        'type'  => '!=', 
    26932860                                                        'value' => '-1' 
     2861/**rev 104**/ 
     2862        /*                                      ), 
     2863                                                2 => array( 
     2864                                                        'field' => 'contact.object_class', 
     2865                                                        'type'  => '=', 
     2866                                                        'value' => 'inetOrgPerson' 
     2867/****/ 
    26942868                                                ), 
    26952869                                        ); 
    26962870                                } 
    2697                  
    2698                 foreach ($names as $name) 
    2699                 { 
    2700                     if ($name != '') 
    2701                     { 
    2702                         array_push($rules, array( 
    2703                             'field' => $data['fields']['search'], 
    2704                             'type'  => 'iLIKE', 
    2705                             'value' => '%'.$name.'%' 
    2706                         )); 
    2707                     } 
    2708                 } 
    2709             } 
     2871 
     2872                                foreach ($names as $name) 
     2873                                { 
     2874                                        if ($name != '') 
     2875                                        { 
     2876                                                array_push($rules, array( 
     2877                                                        'field' => $data['fields']['search'], 
     2878                                                        'type'  => 'iLIKE', 
     2879                                                        'value' => '%'.$name.'%' 
     2880                                                )); 
     2881                                        } 
     2882                                } 
     2883                        } 
    27102884 
    27112885                        if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 
     2886/**rev 104**/ 
     2887                                //$this->page_info['actual_catalog']['class'] == 'bo_group_manager') 
    27122888                                $this->page_info['actual_catalog']['class'] == 'bo_group_manager' || 
    27132889                                $this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager' || 
    2714                                 $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager'        ) 
     2890                                $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 
     2891 
     2892 
     2893/***/ 
    27152894                        { 
    27162895                                // Get only this attributes: dn, cn for external catalogs, 
     
    27282907                                        //'contact.account_status', 
    27292908                                        'contact.account_visible' 
    2730                                         ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 
    2731                         } 
    2732  
    2733             if (!is_array($ids) || !count($ids)) 
    2734             { 
     2909                                        ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC'), $data['search_for_area'] ); 
     2910                        } 
     2911 
     2912                        if (!is_array($ids) || !count($ids)) 
     2913                        { 
    27352914                                $this->last_search_ids = null; 
    27362915                                $this->save_session(); 
    27372916                                return null; 
    2738             } 
    2739  
    2740             $id_field = substr($data['fields']['id'], strrpos($data['fields']['id'], '.')+1); 
    2741                          
    2742             $ids_f = array(); 
    2743  
    2744             foreach ($ids as $e_info) 
    2745             { 
     2917                        } 
     2918 
     2919                        $id_field = substr($data['fields']['id'], strrpos($data['fields']['id'], '.')+1); 
     2920 
     2921                        $ids_f = array(); 
     2922 
     2923                        foreach ($ids as $e_info) 
     2924                        { 
     2925/**rev 104**/ 
     2926                                //$ids_f[] = $e_info[$id_field]; 
    27462927                                if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 
    2747                         $ids_f[] = $e_info[$id_field]; 
    2748                 else 
    2749                         $ids_f[] = array(0=>$e_info[$id_field],1=>$e_info['perms']); 
    2750             } 
     2928                                { 
     2929                                        $ids_f[] = $e_info[$id_field]; 
     2930                                } else{ 
     2931                                        $ids_f[] = array(0=>$e_info[$id_field],1=>$e_info['perms']); 
     2932                                } 
     2933/****/ 
     2934                        } 
    27512935 
    27522936                        return $ids_f; 
    27532937                } 
    2754                  
     2938 
    27552939                // CELEPAR 
    27562940                /* 
     
    27912975                        'status' => 'abort' 
    27922976                    )); 
    2793                      
     2977 
    27942978                    return; 
    27952979                } 
    2796                  
     2980 
    27972981                foreach ($names as $name) 
    27982982                { 
     
    28082992            } 
    28092993 
    2810              
    2811              
     2994 
     2995 
    28122996            //$catalog = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 
    2813              
     2997 
    28142998            //if ($catalog['class'] === 'bo_people_catalog') 
    28152999            //{ 
     
    28203004            //    )); 
    28213005            //} 
    2822              
    2823              
     3006 
     3007 
    28243008            $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 
    28253009 
     
    28463030                'status' => 'ok' 
    28473031            )); 
    2848                          
     3032 
    28493033                        return; 
    28503034        }*/ 
     
    28563040                        @author Raphael Derosso Pereira 
    28573041 
    2858                         @param array str_data A serialized array containing the ID's of the entries  
     3042                        @param array str_data A serialized array containing the ID's of the entries 
    28593043                                to be taken, the fields to be taken and the rules to be used on the 
    28603044                                retrieval: 
     
    28693053                { 
    28703054                        $data = unserialize($str_data); 
    2871                          
     3055 
    28723056                        if (!is_array($data) or !count($data) or !count($data['fields']) or !count($data['ids'])) 
    28733057                        { 
     
    28793063 
    28803064                        $entries = $this->bo->catalog->get_multiple_entries($data['ids'], $data['fields']); 
    2881                          
     3065 
    28823066                        if (!is_array($entries) or !count($entries)) 
    28833067                        { 
     
    28983082 
    28993083                        @function get_all_entries 
    2900                         @abstract Returns the specified fields for all catalog's entries  
     3084                        @abstract Returns the specified fields for all catalog's entries 
    29013085                                in the default CC UI format 
    29023086                        @author Raphael Derosso Pereira 
    29033087 
    2904                         @params array str_data A serialized array containing the fields to  
     3088                        @params array str_data A serialized array containing the fields to 
    29053089                                be grabbed, the maximum number of entries to be returned and a 
    29063090                                boolean specifying if the calls refers to a new grab or to an 
     
    29113095                { 
    29123096                        $data = unserialize($str_data); 
    2913                          
    2914                         if (!is_array($data) or  
    2915                             !count($data) or  
    2916                                 !count($data['fields']) or  
     3097 
     3098                        if (!is_array($data) or 
     3099                            !count($data) or 
     3100                                !count($data['fields']) or 
    29173101                                !$data['maxlength'] or 
    29183102                                (!$data['new'] and !$data['offset'])) 
     
    29403124                                $data['offset'] = 0; 
    29413125                        } 
    2942                          
     3126 
    29433127                        if ($data['maxlength'] != -1) 
    29443128                        { 
     
    29513135 
    29523136                        $prefs = ExecMethod('contactcenter.ui_preferences.get_preferences'); 
    2953                          
     3137 
    29543138                        $jsCode = array(); 
    29553139                        $count = 0; 
     
    29613145                                } 
    29623146 
    2963                                 if($this-> typeContact == 'groups') {                            
    2964                                          
     3147                                if($this-> typeContact == 'groups') { 
     3148 
    29653149                                        foreach ($each as $field => $value)     { 
    2966                                                                                  
     3150 
    29673151                                                if ($field === 'title') { 
    29683152                                                        $optionName = '\\"'.$value.'\\"'; 
    2969                                                           
     3153 
    29703154                                                } 
    29713155                                                else if ($field === 'short_name')       { 
    2972                                                          
     3156 
    29733157                                                        $jsCode[] = '_this.entries.options[_this.entries.options.length] = new Option("'.$optionName.' ('.$value.')", "'.$count.'");'; 
    2974                                                         $count++;                                                                                                                                                                        
    2975                                                 }                                        
     3158                                                        $count++; 
     3159                                                } 
    29763160                                        } 
    29773161                                } 
    2978                                  
    2979                                 else  {  
     3162 
     3163                                else  { 
    29803164                                        foreach ($each as $field => $value)     { 
    29813165                                                if ($field === 'names_ordered') { 
     
    29853169                                                } 
    29863170                                                else if ($field === 'connections')      { 
    2987                                                          
     3171 
    29883172                                                        foreach ($value as $connection)         { 
    29893173                                                                if ($connection['id_type'] == $prefs['personCardEmail'])        { 
     
    29983182 
    29993183                        $jsCodeFinal = implode("\n", $jsCode); 
    3000                          
     3184 
    30013185                        $nEntries = count($result); 
    3002                          
     3186 
    30033187                        if (!$nEntries) 
    30043188                        { 
     
    30183202                        ); 
    30193203                } 
    3020                  
     3204 
    30213205                /*********************************************************************\ 
    30223206                 *                      Auxiliar Methods                             * 
     
    30243208 
    30253209                /*! 
    3026                  
     3210 
    30273211                        @function save_session 
    30283212                        @abstract Saves the data on the session 
    30293213                        @author Raphael Derosso Pereira 
    3030                  
     3214 
    30313215                */ 
    30323216                function save_session() 
     
    30373221 
    30383222                /*! 
    3039                  
     3223 
    30403224                        @function convert_tree 
    30413225                        @abstract Converts the tree array in the BO format to a JS tree array compatible 
    30423226                                with the one available in eGW 
    30433227                        @author Raphael Derosso Pereira 
    3044                  
     3228 
    30453229                        @param (array)  $tree    The tree in the BO format 
    30463230                        @param (string) $name    The tree name 
     
    30763260                                        'caption' => $value['name'] 
    30773261                                ); 
    3078                                  
     3262 
    30793263                                switch($value['type']) 
    30803264                                { 
     
    30993283                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
    31003284                        } 
    3101                          
    3102                         $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);                               
     3285 
     3286                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 
    31033287                        $dn=$this->bo->catalog->src_info['dn']; 
    31043288                        $justThese = array("givenname","givenname","sn","telephonenumber","mail"); 
    3105                         $sr = ldap_read($ds,$id, "objectClass=*",$justThese);                                                    
    3106                         $info = ldap_get_entries($ds, $sr);                                                      
     3289                        $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 
     3290                        $info = ldap_get_entries($ds, $sr); 
    31073291                        for($z = 0; $z < 5; $z++) { 
    3108                                 $participant = $info[0][$justThese[$z]];                                                                                                         
     3292                                $participant = $info[0][$justThese[$z]]; 
    31093293                                array_push($array_participants, $participant); 
    31103294                        } 
     
    31123296                        ldap_close($ds); 
    31133297                        echo serialize($array_participants); 
    3114                 }        
    3115                  
    3116                 function get_catalog_participants_group($id)  
     3298                } 
     3299 
     3300                function get_catalog_participants_group($id) 
    31173301                { 
    31183302                        if(!$this->bo->catalog->src_info) { 
    31193303                                $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
    31203304                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
    3121                         }                        
    3122                         $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);                       
    3123                         $justThese = array("description","memberuid");                   
    3124                         $sr = ldap_read($ds,$id, "objectClass=*",$justThese);                                                    
     3305                        } 
     3306                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 
     3307                        $justThese = array("description","memberuid"); 
     3308                        $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 
    31253309                        $info = ldap_get_entries($ds, $sr); 
    31263310                        $member_uids = $info[0]['memberuid']; 
    31273311                        $contact['names_ordered'] = $info[0]['description']; 
    3128                         $filter = "";                    
     3312                        $filter = ""; 
    31293313                        for($z = 0; $z < count($member_uids); $z++) { 
    31303314                                if($member_uids[$z]) 
    3131                                         $filter.="(uid=".$member_uids[$z].")";   
     3315                                        $filter.="(uid=".$member_uids[$z].")"; 
    31323316                        } 
    31333317                        $array_participants = array(); 
     
    31383322                                $dn = implode(',',$valarray); 
    31393323                                $justThese = array("cn","mail"); 
    3140                                 $sr = ldap_search($ds,$dn, $filter,$justThese);                                                          
    3141                                 $info = ldap_get_entries($ds, $sr);                                                      
     3324                                $sr = ldap_search($ds,$dn, $filter,$justThese); 
     3325                                $info = ldap_get_entries($ds, $sr); 
    31423326                                for($z = 0; $z < $info['count']; $z++) { 
    31433327                                        $participant =  '<font color=\'DARKBLUE\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;'.$info[$z]['cn'][0].'&quot; &lt;'.$info[$z]['mail'][0].'&gt;</font><br>'; 
    3144                                         $array_emails[$info[$z]['mail'][0]] = null;                                                              
    3145                                         array_push($array_participants, $participant);                                   
     3328                                    $array_emails[$info[$z]['mail'][0]] = null; 
     3329                                        array_push($array_participants, $participant); 
    31463330                                } 
    31473331                                ldap_close($ds); 
    3148                         }                        
     3332                        } 
    31493333                        sort($array_participants); 
    3150                         $innerHTML = '';                         
     3334                        $innerHTML = ''; 
    31513335                        foreach($array_participants as $index => $participant){ 
    31523336                                $innerHTML .= $participant; 
    31533337                        } 
    3154                         $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML);                   
     3338                        $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 
    31553339                        echo serialize($return); 
    31563340                } 
    31573341 
    3158                 function get_catalog_participants_list($id)  
     3342                function get_catalog_participants_list($id) 
    31593343                { 
    3160                          
    3161                         $fields = $this->bo->catalog->get_fields(false);                         
     3344 
     3345                        $fields = $this->bo->catalog->get_fields(false); 
    31623346                        $fields['names_ordered'] = true; 
    3163                         $fields['mail_forwarding_address'] = true;                       
    3164                         $contact = $this->bo->catalog->get_single_entry($id,$fields);                    
    3165                          
     3347                        $fields['mail_forwarding_address'] = true; 
     3348                        $contact = $this->bo->catalog->get_single_entry($id,$fields); 
     3349 
    31663350                        $array_participants = array(); 
    31673351                        $array_emails = array(); 
    31683352 
    31693353                        $filter = null; 
    3170                         for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) {                   
     3354                        for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) { 
    31713355                                        if(strstr($contact['mail_forwarding_address'][$z],'@')) { 
    31723356                                                $filter.="(mail=".$contact['mail_forwarding_address'][$z].")"; 
    31733357                                                $array_emails[$contact['mail_forwarding_address'][$z]] = "<font color=black>".$contact['mail_forwarding_address'][$z]."</font>"; 
    3174                                         }                                                                                                                                
    3175                                         else  
     3358                                        } 
     3359                                        else 
    31763360                                                $array_participants[$z] = "<font color=red>".$contact['mail_forwarding_address'][$z]."</font>"; 
    3177                         }                                        
    3178                          
     3361                        } 
     3362 
    31793363                        if($filter) { 
    3180                                 $filter = "(|".$filter.")";                                                      
     3364                                $filter = "(|".$filter.")"; 
    31813365                                if(!$this->bo->catalog->src_info) { 
    31823366                                        $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
     
    31843368                                } 
    31853369                                $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 
    3186                                  
    31873370                                $dn=$this->bo->catalog->src_info['dn']; 
    31883371                                $justThese = array("cn","mail"); 
    3189                                 $sr = ldap_search($ds,$dn, $filter,$justThese);                                                          
    3190                                 $info = ldap_get_entries($ds, $sr);                                                      
     3372                                $sr = ldap_search($ds,$dn, $filter,$justThese); 
     3373                                $info = ldap_get_entries($ds, $sr); 
    31913374                                for($z = 0; $z < $info['count']; $z++) { 
    31923375                                        $participant =  '<font color=\'DARKBLUE\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;'.$info[$z]['cn'][0].'&quot; &lt;'.$info[$z]['mail'][0].'&gt;</font><br>'; 
    3193                                         $array_emails[$info[$z]['mail'][0]] = null;                                                              
    3194                                         array_push($array_participants, $participant);                                   
    3195                                 } 
    3196                                  
     3376                                        $array_emails[$info[$z]['mail'][0]] = null; 
     3377                                        array_push($array_participants, $participant); 
     3378                                } 
     3379 
    31973380                                foreach($array_emails as $index => $email) 
    3198                                         if($email)  
    3199                                                 array_push($array_participants, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$email."<br>");                           
    3200                                                                                                  
     3381                                        if($email) 
     3382                                                array_push($array_participants, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$email."<br>"); 
     3383 
    32013384                                ldap_close($ds); 
    32023385                        } 
    32033386                        sort($array_participants); 
    3204                         $innerHTML = '';                         
     3387                        $innerHTML = ''; 
    32053388                        foreach($array_participants as $index => $participant){ 
    32063389                                $innerHTML .= $participant; 
    32073390                        } 
    3208                         $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML);                   
     3391                        $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 
    32093392                        echo serialize($return); 
    3210                 }        
    3211                  
     3393                } 
     3394 
    32123395                function export_contacts($typeExport){ 
    32133396 
     
    32183401                        if(!count($contacts)) 
    32193402                                echo null; 
    3220                          
     3403 
     3404/**rev 104**/ 
     3405                        // Essa iteraᅵᅵo transforma uma esturuta com contatos redundantes e separados por email ou tel. 
     3406                        // em outra com apenas 1 elemento pra cada contato 
     3407        /*              $i=0; 
     3408                        foreach($contacts as $object){ 
     3409                                $i=($object['id_contact'] - 1); 
     3410                                $all_contacts[$i]['name']=$object['names_ordered']; 
     3411                                if ($object['id_typeof_contact_connection'] == 1) 
     3412                                        $all_contacts[$i]['email']=$object['connection_value']; 
     3413                                else 
     3414                                        $all_contacts[$i]['phone']=$object['connection_value']; 
     3415                        } 
     3416        */ 
     3417/*****/ 
     3418 
    32213419                        switch($typeExport) { 
    32223420 
    32233421                                case 'outlook_en': 
    32243422                                        $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 
     3423/**rev 104**/ 
     3424        /*                                              "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 
     3425                                        foreach($all_contacts as $index => $object){ 
     3426                                                $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;\r\n"; 
     3427                                        } 
     3428        */ 
    32253429                                                        "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n";                                                         
    32263430                                        foreach($contacts as $index => $object){ 
    32273431                                                $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;\r\n"; 
    32283432                                        } 
     3433/*****/ 
    32293434                                break; 
    3230                                  
     3435 
    32313436                                case 'outlook_pt-BR': 
    3232                                         $streamBuffer = "Nome;End. de email;Endereço residencial;". 
    3233                                         "Cidade do endereço residencial;CEP do endereço residencial;". 
    3234                                         "Estado;País/região do endereço residencial;Telefone residencial;". 
    3235                                         "Rua do endereço comercial;Cidade do endereço comercial;". 
    3236                                         "CEP do endereço comercial;Estado do endereço comercial;". 
    3237                                         "País/região do endereço comercial;Telefone comercial;Empresa;Cargo\r\n";                                                        
     3437                                        $streamBuffer = "Nome;End. de email;Endereï¿œo residencial;". 
     3438                                        "Cidade do endereï¿œo residencial;CEP do endereï¿œo residencial;". 
     3439                                        "Estado;Paï¿œs/regiï¿œo do endereï¿œo residencial;Telefone residencial;". 
     3440                                        "Rua do endereï¿œo comercial;Cidade do endereï¿œo comercial;". 
     3441                                        "CEP do endereï¿œo comercial;Estado do endereï¿œo comercial;". 
     3442                                        "Paï¿œs/regiï¿œo do endereï¿œo comercial;Telefone comercial;Empresa;Cargo\r\n"; 
     3443/**rev 104**/ 
     3444                                //      foreach($all_contacts as $index => $object){ 
     3445                                //              $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 
    32383446                                        foreach($contacts as $index => $object){ 
    32393447                                                $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 
     3448/******/ 
    32403449                                        } 
    32413450                                break; 
    3242                                  
     3451 
    32433452                                case 'outlook2000_pt-BR': 
    32443453                                        $streamBuffer = "\"Tratamento\",\"Nome\",\"Segundo Nome\",\"Sobrenome\",\"Sufixo\",". 
    3245                                         "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereço comercial\",\"Rua do endereço comercial 2\",". 
    3246                                         "\"Rua do endereço comercial 3\",\"Cidade do endereço comercial\",\"Estado do endereço comercial\",". 
    3247                                         "\"CEP do endereço comercial\",\"País do endereço comercial\",\"Endereço residencial\",\"Rua residencial 2\",". 
    3248                                         "\"Rua residencial 3\",\"Cidade do endereço residencial\",\"Estado\",\"CEP do endereço residencial\",\"País do endereço residencial\",". 
    3249                                         "\"Outro endereço\",\"Outro endereço 2\",\"Outro endereço 3\",\"Cidade\",\"Estado\",\"CEP\",\"País\",". 
     3454                                        "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereï¿œo comercial\",\"Rua do endereï¿œo comercial 2\",". 
     3455                                        "\"Rua do endereï¿œo comercial 3\",\"Cidade do endereï¿œo comercial\",\"Estado do endereï¿œo comercial\",". 
     3456                                        "\"CEP do endereï¿œo comercial\",\"Paï¿œs do endereï¿œo comercial\",\"Endereï¿œo residencial\",\"Rua residencial 2\",". 
     3457                                        "\"Rua residencial 3\",\"Cidade do endereï¿œo residencial\",\"Estado\",\"CEP do endereï¿œo residencial\",\"Paï¿œs do endereï¿œo residencial\",". 
     3458                                        "\"Outro endereï¿œo\",\"Outro endereï¿œo 2\",\"Outro endereï¿œo 3\",\"Cidade\",\"Estado\",\"CEP\",\"Paï¿œs\",". 
    32503459                                        "\"Telefone do assistente\",\"Fax comercial\",\"Telefone comercial\",\"Telefone comercial 2\",\"Retorno de chamada\",". 
    32513460                                        "\"Telefone do carro\",\"Telefone principal da empresa\",\"Fax residencial\",\"Telefone residencial\",". 
    32523461                                        "\"Telefone residencial 2\",\"ISDN\",\"Telefone celular\",\"Outro fax\",\"Outro telefone\",\"Pager\",\"Telefone principal\",". 
    3253                                         "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversário\",\"Anotações\",\"Caixa postal\",\"Categorias\",". 
    3254                                         "\"Código da empresa\",\"Código do governo\",\"Cônjuge\",\"Conta\",\"Endereço de correio eletrônico\",". 
    3255                                         "\"Nome de exibição do correio eletr.\",\"Endereço de correio eletrônico 2\",". 
    3256                                         "\"Nome de exibição do correio eletr.2\",\"Endereço de correio eletrônico 3\",". 
    3257                                         "\"Nome de exibição do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 
    3258                                         "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicação\",\"Informações para cobrança\",\"Iniciais\",\"Local\",". 
    3259                                         "\"Nome do assistente\",\"Nome do gerenciador\",\"Página da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 
    3260                                         "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissão\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretório\",". 
     3462                                        "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversï¿œrio\",\"Anotaᅵᅵes\",\"Caixa postal\",\"Categorias\",". 
     3463                                        "\"Cï¿œdigo da empresa\",\"Cï¿œdigo do governo\",\"Cï¿œnjuge\",\"Conta\",\"Endereï¿œo de correio eletrï¿œnico\",". 
     3464                                        "\"Nome de exibiᅵᅵo do correio eletr.\",\"Endereï¿œo de correio eletrï¿œnico 2\",". 
     3465                                        "\"Nome de exibiᅵᅵo do correio eletr.2\",\"Endereï¿œo de correio eletrï¿œnico 3\",". 
     3466                                        "\"Nome de exibiᅵᅵo do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 
     3467                                        "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicaᅵᅵo\",\"Informaᅵᅵes para cobranï¿œa\",\"Iniciais\",\"Local\",". 
     3468                                        "\"Nome do assistente\",\"Nome do gerenciador\",\"Pï¿œgina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 
     3469                                        "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissï¿œo\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretï¿œrio\",". 
    32613470                                        "\"Sexo\"\r\n"; 
     3471 
     3472/**rev 104**/ 
     3473                                        //foreach($all_contacts as $index => $object){ 
     3474                                        //      $streamBuffer.= ",\"".$object['name']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['email']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    32623475                                        foreach($contacts as $index => $object){ 
    32633476                                                $streamBuffer.= ",\"".$object['names_ordered']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['connection_value']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     3477/******/ 
    32643478                                        } 
    32653479                                break; 
    3266                                  
     3480 
    32673481                                case 'outlook2000_en': 
    32683482                                        $streamBuffer = "Title,First Name,Middle Name,Last Name,Suffix,Company,Department,Job Title,". 
     
    32763490                                        "Gender,Government ID Number,Hobby,Initials,Internet Free Busy,Keywords,Language,Location,Manager's Name,Mileage,Notes,". 
    32773491                                        "Office Location,Organizational ID Number,PO Box,Priority,Private,Profession,Referred By,Sensitivity,Spouse,User 1,User 2,User 3,User 4,Web Page\r\n"; 
     3492 
     3493/**rev 104**/ 
     3494                                        //foreach($all_contacts as $index => $object){ 
     3495                                        //      $streamBuffer.= ",".$object['name'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['email'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    32783496                                        foreach($contacts as $index => $object){ 
    32793497                                                $streamBuffer.= ",".$object['names_ordered'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['connection_value'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     3498/*******/ 
    32803499                                        } 
    32813500                                break; 
    3282                                          
     3501 
    32833502                                case 'thunderbird': 
    3284                                         $streamBuffer = "\n";                                                    
     3503                                        $streamBuffer = "\n"; 
     3504 
     3505/**rev 104**/ 
     3506                                        //foreach($all_contacts as $index => $object){ 
     3507                                        //      $streamBuffer.= ",,".$object['name'].",,".$object['email'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    32853508                                        foreach($contacts as $index => $object){ 
    32863509                                                $streamBuffer.= ",,".$object['names_ordered'].",,".$object['connection_value'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     3510 
     3511/******/ 
    32873512                                        } 
    32883513                                break; 
    3289                                  
     3514 
    32903515                                case 'expresso': 
    32913516                                        $streamBuffer = "Nome,Email,Telefone\r\n"; 
     3517 
     3518/**rev 104**/ 
     3519                                        //foreach($all_contacts as $index => $object){ 
     3520                                        //      $streamBuffer.= $object['name'].",".$object['email'].",".$object['phone']."\r\n"; 
    32923521                                        foreach($contacts as $index => $object){ 
    32933522                                                $streamBuffer.= $object['names_ordered'].",".$object['connection_value'].",".$object['phone']."\r\n"; 
     3523  
     3524/******/ 
    32943525                                        } 
    32953526                                break; 
    3296                                  
     3527 
    32973528                        } 
    32983529 
     
    33023533                        if(!$f) 
    33033534                                echo null; 
    3304                  
     3535 
    33053536                        fputs($f,$streamBuffer); 
    33063537                        fclose($f); 
     
    33153546                         $re_d = '\x' . dechex(ord($delimiter));            //format for regexp 
    33163547                        $re_tq = '\x' . dechex(ord($text_qualifier));    //format for regexp 
    3317                          
     3548 
    33183549                        $fields = array(); 
    33193550                        $field_num = 0; 
     
    33213552                        if($text{0} == $text_qualifier) { 
    33223553                                preg_match('/^' . $re_tq . '((?:[^' . $re_tq . ']|(?<=\x5c)' . $re_tq . ')*)' . $re_tq . $re_d . '?(.*)$/', $text, $matches); 
    3323                                 
     3554 
    33243555                                $value = str_replace('\\' . $text_qualifier, $text_qualifier, $matches[1]); 
    33253556                                $text = trim($matches[2]); 
    3326                 
     3557 
    33273558                                $fields[$field_num++] = $value; 
    33283559                        } else { 
    33293560                                preg_match('/^([^' . $re_d . ']*)' . $re_d . '?(.*)$/', $text, $matches); 
    3330                                 
     3561 
    33313562                                $value = $matches[1]; 
    33323563                                $text = trim($matches[2]); 
    3333                 
     3564 
    33343565                                $fields[$field_num++] = $value; 
    33353566                } 
     
    33403571                } 
    33413572 
     3573                //funcao alterada para importar outros campos alem de nome, telefone e email, de arquivo csv (Outlook 2000) 
     3574                //em 08/04/2009 - Rommel Cysne (rommel.cysne@serpro.gov.br); 
     3575                //Foi adicionada uma funcao (escapesheelcmd()) nas variaveis para que caracteres especiais sejam ignorados 
     3576                //durante a importacao dos contatos; o processo estava travando por causa de caracteres em campos como nome, 
     3577                //sobrenome, notas e e-mail; 
     3578                //em 19/06/2009 - Rommel Cysne (rommel.cysne@serpro.gov.br); 
    33423579                function import_contacts($typeImport){ 
    33433580 
    3344                         if($file = $_SESSION['contactcenter']['importCSV']) {                            
    3345                                 unset($_SESSION['contactcenter']['importCSV']);                          
     3581                        if($file = $_SESSION['contactcenter']['importCSV']) { 
     3582                                unset($_SESSION['contactcenter']['importCSV']); 
    33463583                                $len = filesize($file); 
    33473584                                $count = 0; 
    33483585                                $return = array('error' => false, '_new' => 0, '_existing' => 0, '_failure' => 0); 
    33493586                                $handle = @fopen($file, "r") or die(serialize($return['error'] = true)); 
    3350                                  
     3587 
    33513588                                $input_header = fgets($handle); 
    33523589                                if ($typeImport == 'outlook') 
     
    33543591                                else if ($typeImport == 'auto') 
    33553592                                $delim = strstr($input_header,',') ? ',' : ';'; 
    3356                                 else   
     3593                                else 
    33573594                                        $delim = ','; 
    33583595                                $csv_header = $this->parse_line($input_header,$delim); 
    33593596                                $firstContact = fgets($handle); 
    33603597                                preg_match("/\"(.+)\"[,;]/sU",$firstContact,$matches); // yahoo csv 
    3361                                 rewind($handle);                                 
     3598                                rewind($handle); 
    33623599 
    33633600                                $header = @fgetcsv($handle, $len, $delim) or die(serialize($return['error'] = true)); 
     
    33683605                                        return; 
    33693606                                } 
    3370                                  
     3607 
    33713608                                if ($matches[0][strlen($matches[0])-1] == ';') 
    33723609                                        $delim = ';'; 
    3373                                  
     3610 
    33743611                        $boGroup = CreateObject('contactcenter.bo_group'); 
    33753612                        $boPeople = CreateObject('contactcenter.bo_people_catalog'); 
     
    33773614                                        case 'outlook2000': 
    33783615                                                $name_pos=1; 
     3616                                                $name2_pos=2; 
     3617                                                $name3_pos=3; 
     3618                                                $addr1_pos=8; 
     3619                                                $cep_pos=13; 
     3620                                                $addr2_pos=22; 
     3621                                                $fax_pos=30; 
     3622                                                $phone_pos=31; 
     3623                                                $resPhone_pos=37; 
     3624                                                $cellPhone_pos=40; 
     3625                                                $pager_pos=43; 
     3626                                                $birth_pos=48; 
     3627                                                $notes_pos=49; 
    33793628                                                $email_pos=56; 
    3380                                                 $phone_pos=44; 
     3629                                                $altEmail_pos=59; 
     3630 
    33813631                                                break; 
    33823632                                        case 'outlook': 
    3383                                                 $name_pos=0; 
    3384                                                 $email_pos=1; 
     3633                                                $name_pos=3; 
     3634                                                $email_pos=4; 
    33853635                                                $phone_pos=7; 
     3636                                                $resPhone_pos=10; 
     3637                                                $cellPhone_pos=12; 
     3638                                                $addr1_pos=13; 
     3639                                                $cep_pos=15; 
     3640                                                $phone_pos=18; 
     3641                                                $fax_pos=19; 
     3642                                                $pager_pos=20; 
     3643                                                $notes_pos=25; 
    33863644                                                break; 
    33873645                                        case 'thunderbird': 
     
    33983656                                                foreach($csv_header as $index => $fieldName) 
    33993657                                                { 
    3400                                                         switch(strtoupper($fieldName)){ 
    3401                                                         case 'NAME': 
    3402                                                         case 'NOME': 
    3403                                                         case 'FIRST NAME': 
     3658                                                        switch($fieldName){ 
     3659                                                        case 'Name': 
     3660                                                        case 'Nome': 
     3661                                                        case 'First Name': 
    34043662                                                                $name_pos = $index; 
    34053663                                                                break; 
    3406                                                         case 'E-MAIL': 
    3407                                                         case 'EMAIL': 
    3408                                                         case 'E-MAIL ADDRESS': 
    3409                                                         case 'ENDEREÇO DE CORREIO ELETRÔNICO': 
    3410                                                         case 'END. DE EMAIL': 
     3664                                                        case 'Second name': 
     3665                                                        case 'Segundo nome': 
     3666                                                                $name2_pos = $index; 
     3667                                                                break; 
     3668                                                        case 'Sobrenome': 
     3669                                                        case 'Surname': 
     3670                                                                $name3_pos = $index; 
     3671                                                                break; 
     3672                                                        case 'Business Street': 
     3673                                                        case 'Rua do endereço comercial': 
     3674                                                                $addr1_pos = $index; 
     3675                                                                break; 
     3676                                                        case 'Rua do endereço comercial 2': 
     3677                                                        case 'Outro endereço': 
     3678                                                                $addr2_pos = $index; 
     3679                                                                break; 
     3680                                                        case 'Business Postal Code': 
     3681                                                        case 'CEP do endereço comercial': 
     3682                                                                $cep_pos = $index; 
     3683                                                                break; 
     3684                                                        case 'Business Fax': 
     3685                                                        case 'Fax comercial': 
     3686                                                        case 'Fax': 
     3687                                                                $fax_pos = $index; 
     3688                                                                break; 
     3689                                                        case 'Home Phone': 
     3690                                                        case 'Telefone residencial': 
     3691                                                                $resPhone_pos = $index; 
     3692                                                                break; 
     3693                                                        case 'Mobile phone': 
     3694                                                        case 'Telefone celular': 
     3695                                                                $cellPhone_pos = $index; 
     3696                                                                break; 
     3697                                                        case 'Pager': 
     3698                                                                $pager_pos = $index; 
     3699                                                                break; 
     3700                                                        case 'Phone': 
     3701                                                        case 'Business Phone': 
     3702                                                        case 'Telefone': 
     3703                                                        case 'Telefone principal': 
     3704                                                        case 'Telefone comercial': 
     3705                                                                $phone_pos = $index; 
     3706                                                                break; 
     3707                                                        case 'Aniversário': 
     3708                                                        case 'Birthdate': 
     3709                                                                $birth_pos = $index; 
     3710                                                        case 'Anotações': 
     3711                                                        case 'Notes': 
     3712                                                                $notes_pos = $index; 
     3713                                                        case 'E-mail': 
     3714                                                        case 'Email': 
     3715                                                        case 'E-mail Address': 
     3716                                                        case 'Endereï¿œo de correio eletrï¿œnico': 
     3717                                                        case 'End. de email': 
    34113718                                                                $email_pos = $index; 
    34123719                                                                break; 
    3413                                                         case 'HOME PHONE': 
    3414                                                         case 'PHONE': 
    3415                                                         case 'TELEFONE': 
    3416                                                         case 'TELEFONE PRINCIPAL': 
    3417                                                         case 'TELEFONE COMERCIAL': 
    3418                                                                 $phone_pos = $index; 
     3720                                                        case 'Endereï¿œo de correio eletrï¿œnico 2': 
     3721                                                                $altEmail_pos = $index; 
    34193722                                                                break; 
    34203723                                                        } 
     
    34223725                                                break; 
    34233726                                } 
    3424                                  
    34253727 
    34263728                                while (($data = fgetcsv($handle, $len, $delim))) { 
    34273729                                foreach ($header as $key=>$heading) 
    34283730                                $row[$heading]=(isset($data[$key])) ? $data[$key] : ''; 
    3429                                  
     3731 
    34303732                                        $sdata = array(); 
    3431                                         $full_name  = trim($row[$header[$name_pos]]); 
     3733                                        $full_name      = trim($row[$header[$name_pos]]); 
    34323734                                        $email          = trim($row[$header[$email_pos]]); 
    34333735                                        $phone          = trim($row[$header[$phone_pos]]); 
     3736                                        $name2          = trim($row[$header[$name2_pos]]); 
     3737                                        $name3          = trim($row[$header[$name3_pos]]); 
     3738 
     3739                                        $addr1          = trim($row[$header[$addr1_pos]]); 
     3740                                        $addr2          = trim($row[$header[$addr2_pos]]); 
     3741                                        $cep            = trim($row[$header[$cep_pos]]); 
     3742                                        $fax            = trim($row[$header[$fax_pos]]); 
     3743                                        $resPhone       = trim($row[$header[$resPhone_pos]]); 
     3744                                        $cellPhone      = trim($row[$header[$cellPhone_pos]]); 
     3745                                        $pager          = trim($row[$header[$pager_pos]]); 
     3746                                        $birth          = trim($row[$header[$birth_pos]]); 
     3747                                        $notes          = trim($row[$header[$notes_pos]]); 
     3748                                        $altEmail       = trim($row[$header[$altEmail_pos]]); 
     3749 
     3750                                        $full_name = escapeshellcmd($full_name); 
    34343751                                        $array_name = explode(' ', str_replace('"','',(str_replace('\'','',$full_name)))); 
    3435                                         $sdata['given_names'] = $array_name[0]; 
     3752                                        $sdata['given_names'] = escapeshellcmd($array_name[0]); 
    34363753                                        $array_name[0] = null; 
    34373754                                        $sdata['family_names'] = trim(implode(' ',$array_name)); 
     3755                                        if($sdata['family_names'] == '') 
     3756                                        { 
     3757                                                $sdata['family_names'] = escapeshellcmd($name2) . " " . escapeshellcmd($name3); 
     3758                                        } 
     3759 
    34383760                                        $sdata['connections']['default_email']['connection_name'] = lang('Main'); 
    3439                                         $sdata['connections']['default_email']['connection_value'] = $email; 
     3761                                        $sdata['connections']['default_email']['connection_value'] = escapeshellcmd($email); 
    34403762 
    34413763                                        $sdata['connections']['default_phone']['connection_name'] = lang('Main'); 
     3764                                        $sdata['connections']['default_phone']['connection_value'] = escapeshellcmd($phone); 
     3765 
     3766                                        $sdata['connections']['fax']['connection_name'] = lang('Fax'); 
     3767                                        $sdata['connections']['fax']['connection_value'] = escapeshellcmd($fax); 
     3768 
     3769                                        $sdata['connections']['residencial_phone']['connection_name'] = lang('Residencial'); 
     3770                                        $sdata['connections']['residencial_phone']['connection_value'] = escapeshellcmd($resPhone); 
     3771 
     3772                                        $sdata['connections']['cellular_phone']['connection_name'] = lang('Cellphone'); 
     3773                                        $sdata['connections']['cellular_phone']['connection_value'] = escapeshellcmd($cellPhone); 
     3774 
     3775                                        $sdata['connections']['pager']['connection_name'] = lang('Pager'); 
     3776                                        $sdata['connections']['pager']['connection_value'] = escapeshellcmd($pager); 
     3777 
     3778                                        $sdata['connections']['alternative_email']['connection_name'] = lang('Alternative'); 
     3779                                        $sdata['connections']['alternative_email']['connection_value'] = escapeshellcmd($altEmail); 
     3780 
     3781                                        $sdata['addresses']['addr1']['address_value'] = escapeshellcmd($addr1); 
     3782                                        $sdata['addresses']['addr2']['address_value'] = escapeshellcmd($addr2); 
     3783                                        $sdata['addresses']['cep']['address_value'] = escapeshellcmd($cep); 
     3784 
     3785                                        $array_birth = explode("/",$birth); 
     3786 
     3787                                        $sdata['birthdate'] = escapeshellcmd(date('Y-m-d', mktime(0,0,0,$array_birth[1],$array_birth[0],$array_birth[2]))); 
     3788 
     3789                                        $sdata['notes'] = escapeshellcmd($notes); 
     3790                                        $sdata['is_quick_add'] = true; 
    34423791                                        $sdata['connections']['default_phone']['connection_value'] = $phone; 
    3443                                         $sdata['is_quick_add'] = true; 
    3444                                          
     3792 
    34453793                                        //      verifica se email já existe! 
     3794                                        $email = escapeshellcmd($email); 
    34463795                                        $contact = $boGroup->verify_contact($email); 
    3447                                                                                  
     3796 
    34483797                                        if(!$sdata['given_names'] && $email){ 
    34493798                                                        $a_email = explode("@",$email); 
    3450                                                         $sdata['given_names'] = $a_email[0]; 
     3799                                                        $sdata['given_names'] = escapeshellcmd($a_email[0]); 
    34513800                                        } 
    34523801 
    3453                                         $line_iteration = $return['_failure'] + $return['_existing'] + $return['_new'];  
     3802                                        $line_iteration = $return['_failure'] + $return['_existing'] + $return['_new']; 
     3803 
    34543804                                        if($contact){ 
    34553805                                                $return['_existing']++; 
    3456                                         }                                                                                                                
    3457                                         else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
     3806                                        } 
     3807                                        else if(!eregi("^[/_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
    34583808                                                $return['_failure']++; 
    34593809                                                $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid E-Mail address: " . $email ."<br>"; 
    34603810                                        } 
    34613811                                        else if (!$sdata['given_names'] || !$email || !$boPeople ->quick_add($sdata)){ 
    3462                                                 $return['_failure']++;                                                   
     3812                                                $return['_failure']++; 
    34633813                                                $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid Name: " . $sdata['given_names'] ."<br>"; 
    34643814                                        } 
    34653815                                        else 
    34663816                                                $return['_new']++; 
    3467                         }                                
     3817                        } 
    34683818                                fclose($handle); 
    34693819                                unlink($file); 
     
    34743824                        echo serialize($return); 
    34753825                } 
    3476 /* 
    3477                 function convert_tree($tree, $name, &$iconDir, $parent='0') 
    3478                 { 
    3479                         $new = null; 
    3480                         $code = null; 
    3481                          
    3482                         if ($parent === '0') 
    3483                         { 
    3484  
    3485                                 $code .= $name.".add(new dNode({id:'0', caption: '".lang('Catalogues')."'}),'none');\n"; 
    3486                         } 
    3487                          
    3488                         foreach ($tree as $id => $value) 
    3489                         { 
    3490                                 $title = $value['name']; 
    3491  
    3492                                 switch ($value['type']) 
    3493                                 {                                        
    3494                                         case 'unknown': 
    3495                                                 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption:'{$value['name']}', onFirstOpen: 'getCatalogTree(\\'{$parent}.{$id}\\');', onClick: 'getCatalogTree(\\'{$parent}.{$id}\\'); waitForTree(\\'{$parent}.{$id}\\', 0)'}),'$parent');\n";  
    3496                                                 break; 
    3497                                          
    3498                                         case 'catalog_group': 
    3499                                                 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}'}),'$parent');\n";  
    3500                                                 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id); 
    3501                                                 break; 
    3502  
    3503                                         case 'mixed_catalog_group': 
    3504                                                 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}', onClick: 'setCatalog(\\'{$parent}.{$id}\\')'}),'$parent');\n"; 
    3505  
    3506                                                 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id); 
    3507                                                 break; 
    3508                                          
    3509                                         case 'catalog': 
    3510                                                 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}', onClick: 'setCatalog(\\'{$parent}.{$id}\\')'}),'$parent');\n"; 
    3511                                                  
    3512                                 } 
    3513                         } 
    3514                          
    3515                         return $code; 
    3516                 } 
    3517 */ 
    35183826        } 
    35193827 
  • trunk/contactcenter/js/cc.js

    r1517 r1599  
    6161var CC_full_add_const = false; 
    6262var CC_full_add_photo = false; 
    63          
     63 
    6464var CC_last_height = window.innerHeight; 
    6565var CC_last_width = window.innerWidth; 
     
    9494                 photo_input = photo_frame.contentDocument.createElement('input'); 
    9595        } 
    96          
     96 
    9797        photo_frame.id = 'cc_photo_frame'; 
    9898        photo_frame.style.position = 'absolute'; 
     
    100100        photo_frame.style.top = '600px'; 
    101101        photo_frame.style.left = '0px'; 
    102          
     102 
    103103        photo_form.id = 'cc_photo_form'; 
    104104        photo_form.method = 'POST'; 
    105105        photo_form.enctype = 'multipart/form-data'; 
    106          
     106 
    107107        photo_input.id = 'cc_photo_input'; 
    108108        photo_input.type = 'file'; 
    109          
     109 
    110110        if (is_ie) 
    111111        { 
     
    117117        } 
    118118        photo_form.appendChild(photo_input); 
    119          
     119 
    120120} 
    121121 
     
    125125        var obj = Element(id); 
    126126        var max = obj.options.length; 
    127          
     127 
    128128        if (option == undefined) 
    129129        { 
     
    165165function openFullAdd(){ 
    166166        // Build the FullAdd Window. 
    167         if(!fullAddWin && !is_ie)  
     167        if(!fullAddWin && !is_ie) 
    168168                __f(); 
    169169 
     
    172172        fullAddWin.open(); 
    173173        tabs._showTab('cc_contact_tab_0'); 
    174         Element("cc_conn_type_1").checked = false;       
     174        Element("cc_conn_type_1").checked = false; 
    175175        Element("cc_conn_type_2").checked = false; 
    176176        Element("cc_conn_type_sel").disabled = true; 
     
    243243/************ Edit Group *************/ 
    244244function editGroup(id){ 
    245         populateEditGroup(id);   
     245        populateEditGroup(id); 
     246        ccAddGroup.window.open(); 
    246247} 
    247248 
     
    253254        Updates all the constant fields in the 
    254255        full add window, like Prefixes, Suffixes, 
    255         Countries, Types and Shared catalogs 
     256        Countries and Types 
    256257*/ 
    257258 
     
    268269                        return; 
    269270                } 
    270                  
     271 
    271272                if (typeof(data[3]) == 'object') 
    272273                { 
     
    298299{ 
    299300        CC_full_add_const = false; 
    300          
     301 
    301302        setTimeout('populateFullAddConstAsync()', 10); 
    302303} 
     
    306307        var handler = function(responseText) 
    307308        { 
    308                 //Element('cc_debug').innerHTML = responseText;          
     309                //Element('cc_debug').innerHTML = responseText; 
    309310                var data = unserialize(responseText); 
    310311                var i = 1; 
    311312                var j; 
    312                  
     313 
    313314                if (typeof(data) != 'object') 
    314315                { 
     
    316317                        return; 
    317318                } 
    318                  
     319 
    319320                /* Populate Prefixes */ 
    320321                for (j in data[0]) 
     
    323324                        i++; 
    324325                } 
    325                  
     326 
    326327                /* Populate Suffixes */ 
    327328                i = 1; 
     
    345346                { 
    346347                        Element('cc_addr_countries').options[i] = new Option(data[3][j], j); 
    347                          
     348 
    348349                        if (j == 'BR' || j == 'br') 
    349350                        { 
    350351                                CC_br_index = i; 
    351352                        } 
    352                          
     353 
    353354                        i++; 
    354355                } 
    355                  
     356 
    356357                /* Populate Connection Types */ 
    357358                i = 1; 
     
    361362                        i++; 
    362363                } 
    363                  
     364 
    364365                /* Populate Relations Types */ 
    365366                i = 0; 
     
    369370                        i++; 
    370371                } 
    371                  
     372 
    372373                CC_full_add_const = true; 
    373374 
     
    397398                //populateRelations(data['relations']); 
    398399        }; 
    399  
    400400        Connector.newRequest('populateFullEdit', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_full_data&id=' + id + "&catalog="+catalog, 'GET', handler); 
    401401} 
     
    416416                select_contact_list += data['contact_list'] + "</select>"; 
    417417                options_contact_list.innerHTML = select_contact_list; 
    418  
    419                 if(data['id_group']) {           
    420                         Element('title').value =  data['title']; 
     418                 
     419                if(data['id_group']) { 
     420                        Element('title').value =  data['title'];         
    421421                        if(data['contact_in_list']) {                                    
    422422                                for(i = 0; i < data['contact_in_list'].length; i++) {                            
     
    425425                                        option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')';                               
    426426                                        Element('contact_in_list').options[Element('contact_in_list').options.length] = option; 
    427                                 }                
    428                         } 
     427                                } 
     428                        }                
     429                         
     430                        Element('title').value =  data['title']; 
    429431                } 
    430432                                 
     
    439441        id = typeof(id) == 'undefined' ? id = 0 :  id; 
    440442         
    441         ccAddGroup.clear(true);                          
     443        ccAddGroup.clear(true);                  
    442444        if(!shared) 
    443445                Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 
     
    445447                Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id+'&shared_from='+shared, 'GET', handler); 
    446448} 
     449 
    447450 
    448451 
     
    478481                return false; 
    479482        } 
    480          
     483 
    481484        /* First thing: Send Photo */ 
    482485        if (Element('cc_pd_select_photo').value != '' && !is_ie) 
     
    496499                        frame = old_frame; 
    497500                } 
    498                  
     501 
    499502                frame.id = 'cc_photo_frame'; 
    500503                frame.style.visibility = 'hidden'; 
     
    505508 
    506509                form = frame.contentDocument.createElement('form'); 
    507                  
     510 
    508511                var id_contact = Element('cc_full_add_contact_id').value; 
    509512                form.id = 'cc_form_photo'; 
     
    511514                form.enctype = 'multipart/form-data'; 
    512515                form.action = 'http://'+ document.domain + Element('cc_root_dir').value+'../index.php?menuaction=contactcenter.ui_data.data_manager&method=post_photo&id='+(id_contact != '' && id_contact != 'null' ? id_contact : ''); 
    513                  
     516 
    514517                var input_clone = Element('cc_pd_select_photo').cloneNode(false); 
    515518                form.appendChild(input_clone); 
    516                  
     519 
    517520                frame.contentDocument.body.appendChild(form); 
    518521                form.submit(); 
     
    535538        } 
    536539        if (Element('cc_contact_sharing').style.display == 'none') 
    537                 setTimeout('postFullAddInfo()', 100); 
     540        setTimeout('postFullAddInfo()', 100); 
    538541        else 
    539542                setTimeout('postFullAddInfoShared()', 100); 
     
    561564                updateCards(); 
    562565        }; 
     566 
    563567        Connector.newRequest('postFullAddInfo', CC_url+'post_full_add', 'POST', handler, getFullAddData()); 
    564568} 
     
    594598 
    595599        data['commercialAnd'] = replacer; 
    596          
     600 
    597601        if (Element('cc_full_add_contact_id').value != '' && Element('cc_full_add_contact_id').value != 'null') 
    598602        { 
     
    600604                data.length++; 
    601605        } 
    602          
     606 
    603607        /* Owner do contato (Para o caso de adicao de contato compartilhado) */ 
    604608        if (Element('cc_contact_sharing').style.display == 'block') 
    605609        { 
    606610                var index = Element('cc_contact_shared_types').selectedIndex; 
    607                 data['owner'] = replaceComAnd(owners[index], replacer);  
     611                data['owner'] = replaceComAnd(owners[index], replacer); 
    608612                data.length++; 
    609613        } 
    610          
     614 
    611615        /* Status: Full Added */ 
    612616        data['id_status'] = CC_STATUS_FULL_ADD; 
    613          
     617 
    614618        /* Personal Data */ 
    615619        data['alias']         = replaceComAnd(Element('cc_pd_alias').value, replacer); 
     
    631635                data['corporate_name'] = replaceComAnd(Element('cc_name_corporate').value, replacer); 
    632636                data['job_title'] = replaceComAnd(Element('cc_job_title').value, replacer); 
    633                 data['department'] = replaceComAnd(Element('cc_department').value, replacer); 
     637                data['department'] = replaceComAnd(Element('cc_dept').value, replacer); 
    634638                data['web_page'] = replaceComAnd(Element('cc_web_page').value, replacer); 
    635639                data.length += 18; 
    636640        } 
    637  
    638                  
    639          
    640641 
    641642        /* Addresses */ 
     
    660661                                data['connections'] = new Array(); 
    661662                        } 
    662                          
     663 
    663664                        for (var i in CC_contact_full_info['connections'][type]) 
    664665                        { 
     
    672673                                        data['connections']['connection'+connNumber] = new Array(5); 
    673674                                } 
    674                                  
     675 
    675676                                data['connections']['connection'+connNumber]['id_connection'] = CC_contact_full_info['connections'][type][i]['id']; 
    676677                                data['connections']['connection'+connNumber]['id_typeof_connection'] = type; 
     
    681682                                                data['connections']['connection'+connNumber]['connection_is_default']  = 'TRUE'; 
    682683                                        } 
    683                                         else  
     684                                        else 
    684685                                                data['connections']['connection'+connNumber]['connection_is_default']  = 'FALSE'; 
    685686                                } 
    686687 
    687688//                              data['connections']['connection'+connNumber].length = 5; 
    688                                  
     689 
    689690                                empty = false; 
    690691                                connNumber++; 
     
    693694 
    694695                } 
    695                  
     696 
    696697                if (!empty) 
    697698                { 
     
    700701                } 
    701702        } 
    702          
     703 
    703704        if (CC_contact_full_info['removed_conns']) 
    704705        { 
    705706                empty = false; 
    706                  
     707 
    707708                if (typeof(data['connections']) != 'object') 
    708709                { 
     
    727728        { 
    728729                if (Element('cc_contact_shared_types').disabled == true) 
    729                 {        
     730                { 
    730731                        showMessage('Nenhum catálogo compartilhado existente'); 
    731732                        return false; 
     
    737738                } 
    738739        } 
    739          
     740 
    740741        /* Check Personal Data */ 
     742 
    741743        if (Element('cc_pd_given_names').value == '') 
    742744        { 
     
    756758                        for (var i in CC_contact_full_info['connections'][type]){ 
    757759                                if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || 
    758                                         (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){  
     760                                        (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 
    759761                                        showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido'); 
    760762                                        return false; 
     
    767769                        } 
    768770                } 
    769                  
     771 
    770772        } 
    771773 
     
    776778 
    777779/********* Personal Data Functions *********/ 
    778 /*  
     780/* 
    779781 * data[0] => cc_pd_select_photo 
    780782 * data[1] => cc_pd_alias 
     
    788790 * data[9] => cc_pd_gpg_finger_print 
    789791 * data[10] => cc_pd_notes 
    790  * data[11] => cc_name_corporate 
    791  * data[12] => cc_job_title 
    792  * data[13] => cc_department 
    793  * data[14] => cc_we_page 
    794792 */ 
    795793 
     
    828826{ 
    829827        Element('cc_addr_types').selectedIndex = 0; 
    830          
     828 
    831829        Element('cc_addr_countries').selectedIndex = 0; 
    832830        Element('cc_addr_countries').disabled = true; 
    833          
     831 
    834832        Element('cc_addr_states').selectedIndex = 0; 
    835833        Element('cc_addr_states').disabled = true; 
     
    882880        var type = Element('cc_addr_types'); 
    883881        var oldSelected = type.value; 
    884          
     882 
    885883        saveAddressFields(); 
    886          
     884 
    887885        if (oldSelected == '_NONE_') 
    888886        { 
     
    890888                return true; 
    891889        } 
    892          
     890 
    893891        CC_addr_last_selected = type.selectedIndex; 
    894          
     892 
    895893        Element('cc_addr_countries').disabled = false; 
    896          
     894 
    897895        var data = CC_contact_full_info['addresses']; 
    898896        var addrIndex  = 'address'+Element('cc_addr_types').value; 
    899          
    900         if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object')  
     897 
     898        if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 
    901899        { 
    902900                resetAddressFields(); 
     
    907905                return true; 
    908906        } 
    909          
     907 
    910908        var addrTypeID = Element('cc_addr_types').value; 
    911          
     909 
    912910        data = CC_contact_full_info['addresses'][addrIndex]; 
    913          
     911 
    914912        Element('cc_addr_id').value                              = data['id_address']           ? data['id_address']                    : ''; 
    915913        Element('cc_addr_1').value                              = data['address1']                      ? data['address1']                              : ''; 
     
    933931                states.selectedIndex = 0; 
    934932                clearSelectBox(states, 4); 
    935                 updateAddrCities();      
     933                updateAddrCities(); 
    936934                return; 
    937935        } 
     
    948946        { 
    949947                var data = unserialize(responseText); 
    950                  
     948 
    951949                clearSelectBox(states, 1); 
    952                          
     950 
    953951                if (typeof(data) != 'object') 
    954952                { 
    955953                        showMessage(Element('cc_msg_err_contacting_server').value); 
    956          
     954 
    957955                        return; 
    958956                } 
     
    961959                { 
    962960                        states.disabled = true; 
    963                         cities.disabled = true;                  
     961                        cities.disabled = true; 
    964962                        states.selectedIndex = 0; 
    965963                        cities.selectedIndex = 0; 
     
    1001999                } 
    10021000        }; 
    1003          
     1001 
    10041002        Connector.newRequest('populateStates', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_states&country='+Element('cc_addr_countries').value, 'GET', handler); 
    10051003} 
     
    10291027                        newState.disabled = false; 
    10301028                        updateAddrNewStateOnMouseOut(); 
    1031                          
     1029 
    10321030                        cities.disabled = false; 
    10331031                        clearSelectBox(cities, 3); 
     
    10401038                case '_NOSTATE_': 
    10411039                        clearSelectBox(cities, 3); 
    1042                          
     1040 
    10431041                        cities.disabled = false; 
    10441042                        cities.selectedIndex = 0; 
    1045                          
     1043 
    10461044                        requestStr = 'country='+Element('cc_addr_countries').value; 
    10471045                        break; 
    1048                  
     1046 
    10491047                default: 
    10501048                        requestStr = 'country='+Element('cc_addr_countries').value+'&state='+states.value; 
     
    10611059{ 
    10621060        var cities = Element('cc_addr_cities'); 
    1063          
     1061 
    10641062        var handler = function (responseText) 
    10651063        { 
    10661064                var data = unserialize(responseText); 
    1067                  
     1065 
    10681066                clearSelectBox(cities, 1); 
    1069                  
     1067 
    10701068                if (typeof(data) != 'object') 
    10711069                { 
    10721070                        showMessage(Element('cc_msg_err_contacting_server').value); 
    1073                          
     1071 
    10741072                        return; 
    10751073                } 
     
    11161114                } 
    11171115        }; 
    1118          
     1116 
    11191117        Connector.newRequest('populateCities', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cities&'+requestStr, 'GET', handler); 
    11201118} 
     
    11221120function updateAddrNewStateOnMouseOver () 
    11231121{ 
    1124         if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1)  
     1122        if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 
    11251123        { 
    11261124                Element('cc_addr_states_new').value = ''; 
     
    11301128function updateAddrNewStateOnMouseOut () 
    11311129{ 
    1132         if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1)  
     1130        if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 
    11331131        { 
    11341132                Element('cc_addr_states_new').value = Element('cc_msg_type_state').value; 
     
    11501148                return; 
    11511149        } 
    1152          
     1150 
    11531151        Element('cc_addr_1').readonly = false; 
    11541152        Element('cc_addr_1').disabled = false; 
     
    11801178 
    11811179                        //resetAddrFillingFields(); 
    1182                          
     1180 
    11831181                        return; 
    11841182 
     
    11881186                        newCity.disabled = false; 
    11891187                        updateAddrNewCityOnMouseOut(); 
    1190                          
     1188 
    11911189                        break; 
    11921190 
     
    12021200function updateAddrNewCityOnMouseOver () 
    12031201{ 
    1204         if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1)  
     1202        if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 
    12051203        { 
    12061204                Element('cc_addr_cities_new').value = ''; 
     
    12101208function updateAddrNewCityOnMouseOut () 
    12111209{ 
    1212         if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1)  
     1210        if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 
    12131211        { 
    12141212                Element('cc_addr_cities_new').value = Element('cc_msg_type_city').value; 
     
    12241222                return true; 
    12251223        } 
    1226          
    1227         var addrFields = new Array('cc_addr_1',  
    1228                                    'cc_addr_2',  
    1229                                                            'cc_addr_complement',  
     1224 
     1225        var addrFields = new Array('cc_addr_1', 
     1226                                   'cc_addr_2', 
     1227                                                           'cc_addr_complement', 
    12301228                                                           'cc_addr_other', 
    1231                                                            'cc_addr_postal_code',  
     1229                                                           'cc_addr_postal_code', 
    12321230                                                           'cc_addr_po_box', 
    12331231                                                           'cc_addr_countries', 
     
    12361234 
    12371235        var empty = true; 
    1238          
     1236 
    12391237        for (var i = 0; i < 8; i++) 
    12401238        { 
     
    12451243                } 
    12461244        } 
    1247                                  
     1245 
    12481246        if (empty) 
    12491247        { 
     
    12741272                default: 
    12751273                        addrInfo['id_country'] = Element('cc_addr_countries').value; 
    1276                  
     1274 
    12771275        } 
    12781276 
     
    12881286                default: 
    12891287                        addrInfo['id_state'] = Element('cc_addr_states').value; 
    1290                  
     1288 
    12911289        } 
    12921290 
     
    13011299                default: 
    13021300                        addrInfo['id_city'] = Element('cc_addr_cities').value; 
    1303                  
    1304         }        
     1301 
     1302        } 
    13051303 
    13061304        addrInfo['id_typeof_address']  = Element('cc_addr_types').options[lastIndex].value; 
     
    13151313        CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value] = addrInfo; 
    13161314 
    1317         if (Element('cc_addr_cities').value == '_NEW_' &&  
     1315        if (Element('cc_addr_cities').value == '_NEW_' && 
    13181316            Element('cc_msg_type_city').value !=  Element('cc_addr_cities_new').value && 
    13191317                Element('cc_addr_cities_new').value != '') 
    13201318        { 
    13211319                var addrRootInfo = CC_contact_full_info['addresses']['new_cities']; 
    1322                  
     1320 
    13231321                if (!addrRootInfo) 
    13241322                { 
    13251323                        addrRootInfo = new Array(); 
    13261324                } 
    1327                  
     1325 
    13281326                var i = addrRootInfo.length; 
    13291327                addrRootInfo[addrInfo['id_typeof_address']] = new Array(); 
     
    13341332        } 
    13351333 
    1336         if (Element('cc_addr_states').value == '_NEW_' &&  
    1337             Element('cc_msg_type_state').value !=  Element('cc_addr_states_new').value &&  
     1334        if (Element('cc_addr_states').value == '_NEW_' && 
     1335            Element('cc_msg_type_state').value !=  Element('cc_addr_states_new').value && 
    13381336                Element('cc_addr_states_new').value != '') 
    13391337        { 
    13401338                var addrRootInfo = CC_contact_full_info['addresses']['new_states']; 
    1341                  
     1339 
    13421340                if (!addrRootInfo) 
    13431341                { 
    13441342                        addrRootInfo = new Array(); 
    13451343                } 
    1346                  
     1344 
    13471345                var i = addrRootInfo.length; 
    13481346                addrRootInfo[addrInfo['id_typeof_address']] = new Array(); 
     
    13741372        for(idx_conn; idx_conn < cc_conn_default.options.length; idx_conn++) 
    13751373                if(cc_conn_default.options[idx_conn].value == _label) 
    1376                         break;   
    1377          
     1374                        break; 
     1375 
    13781376        if(idx_conn == cc_conn_default.options.length) 
    13791377                cc_conn_default.options[idx_conn] = new Option (_label,_label, false,false); 
    1380                          
     1378 
    13811379        if (!document.all) 
    13821380        { 
    1383                 return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 
    1384                 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 
    1385                 '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 
    1386                 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" type="text">&nbsp;' + 
    1387                 '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 
     1381                if (Element("cc_conn_type_1").checked) 
     1382                { 
     1383                        return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 
     1384                        //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 
     1385                        '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 
     1386                        '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="100" type="text">&nbsp;' + 
     1387                        '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 
     1388                } 
     1389                else if (Element("cc_conn_type_2").checked) 
     1390                { 
     1391                        return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 
     1392                        //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 
     1393                        '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 
     1394                        '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="50" type="text">&nbsp;' + 
     1395                        '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 
     1396                } 
    13881397        } 
    13891398        else 
     
    14091418                img.align = 'top'; 
    14101419                img.onclick = function(e){ removeConnField(remove_id);}; 
    1411                  
     1420 
    14121421                for (var i = 0; i < 3; i++) 
    14131422                { 
     
    14201429 
    14211430                inputs[1].id = 'cc_conn_name_'+CC_conn_count; 
    1422                 inputs[1].type = 'hidden';               
     1431                inputs[1].type = 'hidden'; 
    14231432 
    14241433                inputs[2].id = 'cc_conn_value_'+CC_conn_count; 
     
    14491458                || typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) == 'undefined' 
    14501459                || typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) == 'undefined'); 
    1451          
    1452         if(_emptyLine) {         
    1453                  
     1460 
     1461        if(_emptyLine) { 
     1462 
    14541463                if(Element("cc_conn_type_sel").value == '-1'){ 
    1455                                 return false;    
    1456                 } 
    1457                  
     1464                                return false; 
     1465                } 
     1466 
    14581467                for(k = 0; k < CC_conn_count; k++) { 
    14591468                        if(Element("cc_conn_name_"+k) && Element("cc_conn_name_"+k).value != "" && Element("cc_conn_name_"+k).value == Element("cc_conn_type_sel").value) { 
    14601469                                alert('Você já possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!'); 
    1461                                 Element("cc_conn_type_sel").options.selectedIndex = 0;                           
     1470                                Element("cc_conn_type_sel").options.selectedIndex = 0; 
    14621471                                return false; 
    14631472                        } 
    14641473                } 
    1465         }        
     1474        } 
    14661475        if (!document.all) 
    14671476        { 
     
    14901499 
    14911500function connRemoveLine(id) 
    1492 {        
     1501{ 
    14931502        var p = Element(id).parentNode; 
    14941503        var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default"); 
     
    15291538                } 
    15301539        } 
    1531          
     1540 
    15321541        CC_conn_count = 0; 
    15331542} 
     
    15511560function updateConnFields() 
    15521561{ 
    1553          
     1562 
    15541563        var connID; 
    15551564        var i; 
     
    15601569        var cc_conn_is_default = ''; 
    15611570        var selected_index = ''; 
    1562          
     1571 
    15631572        cc_conn_type_sel.disabled = false; 
    15641573        div_cc_conn_is_default.style.display = ""; 
    1565          
     1574 
    15661575        for(var i = 0;i < cc_conn_type_sel.options.length; i++) 
    1567                 cc_conn_type_sel.options[i--] = null;    
    1568                  
     1576                cc_conn_type_sel.options[i--] = null; 
     1577 
    15691578        if(Element('cc_conn_type_1').checked) { 
    15701579            var lang_new_email = Element('cc_msg_new_email').value; 
    15711580            var lang_main = Element('cc_msg_main').value; 
    1572             var lang_alternative = Element('cc_msg_alternative').value;  
    1573             cc_conn_type_sel[0] = new Option(lang_new_email,'-1');       
     1581            var lang_alternative = Element('cc_msg_alternative').value; 
     1582            cc_conn_type_sel[0] = new Option(lang_new_email,'-1'); 
    15741583            cc_conn_type_sel[1] = new Option(lang_main,lang_main); 
    1575             cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative);         
     1584            cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative); 
    15761585                connID = 1; 
    15771586                selected_index = cc_email_default.options.selectedIndex; 
     
    15811590 
    15821591                var lang_select_email = Element('cc_msg_select_email').value; 
    1583                 cc_email_default.options[0] = new Option(lang_select_email,'-1');                
     1592                cc_email_default.options[0] = new Option(lang_select_email,'-1'); 
    15841593                cc_phone_default.style.display = 'none'; 
    1585                 cc_email_default.style.display = '';                     
     1594                cc_email_default.style.display = ''; 
    15861595                cc_conn_is_default = cc_email_default; 
    15871596        } 
     
    15961605                var lang_corporative_fax = Element('cc_msg_corporative_fax').value; 
    15971606                var lang_corporative_pager = Element('cc_msg_corporative_pager').value; 
    1598                  
    1599             cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1');   
     1607 
     1608            cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1'); 
    16001609            cc_conn_type_sel[1] = new Option(lang_home,lang_home); 
    1601             cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone);     
     1610            cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone); 
    16021611            cc_conn_type_sel[3] = new Option(lang_work,lang_work); 
    16031612            cc_conn_type_sel[4] = new Option(lang_fax,lang_fax); 
     
    16081617                        cc_conn_type_sel[8] = new Option(lang_corporative_pager, lang_corporative_pager); 
    16091618                } 
    1610                  
     1619 
    16111620                connID = 2; 
    16121621                selected_index = cc_phone_default.options.selectedIndex; 
     
    16151624                } 
    16161625 
    1617                 var lang_choose_phone = Element('cc_msg_choose_phone').value;            
     1626                var lang_choose_phone = Element('cc_msg_choose_phone').value; 
    16181627                cc_phone_default.options[0] = new Option(lang_choose_phone,'-1'); 
    16191628                cc_email_default.style.display = 'none'; 
     
    16211630                cc_conn_is_default = cc_phone_default; 
    16221631        } 
    1623                          
     1632 
    16241633        Element("cc_conn_type_sel").options.selectedIndex = 0; 
    16251634        /* First save the data */ 
     
    16271636 
    16281637        CC_conn_last_selected = connID; 
    1629          
     1638 
    16301639        clearConn(); 
    1631          
     1640 
    16321641        if (connID == '_NONE_') 
    16331642        {       cc_conn_is_default.disabled = true; 
    16341643                return; 
    16351644        } 
    1636          
     1645 
    16371646        /* If no data already available, return */ 
    16381647        if (!CC_contact_full_info['connections']) 
     
    16581667                        } 
    16591668                } 
    1660         }        
     1669        } 
    16611670        if(cc_conn_is_default.options.length > selected_index) 
    16621671                cc_conn_is_default.options.selectedIndex = (selected_index == "-1" ? 0 : selected_index); 
     
    16791688                        CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); 
    16801689                } 
    1681                 else  
     1690                else 
    16821691                { 
    16831692                        delete CC_contact_full_info['connections'][CC_conn_last_selected]; 
     
    16911700                                var subNodes = nodes[i].childNodes; 
    16921701                                var found = false; 
    1693                                  
     1702 
    16941703                                for (var j = 0; j < subNodes.length; j++) 
    16951704                                { 
    1696                                         if (subNodes[j].childNodes.length > 0 &&  
     1705                                        if (subNodes[j].childNodes.length > 0 && 
    16971706                                            subNodes[j].childNodes[0].id) 
    16981707                                        { 
     
    17021711                                                        CC_contact_full_info['connections'][CC_conn_last_selected][k] = new Array(); 
    17031712                                                } 
    1704                                                  
     1713 
    17051714                                            if (subNodes[j].childNodes[0].id.indexOf('cc_conn_name') != -1) 
    17061715                                                { 
     
    17221731                                                        else 
    17231732                                                        { 
    1724                                                                 CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = '';  
     1733                                                                CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 
    17251734                                                        } 
    17261735                                                } 
     
    17331742                                        } 
    17341743                                } 
    1735                                  
     1744 
    17361745                                if (found) 
    17371746                                { 
     
    17501759                        delete CC_contact_full_info['connections'][CC_conn_last_selected]; 
    17511760                } 
    1752                  
     1761 
    17531762        } 
    17541763 
     
    17761785        var number = randomString().toLowerCase(); 
    17771786        var result = ''; 
    1778          
     1787 
    17791788        if(!is_ie) 
    17801789                result = prompt("Essa operação removerá TODOS os seus \ncontatos pessoais,  e  NÃO  PODERÁ  ser \ndesfeita. Digite o código abaixo:\n\tCódigo de confirmação: "+number); 
     
    17871796                else 
    17881797                        alert('Código Incorreto'); 
    1789         }        
     1798        } 
    17901799} 
    17911800 
     
    18081817                        return; 
    18091818                } 
    1810                  
     1819 
    18111820                if (data['status'] != 'ok') 
    18121821                { 
     
    18141823                        return; 
    18151824                } 
    1816                  
     1825 
    18171826                setTimeout('updateCards()',80);; 
    18181827        }; 
    1819                  
     1828 
    18201829        typeArg = (type == 'groups' ? 'group' : 'entry'); 
    1821                  
     1830 
    18221831        Connector.newRequest('removeEntry', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_'+typeArg+'&remove=' + id, 'GET', handler); 
    18231832} 
     
    18421851        var w_height = 0; 
    18431852        var w_extra = 200; 
    1844          
     1853 
    18451854        if (document.body.clientHeight) 
    18461855        { 
     
    18811890        } 
    18821891} 
     1892 
    18831893function getActualPage () 
    18841894{ 
     
    19451955                                final_page = 1; 
    19461956                        } 
    1947                          
     1957 
    19481958                        html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ final_page +')">...</a> '; 
    19491959 
    19501960                        page = showing_page ? showing_page : actual_page; 
    19511961                } 
    1952                  
     1962 
    19531963                for (; page <= npages; page++) 
    19541964                { 
     
    20102020                Element('cc_panel_arrow_last').style.cursor = 'hand'; 
    20112021        } 
    2012          
     2022 
    20132023        Element('cc_panel_pages').innerHTML = html_pages; 
    20142024} 
     
    20222032                        for (j = 0; j < 3; j++) 
    20232033                                document.getElementById("cc_card:"+j+":"+i).innerHTML = ''; 
    2024                 return false; 
    2025         } 
    2026          
    2027         if(type == 'groups' || type == 'shared_groups') 
     2034                        return false; 
     2035        } 
     2036 
     2037        if(type == 'groups' || type =='shared_groups') 
    20282038                return populateGroupsInCards(data,type); 
    2029          
     2039 
    20302040        var pos = 0; 
    20312041        var ncards = data[3].length; 
    2032          
     2042 
    20332043        if (typeof(data[3]) == 'object' && ncards > 0) 
    20342044        { 
     
    20382048                        { 
    20392049                                id = 'cc_card:'+j+':'+i; 
    2040                          
     2050 
    20412051                                for (var k = 0; k < data[2].length; k++) 
    20422052                                { 
     
    20562066                                                                break; 
    20572067                                                } 
    2058                                                  
     2068 
    20592069                                        } 
    2060                                          
    2061                                          
     2070 
     2071 
    20622072                                        /*if(data[2][k] ==  'cc_mail' && data[3][pos][k] == 'none' && !(ccTree.catalog_perms & 2) ) { 
    20632073                                                Element(id).style.display = 'none'; 
    20642074                                                continue; 
    20652075                                        }*/ 
    2066                                  
     2076 
    20672077                                        if(data[3][pos][k] != 'none') 
    20682078                                        { 
     
    20792089                                                                        Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 
    20802090                                                                } 
    2081                                                                 if(data[3][pos][9]){ 
    2082                                                                         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>";  } 
     2091                                                                if(data[3][pos][12]) 
     2092                                                                        Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][12]+"</i></font></span>";  
    20832093                                                                break; 
    2084                                                          
     2094 
    20852095                                                        case 'cc_mail': 
    2086                                                                  
    20872096                                                                if (data[3][pos][k].length > (CC_visual == 'table'  ? 50 : 20)) 
    20882097                                                                { 
     
    20922101                                                                else 
    20932102                                                                { 
    2094                                                                         Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>';                                                                   
     2103                                                                        Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; 
    20952104                                                                } 
    20962105                                                                break; 
    2097                                                          
     2106 
    20982107                                                        case 'cc_phone': 
    20992108                                                                if (data[3][pos][k].length > 20) 
     
    21312140                                                        case 'cc_forwarding_address': 
    21322141                                                                var account_type = data[3][pos][k]; 
    2133                                                                                                                          
     2142 
    21342143                                                                if( !account_type) 
    21352144                                                                        break; 
    2136                                                                                                                                                                                                                                                                                                                                                                                                                                          
     2145 
    21372146                                                                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>'; 
     2147                                                                break; 
     2148 
     2149                                                        //Para tratar tamanho do campo "celular" do empregado 
     2150                                                        case 'cc_mobile': 
     2151                                                                if (data[3][pos][k].length > 20) 
     2152                                                                { 
     2153                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 
     2154                                                                        Element(id+':'+data[2][k]).title = data[3][pos][k]; 
     2155                                                                } 
     2156                                                                else 
     2157                                                                { 
     2158                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 
     2159                                                                } 
     2160                                                                Element(id+':cc_mobile').innerHTML = data[3][pos][k]; 
     2161                                                                break; 
     2162 
     2163                                                        //Para tratar tamanho do campo "matricula" do empregado 
     2164                                                        case 'cc_empNumber': 
     2165                                                                if (data[3][pos][k].length > 20) 
     2166                                                                { 
     2167                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 
     2168                                                                        Element(id+':'+data[2][k]).title = data[3][pos][k]; 
     2169                                                                } 
     2170                                                                else 
     2171                                                                { 
     2172                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 
     2173                                                                } 
     2174                                                                Element(id+':cc_empNumber').innerHTML = data[3][pos][k]; 
     2175                                                                break; 
     2176 
     2177                                                        //Para tratar tamanho do campo "departamento" do empregado 
     2178                                                        case 'cc_department': 
     2179                                                                if (data[3][pos][k].length > 15) 
     2180                                                                { 
     2181                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 
     2182                                                                        Element(id+':'+data[2][k]).title = data[3][pos][k]; 
     2183                                                                } 
     2184                                                                else 
     2185                                                                { 
     2186                                                                        Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 
     2187                                                                } 
     2188                                                                Element(id+':cc_department').innerHTML = data[3][pos][k]; 
    21382189                                                                break; 
    21392190 
     
    21462197                                                                else 
    21472198                                                                { 
     2199                                                                        if (Element(id+':'+data[2][k]) == null) alert('É nulo'); 
    21482200                                                                        Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 
    21492201                                                                } 
    21502202                                                } 
    21512203                                        } 
    2152                                 }                                
     2204                                } 
     2205                                 
    21532206                                if (type == "shared_contacts") { 
    2154                                         if (data[3][pos][8] & 4)  
     2207                                        if (data[3][pos][11] & 4)  
    21552208                                                eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedContact(Element('"+id+"' + ':cc_id').value);};"); 
    21562209                                        else  
     
    21582211                                                        alert(Element('cc_msg_not_allowed').value); 
    21592212                                                }; 
    2160                                         if (data[3][pos][8] & 8)  
     2213                                        if (data[3][pos][11] & 8)  
    21612214                                                eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value);};"); 
    21622215                                        else  
     
    21652218                                                }; 
    21662219                                } 
    2167                                  
    2168                                  
    2169                                  
     2220 
    21702221                                if (--ncards == 0) 
    21712222                                { 
     
    21732224                                        i = CC_max_cards[1]; 
    21742225                                } 
    2175          
     2226 
    21762227                                pos++; 
    21772228                        } 
     
    21812232 
    21822233function populateGroupsInCards(data,type) 
    2183 {        
     2234{ 
    21842235        var pos = 0; 
    2185         var contacts = data[5];          
     2236        var contacts = data[5]; 
    21862237        var ncards = data[3].length; 
    2187          
     2238 
    21882239        if (typeof(data[3]) == 'object' && ncards > 0) 
    21892240        { 
     
    21932244                        { 
    21942245                                id = 'cc_card:'+j+':'+i; 
    2195                          
     2246 
    21962247                                for (var k = 0; k < data[2].length; k++) 
    21972248                                { 
    2198                                  
     2249 
    21992250                                        if(data[3][pos][k] != 'none') 
    2200                                         {        
    2201                                                                                          
     2251                                        { 
     2252 
    22022253                                                switch (data[2][k]) 
    2203                                                 {                                                        
     2254                                                { 
    22042255                                                        case 'cc_title': 
    22052256                                                                if (data[3][pos][k].length > 50) 
     
    22152266                                                                        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>"; 
    22162267                                                                break; 
    2217                                                          
     2268 
    22182269                                                        case 'cc_short_name': 
    22192270                                                                if (data[3][pos][k].length > (CC_visual == 'table'  ? 50 : 20)) 
     
    22272278                                                                } 
    22282279                                                                break; 
    2229                                                          
     2280 
    22302281                                                        case 'cc_contacts': 
    22312282 
     
    22362287                                                                var email = ""; 
    22372288 
    2238                                                                 for (var d = 0; d < contacts.length; d++) {                                                                                                                                                                                                                                                                                                      
     2289                                                                for (var d = 0; d < contacts.length; d++) { 
    22392290                                                                        contact += contacts[d]['names_ordered']+ ","; 
    22402291                                                                        email += contacts[d]['connection_value']+","; 
    22412292                                                                } 
    2242                                                                  
     2293 
    22432294                                                                Element(id+':cc_participantes').innerHTML = '<span title="Ver Participantes" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value+'value\', \''+contact+'\', \''+email+'\', \''+title+'\', \''+id_group+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img title="Ver participantes" align="center" src="templates/default/images/people-mini.png">&nbsp;&nbsp</span>'; 
    2244                                                                                                                                                                          
     2295 
    22452296                                                                break; 
    2246                                                          
     2297 
    22472298                                                        case 'cc_id': 
    22482299                                                                var id_contact = data[3][pos][k]; 
    22492300                                                                Element(id+':'+data[2][k]).value = data[3][pos][k]; 
    2250                                                                                                                          
     2301 
    22512302                                                                break; 
    2252                                                                  
     2303 
    22532304                                                } 
    22542305                                        } 
    22552306                                } 
    2256          
     2307 
    22572308                                if (type == "shared_groups") { 
    22582309                                         
     
    22692320                                                }; 
    22702321                                }                                
    2271                                  
    2272                                  
     2322 
    22732323                                if (--ncards == 0) 
    22742324                                { 
     
    22762326                                        i = CC_max_cards[1]; 
    22772327                                } 
    2278          
     2328 
    22792329                                pos++; 
    22802330                        } 
     
    23052355        }; 
    23062356 
    2307         Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET');  
     2357        Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 
    23082358} 
    23092359 
     
    23112361{ 
    23122362        var coord = new Array(); 
    2313          
     2363 
    23142364        //Element('cc_card_space').innerHTML = ''; 
    23152365        //return; 
     
    23182368        //card_space_width = parseInt(is_ie ? document.body.offsetWidth : window.innerWidth) - parseInt(Element('cc_left').offsetWidth) - parseInt(CC_card_extra) - 40; 
    23192369        card_space_height = parseInt(Element('cc_card_space').offsetHeight) - parseInt(CC_card_extra); 
    2320          
     2370 
    23212371        card_width = CC_card_image_width + CC_card_extra; 
    23222372        card_height = CC_card_image_height + CC_card_extra; 
     
    23242374        ncols = parseInt(card_space_width / card_width); 
    23252375        nlines = parseInt(card_space_height / card_height); 
    2326          
     2376 
    23272377        coord[0] = ncols; 
    23282378        //coord[1] = nlines; 
     
    23392389                if(type == 'groups' || type == 'shared_groups') { 
    23402390                        html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 
    2341             '<div style="border: 0px solid #999; position: relative;">' +  
     2391            '<div style="border: 0px solid #999; position: relative;">' + 
    23422392                                '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
    23432393                                '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 
    2344                                 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' +  
     2394                                '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 
    23452395                                '<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>' + 
    23462396                                '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + 
     
    23482398                                '<input id="' + id + ':cc_id" type="hidden">' + 
    23492399                        '</div>' + '</td>'; 
    2350                  
     2400 
    23512401                } 
    23522402                else { 
    23532403                        html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 
    23542404                                '<div style="border: 0px solid #999; position: relative;">' + 
    2355                                         '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' +  
     2405                                        '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
    23562406                                                ( ccTree.catalog_perms == 1 ? 
    23572407                                                '<span id="' + id + ':cc_icon_data" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1"></span>':'') + 
     
    23592409                                                '<img title="'+Element('cc_msg_card_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editContact(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 
    23602410                                                '<img title="'+Element('cc_msg_card_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' : '') + 
    2361                                                 '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' +  
     2411                                                '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
    23622412                                                '<span id="' + id + ':cc_company" style="position: absolute; top: 5px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 14px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_company_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_company_full\').style.visibility=\'hidden\'"></span>' + 
    2363                                                 '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px"  valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>'+  
    2364                                                 '<span id="' + id + ':cc_name" 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>' +  
    2365                                                 '<span id="' + id + ':cc_title" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' +  
    2366                                                 '<span id="' + id + ':cc_phone" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' +  
    2367                                                 '<span id="' + id + ':cc_mail" 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>' +  
    2368                                                 '<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' +  
     2413                                                '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px"  valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>'+ 
     2414                                                //Para exibir a matricula do empregado nos cartoes 
     2415                                                '<span id="' + id + ':cc_empNumber" style="position: absolute; top: 15px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 
     2416                                                '<span id="' + id + ':cc_name" 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>' + 
     2417                                                '<span id="' + id + ':cc_title" style="position: absolute; top: 50px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' + 
     2418                                                //Para exibir o setor/lotacao do empregado nos cartoes 
     2419                                                '<span id="' + id + ':cc_department" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
     2420                                                '<span id="' + id + ':cc_phone" style="position: absolute; top: 75px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
     2421                                                //Para exibir o celular empresarial do empregado na tabela 
     2422                                                '<span id="' + id + ':cc_mobile" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 
     2423                                                '<span id="' + id + ':cc_mail" 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>' + 
     2424                                                '<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 
    23692425                                        '<input id="' + id + ':cc_id" type="hidden">' + 
    23702426                                '</div>' + '</td>'; 
    2371                 } 
    2372          
     2427 
     2428                /*} else { 
     2429                        html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 
     2430            '<div style="border: 0px solid #999; position: relative;">' + 
     2431                                '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 
     2432                                '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 
     2433                                '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 
     2434                                '<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>' + 
     2435                                '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + 
     2436                                '<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>' + 
     2437                                '<input id="' + id + ':cc_id" type="hidden">' + 
     2438                        '</div>' + '</td>';*/ 
     2439                } 
    23732440 
    23742441        return html_card; 
     
    23912458                                        '&nbsp;&nbsp;|&nbsp;&nbsp;'+ 
    23922459                                        '<img  title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" src="templates/default/images/cc_x.png">'  + 
    2393                                         '<input id="' + id + ':cc_id" type="hidden">'+                                                                           
     2460                                        '<input id="' + id + ':cc_id" type="hidden">'+ 
    23942461                                        '</td></tr>'; 
    2395                                                  
    2396                          
    2397                         } 
    2398                         else { 
    2399                                 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;">' +                                        
    2400                                         '<span valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="' + id + ':cc_name"></span></td>' + 
    2401                                         '<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>' + 
    2402                                         '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' +          
     2462 
     2463        //              if(type != 'groups'||type=='shared_groups') { 
     2464            } 
     2465            else { 
     2466                                html_card = '<tr  style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE">' + 
     2467                                        //Para exibir a matricula do empregado na tabela 
     2468                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_empNumber"></span></td>' + 
     2469                                        '<td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;"><span valign="bottom" id="' + id + ':cc_icon_group">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="' + id + ':cc_name"></span></td>' + 
     2470                                        '<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>' + 
     2471                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 
     2472                                        //Para exibir o celular empresarial do empregado na tabela 
     2473                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' + 
     2474                                        //Para exibir o setor/lotacao do empregado na tabela 
     2475                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_department"></span></td>' + 
     2476                                        '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' + 
     2477                                        '<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>' + 
    24032478                                        ( ccTree.catalog_perms == 1 ? 
    24042479                                        '<td align="left"><span valign="bottom" id="' + id + ':cc_icon_data"></span></td>':'') + 
     
    24162491                                        '</td></tr>'; 
    24172492                        } 
     2493                        /*else { 
     2494                                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;">' + 
     2495                                        '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1"></span>' + 
     2496                                        '<span id="' + id + ':cc_title"></span></td>' + 
     2497                                        '<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>' + 
     2498                                        '<td align="left" width="55px">'+ 
     2499                                        '<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">' + 
     2500                                        '&nbsp;&nbsp;|&nbsp;&nbsp;'+ 
     2501                                        '<img  title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" src="templates/default/images/cc_x.png">'  + 
     2502                                        '<input id="' + id + ':cc_id" type="hidden">'+ 
     2503                                        '</td></tr>'; 
     2504                        }*/ 
    24182505 
    24192506        return html_card; 
     
    24232510{ 
    24242511        var pos; 
    2425          
     2512 
    24262513        html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1"><table width="100%" border="0" cellpadding="0" cellspacing="3">'; 
    2427          
     2514 
    24282515        if (ncards > 0) 
    24292516        { 
     
    24452532                if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 
    24462533                        html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 
    2447         }        
     2534        } 
    24482535        else if (CC_max_cards != 0) 
    24492536        { 
     
    24652552        html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1">'; 
    24662553        html_cards += '<table  border="0" cellpadding="0" cellspacing="' + CC_card_extra + '">'; 
    2467          
     2554 
    24682555        if (ncards > 0) 
    24692556        { 
     
    24842571                if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 
    24852572                        html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 
    2486         }        
     2573        } 
    24872574        else if (CC_max_cards != 0) 
    24882575        { 
     
    25212608                else if(CC_visual == 'table') 
    25222609                        drawTable(0); 
    2523                          
     2610 
    25242611                setPages(0,0); 
    25252612                return; 
    25262613        } 
    2527  
    25282614 
    25292615        var handler = function (responseText) 
     
    25322618                data = unserialize(responseText); 
    25332619                if (data[0] == '0') 
    2534                 {                                
    2535                         Element('cc_type_contact').value = data[1];                      
     2620                { 
     2621                        Element('cc_type_contact').value = data[1]; 
    25362622                        CC_npages = 0; 
    25372623                        CC_actual_page = 1; 
     
    25452631                else 
    25462632                Element('cc_type_contact').value = data[10]; 
    2547                  
    2548 //              Element('cc_debug').innerHTML = responseText;                                            
    2549                  
     2633 
     2634//              Element('cc_debug').innerHTML = responseText; 
     2635 
    25502636                if (typeof(data) != 'object') 
    25512637                { 
     
    25532639                        return; 
    25542640                } 
    2555                  
     2641 
    25562642                if (typeof(data[3]) == 'object') 
    25572643                { 
     
    25662652                        qtd_compartilhado = data[9]; 
    25672653                        CC_npages = parseInt(data[0]); 
    2568                         CC_actual_page = parseInt(data[1]);                      
     2654                        CC_actual_page = parseInt(data[1]); 
    25692655                        if(CC_visual == 'cards') 
    25702656                                drawCards(data[3].length, data[10]); 
     
    25742660                        populateCards(data, data[10]); 
    25752661                        setPages(data[0], data[1]); 
    2576                          
     2662 
     2663                } 
     2664                else if (data['error']) 
     2665                { 
     2666                        showMessage(data['error']); 
    25772667                } 
    25782668                else 
     
    25862676        Connector.newRequest('showCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler, info); 
    25872677} 
     2678 
    25882679 
    25892680function clearCards() 
     
    26102701        var table_h = Element('cc_panel_table'); 
    26112702        var cards_h = Element('cc_panel_cards'); 
    2612          
     2703 
    26132704        switch (type) 
    26142705        { 
     
    26232714                        break; 
    26242715        } 
    2625          
     2716 
    26262717        CC_visual = type; 
    26272718        showCards(getActualLetter(), getActualPage()); 
    26282719} 
    26292720 
    2630 function ccSearchUpdate(ids) 
     2721/*function ccSearchUpdate(ids) 
    26312722{ 
    26322723        Element('cc_panel_letters').style.display = 'none'; 
    26332724        Element('cc_panel_search').style.display  = 'inline'; 
    2634          
     2725 
    26352726        if(CC_visual == 'cards') 
    26362727                drawCards(0); 
     
    26402731        if (!ids) 
    26412732        { 
    2642                 ccSearchHide(); 
     2733                //ccSearchHide(); 
    26432734                return; 
    26442735        } 
    2645          
     2736 
    26462737        var sIds = serialize(ids); 
    26472738 
     
    26512742        } 
    26522743        showCards('search', '1', sIds); 
     2744} 
     2745*/ 
     2746 
     2747function ccSearchUpdate() 
     2748{ 
     2749        Element('cc_panel_letters').style.display = 'none'; 
     2750        Element('cc_panel_search').style.display  = 'inline'; 
     2751 
     2752        if(CC_visual == 'cards') 
     2753                drawCards(0); 
     2754        else if(CC_visual == 'table') 
     2755                drawTable(0); 
     2756 
     2757        if (CC_actual_letter != 'search') 
     2758        { 
     2759                CC_last_letter = CC_actual_letter; 
     2760        } 
     2761        //showCards('search', '1', sIds); 
    26532762} 
    26542763 
     
    26932802        data[3] = Element('cc_qa_phone').value; 
    26942803        data[4] = Element('cc_qa_email').value; 
     2804 
     2805        return data; 
     2806} 
     2807 
     2808function sendQuickAdd () 
     2809{ 
     2810        var data = getQuickAdd(); 
     2811 
     2812        var str = serialize(data); 
     2813 
     2814        if (!str) 
     2815        { 
     2816                return false; 
     2817        } 
     2818 
     2819        var handler = function (responseText) 
     2820        { 
     2821                setTimeout('updateCards()',100);; 
     2822        } 
     2823 
     2824        resetQuickAdd(); 
     2825 
     2826        Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); 
     2827} 
     2828 
    26952829         
    2696         return data; 
    2697 } 
    2698  
    2699 function sendQuickAdd () 
    2700 { 
    2701         var data = getQuickAdd(); 
    2702          
    2703         var str = serialize(data); 
    2704  
    2705         if (!str) 
    2706         { 
    2707                 return false; 
    2708         } 
    2709  
    2710         var handler = function (responseText) 
    2711         { 
    2712                 setTimeout('updateCards()',100);; 
    2713         } 
    2714  
    2715         resetQuickAdd(); 
    2716  
    2717         Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); 
    2718 } 
    2719  
    27202830function connectVoip (phoneUser, typePhone){ 
    27212831        var handler_voip = function (responseText){ 
     
    27242834                } 
    27252835                else{ 
    2726                         data = unserialize(responseText); 
     2836                    data = unserialize(responseText); 
    27272837                        alert("Requisitando chamada para o ramal: "+data); 
    2728                 } 
     2838        } 
    27292839        } 
    27302840        Connector.newRequest('voip', "../../expressoMail1_2/controller.php?action=expressoMail1_2.functions.callVoipconnect&to="+phoneUser+"&typePhone="+typePhone, 'POST', handler_voip); 
Note: See TracChangeset for help on using the changeset viewer.