add parameter $noecho to method getAttributeValue()

This commit is contained in:
Uwe Steinmann 2026-05-06 14:14:31 +02:00
parent dc94f8e24e
commit 3ee68b86d2
2 changed files with 30 additions and 22 deletions

View File

@ -2094,11 +2094,11 @@ $(document).ready(function() {
*
* @param object $attribute attribute
*/
protected function printAttributeValue($attribute) { /* {{{ */
echo self::getAttributeValue($attribute);
protected function printAttributeValue($attribute, $noecho=false) { /* {{{ */
echo self::getAttributeValue($attribute, $noecho);
} /* }}} */
function getAttributeValue($attribute) { /* {{{ */
function getAttributeValue($attribute, $noecho=false) { /* {{{ */
$dms = $this->params['dms'];
$attrdef = $attribute->getAttributeDefinition();
switch($attrdef->getType()) {
@ -2108,7 +2108,7 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = '<a href="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_email:
$attrs = $attribute->getValueAsArray();
@ -2116,7 +2116,7 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = '<a mailto="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
$attrs = $attribute->getValueAsArray();
@ -2125,7 +2125,7 @@ $(document).ready(function() {
if ($targetfolder)
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
$attrs = $attribute->getValueAsArray();
@ -2134,7 +2134,7 @@ $(document).ready(function() {
if ($targetdoc)
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
$attrs = $attribute->getValueAsArray();
@ -2143,7 +2143,7 @@ $(document).ready(function() {
if ($curuser)
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
$attrs = $attribute->getValueAsArray();
@ -2152,7 +2152,7 @@ $(document).ready(function() {
if ($curgroup)
$tmp[] = htmlspecialchars($curgroup->getName());
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$attrs = $attribute->getValueAsArray();
@ -2160,11 +2160,15 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = getReadableDate($attr);
}
return implode(', ', $tmp);
$content = implode(', ', $tmp);
break;
default:
return htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
$content = htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
}
if($noecho)
return $content;
else
echo $content;
} /* }}} */
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */

View File

@ -2042,11 +2042,11 @@ $(document).ready(function() {
*
* @param object $attribute attribute
*/
protected function printAttributeValue($attribute) { /* {{{ */
echo self::getAttributeValue($attribute);
protected function printAttributeValue($attribute, $noecho=false) { /* {{{ */
echo self::getAttributeValue($attribute, $noecho);
} /* }}} */
function getAttributeValue($attribute) { /* {{{ */
function getAttributeValue($attribute, $noecho=false) { /* {{{ */
$dms = $this->params['dms'];
$attrdef = $attribute->getAttributeDefinition();
switch($attrdef->getType()) {
@ -2056,7 +2056,7 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = '<a href="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_email:
$attrs = $attribute->getValueAsArray();
@ -2064,7 +2064,7 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = '<a mailto="'.htmlspecialchars($attr).'">'.htmlspecialchars($attr).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_folder:
$attrs = $attribute->getValueAsArray();
@ -2073,7 +2073,7 @@ $(document).ready(function() {
if ($targetfolder)
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$targetfolder->getId().'">'.htmlspecialchars($targetfolder->getName()).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_document:
$attrs = $attribute->getValueAsArray();
@ -2082,7 +2082,7 @@ $(document).ready(function() {
if ($targetdoc)
$tmp[] = '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$targetdoc->getId().'">'.htmlspecialchars($targetdoc->getName()).'</a>';
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_user:
$attrs = $attribute->getValueAsArray();
@ -2091,7 +2091,7 @@ $(document).ready(function() {
if ($curuser)
$tmp[] = htmlspecialchars($curuser->getFullname()." (".$curuser->getLogin().")");
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_group:
$attrs = $attribute->getValueAsArray();
@ -2100,7 +2100,7 @@ $(document).ready(function() {
if ($curgroup)
$tmp[] = htmlspecialchars($curgroup->getName());
}
return implode('<br />', $tmp);
$content = implode('<br />', $tmp);
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$attrs = $attribute->getValueAsArray();
@ -2108,11 +2108,15 @@ $(document).ready(function() {
foreach($attrs as $attr) {
$tmp[] = getReadableDate($attr);
}
return implode(', ', $tmp);
$content = implode(', ', $tmp);
break;
default:
return htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
$content = htmlspecialchars(implode(', ', $attribute->getValueAsArray()));
}
if($noecho)
return $content;
else
echo $content;
} /* }}} */
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */