Changeset 5327 for trunk/filemanager


Ignore:
Timestamp:
01/09/12 09:17:50 (12 years ago)
Author:
alexandrecorreia
Message:

Ticket #2260 - Sincronismo do módulo Filemanager para o trunk.

Location:
trunk/filemanager
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/filemanager/inc/after_upload.php

    r3610 r5327  
    2121include_once("../../header.inc.php"); 
    2222 
     23 
     24function convert_char( $String ) 
     25{ 
     26                $String = trim( str_replace( "\'", "", $String) ); 
     27                $String = str_replace( "'", "", $String ); 
     28                $String = str_replace( "ç", "c", $String ); 
     29                $String = str_replace( "Ç", "C", $String ); 
     30                $String = ereg_replace( "[áàâã]", "a", $String ); 
     31                $String = ereg_replace( "[ÁÀÂÃ]", "A", $String ); 
     32                $String = ereg_replace( "[éÚê]", "e", $String ); 
     33                $String = ereg_replace( "[ÉÈÊ]", "E", $String ); 
     34                $String = ereg_replace( "[íìîï]", "i", $String ); 
     35                $String = ereg_replace( "[ÍÌÎ]", "I", $String ); 
     36                $String = ereg_replace( "[óòÎõ]", "o", $String ); 
     37                $String = ereg_replace( "[ÓÒÔÕ]", "O", $String ); 
     38                $String = ereg_replace( "[úùû]", "u", $String ); 
     39                $String = ereg_replace( "[ÚÙÛ]", "U", $String ); 
     40                 
     41                return $String; 
     42} 
     43 
    2344$bo = CreateObject('filemanager.bofilemanager'); 
    2445 
    25 foreach ($files as $f) { 
    26                 if ($bo->vfs->cp(array( 
    27                         'from'=> $f['fullName'], 
    28                         'to'=> $f['name'], 
    29                         'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
    30                 ))) 
     46foreach ($files as $f) 
     47{ 
     48        $newName = convert_char( $f['name'] ); 
     49         
     50        $_array = array( 
     51                        'from'          => $f['fullName'], 
     52                        'to'            => $newName, 
     53                        'relatives'     => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 
     54        ); 
     55         
     56        if ( $bo->vfs->cp($_array) ) 
     57        { 
     58                $bo->vfs->set_attributes(array( 
     59                        'string'                => $newName, 
     60                        'relatives'             => array( RELATIVE_ALL ), 
     61                        'attributes'    => array( 'mime_type' => $f['mimetype'] ) 
     62                )); 
     63                 
     64                $fullName = $f['fullName']; 
     65                 
     66                if( file_exists($fullName) ) 
    3167                { 
    32                                 $bo->vfs->set_attributes(array( 
    33                                 'string'=> $f['name'], 
    34                                 'relatives'     => array(RELATIVE_ALL), 
    35                                 'attributes'=> array( 
    36                                 'mime_type' => $f['mimetype'] 
    37                                 ) 
    38                         )); 
    39                         exec("rm -f ".escapeshellcmd(escapeshellarg($f['fullName']))); 
     68                        exec("rm -f ".escapeshellcmd(escapeshellarg($fullName))); 
    4069                } 
     70        } 
    4171} 
    4272 
  • trunk/filemanager/inc/class.uifilemanager.inc.php

    r5323 r5327  
    568568                        else 
    569569                                $tuple['icon'] = $this->mime_icon($files['mime_type']); 
    570                         $tuple['type'] = $files['type']; 
    571                         $tuple['created'] = $this->vfs_functions->dateString2timeStamp($files['created']); 
    572                         $tuple['modified'] = $this->vfs_functions->dateString2timeStamp($files['modified']); 
    573                         $tuple['size'] = $files['size']; 
    574                         $tuple['mime_type'] = $files['mime_type']; 
    575                         $tuple['pub'] = $files['type']; 
    576                         $tuple['createdby_id'] = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']); 
     570 
     571                        $tuple['type']                  = $files['type']; 
     572                        $tuple['created']               = $this->vfs_functions->dateString2timeStamp($files['created']); 
     573                        $tuple['modified']              = ( $files['modified'] != "" ) ? $this->vfs_functions->dateString2timeStamp($files['modified']) : ""; 
     574                        $tuple['size']                  = $files['size']; 
     575                        $tuple['mime_type']             = $files['mime_type']; 
     576                        $tuple['pub']                   = $files['type']; 
     577                        $tuple['createdby_id']  = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']); 
    577578                        $tuple['modifiedby_id'] = $files['modifiedby_id'] ? $GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']) : ''; 
    578                         $tuple['owner'] = $GLOBALS['phpgw']->accounts->id2name($files['owner_id']); 
    579                         $tuple['comment'] = $files['comment']; 
    580                         $tuple['version'] = $files['version']; 
     579                        $tuple['owner']                 = $GLOBALS['phpgw']->accounts->id2name($files['owner_id']); 
     580                        $tuple['comment']               = $files['comment']; 
     581                        $tuple['version']               = $files['version']; 
     582                         
    581583                        $output[] = $tuple; 
    582584                } 
     
    610612                        $return[] = $dir['directory'] . $dir['name']; 
    611613                sort(&$return, SORT_STRING); 
     614 
    612615                echo serialize($return); 
    613616        } 
     
    753756        } 
    754757 
    755         function createdir() { 
     758        function createdir() 
     759        { 
    756760                if ($this->bo->badchar = $this->bo->bad_chars($this->filename, True, True)) { 
    757761                        echo lang('Error:') . $this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 
     
    772776                $fileinfo = $ls_array[0]; 
    773777 
    774                 if ($fileinfo['name']) { 
     778                if ($fileinfo['name']) 
     779                { 
    775780                        if ($fileinfo['mime_type'] != 'Directory') { 
    776781                                echo lang('Error:') . lang('%1 already exists as a file', $fileinfo['name']); 
     
    778783                                echo lang('Error:') . lang('Directory %1 already exists', $fileinfo['name']); 
    779784                        } 
    780                 } else { 
     785                } 
     786                else 
     787                { 
    781788                        $this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    782789 
    783                         if ($this->bo->vfs->mkdir(array('string' => $this->filename))) { 
    784                                 echo lang('Created directory %1', $this->disppath . '/' . $this->filename); 
    785                         } else { 
     790                        if ($this->bo->vfs->mkdir(array('string' => $this->filename))) 
     791                        { 
     792                                echo "True"; 
     793                                //echo lang('Created directory %1', $this->disppath . '/' . $this->filename); 
     794                        } 
     795                        else 
     796                        { 
    786797                                echo lang('Error:') . lang('Could not create %1', $this->disppath . '/' . $this->filename); 
    787798                        } 
    788799                } 
    789                 echo lang('Directory created'); 
     800                 
    790801        } 
    791802 
  • trunk/filemanager/inc/load_lang.php

    r3873 r5327  
    2525        } 
    2626         
    27         echo "var array_lang = new Array(); \n$script"; 
     27        echo "var array_lang = new Array();\n{$script}"; 
    2828         
    2929?> 
  • trunk/filemanager/inc/upload.php

    r3897 r5327  
    3333$path                                   = $_POST['path']; 
    3434$notifUser                              = $_POST['notifTo']; 
    35 $show_upload_boxes      = count($_FILES['upload_file']['name']); 
    36 $filesUpload                            = $_FILES['upload_file']; 
     35$show_upload_boxes              = count($_FILES['upload_file']['name']); 
     36$filesUpload                    = $_FILES['upload_file']; 
    3737 
    3838function create_summaryImage($file) 
     
    121121                { 
    122122                        $badchar = $bo->bad_chars( $_FILES['upload_file']['name'][$i], True, True ); 
    123                          
     123 
    124124                        if( $badchar ) 
    125125                        { 
     
    165165                                $bo->vfs->cp($tmp_arr); 
    166166                                $tmp_arr=array( 
    167                                                 'string'=> $_FILES['upload_file']['name'][$i], 
    168                                                 'relatives'     => array(RELATIVE_ALL), 
     167                                                'string'                => $_FILES['upload_file']['name'][$i], 
     168                                                'relatives'             => array(RELATIVE_ALL), 
    169169                                                'attributes'    => array( 
    170                                                         'owner_id' => $bo->userinfo['username'], 
    171                                                         'modifiedby_id' => $bo->userinfo['username'], 
    172                                                         'size' => $_FILES['upload_file']['size'][$i], 
    173                                                         'mime_type' => $_FILES['upload_file']['type'][$i], 
    174                                                         'deleteable' => 'Y', 
    175                                                         'comment' => stripslashes($_POST['upload_comment'][$i]) 
     170                                                'owner_id'              => $bo->userinfo['username'], 
     171                                                'modifiedby_id' => $bo->userinfo['username'], 
     172                                                'size'                  => $_FILES['upload_file']['size'][$i], 
     173                                                'mime_type'             => $_FILES['upload_file']['type'][$i], 
     174                                                'deleteable'    => 'Y', 
     175                                                'comment'               => stripslashes($_POST['upload_comment'][$i]) 
    176176                                        ) 
    177177                                ); 
     
    195195                                                        'relatives'     => array(RELATIVE_ALL), 
    196196                                                        'attributes'    => array( 
    197                                                                 'mime_type'     => $_FILES['upload_file']['type'][$i], 
    198                                                                 'comment'       => stripslashes($_POST['upload_comment'][$i]) 
     197                                                        'mime_type'     => $_FILES['upload_file']['type'][$i], 
     198                                                        'comment'       => stripslashes($_POST['upload_comment'][$i]) 
    199199                                                        ) 
    200200                                        )); 
     
    218218                        $bo->vfs->set_attributes(array( 
    219219                                        'string'                => $_FILES['upload_file']['name'][$i], 
    220                                         'relatives'     => array(RELATIVE_ALL), 
     220                                        'relatives'             => array(RELATIVE_ALL), 
    221221                                        'attributes'    => array( 
    222                                                                                 'mime_type'     => $_FILES['upload_file']['type'][$i], 
    223                                                                                 'comment'       => stripslashes($_POST['upload_comment'][$i]) 
     222                                        'mime_type'     => $_FILES['upload_file']['type'][$i], 
     223                                        'comment'       => stripslashes($_POST['upload_comment'][$i]) 
    224224                                        ) 
    225225                        )); 
  • trunk/filemanager/inc/uploadApp.php

    r3894 r5327  
    3434                                                        'maxFileSize'           => $maxFileSize, 
    3535                                                        'maxChunkSize'          => $maxChunkSize, 
    36                                                         'archive'                               => '../tp/juploader/wjhk.jupload.jar', 
    37                                                         'afterUploadURL'                => 'after_upload.php', 
     36                                                        'archive'                       => '../tp/juploader/wjhk.jupload.jar', 
     37                                                        'afterUploadURL'        => 'after_upload.php', 
    3838                                                        'sendMD5Sum'            => 'true', 
    39                                                         'showLogWindow' => 'false', 
    40                                                         'debugLevel'                    => 0  
     39                                                        'showLogWindow'         => 'false', 
     40                                                        'debugLevel'            => 0  
    4141                                                ); 
    4242 
    4343$classParameters = array( 
    44                                                         'demo_mode'     => false, 
     44                                                        'demo_mode'             => false, 
    4545                                                        'allow_subdirs' => true, 
    46                                                         'destdir'                       => '/tmp'  //Where to store the files on the webserver  
     46                                                        'destdir'               => '/tmp'  //Where to store the files on the webserver  
    4747                                                ); 
    4848 
  • trunk/filemanager/js/draw_api.js

    r5038 r5327  
    351351        var midnight = Date.parse(now.toDateString()); 
    352352        var dtString = ""; 
    353         if (preferences.created =='1') { 
    354                 var created = new Date(); 
    355                 created.setTime(file.created*1000); 
    356                 if (created.getTime() > midnight) 
    357                         if (created.getMinutes() < 10 ) 
    358                                 dtString = created.getHours()+":0"+created.getMinutes(); 
    359                         else 
    360                                 dtString = created.getHours()+":"+created.getMinutes(); 
    361                 else { 
    362                         dtString = (created.getDate() < 10) ? "0"+created.getDate()+"/" : created.getDate()+"/"; 
    363                         dtString += (created.getMonth() < 9) ? "0" : ""; 
    364                         dtString += (created.getMonth()+1)+"/"+created.getFullYear(); 
    365                 } 
    366                 retBuff += fl.td+dtString+'</td>'; 
    367         } 
    368         if (preferences.modified =='1'){ 
    369                 var modified = new Date(); 
    370                 modified.setTime(file.modified*1000); 
    371                 if (file.modified != "") 
    372                         if (modified.getTime() > midnight) 
    373                                 if (modified.getMinutes() < 10) 
    374                                         dtString = modified.getHours()+":0"+modified.getMinutes(); 
    375                                 else 
    376                                         dtString = modified.getHours()+":"+modified.getMinutes(); 
    377                         else { 
    378                                 dtString = (modified.getDate() < 10) ? "0"+modified.getDate()+"/" : modified.getDate()+"/"; 
    379                                 dtString += (modified.getMonth() < 9) ? "0" : ""; 
    380                                 dtString += (modified.getMonth()+1)+"/"+modified.getFullYear(); 
    381                         } 
    382                 else 
    383                         dtString = ""; 
    384                 retBuff += fl.td+dtString+'</td>'; 
     353         
     354        if (preferences.created =='1') 
     355        { 
     356                retBuff += fl.td+file.created+'</td>'; 
     357        } 
     358         
     359        if ( preferences.modified =='1' ) 
     360        { 
     361                retBuff += fl.td+file.modified+'</td>'; 
    385362        } 
    386363        if (preferences.owner =='1'){ 
     
    521498 
    522499} 
    523 toolbar.prototype.getCheckedFiles = function () { 
     500 
     501toolbar.prototype.getCheckedFiles = function() 
     502{ 
    524503        filesUrl = ""; 
    525504        var one_checked = false; 
    526         files=document.getElementsByName('fileman'); 
     505        var files = document.getElementsByName('fileman'); 
    527506        var j=0; 
     507         
    528508        for (i = 0; i <  files.length; i++) 
    529                 if (files[i].checked){ 
     509        {        
     510                if (files[i].checked) 
     511                { 
    530512                        one_checked = true; 
    531513                        filesUrl += "&fileman["+j+"]="+base64_encode(files[i].value); 
    532514                        j++; 
    533515                } 
     516        } 
     517         
    534518        if (!one_checked) 
    535519        { 
     
    537521                return; 
    538522        } 
     523         
    539524        return filesUrl; 
    540525} 
     
    905890        } 
    906891        menu.innerHTML = content; 
    907  
    908892        menu.style.visibility = 'visible'; 
    909893        clearTimeout(menuTimeout); 
  • trunk/filemanager/js/handler.js

    r3924 r5327  
    1212 
    1313                if (returnVal[0] == 'wpasswd') 
    14         { 
    15                 write_error(get_lang('Wrong password')); 
    16                 return; 
    17         } 
    18         else 
    19                 write_msg(get_lang('Your operation was successfully executed')); 
    20  
    21         toolbar.control('reload'); 
     14                { 
     15                        write_error(get_lang('Wrong password')); 
     16                        return; 
     17                } 
     18                else 
     19                        write_msg(get_lang('Your operation was successfully executed')); 
     20 
     21                toolbar.control('reload'); 
    2222        } 
    2323 
     
    7979        function draw_folders_list(data) 
    8080        { 
     81                var contentFolders = document.getElementById('content_folders'); 
     82                 
    8183                toolbar.control('reload'); 
    8284                folders_tree = new dFTree({name: 'main'}); 
    83  
    8485                folders = unserialize(data); 
    85  
     86                 
     87                contentFolders.innerHTML = ""; 
     88                 
    8689                var rootFold = new dNode({id:'root', caption: get_lang("Directories")}); 
     90                 
    8791                folders_tree.add(rootFold,'root'); 
    8892 
     
    118122                } 
    119123 
    120                 document.getElementById('content_folders').innerHTML = ""; 
    121  
    122                 folders_tree.draw(document.getElementById('content_folders')); 
     124                folders_tree.draw(contentFolders); 
    123125 
    124126                folders_tree.openTo(currentPath); 
    125127 
    126128                folders_tree.getNodeById(currentPath)._select(); 
     129 
    127130        } 
    128131 
     
    146149        function refreshDir(data)  
    147150        { 
    148                 cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list', handler.draw_folders_list); 
     151                if( data.toString() === "True" ) 
     152                { 
     153                        var _action = './index.php?menuaction=filemanager.uifilemanager.get_folders_list'; 
     154                         
     155                        cExecute_( _action , draw_folders_list ); 
     156                } 
     157                else 
     158                { 
     159                        write_msg( data ); 
     160                } 
    149161        } 
    150162 
     
    342354        handler.prototype.draw_folders_list     = draw_folders_list; 
    343355        handler.prototype.moveto                        = moveto; 
    344         handler.prototype.refreshDir                    = refreshDir; 
     356        handler.prototype.refreshDir            = refreshDir; 
    345357        handler.prototype.rename                        = rename; 
    346         handler.prototype.restricted                    = restricted; 
    347         handler.prototype.updateComment = updateComment; 
     358        handler.prototype.restricted            = restricted; 
     359        handler.prototype.updateComment         = updateComment; 
    348360        handler.prototype.upload                        = upload; 
    349361 
Note: See TracChangeset for help on using the changeset viewer.