Changeset 1726


Ignore:
Timestamp:
12/01/09 10:54:27 (14 years ago)
Author:
amuller
Message:

Ticket #597 - Melhorias no módulos gerenciador de arquivos do expresso livre

Files:
1 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/.htaccess

    r1704 r1726  
    1 php_value post_max_size 1G 
    2 php_value upload_max_filesize 1G 
     1php_value post_max_size 1300M 
     2php_value upload_max_filesize 1300M 
  • sandbox/filemanager/inc/class.uiconfig.inc.php

    r1678 r1726  
    3232 
    3333                         $GLOBALS['phpgw']->common->phpgw_header(); 
     34                        include('load_lang.php'); 
    3435                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
    3536                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 
  • sandbox/filemanager/inc/class.uifilemanager.inc.php

    r1719 r1726  
    3131                        'dir_ls' => True, 
    3232                        'get_permissions' => True, 
     33                        'search' => True, 
    3334                        'uploadModel'=>True 
    3435                ); 
     
    5253                var $groups_applications; 
    5354 
    54                 //originally post_vars 
    55                 //              var $goto; 
    5655                var $current_config; 
    57                 var $goto_x; 
     56                var $dirs; 
    5857                var $to; 
    5958                var $changedir; // for switching dir. 
    6059                var $cdtodir; // for switching dir. 
    61 //              var $createdir; 
    6260                var $newfile_or_dir; 
    6361                var $newdir_x; 
     
    6563                var $createfile_var; 
    6664                var $move_to_x; 
    67 //              var $copy_to; 
    6865                var $copy_to_x; 
    6966                var $edit_x; 
     
    252249 
    253250                        } 
    254                          
    255251                } 
    256252                function fileModels() 
     
    407403                        } 
    408404 
    409                         # Get their readable groups to be used throughout the script 
    410                         $acl = array(); 
    411                         $groups = array(); 
    412                         $acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'],1,'filemanager'); 
    413                         if (is_array($acl)) 
    414                                 foreach($acl as $key => $value){ 
    415                                         $info = array(); 
    416                                         $info = $GLOBALS['phpgw']->accounts->get_account_data($value); 
    417                                         $groups[$key]['account_id'] = $value; 
    418                                         $groups[$key]['account_lid'] = $info[$value]['lid']; 
    419                                         $groups[$key]['account_name'] = $info[$value]['firstname']; 
    420                                         $groups[$key]['account_lastname'] = $info[$value]['lastname']; 
    421                                         $groups[$key]['account_fullname'] = $info[$value]['fullname']; 
    422                                 } 
    423                         $this->readable_groups = array(); 
    424                         while(list($num, $account) = each($groups)) 
    425                         { 
    426                                 if($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'],'operation' => PHPGW_ACL_READ))) 
    427                                 { 
    428                                         $this->readable_groups[$account['account_lid']] = Array('account_id' => $account['account_id'], 'account_name' => $account['account_lid']); 
    429                                 } 
    430                         } 
    431  
     405                        $this->update_groups();  
    432406                        $this->groups_applications = array(); 
    433407 
     
    692666 
    693667                                // selectbox for change/move/and copy to 
    694                                 $dirs=$this->all_other_directories_options(); 
    695                                 foreach($dirs as $elem) 
     668                                $this->dirs=$this->all_other_directories(); 
     669                                foreach($this->dirs as $elem) 
    696670                                        $vars[folders].='<br><span onclick="load(\''.$elem['directory'].$elem['name'].'\')" class="l" onmouseover="this.style.border=\'1px solid black\'" onmouseout="this.style.border=\'1px solid transparent\'">'.$elem['name'].'</span>'; 
    697671                                 
    698672 
    699                                 // copy and move buttons 
    700                                 //if($this->path != '/' && $this->path != $this->bo->fakebase){} 
    701  
    702                                 $dirs=$this->all_other_directories_options(); 
    703                                 foreach($dirs as $dir) 
     673                                $this->dirs=$this->all_other_directories(); 
     674                                foreach($this->dirs as $dir) 
    704675                                        if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE)))) 
    705676                                        { 
     
    10541025 
    10551026                                if(!in_array($mime_type,$editable)){ 
    1056                                         echo lang('Impossbile to edit this file'); 
    1057                                         return False; 
     1027                                        $this->messages[] = lang('Error:').lang('Impossible to edit this file'); 
     1028                                        $this->readFilesInfo(); 
     1029                                        $this->fileListing(); 
     1030                                        return; 
    10581031                                } 
    10591032                        } 
     
    11061079                                else 
    11071080                                { 
    1108                                         echo lang('Could not save %1', $this->path.'/'.$this->edit_file); 
    11091081                                        $this->messages[]=lang('Could not save %1', $this->path.'/'.$this->edit_file); 
    11101082                                } 
     
    12361208                        ))) 
    12371209                        { 
    1238                                 echo lang("You have no permission to access this file"); 
    1239                                 return false; 
     1210                                $this->messages[] = lang("You have no permission to access this file"); 
     1211                                header('Location:'.$this->encode_href('inc/index.php?menuaction=filemanager.uifilemanager.index','&path='.base64_encode($this->bo->homedir))); 
     1212 
     1213                                return; 
    12401214                        } 
    12411215                        if($this->file) //FIXME 
     
    12471221                                        'nofiles'       => True 
    12481222                                )); 
    1249                                 if ($ls_array[0]['size'] > 4194304){ 
    1250                                         header('Location:'.$this->encode_href('inc/download.php','file='.base64_encode($this->file).'&path='.base64_encode($this->path))); 
    1251                                         return; 
    1252                                 } 
    12531223                                if($ls_array[0]['mime_type']) 
    12541224                                { 
     
    12651235                                        /*Note: if you put application/octet-stream you force download */ 
    12661236                                        header('Content-type: ' . $mime_type); 
    1267                                         header('Content-disposition: filename="' . $this->file . '"');//FIXME 
     1237                                        header('Content-disposition: filename="' . addslashes($this->file) . '"'); 
    12681238                                        Header("Pragma: public"); 
    12691239                                } 
    12701240                                else 
    12711241                                { 
    1272                                         $GLOBALS['phpgw']->browser->content_header($this->file,$mime_type);//FIXME 
    1273                                 } 
    1274   
    1275  
    1276                                 echo $this->bo->vfs->read(array( 
    1277                                         'string'        => $this->path.'/'.$this->file,//FIXME 
    1278                                         'relatives'     => array(RELATIVE_NONE) 
    1279                                 )); 
     1242                                        $GLOBALS['phpgw']->browser->content_header($this->file,$mime_type,$ls_array[0]['size']); 
     1243                                } 
     1244                                $this->bo->vfs->print_content(array( 
     1245                                        'string' => $this->path.'/'.$this->file, 
     1246                                        'relatives' => array(RELATIVE_NONE) 
     1247                                ) 
     1248                        ); 
     1249 
    12801250                                $GLOBALS['phpgw']->common->phpgw_exit(); 
    12811251                        } 
     
    12991269                                $formats = array('text/html'); 
    13001270                                if(!in_array($mime_type,$formats)){ 
    1301                                         echo lang('Impossbile to export this file'); 
     1271                                        echo lang('Impossible to export this file'); 
    13021272                                        return False; 
    13031273                                } 
     
    13181288 
    13191289                //give back an array with all directories except current and dirs that are not accessable 
    1320                 function all_other_directories_options() 
     1290                function all_other_directories() 
    13211291                { 
    13221292                        # First we get the directories in their home directory 
     
    13821352                } 
    13831353 
     1354                function update_groups() 
     1355                { 
     1356                        # Get their readable groups to be used throughout the script 
     1357                        $acl = array(); 
     1358                        $groups = array(); 
     1359                        $acl = $GLOBALS['phpgw']->acl->get_ids_for_location($GLOBALS['phpgw_info']['user']['account_id'],1,'filemanager'); 
     1360                        if (is_array($acl)) 
     1361                                foreach($acl as $key => $value){ 
     1362                                        $info = array(); 
     1363                                        $info = $GLOBALS['phpgw']->accounts->get_account_data($value); 
     1364                                        $groups[$key]['account_id'] = $value; 
     1365                                        $groups[$key]['account_lid'] = $info[$value]['lid']; 
     1366                                        $groups[$key]['account_name'] = $info[$value]['firstname']; 
     1367                                        $groups[$key]['account_lastname'] = $info[$value]['lastname']; 
     1368                                        $groups[$key]['account_fullname'] = $info[$value]['fullname']; 
     1369                                } 
     1370                        $this->readable_groups = array(); 
     1371                        while(list($num, $account) = each($groups)) 
     1372                        { 
     1373                                if($this->bo->vfs->acl_check(array('owner_id' => $account['account_id'],'operation' => PHPGW_ACL_READ))) 
     1374                                { 
     1375                                        $this->readable_groups[$account['account_lid']] = Array('account_id' => $account['account_id'], 'account_name' => $account['account_lid']); 
     1376                                } 
     1377                        } 
     1378 
     1379                } 
     1380                function search() 
     1381                { 
     1382                        /* TODO this is a primitive search */ 
     1383                        $this->update_groups(); 
     1384                        $this->dirs = $this->all_other_directories(); 
     1385                        $path = $this->path; 
     1386                        if (strlen($this->text) > 3) 
     1387                        {                                                                 
     1388                                $this->text = strtoupper($this->text); 
     1389                                foreach($this->dirs as $elem) 
     1390                                { 
     1391                                        $this->path = $elem['directory'].$elem['name']; 
     1392                                        reset($this->files_array); 
     1393                                        $this->readFilesInfo(); 
     1394                                        for($i = 0; $i < count($this->files_array); $i++) 
     1395                                        { 
     1396                                                $comment = strtoupper($this->files_array[$i]['comment']); 
     1397                                                $name = strtoupper($this->files_array[$i]['name']); 
     1398                                                if (strstr($name,$this->text) || 
     1399                                                strstr($comment,$this->text) ) 
     1400                                                        $return[$this->files_array[$i]['directory'].$name] = $this->files_array[$i]; 
     1401                                        } 
     1402                                        if (count($return) > 50) 
     1403                                        { 
     1404                                                $return = array_slice($return,0,50); 
     1405                                                break; 
     1406                                        } 
     1407                                }        
     1408                        } 
     1409                        echo serialize(array_values($return)); 
     1410                } 
     1411 
    13841412                /* seek icon for mimetype else return an unknown icon */ 
    13851413                function mime_icon($mime_type, $size=16) 
  • sandbox/filemanager/js/common_functions.js

    r1719 r1726  
    383383 
    384384function EditColumns(param){ 
    385         if (param == 'close'){ 
     385        if (param == 'close') 
     386        { 
    386387                var menu = document.getElementById('menu_col_pref'); 
    387388                menu.parentNode.removeChild(menu); 
    388389                return; 
    389390        } 
    390         if(param == 'save'){ 
     391        if(param == 'save') 
     392        { 
    391393                var checkBoxes = document.getElementsByName('prefView'); 
    392394                var url=""; 
     
    424426                document.getElementById('divAppboxHeader').appendChild(menu); 
    425427} 
     428 
     429 
     430function searchFile(){ 
     431        var inputText = document.getElementById('em_message_search'); 
     432        if (inputText.value.length < 4) 
     433        { 
     434                alert(get_lang('Your search must have at least 4 characters')); 
     435                return; 
     436        } 
     437        cExecute('/index.php?menuaction=filemanager.uifilemanager.search&text='+inputText.value,drawSearch); 
     438} 
  • sandbox/filemanager/js/draw_api.js

    r1719 r1726  
    1111document.onmousemove = getPointer; 
    1212 
     13function close_window(){ 
     14        var menu =  document.getElementById('dwindow'); 
     15        menu.style.visibility = 'hidden' 
     16} 
     17function draw_window(htmlData){ 
     18        var menu =  document.getElementById('dwindow'); 
     19        buttonClose = '<input value="'+get_lang('close')+'" onclick="close_window()" type="button">'; 
     20        if (!menu){ 
     21                menu = document.createElement('DIV'); 
     22                menu.id = "dwindow"; 
     23                menu.style.left = DocX - 500; 
     24                menu.style.width = "auto"; 
     25                menu.style.top = DocY; 
     26                menu.className = 'menubox'; 
     27                menu.style.zIndex='1'; 
     28                menu.innerHTML = htmlData+buttonClose; 
     29                document.getElementById('divAppboxHeader').appendChild(menu); 
     30        } 
     31        else{ 
     32                menu.innerHTML = htmlData+buttonClose; 
     33                menu.style.visibility = 'visible'; 
     34        } 
     35 
     36} 
    1337 
    1438function draw_menu(id,elements){ 
     
    125149                        return parseInt(size/gbyte).toFixed(1) + 'GB'; 
    126150} 
     151function drawSearch(data){ 
     152        var fmFileWindow = document.getElementById('fmFileWindow'); 
     153        var files = unserialize(data); 
     154        if (files == null) 
     155        { 
     156                alert(get_lang('No results found')); 
     157                return 
     158        } 
     159        var toolbar = document.getElementById('fmMenu'); 
     160        toolbar.innerHTML = ""; 
     161        fmFileWindow.innerHTML = ""; 
     162        var newpage; 
     163        var td_hd = '<td style="padding-left: 2px; padding-right: 2px;" valign="middle">'; 
     164        var sp_hd = '<span name="head" style="cursor: pointer; cursor: hand;"'; 
     165        var sp_tl = '</span></td>'; 
     166        newpage = '<table cellspacing="0" cellpadding="2"><tbody><tr class="message_header">'; 
     167        newpage += td_hd+'<input onclick="selectAll(this)" type="checkbox"></td><td></td><td></td>'; 
     168        newpage += td_hd+sp_hd+' id="name">'+get_lang('file name')+sp_tl; 
     169        newpage += td_hd+sp_hd+' id="folder">'+get_lang('folder')+sp_tl; 
     170        if (preferences.mime_type =='1') 
     171                newpage += td_hd+sp_hd+' id="mime">'+get_lang('mime type')+sp_tl; 
     172        if (preferences.size =='1') 
     173                newpage += td_hd+sp_hd+' id="size">'+get_lang('size')+'</a>'+sp_tl; 
     174        if (preferences.created =='1') 
     175                newpage += td_hd+sp_hd+' id="created">'+get_lang('created')+'</a>'+sp_tl; 
     176        if (preferences.modified =='1') 
     177                newpage += td_hd+sp_hd+' id="modified">'+get_lang('modified')+'</a>'+sp_tl; 
     178        if (preferences.createdby_id =='1') 
     179                newpage += td_hd+sp_hd+' id="creatdby">'+get_lang('created by')+'</a>'+sp_tl; 
     180        if (preferences.modifiedby_id =='1') 
     181                newpage += td_hd+sp_hd+' id="modifdby">'+get_lang('modified by')+'</a>'+sp_tl; 
     182        if (preferences.comment =='1') 
     183                newpage += td_hd+sp_hd+' id="comm">'+get_lang('comment')+'</a>'+sp_tl; 
     184        if (preferences.version =='1') newpage += td_hd+sp_hd+' id="vers">'+get_lang('version')+'</a>'+sp_tl+'</tr>'; 
     185         
     186        var classTr = "tr_msg_read"; 
     187        for (var i=0; i < files.length; i++) 
     188        { 
     189                newpage += '<tr class="'+classTr+'">'+td_hd; 
     190                newpage += '<input name="fileman" value="'+files[i].name+'" type="checkbox"></td>'; 
     191                newpage += '<td></td><td></td>'; 
     192                newpage += td_hd+'<img src="'+templatePath+'images/mime16_unknown.png">'; 
     193                newpage += '<a id="name_'+files[i].name+'" href="/index.php?menuaction=filemanager.uifilemanager.view&file='+base64_encode(files[i].name)+'&path='+base64_encode(files[i].directory)+'" target="_blank">'+files[i].name+'</a>&nbsp;</td>'; 
     194                newpage += td_hd+files[i].directory+'</td>'; 
     195                if (preferences.mime_type =='1') newpage += td_hd+files[i].mime_type+'</td>'; 
     196                if (preferences.size =='1') newpage += td_hd+borkb(files[i].size)+'</td>'; 
     197                if (preferences.created =='1') newpage += td_hd+files[i].created+'</td>'; 
     198                if (preferences.modified =='1') newpage += td_hd+files[i].modified+'</td>'; 
     199                if (preferences.createdby_id =='1') newpage += td_hd+files[i].createdby_id+'</td>'; 
     200                if (preferences.modifiedby_id =='1') newpage += td_hd+files[i].modifiedby_id+'</td>'; 
     201                if (files[i].comment == null || files[i].comment.length == 0) 
     202                        files[i].comment = "&lt;"+get_lang("no comments")+"&gt;"; 
     203                if (preferences.comment =='1') newpage += td_hd+'<span id="'+files[i].name+'">'+files[i].comment+'</span></td>'; 
     204                if (preferences.version =='1') newpage += td_hd+'<span>'+files[i].version+'</span></td></tr>'; 
     205                classTr = (classTr == "tr_msg_read"?"tr_msg_read2":"tr_msg_read"); 
     206 
     207        } 
     208        fmFileWindow.innerHTML = newpage; 
     209} 
     210 
    127211 
    128212function drawFiles(data){ 
     
    184268                if (preferences.comment =='1') newpage += td_hd+'<span id="'+files[i].name+'" onclick="setComments(this)">'+files[i].comm+'</span></td>'; 
    185269                if (preferences.version =='1') newpage += td_hd+'<span onclick="loadHistory(\''+files[i].name+'\')">'+files[i].vers+'</span></td></tr>'; 
    186                 // /index.php?menuaction=filemanager.uifilemanager.history&amp;file=MDAxMC5lbWw%253D&amp;path=L2hvbWUvem9yZWlh  
    187270                classTr = (classTr == "tr_msg_read"?"tr_msg_read2":"tr_msg_read"); 
    188271 
     
    227310} 
    228311 
     312function loadHistory(filename){ 
     313        cExecute('/index.php?menuaction=filemanager.uifilemanager.history&file='+base64_encode(filename)+"&path="+base64_encode(currentPath),draw_window); 
     314} 
     315 
    229316function loadPermissions(data){ 
    230317        var permission = parseInt(data); 
  • sandbox/filemanager/setup/phpgw_pt-br.lang

    r1719 r1726  
    2525create folder   filemanager     pt-br   Criar Pasta 
    2626new     filemanager     pt-br   novo 
     27close   filemanager     pt-br   Fechar 
    2728created filemanager     pt-br   Criado 
    2829created %1      filemanager     pt-br   Criado %1 
     
    148149Cards   filemanager     pt-br   Cartões 
    149150Resume  filemanager     pt-br   Currículo 
    150 Impossbile to edit this file    filemanager     pt-br   Impossível editar o arquivo selecionado 
     151Impossible to edit this file    filemanager     pt-br   Impossível editar o arquivo selecionado 
    151152Enter with the name of new file/directory       filemanager     pt-br   Insira o nome do novo arquivo/diretório 
    152153File extension forbidden or invalid file        filemanager     pt-br   Formato de arquivo inválido 
  • sandbox/filemanager/templates/default/main.css

    r1719 r1726  
    6060.toolButton{ 
    6161        padding:0 3px; 
     62        font-size: 13px; 
     63        font-weight: bold; 
     64 
    6265} 
    6366#fmFileWindow 
  • sandbox/filemanager/templates/default/main.tpl

    r1719 r1726  
    1414                        <div id="search_div" align="left" style="white-space:nowrap"> 
    1515                        <input type="text" id="em_message_search" size="16" maxlength="22" /> 
    16                         <img style="vertical-align: bottom;" src="./filemanager/templates/default/images/search.gif"> 
     16                        <img style="vertical-align: bottom;" onclick="searchFile();" src="./filemanager/templates/default/images/search.gif"> 
    1717                        </div> 
    1818                        <table border="0" cellspacing="0" cellpadding="0" border="0" style="width:100%"> 
  • trunk/phpgwapi/inc/class.vfs_sql.inc.php

    r1704 r1726  
    821821                                return False; 
    822822                        } 
    823  
    824                         $conf = CreateObject('phpgwapi.config', 'phpgwapi'); 
    825                         $conf->read_repository(); 
    826                         if ($this->file_actions || $p->outside) 
    827                         { 
    828823                                if ($fp = fopen ($p->real_full_path, 'rb')) 
    829824                                { 
     
    832827                                                echo fread($fp, $i); 
    833828                                                flush(); 
     829                                                ob_clean(); 
    834830                                        } 
    835831                                        fclose ($fp); 
     
    839835                                        return False; 
    840836                                } 
    841                         } 
    842837                        return True; 
    843838                } 
Note: See TracChangeset for help on using the changeset viewer.