r104586 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104585‎ | r104586 | r104587 >
Date:20:22, 29 November 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionHistory_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionTrackingStatistics_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/DailyTotal_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/DisabledNotice_body.php (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics.css (deleted) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics.js (deleted) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/YearlyTotal_body.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/arrow.png (deleted) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/arrow.png (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.disablednotice.css (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.css (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.table.css (added) (history)
  • /branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/warning-icon.png (added) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics.css
@@ -1,103 +0,0 @@
2 -div#configholder {
3 - position: absolute;
4 - top: 22px;
5 - right: 0;
6 - z-index: 200;
7 - width: 180px;
8 - border: 1px solid silver;
9 - background-color: white;
10 - padding: 2px 5px 5px 5px;
11 - display: none;
12 -}
13 -div#configtoggle {
14 - position: absolute;
15 - top: 0;
16 - right: 0;
17 - z-index: 199;
18 - height: 17px;
19 - border: 1px solid silver;
20 - background-color: white;
21 - padding: 2px 5px 2px 0px;
22 - cursor: pointer;
23 -}
24 -div#configtoggle a, div#configtoggle a:visited {
25 - background-image: url("arrow.png");
26 - background-position: 0px -3px;
27 - background-repeat: no-repeat;
28 - padding-left: 16px;
29 - outline: 0;
30 -}
31 -
32 -.fundraiserstats-view-box {
33 - border: solid 1px silver;
34 -}
35 -.fundraiserstats-view-box h3 {
36 - margin-top: 0;
37 - padding-top: 0;
38 -}
39 -.fundraiserstats-today {
40 - position: absolute;
41 - width: 6px;
42 - height: 6px;
43 - background-color: black;
44 - margin-top: 3px;
45 - margin-left: -1px;
46 -}
47 -.fundraiserstats-bar {
48 - width: 2px;
49 -}
50 -.fundraiserstats-bar-2007 {
51 - background-color: #AAAAFF;
52 - border: outset 1px #AAAAFF;
53 -}
54 -.fundraiserstats-bar-2008 {
55 - background-color: #AAFFAA;
56 - border: outset 1px #AAFFAA;
57 -}
58 -.fundraiserstats-bar-2009 {
59 - background-color: #FFAAAA;
60 - border: outset 1px #FFAAAA;
61 -}
62 -.fundraiserstats-bar-2010 {
63 - background-color: #a0e8ff;
64 - border: outset 1px #a0e8ff;
65 -}
66 -.fundraiserstats-bar-2011 {
67 - background-color: #ffd617;
68 - border: outset 1px #ffd617;
69 -}
70 -.fundraiserstats-bar-space {
71 - width: 3px;
72 -}
73 -.fundraiserstats-chart {
74 - padding: 10px;
75 - border-left: solid 1px silver;
76 - border-right: solid 1px silver;
77 -}
78 -.fundraiserstats-chart-tabs {
79 - border-bottom: solid 1px silver;
80 - height: 24px;
81 -}
82 -.fundraiserstats-chart-tab-normal {
83 - padding-left: 6px;
84 - padding-right: 6px;
85 - border: solid 1px silver;
86 - float: left;
87 - line-height: 23px;
88 - height: 23px;
89 - margin-right: 6px;
90 - cursor: pointer;
91 - font-weight: bold;
92 -}
93 -.fundraiserstats-chart-tab-current {
94 - padding-left: 6px;
95 - padding-right: 6px;
96 - border: solid 1px silver;
97 - border-bottom-color: white;
98 - float: left;
99 - line-height: 23px;
100 - height: 23px;
101 - margin-right: 6px;
102 - cursor: pointer;
103 - font-weight: bold;
104 -}
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics.js
@@ -1,51 +0,0 @@
2 -/* JavaScript */
3 -
4 -$j( document ).ready( function() {
5 -
6 - var currentViewID = 'fundraiserstats-view-box-0';
7 - function replaceView( newLayerID ) {
8 - var currentLayer = document.getElementById( currentViewID );
9 - var newLayer = document.getElementById( newLayerID );
10 - currentLayer.style.display = 'none';
11 - newLayer.style.display = 'block';
12 - currentViewID = newLayerID;
13 - }
14 -
15 - var currentChartID = 'fundraiserstats-chart-totals';
16 - function replaceChart( newLayerID ) {
17 - var currentLayer = document.getElementById( currentChartID );
18 - var currentTab = document.getElementById( currentChartID + '-tab' );
19 - var newLayer = document.getElementById( newLayerID );
20 - var newTab = document.getElementById( newLayerID + '-tab' );
21 - currentLayer.style.display = 'none';
22 - currentTab.setAttribute( 'class', 'fundraiserstats-chart-tab-normal' );
23 - newLayer.style.display = 'block';
24 - newTab.setAttribute( 'class', 'fundraiserstats-chart-tab-current' );
25 - currentChartID = newLayerID;
26 - }
27 -
28 - $j( '.fundraiserstats-bar' ).hover( function() {
29 - replaceView( $j(this).attr( 'rel' ) )
30 - } );
31 - $j( '.fundraiserstats-chart-tab' ).click( function() {
32 - replaceChart( $j(this).attr( 'rel' ) )
33 - } );
34 - $j( '.fundraiserstats-current' ).each( function() {
35 - replaceView( $j(this).attr( 'rel' ) )
36 - } );
37 - $j( '#configholder .yeartoggle' ).click( function() {
38 - $j('.fundraiserstats-'+$j(this).attr( 'id' )).toggle();
39 - } );
40 - $j( '#configtoggle' ).click( function() {
41 - $j('#configholder').toggle();
42 - if ($j( '#configtoggle a' ).css( 'background-position' ) == '0px -18px') {
43 - $j( '#configtoggle a' ).css( 'background-position', '0px -3px' );
44 - } else {
45 - $j( '#configtoggle a' ).css( 'background-position','0px -18px' );
46 - }
47 - } );
48 - $j( '#timezone' ).change( function() {
49 - $j('#configform').submit();
50 - } );
51 -
52 -} );
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/arrow.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php
@@ -43,7 +43,9 @@
4444 $wgAutoloadClasses['SpecialContributionTrackingStatistics'] = $dir . 'ContributionTrackingStatistics_body.php';
4545 $wgAutoloadClasses['SpecialDailyTotal'] = $dir . 'DailyTotal_body.php';
4646 $wgAutoloadClasses['SpecialYearlyTotal'] = $dir . 'YearlyTotal_body.php';
 47+$wgAutoloadClasses['DisabledNotice'] = $dir . 'DisabledNotice_body.php';
4748
 49+/*
4850 $wgSpecialPages['ContributionHistory'] = 'ContributionHistory';
4951 $wgSpecialPages['ContributionTotal'] = 'ContributionTotal';
5052 $wgSpecialPages['ContributionStatistics'] = 'SpecialContributionStatistics';
@@ -51,14 +53,24 @@
5254 $wgSpecialPages['ContributionTrackingStatistics'] = 'SpecialContributionTrackingStatistics';
5355 $wgSpecialPages['DailyTotal'] = 'SpecialDailyTotal';
5456 $wgSpecialPages['YearlyTotal'] = 'SpecialYearlyTotal';
 57+*/
 58+
 59+// Temporarily redirect all pages to DisabledNotice
 60+$wgSpecialPages['DisabledNotice'] = 'DisabledNotice';
 61+$wgSpecialPages['ContributionHistory'] = 'DisabledNotice';
 62+$wgSpecialPages['ContributionTotal'] = 'DisabledNotice';
 63+$wgSpecialPages['ContributionStatistics'] = 'DisabledNotice';
 64+$wgSpecialPages['FundraiserStatistics'] = 'DisabledNotice';
 65+$wgSpecialPages['ContributionTrackingStatistics'] = 'DisabledNotice';
 66+$wgSpecialPages['DailyTotal'] = 'DisabledNotice';
 67+$wgSpecialPages['YearlyTotal'] = 'DisabledNotice';
 68+
5569 $wgSpecialPageGroups['ContributionHistory'] = 'contribution';
5670 $wgSpecialPageGroups['ContributionTotal'] = 'contribution';
5771 $wgSpecialPageGroups['ContributionStatistics'] = 'contribution';
5872 $wgSpecialPageGroups['FundraiserStatistics'] = 'contribution';
5973 $wgSpecialPageGroups['ContributionTrackingStatistics'] = 'contribution';
6074
61 -
62 -
6375 // Shortcut to this extension directory
6476 $dir = dirname( __FILE__ ) . '/';
6577
@@ -110,23 +122,52 @@
111123 // Cache timeout for fundraiser statistics, in seconds
112124 $egFundraiserStatisticsCacheTimeout = 900; // 15 minutes
113125
114 -
115126 $wgContributionTrackingStatisticsViewWeeks = 3;
116127
 128+$commonModuleInfo = array(
 129+ 'localBasePath' => dirname( __FILE__ ) . '/modules',
 130+ 'remoteExtPath' => 'ContributionReporting/modules',
 131+);
 132+
 133+$wgResourceModules['ext.fundraiserstatistics.table'] = array(
 134+ 'styles' => 'ext.fundraiserstatistics.table.css',
 135+) + $commonModuleInfo;
 136+
 137+$wgResourceModules['ext.fundraiserstatistics'] = array(
 138+ 'scripts' => 'ext.fundraiserstatistics.edit.js',
 139+ 'styles' => 'ext.fundraiserstatistics.css',
 140+) + $commonModuleInfo;
 141+
 142+$wgResourceModules['ext.disablednotice'] = array(
 143+ 'styles' => 'ext.disablednotice.css',
 144+) + $commonModuleInfo;
 145+
117146 $wgHooks['ParserFirstCallInit'][] = 'efContributionReportingSetup';
118147 $wgHooks['LanguageGetMagic'][] = 'efContributionReportingTotal_Magic';
119148
 149+/**
 150+ * @param $parser Parser
 151+ * @return bool
 152+ */
120153 function efContributionReportingSetup( $parser ) {
121154 $parser->setFunctionHook( 'contributiontotal', 'efContributionReportingTotal_Render' );
122155 return true;
123156 }
124157
 158+/**
 159+ * @param $magicWords array
 160+ * @param $langCode string
 161+ * @return bool
 162+ */
125163 function efContributionReportingTotal_Magic( &$magicWords, $langCode ) {
126164 $magicWords['contributiontotal'] = array( 0, 'contributiontotal' );
127165 return true;
128166 }
129167
130168 // Automatically use a local or special database connection
 169+/**
 170+ * @return DatabaseMysql
 171+ */
131172 function efContributionReportingConnection() {
132173 global $wgContributionReportingDBserver, $wgContributionReportingDBname;
133174 global $wgContributionReportingDBuser, $wgContributionReportingDBpassword;
@@ -145,6 +186,9 @@
146187 return $db;
147188 }
148189
 190+/**
 191+ * @return DatabaseMysql
 192+ */
149193 function efContributionTrackingConnection() {
150194 global $wgContributionTrackingDBserver, $wgContributionTrackingDBname;
151195 global $wgContributionTrackingDBuser, $wgContributionTrackingDBpassword;
@@ -163,9 +207,13 @@
164208 return $db;
165209 }
166210
 211+/**
 212+ * @param $start
 213+ * @param $fudgeFactor
 214+ * @return string
 215+ */
167216 function efContributionReportingTotal( $start, $fudgeFactor ) {
168217 $db = efContributionReportingConnection();
169 - #$db = wfGetDB( DB_MASTER );
170218
171219 $sql = 'SELECT ROUND( SUM(converted_amount) ) AS ttl FROM public_reporting';
172220
@@ -185,6 +233,9 @@
186234 return $output;
187235 }
188236
 237+/**
 238+ * @return string
 239+ */
189240 function efContributionReportingTotal_Render() {
190241 $args = func_get_args();
191242 array_shift( $args );
@@ -193,8 +244,9 @@
194245 $start = false;
195246
196247 foreach( $args as $arg ) {
197 - if ( strpos($arg,'=') === false )
 248+ if ( strpos($arg,'=') === false ) {
198249 continue;
 250+ }
199251
200252 list($key,$value) = explode( '=', trim($arg), 2 );
201253
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php
___________________________________________________________________
Modified: svn:mergeinfo
202254 Merged /trunk/extensions/ContributionReporting/ContributionReporting.php:r104370,104372,104424-104425,104428,104478,104481,104515
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
@@ -205,7 +205,12 @@
206206
207207 /* Query Functions */
208208
209 - // Totals for today
 209+ /**
 210+ * Totals for today
 211+ *
 212+ * @param $timestamp string
 213+ * @return array
 214+ */
210215 public function getDayTotals( $timestamp = 0 ) {
211216 $range = array();
212217 $end_format = 'Ymd235959';
@@ -250,15 +255,21 @@
251256
252257 );
253258
 259+ $result = array();
254260 foreach ( $res as $row ) {
255 - foreach( $row as $key => $value ) {
 261+ foreach( $row as $value ) {
256262 $result[] = $value;
257263 }
258264 }
259265 return $result;
260266 }
261267
262 - // Given a day figure out what its week bounds are
 268+ /**
 269+ * Given a day figure out what its week bounds are
 270+ *
 271+ * @param $day
 272+ * @return array
 273+ */
263274 public function weekRange( $day ) {
264275 $day = wfTimestamp( TS_UNIX, $day );
265276 $start = ( date( 'w', $day ) == 0) ? $day : strtotime('last sunday', $day ); // Use current Sunday
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
___________________________________________________________________
Modified: svn:mergeinfo
266277 Merged /trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php:r104370,104372,104424-104425,104428,104478,104481,104515
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php
@@ -15,7 +15,7 @@
1616 }
1717
1818 public function execute( $sub ) {
19 - global $wgRequest, $wgOut, $wgUser, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers;
 19+ global $wgRequest, $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers;
2020
2121 $showYear = array();
2222 foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) {
@@ -81,14 +81,7 @@
8282 /* Setup */
8383
8484 $this->setHeaders();
85 - $wgOut->addScriptFile( $wgScriptPath . '/extensions/ContributionReporting/FundraiserStatistics.js' );
86 - $wgOut->addLink(
87 - array(
88 - 'rel' => 'stylesheet',
89 - 'type' => 'text/css',
90 - 'href' => $wgScriptPath . '/extensions/ContributionReporting/FundraiserStatistics.css',
91 - )
92 - );
 85+ $wgOut->addModules( 'ext.fundraiserstatistics' );
9386
9487 /* Display */
9588
@@ -249,7 +242,7 @@
250243 Xml::tags(
251244 'table',
252245 array( 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0 ),
253 - Xml::tags( 'tr', null, implode( $chart['data'] ) )
 246+ Xml::tags( 'tr', null, implode( $chart['data'] ) ) // FIXME: Missing parameter to implode
254247 )
255248 );
256249 $first = false;
@@ -299,7 +292,7 @@
300293 'max(converted_amount)',
301294 ),
302295 $conditions,
303 - __METHOD__,
 296+ __METHOD__ . '-dailyTotals',
304297 array(
305298 'ORDER BY' => 'received',
306299 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')"
@@ -307,7 +300,7 @@
308301 );
309302 $result = array();
310303 $ytd = 0;
311 - while ( $row = $dbr->fetchRow( $select ) ) {
 304+ foreach( $select as $row ) {
312305 $row[] = $ytd += $row[1]; // YTD
313306 $result[] = $row;
314307 }
@@ -316,7 +309,7 @@
317310 $result = $dbr->selectField( 'public_reporting',
318311 array( 'sum(converted_amount) as sum' ),
319312 $conditions,
320 - __METHOD__,
 313+ __METHOD__ . '-dailyTotalMax',
321314 array(
322315 'ORDER BY' => 'sum DESC',
323316 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')"
@@ -327,14 +320,14 @@
328321 $result = $dbr->selectField( 'public_reporting',
329322 array( 'sum(converted_amount) as sum' ),
330323 $conditions,
331 - __METHOD__
 324+ __METHOD__ . '-yearlyTotalMax'
332325 );
333326 break;
334327 case 'contributionsMax':
335328 $result = $dbr->selectField( 'public_reporting',
336329 array( 'count(converted_amount) as sum' ),
337330 $conditions,
338 - __METHOD__,
 331+ __METHOD__ . '-contributionsMax',
339332 array(
340333 'ORDER BY' => 'sum DESC',
341334 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')"
@@ -345,7 +338,7 @@
346339 $result = $dbr->selectField( 'public_reporting',
347340 array( 'avg(converted_amount) as sum' ),
348341 $conditions,
349 - __METHOD__,
 342+ __METHOD__ . '-averagesMax',
350343 array(
351344 'ORDER BY' => 'sum DESC',
352345 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')"
@@ -356,7 +349,7 @@
357350 $result = $dbr->selectField( 'public_reporting',
358351 array( 'max(converted_amount) as sum' ),
359352 $conditions,
360 - __METHOD__,
 353+ __METHOD__ . '-maximumsMax',
361354 array(
362355 'ORDER BY' => 'sum DESC',
363356 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')"
@@ -371,6 +364,10 @@
372365 return null;
373366 }
374367
 368+ /**
 369+ * @param $values
 370+ * @return string
 371+ */
375372 private function dropDownList ( $values ) {
376373 $dropDown = '';
377374 foreach ( $values as $value ) {
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php
___________________________________________________________________
Modified: svn:mergeinfo
378375 Merged /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php:r104370,104372,104424-104425,104428,104478,104481,104515
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionHistory_body.php
@@ -11,7 +11,6 @@
1212 $wgOut->redirect( SpecialPage::getTitleFor( 'FundraiserStatistics' )->getFullURL() );
1313 return;
1414
15 -
1615 if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
1716 $language = 'en';
1817 }
@@ -25,11 +24,7 @@
2625
2726 $db = efContributionReportingConnection();
2827
29 - $output = '<style type="text/css">';
30 - $output .= 'td.left {padding-right: 10px;}';
31 - $output .= 'td.right {padding-left: 10px; text-align: right;}';
32 - $output .= 'td.alt {background-color: #DDDDDD;}';
33 - $output .= '</style>';
 28+ $wgOut->addModules( 'ext.fundraiserstatistics.table' );
3429
3530 // Paging controls
3631 $newer = $db->selectField( 'public_reporting', 'received',
@@ -65,14 +60,14 @@
6661 array(
6762 'href' => $title->getFullURL( 'offset=' . $newer ),
6863 ),
69 - $this->msg( 'contrib-hist-previous' )
 64+ $this->chMsg( 'contrib-hist-previous' )
7065 );
7166 }
7267 $pagingLinks[] = Xml::element( 'a',
7368 array(
7469 'href' => $title->getFullURL( 'offset=' . $older ),
7570 ),
76 - $this->msg( 'contrib-hist-next' )
 71+ $this->chMsg( 'contrib-hist-next' )
7772 );
7873 $pagingDiv = Xml::openElement( 'div',
7974 array( 'align' => 'right', 'style' => 'padding-bottom:20px' ) ) .
@@ -82,9 +77,9 @@
8378
8479 $output .= '<table style="width: 100%">';
8580 $output .= '<tr>';
86 - $output .= '<th width="60%">' . $this->msg( 'contrib-hist-name' ) . '</th>';
87 - $output .= '<th width="25%">' . $this->msg( 'contrib-hist-date' ) . '</th>';
88 - $output .= '<th width="15%" align="right">' . $this->msg( 'contrib-hist-amount' ) . '</th>';
 81+ $output .= '<th width="60%">' . $this->chMsg( 'contrib-hist-name' ) . '</th>';
 82+ $output .= '<th width="25%">' . $this->chMsg( 'contrib-hist-date' ) . '</th>';
 83+ $output .= '<th width="15%" align="right">' . $this->chMsg( 'contrib-hist-amount' ) . '</th>';
8984 $output .= '</tr>';
9085
9186 if ( $offset == null ) {
@@ -142,19 +137,19 @@
143138
144139 header( 'Cache-Control: max-age=300,s-maxage=300' );
145140 $wgOut->addWikiText( '{{2009/Donate-header/' . $language . '}}' );
146 - $wgOut->addHTML( '<h1>' . $this->msg( 'contrib-hist-header' ) . '</h1>' );
 141+ $wgOut->addHTML( '<h1>' . $this->chMsg( 'contrib-hist-header' ) . '</h1>' );
147142 $wgOut->addWikiText( '<strong>{{2008/Contribution history introduction/' . $language . '}}</strong>' );
148143 $wgOut->addHTML( $output );
149144 }
150145
151 - function msg( $key ) {
 146+ function chMsg( $key ) {
152147 return wfMsgExt( $key, array( 'escape', 'language' => $this->lang ) );
153148 }
154149
155150 function formatName( $row ) {
156151 $name = htmlspecialchars( $row['name'] );
157152 if( !$name ) {
158 - $name = $this->msg( 'contrib-hist-anonymous' );
 153+ $name = $this->chMsg( 'contrib-hist-anonymous' );
159154 }
160155 $name = '<strong>' . $name . '</strong>';
161156
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionHistory_body.php
___________________________________________________________________
Modified: svn:mergeinfo
162157 Merged /trunk/extensions/ContributionReporting/ContributionHistory_body.php:r104247-104248,104362,104370,104372,104424-104425,104428,104478,104481,104515
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.disablednotice.css
@@ -0,0 +1,10 @@
 2+div#cr-disablednotice {
 3+ font-size: 1.2em;
 4+ line-height: 1.3em;
 5+ background-image: url("warning-icon.png");
 6+ background-repeat: no-repeat;
 7+ background-position: 1.1em 50%;
 8+ background-color: #ffffd9;
 9+ border: 1px solid orange;
 10+ padding: 1.1em 1em 1em 4em;
 11+}
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.css
@@ -0,0 +1,103 @@
 2+div#configholder {
 3+ position: absolute;
 4+ top: 22px;
 5+ right: 0;
 6+ z-index: 200;
 7+ width: 180px;
 8+ border: 1px solid silver;
 9+ background-color: white;
 10+ padding: 2px 5px 5px 5px;
 11+ display: none;
 12+}
 13+div#configtoggle {
 14+ position: absolute;
 15+ top: 0;
 16+ right: 0;
 17+ z-index: 199;
 18+ height: 17px;
 19+ border: 1px solid silver;
 20+ background-color: white;
 21+ padding: 2px 5px 2px 0px;
 22+ cursor: pointer;
 23+}
 24+div#configtoggle a, div#configtoggle a:visited {
 25+ background-image: url("arrow.png");
 26+ background-position: 0px -3px;
 27+ background-repeat: no-repeat;
 28+ padding-left: 16px;
 29+ outline: 0;
 30+}
 31+
 32+.fundraiserstats-view-box {
 33+ border: solid 1px silver;
 34+}
 35+.fundraiserstats-view-box h3 {
 36+ margin-top: 0;
 37+ padding-top: 0;
 38+}
 39+.fundraiserstats-today {
 40+ position: absolute;
 41+ width: 6px;
 42+ height: 6px;
 43+ background-color: black;
 44+ margin-top: 3px;
 45+ margin-left: -1px;
 46+}
 47+.fundraiserstats-bar {
 48+ width: 2px;
 49+}
 50+.fundraiserstats-bar-2007 {
 51+ background-color: #AAAAFF;
 52+ border: outset 1px #AAAAFF;
 53+}
 54+.fundraiserstats-bar-2008 {
 55+ background-color: #AAFFAA;
 56+ border: outset 1px #AAFFAA;
 57+}
 58+.fundraiserstats-bar-2009 {
 59+ background-color: #FFAAAA;
 60+ border: outset 1px #FFAAAA;
 61+}
 62+.fundraiserstats-bar-2010 {
 63+ background-color: #a0e8ff;
 64+ border: outset 1px #a0e8ff;
 65+}
 66+.fundraiserstats-bar-2011 {
 67+ background-color: #ffd617;
 68+ border: outset 1px #ffd617;
 69+}
 70+.fundraiserstats-bar-space {
 71+ width: 3px;
 72+}
 73+.fundraiserstats-chart {
 74+ padding: 10px;
 75+ border-left: solid 1px silver;
 76+ border-right: solid 1px silver;
 77+}
 78+.fundraiserstats-chart-tabs {
 79+ border-bottom: solid 1px silver;
 80+ height: 24px;
 81+}
 82+.fundraiserstats-chart-tab-normal {
 83+ padding-left: 6px;
 84+ padding-right: 6px;
 85+ border: solid 1px silver;
 86+ float: left;
 87+ line-height: 23px;
 88+ height: 23px;
 89+ margin-right: 6px;
 90+ cursor: pointer;
 91+ font-weight: bold;
 92+}
 93+.fundraiserstats-chart-tab-current {
 94+ padding-left: 6px;
 95+ padding-right: 6px;
 96+ border: solid 1px silver;
 97+ border-bottom-color: white;
 98+ float: left;
 99+ line-height: 23px;
 100+ height: 23px;
 101+ margin-right: 6px;
 102+ cursor: pointer;
 103+ font-weight: bold;
 104+}
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.css
___________________________________________________________________
Added: svn:eol-style
1105 + native
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js
@@ -0,0 +1,51 @@
 2+/* JavaScript */
 3+
 4+$j( document ).ready( function() {
 5+
 6+ var currentViewID = 'fundraiserstats-view-box-0';
 7+ function replaceView( newLayerID ) {
 8+ var currentLayer = document.getElementById( currentViewID );
 9+ var newLayer = document.getElementById( newLayerID );
 10+ currentLayer.style.display = 'none';
 11+ newLayer.style.display = 'block';
 12+ currentViewID = newLayerID;
 13+ }
 14+
 15+ var currentChartID = 'fundraiserstats-chart-totals';
 16+ function replaceChart( newLayerID ) {
 17+ var currentLayer = document.getElementById( currentChartID );
 18+ var currentTab = document.getElementById( currentChartID + '-tab' );
 19+ var newLayer = document.getElementById( newLayerID );
 20+ var newTab = document.getElementById( newLayerID + '-tab' );
 21+ currentLayer.style.display = 'none';
 22+ currentTab.setAttribute( 'class', 'fundraiserstats-chart-tab-normal' );
 23+ newLayer.style.display = 'block';
 24+ newTab.setAttribute( 'class', 'fundraiserstats-chart-tab-current' );
 25+ currentChartID = newLayerID;
 26+ }
 27+
 28+ $j( '.fundraiserstats-bar' ).hover( function() {
 29+ replaceView( $j(this).attr( 'rel' ) )
 30+ } );
 31+ $j( '.fundraiserstats-chart-tab' ).click( function() {
 32+ replaceChart( $j(this).attr( 'rel' ) )
 33+ } );
 34+ $j( '.fundraiserstats-current' ).each( function() {
 35+ replaceView( $j(this).attr( 'rel' ) )
 36+ } );
 37+ $j( '#configholder .yeartoggle' ).click( function() {
 38+ $j('.fundraiserstats-'+$j(this).attr( 'id' )).toggle();
 39+ } );
 40+ $j( '#configtoggle' ).click( function() {
 41+ $j('#configholder').toggle();
 42+ if ($j( '#configtoggle a' ).css( 'background-position' ) == '0px -18px') {
 43+ $j( '#configtoggle a' ).css( 'background-position', '0px -3px' );
 44+ } else {
 45+ $j( '#configtoggle a' ).css( 'background-position','0px -18px' );
 46+ }
 47+ } );
 48+ $j( '#timezone' ).change( function() {
 49+ $j('#configform').submit();
 50+ } );
 51+
 52+} );
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js
___________________________________________________________________
Added: svn:eol-style
153 + native
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.table.css
@@ -0,0 +1,10 @@
 2+td.left {
 3+ padding-right: 10px
 4+}
 5+td.right {
 6+ padding-left: 10px;
 7+ text-align: right;
 8+}
 9+td.alt {
 10+ background-color: #DDDDDD;
 11+}
\ No newline at end of file
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.table.css
___________________________________________________________________
Added: svn:eol-style
112 + native
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/arrow.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/arrow.png
___________________________________________________________________
Added: svn:mime-type
213 + image/png
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/warning-icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/warning-icon.png
___________________________________________________________________
Added: svn:mime-type
314 + application/octet-stream
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/DailyTotal_body.php
@@ -8,8 +8,8 @@
99
1010 class SpecialDailyTotal extends IncludableSpecialPage {
1111
12 - protected $sharedMaxAge = 300; // Cache for 5 minutes on the server side
13 - protected $maxAge = 300; // Cache for 5 minutes on the client side
 12+ protected $sharedMaxAge = 600; // Cache for 10 minutes on the server side
 13+ protected $maxAge = 600; // Cache for 10 minutes on the client side
1414
1515 /* Functions */
1616
@@ -102,10 +102,14 @@
103103 return $cache;
104104 }
105105
 106+ // We're only interested in donations from the past 2 days at most
 107+ $recentTime = time() - 60 * 60 * 48;
 108+
106109 // Use database
107110 $dbr = efContributionReportingConnection();
108111 #$dbr = wfGetDB( DB_MASTER );
109112 $conditions = array(
 113+ 'received > ' . $recentTime,
110114 'converted_amount >= ' . $egFundraiserStatisticsMinimum,
111115 'converted_amount <= ' . $egFundraiserStatisticsMaximum,
112116 "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$timeZoneOffset'),'%Y-%m-%d') = '$start'"
@@ -116,10 +120,7 @@
117121 'sum(converted_amount)'
118122 ),
119123 $conditions,
120 - __METHOD__,
121 - array(
122 - 'ORDER BY' => 'received'
123 - )
 124+ __METHOD__
124125 );
125126 $row = $dbr->fetchRow( $select );
126127 $total = $row['sum(converted_amount)'];
@@ -134,4 +135,8 @@
135136 header( "Content-type: $wgJsMimeType; charset=utf-8" );
136137 header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" );
137138 }
 139+
 140+ public function isListed(){
 141+ return false;
 142+ }
138143 }
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/DisabledNotice_body.php
@@ -0,0 +1,36 @@
 2+<?php
 3+/**
 4+ * Special Page for Contribution statistics extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+class DisabledNotice extends SpecialPage {
 11+
 12+ /* Functions */
 13+
 14+ public function __construct() {
 15+ parent::__construct( 'DisabledNotice' );
 16+ }
 17+
 18+ public function execute( $sub ) {
 19+ global $wgOut, $wgScriptPath;
 20+
 21+ /* Setup */
 22+
 23+ $this->setHeaders();
 24+ $wgOut->addModules( 'ext.disablednotice' );
 25+
 26+ /* Display */
 27+
 28+ $wgOut->addWikiMsg( 'contribstats-header' );
 29+
 30+ $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'cr-disablednotice' ) ) );
 31+ $wgOut->addWikiMsg( 'disablednotice-disabled' );
 32+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
 33+
 34+ $wgOut->addWikiMsg( 'contribstats-footer' );
 35+ }
 36+
 37+}
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/YearlyTotal_body.php
@@ -74,4 +74,8 @@
7575 header( "Content-type: $wgJsMimeType; charset=utf-8" );
7676 header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" );
7777 }
 78+
 79+ public function isListed(){
 80+ return false;
 81+ }
