[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] filemanager index.php inc/class.bofilemanager.i...
From: |
Caeies |
Subject: |
[Phpgroupware-cvs] filemanager index.php inc/class.bofilemanager.i... |
Date: |
Wed, 29 Nov 2006 15:32:21 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: filemanager
Changes by: Caeies <Caeies> 06/11/29 15:32:21
Modified files:
. : index.php
inc : class.bofilemanager.inc.php
class.uiaction_base.inc.php
class.uiaction_edit.inc.php
class.uifilemanager.inc.php
templates/base : app_data.xsl widgets.xsl
Added files:
templates/base/css: base.css
templates/base/images: first-grey.png last-grey.png
left-grey.png right-grey.png version.png
Log message:
bugfix for links, for appname not set, and E_ALL; add the history file
browsing to help with svn ... should be useable by evry vfs using the right
function (see phpgwapi/inc/class.vfs*) & history
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/filemanager/index.php?cvsroot=phpgroupware&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/filemanager/inc/class.bofilemanager.inc.php?cvsroot=phpgroupware&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/filemanager/inc/class.uiaction_base.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/filemanager/inc/class.uiaction_edit.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/filemanager/inc/class.uifilemanager.inc.php?cvsroot=phpgroupware&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/app_data.xsl?cvsroot=phpgroupware&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/widgets.xsl?cvsroot=phpgroupware&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/css/base.css?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/images/first-grey.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/images/last-grey.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/images/left-grey.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/images/right-grey.png?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/filemanager/templates/base/images/version.png?cvsroot=phpgroupware&rev=1.1
Patches:
Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/index.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- index.php 28 Apr 2005 20:45:53 -0000 1.45
+++ index.php 29 Nov 2006 15:32:21 -0000 1.46
@@ -5,7 +5,7 @@
* @copyright Copyright (C) 2002-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package filemanager
- * @version $Id: index.php,v 1.45 2005/04/28 20:45:53 powerstat Exp $
+ * @version $Id: index.php,v 1.46 2006/11/29 15:32:21 Caeies Exp $
*/
$GLOBALS['phpgw_info']['flags'] = array
@@ -20,6 +20,6 @@
*/
include('../header.inc.php');
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=filemanager.uifilemanager.index');
+ $GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' =>
'filemanager.uifilemanager.index'));
$GLOBALS['phpgw']->common->phpgw_exit();
?>
Index: inc/class.bofilemanager.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/inc/class.bofilemanager.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- inc/class.bofilemanager.inc.php 30 Aug 2006 13:17:40 -0000 1.30
+++ inc/class.bofilemanager.inc.php 29 Nov 2006 15:32:21 -0000 1.31
@@ -8,7 +8,7 @@
* @copyright Portions Copyright (C) 2000-2005 Free Software
Foundation, Inc http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package filemanager
- * @version $Id: class.bofilemanager.inc.php,v 1.30 2006/08/30 13:17:40
skwashd Exp $
+ * @version $Id: class.bofilemanager.inc.php,v 1.31 2006/11/29 15:32:21
Caeies Exp $
* @internal Based on phpWebhosting
*/
@@ -43,8 +43,20 @@
var $changes = array();
var $upload_comment = array();
var $upload_file = array();
+ var $filehis = array();
var $file;
var $path;
+ var $vers;
+ var $mime_type;
+ var $from_rev;
+ var $to_rev;
+ var $collapse;
+ var $page=1;
+ var $pages=0;
+ var $svnpath;
+ var $history_path;
+ var $history_file;
+ var $list_elements=array();
var $dispsep;
var $sortby = 'name';
@@ -57,6 +69,8 @@
var $quota = 0;
var $command_line;
+ var $go = false;
+
//var $debug = true;
var $debug = false;
@@ -94,7 +108,17 @@
'createfile',
'createdir',
'params',
- 'command_line'
+ 'command_line',
+ 'vers',
+ 'mime_type',
+ 'from_rev',
+ 'to_rev',
+ 'collapse',
+ 'filehis',
+ 'page',
+ 'pages',
+ 'history_path',
+ 'history_file'
);
foreach ( $to_decode as $decode_me )
@@ -111,12 +135,27 @@
$this->read_sessiondata('fileman');
}
- //_debug_array($this->fileman);
+ if(count($this->filehis))
+ {
+
$this->save_sessiondata($this->filehis,'filehis');
+ }
+ else
+ {
+ $this->read_sessiondata('filehis');
+ }
+
+ if($this->page > 1 || (!isset($this->params['next']) &&
!isset($this->params['prev']) && !isset($this->params['compare']) &&
!isset($this->params['last'])))
+ {
+ $this->save_page($this->page,$this->pages);
+ }
+ else if(isset($this->params['next']) ||
isset($this->params['prev']) || isset($this->params['compare']) ||
isset($this->params['last']))
+ {
+ $this->read_page();
+ }
$this->basedir = $GLOBALS['phpgw']->vfs->basedir;
$this->fakebase = $GLOBALS['phpgw']->vfs->fakebase;
- $this->settings =
$GLOBALS['phpgw_info']['user']['preferences']['filemanager'];
-
+ $this->settings =
isset($GLOBALS['phpgw_info']['user']['preferences']['filemanager']) ?
$GLOBALS['phpgw_info']['user']['preferences']['filemanager'] : array();
if(stristr($this->basedir,PHPGW_SERVER_ROOT))
{
$this->filesdir =
substr($this->basedir,strlen(PHPGW_SERVER_ROOT));
@@ -125,6 +164,8 @@
{
$this->filesdir = '';
}
+
+ $this->svnpath =
isset($GLOBALS['phpgw_info']['server']['svn_dir']) ?
$GLOBALS['phpgw_info']['server']['svn_dir'] : '';
$this->hostname =
$GLOBALS['phpgw_info']['server']['webserver_url'].$this->filesdir;
$this->userinfo['account_id'] =
$GLOBALS['phpgw_info']['user']['account_id'];
$this->userinfo['account_lid'] =
$GLOBALS['phpgw_info']['user']['account_lid'];
@@ -155,8 +196,7 @@
$this->upload_boxes = array(1,5,10,15,20,25,30);
- $this->show_upload_boxes =
$GLOBALS['phpgw_info']['user']['preferences']['filemanager']['show_upload_boxes']?
-
$GLOBALS['phpgw_info']['user']['preferences']['filemanager']['show_upload_boxes']:5;
+ $this->show_upload_boxes =
isset($this->settings['show_upload_boxes']) ?
$this->settings['show_upload_boxes'] : 5 ;
if($this->go)
{
$this->path = $this->todir;
@@ -204,6 +244,10 @@
$this->lesspath = '/';
}
+ if (!($this->historylesspath =
substr($this->history_path,0,strrpos($this->history_path, '/'))))
+ {
+ $this->historylesspath = '/';
+ }
if(substr($this->path,0,strlen($this->homedir)) ==
$this->homedir)
{
$this->homestr = True;
@@ -239,28 +283,25 @@
{
$groups = array();
}
- //_debug_array($groups);
/*
Don't list directories for groups that don't have
access
*/
-
- for($i=0;$i<count($groups);++$i)
+ foreach($groups as $idx => $group)
{
- if
($GLOBALS['phpgw']->vfs->acl_check(array('owner_id' =>
$groups[$i]['account_id'],'operation' => PHPGW_ACL_READ)))
+ if
($GLOBALS['phpgw']->vfs->acl_check(array('owner_id' =>
$group['account_id'],'operation' => PHPGW_ACL_READ)))
{
- $applications =&
CreateObject('phpgwapi.applications', $groups[$i]['account_id']);
+ $applications =
CreateObject('phpgwapi.applications', $group['account_id']);
$apps =
$applications->read_account_specific();
- //_debug_array($apps);
if(!$apps['filemanager'])
{
- unset($groups[$i]);
+ unset($groups[$idx]);
}
unset($applications);
}
else
{
- unset($groups[$i]);
+ unset($groups[$idx]);
}
}
reset($groups);
@@ -280,6 +321,7 @@
$GLOBALS['phpgw']->vfs->working_id =
$this->userinfo['account_id'];
}
+ //XXX Caeies: well, doing this when the path doesn't
exist, is ... problematic at least for DAV ...
if ($GLOBALS['phpgw']->vfs->acl_check(array('string' =>
$this->path,'relatives' => array (RELATIVE_NONE),'operation' => PHPGW_ACL_ADD)))
{
$this->access_add = true;
@@ -312,7 +354,7 @@
echo "<!-- {$name} = {$var} -->\n";
}
- if(is_array($this->$name) && $var)
+ if(isset($this->$name) && is_array($this->$name) &&
$var)
{
//_debug_array($var);
@@ -341,6 +383,25 @@
}
}
+ function save_page($page=0,$pages=0)
+ {
+ $this->page=$page;
+ $this->pages=$pages;
+ $data = array
+ (
+ 'page' => serialize($this->page),
+ 'pages' => serialize($this->pages),
+ );
+
$GLOBALS['phpgw']->session->appsession('session_data','filemanager_page',$data);
+ }
+
+ function read_page()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','filemanager_page');
+ $this->pages=unserialize($data['pages']);
+ $this->page=unserialize($data['page']);
+ }
+
function save_sessiondata($values = 0,$type = 'changes')
{
if(is_array($values))
@@ -350,6 +411,9 @@
case 'fileman':
$this->fileman = $values;
break;
+ case 'filehis':
+ $this->filehis=$values;
+ break;
default:
$this->changes = $values;
}
@@ -357,17 +421,25 @@
$data = array
(
'fileman' => serialize($this->fileman),
+ 'filehis' =>
serialize($this->filehis),
'changes' => serialize($this->changes)
);
$GLOBALS['phpgw']->session->appsession('session_data','filemanager',$data);
}
- function read_sessiondata()
+ function read_sessiondata($type='fileman')
{
$data =
$GLOBALS['phpgw']->session->appsession('session_data','filemanager');
- $this->fileman = unserialize($data['fileman']);
- $this->changes = unserialize($data['changes']);
+ switch($type)
+ {
+ case 'fileman':
+ $this->fileman =
!empty($data['fileman']) ? unserialize($data['fileman']) : '';
+ $this->changes =
!empty($data['changes']) ? unserialize($data['changes']) : '';
+ break;
+ default:
+ $this->filehis =
!empty($data['filehis']) ? unserialize($data['filehis']) : '';
+ }
}
function get_fileman()
@@ -392,7 +464,7 @@
If their home directory doesn't exist, we create it
Same for group directories
*/
-
+ $error = '';
if($this->debug)
{
echo 'DEBUG: bo.create_home_dir: PATH =
'.$this->path.'<br>'."\n";
@@ -407,7 +479,7 @@
{
$error = lang('failed to create
directory %1',$this->homedir);
}
- //$GLOBALS['phpgw']->vfs->override_acl = 0;
+ $GLOBALS['phpgw']->vfs->override_acl = 0;
}
elseif(preg_match("|^{$this->fakebase}\/(.*)$|U",
$this->path, $this->matches))
{
@@ -446,14 +518,20 @@
}
}
- function load_files()
+ function load_files($history=False)
{
/*
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
*/
- if ($this->path == $this->fakebase)
+ if($history && $this->history_file)
+ {
+
$this->historylesspath=$this->history_path;
+
$this->history_path=$this->history_path.$this->dispsep.$this->history_file;
+ }
+
+ if (($this->path == $this->fakebase && !$history) ||
$this->history_path == $this->fakebase)
{
//echo 'path: ' . $this->path . "\n";
//echo 'fake: ' . $this->fakebase;
@@ -462,24 +540,31 @@
{
$GLOBALS['phpgw']->vfs->mkdir(array('string' => $this->homedir,'relatives' =>
array(RELATIVE_NONE)));
}
-
- $ls_array = $GLOBALS['phpgw']->vfs->ls(array(
+ $data = array(
'string' =>
$this->homedir,
'relatives'
=>Array(RELATIVE_NONE),
'checksubdirs' => False,
'nofiles' => True
- ));
- $this->files_array[] = $ls_array[0];
+ );
+ if($history)
+ {
+ $data['rev'] = $this->vers;
+ }
+ $ls_array = $GLOBALS['phpgw']->vfs->ls($data);
+ $this->files_array[] = $ls_array[0];
foreach ( $this->memberships as $group_array )
{
if (
!$GLOBALS['phpgw']->vfs->file_exists(array('string' =>
"{$this->fakebase}/{$group_array['account_name']}", 'relatives' =>
array(RELATIVE_NONE) ) ) )
{
-
$GLOBALS['phpgw']->vfs->mkdir(array
+ //We want to create it, so
overide acl :
+
$GLOBALS['phpgw']->vfs->override_acl=true;
+
if($GLOBALS['phpgw']->vfs->mkdir(array
(
'string'
=> "{$this->fakebase}/{$group_array['account_name']}",
'relatives'
=> array(RELATIVE_NONE)
- ));
+ )))
+ {
$GLOBALS['phpgw']->vfs->set_attributes(array
(
@@ -488,14 +573,20 @@
'attributes'=>
array('owner_id' => $group_array['account_id'], 'createdby_id' =>
$group_array['account_id'])
));
}
-
- $ls_array =
$GLOBALS['phpgw']->vfs->ls(array
+
$GLOBALS['phpgw']->vfs->override_acl=false;
+ }
+ $data= array
(
'string'
=> "{$this->fakebase}/{$group_array['account_name']}",
'relatives' =>
array(RELATIVE_NONE),
'checksubdirs' =>
false,
'nofiles'
=> true
- ));
+ );
+ if($history)
+ {
+ $data['rev']=$this->vers;
+ }
+ $ls_array =
$GLOBALS['phpgw']->vfs->ls($data);
$this->files_array[] = $ls_array[0];
}
}
@@ -503,16 +594,22 @@
{
//echo 'path: ' . $this->path . "\n";
//echo 'fake: ' . $this->fakebase;
-
- $ls_array = $GLOBALS['phpgw']->vfs->ls(array
+ $data=array
(
'string' =>
$this->path,
+ 'rev'
=> $this->vers,
'relatives' =>
array(RELATIVE_NONE),
'checksubdirs' => false,
- 'orderby' =>
$this->sortby
- ));
- //echo '<pre>' . print_r($ls_array, true) .
'</pre>';
+ 'orderby'
=>$this->sortby
+ );
+ if($history)
+ {
+ $data['rev'] = $this->vers;
+ $data['string'] = $this->history_path;
+ }
+ $ls_array = $GLOBALS['phpgw']->vfs->ls($data);
+ //echo '<pre>' . print_r($ls_array, true) .
'</pre>';
if ($this->debug)
{
echo "# of files found in
'{$this->path}' : " . count($ls_array) . "<br>\n";
@@ -527,7 +624,7 @@
}
}
}
- if(!is_array($this->files_array))
+ if(!isset($this->files_array) ||
!is_array($this->files_array))
{
$this->files_array = array();
}
@@ -653,7 +750,7 @@
{
if($this->fileman[$i])
{
-
if(!$this->get_quota($this->fileman[$i]))
+
if(!$this->check_quota($this->fileman[$i]))
{
$result[] = lang('Could not
copy %1 to %2 quota
exceeded',$this->todir.SEP.$this->fileman[$i],$this->path.SEP.$this->fileman[$i]);
}
@@ -746,9 +843,9 @@
'checksubdirs' => False,
'nofiles' => True));
- $fileinfo = $ls_array[0];
+ $fileinfo = (is_array($ls_array) &&
isset($ls_array[0])) ? $ls_array[0] : array();
- if ($fileinfo['name'])
+ if (is_array($fileinfo) &&
isset($fileinfo['name']))
{
if ($fileinfo['mime_type'] !=
'Directory')
{
@@ -781,6 +878,7 @@
{
//echo "newfile: ".$this->params['newfile'] ."
createfile: ".$this->createfile;
//die();
+ $result = array();
if ($this->params['newfile'] && $this->createfile)
{
if($badchar =
$this->bad_chars($this->createfile,True,True))
@@ -806,7 +904,7 @@
{
$result[] = lang('filename not provided');
}
- return is_array($result)?$result:True;
+ return count($result)?$result:True;
}
function f_upload()
@@ -915,7 +1013,7 @@
/**TODO : xslt-ise this */
function build_help($help_option,$text = '')
{
- if($this->settings['show_help'])
+ if(isset($this->settings['show_help']))
{
$link =
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'filemanager.uiaction_base.help','help_name' => urlencode($help_option)));
@@ -1019,6 +1117,7 @@
*/
function bad_chars($string,$all = True,$return = 0)
{
+ $rstring = '';
if($all)
{
if (preg_match("-([\\/<>\'\"\&])-", $string,
$badchars))
@@ -1146,7 +1245,7 @@
'checksubdirs' => True,
'relatives' =>
array (RELATIVE_NONE)));
}
- elseif($files['mime_type']=='Directory')
+ elseif(isset($files['mime_type']) &&
$files['mime_type']=='Directory')
{
$size = $GLOBALS['phpgw']->vfs->get_size(array(
'string' =>
$files['directory'] . '/' . $files['name'],
@@ -1165,7 +1264,7 @@
function check_quota($file)
{
- $homedir = $this->get_size($this->homedir, True);
+ $size_homedir = $this->get_size($this->homedir, True);
$size_file = $this->get_size(array('directory' =>
$this->path, 'name' => $file),False);
if($this->quota == -1)
@@ -1204,15 +1303,184 @@
{
/* Update if they request it, or one out of 20 page
loads */
srand((double)microtime() * 1000000);
- if($this->params['update'] || rand(0,19) == 4)
+ if((isset($this->params['update']) &&
$this->params['update']) || rand(0,19) == 4)
{
- $dir_files = $this->get_dirfiles();
- $sql_files = $this->get_sqlfiles();
- $this->sync_files($dir_files,$sql_files);
+ /*
+ * CAEIES VERY ANGRY : SEE BELOW
+ * $dir_files = $this->get_dirfiles();
+ * $sql_files = $this->get_sqlfiles();
+ * $this->sync_files($dir_files,$sql_files);
+ */
$GLOBALS['phpgw']->vfs->update_real(array('string' => $this->path,'relatives'
=> array(RELATIVE_NONE)));
}
}
+ function f_compare()
+ {
+
$file=$this->basedir.$this->path.$this->dispsep.$this->file;
+ $path=array();
+ $table=array();
+ if(count($this->filehis)>1)
+ {
+ if($this->filehis[0]> $this->filehis[1])
+ {
+ $temp=$this->filehis[0];
+
$this->filehis[0]=$this->filehis[1];
+ $this->filehis[1]=$temp;
+ }
+ }
+ else
+ {
+ return array();
+ }
+
+ for($i=0;$i<count($this->filehis);++$i)
+ {
+ if($this->filehis[$i])
+ {
+ $path[$i]=$file."@".$this->filehis[$i];
+ }
+ }
+ if(isset($this->svnpath) && !empty($this->svnpath))
+ {
+ $cmd=$this->svnpath." diff --non-interactive
".$path[0] ." ".$path[1];
+ }
+ else
+ {
+ $cmd="svn diff --non-interactive ".$path[0]."
".$path[1];
+ }
+ $diff=popen($cmd,"r");
+ $indiffproper = false;
+ $indiff = false;
+ $getLine = true;
+ $node = null;
+ $table_rows=array();
+ while (!feof($diff))
+ {
+ if ($getLine)
+ {
+ $line = fgets($diff);
+ }
+ $getLine = true;
+ if ($indiff)
+ {
+ if ($indiffproper)
+ {
+ $var = array();
+ if ($line[0] == " " || $line[0]
== "+" || $line[0] == "-" || $line[0] == "\\")
+ {
+ $subline='';
+ switch ($line[0])
+ {
+ case "\\":
+ break;
+ case " ":
+
$subline = htmlentities(rtrim(substr($line, 1)));
+ $var[]
= array('widget' => array('type' => 'label','caption'
=>$subline),'class'=>'diff');
+ break;
+ case "+":
+
$subline = htmlentities(rtrim(substr($line, 1)));
+ $var[]
= array('widget' => array('type' => 'label','caption'
=>$subline),'class'=>'diffadded');
+ break;
+ case "-":
+
$subline = htmlentities(rtrim(substr($line, 1)));
+ $var[]
= array('widget' => array('type' => 'label','caption'
=>$subline),'class'=>'diffdeleted');
+ break;
+ }
+ if(!empty($subline))
+ {
+ $table_rows[] =
array('table_col' => $var);
+ }
+ continue;
+ }
+ else
+ {
+ $indiffproper = false;
+ $table[] =
array('tablediff' => array('table_row' => $table_rows),'class' => 'diff');
+ unset($table_rows);
+ $getLine = false;
+ continue;
+ }
+ }//end indiffproper
+ // Check for the start of a new diff
area
+ if (!strncmp($line, "@@", 2))
+ {
+ $pos = strpos($line, "+");
+ $posline = substr($line, $pos);
+ $var=array();
+ sscanf($posline, "+%d,%d",
$sline, $eline);
+ // Check that this isn't a file
deletion
+ if ($sline == 0 && $eline == 0)
+ {
+ $line = fgets($diff);
+ //ignoring this line
+ while ($line[0] == " "
|| $line[0] == "+" || $line[0] == "-")
+ {
+ $line =
fgets($diff);
+ }
+ $getLine = false;
+ $var[] = array('widget'
=> array('type' => 'label','caption' =>lang('File deleted')));
+ }
+ else
+ {
+ $var[] = array('widget'
=> array('type' => 'label','caption' =>$line));
+ $indiffproper = true;
+ }
+ $table_rows[] =
array('table_col' => $var);
+ $table[] = array('tablediff' =>
array('table_row' => $table_rows));
+ unset($var);
+ unset($table_rows);
+ continue;
+ }
+ else
+ {
+ $indiff = false;
+ }
+ }
+ // Check for a new node entry
+ if (strncmp(trim($line), "Index: ", 7) == 0)
+ {
+ // End the current node
+ $var=array();
+ $node = trim($line);
+ $node = substr($node, 7);
+ $var[] = array('widget' => array('type'
=> 'label','caption' => $node),'class' => 'newpath');
+ $table_rows[] = array('table_col' =>
$var);
+ unset($var);
+ $line = fgets($diff);
+ // Check for a file addition
+ $line = fgets($diff);
+ if (strpos($line, "(revision 0)"))
+ {
+ $var[] = array('widget' =>
array('type' => 'label','caption' => lang('File added')));
+ $table_rows[] =
array('table_col' => $var);
+ unset($var);
+ }
+ if (strncmp(trim($line), "Cannot
display:", 15) == 0)
+ {
+ $var[] = array('widget' =>
array('type' => 'label','caption' => $line));
+ $table_rows[] =
array('table_col' => $var);
+ unset($var);
+ continue;
+ }
+ // Skip second file info
+ $line = fgets($diff);
+ $indiff = true;
+ $table_rows[] = array('table_col' =>
isset($var) ? $var : array());
+ $table[] = array('tablediff' =>
array('table_row' => $table_rows));
+ unset($table_rows);
+ continue;
+ }
+ }
+ $this->list_elements=$table;
+ }
+
+ /*
+ * CAEIES VERY ANGRY
+ * That's a pure non - sense
+ * - First : what happens If we are using DAV and not SQL ??? =>
all files erased on a rand() ...
+ * - Second : vfs->update_real should do this work : if it
doesn't work, correct it !!!!
+
function get_dirfiles($basedir = '')
{
if($basedir = '')
@@ -1272,5 +1540,6 @@
}
}
}
+ */
}
?>
Index: inc/class.uiaction_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/inc/class.uiaction_base.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- inc/class.uiaction_base.inc.php 28 Apr 2005 20:45:53 -0000 1.7
+++ inc/class.uiaction_base.inc.php 29 Nov 2006 15:32:21 -0000 1.8
@@ -6,7 +6,7 @@
* @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package filemanager
- * @version $Id: class.uiaction_base.inc.php,v 1.7 2005/04/28 20:45:53
powerstat Exp $
+ * @version $Id: class.uiaction_base.inc.php,v 1.8 2006/11/29 15:32:21
Caeies Exp $
*/
/**
@@ -67,7 +67,7 @@
{
return $GLOBALS['phpgw']->link('/index.php',
Array(
- 'menuaction'
=> $this->bo->appname.'.ui'.$this->bo->appname.'.action',
+ 'menuaction'
=> 'filemanager'.'.ui'.'filemanager'.'.action',
'path'
=> urlencode($this->bo->path),
'uiaction' =>
urlencode($action)
)
Index: inc/class.uiaction_edit.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/inc/class.uiaction_edit.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- inc/class.uiaction_edit.inc.php 13 Apr 2006 22:43:37 -0000 1.12
+++ inc/class.uiaction_edit.inc.php 29 Nov 2006 15:32:21 -0000 1.13
@@ -6,7 +6,7 @@
* @copyright Copyright (C) 2000-2006 Free Software Foundation, Inc
http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package filemanager
- * @version $Id: class.uiaction_edit.inc.php,v 1.12 2006/04/13 22:43:37
ceb Exp $
+ * @version $Id: class.uiaction_edit.inc.php,v 1.13 2006/11/29 15:32:21
Caeies Exp $
*/
/**
@@ -45,26 +45,26 @@
//_debug_array($this->bofilemanager->fileman);
- if($_POST['cancel'])
+ if(isset($_POST['cancel']) && $_POST['cancel'])
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' =>
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' =>
'filemanager'.'.ui'.'filemanager'.'.index',
'path' =>
urlencode($this->bofilemanager->path)));
}
$data = array
(
'img_up' => array('widget' =>
array('type' => 'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'up'),
+
'src' => $GLOBALS['phpgw']->common->image('filemanager','up'),
'title' => lang('up'),
'link' => $GLOBALS['phpgw']->link('/index.php',Array(
-
'menuaction' =>
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+
'menuaction' =>
'filemanager'.'.ui'.'filemanager'.'.index',
'path' =>
urlencode($this->bofilemanager->lesspath))))),
'help_up' => array('widget' =>
array('type' => 'help','onClick' => $this->bofilemanager->build_help('up'))),
'img_home' => array('widget' =>
array('type' => 'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'folder_large'),
+
'src' => $GLOBALS['phpgw']->common->image('filemanager','folder_large'),
'title' => lang('go to your home directory'),
'link' => $GLOBALS['phpgw']->link('/index.php',Array(
-
'menuaction' =>
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+
'menuaction' =>
'filemanager'.'.ui'.'filemanager'.'.index',
'path' => urlencode($this->bofilemanager->homedir))))),
'help_home' => array('widget' =>
array('type' => 'help','onClick' => $this->bofilemanager->build_help('home'))),
'current_dir' => $this->bofilemanager->path
@@ -83,10 +83,10 @@
$content = $GLOBALS['phpgw']->vfs->read (array
('string' => $edit_file));
}
- if($_POST['preview'])
+ if(isset($_POST['preview']))
{
$vars[] = array('widget' => array('type' => 'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','pencil'),
'title' => lang('edit'),
'name' => 'edit',
'value' => 'edit'));
@@ -94,33 +94,33 @@
else
{
$vars[] = array('widget' => array('type' =>
'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'preview'),
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','preview'),
'title' => lang('preview'),
'name' => 'preview',
'value' => 'preview'));
}
$vars[] = array('widget' => array('type' => 'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'filesave'),
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','filesave'),
'title' => lang('save'),
'name' => 'save',
'value' => 'save'));
$vars[] = array('widget' => array('type' => 'image',
-
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'button_cancel'),
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','button_cancel'),
'title' => lang('close'),
'name' => 'cancel',
'value' => 'cancel'));
$data['nav_data'] = $vars;
- $data['lang_edit'] = $_POST['preview']?lang('preview
for'):lang('edit file');
+ $data['lang_edit'] =
isset($_POST['preview'])?lang('preview for'):lang('edit file');
$data['filename'] = $edit_file;
$vars = array();
- if($_POST['preview'])
+ if(isset($_POST['preview']))
{
$vars['preview'] = nl2br($content);
$v[] = array('widget' => array('type' =>
'hidden','name'=> 'edit_file_content','value'=> $content));
}
- elseif ($_POST['save'])
+ elseif (isset($_POST['save']))
{
if
($GLOBALS['phpgw']->vfs->write(array('string' =>
$this->bofilemanager->path.'/'.$edit_file ,'relatives' =>
array(RELATIVE_NONE),'content' => $content)))
{
@@ -144,7 +144,7 @@
$output = array
(
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
$this->bofilemanager->appname.'.uiaction_edit.edit',
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'filemanager'.'.uiaction_edit.edit',
'path' => urlencode($this->bofilemanager->path),'edit_file' =>
$edit_file)),
'filemanager_nav' => $data,
'filemanager_edit' => $vars
Index: inc/class.uifilemanager.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/inc/class.uifilemanager.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- inc/class.uifilemanager.inc.php 16 Aug 2006 14:20:32 -0000 1.36
+++ inc/class.uifilemanager.inc.php 29 Nov 2006 15:32:21 -0000 1.37
@@ -8,7 +8,7 @@
* @copyright Portions Copyright (C) 2000-2005 Free Software Foundation,
Inc http://www.fsf.org/
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
* @package filemanager
- * @version $Id: class.uifilemanager.inc.php,v 1.36 2006/08/16 14:20:32
skwashd Exp $
+ * @version $Id: class.uifilemanager.inc.php,v 1.37 2006/11/29 15:32:21
Caeies Exp $
* @internal Based on phpWebhosting
*/
@@ -27,17 +27,21 @@
var $public_functions = array
(
'index' => True,
+ 'indexhis' => True,
'action' => True,
'history' => True,
'view' => True,
+ 'viewhis' => True,
'edit' => True,
'preferences' => True,
'admin' => True,
- 'edit_actions' => True
+ 'edit_actions' => True,
+ 'compare' => True
);
var $bofilemanager;
var $browser;
+ var $maxperpage=20;
//TODO use the API mime-icons ... still being implemented
var $mime_ico = array
(
@@ -76,9 +80,15 @@
$this->action =
CreateObject('filemanager.uiaction_base');
$this->bofilemanager = $this->action->bofilemanager;
$this->fileman =
$this->bofilemanager->fileman;
+ $this->filehis =
$this->bofilemanager->filehis;
+ $this->history_path =
$this->bofilemanager->history_path;
+ $this->history_file =
$this->bofilemanager->history_file;
$this->path =
$this->bofilemanager->path;
$this->homedir =
$this->bofilemanager->homedir;
-
+
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']))
+ {
+ $this->maxperpage=
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
$this->check_access();
$this->bofilemanager->f_update();
@@ -107,7 +117,7 @@
$error[] = lang('you do not have access to
%1',$this->bofilemanager->path);
}
$this->bofilemanager->userinfo['working_id'] =
$GLOBALS['phpgw']->vfs->working_id;
- $this->bofilemanager->userinfo['working_lid'] =
$GLOBALS['phpgw']->accounts->id2name($this->bofilemanager->userinfo['working_id']);
+ $this->bofilemanager->userinfo['working_lid'] =
$GLOBALS['phpgw']->accounts->id2lid($this->bofilemanager->userinfo['working_id']);
// Verify path is real
@@ -129,7 +139,7 @@
{
$error[] = lang('directory %1 does not
exist',$this->bofilemanager->path);
}
- if(is_array($error))
+ if(isset($error) && is_array($error))
{
if($this->bofilemanager->debug)
{
@@ -145,14 +155,13 @@
function action()
{
$params = get_var('params',array('POST','GET'));
-
- //_debug_array($params);
- if($_GET['show_upload_boxes'])
+ $show_upload_box = get_var('show_upload_boxes', 'GET');
+ if($show_upload_box)
{
$GLOBALS['phpgw']->preferences->read_repository();
-
$GLOBALS['phpgw']->preferences->change('filemanager','show_upload_boxes',$_GET['show_upload_boxes']);
+
$GLOBALS['phpgw']->preferences->change('filemanager','show_upload_boxes',$show_upload_box);
$GLOBALS['phpgw']->preferences->save_repository();
- $this->bofilemanager->show_upload_boxes =
$_GET['show_upload_boxes'];
+ $this->bofilemanager->show_upload_boxes =
$show_upload_box;
}
if (UI_DEBUG)
@@ -160,7 +169,6 @@
echo 'uifilemanager -> Debug mode <br />';
_debug_array($_POST);
}
-
$functions = Array
(
'rename',
@@ -178,7 +186,13 @@
'cancel',
'upload',
'execute',
- 'update'
+ 'update',
+ 'research',
+ 'compare',
+ 'next',
+ 'first',
+ 'last',
+ 'prev'
);
$bo_functions = array
@@ -201,7 +215,7 @@
'menuaction' =>
'filemanager.uifilemanager.index',
'path' =>
urlencode($this->bofilemanager->path)
);
-
+ $var_msg = '';
if(is_array($params))
{
foreach($params as $true => $action)
@@ -209,6 +223,16 @@
$action =
$true=='execute'?$true:$action;
if($action != '' &&
in_array($action,$functions))
{
+
if(in_array($action,array('first','next','prev','last','research')))
+ {
+
$link_data['menuaction']='filemanager.uifilemanager.history';
+ $link_data['vers']
=urlencode($this->bofilemanager->vers);
+
$link_data['file']=urlencode($this->bofilemanager->file);
+
$link_data['history_path']=urlencode($this->bofilemanager->path);
+
$link_data['history_file']=urlencode($this->bofilemanager->file);
+
$link_data['collapse']=urlencode($this->bofilemanager->collapse);
+
$link_data['mime_type']=urlencode($this->bofilemanager->mime_type);
+ }
switch($action)
{
case 'rename':
@@ -223,6 +247,28 @@
$GLOBALS['phpgw']->preferences->save_repository();
}
break;
+ case 'research':
+
$link_data['from_rev'] =urlencode($this->bofilemanager->from_rev);
+
$link_data['to_rev'] =urlencode($this->bofilemanager->to_rev);
+ break;
+ case 'first':
+ break;
+ case 'next':
+
$link_data['page']=urlencode($this->bofilemanager->page+1);
+ break;
+ case 'prev':
+
$link_data['page']=urlencode($this->bofilemanager->page-1);
+ break;
+ case 'last':
+
$link_data['page']=urlencode($this->bofilemanager->pages);
+ break;
+ case 'compare':
+
$link_data['menuaction'] = 'filemanager.uifilemanager.compare';
+
$link_data['file']=urlencode($this->bofilemanager->file);
+
$link_data['collapse']=urlencode($this->bofilemanager->collapse);
+
$link_data['page']=urlencode($this->bofilemanager->page);
+
$link_data['pages']=urlencode($this->bofilemanager->pages);
+ break;
case 'edit_comments':
$link_data['edit_comments'] = True;
$edit =
$this->bofilemanager->get_fileman();
@@ -314,7 +360,7 @@
'caption' => lang('Menu -->')
);
-
if(is_array($this->config_items['menu_disabled']))
+
if(isset($this->config_items['menu_disabled']) &&
is_array($this->config_items['menu_disabled']))
{
$disabled =
$this->config_items['menu_disabled'];
}
@@ -393,7 +439,7 @@
'mime_type' => 'Directory'));
//_debug_array($ls_array);
-
+ reset($ls_array);
while(list($num,$dir) = each($ls_array))
{
$dirs[] = $dir;
@@ -407,11 +453,11 @@
{
$dirs[] = Array(
'directory' =>
$this->bofilemanager->fakebase,
- 'name' =>
$group_array['account_name']
+ 'name' =>
$GLOBALS['phpgw']->accounts->id2lid($group_array['account_id'])
);
$ls_array =
$GLOBALS['phpgw']->vfs->ls(array(
- 'string' =>
$this->bofilemanager->fakebase.SEP.$group_array['account_name'],
+ 'string' =>
$this->bofilemanager->fakebase.SEP.$GLOBALS['phpgw']->accounts->id2lid($group_array['account_id']),
'relatives' =>
Array(RELATIVE_NONE),
'checksubdirs' => True,
'mime_type' => 'Directory'
@@ -532,8 +578,8 @@
function index()
{
- $rename_files = $_GET['rename_files'];
- $edit_comments = $_GET['edit_comments'];
+ $rename_files = get_var('rename_files','GET');
+ $edit_comments = get_var('edit_comments','GET');
$files_array = $this->bofilemanager->load_files();
//_debug_array($files_array);
@@ -553,7 +599,7 @@
foreach($this->bofilemanager->file_attributes as
$attribute => $translation)
{
- if ($this->bofilemanager->settings[$attribute])
+ if
(isset($this->bofilemanager->settings[$attribute]))
{
$link_data['sortby'] = $attribute;
$file_attributes[] = array('widget'=>
array('type' => 'link','caption' => lang($attribute),
@@ -561,18 +607,17 @@
'help' => array('widget' => array('type' => 'help','onClick'
=> $this->bofilemanager->build_help($attribute))));
}
}
- //_debug_array($file_attributes);
$file_output = array();
for($i=0;$i<count($files_array);$i++)
{
$file = $files_array[$i];
$file_output[$i]['checkbox'] = array('widget'
=> array( 'type' => 'checkbox','name' => 'fileman[]','value' => $file['name'],
-
'checked' =>
($this->bofilemanager->changes[$file['name']] == $file['name']?True:False)));
+
'checked' =>
(isset($this->bofilemanager->changes[$file['name']]) &&
$this->bofilemanager->changes[$file['name']] == $file['name']?True:False)));
@reset($this->bofilemanager->file_attributes);
while(list($internal,$displayed) =
each($this->bofilemanager->file_attributes))
{
- if
($this->bofilemanager->settings[$internal])
+ if
(isset($this->bofilemanager->settings[$internal]))
{
switch($internal)
{
@@ -580,7 +625,11 @@
case 'owner':
case 'createdby_id':
case 'modifiedby_id':
+ $name =
'';
+
if(isset($file[$internal]))
+ {
$name =
$GLOBALS['phpgw']->accounts->id2name($file[$internal]) ;
+ }
$file_output[$i][$internal] = $name ? $name: '';
break;
case 'created':
@@ -598,7 +647,7 @@
else
{
$mime_parts = explode('/',$file['mime_type']);
-
$file_icon = $this->mime_ico[$file['mime_type']];
+
$file_icon = isset($this->mime_ico[$file['mime_type']]) ?
$this->mime_ico[$file['mime_type']] : '';
if (!$file_icon)
{
$file_icon = ( $this->mime_ico[$mime_parts[0]]) ?
$this->mime_ico[$mime_parts[0]] : $this->mime_ico['unknown'];
@@ -610,6 +659,7 @@
{
$link_data['path'] = $this->bofilemanager->path .
$this->bofilemanager->dispsep . $file['name'];
$href = $GLOBALS['phpgw']->link('/index.php',$link_data);
+
$onClick = '';
}
else
{
@@ -626,6 +676,7 @@
{
$link_data['menuaction'] = 'filemanager.uiaction_edit.edit';
$link_data['edit_file'] = urlencode($file['name']);
+
$link_data['path'] = $this->bofilemanager->path;
$file_output[$i]['name']['edit'] = array('widget' => array( 'type' =>
'image',
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','pencil'),
'link' =>
$GLOBALS['phpgw']->link('/index.php',$link_data)));
@@ -641,19 +692,35 @@
}
else
{
-
$file_output[$i][$internal] = $file[$internal];
+
$file_output[$i][$internal] = isset($file[$internal]) ? $file[$internal] : '';
}
break;
case 'size':
$file_output[$i][$internal] = $this->bofilemanager->borkb($file[$internal]);
break;
case 'version':
+
if(isset($file[$internal]))
+ {
$file_output[$i][$internal] = array('widget' => array('type' => 'link',
'onClick' => "open_popup('" .
$GLOBALS['phpgw']->link('/index.php',
-
'menuaction=filemanager.uifilemanager.history&file='
-
.
urlencode($file['name'])) . "','600','600');",
+
array(
+
'menuaction' => 'filemanager.uifilemanager.history',
+
'file' => urlencode($file['name']),
+
'vers' => urlencode($file[$internal]),
+
'mime_type'=> urlencode($file['mime_type']),
+
'collapse' => urlencode('collapse'),
+
'history_path'=> urlencode($this->bofilemanager->path),
+
'history_file' => urlencode($file['name'])
+
)
+
).
+
"','1000','800');",
'href' => '#',
'caption' => $file[$internal]));
+ }
+ else
+ {
+
$file_output[$i][$internal] = '';
+ }
break;
default:
$file_output[$i][$internal] = $file[$internal];
@@ -734,7 +801,7 @@
if($this->bofilemanager->path !=
$this->bofilemanager->fakebase && $this->bofilemanager->access_add)
{
-
if($this->bofilemanager->settings['show_command_line'])
+
if(isset($this->bofilemanager->settings['show_command_line']))
{
$data['command_line'] =
array('widget' => array('type' => 'text',
'name' => 'command_line',
@@ -815,10 +882,10 @@
{
$data['errors'] = $this->bofilemanager->errors;
}*/
-
- if(strlen($_GET['msg']) > 0)
+ $msg = get_var('msg', 'GET', '');
+ if(strlen($msg) > 0)
{
- $data['msg'] = $_GET['msg'];
+ $data['msg'] = $msg;
}
if ($rename_files || $edit_comments)
@@ -840,6 +907,136 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('index' => $data));
}
+ function indexhis()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework']=True;
+ $link_data = array
+ (
+ 'menuaction' =>
'filemanager.uifilemanager.indexhis',
+ 'history_path' =>
$this->bofilemanager->history_path
+ );
+ foreach($this->bofilemanager->file_attributes as
$attribute => $translation)
+ {
+ if
(isset($this->bofilemanager->settings[$attribute]))
+ {
+ $file_attributes[] = array('widget'=>
array('type' => 'label','caption' => lang($attribute)));
+ }
+ }
+
+ $files_array=$this->bofilemanager->load_files(True);
+ $files_array = $this->dirs_first($files_array);
+ $file_output = array();
+ for($i=0;$i<count($files_array);$i++)
+ {
+ $file = $files_array[$i];
+ @reset($this->bofilemanager->file_attributes);
+ while(list($internal,$displayed) =
each($this->bofilemanager->file_attributes))
+ {
+ if
(isset($this->bofilemanager->settings[$internal]))
+ {
+ switch($internal)
+ {
+ case 'owner_id':
+ case 'owner':
+ case 'createdby_id':
+ case 'modifiedby_id':
+ $name =
'';
+
if(isset($file[$internal]))
+ {
+
$name = $GLOBALS['phpgw']->accounts->id2name($file[$internal]) ;
+ }
+
$file_output[$i][$internal] = $name ? $name: '';
+ break;
+ case 'created':
+ case 'modified':
+
//Convert ISO 8601 date format used by DAV into something people can read
+
$file_output[$i][$internal] =
$this->bofilemanager->convert_date($file[$internal]);
+ break;
+ case 'name':
+
$mime_parts = explode('/',$file['mime_type']);
+
$file_icon = isset($this->mime_ico[$file['mime_type']]) ?
$this->mime_ico[$file['mime_type']] : '';
+ if
(!$file_icon)
+ {
+
$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('filemanager',$file_icon)));
+ if
($file['mime_type']=='Directory')
+ {
+
$link_data['history_path'] = $this->bofilemanager->history_path.
$this->bofilemanager->dispsep . $file['name'];
+
$link_data['vers']= $this->bofilemanager-> vers;
+
$href = $GLOBALS['phpgw']->link('/index.php',$link_data);
+ }
+ else
+ {
+
$href = '#';
+
$onClick = "open_popup('" . $GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'filemanager.ui'
+
.'filemanager.viewhis',
+
'vers' => urlencode($this->bofilemanager->vers),
+
'history_path' =>
urlencode($this->bofilemanager->history_path),
+
'history_file' => urlencode($file['name']))) .
"','600','600');";
+ }
+
$file_output[$i]['name']['link'] = array('widget' => array('type' =>
'link','caption' => $file['name'],
'href' =>
$href,'onClick' => isset($onClick) ? $onClick : ''));
+ break;
+ case 'size':
+
$file_output[$i][$internal] = $this->bofilemanager->borkb($file[$internal]);
+ break;
+ case 'version':
+
$file_output[$i][$internal] = array('widget' => array('type' =>
'label','caption' => $file[$internal]));
+ default:
+
$file_output[$i][$internal] = isset($file[$internal]) ? $file[$internal] : '';
+ }
+ }
+ }
+ }
+
+ $data= array(
+ 'files' => array
+ (
+ 'file_attributes' =>
$file_attributes,
+ 'file'
=> $file_output
+ ),
+ 'img_dir' => array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager',($this->bofilemanager->homestr?'folder_home':'folder')),
+
'title' => lang('current directory'))),
+ 'current_dir' =>
$this->bofilemanager->history_path,
+ 'img_vers' => array('widget' =>
array('type' => 'image',
+
'src' => $GLOBALS['phpgw']->common->image('filemanager','version')),
+
'title' => lang('current version')),
+ 'current_vers' => $this->bofilemanager->vers,
+ 'img_home' => array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','folder_large'),
+
'title' => lang('go to your home directory'),
+
'link' =>
$GLOBALS['phpgw']->link('/index.php',Array(
+
'menuaction' =>
'filemanager.uifilemanager.indexhis',
+
'vers' =>
urlencode($this->bofilemanager->vers),
+
'history_path' =>
urlencode($this->bofilemanager->homedir))))),
+ 'lang_close' => lang('close window')
+ );
+ if($this->bofilemanager->path != '/')
+ {
+ $data['img_up'] = array('widget' =>
array('type' => 'image',
+
'src' => $GLOBALS['phpgw']->common->image('filemanager','up'),
+
'title' => lang('up'),
+
'link' => $GLOBALS['phpgw']->link('/index.php',Array(
+
'menuaction' => 'filemanager.uifilemanager.indexhis',
+
'vers' =>
urlencode($this->bofilemanager->vers),
+
'history_path' =>
urlencode($this->bofilemanager->historylesspath)))));
+ }
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('index' => $data));
+ }
+
+
+ function compare()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework']=True;
+ $this->bofilemanager->f_compare();
+ $GLOBALS['phpgw']->xslttpl->set_var('compare',
array('diff' => $this->bofilemanager->list_elements));
+ }
+
+
function edit_comments()
{
$edit=array();
@@ -856,34 +1053,115 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' =>
$GLOBALS['phpgw']->vfs->view(array('string' => $this->path.'/'.
$this->bofilemanager->file,'relatives' => array (RELATIVE_NONE)))));
}
+ function viewhis()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' =>
$GLOBALS['phpgw']->vfs->view(array('string' => $this->history_path.'/'.
$this->bofilemanager->history_file,'rev' =>
$this->bofilemanager->vers,'relatives' => array (RELATIVE_NONE)))));
+ }
+
function history()
{
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
$file =
$this->bofilemanager->path.$this->bofilemanager->dispsep.$this->bofilemanager->file;
+ $from_rev=$this->bofilemanager->from_rev;
+ $to_rev=$this->bofilemanager->to_rev;
+ $vers= $this->bofilemanager->vers;
+ $collapse=$this->bofilemanager->collapse;
+ $mime_type=$this->bofilemanager->mime_type;
+ $page=$this->bofilemanager->page;
+ $pages=0;
if($GLOBALS['phpgw']->vfs->file_exists(array('string'
=> $file,'relatives' => Array(RELATIVE_NONE))))
{
$col_headers = array
(
- lang('date')
=> 'created',
+ lang('') => '',
lang('version')
=> 'version',
+ lang('date')
=> 'created',
lang('performed by') =>
'owner_id',
lang('operation')
=> 'comment'
);
-
foreach($col_headers as $label => $field)
{
$header[] = array('widget' =>
array('type' => 'label','caption' => $label));
}
$table_head = array('table_col' => $header);
- $data = array();
- $journal_array =
$GLOBALS['phpgw']->vfs->get_journal(array('string' => $file,'relatives' =>
Array(RELATIVE_NONE)));
+ if($from_rev && $to_rev)
+ {
+ if(!is_numeric($from_rev) ||
$from_rev <0 || $from_rev>$vers)
+ {
+ $from_rev=1;
+ }
+ if(!is_numeric($to_rev) ||
$to_rev >$vers || $to_rev<0)
+ {
+ $to_rev=$vers;
+ }
+
+ if($from_rev>$to_rev)
+ {
+ $temp=$from_rev;
+ $from_rev=$to_rev;
+ $to_rev=$temp;
+ }
+ }
+ elseif($from_rev)
+ {
+ if(!is_numeric($from_rev) || $from_rev
<0 || $from_rev>$vers)
+ {
+ $from_rev=1;
+ }
+ $to_rev=$vers;
+ }
+ elseif($to_rev)
+ {
+ if(!is_numeric($to_rev) || $to_rev <0
|| $to_rev>$vers)
+ {
+ $to_rev=$vers;
+ }
+ $from_rev=1;
+ }
+ $data = array(
+ 'string' => $file,
+ 'from_rev'=>$from_rev,
+ 'to_rev' => $to_rev,
+ 'vers' =>$vers,
+ 'relatives' => Array(RELATIVE_NONE)
+ );
+
+ if($collapse)
+ {
+ $data['collapse']='collapse';
+ }
+ $journal_array =
$GLOBALS['phpgw']->vfs->get_journal($data);
+ $revision=count($journal_array);
+ // Calculate the number of pages
+ $pages = floor($revision / $this->maxperpage);
+ if($revision % $this->maxperpage) $pages++;
+ if($page > $pages)
+ {
+ $page= $pages;
+ }
+ else if($page<1)
+ {
+ $page=1;
+ }
+ $this->bofilemanager->save_page($page,$pages);
if(is_array($journal_array))
{
- foreach($journal_array as $num =>
$journal_entry)
+ @reset($journal_array);
+
$startrevision=($page-1)*$this->maxperpage;
+
$endrevision=$startrevision+$this->maxperpage;
+ if($pages==0)
{
+ $startrevision=0;
+ $endrevision=0;
+ }
+ for($i=$startrevision;
$i<$endrevision;$i++)
+ {
+ if($i==$revision) break;
+
$journal_entry=$journal_array[$i];
$var = array();
@reset($col_headers);
foreach($col_headers as $label
=> $field)
@@ -891,31 +1169,135 @@
switch($field)
{
case 'owner_id':
- $var[]
= array('widget' => array('type' => 'label','caption' =>
$GLOBALS['phpgw']->common->grab_owner_name($journal_entry[$field])));
+ $var[]
= array('widget' => array('type' => 'label','caption' =>
$GLOBALS['phpgw']->common->grab_owner_name(isset($journal_entry[$field]) ?
$journal_entry[$field] : '')));
break;
case 'created':
$var[]
= array('widget' => array('type' => 'label','caption' =>
$this->bofilemanager->convert_date($journal_entry[$field])));
break;
+ case '':
+ $var[]
= array('widget' => array('type' =>
'checkbox','name'=>'filehis[]','value'=>$journal_entry['version'],'onClick' =>
'checkCB(this)'));
+ break;
+ case 'version':
+
if($mime_type=='Directory')
+ {
+
$href = '#';
+
$onClick = "open_popup('" . $GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'filemanager.ui'
+
.'filemanager.indexhis',
+
'path' => urlencode($this->bofilemanager->path),
+
'file' => urlencode($this->bofilemanager->file),
+
'history_path' =>
urlencode($this->bofilemanager->history_path),
+
'history_file' =>
urlencode($this->bofilemanager->history_file),
+
'vers' => urlencode($journal_entry[$field]))) .
"','800','800');";
+
}
+ else
+ {
+
$href = '#';
+
$onClick = "open_popup('" . $GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'filemanager.ui'
+
.'filemanager.viewhis',
+
'path' => urlencode($this->bofilemanager->path),
+
'history_path' =>
urlencode($this->bofilemanager->history_path),
+
'file' => urlencode($this->bofilemanager->file),
+
'history_file' =>
urlencode($this->bofilemanager->history_file),
+
'vers' => urlencode($journal_entry[$field]))) .
"','800','800');";
+ }
+ $var[]
= array('widget' => array('type' => 'link','caption' =>
$journal_entry[$field],'href' => $href,'onClick' => $onClick));
+ break;
default:
$var[]
= array('widget' => array('type' => 'label','caption' =>
$journal_entry[$field]));
break;
}
}
$table_rows[] =
array('table_col' => $var);
+ $table_footer = array();
}
}
-
$data = array
(
+ 'form' => array('action' =>
$GLOBALS['phpgw']->link('/index.php',array(
+
'menuaction' => 'filemanager.uifilemanager.action',
+
'path' =>
urlencode($this->bofilemanager->path))),
+
'id' => 'form_history',
+
'name' => 'history',
+
'method' => 'POST',
+
'enctype' => 'multipart/form-data'),
+ 'error' =>
(isset($this->bofilemanager->errors) &&
is_array(unserialize(base64_decode($this->bofilemanager->errors)))?$GLOBALS['phpgw']->common->error_list(unserialize(base64_decode($this->bofilemanager->errors)),'Results'):''),
'error' => '',
- 'action_url' => '#',
//$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.preferences'),
+ 'action_url' => '#',
'title' =>
lang('history for %1',$file),
'table' =>
array('width' => '100%','table_head' => $table_head ,'table_row' =>
$table_rows,'table_footer' => $table_footer),
'lang_close' => lang('close window')
);
- //_debug_array($data);
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('history' => $data));
+ $data['lang_from_rev'] = lang('from rev');
+ $data['from'] = array('widget' =>
array('type' => 'text',
+
'name' => 'from_rev',
+
'maxlength' => '255',
+
'size' => '15',
+
'value' => $from_rev));
+ $data['lang_to_rev'] = lang('to rev');
+
+ $data['to'] = array('widget' =>
array('type' => 'text',
+
'name' => 'to_rev',
+
'maxlength' => '255',
+
'size' => '15',
+
'value' => $to_rev));
+ $data['img_search'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','reload'),
+
'title' => lang('search'),
+
'name' => 'params[research]',
+
'value' => 'research'));
+ $data['file'] = array('widget' =>
array('type' => 'hidden',
+ 'name' => 'file',
+ 'value' =>
$this->bofilemanager->file
+ ));
+ $data['vers'] = array('widget' =>
array('type' => 'hidden',
+ 'name' => 'vers',
+ 'value' =>
$this->bofilemanager->vers
+ ));
+ $data['mime_type'] = array('widget'
=> array('type' => 'hidden',
+ 'name' => 'mime_type',
+ 'value' =>
$this->bofilemanager->mime_type
+ ));
+ $data['collapse'] = array('widget' =>
array('type' => 'checkbox','name'=>'collapse','value'=>'collapse','caption'=>
'collapse','checked' => (isset($this->bofilemanager->collapse)?True:False)));
+ $data['img_compare'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','button_ok'),
+
'title' =>
lang('Compare'),
+
'name' =>
'params[compare]',
+
'value' => 'compare'));
+ if($page>1)
+ {
+ $data['img_first'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','first-grey'),
+
'title' => lang('first'),
+
'name' => 'params[first]',
+
'value' => 'first'));
+ $data['img_prev'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','left-grey'),
+
'title' => lang('previsous'),
+
'name' => 'params[prev]',
+
'value' => 'prev'));
+ }
+ if($page<$pages)
+ {
+ $data['img_next'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','right-grey'),
+
'title' => lang('next'),
+
'name' => 'params[next]',
+
'value' => 'next'));
+ $data['img_last'] = array('widget' =>
array('type' => 'image',
+
'src' =>
$GLOBALS['phpgw']->common->image('filemanager','last-grey'),
+
'title' => lang('last'),
+
'name' => 'params[last]',
+
'value' => 'last'));
+ }
+ if($pages>1)
+ {
+ $data['page'] = array('widget' =>
array('type' => 'label',
+
'caption' =>
lang('Page').$page.'/'.$pages));
+ }
}
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('history' => $data));
}
function view_file($file_array='')
Index: templates/base/app_data.xsl
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/templates/base/app_data.xsl,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- templates/base/app_data.xsl 16 Aug 2006 14:19:53 -0000 1.20
+++ templates/base/app_data.xsl 29 Nov 2006 15:32:21 -0000 1.21
@@ -1,4 +1,4 @@
-<!-- $Id: app_data.xsl,v 1.20 2006/08/16 14:19:53 skwashd Exp $ -->
+<!-- $Id: app_data.xsl,v 1.21 2006/11/29 15:32:21 Caeies Exp $ -->
<xsl:template name="app_data">
<xsl:choose>
@@ -40,6 +40,8 @@
<xsl:apply-templates
select="img_dir/widget" />
<xsl:apply-templates
select="help_dir/widget" />
<font size="+1"
color="maroon"><b><xsl:value-of select="current_dir" /></b></font>
+ <xsl:apply-templates
select="img_vers/widget" />
+ <font size="+1"
color="maroon"><b><xsl:value-of select="current_vers" /></b></font>
</td>
</tr>
<tr>
@@ -150,6 +152,16 @@
<xsl:apply-templates select="summary" />
</td>
</tr>
+ <xsl:if test='lang_close'>
+ <tr>
+ <td align="center" colspan="5">
+ <input type="button">
+ <xsl:attribute
name="value"><xsl:value-of select="lang_close"/></xsl:attribute>
+ <xsl:attribute
name="onClick"><xsl:text>window.close();</xsl:text></xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:if>
<xsl:apply-templates select="add_moz_sidebar" />
<xsl:apply-templates select="body_data" />
@@ -200,6 +212,24 @@
</tr>
</xsl:template>
+ <!--The template for compare two files -->
+ <xsl:template match="compare">
+ <table width="100%" border="0" cellpadding="2"
cellspacing="2">
+ <tr>
+ <xsl:apply-templates select="diff" />
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="diff">
+ <xsl:for-each select="tablediff">
+ <div class="difflines">
+ <xsl:apply-templates select="../tablediff" />
+ </div>
+ </xsl:for-each>
+ </xsl:template>
+
+
<!--Prints out the buttons-->
<xsl:template match="buttons">
<xsl:for-each select="button">
@@ -294,19 +324,77 @@
</xsl:template>
<xsl:template match="history">
+ <!--<xsl:variable name="form_action" select="form_action" />
+ <form enctype="multipart/form-data" action="{$form_action}"
method="POST">-->
+ <form>
+ <xsl:attribute name="action"> <xsl:value-of
select="form/action"/> </xsl:attribute>
+ <xsl:attribute name="method"> <xsl:value-of
select="form/method"/></xsl:attribute>
+ <xsl:attribute name="enctype"> <xsl:value-of
select="form/enctype"/></xsl:attribute>
+ <xsl:attribute name="id"> <xsl:value-of
select="form/id"/></xsl:attribute>
+ <xsl:attribute name="name"> <xsl:value-of
select="form/name"/></xsl:attribute>
<table width="100%">
<tr>
- <td align="center">
+ <td colspan="2" align="center">
<b><xsl:value-of
select="title"/></b><br />
</td>
</tr>
<tr>
- <td>
+ <td colspan="2" align="left" valign="middle">
+ <nobr>
+ <b><xsl:value-of
select="lang_from_rev" /></b>
+ <xsl:apply-templates
select="from/widget" />
+ <b><xsl:value-of
select="lang_to_rev" /></b>
+ <xsl:apply-templates
select="to/widget" />
+ <xsl:apply-templates
select="img_search/widget" />
+ <xsl:apply-templates
select="file/widget" />
+ <xsl:apply-templates
select="vers/widget" />
+ <xsl:apply-templates
select="mime_type/widget" />
+ </nobr>
+ </td>
+
+ </tr>
+ <tr>
+ <td colspan="2" align="left">
+ <nobr>
+ <xsl:apply-templates
select="collapse/widget"/>
+
+ </nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
<xsl:apply-templates select="table" />
</td>
</tr>
+ <tr>
+ <td colspan="2">
+ <xsl:apply-templates
select="img_compare/widget" />
+ </td>
+
+ </tr>
+ <tr>
+ <td align="left">
+ <xsl:apply-templates
select="img_first/widget" />
+ <xsl:apply-templates
select="img_prev/widget" />
+ </td>
+ <td align="right">
+ <xsl:apply-templates
select="img_next/widget" />
+ <xsl:apply-templates
select="img_last/widget" />
+ </td>
+
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <nobr>
+ <font
size="+1"><xsl:apply-templates select="page/widget" /></font>
+ </nobr>
+ </td>
+ </tr>
+
+
<tr height="50" valign="bottom">
- <td align="center">
+ <td colspan="2" align="center">
<input type="button">
<xsl:attribute
name="value"><xsl:value-of select="lang_close"/></xsl:attribute>
<xsl:attribute
name="onClick"><xsl:text>window.close();</xsl:text></xsl:attribute>
@@ -314,6 +402,7 @@
</td>
</tr>
</table>
+ </form>
</xsl:template>
<xsl:template match="view">
Index: templates/base/widgets.xsl
===================================================================
RCS file: /cvsroot/phpgroupware/filemanager/templates/base/widgets.xsl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- templates/base/widgets.xsl 9 Apr 2005 21:56:02 -0000 1.13
+++ templates/base/widgets.xsl 29 Nov 2006 15:32:21 -0000 1.14
@@ -1,4 +1,4 @@
-<!-- $Id: widgets.xsl,v 1.13 2005/04/09 21:56:02 ceb Exp $ -->
+<!-- $Id: widgets.xsl,v 1.14 2006/11/29 15:32:21 Caeies Exp $ -->
<!--A widget is something like an input box, image etc, or a composite/virtual
widget like a "seperator" or a "label". These are used throughout the
filemanager
@@ -106,6 +106,9 @@
<xsl:if test="$checked=1">
<xsl:attribute
name="checked"><xsl:text>checked</xsl:text></xsl:attribute>
</xsl:if>
+ <xsl:if test="onClick != ''">
+ <xsl:attribute
name="onClick"><xsl:value-of disable-output-escaping="yes"
select="onClick"/></xsl:attribute>
+ </xsl:if>
</xsl:if>
<xsl:value-of select="caption"/>
</input>
@@ -161,6 +164,19 @@
</table>
</xsl:template>
+ <xsl:template match="tablediff">
+ <table border="0" cellspacing="0">
+ <xsl:attribute name="class"><xsl:value-of
select="class"/></xsl:attribute>
+ <xsl:attribute name="width"><xsl:value-of
select="width"/></xsl:attribute>
+ <xsl:apply-templates select="table_head"/>
+ <xsl:for-each select="table_row">
+ <xsl:call-template name="table_row">
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:apply-templates select="table_footer"/>
+ </table>
+ </xsl:template>
+
<xsl:template match="table_head">
<tr class="th">
<xsl:apply-templates select="table_col"/>
Index: templates/base/css/base.css
===================================================================
RCS file: templates/base/css/base.css
diff -N templates/base/css/base.css
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/css/base.css 29 Nov 2006 15:32:21 -0000 1.1
@@ -0,0 +1,23 @@
+.diffdeleted
+{
+ font-size: 11px;
+ background-color: #FF2000;
+}
+
+.diffadded
+{
+ font-size: 11px;
+ background-color: #15AA15;
+}
+
+.diff
+{
+ font-size: 11px;
+ background-color: #D0D0D0
+}
+
+.newpath
+{
+ font-size: 150%;
+ color: #DDA0DD
+}
Index: templates/base/images/first-grey.png
===================================================================
RCS file: templates/base/images/first-grey.png
diff -N templates/base/images/first-grey.png
Binary files /dev/null and /tmp/cvsjn8nbz differ
Index: templates/base/images/last-grey.png
===================================================================
RCS file: templates/base/images/last-grey.png
diff -N templates/base/images/last-grey.png
Binary files /dev/null and /tmp/cvsUlxyJz differ
Index: templates/base/images/left-grey.png
===================================================================
RCS file: templates/base/images/left-grey.png
diff -N templates/base/images/left-grey.png
Binary files /dev/null and /tmp/cvs2U1xIC differ
Index: templates/base/images/right-grey.png
===================================================================
RCS file: templates/base/images/right-grey.png
diff -N templates/base/images/right-grey.png
Binary files /dev/null and /tmp/cvsPXZApD differ
Index: templates/base/images/version.png
===================================================================
RCS file: templates/base/images/version.png
diff -N templates/base/images/version.png
Binary files /dev/null and /tmp/cvsAjgtEB differ
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] filemanager index.php inc/class.bofilemanager.i...,
Caeies <=