r81646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81645‎ | r81646 | r81647 >
Date:20:03, 7 February 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Pass additional steps in the URL to pages
Modified paths:
  • /trunk/extensions/ResearchTools/ResearchToolsPage.php (modified) (history)
  • /trunk/extensions/ResearchTools/SpecialResearchTools.php (modified) (history)
  • /trunk/extensions/ResearchTools/pages/ResearchToolsClicksPage.php (modified) (history)
  • /trunk/extensions/ResearchTools/pages/ResearchToolsDashboardPage.php (modified) (history)
  • /trunk/extensions/ResearchTools/pages/ResearchToolsPrefsPage.php (modified) (history)
  • /trunk/extensions/ResearchTools/pages/ResearchToolsSurveysPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ResearchTools/pages/ResearchToolsPrefsPage.php
@@ -2,7 +2,7 @@
33
44 class ResearchToolsPrefsPage implements ResearchToolsPage {
55
6 - public function main() {
 6+ public function main( array $steps ) {
77 ?>
88 Hello pref stats!
99 <?php
Index: trunk/extensions/ResearchTools/pages/ResearchToolsSurveysPage.php
@@ -2,7 +2,7 @@
33
44 class ResearchToolsSurveysPage implements ResearchToolsPage {
55
6 - public function main() {
 6+ public function main( array $steps ) {
77 ?>
88 Hello surveys!
99 <?php
Index: trunk/extensions/ResearchTools/pages/ResearchToolsDashboardPage.php
@@ -2,7 +2,7 @@
33
44 class ResearchToolsDashboardPage implements ResearchToolsPage {
55
6 - public function main() {
 6+ public function main( array $steps ) {
77 ?>
88 Hello dashboard!
99 <?php
Index: trunk/extensions/ResearchTools/pages/ResearchToolsClicksPage.php
@@ -2,7 +2,7 @@
33
44 class ResearchToolsClicksPage implements ResearchToolsPage {
55
6 - public function main() {
 6+ public function main( array $steps ) {
77 ?>
88 Hello click tracking!
99 <?php
Index: trunk/extensions/ResearchTools/ResearchToolsPage.php
@@ -2,5 +2,5 @@
33
44 interface ResearchToolsPage {
55
6 - public function main();
 6+ public function main( array $steps );
77 }
Index: trunk/extensions/ResearchTools/SpecialResearchTools.php
@@ -26,32 +26,33 @@
2727
2828 $this->setHeaders();
2929
30 - $current = current( explode( '/', $par ) );
31 - if ( !isset( self::$pages[$current] ) ) {
32 - $current = key( self::$pages );
 30+ $steps = explode( '/', $par );
 31+ $base = array_shift( $steps );
 32+ if ( !isset( self::$pages[$base] ) ) {
 33+ $base = key( self::$pages );
3334 }
3435
3536 ob_start();
3637
37 - self::renderNavigation( $current );
 38+ self::renderNavigation( $base );
3839
3940 ?><div class="researchTools-page"><?php
4041
41 - $page = new self::$pages[$current];
42 - $page->main();
 42+ $page = new self::$pages[$base];
 43+ $page->main( $steps );
4344
4445 ?></div><?php
4546
4647 $wgOut->addHtml( ob_get_clean() );
4748 }
4849
49 - protected function renderNavigation( $current ) {
 50+ protected function renderNavigation( $base ) {
5051 global $wgUser;
5152
5253 ?>
5354 <ul class="researchTools-navigation">
5455 <?php foreach ( self::$pages as $page => $class ): ?>
55 - <li class="researchTools-navigation-item <?php echo $page == $current ? 'researchTools-navigation-item-current' : '' ?>">
 56+ <li class="researchTools-navigation-item <?php echo $page == $base ? 'researchTools-navigation-item-current' : '' ?>">
5657 <?php echo $wgUser->getSkin()->link( $this->getTitle( $page ), wfMsg( "researchtools-page-$page" ) ) ?>
5758 </li>
5859 <?php endforeach; ?>

Status & tagging log