mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
call hook to get document content
This commit is contained in:
parent
00c6c72f25
commit
e2ab2ba1af
|
@ -28,7 +28,17 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
|
|||
|
||||
switch($type) {
|
||||
case "version":
|
||||
$content = $this->params['content'];
|
||||
$version = $this->params['version'];
|
||||
$document = $this->params['document'];
|
||||
$content = $document->getContentByVersion($version);
|
||||
if (!is_object($content)) {
|
||||
$this->errormsg = 'invalid_version';
|
||||
return false;
|
||||
}
|
||||
/* set params['content'] for compatiblity with older extensions which
|
||||
* expect the content in the controller
|
||||
*/
|
||||
$this->params['content'] = $content;
|
||||
if(null === $this->callHook('version')) {
|
||||
if(file_exists($dms->contentDir . $content->getPath())) {
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
|
@ -43,5 +53,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
|
|||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,28 @@ class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
|
|||
$dms = $this->params['dms'];
|
||||
$settings = $this->params['settings'];
|
||||
$type = $this->params['type'];
|
||||
$content = $this->params['content'];
|
||||
$document = $content->getDocument();
|
||||
|
||||
switch($type) {
|
||||
case "version":
|
||||
$version = $this->params['version'];
|
||||
$document = $this->params['document'];
|
||||
if($version < 1) {
|
||||
$content = $this->callHook('documentLatestContent', $document);
|
||||
if($content === null)
|
||||
$content = $document->getLatestContent();
|
||||
} else {
|
||||
$content = $this->callHook('documentContent', $document, $version);
|
||||
if($content === null)
|
||||
$content = $document->getContentByVersion($version);
|
||||
}
|
||||
if (!is_object($content)) {
|
||||
$this->errormsg = 'invalid_version';
|
||||
return false;
|
||||
}
|
||||
/* set params['content'] for compatiblity with older extensions which
|
||||
* expect the content in the controller
|
||||
*/
|
||||
$this->params['content'] = $content;
|
||||
if(null === $this->callHook('version')) {
|
||||
header("Content-Type: " . $content->getMimeType());
|
||||
$efilename = rawurlencode($content->getOriginalFileName());
|
||||
|
@ -46,5 +63,7 @@ class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
|
|||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user