Ignore:
Timestamp:
12/10/09 15:26:19 (15 years ago)
Author:
amuller
Message:

Ticket #597 - Melhorias no modulo gerenciador de arquivos

Location:
sandbox/filemanager/inc
Files:
2 edited

Legend:

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

    r1791 r1804  
    3131                        'dir_ls' => True, 
    3232                        'search' => True, 
     33                        'showUploadboxes' => True, 
    3334                        'uploadModel'=>True 
    3435                ); 
     
    6970                var $edit_save_done_x; 
    7071                var $edit_cancel_x; 
    71                 var $upload_x; 
    7272 
    7373                // this ones must be checked thorougly; 
     
    7878                var $sortby; 
    7979                var $messages; 
    80                 var $show_upload_boxes; 
    8180 
    8281                var $now; 
     
    347346                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
    348347                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/draw_api.js'></script>"; 
     348                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/drag_area.js'></script>"; 
    349349                        include('load_lang.php'); 
    350350 
     
    412412                        } 
    413413 
    414                         # We determine if they're in their home directory or a group's directory, 
    415                         # and set the VFS working_id appropriately 
    416                         if((preg_match('+^'.$this->bo->fakebase.'\/(.*)(\/|$)+U', $this->path, $matches)) && $matches[1] != $this->bo->userinfo['account_lid']) //FIXME matches not defined 
    417  
    418                         { 
    419                                 $this->bo->vfs->working_id = $GLOBALS['phpgw']->accounts->name2id($matches[1]);//FIXME matches not defined 
    420  
    421                         } 
    422                         else 
    423                         { 
    424                                 $this->bo->vfs->working_id = $this->bo->userinfo['username']; 
    425                         } 
    426  
    427                         # Check available permissions for $this->path, so we can disable unusable operations in user interface 
    428                         $path = explode('/',$this->path); 
    429                         $owner_id = $this->bo->vfs->ownerOf($this->bo->fakebase,$path[2]); 
    430                         $user_id = $GLOBALS['phpgw_info']['user']['account_id']; 
    431                         if ($owner_id == $user_id) 
     414                        /*Check permission*/ 
     415                        if($this->bo->vfs->acl_check(array( 
     416                                'string' => $this->path, 
     417                                'relatives' => array(RELATIVE_NONE), 
     418                                'operation' => PHPGW_ACL_READ 
     419                        ))) 
    432420                        { 
    433421                                $this->can_read = True; 
    434                                 $this->can_add = True; 
    435                                 $this->can_edit = True; 
    436                                 $this->can_delete = True; 
    437                                 $this->can_private = True; 
    438                         }else 
    439                         { 
    440                                 $acl = CreateObject ('phpgwapi.acl', $owner_id); 
    441                                 $acl->account_id = $owner_id; 
    442                                 $acl->read_repository(); 
    443                                 $rights = $acl->get_rights($user_id); 
    444                                 $this->can_read = $rights & PHPGW_ACL_READ; 
    445                                 $this->can_add = $rights & PHPGW_ACL_ADD; 
    446                                 $this->can_edit = $rights & PHPGW_ACL_EDIT; 
    447                                 $this->can_delete = $rights & PHPGW_ACL_DELETE; 
    448                                 $this->can_private = $rights & PHPGW_ACL_PRIVATE; 
    449                         } 
    450          
     422                        } 
     423 
    451424                        # if is different path than home and no permission allowed 
    452425                        if($this->path != $this->bo->homedir && $this->path != $this->bo->fakebase && $this->path != '/' && !$this->can_read) 
     
    503476                        { 
    504477                                $this->createdir(); 
    505                         } 
    506                         elseif($this->upload_x || $this->show_upload_boxes) 
    507                         { 
    508                                 $this->showUploadboxes(); 
    509478                        } 
    510479                        elseif($this->copy_to_x) 
     
    907876                function showUploadboxes() 
    908877                { 
     878                        $GLOBALS['phpgw_info']['flags'] = array 
     879                                ( 
     880                                        'currentapp'    => 'filemanager', 
     881                                        'noheader'      => True, 
     882                                        'nonavbar' => True, 
     883                                        'nofooter'      => True, 
     884                                        'noappheader'   => True 
     885                                ); 
     886                        $GLOBALS['phpgw']->common->phpgw_header(); 
     887 
    909888                        $this->t->set_file(array('upload' => 'upload.tpl')); 
    910889                        $this->t->set_block('upload','upload_header','upload_header'); 
     
    912891                        $this->t->set_block('upload','upload_footer','upload_footer'); 
    913892 
    914                         if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 
     893                        if($this->path != '/' && $this->path != $this->bo->fakebase) 
    915894                        { 
    916895                                $vars[max_size]=lang('Note: Uploaded is limited to %1MB',($this->current_config['filemanager_Max_file_size'])); 
  • sandbox/filemanager/inc/upload.php

    r1745 r1804  
    3131        if ($return == 1) 
    3232        { 
    33                 $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Error:').lang('One of the files sent was considered infected'); 
     33                $_SESSION['response'] = serialize(array(0 => lang('Error:').lang('One of the files sent was considered infected'))); 
    3434                return; 
    3535        } 
     
    4141                if($badchar = $bo->bad_chars($_FILES['upload_file']['name'][$i], True, True)) 
    4242                { 
    43                         $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Error:').lang('File names cannot contain "%1"', $badchar); 
     43                        $return[] = lang('Error:').lang('File names cannot contain "%1"', $badchar); 
    4444                        continue; 
    4545                } 
     
    5959                        if($fileinfo['mime_type'] == 'Directory') 
    6060                        { 
    61                                 $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Error:').lang('Cannot replace %1 because it is a directory', $fileinfo['name']); 
     61                                $return[] = lang('Error:').lang('Cannot replace %1 because it is a directory', $fileinfo['name']); 
    6262                                continue; 
    6363                        } 
     
    6666                if ($_FILES['upload_file']['size'][$i] > ($upload_max_size*1024*1024)) 
    6767                { 
    68                         $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('The size of %1 has exceded the limit: %2', $_FILES['upload_file']['name'][$i], $upload_max_size); 
     68                        $return[] = lang('The size of %1 has exceded the limit: %2', $_FILES['upload_file']['name'][$i], $upload_max_size); 
    6969                        continue; 
    7070                } 
     
    9494                                ); 
    9595                                $bo->vfs->cp($tmp_arr); 
    96  
    97                                 $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Created new %1', $_FILES['upload_file']['name'][$i])."\n"; 
    9896                        } 
    9997                        else 
     
    114112                                )); 
    115113                                else{ 
    116                                         $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Error:').lang('Your quota has exceeded the limit'); 
     114                                        $return[] = lang('Error:').lang('Your quota has exceeded the limit'); 
    117115                                        return false; 
    118116                                } 
    119117 
    120                                  $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Created %1,%2', $_FILES['upload_file']['name'][$i], $bo->borkb($_FILES['upload_file']['size'][$i]))."\n"; 
    121118                        } 
    122119                } 
     
    137134                        )); 
    138135 
    139                          $_SESSION['phpgw_info']['filemanager']['user']['messages'][] = lang('Created %1,%2', $_FILES['upload_file']['name'][$i], $bo->borkb($file_size[$i]))."\n"; 
    140  
    141136                } 
    142137        } 
     138        if (count($return) > 0) 
     139                $_SESSION['response'] = serialize($return); 
     140        else 
     141                 $_SESSION['response'] = serialize( array( 0 => 'Ok' ) ); 
    143142?> 
Note: See TracChangeset for help on using the changeset viewer.