https://www.mediawiki.org/wiki/Special:Code/MediaWiki/105485
Revision: 105485 Author: awjrichards Date: 2011-12-07 23:27:13 +0000 (Wed, 07 Dec 2011) Log Message: ----------- MFT r105051, r105064, r105145, r105214, r105353, r105454 Modified Paths: -------------- branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js Property Changed: ---------------- branches/wmf/1.18wmf1/extensions/ContributionReporting/ branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting ___________________________________________________________________ Modified: svn:mergeinfo - /branches/wmf/1.16wmf4/extensions/ContributionReporting:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting:60970 /trunk/extensions/ContributionReporting:64690-67673,76496,76558,76586,76647,77217,77219,77236,102713,103064,103098,103125,103371,103460,103519,103626,103884,103947,103959,103967,103991,103996,104062,104247-104248,104362,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904 /trunk/phase3/extensions/ContributionReporting:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 + /branches/wmf/1.16wmf4/extensions/ContributionReporting:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting:60970 /trunk/extensions/ContributionReporting:64690-67673,76496,76558,76586,76647,77217,77219,77236,102713,103064,103098,103125,103371,103460,103519,103626,103884,103947,103959,103967,103991,103996,104062,104247-104248,104362,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904,105051,105064,105145,105214,105353,105454 /trunk/phase3/extensions/ContributionReporting:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 Modified: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php =================================================================== --- branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php 2011-12-07 23:25:13 UTC (rev 105484) +++ branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php 2011-12-07 23:27:13 UTC (rev 105485) @@ -41,30 +41,22 @@ $wgAutoloadClasses['SpecialContributionStatistics'] = $dir . 'ContributionStatistics_body.php'; $wgAutoloadClasses['SpecialFundraiserStatistics'] = $dir . 'FundraiserStatistics_body.php'; $wgAutoloadClasses['SpecialContributionTrackingStatistics'] = $dir . 'ContributionTrackingStatistics_body.php'; +/* $wgAutoloadClasses['SpecialDailyTotal'] = $dir . 'DailyTotal_body.php'; $wgAutoloadClasses['SpecialYearlyTotal'] = $dir . 'YearlyTotal_body.php'; $wgAutoloadClasses['DisabledNotice'] = $dir . 'DisabledNotice_body.php'; +*/ -/* $wgSpecialPages['ContributionHistory'] = 'ContributionHistory'; $wgSpecialPages['ContributionTotal'] = 'ContributionTotal'; $wgSpecialPages['ContributionStatistics'] = 'SpecialContributionStatistics'; $wgSpecialPages['FundraiserStatistics'] = 'SpecialFundraiserStatistics'; $wgSpecialPages['ContributionTrackingStatistics'] = 'SpecialContributionTrackingStatistics'; +/* $wgSpecialPages['DailyTotal'] = 'SpecialDailyTotal'; $wgSpecialPages['YearlyTotal'] = 'SpecialYearlyTotal'; */ -// Temporarily redirect all pages to DisabledNotice -$wgSpecialPages['DisabledNotice'] = 'DisabledNotice'; -$wgSpecialPages['ContributionHistory'] = 'DisabledNotice'; -$wgSpecialPages['ContributionTotal'] = 'DisabledNotice'; -$wgSpecialPages['ContributionStatistics'] = 'DisabledNotice'; -$wgSpecialPages['FundraiserStatistics'] = 'DisabledNotice'; -$wgSpecialPages['ContributionTrackingStatistics'] = 'DisabledNotice'; -$wgSpecialPages['DailyTotal'] = 'DisabledNotice'; -$wgSpecialPages['YearlyTotal'] = 'DisabledNotice'; - $wgSpecialPageGroups['ContributionHistory'] = 'contribution'; $wgSpecialPageGroups['ContributionTotal'] = 'contribution'; $wgSpecialPageGroups['ContributionStatistics'] = 'contribution'; @@ -115,6 +107,10 @@ ), ); +// The first year of statistics to make visible by default. +// We normally don't show all of them by default, since it makes the chart extremely wide. +$egFundraiserStatisticsFirstYearDefault = 2009; + // Thesholds for fundraiser statistics $egFundraiserStatisticsMinimum = 1; $egFundraiserStatisticsMaximum = 10000; @@ -229,6 +225,11 @@ # Output $output = $row['ttl'] ? $row['ttl'] : '0'; + + // Make sure fudge factor is a number + if ( is_nan( $fudgeFactor ) ) { + $fudgeFactor = 0; + } $output += $fudgeFactor; Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/ContributionReporting.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/wmf/1.16wmf4/extensions/ContributionReporting/ContributionReporting.php:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting/ContributionReporting.php:60970 /trunk/extensions/ContributionReporting/ContributionReporting.php:64690-67673,75680,76496,76558,76586,76647,77217,77219,77236,102035,102430,103064,103125,103626,103884,103947,103959,103967,103991,103996,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904 /trunk/phase3/extensions/ContributionReporting/ContributionReporting.php:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 + /branches/wmf/1.16wmf4/extensions/ContributionReporting/ContributionReporting.php:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting/ContributionReporting.php:60970 /trunk/extensions/ContributionReporting/ContributionReporting.php:64690-67673,75680,76496,76558,76586,76647,77217,77219,77236,102035,102430,103064,103125,103626,103884,103947,103959,103967,103991,103996,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904,105051,105064,105145,105214,105353,105454 /trunk/phase3/extensions/ContributionReporting/ContributionReporting.php:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 Modified: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php =================================================================== --- branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php 2011-12-07 23:25:13 UTC (rev 105484) +++ branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php 2011-12-07 23:27:13 UTC (rev 105485) @@ -1,6 +1,7 @@ <?php /** * Special Page for Contribution statistics extension + * This page displays charts and tables related to donation statistics. * * @file * @ingroup Extensions @@ -15,15 +16,22 @@ } public function execute( $sub ) { - global $wgRequest, $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers; + global $wgRequest, $wgOut, $wgLang, $wgScriptPath, $egFundraiserStatisticsFundraisers, + $egFundraiserStatisticsFirstYearDefault; + // Figure out what years to display initially $showYear = array(); foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { - if ( $wgRequest->wasPosted() ) { - $showYear[$fundraiser['id']] = $wgRequest->getCheck( 'toogle'.$fundraiser['id'] ); + // You can override the years to display by default via the query string. + // For example, Special:FundraiserStatistics?2007=show&2010=hide + $yearOverride = $wgRequest->getVal( $fundraiser['id'] ); + if ( $yearOverride === "hide" ) { + $showYear[$fundraiser['id']] = false; + } else if ( $yearOverride === "show" ) { + $showYear[$fundraiser['id']] = true; } else { - // By default, show only the fundraising years after 2008 - if ( intval( $fundraiser['id'] ) > 2008 ) { + // By default, show only the recent fundraising years + if ( intval( $fundraiser['id'] ) >= $egFundraiserStatisticsFirstYearDefault ) { $showYear[$fundraiser['id']] = true; } else { $showYear[$fundraiser['id']] = false; @@ -31,15 +39,12 @@ } } - $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(), 'index' => 1, - 'query' => 'dailyTotalMax', 'precision' => 2, 'label' => 'fundraiserstats-total', 'max' => 1, @@ -47,7 +52,6 @@ 'contributions' => array( 'data' => array(), 'index' => 2, - 'query' => 'contributionsMax', 'precision' => 0, 'label' => 'fundraiserstats-contributions', 'max' => 1, @@ -55,7 +59,6 @@ 'averages' => array( 'data' => array(), 'index' => 3, - 'query' => 'averagesMax', 'precision' => 2, 'label' => 'fundraiserstats-avg', 'max' => 1, @@ -63,7 +66,6 @@ 'maximums' => array( 'data' => array(), 'index' => 4, - 'query' => 'maximumsMax', 'precision' => 2, 'label' => 'fundraiserstats-max', 'max' => 1, @@ -71,7 +73,6 @@ 'ytd' => array( 'data' => array(), 'index' => 5, - 'query' => 'yearlyTotalMax', 'precision' => 2, 'label' => 'fundraiserstats-ytd', 'max' => 1, @@ -85,11 +86,30 @@ /* Display */ - $wgOut->addWikiMsg('contribstats-header'); + $wgOut->addWikiMsg( 'contribstats-header' ); // Header (typically empty) + + // The $fundraisingData array contains all of the fundraising data in the following scheme: + // $fundraisingData[<fundraiserId>][<dayIndex>][<dataTypeIndex>] + $fundraisingData = array(); + + foreach ( $egFundraiserStatisticsFundraisers as $fundraiserIndex => $fundraiser ) { + + // See if this is the most recent fundraiser or not + if ( $fundraiserIndex == count( $egFundraiserStatisticsFundraisers ) - 1 ) { + $mostRecent = true; + } else { + $mostRecent = false; + } + + // Collect all the data + $fundraisingData[$fundraiser['id']] = $this->query( $mostRecent, $fundraiser['start'], $fundraiser['end'] ); + } + // Chart maximums - foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { + // We cycle through all the fundraisers with all the different chart types and collect the maximums. + foreach ( $fundraisingData as $fundraiser ) { foreach ( $charts as $name => $chart ) { - $chartMax = $this->query( $charts[$name]['query'], $fundraiser['start'], $fundraiser['end'] ); + $chartMax = $this->getMaximum( $fundraiser, $chart['index'] ); if ( $chartMax > $charts[$name]['max'] ) { $charts[$name]['max'] = $chartMax; } @@ -99,12 +119,25 @@ foreach ( $charts as $name => $chart ) { $charts[$name]['factor'] = 300 / $chart['max']; } + // HTML-time! - $view = 0; - $htmlViews = ''; + + // Each bar on the graph is associated with an individual data table. The ID linking the + // bar and the table is stored in $dataTableId. + $dataTableId = 0; + $dataTablesHtml = ''; // This will contain the HTML for all the data tables foreach ( $egFundraiserStatisticsFundraisers as $fundraiserIndex => $fundraiser ) { - $days = $this->query( 'dailyTotals', $fundraiser['start'], $fundraiser['end'] ); - $mostRecentFundraiser = $fundraiserIndex == count( $egFundraiserStatisticsFundraisers ) - 1; + + // Get all the daily data for a particular fundraiser + $days = $fundraisingData[$fundraiser['id']]; + + // See if this is the most recent fundraiser or not + if ( $fundraiserIndex == count( $egFundraiserStatisticsFundraisers ) - 1 ) { + $mostRecentFundraiser = true; + } else { + $mostRecentFundraiser = false; + } + foreach ( $charts as $name => $chart ) { $column = 0; foreach( $days as $i => $day ) { @@ -125,13 +158,13 @@ $height = $chart['factor'] * $day[$chart['index']]; $style = "height:{$height}px;"; - if ( $showYear[$fundraiser['id']] !== true ) { + if ( !$showYear[$fundraiser['id']] ) { $style .= "display:none;"; } $attributes = array( 'style' => $style, 'class' => "fundraiserstats-bar fundraiserstats-bar-{$fundraiser['id']}", - 'rel' => "fundraiserstats-view-box-{$view}", + 'rel' => "fundraiserstats-view-box-{$dataTableId}", ); if ( $mostRecentFundraiser && $i == count( $days ) -1 ) { $attributes['class'] .= ' fundraiserstats-current'; @@ -139,28 +172,31 @@ $charts[$name]['data'][$column] .= Xml::tags( 'td', array( 'valign' => 'bottom' ), Xml::element( 'div', $attributes, '', false ) ); - $htmlView = Xml::openElement( 'tr' ); + + // Construct the data table for this day + $dataTable = Xml::openElement( 'tr' ); $count = 0; foreach ( $charts as $subchart ) { - $htmlView .= Xml::element( + $dataTable .= Xml::element( 'td', array( 'width' => '16%', 'nowrap' => 'nowrap' ), wfMsg( $subchart['label'] ) ); - $htmlView .= Xml::element( + $dataTable .= Xml::element( 'td', array( 'width' => '16%', 'nowrap' => 'nowrap', 'align' => 'right' ), $wgLang->formatNum( number_format( $day[$subchart['index']], $subchart['precision'] ) ) ); if ( ++$count % 3 == 0 ) { - $htmlView .= Xml::closeElement( 'tr' ) . Xml::openElement( 'tr' ); + $dataTable .= Xml::closeElement( 'tr' ) . Xml::openElement( 'tr' ); } } - $htmlView .= Xml::closeElement( 'tr' ); - $htmlViews .= Xml::tags( + $dataTable .= Xml::closeElement( 'tr' ); + + $dataTablesHtml .= Xml::tags( 'div', array( - 'id' => 'fundraiserstats-view-box-' . $view, + 'id' => 'fundraiserstats-view-box-' . $dataTableId, 'class' => 'fundraiserstats-view-box', - 'style' => 'display: ' . ( $view == 0 ? 'block' : 'none' ) + 'style' => 'display: ' . ( $dataTableId == 0 ? 'block' : 'none' ) ), Xml::tags( 'table', @@ -171,7 +207,7 @@ Xml::tags( 'td', array( 'colspan' => 6 ), - Xml::element( 'h3', array( 'style' => 'float:right;color:gray;' ), $day[0] ) . + Xml::element( 'h3', array( 'style' => 'float:right;color:gray;' ), $day[0] ) . // The date Xml::tags( 'h3', array( 'style' => 'float:left;color:black;' ), @@ -180,11 +216,11 @@ Xml::element( 'div', array( 'style' => 'clear:both;' ), '', false ) ) ) . - $htmlView + $dataTable ) ); $column++; - $view++; + $dataTableId++; } } } @@ -197,15 +233,12 @@ $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' ) ); - $years .= Xml::label( $fundraiser['id'], 'toogle'.$fundraiser['id'] ); + $years .= Xml::check( 'toggle'.$fundraiser['id'], $showYear[$fundraiser['id']], array( 'id' => 'bar-'.$fundraiser['id'], 'class' => 'yeartoggle' ) ); + $years .= Xml::label( $fundraiser['id'], 'toggle'.$fundraiser['id'] ); $years .= "<br/>"; } $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'configholder' ) ) ); $wgOut->addHTML( $years ); - // TODO: Fix timezone feature to work with caching correctly. - // $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' ) ); @@ -213,11 +246,13 @@ // Instructions $wgOut->addWikiMsg( 'fundraiserstats-instructions' ); + $chartsHtml = ''; // This will contain the HTML for all of the bar charts and tabs + // Tabs + $chartsHtml .= Xml::openElement( 'div', array( 'class' => 'fundraiserstats-chart-tabs' ) ); $first = true; - $htmlCharts = Xml::openElement( 'div', array( 'class' => 'fundraiserstats-chart-tabs' ) ); foreach ( $charts as $chart => $columns ) { - $htmlCharts .= Xml::tags( + $chartsHtml .= Xml::tags( 'div', array( 'id' => "fundraiserstats-chart-{$chart}-tab", @@ -228,11 +263,12 @@ ); $first = false; } - $htmlCharts .= Xml::closeElement( 'div' ); + $chartsHtml .= Xml::closeElement( 'div' ); + // Charts $first = true; foreach ( $charts as $name => $chart ) { - $htmlCharts .= Xml::tags( + $chartsHtml .= Xml::tags( 'div', array( 'id' => "fundraiserstats-chart-{$name}", @@ -247,7 +283,8 @@ ); $first = false; } - // Output + + // Output everything $wgOut->addHTML( Xml::tags( 'table', @@ -256,23 +293,36 @@ 'cellspacing' => 0, 'border' => 0 ), - Xml::tags( 'tr', null, Xml::tags( 'td', null, $htmlCharts ) ) . - Xml::tags( 'tr', null, Xml::tags( 'td', null, $htmlViews ) ) + Xml::tags( 'tr', null, Xml::tags( 'td', null, $chartsHtml ) ) . + Xml::tags( 'tr', null, Xml::tags( 'td', null, $dataTablesHtml ) ) ) ); - $wgOut->addWikiMsg('contribstats-footer'); + + $wgOut->addWikiMsg( 'contribstats-footer' ); // Footer (typically empty) } /* Private Functions */ - private function query( $type, $start, $end ) { + /** + * Retrieve the donation data from the database + * + * @param boolean $mostRecent Is this query for the most recent fundraiser? + * @param string $start The start date for a fundraiser + * @param string $end The end date for a fundraiser + * @return an array of results or null + */ + private function query( $mostRecent, $start, $end ) { global $wgMemc, $egFundraiserStatisticsMinimum, $egFundraiserStatisticsMaximum, $egFundraiserStatisticsCacheTimeout; - $key = wfMemcKey( 'fundraiserstatistics', $type, $start, $end ); + // Conctruct the key for memcached + $key = wfMemcKey( 'fundraiserstatistics', $start, $end ); + + // If result exists in memcached, use that $cache = $wgMemc->get( $key ); if ( $cache != false && $cache != -1 ) { return $cache; } + // Use database $dbr = efContributionReportingConnection(); $conditions = array( @@ -281,99 +331,60 @@ 'converted_amount >= ' . $egFundraiserStatisticsMinimum, 'converted_amount <= ' . $egFundraiserStatisticsMaximum ); - switch ( $type ) { - case 'dailyTotals': - $select = $dbr->select( 'public_reporting', - array( - "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')", - 'sum(converted_amount)', - 'count(*)', - 'avg(converted_amount)', - 'max(converted_amount)', - ), - $conditions, - __METHOD__ . '-dailyTotals', - array( - 'ORDER BY' => 'received', - 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')" - ) - ); - $result = array(); - $ytd = 0; - while ( $row = $dbr->fetchRow( $select ) ) { - $row[] = $ytd += $row[1]; // YTD - $result[] = $row; - } - break; - case 'dailyTotalMax': - $result = $dbr->selectField( 'public_reporting', - array( 'sum(converted_amount) as sum' ), - $conditions, - __METHOD__ . '-dailyTotalMax', - array( - 'ORDER BY' => 'sum DESC', - 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')" - ) - ); - break; - case 'yearlyTotalMax': - $result = $dbr->selectField( 'public_reporting', - array( 'sum(converted_amount) as sum' ), - $conditions, - __METHOD__ . '-yearlyTotalMax' - ); - break; - case 'contributionsMax': - $result = $dbr->selectField( 'public_reporting', - array( 'count(converted_amount) as sum' ), - $conditions, - __METHOD__ . '-contributionsMax', - array( - 'ORDER BY' => 'sum DESC', - 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')" - ) - ); - break; - case 'averagesMax': - $result = $dbr->selectField( 'public_reporting', - array( 'avg(converted_amount) as sum' ), - $conditions, - __METHOD__ . '-averagesMax', - array( - 'ORDER BY' => 'sum DESC', - 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')" - ) - ); - break; - case 'maximumsMax': - $result = $dbr->selectField( 'public_reporting', - array( 'max(converted_amount) as sum' ), - $conditions, - __METHOD__ . '-maximumsMax', - array( - 'ORDER BY' => 'sum DESC', - 'GROUP BY' => "DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(received),'+00:00','$this->timezone'),'%Y-%m-%d')" - ) - ); - break; + + // Get the data for a fundraiser + $select = $dbr->select( 'public_reporting', + array( + "DATE_FORMAT(FROM_UNIXTIME(received),'%Y-%m-%d')", + 'sum(converted_amount)', + 'count(*)', + 'avg(converted_amount)', + 'max(converted_amount)', + ), + $conditions, + __METHOD__, + array( + 'ORDER BY' => 'received', + 'GROUP BY' => "DATE_FORMAT(FROM_UNIXTIME(received),'%Y-%m-%d')" + ) + ); + $result = array(); + $ytd = 0; + while ( $row = $dbr->fetchRow( $select ) ) { + // Insert the year-to-date amount as a record in the row (existing $ytd + sum) + $row[5] = $ytd += $row[1]; + $result[] = $row; } + if ( isset( $result ) ) { - $wgMemc->set( $key, $result, $egFundraiserStatisticsCacheTimeout ); + // Store the result in memcached. + // If it's the most recent fundraiser, cache for a short period of time, otherwise + // cache for 24 hours (since the query is expensive). + if ( $mostRecent ) { + $wgMemc->set( $key, $result, $egFundraiserStatisticsCacheTimeout ); + } else { + $wgMemc->set( $key, $result, 86400 ); + } return $result; } return null; } - + /** - * @param $values - * @return string + * Given a particular index, find the maximum for all values in a 2D array with that particular + * index as the 2nd key. + * + * @param array $fundraiserDays A 2D array of daily data for a particular fundraiser + * @param integer $comparisonIndex The index to find the maximum for + * @return an integer */ - private function dropDownList ( $values ) { - $dropDown = ''; - foreach ( $values as $value ) { - if ( $value >= 0 ) $dropDown .= '+'; - $dropDown .= "$value:00\n"; + private function getMaximum( $fundraiserDays, $comparisonIndex ) { + $max = 0; + foreach( $fundraiserDays as $day ) { + if ( $day[$comparisonIndex] > $max ) { + $max = $day[$comparisonIndex]; + } } - return $dropDown; + return $max; } } Property changes on: branches/wmf/1.18wmf1/extensions/ContributionReporting/FundraiserStatistics_body.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/wmf/1.16wmf4/extensions/ContributionReporting/FundraiserStatistics_body.php:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting/FundraiserStatistics_body.php:60970 /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php:64690-67673,75671,76496,76558,76586,76596-78420,78787,80954-80955,82413,102035,102211,103626,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904 /trunk/phase3/extensions/ContributionReporting/FundraiserStatistics_body.php:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 + /branches/wmf/1.16wmf4/extensions/ContributionReporting/FundraiserStatistics_body.php:67177,69199,76243,77266 /branches/wmf-deployment/extensions/ContributionReporting/FundraiserStatistics_body.php:60970 /trunk/extensions/ContributionReporting/FundraiserStatistics_body.php:64690-67673,75671,76496,76558,76586,76596-78420,78787,80954-80955,82413,102035,102211,103626,104370,104372,104424-104425,104428,104478,104481,104515,104889,104904,105051,105064,105145,105214,105353,105454 /trunk/phase3/extensions/ContributionReporting/FundraiserStatistics_body.php:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 Modified: branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js =================================================================== --- branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js 2011-12-07 23:25:13 UTC (rev 105484) +++ branches/wmf/1.18wmf1/extensions/ContributionReporting/modules/ext.fundraiserstatistics.js 2011-12-07 23:27:13 UTC (rev 105485) @@ -33,9 +33,11 @@ $j( '.fundraiserstats-current' ).each( function() { replaceView( $j(this).attr( 'rel' ) ) } ); + // When someone clicks on a year, hide or show that year in the chart $j( '#configholder .yeartoggle' ).click( function() { $j('.fundraiserstats-'+$j(this).attr( 'id' )).toggle(); } ); + // When someone clicks on Customize, display pop-up menu and change arrow icon. $j( '#configtoggle' ).click( function() { $j('#configholder').toggle(); if ($j( '#configtoggle a' ).css( 'background-position' ) == '0px -18px') { @@ -44,8 +46,5 @@ $j( '#configtoggle a' ).css( 'background-position','0px -18px' ); } } ); - $j( '#timezone' ).change( function() { - $j('#configform').submit(); - } ); } ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs