phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] filemanager/inc class.uiaction_edit.inc.php, 1.9 clas


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc class.uiaction_edit.inc.php, 1.9 class.bofilemanager.inc.php, 1.20 class.uifilemanager.inc.php, 1.26
Date: Fri, 11 Feb 2005 01:29:00 +0100

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            class.uiaction_edit.inc.php lines: +3 -3
            class.bofilemanager.inc.php lines: +46 -55
            class.uifilemanager.inc.php lines: +30 -105

Log Message:
command line

====================================================
Index: filemanager/inc/class.uiaction_edit.inc.php
diff -u filemanager/inc/class.uiaction_edit.inc.php:1.8 
filemanager/inc/class.uiaction_edit.inc.php:1.9
--- filemanager/inc/class.uiaction_edit.inc.php:1.8     Fri Jan 28 00:19:03 2005
+++ filemanager/inc/class.uiaction_edit.inc.php Fri Feb 11 00:29:41 2005
@@ -62,7 +62,7 @@
                                'current_dir'   => $this->bofilemanager->path
                        );

-                       if (get_var('edited', array('GET', 'POST')))
+                       if (get_var('edited',array('GET', 'POST')))
                        {
                                $content = get_var('edit_file_content', 
array('GET', 'POST'));
                                if (get_magic_quotes_gpc()) //a thousand curses!
@@ -137,7 +137,7 @@
                        $output = array
                        (
                                'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
$this->bofilemanager->appname.'.uiaction_edit.edit',
-                                                                               
                                                                                
        'path' => $this->bofilemanager->path)),
+                                                                               
                                                                                
        'path' => urlencode($this->bofilemanager->path),'edit_file' => 
$edit_file)),
                                'filemanager_nav'       => $data,
                                'filemanager_edit'      => $vars
                        );

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.19 
filemanager/inc/class.bofilemanager.inc.php:1.20
--- filemanager/inc/class.bofilemanager.inc.php:1.19    Thu Feb 10 16:19:46 2005
+++ filemanager/inc/class.bofilemanager.inc.php Fri Feb 11 00:29:41 2005
@@ -14,11 +14,6 @@

        class bofilemanager
        {
-               var $public_functions = array
-               (
-                       'delete'        => True
-               );
-
                var $access_add = False;
                var $rootdir;
                var $fakebase;
@@ -34,11 +29,6 @@

                var $errors;

-               var $rename;
-               var $delete;
-               var $go;
-               var $copy;
-               var $move;
                var $download;
                var $createdir;
                var $createfile;
@@ -49,22 +39,19 @@
                var $changes = array();
                var $upload_comment = array();
                var $upload_file = array();
-               var $op;
                var $file;
-               var $help_name;
                var $path;
-               var $disppath;
+
                var $dispsep;
                var $sortby = 'name';
-               var $messages = array();
-               var $renamefiles;
-               var $comment_files = array();
+
                var $show_upload_boxes = 5;
                var $upload_boxes = array();
                var $memberships = array();
                var $now;
                var $matches;
                var $quota = 0;
+               var $command_line;

        //      var $debug = True;
                var $debug = False;
@@ -83,8 +70,6 @@
                                        'var'   when      'var'  is set
                                */

-                               'errors',
-                               'op',
                                'path',
                                'file',
                                'todir',
@@ -93,30 +78,13 @@
                                'upload_file',
                                'upload_comment',
                                'upload_name',
-                               'messages',
-                               'help_name',
-                               'renamefiles',
-                               'comment_files',
-                               'show_upload_boxes',
-                               'submit',
-                               'cancel',
-                               'rename',
                                'upload',
-                               'edit_comments',
-                               'apply_edit_comment',
-                               'apply_edit_name',
                                'changes',
-                               'delete',
-                               'edit',
-                               'go',
-                               'copy',
-                               'move',
                                'download',
-                               //'newfile',
                                'createfile',
-                               //'newdir',
                                'createdir',
-                               'params'
+                               'params',
+                               'command_line'
                        );

                        $c_to_decode = count($to_decode);
