<!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( "{$action}_$id" );
</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( "{$action}_$id" );
</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:"Lucida Grande","Bitstream Vera Sans",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="text"],.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:"Lucida Grande","Bitstream Vera Sans",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,"Times New Roman",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:"Lucida Grande","Bitstream Vera Sans",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="text"],.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:"Lucida Grande","Bitstream Vera Sans",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,"Times New Roman",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' => array(),
</span><span class="cx">         );
</span><span class="cx">
</span><del>-        $delete_href = wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id);
</del><ins>+        $trash_href = wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id);
+        $untrash_href = wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id);
</ins><span class="cx">         if ( $send )
</span><span class="cx">                 $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
</span><span class="cx">         if ( $delete )
</span><del>-                $delete = current_user_can('delete_post', $attachment_id) ? "<a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a>" : "";
</del><ins>+                $delete = current_user_can('delete_post', $attachment_id) ? "<a href=\"$trash_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"$untrash_href\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo?') . "</a>" : "";
</ins><span class="cx">         if ( 'image' == $type && get_post_image_id($_GET['post_id']) != $attachment_id )
</span><span class="cx">                 $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
</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>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
</del><ins>+        if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 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('<div id="media-item-' + fileObj.id + '" class="media-item child-of-' + post_id + '"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> ' + fileObj.name + '</div></div>');
</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('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
</del><ins>+                jQuery('.bar', item).html('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
</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 "pinkynail" -- 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>*').length == 1 && jQuery('#media-items .hidden').length > 0 ) {
</del><ins>+        if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 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(' <span class="file-error">'+swfuploadL10n.deleted+'</span>').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('<span class="trashnotice"> ' + swfuploadL10n.deleted + ' </span>').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>*').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>*').not('.media-blank').length > 0 )
</del><ins>+        if ( items.not('.media-blank').length > 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>*').length > 1 )
</del><ins>+        if ( items.length > 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("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+a.name+"</div></div>");jQuery("#media-item-"+a.id+" .progress").show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(a){return true}function uploadProgress(d,b,c){var a=jQuery("#media-items").width()-2;jQuery("#media-item-"+d.id+" .bar").width(a*b/c);jQuery("#media-item-"+d.id+" .percent").html(Math.ceil(b/c*100)+"%");if(b==c){jQuery("#media-item-"+d.id+" .bar").html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(b,a){jQuery("#media-item-"+b.id+" .bar").remove();jQuery("#media-item-"+b.id+" .progress").hide();var c=(typeof shortform=="undefined")?1:2;if(isNaN(a)||!a){jQuery("#media-item-"+b.id).append(a);prepareMediaItemInit(b)}else{jQuery("#media-item-"+b.id).load("async-upload.php",{attachment_id:a,fetch:c},function(){prepareMediaItemInit(b);updateMediaForm()})}}function prepareMediaItemInit(a){jQuery("#media-item-"+a.id+" .thumbnail").clone().attr("className","pinkynail toggle").prependTo("#media-item-"+a.id);jQuery("#media-item-"+a.id+" .filename.original").replaceWith(jQuery("#media-item-"+a.id+" .filename.new"));jQuery("#media-item-"+a.id+" a.toggle").click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(150,function(){var b=jQuery(this).offset();window.scrollTo(0,b.top-36)});jQuery(this).parent().children(".toggle").toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("#media-item-"+a.id+" a.delete").click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:a.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("#media-item-"+a.id+".startopen").removeClass("startopen").slideToggle(500).parent().children(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,c){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var a=jQuery("#media-item-"+this.id);if(type=jQuery("#type-of-"+this.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery(".type-form #media-items>*").length==1&&jQuery("#media-items .hidden").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-item-"+this.id+" .filename:empty").remove();jQuery("#media-item-"+this.id+" .filename").append(' <span class="file-error">'+swfuploadL10n.deleted+"</span>").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()});return}function deleteError(c,b,a){}function updateMediaForm(){storeState();if(jQuery(".type-form #media-items>*").length==1){jQuery("#media-items .slidetoggle").slideDown(500).parent().eq(0).children(".toggle").toggle();jQuery(".type-form .slidetoggle").siblings().addClass("hidden")}if(jQuery("#media-items>*").not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(jQuery("#media-items>*").length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").attr("disabled","disabled");jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").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>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="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").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("#media-item-"+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery("#media-items").append('<div id="media-item-'+a.id+'" class="media-item child-of-'+post_id+'"><div class="progress"><div class="bar"></div></div><div class="filename original"><span class="percent"></span> '+a.name+"</div></div>");jQuery(".progress","#media-item-"+a.id).show();jQuery("#insert-gallery").attr("disabled","disabled");jQuery("#cancel-upload").attr("disabled","")}function uploadStart(a){return true}function uploadProgress(e,b,d){var a=jQuery("#media-items").width()-2,c=jQuery("#media-item-"+e.id);jQuery(".bar",c).width(a*b/d);jQuery(".percent",c).html(Math.ceil(b/d*100)+"%");if(b==d){jQuery(".bar",c).html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(c,a){var d=(typeof shortform=="undefined")?1:2,b=jQuery("#media-item-"+c.id);jQuery(".bar",b).remove();jQuery(".progress",b).hide();if(isNaN(a)||!a){b.append(a);prepareMediaItemInit(c)}else{b.load("async-upload.php",{attachment_id:a,fetch:d},function(){prepareMediaItemInit(c);updateMediaForm()})}}function prepareMediaItemInit(b){var a=jQuery("#media-item-"+b.id);jQuery(".thumbnail",a).clone().attr("className","pinkynail toggle").prependTo(a);jQuery(".filename.original",a).replaceWith(jQuery(".filename.new",a));jQuery("a.toggle",a).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var c=jQuery(this).offset();window.scrollTo(0,c.top-36)});jQuery(this).siblings(".toggle").andSelf().toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("a.delete",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",success:deleteSuccess,error:deleteError,id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("a.undo",a).click(function(){jQuery.ajax({url:"admin-ajax.php",type:"post",id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(d,e){var c=jQuery("#media-item-"+b.id);if(type=jQuery("#type-of-"+b.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1)}if(c.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1)}jQuery(".filename .trashnotice",c).remove();jQuery("a.undo",c).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",c).show();c.animate({backgroundColor:"#fff"},{queue:false,duration:200,complete:function(){jQuery(this).css({backgroundColor:""})}})}});return false});jQuery("#media-item-"+b.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function itemAjaxError(c,b){var a=jQuery("#media-item-error"+c);a.html('<div class="file-error"><button type="button" id="dismiss-'+c+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+b+"</div>");jQuery("#dismiss-"+c).click(function(){jQuery(this).parents(".file-error").slideUp(200,function(){jQuery(this).empty()})})}function deleteSuccess(b,d){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var c=this.id,a=jQuery("#media-item-"+c);if(type=jQuery("#type-of-"+c).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery(".toggle",a).toggle();jQuery(".slidetoggle",a).slideUp(200).siblings().removeClass("hidden");a.css({backgroundColor:"#fff"}).animate({backgroundColor:"#ffc0c0"},{queue:false,duration:500});jQuery(".filename:empty",a).remove();jQuery(".filename",a).append('<span class="trashnotice"> '+swfuploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",a).append(jQuery("a.undo",a).removeClass("hidden"));jQuery(".menu_order_input",a).hide();return}function deleteError(c,b,a){}function updateMediaForm(){var b=jQuery("form.type-form #media-items").children(),a=jQuery("#media-items").children();storeState();if(b.length==1){jQuery(".slidetoggle",b).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle()}if(a.not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(a.length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").attr("disabled","disabled");jQuery("#insert-gallery").attr("disabled","")}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(b,a){jQuery("#media-item-"+b.id+" .filename").after('<div class="file-error"><button type="button" id="dismiss-'+b.id+'" class="button dismiss">'+swfuploadL10n.dismiss+"</button>"+a+"</div>").siblings(".toggle").remove();jQuery("#dismiss-"+b.id).click(function(){jQuery(this).parents(".media-item").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>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="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").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("#media-item-"+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}var storeState;(function(a){storeState=function(){var c=getUserSetting("align")||"",b=getUserSetting("imgsize")||"";a('tr.align input[type="radio"]').click(function(){setUserSetting("align",a(this).val())}).filter(function(){if(a(this).val()==c){return true}return false}).attr("checked","checked");a('tr.image-size input[type="radio"]').click(function(){setUserSetting("imgsize",a(this).val())}).filter(function(){if(a(this).attr("disabled")||a(this).val()!=b){return false}return true}).attr("checked","checked");a("tr.url button").click(function(){var d=this.className||"";d=d.replace(/.*?(url[^ '"]+).*/,"$1");if(d){setUserSetting("urlbutton",d)}a(this).siblings(".urlfield").val(a(this).attr("title"))});a("tr.url .urlfield").each(function(){var d=getUserSetting("urlbutton");a(this).val(a(this).siblings("button."+d).attr("title"))})}})(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->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090818');
</del><ins>+        $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20091029');
</ins><span class="cx">         $max_upload_size = ( (int) ( $max_up = @ini_get('upload_max_filesize') ) < (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' => __('Upload stopped.'),
</span><span class="cx">                         'dismiss' => __('Dismiss'),
</span><span class="cx">                         'crunching' => __('Crunching&hellip;'),
</span><del>-                        'deleted' => __('Moved to Trash'),
</del><ins>+                        'deleted' => __('moved to the trash.'),
</ins><span class="cx">                         'l10n_print_after' => '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->add_data( 'colors-classic', 'rtl', true );
</span><span class="cx">
</span><span class="cx">         $styles->add( 'global', "/wp-admin/css/global$suffix.css", array(), '20090630' );
</span><del>-        $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20091023' );
</del><ins>+        $styles->add( 'media', "/wp-admin/css/media$suffix.css", array(), '20091029' );
</ins><span class="cx">         $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array(), '20090603' );
</span><span class="cx">         $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css", array(), '20090514' );
</span><span class="cx">         $styles->add( 'install', "/wp-admin/css/install$suffix.css", array(), '20090514' );
</span></span></pre>
</div>
</div>
</body>
</html>