From 90d7d2b3b0cc906e38605be3c36d30f121691e38 Mon Sep 17 00:00:00 2001 From: sim Date: Tue, 8 Apr 2003 20:47:38 +0000 Subject: [PATCH] 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" --- filemanager/inc/class.uifilemanager.inc.php | 30 +++++++++--------- filemanager/index.php | 5 ++- filemanager/view.php | 35 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 filemanager/view.php diff --git a/filemanager/inc/class.uifilemanager.inc.php b/filemanager/inc/class.uifilemanager.inc.php index 1fdd7e2fd4..a3ac4a0771 100755 --- a/filemanager/inc/class.uifilemanager.inc.php +++ b/filemanager/inc/class.uifilemanager.inc.php @@ -79,7 +79,7 @@ $this->create_home_dir(); $this->verify_path(); $this->update(); - $GLOBALS['phpgw']->xslttpl->add_file(array('widgets')); + } function load_header() @@ -90,7 +90,9 @@ unset($GLOBALS['phpgw_info']['flags']['noappfooter']); unset($GLOBALS['phpgw_info']['flags']['noappfooter']); 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')); + } function no_header() { @@ -99,7 +101,7 @@ $GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['headonly'] = True; - + $GLOBALS['phpgw']->xslttpl->add_file(array('widgets')); } @@ -743,6 +745,7 @@ } $files_array = $this->bo->load_files(); + $usage = 0; $files_array = $this->dirs_first($files_array); if(count($files_array) || $this->bo->cwd) @@ -760,11 +763,10 @@ 'value' => $file['name'] )); } - @reset($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']]) { @@ -849,6 +851,7 @@ } } } + $GLOBALS['phpgw']->xslttpl->set_var('phpgw', array('summary' => array( 'file_count' => count($files_array), @@ -991,17 +994,14 @@ $this->index($edit); } function view() - { - $GLOBALS['phpgw_info']['flags']['noheader'] = true; - $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; - $GLOBALS['phpgw_info']['flags']['noappheader'] = true; - $GLOBALS['phpgw_info']['flags']['noappfooter'] = true; - - $this->bo->vfs->view(array ( - 'string' => $this->bo->path.'/'.$this->bo->file, - 'relatives' => array (RELATIVE_NONE) - )); - exit();; + { + Header('Location: '.$GLOBALS['phpgw']->link( + 'view.php', + Array('path' => urlencode($this->bo->path), + 'file' => urlencode($this->bo->file)) + ) + ); + } function history() diff --git a/filemanager/index.php b/filemanager/index.php index 0678bfd0fb..73e49ae8cf 100755 --- a/filemanager/index.php +++ b/filemanager/index.php @@ -18,8 +18,7 @@ 'nonavbar' => True, 'noappheader' => True, 'noappfooter' => True, - 'nofooter' => True, - 'xslt_app' => True + 'nofooter' => True ); $GLOBALS['phpgw_info']['flags'] = $phpgw_flags; @@ -29,7 +28,7 @@ '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; exit; ?> diff --git a/filemanager/view.php b/filemanager/view.php new file mode 100644 index 0000000000..643e0f1818 --- /dev/null +++ b/filemanager/view.php @@ -0,0 +1,35 @@ + 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) + )); + +?>