merged from trunk

This commit is contained in:
Lars Kneschke 2007-03-19 09:12:00 +00:00
parent 0eac6dd897
commit 31c863fb89

View File

@ -30,7 +30,6 @@
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;
@ -639,8 +638,7 @@
} }
# 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);
@ -1064,8 +1062,8 @@
//$toolbar.='<input id="fmInputLocation" type="text" size="20" disabled="disabled" name="location" value="'.$this->disppath.'"/>&nbsp;'; //$toolbar.='<input id="fmInputLocation" type="text" size="20" disabled="disabled" name="location" value="'.$this->disppath.'"/>&nbsp;';
$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
$this->dirs_options=$this->all_other_directories_options(); $dirs_options=$this->all_other_directories_options();
$toolbar.='<select name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$this->dirs_options.'</select> $toolbar.='<select name="cdtodir" onChange="document.formfm.changedir.value=\'true\';document.formfm.submit()">'.$current_option.$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'));
@ -1118,19 +1116,6 @@
} }
$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)
@ -1141,8 +1126,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>';
if(!($this->dirs_options)) $this->dirs_options=$this->all_other_directories_options(); $dirs_options=$this->all_other_directories_options();
$toolbar3.='<td><select name="todir">'.$this->dirs_options.'</select></td>'; $toolbar3.='<td><select name="todir">'.$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'));
@ -1773,7 +1758,6 @@
{ {
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),
@ -1785,28 +1769,19 @@
{ {
$mime_type = $ls_array[0]['mime_type']; $mime_type = $ls_array[0]['mime_type'];
} }
elseif($this->prefs['viewtextplain'])
{
$mime_type = 'text/plain';
}
else else
{ {
list($_first,$_ext) = split("\.",$this->file); list($_first,$_ext) = split("\.",$this->file);
$mime_type = ExecMethod('phpgwapi.mime_magic.ext2mime',$_ext); $mime_type = ExecMethod('phpgwapi.mime_magic.ext2mime',$_ext);
} }
// check if the prefs are set for viewing unknown extensions as text/plain and $viewable = array('','text/plain','text/csv','text/html','text/text');
// check if the mime_type is unknown, empty or not found (application/octet)
// or check if the mimetype contains text,
// THEN set the mime_type text/plain
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");
@ -1889,9 +1864,6 @@
} }
reset($dirs); reset($dirs);
// key for the sorted array
$i=0;
while(list($num, $dir) = each($dirs)) while(list($num, $dir) = each($dirs))
{ {
if(!$dir['directory']) if(!$dir['directory'])
@ -1909,21 +1881,9 @@
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['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 //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']);
// 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
//$options .= $this->html_form_option($dir['directory'] . $dir['name'], $dir['directory'] . $dir['name']);
$options .= $this->html_form_option($row, $row);
}
return $options; return $options;
} }