WordPress.org

Make WordPress Core

Changeset 4312


Ignore:
Timestamp:
10/04/2006 06:37:42 AM (12 years ago)
Author:
ryan
Message:

Uploader improvements from mdawaffe. fixes #3191

Location:
trunk/wp-admin
Files:
5 edited

Legend:

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

    r4276 r4312  
    4848    global $style, $post_id;
    4949    $id = get_the_ID();
     50    $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
    5051?>
    5152    <div id="upload-file">
    5253        <div id="file-title">
    53             <h2><a href="<?php the_guid(); ?>" title="Direct link to this file"><?php the_title(); ?></a></h2>
     54            <h2><?php if ( !isset($attachment_data['width']) )
     55                    echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
     56                the_title();
     57                if ( !isset($attachment_data['width']) )
     58                    echo '</a>';
     59            ?></h2>
    5460            <span><?php
    5561                echo '[&nbsp;';
    56                 echo '<a href="' . get_permalink() . '" title="' . ('Permalink to the blog page for this file') . '">' . __('page link') . '</a>';
     62                echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
    5763                echo '&nbsp;|&nbsp;';
    5864                    echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'edit' ), 1 ) . '" title="' . __('Edit this file') . '">' . __('edit') . '</a>';
     
    6268        </div>
    6369
    64         <div id="upload-file-view" class="left">
    65 <?php   echo wp_upload_display( array(171, 128)  ); ?>
     70        <div id="upload-file-view" class="alignleft">
     71<?php       if ( isset($attachment_data['width']) )
     72            echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
     73        echo wp_upload_display( array(171, 128) );
     74        if ( isset($attachment_data['width']) )
     75            echo '</a>'; ?>
    6676        </div>
    6777        <?php the_attachment_links( $id ); ?>
     
    7989    if ( $id ) :
    8090        $attachment = get_post_to_edit( $id );
     91        $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
    8192?>
    8293        <div id="file-title">
    83             <h2><a href="<?php the_guid(); ?>" title="Direct link to this file"><?php the_title(); ?></a></h2>
     94            <h2><?php if ( !isset($attachment_data['width']) )
     95                    echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
     96                the_title();
     97                if ( !isset($attachment_data['width']) )
     98                    echo '</a>';
     99            ?></h2>
    84100            <span><?php
    85101                echo '[&nbsp;';
    86                 echo '<a href="' . get_permalink() . '" title="' . ('Permalink to the blog page for this file') . '">' . __('page link') . '</a>';
     102                echo '<a href="' . get_permalink() . '">' . __('view') . '</a>';
    87103                echo '&nbsp;|&nbsp;';
    88                     echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '" title="' . __('View options for this file') . '">' . __('options') . '</a>';
     104                    echo '<a href="' . wp_specialchars( add_query_arg( 'action', 'view' ), 1 ) . '">' . __('options') . '</a>';
    89105                echo '&nbsp;|&nbsp;';
    90106                echo '<a href="' . wp_specialchars( remove_query_arg( array('action','ID') ), 1 ) . '" title="' . __('Browse your files') . '">' . __('cancel') . '</a>';
     
    92108        </div>
    93109
    94     <div id="upload-file-view" class="left">
    95 <?php       echo wp_upload_display( array(171, 128) ); ?>
     110    <div id="upload-file-view" class="alignleft">
     111<?php       if ( isset($attachment_data['width']) )
     112            echo "<a href='" . get_the_guid() . "' title='" . __('Direct link to file') . "'>";
     113        echo wp_upload_display( array(171, 128) );
     114        if ( isset($attachment_data['width']) )
     115            echo '</a>'; ?>
    96116    </div>
    97117<?php   endif; ?>
     
    122142<?php   endif; ?>
    123143                    <?php wp_nonce_field( 'inlineuploading' ); ?>
    124                     <div id="submit">
     144                    <div class="submit">
    125145                        <input type="submit" value="<?php $id ? _e('Save') : _e('Upload'); ?>" />
    126146<?php   if ( $id ) : ?>
     
    294314            echo "\t<li id='file-";
    295315            the_ID();
    296             echo "' class='left'>\n";
     316            echo "' class='alignleft'>\n";
    297317            echo wp_upload_display( array(128,128), $href );
    298318            echo "\t</li>\n";
  • trunk/wp-admin/upload-js.php

    r4276 r4312  
    6363            h += "<div id='upload-file'>"
    6464            h += "<div id='file-title'>"
    65             h += "<h2><a href='" + this.currentImage.src + "' title='Direct Link to this file'>" + this.currentImage.title + "</a></h2>";
    66             h += "<span>[&nbsp";
    67             h += "<a href='" + this.currentImage.page + "' title='Permalink to the blog page for this file'>page link</a>"
    68             h += '&nbsp;|&nbsp;';
    69             h += "<a href='#' onclick='theFileList.editView(" + id + ")'  title='Edit this file'>edit</a>"
     65            if ( !this.currentImage.thumb )
     66                h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
     67            else
     68                h += "<h2>" + this.currentImage.title + "</h2>";
     69            h += "<span>[&nbsp;";
     70            h += "<a href='#' onclick='theFileList.editView(" + id + ")'>edit</a>"
    7071            h += '&nbsp;|&nbsp;';
    7172            if ( this.ID ) {
     
    7980            h += "&nbsp;]</span>";
    8081            h += '</div>'
    81             h += "<div id='upload-file-view' class='left'>";
     82            h += "<div id='upload-file-view' class='alignleft'>";
    8283            if ( this.currentImage.thumb )
    83                 h += "<img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
     84                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>";
    8485            else
    8586                h += '&nbsp;';
    8687            h += "</div>";
    8788
    88             h += "<form name='uploadoptions' id='uploadoptions' class='left'>";
     89            h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
     90            h += "<table>";
    8991            if ( this.currentImage.thumb ) {
    90                 h += "<input type='radio' name='display' value='thumb' checked='checked'>Display thumbnail</input><br />";
    91                 h += "<input type='radio' name='display' value='full'>Display full-sized image</input><br /><br />";
    92             }
    93 
    94             if ( this.currentImage.thumb ) {
    95                 h += "<input type='radio' name='link' value='none' checked='checked'>Do not link to this file</input><br />";
    96                 h += "<input type='radio' name='link' value='file'>Link directly to this file</input><br />";
    97                 h += "<input type='radio' name='link' value='page'>Link to this file's blog page</input><br />";
    98             } else {
    99                 h += "<input type='radio' name='link' value='file'>Link directly to this file</input><br />";
    100                 h += "<input type='radio' name='link' value='page' checked='checked'>Link to this file's blog page</input><br />";
    101             }
    102 
    103             h += "<input type='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='Send to editor' />";
     92                h += "<tr><th style='padding-bottom:.5em'>Show</th><td style='padding-bottom:.5em'>";
     93                h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> thumbnail</label><br />";
     94                h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> full size</label>";
     95                h += "</td></tr>";
     96            }
     97
     98            h += "<tr><th>Link</th><td>";
     99            h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> file</label><br />";
     100            h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> page</label><br />";
     101            h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> none</label>";
     102            h += "</td></tr>";
     103
     104            h += "<tr><td colspan='2'>";
     105            h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='Send to editor &raquo;' />";
     106            h += "</td></tr></table>";
    104107            h += "</form>";
    105108
     
    117120            h += "<form id='upload-file' method='post' action='upload.php?style=inline&amp;tab=upload&amp;post_id=" + this.postID + "'>";
    118121            h += "<div id='file-title'>"
    119             h += "<h2><a href='" + this.currentImage.src + "' title='Direct Link to this file'>" + this.currentImage.title + "</a></h2>";
    120             h += "<span>[&nbsp";
    121             h += "<a href='" + this.currentImage.page + "' title='Permalink to the blog page for this file'>page link</a>"
    122             h += '&nbsp;|&nbsp;';
    123             h += "<a href='#' onclick='theFileList.imageView(" + id + ")'  title='View options for this file'>options</a>"
     122            if ( !this.currentImage.thumb )
     123                h += "<h2><a href='" + this.currentImage.src + "' title='Direct link to file'>" + this.currentImage.title + "</a></h2>";
     124            else
     125                h += "<h2>" + this.currentImage.title + "</h2>";
     126            h += "<span>[&nbsp;";
     127            h += "<a href='#' onclick='theFileList.imageView(" + id + ")'>options</a>"
    124128            h += '&nbsp;|&nbsp;';
    125129            if ( this.ID ) {
     
    133137            h += "&nbsp;]</span>";
    134138            h += '</div>'
    135             h += "<div id='upload-file-view' class='left'>";
     139            h += "<div id='upload-file-view' class='alignleft'>";
    136140            if ( this.currentImage.thumb )
    137                 h += "<img src='" + this.currentImage.thumb + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
     141                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>";
    138142            else
    139143                h += '&nbsp;';
     
    152156            h += "<input type='hidden' name='ID' value='" + id + "' />";
    153157            h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
    154             h += "<div id='submit'><input type='submit' value='Save' />";
     158            h += "<div class='submit'><input type='submit' value='Save' />";
    155159            h += "<input type='button' name='delete' class='delete' value='Delete' onclick='theFileList.deleteFile(" + id + ");' />";
    156160            h += "</div></td></tr></table></form>";
  • trunk/wp-admin/upload-rtl.css

    r4276 r4312  
    88}
    99
    10 #file-title { margin: 0 15px 0 0; }
     10#upload-file-view { 0 15px 0 0 }
     11
     12#file-title { margin: 0 15px .2em 0; }
    1113
    1214h2 { margin: 0 0 0 .2em; }
     
    1416#upload-files li { margin: 0 15px 15px 0; }
    1517
    16 th { text-align: right; }
     18table { float: right; }
    1719
    18 .left, table { float: right; }
    19 
    20 .right, #the-attachment-links { float: left; }
    21 
    22 #submit input, #submit input:focus {
    23     border-left: 0;
    24     border-right-color: #ccc;
    25 }
    26 
    27 #submit input:active {
    28     border-left: 0;
    29     border-right-color: #999;
    30 }
     20#the-attachment-links { float: left; }
  • trunk/wp-admin/upload.css

    r4276 r4312  
    6060}
    6161
    62 #upload-file-view { padding: 0 15px; }
     62form#upload-file input, form#upload-file textarea, div#upload-content.upload table { width: 100%; }
     63
     64form#upload-file div.submit input { width: auto; }
     65
     66#upload-file-view { padding: 0 0 0 15px; }
    6367
    6468#file-title {
    65     margin: 0 0 0 15px;
     69    margin: 0 0 .2em 15px;
    6670    padding: 0;
    6771    display: block;
     
    7377    display: inline;
    7478    border: none;
     79    color: #000;
    7580    font-weight: bold;
    7681    font-size: 1.4em;
     
    106111}
    107112
    108 #upload-files a.file-link img {
    109     vertical-align: middle;
    110 }
     113#upload-files a.file-link img { vertical-align: middle; }
    111114
    112115#the-attachment-links { float: right; }
     
    117120}
    118121
    119 form table { float: none; }
     122form table { float: none; padding: 0 15px; }
    120123
    121124table {
    122125    float: left;
    123126    margin: 0;
    124     padding: 0 15px;
     127    padding: 0;
    125128}
    126129
    127 .left { float: left; }
    128 
    129 .right { float: right; }
    130 
    131 .center { text-align: center; }
    132 
    133 th { text-align: left; }
     130th { vertical-align: text-top; }
    134131
    135132tr, td, th {
     
    137134    padding-top: 0;
    138135}
    139 
    140 #submit {
    141     margin: 1px;
    142     width: 99%;
    143 }
    144 
    145 #submit input, #submit input:focus {
    146     background: url( images/fade-butt.png );
    147     border: 3px double #999;
    148     border-left-color: #ccc;
    149     border-top-color: #ccc;
    150     color: #333;
    151     padding: 0.25em;
    152 }
    153 
    154 #submit input:active {
    155     background: #f4f4f4;
    156     border: 3px double #ccc;
    157     border-left-color: #999;
    158     border-top-color: #999;
    159 }
    160 
    161 #submit input.delete:hover {
    162     background: #ce0000;
    163     color: #fff;
    164 }
  • trunk/wp-admin/upload.php

    r4276 r4312  
    8585    }
    8686
    87     echo "\t<li class='$class left'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n";
     87    echo "\t<li class='$class alignleft'><div><a href='$_href' title='{$tab_array[0]}'>{$tab_array[0]}</a>$page_links</div></li>\n";
    8888}
    8989unset($t, $tab_array, $href, $_href, $page_links, $total, $per, $class);
    9090echo "</ul>\n\n";
    9191
    92 echo "<div id='upload-content'>\n";
     92echo "<div id='upload-content' class='$tab'>\n";
    9393
    9494call_user_func( $wp_upload_tabs[$tab][2] );
Note: See TracChangeset for help on using the changeset viewer.