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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/admin/inc/class.uiconfig.inc.php

    r3018 r4500  
    7979                                /* Load hook file with functions to validate each config (one/none/all) */ 
    8080                                $GLOBALS['phpgw']->hooks->single('config_validate',$appname); 
     81                                 
     82                                if (!isset($_POST['newsettings']['cc_allow_details'])) { 
     83                                        $_POST['newsettings']['cc_allow_details'] = "false"; 
     84                                } 
    8185 
    8286                                foreach($_POST['newsettings'] as $key => $config) 
    8387                                { 
    84                                         if ($config) 
    85                                         { 
    86                                                 if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && function_exists($key)) 
    87                                                 { 
    88                                                         call_user_func($key,$config); 
    89                                                         if($GLOBALS['config_error']) 
     88                                         
     89                                        if ($config)   
     90                                        {                                                                                                                                                                                 // Código adicionado   
     91                                                if($GLOBALS['phpgw_info']['server']['found_validation_hook'] && (function_exists($key) || function_exists(substr($key,0,strrpos($key,'_')))) ) 
     92                                                { 
     93                                                        if(function_exists(substr($key,0,strrpos($key,'_')))) 
     94                                { 
     95                                call_user_func(substr($key,0,strrpos($key,'_')),&$config); 
     96                                }  
     97                                else  
     98                                { 
     99                                call_user_func($key,&$config); 
     100                                } 
     101 
     102                                if($GLOBALS['config_error']) 
    90103                                                        { 
    91104                                                                $errors .= lang($GLOBALS['config_error']) . ' '; 
     
    152165                        echo parse_navbar(); 
    153166 
     167                         
     168                        $campos = ''; 
     169                         
     170                        if($appname=="contactcenter")  
     171                        { 
     172                                 
     173                                foreach ($c->config_data as $key => $config)  
     174                                {                
     175                                        $parts = explode('_', $key); 
     176                        if (is_numeric($parts[3]) && $parts[1]=='attribute') 
     177                        { 
     178                        $fields[$parts[3]][$key] = $config; 
     179                        } 
     180                         
     181                         
     182                        if($key == 'cc_allow_details') { 
     183                                $checkedCoisa = 'value="details"'; 
     184                                if ($config=='true') { 
     185                                        $checkedCoisa = 'value="details" checked="checked"';  
     186                                } 
     187                        } 
     188                } 
     189                         
     190                 
     191                        foreach ($fields as $i => $line)  
     192                        { 
     193                        if ($line["cc_attribute_name_$i"] != '' && $line["cc_attribute_ldapname_$i"] != '') { 
     194                        $selectedText  = $line["cc_attribute_type_$i"] == 'text' ? 'selected="selected"' : ''; 
     195                        $selectedTMult = $line["cc_attribute_type_$i"] == 'multivalues' ? 'selected="selected"' : ''; 
     196                                 
     197                                $campos = $campos . "<div class=\"cc_attribute\"> 
     198                                <label>" . lang('Name') .":</label> 
     199                                <input type=\"text\" name=\"newsettings[cc_attribute_name_" . $i . "]\" value=\"".$line["cc_attribute_name_$i"]."\" />  
     200                                <label>" . lang('Corresponding LDAP') . ":</label> 
     201                                <input type=\"text\" name=\"newsettings[cc_attribute_ldapname_" . $i . "]\" value=\"".$line["cc_attribute_ldapname_$i"]."\" />  
     202                                <label>" . lang('Type') . ":</label> 
     203                                <select name=\"newsettings[cc_attribute_type_" . $i . "]\"> 
     204                                        <option value=\"text\" $selectedText>" . lang('Text') . "</option> 
     205                                        <option value=\"multivalues\" $selectedTMult>" . lang('Multivalued') ."</option> 
     206                                </select> 
     207                                <img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') . "\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"/>   
     208                        </div>"; 
     209                        } 
     210                        }  
     211                 
     212                            if ($campos == '') 
     213                        { 
     214                                $campos = "<div class=\"cc_attribute\"> 
     215                                <label>" . lang('Name') .":</label> 
     216                                <input type=\"text\" name=\"newsettings[cc_attribute_name_0]\" value=\"\" />  
     217                                <label>" . lang('Corresponding LDAP') . ":</label> 
     218                                <input type=\"text\" name=\"newsettings[cc_attribute_ldapname_0]\" value=\"\" />  
     219                                <label>" . lang('Type') . ":</label> 
     220                                <select name=\"newsettings[cc_attribute_type_0]\"> 
     221                                        <option value=\"text\">" . lang('Text') . "</option> 
     222                                        <option value=\"multivalues\">" . lang('Multivalued') . "</option> 
     223                                </select> 
     224                                <img src=\"contactcenter/templates/default/images/cc_x.png\" alt=\"". lang('Delete') ."\" style=\"width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;\" onclick=\"javascript:cc_attribute_delete(this)\"/>  
     225                        </div>"; 
     226                        } 
     227                         
     228                        $t->set_var('lang_add_button', lang('Add')); 
     229                                $t->set_var('lang_cc_Set_details_attributes',   lang('Details on the Global Catalog Address')); 
     230                        $t->set_var('lang_cc_Allow_view_details_label', lang('Enable display of contact details for the Global Catalog'));                               
     231                        $t->set_var('attribute_fields', $campos);                
     232                        $t->set_var('cc_config_js', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_config.js'); 
     233                        $t->set_var('cc_allow_view_details_value', $checkedCoisa); 
     234                        }  
     235                 
     236                         
    154237                        if($appname=="expressoAdmin1_2") { 
    155238                                /* Varre a pasta inc do admin do expresso procurando scripts de geração de login automático 
Note: See TracChangeset for help on using the changeset viewer.