7882 }
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.i18n.php
@@ -15,17 +15,22 @@
1616 // ContributionReporting and ContributionTotal
1717 'contributionreporting-desc' => 'Live reporting on the Wikimedia fundraiser',
1818 'contributiontotal' => 'Contribution total',
 19+
 20+ 'contribstats-header' => '',
 21+ 'contribstats-footer' => '',
 22+
 23+ // DisabledNotice
 24+ 'disablednotice' => 'Contribution reporting',
 25+ 'disablednotice-disabled' => 'This page has been temporarily disabled. Please try again later.',
 26+
 27+ // ContributionHistory
1928 'contributionhistory' => 'Contribution history',
20 -
2129 'contrib-hist-header' => 'Donor comments from around the world',
22 -
2330 'contrib-hist-name' => 'Name',
2431 'contrib-hist-date' => 'Time and date',
2532 'contrib-hist-amount' => 'Amount',
26 -
2733 'contrib-hist-next' => 'Earlier donations',
2834 'contrib-hist-previous' => 'Newer donations',
29 -
3035 'contrib-hist-anonymous' => 'Anonymous',
3136
3237 // ContributionStatistics
@@ -53,8 +58,6 @@
5459 'contribstats-value-under' => 'Under $1',
5560 'contribstats-value-from' => 'From $1 - $2',
5661 'contribstats-value-over' => 'Over $1',
57 - 'contribstats-header' => '',
58 - 'contribstats-footer' => '',
5962
6063 // Tracking Statistics
6164 'contributiontrackingstatistics' => 'Contribution tracking statistics',
@@ -120,21 +123,21 @@
121124 'contrib-hist-name' => '{{Identical|Name}}',
122125 'contrib-hist-date' => '{{Identical|Date}}',
123126 'contrib-hist-amount' => '{{Identical|Amount}}',
124 - 'contributionstatistics' => 'Title on the contribution report for <nowiki>[[Special:ContributionStatistics]]</nowiki>.
 127+ 'contributionstatistics' => 'Title on the contribution report for <nowiki>[[Special:ContributionStatistics]]</nowiki>.
