r65312 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65311‎ | r65312 | r65313 >
Date:13:52, 20 April 2010
Author:jojo
Status:resolved (Comments)
Tags:
Comment:
show progress with 2 decimals. fix number formatting in JS code.
Modified paths:
  • /trunk/extensions/Collection/Collection.php (modified) (history)
  • /trunk/extensions/Collection/Collection.templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.php
@@ -177,11 +177,16 @@
178178 $wgAjaxExportList[] = 'wfAjaxPostCollection';
179179
180180 function wfAjaxGetMWServeStatus( $collection_id = '', $writer = 'rl' ) {
 181+ global $wgLang;
 182+
181183 $json = new Services_JSON();
182184 $result = SpecialCollection::mwServeCommand( 'render_status', array(
183185 'collection_id' => $collection_id,
184186 'writer' => $writer
185187 ) );
 188+ if ( isset( $result['status']['progress'] ) ) {
 189+ $result['status']['progress'] = $wgLang->parseFormattedNumber( number_format( $result['status']['progress'], 2 ) );
 190+ }
186191 $r = new AjaxResponse( $json->encode( $result ) );
187192 $r->setContentType( 'application/json' );
188193 return $r;
Index: trunk/extensions/Collection/Collection.templates.php
@@ -349,7 +349,7 @@
350350 <span style="display:none" id="renderingArticle"><?php echo ' ' . wfMsg( 'coll-rendering_article', '%PARAM%' ) ?></span>
351351 <span style="display:none" id="renderingPage"><?php echo ' ' . wfMsg( 'coll-rendering_page', '%PARAM%' ) ?></span>
352352
353 -<?php echo wfMsg( 'coll-rendering_text', $GLOBALS['wgLang']->formatNum( $this->data['progress'] ), $this->data['status'] ) ?>
 353+<?php echo wfMsg( 'coll-rendering_text', $GLOBALS['wgLang']->parseFormattedNumber( number_format( $this->data['progress'], 2 ) ), $this->data['status'] ) ?>
354354
355355 <?php
356356 if ( CollectionSession::isEnabled() ) {

Comments

#Comment by Nikerabbit (talk | contribs)   14:47, 20 April 2010

Language::parseFormattedNumber expects input that is formatted with Language::formatNum in the same language. It is not suitable for use with number_format. Use either sprintf or number_format($number, 2, '.', '');.


#Comment by Jbeigel (talk | contribs)   12:29, 21 April 2010

OK, thanks for pointing that out! It's fixed in r65377.

Status & tagging log