phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] filemanager/inc class.uifilemanager.inc.php, 1.22 cla


From: ceb
Subject: [Phpgroupware-cvs] filemanager/inc class.uifilemanager.inc.php, 1.22 class.uiaction_edit.inc.php, 1.8 class.bofilemanager.inc.php, 1.16
Date: Thu, 24 Feb 2005 15:08:59 -0000

Update of filemanager/inc

Modified Files:
     Branch: MAIN
            class.uifilemanager.inc.php lines: +102 -120
            class.uiaction_edit.inc.php lines: +63 -82
            class.bofilemanager.inc.php lines: +34 -11

Log Message:
update

====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.21 
filemanager/inc/class.uifilemanager.inc.php:1.22
--- filemanager/inc/class.uifilemanager.inc.php:1.21    Thu Jan 27 13:24:02 2005
+++ filemanager/inc/class.uifilemanager.inc.php Fri Jan 28 00:19:03 2005
@@ -157,12 +157,6 @@
                function action()
                {
                        $params = get_var('params',array('POST','GET'));
-                       //echo 'createdir: ' . $_POST['createdir'];
-                       //echo 'newdir: ' . $_POST['params']['newdir'];
-                       //echo 'createfile: ' . $_POST['createfile'];
-                       //echo 'newfile: ' . $_POST['params']['newfile'];
-
-                       //_debug_array($params);

                        if($_GET['show_upload_boxes'])
                        {
@@ -174,12 +168,10 @@

                        if (UI_DEBUG)
                        {
-                               echo " Debug mode <br>";
-                               echo "function : 
".$this->bofilemanager->$function;
-                               print_r($_POST);
-                               die();
-
+                               echo 'uifilemanager -> Debug mode <br />';
+                               _debug_array($_POST);
                        }
+
                        /*$actions = Array(
                                'rename'        => lang('rename'),
                                'delete'        => lang('delete'),
@@ -196,12 +188,13 @@
                                'cancel'        => lang('cancel'),
                                'upload'  => lang('upload files')
                        );
-
+
                        $local_functions = array(
                                'rename',
                                'edit_comments'
                        );*/
-                       $bo_functions = array(
+                       $functions = array
+                       (
                                'apply_edit_comment',
                                'apply_edit_name',
                                'copy',
@@ -211,14 +204,21 @@
                                'newfile',
                                'go',
                                'upload',
-                               'download'
+                               'download',
+                               'edit'
+                       );
+
+                       $link_data = array
+                       (
+                               'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                               'path'                  => 
urlencode($this->bofilemanager->path)
                        );

-                       if (trim(strtolower($this->bofilemanager->cancel)) == 
strtolower(lang('cancel'))) {
+                       /*if (trim(strtolower($this->bofilemanager->cancel)) == 
strtolower(lang('cancel'))) {
                                $this->cancel();
-                               exit();
+                               exit();
                        }
-                       /*If the action is a "uiaction" (ie it has its own 
seperate interface), this will run it
+                       If the action is a "uiaction" (ie it has its own 
seperate interface), this will run it
                        $this->actions->dispatch($this);
                        @reset($actions);*/

@@ -226,19 +226,28 @@
                        {
                                foreach($params as $true => $action)
                                {
-                                       if(in_array($action,$bo_functions))
+                                       if(in_array($action,$functions))
                                        {
-                                               //echo " bofunction $function ";
-                                               $f_function = 'f_'.$action;
-                                               $error = 
$this->bofilemanager->$f_function();
-
-                                               if($function == 'newfile')
-                                               {
-                                                       
$link_data['createfile'] = urlencode($this->bofilemanager->createfile);
-                                               }
-                                               elseif(is_array($error))
+                                               switch($action)
                                                {
-                                                       $var['errors'] = 
implode("\n",$error);
+                                                       case 'edit':
+                                                               
$link_data['menuaction'] = $this->bofilemanager->appname.'.uiaction_edit.edit';
+                                                               break;
+                                                       default:
+                                                               //echo ' 
bofunction: f_' . $action;
+                                                               $f_function = 
'f_'.$action;
+                                                               $error = 
$this->bofilemanager->$f_function();
+
+                                                               if($action == 
'newfile' && !is_array($error))
+                                                               {
+                                                                       
$link_data['menuaction']        = 
$this->bofilemanager->appname.'.uiaction_edit.edit';
+                                                                       
$link_data['file']                      = 
urlencode($this->bofilemanager->createfile);
+                                                               }
+                                                               
elseif(is_array($error))
+                                                               {
+                                                                       
$var['errors'] = implode("\n",$error);
+                                                               }
+                                                               break;
                                                }
                                        }
                                        else
@@ -247,12 +256,6 @@
                                        }
                                }
                        }
-
-                       $link_data = array
-                       (
-                               'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                               'path'                  => 
urlencode($this->bofilemanager->path)
-                       );
                        
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                }

@@ -630,45 +633,31 @@
                                                                                
$file_icon = ( $this->mime_ico[$mime_parts[0]]) ?  
$this->mime_ico[$mime_parts[0]] :  $this->mime_ico['unknown'];
                                                                                
if (strpos($file['name'],'.exe') !== false) $file_icon =  
$this->mime_ico['exe'];
                                                                        }
-
-                                                                       
$file_output[$i]['name']['icon'] = array(
-                                                                               
                'widget' => array( 'type' => 'image',
-                                                                               
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,$file_icon)
-                                                                               
                        ));
