<!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>[12500] trunk:
Improve the revision comparison user interface to hilight that we compare
"old on left" to "new on right".</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12500">12500</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2009-12-23 09:15:13 +0000 (Wed, 23 Dec 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve the revision comparison user interface to hilight that we compare "old on left" to "new on right". Includes some js to hide the radio buttons to stop you selecting reverse comparisions.
Fixes <a href="http://trac.wordpress.org/ticket/11088">#11088</a> props filosofo.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminrevisionphp">trunk/wp-admin/revision.php</a></li>
<li><a href="#trunkwpincludesposttemplatephp">trunk/wp-includes/post-template.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpincludesjswplistrevisionsdevjs">trunk/wp-includes/js/wp-list-revisions.dev.js</a></li>
<li><a href="#trunkwpincludesjswplistrevisionsjs">trunk/wp-includes/js/wp-list-revisions.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminrevisionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/revision.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/revision.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-admin/revision.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -9,6 +9,8 @@
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><span class="cx"> require_once('admin.php');
</span><span class="cx">
</span><ins>+wp_enqueue_script('list-revisions');
+
</ins><span class="cx"> wp_reset_vars(array('revision', 'left', 'right', 'diff', 'action'));
</span><span class="cx"> $revision_id = absint($revision);
</span><span class="cx"> $diff = absint($diff);
</span></span></pre></div>
<a id="trunkwpincludesjswplistrevisionsdevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/wp-list-revisions.dev.js (0 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/wp-list-revisions.dev.js         (rev 0)
+++ trunk/wp-includes/js/wp-list-revisions.dev.js        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+(function(w) {
+        var init = function() {
+                var pr = document.getElementById('post-revisions'),
+                inputs = pr ? pr.getElementsByTagName('input') : [];
+                pr.onclick = function() {
+                        var i, checkCount = 0, side;
+                        for ( i = 0; i < inputs.length; i++ ) {
+                                checkCount += inputs[i].checked ? 1 : 0;
+                                side = inputs[i].getAttribute('name');
+                                if ( ! inputs[i].checked &&
+                                ( 'left' == side && 1 > checkCount || 'right' == side && 1 < checkCount && ( ! inputs[i-1] || ! inputs[i-1].checked ) ) &&
+                                ! ( inputs[i+1] && inputs[i+1].checked && 'right' == inputs[i+1].getAttribute('name') ) )
+                                        inputs[i].style.visibility = 'hidden';                
+                                else if ( 'left' == side || 'right' == side )
+                                        inputs[i].style.visibility = 'visible';
+                        }
+                }
+                pr.onclick();
+        }
+        if ( w && w.addEventListener )
+                w.addEventListener('load', init, false);
+        else if ( w && w.attachEvent )
+                w.attachEvent('onload', init);
+})(window);
</ins></span></pre></div>
<a id="trunkwpincludesjswplistrevisionsjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/wp-list-revisions.js (0 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/wp-list-revisions.js         (rev 0)
+++ trunk/wp-includes/js/wp-list-revisions.js        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+(function(a){var b=function(){var d=document.getElementById("post-revisions"),c=d?d.getElementsByTagName("input"):[];d.onclick=function(){var g,f=0,e;for(g=0;g<c.length;g++){f+=c[g].checked?1:0;e=c[g].getAttribute("name");if(!c[g].checked&&("left"==e&&1>f||"right"==e&&1<f&&(!c[g-1]||!c[g-1].checked))&&!(c[g+1]&&c[g+1].checked&&"right"==c[g+1].getAttribute("name"))){c[g].style.visibility="hidden"}else{if("left"==e||"right"==e){c[g].style.visibility="visible"}}}};d.onclick()};if(a&&a.addEventListener){a.addEventListener("load",b,false)}else{if(a&&a.attachEvent){a.attachEvent("onload",b)}}})(window);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post-template.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post-template.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-includes/post-template.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -1299,7 +1299,8 @@
</span><span class="cx">                                 $actions = '';
</span><span class="cx">
</span><span class="cx">                         $rows .= "<tr$class>\n";
</span><del>-                        $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
</del><ins>+                        $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked />\n";
+                        $rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
</ins><span class="cx">                         $rows .= "\t<td>$date</td>\n";
</span><span class="cx">                         $rows .= "\t<td>$name</td>\n";
</span><span class="cx">                         $rows .= "\t<td class='action-links'>$actions</td>\n";
</span><span class="lines">@@ -1323,14 +1324,16 @@
</span><span class="cx">
</span><span class="cx"> <br class="clear" />
</span><span class="cx">
</span><del>-<table class="widefat post-revisions" cellspacing="0">
</del><ins>+<table class="widefat post-revisions" cellspacing="0" id="post-revisions">
</ins><span class="cx">         <col />
</span><ins>+        <col />
</ins><span class="cx">         <col style="width: 33%" />
</span><span class="cx">         <col style="width: 33%" />
</span><span class="cx">         <col style="width: 33%" />
</span><span class="cx"> <thead>
</span><span class="cx"> <tr>
</span><del>-        <th scope="col"></th>
</del><ins>+        <th scope="col"><?php _e( 'Old' ); ?></th>
+        <th scope="col"><?php _e( 'New' ); ?></th>
</ins><span class="cx">         <th scope="col"><?php _e( 'Date Created' ); ?></th>
</span><span class="cx">         <th scope="col"><?php _e( 'Author' ); ?></th>
</span><span class="cx">         <th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12499 => 12500)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-12-23 09:10:26 UTC (rev 12499)
+++ trunk/wp-includes/script-loader.php        2009-12-23 09:15:13 UTC (rev 12500)
</span><span class="lines">@@ -373,6 +373,8 @@
</span><span class="cx">                 $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '20090102' );
</span><span class="cx">                 $scripts->add_data( 'hoverIntent', 'group', 1 );
</span><span class="cx">
</span><ins>+                $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js", null, '20091223' );
+
</ins><span class="cx">                 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), '20090415' );
</span><span class="cx">                 $scripts->add_data( 'media', 'group', 1 );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>