From e69fb26dcc1cb7ca3c4333717e9363fb0e177f3a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 7 Oct 2016 16:11:29 +0200 Subject: [PATCH 1/8] prepare for new version 4.3.30 --- SeedDMS_Core/Core/inc.ClassDMS.php | 2 +- inc/inc.Version.php | 2 +- install/install.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index b584ff2df..d28f62893 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -291,7 +291,7 @@ class SeedDMS_Core_DMS { $this->callbacks = array(); $this->version = '@package_version@'; if($this->version[0] == '@') - $this->version = '4.3.29'; + $this->version = '4.3.30'; } /* }}} */ /** diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 57787a1ca..238f82aa3 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -20,7 +20,7 @@ class SeedDMS_Version { - public $_number = "4.3.29"; + public $_number = "4.3.30"; private $_string = "SeedDMS"; function __construct() { diff --git a/install/install.php b/install/install.php index 97f3aaf64..8229f9cc2 100644 --- a/install/install.php +++ b/install/install.php @@ -118,7 +118,7 @@ function fileExistsInIncludePath($file) { /* {{{ */ * Load default settings + set */ define("SEEDDMS_INSTALL", "on"); -define("SEEDDMS_VERSION", "4.3.29"); +define("SEEDDMS_VERSION", "4.3.30"); require_once('../inc/inc.ClassSettings.php'); From 894466b1028f29b48f40ae71dcd811172cc95264 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 20 Oct 2016 18:27:43 +0200 Subject: [PATCH 2/8] add code for taking over attribute value of previous version --- views/bootstrap/class.Bootstrap.php | 93 +++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 5 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index ead8a14cd..4ac13cd9c 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1067,12 +1067,12 @@ $('#acceptkeywords').click(function(ev) { switch($attrdef->getType()) { case SeedDMS_Core_AttributeDefinition::type_boolean: echo "getId()."]\" value=\"0\" />"; - echo "getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />"; + echo "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />"; break; case SeedDMS_Core_AttributeDefinition::type_date: ?> - "> + getId();?>" class="span4" size="16" name="[getId() ?>]" type="text" value=""> getValueSetAsArray()) { echo "getId()."]\" value=\"\" />"; - echo "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]"; if($attrdef->getMultipleValues()) { echo "[]\" multiple"; } else { @@ -1103,9 +1103,9 @@ $('#acceptkeywords').click(function(ev) { echo ""; } else { if (strlen($objvalue) > 80) { - echo '"; + echo '"; } else { - echo "getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; + echo "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; } } break; @@ -1664,6 +1664,89 @@ $(document).ready( function() { + " data-ref="" data-text=""> + +$(document).ready( function() { + $('.inputpreset_btn').click(function(ev){ + ev.preventDefault(); + if (typeof $(ev.currentTarget).data('text') != 'undefined') { + target = $(ev.currentTarget).data('ref'); + value = $(ev.currentTarget).data('text'); + sep = $(ev.currentTarget).data('sep'); + if(sep) { + // Use attr() instead of data() because data() converts to int which cannot be split + arr = value.split(sep); + for(var i in arr) { + $("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected"); + } + } else { + $("#"+target).val(value); + } + } + }); +}); + + " data-ref="" data-text=""> + +$(document).ready( function() { + $('.checkboxpreset_btn').click(function(ev){ + ev.preventDefault(); + if (typeof $(ev.currentTarget).data('text') != 'undefined') { + target = $(ev.currentTarget).data('ref'); + value = $(ev.currentTarget).data('text'); + if(value) { + $("#"+target).attr('checked', ''); + } else { + $("#"+target).removeAttribute('checked'); + } + } + }); +}); + Date: Thu, 20 Oct 2016 18:28:25 +0200 Subject: [PATCH 3/8] add preset button for attributes takes over attribute value from previous version --- views/bootstrap/class.UpdateDocument.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/views/bootstrap/class.UpdateDocument.php b/views/bootstrap/class.UpdateDocument.php index 3bf912e2b..6da53d5b7 100644 --- a/views/bootstrap/class.UpdateDocument.php +++ b/views/bootstrap/class.UpdateDocument.php @@ -37,6 +37,8 @@ class SeedDMS_View_UpdateDocument extends SeedDMS_Bootstrap_Style { header('Content-Type: application/javascript'); $this->printDropFolderChooserJs("form1"); $this->printSelectPresetButtonJs(); + $this->printInputPresetButtonJs(); + $this->printCheckboxPresetButtonJs(); ?> function checkForm() { @@ -233,7 +235,23 @@ console.log(element); ?> getName()); ?>: - printAttributeEditField($attrdef, '') ?> + printAttributeEditField($attrdef, '') ?> +getAttributeValue($attrdef)) { + switch($attrdef->getType()) { + case SeedDMS_Core_AttributeDefinition::type_string: + case SeedDMS_Core_AttributeDefinition::type_date: + case SeedDMS_Core_AttributeDefinition::type_int: + case SeedDMS_Core_AttributeDefinition::type_float: + $this->printInputPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef), $attrdef->getValueSetSeparator()); + break; + case SeedDMS_Core_AttributeDefinition::type_boolean: + $this->printCheckboxPresetButtonHtml('attributes_'.$attrdef->getID(), $latestContent->getAttributeValue($attrdef)); + break; + } +// print_r($latestContent->getAttributeValue($attrdef)); + } +?> Date: Tue, 25 Oct 2016 07:55:27 +0200 Subject: [PATCH 4/8] add check for valid email address --- SeedDMS_Core/Core/inc.ClassAttribute.php | 1 + 1 file changed, 1 insertion(+) diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index e50662387..e96ae8ed5 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -924,6 +924,7 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ break; case self::type_email: foreach($values as $value) { + $success &= preg_match('/^[a-z0-9._-]+@+[a-z0-9._-]+\.+[a-z]{2,4}$/i', $value); } if(!$success) $this->_validation_error = 5; From 8b2668115301adbf5eed3f79e665a57cb522f263 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 25 Oct 2016 07:58:28 +0200 Subject: [PATCH 5/8] add attribute data-rule-email to seeddms attribute of type email --- views/bootstrap/class.Bootstrap.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index d6dfacb67..9fc963a07 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1140,6 +1140,9 @@ $('#acceptkeywords').click(function(ev) { getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').' data-rule-email="true"'." />"; + break; default: if($valueset = $attrdef->getValueSetAsArray()) { echo "getId()."]\" value=\"\" />"; From 4d6d184944733007ae67379c41ba38a6163052d6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 25 Oct 2016 08:03:18 +0200 Subject: [PATCH 6/8] set default value of attribute of type email --- views/bootstrap/class.Bootstrap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 9fc963a07..12420e694 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1141,6 +1141,7 @@ $('#acceptkeywords').click(function(ev) { getValue() : $attribute) : ''; echo "getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').' data-rule-email="true"'." />"; break; default: From bfd02591c86fe587f74ad74d77d9b86bc9ea9891 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 25 Oct 2016 09:56:49 +0200 Subject: [PATCH 7/8] make getConfigDir static --- inc/inc.ClassSettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 00aabc562..312b6fe84 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -872,7 +872,7 @@ class Settings { /* {{{ */ function searchConfigFilePath() { /* {{{ */ $configFilePath = null; - if($configDir = $this->getConfigDir()) { + if($configDir = Settings::getConfigDir()) { if (file_exists($configDir."/settings.xml")) return $configDir."/settings.xml"; } @@ -888,7 +888,7 @@ class Settings { /* {{{ */ * 3. The directory /etc/seeddms * @return NULL|string config directory */ - function getConfigDir() { /* {{{ */ + static function getConfigDir() { /* {{{ */ $_tmp = dirname($_SERVER['SCRIPT_FILENAME']); $_arr = preg_split('/\//', rtrim(str_replace('\\', '/', $_tmp))); $configDir = null; From 74c97ee46642be9c26b638e1548f45d01bdc2fa9 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 25 Oct 2016 10:01:51 +0200 Subject: [PATCH 8/8] add entry for 5.0.7 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 47f5e1e53..00ede1086 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Changes in version 5.0.7 -------------------------------------------------------------------------------- - merged changes from 4.3.30 +- validate email address of attributes of type email -------------------------------------------------------------------------------- Changes in version 5.0.6