Changeset 4915 for branches/2.2


Ignore:
Timestamp:
08/09/11 17:14:05 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #2199 - Corrigido bug para criar e mover arquivos dentro do filemanager

Location:
branches/2.2/filemanager
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/after_upload.php

    r3610 r4915  
    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 
  • branches/2.2/filemanager/inc/class.uifilemanager.inc.php

    r4228 r4915  
    582582                $return['files'] = $output; 
    583583                $return['quota']['quotaSize'] = ($quota * 1024 * 1024); 
     584                //echo serialize(htmlspecialchars_decode(htmlentities($return))); 
    584585                echo serialize($return); 
    585586        } 
     
    609610                        $return[] = $dir['directory'] . $dir['name']; 
    610611                sort(&$return, SORT_STRING); 
     612 
    611613                echo serialize($return); 
    612614        } 
     
    752754        } 
    753755 
    754         function createdir() { 
     756        function createdir() 
     757        { 
    755758                if ($this->bo->badchar = $this->bo->bad_chars($this->filename, True, True)) { 
    756759                        echo lang('Error:') . $this->bo->html_encode(lang('Directory names cannot contain "%1"', $badchar), 1); 
     
    771774                $fileinfo = $ls_array[0]; 
    772775 
    773                 if ($fileinfo['name']) { 
     776                if ($fileinfo['name']) 
     777                { 
    774778                        if ($fileinfo['mime_type'] != 'Directory') { 
    775779                                echo lang('Error:') . lang('%1 already exists as a file', $fileinfo['name']); 
     
    777781                                echo lang('Error:') . lang('Directory %1 already exists', $fileinfo['name']); 
    778782                        } 
    779                 } else { 
     783                } 
     784                else 
     785                { 
    780786                        $this->bo->vfs->cd(array('string' => $this->path, 'relatives' => array(RELATIVE_NONE), 'relative' => False)); 
    781787 
    782                         if ($this->bo->vfs->mkdir(array('string' => $this->filename))) { 
    783                                 echo lang('Created directory %1', $this->disppath . '/' . $this->filename); 
    784                         } else { 
     788                        if ($this->bo->vfs->mkdir(array('string' => $this->filename))) 
     789                        { 
     790                                echo "True"; 
     791                                //echo lang('Created directory %1', $this->disppath . '/' . $this->filename); 
     792                        } 
     793                        else 
     794                        { 
    785795                                echo lang('Error:') . lang('Could not create %1', $this->disppath . '/' . $this->filename); 
    786796                        } 
    787797                } 
    788                 echo lang('Directory created'); 
     798                 
    789799        } 
    790800 
  • branches/2.2/filemanager/inc/load_lang.php

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

    r3897 r4915  
    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                                ); 
     
    191191                                ))) 
    192192                                { 
    193                                         $bo->vfs->set_attributes(array( 
     193                                $bo->vfs->set_attributes(array( 
    194194                                                        'string'                => $_FILES['upload_file']['name'][$i], 
    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                        )); 
  • branches/2.2/filemanager/inc/uploadApp.php

    r3894 r4915  
    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 
  • branches/2.2/filemanager/js/drag_area.js

    r3436 r4915  
    1919 
    2020counter = 0; 
    21 DragArea.prototype.dragObj = function(e){ 
     21DragArea.prototype.dragObj = function(e) 
     22{ 
    2223        var _event  = is_ie ? window.event : e; 
    2324        var _target = is_ie ? _event.srcElement : _event.target; 
  • branches/2.2/filemanager/js/draw_api.js

    r3936 r4915  
    410410                var contentQuota = document.getElementById('content_quota'); 
    411411                if (contentQuota != null) 
    412                         contentQuota.innerHTML = '<table width="102" cellspacing="0" cellpadding="0" border="0" id="table_quota"><tbody><tr><td width="102" nowrap="true" height="15" background="../phpgwapi/templates/default/images/dsunused.gif"><table cellspacing="0" cellpadding="0" border="0" style="width: '+parseInt((usedSpace/quotaSize)*100)+'%;"><tbody><tr><td height="15" class="dsused"/></tr></tbody></table></td><td nowrap="true" align="center"><span class="boxHeaderText">'+parseInt(usedSpace/quotaSize*100)+'% ('+borkb(usedSpace)+'/'+borkb(quotaSize)+')</span></td></tr></tbody></table></td></tr></table>'; 
     412                        contentQuota.innerHTML = '<table width="102" cellspacing="0" cellpadding="0" border="0" id="table_quota"><tbody><tr><td width="102" nowrap="true" height="15" background="./phpgwapi/templates/default/images/dsunused.gif"><table cellspacing="0" cellpadding="0" border="0" style="width: '+parseInt((usedSpace/quotaSize)*100)+'%;"><tbody><tr><td height="15" class="dsused"/></tr></tbody></table></td><td nowrap="true" align="center"><span class="boxHeaderText">'+parseInt(usedSpace/quotaSize*100)+'% ('+borkb(usedSpace)+'/'+borkb(quotaSize)+')</span></td></tr></tbody></table></td></tr></table>'; 
    413413        } 
    414414} 
     
    820820                                 
    821821                        var parentDir_en = base64_encode( parentDir ); 
    822                         cExecute_('./index.php?menuaction=filemanager.uifilemanager.createdir&path=' 
    823                                 + parentDir_en+'&filename='+base64_encode(name), handler.refreshDir); 
     822                        var _action = './index.php?menuaction=filemanager.uifilemanager.createdir&path='+ parentDir_en+'&filename='+base64_encode(name);         
     823                         
     824                        cExecute_( _action , handler.refreshDir ); 
    824825                                 
    825826                        currentPath = parentDir + '/' + name; 
     
    836837                                        Dfolder.replace(my_home_filemanager, get_lang("My folder"))), '') ) 
    837838                                        { 
     839                                         
    838840                                        var Dfolder_en = base64_encode( Dfolder ); 
    839                                          
    840                                         cExecute_('./index.php?menuaction=filemanager.uifilemanager.removedir&path=' + Dfolder_en ,handler.refreshDir ); 
     841                                        var _action = './index.php?menuaction=filemanager.uifilemanager.removedir&path=' + Dfolder_en;  
     842                                        cExecute_( _action , handler.refreshDir ); 
    841843                                        var lastIndex = Dfolder.lastIndexOf('/'); 
    842844                                        currentPath = Dfolder.substr(0,lastIndex); 
     
    871873                        { 
    872874                                'lang_new_folder'               : get_lang('new folder'), 
    873                                 'lang_remove_folder'            : get_lang('remove folder'), 
     875                                'lang_remove_folder'    : get_lang('remove folder'), 
    874876                                'path_filemanager'              : path_filemanager, 
    875                                 'onclick_new_folder'            : 'editFolders("new")', 
     877                                'onclick_new_folder'    : 'editFolders("new")', 
    876878                                'onclick_remove_folder' : 'editFolders("remove")' 
    877879                        }; 
  • branches/2.2/filemanager/js/handler.js

    r3924 r4915  
    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 
    129132        function moveto(data)  
    130133        { 
    131                 returnVal = data.split('|'); 
     134                var returnVal = data.split('|'); 
     135                 
    132136                if (returnVal[0] == 'NODIR') 
     137                { 
    133138                        write_error(get_lang('Could not copy file because no destination directory is given')); 
    134                 else if(returnVal[0] == 'SOMEERROR'){ 
    135                         write_error(get_lang('Could not move %1 file(s)',returnVal[1])); 
    136                 } 
    137                 else  if(returnVal[0] == 'MOVED'){ 
    138                         if (returnVal[1] == 1) 
    139                                 write_msg(get_lang('File moved successfuly')); 
    140                         else 
    141                                 write_msg(get_lang('%1 files moved successfuly', returnVal[1])); 
    142                 } 
    143                 handler.refreshDir(); 
     139                }        
     140                else if( returnVal[0] == 'SOMEERROR' ) 
     141                { 
     142                        write_error( get_lang('Could not move %1 file(s)',returnVal[1]) ); 
     143                } 
     144                else  if( returnVal[0] == 'MOVED') 
     145                { 
     146                        if ( returnVal[1] == 1 ) 
     147                        {        
     148                                write_msg( get_lang('File moved successfuly') ); 
     149                                toolbar.control('reload'); 
     150                        } 
     151                        else 
     152                        { 
     153                                write_msg( get_lang('%1 files moved successfuly', returnVal[1]) ); 
     154                        } 
     155                } 
    144156        } 
    145157 
    146158        function refreshDir(data)  
    147159        { 
    148                 cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list', handler.draw_folders_list); 
     160                if( data.toString() === "True" ) 
     161                { 
     162                        var _action = './index.php?menuaction=filemanager.uifilemanager.get_folders_list'; 
     163                         
     164                        cExecute_( _action , draw_folders_list ); 
     165                } 
     166                else 
     167                { 
     168                        write_msg( data ); 
     169                } 
    149170        } 
    150171 
     
    342363        handler.prototype.draw_folders_list     = draw_folders_list; 
    343364        handler.prototype.moveto                        = moveto; 
    344         handler.prototype.refreshDir                    = refreshDir; 
     365        handler.prototype.refreshDir            = refreshDir; 
    345366        handler.prototype.rename                        = rename; 
    346         handler.prototype.restricted                    = restricted; 
    347         handler.prototype.updateComment = updateComment; 
     367        handler.prototype.restricted            = restricted; 
     368        handler.prototype.updateComment         = updateComment; 
    348369        handler.prototype.upload                        = upload; 
    349370 
  • branches/2.2/filemanager/js/main.js

    r3019 r4915  
    1  
    2  
Note: See TracChangeset for help on using the changeset viewer.