From 2403b2f2a734fcd3042347db712ac03af163a92b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 4 Nov 2014 13:57:50 +0100 Subject: [PATCH 01/21] instanciate access object --- out/out.RewindWorkflow.php | 5 +++++ out/out.RunSubWorkflow.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/out/out.RewindWorkflow.php b/out/out.RewindWorkflow.php index d34bc1bdd..da77424ff 100644 --- a/out/out.RewindWorkflow.php +++ b/out/out.RewindWorkflow.php @@ -23,6 +23,7 @@ include("../inc/inc.Utils.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); if (!$user->isAdmin()) { @@ -56,9 +57,13 @@ if (!is_object($workflow)) { $folder = $document->getFolder(); +/* Create object for checking access to certain operations */ +$accessop = new SeedDMS_AccessOperation($document, $user, $settings); + $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version)); if($view) { + $view->setParam('accessobject', $accessop); $view->show(); exit; } diff --git a/out/out.RunSubWorkflow.php b/out/out.RunSubWorkflow.php index c644ecfab..52d5d0618 100644 --- a/out/out.RunSubWorkflow.php +++ b/out/out.RunSubWorkflow.php @@ -23,6 +23,7 @@ include("../inc/inc.Utils.php"); include("../inc/inc.DBInit.php"); include("../inc/inc.Language.php"); include("../inc/inc.ClassUI.php"); +include("../inc/inc.ClassAccessOperation.php"); include("../inc/inc.Authentication.php"); if (!isset($_POST["documentid"]) || !is_numeric($_POST["documentid"]) || intval($_POST["documentid"])<1) { @@ -61,9 +62,13 @@ if (!is_object($subworkflow)) { $folder = $document->getFolder(); +/* Create object for checking access to certain operations */ +$accessop = new SeedDMS_AccessOperation($document, $user, $settings); + $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$version, 'subworkflow'=>$subworkflow)); if($view) { + $view->setParam('accessobject', $accessop); $view->show(); exit; } From 55def11f015f399577670caf725fca01e3065d4e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 4 Nov 2014 16:54:56 +0100 Subject: [PATCH 02/21] fix saving of multi value attributes --- SeedDMS_Core/Core/inc.ClassFolder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index a4ede97ae..fbcabe89f 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -750,7 +750,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { if($attributes) { foreach($attributes as $attrdefid=>$attribute) { - if(trim($attribute)) + /* $attribute can be a string or an array */ + if($attribute) if(!$document->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) { $document->remove(); $db->rollbackTransaction(); From 15c163274cf1ce3ec020d919da37f5ea02af12bb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 7 Nov 2014 08:06:08 +0100 Subject: [PATCH 03/21] take out window.close() because there is no window to close anymore since bootstraps modal box, the keyword chooser isn't a window anymore. --- views/bootstrap/class.KeywordChooser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.KeywordChooser.php b/views/bootstrap/class.KeywordChooser.php index cb22b1af6..b6c5d94ad 100644 --- a/views/bootstrap/class.KeywordChooser.php +++ b/views/bootstrap/class.KeywordChooser.php @@ -63,13 +63,13 @@ function insertKeywords(keywords) { } function cancel() { - window.close(); +// window.close(); return true; } function acceptKeywords() { targetObj.value = myTA.value; - window.close(); +// window.close(); return true; } From d24ac0400d6b1d8fd2479ae9ba4357120867cd62 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 7 Nov 2014 08:09:43 +0100 Subject: [PATCH 04/21] add entry for fixing bug #141 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 227d2a0f7..8ff6f9f46 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ -------------------------------------------------------------------------------- - translation updates - password expiration can be set to 'never' +- do not close browser window anymore when keywords are chosen (Bug #141) -------------------------------------------------------------------------------- Changes in version 4.3.10 From f76cb1afc12fd278cd20e531c3ca77063a4b0e60 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 7 Nov 2014 08:42:55 +0100 Subject: [PATCH 05/21] new version 4.3.11 --- Makefile | 2 +- SeedDMS_Core/Core/inc.ClassDMS.php | 2 +- SeedDMS_Core/package.xml | 26 +++++++++++++++++++++----- inc/inc.Version.php | 2 +- install/install.php | 2 +- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 26f90541a..66d481c6d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=4.3.10 +VERSION=4.3.11 SRC=CHANGELOG inc conf utils index.php languages views op out README.md README.Notification README.Ubuntu drop-tables-innodb.sql styles js TODO LICENSE Makefile webdav install restapi # webapp diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 1877413fd..0540d024f 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -243,7 +243,7 @@ class SeedDMS_Core_DMS { $this->convertFileTypes = array(); $this->version = '@package_version@'; if($this->version[0] == '@') - $this->version = '4.3.10'; + $this->version = '4.3.11'; } /* }}} */ function getDB() { /* {{{ */ diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index fbf53e2bf..a36022492 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,11 +12,11 @@ uwe@steinmann.cx yes - 2014-10-22 - + 2014-11-97 + - 4.3.10 - 4.3.10 + 4.3.11 + 4.3.11 stable @@ -24,7 +24,7 @@ GPL License -new release +fixed saving multivalue attributes @@ -700,5 +700,21 @@ no changes - SeedDMS_Core_DMS::addUser() doesn't throw an error if sql_mode is set to STRICT_TRANS_TABLES and pwdexpiration is not set to a valid date. + + 2014-10-22 + + + 4.3.10 + 4.3.10 + + + stable + stable + + GPL License + +new release + + diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 071ea39b7..631ea4127 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -20,7 +20,7 @@ class SeedDMS_Version { - public $_number = "4.3.10"; + public $_number = "4.3.11"; private $_string = "SeedDMS"; function SeedDMS_Version() { diff --git a/install/install.php b/install/install.php index 5b2bdbbdc..cf35141c9 100644 --- a/install/install.php +++ b/install/install.php @@ -116,7 +116,7 @@ function fileExistsInIncludePath($file) { /* {{{ */ * Load default settings + set */ define("SEEDDMS_INSTALL", "on"); -define("SEEDDMS_VERSION", "4.3.10"); +define("SEEDDMS_VERSION", "4.3.11"); require_once('../inc/inc.ClassSettings.php'); From 7c4e5a15aa044875b2006d0f2136487aaf2e9e7a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 7 Nov 2014 08:54:47 +0100 Subject: [PATCH 06/21] strip html tags from sitename when using for html title --- views/bootstrap/class.Bootstrap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 1c7ac2659..58bb1204e 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -76,7 +76,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);; ".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."\n"; + $sitename = trim(strip_tags($this->params['sitename'])); + echo "".(strlen($sitename)>0 ? $sitename : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."\n"; echo "\n"; echo "0 ? " class=\"".$bodyClass."\"" : "").">\n"; if($this->params['session'] && $flashmsg = $this->params['session']->getSplashMsg()) { From a800f74a75b84f3d31596bfae44ab0961f7fa040 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 11 Nov 2014 15:42:07 +0100 Subject: [PATCH 07/21] fix almost unrestricted fast upload (Bug #175) --- op/op.Ajax.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/op/op.Ajax.php b/op/op.Ajax.php index 1456c7b1b..9b500202f 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -443,6 +443,20 @@ switch($command) { echo json_encode(array('success'=>false, 'message'=>getMLText("invalid_folder_id"))); exit; } + + if ($folder->getAccessMode($user) < M_READWRITE) { + echo json_encode(array('success'=>false, 'message'=>getMLText("access_denied"))); + exit; + } + + if($settings->_quota > 0) { + $remain = checkQuota($user); + if ($remain < 0) { + echo json_encode(array('success'=>false, 'message'=>getMLText("quota_exceeded", array('bytes'=>SeedDMS_Core_File::format_filesize(abs($remain)))))); + exit; + } + } + if (!is_uploaded_file($_FILES["userfile"]["tmp_name"]) || $_FILES['userfile']['error']!=0){ header('Content-Type', 'application/json'); echo json_encode(array('success'=>false, 'message'=>getMLText("uploading_failed"))); From 6d6bb02a6076d656594225d3bfbbcdd5060e1871 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 11 Nov 2014 16:01:36 +0100 Subject: [PATCH 08/21] do not show fast upload area if user has no write access of folder --- views/bootstrap/class.ViewFolder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index 1f228be64..16216c103 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -131,7 +131,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { echo "
\n"; - if ($enableDropUpload) { + if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) { echo "
"; echo "
"; } @@ -190,7 +190,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { } echo "\n"; $this->contentContainerEnd(); - if ($enableDropUpload) { + if ($enableDropUpload && $folder->getAccessMode($user) >= M_READWRITE) { echo "
"; echo "
"; $this->contentHeading(getMLText("dropupload"), true); From cd5afb0b69c05535c521164dfeb7d191c2673db4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 11 Nov 2014 16:08:08 +0100 Subject: [PATCH 09/21] add more changes for 4.3.11 --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 8ff6f9f46..179a8c7f1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,9 @@ -------------------------------------------------------------------------------- - translation updates - password expiration can be set to 'never' +- fixed saving multi value attributes - do not close browser window anymore when keywords are chosen (Bug #141) +- fix almost unrestricted fast upload (Bug #175) -------------------------------------------------------------------------------- Changes in version 4.3.10 From 16d33ef342c8237bed9f3a6923fa432c8e6d9e99 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 11 Nov 2014 18:18:07 +0100 Subject: [PATCH 10/21] fix release date --- SeedDMS_Core/package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index a36022492..614571bbe 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,7 +12,7 @@ uwe@steinmann.cx yes - 2014-11-97 + 2014-11-11 4.3.11 From 25aa6983df7b8325250c5a92b21e1d1ab3014fe3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 12 Nov 2014 10:41:13 +0100 Subject: [PATCH 11/21] use correct name for 'previewWidthList' (Closes #177) --- out/out.WorkflowSummary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/out/out.WorkflowSummary.php b/out/out.WorkflowSummary.php index 2fc76f127..c45889051 100644 --- a/out/out.WorkflowSummary.php +++ b/out/out.WorkflowSummary.php @@ -35,7 +35,7 @@ if ($user->isGuest()) { } $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'cachedir'=>$settings->_cacheDir, 'workflowmode'=>$settings->_workflowMode, 'previewwidthlist'=>$settings->_previewWidthList)); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'cachedir'=>$settings->_cacheDir, 'workflowmode'=>$settings->_workflowMode, 'previewWidthList'=>$settings->_previewWidthList)); if($view) { $view->show(); exit; From 6be63346cefb5f8d900997d9e96d11f3e26dd7f0 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 12 Nov 2014 10:41:51 +0100 Subject: [PATCH 12/21] add entry for closing bug #177 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 179a8c7f1..7558fc47c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - fixed saving multi value attributes - do not close browser window anymore when keywords are chosen (Bug #141) - fix almost unrestricted fast upload (Bug #175) +- no more php warning on Workflow summary page (Bug #177) -------------------------------------------------------------------------------- Changes in version 4.3.10 From cd1bff73bebff967a1d2f0afba10e4b5a53b0584 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 07:53:29 +0100 Subject: [PATCH 13/21] fix searching for multi value attributes --- SeedDMS_Core/Core/inc.ClassDMS.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 0540d024f..8865e7fca 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -550,7 +550,9 @@ class SeedDMS_Core_DMS { * @param modificationstartdate array search for documents modified after this date * @param modificationenddate array search for documents modified before this date * @param categories array list of categories the documents must have assigned - * @param attributes array list of attributes + * @param attributes array list of attributes. The key of this array is the + * attribute definition id. The value of the array is the value of the + * attribute. If the attribute may have multiple values it must be an array. * @param mode int decide whether to search for documents/folders * 0x1 = documents only * 0x2 = folders only @@ -623,10 +625,13 @@ class SeedDMS_Core_DMS { foreach($attributes as $attrdefid=>$attribute) { if($attribute) { $attrdef = $this->getAttributeDefinition($attrdefid); - if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { - if($attrdef->getValueSet()) - $searchAttributes[] = "`tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."'"; - else + if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { + if($valueset = $attrdef->getValueSet()) { + if($attrdef->getMultipleValues()) { + $searchAttributes[] = "`tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '".$valueset[0], $attribute)."%')"; + } else + $searchAttributes[] = "`tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."'"; + } else $searchAttributes[] = "`tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value` like '%".$attribute."%'"; } } @@ -783,10 +788,13 @@ class SeedDMS_Core_DMS { foreach($attributes as $attrdefid=>$attribute) { if($attribute) { $attrdef = $this->getAttributeDefinition($attrdefid); - if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document) { - if($attrdef->getValueSet()) - $searchAttributes[] = "`tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."'"; - else + if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { + if($valueset = $attrdef->getValueSet()) { + if($attrdef->getMultipleValues()) { + $searchAttributes[] = "`tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '".$valueset[0], $attribute)."%')"; + } else + $searchAttributes[] = "`tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."'"; + } else $searchAttributes[] = "`tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value` like '%".$attribute."%'"; } elseif($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { if($attrdef->getValueSet()) From 9f758667c4c7ca6811b81ef337bdb11a31f2b015 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 07:53:51 +0100 Subject: [PATCH 14/21] fix saving of multi value attributes --- SeedDMS_Core/Core/inc.ClassFolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index fbcabe89f..d69eeb697 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -451,7 +451,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { if($attributes) { foreach($attributes as $attrdefid=>$attribute) { - if(trim($attribute)) + if($attribute) if(!$newFolder->setAttributeValue($this->_dms->getAttributeDefinition($attrdefid), $attribute)) { $db->rollbackTransaction(); return false; From 5ff934373d16d420146dcf8166bdd4946b79f916 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 07:54:35 +0100 Subject: [PATCH 15/21] take all attributes for searching into account --- op/op.Search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op/op.Search.php b/op/op.Search.php index a1733b709..eb4702d12 100644 --- a/op/op.Search.php +++ b/op/op.Search.php @@ -436,7 +436,7 @@ if(count($entries) == 1 && ($resArr['totalDocs'] + $resArr['totalFolders']) == 1 $view->setParam('status', isset($status) ? $status : array()); $view->setParam('categories', isset($categories) ? $categories : ''); $view->setParam('attributes', isset($attributes) ? $attributes : ''); - $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder/*, SeedDMS_Core_AttributeDefinition::objtype_all*/)); + $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); $view->setParam('attrdefs', $attrdefs); $allCats = $dms->getDocumentCategories(); $view->setParam('allcategories', $allCats); From 53389d01d51618e9150931da1b2d462be1faf210 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 07:55:29 +0100 Subject: [PATCH 16/21] extend search on attributes for all object types --- views/bootstrap/class.Search.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index ac72d624c..f16c6f9ed 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -161,6 +161,24 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style { + +getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { +?> + + getName()); ?>: + printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?> + + + + From 68ffdb407ff36637774508b05651ac20b4a531b1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 07:56:20 +0100 Subject: [PATCH 17/21] add entry for fixing handling of multi value attributes --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 7558fc47c..5393789c0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ - do not close browser window anymore when keywords are chosen (Bug #141) - fix almost unrestricted fast upload (Bug #175) - no more php warning on Workflow summary page (Bug #177) +- various bug fixes in saving and searching for multi value attributes -------------------------------------------------------------------------------- Changes in version 4.3.10 From 86ba6aa6a61679c035b1b3b80a20001df4966644 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 08:20:45 +0100 Subject: [PATCH 18/21] add new method getValueAsArray() helpful for multi value attributes --- SeedDMS_Core/Core/inc.ClassAttribute.php | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index 9fc49eb6f..bbce8671b 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -91,8 +91,33 @@ class SeedDMS_Core_Attribute { /* {{{ */ function getID() { return $this->_id; } + /** + * Return attribute value as stored in database + * + * This function will return the value of multi value attributes + * including the separator char. + * + * @return string the attribute value as it is stored in the database. + */ function getValue() { return $this->_value; } + /** + * Return attribute values as an array + * + * This function returns the attribute value as an array. Such an array + * has one element for non multi value attributes and n elements for + * multi value attributes. + * + * @return array the attribute values + */ + function getValueAsArray() { /* {{{ */ + if($this->_attrdef->getMultipleValues()) { + return explode($this->_value[0], substr($this->_value, 1)); + } else { + return array($this->_value); + } + } /* }}} */ + /** * Set a value of an attribute * The attribute is deleted completely if the value is the empty string From 99590a322d4dd6681eadafe75821b4b899df9f51 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 08:21:49 +0100 Subject: [PATCH 19/21] use new method getValueAsArray() for showing attributes --- views/bootstrap/class.DocumentVersionDetail.php | 2 +- views/bootstrap/class.Search.php | 6 +++--- views/bootstrap/class.ViewDocument.php | 6 +++--- views/bootstrap/class.ViewFolder.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/views/bootstrap/class.DocumentVersionDetail.php b/views/bootstrap/class.DocumentVersionDetail.php index 86b6a8d5d..cb8cdb3e9 100644 --- a/views/bootstrap/class.DocumentVersionDetail.php +++ b/views/bootstrap/class.DocumentVersionDetail.php @@ -120,7 +120,7 @@ class SeedDMS_View_DocumentVersionDetail extends SeedDMS_Bootstrap_Style { ?> getName()); ?>: - getValue()); ?> + getValueAsArray())); ?> getAttributeDefinition(); - print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($lcattribute->getValue())."
  • \n"; + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
  • \n"; } } print "\n"; @@ -484,7 +484,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style { if($docttributes) { foreach($docttributes as $docttribute) { $attrdef = $docttribute->getAttributeDefinition(); - print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($docttribute->getValue())."
  • \n"; + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $docttribute->getValueAsArray()))."
  • \n"; } } print "\n"; @@ -549,7 +549,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style { if($folderattributes) { foreach($folderattributes as $folderattribute) { $attrdef = $folderattribute->getAttributeDefinition(); - print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($folderattribute->getValue())."
  • \n"; + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $folderattribute->getValueAsArray()))."
  • \n"; } } print ""; diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 95c78b112..23fc0c4f5 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -241,7 +241,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { ?> getName()); ?>: - getValue()); ?> + getValueAsArray())); ?> getAttributeDefinition(); - print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."
  • \n"; + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."
  • \n"; } } print "\n"; @@ -933,7 +933,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { if($attributes) { foreach($attributes as $attribute) { $attrdef = $attribute->getAttributeDefinition(); - print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($attribute->getValue())."
  • \n"; + print "
  • ".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars(implode(', ', $attribute->getValueAsArray()))."
  • \n"; } } print "\n"; diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index 16216c103..09931bc95 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -183,7 +183,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { ?> getName()); ?>: - getValue()); ?> + getValueAsArray())); ?> Date: Thu, 13 Nov 2014 09:01:39 +0100 Subject: [PATCH 20/21] add missing space between icon and text on button --- views/bootstrap/class.ViewDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 23fc0c4f5..8fcd10db6 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -709,7 +709,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { if(SeedDMS_Core_DMS::checkIfEqual($workflow->getInitState(), $latestContent->getWorkflowState())) { print "
    ".createHiddenFieldWithKey('removeworkflowfromdocument')."getVersion()."\" />
    "; } else { - print "
    ".createHiddenFieldWithKey('rewindworkflow')."getVersion()."\" />
    "; + print "
    ".createHiddenFieldWithKey('rewindworkflow')."getVersion()."\" />
    "; } } From afb434a35f80201613c66389f5b4c428fb9e40f3 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 13 Nov 2014 09:09:43 +0100 Subject: [PATCH 21/21] complete changelog --- SeedDMS_Core/package.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 614571bbe..77464e2a9 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,8 +12,8 @@ uwe@steinmann.cx yes - 2014-11-11 - + 2014-11-13 + 4.3.11 4.3.11 @@ -24,7 +24,8 @@ GPL License -fixed saving multivalue attributes +- fixed saving multivalue attributes +- add method SeedDMS_Core_Attribute::getValueAsArray()