Make WordPress Core


Ignore:
Timestamp:
10/07/2006 06:31:39 PM (18 years ago)
Author:
ryan
Message:

Inline uploader styling from mdawaffe. fixes #3212

File:
1 edited

Legend:

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

    r4349 r4355  
    3838                return;
    3939            var thumbEl = $('attachment-thumb-url-' + id);
    40             if ( thumbEl )
     40            this.currentImage.isImage = true;
     41            if ( thumbEl ) {
    4142                this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value );
    42             else
     43                this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value );
     44            } else {
    4345                this.currentImage.thumb = false;
     46                var isImageEl = $('attachment-is-image-' + id);
     47                if ( !isImageEl )
     48                    this.currentImage.isImage = false;
     49            }
    4450            this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value );
     51            this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value );
    4552            this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value );
    4653            this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value );
     
    6673                params.ID = '';
    6774                params.action = '';
    68                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='Browse your files' class='back'>&laquo; Back</a>";
     75                h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='Browse your files' class='back'>&laquo; Back</a>";
    6976            } else {
    7077                h += "<a href='#' onclick='theFileList.cancelView()'  title='Browse your files' class='back'>&laquo; Back</a>";
    7178            }
    7279            h += "<div id='file-title'>"
    73             if ( !this.currentImage.thumb )
    74                 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
     80            if ( !this.currentImage.isImage )
     81                h += "<h2><a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
    7582            else
    7683                h += "<h2>" + this.currentImage.title + "</h2>";
     
    8087            h += '</div>'
    8188            h += "<div id='upload-file-view' class='alignleft'>";
    82             if ( this.currentImage.thumb )
    83                 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
    84             else
     89            if ( this.currentImage.isImage ) {
     90                h += "<a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>";
     91                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
     92                h += "</a>";
     93            } else
    8594                h += '&nbsp;';
    8695            h += "</div>";
     
    120129            if ( this.postID )
    121130                action += '&amp;post_id=' + this.postID;
     131
    122132            h += "<form id='upload-file' method='post' action='" + action + "'>";
    123133            if ( this.ID ) {
     
    130140            }
    131141            h += "<div id='file-title'>"
    132             if ( !this.currentImage.thumb )
    133                 h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
     142            if ( !this.currentImage.isImage )
     143                h += "<h2><a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
    134144            else
    135145                h += "<h2>" + this.currentImage.title + "</h2>";
     
    139149            h += '</div>'
    140150            h += "<div id='upload-file-view' class='alignleft'>";
    141             if ( this.currentImage.thumb )
    142                 h += "<a href='" + this.currentImage.src + "' title='Direct link to file'><img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' /></a>";
    143             else
     151            if ( this.currentImage.isImage ) {
     152                h += "<a href='" + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>";
     153                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
     154                h += "</a>";
     155            } else
    144156                h += '&nbsp;';
    145157            h += "</div>";
    146158
    147159
    148             h += "<table><tr>"
    149             h += "<th scope='row'><label for='post_title'>Title:</label></th>";
     160            h += "<table><col /><col class='widefat' /><tr>"
     161            h += "<th scope='row'><label for='url'>URL</label></th>";
     162            h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.src + "' readonly='readonly' /></td>";
     163            h += "</tr><tr>";
     164            h += "<th scope='row'><label for='post_title'>Title</label></th>";
    150165            h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
    151166            h += "</tr><tr>";
    152             h += "<th scope='row'><label for='post_content'>Description:</label></th>";
     167            h += "<th scope='row'><label for='post_content'>Description</label></th>";
    153168            h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
    154             h += "</tr><tr id='buttons'><th><input type='button' name='delete' class='delete button' value='Delete' onclick='theFileList.deleteFile(" + id + ");' /></th><td>";
     169            h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='Delete File' onclick='theFileList.deleteFile(" + id + ");' />";
    155170            h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
    156171            h += "<input type='hidden' name='action' id='action-value' value='save' />";
    157172            h += "<input type='hidden' name='ID' value='" + id + "' />";
    158173            h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
    159             h += "<div class='submit'><input type='submit' value='Save &raquo;' />";
    160             h += "</div></td></tr></table></form>";
     174            h += "<div class='submit'><input type='submit' value='Save &raquo;' /></div>";
     175            h += "</td></tr></table></form>";
    161176
    162177            new Insertion.Top('upload-content', h);
     
    203218            if ( displayEl )
    204219                display = displayEl.value;
     220            else if ( this.currentImage.isImage )
     221                display = 'full';
    205222
    206223            if ( 'none' != link )
    207                 h += "<a href='" + ( 'file' == link ? this.currentImage.src : this.currentImage.page ) + "' title='" + this.currentImage.title + "'>";
     224                h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment" ) ) + "' title='" + this.currentImage.title + "'>";
    208225            if ( display )
    209                 h += "<img src='" + ( 'thumb' == display ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' />";
     226                h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
    210227            else
    211228                h += this.currentImage.title;
     
    221238            else
    222239                win.edInsertContent(win.edCanvas, h);
    223             this.cancelView();
     240            if ( !this.ID )
     241                this.cancelView();
    224242            return false;
    225243        },
Note: See TracChangeset for help on using the changeset viewer.