diff --git a/CHANGELOG b/CHANGELOG index 6642cbf0d..047f9e599 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -186,6 +186,8 @@ - move lots of javascript packages into views/bootstrap/vendors and update them with npm and grunt - update to font-awesome 4.7.1 +- add new attribute types 'document', 'folder', 'user', 'group' +- overhaul of folder tree which can now be used more than once on a page -------------------------------------------------------------------------------- Changes in version 5.1.18 diff --git a/Makefile b/Makefile index f10892e27..bb9b3e979 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION=$(shell php -r 'include("inc/inc.Version.php"); $$v=new SeedDMS_Version( SRC=CHANGELOG inc conf utils index.php .htaccess languages views op out controllers doc styles TODO LICENSE webdav install restapi pdfviewer # webapp -NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder .svn .gitignore styles/blue styles/hc styles/clean views/blue views/hc views/clean views/pca +NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder .svn .gitignore styles/blue styles/hc styles/clean views/blue views/hc views/clean views/pca views/tdk EXTENSIONS := \ dynamic_content.tar.gz\ diff --git a/SeedDMS_Core/Core/inc.ClassAttribute.php b/SeedDMS_Core/Core/inc.ClassAttribute.php index 3cb423703..ad129b069 100644 --- a/SeedDMS_Core/Core/inc.ClassAttribute.php +++ b/SeedDMS_Core/Core/inc.ClassAttribute.php @@ -130,7 +130,8 @@ class SeedDMS_Core_Attribute { /* {{{ */ * the value set and later turned into a multi value attribute. */ $sep = substr($this->_value, 0, 1); - $vsep = $this->_attrdef->getValueSetSeparator(); + if(!($vsep = $this->_attrdef->getValueSetSeparator())) + $vsep = $sep; if($sep == $vsep) return(explode($sep, substr($this->_value, 1))); else @@ -156,38 +157,54 @@ class SeedDMS_Core_Attribute { /* {{{ */ $db = $this->_dms->getDB(); if($this->_attrdef->getMultipleValues()) { + $valuesetstr = $this->_attrdef->getValueSet(); /* Multiple values without a value set is not allowed */ - if(!$valuesetstr = $this->_attrdef->getValueSet()) + /* No need to have valueset anymore. If none is given, the values are + * expected to be separated by ',' + if(!$valuesetstr) return false; + */ $valueset = $this->_attrdef->getValueSetAsArray(); if(is_array($values)) { if($values) { - $error = false; - foreach($values as $v) { - if(!in_array($v, $valueset)) { $error = true; break; } + if($valueset) { + $error = false; + foreach($values as $v) { + if(!in_array($v, $valueset)) { $error = true; break; } + } + if($error) + return false; + $valuesetstr = $this->_attrdef->getValueSet(); + $value = $valuesetstr[0].implode($valuesetstr[0], $values); + } else { + $value = ','.implode(',', $values); } - if($error) - return false; - $valuesetstr = $this->_attrdef->getValueSet(); - $value = $valuesetstr[0].implode($valuesetstr[0], $values); } else { $value = ''; } } else { if($values) { - if($valuesetstr[0] != $values[0]) - $values = explode($valuesetstr[0], $values); - else - $values = explode($valuesetstr[0], substr($values, 1)); - - $error = false; - foreach($values as $v) { - if(!in_array($v, $valueset)) { $error = true; break; } + if($valuesetstr) { + if($valuesetstr[0] != $values[0]) + $values = explode($valuesetstr[0], $values); + else + $values = explode($valuesetstr[0], substr($values, 1)); + } else { + $values = explode(',', substr($values, 1)); + } + + if($valueset) { + $error = false; + foreach($values as $v) { + if(!in_array($v, $valueset)) { $error = true; break; } + } + if($error) + return false; + $value = $valuesetstr[0].implode($valuesetstr[0], $values); + } else { + $value = ','.implode(',', $values); } - if($error) - return false; - $value = $valuesetstr[0].implode($valuesetstr[0], $values); } else { $value = $values; } @@ -395,6 +412,15 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */ const type_email = '6'; const type_date = '7'; + /* + * Addtional data types of an attribute representing objects in seeddms + */ + const type_folder = '101'; + const type_document = '102'; + //const type_documentcontent = '103'; + const type_user = '104'; + const type_group = '105'; + /* * The object type for which a attribute may be used */ diff --git a/SeedDMS_Core/Core/inc.ClassObject.php b/SeedDMS_Core/Core/inc.ClassObject.php index 101f3bf2c..ed5daa457 100644 --- a/SeedDMS_Core/Core/inc.ClassObject.php +++ b/SeedDMS_Core/Core/inc.ClassObject.php @@ -238,7 +238,10 @@ class SeedDMS_Core_Object { /* {{{ */ break; } if($attrdef->getMultipleValues() && is_array($value)) { - $sep = substr($attrdef->getValueSet(), 0, 1); + if(in_array($attrdef->getType(), array(SeedDMS_Core_AttributeDefinition::type_user, SeedDMS_Core_AttributeDefinition::type_group))) + $sep = ','; + else + $sep = substr($attrdef->getValueSet(), 0, 1); $value = $sep.implode($sep, $value); } if(!isset($this->_attributes[$attrdef->getId()])) { diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index a6e01739e..823d7ab15 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -28,6 +28,7 @@ - clear the save content list and latest content in SeedDMS_Core_Document after a version has been deleted. - new method SeedDMS_Core_Document::isLatestVersion() +- add new attribute types 'document', 'folder', 'user', 'group' diff --git a/controllers/class.ExtensionMgr.php b/controllers/class.ExtensionMgr.php index e28f4dab7..306e521f8 100644 --- a/controllers/class.ExtensionMgr.php +++ b/controllers/class.ExtensionMgr.php @@ -57,10 +57,12 @@ class SeedDMS_Controller_ExtensionMgr extends SeedDMS_Controller_Common { $extmgr = $this->params['extmgr']; $file = $this->params['file']; - if($extmgr->updateExtension($file)) + if($extmgr->updateExtension($file)) { $extmgr->createExtensionConf(); - else + } else { + $this->setErrorMsg($extmgr->getErrorMsg()); return false; + } return true; } /* }}} */ diff --git a/doc/README.npm b/doc/README.npm new file mode 100644 index 000000000..382f1785b --- /dev/null +++ b/doc/README.npm @@ -0,0 +1,16 @@ +Installation of external js packages +------------------------------------- + +All javascript was located in styles/bootstrap until SeedDMS 5.1.18 and 6.0.11. +Since 5.1.19 and 6.0.12 most of it has moved into the view at views/boostrap/vendors +and is no longer placed in git but must be installed by npm and grunt. + +Run + +`npm install` + +and afterwards + +`grunt` + +to download the js packages and copy them into the new location. diff --git a/op/op.AttributeMgr.php b/op/op.AttributeMgr.php index 9b15139f1..918ae29d7 100644 --- a/op/op.AttributeMgr.php +++ b/op/op.AttributeMgr.php @@ -71,7 +71,7 @@ if ($action == "addattrdef") { if($minvalues > $maxvalues) { UI::exitError(getMLText("admin_tools"),getMLText("attrdef_min_greater_max")); } - if($multiple && $valueset == '') { + if($multiple && $valueset == '' && !in_array($type, array(SeedDMS_Core_AttributeDefinition::type_user, SeedDMS_Core_AttributeDefinition::type_group))) { UI::exitError(getMLText("admin_tools"),getMLText("attrdef_multiple_needs_valueset")); } @@ -148,7 +148,7 @@ else if ($action == "editattrdef") { if($minvalues > $maxvalues) { UI::exitError(getMLText("admin_tools"),getMLText("attrdef_min_greater_max")); } - if($multiple && $valueset == '') { + if($multiple && $valueset == '' && !in_array($type, array(SeedDMS_Core_AttributeDefinition::type_user, SeedDMS_Core_AttributeDefinition::type_group))) { UI::exitError(getMLText("admin_tools"),getMLText("attrdef_multiple_needs_valueset")); } diff --git a/op/op.ExtensionMgr.php b/op/op.ExtensionMgr.php index c50d6b1e9..1e7d63b8d 100644 --- a/op/op.ExtensionMgr.php +++ b/op/op.ExtensionMgr.php @@ -76,10 +76,10 @@ elseif ($action == "upload") { /* {{{ */ UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_no_upload")); } if($_FILES['userfile']['error']) { - UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); + UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_error_upload")); } if(!in_array($_FILES['userfile']['type'], array('application/zip', 'application/x-zip-compressed'))) { - UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); + UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_no_zipfile")); } // $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); $controller->setParam('extmgr', $extMgr); diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index afa9ecf38..f9a7d09cc 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -34,6 +34,19 @@ function escapeHtml(text) { return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } + +function treeFolderSelected(formid, nodeid, nodename) { + $('#targetid'+formid).val(nodeid); + $('#choosefoldersearch'+formid).val(nodename); + $('#folderChooser'+formid).modal('hide'); +} + +function treeDocumentSelected(formid, nodeid, nodename) { + $('#docid'+formid).val(nodeid); + $('#choosedocsearch'+formid).val(nodename); + $('#docChooser'+formid).modal('hide'); +} + $(document).ready( function() { /* close popovers when clicking somewhere except in the popover or the * remove icon @@ -169,6 +182,22 @@ $(document).ready( function() { } }); /* }}} */ + $('body').on('click', '[id^=clearfolder]', function(ev) { /* {{{ */ + ev.preventDefault(); + ev.stopPropagation(); + target = $(this).data('target'); + $('#choosefoldersearch'+target).val(''); + $('#'+target).val(''); + }); /* }}} */ + + $('body').on('click', '[id^=cleardocument]', function(ev) { /* {{{ */ + ev.preventDefault(); + ev.stopPropagation(); + target = $(this).data('target'); + $('#choosedocsearch'+target).val(''); + $('#'+target).val(''); + }); /* }}} */ + $('body').on('click', '#clipboard-float', function(ev) { /* {{{ */ ev.preventDefault(); ev.stopPropagation(); diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index c0544f276..89e18a431 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -336,7 +336,7 @@ $(document).ready(function() { } } } - $arrs = $this->callHook('addDocumentAttributes', $folder); + $arrs = $this->callHook('addDocumentAttributes', null); if(is_array($arrs)) { foreach($arrs as $arr) { $this->formField($arr[0], $arr[1]); diff --git a/views/bootstrap/class.AddSubFolder.php b/views/bootstrap/class.AddSubFolder.php index e2778d2b9..eb097de90 100644 --- a/views/bootstrap/class.AddSubFolder.php +++ b/views/bootstrap/class.AddSubFolder.php @@ -109,6 +109,10 @@ $(document).ready( function() { $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) { foreach($attrdefs as $attrdef) { + /* The second parameter is null, to make this function call equal + * to 'editFolderAttribute', which expects the folder as the second + * parameter. + */ $arr = $this->callHook('addFolderAttribute', null, $attrdef); if(is_array($arr)) { if($arr) { @@ -119,7 +123,11 @@ $(document).ready( function() { } } } - $arrs = $this->callHook('addFolderAttributes', $folder); + /* The second parameter is null, to make this function call equal + * to 'editFolderAttributes', which expects the folder as the second + * parameter. + */ + $arrs = $this->callHook('addFolderAttributes', null); if(is_array($arrs)) { foreach($arrs as $arr) { $this->formField($arr[0], $arr[1]); diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index 17811c4c1..a62ea7612 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -57,6 +57,7 @@ $(document).ready( function() { $this->printDeleteDocumentButtonJs(); $this->printDeleteAttributeValueButtonJs(); $this->printClickDocumentJs(); + $this->printClickFolderJs(); } /* }}} */ function info() { /* {{{ */ @@ -217,6 +218,7 @@ $(document).ready( function() {
getID() : "") ."\">"; + $content .= "getID() : "") ."\">"; $content .= "
\n"; - $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; - $content .= "".getMLText("document")."…\n"; + $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; + if(!$skiptree) + $content .= "".getMLText("document")."…\n"; $content .= "
\n"; - $content .= ' -