{if $wysiwygEnableUpload}
$config.plugins.push('wupload');
$config.wattachment = {
+ attachments: [ ],
maxCount: {@$attachmentHandler->getMaxCount()},
objectType: '{@$attachmentObjectType}',
objectID: '{@$attachmentObjectID}',
parentObjectID: '{@$attachmentParentObjectID}',
tmpHash: '{$tmpHash|encodeJS}'
};
+
+ {if $attachmentList|isset && !$attachmentList|empty}
+ {foreach from=$attachmentList item=attachment}
+ $config.wattachment.attachments.push({
+ attachmentID: {@$attachment->attachmentID},
+ filename: '{$attachment->filename|encodeJs}',
+ isImage: {if $attachment->isImage}true{else}false{/if},
+ tinyThumbnailUrl: '{if $attachment->tinyThumbnailType}{link controller='Attachment' object=$attachment}tiny=1{/link}{/if}',
+ url: '{link controller='Attachment' object=$attachment}{/link}'
+ });
+ {/foreach}
+ {/if}
{/if}
{event name='javascriptInit'}
*/
_initAttachments: function() {
this._attachmentsContainer = $('<div class="redactorAttachmentContainer" />').hide().appendTo(this.$box);
- $('<ul class="formAttachmentList clearfix" />').hide().appendTo(this._attachmentsContainer);
+ var $attachmentList = $('<ul class="formAttachmentList clearfix" />').hide().appendTo(this._attachmentsContainer);
$('<dl class="wide"><dt></dt><dd><div data-max-size="{@$attachmentHandler->getMaxSize()}"></div><small>' + WCF.String.unescapeHTML(WCF.Language.get('wcf.attachment.upload.limits')) + '</small></dd></dl>').appendTo(this._attachmentsContainer);
var $options = this.getOption('wattachment');
+ if ($options.attachments.length) {
+ for (var $i = 0; $i < $options.attachments.length; $i++) {
+ var $attachment = $options.attachments[$i];
+ var $listItem = $('<li class="box48" />');
+ if ($attachment.tinyThumbnailUrl) {
+ $('<img src="' + $attachment.tinyThumbnailUrl + '" alt="" class="attachmentTinyThumbnail" />').appendTo($listItem);
+ }
+ else {
+ $('<span class="icon icon48 icon-paper-clip" />').appendTo($listItem);
+ }
+
+ var $div = $('<div />').appendTo($listItem);
+ $('<div><p><a href="' + $attachment.url + '"' + ($attachment.isImage ? ' title="' + $attachment.filename + '" class="jsImageViewer"' : '') + '>' + $attachment.filename + '</a></p></div>').appendTo($div);
+ var $list = $('<ul />').appendTo($div);
+ $('<li><span class="icon icon16 icon-remove pointer jsTooltip jsDeleteButton " title="' + WCF.Language.get('wcf.global.button.delete') + '" data-object-id="' + $attachment.attachmentID + '" data-confirm-message="' + WCF.Language.get('wcf.attachment.delete.sure') + '"></span></li>').appendTo($list);
+ $('<li><span class="icon icon16 icon-paste pointer jsTooltip jsButtonInsertAttachment" title="' + WCF.Language.get('wcf.attachment.insert') + '" data-object-id="' + $attachment.attachmentID + '"></span></li>').appendTo($list);
+
+ $listItem.appendTo($attachmentList);
+
+ this._attachmentsContainer.show();
+ $attachmentList.show();
+ }
+ }
+
new WCF.Attachment.Upload(this._attachmentsContainer.find('> dl > dd > div'), this._attachmentsContainer.children('ul'), $options.objectType, $options.objectID, $options.tmpHash, $options.parentObjectID, $options.maxCount, this.$source.wcfIdentify());
new WCF.Action.Delete('wcf\\data\\attachment\\AttachmentAction', '.formAttachmentList > li');
}
// hide unrelated content
$content.parent().children('.jsInlineEditorHideContent').hide();
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').hide();
this._cache = $content.detach();
},
var $messageBody = $container.find('.messageBody');
$messageBody.children('.icon-spinner').remove();
$messageBody.children('div:eq(0)').html(this._cache);
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').show();
// show unrelated content
$messageBody.find('.jsInlineEditorHideContent').show();
var $messageBody = this._container[this._activeElementID].removeClass('jsInvalidQuoteTarget').find('.messageBody');
$messageBody.children('span.icon-spinner').remove();
$messageBody.children('div:eq(0)').children().show();
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').show();
// show unrelated content
$messageBody.find('.jsInlineEditorHideContent').show();
var $messageBody = this._container[this._activeElementID].removeClass('jsInvalidQuoteTarget').find('.messageBody');
$('<span class="icon icon48 icon-spinner" />').appendTo($messageBody);
$messageBody.children('div:eq(0)').children().hide();
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').show();
// show unrelated content
$messageBody.find('.jsInlineEditorHideContent').show();
// insert new message
$content.html('<div class="messageText">' + data.returnValues.message + '</div>');
+ if (data.returnValues.attachmentList == undefined) {
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').show();
+ }
+ else {
+ $messageBody.children('.attachmentThumbnailList, .attachmentFileList').remove();
+
+ if (data.returnValues.attachmentList) {
+ $(data.returnValues.attachmentList).insertAfter($messageBody.children('div:eq(0)'));
+ }
+ }
+
this._activeElementID = '';
this._updateHistory(this._getHash($container.data('objectID')));
<?php
namespace wcf\system\message;
use wcf\data\DatabaseObjectDecorator;
+use wcf\data\IAttachmentMessageQuickReplyAction;
use wcf\data\IMessage;
use wcf\data\IMessageQuickReplyAction;
use wcf\system\bbcode\PreParser;
use wcf\util\ClassUtil;
use wcf\util\MessageUtil;
use wcf\util\StringUtil;
-use wcf\data\IAttachmentMessageQuickReplyAction;
/**
* Manages quick replies and stored messages.