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,6 +149,13 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { 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> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td> <td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
@ -157,6 +164,7 @@ $(document).ready(function() {
<?php <?php
} }
} }
}
if($presetexpiration) { if($presetexpiration) {
if(!($expts = strtotime($presetexpiration))) if(!($expts = strtotime($presetexpiration)))
$expts = time(); $expts = time();
@ -216,6 +224,13 @@ $(document).ready(function() {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { 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> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td> <td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
@ -224,6 +239,7 @@ $(document).ready(function() {
<?php <?php
} }
} }
}
if($workflowmode == 'advanced') { if($workflowmode == 'advanced') {
?> ?>
<tr> <tr>

View File

@ -143,6 +143,13 @@ function checkForm()
} }
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { 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> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> <td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
@ -151,6 +158,7 @@ function checkForm()
<?php <?php
} }
} }
}
?> ?>
<tr> <tr>
<td></td> <td></td>

View File

@ -98,6 +98,14 @@ function checkForm() {
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { 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> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td> <td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
@ -106,6 +114,7 @@ function checkForm() {
<?php <?php
} }
} }
}
?> ?>
<tr> <tr>
<td></td> <td></td>

View File

@ -196,6 +196,14 @@ function checkForm()
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_all));
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { 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> <tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> <td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
@ -204,6 +212,7 @@ function checkForm()
<?php <?php
} }
} }
}
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
// Retrieve a list of all users and groups that have review / approve // Retrieve a list of all users and groups that have review / approve
// privileges. // privileges.

View File

@ -286,9 +286,18 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $document->getAttributes(); $attributes = $document->getAttributes();
if($attributes) { if($attributes) {
foreach($attributes as $attribute) { foreach($attributes as $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); $this->printAttribute($attribute);
} }
} }
}
?> ?>
</table> </table>
<?php <?php
@ -393,10 +402,15 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $latestContent->getAttributes(); $attributes = $latestContent->getAttributes();
if($attributes) { if($attributes) {
foreach($attributes as $attribute) { foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $latestcontent, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition(); $attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n"; print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
} }
} }
}
print "</ul>\n"; print "</ul>\n";
print "<td>".htmlspecialchars($latestContent->getComment())."</td>"; print "<td>".htmlspecialchars($latestContent->getComment())."</td>";
@ -992,10 +1006,15 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$attributes = $version->getAttributes(); $attributes = $version->getAttributes();
if($attributes) { if($attributes) {
foreach($attributes as $attribute) { foreach($attributes as $attribute) {
$arr = $this->callHook('showDocumentContentAttribute', $version, $attribute);
if(is_array($arr)) {
print "<li>".$arr[0].": ".$arr[1]."</li>\n";
} else {
$attrdef = $attribute->getAttributeDefinition(); $attrdef = $attribute->getAttributeDefinition();
print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n"; print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."</li>\n";
} }
} }
}
print "</ul>\n"; print "</ul>\n";
print "<td>".htmlspecialchars($version->getComment())."</td>"; print "<td>".htmlspecialchars($version->getComment())."</td>";
print "<td>".getOverallStatusText($vstat["status"])."</td>"; print "<td>".getOverallStatusText($vstat["status"])."</td>";

View File

@ -199,6 +199,14 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
$attributes = $folder->getAttributes(); $attributes = $folder->getAttributes();
if($attributes) { if($attributes) {
foreach($attributes as $attribute) { foreach($attributes as $attribute) {
$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(); $attrdef = $attribute->getAttributeDefinition();
?> ?>
<tr> <tr>
@ -208,6 +216,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
<?php <?php
} }
} }
}
echo "</table>\n"; echo "</table>\n";
$this->contentContainerEnd(); $this->contentContainerEnd();
} }