Index: trunk/extensions/ContributionReporting/FundraiserStatistics_body.php |
— | — | @@ -92,8 +92,9 @@ |
93 | 93 | // HTML-time! |
94 | 94 | $view = 0; |
95 | 95 | $htmlViews = ''; |
96 | | - foreach ( $egFundraiserStatisticsFundraisers as $fundraiser ) { |
| 96 | + foreach ( $egFundraiserStatisticsFundraisers as $fundraiserIndex => $fundraiser ) { |
97 | 97 | $days = $this->query( 'dailyTotals', $fundraiser['start'], $fundraiser['end'] ); |
| 98 | + $mostRecentFundraiser = $fundraiserIndex == count( $egFundraiserStatisticsFundraisers ) - 1; |
98 | 99 | foreach ( $charts as $name => $chart ) { |
99 | 100 | $column = 0; |
100 | 101 | foreach( $days as $i => $day ) { |
— | — | @@ -103,9 +104,12 @@ |
104 | 105 | $height = $chart['factor'] * $day[$chart['index']]; |
105 | 106 | $attributes = array( |
106 | 107 | 'style' => "height:{$height}px", |
107 | | - 'class' => "fundraiserstats-bar-{$fundraiser['id']}", |
108 | | - 'onMouseOver' => "replaceView( 'fundraiserstats-view-box-{$view}' )" |
| 108 | + 'class' => "fundraiserstats-bar fundraiserstats-bar-{$fundraiser['id']}", |
| 109 | + 'rel' => "fundraiserstats-view-box-{$view}", |
109 | 110 | ); |
| 111 | + if ( $mostRecentFundraiser && $i == count( $days ) -1 ) { |
| 112 | + $attributes['class'] .= ' fundraiserstats-current'; |
| 113 | + } |
110 | 114 | $charts[$name]['data'][$column] .= Xml::tags( |
111 | 115 | 'td', array( 'valign' => 'bottom' ), Xml::element( 'div', $attributes, '', false ) |
112 | 116 | ); |
— | — | @@ -166,8 +170,8 @@ |
167 | 171 | 'div', |
168 | 172 | array( |
169 | 173 | 'id' => "fundraiserstats-chart-{$chart}-tab", |
170 | | - 'class' => 'fundraiserstats-chart-tab-' . ( $first ? 'current' : 'normal' ), |
171 | | - 'onClick' => "replaceChart( 'fundraiserstats-chart-{$chart}' )" |
| 174 | + 'class' => 'fundraiserstats-chart-tab fundraiserstats-chart-tab-' . ( $first ? 'current' : 'normal' ), |
| 175 | + 'rel' => "fundraiserstats-chart-{$chart}" |
172 | 176 | ), |
173 | 177 | wfMsg( 'fundraiserstats-tab-' . $chart ) |
174 | 178 | ); |
Index: trunk/extensions/ContributionReporting/FundraiserStatistics.js |
— | — | @@ -1,22 +1,36 @@ |
2 | 2 | /* JavaScript */ |
3 | 3 | |
4 | | -var currentViewID = 'fundraiserstats-view-box-0'; |
5 | | -function replaceView( newLayerID ) { |
6 | | - var currentLayer = document.getElementById( currentViewID ); |
7 | | - var newLayer = document.getElementById( newLayerID ); |
8 | | - currentLayer.style.display = 'none'; |
9 | | - newLayer.style.display = 'block'; |
10 | | - currentViewID = newLayerID; |
11 | | -} |
12 | | -var currentChartID = 'fundraiserstats-chart-totals'; |
13 | | -function replaceChart( newLayerID ) { |
14 | | - var currentLayer = document.getElementById( currentChartID ); |
15 | | - var currentTab = document.getElementById( currentChartID + '-tab' ); |
16 | | - var newLayer = document.getElementById( newLayerID ); |
17 | | - var newTab = document.getElementById( newLayerID + '-tab' ); |
18 | | - currentLayer.style.display = 'none'; |
19 | | - currentTab.setAttribute( 'class', 'fundraiserstats-chart-tab-normal' ); |
20 | | - newLayer.style.display = 'block'; |
21 | | - newTab.setAttribute( 'class', 'fundraiserstats-chart-tab-current' ); |
22 | | - currentChartID = newLayerID; |
23 | | -} |
| 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 | +} ); |