Make WordPress Core


Ignore:
Timestamp:
01/02/2007 07:28:30 PM (19 years ago)
Author:
ryan
Message:

Attachment fixes from mdawaffe. fixes #3411

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload-js.php

    r4656 r4670  
    3838                return;
    3939            var thumbEl = $('attachment-thumb-url-' + id);
    40             this.currentImage.isImage = true;
    4140            if ( thumbEl ) {
    4241                this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
     
    4443            } else {
    4544                this.currentImage.thumb = false;
    46                 var isImageEl = $('attachment-is-image-' + id);
    47                 if ( !isImageEl )
    48                     this.currentImage.isImage = false;
    4945            }
    5046            this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
     
    6157                this.currentImage.height = false;
    6258            }
     59            this.currentImage.isImage = ( 0 == id ? '' : $('attachment-is-image-' + id).value );
    6360            this.currentImage.ID = id;
    6461        },
     
    9794            h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
    9895            h += "<table>";
    99             if ( this.currentImage.thumb ) {
     96            var display = [];
     97            var checked = 'display-title';
     98            if ( 1 == this.currentImage.isImage ) {
     99                checked = 'display-full';
     100                if ( this.currentImage.thumb ) {
     101                    display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />");
     102                    checked = 'display-thumb';
     103                }
     104                display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>");
     105            } else if ( this.currentImage.thumb ) {
     106                display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>");
     107            }
     108            if ( display.length ) {
     109                display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>");
    100110                h += "<tr><th style='padding-bottom:.5em'><?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>";
    101                 h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />";
    102                 h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>";
     111                $A(display).each( function(i) { h += i; } );
    103112                h += "</td></tr>";
    104113            }
     
    118127
    119128            new Insertion.Top('upload-content', h);
     129            var displayEl = $(checked);
     130            if ( displayEl )
     131                displayEl.checked = true;
     132
    120133            if (e) Event.stop(e);
    121134            return false;
     
    145158                h += "<h2>" + this.currentImage.title + "</h2>";
    146159            h += " &#8212; <span>";
    147             h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php attribute_escape(__('Insert')); ?></a>"
     160            h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php echo attribute_escape(__('Insert')); ?></a>"
    148161            h += "</span>";
    149162            h += '</div>'
     
    223236            if ( 'none' != link )
    224237                h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";
    225             if ( display )
     238            if ( display && 'title' != display )
    226239                h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
    227240            else
Note: See TracChangeset for help on using the changeset viewer.