@@ -199,15 +167,8 @@
                                        $this->path = $this->homedir;
                                }
                        }
-                       $GLOBALS['phpgw']->vfs->cd(array(
-                               'relative' => False,
-                               'relatives'=>Array(RELATIVE_NONE)
-                               ));
-                       $GLOBALS['phpgw']->vfs->cd(array(
-                               'string' => $this->path,
-                               'relative' => False,
-                               'relatives' => Array(RELATIVE_NONE)
-                               ));
+                       $GLOBALS['phpgw']->vfs->cd(array('relative' => 
False,'relatives' => array(RELATIVE_NONE)));
+                       $GLOBALS['phpgw']->vfs->cd(array('string' => 
$this->path,'relative' => False,'relatives' => array(RELATIVE_NONE)));

                        $this->pwd = $GLOBALS['phpgw']->vfs->pwd();

@@ -220,8 +181,6 @@
                                $this->cwd = 
substr($this->pwd,strrpos($this->pwd,'/')+1);
                        }

-                       $this->disppath = $this->path;
-
                        /* This just prevents // in some cases */
                        if($this->path == '/')
                        {
@@ -248,7 +207,6 @@
                        {
                                echo '<b>Filemanager debug:</b><br>'
                                        . 'path: '.$this->path.'<br>'
-                                       . 'disppath: '.$this->disppath.'<br>'
                                        . 'cwd: '.$this->cwd.'<br>'
                                        . 'lesspath: '.$this->lesspath.'<br>'
                                        . 'fakebase: '.$this->fakebase.'<br>'
@@ -601,7 +559,7 @@
                        //_debug_array($this->changes);
                        while (list ($from, $to) = each ($this->changes))
                        {
-                               if ($badchar = $this->bad_chars ($to, True, 
True))
+                               if ($badchar = $this->bad_chars($to,True,True))
                                {
                                 $result[] = lang('file names cannot contain 
%1', $badchar);
                                }
@@ -981,10 +939,10 @@
                                'download' => 'Download the first selected file 
to your local computer. You can only download one file at a time. Directories 
cannot be downloaded, only files.',
                                'create_folder' => "Creates a directory (folder 
== directory).  The name of the directory is specified in the text box next to 
the Create Folder button.",
                                'create_file' => "Creates a file in the current 
directory.  The name of the file is specified in the text box next to the 
Create File button.  After clicking the Create File button you will be 
presented with the [edit|Edit] screen, where you may edit the file you just 
created.  If you do not with to make any changes to the file at this time, 
simply click the Save button and the file will be saved as an empty file.",
-                               'command_line' => "Enter a Unix-style command 
line here, which will be executed when the [execute|Execute] button is pressed. 
 If you don't know what this is, you probably should turn the option off in the 
Preferences.",
-                               'execute' => "Clicking the Execute button will 
execute the Unix-style [command_line|command line] specified in the text box 
above.  If you don't know what this is, you probably should turn the option off 
in the Preferences.",
-                               'update' => "Sync the database with the 
filesystem for the current directory.  This is useful if you use another 
interface to access the same files.  Any new files or directories in the 
current directory will be read in, and the attributes for the other files will 
be updated to reflect any changes to the filesystem.  Update is run 
automatically every few page loads (currently every 20 page loads as of this 
writing, but that may have changed by now).",
-                               'file_stats' => "Various statistics on the 
number and size of the files in the current directory.  In some situations, 
these reflect different statistics.  For example, when in / or the base 
directory.",
+                               'command_line' => 'Enter a Unix-style command 
line here, which will be executed when the [execute|Execute] button is pressed. 
If you do not know what this is, you probably should turn the option off in the 
Preferences.',
+                               'execute' => 'Clicking the Execute button will 
execute the Unix-style [command_line|command line] specified in the text box 
above. If you do not know what this is, you probably should turn the option off 
in the Preferences.',
+                               'update' => "Sync the database with the 
filesystem for the current directory. This is useful if you use another 
interface to access the same files.  Any new files or directories in the 
current directory will be read in, and the attributes for the other files will 
be updated to reflect any changes to the filesystem.  Update is run 
automatically every few page loads (currently every 20 page loads as of this 
writing, but that may have changed by now).",
+                               'file_stats' => 'Various statistics on the 
number and size of the files in the current directory. In some situations, 
these reflect different statistics. For example, when in / or the base 
directory.',
                                'upload_file' => 'The full path of the local 
file to upload. You can type it in or use the Browse.. button to select it. The 
file will be uploaded to the current directory. You cannot upload directories, 
only files.',
                                'upload_comment' => 'The inital comment to use 
for the newly uploaded file. Totally optional and completely arbitrary. You can 
[edit_comments|create or edit the comment] at any time in the future.',
                                'upload_files' => 'This will upload the files 
listed in the input boxes and store them in the current directory.',
@@ -1184,5 +1142,38 @@
                        }
                        return False;
                }
+
+               function f_execute()
+               {
+                       if ($this->params['execute'] && $this->command_line != 
'')
+                       {
+                               if ($command = 
$GLOBALS['phpgw']->vfs->command_line(array('command_line' => 
stripslashes($this->command_line))))
+                               {
+                                       $result[] = lang('Command sucessfully 
run');
+
+                                       if ($command != 1 && strlen ($command) 
> 0)
+                                       {
+                                               $resutl[] = $command;
+                                       }
+                               }
+                               else
+                               {
+                                       $result[] = lang('Error running 
command');
+                               }
+                       }
+                       return is_array($result)?$result:False;
+               }
+
+               function f_update()
+               {
+                       /* Update if they request it, or one out of 20 page 
loads */
+                       srand((double)microtime() * 1000000);
+                       if($this->params['update'] || rand(0,19) == 4)
+                       {
+                               $GLOBALS['phpgw']->vfs->update_real(array(
+                                       'string' => $this->bofilemanager->path,
+                                       'relatives' =>Array(RELATIVE_NONE)));
+                       }
+               }
        }
 ?>

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.25 
filemanager/inc/class.uifilemanager.inc.php:1.26
--- filemanager/inc/class.uifilemanager.inc.php:1.25    Thu Feb 10 16:19:46 2005
+++ filemanager/inc/class.uifilemanager.inc.php Fri Feb 11 00:29:41 2005
@@ -22,10 +22,7 @@
                        'action'                => True,
                        'history'               => True,
                        'view'                  => True,
-                       'view_file'             => True,
                        'edit'                  => True,
-                       'edit_comments' => True,
-                       'update'                => True,
                        'preferences'   => True,
                        'admin'                 => True
                );
@@ -76,7 +73,7 @@
                        $this->homedir                  = 
$this->bofilemanager->homedir;

                        $this->check_access();
-                       $this->update();
+                       $this->bofilemanager->f_update();
                }

                function check_access()
