From 15567f8a556b24dadfa719001aac794571b90e49 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 21 Jan 2025 10:28:32 +0100 Subject: [PATCH] output attrdefgrps in documentListRow --- views/bootstrap4/class.Bootstrap4.php | 39 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index bd1fdfc59..ebd21cdf2 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -3321,8 +3321,15 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) * @param object $document * @param object $previewer * @param boolean $skipcont set to true if embrasing tr shall be skipped + * @param integer $version set to a value != 0 for a specific version, otherwise + * the latest version will be used + * @param integer $context specifies the type of list. Can be any value + * of SeedDMS_Core_AttributeDefinitionGroup::show_xxx, though only + * show_list and show_ѕearchlist are useful. If the parameter is + * not set or 0, attributes will not be output at all. + * @return string html */ - function documentListRow($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ + function documentListRow($document, $previewer, $skipcont=false, $version=0, $extracontent=array(), $context=0) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $showtree = $this->params['showtree']; @@ -3394,11 +3401,39 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if($comment) { $content .= "
".htmlspecialchars($comment).""; } + + if($context) { + $attrdefgrps = $document->getParent()->getAttributeDefintionGroupList(true); + if($attrdefgrps) { + foreach($attrdefgrps as $attrdefgrp) { + $attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_document), $context); + if($attrdefs) { + $content .= "
".htmlspecialchars($attrdefgrp['group']->getName())."
"; + foreach($attrdefs as $attrdefarr) { + $attrdef = $attrdefarr['attrdef']; + $attribute = $document->getAttribute($attrdef); + if($attribute) { + $arr = $this->callHook('showDocumentAttribute', $document, $attribute, $context); + if(is_array($arr)) { + $content .= "".$arr[0].": "; + $content .= "".$arr[1]."
"; + } else { + $content .= "".htmlspecialchars($attrdef->getName()).": "; + $content .= $this->printAttributeValue($attribute, true)."
"; + } + } + } + } + } + } + } + if($categories = $document->getCategories()) { $content .= "
"; - foreach($categories as $category) + foreach($categories as $category) { $color = $category->getColor() ? $category->getColor() : substr(md5($category->getName()), 0, 6); $content .= "".$category->getName()." "; + } } if(!empty($extracontent['bottom_title'])) $content .= $extracontent['bottom_title'];