https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102035
Revision: 102035
Author: mah
Date: 2011-11-04 20:06:16 +0000 (Fri, 04 Nov 2011)
Log Message:
-----------
w/s fixups
Modified Paths:
--------------
trunk/extensions/ContributionReporting/ContributionHistory_body.php
trunk/extensions/ContributionReporting/ContributionReporting.i18n.php
trunk/extensions/ContributionReporting/ContributionReporting.php
trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
trunk/extensions/ContributionReporting/FundraiserStatistics.js
trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
Modified: trunk/extensions/ContributionReporting/ContributionHistory_body.php
===================================================================
--- trunk/extensions/ContributionReporting/ContributionHistory_body.php
2011-11-04 19:50:08 UTC (rev 102034)
+++ trunk/extensions/ContributionReporting/ContributionHistory_body.php
2011-11-04 20:06:16 UTC (rev 102035)
@@ -10,27 +10,27 @@
# Emergecny short cut until post donation comments are enabled
$wgOut->redirect( SpecialPage::getTitleFor(
'FundraiserStatistics' )->getFullURL() );
return;
-
+
if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
$language = 'en';
}
$this->lang = Language::factory( $language );
-
+
// Get request data
$offset = $wgRequest->getIntOrNull( 'offset' );
$show = 100;
-
+
$this->setHeaders();
-
+
$db = efContributionReportingConnection();
-
+
$output = '<style type="text/css">';
$output .= 'td.left {padding-right: 10px;}';
$output .= 'td.right {padding-left: 10px; text-align: right;}';
$output .= 'td.alt {background-color: #DDDDDD;}';
$output .= '</style>';
-
+
// Paging controls
$newer = $db->selectField( 'public_reporting', 'received',
array_merge(
@@ -41,7 +41,7 @@
array(
'ORDER BY' => 'received ASC',
'LIMIT' => 1,
- 'OFFSET' => $show
+ 'OFFSET' => $show
)
);
$older = $db->selectField( 'public_reporting', 'received',
@@ -56,9 +56,9 @@
'OFFSET' => $show
)
);
-
+
$title = $this->getTitle( $language == 'en' ? null : $language
);
-
+
$pagingLinks = array();
if( $offset !== null ) {
$pagingLinks[] = Xml::element( 'a',
@@ -79,14 +79,14 @@
$wgLang->pipeList( $pagingLinks ) .
Xml::closeElement( 'div' );
$output .= $pagingDiv;
-
+
$output .= '<table style="width: 100%">';
$output .= '<tr>';
$output .= '<th width="60%">' . $this->msg( 'contrib-hist-name'
) . '</th>';
$output .= '<th width="25%">' . $this->msg( 'contrib-hist-date'
) . '</th>';
$output .= '<th width="15%" align="right">' . $this->msg(
'contrib-hist-amount' ) . '</th>';
$output .= '</tr>';
-
+
if ( $offset == null ) {
$offset = $db->selectField( 'public_reporting',
'received',
array( 'received > ' . strtotime( 'July 1st
2008' ) ),
@@ -97,9 +97,9 @@
)
);
}
-
+
$url = SpecialPage::getTitleFor( 'ContributionHistory'
)->getFullURL();
-
+
$res = $db->select( 'public_reporting', '*',
array_merge(
array( 'received > ' . strtotime( 'July 1st
2008' ) ),
@@ -126,7 +126,7 @@
if ( $alt ) {
$class = ' alt';
}
-
+
$output .= "<tr>";
$output .= "<td class=\"left $class\"><a
name=\"{$contributionId}\"></a><a
href=\"{$url}?offset={$offset}#{$contributionId}\">{$name}</a></td>";
$output .= "<td class=\"left $class\" style=\"width:
100px;\">$date</td>";
@@ -135,9 +135,9 @@
$alt = !$alt;
}
-
+
$output .= '</table>';
-
+
$output .= $pagingDiv;
header( 'Cache-Control: max-age=300,s-maxage=300' );
@@ -146,25 +146,25 @@
$wgOut->addWikiText( '<strong>{{2008/Contribution history
introduction/' . $language . '}}</strong>' );
$wgOut->addHTML( $output );
}
-
+
function msg( $key ) {
return wfMsgExt( $key, array( 'escape', 'language' =>
$this->lang ) );
}
-
+
function formatName( $row ) {
$name = htmlspecialchars( $row['name'] );
if( !$name ) {
$name = $this->msg( 'contrib-hist-anonymous' );
}
$name = '<strong>' . $name . '</strong>';
-
+
if( $row['note'] && !$this->isTiny( $row ) ) {
$name .= '<br />' . htmlspecialchars( $row['note'] );
}
return $name;
}
-
+
function isTiny( $row ) {
$mins = array(
'USD' => 1,
@@ -200,7 +200,7 @@
return false;
}
}
-
+
function formatDate( $row ) {
$ts = wfTimestamp( TS_MW, $row['received'] );
return $this->lang->timeanddate( $ts );
@@ -208,7 +208,7 @@
function formatAmount( $row ) {
$converted = $row['converted_amount'];
-
+
if ( $row['original_currency'] ) {
$currency = $row['original_currency'];
$amount = $row['original_amount'];
Modified: trunk/extensions/ContributionReporting/ContributionReporting.i18n.php
===================================================================
--- trunk/extensions/ContributionReporting/ContributionReporting.i18n.php
2011-11-04 19:50:08 UTC (rev 102034)
+++ trunk/extensions/ContributionReporting/ContributionReporting.i18n.php
2011-11-04 20:06:16 UTC (rev 102035)
@@ -16,16 +16,16 @@
'contributionreporting-desc' => 'Live reporting on the Wikimedia
fundraiser',
'contributiontotal' => 'Contribution total',
'contributionhistory' => 'Contribution history',
-
+
'contrib-hist-header' => 'Donor comments from around the world',
-
+
'contrib-hist-name' => 'Name',
'contrib-hist-date' => 'Time and date',
'contrib-hist-amount' => 'Amount',
-
+
'contrib-hist-next' => 'Earlier donations',
'contrib-hist-previous' => 'Newer donations',
-
+
'contrib-hist-anonymous' => 'Anonymous',
// ContributionStatistics
@@ -118,21 +118,21 @@
'contrib-hist-name' => '{{Identical|Name}}',
'contrib-hist-date' => '{{Identical|Date}}',
'contrib-hist-amount' => '{{Identical|Amount}}',
- 'contributionstatistics' => 'Title on the contribution report for
<nowiki>[[Special:ContributionStatistics]]</nowiki>.
+ 'contributionstatistics' => 'Title on the contribution report for
<nowiki>[[Special:ContributionStatistics]]</nowiki>.
You may see an example in context at
http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
'contribstats-desc' => '{{desc}}',
'contribstats-currency-range-totals' => '* $1 is a start date
* $2 is an end date',
- 'contribstats-contribution-breakdown' => 'Title on the contribution
report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
+ 'contribstats-contribution-breakdown' => 'Title on the contribution
report for <nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
You may see an example in context at
http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
- 'contribstats-day' => '"Day" on the contribution report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
+ 'contribstats-day' => '"Day" on the contribution report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
You may see an example in context at
http://wikimediafoundation.org/wiki/Special:ContributionStatistics
{{Identical|Day}}',
- 'contribstats-month' => '"Month" on the contribution report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
+ 'contribstats-month' => '"Month" on the contribution report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
You may see an example in context at
http://wikimediafoundation.org/wiki/Special:ContributionStatistics
{{Identical|Month}}',
'contribstats-currency' => '{{Identical|Currency}}',
- 'contribstats-contributions' => 'The number of contributions
(donations) on a report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
+ 'contribstats-contributions' => 'The number of contributions
(donations) on a report for
<nowiki>[[</nowiki>Special:ContributionStatistics<nowiki>]]</nowiki>.
You may see an example in context at
http://wikimediafoundation.org/wiki/Special:ContributionStatistics',
'contribstats-day-totals' => 'The day for which the contribution
statistics are being displayed.',
'contribstats-conversion' => 'Click conversion rate, see
[[:wikipedia:Conversion rate|Wikipedia article]].',
Modified: trunk/extensions/ContributionReporting/ContributionReporting.php
===================================================================
--- trunk/extensions/ContributionReporting/ContributionReporting.php
2011-11-04 19:50:08 UTC (rev 102034)
+++ trunk/extensions/ContributionReporting/ContributionReporting.php
2011-11-04 20:06:16 UTC (rev 102035)
@@ -168,31 +168,31 @@
# Output
$output = $row['ttl'] ? $row['ttl'] : '0';
-
+
$output += $fudgeFactor;
-
+
return $output;
}
function efContributionReportingTotal_Render() {
$args = func_get_args();
array_shift( $args );
-
+
$fudgeFactor = false;
$start = false;
-
+
foreach( $args as $arg ) {
if ( strpos($arg,'=') === false )
continue;
-
+
list($key,$value) = explode( '=', trim($arg), 2 );
-
+
if ($key == 'fudgefactor') {
$fudgeFactor = $value;
} elseif ($key == 'start') {
$start = $value;
}
}
-
+
return efContributionReportingTotal( $start, $fudgeFactor );
}
Modified:
trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
===================================================================
---
trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
2011-11-04 19:50:08 UTC (rev 102034)
+++
trunk/extensions/ContributionReporting/ContributionTrackingStatistics_body.php
2011-11-04 20:06:16 UTC (rev 102035)
@@ -37,18 +37,18 @@
);
$htmlOut .= Xml::tags( 'tr', null,
- Xml::element( 'td', array( 'align' => 'left' ),
+ Xml::element( 'td', array( 'align' => 'left' ),
wfMsg( 'contribstats-imperfect-data' )
) .
- Xml::element( 'td', array( 'align' => 'right'
),
+ Xml::element( 'td', array( 'align' => 'right' ),
wfTimestamp( TS_DB ) . ' (UTC)')
);
$htmlOut .= Xml::tags( 'tr', null,
- Xml::element( 'td', array( 'align' => 'left' ),
- wfMsg( 'contribstats-fraud-note' ) . "
" .
+ Xml::element( 'td', array( 'align' => 'left' ),
+ wfMsg( 'contribstats-fraud-note' ) . "
" .
wfMsg( 'contribstats-unaudited'
) )
);
$htmlOut .= Xml::tags( 'tr', null,
- Xml::element( 'td', array( 'align' => 'left'
),
+ Xml::element( 'td', array( 'align' => 'left' ),
'PP = ' . wfMsg(
'contribstats-paypal-donations' ) . ', ' .
'CC = ' . wfMsg(
'contribstats-credit-card' ) )
);
@@ -74,11 +74,11 @@
public function showTotalsForRange( $range, $format ) {
list( $start, $end ) = $range;
$current = $end;
-
+
switch( $format ) {
case 1:
while( $current > $start ) {
- $this->showDayTotals( $current );
+ $this->showDayTotals( $current );
$current = $current - 24 * 60 * 60;
}
break;
@@ -91,7 +91,7 @@
$this->showCombinedTotals( $totals, $range );
break;
- }
+ }
}
// Display tracking information for one day
@@ -187,7 +187,7 @@
public function showCombinedTotals( $totals, $range ) {
global $wgOut;
- $msg = date( 'o-m-d', wfTimestamp( TS_UNIX, $range[0] ) ) . ' -
' .
+ $msg = date( 'o-m-d', wfTimestamp( TS_UNIX, $range[0] ) ) . ' -
' .
date( 'o-m-d', wfTimestamp( TS_UNIX, $range[1] ) ) ;
$htmlOut = Xml::element( 'h3', null, $msg );
@@ -224,7 +224,7 @@
$res = $dbr->select(
array( 'contribution_tracking',
- 'civicrm.public_reporting',
+ 'civicrm.public_reporting',
),
array(
'utm_source',
@@ -242,7 +242,7 @@
array( 'civicrm.public_reporting' =>
array(
'LEFT JOIN',
- 'contribution_tracking.contribution_id
= civicrm.public_reporting.contribution_id',
+ 'contribution_tracking.contribution_id
= civicrm.public_reporting.contribution_id',
)
)
Modified: trunk/extensions/ContributionReporting/FundraiserStatistics.js
===================================================================
--- trunk/extensions/ContributionReporting/FundraiserStatistics.js
2011-11-04 19:50:08 UTC (rev 102034)
+++ trunk/extensions/ContributionReporting/FundraiserStatistics.js
2011-11-04 20:06:16 UTC (rev 102035)
@@ -1,7 +1,7 @@
/* JavaScript */
$j( document ).ready( function() {
-
+
var currentViewID = 'fundraiserstats-view-box-0';
function replaceView( newLayerID ) {
var currentLayer = document.getElementById( currentViewID );
@@ -10,7 +10,7 @@
newLayer.style.display = 'block';
currentViewID = newLayerID;
}
-
+
var currentChartID = 'fundraiserstats-chart-totals';
function replaceChart( newLayerID ) {
var currentLayer = document.getElementById( currentChartID );
@@ -47,5 +47,5 @@
$j( '#timezone' ).change( function() {
$j('#configform').submit();
} );
-
+
} );
Modified: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
===================================================================
--- trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
2011-11-04 19:50:08 UTC (rev 102034)
+++ trunk/extensions/ContributionReporting/FundraiserStatistics_body.php
2011-11-04 20:06:16 UTC (rev 102035)
@@ -13,10 +13,10 @@
public function __construct() {
parent::__construct( 'FundraiserStatistics' );
}
-
+
public function execute( $sub ) {
global $wgRequest, $wgOut, $wgUser, $wgLang, $wgScriptPath,
$egFundraiserStatisticsFundraisers;
-
+
$showYear = array();
foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) {
if ( $wgRequest->wasPosted() ) {
@@ -25,11 +25,11 @@
$showYear[$fundraiser['id']] = true;
}
}
-
+
$this->timezone = $wgRequest->getText( 'timezone', '+0:00' );
-
+
/* Configuration (this isn't totally static data, some of it
gets built on the fly) */
-
+
$charts = array(
'totals' => array(
'data' => array(),
@@ -72,9 +72,9 @@
'max' => 1,
),
);
-
+
/* Setup */
-
+
$this->setHeaders();
$wgOut->addScriptFile( $wgScriptPath .
'/extensions/ContributionReporting/FundraiserStatistics.js' );
$wgOut->addLink(
@@ -84,9 +84,9 @@
'href' => $wgScriptPath .
'/extensions/ContributionReporting/FundraiserStatistics.css',
)
);
-
+
/* Display */
-
+
// Chart maximums
foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) {
foreach ( $charts as $name => $chart ) {
@@ -97,7 +97,7 @@
}
}
// Scale factors
- foreach ( $charts as $name => $chart ) {
+ foreach ( $charts as $name => $chart ) {
$charts[$name]['factor'] = 300 / $chart['max'];
}
// HTML-time!
@@ -112,7 +112,7 @@
if ( !isset(
$charts[$name]['data'][$column] ) ) {
$charts[$name]['data'][$column]
= '';
}
-
+
// Add spacer between days
if ( $fundraiserIndex == 0 ) {
$attributes = array(
@@ -123,7 +123,7 @@
'td', array( 'valign'
=> 'bottom' ), Xml::element( 'div', $attributes, '', false )
);
}
-
+
$height = $chart['factor'] *
$day[$chart['index']];
$style = "height:{$height}px;";
if ( $showYear[$fundraiser['id']] !==
true ) {
@@ -189,13 +189,13 @@
}
}
}
-
+
$wgOut->addHTML( Xml::openElement( 'div', array( 'id' =>
'configtoggle' ) ) );
$wgOut->addHTML( '<a id="customize-chart">'.wfMsg(
'fundraiserstats-customize' ).'</a>' );
$wgOut->addHTML( Xml::closeElement( 'div' ) );
-
+
$wgOut->addHTML( Xml::openElement( 'form', array( 'method' =>
'post', 'id' => 'configform' ) ) );
-
+
$years = wfMsg( 'fundraiserstats-show-years' ).'<br/>';
foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) {
$years .= Xml::check( 'toogle'.$fundraiser['id'],
$showYear[$fundraiser['id']], array( 'id' => 'bar-'.$fundraiser['id'], 'class'
=> 'yeartoggle' ) );
@@ -207,9 +207,9 @@
$wgOut->addHTML( wfMsg( 'fundraiserstats-time-zone' ).'<br/>' );
$wgOut->addHTML( ' '.Xml::listDropDown( 'timezone',
$this->dropDownList( range ( -12, 14, 1 ) ), '', $this->timezone, '', 1 ).'
'.wfMsg( 'fundraiserstats-utc' ) );
$wgOut->addHTML( Xml::closeElement( 'div' ) );
-
+
$wgOut->addHTML( Xml::closeElement( 'form' ) );
-
+
// Instructions
$wgOut->addWikiMsg( 'fundraiserstats-instructions' );
@@ -237,7 +237,7 @@
array(
'id' => "fundraiserstats-chart-{$name}",
'class' => 'fundraiserstats-chart',
- 'style' => 'display:' . ( $first ?
'block' : 'none' )
+ 'style' => 'display:' . ( $first ?
'block' : 'none' )
),
Xml::tags(
'table',
@@ -261,12 +261,12 @@
)
);
}
-
+
/* Private Functions */
-
+
private function query( $type, $start, $end ) {
global $wgMemc, $egFundraiserStatisticsMinimum,
$egFundraiserStatisticsMaximum, $egFundraiserStatisticsCacheTimeout;
-
+
$key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end );
$cache = $wgMemc->get( $key );
if ( $cache != false && $cache != -1 ) {
@@ -362,7 +362,7 @@
}
return null;
}
-
+
private function dropDownList ( $values ) {
$dropDown = '';
foreach ( $values as $value ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs