Changeset 1556


Ignore:
Timestamp:
10/29/09 14:46:20 (15 years ago)
Author:
amuller
Message:

Ticket #597 - Melhorias no módulo filemanager, implementação de quota!

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/class.uifilemanager.inc.php

    r1543 r1556  
    4747                //originally post_vars 
    4848                //              var $goto; 
     49                var $current_config; 
    4950                var $goto_x; 
    5051                var $download_x; 
     
    9697 
    9798                        $this->t = $GLOBALS['phpgw']->template; 
     99                        $c = CreateObject('phpgwapi.config','filemanager'); 
     100                        $c->read_repository(); 
     101                        $this->current_config = $c->config_data; 
     102 
    98103 
    99104                        // here local vars are created from the HTTP vars 
     
    277282                        } 
    278283 
     284                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/global.js'></script>"; 
    279285                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/main.js'></script>"; 
    280286                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 
     
    450456                        } 
    451457 
    452                         /* Update if they request it, or one out of 20 page loads */ 
    453                         srand((double) microtime() * 1000000); 
    454                         if($update || rand(0, 19) == 4) 
     458 
     459                        /* Update the vfs */ 
     460                        if ($_GET['update'] == 'True')  
    455461                        { 
    456462                                $this->bo->vfs->update_real(array( 
    457463                                        'string' => $this->path, 
    458                                         'relatives' => array(RELATIVE_NONE) 
     464                                        'relatives' => array(RELATIVE_ALL) 
    459465                                )); 
    460466                        } 
     
    575581                                } 
    576582                                $columns++; 
    577  
     583                                $vars[usedSpace]='<input type="hidden" id="usedSpace" value="'.round(($this->usedSpace()/1024)/1024).'">'; 
     584                                $vars[quotaSize]='<input type="hidden" id="quotaSize" value="'.$this->current_config['filemanager_quota_size'].'">'; 
     585                                $vars[javascript]='<script src="filemanager/js/draw_api.js"></script>'; 
    578586                                $vars[toolbar0]=$this->toolbar('location'); 
    579587                                $vars[toolbar1]=$this->toolbar('list_nav'); 
     
    863871                                        } 
    864872 
    865                                         if($files['mime_type'] == 'Directory') 
    866                                         { 
    867                                                 $usedspace += $fileinfo[0]; 
    868                                         } 
    869                                         else 
    870                                         { 
    871                                                 $usedspace += $files['size']; 
    872                                         } 
     873                                        $usedspace += $files['size']; 
    873874 
    874875                                        $this->t->set_var('row_tr_color',''); 
     
    10541055                                        if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 
    10551056                                        { 
    1056  
    1057                                         //      $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 
    1058                                         //      $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 
    1059                                         //      $toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 
    1060                                         //      $toolbar.=$this->inputImage('download','download',lang('Download')); 
    10611057                                                // upload button 
    1062                                                 $toolbar.=$this->inputImage('upload','upload',lang('Upload')); 
     1058                                                if (($this->usedSpace()*1024*1024) > $this->current_config['filemanager_quota_size']) 
     1059                                                        $toolbar.=$this->inputImage('upload','upload',lang('Upload')); 
    10631060                                        } 
    10641061                                        $toolbar.='</tr></table>'; 
     
    11541151                } 
    11551152 
     1153 
     1154                function usedSpace(){ 
     1155                           for($i = 0; $i != $this->numoffiles; $i++) 
     1156                                $usedspace += $this->files_array[$i]['size']; 
     1157                           return $usedspace; 
     1158                } 
     1159 
    11561160                // move to bo 
    11571161                # Handle File Uploads 
    11581162                function fileUpload() 
    11591163                { 
     1164                        if (($this->usedSpace()*1024*1024) > $this->current_config['filemanager_quota_size']) 
     1165                                echo lang('You exceded the quota'); 
     1166                        else 
    11601167                        if($this->path != '/' && $this->path != $this->bo->fakebase) 
    11611168                        { 
     
    11871194                                                } 
    11881195                                        } 
    1189                                          $c = CreateObject('phpgwapi.config','filemanager'); 
    1190                                          $c->read_repository(); 
    1191                                          $current_config = $c->config_data; 
    1192                                          $max_size = $current_config['filemanager_Max_file_size']; 
     1196                                         $max_size = $this->current_config['filemanager_Max_file_size']; 
    11931197                                         if (! $max_size) 
    11941198                                                 $max_size = ini_get('upload_max_filesize'); 
  • sandbox/filemanager/inc/hook_sidebox_menu.inc.php

    r1506 r1556  
    3030        $file = Array( 
    3131                'Filemanager preferences'=>$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=filemanager'), 
     32                'Update'=>$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index&update=True'), 
    3233                'Grant Access'=>$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=filemanager'),     
    3334        ); 
  • sandbox/filemanager/js/main.js

    r1529 r1556  
    11 
     2 
  • sandbox/filemanager/templates/default/config.tpl

    r1533 r1556  
    1111    <td>                  
    1212    <input size="1" name="newsettings[filemanager_Max_file_size]" value="{value_filemanager_Max_file_size}">&nbsp;Mb 
     13    </td> 
     14    </tr> 
     15    <tr bgcolor="{row_off}">               
     16    <td>{lang_quota_size}</td>                 
     17    <td>                  
     18    <input size="2" name="newsettings[filemanager_quota_size]" value="{value_filemanager_quota_size}">&nbsp;Mb 
    1319    </td> 
    1420    </tr> 
  • sandbox/filemanager/templates/default/filelisting.tpl

    r1543 r1556  
    11<!-- BEGIN filemanager_header --> 
     2{usedSpace} 
     3{quotaSize} 
     4{javascript} 
    25<form name="formfm" method="post" action="{form_action}"> 
    3  
    4  
    56{toolbar0} 
    67<div id="fmMenu"> 
     
    2627{lang_no_files} 
    2728</tbody></table> 
    28                                                 </div> 
    29  
     29</div> 
    3030<div id="fmStatusBar"><b>{lang_files_in_this_dir}:</b> {files_in_this_dir} <b>{lang_used_space}: </b> {used_space}</div> 
    3131</form> 
    3232<!-- END filemanager_footer --> 
     33 
  • trunk/phpgwapi/templates/default/css/azul.css

    r1513 r1556  
    5555/*      overflow: visible !important;*/ 
    5656        border: 1px #bbbbbb solid !important; 
     57} 
     58.dsused 
     59{ 
     60                background-image: url(../images/dsused.gif); 
    5761} 
    5862 
Note: See TracChangeset for help on using the changeset viewer.