Changeset 1600 for trunk/contactcenter


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

Ticket #619 - Incluidos campos configuraveis (matricula/celular/setor) para o contactcenter

Location:
trunk/contactcenter
Files:
4 edited

Legend:

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

    r1419 r1600  
    4545                                                'acc'    => $data['cc_ldap_browse_dn0'], 
    4646                                                'pw'     => $data['cc_ldap_pw0'], 
    47                                                 'obj'    => 'phpgwAccount', 
     47                                                'obj'    => 'inetOrgPerson', 
    4848                                                'branch' => strtolower('ou'), 
    4949                                                'visible' => $data['cc_ldap_query_automatic'] 
     
    8383                /* 
    8484                * @function get_external_ldap_sources 
    85                 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     85                * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
    8686                * @abstract returns an array with the external sources 
    8787                * @return (array) the external sources 
     
    104104                         
    105105                        $op_iop = array( 
    106                                 'contact.uidnumber'                                => array('uidNumber'), 
     106                                'contact.uidnumber'                => array('uidNumber'), 
    107107                                'contact.id_contact'               => array('dn'), 
    108108                                'contact.photo'                    => array('jpegPhoto'), 
     
    123123                                'contact.object_class'             => array('objectClass'), 
    124124                                'contact.business_info.title'      => array('title'), 
    125                                 'contact.business_info.department' => array('ou'), 
    126                                 'contact.company.company_name'     => array('o'), 
     125                                'contact.business_info.department' => array('ou'), // Setor do empregado... 
     126                                'contact.business_info.empNumber'  => array('employeeNumber'), // Matricula do empregado 
     127 
     128                                'contact.business_info.celPhone'   => array('mobile'), // Celular empresarial do empregado 
     129 
     130                                'contact.company.company_name'     => array('o'), 
    127131                                'contact.company.company_notes'    => array('businessCategory'), 
    128132                                 
     
    162166                                        'email'  => array('mail'), 
    163167                                        'phone'  => array('telephoneNumber'), 
    164                                         'mobile' => array('mobile'), 
    165                                         'pager'  => array('pager'), 
    166                                         'fax'    => array('facsimileTelephoneNumber'), 
     168                                //      'mobile' => array('mobile'), 
     169                                //      'pager'  => array('pager'), // idem ao comentario abaixo, do atributo fax; 
     170                                //      'fax'    => array('facsimileTelephoneNumber'), //linha comentada para nao trazer 
     171                                // o atributo fax do Ldap; correcao temporaria para nao exibir o fax no ContactCenter 
     172                                //(estava sobrepondo o telefone do usuario) 
     173 
    167174                                        'telex'  => array('telexNumber') 
    168175                                ), 
     
    174181                /* 
    175182                 * @function get_external_ldap_fields_association 
    176                  * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     183                 * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
    177184                 * @abstract get the fields association for an external ldap_source 
    178185                 * @return an array with attribute mappings 
     
    187194                /* 
    188195                 * @function test_connection 
    189                  * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     196                 * @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
    190197                 * @abstract Test if we can bind to a ldap server in a reasonable time 
    191198                 * @param (string) $host ldap server's hostname 
     
    250257                        } 
    251258                         
    252                         $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], true); 
     259                        $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], false); 
    253260                        if (!$ldap) 
    254261                        { 
     
    272279                        @function get_external_ldap_tree 
    273280                        @abstract Returns the LDAP external tree corresponding to the specified level 
    274                         @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     281                        @author Mï¿œrio Cï¿œsar Kolling <mario.kolling@serpro.gov.br> 
    275282                        @param (integer) $id_source The ID of the external LDAP source 
    276283                        @param (string)  $context The context to be used as root branch 
     
    285292                        include(PHPGW_INCLUDE_ROOT . '/contactcenter/setup/external_catalogs.inc.php' ); 
    286293                        //include('external_catalogs.inc.php' ); 
    287                          
     294 
    288295                        if (!$external_srcs[$id_source]) 
    289296                        { 
    290297                                return null; 
    291298                        } 
    292                          
     299 
    293300                        // calls test_connection first. If succeeded continue, return error message otherwise. 
    294301                        if (!($response = $this->test_connection($external_srcs[$id_source]['host'], $external_srcs[$id_source]['acc'], $external_srcs[$id_source]['pw'], 10))) 
     
    411418                        else  
    412419                                return false; 
    413                          
    414                          
    415420                } 
    416421 
     
    441446                { 
    442447                        /* 
    443                          * Esta operação resolve o problema causado pela conversão de caracteres acentuados realizada 
    444                          * pela função ldap_explode_dn(). 
     448                         * Esta operaᅵᅵo resolve o problema causado pela conversï¿œo de caracteres acentuados realizada 
     449                         * pela funᅵᅵo ldap_explode_dn(). 
    445450                         */ 
    446451 
     
    450455                function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn, $external = 0) 
    451456                { 
    452                                                  
     457                        if(strstr($context, "ldap://")){ 
     458                                $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context)); 
     459                                $host   = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context); 
     460                                $resource = ldap_connect($host); 
     461                                ldap_bind($resource); 
     462                        } 
     463 
    453464                        /* 
    454465                         * TODO: Search timeouts 
    455466                         */ 
    456                          
    457                         $dn_parts = ldap_explode_dn($context,1); 
     467 
     468                        $dn_parts = ldap_explode_dn(($refer_context ? $refer_context : $context),1); 
    458469                        //$filter = '(!(objectClass='.$objectClass.'))'; 
    459470                        // Don't show OU's whith phpgwAccountVisible equal to '-1' 
     
    468479                                // and whose attribute phpgwAccountVisible value is different from -1 
    469480                                $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 
    470                                 $context = preg_replace("/dc=(.*)/i",$this->srcs[$id_source]['dn'],$context);    
    471                         } 
    472                          
    473                         $result_res = @ldap_list($resource,  $context, $filter, array(), 0, 0); 
    474                         if (!$result_res) 
     481                        } 
     482                        $result_res = @ldap_list($resource,  ($refer_context ? $refer_context : $context), $filter, array(), 0, 0); 
     483                        @ldap_sort($resource, $result_res, 'ou'); 
     484 
     485                        // Timeouts commented out 
     486                        /* 
     487                        if ($result_res === false) 
     488                        { 
    475489                                return null; 
    476                          
    477                         @ldap_sort($resource, $result_res, 'ou'); 
     490                        } 
     491                        */ 
     492 
    478493                        $count = ldap_count_entries($resource,$result_res); 
    479                          
     494 
    480495                        if ( $count == 0 ) 
    481496                        { 
    482497                                $filter = '(objectClass='.$objectClass.')'; 
    483498                                // Get only one attribute of the source's objectClass 
    484                                 $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 
    485                                 if (!$result_res2) 
    486                                         return null; 
    487  
     499                                $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 
    488500                                $entries_count = ldap_count_entries($resource, $result_res2); 
    489501 
     
    509521                                } 
    510522                        } 
    511                          
     523 
    512524                        $sub_branch_found = false; 
    513525                        $i = 0; 
     
    521533                                list($group) = explode('=',$dn_parts_full[0]); 
    522534 
    523                                 //Faz a comparação do branch como case insensitive 
     535                                //Faz a comparaᅵᅵo do branch como case insensitive 
    524536                                if (strtolower($group) == strtolower($branch_dn) or $branch_dn === 'all') 
    525537                                { 
     
    527539                                                'name'  => $this->translate_accentuation($dn_parts_1[0]), 
    528540                                                'type'  => 'unknown', 
    529                                                 'value' =>  $dn, 
     541                                                'value' =>  ($refer_context ? $host."/" : "").$dn, 
    530542                                                'sub_branch' => false 
    531543                                        ); 
     
    534546                                $i++; 
    535547                        } 
    536                                                  
     548 
     549                        if(! $refer_context) { 
     550                                $array_referral = $this -> get_ldap_sub_branches_referrals($resource, $context,'(objectClass=organizationalUnit)'); 
     551                                for($z = 0; $z < count($array_referral); $z++) { 
     552                                        $tree['sub_branch'][$i++] = $array_referral[$z]; 
     553                                } 
     554                        } 
     555 
    537556                        $filter = 'objectClass='.$objectClass; 
    538                         $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 
     557                        $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 
    539558                        $entries_count = ldap_count_entries($resource, $result_res2); 
    540559 
  • trunk/contactcenter/inc/class.ui_preferences.inc.php

    r285 r1600  
    7979                        } 
    8080                         
     81                        if ($actual['empNum']) 
     82                        { 
     83                                $GLOBALS['phpgw']->template->set_var('empNum', 'checked'); 
     84                        } 
     85                        else 
     86                        { 
     87                                $GLOBALS['phpgw']->template->set_var('empNum', ''); 
     88                        } 
     89 
     90                        if ($actual['cell']) 
     91                        { 
     92                                $GLOBALS['phpgw']->template->set_var('cell', 'checked'); 
     93                        } 
     94                        else 
     95                        { 
     96                                $GLOBALS['phpgw']->template->set_var('cell', ''); 
     97                        } 
     98 
     99                        if ($actual['department']) 
     100                        { 
     101                                $GLOBALS['phpgw']->template->set_var('department', 'checked'); 
     102                        } 
     103                        else 
     104                        { 
     105                                $GLOBALS['phpgw']->template->set_var('department', ''); 
     106                        } 
     107 
    81108                        $GLOBALS['phpgw']->template->set_var('personCardEmail', $options_email); 
    82109                        $GLOBALS['phpgw']->template->set_var('personCardPhone', $options_phone); 
     
    130157                                } 
    131158                                 
     159                                if($_POST['empNum']) 
     160                                { 
     161                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'empNum', '1'); 
     162                                } 
     163                                else 
     164                                { 
     165                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'empNum', '0'); 
     166                                } 
     167                                 
     168                                if($_POST['cell']) 
     169                                { 
     170                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'cell', '1'); 
     171                                } 
     172                                else 
     173                                { 
     174                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'cell', '0'); 
     175                                } 
     176                                 
     177                                if($_POST['department']) 
     178                                { 
     179                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'department', '1'); 
     180                                } 
     181                                else 
     182                                { 
     183                                        $GLOBALS['phpgw']->preferences->add('contactcenter', 'department', '0'); 
     184                                } 
     185                                 
    132186                                $GLOBALS['phpgw']->preferences->save_repository(); 
    133187                        } 
  • trunk/contactcenter/templates/default/index.tpl

    r1517 r1600  
    1111        } 
    1212</style> 
     13<script src="js/cc.js" type="text/javascript"></script> 
    1314<!-- JS MESSAGES --> 
    1415<input id="cc_msg_not_allowed" type="hidden" value="{cc_msg_not_allowed}"> 
     
    8687<input id="cc_contact_type" type="hidden" value="{cc_contact_type}"> 
    8788 
     89 
    8890 <!-- END JS MESSAGES --> 
    8991 <input id="cc_type_contact"    type="hidden"> 
     
    249251<!-- _END VIEW CARDS --> 
    250252<!-- BOTTOM DETAILS--> 
    251 <script src="js/cc.js" type="text/javascript"></script> 
    252253<script type="text/javascript" src="js/moo.fx.js"></script> 
    253254<script type="text/javascript" src="js/ccListParticipants.js"></script> 
  • trunk/contactcenter/templates/default/preferences.tpl

    r1158 r1600  
    6363                </tr> 
    6464        </table> 
     65        <br> 
     66        <p align="center" style="font-weight: bold; font-size: medium; border: 0px solid black">Preferências de Visualização</p> 
     67        <table align="center" style="width: 400px"> 
     68                <tr class="th"> 
     69                        <td style="text-align: center; font-weight: bold; width: 200px">Campo</td> 
     70                        <td style="text-align: center; font-weight: bold; width: 200px">{lang_Value}</td> 
     71                </tr> 
     72                <tr class="row_off"> 
     73                        <td>Matrícula</td> 
     74                        <td align="center"> 
     75                                <input type="checkbox" name="empNum" {empNum} /> 
     76                        </td> 
     77                </tr> 
     78                <tr class="row_off"> 
     79                        <td>Celular</td> 
     80                        <td align="center"> 
     81                                <input type="checkbox" name="cell" {cell} /> 
     82                        </td> 
     83                </tr> 
     84                <tr class="row_off"> 
     85                        <td>Setor</td> 
     86                        <td align="center"> 
     87                                <input type="checkbox" name="department" {department} /> 
     88                        </td> 
     89                </tr> 
     90                <tr> 
     91                        <td></td> 
     92                        <td style="text-align: right;"> 
     93                                <input type="submit" name="save" value="{lang_Save}"> 
     94                                <input type="button" name="cancel" value="{lang_Cancel}" onclick="window.back()"> 
     95                        </td> 
     96                </tr> 
     97        </table> 
    6598</div> 
    6699</form> 
Note: See TracChangeset for help on using the changeset viewer.