forked from extern/egroupware
"Fixes from Klaus Leithoff <kl-AT-stylite.de>:
- folders can have comments now - folder selection is now sorted alphabetically - fixed handling of unknown mime-types and application/pdf - some performance fixes"
This commit is contained in:
parent
98ca788a6d
commit
20e1535e70
@ -30,6 +30,7 @@
|
|||||||
var $lesspath;
|
var $lesspath;
|
||||||
var $readable_groups;
|
var $readable_groups;
|
||||||
var $files_array;
|
var $files_array;
|
||||||
|
var $dirs_options;
|
||||||
var $numoffiles;
|
var $numoffiles;
|
||||||
var $dispsep;
|
var $dispsep;
|
||||||
|
|
||||||
@ -638,7 +639,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Checkboxes
|
# Checkboxes
|
||||||
if(!$this->rename_x && !$this->edit_comments_x && $this->path != $this->bo->fakebase && $this->path != '/')
|
//if(!$this->rename_x && !$this->edit_comments_x && $this->path != $this->bo->fakebase && $this->path != '/')
|
||||||
|
if(!$this->rename_x && !$this->edit_comments_x && $this->path != '/')
|
||||||
{
|
{
|
||||||
$cbox='<input type="checkbox" name="fileman['.$i.']" value="'.$files['name'].'">';
|
$cbox='<input type="checkbox" name="fileman['.$i.']" value="'.$files['name'].'">';
|
||||||
$this->t->set_var('actions',$cbox);
|
$this->t->set_var('actions',$cbox);
|
||||||
@ -1062,8 +1064,8 @@
|
|||||||
//$toolbar.='<input id="fmInputLocation" type="text" size="20" disabled="disabled" name="location" value="'.$this->disppath.'"/> ';
|
//$toolbar.='<input id="fmInputLocation" type="text" size="20" disabled="disabled" name="location" value="'.$this->disppath.'"/> ';
|
||||||
$current_option='<option>'.$this->disppath.'</option>';
|
$current_option='<option>'.$this->disppath.'</option>';
|
||||||
// selectbox for change/move/and copy to
|
// selectbox for change/move/and copy to
|
||||||
$dirs_options=$this->all_other_directories_options();
|
$this->dirs_options=$this->all_other_directories_options();
|
||||||
$toolbar.='<select name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$dirs_options.'</select>
|
$toolbar.='<select name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$this->dirs_options.'</select>
|
||||||
<input type="hidden" name="changedir" value="false"></td>
|
<input type="hidden" name="changedir" value="false"></td>
|
||||||
';
|
';
|
||||||
$toolbar.=$this->inputImage('goto','goto',lang('Quick jump to'));
|
$toolbar.=$this->inputImage('goto','goto',lang('Quick jump to'));
|
||||||
@ -1116,6 +1118,19 @@
|
|||||||
}
|
}
|
||||||
$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';
|
$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->path = $this->bo->fakebase)
|
||||||
|
{
|
||||||
|
$toolbar.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>';
|
||||||
|
$toolbar.='
|
||||||
|
<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';
|
||||||
|
if(!$this->rename_x)
|
||||||
|
{
|
||||||
|
$toolbar.=$this->inputImage('edit_comments','edit_comments',lang('Edit comments'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// $toolbar.='</tr></table>';
|
// $toolbar.='</tr></table>';
|
||||||
if(!$this->rename_x && !$this->edit_comments_x)
|
if(!$this->rename_x && !$this->edit_comments_x)
|
||||||
@ -1126,8 +1141,8 @@
|
|||||||
$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>';
|
$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('phpgwapi','buttonseparator').'" height="27" width="8"></td>';
|
||||||
$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';
|
$toolbar3.='<td><img alt="spacer" src="'.$GLOBALS['egw']->common->image('filemanager','spacer').'" height="27" width="1"></td>';
|
||||||
|
|
||||||
$dirs_options=$this->all_other_directories_options();
|
if(!($this->dirs_options)) $this->dirs_options=$this->all_other_directories_options();
|
||||||
$toolbar3.='<td><select name="todir">'.$dirs_options.'</select></td>';
|
$toolbar3.='<td><select name="todir">'.$this->dirs_options.'</select></td>';
|
||||||
|
|
||||||
$toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to'));
|
$toolbar3.=$this->inputImage('copy_to','copy_to',lang('Copy to'));
|
||||||
$toolbar3.=$this->inputImage('move_to','move_to',lang('Move to'));
|
$toolbar3.=$this->inputImage('move_to','move_to',lang('Move to'));
|
||||||
@ -1758,6 +1773,7 @@
|
|||||||
{
|
{
|
||||||
if($this->file) //FIXME
|
if($this->file) //FIXME
|
||||||
{
|
{
|
||||||
|
$mime_type='unknown';
|
||||||
$ls_array = $this->bo->vfs->ls(array(
|
$ls_array = $this->bo->vfs->ls(array(
|
||||||
'string' => $this->path.'/'.$this->file,//FIXME
|
'string' => $this->path.'/'.$this->file,//FIXME
|
||||||
'relatives' => array(RELATIVE_ALL),
|
'relatives' => array(RELATIVE_ALL),
|
||||||
@ -1769,19 +1785,28 @@
|
|||||||
{
|
{
|
||||||
$mime_type = $ls_array[0]['mime_type'];
|
$mime_type = $ls_array[0]['mime_type'];
|
||||||
}
|
}
|
||||||
elseif($this->prefs['viewtextplain'])
|
else
|
||||||
{
|
{
|
||||||
$mime_type = 'text/plain';
|
list($_first,$_ext) = split("\.",$this->file);
|
||||||
}
|
$mime_type = ExecMethod('phpgwapi.mime_magic.ext2mime',$_ext);
|
||||||
else
|
}
|
||||||
{
|
// check if the prefs are set for viewing unknown extensions as text/plain and
|
||||||
list($_first,$_ext) = split("\.",$this->file);
|
// check if the mime_type is unknown, empty or not found (application/octet)
|
||||||
$mime_type = ExecMethod('phpgwapi.mime_magic.ext2mime',$_ext);
|
// or check if the mimetype contains text,
|
||||||
}
|
// THEN set the mime_type text/plain
|
||||||
$viewable = array('','text/plain','text/csv','text/html','text/text');
|
if(($this->prefs['viewtextplain'] && ($mime_type=='' or $mime_type=='unknown' or $mime_type=='application/octet-stream')) or strpos($mime_type, 'text/')!==false)
|
||||||
|
{
|
||||||
|
|
||||||
|
$mime_type = 'text/plain';
|
||||||
|
}
|
||||||
|
|
||||||
|
// we want to define pdfs and text files as viewable
|
||||||
|
$viewable = array('','text/plain','text/csv','text/html','text/text','application/pdf');
|
||||||
|
// we want to view pdfs and text files within the browser
|
||||||
if(in_array($mime_type,$viewable) && !$_GET['download'])
|
if(in_array($mime_type,$viewable) && !$_GET['download'])
|
||||||
{
|
{
|
||||||
|
// if you add attachment; to the Content-disposition between disposition and filename
|
||||||
|
// you get a download dialog even for viewable files
|
||||||
header('Content-type: ' . $mime_type);
|
header('Content-type: ' . $mime_type);
|
||||||
header('Content-disposition: filename="' . $this->file . '"');//FIXME
|
header('Content-disposition: filename="' . $this->file . '"');//FIXME
|
||||||
Header("Pragma: public");
|
Header("Pragma: public");
|
||||||
@ -1816,77 +1841,92 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//give back an array with all directories except current and dirs that are not accessable
|
//give back an array with all directories except current and dirs that are not accessable
|
||||||
function all_other_directories_options()
|
function all_other_directories_options()
|
||||||
{
|
{
|
||||||
# First we get the directories in their home directory
|
# First we get the directories in their home directory
|
||||||
$dirs = array();
|
$dirs = array();
|
||||||
$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $this->bo->userinfo['account_lid']);
|
$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $this->bo->userinfo['account_lid']);
|
||||||
|
|
||||||
$tmp_arr=array(
|
$tmp_arr=array(
|
||||||
'string' => $this->bo->homedir,
|
'string' => $this->bo->homedir,
|
||||||
'relatives' => array(RELATIVE_NONE),
|
'relatives' => array(RELATIVE_NONE),
|
||||||
'checksubdirs' => True,
|
'checksubdirs' => True,
|
||||||
'mime_type' => 'Directory'
|
'mime_type' => 'Directory'
|
||||||
);
|
);
|
||||||
|
|
||||||
$ls_array = $this->bo->vfs->ls($tmp_arr);
|
$ls_array = $this->bo->vfs->ls($tmp_arr);
|
||||||
|
|
||||||
while(list($num, $dir) = each($ls_array))
|
while(list($num, $dir) = each($ls_array))
|
||||||
{
|
{
|
||||||
$dirs[] = $dir;
|
$dirs[] = $dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Then we get the directories in their readable groups' home directories
|
# Then we get the directories in their readable groups' home directories
|
||||||
reset($this->readable_groups);
|
reset($this->readable_groups);
|
||||||
while(list($num, $group_array) = each($this->readable_groups))
|
while(list($num, $group_array) = each($this->readable_groups))
|
||||||
{
|
{
|
||||||
# Don't list directories for groups that don't have access
|
# Don't list directories for groups that don't have access
|
||||||
if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled'])
|
if(!$this->groups_applications[$group_array['account_name']][$this->bo->appname]['enabled'])
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $group_array['account_name']);
|
$dirs[] = array('directory' => $this->bo->fakebase, 'name' => $group_array['account_name']);
|
||||||
|
|
||||||
$tmp_arr=array(
|
$tmp_arr=array(
|
||||||
'string' => $this->bo->fakebase.'/'.$group_array['account_name'],
|
'string' => $this->bo->fakebase.'/'.$group_array['account_name'],
|
||||||
'relatives' => array(RELATIVE_NONE),
|
'relatives' => array(RELATIVE_NONE),
|
||||||
'checksubdirs' => True,
|
'checksubdirs' => True,
|
||||||
'mime_type' => 'Directory'
|
'mime_type' => 'Directory'
|
||||||
);
|
);
|
||||||
|
|
||||||
$ls_array = $this->bo->vfs->ls($tmp_arr);
|
$ls_array = $this->bo->vfs->ls($tmp_arr);
|
||||||
while(list($num, $dir) = each($ls_array))
|
while(list($num, $dir) = each($ls_array))
|
||||||
{
|
{
|
||||||
$dirs[] = $dir;
|
$dirs[] = $dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset($dirs);
|
reset($dirs);
|
||||||
while(list($num, $dir) = each($dirs))
|
// key for the sorted array
|
||||||
{
|
$i=0;
|
||||||
if(!$dir['directory'])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
# So we don't display //
|
while(list($num, $dir) = each($dirs))
|
||||||
if($dir['directory'] != '/')
|
{
|
||||||
{
|
if(!$dir['directory'])
|
||||||
$dir['directory'] .= '/';
|
{
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
# No point in displaying the current directory, or a directory that doesn't exist
|
# So we don't display //
|
||||||
if((($dir['directory'] . $dir['name']) != $this->path) && $this->bo->vfs->file_exists(array('string' => $dir['directory'] . $dir['name'],'relatives' => array(RELATIVE_NONE))))
|
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']);
|
||||||
|
// set the content of the sorted array
|
||||||
|
$i++;
|
||||||
|
$dirs_sorted[$i]=$dir['directory'] . $dir['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// sort the directory optionlist
|
||||||
|
natcasesort($dirs_sorted);
|
||||||
|
|
||||||
|
// set the optionlist
|
||||||
|
foreach ($dirs_sorted as $key => $row) {
|
||||||
//FIXME replace the html_form_option function
|
//FIXME replace the html_form_option function
|
||||||
$options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
|
//$options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
|
||||||
}
|
$options .= $this->html_form_option($row, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* seek icon for mimetype else return an unknown icon */
|
/* seek icon for mimetype else return an unknown icon */
|
||||||
function mime_icon($mime_type, $size=16)
|
function mime_icon($mime_type, $size=16)
|
||||||
|
Loading…
Reference in New Issue
Block a user