From: Matthias Schmidt Date: Mon, 19 Aug 2019 16:11:25 +0000 (+0200) Subject: Add pending items to item list on form submit X-Git-Tag: 5.2.0_Beta_1~16^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aad8857a698195e69ff4feb5f997d2f73d79efe9;p=GitHub%2FWoltLab%2FWCF.git Add pending items to item list on form submit Close WoltLab/com.woltlab.wcf.conversation#129 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js index dd02c80e64..02485596e0 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js @@ -97,6 +97,13 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSu } form.addEventListener('submit', (function() { + if (this._acceptsNewItems(elementId)) { + var value = _data.get(elementId).element.value.trim(); + if (value.length) { + this._addItem(elementId, { objectId: 0, value: value }); + } + } + var values = this.getValues(elementId); if (options.submitFieldName.length) { var input; @@ -114,6 +121,16 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'EventKey', 'WoltLabSu } }).bind(this)); } + else { + form.addEventListener('submit', function() { + if (this._acceptsNewItems(elementId)) { + var value = _data.get(elementId).element.value.trim(); + if (value.length) { + this._addItem(elementId, {objectId: 0, value: value}); + } + } + }.bind(this)); + } } this._setup(); diff --git a/wcfsetup/install/files/lib/form/TagSearchForm.class.php b/wcfsetup/install/files/lib/form/TagSearchForm.class.php index 7b6d9f41d8..74c63b7b7d 100644 --- a/wcfsetup/install/files/lib/form/TagSearchForm.class.php +++ b/wcfsetup/install/files/lib/form/TagSearchForm.class.php @@ -84,7 +84,13 @@ class TagSearchForm extends AbstractCaptchaForm { if (!empty($this->tagNames)) { $this->tags = TagEngine::getInstance()->getTagsByName($this->tagNames, $this->languageID); - if (empty($this->tags)) { + if (count($this->tagNames) !== count($this->tags)) { + WCF::getTPL()->assign('unknownTags', array_diff($this->tagNames, array_map(function(Tag $tag) { + return $tag->getTitle(); + }, $this->tags))); + throw new UserInputException('tags', 'unknownTags'); + } + else if (empty($this->tags)) { throw new UserInputException('tags'); } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index b77a39eb81..7ca7f82ee3 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4377,6 +4377,7 @@ Dateianhänge: name}“]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index eb1a4bb0cf..2714015cc3 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4379,6 +4379,7 @@ Attachments: name}”]]> +