r43046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43045‎ | r43046 | r43047 >
Date:22:56, 1 November 2008
Author:brion
Status:old
Tags:
Comment:
* proper num formatting for currency
* add USD conversion as a hover title for the lazy like me :D
Modified paths:
  • /trunk/extensions/ContributionReporting/ContributionHistory_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContributionReporting/ContributionHistory_body.php
@@ -97,12 +97,15 @@
9898 }
9999
100100 function formatAmount( $row ) {
 101+ global $wgLang;
 102+ $converted = $row['converted_amount'];
 103+
101104 if ( $row['original_currency'] ) {
102105 $currency = $row['original_currency'];
103106 $amount = $row['original_amount'];
104107 } else {
105108 $currency = 'USD';
106 - $amount = $row['converted_amount'];
 109+ $amount = $converted;
107110 }
108111
109112 if ( $currency == 'JPY' ) {
@@ -110,6 +113,8 @@
111114 $amount = intval( $amount );
112115 }
113116
114 - return htmlspecialchars( "$currency $amount" );
 117+ return Xml::element( 'span',
 118+ array( 'title' => "USD " . $this->lang->formatNum( $converted ) ),
 119+ "$currency " . $this->lang->formatNum( $amount ) );
115120 }
116121 }

Status & tagging log