-
+                                                                       
$file_output[$i]['name']['icon'] = array('widget' => array( 'type' => 'image',
+                                                                               
                                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,$file_icon)));
                                                                        if 
($file['mime_type']=='Directory')
                                                                        {
-                                                                               
$href = array('menuaction'      => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                                               
                        'path'          => $this->bofilemanager->path . 
$this->bofilemanager->dispsep . $file['name']
-                                                                               
                        );
+                                                                               
$href = array('menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                                                                               
                                                'path' => 
$this->bofilemanager->path . $this->bofilemanager->dispsep . $file['name']);
                                                                        }
                                                                        else
                                                                        {
                                                                                
$href = Array( 'menuaction'     => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.view',
-                                                                               
                                        'path'          => 
urlencode($this->bofilemanager->path),
-                                                                               
                                        'file'          => 
urlencode($file['name'])
-                                                                               
                                );
-
+                                                                               
                                        'path' => 
urlencode($this->bofilemanager->path),'file' => urlencode($file['name']));
                                                                        }
-                                                                       
$file_output[$i]['name']['link'] = array(
-                                                                               
                "widget"=> array(
-                                                                               
                                'type' => 'link',
-                                                                               
                                'caption' => $file['name'],
-                                                                               
                                'href' =>  
$GLOBALS['phpgw']->link('/index.php', $href)
-                                                                               
                ));
-                                                                       if 
($mime_parts[0] == 'text')
+                                                                       
$file_output[$i]['name']['link'] = array('widget' => array('type' => 
'link','caption' => $file['name'],
+                                                                               
                                                                        'href' 
=> $GLOBALS['phpgw']->link('/index.php', $href)));
+                                                                       
if($mime_parts[0] == 'text')
                                                                        {
-                                                                               
                $href['menuaction'] = 
$this->bofilemanager->appname.'.uiaction_edit.edit';
-                                                                               
                //$href['uiaction'] = 'edit';
-                                                                               
                $file_output[$i]['name']['edit'] = array('widget' => array( 
'type' => 'image',
-                                                                               
                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
-                                                                               
                                'link' =>  
$GLOBALS['phpgw']->link('/index.php', $href)
-                                                                               
                                ));
+                                                                               
$href['menuaction']     = $this->bofilemanager->appname.'.uiaction_edit.edit';
+                                                                               
$href['edit_file']      = urlencode($file['name']);
+                                                                               
$file_output[$i]['name']['edit'] = array('widget' => array( 'type' => 'image',
+                                                                               
                                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
+                                                                               
                                                'link' =>  
$GLOBALS['phpgw']->link('/index.php', $href)));
                                                                        }
                                                                        break;
                                                                default:
                                                                        
