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

Ticket #597 - melhoria no modulo gerenciador de arquivos

File:
1 edited

Legend:

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

    r1648 r1654  
    6161                var $newfile_x; 
    6262                var $createfile_var; 
    63                 var $delete_x; 
    64                 var $renamefiles; 
    65                 var $rename_x; 
    6663                var $move_to_x; 
    6764//              var $copy_to; 
     
    8683                var $show_upload_boxes; 
    8784 
    88                 var $debug = false; 
    8985                var $now; 
    9086 
     
    123119                        $to_decode = array 
    124120                        ( 
    125                                 /* 
    126                                 Decode 
    127                                 'var'   when      'avar' == 'value' 
    128                                 or 
    129                                 'var'   when      'var'  is set 
    130                                 */ 
    131121                                'op'    => array('op' => ''), 
    132122                                'path'  => array('path' => ''), 
     123                                'filename' => array('filename' => ''), 
    133124                                'file'  => array('file' => ''), 
    134125                                'sortby'        => array('sortby' => ''), 
     
    333324                                ) 
    334325                        )); 
    335                         $this->fileman[0] = $filename; 
     326                        $this->filename = $filename; 
    336327                        $this->edit(); 
    337328 
     
    355346                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 
    356347                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 
     348                        echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/draw_api.js'></script>"; 
    357349                        include('load_lang.php'); 
    358350 
     
    524516                        } 
    525517 
    526                         if($this->debug) 
    527                         { 
    528                                 $this->debug_filemanager(); 
    529                         } 
    530  
    531518                        # main action switch 
    532519                        // FIXME this will become a switch 
     
    555542                                $this->moveTo(); 
    556543                        } 
    557                         elseif($this->renamefiles) 
    558                         { 
    559                                 $this->rename(); 
    560                         } 
    561544                        elseif($this->edit_cancel_x) 
    562545                        { 
     
    567550                        { 
    568551                                $this->edit(); 
    569                         } 
    570                         elseif($this->delete_x) 
    571                         { 
    572                                 $this->delete(); 
    573552                        } 
    574553                        else 
     
    607586                                $vars[usedSpace]='<input type="hidden" id="usedSpace" value="'.$usedSpace.'">'; 
    608587                                $vars[quotaSize]='<input type="hidden" id="quotaSize" value="'.($quota*1024*1024).'">'; 
    609                                 $vars[javascript]='<script src="filemanager/js/draw_api.js"></script> 
     588                                $vars[path]='<input type="hidden" id="currentPath" value="'.$this->path.'">'; 
     589                                $vars[css]='<script>initDrawApi();</script> 
    610590                                        <link rel="stylesheet" type="text/css" href="filemanager/templates/default/main.css">'; 
    611591                                $vars[toolbar0]=$this->toolbar('location'); 
     
    692672                                { 
    693673                                        $files = $this->files_array[$i]; 
    694  
    695                                         if($this->rename_x) 
    696                                         { 
    697                                                 unset($this_selected); 
    698                                                 unset($renamethis); 
    699  
    700                                                 for($j = 0; $j != $this->numoffiles; $j++) 
    701                                                 { 
    702                                                         if($this->fileman[$j] == $files['name']) 
    703                                                         { 
    704                                                                 $this_selected = 1; 
    705                                                                 break; 
    706                                                         } 
    707                                                 } 
    708  
    709                                                 if($this->rename_x && $this_selected) 
    710                                                 { 
    711                                                         $renamethis = 1; 
    712                                                 } 
    713                                         } 
     674                                         
    714675 
    715676                                        if(!$this->prefs['dotfiles'] && ereg("^\.", $files['name'])) 
     
    719680 
    720681                                        # Checkboxes 
    721                                         if(!$this->rename_x && $this->path != $this->bo->fakebase && $this->path != '/') 
    722                                         { 
    723                                                 $cbox='<input type="checkbox" class="checkbox" name="fileman['.$i.']" value="'.$files['name'].'">'; 
    724                                                 $this->t->set_var('actions',$cbox); 
    725                                         } 
    726                                         elseif($renamethis) 
    727                                         { 
    728                                                 $cbox=$this->html_form_input('hidden', 'fileman[' . base64_encode($files['name']) . ']', $files['name'], NULL, NULL, 'checked'); 
     682                                        if($this->path != $this->bo->fakebase && $this->path != '/') 
     683                                        { 
     684                                                $cbox='<input type="checkbox" name="fileman" value="'.$files['name'].'">'; 
    729685                                                $this->t->set_var('actions',$cbox); 
    730686                                        } 
     
    761717 
    762718                                        # File name and icon 
    763                                         if($renamethis) 
    764                                         { 
    765                                                 $col_data=$this->mime_icon($files['mime_type']); 
    766                                                 $col_data.='<input type="text" maxlength="255" name="renamefiles[' . $files['name'] . ']" value="'.$files['name'].'">'; 
     719                                        if($files['mime_type'] == 'Directory') 
     720                                        { 
     721                                                $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path.$this->dispsep.$files['name']); 
     722 
     723                                                $icon=$this->mime_icon($files['mime_type']); 
     724 
     725                                                $col_data='<a href="'.$link.'">'.$icon.'</a>&nbsp;'; 
     726                                                $col_data.='<a href="'.$link.'">'.$files['name'].'</a>&nbsp;'; 
    767727                                        } 
    768728                                        else 
    769729                                        { 
    770                                                 if($files['mime_type'] == 'Directory') 
     730 
     731                                                if($this->prefs['viewonserver'] && isset($this->bo->filesdir) && !$files['link_directory']) 
    771732                                                { 
    772                                                         $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path.$this->dispsep.$files['name']); 
    773  
    774                                                         $icon=$this->mime_icon($files['mime_type']); 
    775  
    776                                                         $col_data='<a href="'.$link.'">'.$icon.'</a>&nbsp;'; 
    777                                                         $col_data.='<a href="'.$link.'">'.$files['name'].'</a>&nbsp;'; 
     733                                                        #FIXME 
     734                                                        $clickview = $this->filesdir.$pwd.'/'.$files['name']; 
     735 
    778736                                                } 
    779737                                                else 
    780738                                                { 
    781  
    782                                                         if($this->prefs['viewonserver'] && isset($this->bo->filesdir) && !$files['link_directory']) 
    783                                                         { 
    784                                                                 #FIXME 
    785                                                                 $clickview = $this->filesdir.$pwd.'/'.$files['name']; 
    786  
    787                                                                 if($phpwh_debug) 
    788                                                                 { 
    789                                                                         echo 'Setting clickview = '.$clickview.'<br>'."\n"; 
    790                                                                         $this->html_link($clickview,'', '',$files['name'], 0, 1, 0, ''); 
    791                                                                 } 
    792                                                         } 
    793                                                         else 
    794                                                         { 
    795                                                                 $icon=$this->mime_icon($files['mime_type']); 
    796                                                                 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.view','file='.$files['name'].'&path='.$this->path); 
    797  
    798                                                                 $col_data='<a href="'.$link.'" target="'.$this->target.'">'.$icon.'</a>&nbsp;<a href="'.$link.'" target="'.$this->target.'">'.$files['name'].'</a>'; 
    799                                                         } 
     739                                                        $icon=$this->mime_icon($files['mime_type']); 
     740                                                        $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.view','file='.$files['name'].'&path='.$this->path); 
     741 
     742                                                        $col_data='<a href="'.$link.'" target="'.$this->target.'">'.$icon.'</a>&nbsp;'. 
     743                                                        '<a id="name_'.$files['name'].'" href="'.$link.'" target="'.$this->target.'">'.$files['name'].'</a>'; 
    800744                                                } 
    801745                                        } 
     746 
    802747 
    803748                                        $this->t->set_var('col_data',$col_data); 
     
    923868                                        $this->t->pparse('out','row'); 
    924869                                } 
    925  
    926                                 // when renaming render extra sumbmit button 
    927                                 if($this->rename_x) 
    928                                 { 
    929                                         $col_data='<br/><input type="submit" name="save_changes" value="'.lang('Save changes').'">'; 
    930                                         $this->t->set_var('col_data',$col_data); 
    931                                         $this->t->parse('columns','column'); 
    932                                         $this->t->set_var('row_tr_color',''); 
    933                                         $this->t->parse('rows','row'); 
    934                                         $this->t->pparse('out','row'); 
    935                                 } 
    936870                        } 
    937871 
     
    1036970                                )); 
    1037971 
    1038                                 if($phpwh_debug) 
    1039                                 { 
    1040                                         echo '# of files found in "'.$this->path.'" : '.count($ls_array).'<br>'."\n"; 
    1041                                 } 
    1042  
    1043972                                while(list($num, $file_array) = each($ls_array)) 
    1044973                                { 
    1045974                                        $this->numoffiles++; 
    1046975                                        $this->files_array[] = $file_array; 
    1047                                         if($phpwh_debug) 
    1048                                         { 
    1049                                                 echo 'Filename: '.$file_array['name'].'<br>'."\n"; 
    1050                                         } 
    1051976                                } 
    1052977                        } 
     
    10761001                                        { 
    10771002                                                $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath); 
    1078                                                 $toolbar.=$this->buttonImage($link,'up',lang('go up')); 
     1003                                                $toolbar.=$this->linkButton($link,'up',lang('go up')); 
    10791004                                        } 
    10801005 
     
    10831008                                        { 
    10841009                                                $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->bo->homedir); 
    1085                                                 $toolbar.=$this->buttonImage($link,'home',lang('go home')); 
     1010                                                $toolbar.=$this->linkButton($link,'home',lang('go home')); 
    10861011                                        } 
    10871012 
    10881013                                        // reload button with this url 
    10891014                                        $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path); 
    1090                                         $toolbar.=$this->buttonImage($link,'reload',lang('reload')); 
     1015                                        $toolbar.=$this->linkButton($link,'reload',lang('reload')); 
    10911016 
    10921017                                        $toolbar.='<td>'.lang('Location').':&nbsp;'; 
     
    11181043                                        if($this->path != '/' && $this->path != $this->bo->fakebase) 
    11191044                                        { 
    1120                                                 //$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 
    1121                                                 //$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 
    11221045                                                // create dir and file button 
    11231046                                                if($this->can_add) 
    11241047                                                { 
    1125                                                         //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>'; 
    1126                                                         //$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['phpgw']->common->image('filemanager','spacer').'" height="27" width="1"></td>'; 
    1127  
    11281048                                                        $toolbar.='<td><input type="hidden" id="newfile_or_dir" name="newfile_or_dir" value="" /></td>'; 
    11291049                                                        //TODO : create folder with problems 
     
    11321052                                                } 
    11331053 
    1134                                                 if(!$this->rename_x && $this->can_edit) 
     1054                                                if($this->can_edit) 
    11351055                                                { 
    11361056                                                        // edit text file button 
     
    11431063                                                } 
    11441064 
    1145                                                 if(!$this->rename_x && $this->can_delete) 
     1065                                                if($this->can_delete) 
    11461066                                                { 
    11471067                                                        $toolbar.=$this->inputImage('delete','delete',lang('Delete')); 
    11481068                                                } 
    11491069 
    1150                                                 /*if(!$this->rename_x && $this->can_edit &&  
    1151                                                 $_SESSION['phpgw_info']['user']['preferences']['filemanager']['comment'] == 1) 
    1152                                                 { 
    1153                                                         $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments')); 
    1154                                                 }*/ 
    1155  
    1156                                         } 
    1157  
    1158                                         //      $toolbar.='</tr></table>'; 
    1159                                         if(!$this->rename_x) 
    1160                                         { 
     1070                                        } 
     1071 
    11611072                                                // copy and move buttons 
    11621073                                                if($this->path != '/' && $this->path != $this->bo->fakebase) 
     
    11791090                                                        <tr>'.$toolbar3;*/ 
    11801091                                                } 
    1181                                         } 
    11821092                                        $toolbar.='</tr></table>'; 
    11831093 
     
    13121222                        } 
    13131223                } 
    1314                 # Handle Renaming Files and Directories 
    1315                 function rename() 
    1316                 { 
    1317                         while(list($from, $to) = each($this->renamefiles)) 
    1318                         { 
    1319                                 if($badchar = $this->bo->bad_chars($to, True, True)) 
    1320                                 { 
    1321                                         $this->messages[]=lang('Error:').$this->bo->html_encode(lang('File names cannot contain "%1"', $badchar), 1); 
    1322                                         continue; 
    1323                                 } 
    1324  
    1325                                 if(ereg("/", $to) || ereg("\\\\", $to)) 
    1326                                 { 
    1327                                         $this->messages[]=lang('Error:').lang("File names cannot contain \\ or /"); 
    1328                                 } 
    1329                                 elseif($this->vfs_functions->verifyLock($from,RELATIVE_CURRENT) && $this->bo->vfs->mv(array( 
    1330                                         'from'  => $this->disppath.'/'.$from, 
    1331                                         'to'    => $this->disppath.'/'.$to, 
    1332                                         'relatives' => array(RELATIVE_NONE,RELATIVE_NONE) 
    1333                                 ))) 
    1334                                 { 
    1335                                         $this->messages[]=lang('Renamed %1 to %2', $from, $to); 
    1336                                 } 
    1337                                 else 
    1338                                 { 
    1339                                         $this->messages[]= lang('Error:').lang('Could not rename %1 to %2', $from, $to); 
    1340                                 } 
    1341                         } 
    1342                         $this->readFilesInfo(); 
    1343                         $this->filelisting(); 
    1344                 } 
    1345  
    13461224                # Handle Moving Files and Directories 
    13471225                function moveTo() 
     
    14701348                        } 
    14711349                } 
    1472                 function delete() 
    1473                 { 
    1474                         if( is_array($this->fileman) && count($this->fileman) >= 1) 
    1475                         { 
    1476                                 foreach($this->fileman as $filename) 
    1477                                 { 
    1478                                         if($this->vfs_functions->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename))) 
    1479                                         { 
    1480                                                 $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'<br/>'; 
    1481                                         } 
    1482                                         else 
    1483                                         { 
    1484                                                 $this->messages[]=lang('Error:').lang('Could not delete %1', $this->disppath.'/'.$filename); 
    1485                                         } 
    1486                                 } 
    1487                         } 
    1488                         else 
    1489                         { 
    1490                                 // make this a javascript func for quicker respons 
    1491                                 $this->messages[]=lang('Error:').lang('Please select a file to delete.'); 
    1492                         } 
    1493                         $this->readFilesInfo(); 
    1494                         $this->filelisting(); 
    1495                 } 
    1496  
    1497                 function debug_filemanager() 
    1498                 { 
    1499                         error_reporting(8); 
    1500  
    1501                         echo "<b>Filemanager debug:</b><br> 
    1502                         path: {$this->path}<br> 
    1503                         disppath: {$this->disppath}<br> 
    1504                         cwd: {$this->cwd}<br> 
    1505                         lesspath: {$this->lesspath} 
    1506                         <p> 
    1507                         <b>eGroupware debug:</b><br> 
    1508                         real getabsolutepath: " . $this->bo->vfs->getabsolutepath(array('target' => False, 'mask' => False, 'fake' => False)) . "<br> 
    1509                         fake getabsolutepath: " . $this->bo->vfs->getabsolutepath(array('target' => False)) . "<br> 
    1510                         appsession: " . $GLOBALS['phpgw']->session->appsession('vfs','') . "<br> 
    1511                         pwd: " . $this->bo->vfs->pwd() . "<br>"; 
    1512  
    1513                         echo '<p></p>'; 
    1514                         var_dump($this); 
    1515                 } 
    1516  
    15171350                function showUploadboxes() 
    15181351                { 
     
    15461379                function createfile() 
    15471380                { 
    1548                         $this->createfile_var=$this->newfile_or_dir; 
    1549                         if($this->createfile_var) 
    1550                         { 
    1551                                 if($badchar = $this->bo->bad_chars($this->createfile_var, True, True)) 
     1381                        $this->filename=$this->newfile_or_dir; 
     1382                        if($this->filename) 
     1383                        { 
     1384                                if($badchar = $this->bo->bad_chars($this->filename, True, True)) 
    15521385                                { 
    15531386                                        $this->messages[] = lang('Error:').lang('File names cannot contain "%1"',$badchar); 
     
    15571390 
    15581391                                if($this->bo->vfs->file_exists(array( 
    1559                                         'string'=> $this->createfile_var, 
     1392                                        'string'=> $this->filename, 
    15601393                                        'relatives'     => array(RELATIVE_ALL) 
    15611394                                ))) 
    15621395                                { 
    1563                                         $this->messages[]= lang('Error:').lang('File %1 already exists. Please edit it or delete it first.', $this->createfile_var); 
     1396                                        $this->messages[]= lang('Error:').lang('File %1 already exists. Please edit it or delete it first.', $this->filename); 
    15641397                                        $this->fileListing(); 
    15651398                                } 
    15661399 
    15671400                                if($this->bo->vfs->touch(array( 
    1568                                         'string'        => $this->createfile_var, 
     1401                                        'string'        => $this->filename, 
    15691402                                        'relatives'     => array(RELATIVE_ALL) 
    15701403                                ))) 
    15711404                                { 
    1572                                         $this->fileman = array(); 
    1573                                         $this->fileman[0] = $this->createfile_var; 
    15741405                                        $this->edit = 1; 
    15751406                                        $this->numoffiles++; 
     
    15781409                                else 
    15791410                                { 
    1580                                         $this->messages[]= lang('Error:').lang('File %1 could not be created.', $this->createfile_var); 
     1411                                        $this->messages[]= lang('Error:').lang('File %1 could not be created.', $this->filename); 
    15811412                                        $this->fileListing(); 
    15821413                                } 
     
    15871418                function edit() 
    15881419                { 
    1589                         $files = array_keys($this->fileman); 
    1590                         $this->file = $this->fileman[$files[0]]; 
    1591                         if($this->file) 
    1592                         { 
    1593                                 if (! $this->vfs_functions->verifyLock($this->path.'/'.$this->file,RELATIVE_NONE)){ 
     1420                        if($this->filename) 
     1421                        { 
     1422                                if (! $this->vfs_functions->verifyLock($this->path.'/'.$this->filename,RELATIVE_NONE)){ 
    15941423                                        echo $this->messages['0']; 
    15951424                                        $GLOBALS['phpgw']->redirect('/index.php'); 
     
    15981427                                } 
    15991428                                $ls_array = $this->bo->vfs->ls(array( 
    1600                                         'string'        => $this->path.'/'.$this->file, 
     1429                                        'string'        => $this->path.'/'.$this->filename, 
    16011430                                        'relatives'     => array(RELATIVE_NONE), 
    16021431                                        'checksubdirs'  => False, 
     
    16041433                                )); 
    16051434                                $this->bo->vfs->touch(array( 
    1606                                         'string'=> $this->path.'/'.$this->file, 
     1435                                        'string'=> $this->path.'/'.$this->filename, 
    16071436                                        'relatives'     => array(RELATIVE_NONE) 
    16081437                                )); 
     
    16771506                        } 
    16781507 
    1679                         # Now we display the edit boxes and forms 
    1680                         for($j = 0; $j != $this->numoffiles; $j++) 
    1681                         { 
    1682                                 # If we're in preview or save mode, we only show the file 
    1683                                 # being previewed or saved 
    1684                                 if($this->edit_file &&($this->fileman[$j] != $this->edit_file)) 
    1685                                 { 
    1686                                         continue; 
    1687                                 } 
    1688  
    1689                                 if($this->fileman[$j] && $this->bo->vfs->file_exists(array( 
    1690                                         'string'        => $this->fileman[$j], 
    1691                                         'relatives'     => array(RELATIVE_ALL) 
    1692                                 ))) 
    1693                                 { 
    1694                                         if($this->edit_file) 
    1695                                         { 
    1696                                                 $content = stripslashes($this->edit_file_content); 
    1697                                         } 
    1698                                         else 
    1699                                         { 
    1700                                                 $content = $this->bo->vfs->read(array('string' => $this->fileman[$j])); 
    1701                                         } 
    1702  
    1703                                         $vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path); 
    1704                                         $vars[edit_file]=$this->fileman[$j]; 
    1705  
    1706                                         # We need to include all of the fileman entries for each file's form, 
    1707                                         # so we loop through again 
    1708                                         for($i = 0; $i != $this->numoffiles; $i++) 
    1709                                         { 
    1710                                                 if($this->fileman[$i]) $value='value="'.$this->fileman[$i].'"'; 
    1711                                                 $vars[filemans_hidden]='<input type="hidden" name="fileman['.$i.']" '.$value.' />'; 
    1712                                         } 
    1713  
    1714                                         $vars[file_content]=$content; 
    1715  
    1716                                         $vars[buttonPreview]=$this->inputImage('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode($this->fileman[$j], 1))); 
    1717                                         $vars[buttonSave]=$this->inputImage('edit_save','save',lang('Save %1', $this->bo->html_encode($this->fileman[$j], 1))); 
    1718                                         $vars[buttonDone]=$this->inputImage('edit_save_done','ok',lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->fileman[$j], 1))); 
    1719                                         $vars[buttonCancel]=$this->inputImage('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode($this->fileman[$j], 1))); 
    1720  
    1721                                          if ($mime_type == 'text/html'){ 
    1722                                                  $vars[fck_edit] = '<script type="text/javascript" src="filemanager/tp/ckeditor/ckeditor.js"></script> 
    1723                                                          <textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">'.$content.'</textarea> 
    1724                                                          <script type="text/javascript"> CKEDITOR.replace( \'edit_file_content\',{ 
    1725                                         removePlugins : \'elementspath\', 
    1726                                         skin : \'office2003\', 
    1727                                         toolbar : [["Source","Preview","-","Cut","Copy","Paste","-","Print", 
    1728                                         "Undo","Redo","-","Find","Replace","-","SelectAll" ], 
    1729                                         ["Table","HorizontalRule","Smiley","SpecialChar","PageBreak","-","Bold", 
    1730                                         "Italic","Underline","Strike","-","Subscript","Superscript", 
    1731                                         "NumberedList","BulletedList","-","Outdent","Indent","Blockquote", 
    1732                                         "JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock", 
    1733                                         "Link", "TextColor","BGColor","Maximize"], 
    1734                                         ["Styles","Format","Font","FontSize"]] 
    1735                                          });</script>'; 
    1736  
    1737                                         } 
    1738  
    1739  
    1740                                         $this->t->set_var($vars); 
    1741                                         $this->t->parse('rows','row'); 
    1742                                         $this->t->pparse('out','row'); 
    1743  
    1744                                 } 
    1745                         } 
     1508                        # If we're in preview or save mode, we only show the file 
     1509                        # being previewed or saved 
     1510                        if($this->edit_file &&($this->filename != $this->edit_file)) 
     1511                        { 
     1512                                continue; 
     1513                        } 
     1514 
     1515                        if($this->filename && $this->bo->vfs->file_exists(array( 
     1516                                'string'        => $this->filename, 
     1517                                'relatives'     => array(RELATIVE_ALL) 
     1518                        ))) 
     1519                        { 
     1520                                if($this->edit_file) 
     1521                                { 
     1522                                        $content = stripslashes($this->edit_file_content); 
     1523                                } 
     1524                                else 
     1525                                { 
     1526                                        $content = $this->bo->vfs->read(array('string' => $this->filename)); 
     1527                                } 
     1528                                $vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path); 
     1529                                $vars[edit_file]=$this->filename; 
     1530                                # We need to include all of the fileman entries for each file's form, 
     1531                                # so we loop through again 
     1532                                for($i = 0; $i != $this->numoffiles; $i++) 
     1533                                { 
     1534                                        if($this->filename) $value='value="'.$this->filename.'"'; 
     1535                                        $vars[filemans_hidden]='<input type="hidden" name="filename" '.$value.' />'; 
     1536                                } 
     1537                                $vars[file_content]=$content; 
     1538 
     1539                                $vars[buttonPreview]=$this->inputButton('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode($this->fileman[$j], 1))); 
     1540                                $vars[buttonSave]=$this->inputButton('edit_save','save',lang('Save %1', $this->bo->html_encode($this->filename, 1))); 
     1541                                $vars[buttonDone]=$this->inputButton('edit_save_done','ok',lang('Save %1, and go back to file listing ', $this->bo->html_encode($this->filename, 1))); 
     1542                                $vars[buttonCancel]=$this->inputButton('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode($this->filename, 1))); 
     1543 
     1544                                if ($mime_type == 'text/html'){ 
     1545                                        $vars[fck_edit] = '<script type="text/javascript" src="filemanager/tp/ckeditor/ckeditor.js"></script> 
     1546                                                <textarea cols="80" id="edit_file_content" name="edit_file_content" rows="10">'.$content.'</textarea> 
     1547                                                <script type="text/javascript"> CKEDITOR.replace( \'edit_file_content\',{ 
     1548removePlugins : \'elementspath\', 
     1549skin : \'office2003\', 
     1550toolbar : [["Source","Preview","-","Cut","Copy","Paste","-","Print", 
     1551"Undo","Redo","-","Find","Replace","-","SelectAll" ], 
     1552["Table","HorizontalRule","Smiley","SpecialChar","PageBreak","-","Bold", 
     1553"Italic","Underline","Strike","-","Subscript","Superscript", 
     1554"NumberedList","BulletedList","-","Outdent","Indent","Blockquote", 
     1555"JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock", 
     1556"Link", "TextColor","BGColor","Maximize"], 
     1557["Styles","Format","Font","FontSize"]] 
     1558                                });</script>'; 
     1559 
     1560                                } 
     1561 
     1562 
     1563                                $this->t->set_var($vars); 
     1564                                $this->t->parse('rows','row'); 
     1565                                $this->t->pparse('out','row'); 
     1566 
     1567                        } 
     1568 
    17461569                } 
    17471570 
     
    19711794                } 
    19721795 
    1973                 function buttonImage($link,$img='',$description='') 
     1796                function linkButton($link,$img='',$description='') 
    19741797                { 
    19751798                        $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img)); 
     
    19831806                } 
    19841807 
     1808                function inputButton($name,$img='',$description='') 
     1809                { 
     1810                        $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img)); 
     1811 
     1812                        if($img) 
     1813                        { 
     1814                                return '<td class="" align="center" valign="middle" height="28" width="70"> 
     1815                                <input title="'.$description.'" name="'.$name.'" type="image" alt="'.$name.'" src="'.$image.'" value="clicked" /><br><small>'.$description.'</small> 
     1816                                </td>'; 
     1817                        } 
     1818                } 
    19851819                function inputImage($name,$img='',$description='') 
    19861820                { 
     
    19901824                        { 
    19911825                                return '<td class="" align="center" valign="middle" height="28" width="70"> 
    1992                                 <input onClick="return formfmValidate(\''.$name.'\')" title="'.$description.'" name="'.$name.'" type="image" alt="'.$name.'" src="'.$image.'" value="clicked" /><br><small>'.$description.'</small> 
     1826                                <img onClick="toolbar_control(\''.$name.'\')" title="'.$description.'" name="'.$name.'" alt="'.$name.'" src="'.$image.'" /><br><small>'.$description.'</small> 
    19931827                                </td>'; 
    19941828                        } 
    19951829                } 
     1830 
     1831 
    19961832 
    19971833                function html_form_input($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1) 
Note: See TracChangeset for help on using the changeset viewer.