@@ -129,25 +126,6 @@
                                                echo 'DEBUG: ui.check_access: ' 
. $er ."\n";
                                        }
                                }
-                               
//$GLOBALS['phpgw']->xslttpl->add_file('widgets');
-                       }
-               }
-
-               function update()
-               {
-                       /* Update if they request it, or one out of 20 page 
loads */
-                       srand((double)microtime() * 1000000);
-                       if($this->bofilemanager->update || rand(0,19) == 4)
-                       {
-                               $GLOBALS['phpgw']->vfs->update_real(array(
-                                       'string' => $this->bofilemanager->path,
-                                       'relatives' =>Array(RELATIVE_NONE)
-                                       ));
-                       }
-                       if($this->bofilemanager->update)
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'filemanager.uifilemanager.index',
-                                                                               
                                                'path' => 
urlencode($this->bofilemanager->path)));
                        }
                }

@@ -156,7 +134,6 @@
                {
                        $params = get_var('params',array('POST','GET'));

-
                        //_debug_array($params);
                        if($_GET['show_upload_boxes'])
                        {
@@ -187,13 +164,11 @@
                                'apply_edit_comment',
                                'apply_edit_name',
                                'cancel',
-                               'upload'
-                       );
-
-                       $local_functions = array(
-                               'rename',
-                               'edit_comments'
+                               'upload',
+                               'execute',
+                               'update'
                        );
+
                        $bo_functions = array
                        (
                                'apply_edit_comment',
@@ -203,9 +178,10 @@
                                'move',
                                'newdir',
                                'newfile',
-                               'go',
                                'upload',
-                               'download'
+                               'download',
+                               'execute',
+                               'update'
                        );

                        $link_data = array
@@ -214,18 +190,11 @@
                                'path'                  => 
urlencode($this->bofilemanager->path)
                        );