$file_output[$i][$internal] = $file[$internal];
-
                                                        }
                                                }
                                        }
@@ -707,28 +696,13 @@
                                'img_dir'       => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,($this->bofilemanager->homestr?'folder_home':'folder')),
                                                                                
        'title' => lang('current directory'))),
-                               'img_upload'    => array('widget' => 
array('type' => 'image',
-                                                                               
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'1uparrow'),
-                                                                               
        'title' => lang('upload files'),
-                                                                               
        'name'  => 'params[upload]',
-                                                                               
        'value' => 'upload')),
-                               'help_upload_files'     => array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_files'))),
-                               'lang_upload'   => lang('upload'),
                                '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))))),
-                               'help_refresh'  => array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('refresh'))),
-                               'img_dl'        => array('widget' => 
array('type' => 'image',
-                                                                               
                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'bottom'),
-                                                                               
                                'title' => lang('download files'),
-                                                                               
                                'link' => 
$GLOBALS['phpgw']->link('/index.php',Array(
-                                                                               
                                                        'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-                                                                               
                                                        'path' => 
urlencode($this->bofilemanager->homedir))))),
-                               'help_dl'       => array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('download'))),
-                               'lang_dl'       => lang('download')
+                               'help_refresh'  => array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('refresh')))
                                        /*'add_moz_sidebar' => array
                                        (
                                                'url'                   => 
$GLOBALS['phpgw']->link('/index.php',array(
@@ -750,34 +724,73 @@
                                                                                
                        'path'          => 
urlencode($this->bofilemanager->lesspath)))));
                                $data['help_up'] = array('widget' => 
array('type' => 'help','onClick' => $this->bofilemanager->build_help('up')));

-                               if($this->bofilemanager->path != 
$this->bofilemanager->fakebase)
+                               if($this->bofilemanager->path != 
$this->bofilemanager->fakebase && $this->bofilemanager->access_add)
                                {
-                               $data['create_folder']  = array('widget' => 
array('type' => 'text',
+                                       $data['create_folder']  = 
array('widget' => array('type' => 'text',
                                                                                
                                                'name' => 'createdir',
                                                                                
                                                'maxlength' => '255',
                                                                                
                                                'size' => '15'
                                                                                
        ));
-                               $data['img_create_folder']      = 
array('widget' => array('type' => 'image',
+                                       $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'
                                                                                
                ));
-                               $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',
+                                       $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',
                                                                                
                                                'name' => 'createfile',
                                                                                
                                                'maxlength' => '255',
-                                                                               
                                                'size' => '15'
-                                                                               
        ));
-                               $data['img_create_file']        = 
array('widget' => array('type' => 'image',
+                                                                               
                                                'size' => '15'));
+                                       $data['img_create_file']        = 
array('widget' => array('type' => 'image',
                                                                                
                                                        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'filenew'),
                                                                                
                                                        'title' => lang('create 
file'),
                                                                                
                                                        'name'  => 
'params[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')));
+                                       $data['lang_create_file']       = 
lang('create file');
+                                       $data['help_create_file']       = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('create_file')));
+
+                                       $data['lang_show']                      
                = lang('show');
+                                       $data['lang_upload_fields']             
        = lang('upload fields');
+                                       $data['help_upload_file']               
        = array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_file')));
+                                       $data['lang_file']                      
                = lang('file');
+                                       $data['lang_comment']                   
        = lang('comment');
+                                       $data['help_upload_comment']            
= array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_comment')));
+                                       $data['help_show_upload_fields']        
= array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('show_upload_fields')));
+
+                                       
foreach($this->bofilemanager->upload_boxes as $box)
+                                       {
+                                               $data['show_upload_boxes'][] = 
array('widget' => array('type' => 'link','caption' => $box,
+                                                                               
                                                                        'href' 
=> $GLOBALS['phpgw']->link('/index.php',array(
+                                                                               
                                                                                
'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action',
+                                                                               
                                                                                
'show_upload_boxes' => $box))));
+                                       }
+                                       $data['uploads']                = 
$this->display_uploads();
+                                       $data['img_upload']     = 
array('widget' => array('type' => 'image',
+                                                                               
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'1uparrow'),
+                                                                               
        'title' => lang('upload files'),
+                                                                               
        'name'  => 'params[upload]',
+                                                                               
        'value' => 'upload'));
+                                       $data['help_upload_files']      = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_files')));
+                                       $data['lang_upload']    = 
lang('upload');
+
+                                       $js             = 
"document.getElementById('file_menu').selectedIndex>5?(document.getElementById('menu_todir').disabled=false):document.getElementById('form_files').submit()";
+                                       $js_dir = 
"document.getElementById('form_files').submit()";
+
+                                       $data['menu']                   = 
array('widget' => array('type' => 'select','name' => 'params[menu]', 'id' => 
'file_menu','onChange' => $js,'options' => $this->display_buttons('menu')));
+                                       $data['help_menu']              = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('menu')));
+                                       $data['dir_menu']               = 
array('widget' => array('type' => 'select','name' => 'todir', 'id' => 
'menu_todir','onChange' => $js_dir,'disabled' => True,'options' => 
$this->display_buttons('dir_menu')));
+                                       $data['help_dir_list']  = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('dir_list')));
+                                       $data['img_dl'] = array('widget' => 
array('type' => 'image',
+                                                                               
                                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'bottom'),
+                                                                               
                                'title' => lang('download files'),
+                                                                               
                                'link' => 
$GLOBALS['phpgw']->link('/index.php',Array(
+                                                                               
                                                        'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                                                                               
                                                        'path' => 
urlencode($this->bofilemanager->homedir)))));
+                                       $data['help_dl']        = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('download')));
+                                       $data['lang_dl']        = 
lang('download');
                                }
                        }

@@ -818,37 +831,6 @@
                                                                        'value' 
=> 1
                                                ));
                        }
-
-                       @reset($this->bofilemanager->file_attributes);
-                       //$data['settings'] = $this->bofilemanager->settings;
-                       //$data['display_settings'] = 
$GLOBALS['phpgw_info']['theme'];
-
-                       $js             = 
"document.getElementById('file_menu').selectedIndex>5?(document.getElementById('menu_todir').disabled=false):document.getElementById('form_files').submit()";
-                       $js_dir = 
"document.getElementById('form_files').submit()";
-
-                       if(!count($edit))
-                       {
-                               $data['menu']                   = 
array('widget' => array('type' => 'select','name' => 'params[menu]', 'id' => 
'file_menu','onChange' => $js,'options' => $this->display_buttons('menu')));
-                               $data['help_menu']              = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('menu')));
-                               $data['dir_menu']               = 
array('widget' => array('type' => 'select','name' => 'todir', 'id' => 
'menu_todir','onChange' => $js_dir,'disabled' => True,'options' => 
$this->display_buttons('dir_menu')));
-                               $data['help_dir_list']  = array('widget' => 
array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('dir_list')));
-                               $data['uploads']                = 
$this->display_uploads();
-                       }
-                       $data['lang_show']                                      
= lang('show');
-                       $data['lang_upload_fields']                     = 
lang('upload fields');
-                       $data['help_upload_file']                       = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_file')));
-                       $data['lang_file']                                      
= lang('file');
-                       $data['lang_comment']                           = 
lang('comment');
-                       $data['help_upload_comment']            = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('upload_comment')));
-                       $data['help_show_upload_fields']        = 
array('widget' => array('type' => 'help','onClick' => 
$this->bofilemanager->build_help('show_upload_fields')));
-
-                       foreach($this->bofilemanager->upload_boxes as $box)
-                       {
-                               $data['show_upload_boxes'][] = array('widget' 
=> array('type' => 'link','caption' => $box,
-                                                                               
                                                                        'href' 
=> $GLOBALS['phpgw']->link('/index.php',array(
-                                                                               
                                                                                
'menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action',
-                                                                               
                                                                                
'show_upload_boxes' => $box))));
-                       }
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('index' => $data));
                }


====================================================
Index: filemanager/inc/class.uiaction_edit.inc.php
diff -u filemanager/inc/class.uiaction_edit.inc.php:1.7 
filemanager/inc/class.uiaction_edit.inc.php:1.8
--- filemanager/inc/class.uiaction_edit.inc.php:1.7     Thu Jan 27 01:55:40 2005
+++ filemanager/inc/class.uiaction_edit.inc.php Fri Jan 28 00:19:03 2005
@@ -26,23 +26,25 @@
                        $GLOBALS['phpgw']->xslttpl->add_file('edit');
                }

-               function edit($parent = 0,$param = false)
+               function edit()
                {
-                       //$this->bofilemanager = &$parent->bofilemanager;
-                       if (UIEDIT_DEBUG) echo ' action::edit ';
-                       $edit_file = get_var('file', array('GET', 'POST'));
+                       $edit_file = get_var('edit_file',array('GET','POST'));
+
                        if (!strlen($edit_file))
-                       {
+                       {
                                $edit_file = $this->bofilemanager->fileman[0];
-                       }
-/*                     $GLOBALS['phpgw']->vfs->cd(array(
-                               'string' => $this->bofilemanager->path,
-                               'relatives' => array(RELATIVE_NONE)
-                               ));
-
-       //              echo "path ".$GLOBALS['phpgw']->vfs->pwd()." Editing: 
".$edit_file;
-*/
-                       $data = Array(
+                       }
+
+                       //_debug_array($this->bofilemanager->fileman);
+
+                       if($_POST['cancel'])
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+                                                                               
                                                        'path' => 
