<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#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>
<title>[12007] trunk: First pass on canonical post thumbanils.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12007">12007</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2009-10-07 22:18:09 +0000 (Wed, 07 Oct 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>First pass on canonical post thumbanils. Admin-side GUI only. Theme functions to follow. see <a href="http://trac.wordpress.org/ticket/10928">#10928</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmincssmediacss">trunk/wp-admin/css/media.css</a></li>
<li><a href="#trunkwpadmincssmediadevcss">trunk/wp-admin/css/media.dev.css</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminmediauploadphp">trunk/wp-admin/media-upload.php</a></li>
<li><a href="#trunkwpadminpostnewphp">trunk/wp-admin/post-new.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminjssetpostthumbnailhandlerdevjs">trunk/wp-admin/js/set-post-thumbnail-handler.dev.js</a></li>
<li><a href="#trunkwpadminjssetpostthumbnailhandlerjs">trunk/wp-admin/js/set-post-thumbnail-handler.js</a></li>
<li><a href="#trunkwpadminjssetpostthumbnaildevjs">trunk/wp-admin/js/set-post-thumbnail.dev.js</a></li>
<li><a href="#trunkwpadminjssetpostthumbnailjs">trunk/wp-admin/js/set-post-thumbnail.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/admin-ajax.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -1370,6 +1370,19 @@
</span><span class="cx">         wp_image_editor($attachment_id, $msg);
</span><span class="cx">         die();
</span><span class="cx">         break;
</span><ins>+case 'set-post-thumbnail':
+        $post_id = intval( $_POST['post_id'] );
+        if ( !current_user_can( 'edit_post', $post_id ) )
+                die( '-1' );
+        $thumbnail_id = intval( $_POST['thumbnail_id'] );
+        if ( $thumbnail_id &amp;&amp; get_post( $thumbnail_id ) ) {
+                $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
+                if ( !empty( $thumbnail_html ) ) {
+                        update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );
+                        die( _wp_post_thumbnail_html( $thumbnail_id ) );
+                }
+        }
+        die( '0' );
</ins><span class="cx"> default :
</span><span class="cx">         do_action( 'wp_ajax_' . $_POST['action'] );
</span><span class="cx">         die('0');
</span></span></pre></div>
<a id="trunkwpadmincssmediacss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/media.css (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media.css        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/css/media.css        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -1 +1 @@
</span><del>-div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:&quot;Lucida Grande&quot;,&quot;Bitstream Vera Sans&quot;,Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.A1{width:132px;}.describe input[type=&quot;text&quot;],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:&quot;Lucida Grande&quot;,&quot;Bitstream Vera Sans&quot;,Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:25%;text-align:center;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;border-bottom-style:solid;border-bottom-width:1px;font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-size:1.6em;border-bottom-color:#DADADA;color:#5A5A5A;}h3.media-title{color:#5A5A5A;font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-size:1.6em;font-weight:normal;}#gallery-settings .describe td{vertical-align:middle;height:3.5em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;border:1px solid #dfdfdf;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}
</del><span class="cx">\ No newline at end of file
</span><ins>+div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:&quot;Lucida Grande&quot;,&quot;Bitstream Vera Sans&quot;,Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.A1{width:132px;}.describe input[type=&quot;text&quot;],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:&quot;Lucida Grande&quot;,&quot;Bitstream Vera Sans&quot;,Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{display:block;line-height:36px;float:right;margin-right:20px;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;border-bottom-style:solid;border-bottom-width:1px;font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-size:1.6em;border-bottom-color:#DADADA;color:#5A5A5A;}h3.media-title{color:#5A5A5A;font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-size:1.6em;font-weight:normal;}#gallery-settings .describe td{vertical-align:middle;height:3.5em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;border:1px solid #dfdfdf;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadmincssmediadevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/media.dev.css (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media.dev.css        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/css/media.dev.css        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -263,10 +263,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #media-upload th.order-head {
</span><ins>+        width: 20%;
+        text-align: center;
+}
+
+#media-upload th.actions-head {
</ins><span class="cx">         width: 25%;
</span><span class="cx">         text-align: center;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#media-upload a.wp-post-thumbnail{
+        display: block;
+        line-height: 36px;
+        float: right;
+        margin-right: 20px;
+}
+
</ins><span class="cx"> #media-upload .widefat {
</span><span class="cx">         width: 626px;
</span><span class="cx">         border-style: solid solid none;
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/edit-form-advanced.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
</span><ins>+add_meta_box('postthumbnaildiv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
</ins><span class="cx"> // add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');
</span><span class="cx"> add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
</span><span class="cx"> add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/includes/media.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -114,6 +114,21 @@
</span><span class="cx">         return $html;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
+        if ( $thumbnail_id &amp;&amp; get_post( $thumbnail_id ) ) {
+                $thumbnail_html = wp_get_attachment_image($thumbnail_id, 'thumbnail');
+                if ( !empty( $thumbnail_html ) )
+                        return '&lt;a href=&quot;#&quot; id=&quot;cws-post-thumbnail&quot; onclick=&quot;jQuery(\'#add_image\').click();return false;&quot;&gt;' . $thumbnail_html . '&lt;/a&gt;';
+        }
+        return '&lt;a href=&quot;#&quot; id=&quot;cws-post-thumbnail&quot; onclick=&quot;jQuery(\'#add_image\').click();return false;&quot;&gt;' . esc_html__( 'Set thumbnail' ) . '&lt;/a&gt;';
+}
+
+function post_thumbnail_meta_box() {
+        global $post;
+        $thumbnail_id = get_post_meta( $post-&gt;ID, '_thumbnail_id', true );
+        echo _wp_post_thumbnail_html( $thumbnail_id );
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * {@internal Missing Short Description}}
</span><span class="cx">  *
</span><span class="lines">@@ -1135,7 +1150,8 @@
</span><span class="cx">                 $class = empty($errors) ? 'startclosed' : 'startopen';
</span><span class="cx">                 $toggle_links = &quot;
</span><span class="cx">         &lt;a class='toggle describe-toggle-on' href='#'&gt;$toggle_on&lt;/a&gt;
</span><del>-        &lt;a class='toggle describe-toggle-off' href='#'&gt;$toggle_off&lt;/a&gt;&quot;;
</del><ins>+        &lt;a class='toggle describe-toggle-off' href='#'&gt;$toggle_off&lt;/a&gt;
+        &lt;a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\&quot;&quot; . intval( $attachment_id ) . &quot;\&quot;);return false;'&gt;&quot; . esc_html__( &quot;Use for thumbnail&quot; ) . &quot;&lt;/a&gt;&quot;;
</ins><span class="cx">         } else {
</span><span class="cx">                 $class = 'form-table';
</span><span class="cx">                 $toggle_links = '';
</span><span class="lines">@@ -1629,6 +1645,7 @@
</span><span class="cx"> &lt;thead&gt;&lt;tr&gt;
</span><span class="cx"> &lt;th&gt;&lt;?php _e('Media'); ?&gt;&lt;/th&gt;
</span><span class="cx"> &lt;th class=&quot;order-head&quot;&gt;&lt;?php _e('Order'); ?&gt;&lt;/th&gt;
</span><ins>+&lt;th class=&quot;actions-head&quot;&gt;&lt;?php _e('Actions'); ?&gt;&lt;/th&gt;
</ins><span class="cx"> &lt;/tr&gt;&lt;/thead&gt;
</span><span class="cx"> &lt;/table&gt;
</span><span class="cx"> &lt;div id=&quot;media-items&quot;&gt;
</span></span></pre></div>
<a id="trunkwpadminjssetpostthumbnailhandlerdevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/js/set-post-thumbnail-handler.dev.js (0 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/set-post-thumbnail-handler.dev.js                                (rev 0)
+++ trunk/wp-admin/js/set-post-thumbnail-handler.dev.js        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+function WPSetThumbnailHTML(html){
+        jQuery('#postthumbnaildiv .inside').html(html);
+}
+function WPSetThumbnailID(id){
+        if ( jQuery('input[value=_thumbnail_id]').size() &gt; 0 ) {
+                jQuery('#meta\\[' + jQuery('input[value=_thumbnail_id]').attr('id').match(/[0-9]+/) + '\\]\\[value\\]' ).text(id);
+        }
+}
+function WPCloseTB(){
+        tb_remove();
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjssetpostthumbnailhandlerjs"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/js/set-post-thumbnail-handler.js (0 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/set-post-thumbnail-handler.js                                (rev 0)
+++ trunk/wp-admin/js/set-post-thumbnail-handler.js        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+function WPSetThumbnailHTML(html){jQuery(&quot;#postthumbnaildiv .inside&quot;).html(html)}function WPSetThumbnailID(id){if(jQuery(&quot;input[value=_thumbnail_id]&quot;).size()&gt;0){jQuery(&quot;#meta\\[&quot;+jQuery(&quot;input[value=_thumbnail_id]&quot;).attr(&quot;id&quot;).match(/[0-9]+/)+&quot;\\]\\[value\\]&quot;).text(id)}}function WPCloseTB(){tb_remove()};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjssetpostthumbnaildevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/js/set-post-thumbnail.dev.js (0 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/set-post-thumbnail.dev.js                                (rev 0)
+++ trunk/wp-admin/js/set-post-thumbnail.dev.js        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+function WPSetAsThumbnail(id){
+        jQuery('#media-item-' + id + ' &gt; a.wp-post-thumbnail').text( setPostThumbnailL10n.saving ).attr('href', '#');
+        jQuery.post(ajaxurl, {
+                action:&quot;set-post-thumbnail&quot;, post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
+        }, function(str){
+                var win = window.dialogArguments || opener || parent || top;
+                if ( str == '0' ) {
+                        alert( setPostThumbnailL10n.error );
+                        win.cwsCloseTB();
+                } else {
+                        jQuery('a.wp-post-thumbnail').text( setPostThumbnailL10n.setThumbnail );
+                        jQuery('#media-item-' + id + ' &gt; a.wp-post-thumbnail').hide();
+                        win.WPSetThumbnailID(id);
+                        win.WPSetThumbnailHTML(str);
+                        win.WPCloseTB();
+                }
+        }
+        );
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjssetpostthumbnailjs"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/js/set-post-thumbnail.js (0 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/set-post-thumbnail.js                                (rev 0)
+++ trunk/wp-admin/js/set-post-thumbnail.js        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+function WPSetAsThumbnail(id){jQuery(&quot;#media-item-&quot;+id+&quot; &gt; a.wp-post-thumbnail&quot;).text(setPostThumbnailL10n.saving).attr(&quot;href&quot;,&quot;#&quot;);jQuery.post(ajaxurl,{action:&quot;set-post-thumbnail&quot;,post_id:post_id,thumbnail_id:id,cookie:encodeURIComponent(document.cookie)},function(str){var win=window.dialogArguments||opener||parent||top;if(str==&quot;0&quot;){alert(setPostThumbnailL10n.error);win.cwsCloseTB()}else{jQuery(&quot;a.wp-post-thumbnail&quot;).text(setPostThumbnailL10n.setThumbnail);jQuery(&quot;#media-item-&quot;+id+&quot; &gt; a.wp-post-thumbnail&quot;).hide();win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str);win.WPCloseTB()}})};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmediauploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/media-upload.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media-upload.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/media-upload.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -18,6 +18,7 @@
</span><span class="cx"> wp_enqueue_script('swfupload-all');
</span><span class="cx"> wp_enqueue_script('swfupload-handlers');
</span><span class="cx"> wp_enqueue_script('image-edit');
</span><ins>+wp_enqueue_script('set-post-thumbnail' );
</ins><span class="cx"> wp_enqueue_style('imgareaselect');
</span><span class="cx"> 
</span><span class="cx"> @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
</span></span></pre></div>
<a id="trunkwpadminpostnewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post-new.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post-new.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/post-new.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -18,6 +18,7 @@
</span><span class="cx"> add_thickbox();
</span><span class="cx"> wp_enqueue_script('media-upload');
</span><span class="cx"> wp_enqueue_script('word-count');
</span><ins>+wp_enqueue_script( 'set-post-thumbnail-handler' );
</ins><span class="cx"> 
</span><span class="cx"> if ( ! current_user_can('edit_posts') ) {
</span><span class="cx">         require_once ('./admin-header.php'); ?&gt;
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-admin/post.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -139,6 +139,7 @@
</span><span class="cx">         add_thickbox();
</span><span class="cx">         wp_enqueue_script('media-upload');
</span><span class="cx">         wp_enqueue_script('word-count');
</span><ins>+        wp_enqueue_script( 'set-post-thumbnail-handler' );
</ins><span class="cx">         wp_enqueue_script( 'admin-comments' );
</span><span class="cx">         enqueue_comment_hotkeys_js();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12006 => 12007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-10-07 20:42:05 UTC (rev 12006)
+++ trunk/wp-includes/script-loader.php        2009-10-07 22:18:09 UTC (rev 12007)
</span><span class="lines">@@ -407,6 +407,18 @@
</span><span class="cx"> 
</span><span class="cx">                 $scripts-&gt;add( 'image-edit', &quot;/wp-admin/js/image-edit$suffix.js&quot;, array('jquery', 'json2', 'imgareaselect'), '20090929' );
</span><span class="cx">                 $scripts-&gt;add_data( 'image-edit', 'group', 1 );
</span><ins>+
+                $scripts-&gt;add( 'set-post-thumbnail', &quot;/wp-admin/js/set-post-thumbnail$suffix.js&quot;, array( 'jquery' ), '20091005' );
+                $scripts-&gt;add_data( 'set-post-thumbnail', 'group', 1 );
+                $scripts-&gt;localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
+                        'setThumbnail' =&gt; __( 'Use for thumbnail' ),
+                        'saving' =&gt; __( 'Saving...' ),
+                        'error' =&gt; __( 'Could not set that as the thumbnail image. Try a different attachment.' )
+                ) );
+
+                $scripts-&gt;add( 'set-post-thumbnail-handler', &quot;/wp-admin/js/set-post-thumbnail-handler$suffix.js&quot;, array( 'jquery' ), '20091005' );
+                $scripts-&gt;add_data( 'set-post-thumbnail-handler', 'group', 1 );
+        
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -460,7 +472,7 @@
</span><span class="cx">         $styles-&gt;add_data( 'colors-classic', 'rtl', true );
</span><span class="cx"> 
</span><span class="cx">         $styles-&gt;add( 'global', &quot;/wp-admin/css/global$suffix.css&quot;, array(), '20090630' );
</span><del>-        $styles-&gt;add( 'media', &quot;/wp-admin/css/media$suffix.css&quot;, array(), '20090922' );
</del><ins>+        $styles-&gt;add( 'media', &quot;/wp-admin/css/media$suffix.css&quot;, array(), '20091005' );
</ins><span class="cx">         $styles-&gt;add( 'widgets', &quot;/wp-admin/css/widgets$suffix.css&quot;, array(), '20090603' );
</span><span class="cx">         $styles-&gt;add( 'dashboard', &quot;/wp-admin/css/dashboard$suffix.css&quot;, array(), '20090514' );
</span><span class="cx">         $styles-&gt;add( 'install', &quot;/wp-admin/css/install$suffix.css&quot;, array(), '20090514' );
</span></span></pre>
</div>
</div>

</body>
</html>