<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[22755] trunk: 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).</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/22755">22755</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-11-21 13:05:44 +0000 (Wed, 21 Nov 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://core.trac.wordpress.org/ticket/22083">#22083</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminasyncuploadphp">trunk/wp-admin/async-upload.php</a></li>
<li><a href="#trunkwpadmincsswpadminrtlcss">trunk/wp-admin/css/wp-admin-rtl.css</a></li>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminmedianewphp">trunk/wp-admin/media-new.php</a></li>
<li><a href="#trunkwpincludesjspluploadhandlersjs">trunk/wp-includes/js/plupload/handlers.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminasyncuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/async-upload.php (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/async-upload.php        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-admin/async-upload.php        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -37,12 +37,22 @@
</span><span class="cx">         if ( ! current_user_can( $post_type_object->cap->edit_post, $id ) )
</span><span class="cx">                 wp_die( __( 'You are not allowed to edit this item.' ) );
</span><span class="cx">
</span><del>-        if ( 2 == $_REQUEST['fetch'] ) {
-                add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
-                echo get_media_item($id, array( 'send' => false, 'delete' => true ));
-        } else {
-                add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
-                echo get_media_item($id);
</del><ins>+        switch ( $_REQUEST['fetch'] ) {
+                case 3 :
+                        if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
+                                echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
+                        echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
+                        $title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e
+                        echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60 ) ) . '</span></div>';
+                        break;
+                case 2 :
+                        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
+                        echo get_media_item($id, array( 'send' => false, 'delete' => true ));
+                        break;
+                default:
+                        add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
+                        echo get_media_item($id);
+                        break;
</ins><span class="cx">         }
</span><span class="cx">         exit;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadmincsswpadminrtlcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin-rtl.css (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin-rtl.css        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-admin/css/wp-admin-rtl.css        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -1049,6 +1049,7 @@
</span><span class="cx">         padding: 0 5px 0 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.media-item .edit-attachment,
</ins><span class="cx"> .media-item .error-div a.dismiss,
</span><span class="cx"> .describe-toggle-on,
</span><span class="cx"> .describe-toggle-off {
</span></span></pre></div>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-admin/css/wp-admin.css        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -3817,6 +3817,7 @@
</span><span class="cx">         padding: 0 0 0 5px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.media-item .edit-attachment,
</ins><span class="cx"> .describe-toggle-on,
</span><span class="cx"> .describe-toggle-off {
</span><span class="cx">         display: block;
</span><span class="lines">@@ -3848,6 +3849,10 @@
</span><span class="cx">         width: 623px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.media-new-php #media-items {
+        margin: 1em 0;
+}
+
</ins><span class="cx"> #media-items:empty {
</span><span class="cx">         border: 0 none;
</span><span class="cx"> }
</span><span class="lines">@@ -5533,10 +5538,10 @@
</span><span class="cx">         margin: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.wp-full-overlay-sidebar .wp-full-overlay-header {
-        border-top: 0;
-        border-bottom: 1px solid #fff;
-        box-shadow: inset 0 -1px 0 0px #dfdfdf;
</del><ins>+.wp-full-overlay-sidebar .wp-full-overlay-header {
+        border-top: 0;
+        border-bottom: 1px solid #fff;
+        box-shadow: inset 0 -1px 0 0px #dfdfdf;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .wp-full-overlay-sidebar .wp-full-overlay-footer {
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-admin/includes/media.php        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -1055,11 +1055,18 @@
</span><span class="cx"> function get_media_item( $attachment_id, $args = null ) {
</span><span class="cx">         global $redir_tab;
</span><span class="cx">
</span><ins>+        echo "<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>";
+
</ins><span class="cx">         if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
</span><span class="cx">                 $thumb_url = $thumb_url[0];
</span><span class="cx">         else
</span><span class="cx">                 $thumb_url = false;
</span><span class="cx">
</span><ins>+        $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
+        $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60 ) . "</span></div>" : '';
+
+        echo "<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' /></a></p>";
+
</ins><span class="cx">         $post = get_post( $attachment_id );
</span><span class="cx">         $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminmedianewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/media-new.php (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media-new.php        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-admin/media-new.php        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 updateMediaForm();
</span><span class="cx">                 post_id = 0;
</span><del>-                shortform = 1;
</del><ins>+                shortform = 3;
</ins><span class="cx">         });
</span><span class="cx">         </script>
</span><span class="cx">         <input type="hidden" name="post_id" id="post_id" value="0" />
</span></span></pre></div>
<a id="trunkwpincludesjspluploadhandlersjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/plupload/handlers.js (22754 => 22755)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/plupload/handlers.js        2012-11-21 12:58:33 UTC (rev 22754)
+++ trunk/wp-includes/js/plupload/handlers.js        2012-11-21 13:05:44 UTC (rev 22755)
</span><span class="lines">@@ -112,6 +112,8 @@
</span><span class="cx">
</span><span class="cx"> function prepareMediaItem(fileObj, serverData) {
</span><span class="cx">         var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
</span><ins>+        if ( f == 2 && shortform > 2 )
+                f = shortform;
</ins><span class="cx">
</span><span class="cx">         try {
</span><span class="cx">                 if ( typeof topWin.tb_remove != 'undefined' )
</span><span class="lines">@@ -429,7 +431,7 @@
</span><span class="cx">                                 $('#drag-drop-area').unbind('.wp-uploader');
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        if ( up.runtime == 'html4' )
</del><ins>+                        if ( up.runtime == 'html4' )
</ins><span class="cx">                                 $('.upload-flash-bypass').hide();
</span><span class="cx">                 });
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>