urlencode($this->bofilemanager->path)));
+                       }
+
+                       $data = array
+                       (
                                'img_up'        => array('widget' => 
array('type' => 'image',
                                                                                
        'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'up'),
                                                                                
        'title' => lang('up'),
@@ -57,84 +59,85 @@
                                                                                
                        'menuaction'    => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
                                                                                
                        'path' => urlencode($this->bofilemanager->homedir))))),
                                'help_home'             => array('widget' => 
array('type' => 'help','onClick' => $this->bofilemanager->build_help('home'))),
-                               'current_dir'   => $this->bofilemanager->path . 
'/' . $edit_file);
-                       $vars = array();
+                               'current_dir'   => $this->bofilemanager->path
+                       );
+
+                       if (get_var('edited', array('GET', 'POST')))
+                       {
+                               $content = get_var('edit_file_content', 
array('GET', 'POST'));
+                               if (get_magic_quotes_gpc()) //a thousand curses!
+                               {
+                                       $content = stripslashes($content);
+                               }
+                       }
+                       else
+                       {
+                               $content = $GLOBALS['phpgw']->vfs->read (array 
('string' => $edit_file));
+                       }
+
+                       if($_POST['preview'])
+                       {
                        $vars[] = array('widget' => array('type' => 'image',
+                                                                               
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
+                                                                               
                'title' => lang('edit'),
+                                                                               
                'name'  => 'edit',
+                                                                               
                'value' => 'edit'));
+                       }
+                       else
+                       {
+                               $vars[] = array('widget' => array('type' => 
'image',
                                                                                
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'preview'),
                                                                                
                'title' => lang('preview'),
-                                                                               
                'name'  => 'uiaction_edit_preview',
+                                                                               
                'name'  => 'preview',
                                                                                
                'value' => 'preview'));
