mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
add method showActions(), move version actions in second column
This commit is contained in:
parent
80689dc9c1
commit
ca4022ce7c
|
@ -443,6 +443,40 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
protected function showActions($items) { /* {{{ */
|
||||
print "<ul class=\"nav nav-pills mb-4\">";
|
||||
foreach($items as $item) {
|
||||
if(is_string($item))
|
||||
echo "<li class=\"nav-item\">".$item."</li>";
|
||||
elseif(is_array($item)) {
|
||||
echo "<li class=\"nav-item m-1\"><a class=\"_nav-link btn btn-outline-primary btn-sm".($item['class'] ? ' '. $item['class'] : '')."\"".(!isset($item['link']) ? " href=\"".$item['link']."\"" : '').(!empty($item['target']) ? ' target="'.$item['target'].'"' : '');
|
||||
if(!empty($item['attributes'])) {
|
||||
foreach($item['attributes'] as $attr) {
|
||||
echo ' '.$attr[0].'="'.$attr[1].'"';
|
||||
}
|
||||
}
|
||||
echo ">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i> " : "").getMLText($item['label'])."</a></li>";
|
||||
}
|
||||
}
|
||||
print "</ul>";
|
||||
return;
|
||||
print "<ul class=\"unstyled actions\">";
|
||||
foreach($items as $item) {
|
||||
if(is_string($item))
|
||||
echo "<li>".$item."</li>";
|
||||
elseif(is_array($item)) {
|
||||
echo "<li><a href=\"".$item['link']."\"".(!empty($item['target']) ? ' target="'.$item['target'].'"' : '');
|
||||
if(!empty($item['attributes'])) {
|
||||
foreach($item['attributes'] as $attr) {
|
||||
echo ' '.$attr[0].'="'.$attr[1].'"';
|
||||
}
|
||||
}
|
||||
echo ">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i>" : "").getMLText($item['label'])."</a></li>";
|
||||
}
|
||||
}
|
||||
print "</ul>";
|
||||
} /* }}} */
|
||||
|
||||
function show() { /* {{{ */
|
||||
parent::show();
|
||||
|
||||
|
@ -606,7 +640,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
print "<th colspan=\"2\">".htmlspecialchars($latestContent->getOriginalFileName())."</th>\n";
|
||||
// print "<th width='*'>".getMLText("file")."</th>\n";
|
||||
// print "<th width='25%'>".getMLText("comment")."</th>\n";
|
||||
print "<th width='25%'></th>\n";
|
||||
// print "<th width='25%'></th>\n";
|
||||
print "</tr></thead><tbody>\n";
|
||||
print "<tr>\n";
|
||||
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
|
||||
|
@ -631,7 +665,6 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
print "</td>\n";
|
||||
|
||||
print "<td><ul class=\"actions unstyled\">\n";
|
||||
// print "<li class=\"wordbreak\">".$latestContent->getOriginalFileName() ."</li>\n";
|
||||
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
|
||||
|
||||
if ($file_exists)
|
||||
|
@ -658,77 +691,63 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
}
|
||||
print "<ul class=\"actions unstyled\">\n";
|
||||
$this->printVersionAttributes($folder, $latestContent);
|
||||
print "</ul></td>\n";
|
||||
print "</ul>";
|
||||
// print "</td>\n";
|
||||
|
||||
print "<td>";
|
||||
// print "<td>";
|
||||
|
||||
if ($file_exists){
|
||||
print "<ul class=\"unstyled actions\">";
|
||||
print "<li><a href=\"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\"><i class=\"fa fa-download\"></i>".getMLText("download")."</a></li>";
|
||||
$items = array();
|
||||
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes)))
|
||||
print "<li><a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\"><i class=\"fa fa-star\"></i>" . getMLText("view_online") . "</a></li>";
|
||||
$items = $this->callHook('extraVersionViews', $latestContent);
|
||||
$items[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
|
||||
if($newitems = $this->callHook('extraVersionViews', $latestContent))
|
||||
$items = array_merge($items, $newitems);
|
||||
if($items) {
|
||||
foreach($items as $item) {
|
||||
if(is_string($item))
|
||||
echo "<li>".$item."</li>";
|
||||
elseif(is_array($item))
|
||||
echo "<li><a href=\"".$item['link']."\">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i>" : "").getMLText($item['label'])."</a></li>";
|
||||
}
|
||||
$this->showActions($items);
|
||||
}
|
||||
print "</ul>";
|
||||
}
|
||||
|
||||
print "<ul class=\"unstyled actions\">";
|
||||
$items = array();
|
||||
if ($file_exists){
|
||||
if($accessop->mayEditVersion()) {
|
||||
print "<li><a href=\"../out/out.EditOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\"><i class=\"fa fa-edit\"></i>".getMLText("edit_version")."</a></li>";
|
||||
$items[] = array('link'=>"../out/out.EditOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_version');
|
||||
}
|
||||
}
|
||||
/* Only admin has the right to remove version in any case or a regular
|
||||
* user if enableVersionDeletion is on
|
||||
*/
|
||||
if($accessop->mayRemoveVersion()) {
|
||||
print "<li><a href=\"../out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\"><i class=\"fa fa-remove\"></i>".getMLText("rm_version")."</a></li>";
|
||||
$items[] = array('link'=>"../out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version');
|
||||
}
|
||||
if($accessop->mayOverwriteStatus()) {
|
||||
print "<li><a href='../out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."'><i class=\"fa fa-align-justify\"></i>".getMLText("change_status")."</a></li>";
|
||||
$items[] = array('link'=>"../out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status');
|
||||
}
|
||||
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
|
||||
// Allow changing reviewers/approvals only if not reviewed
|
||||
if($accessop->maySetReviewersApprovers()) {
|
||||
print "<li><a href='../out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."'><i class=\"fa fa-edit\"></i>".getMLText("change_assignments")."</a></li>";
|
||||
$items[] = array('link'=>"../out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments');
|
||||
}
|
||||
} elseif($workflowmode == 'advanced') {
|
||||
if($accessop->maySetWorkflow()) {
|
||||
if(!$workflow) {
|
||||
print "<li><a href='../out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."'><i class=\"fa fa-random\"></i>".getMLText("set_workflow")."</a></li>";
|
||||
$items[] = array('link'=>"../out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow');
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if($accessop->maySetExpires()) {
|
||||
print "<li><a href='../out/out.SetExpires.php?documentid=".$documentid."'><i class=\"fa fa-clock-o\"></i>".getMLText("set_expiry")."</a></li>";
|
||||
}
|
||||
*/
|
||||
if($accessop->mayEditComment()) {
|
||||
print "<li><a href=\"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\"><i class=\"fa fa-comment\"></i>".getMLText("edit_comment")."</a></li>";
|
||||
$items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment');
|
||||
}
|
||||
if($accessop->mayEditAttributes()) {
|
||||
print "<li><a href=\"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\"><i class=\"fa fa-edit\"></i>".getMLText("edit_attributes")."</a></li>";
|
||||
$items[] = array('link'=>"out.EditAttributes.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'edit_attributes');
|
||||
}
|
||||
|
||||
$items = $this->callHook('extraVersionActions', $latestContent);
|
||||
if($newitems = $this->callHook('extraVersionActions', $latestContent))
|
||||
$items = array_merge($items, $newitems);
|
||||
if($items) {
|
||||
foreach($items as $item) {
|
||||
if(is_string($item))
|
||||
echo "<li>".$item."</li>";
|
||||
elseif(is_array($item))
|
||||
echo "<li><a href=\"".$item['link']."\">".(!empty($item['icon']) ? "<i class=\"fa fa-".$item['icon']."\"></i>" : "").getMLText($item['label'])."</a></li>";
|
||||
}
|
||||
$this->showActions($items);
|
||||
}
|
||||
|
||||
print "</ul>";
|
||||
echo "</td>";
|
||||
print "</tr></tbody>\n</table>\n";
|
||||
$this->contentContainerEnd();
|
||||
|
|
Loading…
Reference in New Issue
Block a user