add more hooks for showing/editing attributes

This commit is contained in:
Uwe Steinmann 2015-04-27 08:27:19 +02:00
parent c7ad9433a1
commit 4e4848c5d7
6 changed files with 77 additions and 7 deletions

View File

@ -149,12 +149,20 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentAttribute', null, $attrdef);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php $this->printAttributeEditField($attrdef, '') ?></td>
</tr>
<?php
}
}
}
if($presetexpiration) {
@ -216,12 +224,20 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$arr = $this->callHook('editDocumentAttribute', null, $attrdef);
if(is_array($arr)) {
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php $this->printAttributeEditField($attrdef, '', 'attributes_version') ?></td>
</tr>
<?php
}
}
}
if($workflowmode == 'advanced') {

View File

@ -143,12 +143,20 @@ function checkForm()
}
if($attrdefs) {
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>";
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, $document->getAttribute($attrdef)) ?></td>
</tr>
<?php
}
}
}
?>

View File

@ -98,12 +98,21 @@ function checkForm() {
if($attrdefs) {
foreach($attrdefs as $attrdef) {
$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>";
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php $this->printAttributeEditField($attrdef, $folder->getAttribute($attrdef)) ?></td>
</tr>
<?php
}
}
}
?>

View File

@ -196,12 +196,21 @@ function checkForm()
$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);
if(is_array($arr)) {
echo $txt;
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, '') ?></td>
</tr>
<?php
}
}
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {

View File

@ -286,7 +286,16 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $document->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$this->printAttribute($attribute);
$arr = $this->callHook('showDocumentAttribute', $document, $attribute);
if(is_array($arr)) {
echo $txt;
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1]."</td>";
echo "</tr>";
} else {
$this->printAttribute($attribute);
}
}
}
?>
@ -393,8 +402,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $latestContent->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
$arr = $this->callHook('showDocumentContentAttribute', $latestcontent, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
}
}
}
print "</ul>\n";
@ -992,8 +1006,13 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $version->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
$arr = $this->callHook('showDocumentContentAttribute', $version, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
}
}
}
print "</ul>\n";

View File

@ -199,13 +199,22 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
$attributes = $folder->getAttributes();
if($attributes) {
foreach($attributes as $attribute) {
$attrdef = $attribute->getAttributeDefinition();
$arr = $this->callHook('showFolderAttribute', $folder, $attribute);
if(is_array($arr)) {
echo $txt;
echo "<tr>";
echo "<td>".$arr[0].":</td>";
echo "<td>".$arr[1].":</td>";
echo "</tr>";
} else {
$attrdef = $attribute->getAttributeDefinition();
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php echo htmlspecialchars(implode(', ', $attribute->getValueAsArray())); ?></td>
</tr>
<?php
<?php
}
}
}
echo "</table>\n";