+                       }
+
                        $vars[] = array('widget' => array('type' => 'image',
                                                                                
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'filesave'),
                                                                                
                'title' => lang('save'),
-                                                                               
                'name'  => 'uiaction_edit_save',
+                                                                               
                'name'  => 'save',
                                                                                
                'value' => 'save'));
                        $vars[] = array('widget' => array('type' => 'image',
                                                                                
                'src' => 
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_cancel'),
                                                                                
                'title' => lang('close'),
-                                                                               
                'name'  => 'uiaction_edit_cancel',
+                                                                               
                'name'  => 'cancel',
                                                                                
                'value' => 'cancel'));
                        $data['nav_data'] = $vars;
-                       $data['lang_edit'] = lang('edit file');
+                       $data['lang_edit'] = $_POST['preview']?lang('preview 
for'):lang('edit file');
                        $data['filename'] = $edit_file;

                        $vars = array();
-                       if (get_var('edited', array('GET', 'POST')))
+                       if($_POST['preview'])
                        {
-                               $content = get_var('edit_file_content', 
array('GET', 'POST'));
-                               if (get_magic_quotes_gpc()) //a thousand curses!
-                               {
-                                       $content = stripslashes($content);
-                               }
+                               $vars['preview'] =  $content;
+                               $v[] = array('widget' => array('type' => 
'hidden','name'=> 'edit_file_content','value'=> $content));
                        }
-                       else
+                       elseif ($_POST['save'])
                        {
-                               $content = $GLOBALS['phpgw']->vfs->read (array 
('string' => $edit_file));
-                       }
-
-                       if ($param == 'edit_preview')
-                       {
-                               $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('preview'=>$content));
-                               $vars['preview'] = nl2br($content);
-                       }
-
-                       elseif ($param =='edit_save')
-                       {
-                               if ($GLOBALS['phpgw']->vfs->write (array (
-                                               'string'        => 
$parent->bo->path.'/'.$edit_file ,
-                                               'relatives' => 
array(RELATIVE_NONE),
-                                               'content'       => $content
-                                       ))
-                               )
+                               if 
($GLOBALS['phpgw']->vfs->write(array('string' => 
$this->bofilemanager->path.'/'.$edit_file ,'relatives' => 
array(RELATIVE_NONE),'content' => $content)))
                                {
-                                       $vars['output'] = lang('Saved %1', 
$parent->bo->path.'/'.$edit_file);
+                                       $vars['output'] = lang('Saved 
%1',$this->bofilemanager->path.'/'.$edit_file);
                                }
                                else
                                {
-                                       $vars['output'] = lang('Could not save 
%1', $parent->bo->path.'/'.$edit_file);
+                                       $vars['output'] = lang('Could not save 
%1',$this->bofilemanager->path.'/'.$edit_file);
                                }
                        }

                        if ($edit_file && $GLOBALS['phpgw']->vfs->file_exists 
(array('string' => $edit_file,'relatives' => array (RELATIVE_ALL))))
                        {
-                                       $v[] = array('widget' => array('type' 
=> "hidden" ,
-                                                                               
        'name'=> "edited",
-                                                                               
        'value'=>"1"));
-                                       $v[] = array('widget' => array('type' 
=> "hidden",
-                                               'name' => 'edit_file',
-                                               'value' => $edit_file));
-                                       $v[] = array('widget' => 
array('type'=>"hidden",
-                                                               'name'=> 
"fileman[0]",
-                                                               'value' => 
$this->bofilemanager->html_encode($edit_file,1)));
+                                       $v[] = array('widget' => array('type' 
=> 'hidden','name'=> 'edited','value'=> 1));
+                                       $v[] = array('widget' => array('type' 
=> 'hidden','name' => 'edit_file','value' => $edit_file));
+                                       $v[] = array('widget' => array('type'=> 
'hidden','name'=> 'fileman[0]','value' => 
$this->bofilemanager->html_encode($edit_file,1)));

-                                       $vars['form_data']      = $v;
-                                       $vars['file_content'] =  $content;
+                                       $vars['form_data']              = $v;
+                                       $vars['file_content']   =  $content;
                        }

                        $output = array
                        (
-                               'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.action',
-                                                                               
                                                                                
'path' => $this->bofilemanager->path)),
+                               'form_action'           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
$this->bofilemanager->appname.'.uiaction_edit.edit',
+                                                                               
                                                                                
        'path' => $this->bofilemanager->path)),
                                'filemanager_nav'       => $data,
                                'filemanager_edit'      => $vars
                        );
