WordPress.org

Make WordPress Core

Changeset 22755


Ignore:
Timestamp:
11/21/2012 01:05:44 PM (9 years ago)
Author:
nacin
Message:

Have media-new.php return simple rows of basic attachment data, with an 'Edit' link next to each taking them to post.php (in a new window). Not ideal, but this is largely a fallback screen at this point.

This is bolted on to existing code, the vast majority of which is destined to be ripped out in 3.6 once things settle.

see #22083.

Location:
trunk
Files:
6 edited

Legend:

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

    r19712 r22755  
    3838        wp_die( __( 'You are not allowed to edit this item.' ) );
    3939
    40     if ( 2 == $_REQUEST['fetch'] ) {
    41         add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
    42         echo get_media_item($id, array( 'send' => false, 'delete' => true ));
    43     } else {
    44         add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
    45         echo get_media_item($id);
     40    switch ( $_REQUEST['fetch'] ) {
     41        case 3 :
     42            if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
     43                echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
     44            echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
     45            $title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e
     46            echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60 ) ) . '</span></div>';
     47            break;
     48        case 2 :
     49            add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
     50            echo get_media_item($id, array( 'send' => false, 'delete' => true ));
     51            break;
     52        default:
     53            add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
     54            echo get_media_item($id);
     55            break;
    4656    }
    4757    exit;
  • trunk/wp-admin/css/wp-admin-rtl.css

    r22723 r22755  
    10501050}
    10511051
     1052.media-item .edit-attachment,
    10521053.media-item .error-div a.dismiss,
    10531054.describe-toggle-on,
  • trunk/wp-admin/css/wp-admin.css

    r22731 r22755  
    38183818}
    38193819
     3820.media-item .edit-attachment,
    38203821.describe-toggle-on,
    38213822.describe-toggle-off {
     
    38473848#media-items {
    38483849    width: 623px;
     3850}
     3851
     3852.media-new-php #media-items {
     3853    margin: 1em 0;
    38493854}
    38503855
     
    55345539}
    55355540
    5536 .wp-full-overlay-sidebar .wp-full-overlay-header { 
    5537     border-top: 0; 
    5538     border-bottom: 1px solid #fff; 
    5539     box-shadow: inset 0 -1px 0 0px #dfdfdf; 
     5541.wp-full-overlay-sidebar .wp-full-overlay-header {
     5542    border-top: 0;
     5543    border-bottom: 1px solid #fff;
     5544    box-shadow: inset 0 -1px 0 0px #dfdfdf;
    55405545}
    55415546
  • trunk/wp-admin/includes/media.php

    r22749 r22755  
    10561056    global $redir_tab;
    10571057
     1058    echo "<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>";
     1059
    10581060    if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
    10591061        $thumb_url = $thumb_url[0];
    10601062    else
    10611063        $thumb_url = false;
     1064
     1065    $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
     1066    $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
     1067
     1068    echo "<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' /></a></p>";
    10621069
    10631070    $post = get_post( $attachment_id );
  • trunk/wp-admin/media-new.php

    r22752 r22755  
    9191        updateMediaForm();
    9292        post_id = 0;
    93         shortform = 1;
     93        shortform = 3;
    9494    });
    9595    </script>
  • trunk/wp-includes/js/plupload/handlers.js

    r22305 r22755  
    113113function prepareMediaItem(fileObj, serverData) {
    114114    var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
     115    if ( f == 2 && shortform > 2 )
     116        f = shortform;
    115117
    116118    try {
     
    430432            }
    431433
    432             if ( up.runtime == 'html4' ) 
     434            if ( up.runtime == 'html4' )
    433435                $('.upload-flash-bypass').hide();
    434436        });
Note: See TracChangeset for help on using the changeset viewer.