-                       /*if (trim(strtolower($this->bofilemanager->cancel)) == 
strtolower(lang('cancel'))) {
-                               $this->cancel();
-                               exit();
-                       }
-                       If the action is a "uiaction" (ie it has its own 
seperate interface), this will run it
-                       $this->actions->dispatch($this);
-                       @reset($actions);*/
-
                        if(is_array($params))
                        {
                                foreach($params as $true => $action)
                                {
+                                       $action = 
$true=='execute'?$true:$action;
                                        if($action != '' && 
in_array($action,$functions))
                                        {
                                                switch($action)
@@ -270,7 +239,7 @@
                                                                        
if($action == 'newfile' && !is_array($msg))
                                                                        {
                                                                                
$link_data['menuaction']        = 
$this->bofilemanager->appname.'.uiaction_edit.edit';
-                                                                               
$link_data['file']                      = 
urlencode($this->bofilemanager->createfile);
+                                                                               
$link_data['edit_file']         = urlencode($this->bofilemanager->createfile);
                                                                        }
                                                                        
elseif(is_array($msg))
                                                                        {
@@ -484,60 +453,7 @@
                        }
                        return $var;
                }
-/*
-               function display_summary_info($numoffiles,$usedspace)
-               {
-
-                       $p->set_var($var);
-                       $p->parse('col_headers','column_headers_normal',True);
-
-                       $var['td_extras']       = ' align="right"';
-                       $var['column_header'] = '<b>'.lang('used 
space').'</b>:';
-                       $p->set_var($var);
-                       $p->parse('col_headers','column_headers_normal',True);

-                       $var['td_extras']       = ' align="left"';
-                       $var['column_header'] = 
$this->bofilemanager->borkb($usedspace);
-                       $p->set_var($var);
-                       $p->parse('col_headers','column_headers_normal',True);
-
-                       if($this_homedir)
-                       {
-                               $var['td_extras']       = ' align="right"';
-                               $var['column_header'] = '<b>'.lang('unused 
space').'</b>:';
-                               $p->set_var($var);
-                               
$p->parse('col_headers','column_headers_normal',True);
-
-                               $var['td_extras']       = ' align="left"';
-                               $var['column_header'] = 
$this->bofilemanager->borkb($this->bofilemanager->userinfo['hdspace'] - 
$usedspace);
-                               $p->set_var($var);
-                               
$p->parse('col_headers','column_headers_normal',True);
-                       }
-
-                       $p->parse('list','column_rows',True);
-                       $p->set_var('col_headers','');
-
-                       if($this_homedir)
-                       {
-                               $var['td_extras']       = ' 
colspan="'.($info_columns / 2).'" align="right" width="50%"';
-                               $var['column_header'] = '<b>'.lang('total 
files').'</b>:';
-                               $p->set_var($var);
-                               
$p->parse('col_headers','column_headers_normal',False);
-
-                               $var['td_extras']       = ' 
colspan="'.($info_columns / 2).'" align="left" width="50%"';
-                               $var['column_header'] = 
count($GLOBALS['phpgw']->vfs->ls(array(
-                                       'string' => $this->bofilemanager->path,
-                                       'relatives' => Array(RELATIVE_NONE)
-                                       )));
-                               $p->set_var($var);
-                               
$p->parse('col_headers','column_headers_normal',True);
-
-                               $p->parse('list','column_rows',True);
-                               $p->set_var('col_headers','');
-                       }
-                       return $p->fp('output','table');
-               }
-*/
                function display_uploads()
                {
                        
for($i=0;$i<$this->bofilemanager->show_upload_boxes;$i++)
@@ -592,7 +508,7 @@
                        $edit_comments = $_GET['edit_comments'];

                        $files_array = $this->bofilemanager->load_files();
-                       //_debug_array($this->bofilemanager->changes);
+                       //_debug_array($files_array);
                        $usage = 0;
                        $files_array = $this->dirs_first($files_array);

@@ -757,9 +673,8 @@
                                'img_refresh'   => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'reload'),
                                                                                
        'title' => lang('refresh'),
-                                                                               
        'link' => $GLOBALS['phpgw']->link('/index.php',Array(
-                                                                               
                        'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.update',
-                                                                               
                        'path'          => 
urlencode($this->bofilemanager->path))))),
+                                                                               
        'name'  => 'params[update]',
