output attrdefgrps in documentListRow

This commit is contained in:
Uwe Steinmann 2025-01-21 10:28:32 +01:00
parent 7bf731c5f2
commit 15567f8a55

View File

@ -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 .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";
}
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 .= "<br /><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b><br />";
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]."<br />";
} else {
$content .= "".htmlspecialchars($attrdef->getName()).": ";
$content .= $this->printAttributeValue($attribute, true)."<br />";
}
}
}
}
}
}
}
if($categories = $document->getCategories()) {
$content .= "<br />";
foreach($categories as $category)
foreach($categories as $category) {
$color = $category->getColor() ? $category->getColor() : substr(md5($category->getName()), 0, 6);
$content .= "<span class=\"badge\" style=\"background-color: #".$color."; color: #".self::getContrastColor($color).";\">".$category->getName()."</span> ";
}
}
if(!empty($extracontent['bottom_title']))
$content .= $extracontent['bottom_title'];