diff --git a/filemanager/inc/class.uifilemanager.inc.php b/filemanager/inc/class.uifilemanager.inc.php
index a2d14f8040..cffd7e8d51 100755
--- a/filemanager/inc/class.uifilemanager.inc.php
+++ b/filemanager/inc/class.uifilemanager.inc.php
@@ -40,31 +40,39 @@
var $dispsep;
var $target;
-
+
var $prefs;//array
+ var $groups_applications;
+
//originally post_vars
- var $goto;
+ // var $goto;
+ var $goto_x;
+ var $download_x;
var $todir;
+ var $changedir; // for switching dir.
+ var $cdtodir; // for switching dir.
var $createdir;
var $newfile_or_dir;
- var $newdir;
- var $newfile;
+ var $newdir_x;
+ var $newfile_x;
var $createfile;
- var $delete;
+ var $delete_x;
var $renamefiles;
- var $rename;
- var $move_to;
- var $copy_to;
- var $edit;
+ var $rename_x;
+ var $move_to_x;
+ // var $copy_to;
+ var $copy_to_x;
+ var $edit_x;
+ var $edit_comments_x;
var $edit_file;
- var $edit_preview;
- var $edit_save;
- var $edit_save_done;
- var $edit_cancel;
+ var $edit_preview_x;
+ var $edit_save_x;
+ var $edit_save_done_x;
+ var $edit_cancel_x;
var $comment_files;
- var $upload;
+ var $upload_x;
var $uploadprocess;
// this ones must be checked thorougly;
@@ -80,7 +88,7 @@
function uifilemanager()
{
-// error_reporting (8);
+ // error_reporting (8);
$this->now = date ('Y-m-d');
@@ -94,7 +102,7 @@
{
$this->$name = $GLOBALS['HTTP_POST_VARS'][$name];
}
-
+
@reset ($GLOBALS['HTTP_GET_VARS']);
while (list ($name,) = @each ($GLOBALS['HTTP_GET_VARS']))
{
@@ -113,10 +121,10 @@
'path' => array ('path' => ''),
'file' => array ('file' => ''),
'sortby' => array ('sortby' => ''),
-// 'fileman' => array ('fileman' => ''),
+ // 'fileman' => array ('fileman' => ''),
'messages' => array ('messages' => ''),
-// 'help_name' => array ('help_name' => ''),
-// 'renamefiles' => array ('renamefiles' => ''),
+ // 'help_name' => array ('help_name' => ''),
+ // 'renamefiles' => array ('renamefiles' => ''),
'comment_files' => array ('comment_files' => ''),
'show_upload_boxes' => array ('show_upload_boxes' => '')
);
@@ -155,13 +163,13 @@
// get appl. and user prefs
$pref = CreateObject ('phpgwapi.preferences', $GLOBALS['userinfo']['username']);
$pref->read_repository ();
-// $GLOBALS['phpgw']->hooks->single ('add_def_pref', $GLOBALS['appname']);
+ // $GLOBALS['phpgw']->hooks->single ('add_def_pref', $GLOBALS['appname']);
$pref->save_repository (True);
$pref_array = $pref->read_repository ();
$this->prefs = $pref_array[$GLOBALS['appname']];
-
+
//always show name
-
+
$this->prefs[name] =1;
@@ -173,7 +181,7 @@
function index()
{
- if ($noheader || $nofooter || ($this->download && (count ($this->fileman) > 0)))
+ if ($noheader || $nofooter || ($this->download_x && (count ($this->fileman) > 0)))
{
$noheader = True;
$nofooter = True;
@@ -196,9 +204,9 @@
}
- //var_dump($GLOBALS[HTTP_POST_VARS]);
-
-
+ // var_dump($GLOBALS[HTTP_POST_VARS]);
+ //var_dump($this->delete_x);
+
# Page to process users
# Code is fairly hackish at the beginning, but it gets better
# Highly suggest turning wrapping off due to long SQL queries
@@ -206,12 +214,18 @@
###
# Some hacks to set and display directory paths correctly
###
-
- if ($this->goto)
+/*
+ if ($this->goto || $this->goto_x)
{
- $this->path = $this->todir;
+ $this->path = $this->cdtodir;
}
-
+*/
+ // new method for switching to a new dir.
+ if($this->changedir=='true' && $this->cdtodir || $this->goto_x)
+ {
+ $this->path = $this->cdtodir;
+ }
+
if (!$this->path)
{
$this->path = $this->bo->vfs->pwd ();
@@ -262,14 +276,14 @@
}
}
- $groups_applications = array ();
+ $this->groups_applications = array ();
while (list ($num, $group_array) = each ($this->readable_groups))
{
$group_id = $GLOBALS['phpgw']->accounts->name2id ($group_array['account_name']);
$applications = CreateObject('phpgwapi.applications', $group_id);
- $groups_applications[$group_array['account_name']] = $applications->read_account_specific ();
+ $this->groups_applications[$group_array['account_name']] = $applications->read_account_specific ();
}
# We determine if they're in their home directory or a group's directory,
@@ -282,8 +296,8 @@
{
$this->bo->vfs->working_id = $GLOBALS['userinfo']['username'];
}
-
-
+
+
# FIXME # comment waht happens here
if ($this->path != $GLOBALS['homedir'] && $this->path != $GLOBALS['fakebase'] && $this->path != '/' && !$this->bo->vfs->acl_check (array ( 'string' => $this->path, 'relatives' => array (RELATIVE_NONE),'operation' => PHPGW_ACL_READ )))
{
@@ -366,11 +380,11 @@
# main action switch
// FIXME this will become a switch
- if($this->newfile && $this->newfile_or_dir) // create new textfile
+ if($this->newfile_x && $this->newfile_or_dir) // create new textfile
{
$this->createfile();
}
- elseif($this->newfile_or_dir && $this->newdir)
+ elseif($this->newfile_or_dir && $this->newdir_x)
{
$this->createdir();
}
@@ -378,19 +392,19 @@
{
$this->fileUpload();
}
- elseif ($this->upload || $this->show_upload_boxes)
+ elseif ($this->upload_x || $this->show_upload_boxes)
{
$this->showUploadboxes();
}
- elseif ($this->copy_to)
+ elseif ($this->copy_to_x)
{
$this->copyTo();
}
- elseif ($this->move_to)
+ elseif ($this->move_to_x)
{
$this->moveTo();
}
- elseif ($this->download)
+ elseif ($this->download_x)
{
$this->download();
}
@@ -402,16 +416,16 @@
{
$this->editComment();
}
- elseif ($this->edit_cancel)
+ elseif ($this->edit_cancel_x)
{
$this->readFilesInfo();
$this->fileListing();
}
- elseif ($this->edit || $this->edit_preview || $this->edit_save)
+ elseif ($this->edit_x || $this->edit_preview_x || $this->edit_save_x || $this->edit_save_done_x)
{
$this->edit();
}
- elseif ($this->delete)
+ elseif ($this->delete_x)
{
$this->delete();
}
@@ -445,8 +459,9 @@
$vars[toolbar0]=$this->toolbar('location');
$vars[toolbar1]=$this->toolbar('list_nav');
+ if($this->messages) $this->messages='
'.$this->messages.'
';
$vars[messages]=$this->messages;
-
+
$this->t->set_var($vars);
$this->t->pparse('out','filemanager_header');
@@ -471,7 +486,7 @@
}
}
- $this->t->set_var('row_tr_color','#cbcbcb');
+ $this->t->set_var('row_tr_color','#dedede');
$this->t->parse('rows','row');
$this->t->pparse('out','row');
}
@@ -480,7 +495,7 @@
$lang_nofiles=lang('No files in this directory.');
}
$vars[lang_no_files]=$lang_nofiles;
-
+
if ($this->prefs['dotdot'] && $this->prefs['name'] && $this->path != '/')
{
@@ -488,7 +503,7 @@
$link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->lesspath);
- $col_data=' ';
+ $col_data=' ';
$col_data.=' .. ';
$this->t->set_var('col_data',$col_data);
@@ -508,12 +523,12 @@
}
# List all of the files, with their attributes
- reset ($this->files_array);
+ @reset ($this->files_array);
for ($i = 0; $i != $this->numoffiles; $i++)
{
$files = $this->files_array[$i];
- if ($this->rename || $this->edit_comments)
+ if ($this->rename_x || $this->edit_comments_x)
{
unset ($this_selected);
unset ($renamethis);
@@ -528,11 +543,11 @@
}
}
- if ($this->rename && $this_selected)
+ if ($this->rename_x && $this_selected)
{
$renamethis = 1;
}
- elseif ($this->edit_comments && $this_selected)
+ elseif ($this->edit_comments_x && $this_selected)
{
$edit_this_comment = 1;
}
@@ -544,7 +559,7 @@
}
# Checkboxes
- if (!$this->rename && !$this->edit_comments && $this->path != $GLOBALS['fakebase'] && $this->path != '/')
+ if (!$this->rename_x && !$this->edit_comments_x && $this->path != $GLOBALS['fakebase'] && $this->path != '/')
{
$cbox=' ';
$this->t->set_var('actions',$cbox);
@@ -710,7 +725,7 @@
$this->t->parse('columns','column',True);
}
-
+
if ($files['mime_type'] == 'Directory')
{
@@ -727,7 +742,7 @@
}
// when renaming or changing comments render extra sumbmit button
- if ($this->rename || $this->edit_comments)
+ if ($this->rename_x || $this->edit_comments_x)
{
$col_data=' ';
$this->t->set_var('col_data',$col_data);
@@ -741,7 +756,7 @@
}
-
+
// The file and directory information
$vars[lang_files_in_this_dir]=lang('Files is this directory');
$vars[files_in_this_dir]=$this->numoffiles;
@@ -778,7 +793,7 @@
function readFilesInfo()
{
// start files info
-
+
# Read in file info from database to use in the rest of the script
# $fakebase is a special directory. In that directory, we list the user's
# home directory and the directories for the groups they're in
@@ -798,7 +813,7 @@
while (list ($num, $group_array) = each ($this->readable_groups))
{
# If the group doesn't have access to this app, we don't show it
- if (!$groups_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
+ if (!$this->groups_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
{
continue;
}
@@ -854,13 +869,11 @@
case 'location':
$toolbar='
- '.lang('location').':
-
';
- break;
- case 'list_nav':
- $toolbar='
+ ';
+ $toolbar.=' ';
+ $toolbar.='
';
// go up icon when we're not at the top
@@ -871,7 +884,7 @@
}
// go home icon when we're not home already
- if ($this->path == $GLOBALS['homedir'])
+ if ($this->path != $GLOBALS['homedir'])
{
$link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$GLOBALS['homedir']);
$toolbar.=$this->buttonImage($link,'home',lang('go home'));
@@ -881,212 +894,251 @@
$link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path);
$toolbar.=$this->buttonImage($link,'reload',lang('reload'));
+ $toolbar.=''.lang('Location').': ';
+ //$toolbar.=' ';
+ $current_option=''.$this->disppath.' ';
// selectbox for change/move/and copy to
$dirs_options=$this->all_other_directories_options();
- $toolbar.=' '.$dirs_options.' ';
-
+ $toolbar.=''.$current_option.$dirs_options.'
+
+ ';
$toolbar.=$this->inputImage('goto','goto','Quick jump to');
-
- if (!$this->rename && !$this->edit_comments)
+ // upload button
+ if ($this->path != '/' && $this->path != $GLOBALS['fakebase'] && $this->can_add)
{
+
+ $toolbar.=' ';
+ $toolbar.=' ';
+ $toolbar.=' ';
+
+ // $toolbar.=$this->inputImage('download','download',lang('Download'));
+ // upload button
+ $toolbar.=$this->inputImage('upload','upload',lang('Upload'));
+ }
+ $toolbar.='
';
+ $toolbar.='';
+ break;
+ case 'list_nav':
+ $toolbar='
+
+ ';
+ // selectbox for change/move/and copy to
+ // submit buttons for
+ if ($this->path != '/' && $this->path != $GLOBALS['fakebase'])
+ {
+ $toolbar.=' ';
+ $toolbar.='
+ ';
+
+ if (!$this->rename_x && !$this->edit_comments_x)
+ {
+ // edit text file button
+ $toolbar.=$this->inputImage('edit','edit',lang('edit'));
+ }
+
+ if (!$this->edit_comments_x)
+ {
+ $toolbar.=$this->inputImage('rename','rename',lang('Rename'));
+ }
+
+ if (!$this->rename_x && !$this->edit_comments_x)
+ {
+ $toolbar.=$this->inputImage('delete','delete',lang('Delete'));
+ }
+
+ if (!$this->rename_x)
+ {
+ $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments'));
+ }
+ $toolbar.=' ';
+ }
+
+ // $toolbar.='
';
+ if (!$this->rename_x && !$this->edit_comments_x)
+ {
+
+
// copy and move buttons
if ($this->path != '/' && $this->path != $GLOBALS['fakebase'])
{
- $toolbar.=$this->inputImage('copy_to','copy_to',lang('Copy to'));
- $toolbar.=$this->inputImage('move_to','move_to',lang('Move to'));
- }
+ $toolbar3.=' ';
+ $toolbar3.=' ';
+ $dirs_options=$this->all_other_directories_options();
+ $toolbar3.=''.$dirs_options.' ';
- // submit buttons for
- if ($this->path != '/' && $this->path != $GLOBALS['fakebase'])
- {
- if (!$this->rename && !$this->edit_comments)
- {
- // edit text file button
- $toolbar.=$this->inputImage('edit','edit',lang('edit'));
- }
+ $toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to'));
+ $toolbar3.=$this->inputImage('move_to','move_to',lang('Move to'));
- if (!$this->edit_comments)
- {
- $toolbar.=$this->inputImage('rename','rename',lang('Rename'));
- }
+ $toolbar3.=' ';
- if (!$this->rename && !$this->edit_comments)
- {
- $toolbar.=$this->inputImage('delete','delete',lang('Delete'));
- }
-
- if (!$this->rename)
- {
- $toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments'));
- }
}
// create dir and file button
if ($this->path != '/' && $this->path != $GLOBALS['fakebase'] && $this->can_add)
{
- $toolbar.=' ';
- $toolbar.=$this->inputImage('newdir','createdir',lang('Create Folder'));
- $toolbar.=$this->inputImage('newfile','createfile',lang('Create File'));
+ $toolbar3.=' ';
+ $toolbar3.=' ';
+
+ $toolbar3.=' ';
+ $toolbar3.=$this->inputImage('newdir','createdir',lang('Create Folder'));
+ $toolbar3.=$this->inputImage('newfile','createfile',lang('Create File'));
}
- $toolbar.=' ';
-
- // download button
- if ($this->path != '/' && $this->path != $GLOBALS['fakebase'] && $this->can_add)
+ if($toolbar3)
{
- $toolbar.=$this->inputImage('download','download',lang('Download'));
+ $toolbar.=$toolbar3;
+ /* $toolbar.='
+
+ '.$toolbar3;*/
}
- // upload button
- $toolbar.=$this->inputImage('upload','upload',lang('Upload'));
-
}
-
$toolbar.='
';
+
break;
default:$x='';
}
- if($toolbar)
- {
- return $toolbar;
- }
- }
-
-
- // move to bo
- # Handle File Uploads
- function fileUpload()
- {
- if ($this->path != '/' && $this->path != $GLOBALS['fakebase'])
- {
- for ($i = 0; $i != $this->show_upload_boxes; $i++)
+ if($toolbar)
{
- if ($badchar = $this->bo->bad_chars ($_FILES['upload_file']['name'][$i], True, True))
+ return $toolbar;
+ }
+ }
+
+
+ // move to bo
+ # Handle File Uploads
+ function fileUpload()
+ {
+ if ($this->path != '/' && $this->path != $GLOBALS['fakebase'])
+ {
+ for ($i = 0; $i != $this->show_upload_boxes; $i++)
{
- $this->messages.= $GLOBALS['phpgw']->common->error_list (array ($this->bo->html_encode (lang('File names cannot contain "%1"', $badchar), 1)));
-
- continue;
- }
-
- # Check to see if the file exists in the database, and get its info at the same time
- $ls_array = $this->bo->vfs->ls (array (
- 'string'=> $this->path . '/' . $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_NONE),
- 'checksubdirs' => False,
- 'nofiles' => True
- ));
-
- $fileinfo = $ls_array[0];
-
- if ($fileinfo['name'])
- {
- if ($fileinfo['mime_type'] == 'Directory')
+ if ($badchar = $this->bo->bad_chars ($_FILES['upload_file']['name'][$i], True, True))
{
- $this->messages.= $GLOBALS['phpgw']->common->error_list (array (lang('Cannot replace %1 because it is a directory', $fileinfo['name'])));
+ $this->messages.= $GLOBALS['phpgw']->common->error_list (array ($this->bo->html_encode (lang('File names cannot contain "%1"', $badchar), 1)));
+
continue;
}
- }
- if ($_FILES['upload_file']['size'][$i] > 0)
- {
- if ($fileinfo['name'] && $fileinfo['deleteable'] != 'N')
+ # Check to see if the file exists in the database, and get its info at the same time
+ $ls_array = $this->bo->vfs->ls (array (
+ 'string'=> $this->path . '/' . $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => True
+ ));
+
+ $fileinfo = $ls_array[0];
+
+ if ($fileinfo['name'])
{
- $tmp_arr=array(
- 'string'=> $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_ALL),
- 'attributes' => array (
- 'owner_id' => $GLOBALS['userinfo']['username'],
- 'modifiedby_id' => $GLOBALS['userinfo']['username'],
- 'modified' => $this->now,
- 'size' => $_FILES['upload_file']['size'][$i],
- 'mime_type' => $_FILES['upload_file']['type'][$i],
- 'deleteable' => 'Y',
- 'comment' => stripslashes ($upload_comment[$i])
- )
- );
- $this->bo->vfs->set_attributes($tmp_arr);
-
- $tmp_arr=array (
- 'from' => $_FILES['upload_file']['tmp_name'][$i],
- 'to' => $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
- );
- $this->bo->vfs->cp($tmp_arr);
-
- $this->messages.=lang('Replaced %1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]);
+ if ($fileinfo['mime_type'] == 'Directory')
+ {
+ $this->messages.= $GLOBALS['phpgw']->common->error_list (array (lang('Cannot replace %1 because it is a directory', $fileinfo['name'])));
+ continue;
+ }
}
- else
- {
- $this->bo->vfs->cp (array (
- 'from'=> $_FILES['upload_file']['tmp_name'][$i],
- 'to'=> $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+ if ($_FILES['upload_file']['size'][$i] > 0)
+ {
+ if ($fileinfo['name'] && $fileinfo['deleteable'] != 'N')
+ {
+ $tmp_arr=array(
+ 'string'=> $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_ALL),
+ 'attributes' => array (
+ 'owner_id' => $GLOBALS['userinfo']['username'],
+ 'modifiedby_id' => $GLOBALS['userinfo']['username'],
+ 'modified' => $this->now,
+ 'size' => $_FILES['upload_file']['size'][$i],
+ 'mime_type' => $_FILES['upload_file']['type'][$i],
+ 'deleteable' => 'Y',
+ 'comment' => stripslashes ($upload_comment[$i])
+ )
+ );
+ $this->bo->vfs->set_attributes($tmp_arr);
+
+ $tmp_arr=array (
+ 'from' => $_FILES['upload_file']['tmp_name'][$i],
+ 'to' => $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+ );
+ $this->bo->vfs->cp($tmp_arr);
+
+ $this->messages.=lang('Replaced %1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]);
+ }
+ else
+ {
+
+ $this->bo->vfs->cp (array (
+ 'from'=> $_FILES['upload_file']['tmp_name'][$i],
+ 'to'=> $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)
+ ));
+
+ $this->bo->vfs->set_attributes (array (
+ 'string'=> $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_ALL),
+ 'attributes'=> array (
+ 'mime_type' => $_FILES['upload_file']['type'][$i],
+ 'comment' => stripslashes ($upload_comment[$i])
+ )
+ ));
+
+ $this->messages.=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $_FILES['upload_file']['size'][$i]);
+ }
+ }
+ elseif ($_FILES['upload_file']['name'][$i])
+ {
+ $this->bo->vfs->touch (array (
+ 'string'=> $_FILES['upload_file']['name'][$i],
+ 'relatives' => array (RELATIVE_ALL)
));
- $this->bo->vfs->set_attributes (array (
+ $this->bo->vfs->set_attributes (array (
'string'=> $_FILES['upload_file']['name'][$i],
'relatives' => array (RELATIVE_ALL),
'attributes'=> array (
'mime_type' => $_FILES['upload_file']['type'][$i],
- 'comment' => stripslashes ($upload_comment[$i])
+ 'comment' => $upload_comment[$i]
)
));
- $this->messages.=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $_FILES['upload_file']['size'][$i]);
+ $this->messages.=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $file_size[$i]);
}
}
- elseif ($_FILES['upload_file']['name'][$i])
- {
- $this->bo->vfs->touch (array (
- 'string'=> $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_ALL)
- ));
- $this->bo->vfs->set_attributes (array (
- 'string'=> $_FILES['upload_file']['name'][$i],
- 'relatives' => array (RELATIVE_ALL),
- 'attributes'=> array (
- 'mime_type' => $_FILES['upload_file']['type'][$i],
- 'comment' => $upload_comment[$i]
- )
- ));
-
- $this->messages.=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $file_size[$i]);
- }
+ $this->readFilesInfo();
+ $this->filelisting();
}
-
+
+ }
+
+ # Handle Editing comments
+ function editComment()
+ {
+ while (list ($file) = each ($this->comment_files))
+ {
+ if ($badchar = $this->bo->bad_chars ($this->comment_files[$file], False, True))
+ {
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array ($file . $this->bo->html_encode (': ' . lang('Comments cannot contain "%1"', $badchar), 1)));
+ continue;
+ }
+
+ $this->bo->vfs->set_attributes (array ( 'string' => $file, 'relatives' => array (RELATIVE_ALL), 'attributes' => array ( 'comment' => stripslashes ($this->comment_files[$file]) ) ) );
+
+ $this->messages=lang('Updated comment for %1', $this->path.'/'.$file);
+ }
+
$this->readFilesInfo();
$this->filelisting();
}
- }
-
- # Handle Editing comments
- function editComment()
- {
- while (list ($file) = each ($this->comment_files))
+ # Handle Renaming Files and Directories
+ function rename()
{
- if ($badchar = $this->bo->bad_chars ($this->comment_files[$file], False, True))
- {
- $this->messages=$GLOBALS['phpgw']->common->error_list (array ($file . $this->bo->html_encode (': ' . lang('Comments cannot contain "%1"', $badchar), 1)));
- continue;
- }
-
- $this->bo->vfs->set_attributes (array ( 'string' => $file, 'relatives' => array (RELATIVE_ALL), 'attributes' => array ( 'comment' => stripslashes ($this->comment_files[$file]) ) ) );
-
- $this->messages=lang('Updated comment for %1', $this->path.'/'.$file);
- }
-
- $this->readFilesInfo();
- $this->filelisting();
- }
-
- # Handle Renaming Files and Directories
- function rename()
- {
while (list ($from, $to) = each ($this->renamefiles))
{
if ($badchar = $this->bo->bad_chars ($to, True, True))
@@ -1110,11 +1162,11 @@
}
$this->readFilesInfo();
$this->filelisting();
- }
+ }
- # Handle Moving Files and Directories
- function moveTo()
- {
+ # Handle Moving Files and Directories
+ function moveTo()
+ {
while (list ($num, $file) = each ($this->fileman))
{
if ($this->bo->vfs->mv (array (
@@ -1139,11 +1191,11 @@
$this->readFilesInfo();
$this->filelisting();
- }
+ }
- // Handle Copying of Files and Directories
- function copyTo()
- {
+ // Handle Copying of Files and Directories
+ function copyTo()
+ {
while (list ($num, $file) = each ($this->fileman))
{
if ($this->bo->vfs->cp (array ( 'from' => $file, 'to' => $this->todir . '/' . $file, 'relatives' => array (RELATIVE_ALL, RELATIVE_NONE) )) )
@@ -1165,702 +1217,707 @@
$this->readFilesInfo();
$this->filelisting();
- }
+ }
- function createdir()
- {
- if ($this->newdir && $this->newfile_or_dir)
+ function createdir()
{
- if ($this->bo->badchar = $this->bo->bad_chars ($this->newfile_or_dir, True, True))
+ if ($this->newdir_x && $this->newfile_or_dir)
{
- $this->messages= $GLOBALS['phpgw']->common->error_list (array ($this->bo->html_encode (lang('Directory names cannot contain "%1"', $badchar), 1)));
- }
-
- if ($$this->newfile_or_dir[strlen($this->newfile_or_dir)-1] == ' ' || $this->newfile_or_dir[0] == ' ')
- {
- $this->messages= $GLOBALS['phpgw']->common->error_list (array (lang('Cannot create directory because it begins or ends in a space')));
- }
-
- $ls_array = $this->bo->vfs->ls (array (
- 'string' => $this->path . '/' . $this->newfile_or_dir,
- 'relatives' => array (RELATIVE_NONE),
- 'checksubdirs' => False,
- 'nofiles' => True
- ));
-
- $fileinfo = $ls_array[0];
-
- if ($fileinfo['name'])
- {
- if ($fileinfo['mime_type'] != 'Directory')
+ if ($this->bo->badchar = $this->bo->bad_chars ($this->newfile_or_dir, True, True))
{
- $this->messages= $GLOBALS['phpgw']->common->error_list (array (
- lang('%1 already exists as a file',
- $fileinfo['name'])
- ));
+ $this->messages= $GLOBALS['phpgw']->common->error_list (array ($this->bo->html_encode (lang('Directory names cannot contain "%1"', $badchar), 1)));
+ }
+
+ if ($$this->newfile_or_dir[strlen($this->newfile_or_dir)-1] == ' ' || $this->newfile_or_dir[0] == ' ')
+ {
+ $this->messages= $GLOBALS['phpgw']->common->error_list (array (lang('Cannot create directory because it begins or ends in a space')));
+ }
+
+ $ls_array = $this->bo->vfs->ls (array (
+ 'string' => $this->path . '/' . $this->newfile_or_dir,
+ 'relatives' => array (RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => True
+ ));
+
+ $fileinfo = $ls_array[0];
+
+ if ($fileinfo['name'])
+ {
+ if ($fileinfo['mime_type'] != 'Directory')
+ {
+ $this->messages= $GLOBALS['phpgw']->common->error_list (array (
+ lang('%1 already exists as a file',
+ $fileinfo['name'])
+ ));
+ }
+ else
+ {
+ $this->messages= $GLOBALS['phpgw']->common->error_list (array (lang('Directory %1 already exists', $fileinfo['name'])));
+ }
}
else
{
- $this->messages= $GLOBALS['phpgw']->common->error_list (array (lang('Directory %1 already exists', $fileinfo['name'])));
+ if ($this->bo->vfs->mkdir (array ('string' => $this->newfile_or_dir)))
+ {
+ $this->messages=lang('Created directory %1', $this->disppath.'/'.$this->newfile_or_dir);
+ }
+ else
+ {
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir)));
+ }
}
+
+ $this->readFilesInfo();
+ $this->filelisting();
+ }
+
+ }
+
+ function delete()
+ {
+ if( is_array($this->fileman) && count($this->fileman) >= 1)
+ {
+ foreach($this->fileman as $filename)
+ {
+ if ($this->bo->vfs->delete (array ('string' => $filename)))
+ {
+ $this->messages .= lang('Deleted %1', $this->disppath.'/'.$filename).' ';
+ }
+ else
+ {
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('Could not delete %1', $this->disppath.'/'.$filename)));
+ }
+ }
}
else
- {
- if ($this->bo->vfs->mkdir (array ('string' => $this->newfile_or_dir)))
- {
- $this->messages=lang('Created directory %1', $this->disppath.'/'.$this->newfile_or_dir);
- }
- else
- {
- $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('Could not create %1', $this->disppath.'/'.$this->newfile_or_dir)));
- }
+ {
+ // make this a javascript func for quicker respons
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('Please select a file to delete.')));
}
-
$this->readFilesInfo();
$this->filelisting();
}
- }
- function delete()
- {
- for ($i = 0; $i != $this->numoffiles; $i++)
+ function debug_filemanager()
{
- if ($this->fileman[$i])
+ error_reporting (8);
+
+ echo "Filemanager debug:
+ path: {$this->path}
+ disppath: {$this->disppath}
+ cwd: {$this->cwd}
+ lesspath: {$this->lesspath}
+
+ eGroupware debug:
+ real getabsolutepath: " . $this->bo->vfs->getabsolutepath (array ('target' => False, 'mask' => False, 'fake' => False)) . "
+ fake getabsolutepath: " . $this->bo->vfs->getabsolutepath (array ('target' => False)) . "
+ appsession: " . $GLOBALS['phpgw']->session->appsession ('vfs','') . "
+ pwd: " . $this->bo->vfs->pwd () . " ";
+
+ echo '
';
+ var_dump($this);
+
+
+ }
+
+ function showUploadboxes()
+ {
+ $this->t->set_file(array('upload' => 'upload.tpl'));
+ $this->t->set_block('upload','upload_header','upload_header');
+ $this->t->set_block('upload','row','row');
+ $this->t->set_block('upload','upload_footer','upload_footer');
+
+ # Decide how many upload boxes to show
+ if (!$this->show_upload_boxes || $this->show_upload_boxes <= 0)
{
- if ($this->bo->vfs->delete (array ('string' => $this->fileman[$i])))
+ if (!$this->show_upload_boxes = $this->prefs['show_upload_boxes'])
{
- $this->messages .= lang('Deleted %1', $this->disppath.'/'.$this->fileman[$i]).' ';
+ $this->show_upload_boxes = 1;
+ }
+ }
+
+ # Show file upload boxes. Note the last argument to html (). Repeats $this->show_upload_boxes times
+ if ($this->path != '/' && $this->path != $GLOBALS['fakebase'] && $this->can_add)
+ {
+ $vars[form_action]=$GLOBALS[phpgw]->link('/index.php','menuaction=filemanager.uifilemanager.index');
+ $vars[path]=$this->path;
+ $vars[lang_file]=lang('File');
+ $vars[lang_comment]=lang('Comment');
+ $vars[num_upload_boxes]=$this->show_upload_boxes;
+ $this->t->set_var($vars);
+ $this->t->pparse('out','upload_header');
+
+ for($i=0;$i<$this->show_upload_boxes;$i++)
+ {
+ $this->t->set_var('row_tr_color',$tr_color);
+ $this->t->parse('rows','row');
+ $this->t->pparse('out','row');
+ }
+
+ $vars[lang_upload]=lang('Upload files');
+ $vars[change_upload_boxes].=lang('Show') . ' ';
+ $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=5', '5');
+ $links.=' ';
+ $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=10', '10');
+ $links.=' ';
+ $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=20', '20');
+ $links.=' ';
+ $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=50', '50');
+ $links.=' ';
+ $links.= lang('upload fields');
+ $vars[change_upload_boxes].=$links;
+ $this->t->set_var($vars);
+ $this->t->pparse('out','upload_footer');
+ }
+ }
+
+ /* create textfile */
+ function createfile()
+ {
+ $this->createfile=$this->newfile_or_dir;
+ if ($this->createfile)
+ {
+ if ($badchar = $this->bo->bad_chars ($this->createfile, True, True))
+ {
+ $this->messages = $GLOBALS['phpgw']->common->error_list (array (
+ lang('File names cannot contain "%1"',$badchar),
+ 1)
+ );
+
+ $this->fileListing();
+ }
+
+ if ($this->bo->vfs->file_exists (array (
+ 'string'=> $this->createfile,
+ 'relatives' => array (RELATIVE_ALL)
+ )))
+ {
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('File %1 already exists. Please edit it or delete it first.', $this->createfile)));
+ $this->fileListing();
+ }
+
+
+ if ($this->bo->vfs->touch (array ( 'string' => $this->createfile, 'relatives' => array (RELATIVE_ALL) )) )
+ {
+ $this->fileman = array ();
+ $this->fileman[0] = $this->createfile;
+ $this->edit = 1;
+ $this->numoffiles++;
+ $this->edit();
}
else
{
- $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('Could not delete %1', $this->disppath.'/'.$this->fileman[$i])));
+ $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('File %1 could not be created.', $this->createfile)));
+ $this->fileListing();
}
}
}
- $this->readFilesInfo();
- $this->filelisting();
- }
-
- function debug_filemanager()
- {
- error_reporting (8);
-
- echo "Filemanager debug:
- path: {$this->path}
- disppath: {$this->disppath}
- cwd: {$this->cwd}
- lesspath: {$this->lesspath}
-
- eGroupware debug:
- real getabsolutepath: " . $this->bo->vfs->getabsolutepath (array ('target' => False, 'mask' => False, 'fake' => False)) . "
- fake getabsolutepath: " . $this->bo->vfs->getabsolutepath (array ('target' => False)) . "
- appsession: " . $GLOBALS['phpgw']->session->appsession ('vfs','') . "
- pwd: " . $this->bo->vfs->pwd () . " ";
-
- echo '
';
- var_dump($this);
-
-
- }
-
- function showUploadboxes()
- {
- $this->t->set_file(array('upload' => 'upload.tpl'));
- $this->t->set_block('upload','upload_header','upload_header');
- $this->t->set_block('upload','row','row');
- $this->t->set_block('upload','upload_footer','upload_footer');
-
- # Decide how many upload boxes to show
- if (!$this->show_upload_boxes || $this->show_upload_boxes <= 0)
+ # Handle Editing files
+ function edit()
{
- if (!$this->show_upload_boxes = $this->prefs['show_upload_boxes'])
- {
- $this->show_upload_boxes = 1;
- }
- }
+ $this->readFilesInfo();
- # Show file upload boxes. Note the last argument to html (). Repeats $this->show_upload_boxes times
- if ($this->path != '/' && $this->path != $GLOBALS['fakebase'] && $this->can_add)
- {
- $vars[form_action]=$GLOBALS[phpgw]->link('/index.php','menuaction=filemanager.uifilemanager.index');
- $vars[path]=$this->path;
- $vars[lang_file]=lang('File');
- $vars[lang_comment]=lang('Comment');
- $vars[num_upload_boxes]=$this->show_upload_boxes;
- $this->t->set_var($vars);
- $this->t->pparse('out','upload_header');
+ $this->t->set_file(array('filemanager_edit' => 'edit_file.tpl'));
+ $this->t->set_block('filemanager_edit','row','row');
- for($i=0;$i<$this->show_upload_boxes;$i++)
- {
- $this->t->set_var('row_tr_color',$tr_color);
- $this->t->parse('rows','row');
- $this->t->pparse('out','row');
- }
-
- $vars[lang_upload]=lang('Upload files');
- $vars[change_upload_boxes].=lang('Show') . ' ';
- $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=5', '5');
- $links.=' ';
- $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=10', '10');
- $links.=' ';
- $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=20', '20');
- $links.=' ';
- $links.= $this->html_link ('/index.php','menuaction=filemanager.uifilemanager.index','show_upload_boxes=50', '50');
- $links.=' ';
- $links.= lang('upload fields');
- $vars[change_upload_boxes].=$links;
- $this->t->set_var($vars);
- $this->t->pparse('out','upload_footer');
- }
- }
-
- /* create textfile */
- function createfile()
- {
- $this->createfile=$this->newfile_or_dir;
- if ($this->createfile)
- {
- if ($badchar = $this->bo->bad_chars ($this->createfile, True, True))
- {
- $this->messages = $GLOBALS['phpgw']->common->error_list (array (
- lang('File names cannot contain "%1"',$badchar),
- 1)
- );
-
- $this->fileListing();
- }
-
- if ($this->bo->vfs->file_exists (array (
- 'string'=> $this->createfile,
- 'relatives' => array (RELATIVE_ALL)
- )))
- {
- $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('File %1 already exists. Please edit it or delete it first.', $this->createfile)));
- $this->fileListing();
- }
-
-
- if ($this->bo->vfs->touch (array ( 'string' => $this->createfile, 'relatives' => array (RELATIVE_ALL) )) )
- {
- $this->fileman = array ();
- $this->fileman[0] = $this->createfile;
- $this->edit = 1;
- $this->numoffiles++;
- $this->edit();
- }
- else
- {
- $this->messages=$GLOBALS['phpgw']->common->error_list (array (lang('File %1 could not be created.', $this->createfile)));
- $this->fileListing();
- }
- }
- }
-
- # Handle Editing files
- function edit()
- {
- $this->readFilesInfo();
-
- $this->t->set_file(array('filemanager_edit' => 'edit_file.tpl'));
- $this->t->set_block('filemanager_edit','row','row');
-
- $vars[preview_content]='';
- if ($this->edit_file)
- {
- $this->edit_file_content = stripslashes ($this->edit_file_content);
- }
-
- if ($this->edit_preview)
- {
- $content = $this->edit_file_content;
-
- $vars[lang_preview_of]=lang('Preview of %1', $this->path.'/'.$edit_file);
-
- $vars[preview_content]=nl2br($content);
- }
- elseif ($this->edit_save || $this->edit_save_done)
- {
- $content = $this->edit_file_content;
-
- if ($this->bo->vfs->write (array (
- 'string' => $this->edit_file,
- 'relatives' => array (RELATIVE_ALL),
- 'content' => $content
- ))
- )
- {
- $this->messages=lang('Saved %1', $this->path.'/'.$this->edit_file);
-
- if($this->edit_save_done)
- {
- $this->readFilesInfo();
- $this->fileListing();
- exit;
- }
- }
- else
- {
- $this->messages=lang('Could not save %1', $this->path.'/'.$this->edit_file);
- }
- }
-
- # Now we display the edit boxes and forms
- for ($j = 0; $j != $this->numoffiles; $j++)
- {
- # If we're in preview or save mode, we only show the file
- # being previewed or saved
- if ($this->edit_file && ($this->fileman[$j] != $this->edit_file))
- {
- continue;
- }
-
- if ($this->fileman[$j] && $this->bo->vfs->file_exists (array ( 'string' => $this->fileman[$j], 'relatives' => array (RELATIVE_ALL) )) )
- {
+ $vars[preview_content]='';
if ($this->edit_file)
{
- $content = stripslashes ($this->edit_file_content);
+ $this->edit_file_content = stripslashes ($this->edit_file_content);
}
- else
+
+ if ($this->edit_preview_x)
{
- $content = $this->bo->vfs->read (array ('string' => $this->fileman[$j]));
+ $content = $this->edit_file_content;
+
+ $vars[lang_preview_of]=lang('Preview of %1', $this->path.'/'.$edit_file);
+
+ $vars[preview_content]=nl2br($content);
+ }
+ elseif ($this->edit_save_x || $this->edit_save_done_x)
+ {
+
+ $content = $this->edit_file_content;
+ //die( $content);
+ if ($this->bo->vfs->write (array (
+ 'string' => $this->edit_file,
+ 'relatives' => array (RELATIVE_ALL),
+ 'content' => $content
+ )))
+ {
+ $this->messages=lang('Saved %1', $this->path.'/'.$this->edit_file);
+
+ if($this->edit_save_done_x)
+ {
+ $this->readFilesInfo();
+ $this->fileListing();
+ exit;
+ }
+ }
+ else
+ {
+ $this->messages=lang('Could not save %1', $this->path.'/'.$this->edit_file);
+ }
}
- $vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path);
- $vars[edit_file]=$this->fileman[$j];
+ # Now we display the edit boxes and forms
+ for ($j = 0; $j != $this->numoffiles; $j++)
+ {
+ # If we're in preview or save mode, we only show the file
+ # being previewed or saved
+ if ($this->edit_file && ($this->fileman[$j] != $this->edit_file))
+ {
+ continue;
+ }
- # We need to include all of the fileman entries for each file's form,
- # so we loop through again
+ if ($this->fileman[$j] && $this->bo->vfs->file_exists (array ( 'string' => $this->fileman[$j], 'relatives' => array (RELATIVE_ALL) )) )
+ {
+ if ($this->edit_file)
+ {
+ $content = stripslashes ($this->edit_file_content);
+ }
+ else
+ {
+ $content = $this->bo->vfs->read (array ('string' => $this->fileman[$j]));
+ }
+
+ $vars[form_action]= $GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.index','path='.$this->path);
+ $vars[edit_file]=$this->fileman[$j];
+
+ # We need to include all of the fileman entries for each file's form,
+ # so we loop through again
+ for ($i = 0; $i != $this->numoffiles; $i++)
+ {
+ if($this->fileman[$i]) $value='value="'.$this->fileman[$i].'"';
+ $vars[filemans_hidden]=' ';
+
+ }
+
+ $vars[file_content]=$content;
+
+
+ $vars[buttonPreview]=$this->inputImage('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode ($this->fileman[$j], 1)));
+ $vars[buttonSave]=$this->inputImage('edit_save','save',lang('Save %1', $this->bo->html_encode ($this->fileman[$j], 1)));
+ $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)));
+ $vars[buttonCancel]=$this->inputImage('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode ($this->fileman[$j], 1)));
+ $this->t->set_var($vars);
+ $this->t->parse('rows','row');
+ $this->t->pparse('out','row');
+
+ }
+ }
+ }
+
+
+
+ function history()
+ {
+ if ($this->file)
+ {
+ $journal_array = $this->bo->vfs->get_journal (array (
+ 'string' => $this->file,
+ 'relatives' => array (RELATIVE_ALL)
+ ));
+
+ if (is_array ($journal_array))
+ {
+ $this->html_table_begin ();
+ $this->html_table_row_begin ();
+ $this->html_table_col_begin ();
+ echo lang('Date');
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ echo lang('Version');
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ echo lang('Who');
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ echo lang('Operation');
+ $this->html_table_col_end ();
+ $this->html_table_row_end ();
+
+ while (list ($num, $journal_entry) = each ($journal_array))
+ {
+ $this->html_table_row_begin ();
+ $this->html_table_col_begin ();
+ $this->bo->html_text ($journal_entry['created'] . ' ');
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ $this->bo->html_text ($journal_entry['version'] . ' ' );
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ $this->bo->html_text ($GLOBALS['phpgw']->accounts->id2name ($journal_entry['owner_id']) . ' ');
+ $this->html_table_col_end ();
+ $this->html_table_col_begin ();
+ $this->bo->html_text ($journal_entry['comment']);
+ $this->html_table_col_end ();
+ }
+
+ $this->html_table_end ();
+ $GLOBALS['phpgw']->common->phpgw_footer ();
+ $GLOBALS['phpgw']->common->phpgw_exit ();
+ }
+ else
+ {
+ echo lang('No version history for this file/directory');
+ }
+
+ }
+
+ }
+
+ function view()
+ {
+
+ if ($this->file)
+ {
+ $ls_array = $this->bo->vfs->ls (array (
+ 'string' => $this->path.'/'.$this->file,
+ 'relatives' => array (RELATIVE_ALL),
+ 'checksubdirs' => False,
+ 'nofiles' => True
+ ));
+
+ if ($ls_array[0]['mime_type'])
+ {
+ $mime_type = $ls_array[0]['mime_type'];
+ }
+ elseif ($this->prefs['viewtextplain'])
+ {
+ $mime_type = 'text/plain';
+ }
+
+ header('Content-type: ' . $mime_type);
+ echo $this->bo->vfs->read (array (
+ 'string' => $this->path.'/'.$this->file,
+ 'relatives' => array (RELATIVE_NONE)
+ ));
+ $GLOBALS['phpgw']->common->phpgw_exit ();
+ }
+ }
+
+ function download()
+ {
for ($i = 0; $i != $this->numoffiles; $i++)
{
- if($this->fileman[$i]) $value='value="'.$this->fileman[$i].'"';
- $vars[filemans_hidden]=' ';
+ if (!$this->fileman[$i])
+ {
+ continue;
+ }
+ $download_browser = CreateObject ('phpgwapi.browser');
+ $download_browser->content_header ($this->fileman[$i]);
+ echo $this->bo->vfs->read (array ('string' => $this->fileman[$i]));
+ $GLOBALS['phpgw']->common->phpgw_exit ();
}
-
- $vars[file_content]=$content;
-
-
- $vars[buttonPreview]=$this->inputImage('edit_preview','edit_preview',lang('Preview %1', $this->bo->html_encode ($this->fileman[$j], 1)));
- $vars[buttonSave]=$this->inputImage('edit_save','save',lang('Save %1', $this->bo->html_encode ($this->fileman[$j], 1)));
- $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)));
- $vars[buttonCancel]=$this->inputImage('edit_cancel','cancel',lang('Cancel editing %1 without saving', $this->bo->html_encode ($this->fileman[$j], 1)));
- $this->t->set_var($vars);
- $this->t->parse('rows','row');
- $this->t->pparse('out','row');
-
}
- }
- }
-
-
- function history()
- {
- if ($this->file)
- {
- $journal_array = $this->bo->vfs->get_journal (array (
- 'string' => $this->file,
- 'relatives' => array (RELATIVE_ALL)
- ));
-
- if (is_array ($journal_array))
+ //give back an array with all directories except current and dirs that are not accessable
+ function all_other_directories_options()
{
- $this->html_table_begin ();
- $this->html_table_row_begin ();
- $this->html_table_col_begin ();
- echo lang('Date');
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- echolang('Version');
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- echo lang('Who');
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- echo lang('Operation');
- $this->html_table_col_end ();
- $this->html_table_row_end ();
+ # First we get the directories in their home directory
+ $dirs = array ();
+ $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $GLOBALS['userinfo']['account_lid']);
- while (list ($num, $journal_entry) = each ($journal_array))
+ $tmp_arr=array (
+ 'string' => $GLOBALS['homedir'],
+ 'relatives' => array (RELATIVE_NONE),
+ 'checksubdirs' => True,
+ 'mime_type' => 'Directory'
+ );
+
+ $ls_array = $this->bo->vfs->ls ($tmp_arr);
+
+ while (list ($num, $dir) = each ($ls_array))
{
- $this->html_table_row_begin ();
- $this->html_table_col_begin ();
- $this->bo->html_text ($journal_entry['created'] . ' ');
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- $this->bo->html_text ($journal_entry['version'] . ' ' );
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- $this->bo->html_text ($GLOBALS['phpgw']->accounts->id2name ($journal_entry['owner_id']) . ' ');
- $this->html_table_col_end ();
- $this->html_table_col_begin ();
- $this->bo->html_text ($journal_entry['comment']);
- $this->html_table_col_end ();
+ $dirs[] = $dir;
}
- $this->html_table_end ();
- $GLOBALS['phpgw']->common->phpgw_footer ();
- $GLOBALS['phpgw']->common->phpgw_exit ();
+
+ # Then we get the directories in their readable groups' home directories
+ reset ($this->readable_groups);
+ while (list ($num, $group_array) = each ($this->readable_groups))
+ {
+ # Don't list directories for groups that don't have access
+ if (!$this->groups_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
+ {
+ continue;
+ }
+
+ $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $group_array['account_name']);
+
+ $tmp_arr=array (
+ 'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
+ 'relatives' => array (RELATIVE_NONE),
+ 'checksubdirs' => True,
+ 'mime_type' => 'Directory'
+ );
+
+ $ls_array = $this->bo->vfs->ls ($tmp_arr);
+ while (list ($num, $dir) = each ($ls_array))
+ {
+ $dirs[] = $dir;
+ }
+ }
+
+ reset ($dirs);
+ while (list ($num, $dir) = each ($dirs))
+ {
+ if (!$dir['directory'])
+ {
+ continue;
+ }
+
+ # So we don't display //
+ if ($dir['directory'] != '/')
+ {
+ $dir['directory'] .= '/';
+ }
+
+ # No point in displaying the current directory, or a directory that doesn't exist
+ if ((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists (array ( 'string' => $dir['directory'] . $dir['name'], 'relatives' => array (RELATIVE_NONE) )) )
+ {
+ //FIXME replace the html_form_option function
+ $options.=$this->html_form_option ($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
+ }
+ }
+
+ return $options;
}
- else
+
+
+ /* seek icon for mimetype else return an unknown icon */
+ function mime_icon($mime_type, $size=16)
{
- echo lang('No version history for this file/directory');
+ if(!$mime_type) $mime_type='unknown';
+
+ $mime_type= str_replace ('/','_',$mime_type);
+
+ $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_'.strtolower($mime_type));
+ if(!$img) $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_unknown');
+
+ $icon=' ';
+ return $icon;
}
- }
-
- }
-
- function view()
- {
-
- if ($this->file)
- {
- $ls_array = $this->bo->vfs->ls (array (
- 'string' => $this->path.'/'.$this->file,
- 'relatives' => array (RELATIVE_ALL),
- 'checksubdirs' => False,
- 'nofiles' => True
- ));
-
- if ($ls_array[0]['mime_type'])
+ function buttonImage($link,$img='',$help='')
{
- $mime_type = $ls_array[0]['mime_type'];
+
+ $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
+
+ if($img)
+ {
+ return '
+
+ ';
+ }
}
- elseif ($this->prefs['viewtextplain'])
+
+ function inputImage($name,$img='',$help='')
{
- $mime_type = 'text/plain';
+ $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
+
+ if($img)
+ {
+ return '
+
+ ';
+ }
+
+
}
- header('Content-type: ' . $mime_type);
- echo $this->bo->vfs->read (array (
- 'string' => $this->path.'/'.$this->file,
- 'relatives' => array (RELATIVE_NONE)
- ));
- $GLOBALS['phpgw']->common->phpgw_exit ();
- }
- }
-
- function download()
- {
- for ($i = 0; $i != $this->numoffiles; $i++)
- {
- if (!$this->fileman[$i])
+ function html_form_input ($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1)
{
- continue;
+ $text = ' ';
+ if ($type != NULL && $type)
+ {
+ if ($type == 'checkbox')
+ {
+ $value = $this->bo->string_encode ($value, 1);
+ }
+ $text .= 'type="'.$type.'" ';
+ }
+ if ($name != NULL && $name)
+ {
+ $text .= 'name="'.$name.'" ';
+ }
+ if ($value != NULL && $value)
+ {
+ $text .= 'value="'.$value.'" ';
+ }
+ if (is_int ($maxlength) && $maxlength >= 0)
+ {
+ $text .= 'maxlength="'.$maxlength.'" ';
+ }
+ if (is_int ($size) && $size >= 0)
+ {
+ $text .= 'size="'.$size.'" ';
+ }
+ if ($checked != NULL && $checked)
+ {
+ $text .= 'checked ';
+ }
+
+ return ' ';
}
- $download_browser = CreateObject ('phpgwapi.browser');
- $download_browser->content_header ($this->fileman[$i]);
- echo $this->bo->vfs->read (array ('string' => $this->fileman[$i]));
- $GLOBALS['phpgw']->common->phpgw_exit ();
- }
- }
-
- //give back an array with all directories except current and dirs that are not accessable
- function all_other_directories_options()
- {
- # First we get the directories in their home directory
- $dirs = array ();
- $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $GLOBALS['userinfo']['account_lid']);
-
- $tmp_arr=array (
- 'string' => $GLOBALS['homedir'],
- 'relatives' => array (RELATIVE_NONE),
- 'checksubdirs' => True,
- 'mime_type' => 'Directory'
- );
-
- $ls_array = $this->bo->vfs->ls ($tmp_arr);
-
- while (list ($num, $dir) = each ($ls_array))
- {
- $dirs[] = $dir;
- }
-
-
- # Then we get the directories in their readable groups' home directories
- reset ($this->readable_groups);
- while (list ($num, $group_array) = each ($this->readable_groups))
- {
- # Don't list directories for groups that don't have access
- if (!$groups_applications[$group_array['account_name']][$GLOBALS['appname']]['enabled'])
+ function html_form_option ($value = NULL, $displayed = NULL, $selected = NULL, $return = 0)
{
- continue;
+ $text = ' ';
+ if ($value != NULL && $value)
+ {
+ $text .= ' value="'.$value.'" ';
+ }
+ if ($selected != NULL && $selected)
+ {
+ $text .= ' selected';
+ }
+ return ''.$displayed.' ';
}
- $dirs[] = array ('directory' => $GLOBALS['fakebase'], 'name' => $group_array['account_name']);
- $tmp_arr=array (
- 'string' => $GLOBALS['fakebase'].'/'.$group_array['account_name'],
- 'relatives' => array (RELATIVE_NONE),
- 'checksubdirs' => True,
- 'mime_type' => 'Directory'
- );
-
- $ls_array = $this->bo->vfs->ls ($tmp_arr);
- while (list ($num, $dir) = each ($ls_array))
- {
- $dirs[] = $dir;
- }
- }
-
- reset ($dirs);
- while (list ($num, $dir) = each ($dirs))
- {
- if (!$dir['directory'])
- {
- continue;
- }
-
- # So we don't display //
- if ($dir['directory'] != '/')
- {
- $dir['directory'] .= '/';
- }
-
- # No point in displaying the current directory, or a directory that doesn't exist
- if ((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists (array ( 'string' => $dir['directory'] . $dir['name'], 'relatives' => array (RELATIVE_NONE) )) )
- {
- //FIXME replace the html_form_option function
- $options.=$this->html_form_option ($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
- }
- }
-
- return $options;
- }
-
-
- /* seek icon for mimetype else return an unknown icon */
- function mime_icon($mime_type, $size=16)
- {
- if(!$mime_type) $mime_type='unknown';
-
- $mime_type= str_replace ('/','_',$mime_type);
-
- $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_'.strtolower($mime_type));
- if(!$img) $img=$GLOBALS['phpgw']->common->image('filemanager','mime'.$size.'_unknown');
-
- $icon=' ';
- return $icon;
- }
-
- function buttonImage($link,$img='',$help='')
- {
-
- $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
-
- if($img)
- {
- return '
-
- ';
- }
- }
-
- function inputImage($name,$img='',$help='')
- {
- $image=$GLOBALS['phpgw']->common->image('filemanager','button_'.strtolower($img));
-
- if($img)
- {
- return '
-
- ';
- }
-
-
- }
-
- function html_form_input ($type = NULL, $name = NULL, $value = NULL, $maxlength = NULL, $size = NULL, $checked = NULL, $string = '', $return = 1)
- {
- $text = ' ';
- if ($type != NULL && $type)
- {
- if ($type == 'checkbox')
- {
- $value = $this->bo->string_encode ($value, 1);
- }
- $text .= 'type="'.$type.'" ';
- }
- if ($name != NULL && $name)
- {
- $text .= 'name="'.$name.'" ';
- }
- if ($value != NULL && $value)
- {
- $text .= 'value="'.$value.'" ';
- }
- if (is_int ($maxlength) && $maxlength >= 0)
- {
- $text .= 'maxlength="'.$maxlength.'" ';
- }
- if (is_int ($size) && $size >= 0)
- {
- $text .= 'size="'.$size.'" ';
- }
- if ($checked != NULL && $checked)
- {
- $text .= 'checked ';
- }
-
- return ' ';
- }
-
- function html_form_option ($value = NULL, $displayed = NULL, $selected = NULL, $return = 0)
- {
- $text = ' ';
- if ($value != NULL && $value)
- {
- $text .= ' value="'.$value.'" ';
- }
- if ($selected != NULL && $selected)
- {
- $text .= ' selected';
- }
- return ''.$displayed.' ';
- }
-
-
- function encode_href($href = NULL, $args = NULL , $extra_args)
- {
- $href = $this->bo->string_encode ($href, 1);
- $all_args = $args.'&'.$this->bo->string_encode ($extra_args, 1);
-
- $address = $GLOBALS['phpgw']->link ($href, $all_args);
-
- return $address;
-
- }
-
- function html_link ($href = NULL, $args = NULL , $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL)
- {
- // unset($encode);
- if ($encode)
+ function encode_href($href = NULL, $args = NULL , $extra_args)
{
$href = $this->bo->string_encode ($href, 1);
$all_args = $args.'&'.$this->bo->string_encode ($extra_args, 1);
- }
- else
- {
- // $href = $this->bo->string_encode ($href, 1);
- $all_args = $args.'&'.$extra_args;
- }
- ###
- # This decodes / back to normal
- ###
- // $all_args = preg_replace ("/%2F/", "/", $all_args);
- // $href = preg_replace ("/%2F/", "/", $href);
-
-
- /* Auto-detect and don't disturb absolute links */
- if (!preg_match ("|^http(.{0,1})://|", $href))
- {
- //Only add an extra / if there isn't already one there
-
- // die(SEP);
- if (!($href[0] == SEP))
- {
- $href = SEP . $href;
- }
-
- /* $phpgw->link requires that the extra vars be passed separately */
- // $link_parts = explode ("?", $href);
$address = $GLOBALS['phpgw']->link ($href, $all_args);
- // $address = $GLOBALS['phpgw']->link ($href);
- }
- else
- {
- $address = $href;
+
+ return $address;
+
}
- /* If $linkonly is set, don't add any HTML */
- if ($linkonly)
+ function html_link ($href = NULL, $args = NULL , $extra_args, $text = NULL, $return = 1, $encode = 1, $linkonly = 0, $target = NULL)
{
- $rstring = $address;
- }
- else
- {
- if ($target)
+ // unset($encode);
+ if ($encode)
{
- $target = 'target='.$target;
+ $href = $this->bo->string_encode ($href, 1);
+ $all_args = $args.'&'.$this->bo->string_encode ($extra_args, 1);
+ }
+ else
+ {
+ // $href = $this->bo->string_encode ($href, 1);
+ $all_args = $args.'&'.$extra_args;
+
+ }
+ ###
+ # This decodes / back to normal
+ ###
+ // $all_args = preg_replace ("/%2F/", "/", $all_args);
+ // $href = preg_replace ("/%2F/", "/", $href);
+
+
+ /* Auto-detect and don't disturb absolute links */
+ if (!preg_match ("|^http(.{0,1})://|", $href))
+ {
+ //Only add an extra / if there isn't already one there
+
+ // die(SEP);
+ if (!($href[0] == SEP))
+ {
+ $href = SEP . $href;
+ }
+
+ /* $phpgw->link requires that the extra vars be passed separately */
+ // $link_parts = explode ("?", $href);
+ $address = $GLOBALS['phpgw']->link ($href, $all_args);
+ // $address = $GLOBALS['phpgw']->link ($href);
+ }
+ else
+ {
+ $address = $href;
}
- $text = trim ($text);
- $rstring = ''.$text.' ';
+ /* If $linkonly is set, don't add any HTML */
+ if ($linkonly)
+ {
+ $rstring = $address;
+ }
+ else
+ {
+ if ($target)
+ {
+ $target = 'target='.$target;
+ }
+
+ $text = trim ($text);
+ $rstring = ''.$text.' ';
+ }
+
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+ function html_table_begin ($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0)
+ {
+ if ($width != NULL && $width)
+ $width = "width=$width";
+ if (is_int ($border) && $border >= 0)
+ $border = "border=$border";
+ if (is_int ($cellspacing) && $cellspacing >= 0)
+ $cellspacing = "cellspacing=$cellspacing";
+ if (is_int ($cellpadding) && $cellpadding >= 0)
+ $cellpadding = "cellpadding=$cellpadding";
+ if ($rules != NULL && $rules)
+ $rules = "rules=$rules";
+
+ $rstring = "";
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+
+ function html_table_end ($return = 0)
+ {
+ $rstring = "
";
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+ function html_table_row_begin ($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0)
+ {
+ if ($align != NULL && $align)
+ $align = "align=$align";
+ if ($halign != NULL && $halign)
+ $halign = "halign=$halign";
+ if ($valign != NULL && $valign)
+ $valign = "valign=$valign";
+ if ($bgcolor != NULL && $bgcolor)
+ $bgcolor = "bgcolor=$bgcolor";
+ $rstring = "";
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+ function html_table_row_end ($return = 0)
+ {
+ $rstring = " ";
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+ function html_table_col_begin ($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0)
+ {
+ if ($align != NULL && $align)
+ $align = "align=$align";
+ if ($halign != NULL && $halign)
+ $halign = "halign=$halign";
+ if ($valign != NULL && $valign)
+ $valign = "valign=$valign";
+ if (is_int ($rowspan) && $rowspan >= 0)
+ $rowspan = "rowspan=$rowspan";
+ if (is_int ($colspan) && $colspan >= 0)
+ $colspan = "colspan=$colspan";
+
+ $rstring = "";
+ return ($this->bo->eor ($rstring, $return));
+ }
+
+ function html_table_col_end ($return = 0)
+ {
+ $rstring = " ";
+ return ($this->bo->eor ($rstring, $return));
}
- return ($this->bo->eor ($rstring, $return));
}
-
- function html_table_begin ($width = NULL, $border = NULL, $cellspacing = NULL, $cellpadding = NULL, $rules = NULL, $string = '', $return = 0)
- {
- if ($width != NULL && $width)
- $width = "width=$width";
- if (is_int ($border) && $border >= 0)
- $border = "border=$border";
- if (is_int ($cellspacing) && $cellspacing >= 0)
- $cellspacing = "cellspacing=$cellspacing";
- if (is_int ($cellpadding) && $cellpadding >= 0)
- $cellpadding = "cellpadding=$cellpadding";
- if ($rules != NULL && $rules)
- $rules = "rules=$rules";
-
- $rstring = "";
- return ($this->bo->eor ($rstring, $return));
- }
-
-
- function html_table_end ($return = 0)
- {
- $rstring = "
";
- return ($this->bo->eor ($rstring, $return));
- }
-
- function html_table_row_begin ($align = NULL, $halign = NULL, $valign = NULL, $bgcolor = NULL, $string = '', $return = 0)
- {
- if ($align != NULL && $align)
- $align = "align=$align";
- if ($halign != NULL && $halign)
- $halign = "halign=$halign";
- if ($valign != NULL && $valign)
- $valign = "valign=$valign";
- if ($bgcolor != NULL && $bgcolor)
- $bgcolor = "bgcolor=$bgcolor";
- $rstring = "";
- return ($this->bo->eor ($rstring, $return));
- }
-
- function html_table_row_end ($return = 0)
- {
- $rstring = " ";
- return ($this->bo->eor ($rstring, $return));
- }
-
- function html_table_col_begin ($align = NULL, $halign = NULL, $valign = NULL, $rowspan = NULL, $colspan = NULL, $string = '', $return = 0)
- {
- if ($align != NULL && $align)
- $align = "align=$align";
- if ($halign != NULL && $halign)
- $halign = "halign=$halign";
- if ($valign != NULL && $valign)
- $valign = "valign=$valign";
- if (is_int ($rowspan) && $rowspan >= 0)
- $rowspan = "rowspan=$rowspan";
- if (is_int ($colspan) && $colspan >= 0)
- $colspan = "colspan=$colspan";
-
- $rstring = "";
- return ($this->bo->eor ($rstring, $return));
- }
-
- function html_table_col_end ($return = 0)
- {
- $rstring = " ";
- return ($this->bo->eor ($rstring, $return));
- }
-
- }
diff --git a/filemanager/inc/hook_sidebox_menu.inc.php b/filemanager/inc/hook_sidebox_menu.inc.php
new file mode 100755
index 0000000000..dc9671dda9
--- /dev/null
+++ b/filemanager/inc/hook_sidebox_menu.inc.php
@@ -0,0 +1,33 @@
+ *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
+
+ /* $Id$ */
+{
+
+ /*
+ This hookfile is for generating an app-specific side menu used in the idots
+ template set.
+
+ $menu_title speaks for itself
+ $file is the array with link to app functions
+
+ display_sidebox can be called as much as you like
+ */
+
+ $menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
+ $file = Array(
+ array('','text'=>'Filemanager Preferences','link'=>$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=filemanager')),
+ );
+ display_sidebox($appname,$menu_title,$file);
+
+}
+?>
diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php
index 18a3925509..7e2a95d817 100755
--- a/filemanager/setup/setup.inc.php
+++ b/filemanager/setup/setup.inc.php
@@ -24,6 +24,7 @@
'admin',
'deleteaccount',
'settings',
+ 'sidebox_menu',
'preferences'
);
diff --git a/filemanager/templates/default/filelisting.tpl b/filemanager/templates/default/filelisting.tpl
index 145bbfcb89..1741d3707e 100644
--- a/filemanager/templates/default/filelisting.tpl
+++ b/filemanager/templates/default/filelisting.tpl
@@ -1,25 +1,23 @@
-