<!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>[16429] trunk: Differentiate between localized and raw total pages.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16429">16429</a></dd>
<dt>Author</dt> <dd>scribu</dd>
<dt>Date</dt> <dd>2010-11-17 17:03:27 +0000 (Wed, 17 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Differentiate between localized and raw total pages. See <a href="http://trac.wordpress.org/ticket/14579">#14579</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesclasswplisttablephp">trunk/wp-admin/includes/class-wp-list-table.php</a></li>
<li><a href="#trunkwpadminjslisttabledevjs">trunk/wp-admin/js/list-table.dev.js</a></li>
<li><a href="#trunkwpadminjslisttablejs">trunk/wp-admin/js/list-table.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesclasswplisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-list-table.php (16428 => 16429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-list-table.php        2010-11-17 16:58:15 UTC (rev 16428)
+++ trunk/wp-admin/includes/class-wp-list-table.php        2010-11-17 17:03:27 UTC (rev 16429)
</span><span class="lines">@@ -809,10 +809,12 @@
</span><span class="cx">                 $response = array( 'rows' =&gt; $rows );
</span><span class="cx"> 
</span><span class="cx">                 if ( isset( $total_items ) )
</span><del>-                        $response['total_items'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
</del><ins>+                        $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
</ins><span class="cx"> 
</span><del>-                if ( isset( $total_pages ) )
</del><ins>+                if ( isset( $total_pages ) ) {
</ins><span class="cx">                         $response['total_pages'] = $total_pages;
</span><ins>+                        $response['total_pages_i18n'] = number_format_i18n( $total_pages );
+                }
</ins><span class="cx"> 
</span><span class="cx">                 die( json_encode( $response ) );
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpadminjslisttabledevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/list-table.dev.js (16428 => 16429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/list-table.dev.js        2010-11-17 16:58:15 UTC (rev 16428)
+++ trunk/wp-admin/js/list-table.dev.js        2010-11-17 17:03:27 UTC (rev 16429)
</span><span class="lines">@@ -22,8 +22,8 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         // paging
</span><del>-        set_total_pages: function() {
-                this.total_pages = parseInt($('.total-pages').eq(0).text());
</del><ins>+        set_total_pages: function(num) {
+                this.total_pages = num || $.query.load( $('.last-page').attr('href') ).get('paged');
</ins><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         get_total_pages: function() {
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         change_page: function(paged) {
</span><del>-                if ( paged &lt; 1 || paged &gt;this.total_pages )
</del><ins>+                if ( paged &lt; 1 || paged &gt; this.total_pages )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><span class="cx">                 this.update_rows({'paged': paged});
</span><span class="lines">@@ -104,10 +104,10 @@
</span><span class="cx"> 
</span><span class="cx">                         this.$tbody.html(response.rows);
</span><span class="cx"> 
</span><del>-                        $('.displaying-num').html(response.total_items);
</del><ins>+                        $('.displaying-num').html(response.total_items_i18n);
+                        $('.total-pages').html(response.total_pages_i18n);
</ins><span class="cx"> 
</span><del>-                        $('.total-pages').html(response.total_pages);
-                        this.set_total_pages();
</del><ins>+                        this.set_total_pages(response.total_pages);
</ins><span class="cx"> 
</span><span class="cx">                         $('.current-page').val($.query.GET('paged'));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminjslisttablejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/list-table.js (16428 => 16429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/list-table.js        2010-11-17 16:58:15 UTC (rev 16428)
+++ trunk/wp-admin/js/list-table.js        2010-11-17 17:03:27 UTC (rev 16429)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(document).ready(function(a){window.listTable={init:function(){this.loading=false;a(&quot;form&quot;).each(function(){this.reset()});if(&quot;&quot;==a.query.GET(&quot;paged&quot;)){a.query.SET(&quot;paged&quot;,1)}this.set_total_pages();this.$tbody=a(&quot;#the-list, #the-comment-list&quot;);this.$overlay=a('&lt;div id=&quot;loading-items&gt;').html(listTableL10n.loading).hide().prependTo(a(&quot;body&quot;))},set_total_pages:function(){this.total_pages=parseInt(a(&quot;.total-pages&quot;).eq(0).text())},get_total_pages:function(){return this.total_pages},change_page:function(c){if(c&lt;1||c&gt;this.total_pages){return false}this.update_rows({paged:c})},htmlencode:function(c){return a(&quot;&lt;div/&gt;&quot;).text(c).html()},update_rows:function(d,c,g){if(this.loading){return false}var f=false,e={};a.each(d,function(h,i){if(i!=a.query.GET(h)){a.query.SET(h,i);f=true}});if(!f){return false}this.show_overlay();if(c){a.query.SET(&quot;paged&quot;,1)}a.each(a.query.get(),function(h,i){if(true===i){e[h]=&quot;&quot;}else{e[h]=i}});this._callback=g;this.fetch_list(e,a.proxy(this,&quot;handle_success&quot;),a.proxy(this,&quot;handle_error&quot;));return true},fetch_list:function(d,e,c){d=a.extend(d,{action:&quot;fetch-list&quot;,list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:&quot;json&quot;,data:d,success:e,error:c})},handle_success:function(c){if(&quot;object&quot;!=typeof c){this.handle_error()}else{this.hide_overlay();this.$tbody.html(c.rows);a(&quot;.displaying-num&quot;).html(c.total_items);a(&quot;.total-pages&quot;).html(c.total_pages);this.set_total_pages();a(&quot;.current-page&quot;).val(a.query.GET(&quot;paged&quot;));a(&quot;th.column-cb :input&quot;).attr(&quot;checked&quot;,false);if(this._callback){this._callback()}}},handle_error:function(){this.hide_overlay();a(&quot;h2&quot;).after('&lt;div class=&quot;error ajax below-h2&quot;&gt;&lt;p&gt;'+listTableL10n.error+&quot;&lt;/p&gt;&lt;/div&gt;&quot;)},show_overlay:function(){this.loading=true;a(&quot;.error.ajax&quot;).remove();this.$overlay.css({width:this.$tbody.width()+&quot;px&quot;,height:this.$tbody.height()-20+&quot;px&quot;}).css(this.$tbody.offset()).show()},hide_overlay:function(){this.loading=false;this.$overlay.hide()}};listTable.init();a(&quot;.tablenav-pages a&quot;).click(function(){var c=a.query.GET(&quot;paged&quot;);switch(a(this).attr(&quot;class&quot;)){case&quot;first-page&quot;:c=1;break;case&quot;prev-page&quot;:c-=1;break;case&quot;next-page&quot;:c+=1;break;case&quot;last-page&quot;:c=listTable.get_total_pages();break}listTable.change_page(c);return false});a(&quot;.current-page&quot;).keypress(function(c){if(13!=c.keyCode){return}listTable.change_page(parseInt(a(this).val()));return false});a(&quot;th a&quot;).click(function(){var e=a.query.GET(&quot;orderby&quot;),c=a.query.GET(&quot;order&quot;),d=a(this).parent(&quot;th&quot;);if(d.hasClass(&quot;sortable&quot;)){e=a.query.load(a(this).attr(&quot;href&quot;)).get(&quot;orderby&quot;);c=&quot;asc&quot;;a(&quot;th.sorted-desc, th.sorted-asc&quot;).removeClass(&quot;sorted-asc&quot;).removeClass(&quot;sorted-desc&quot;).addClass(&quot;sortable&quot;);d.removeClass(&quot;sortable&quot;).addClass(&quot;sorted-asc&quot;)}else{if(d.hasClass(&quot;sorted-asc&quot;)){c=&quot;desc&quot;;d.removeClass(&quot;sorted-asc&quot;).addClass(&quot;sorted-desc&quot;)}else{if(d.hasClass(&quot;sorted-desc&quot;)){c=&quot;asc&quot;;d.removeClass(&quot;sorted-desc&quot;).addClass(&quot;sorted-asc&quot;)}}}listTable.update_rows({orderby:e,order:c},true);return false});function b(c){if(&quot;keypress&quot;==c.type&amp;&amp;13!=c.keyCode){return}c.preventDefault();c.stopImmediatePropagation();var d=a(this).parent(&quot;.search-box&quot;).find(&quot;:input&quot;).serializeObject();listTable.update_rows(d,true,function(){a(&quot;h2 .subtitle&quot;).remove();if(d.s){a(&quot;h2&quot;).append(a('&lt;span class=&quot;subtitle&quot;&gt;').html(listTableL10n.search.replace(&quot;%s&quot;,this.htmlencode(d.s))))}})}a(&quot;.search-box :submit&quot;).click(b);a(&quot;.search-box :text&quot;).keypress(b);a(&quot;#post-query-submit&quot;).click(function(){var c={};a(this).parents(&quot;.actions&quot;).find('select[name!=&quot;action&quot;]').each(function(){var d=a(this);c[d.attr(&quot;name&quot;)]=d.val()});listTable.update_rows(c,true);return false});a(&quot;.view-switch a&quot;).click(function(){var c=a(this);listTable.update_rows({mode:a.query.load(c.attr(&quot;href&quot;)).get(&quot;mode&quot;)},false,function(){a(&quot;.view-switch .current&quot;).removeClass(&quot;current&quot;);c.addClass(&quot;current&quot;)});return false})});
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function(a){window.listTable={init:function(){this.loading=false;a(&quot;form&quot;).each(function(){this.reset()});if(&quot;&quot;==a.query.GET(&quot;paged&quot;)){a.query.SET(&quot;paged&quot;,1)}this.set_total_pages();this.$tbody=a(&quot;#the-list, #the-comment-list&quot;);this.$overlay=a('&lt;div id=&quot;loading-items&gt;').html(listTableL10n.loading).hide().prependTo(a(&quot;body&quot;))},set_total_pages:function(c){this.total_pages=c||a.query.load(a(&quot;.last-page&quot;).attr(&quot;href&quot;)).get(&quot;paged&quot;)},get_total_pages:function(){return this.total_pages},change_page:function(c){if(c&lt;1||c&gt;this.total_pages){return false}this.update_rows({paged:c})},htmlencode:function(c){return a(&quot;&lt;div/&gt;&quot;).text(c).html()},update_rows:function(d,c,g){if(this.loading){return false}var f=false,e={};a.each(d,function(h,i){if(i!=a.query.GET(h)){a.query.SET(h,i);f=true}});if(!f){return false}this.show_overlay();if(c){a.query.SET(&quot;paged&quot;,1)}a.each(a.query.get(),function(h,i){if(true===i){e[h]=&quot;&quot;}else{e[h]=i}});this._callback=g;this.fetch_list(e,a.proxy(this,&quot;handle_success&quot;),a.proxy(this,&quot;handle_error&quot;));return true},fetch_list:function(d,e,c){d=a.extend(d,{action:&quot;fetch-list&quot;,list_args:list_args});a.ajax({url:ajaxurl,global:false,dataType:&quot;json&quot;,data:d,success:e,error:c})},handle_success:function(c){if(&quot;object&quot;!=typeof c){this.handle_error()}else{this.hide_overlay();this.$tbody.html(c.rows);a(&quot;.displaying-num&quot;).html(c.total_items_i18n);a(&quot;.total-pages&quot;).html(c.total_pages_i18n);this.set_total_pages(c.total_pages);a(&quot;.current-page&quot;).val(a.query.GET(&quot;paged&quot;));a(&quot;th.column-cb :input&quot;).attr(&quot;checked&quot;,false);if(this._callback){this._callback()}}},handle_error:function(){this.hide_overlay();a(&quot;h2&quot;).after('&lt;div class=&quot;error ajax below-h2&quot;&gt;&lt;p&gt;'+listTableL10n.error+&quot;&lt;/p&gt;&lt;/div&gt;&quot;)},show_overlay:function(){this.loading=true;a(&quot;.error.ajax&quot;).remove();this.$overlay.css({width:this.$tbody.width()+&quot;px&quot;,height:this.$tbody.height()-20+&quot;px&quot;}).css(this.$tbody.offset()).show()},hide_overlay:function(){this.loading=false;this.$overlay.hide()}};listTable.init();a(&quot;.tablenav-pages a&quot;).click(function(){var c=a.query.GET(&quot;paged&quot;);switch(a(this).attr(&quot;class&quot;)){case&quot;first-page&quot;:c=1;break;case&quot;prev-page&quot;:c-=1;break;case&quot;next-page&quot;:c+=1;break;case&quot;last-page&quot;:c=listTable.get_total_pages();break}listTable.change_page(c);return false});a(&quot;.current-page&quot;).keypress(function(c){if(13!=c.keyCode){return}listTable.change_page(parseInt(a(this).val()));return false});a(&quot;th a&quot;).click(function(){var e=a.query.GET(&quot;orderby&quot;),c=a.query.GET(&quot;order&quot;),d=a(this).parent(&quot;th&quot;);if(d.hasClass(&quot;sortable&quot;)){e=a.query.load(a(this).attr(&quot;href&quot;)).get(&quot;orderby&quot;);c=&quot;asc&quot;;a(&quot;th.sorted-desc, th.sorted-asc&quot;).removeClass(&quot;sorted-asc&quot;).removeClass(&quot;sorted-desc&quot;).addClass(&quot;sortable&quot;);d.removeClass(&quot;sortable&quot;).addClass(&quot;sorted-asc&quot;)}else{if(d.hasClass(&quot;sorted-asc&quot;)){c=&quot;desc&quot;;d.removeClass(&quot;sorted-asc&quot;).addClass(&quot;sorted-desc&quot;)}else{if(d.hasClass(&quot;sorted-desc&quot;)){c=&quot;asc&quot;;d.removeClass(&quot;sorted-desc&quot;).addClass(&quot;sorted-asc&quot;)}}}listTable.update_rows({orderby:e,order:c},true);return false});function b(c){if(&quot;keypress&quot;==c.type&amp;&amp;13!=c.keyCode){return}c.preventDefault();c.stopImmediatePropagation();var d=a(this).parent(&quot;.search-box&quot;).find(&quot;:input&quot;).serializeObject();listTable.update_rows(d,true,function(){a(&quot;h2 .subtitle&quot;).remove();if(d.s){a(&quot;h2&quot;).append(a('&lt;span class=&quot;subtitle&quot;&gt;').html(listTableL10n.search.replace(&quot;%s&quot;,this.htmlencode(d.s))))}})}a(&quot;.search-box :submit&quot;).click(b);a(&quot;.search-box :text&quot;).keypress(b);a(&quot;#post-query-submit&quot;).click(function(){var c={};a(this).parents(&quot;.actions&quot;).find('select[name!=&quot;action&quot;]').each(function(){var d=a(this);c[d.attr(&quot;name&quot;)]=d.val()});listTable.update_rows(c,true);return false});a(&quot;.view-switch a&quot;).click(function(){var c=a(this);listTable.update_rows({mode:a.query.load(c.attr(&quot;href&quot;)).get(&quot;mode&quot;)},false,function(){a(&quot;.view-switch .current&quot;).removeClass(&quot;current&quot;);c.addClass(&quot;current&quot;)});return false})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (16428 => 16429)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-11-17 16:58:15 UTC (rev 16428)
+++ trunk/wp-includes/script-loader.php        2010-11-17 17:03:27 UTC (rev 16429)
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx">                 $scripts-&gt;add( 'theme-preview', &quot;/wp-admin/js/theme-preview$suffix.js&quot;, array( 'thickbox', 'jquery' ), '20100407' );
</span><span class="cx">                 $scripts-&gt;add_data( 'theme-preview', 'group', 1 );
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'list-table', &quot;/wp-admin/js/list-table$suffix.js&quot;, array( 'jquery-query', 'jquery-serialize-object' ), '20101106' );
</del><ins>+                $scripts-&gt;add( 'list-table', &quot;/wp-admin/js/list-table$suffix.js&quot;, array( 'jquery-query', 'jquery-serialize-object' ), '20101117' );
</ins><span class="cx">                 $scripts-&gt;add_data( 'list-table', 'group', 1 );
</span><span class="cx">                 $scripts-&gt;localize( 'list-table', 'listTableL10n', array(
</span><span class="cx">                         'loading' =&gt; __('Loading...'),
</span></span></pre>
</div>
</div>

</body>
</html>