125128 You may see an example in context at http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
126129 'contribstats-desc' => '{{desc}}',
127130 'contribstats-currency-range-totals' => '* $1 is a start date
128131 * $2 is an end date',
129 - 'contribstats-contribution-breakdown' => 'Title on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
 132+ 'contribstats-contribution-breakdown' => 'Title on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
130133 You may see an example in context at http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
131 - 'contribstats-day' => '"Day" on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
 134+ 'contribstats-day' => '"Day" on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
132135 You may see an example in context at http://wikimediafoundation.org/wiki/Special:ContributionStatistics
133136 {{Identical|Day}}',
134 - 'contribstats-month' => '"Month" on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
 137+ 'contribstats-month' => '"Month" on the contribution report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
135138 You may see an example in context at http://wikimediafoundation.org/wiki/Special:ContributionStatistics
136139 {{Identical|Month}}',
137140 'contribstats-currency' => '{{Identical|Currency}}',
138 - 'contribstats-contributions' => 'The number of contributions (donations) on a report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
 141+ 'contribstats-contributions' => 'The number of contributions (donations) on a report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
139142 You may see an example in context at http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
140143 'contribstats-day-totals' => 'The day for which the contribution statistics are being displayed.',
141144 'contribstats-conversion' => 'Click conversion rate, see [[:wikipedia:Conversion rate|Wikipedia article]].',
@@ -3125,7 +3128,7 @@
31263129 'contributionreporting-desc' => '위키미디어 모금 현황',
31273130 'contributiontotal' => '기부 총액',
31283131 'contributionhistory' => '기부 역사',
3129 - 'contrib-hist-header' => '전세계 기부자들의 실시간 한 마디',
 3132+ 'contrib-hist-header' => '전세계 기부자들의 한 마디',
