From 74300082fcfdf5f360c47bebd4387aa5b3588525 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 20 Jan 2020 11:53:38 +0100 Subject: [PATCH 1/2] fix bug #462, pass showtree to ViewDocument --- CHANGELOG | 1 + out/out.ViewDocument.php | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 01f64b8b5..6be2a45bc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ - clean up code for managing extensions - fix renaming of folders via webdav - fix list of expired documents on MyDocuments page +- pass showtree to ViewDocument (Closes: #462) -------------------------------------------------------------------------------- Changes in version 5.1.13 diff --git a/out/out.ViewDocument.php b/out/out.ViewDocument.php index fd0a7d234..af38db22a 100644 --- a/out/out.ViewDocument.php +++ b/out/out.ViewDocument.php @@ -77,6 +77,7 @@ if($view) { $view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array()); $view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array()); $view->setParam('showFullPreview', $settings->_showFullPreview); + $view->setParam('showtree', showtree()); $view->setParam('convertToPdf', $settings->_convertToPdf); $view->setParam('currenttab', isset($_GET['currenttab']) ? $_GET['currenttab'] : ""); $view->setParam('timeout', $settings->_cmdTimeout); From e830477bf0101d67b1f35890ab08b3927fcd1a80 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Jan 2020 08:11:03 +0100 Subject: [PATCH 2/2] new method getPreviewFile(), start version 1.13.0 --- SeedDMS_Preview/Preview/Base.php | 31 ++++++++++++++++++------ SeedDMS_Preview/Preview/PdfPreviewer.php | 2 ++ SeedDMS_Preview/Preview/Previewer.php | 2 ++ SeedDMS_Preview/package.xml | 26 ++++++++++++++++---- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/SeedDMS_Preview/Preview/Base.php b/SeedDMS_Preview/Preview/Base.php index da153b305..f34359e7e 100644 --- a/SeedDMS_Preview/Preview/Base.php +++ b/SeedDMS_Preview/Preview/Base.php @@ -50,6 +50,12 @@ class SeedDMS_Preview_Base { */ protected $xsendfile; + /** + * @var string $lastpreviewfile will be set to the file name of the last preview + * @access protected + */ + protected $lastpreviewfile; + function __construct($previewDir, $timeout=5, $xsendfile=true) { /* {{{ */ if(!is_dir($previewDir)) { if (!SeedDMS_Core_File::makeDir($previewDir)) { @@ -154,14 +160,14 @@ class SeedDMS_Preview_Base { return array_key_exists($mimetype, $this->converters) && $this->converters[$mimetype]; } /* }}} */ -/** - * Send a file from disk to the browser - * - * This function uses either readfile() or the xѕendfile apache module if - * it is installed. - * - * @param string $filename - */ + /** + * Send a file from disk to the browser + * + * This function uses either readfile() or the xѕendfile apache module if + * it is installed. + * + * @param string $filename + */ protected function sendFile($filename) { /* {{{ */ if($this->xsendfile && function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) { header("X-Sendfile: ".$filename); @@ -173,5 +179,14 @@ class SeedDMS_Preview_Base { readfile($filename); } } /* }}} */ + + /** + * Return path of last created preview file + * + * @return string + */ + public function getPreviewFile() { /* {{{ */ + return $this->lastpreviewfile; + } /* }}} */ } diff --git a/SeedDMS_Preview/Preview/PdfPreviewer.php b/SeedDMS_Preview/Preview/PdfPreviewer.php index daae6a4ed..d4cc0b477 100644 --- a/SeedDMS_Preview/Preview/PdfPreviewer.php +++ b/SeedDMS_Preview/Preview/PdfPreviewer.php @@ -96,6 +96,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base { return false; if(!$target) $target = $this->previewDir.$dir.md5($infile); + $this->lastpreviewfile = $target.'.png'; if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) { $cmd = ''; $mimeparts = explode('/', $mimetype, 2); @@ -110,6 +111,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base { try { self::execWithTimeout($cmd, $this->timeout); } catch(Exception $e) { + $this->lastpreviewfile = ''; return false; } } diff --git a/SeedDMS_Preview/Preview/Previewer.php b/SeedDMS_Preview/Preview/Previewer.php index 9e2fe2a34..ba69b75a4 100644 --- a/SeedDMS_Preview/Preview/Previewer.php +++ b/SeedDMS_Preview/Preview/Previewer.php @@ -105,6 +105,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base { return false; if(!$target) $target = $this->previewDir.$dir.md5($infile).'-'.$width; + $this->lastpreviewfile = $target.'.png'; if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) { $cmd = ''; $mimeparts = explode('/', $mimetype, 2); @@ -120,6 +121,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base { try { self::execWithTimeout($cmd, $this->timeout); } catch(Exception $e) { + $this->lastpreviewfile = ''; return false; } } diff --git a/SeedDMS_Preview/package.xml b/SeedDMS_Preview/package.xml index 753cf4768..aa4a3992f 100644 --- a/SeedDMS_Preview/package.xml +++ b/SeedDMS_Preview/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2019-02-11 + 2020-01-21 - 1.2.10 - 1.2.10 + 1.3.0 + 1.3.0 stable @@ -23,8 +23,7 @@ GPL License -new parameter for enabling/disabling xsendfile -fix creation of pdf preview if document content class is not SeedDMS_Core_DocumentContent +add new methode getPreviewFile() @@ -404,5 +403,22 @@ make sure list of converters is always an array usage of mod_sendfile can be configured + + 2019-02-11 + + + 1.2.10 + 1.2.10 + + + stable + stable + + GPL License + +new parameter for enabling/disabling xsendfile +fix creation of pdf preview if document content class is not SeedDMS_Core_DocumentContent + +