From aa398f90b832cecaeffe3c6915fbaa38c46b6533 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 29 Sep 2019 16:10:28 +0200 Subject: [PATCH] Submit attachment tmpHash in AJAX form builder forms Close #3075 --- .../__wysiwygAttachmentFormField.tpl | 2 +- .../__wysiwygAttachmentFormField.tpl | 2 +- .../Form/Builder/Field/Wysiwyg/Attachment.js | 22 +++++++++++++++++++ .../WysiwygAttachmentFormField.class.php | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment.js diff --git a/com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl b/com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl index 6517d07e96..7061590169 100644 --- a/com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl +++ b/com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl @@ -72,6 +72,6 @@ }); - + {include file='__formFieldFooter'} diff --git a/wcfsetup/install/files/acp/templates/__wysiwygAttachmentFormField.tpl b/wcfsetup/install/files/acp/templates/__wysiwygAttachmentFormField.tpl index 6517d07e96..7061590169 100644 --- a/wcfsetup/install/files/acp/templates/__wysiwygAttachmentFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__wysiwygAttachmentFormField.tpl @@ -72,6 +72,6 @@ }); - + {include file='__formFieldFooter'} diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment.js new file mode 100644 index 0000000000..e287068b49 --- /dev/null +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment.js @@ -0,0 +1,22 @@ +/** + * Data handler for a wysiwyg attachment form builder field that stores the temporary hash. + * + * @author Matthias Schmidt + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Form/Builder/Field/Checked + * @since 5.2 + */ +define(['Core', '../Value'], function(Core, FormBuilderFieldValue) { + "use strict"; + + /** + * @constructor + */ + function FormBuilderFieldAttachment(fieldId) { + this.init(fieldId + '_tmpHash'); + }; + Core.inherit(FormBuilderFieldAttachment, FormBuilderFieldValue, {}); + + return FormBuilderFieldAttachment; +}); diff --git a/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygAttachmentFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygAttachmentFormField.class.php index b607e32e89..93d778edfe 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygAttachmentFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygAttachmentFormField.class.php @@ -28,6 +28,11 @@ class WysiwygAttachmentFormField extends AbstractFormField { */ protected $attachmentHandler; + /** + * @inheritDoc + */ + protected $javaScriptDataHandlerModule = 'WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment'; + /** * @inheritDoc */ -- 2.20.1