'wcf.attachment.upload.error.uploadFailed': '{lang}wcf.attachment.upload.error.uploadFailed{/lang}',
'wcf.global.button.upload': '{lang}wcf.global.button.upload{/lang}',
'wcf.attachment.insert': '{lang}wcf.attachment.insert{/lang}',
+ 'wcf.attachment.insertAll': '{lang}wcf.attachment.insertAll{/lang}',
'wcf.attachment.delete.sure': '{lang}wcf.attachment.delete.sure{/lang}'
});
'wcf.attachment.upload.error.uploadFailed': '{lang}wcf.attachment.upload.error.uploadFailed{/lang}',
'wcf.global.button.upload': '{lang}wcf.global.button.upload{/lang}',
'wcf.attachment.insert': '{lang}wcf.attachment.insert{/lang}',
+ 'wcf.attachment.insertAll': '{lang}wcf.attachment.insertAll{/lang}',
'wcf.attachment.delete.sure': '{lang}wcf.attachment.delete.sure{/lang}',
'wcf.attachment.upload.limits': '{'wcf.attachment.upload.limits'|language|encodeJS}'
});
* @see WCF.Upload
*/
WCF.Attachment.Upload = WCF.Upload.extend({
+ /**
+ * reference to 'Insert All' button
+ * @var jQuery
+ */
+ _insertAllButton: null,
+
/**
* object type of the object the uploaded attachments belong to
* @var string
WCF.DOMNodeRemovedHandler.addCallback('WCF.Attachment.Upload', $.proxy(this._removeLimitError, this));
this._makeSortable();
+
+ this._insertAllButton = $('<p class="button">' + WCF.Language.get('wcf.attachment.insertAll') + '</p>').appendTo(this._buttonSelector);
+ this._insertAllButton.click($.proxy(this._insertAll, this));
},
/**
* Inserts an attachment into WYSIWYG editor contents.
*
* @param object event
+ * @param integer attachmentID
*/
- _insert: function(event) {
- var $attachmentID = $(event.currentTarget).data('objectID');
+ _insert: function(event, attachmentID) {
+ var $attachmentID = (event === null) ? attachmentID : $(event.currentTarget).data('objectID');
var $bbcode = '[attach=' + $attachmentID + '][/attach]';
- var $ckEditor = ($.browser.mobile) ? null : $('#' + this._wysiwygContainerID).ckeditorGet();
- if ($ckEditor !== null && $ckEditor.mode === 'wysiwyg') {
- // in design mode
- $ckEditor.insertText($bbcode);
- }
- else {
- // in source mode
- var $textarea = ($.browser.mobile) ? $('#' + this._wysiwygContainerID) : $('#' + this._wysiwygContainerID).next('.cke_editor_text').find('textarea');
- var $value = $textarea.val();
- if ($value.length == 0) {
- $textarea.val($bbcode);
- }
- else {
- var $position = $textarea.getCaret();
- $textarea.val( $value.substr(0, $position) + $bbcode + $value.substr($position) );
- }
+ if ($.browser.redactor) {
+ $('#' + this._wysiwygContainerID).redactor('insertDynamic', $bbcode);
}
},
+ /**
+ * Inserts all attachments at once.
+ */
+ _insertAll: function() {
+ this._fileListSelector.children('li:not(.uploadFailed)').each($.proxy(function(index, attachment) {
+ this._insert(null, $(attachment).data('objectID'));
+ }, this));
+ },
+
/**
* @see WCF.Upload._error()
*/
Maximale Dateigröße: {@$attachmentHandler->getMaxSize()|filesize}<br />
Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getFormattedAllowedExtensions()}]]></item>
<item name="wcf.attachment.insert"><![CDATA[In Text einfügen]]></item>
+ <item name="wcf.attachment.insertAll"><![CDATA[Alle einfügen]]></item>
<item name="wcf.attachment.delete.sure"><![CDATA[Wollen Sie den Dateianhang wirklich löschen?]]></item>
<item name="wcf.attachment.filename"><![CDATA[Dateiname]]></item>
<item name="wcf.attachment.uploadTime"><![CDATA[Hochgeladen]]></item>
Maximum file size: {@$attachmentHandler->getMaxSize()|filesize}<br />
Allowed extensions: {', '|implode:$attachmentHandler->getFormattedAllowedExtensions()}]]></item>
<item name="wcf.attachment.insert"><![CDATA[Insert into message]]></item>
+ <item name="wcf.attachment.insertAll"><![CDATA[Insert All]]></item>
<item name="wcf.attachment.filename"><![CDATA[Filename]]></item>
<item name="wcf.attachment.uploadTime"><![CDATA[Upload Time]]></item>
<item name="wcf.attachment.filesize"><![CDATA[Size]]></item>