use showActions() to output list of buttons on attachment tab

This commit is contained in:
Uwe Steinmann 2023-12-13 08:07:38 +01:00
parent 03de004b30
commit 2a2035cccf

View File

@ -141,7 +141,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
$txt = $this->callHook('documentListItem', $document, $previewer, false, 'viewitem');
if(is_string($txt))
$content = $txt;
else
else
$content = $this->documentListRow($document, $previewer, true);
echo $content;
}
@ -337,7 +337,8 @@ $(document).ready( function() {
}
print "</td>";
print "<td><ul class=\"actions unstyled\">\n";
print "<td>";
print "<ul class=\"actions unstyled\">\n";
print "<li>".htmlspecialchars($file->getName())."</li>\n";
if($file->getName() != $file->getOriginalFileName())
print "<li>".htmlspecialchars($file->getOriginalFileName())."</li>\n";
@ -355,23 +356,26 @@ $(document).ready( function() {
print "</ul></td>";
print "<td>".htmlspecialchars($file->getComment())."</td>";
print "<td><ul class=\"unstyled actions\">";
print "<td>";
$items = [];
if ($file_exists) {
if($accessobject->check_controller_access('Download', array('action'=>'file'))) {
print "<li><a href=\"".$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"fa fa-download\"></i>".getMLText('download')."</a></li>";
$items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID(), 'icon'=>'download', 'label'=>'download');
}
if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) {
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
print "<li><a target=\"_blank\" href=\"".$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>";
$items[] = array('link'=>$this->params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID(), 'icon'=>'star', 'label'=>'view_online');
}
}
}
echo "</ul><ul class=\"unstyled actions\">";
$this->showActions($items);
$items = [];
if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) {
print $this->html_link('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-remove"></i>'.getMLText("delete"), false, true, array('<li>', '</li>'));
print $this->html_link('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID()), array(), '<i class="fa fa-edit"></i>'.getMLText("edit"), false, true, array('<li>', '</li>'));
$items[] = array('link'=>$this->html_url('RemoveDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID())), 'icon'=>'remove', 'label'=>'delete');
$items[] = array('link'=>$this->html_url('EditDocumentFile', array('documentid'=>$document->getID(), 'fileid'=>$file->getID())), 'icon'=>'edit', 'label'=>'edit');
}
print "</ul></td>";
$this->showActions($items);
print "</td>";
print "</tr>";
}