31303133 'contrib-hist-name' => '이름',
31313134 'contrib-hist-date' => '날짜와 시각',
31323135 'contrib-hist-amount' => '금액',
@@ -3188,6 +3191,7 @@
31893192 'fundraiserstats-tab-averages' => '평균 (USD)',
31903193 'fundraiserstats-tab-maximums' => '최댓값 (USD)',
31913194 'fundraiserstats-tab-ytd' => '연간 누계 (USD)',
 3195+ 'fundraiserstats-time-zone' => '시간대:',
31923196 );
31933197
31943198 /** Colognian (Ripoarisch)
@@ -5123,7 +5127,7 @@
51245128 'fundraiserstats-utc' => '(према UTC-у)',
51255129 );
51265130
5127 -/** Serbian Latin ekavian (‪Srpski (latinica)‬)
 5131+/** Serbian (Latin script) (‪Srpski (latinica)‬)
51285132 * @author Michaello
51295133 */
51305134 $messages['sr-el'] = array(
@@ -5357,7 +5361,7 @@
53585362 'fundraiserstats-date' => 'Tempu',
53595363 );
53605364
5361 -/** Tajik (Cyrillic) (Тоҷикӣ (Cyrillic))
 5365+/** Tajik (Cyrillic script) (Тоҷикӣ)
53625366 * @author Ibrahim
53635367 */
53645368 $messages['tg-cyrl'] = array(
@@ -5397,7 +5401,7 @@
53985402 'fundraiserstats-tab-maximums' => 'Ҳаддиаксар (USD)',
53995403 );
54005404
5401 -/** Tajik (Latin) (Тоҷикӣ (Latin))
 5405+/** Tajik (Latin script) (tojikī)
54025406 * @author Liangent
54035407 */
54045408 $messages['tg-latn'] = array(
@@ -5718,7 +5722,7 @@
57195723 'fundraiserstats-tab-ytd' => 'Bugüne kadarki (USD)',
57205724 );
57215725
5722 -/** Tatar (Cyrillic) (Татарча/Tatarça (Cyrillic))
 5726+/** Tatar (Cyrillic script) (Татарча)
57235727 * @author Ильнар
57245728 */
57255729 $messages['tt-cyrl'] = array(
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
57265730 Merged /trunk/extensions/ContributionReporting/ContributionReporting.i18n.php:r104062,104247-104248,104362,104370,104372,104424-104425,104428,104478,104481,104515
Index: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php
@@ -275,6 +275,10 @@
276276
277277 /* Query Functions */
278278
 279+ /**
 280+ * @param $limit int
 281+ * @return array
 282+ */
279283 public function getDailyTotals( $limit = 30 ) {
280284 // Get connection
281285 $dbr = efContributionReportingConnection();
@@ -370,6 +374,9 @@
371375 return $totals;
372376 }
373377
 378+ /**
 379+ * @return array
 380+ */
374381 public function getCurrencyTotals() {
375382 // Get connection
376383 $dbr = efContributionReportingConnection();
@@ -499,6 +506,10 @@
500507 );
501508 }
502509
 510+ /**
 511+ * @param $dbr DatabaseBase
 512+ * @return array
 513+ */
