Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-05-06 11:19:30 +02:00
commit 5869abc56b
5 changed files with 136 additions and 52 deletions

View File

@ -1368,6 +1368,25 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* @return string
*/
function getModalBoxLinkAttributes($config) { /* {{{ */
$attrs = array();
$attrs[] = array('data-target', '#'.$config['target']);
if(isset($config['remote']))
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */
/**
* Get html for button opening a modal box
*
@ -1380,6 +1399,12 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
foreach($attrs as $attr)
$content .= ' '.$attr[0].'="'.$attr[1].'"';
}
if(!empty($config['attributes'])) {
foreach($config['attributes'] as $attrname=>$attrval)
$content .= ' '.$attrname.'="'.$attrval.'"';
@ -1842,8 +1867,8 @@ $(document).ready(function() {
case SeedDMS_Core_AttributeDefinition::type_date:
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
$dateformat = getConvertDateFormat($this->params['settings']->_dateformat);
$content .= '<span class="input-append date datepicker" data-date="'.getReadableDate().'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'">
<input id="'.$fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : '').'" class="span8" size="16" name="'.$fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : '').'" type="text" value="'.($objvalue ? $objvalue : '').'">
$content .= '<span class="input-append date span12 datepicker" data-date="'.getReadableDate().'" data-date-format="'.$dateformat.'" data-date-language="'.str_replace('_', '-', $this->params['session']->getLanguage()).'">
<input id="'.$fieldname.'_'.$attrdef->getId().($namepostfix ? '_'.$namepostfix : '').'" class="span6" size="16" name="'.$fieldname.'['.$attrdef->getId().']'.($namepostfix ? '['.$namepostfix.']' : '').'" type="text" value="'.($objvalue ? $objvalue : '').'">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>';
break;
@ -2996,6 +3021,11 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
if($comment) {
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
}
if($categories = $document->getCategories()) {
$content .= "<br />";
foreach($categories as $category)
$content .= "<span class=\"badge bg-secondary\">".$category->getName()."</span> ";
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";

View File

@ -469,6 +469,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();
@ -649,7 +683,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;\">";
@ -679,7 +713,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)
@ -706,99 +739,87 @@ 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\">";
if($accessobject->check_controller_access('Download', array('action'=>'version'))) {
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();
if($accessobject->check_controller_access('Download', array('action'=>'version')))
$items[] = array('link'=>"../op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'download', 'label'=>'download');
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) {
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[] = array('link'=>"../op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion(), 'icon'=>'eye', 'label'=>'view_online', 'target'=>'_blank');
}
$items = $this->callHook('extraVersionViews', $latestContent);
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($accessobject->check_view_access('EditOnline'))
if($accessobject->mayEditVersion($latestContent->getDocument())) {
print "<li>".$this->html_link('EditOnline', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-edit\"></i>".getMLText("edit_version"), false, true)."</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($accessobject->check_controller_access('RemoveVersion'))
if($accessobject->mayRemoveVersion($latestContent->getDocument())) {
print "<li>".$this->html_link('RemoveVersion', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-remove\"></i>".getMLText("rm_version"), false, true)."</li>";
$items[] = array('link'=>"../out/out.RemoveVersion.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'remove', 'label'=>'rm_version');
}
if($accessobject->check_controller_access('OverrideContentStatus'))
if($accessobject->mayOverrideStatus($latestContent->getDocument())) {
print "<li>".$this->html_link('OverrideContentStatus', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-align-justify\"></i>".getMLText("change_status"), false, true)."</li>";
$items[] = array('link'=>"../out/out.OverrideContentStatus.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'align-justify', 'label'=>'change_status');
}
if($enablereceiptworkflow && $accessobject->check_controller_access('SetRecipients'))
if($accessobject->maySetRecipients($latestContent->getDocument())) {
print "<li>".$this->html_link('SetRecipients', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-check\"></i>".getMLText("change_recipients"), false, true)."</li>";
$items[] = array('link'=>"../out/out.SetRecipients.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'check', 'label'=>'change_recipients');
}
if($enablerevisionworkflow && $accessobject->check_controller_access('SetRevisors'))
if($accessobject->maySetRevisors($latestContent->getDocument())) {
print "<li>".$this->html_link('SetRevisors', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-refresh\"></i>".getMLText("change_revisors"), false, true)."</li>";
$items[] = array('link'=>"../out/out.SetRevisors.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'refresh', 'label'=>'change_revisors');
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
// Allow changing reviewers/approvals only if not reviewed
if($accessobject->check_controller_access('SetReviewersApprovers'))
if($accessobject->maySetReviewersApprovers($latestContent->getDocument())) {
print "<li>".$this->html_link('SetReviewersApprovers', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-edit\"></i>".getMLText("change_assignments"), false, true)."</li>";
$items[] = array('link'=>"../out/out.SetReviewersApprovers.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'edit', 'label'=>'change_assignments');
}
} elseif($workflowmode == 'advanced') {
if($accessobject->check_controller_access('SetWorkflow'))
if($accessobject->maySetWorkflow($latestContent->getDocument())) {
if(!$workflow) {
print "<li>".$this->html_link('SetWorkflow', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-random\"></i>".getMLText("set_workflow"), false, true)."</li>";
$items[] = array('link'=>"../out/out.SetWorkflow.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'random', 'label'=>'set_workflow');
}
}
}
/*
if($accessobject->maySetExpires($latestContent->getDocument())) {
print "<li>".$this->html_link('SetExpires', array('documentid'=>$latestContent->getDocument()->getId()), array(), "<i class=\"fa fa-time\"></i>".getMLText("set_expiry"), false, true)."</li>";
}
*/
if($accessobject->check_controller_access('AddToTransmittal'))
if($dms->getAllTransmittals($user)) {
if($accessobject->check_view_access('AddToTransmittal'))
print "<li>".$this->html_link('AddToTransmittal', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-list\"></i>".getMLText("add_to_transmittal"), false, true)."</li>";
$items[] = array('link'=>"out.AddToTransmittal.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'list', 'label'=>'add_to_transmittal');
}
if($accessobject->check_controller_access('EditComment'))
if($accessobject->mayEditComment($latestContent->getDocument())) {
print "<li>".$this->html_link('EditComment', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-comment\"></i>".getMLText("edit_comment"), false, true)."</li>";
$items[] = array('link'=>"out.EditComment.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion(), 'icon'=>'comment', 'label'=>'edit_comment');
}
if($accessobject->check_controller_access('EditAttributes'))
if($accessobject->mayEditAttributes($latestContent->getDocument())) {
print "<li>".$this->html_link('EditAttributes', array('documentid'=>$latestContent->getDocument()->getId(), 'version'=>$latestContent->getVersion()), array(), "<i class=\"fa fa-edit\"></i>".getMLText("edit_attributes"), false, true)."</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();

View File

@ -305,9 +305,9 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark border-bottom fixed-top\">\n";
echo " <a class=\"navbar-brand\" href=\"../out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\"><img src=\"../views/bootstrap/images/seeddms-logo.svg\"> <span class=\"d-none d-md-inline-block\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
echo " <a class=\"navbar-brand\" href=\"../out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\"><img src=\"../views/bootstrap/images/seeddms-logo.svg\"> <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
/* search form {{{ */
echo " <form action=\"../out/out.Search.php\" class=\"form-inline mr-auto\" autocomplete=\"off\">";
echo " <form action=\"../out/out.Search.php\" class=\"form-inline ml-4 mr-auto\" autocomplete=\"off\">";
if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), $dms->getClassname('folder'))) {
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
}
@ -1294,6 +1294,25 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* @return string
*/
function getModalBoxLinkAttributes($config) { /* {{{ */
$attrs = array();
$attrs[] = array('data-target', '#'.$config['target']);
if(isset($config['remote']))
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
$attrs[] = array('class', $config['class']);
return $attrs;
} /* }}} */
/**
* Get html for button opening a modal box
*
@ -1306,6 +1325,12 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn btn-secondary")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
foreach($attrs as $attr)
$content .= ' '.$attr[0].'="'.$attr[1].'"';
}
if(!empty($config['attributes'])) {
foreach($config['attributes'] as $attrname=>$attrval)
$content .= ' '.$attrname.'="'.$attrval.'"';
@ -2972,6 +2997,11 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
if($comment) {
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
}
if($categories = $document->getCategories()) {
$content .= "<br />";
foreach($categories as $category)
$content .= "<span class=\"badge bg-secondary\">".$category->getName()."</span> ";
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";

View File

@ -67,18 +67,18 @@ span.list-details {
margin-bottom: 10px;
}
ul.actions {
ul.unstyled {
list-style: none;
padding-left: 0px;
}
ul.actions li a:hover > i {
ul.unstyled li a:hover > i {
text-decoration: none;
}
ul.actions li a > i {
ul.unstyled li a > i {
color: #000;
margin-right: 5px;
}
ul.actions li a.btn > i {
ul.unstyled li a.btn > i {
font-size: 200%;
}

View File

@ -59,6 +59,9 @@ body {
}
}
@media (max-width: 767px) {
body {
font-size: 0.875rem;
}
.footer {
height: 126px;
}