Ignore:
Timestamp:
05/25/11 10:47:52 (13 years ago)
Author:
airton
Message:

Ticket #1926 - Permitir configurar mais atributos cadastrados de um contato para exibição

Location:
sandbox/2.2.0.2/contactcenter/inc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/contactcenter/inc/class.bo_ldap_manager.inc.php

    r4352 r4500  
    193193                /* 
    194194                 * @function get_external_ldap_fields_association 
    195                  * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
     195                 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
    196196                 * @abstract get the fields association for an external ldap_source 
    197197                 * @return an array with attribute mappings 
     
    206206                /* 
    207207                 * @function test_connection 
    208                  * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
     208                 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
    209209                 * @abstract Test if we can bind to a ldap server in a reasonable time 
    210210                 * @param (string) $host ldap server's hostname 
     
    291291                        @function get_external_ldap_tree 
    292292                        @abstract Returns the LDAP external tree corresponding to the specified level 
    293                         @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
     293                        @author Mário César Kolling <mario.kolling@serpro.gov.br> 
    294294                        @param (integer) $id_source The ID of the external LDAP source 
    295295                        @param (string)  $context The context to be used as root branch 
     
    458458                { 
    459459                        /* 
    460                          * Esta operaᅵᅵo resolve o problema causado pela conversï¿œo de caracteres acentuados realizada 
    461                          * pela funᅵᅵo ldap_explode_dn(). 
     460                         * Esta operação resolve o problema causado pela conversão de caracteres acentuados realizada 
     461                         * pela função ldap_explode_dn(). 
    462462                         */ 
    463463 
     
    539539                                list($group) = explode('=',$dn_parts_full[0]); 
    540540 
    541                                 //Faz a comparaᅵᅵo do branch como case insensitive 
     541                                //Faz a comparação do branch como case insensitive 
    542542                                if (strtolower($group) == strtolower($branch_dn) or $branch_dn === 'all') 
    543543                                { 
  • sandbox/2.2.0.2/contactcenter/inc/class.ui_api.inc.php

    r4498 r4500  
    183183                        $template->parse('out','search'); 
    184184 
     185                        return $template->get_var('out'); 
     186                } 
     187                 
     188                function get_contact_details() 
     189                { 
     190                        $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 
     191                        $template->set_file(array('details' => 'contact_details.tpl')); 
     192                         
     193                        if (!$this->commons_loaded) 
     194                        { 
     195                                $template->set_var('cc_api', $this->commons); 
     196                                $this->commons_loaded = true; 
     197                        } 
     198                        else 
     199                        { 
     200                                $template->set_var('cc_api', ''); 
     201                        } 
     202                         
     203                        //$template->set_var('ccContactDetails.js', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/ccContactDetails.js'); 
     204                        $template->set_var('cc_contact_details_title',lang("Contact's details")); 
     205                        $template->set_var('cc_contact_details_close',lang("Close")); 
     206                        $template->set_var('cc_contact_details_no_fields',lang("The extra details are not configured.")); 
     207                        $template->set_var('cc_contact_details_attr_name',lang("Attribute name")); 
     208                        $template->set_var('cc_contact_details_attr_value',lang("Value")); 
     209                        $template->parse('out','details'); 
    185210                        return $template->get_var('out'); 
    186211                } 
  • sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php

    r4498 r4500  
    259259                        $GLOBALS['phpgw']->template->set_var('cc_msg_expresso_default_csv', lang('Export as Expresso (Default) CSV.')); 
    260260                        $GLOBALS['phpgw']->template->set_var('cc_msg_copy_to_catalog', lang('Copy to personal catalog.')); 
     261                        $GLOBALS['phpgw']->template->set_var('cc_msg_show_extra_detail', lang("Show extra contact's details.")); 
    261262                        $GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.')); 
    262263                        $GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name')); 
     
    289290                        $main .= $api->get_quick_add_plugin(); 
    290291                        $main .= $api->get_add_group(); 
     292                        $main .= $api->get_contact_details(); 
    291293                        $main .= $GLOBALS['phpgw']->template->get_var('out'); 
    292294 
     
    445447                                        return $this->export_contacts($_POST['typeExport']); 
    446448                                 
     449                                case 'get_contact_details': 
     450                                        return $this->get_contact_details($_GET['id']); 
     451 
    447452                                case 'get_qtds_compartilhado': 
    448453                                        return $this->get_qtds_compartilhado(); 
     454 
    449455                                case 'get_list_owners_perms_add': 
    450456                                        echo $this->get_list_owners_perms_add(); 
     
    13231329                                        ) 
    13241330                                ); 
    1325  
     1331                                //verifica se esta habilitado a opcao de exibir os detalhes extras 
     1332                                $objconfig = CreateObject('phpgwapi.config', 'contactcenter'); 
     1333                                $config = $objconfig->read_repository(); 
     1334                                $final[12] = isset($config['cc_allow_details'])? $config['cc_allow_details'] : false; 
    13261335                                //echo 'Page: '.$page.'<br>'; 
    13271336                                $n_entries = count($this->page_info['actual_entries']); 
     
    44344443                        echo serialize($return); 
    44354444                } 
     4445         
     4446                /*! 
     4447                 * @function get_contact_details 
     4448                 * @abstract Retorna os detalhes extras de um contato 
     4449                 * @author Luiz Carlos Viana Melo - Prognus 
     4450                 * @param (string) O ID do usuário do LDAP 
     4451                 */ 
     4452                function get_contact_details($id) 
     4453                { 
     4454                        $data = array(); 
     4455                         
     4456                        if(!$this->bo->catalog->src_info) { 
     4457                                $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
     4458                                $this->bo->catalog->src_info = $ldap->srcs[1]; 
     4459                        } 
     4460                         
     4461                        $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true);                               
     4462                        $dn=$this->bo->catalog->src_info['dn']; 
     4463                         
     4464                        //buscar os atributos do ldap 
     4465                        $configobj = CreateObject('phpgwapi.config', 'contactcenter'); 
     4466                        $prefs = $configobj->read_repository(); 
     4467                        $attr_names = array(); 
     4468                        $attr_types = array(); 
     4469                        $justThese = array(); 
     4470                        foreach ($prefs as $pref_key => $pref_value) 
     4471                        { 
     4472                                if (stripos($pref_key, "cc_attribute_name_") !== false) 
     4473                                { 
     4474                                        $num = substr($pref_key, strlen("cc_attribute_name_")); 
     4475                                        $attr_names[] = $prefs["cc_attribute_name_$num"]; 
     4476                                        $attr_types[] = $prefs["cc_attribute_type_$num"]; 
     4477                                        $justThese[] = strtolower($prefs["cc_attribute_ldapname_$num"]); 
     4478                                } 
     4479                        } 
     4480                        $sr = ldap_read($ds,$id, "objectClass=*",$justThese);                                                    
     4481                        $info = ldap_get_entries($ds, $sr); 
     4482                        if ($info) 
     4483                        { 
     4484                                for ($i = 0; $i < count($justThese); $i++) 
     4485                                { 
     4486                                        $attr = array(); 
     4487                                        $attr['name'] = $attr_names[$i]; 
     4488                                        if ($attr_types[$i] == 'multivalues') 
     4489                                        { 
     4490                                                $attr['type'] = 'multivalues'; 
     4491                                                $attr['value'] = array(); 
     4492                                                for ($j = 0; $j < $info[0][$justThese[$i]]['count']; $j++) 
     4493                                                        $attr['value'][] = utf8_decode($info[0][$justThese[$i]][$j]); 
     4494                                        } 
     4495                                        else 
     4496                                        { 
     4497                                                $attr['type'] = 'text'; 
     4498                                                $attr['value'] = utf8_decode($info[0][$justThese[$i]][0]); 
     4499                                        } 
     4500                                        $data[] = $attr; 
     4501                                } 
     4502                        } 
     4503                        else 
     4504                                $data = 'error'; 
     4505                        ldap_close($ds); 
     4506                         
     4507                        echo serialize($data); 
     4508                } 
    44364509        } 
    44374510 
  • sandbox/2.2.0.2/contactcenter/inc/hook_config_validate.inc.php

    r2 r4500  
    4747                } 
    4848        } 
     49 
     50         
     51        /* 
     52         * @function cc_allow_details 
     53         * @abstract Recebe o valor do checkbox e forï¿œa a saï¿œda para TRUE ou FALSE 
     54         * @author Prognus software livre - http://www.prognus.com.br | prognus@prognus.com.br 
     55         * @param $value 
     56         */ 
     57        function cc_allow_details(&$value) { 
     58                if ($value == 'details') { 
     59                        $value = "true"; 
     60                } else { 
     61                        $value = "false"; 
     62                } 
     63        } 
    4964?> 
Note: See TracChangeset for help on using the changeset viewer.