mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add new conversion manager and services
This commit is contained in:
parent
12c79d8773
commit
898943dd6e
|
@ -9,6 +9,7 @@
|
||||||
a folder
|
a folder
|
||||||
- get zendframework from pkgist
|
- get zendframework from pkgist
|
||||||
- auto generate path if not set in settings.xml
|
- auto generate path if not set in settings.xml
|
||||||
|
- add document conversion service
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Changes in version 5.1.23
|
Changes in version 5.1.23
|
||||||
|
|
|
@ -38,6 +38,12 @@ class SeedDMS_Preview_Base {
|
||||||
*/
|
*/
|
||||||
protected $converters;
|
protected $converters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var object $conversionmgr
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected $conversionmgr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer $timeout maximum time for execution of external commands
|
* @var integer $timeout maximum time for execution of external commands
|
||||||
* @access protected
|
* @access protected
|
||||||
|
@ -68,6 +74,7 @@ class SeedDMS_Preview_Base {
|
||||||
}
|
}
|
||||||
$this->timeout = intval($timeout);
|
$this->timeout = intval($timeout);
|
||||||
$this->xsendfile = $xsendfile;
|
$this->xsendfile = $xsendfile;
|
||||||
|
$this->conversionmgr = null;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +148,18 @@ class SeedDMS_Preview_Base {
|
||||||
$this->converters = $arr;
|
$this->converters = $arr;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set conversion service manager
|
||||||
|
*
|
||||||
|
* A conversion manager is a service for converting files from one format
|
||||||
|
* to another format.
|
||||||
|
*
|
||||||
|
* @param object $conversionmgr
|
||||||
|
*/
|
||||||
|
function setConversionMgr($conversionmgr) { /* {{{ */
|
||||||
|
$this->conversionmgr = $conversionmgr;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable xsendfile extension
|
* Enable/Disable xsendfile extension
|
||||||
*
|
*
|
||||||
|
@ -169,11 +188,16 @@ class SeedDMS_Preview_Base {
|
||||||
/**
|
/**
|
||||||
* Check if converter for a given mimetype is set
|
* Check if converter for a given mimetype is set
|
||||||
*
|
*
|
||||||
* @param string $mimetype
|
* @param string $from from mimetype
|
||||||
|
* @param string $to to mimetype
|
||||||
|
*
|
||||||
* @return boolean true if converter exists, otherwise false
|
* @return boolean true if converter exists, otherwise false
|
||||||
*/
|
*/
|
||||||
function hasConverter($mimetype) { /* {{{ */
|
function hasConverter($from, $to='') { /* {{{ */
|
||||||
return array_key_exists($mimetype, $this->converters) && $this->converters[$mimetype];
|
if($this->conversionmgr)
|
||||||
|
return $this->conversionmgr->hasService($from, $to);
|
||||||
|
else
|
||||||
|
return array_key_exists($from, $this->converters) && $this->converters[$from];
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,6 +68,17 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
||||||
return $target;
|
return $target;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if converter for a given mimetype is set
|
||||||
|
*
|
||||||
|
* @param string $mimetype from mimetype
|
||||||
|
*
|
||||||
|
* @return boolean true if converter exists, otherwise false
|
||||||
|
*/
|
||||||
|
function hasConverter($from, $to='') { /* {{{ */
|
||||||
|
return parent::hasConverter($from, 'application/pdf');
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a pdf preview for a given file
|
* Create a pdf preview for a given file
|
||||||
*
|
*
|
||||||
|
@ -98,6 +109,11 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
||||||
$target = $this->previewDir.$dir.md5($infile);
|
$target = $this->previewDir.$dir.md5($infile);
|
||||||
$this->lastpreviewfile = $target.'.pdf';
|
$this->lastpreviewfile = $target.'.pdf';
|
||||||
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
|
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
|
||||||
|
if($this->conversionmgr) {
|
||||||
|
if($this->conversionmgr->hasService($mimetype, 'application/pdf')) {
|
||||||
|
return $this->conversionmgr->convert($infile, $mimetype, 'application/pdf', $target.'.pdf');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$cmd = '';
|
$cmd = '';
|
||||||
$mimeparts = explode('/', $mimetype, 2);
|
$mimeparts = explode('/', $mimetype, 2);
|
||||||
if(isset($this->converters[$mimetype])) {
|
if(isset($this->converters[$mimetype])) {
|
||||||
|
@ -115,6 +131,7 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -72,6 +72,17 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
||||||
return $target;
|
return $target;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if converter for a given mimetype is set
|
||||||
|
*
|
||||||
|
* @param string $mimetype from mimetype
|
||||||
|
*
|
||||||
|
* @return boolean true if converter exists, otherwise false
|
||||||
|
*/
|
||||||
|
function hasConverter($from, $to='') { /* {{{ */
|
||||||
|
return parent::hasConverter($from, 'image/png');
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a preview image for a given file
|
* Create a preview image for a given file
|
||||||
*
|
*
|
||||||
|
@ -107,6 +118,15 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
||||||
$target = $this->previewDir.$dir.md5($infile).'-'.$width;
|
$target = $this->previewDir.$dir.md5($infile).'-'.$width;
|
||||||
$this->lastpreviewfile = $target.'.png';
|
$this->lastpreviewfile = $target.'.png';
|
||||||
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
|
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
|
||||||
|
if($this->conversionmgr) {
|
||||||
|
if($this->conversionmgr->hasService($mimetype, 'image/png')) {
|
||||||
|
if(!$this->conversionmgr->convert($infile, $mimetype, 'image/png', $target.'.png', array('width'=>$width))) {
|
||||||
|
$this->lastpreviewfile = '';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$new = true;
|
||||||
|
} else {
|
||||||
$cmd = '';
|
$cmd = '';
|
||||||
$mimeparts = explode('/', $mimetype, 2);
|
$mimeparts = explode('/', $mimetype, 2);
|
||||||
if(isset($this->converters[$mimetype])) {
|
if(isset($this->converters[$mimetype])) {
|
||||||
|
@ -126,6 +146,7 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$new = false;
|
$new = false;
|
||||||
|
|
|
@ -27,6 +27,7 @@ class SeedDMS_Controller_PdfPreview extends SeedDMS_Controller_Common {
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$type = $this->params['type'];
|
$type = $this->params['type'];
|
||||||
$settings = $this->params['settings'];
|
$settings = $this->params['settings'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
|
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case "version":
|
case "version":
|
||||||
|
@ -51,6 +52,9 @@ class SeedDMS_Controller_PdfPreview extends SeedDMS_Controller_Common {
|
||||||
$this->params['content'] = $content;
|
$this->params['content'] = $content;
|
||||||
if(null === $this->callHook('version')) {
|
if(null === $this->callHook('version')) {
|
||||||
$previewer = new SeedDMS_Preview_PdfPreviewer($settings->_cacheDir, $settings->_cmdTimeout);
|
$previewer = new SeedDMS_Preview_PdfPreviewer($settings->_cacheDir, $settings->_cmdTimeout);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters(isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array());
|
$previewer->setConverters(isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array());
|
||||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||||
if(!$previewer->hasPreview($content)) {
|
if(!$previewer->hasPreview($content)) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$type = $this->params['type'];
|
$type = $this->params['type'];
|
||||||
$settings = $this->params['settings'];
|
$settings = $this->params['settings'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
|
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case "version":
|
case "version":
|
||||||
|
@ -55,6 +56,9 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
||||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
||||||
else
|
else
|
||||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($settings->_converters['preview']);
|
$previewer->setConverters($settings->_converters['preview']);
|
||||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||||
if(!$previewer->hasPreview($content)) {
|
if(!$previewer->hasPreview($content)) {
|
||||||
|
@ -86,6 +90,9 @@ class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
|
||||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
|
||||||
else
|
else
|
||||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($settings->_converters['preview']);
|
$previewer->setConverters($settings->_converters['preview']);
|
||||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||||
|
|
||||||
|
|
65
inc/inc.ClassConversionMgr.php
Normal file
65
inc/inc.ClassConversionMgr.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion manager
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc/inc.ClassConversionServiceExec.php");
|
||||||
|
require_once("inc/inc.ClassConversionServiceImageToImage.php");
|
||||||
|
require_once("inc/inc.ClassConversionServicePdfToImage.php");
|
||||||
|
require_once("inc/inc.ClassConversionServiceTextToText.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion manager
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_ConversionMgr {
|
||||||
|
/**
|
||||||
|
* List of services for searching fulltext
|
||||||
|
*/
|
||||||
|
public $services;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->services = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addService($service) {
|
||||||
|
$this->services[$service->from][$service->to][] = $service;
|
||||||
|
return $service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasService($from, $to) {
|
||||||
|
if(!empty($this->services[$from][$to]))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a file
|
||||||
|
*
|
||||||
|
* @param string $file name of file to convert
|
||||||
|
* @param string $from mimetype of input file
|
||||||
|
* @param string $to mimetype of output file
|
||||||
|
*
|
||||||
|
* @return boolean true on success, other false
|
||||||
|
*/
|
||||||
|
public function convert($file, $from, $to, $target=null, $params=array()) {
|
||||||
|
if(isset($this->services[$from][$to])) {
|
||||||
|
$service = array_pop($this->services[$from][$to]);
|
||||||
|
return $service->convert($file, $target, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
inc/inc.ClassConversionServiceBase.php
Normal file
54
inc/inc.ClassConversionServiceBase.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service base class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service base class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
abstract class SeedDMS_ConversionServiceBase {
|
||||||
|
/**
|
||||||
|
* mimetype original file
|
||||||
|
*/
|
||||||
|
public $from;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mimetype converted file
|
||||||
|
*/
|
||||||
|
public $to;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logger
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->from = null;
|
||||||
|
$this->to = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLogger($logger) {
|
||||||
|
$this->logger = $logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInfo() {
|
||||||
|
return 'Conversion service';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function convert($infile, $target = null, $params = array()) {
|
||||||
|
}
|
||||||
|
}
|
126
inc/inc.ClassConversionServiceExec.php
Normal file
126
inc/inc.ClassConversionServiceExec.php
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service exec class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service exec class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_ConversionServiceExec extends SeedDMS_ConversionServiceBase {
|
||||||
|
/**
|
||||||
|
* shell cmd
|
||||||
|
*/
|
||||||
|
public $cmd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timeout
|
||||||
|
*/
|
||||||
|
public $timeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run a shell command
|
||||||
|
*
|
||||||
|
* @param $cmd
|
||||||
|
* @param int $timeout
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
static function execWithTimeout($cmd, $timeout=5) { /* {{{ */
|
||||||
|
$descriptorspec = array(
|
||||||
|
0 => array("pipe", "r"),
|
||||||
|
1 => array("pipe", "w"),
|
||||||
|
2 => array("pipe", "w")
|
||||||
|
);
|
||||||
|
$pipes = array();
|
||||||
|
|
||||||
|
$timeout += time();
|
||||||
|
// Putting an 'exec' before the command will not fork the command
|
||||||
|
// and therefore not create any child process. proc_terminate will
|
||||||
|
// then reliably terminate the cmd and not just shell. See notes of
|
||||||
|
// https://www.php.net/manual/de/function.proc-terminate.php
|
||||||
|
$process = proc_open('exec '.$cmd, $descriptorspec, $pipes);
|
||||||
|
if (!is_resource($process)) {
|
||||||
|
throw new Exception("proc_open failed on: " . $cmd);
|
||||||
|
}
|
||||||
|
stream_set_blocking($pipes[1], 0);
|
||||||
|
stream_set_blocking($pipes[2], 0);
|
||||||
|
|
||||||
|
$output = $error = '';
|
||||||
|
$timeleft = $timeout - time();
|
||||||
|
$read = array($pipes[1], $pipes[2]);
|
||||||
|
$write = NULL;
|
||||||
|
$exeptions = NULL;
|
||||||
|
do {
|
||||||
|
$num_changed_streams = stream_select($read, $write, $exeptions, $timeleft, 200000);
|
||||||
|
|
||||||
|
if ($num_changed_streams === false) {
|
||||||
|
proc_terminate($process);
|
||||||
|
throw new Exception("stream select failed on: " . $cmd);
|
||||||
|
} elseif ($num_changed_streams > 0) {
|
||||||
|
$output .= fread($pipes[1], 8192);
|
||||||
|
$error .= fread($pipes[2], 8192);
|
||||||
|
}
|
||||||
|
$timeleft = $timeout - time();
|
||||||
|
} while (!feof($pipes[1]) && $timeleft > 0);
|
||||||
|
|
||||||
|
fclose($pipes[0]);
|
||||||
|
fclose($pipes[1]);
|
||||||
|
fclose($pipes[2]);
|
||||||
|
if ($timeleft <= 0) {
|
||||||
|
proc_terminate($process);
|
||||||
|
throw new Exception("command timeout on: " . $cmd);
|
||||||
|
} else {
|
||||||
|
$return_value = proc_close($process);
|
||||||
|
return array('stdout'=>$output, 'stderr'=>$error, 'return'=>$return_value);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
public function __construct($from, $to, $cmd) {
|
||||||
|
$this->from = $from;
|
||||||
|
$this->to = $to;
|
||||||
|
$this->cmd = $cmd;
|
||||||
|
$this->timeout = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function convert($infile, $target = null, $params = array()) {
|
||||||
|
$start = microtime(true);
|
||||||
|
if(!$target)
|
||||||
|
$tmpfile = tempnam(sys_get_temp_dir(), 'convert');
|
||||||
|
else
|
||||||
|
$tmpfile = $target;
|
||||||
|
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array(isset($params['width']) ? $params['width'] : '', $infile, $tmpfile, $this->from), $this->cmd);
|
||||||
|
try {
|
||||||
|
self::execWithTimeout($cmd, $this->timeout);
|
||||||
|
} catch(Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$end = microtime(true);
|
||||||
|
if($this->logger) {
|
||||||
|
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with cmd "'.$this->cmd.'" took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||||
|
}
|
||||||
|
if(!$target) {
|
||||||
|
$content = file_get_contents($tmpfile);
|
||||||
|
unlink($tmpfile);
|
||||||
|
return $content;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
57
inc/inc.ClassConversionServiceImageToImage.php
Normal file
57
inc/inc.ClassConversionServiceImageToImage.php
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service image class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service image class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_ConversionServiceImageToImage extends SeedDMS_ConversionServiceBase {
|
||||||
|
/**
|
||||||
|
* timeout
|
||||||
|
*/
|
||||||
|
public $timeout;
|
||||||
|
|
||||||
|
public function __construct($from, $to) {
|
||||||
|
$this->from = $from;
|
||||||
|
$this->to = $to;
|
||||||
|
$this->timeout = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function convert($infile, $target = null, $params = array()) {
|
||||||
|
$start = microtime(true);
|
||||||
|
$imagick = new Imagick();
|
||||||
|
if($imagick->readImage($infile)) {
|
||||||
|
if(!empty($params['width']))
|
||||||
|
$imagick->scaleImage((int) $params['width'], 0);
|
||||||
|
$end = microtime(true);
|
||||||
|
if($this->logger) {
|
||||||
|
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with image service took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||||
|
}
|
||||||
|
if($target) {
|
||||||
|
return $imagick->writeImage($target);
|
||||||
|
} else {
|
||||||
|
return $imagick->getImageBlob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
63
inc/inc.ClassConversionServicePdfToImage.php
Normal file
63
inc/inc.ClassConversionServicePdfToImage.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service pdf class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service pdf class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_ConversionServicePdfToImage extends SeedDMS_ConversionServiceBase {
|
||||||
|
/**
|
||||||
|
* timeout
|
||||||
|
*/
|
||||||
|
public $timeout;
|
||||||
|
|
||||||
|
public function __construct($from, $to) {
|
||||||
|
$this->from = $from;
|
||||||
|
$this->to = $to;
|
||||||
|
$this->timeout = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function convert($infile, $target = null, $params = array()) {
|
||||||
|
$start = microtime(true);
|
||||||
|
$imagick = new Imagick();
|
||||||
|
/* Setting a smaller resolution will speed up the conversion
|
||||||
|
* A resolution of 72,72 will create a 596x842 image
|
||||||
|
*/
|
||||||
|
$imagick->setResolution(36,36);
|
||||||
|
if($imagick->readImage($infile.'[0]')) {
|
||||||
|
if(!empty($params['width']))
|
||||||
|
$imagick->scaleImage((int) $params['width'], 0);
|
||||||
|
$imagick->setImageFormat('png');
|
||||||
|
$end = microtime(true);
|
||||||
|
if($this->logger) {
|
||||||
|
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with pdf service took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||||
|
}
|
||||||
|
if($target) {
|
||||||
|
return $imagick->writeImage($target);
|
||||||
|
} else {
|
||||||
|
return $imagick->getImageBlob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
39
inc/inc.ClassConversionServiceTextToText.php
Normal file
39
inc/inc.ClassConversionServiceTextToText.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service class
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of conversion service class for text to text
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_ConversionServiceTextToText extends SeedDMS_ConversionServiceBase {
|
||||||
|
public function __construct($from, $to) {
|
||||||
|
$this->from = $from;
|
||||||
|
$this->to = $to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function convert($infile, $target = null, $params = array()) {
|
||||||
|
if($target) {
|
||||||
|
file_put_contents($target, file_get_contents($infile));
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return file_get_contents($infile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
36
inc/inc.ConversionInit.php
Normal file
36
inc/inc.ConversionInit.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
$conversionmgr = null;
|
||||||
|
require_once("inc.ClassConversionMgr.php");
|
||||||
|
$conversionmgr = new SeedDMS_ConversionMgr();
|
||||||
|
|
||||||
|
if(!empty($settings->_converters['preview'])) {
|
||||||
|
foreach($settings->_converters['preview'] as $mimetype=>$cmd) {
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceExec($mimetype, 'image/png', $cmd))->setLogger($logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($settings->_converters['pdf'])) {
|
||||||
|
foreach($settings->_converters['pdf'] as $mimetype=>$cmd) {
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceExec($mimetype, 'application/pdf', $cmd))->setLogger($logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServicePdfToImage('application/pdf', 'image/png'))->setLogger($logger);
|
||||||
|
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/jpeg', 'image/png'))->setLogger($logger);
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/png', 'image/png'))->setLogger($logger);
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/jpg', 'image/png'))->setLogger($logger);
|
||||||
|
|
||||||
|
$conversionmgr->addService(new SeedDMS_ConversionServiceTextToText('text/plain', 'text/plain'))->setLogger($logger);
|
||||||
|
|
||||||
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['initConversion'])) {
|
||||||
|
foreach($GLOBALS['SEEDDMS_HOOKS']['initConversion'] as $hookObj) {
|
||||||
|
if (method_exists($hookObj, 'getConversionServices')) {
|
||||||
|
if($services = $hookObj->getConversionServices(array('dms'=>$dms, 'settings'=>$settings, 'logger'=>$logger))) {
|
||||||
|
foreach($services as $service) {
|
||||||
|
$conversionmgr->addService($service)->setLogger($logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,6 +59,7 @@ if(isset($_GET['version'])) {
|
||||||
$controller->setParam('document', $document);
|
$controller->setParam('document', $document);
|
||||||
$controller->setParam('version', $version);
|
$controller->setParam('version', $version);
|
||||||
$controller->setParam('type', 'version');
|
$controller->setParam('type', 'version');
|
||||||
|
$controller->setParam('conversionmgr', $conversionmgr);
|
||||||
if(!$controller->run()) {
|
if(!$controller->run()) {
|
||||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ if ($document->getAccessMode($user) < M_READ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$controller->setParam('conversionmgr', $conversionmgr);
|
||||||
if(isset($_GET['version'])) {
|
if(isset($_GET['version'])) {
|
||||||
$version = $_GET["version"];
|
$version = $_GET["version"];
|
||||||
if (!is_numeric($version))
|
if (!is_numeric($version))
|
||||||
|
|
|
@ -71,6 +71,7 @@ $accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings);
|
||||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
if($view) {
|
if($view) {
|
||||||
|
$view->setParam('conversionmgr', $conversionmgr);
|
||||||
$view->setParam('folder', $folder);
|
$view->setParam('folder', $folder);
|
||||||
$view->setParam('document', $document);
|
$view->setParam('document', $document);
|
||||||
$view->setParam('version', $version);
|
$view->setParam('version', $version);
|
||||||
|
|
|
@ -66,6 +66,7 @@ if ($document->verifyLastestContentExpriry()){
|
||||||
|
|
||||||
if($view) {
|
if($view) {
|
||||||
$view->setParam('fulltextservice', $fulltextservice);
|
$view->setParam('fulltextservice', $fulltextservice);
|
||||||
|
$view->setParam('conversionmgr', $conversionmgr);
|
||||||
$view->setParam('folder', $folder);
|
$view->setParam('folder', $folder);
|
||||||
$view->setParam('document', $document);
|
$view->setParam('document', $document);
|
||||||
$view->setParam('accessobject', $accessop);
|
$view->setParam('accessobject', $accessop);
|
||||||
|
|
|
@ -77,6 +77,7 @@ if($view) {
|
||||||
if(isset($_GET['action']) && $_GET['action'] == 'subtree')
|
if(isset($_GET['action']) && $_GET['action'] == 'subtree')
|
||||||
$view->setParam('node', $node);
|
$view->setParam('node', $node);
|
||||||
$view->setParam('fulltextservice', $fulltextservice);
|
$view->setParam('fulltextservice', $fulltextservice);
|
||||||
|
$view->setParam('conversionmgr', $conversionmgr);
|
||||||
$view->setParam('folder', $folder);
|
$view->setParam('folder', $folder);
|
||||||
$view->setParam('orderby', $orderby);
|
$view->setParam('orderby', $orderby);
|
||||||
$view->setParam('enableFolderTree', $settings->_enableFolderTree);
|
$view->setParam('enableFolderTree', $settings->_enableFolderTree);
|
||||||
|
|
|
@ -60,6 +60,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
||||||
$converttopdf = $this->params['convertToPdf'];
|
$converttopdf = $this->params['convertToPdf'];
|
||||||
$pdfconverters = $this->params['pdfConverters'];
|
$pdfconverters = $this->params['pdfConverters'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$version = $this->params['version'];
|
$version = $this->params['version'];
|
||||||
if(!$showfullpreview)
|
if(!$showfullpreview)
|
||||||
return;
|
return;
|
||||||
|
@ -125,6 +126,9 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
||||||
|
|
||||||
if($converttopdf) {
|
if($converttopdf) {
|
||||||
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$pdfpreviewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$pdfpreviewer->setConverters($pdfconverters);
|
$pdfpreviewer->setConverters($pdfconverters);
|
||||||
if($pdfpreviewer->hasConverter($version->getMimeType())) {
|
if($pdfpreviewer->hasConverter($version->getMimeType())) {
|
||||||
$this->contentHeading(getMLText("preview_pdf"));
|
$this->contentHeading(getMLText("preview_pdf"));
|
||||||
|
@ -145,7 +149,9 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
||||||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||||
$enableversionmodification = $this->params['enableversionmodification'];
|
$enableversionmodification = $this->params['enableversionmodification'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||||
|
$previewconverters = $this->params['previewConverters'];
|
||||||
$timeout = $this->params['timeout'];
|
$timeout = $this->params['timeout'];
|
||||||
$xsendfile = $this->params['xsendfile'];
|
$xsendfile = $this->params['xsendfile'];
|
||||||
|
|
||||||
|
@ -261,6 +267,10 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Theme_Style {
|
||||||
|
|
||||||
print "</ul>";
|
print "</ul>";
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
|
$previewer->setConverters($previewconverters);
|
||||||
$previewer->createPreview($version);
|
$previewer->createPreview($version);
|
||||||
if ($file_exists) {
|
if ($file_exists) {
|
||||||
if ($viewonlinefiletypes && (in_array(strtolower($version->getFileType()), $viewonlinefiletypes) || in_array(strtolower($version->getMimeType()), $viewonlinefiletypes))) {
|
if ($viewonlinefiletypes && (in_array(strtolower($version->getFileType()), $viewonlinefiletypes) || in_array(strtolower($version->getMimeType()), $viewonlinefiletypes))) {
|
||||||
|
|
|
@ -120,10 +120,19 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
$previewwidth = $this->params['previewWidthList'];
|
$previewwidth = $this->params['previewWidthList'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
|
$previewconverters = $this->params['previewConverters'];
|
||||||
|
$timeout = $this->params['timeout'];
|
||||||
|
$xsendfile = $this->params['xsendfile'];
|
||||||
$document = $this->params['document'];
|
$document = $this->params['document'];
|
||||||
|
|
||||||
if($document) {
|
if($document) {
|
||||||
if ($document->getAccessMode($user) >= M_READ) {
|
if ($document->getAccessMode($user) >= M_READ) {
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
|
$previewer->setConverters($previewconverters);
|
||||||
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewitem');
|
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewitem');
|
||||||
if(is_string($txt))
|
if(is_string($txt))
|
||||||
$content = $txt;
|
$content = $txt;
|
||||||
|
@ -226,6 +235,7 @@ $(document).ready( function() {
|
||||||
$accessobject = $this->params['accessobject'];
|
$accessobject = $this->params['accessobject'];
|
||||||
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
$viewonlinefiletypes = $this->params['viewonlinefiletypes'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||||
$previewconverters = $this->params['previewConverters'];
|
$previewconverters = $this->params['previewConverters'];
|
||||||
$timeout = $this->params['timeout'];
|
$timeout = $this->params['timeout'];
|
||||||
|
@ -233,6 +243,9 @@ $(document).ready( function() {
|
||||||
$documentid = $document->getId();
|
$documentid = $document->getId();
|
||||||
|
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
$latestContent = $this->callHook('documentLatestContent', $document);
|
$latestContent = $this->callHook('documentLatestContent', $document);
|
||||||
if($latestContent === null)
|
if($latestContent === null)
|
||||||
|
@ -498,6 +511,7 @@ $(document).ready( function() {
|
||||||
$converttopdf = $this->params['convertToPdf'];
|
$converttopdf = $this->params['convertToPdf'];
|
||||||
$pdfconverters = $this->params['pdfConverters'];
|
$pdfconverters = $this->params['pdfConverters'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
if(!$showfullpreview)
|
if(!$showfullpreview)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -567,6 +581,9 @@ $(document).ready( function() {
|
||||||
|
|
||||||
if($converttopdf) {
|
if($converttopdf) {
|
||||||
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
$pdfpreviewer = new SeedDMS_Preview_PdfPreviewer($cachedir, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$pdfpreviewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$pdfpreviewer->setConverters($pdfconverters);
|
$pdfpreviewer->setConverters($pdfconverters);
|
||||||
if($pdfpreviewer->hasConverter($latestContent->getMimeType())) {
|
if($pdfpreviewer->hasConverter($latestContent->getMimeType())) {
|
||||||
$this->contentHeading(getMLText("preview_pdf"));
|
$this->contentHeading(getMLText("preview_pdf"));
|
||||||
|
@ -774,6 +791,7 @@ $(document).ready( function() {
|
||||||
$enableremoverevapp = $this->params['enableremoverevapp'];
|
$enableremoverevapp = $this->params['enableremoverevapp'];
|
||||||
$workflowmode = $this->params['workflowmode'];
|
$workflowmode = $this->params['workflowmode'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$previewwidthlist = $this->params['previewWidthList'];
|
$previewwidthlist = $this->params['previewWidthList'];
|
||||||
$previewwidthdetail = $this->params['previewWidthDetail'];
|
$previewwidthdetail = $this->params['previewWidthDetail'];
|
||||||
$previewconverters = $this->params['previewConverters'];
|
$previewconverters = $this->params['previewConverters'];
|
||||||
|
@ -917,6 +935,9 @@ $(document).ready( function() {
|
||||||
|
|
||||||
$this->contentContainerStart();
|
$this->contentContainerStart();
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
$this->showVersionDetails($latestContent, $previewer, true);
|
$this->showVersionDetails($latestContent, $previewer, true);
|
||||||
$this->contentContainerEnd();
|
$this->contentContainerEnd();
|
||||||
|
|
|
@ -353,6 +353,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
$orderby = $this->params['orderby'];
|
$orderby = $this->params['orderby'];
|
||||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||||
$incItemsPerPage = $this->params['incItemsPerPage'];
|
$incItemsPerPage = $this->params['incItemsPerPage'];
|
||||||
$previewwidth = $this->params['previewWidthList'];
|
$previewwidth = $this->params['previewWidthList'];
|
||||||
|
@ -362,6 +363,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
$onepage = $this->params['onepage'];
|
$onepage = $this->params['onepage'];
|
||||||
|
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
|
|
||||||
$txt = $this->callHook('listHeader', $folder);
|
$txt = $this->callHook('listHeader', $folder);
|
||||||
|
@ -491,6 +495,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
$orderby = $this->params['orderby'];
|
$orderby = $this->params['orderby'];
|
||||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$previewwidth = $this->params['previewWidthList'];
|
$previewwidth = $this->params['previewWidthList'];
|
||||||
$previewconverters = $this->params['previewConverters'];
|
$previewconverters = $this->params['previewConverters'];
|
||||||
$timeout = $this->params['timeout'];
|
$timeout = $this->params['timeout'];
|
||||||
|
@ -501,6 +506,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
|
|
||||||
$subFolders = $this->callHook('folderGetSubFolders', $folder, $orderby[0]);
|
$subFolders = $this->callHook('folderGetSubFolders', $folder, $orderby[0]);
|
||||||
|
@ -568,6 +576,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
$expandFolderTree = $this->params['expandFolderTree'];
|
$expandFolderTree = $this->params['expandFolderTree'];
|
||||||
$showtree = $this->params['showtree'];
|
$showtree = $this->params['showtree'];
|
||||||
$cachedir = $this->params['cachedir'];
|
$cachedir = $this->params['cachedir'];
|
||||||
|
$conversionmgr = $this->params['conversionmgr'];
|
||||||
$enableRecursiveCount = $this->params['enableRecursiveCount'];
|
$enableRecursiveCount = $this->params['enableRecursiveCount'];
|
||||||
$maxRecursiveCount = $this->params['maxRecursiveCount'];
|
$maxRecursiveCount = $this->params['maxRecursiveCount'];
|
||||||
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
$maxItemsPerPage = $this->params['maxItemsPerPage'];
|
||||||
|
@ -579,6 +588,9 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
|
|
||||||
$folderid = $folder->getId();
|
$folderid = $folder->getId();
|
||||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
|
if($conversionmgr)
|
||||||
|
$previewer->setConversionMgr($conversionmgr);
|
||||||
|
else
|
||||||
$previewer->setConverters($previewconverters);
|
$previewer->setConverters($previewconverters);
|
||||||
|
|
||||||
// echo $this->callHook('startPage');
|
// echo $this->callHook('startPage');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user