503514 protected function dateConds( $dbr ) {
504515 return
505516 array(
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionStatistics_body.php
___________________________________________________________________
Modified: svn:mergeinfo
506517 Merged /trunk/extensions/ContributionReporting/ContributionStatistics_body.php:r104370,104372,104424-104425,104428,104478,104481,104515
Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting
___________________________________________________________________
Modified: svn:mergeinfo
507518 Merged /trunk/extensions/ContributionReporting:r104062,104247-104248,104362,104370,104372,104424-104425,104428,104478,104481,104515

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104062Localisation updates from http://translatewiki.net.siebrand18:43, 23 November 2011
r104247msg function was overriding the new msg() function in SpecialPage, and is cau...johnduhart17:28, 25 November 2011
r104248Don't list these SpecialPages, it's raw output (ew)johnduhart17:30, 25 November 2011
r104362Localisation updates for core and extension messages from translatewiki.netraymond20:45, 27 November 2011
r104370Comments...reedy22:56, 27 November 2011
r1043726 possible queries from one method? Now that's just hard to tracereedy23:10, 27 November 2011
r104424Spaces to tabsreedy13:42, 28 November 2011
r104425* (bug 32682) Remove hard coded CSS from ContributionHistory_body (Contributi...reedy13:49, 28 November 2011
r104428Followup r104425, missed removing a line in FundraiserStatistics_body.phpreedy14:13, 28 November 2011
r104478temporarily display disabled notice for all contribution reporting pageskaldari20:21, 28 November 2011
r104481small optimization to DailyTotalkaldari20:37, 28 November 2011
r104515Followup r104481, fixed syntax errorjohnduhart00:08, 29 November 2011

Status & tagging log