@@ -142,27 +145,5 @@
                        //_debug_array($output);
                        $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('edit' => $output));
                }
-
-               function edit_cancel($parent)
-               {
-                        $url = $GLOBALS['phpgw']->link('/index.php',
-                                                       Array(
-                                                               'menuaction'    
=> $parent->bo->appname.'.ui'.$parent->bo->appname.'.index',
-                                                               'path'          
=> urlencode($parent->bo->path),
-                                                       )
-                                               );
-                       //echo "cancel : $url";
-                       header('Location: '. $url);
-                       exit();
-               }
-               function edit_save($parent)
-               {
-                       $this->edit($parent, 'edit_save');
-               }
-
-               function edit_preview($parent)
-               {
-                       $this->edit($parent, 'edit_preview');
-               }
        }
 ?>

====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.15 
filemanager/inc/class.bofilemanager.inc.php:1.16
--- filemanager/inc/class.bofilemanager.inc.php:1.15    Thu Jan 27 13:24:02 2005
+++ filemanager/inc/class.bofilemanager.inc.php Fri Jan 28 00:19:03 2005
@@ -19,14 +19,14 @@
                        'delete'        => True
                );

-               var $vfs;
+               var $access_add = False;
                var $rootdir;
                var $fakebase;
                var $appname;
                var $settings;
                var $filesdir;
                var $hostname;
