Fixes a problem with file viewing using vfs_sql - where XSLT gets in the way of outputing binary data. XSLT still gets in the way of outputting binary data (grrr), but now we side-step it by using a seperate non-xslt "view.php"

This commit is contained in:
sim 2003-04-08 20:47:38 +00:00
parent 54036d56b3
commit 90d7d2b3b0
3 changed files with 52 additions and 18 deletions

View File

@ -79,7 +79,7 @@
$this->create_home_dir(); $this->create_home_dir();
$this->verify_path(); $this->verify_path();
$this->update(); $this->update();
$GLOBALS['phpgw']->xslttpl->add_file(array('widgets'));
} }
function load_header() function load_header()
@ -90,7 +90,9 @@
unset($GLOBALS['phpgw_info']['flags']['noappfooter']); unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
unset($GLOBALS['phpgw_info']['flags']['noappfooter']); unset($GLOBALS['phpgw_info']['flags']['noappfooter']);
unset($GLOBALS['phpgw_info']['flags']['headonly']); unset($GLOBALS['phpgw_info']['flags']['headonly']);
$GLOBALS['phpgw']->xslttpl->add_file(array('widgets'));
$GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_header')); $GLOBALS['phpgw']->xslttpl->add_file(array($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_header'));
} }
function no_header() function no_header()
{ {
@ -99,7 +101,7 @@
$GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappheader'] = True;
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
$GLOBALS['phpgw_info']['flags']['headonly'] = True; $GLOBALS['phpgw_info']['flags']['headonly'] = True;
$GLOBALS['phpgw']->xslttpl->add_file(array('widgets'));
} }
@ -743,6 +745,7 @@
} }
$files_array = $this->bo->load_files(); $files_array = $this->bo->load_files();
$usage = 0; $usage = 0;
$files_array = $this->dirs_first($files_array); $files_array = $this->dirs_first($files_array);
if(count($files_array) || $this->bo->cwd) if(count($files_array) || $this->bo->cwd)
@ -760,11 +763,10 @@
'value' => $file['name'] 'value' => $file['name']
)); ));
} }
@reset($this->bo->file_attributes); @reset($this->bo->file_attributes);
while(list($internal,$displayed) = each($this->bo->file_attributes)) while(list($internal,$displayed) = each($this->bo->file_attributes))
{ {
if ($this->bo->settings[$internal]) if (!is_array($this->bo->settings)||$this->bo->settings[$internal])
{ {
if ($internal==$edit[$file['name']]) if ($internal==$edit[$file['name']])
{ {
@ -849,6 +851,7 @@
} }
} }
} }
$GLOBALS['phpgw']->xslttpl->set_var('phpgw', array('summary' => array( $GLOBALS['phpgw']->xslttpl->set_var('phpgw', array('summary' => array(
'file_count' => count($files_array), 'file_count' => count($files_array),
@ -991,17 +994,14 @@
$this->index($edit); $this->index($edit);
} }
function view() function view()
{ {
$GLOBALS['phpgw_info']['flags']['noheader'] = true; Header('Location: '.$GLOBALS['phpgw']->link(
$GLOBALS['phpgw_info']['flags']['nonavbar'] = true; 'view.php',
$GLOBALS['phpgw_info']['flags']['noappheader'] = true; Array('path' => urlencode($this->bo->path),
$GLOBALS['phpgw_info']['flags']['noappfooter'] = true; 'file' => urlencode($this->bo->file))
)
$this->bo->vfs->view(array ( );
'string' => $this->bo->path.'/'.$this->bo->file,
'relatives' => array (RELATIVE_NONE)
));
exit();;
} }
function history() function history()

View File

@ -18,8 +18,7 @@
'nonavbar' => True, 'nonavbar' => True,
'noappheader' => True, 'noappheader' => True,
'noappfooter' => True, 'noappfooter' => True,
'nofooter' => True, 'nofooter' => True
'xslt_app' => True
); );
$GLOBALS['phpgw_info']['flags'] = $phpgw_flags; $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
@ -29,7 +28,7 @@
'menuaction'=> 'filemanager.uifilemanager.index' 'menuaction'=> 'filemanager.uifilemanager.index'
); );
Header('Location: '.$GLOBALS['phpgw']->link('/index.php',$parms)); $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php',$parms));
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True; $GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
exit; exit;
?> ?>

35
filemanager/view.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/**************************************************************************\
* phpGroupWare *
* This file written by Jonathon Sim <sim@zeald.com> for Zeald Ltd *
* View interface for the filemanager *
* Copyright (C) 2003 Zeald Ltd *
* -------------------------------------------- *
* 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. *
\**************************************************************************/
/*Due to incredibly annoying aspects of the XSLT template system, to be able to
output binary data you need to bypass XSLT altogether. Hence this file. */
$phpgw_flags = Array(
'currentapp' => 'filemanager',
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True,
'nofooter' => True
);
$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
include('../header.inc.php');
$ui = CreateObject($phpgw_flags['currentapp'].'.uifilemanager');
$ui->bo->vfs->view(array (
'string' => $ui->bo->path.'/'.$ui->bo->file,
'relatives' => array (RELATIVE_NONE)
));
?>