Fixed a few issues related to attachment management
authorAlexander Ebert <ebert@woltlab.com>
Wed, 26 Nov 2014 00:20:33 +0000 (01:20 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 26 Nov 2014 00:20:33 +0000 (01:20 +0100)
com.woltlab.wcf/templates/messageFormAttachments.tpl
wcfsetup/install/files/js/WCF.Attachment.js

index 0eaec9ae78d0f4aa64aa5bb5450215c416ce0f09..5631945be04402ec94a8cf4df588083b1eb45733 100644 (file)
@@ -1,7 +1,7 @@
 <div class="jsOnly formAttachmentContent container containerPadding" id="attachments_{if $wysiwygSelector|isset}{$wysiwygSelector}{else}text{/if}">
        <ul class="formAttachmentList clearfix"{if !$attachmentHandler->getAttachmentList()|count} style="display: none"{/if}>
                {foreach from=$attachmentHandler->getAttachmentList() item=$attachment}
-                       <li class="box48" data-object-id="{@$attachment->attachmentID}">
+                       <li class="box64" data-object-id="{@$attachment->attachmentID}" data-height="{@$attachment->height}" data-width="{@$attachment->width}">
                                {if $attachment->tinyThumbnailType}
                                        <img src="{link controller='Attachment' object=$attachment}tiny=1{/link}" alt="" class="attachmentTinyThumbnail" />
                                {else}
                                                <small>{@$attachment->filesize|filesize}</small>
                                        </div>
                                        
-                                       <ul>
-                                               <li><span class="icon icon16 icon-remove pointer jsTooltip jsDeleteButton " title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$attachment->attachmentID}" data-confirm-message="{lang}wcf.attachment.delete.sure{/lang}"></span></li>
-                                               <li><span class="icon icon16 icon-paste pointer jsTooltip jsButtonInsertAttachment" title="{lang}wcf.attachment.insert{/lang}" data-object-id="{@$attachment->attachmentID}"></span></li>
+                                       <ul class="buttonGroup">
+                                               <li><span class="button small jsDeleteButton" data-object-id="{@$attachment->attachmentID}" data-confirm-message="{lang}wcf.attachment.delete.sure{/lang}">{lang}wcf.global.button.delete{/lang}</span></li>
+                                               {if $attachment->isImage}
+                                                       <li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="{@$attachment->attachmentID}">{lang}wcf.attachment.insertThumbnail{/lang}</span></li>
+                                                       <li><span class="button small jsButtonAttachmentInsertFull" data-object-id="{@$attachment->attachmentID}">{lang}wcf.attachment.insertFull{/lang}</span></li>
+                                               {else}
+                                                       <li><span class="button small jsButtonInsertAttachment" data-object-id="{@$attachment->attachmentID}">{lang}wcf.attachment.insert{/lang}</span></li>
+                                               {/if}
                                        </ul>
                                </div>
                        </li>
index fcc66a13cd1ebcf59def691a6f605bd343d68f60..59040dcfe960c8adef0c9618ef283fb8e8aaf2f9 100644 (file)
@@ -58,7 +58,7 @@ WCF.Attachment.Upload = WCF.Upload.extend({
         */
        init: function(buttonSelector, fileListSelector, objectType, objectID, tmpHash, parentObjectID, maxUploads, wysiwygContainerID) {
                this._super(buttonSelector, fileListSelector, 'wcf\\data\\attachment\\AttachmentAction', { multiple: true, maxUploads: maxUploads });
-               
+               console.debug(wysiwygContainerID);
                this._autoInsert = [ ];
                this._objectType = objectType;
                this._objectID = objectID;
@@ -68,6 +68,8 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                
                this._buttonSelector.children('p.button').click($.proxy(this._validateLimit, this));
                this._fileListSelector.find('.jsButtonInsertAttachment').click($.proxy(this._insert, this));
+               this._fileListSelector.find('.jsButtonAttachmentInsertThumbnail').click($.proxy(this._insert, this));
+               this._fileListSelector.find('.jsButtonAttachmentInsertFull').click($.proxy(this._insert, this));
                
                WCF.DOMNodeRemovedHandler.addCallback('WCF.Attachment.Upload', $.proxy(this._removeLimitError, this));
                
@@ -187,16 +189,14 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                        this._buttonSelector.next('small.innerError').remove();
                }
                
-               var $listItems = this._fileListSelector.children();
+               var $listItems = this._fileListSelector.children('li');
                if (!$listItems.filter(':not(.uploadFailed)').length) {
                        this._insertAllButton.hide();
                }
                
                if (!$listItems.length) {
                        setTimeout((function() {
-                               if (!this._fileListSelector.children('li:not(.uploadFailed)').length) {
-                                       this._fileListSelector.wcfBlindOut();
-                               }
+                               this._fileListSelector.wcfBlindOut();
                        }).bind(this), 250);
                }
        },