+                                                                               
        'value' => 'update')),
                                'help_refresh'  => array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('refresh')))
                                        /*'add_moz_sidebar' => array
                                        (
@@ -784,17 +699,28 @@

                                if($this->bofilemanager->path != 
$this->bofilemanager->fakebase && $this->bofilemanager->access_add)
                                {
+                                       
if($this->bofilemanager->settings['show_command_line'])
+                                       {
+                                               $data['command_line'] = 
array('widget' => array('type' => 'text',
+                                                                               
                                                'name' => 'command_line',
+                                                                               
                                                'maxlength' => '255',
+                                                                               
                                                'size' => '25'));
+                                               $data['execute'] = 
array('widget' => array('type' => 'submit',
+                                                                               
                                                'name' => 'params[execute]',
+                                                                               
                                                'value' => lang('execute')));
+                                               $data['help_command_line']      
= array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('command_line')));
+                                               $data['help_execute']           
= array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('execute')));
+                                       }
+
                                        $data['create_folder']  = 
array('widget' => array('type' => 'text',
                                                                                
                                                'name' => 'createdir',
                                                                                
                                                'maxlength' => '255',
-                                                                               
                                                'size' => '15'
-                                                                               
        ));
+                                                                               
                                                'size' => '15'));
                                        $data['img_create_folder']      = 
array('widget' => array('type' => 'image',
                                                                                
                                                        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'folder_new'),
                                                                                
                                                        'title' => lang('create 
folder'),
                                                                                
                                                        'name'  => 
'params[newdir]',
-                                                                               
                                                        'value' => 'newdir'
-                                                                               
                ));
+                                                                               
                                                        'value' => 'newdir'));
                                        $data['lang_create_folder']     = 
lang('create folder');
                                        $data['help_create_folder']     = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('create_folder')));
                                        $data['create_file']            = 
array('widget' => array('type' => 'text',
@@ -805,8 +731,7 @@
                                                                                
                                                        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'filenew'),
                                                                                
                                                        'title' => lang('create 
file'),
                                                                                
                                                        'name'  => 
'params[newfile]',
-                                                                               
                                                        'value' => 'newfile'
-                                                                               
                ));
+                                                                               
                                                        'value' => 'newfile'));
                                        $data['lang_create_file']       = 
lang('create file');
                                        $data['help_create_file']       = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('create_file')));







reply via email to

[Prev in Thread] Current Thread [Next in Thread]