add hook documentListPreview

This commit is contained in:
Uwe Steinmann 2021-12-15 17:17:23 +01:00
parent ad2ea73031
commit 52a9a41d5c
2 changed files with 26 additions and 16 deletions

View File

@ -2908,6 +2908,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<td>"; $content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) { if (file_exists($dms->contentDir . $latestContent->getPath())) {
$previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
if(is_string($previewhtml))
$content .= $previewhtml;
else {
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; $content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">";
if($previewer->hasPreview($latestContent)) { if($previewer->hasPreview($latestContent)) {
@ -2917,6 +2921,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
} }
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>"; $content .= "</a>";
}
} else } else
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>"; $content .= "</td>";

View File

@ -2976,6 +2976,10 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "<td>"; $content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) { if (file_exists($dms->contentDir . $latestContent->getPath())) {
$previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent);
if(is_string($previewhtml))
$content .= $previewhtml;
else {
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">"; $content .= "<a draggable=\"false\" href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$docID."&version=".$version."\">";
if($previewer->hasPreview($latestContent)) { if($previewer->hasPreview($latestContent)) {
@ -2985,6 +2989,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
} }
if($accessop->check_controller_access('Download', array('action'=>'version'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
$content .= "</a>"; $content .= "</a>";
}
} else } else
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>"; $content .= "</td>";