Submit attachment tmpHash in AJAX form builder forms
authorMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 14:10:28 +0000 (16:10 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 14:10:28 +0000 (16:10 +0200)
Close #3075

com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl
wcfsetup/install/files/acp/templates/__wysiwygAttachmentFormField.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment.js [new file with mode: 0644]
wcfsetup/install/files/lib/system/form/builder/field/wysiwyg/WysiwygAttachmentFormField.class.php

index 6517d07e96e2c4e15e41594f1612fd5367215bb6..7061590169f2414bcd3ddd6654fcca5dc68b2c3e 100644 (file)
@@ -72,6 +72,6 @@
        });
 </script>
 
-<input type="hidden" name="{@$field->getPrefixedID()}_tmpHash" value="{$field->getAttachmentHandler()->getTmpHashes()[0]}">
+<input type="hidden" id="{@$field->getPrefixedID()}_tmpHash" name="{@$field->getPrefixedID()}_tmpHash" value="{$field->getAttachmentHandler()->getTmpHashes()[0]}">
 
 {include file='__formFieldFooter'}
index 6517d07e96e2c4e15e41594f1612fd5367215bb6..7061590169f2414bcd3ddd6654fcca5dc68b2c3e 100644 (file)
@@ -72,6 +72,6 @@
        });
 </script>
 
-<input type="hidden" name="{@$field->getPrefixedID()}_tmpHash" value="{$field->getAttachmentHandler()->getTmpHashes()[0]}">
+<input type="hidden" id="{@$field->getPrefixedID()}_tmpHash" name="{@$field->getPrefixedID()}_tmpHash" value="{$field->getAttachmentHandler()->getTmpHashes()[0]}">
 
 {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 (file)
index 0000000..e287068
--- /dev/null
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
+ * @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;
+});
index b607e32e89a3bbd25b7440641bad06c5a96cbb1e..93d778edfefcfb0e998517c86a46d8479e4a3a1e 100644 (file)
@@ -28,6 +28,11 @@ class WysiwygAttachmentFormField extends AbstractFormField {
         */
        protected $attachmentHandler;
        
+       /**
+        * @inheritDoc
+        */
+       protected $javaScriptDataHandlerModule = 'WoltLabSuite/Core/Form/Builder/Field/Wysiwyg/Attachment';
+       
        /**
         * @inheritDoc
         */