Ignore:
Timestamp:
11/05/09 14:17:02 (14 years ago)
Author:
amuller
Message:

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

File:
1 edited

Legend:

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

    r1575 r1590  
    297297                        # Some hacks to set and display directory paths correctly 
    298298                        ### 
    299 /* 
    300                         if($this->goto || $this->goto_x) 
    301                         { 
    302                                 $this->path = $this->cdtodir; 
    303                         } 
    304  */ 
    305                         if(!$this->bo->vfs->acl_check(array( 
     299                        if(!($this->edit_x || $this->edit_save_x || $this->edit_save_done_x) && !$this->bo->vfs->acl_check(array( 
    306300                                'string' => $this->path, 
    307301                                'relatives' => array(RELATIVE_NONE), 
     
    765759                                                                        $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.export','file='.$files['name'].'&path='.$this->path); 
    766760                                                                        $image=$GLOBALS['phpgw']->common->image('filemanager','button_export'); 
    767                                                                         $col_data.='<a href="'.$link.'"><img alt="'.lang("export").'" src="'.$image.'"></a>'; 
     761                                                                        $col_data.='<a href="'.$link.'"><img alt="'.lang("export").'" title="'.lang("export").'" src="'.$image.'"></a>'; 
    768762                                                                } 
    769763                                                        } 
     
    13471341                                        $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang("File names cannot contain \\ or /"))); 
    13481342                                } 
    1349                                 elseif(!$this->bo->vfs->mv(array( 
     1343                                elseif($this->verifyLock($from,RELATIVE_ALL) && $this->bo->vfs->mv(array( 
    13501344                                        'from'  => $from, 
    13511345                                        'to'    => $to 
    13521346                                ))) 
    13531347                                { 
     1348                                        $this->messages[]=lang('Renamed %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to); 
     1349                                } 
     1350                                else 
     1351                                { 
    13541352                                        $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Could not rename %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to))); 
    1355                                 } 
    1356                                 else 
    1357                                 { 
    1358                                         $this->messages[]=lang('Renamed %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to); 
    13591353                                } 
    13601354                        } 
     
    14201414                                        { 
    14211415                                                $copied++; 
    1422                                                 $this->messages[] .= lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 
     1416                                                $this->messages[] = lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 
    14231417                                        } 
    14241418                                        else 
    14251419                                        { 
    1426                                                 $this->messages[] .= lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 
     1420                                                $this->messages[] = lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 
    14271421                                        } 
    14281422                                } 
     
    14911485                        } 
    14921486                } 
    1493  
     1487                function verifyLock($file,$relative){ 
     1488                        $ls_array = $this->bo->vfs->ls(array( 
     1489                                'string'        => $file, 
     1490                                'relatives'     => array($relative), 
     1491                                'checksubdirs'  => False, 
     1492                                'nofiles'       => True 
     1493                        )); 
     1494                        $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']); 
     1495                        if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']) // recently than last minute: someone is editing 
     1496                        { 
     1497                                $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang('This file is being edited right now by:').$GLOBALS['phpgw']->accounts->id2name($ls_array[0]['modifiedby_id']))); 
     1498                                return False; 
     1499 
     1500                        } 
     1501                        else 
     1502                                return True; 
     1503                } 
    14941504                function delete() 
    14951505                { 
     
    14981508                                foreach($this->fileman as $filename) 
    14991509                                { 
    1500                                         if($this->bo->vfs->delete(array('string' => $filename))) 
     1510                                        if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename))) 
    15011511                                        { 
    15021512                                                $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'<br/>'; 
     
    16391649                        if($this->file) 
    16401650                        { 
     1651                                if (! $this->verifyLock($this->path.'/'.$this->file,RELATIVE_NONE)){ 
     1652                                        echo $this->messages['0']; 
     1653                                        $GLOBALS['phpgw']->redirect('/index.php'); 
     1654 
     1655                                        //$GLOBALS['phpgw']->common->phpgw_exit(); 
     1656                                } 
    16411657                                $ls_array = $this->bo->vfs->ls(array( 
    16421658                                        'string'        => $this->path.'/'.$this->file, 
     
    16451661                                        'nofiles'       => True 
    16461662                                )); 
    1647                                 $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']); 
    1648                                 if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']) // recently than last minute: someone is editing 
    1649                                 { 
    1650                                         echo lang('This file is being edited right now by:').$GLOBALS['phpgw']->accounts->id2name($ls_array[0]['modifiedby_id']); 
    1651                                         return False; 
    1652                                          
    1653                                 } 
     1663 
    16541664                                $this->bo->vfs->touch(array( 
    16551665                                        'string'=> $this->path.'/'.$this->file, 
     
    17121722                                //die( $content); 
    17131723                                if($this->bo->vfs->write(array( 
    1714                                         'string'        => $this->edit_file, 
    1715                                         'relatives'     => array(RELATIVE_ALL), 
     1724                                        'string'        => $this->path.'/'.$this->edit_file, 
     1725                                        'relatives'     => array(RELATIVE_NONE), 
    17161726                                        'content'       => $content 
    17171727                                ))) 
Note: See TracChangeset for help on using the changeset viewer.