-               var $userinfo = Array();
+               var $userinfo = array();
                var $homedir;
                var $homestr = False;
                var $file_attributes;
@@ -45,10 +45,10 @@

                var $params = array();

-               var $fileman = Array();
-               var $changes = Array();
-               var $upload_comment = Array();
-               var $upload_file = Array();
+               var $fileman = array();
+               var $changes = array();
+               var $upload_comment = array();
+               var $upload_file = array();
                var $op;
                var $file;
                var $help_name;
@@ -56,9 +56,9 @@
                var $disppath;
                var $dispsep;
                var $sortby = 'name';
-               var $messages = Array();
+               var $messages = array();
                var $renamefiles;
-               var $comment_files = Array();
+               var $comment_files = array();
                var $show_upload_boxes = 5;
                var $upload_boxes = array();
                var $memberships = array();
@@ -124,6 +124,15 @@
                                $this->initialize_vars($to_decode[$i]);
                        }

+                       if(count($this->fileman))
+                       {
+                               $this->save_sessiondata();
+                       }
+                       else
+                       {
+                               $this->read_sessiondata();
+                       }
+
                        $this->rootdir = $GLOBALS['phpgw']->vfs->basedir;
                        $this->fakebase = $GLOBALS['phpgw']->vfs->fakebase;
                        $this->appname = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
@@ -301,6 +310,11 @@
                        {
                                $GLOBALS['phpgw']->vfs->working_id = 
$this->userinfo['account_id'];
                        }
+
+                       if ($GLOBALS['phpgw']->vfs->acl_check(array('string' => 
$this->path,'relatives' => array (RELATIVE_NONE),'operation' => PHPGW_ACL_ADD)))
+                       {
+                               $this->access_add = True;
+                       }
                }

                function initialize_vars($name)
@@ -352,6 +366,16 @@
                        }
                }

+               function save_sessiondata()
+               {
+                       
$GLOBALS['phpgw']->session->appsession('session_data','filemanager',$this->fileman);
+               }
+
+               function read_sessiondata()
+               {
+                       $this->fileman = 
$GLOBALS['phpgw']->session->appsession('session_data','filemanager');
+               }
+
                function create_home_dir()
                {
                        ###
@@ -745,7 +769,6 @@

                function f_newfile()
                {
-                       $result = Array();
                        //echo "newfile: ".$this->params['newfile'] ." 
createfile: ".$this->createfile;
                        //die();
                        if ($this->params['newfile'] && $this->createfile)
@@ -775,7 +798,7 @@
                        {
                                $result[] = lang('filename not provided!');
                        }
-                       return $result;
+                       return is_array($result)?$result:True;
                }

                function f_upload()






reply via email to

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