Ignore:
Timestamp:
11/03/11 13:24:14 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo ExpressoAdmin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoAdmin1_2/inc/class.uisectors.inc.php

    r3887 r5133  
    2020                        'validate_data_sectors_edit'    => True, 
    2121                        'delete_sector'                                 => True, 
    22                         'css'                                                   => True, 
    23                         'view_cota'                                             => True 
     22                        'css'                                                   => True 
    2423                ); 
    2524 
     
    4746 
    4847                        // Verifica se o administrador tem acesso. 
    49  
     48                        if (!$this->functions->check_acl($manager_lid,'list_sectors')) 
     49                        { 
     50                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); 
     51                        } 
    5052                         
    5153                        unset($GLOBALS['phpgw_info']['flags']['noheader']); 
     
    6163                        $p->set_block('sectors','row_empty','row_empty'); 
    6264                         
    63                         //$sectors_info = $this->functions->get_sectors_list($contexts); 
    64                         $sectors_info = $this->functions->get_organizations2($contexts); 
     65                        $sectors_info = $this->functions->get_sectors_list($contexts); 
    6566                         
    6667                        $var = Array( 
     
    6869                                'back_url'                              => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), 
    6970                                'context_display'               => $context_display, 
    70                                 'lang_inactives'                        => lang('list inactives'), 
    71                                 'lang_ver_cota'         => lang('view cota') 
    72                         ); 
     71                                'lang_inactives'                        => lang('list inactives') 
     72                        ); 
     73 
    7374                        $p->set_var($var); 
    7475                        $p->set_var($this->functions->make_dinamic_lang($p, 'list')); 
     
    9798                                        $var = Array( 
    9899                                                'tr_color'    => $tr_color, 
    99                                                 'sector_name'  => $sector['display'], 
    100                                                 'cota_link' => $this->row_action('view','cota',$sector['dn']), 
     100                                                'sector_name'  => $sector, 
     101                                                'add_link' => $this->row_action('add','sector',$context) 
    101102                                        );       
    102103                                         
    103                                         if ($this->functions->check_acl($manager_lid,'create_sectors')) 
    104                                                 $p->set_var('add_link',$this->row_action('add','sector',$sector['dn'])); 
    105                                         else 
    106                                                 $p->set_var('add_link',' '); 
     104                                        $var['sector_name'] = utf8_decode($var['sector_name']); 
     105 
    107106                                                                         
    108107                                        if(isset($GLOBALS['phpgw_info']['server']['time_to_account_expires'])) 
    109                                                 $var['inactives_link'] = $this->row_action('list_inactive','users',$sector['dn'],'uiaccounts'); 
     108                                                $var['inactives_link'] = $this->row_action('list_inactive','users',$context,'uiaccounts'); 
    110109                                        else 
    111110                                                $var['inactives_link'] = lang('disabled'); 
     
    115114                                        if ($can_edit) 
    116115                                        { 
    117                                                 $p->set_var('edit_link',$this->row_action('edit','sector',$sector['dn'])); 
     116                                                $p->set_var('edit_link',$this->row_action('edit','sector',utf8_decode($context))); 
    118117                                        } 
    119118                                        else 
     
    124123                                        if ($can_delete) 
    125124                                        { 
    126                                                 $p->set_var('delete_link',$this->row_action('delete','sector',$sector['dn'])); 
     125                                                $p->set_var('delete_link',$this->row_action('delete','sector',utf8_decode($context))); 
    127126                                        } 
    128127                                        else 
     
    139138                        $p->set_var($var); 
    140139                         
    141                         if ($this->functions->check_acl($manager_lid,'create_sectors')) { 
    142140                                $p->set_var('input_add','<input type="submit" value="' . lang('Add Sectors') . '">'); 
    143                         } 
    144                         else { 
    145                                 $p->set_var('input_add',' '); 
    146                         } 
    147141                         
    148142                        $p->parse('rows','row_empty',True); 
     
    163157                                $context = $_GET['context']; 
    164158                                $combo_manager_org = $this->functions->get_organizations( $context, '', true, true, true ); 
     159                                $combo_manager_org = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$combo_manager_org); 
     160                                $combo_manager_org = utf8_decode($combo_manager_org); 
    165161                        } 
    166162                        else 
     
    193189                                'context'                       => $context == '' ? $GLOBALS['phpgw_info']['server']['ldap_context'] : $context, 
    194190                                'sector'                        => $_POST['sector'], 
    195                                 'associated_domain'             => $_POST['associated_domain'], 
    196                                 'disk_quota'        => $_POST['disk_quota'], 
    197                                 'users_quota'       => $_POST['users_quota'], 
    198                                 'file_manager_quota'=> $_POST['file_manager_quota'], 
    199191                                'manager_org'           => $combo_manager_org, 
    200192                                'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', 
     
    202194                        ); 
    203195                         
    204                         if($this->functions->db_functions->use_cota_control()) { 
    205                                 $var["open_comment_cotas"] = ""; 
    206                                 $var["close_comment_cotas"] =""; 
    207                         } 
    208                         else { 
    209                                 $var["open_comment_cotas"] = "<!--"; 
    210                                 $var["close_comment_cotas"] ="-->"; 
    211                         }        
     196                        $var['sector'] = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$var['sector']); 
     197                        $var['sector'] = utf8_decode($var['sector']); 
    212198                         
    213199                        $p->set_var($var); 
     
    225211                        $context = $_GET['context']; 
    226212 
    227                         $combo_manager_org = $this->functions->get_organizations($_GET['context'], '', true, true, true); 
     213                        $context = utf8_encode($context); 
     214                        $context = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$context); 
     215 
     216                        $combo_manager_org = $this->functions->get_organizations($context, '', true, true, true); 
     217 
     218                        $combo_manager_org = utf8_decode(preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$combo_manager_org)); 
     219 
    228220                        $combo_manager_org = substr( $combo_manager_org, 0, ( strpos($combo_manager_org, '</option>') + 9 ) ); 
    229221 
     
    250242                        { 
    251243                                $sector_info = $this->so->get_info($context); 
    252                                 $sector_disk_quota = $sector_info[0]['diskquota'][0]; 
    253                                 $sector_users_quota = $sector_info[0]['usersquota'][0]; 
    254                                 $sector_file_manager_quota = $sector_info[0]['filemanagerquota'][0]; 
    255                                 $sector_associated_domain = $sector_info[0]['associateddomain'][0]; 
    256244                                $_POST['sector_visible'] = $sector_info[0]['phpgwaccountvisible'][0]; 
    257245                        }  
     
    266254                                'manager_org'           => $combo_manager_org, 
    267255                                'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', 
    268                                 'associated_domain'        => $_POST['associated_domain'] == '' ? $sector_associated_domain : $_POST['associated_domain'], 
    269                                 'disk_quota'        => $_POST['disk_quota'] == '' ? $sector_disk_quota : $_POST['disk_quota'], 
    270                                 'users_quota'       => $_POST['users_quota'] == '' ? $sector_users_quota : $_POST['users_quota'], 
    271                                 'file_manager_quota'=> $_POST['file_manager_quota'] == '' ? $sector_file_manager_quota : $_POST['file_manager_quota'], 
     256                                 
    272257                                'lang_add'                      => lang('Add'), 
    273258                                'disable'                       => 'disabled', 
    274259                                'error_messages'        => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 
    275                                 'lang_disk_quota'   => lang('disk quota'), 
    276                                 'lang_users_quota'  => lang('users quota') 
    277                         ); 
    278                         if($this->functions->db_functions->use_cota_control()) { 
    279                                 $var["open_comment_cotas"] = ""; 
    280                                 $var["close_comment_cotas"] =""; 
    281                         } 
    282                         else { 
    283                                 $var["open_comment_cotas"] = "<!--"; 
    284                                 $var["close_comment_cotas"] ="-->"; 
    285                         } 
     260                        ); 
     261 
     262                        $var['sector'] = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$var['sector']); 
     263                        $var['sector'] = utf8_decode($var['sector']); 
     264                         
    286265                        $p->set_var($var); 
    287266                        $p->set_var($this->functions->make_dinamic_lang($p, 'list')); 
    288                          
     267 
    289268                        $p->pfp('out','edit_sector'); 
    290                 } 
    291                  
    292                 function view_cota() 
    293                 { 
    294                         $context = $_GET['context']; 
    295                         $a_tmp = explode(",", ldap_dn2ufn($context)); 
    296  
    297                         $sector_name = $a_tmp[0]; 
    298                         if($this->functions->db_functions->use_cota_control()) { 
    299                                 $sector_info = $this->so->get_info($context); 
    300                                 $sector_disk_cota = $sector_info[0]['diskquota'][0]; 
    301                                 $sector_users_cota = $sector_info[0]['usersquota'][0]; 
    302                         } 
    303                         else { 
    304                                 $sector_disk_cota = lang('cotas control disabled'); 
    305                                 $sector_users_cota = lang('cotas control disabled');                             
    306                         } 
    307  
    308  
    309                         unset($GLOBALS['phpgw_info']['flags']['noheader']); 
    310                         unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
    311                         $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Sector'); 
    312                         $GLOBALS['phpgw']->common->phpgw_header(); 
    313                          
    314                         // Set o template 
    315                         $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 
    316                         $p->set_file(Array('ver_cota' => 'sectors_cota.tpl')); 
    317                          
    318                  
    319                         // Seta variaveis utilizadas pelo tpl. 
    320                         $var = Array( 
    321                                 'back_url'                      => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), 
    322                                 'th_bg'                         => $GLOBALS['phpgw_info']['theme']['th_bg'], 
    323                                 'context'                       => $context, 
    324                                 'sector'                        => $sector_name, 
    325                                 'disk_cota'        => $sector_disk_cota, 
    326                                 'users_cota'       => $sector_users_cota, 
    327                                 'actual_users'          => $this->functions->get_num_users($context), 
    328                                 'actual_disk'           => round($this->functions->get_actual_disk_usage($context),2),                           
    329                                  
    330                                 'lang_back'                     => lang('Back'), 
    331                                 'lang_context'          => lang('Context'), 
    332                                 'lang_sector_name'      => lang('Sector name'), 
    333                                 'lang_disk_cota'   => lang('disk usage cota'), 
    334                                 'lang_users_cota'  => lang('user number cota'), 
    335                                 'lang_user_number'  => lang('user number'), 
    336                                 'lang_disk_used'    => lang('disk usage'),                               
    337                                 'error_messages'        => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 
    338                         ); 
    339                         $p->set_var($var); 
    340  
    341                         $p->pfp('out','ver_cota'); 
    342269                }                        
    343270                 
     
    371298                        $acl = $this->functions->read_acl($account_lid); 
    372299                        $manager_context = $acl[0]['context']; 
     300                         
     301                        $manager_context = utf8_encode($manager_context); 
     302                        $manager_context = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$manager_context); 
    373303                         
    374304                        // Verifica se tem acesso a este modulo 
     
    394324                        $sector_name = $tmp_sector_name[1]; 
    395325                         
     326 
    396327                        // Get users of sector 
    397                         $sector_users           = $this->so->get_sector_users($_GET['context']); 
    398                         $sector_groups          = $this->so->get_sector_groups($_GET['context']); 
    399                         $sector_subsectors      = $this->so->get_sector_subsectors($_GET['context']); 
     328                        $sector_users           = $this->so->get_sector_users(utf8_encode($_GET['context'])); 
     329                        $sector_groups          = $this->so->get_sector_groups(utf8_encode($_GET['context'])); 
     330                        $sector_subsectors      = $this->so->get_sector_subsectors(utf8_encode($_GET['context'])); 
    400331                         
    401332                        $users_list = ''; 
     
    415346                        { 
    416347                                if ($subsector['dn'] != $_GET['context']) 
    417                                         $subsectors_list .= $subsector['ou'][0] . '<br>'; 
     348                                        $subsectors_list .= utf8_decode($subsector['ou'][0] . '<br>'); 
    418349                        } 
    419350 
     
    431362                                'sectors_list'                          => $subsectors_list  
    432363                        ); 
     364                        $var['sector_name'] = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$var['sector_name']); 
     365 
    433366                        $p->set_var($var); 
    434367                        $p->set_var($this->functions->make_dinamic_lang($p, 'list')); 
Note: See TracChangeset for help on using the changeset viewer.