Ignore:
Timestamp:
06/27/12 13:00:55 (12 years ago)
Author:
eduardow
Message:

Ticket #2863 - Backport da funcionalidade de Controle de Cotas de usuário e disco(Cotas OU).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/expressoAdmin1_2/inc/class.uisectors.inc.php

    r5133 r6660  
    2020                        'validate_data_sectors_edit'    => True, 
    2121                        'delete_sector'                                 => True, 
    22                         'css'                                                   => True 
     22                        'css'                                                   => True,  
     23                        'view_cota'                                             => True  
    2324                ); 
    2425 
     
    6364                        $p->set_block('sectors','row_empty','row_empty'); 
    6465                         
    65                         $sectors_info = $this->functions->get_sectors_list($contexts); 
     66                        //$sectors_info = $this->functions->get_sectors_list($contexts);  
     67                        $sectors_info = $this->functions->get_organizations2($contexts);  
    6668                         
    6769                        $var = Array( 
     
    6971                                'back_url'                              => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), 
    7072                                'context_display'               => $context_display, 
    71                                 'lang_inactives'                        => lang('list inactives') 
     73                                'lang_inactives'                        => lang('list inactives'),  
     74                                'lang_ver_cota'         => lang('view cota') 
    7275                        ); 
    7376 
     
    9598                                { 
    9699                                        $tr_color = $this->nextmatchs->alternate_row_color($tr_color); 
    97                                          
    98100                                        $var = Array( 
    99101                                                'tr_color'    => $tr_color, 
    100                                                 'sector_name'  => $sector, 
    101                                                 'add_link' => $this->row_action('add','sector',$context) 
     102                                                'sector_name'  => $sector['display'],  
     103                                                'cota_link' => $this->row_action('view','cota',$sector['dn']),  
     104                                                'add_link' => $this->row_action('add','sector',$sector['dn'])  
    102105                                        );       
    103106                                         
     
    106109                                                                         
    107110                                        if(isset($GLOBALS['phpgw_info']['server']['time_to_account_expires'])) 
    108                                                 $var['inactives_link'] = $this->row_action('list_inactive','users',$context,'uiaccounts'); 
     111                                                $var['inactives_link'] = $this->row_action('list_inactive','users',$sector['dn'],'uiaccounts');  
    109112                                        else 
    110113                                                $var['inactives_link'] = lang('disabled'); 
     
    114117                                        if ($can_edit) 
    115118                                        { 
    116                                                 $p->set_var('edit_link',$this->row_action('edit','sector',utf8_decode($context))); 
     119                                                $p->set_var('edit_link',$this->row_action('edit','sector',$sector['dn']));  
    117120                                        } 
    118121                                        else 
     
    123126                                        if ($can_delete) 
    124127                                        { 
    125                                                 $p->set_var('delete_link',$this->row_action('delete','sector',utf8_decode($context))); 
     128                                                $p->set_var('delete_link',$this->row_action('delete','sector',$sector['dn']));  
    126129                                        } 
    127130                                        else 
     
    189192                                'context'                       => $context == '' ? $GLOBALS['phpgw_info']['server']['ldap_context'] : $context, 
    190193                                'sector'                        => $_POST['sector'], 
     194                                'disk_quota'        => $_POST['disk_quota'],  
     195                                'users_quota'       => $_POST['users_quota'],  
    191196                                'manager_org'           => $combo_manager_org, 
    192197                                'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', 
    193198                                'error_messages'        => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 
    194199                        ); 
    195                          
     200 
     201                        if($this->functions->db_functions->use_cota_control()) {  
     202                                $var["open_comment_cotas"] = "";  
     203                                $var["close_comment_cotas"] ="";  
     204                        }  
     205                        else {  
     206                                $var["open_comment_cotas"] = "<!--";  
     207                                $var["close_comment_cotas"] ="-->";  
     208                        }         
     209                                                                 
    196210                        $var['sector'] = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$var['sector']); 
    197211                        $var['sector'] = utf8_decode($var['sector']); 
     
    242256                        { 
    243257                                $sector_info = $this->so->get_info($context); 
     258                                $sector_disk_quota = $sector_info[0]['diskquota'][0];  
     259                                $sector_users_quota = $sector_info[0]['usersquota'][0];  
    244260                                $_POST['sector_visible'] = $sector_info[0]['phpgwaccountvisible'][0]; 
    245261                        }  
     
    254270                                'manager_org'           => $combo_manager_org, 
    255271                                'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', 
     272                                'disk_quota'        => $_POST['disk_quota'] == '' ? $sector_disk_quota : $_POST['disk_quota'],  
     273                                'users_quota'       => $_POST['users_quota'] == '' ? $sector_users_quota : $_POST['users_quota'],  
    256274                                 
    257275                                'lang_add'                      => lang('Add'), 
    258276                                'disable'                       => 'disabled', 
    259277                                'error_messages'        => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 
    260                         ); 
     278                                'lang_disk_quota'   => lang('disk quota'),  
     279                                'lang_users_quota'  => lang('users quota')  
     280                        );  
     281                        if($this->functions->db_functions->use_cota_control()) {  
     282                                $var["open_comment_cotas"] = "";  
     283                                $var["close_comment_cotas"] ="";  
     284                        }  
     285                        else {  
     286                                $var["open_comment_cotas"] = "<!--";  
     287                                $var["close_comment_cotas"] ="-->";  
     288                        }  
    261289 
    262290                        $var['sector'] = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$var['sector']); 
     
    267295 
    268296                        $p->pfp('out','edit_sector'); 
    269                 }                        
     297                } 
     298                         
     299                function view_cota()  
     300                {  
     301                        $context = $_GET['context'];  
     302                        $a_tmp = explode(",", ldap_dn2ufn($context));  
     303  
     304                        $sector_name = $a_tmp[0];  
     305                        if($this->functions->db_functions->use_cota_control()) {  
     306                                $sector_info = $this->so->get_info($context);  
     307                                $sector_disk_cota = $sector_info[0]['diskquota'][0];  
     308                                $sector_users_cota = $sector_info[0]['usersquota'][0];  
     309                        }  
     310                        else {  
     311                                $sector_disk_cota = lang('cotas control disabled');  
     312                                $sector_users_cota = lang('cotas control disabled');                              
     313                        }  
     314  
     315  
     316                        unset($GLOBALS['phpgw_info']['flags']['noheader']);  
     317                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);  
     318                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Sector');  
     319                        $GLOBALS['phpgw']->common->phpgw_header();  
     320                          
     321                        // Set o template  
     322                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);  
     323                        $p->set_file(Array('ver_cota' => 'sectors_cota.tpl'));  
     324                          
     325                  
     326                        // Seta variaveis utilizadas pelo tpl.  
     327                        $var = Array(  
     328                                'back_url'                      => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'),  
     329                                'th_bg'                         => $GLOBALS['phpgw_info']['theme']['th_bg'],  
     330                                'context'                       => $context,  
     331                                'sector'                        => $sector_name,  
     332                                'disk_cota'        => $sector_disk_cota,  
     333                                'users_cota'       => $sector_users_cota,  
     334                                'actual_users'          => $this->functions->get_num_users($context),  
     335                                'actual_disk'           => round($this->functions->get_actual_disk_usage($context),2),                            
     336                                  
     337                                'lang_back'                     => lang('Back'),  
     338                                'lang_context'          => lang('Context'),  
     339                                'lang_sector_name'      => lang('Sector name'),  
     340                                'lang_disk_cota'   => lang('disk usage cota'),  
     341                                'lang_users_cota'  => lang('user number cota'),  
     342                                'lang_user_number'  => lang('user number'),  
     343                                'lang_disk_used'    => lang('disk usage'),                                
     344                                'error_messages'        => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>",  
     345                        );  
     346                        $p->set_var($var);  
     347  
     348                        $p->pfp('out','ver_cota');  
     349                }          
    270350                 
    271351                function validate_data_sectors_add() 
Note: See TracChangeset for help on using the changeset viewer.