add hook for editing attribute, return value of hook can be an empty array

This commit is contained in:
Uwe Steinmann 2017-06-09 15:13:49 +02:00
parent 4b89d920cb
commit dc58e02d25
6 changed files with 46 additions and 20 deletions

View File

@ -275,10 +275,12 @@ $(document).ready(function() {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('addDocumentAttribute', null, $attrdef);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
if($arr) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
}
} else {
?>
<tr>

View File

@ -126,12 +126,22 @@ $(document).ready( function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('addFolderAttribute', null, $attrdef);
if(is_array($arr)) {
if($arr) {
echo "<div class=\"control-group\">";
echo " <label class=\"control-label\">".$arr[0].":</label>";
echo " <div class=\"controls\">".$arr[1]."</div>";
echo "</div>";
}
} else {
?>
<div class="control-group">
<label class="control-label"><?php echo htmlspecialchars($attrdef->getName()); ?>:</label>
<div class="controls"><?php $this->printAttributeEditField($attrdef, '') ?></div>
</div>
<?php
}
}
}
?>

View File

@ -55,6 +55,15 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Bootstrap_Style {
<?php
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentContentAttribute', $version, $attrdef);
if(is_array($arr)) {
if($arr) {
echo "<div class=\"control-group\">";
echo "<label class=\"control-label\">".$arr[0].":</label>";
echo "<div class=\"controls\">".$arr[1]."</div>";
echo "</div>";
}
} else {
?>
<div class="control-group">
<label class="control-label"><?php echo htmlspecialchars($attrdef->getName()); ?></label>
@ -63,6 +72,7 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Bootstrap_Style {
</div>
</div>
<?php
}
}
}
?>

View File

@ -192,10 +192,12 @@ $(document).ready( function() {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentAttribute', $document, $attrdef);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
if($arr) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
}
} else {
?>
<tr>

View File

@ -132,13 +132,14 @@ $(document).ready(function() {
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('folderEditAttribute', $folder, $attrdef);
$arr = $this->callHook('editFolderAttribute', $folder, $attrdef);
if(is_array($arr)) {
echo $txt;
echo "<div class=\"control-group\">";
echo "<label class=\"control-label\">".$arr[0]."</label>";
echo "<div class=\"controls\">".$arr[1]."</div>";
echo "</div>";
if($arr) {
echo "<div class=\"control-group\">";
echo "<label class=\"control-label\">".$arr[0]."</label>";
echo "<div class=\"controls\">".$arr[1]."</div>";
echo "</div>";
}
} else {
?>
<div class="control-group">

View File

@ -277,13 +277,14 @@ console.log(element);
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentContentAttribute', null, $attrdef);
$arr = $this->callHook('editDocumentContentAttribute', $document, $attrdef);
if(is_array($arr)) {
echo $txt;
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
if($arr) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
}
} else {
?>
<tr>