<!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 { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { 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>[12130] trunk: Trash undo for the uploader, props caesarsgrunt, see #4529</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12130">12130</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-10-30 07:09:55 +0000 (Fri, 30 Oct 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Trash undo for the uploader, props caesarsgrunt, see <a href="http://trac.wordpress.org/ticket/4529">#4529</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmincssmediartlcss">trunk/wp-admin/css/media-rtl.css</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="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpincludesjsswfuploadhandlersdevjs">trunk/wp-includes/js/swfupload/handlers.dev.js</a></li>
<li><a href="#trunkwpincludesjsswfuploadhandlersjs">trunk/wp-includes/js/swfupload/handlers.js</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</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 (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-admin/admin-ajax.php        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -334,6 +334,7 @@
</span><span class="cx">                 die('0');
</span><span class="cx">         break;
</span><span class="cx"> case 'trash-post' :
</span><ins>+case 'untrash-post' :
</ins><span class="cx">         check_ajax_referer( &quot;{$action}_$id&quot; );
</span><span class="cx">         if ( !current_user_can( 'delete_post', $id ) )
</span><span class="cx">                 die('-1');
</span><span class="lines">@@ -341,10 +342,15 @@
</span><span class="cx">         if ( !get_post( $id ) )
</span><span class="cx">                 die('1');
</span><span class="cx"> 
</span><del>-        if ( wp_trash_post( $id ) )
</del><ins>+        if ( 'trash-post' == $action )
+                $done = wp_trash_post( $id );
+        else
+                $done = wp_untrash_post( $id );
+
+        if ( $done )
</ins><span class="cx">                 die('1');
</span><del>-        else
-                die('0');
</del><ins>+
+        die('0');
</ins><span class="cx">         break;
</span><span class="cx"> case 'delete-page' :
</span><span class="cx">         check_ajax_referer( &quot;{$action}_$id&quot; );
</span></span></pre></div>
<a id="trunkwpadmincssmediartlcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/media-rtl.css (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media-rtl.css        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-admin/css/media-rtl.css        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -48,12 +48,6 @@
</span><span class="cx">         border-left-style: solid;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.describe-toggle-on,
-.describe-toggle-off {
-        float: left;
-        margin-right: 0;
-        margin-left: 20px;
-}
</del><span class="cx"> /* Specific to Uploader */
</span><span class="cx"> #media-upload .media-upload-form p {
</span><span class="cx">         margin: 0 0 1em 1em;
</span></span></pre></div>
<a id="trunkwpadmincssmediacss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/media.css (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media.css        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-admin/css/media.css        2009-10-30 07:09:55 UTC (rev 12130)
</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:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#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;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#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;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#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;}.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{margin:0 20px;}#media-items a.delete{display:block;float:right;}#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;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,&quot;Times New Roman&quot;,Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#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;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#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 (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media.dev.css        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-admin/css/media.dev.css        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -134,18 +134,6 @@
</span><span class="cx">         border-style: solid;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.describe-toggle-on,
-.describe-toggle-off {
-        display: block;
-        line-height: 36px;
-        float: right;
-        margin-right: 20px;
-}
-
-.describe-toggle-off {
-        display: none;
-}
-
</del><span class="cx"> .hidden {
</span><span class="cx">         height: 0;
</span><span class="cx">         width: 0;
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-admin/includes/media.php        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -1203,11 +1203,12 @@
</span><span class="cx">                 'extra_rows' =&gt; array(),
</span><span class="cx">         );
</span><span class="cx"> 
</span><del>-        $delete_href = wp_nonce_url(&quot;post.php?action=trash&amp;amp;post=$attachment_id&quot;, 'trash-post_' . $attachment_id);
</del><ins>+        $trash_href = wp_nonce_url(&quot;post.php?action=trash&amp;amp;post=$attachment_id&quot;, 'trash-post_' . $attachment_id);
+        $untrash_href = wp_nonce_url(&quot;post.php?action=untrash&amp;amp;post=$attachment_id&quot;, 'untrash-post_' . $attachment_id);
</ins><span class="cx">         if ( $send )
</span><span class="cx">                 $send = &quot;&lt;input type='submit' class='button' name='send[$attachment_id]' value='&quot; . esc_attr__( 'Insert into Post' ) . &quot;' /&gt;&quot;;
</span><span class="cx">         if ( $delete )
</span><del>-                $delete = current_user_can('delete_post', $attachment_id) ? &quot;&lt;a href=\&quot;$delete_href\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;delete\&quot;&gt;&quot; . __('Move to Trash') . &quot;&lt;/a&gt;&quot; : &quot;&quot;;
</del><ins>+                $delete = current_user_can('delete_post', $attachment_id) ? &quot;&lt;a href=\&quot;$trash_href\&quot; id=\&quot;del[$attachment_id]\&quot; class=\&quot;delete\&quot;&gt;&quot; . __('Move to Trash') . &quot;&lt;/a&gt; &lt;a href=\&quot;$untrash_href\&quot; id=\&quot;undo[$attachment_id]\&quot; class=\&quot;undo hidden\&quot;&gt;&quot; . __('Undo?') . &quot;&lt;/a&gt;&quot; : &quot;&quot;;
</ins><span class="cx">         if ( 'image' == $type &amp;&amp; get_post_image_id($_GET['post_id']) != $attachment_id )
</span><span class="cx">                 $thumbnail = &quot;&lt;a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\&quot;$attachment_id\&quot;);return false;'&gt;&quot; . esc_html__( &quot;Use as thumbnail&quot; ) . &quot;&lt;/a&gt;&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesjsswfuploadhandlersdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/swfupload/handlers.dev.js (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/swfupload/handlers.dev.js        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-includes/js/swfupload/handlers.dev.js        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -8,7 +8,7 @@
</span><span class="cx">         // Get rid of unused form
</span><span class="cx">         jQuery('.media-blank').remove();
</span><span class="cx">         // Collapse a single item
</span><del>-        if ( jQuery('.type-form #media-items&gt;*').length == 1 &amp;&amp; jQuery('#media-items .hidden').length &gt; 0 ) {
</del><ins>+        if ( jQuery('form.type-form #media-items').children().length == 1 &amp;&amp; jQuery('.hidden', '#media-items').length &gt; 0 ) {
</ins><span class="cx">                 jQuery('.describe-toggle-on').show();
</span><span class="cx">                 jQuery('.describe-toggle-off').hide();
</span><span class="cx">                 jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">         // Create a progress bar containing the filename
</span><span class="cx">         jQuery('#media-items').append('&lt;div id=&quot;media-item-' + fileObj.id + '&quot; class=&quot;media-item child-of-' + post_id + '&quot;&gt;&lt;div class=&quot;progress&quot;&gt;&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;filename original&quot;&gt;&lt;span class=&quot;percent&quot;&gt;&lt;/span&gt; ' + fileObj.name + '&lt;/div&gt;&lt;/div&gt;');
</span><span class="cx">         // Display the progress div
</span><del>-        jQuery('#media-item-' + fileObj.id + ' .progress').show();
</del><ins>+        jQuery('.progress', '#media-item-' + fileObj.id).show();
</ins><span class="cx"> 
</span><span class="cx">         // Disable submit and enable cancel
</span><span class="cx">         jQuery('#insert-gallery').attr('disabled', 'disabled');
</span><span class="lines">@@ -29,63 +29,99 @@
</span><span class="cx"> 
</span><span class="cx"> function uploadProgress(fileObj, bytesDone, bytesTotal) {
</span><span class="cx">         // Lengthen the progress bar
</span><del>-        var w = jQuery('#media-items').width() - 2;
-        jQuery('#media-item-' + fileObj.id + ' .bar').width( w * bytesDone / bytesTotal );
-        jQuery('#media-item-' + fileObj.id + ' .percent').html( Math.ceil(bytesDone / bytesTotal * 100) + '%' );
</del><ins>+        var w = jQuery('#media-items').width() - 2, item = jQuery('#media-item-' + fileObj.id);
+        jQuery('.bar', item).width( w * bytesDone / bytesTotal );
+        jQuery('.percent', item).html( Math.ceil(bytesDone / bytesTotal * 100) + '%' );
</ins><span class="cx"> 
</span><span class="cx">         if ( bytesDone == bytesTotal )
</span><del>-                jQuery('#media-item-' + fileObj.id + ' .bar').html('&lt;strong class=&quot;crunching&quot;&gt;' + swfuploadL10n.crunching + '&lt;/strong&gt;');
</del><ins>+                jQuery('.bar', item).html('&lt;strong class=&quot;crunching&quot;&gt;' + swfuploadL10n.crunching + '&lt;/strong&gt;');
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function prepareMediaItem(fileObj, serverData) {
</span><ins>+        var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
</ins><span class="cx">         // Move the progress bar to 100%
</span><del>-        jQuery('#media-item-' + fileObj.id + ' .bar').remove();
-        jQuery('#media-item-' + fileObj.id + ' .progress').hide();
</del><ins>+        jQuery('.bar', item).remove();
+        jQuery('.progress', item).hide();
</ins><span class="cx"> 
</span><del>-        var f = ( typeof shortform == 'undefined' ) ? 1 : 2;
</del><span class="cx">         // Old style: Append the HTML returned by the server -- thumbnail and form inputs
</span><span class="cx">         if ( isNaN(serverData) || !serverData ) {
</span><del>-                jQuery('#media-item-' + fileObj.id).append(serverData);
</del><ins>+                item.append(serverData);
</ins><span class="cx">                 prepareMediaItemInit(fileObj);
</span><span class="cx">         }
</span><span class="cx">         // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
</span><span class="cx">         else {
</span><del>-                jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
</del><ins>+                item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
</ins><span class="cx">         }
</span><span class="cx"> }
</span><del>-                
</del><ins>+
</ins><span class="cx"> function prepareMediaItemInit(fileObj) {
</span><del>-
</del><ins>+        var item = jQuery('#media-item-' + fileObj.id);
</ins><span class="cx">         // Clone the thumbnail as a &quot;pinkynail&quot; -- a tiny image to the left of the filename
</span><del>-        jQuery('#media-item-' + fileObj.id + ' .thumbnail').clone().attr('className', 'pinkynail toggle').prependTo('#media-item-' + fileObj.id);
</del><ins>+        jQuery('.thumbnail', item).clone().attr('className', 'pinkynail toggle').prependTo(item);
</ins><span class="cx"> 
</span><span class="cx">         // Replace the original filename with the new (unique) one assigned during upload
</span><del>-        jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
</del><ins>+        jQuery('.filename.original', item).replaceWith( jQuery('.filename.new', item) );
</ins><span class="cx"> 
</span><span class="cx">         // Also bind toggle to the links
</span><del>-        jQuery('#media-item-' + fileObj.id + ' a.toggle').click(function(){
-                jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){
</del><ins>+        jQuery('a.toggle', item).click(function(){
+                jQuery(this).siblings('.slidetoggle').slideToggle(350, function(){
</ins><span class="cx">                         var o = jQuery(this).offset();
</span><del>-                        window.scrollTo(0, o.top-36);
</del><ins>+                        window.scrollTo(0, o.top - 36);
</ins><span class="cx">                 });
</span><del>-                jQuery(this).parent().children('.toggle').toggle();
</del><ins>+                jQuery(this).siblings('.toggle').andSelf().toggle();
</ins><span class="cx">                 jQuery(this).siblings('a.toggle').focus();
</span><span class="cx">                 return false;
</span><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         // Bind AJAX to the new Delete button
</span><del>-        jQuery('#media-item-' + fileObj.id + ' a.delete').click(function(){
</del><ins>+        jQuery('a.delete', item).click(function(){
</ins><span class="cx">                 // Tell the server to delete it. TODO: handle exceptions
</span><del>-                jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
-                        id : this.id.replace(/[^0-9]/g,''),
-                        action : 'trash-post',
-                        _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
-                        });
</del><ins>+                jQuery.ajax({
+                        url: 'admin-ajax.php',
+                        type: 'post',
+                        success: deleteSuccess,
+                        error: deleteError,
+                        id: fileObj.id,
+                        data: {
+                                id : this.id.replace(/[^0-9]/g, ''),
+                                action : 'trash-post',
+                                _ajax_nonce : this.href.replace(/^.*wpnonce=/,'')
+                        }
+                });
</ins><span class="cx">                 return false;
</span><span class="cx">         });
</span><span class="cx"> 
</span><ins>+        // Bind AJAX to the new Undo button
+        jQuery('a.undo', item).click(function(){
+                // Tell the server to untrash it. TODO: handle exceptions
+                jQuery.ajax({
+                        url: 'admin-ajax.php',
+                        type: 'post',
+                        id: fileObj.id,
+                        data: {
+                                id : this.id.replace(/[^0-9]/g,''),
+                                action: 'untrash-post',
+                                _ajax_nonce: this.href.replace(/^.*wpnonce=/,'')
+                        },
+                        success: function(data, textStatus){
+                                var item = jQuery('#media-item-' + fileObj.id);
+
+                                if ( type = jQuery('#type-of-' + fileObj.id).val() )
+                                        jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1);
+                                if ( item.hasClass('child-of-'+post_id) )
+                                        jQuery('#attachments-count').text(jQuery('#attachments-count').text()-0+1);
+
+                                jQuery('.filename .trashnotice', item).remove();
+                                jQuery('a.undo', item).addClass('hidden');
+                                jQuery('a.describe-toggle-on, .menu_order_input', item).show();
+                                item.animate( {backgroundColor: '#fff'}, { queue: false, duration: 200, complete: function(){ jQuery(this).css({backgroundColor:''}); } });
+                        }
+                });
+                return false;
+        });
+
</ins><span class="cx">         // Open this item if it says to start open (e.g. to display an error)
</span><del>-        jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').slideToggle(500).parent().children('.toggle').toggle();
</del><ins>+        jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').slideToggle(500).siblings('.toggle').toggle();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function itemAjaxError(id, html) {
</span><span class="lines">@@ -101,28 +137,29 @@
</span><span class="cx">         if ( data == '0' )
</span><span class="cx">                 return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
</span><span class="cx"> 
</span><del>-        var item = jQuery('#media-item-' + this.id);
</del><ins>+        var id = this.id, item = jQuery('#media-item-' + id);
</ins><span class="cx"> 
</span><span class="cx">         // Decrement the counters.
</span><del>-        if ( type = jQuery('#type-of-' + this.id).val() )
-                jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-1);
</del><ins>+        if ( type = jQuery('#type-of-' + id).val() )
+                jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 );
</ins><span class="cx">         if ( item.hasClass('child-of-'+post_id) )
</span><del>-                jQuery('#attachments-count').text(jQuery('#attachments-count').text()-1);
</del><ins>+                jQuery('#attachments-count').text( jQuery('#attachments-count').text() - 1 );
</ins><span class="cx"> 
</span><del>-        if ( jQuery('.type-form #media-items&gt;*').length == 1 &amp;&amp; jQuery('#media-items .hidden').length &gt; 0 ) {
</del><ins>+        if ( jQuery('form.type-form #media-items').children().length == 1 &amp;&amp; jQuery('.hidden', '#media-items').length &gt; 0 ) {
</ins><span class="cx">                 jQuery('.toggle').toggle();
</span><span class="cx">                 jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Vanish it.
</span><del>-        jQuery('#media-item-' + this.id + ' .filename:empty').remove();
-        jQuery('#media-item-' + this.id + ' .filename').append(' &lt;span class=&quot;file-error&quot;&gt;'+swfuploadL10n.deleted+'&lt;/span&gt;').siblings('a.toggle').remove();
-        jQuery('#media-item-' + this.id).children('.describe').css({backgroundColor:'#fff'}).end()
-                        .animate({backgroundColor:'#ffc0c0'}, {queue:false,duration:50})
-                        .animate({minHeight:0,height:36}, 400, null, function(){jQuery(this).children('.describe').remove()})
-                        .animate({backgroundColor:'#fff'}, 400)
-                        .animate({height:0}, 800, null, function(){jQuery(this).remove();updateMediaForm();});
</del><ins>+        jQuery('.toggle', item).toggle();
+        jQuery('.slidetoggle', item).slideUp(200).siblings().removeClass('hidden');
+        item.css( {backgroundColor:'#fff'} ).animate( {backgroundColor:'#ffc0c0'}, {queue:false, duration:500} );
</ins><span class="cx"> 
</span><ins>+        jQuery('.filename:empty', item).remove();
+        jQuery('.filename', item).append('&lt;span class=&quot;trashnotice&quot;&gt; ' + swfuploadL10n.deleted + ' &lt;/span&gt;').siblings('a.toggle').hide();
+        jQuery('.filename', item).append( jQuery('a.undo', item).removeClass('hidden') );
+        jQuery('.menu_order_input', item).hide();
+
</ins><span class="cx">         return;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -131,21 +168,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function updateMediaForm() {
</span><ins>+        var one = jQuery('form.type-form #media-items').children(), items = jQuery('#media-items').children();
</ins><span class="cx">         storeState();
</span><span class="cx">         // Just one file, no need for collapsible part
</span><del>-        if ( jQuery('.type-form #media-items&gt;*').length == 1 ) {
-                jQuery('#media-items .slidetoggle').slideDown(500).parent().eq(0).children('.toggle').toggle();
-                jQuery('.type-form .slidetoggle').siblings().addClass('hidden');
</del><ins>+        if ( one.length == 1 ) {
+                jQuery('.slidetoggle', one).slideDown(500).siblings().addClass('hidden').filter('.toggle').toggle();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Only show Save buttons when there is at least one file.
</span><del>-        if ( jQuery('#media-items&gt;*').not('.media-blank').length &gt; 0 )
</del><ins>+        if ( items.not('.media-blank').length &gt; 0 )
</ins><span class="cx">                 jQuery('.savebutton').show();
</span><span class="cx">         else
</span><span class="cx">                 jQuery('.savebutton').hide();
</span><span class="cx"> 
</span><span class="cx">         // Only show Gallery button when there are at least two files.
</span><del>-        if ( jQuery('#media-items&gt;*').length &gt; 1 )
</del><ins>+        if ( items.length &gt; 1 )
</ins><span class="cx">                 jQuery('.insert-gallery').show();
</span><span class="cx">         else
</span><span class="cx">                 jQuery('.insert-gallery').hide();
</span><span class="lines">@@ -245,7 +282,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function uploadError(fileObj, errorCode, message) {
</span><del>-        
</del><ins>+
</ins><span class="cx">         switch (errorCode) {
</span><span class="cx">                 case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
</span><span class="cx">                         wpFileError(fileObj, swfuploadL10n.missing_upload_url);
</span></span></pre></div>
<a id="trunkwpincludesjsswfuploadhandlersjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/swfupload/handlers.js (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/swfupload/handlers.js        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-includes/js/swfupload/handlers.js        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function fileDialogStart(){jQuery(&quot;#media-upload-error&quot;).empty()}function fileQueued(a){jQuery(&quot;.media-blank&quot;).remove();if(jQuery(&quot;.type-form #media-items&gt;*&quot;).length==1&amp;&amp;jQuery(&quot;#media-items .hidden&quot;).length&gt;0){jQuery(&quot;.describe-toggle-on&quot;).show();jQuery(&quot;.describe-toggle-off&quot;).hide();jQuery(&quot;.slidetoggle&quot;).slideUp(200).siblings().removeClass(&quot;hidden&quot;)}jQuery(&quot;#media-items&quot;).append('&lt;div id=&quot;media-item-'+a.id+'&quot; class=&quot;media-item child-of-'+post_id+'&quot;&gt;&lt;div class=&quot;progress&quot;&gt;&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;filename original&quot;&gt;&lt;span class=&quot;percent&quot;&gt;&lt;/span&gt; '+a.name+&quot;&lt;/div&gt;&lt;/div&gt;&quot;);jQuery(&quot;#media-item-&quot;+a.id+&quot; .progress&quot;).show();jQuery(&quot;#insert-gallery&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;);jQuery(&quot;#cancel-upload&quot;).attr(&quot;disabled&quot;,&quot;&quot;)}function uploadStart(a){return true}function uploadProgress(d,b,c){var a=jQuery(&quot;#media-items&quot;).width()-2;jQuery(&quot;#media-item-&quot;+d.id+&quot; .bar&quot;).width(a*b/c);jQuery(&quot;#media-item-&quot;+d.id+&quot; .percent&quot;).html(Math.ceil(b/c*100)+&quot;%&quot;);if(b==c){jQuery(&quot;#media-item-&quot;+d.id+&quot; .bar&quot;).html('&lt;strong class=&quot;crunching&quot;&gt;'+swfuploadL10n.crunching+&quot;&lt;/strong&gt;&quot;)}}function prepareMediaItem(b,a){jQuery(&quot;#media-item-&quot;+b.id+&quot; .bar&quot;).remove();jQuery(&quot;#media-item-&quot;+b.id+&quot; .progress&quot;).hide();var c=(typeof shortform==&quot;undefined&quot;)?1:2;if(isNaN(a)||!a){jQuery(&quot;#media-item-&quot;+b.id).append(a);prepareMediaItemInit(b)}else{jQuery(&quot;#media-item-&quot;+b.id).load(&quot;async-upload.php&quot;,{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery(&quot;#media-item-&quot;+a.id+&quot; .thumbnail&quot;).clone().attr(&quot;className&quot;,&quot;pinkynail toggle&quot;).prependTo(&quot;#media-item-&quot;+a.id);jQuery(&quot;#media-item-&quot;+a.id+&quot; .filename.original&quot;).replaceWith(jQuery(&quot;#media-item-&quot;+a.id+&quot; .filename.new&quot;));jQuery(&quot;#media-item-&quot;+a.id+&quot; a.toggle&quot;).click(function(){jQuery(this).siblings(&quot;.slidetoggle&quot;).slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().children(&quot;.toggle&quot;).toggle();jQuery(this).siblings(&quot;a.toggle&quot;).focus();return false});jQuery(&quot;#media-item-&quot;+a.id+&quot; a.delete&quot;).click(function(){jQuery.ajax({url:&quot;admin-ajax.php&quot;,type:&quot;post&quot;,success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,&quot;&quot;),action:&quot;trash-post&quot;,_ajax_nonce:this.href.replace(/^.*wpnonce=/,&quot;&quot;)}});return false});jQuery(&quot;#media-item-&quot;+a.id+&quot;.startopen&quot;).removeClass(&quot;startopen&quot;).slideToggle(500).parent().children(&quot;.toggle&quot;).toggle()}function itemAjaxError(c,b){var a=jQuery(&quot;#media-item-error&quot;+c);a.html('&lt;div class=&quot;file-error&quot;&gt;&lt;button type=&quot;button&quot; id=&quot;dismiss-'+c+'&quot; class=&quot;button dismiss&quot;&gt;'+swfuploadL10n.dismiss+&quot;&lt;/button&gt;&quot;+b+&quot;&lt;/div&gt;&quot;);jQuery(&quot;#dismiss-&quot;+c).click(function(){jQuery(this).parents(&quot;.file-error&quot;).slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b==&quot;-1&quot;){return itemAjaxError(this.id,&quot;You do not have permission. Has your session expired?&quot;)}if(b==&quot;0&quot;){return itemAjaxError(this.id,&quot;Could not be deleted. Has it been deleted already?&quot;)}var a=jQuery(&quot;#media-item-&quot;+this.id);if(type=jQuery(&quot;#type-of-&quot;+this.id).val()){jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text(jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text()-1)}if(a.hasClass(&quot;child-of-&quot;+post_id)){jQuery(&quot;#attachments-count&quot;).text(jQuery(&quot;#attachments-count&quot;).text()-1)}if(jQuery(&quot;.type-form #media-items&gt;*&quot;).length==1&amp;&amp;jQuery(&quot;#media-items .hidden&quot;).length&gt;0){jQuery(&quot;.toggle&quot;).toggle();jQuery(&quot;.slidetoggle&quot;).slideUp(200).siblings().removeClass(&quot;hidden&quot;)}jQuery(&quot;#media-item-&quot;+this.id+&quot; .filename:empty&quot;).remove();jQuery(&quot;#media-item-&quot;+this.id+&quot; .filename&quot;).append(' &lt;span class=&quot;file-error&quot;&gt;'+swfuploadL10n.deleted+&quot;&lt;/span&gt;&quot;).siblings(&quot;a.toggle&quot;).remove();jQuery(&quot;#media-item-&quot;+this.id).children(&quot;.describe&quot;).css({backgroundColor:&quot;#fff&quot;}).end().animate({backgroundColor:&quot;#ffc0c0&quot;},{queue:false,duration:50}).animate({minHeight:0,height:36},400,null,function(){jQuery(this).children(&quot;.describe&quot;).remove()}).animate({backgroundColor:&quot;#fff&quot;},400).animate({height:0},800,null,function(){jQuery(this).remove();updateMediaForm()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(&quot;.type-form #media-items&gt;*&quot;).length==1){jQuery(&quot;#media-items .slidetoggle&quot;).slideDown(500).parent().eq(0).children(&quot;.toggle&quot;).toggle();jQuery(&quot;.type-form .slidetoggle&quot;).siblings().addClass(&quot;hidden&quot;)}if(jQuery(&quot;#media-items&gt;*&quot;).not(&quot;.media-blank&quot;).length&gt;0){jQuery(&quot;.savebutton&quot;).show()}else{jQuery(&quot;.savebutton&quot;).hide()}if(jQuery(&quot;#media-items&gt;*&quot;).length&gt;1){jQuery(&quot;.insert-gallery&quot;).show()}else{jQuery(&quot;.insert-gallery&quot;).hide()}}function uploadSuccess(b,a){if(a.match(&quot;media-upload-error&quot;)){jQuery(&quot;#media-item-&quot;+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery(&quot;#media-item-&quot;+b.id).hasClass(&quot;child-of-&quot;+post_id)){jQuery(&quot;#attachments-count&quot;).text(1*jQuery(&quot;#attachments-count&quot;).text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery(&quot;#cancel-upload&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;);jQuery(&quot;#insert-gallery&quot;).attr(&quot;disabled&quot;,&quot;&quot;)}}function wpQueueError(a){jQuery(&quot;#media-upload-error&quot;).show().text(a)}function wpFileError(b,a){jQuery(&quot;#media-item-&quot;+b.id+&quot; .filename&quot;).after('&lt;div class=&quot;file-error&quot;&gt;&lt;button type=&quot;button&quot; id=&quot;dismiss-'+b.id+'&quot; class=&quot;button dismiss&quot;&gt;'+swfuploadL10n.dismiss+&quot;&lt;/button&gt;&quot;+a+&quot;&lt;/div&gt;&quot;).siblings(&quot;.toggle&quot;).remove();jQuery(&quot;#dismiss-&quot;+b.id).click(function(){jQuery(this).parents(&quot;.media-item&quot;).slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b&gt;0){this.startUpload()}}catch(a){this.debug(a)}}function switchUploader(b){var c=document.getElementById(swfu.customSettings.swfupload_element_id),a=document.getElementById(swfu.customSettings.degraded_element_id);if(b){c.style.display=&quot;block&quot;;a.style.display=&quot;none&quot;}else{c.style.display=&quot;none&quot;;a.style.display=&quot;block&quot;}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(&quot;.upload-html-bypass&quot;).hide()}function uploadError(b,c,a){switch(c){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(b,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(b,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery(&quot;#media-item-&quot;+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}var storeState;(function(a){storeState=function(){var c=getUserSetting(&quot;align&quot;)||&quot;&quot;,b=getUserSetting(&quot;imgsize&quot;)||&quot;&quot;;a('tr.align input[type=&quot;radio&quot;]').click(function(){setUserSetting(&quot;align&quot;,a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr(&quot;checked&quot;,&quot;checked&quot;);a('tr.image-size input[type=&quot;radio&quot;]').click(function(){setUserSetting(&quot;imgsize&quot;,a(this).val())}).filter(function(){if(a(this).attr(&quot;disabled&quot;)||a(this).val()!=b){return false}return true}).attr(&quot;checked&quot;,&quot;checked&quot;);a(&quot;tr.url button&quot;).click(function(){var d=this.className||&quot;&quot;;d=d.replace(/.*?(url[^ '&quot;]+).*/,&quot;$1&quot;);if(d){setUserSetting(&quot;urlbutton&quot;,d)}a(this).siblings(&quot;.urlfield&quot;).val(a(this).attr(&quot;title&quot;))});a(&quot;tr.url .urlfield&quot;).each(function(){var d=getUserSetting(&quot;urlbutton&quot;);a(this).val(a(this).siblings(&quot;button.&quot;+d).attr(&quot;title&quot;))})}})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+function fileDialogStart(){jQuery(&quot;#media-upload-error&quot;).empty()}function fileQueued(a){jQuery(&quot;.media-blank&quot;).remove();if(jQuery(&quot;form.type-form #media-items&quot;).children().length==1&amp;&amp;jQuery(&quot;.hidden&quot;,&quot;#media-items&quot;).length&gt;0){jQuery(&quot;.describe-toggle-on&quot;).show();jQuery(&quot;.describe-toggle-off&quot;).hide();jQuery(&quot;.slidetoggle&quot;).slideUp(200).siblings().removeClass(&quot;hidden&quot;)}jQuery(&quot;#media-items&quot;).append('&lt;div id=&quot;media-item-'+a.id+'&quot; class=&quot;media-item child-of-'+post_id+'&quot;&gt;&lt;div class=&quot;progress&quot;&gt;&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;filename original&quot;&gt;&lt;span class=&quot;percent&quot;&gt;&lt;/span&gt; '+a.name+&quot;&lt;/div&gt;&lt;/div&gt;&quot;);jQuery(&quot;.progress&quot;,&quot;#media-item-&quot;+a.id).show();jQuery(&quot;#insert-gallery&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;);jQuery(&quot;#cancel-upload&quot;).attr(&quot;disabled&quot;,&quot;&quot;)}function uploadStart(a){return true}function uploadProgress(e,b,d){var a=jQuery(&quot;#media-items&quot;).width()-2,c=jQuery(&quot;#media-item-&quot;+e.id);jQuery(&quot;.bar&quot;,c).width(a*b/d);jQuery(&quot;.percent&quot;,c).html(Math.ceil(b/d*100)+&quot;%&quot;);if(b==d){jQuery(&quot;.bar&quot;,c).html('&lt;strong class=&quot;crunching&quot;&gt;'+swfuploadL10n.crunching+&quot;&lt;/strong&gt;&quot;)}}function prepareMediaItem(c,a){var d=(typeof shortform==&quot;undefined&quot;)?1:2,b=jQuery(&quot;#media-item-&quot;+c.id);jQuery(&quot;.bar&quot;,b).remove();jQuery(&quot;.progress&quot;,b).hide();if(isNaN(a)||!a){b.append(a);prepareMediaItemInit(c)}else{b.load(&quot;async-upload.php&quot;,{attachment_id:a,fetch:d},function(){prepareMediaItemInit(c);updateMediaForm()})}}function prepareMediaItemInit(b){var a=jQuery(&quot;#media-item-&quot;+b.id);jQuery(&quot;.thumbnail&quot;,a).clone().attr(&quot;className&quot;,&quot;pinkynail toggle&quot;).prependTo(a);jQuery(&quot;.filename.original&quot;,a).replaceWith(jQuery(&quot;.filename.new&quot;,a));jQuery(&quot;a.toggle&quot;,a).click(function(){jQuery(this).siblings(&quot;.slidetoggle&quot;).slideToggle(350,function(){var c=jQuery(this).offset();window.scrollTo(0,c.top-36)});jQuery(this).siblings(&quot;.toggle&quot;).andSelf().toggle();jQuery(this).siblings(&quot;a.toggle&quot;).focus();return false});jQuery(&quot;a.delete&quot;,a).click(function(){jQuery.ajax({url:&quot;admin-ajax.php&quot;,type:&quot;post&quot;,success:deleteSuccess,error:deleteError,id:b.id,data:{id:this.id.replace(/[^0-9]/g,&quot;&quot;),action:&quot;trash-post&quot;,_ajax_nonce:this.href.replace(/^.*wpnonce=/,&quot;&quot;)}});return false});jQuery(&quot;a.undo&quot;,a).click(function(){jQuery.ajax({url:&quot;admin-ajax.php&quot;,type:&quot;post&quot;,id:b.id,data:{id:this.id.replace(/[^0-9]/g,&quot;&quot;),action:&quot;untrash-post&quot;,_ajax_nonce:this.href.replace(/^.*wpnonce=/,&quot;&quot;)},success:function(d,e){var c=jQuery(&quot;#media-item-&quot;+b.id);if(type=jQuery(&quot;#type-of-&quot;+b.id).val()){jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text(jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text()-0+1)}if(c.hasClass(&quot;child-of-&quot;+post_id)){jQuery(&quot;#attachments-count&quot;).text(jQuery(&quot;#attachments-count&quot;).text()-0+1)}jQuery(&quot;.filename .trashnotice&quot;,c).remove();jQuery(&quot;a.undo&quot;,c).addClass(&quot;hidden&quot;);jQuery(&quot;a.describe-toggle-on, .menu_order_input&quot;,c).show();c.animate({backgroundColor:&quot;#fff&quot;},{queue:false,duration:200,complete:function(){jQuery(this).css({backgroundColor:&quot;&quot;})}})}});return false});jQuery(&quot;#media-item-&quot;+b.id+&quot;.startopen&quot;).removeClass(&quot;startopen&quot;).slideToggle(500).siblings(&quot;.toggle&quot;).toggle()}function itemAjaxError(c,b){var a=jQuery(&quot;#media-item-error&quot;+c);a.html('&lt;div class=&quot;file-error&quot;&gt;&lt;button type=&quot;button&quot; id=&quot;dismiss-'+c+'&quot; class=&quot;button dismiss&quot;&gt;'+swfuploadL10n.dismiss+&quot;&lt;/button&gt;&quot;+b+&quot;&lt;/div&gt;&quot;);jQuery(&quot;#dismiss-&quot;+c).click(function(){jQuery(this).parents(&quot;.file-error&quot;).slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,d){if(b==&quot;-1&quot;){return itemAjaxError(this.id,&quot;You do not have permission. Has your session expired?&quot;)}if(b==&quot;0&quot;){return itemAjaxError(this.id,&quot;Could not be deleted. Has it been deleted already?&quot;)}var c=this.id,a=jQuery(&quot;#media-item-&quot;+c);if(type=jQuery(&quot;#type-of-&quot;+c).val()){jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text(jQuery(&quot;#&quot;+type+&quot;-counter&quot;).text()-1)}if(a.hasClass(&quot;child-of-&quot;+post_id)){jQuery(&quot;#attachments-count&quot;).text(jQuery(&quot;#attachments-count&quot;).text()-1)}if(jQuery(&quot;form.type-form #media-items&quot;).children().length==1&amp;&amp;jQuery(&quot;.hidden&quot;,&quot;#media-items&quot;).length&gt;0){jQuery(&quot;.toggle&quot;).toggle();jQuery(&quot;.slidetoggle&quot;).slideUp(200).siblings().removeClass(&quot;hidden&quot;)}jQuery(&quot;.toggle&quot;,a).toggle();jQuery(&quot;.slidetoggle&quot;,a).slideUp(200).siblings().removeClass(&quot;hidden&quot;);a.css({backgroundColor:&quot;#fff&quot;}).animate({backgroundColor:&quot;#ffc0c0&quot;},{queue:false,duration:500});jQuery(&quot;.filename:empty&quot;,a).remove();jQuery(&quot;.filename&quot;,a).append('&lt;span class=&quot;trashnotice&quot;&gt; '+swfuploadL10n.deleted+&quot; &lt;/span&gt;&quot;).siblings(&quot;a.toggle&quot;).hide();jQuery(&quot;.filename&quot;,a).append(jQuery(&quot;a.undo&quot;,a).removeClass(&quot;hidden&quot;));jQuery(&quot;.menu_order_input&quot;,a).hide();return}function deleteError(c,b,a){}function updateMediaForm(){var b=jQuery(&quot;form.type-form #media-items&quot;).children(),a=jQuery(&quot;#media-items&quot;).children();storeState();if(b.length==1){jQuery(&quot;.slidetoggle&quot;,b).slideDown(500).siblings().addClass(&quot;hidden&quot;).filter(&quot;.toggle&quot;).toggle()}if(a.not(&quot;.media-blank&quot;).length&gt;0){jQuery(&quot;.savebutton&quot;).show()}else{jQuery(&quot;.savebutton&quot;).hide()}if(a.length&gt;1){jQuery(&quot;.insert-gallery&quot;).show()}else{jQuery(&quot;.insert-gallery&quot;).hide()}}function uploadSuccess(b,a){if(a.match(&quot;media-upload-error&quot;)){jQuery(&quot;#media-item-&quot;+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery(&quot;#media-item-&quot;+b.id).hasClass(&quot;child-of-&quot;+post_id)){jQuery(&quot;#attachments-count&quot;).text(1*jQuery(&quot;#attachments-count&quot;).text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery(&quot;#cancel-upload&quot;).attr(&quot;disabled&quot;,&quot;disabled&quot;);jQuery(&quot;#insert-gallery&quot;).attr(&quot;disabled&quot;,&quot;&quot;)}}function wpQueueError(a){jQuery(&quot;#media-upload-error&quot;).show().text(a)}function wpFileError(b,a){jQuery(&quot;#media-item-&quot;+b.id+&quot; .filename&quot;).after('&lt;div class=&quot;file-error&quot;&gt;&lt;button type=&quot;button&quot; id=&quot;dismiss-'+b.id+'&quot; class=&quot;button dismiss&quot;&gt;'+swfuploadL10n.dismiss+&quot;&lt;/button&gt;&quot;+a+&quot;&lt;/div&gt;&quot;).siblings(&quot;.toggle&quot;).remove();jQuery(&quot;#dismiss-&quot;+b.id).click(function(){jQuery(this).parents(&quot;.media-item&quot;).slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b&gt;0){this.startUpload()}}catch(a){this.debug(a)}}function switchUploader(b){var c=document.getElementById(swfu.customSettings.swfupload_element_id),a=document.getElementById(swfu.customSettings.degraded_element_id);if(b){c.style.display=&quot;block&quot;;a.style.display=&quot;none&quot;}else{c.style.display=&quot;none&quot;;a.style.display=&quot;block&quot;}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(&quot;.upload-html-bypass&quot;).hide()}function uploadError(b,c,a){switch(c){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(b,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(b,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery(&quot;#media-item-&quot;+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}var storeState;(function(a){storeState=function(){var c=getUserSetting(&quot;align&quot;)||&quot;&quot;,b=getUserSetting(&quot;imgsize&quot;)||&quot;&quot;;a('tr.align input[type=&quot;radio&quot;]').click(function(){setUserSetting(&quot;align&quot;,a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr(&quot;checked&quot;,&quot;checked&quot;);a('tr.image-size input[type=&quot;radio&quot;]').click(function(){setUserSetting(&quot;imgsize&quot;,a(this).val())}).filter(function(){if(a(this).attr(&quot;disabled&quot;)||a(this).val()!=b){return false}return true}).attr(&quot;checked&quot;,&quot;checked&quot;);a(&quot;tr.url button&quot;).click(function(){var d=this.className||&quot;&quot;;d=d.replace(/.*?(url[^ '&quot;]+).*/,&quot;$1&quot;);if(d){setUserSetting(&quot;urlbutton&quot;,d)}a(this).siblings(&quot;.urlfield&quot;).val(a(this).attr(&quot;title&quot;))});a(&quot;tr.url .urlfield&quot;).each(function(){var d=getUserSetting(&quot;urlbutton&quot;);a(this).val(a(this).siblings(&quot;button.&quot;+d).attr(&quot;title&quot;))})}})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-includes/post.php        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -1251,6 +1251,9 @@
</span><span class="cx">         if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
</span><span class="cx">                 return $post;
</span><span class="cx"> 
</span><ins>+        if ( $post['post_status'] == 'trash' )
+                return false;
+
</ins><span class="cx">         do_action('trash_post', $post_id);
</span><span class="cx"> 
</span><span class="cx">         add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
</span><span class="lines">@@ -1278,6 +1281,9 @@
</span><span class="cx">         if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
</span><span class="cx">                 return $post;
</span><span class="cx"> 
</span><ins>+        if ( $post['post_status'] != 'trash' )
+                return false;
+
</ins><span class="cx">         do_action('untrash_post', $post_id);
</span><span class="cx"> 
</span><span class="cx">         $post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12129 => 12130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-10-30 00:18:15 UTC (rev 12129)
+++ trunk/wp-includes/script-loader.php        2009-10-30 07:09:55 UTC (rev 12130)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'swfupload-handlers', &quot;/wp-includes/js/swfupload/handlers$suffix.js&quot;, array('swfupload-all', 'jquery'), '2201-20090818');
</del><ins>+        $scripts-&gt;add( 'swfupload-handlers', &quot;/wp-includes/js/swfupload/handlers$suffix.js&quot;, array('swfupload-all', 'jquery'), '2201-20091029');
</ins><span class="cx">         $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) &lt; (int) ( $max_post = @ini_get('post_max_size') ) ) ? $max_up : $max_post;
</span><span class="cx">         if ( empty($max_upload_size) )
</span><span class="cx">                 $max_upload_size = __('not configured');
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">                         'upload_stopped' =&gt; __('Upload stopped.'),
</span><span class="cx">                         'dismiss' =&gt; __('Dismiss'),
</span><span class="cx">                         'crunching' =&gt; __('Crunching&amp;hellip;'),
</span><del>-                        'deleted' =&gt; __('Moved to Trash'),
</del><ins>+                        'deleted' =&gt; __('moved to the trash.'),
</ins><span class="cx">                         'l10n_print_after' =&gt; 'try{convertEntities(swfuploadL10n);}catch(e){};'
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="lines">@@ -433,7 +433,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(), '20091023' );
</del><ins>+        $styles-&gt;add( 'media', &quot;/wp-admin/css/media$suffix.css&quot;, array(), '20091029' );
</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>