replace plain html by formField()

This commit is contained in:
Uwe Steinmann 2021-04-07 07:10:17 +02:00
parent 5e357e9f0b
commit 98993e89df

View File

@ -116,7 +116,7 @@ $(document).ready(function() {
$attrdefids = array();
foreach($attrdefgrps as $attrdefgrp) {
$attrdefs = $attrdefgrp['group']->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all, SeedDMS_Core_AttributeDefinition::objtype_folder));
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp['group']->getName())."</b></td></tr>";
$this->contentSubHeading(htmlspecialchars($attrdefgrp['group']->getName()));
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
$show = $attrdefarr['show'];
@ -128,28 +128,18 @@ $(document).ready(function() {
if(!in_array($attrdef->getID(), $attrdefids)) {
$arr = $this->callHook('folderEditAttribute', $folder, $attrdef);
if(is_array($arr)) {
echo $txt;
echo "<tr>";
echo "<td>".$arr[0]."</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
if($arr) {
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
}
} elseif(is_string($arr)) {
echo $arr;
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?><?php echo $shows ? " (".implode(", ", $shows).")" : ''; ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, $folder->getAttribute($attrdef)) ?></td>
</tr>
<?php
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $folder->getAttribute($attrdef)));
}
$attrdefids[] = $attrdef->getID();
} else {
if($folder->getAttribute($attrdef)) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php echo $folder->getAttribute($attrdef)->getValue(); ?></td>
</tr>
<?php
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $folder->getAttribute($attrdef)));
}
}
}
@ -174,12 +164,7 @@ $(document).ready(function() {
}
} else {
if($attribute = $folder->getAttribute($attrdef)) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php echo $attribute->getValue() ?></td>
</tr>
<?php
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $attribute));
}
}
}