From dc58e02d25ad45e4e64e28b32c3143c42f9e4843 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 9 Jun 2017 15:13:49 +0200 Subject: [PATCH] add hook for editing attribute, return value of hook can be an empty array --- views/bootstrap/class.AddDocument.php | 10 ++++++---- views/bootstrap/class.AddSubFolder.php | 10 ++++++++++ views/bootstrap/class.EditAttributes.php | 10 ++++++++++ views/bootstrap/class.EditDocument.php | 10 ++++++---- views/bootstrap/class.EditFolder.php | 13 +++++++------ views/bootstrap/class.UpdateDocument.php | 13 +++++++------ 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index 206cd7aa7..3c67814e7 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -275,10 +275,12 @@ $(document).ready(function() { foreach($attrdefs as $attrdef) { $arr = $this->callHook('addDocumentAttribute', null, $attrdef); if(is_array($arr)) { - echo ""; - echo "".$arr[0].":"; - echo "".$arr[1].""; - echo ""; + if($arr) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } } else { ?> diff --git a/views/bootstrap/class.AddSubFolder.php b/views/bootstrap/class.AddSubFolder.php index 105a1145c..05c7fb959 100644 --- a/views/bootstrap/class.AddSubFolder.php +++ b/views/bootstrap/class.AddSubFolder.php @@ -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 "
"; + echo " "; + echo "
".$arr[1]."
"; + echo "
"; + } + } else { ?>
printAttributeEditField($attrdef, '') ?>
diff --git a/views/bootstrap/class.EditAttributes.php b/views/bootstrap/class.EditAttributes.php index cc2645f75..8f45b67e7 100644 --- a/views/bootstrap/class.EditAttributes.php +++ b/views/bootstrap/class.EditAttributes.php @@ -55,6 +55,15 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Bootstrap_Style { callHook('editDocumentContentAttribute', $version, $attrdef); + if(is_array($arr)) { + if($arr) { + echo "
"; + echo ""; + echo "
".$arr[1]."
"; + echo "
"; + } + } else { ?>
@@ -63,6 +72,7 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Bootstrap_Style {
diff --git a/views/bootstrap/class.EditDocument.php b/views/bootstrap/class.EditDocument.php index f4f099790..2e43087f8 100644 --- a/views/bootstrap/class.EditDocument.php +++ b/views/bootstrap/class.EditDocument.php @@ -192,10 +192,12 @@ $(document).ready( function() { foreach($attrdefs as $attrdef) { $arr = $this->callHook('editDocumentAttribute', $document, $attrdef); if(is_array($arr)) { - echo ""; - echo "".$arr[0].":"; - echo "".$arr[1].""; - echo ""; + if($arr) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } } else { ?> diff --git a/views/bootstrap/class.EditFolder.php b/views/bootstrap/class.EditFolder.php index 8c156c19d..2da21e14b 100644 --- a/views/bootstrap/class.EditFolder.php +++ b/views/bootstrap/class.EditFolder.php @@ -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 "
"; - echo ""; - echo "
".$arr[1]."
"; - echo "
"; + if($arr) { + echo "
"; + echo ""; + echo "
".$arr[1]."
"; + echo "
"; + } } else { ?>
diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index 0267ac7a1..9bf21f8c0 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -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 ""; - echo "".$arr[0].":"; - echo "".$arr[1].""; - echo ""; + if($arr) { + echo ""; + echo "".$arr[0].":"; + echo "".$arr[1].""; + echo ""; + } } else { ?>