diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 8448cd0ff..8ad11b847 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1306,7 +1306,8 @@ $('#acceptkeywords').click(function(ev) { * * @param object $attribute attribute */ - protected function printAttributeValue($attribute) { /* {{{ */ + protected function printAttributeValue($attribute, $noecho=false) { /* {{{ */ + $content = ''; $attrdef = $attribute->getAttributeDefinition(); switch($attrdef->getType()) { case SeedDMS_Core_AttributeDefinition::type_url: @@ -1315,7 +1316,7 @@ $('#acceptkeywords').click(function(ev) { foreach($attrs as $attr) { $tmp[] = ''.htmlspecialchars($attr).''; } - echo implode('
', $tmp); + $content .= implode('
', $tmp); break; case SeedDMS_Core_AttributeDefinition::type_email: $attrs = $attribute->getValueAsArray(); @@ -1323,11 +1324,15 @@ $('#acceptkeywords').click(function(ev) { foreach($attrs as $attr) { $tmp[] = ''.htmlspecialchars($attr).''; } - echo implode('
', $tmp); + $content .= implode('
', $tmp); break; default: - echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); + $content .= htmlspecialchars(implode(', ', $attribute->getValueAsArray())); } + if($noecho) + return $content; + else + echo $content; } /* }}} */ /** @@ -2092,8 +2097,15 @@ $(document).ready( function() { * @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) { /* {{{ */ + function documentListRow($document, $previewer, $skipcont=false, $version=0, $context=0) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $showtree = $this->params['showtree']; @@ -2157,6 +2169,32 @@ $(document).ready( function() { 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); + } + } + } + } + } + } + } $content .= "\n"; $content .= ""; @@ -2203,7 +2241,17 @@ $(document).ready( function() { return $content; } /* }}} */ - function folderListRow($subFolder) { /* {{{ */ + /** + * Return the HTML for a row in a list of folders + * + * @param object $subFolder folder to be listed + * @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 folderListRow($subFolder, $context=0) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; // $folder = $this->params['folder']; @@ -2225,6 +2273,32 @@ $(document).ready( function() { if($comment) { $content .= "
".htmlspecialchars($comment).""; } + + if($context) { + $attrdefgrps = $subFolder->getAttributeDefintionGroupList(true); + if($attrdefgrps) { + foreach($attrdefgrps as $attrdefgrp) { + $attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_folder), $context); + if($attrdefs) { + $content .= "
".htmlspecialchars($attrdefgrp['group']->getName())."
"; + foreach($attrdefs as $attrdefarr) { + $attrdef = $attrdefarr['attrdef']; + $attribute = $subFolder->getAttribute($attrdef); + if($attribute) { + $arr = $this->callHook('showFolderAttribute', $subFolder, $attribute, $context); + if(is_array($arr)) { + $content .= "".$arr[0].": "; + $content .= "".$arr[1]."
"; + } else { + $content .= "".htmlspecialchars($attrdef->getName()).": "; + $content .= $this->printAttributeValue($attribute, true); + } + } + } + } + } + } + } $content .= "\n"; // $content .= "".htmlspecialchars($owner->getFullName()).""; $content .= "";