this._autoInsert = [ ];
this._objectType = objectType;
- this._objectID = objectID;
+ this._objectID = parseInt(objectID);
this._tmpHash = tmpHash;
- this._parentObjectID = parentObjectID;
+ this._parentObjectID = parseInt(parentObjectID);
this._wysiwygContainerID = wysiwygContainerID;
this._buttonSelector.children('p.button').click($.proxy(this._validateLimit, this));
if (this._wysiwygContainerID) {
WCF.System.Event.addListener('com.woltlab.wcf.messageOptionsInline', 'submit_' + this._wysiwygContainerID, $.proxy(this._submitInline, this));
+ WCF.System.Event.addListener('com.woltlab.wcf.messageOptionsInline', 'prepareExtended_' + this._wysiwygContainerID, $.proxy(this._prepareExtended, this));
WCF.System.Event.addListener('com.woltlab.wcf.redactor', 'reset', $.proxy(this._reset, this));
WCF.System.Event.addListener('com.woltlab.wcf.redactor', 'upload_' + this._wysiwygContainerID, $.proxy(this._editorUpload, this));
WCF.System.Event.addListener('com.woltlab.wcf.redactor', 'getImageAttachments_' + this._wysiwygContainerID, $.proxy(this._getImageAttachments, this));
}
},
+ /**
+ * Adds parameters send to the server before jumping to extended form.
+ *
+ * @param object data
+ */
+ _prepareExtended: function(data) {
+ if (!this._objectID && this._tmpHash && this._fileListSelector.children('li:not(.uploadFailed)').length) {
+ data.tmpHash = this._tmpHash;
+ }
+ },
+
/**
* Resets the attachment container.
*/
$message = $.trim(this._messageField.val());
}
+ var $parameters = {
+ containerID: this._getObjectID(),
+ message: $message
+ };
+
+ WCF.System.Event.fireEvent('com.woltlab.wcf.messageOptionsInline', 'prepareExtended_' + this._messageField.wcfIdentify(), $parameters);
+
new WCF.Action.Proxy({
autoSend: true,
data: {
actionName: 'jumpToExtended',
className: this._getClassName(),
interfaceName: 'wcf\\data\\IExtendedMessageQuickReplyAction',
- parameters: {
- containerID: this._getObjectID(),
- message: $message
- }
+ parameters: $parameters
},
success: (function(data) {
this._messageField.redactor('wutil.saveTextToStorage');
$this->tmpHash = $_REQUEST['tmpHash'];
}
if (empty($this->tmpHash)) {
- $this->tmpHash = StringUtil::getRandomID();
+ $this->tmpHash = WCF::getSession()->getVar('__wcfAttachmentTmpHash');
+ if ($this->tmpHash === null) {
+ $this->tmpHash = StringUtil::getRandomID();
+ }
+ else {
+ WCF::getSession()->unregister('__wcfAttachmentTmpHash');
+ }
}
if ($this->enableMultilingualism) {
public function getContainer() {
return $this->container;
}
+
+ /**
+ * Stores tmpHash in current session, used in combination with the extended form.
+ *
+ * @param string $tmpHash
+ */
+ public function setTmpHash($tmpHash) {
+ WCF::getSession()->register('__wcfAttachmentTmpHash', $tmpHash);
+ }
}