r87874 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87873‎ | r87874 | r87875 >
Date:12:38, 11 May 2011
Author:raylton.sousa
Status:deferred
Tags:
Comment:
fix last commit
Modified paths:
  • /trunk/extensions/BookManager/BookManager.body.php (modified) (history)
  • /trunk/extensions/BookManager/BookManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BookManager/BookManager.body.php
@@ -2,6 +2,7 @@
33 /**
44 * BookManager protected functions [Core]
55 */
 6+$wgBookSidebarSection = false;
67 class BookManagerCore extends SpecialPage {
78 const VERSION = "0.1.6 ";
89 private static $chapterList;
@@ -343,32 +344,30 @@
344345 $out->addHTML( "<div>$bottom</div>" );
345346 # adds CSS and JS to navigation bar
346347 $out->addModuleStyles( 'ext.BookManager' );
347 - //$out->addModules( 'ext.BookManager' );
 348+ $out->addModules( 'ext.BookManager' );
348349 return true;
349350 }
350 -
351 -
352 - public static function ratingToolboxLink( &$sk, &$toolbox ) {
353 - global $wgTitle;
 351+ static function bookToolboxSection( &$sk, &$toolbox ) {
 352+ global $wgTitle, $wgParser;
354353 $currenttitletext = $wgTitle->getText();
 354+ $randchapter = self::pageText( $wgParser, $currenttitletext, 'rand' );
355355 # Add book tools section and all yours itens
356 - ?><div class="portal" id='p-tb'><?php
357 - ?><h5><?php $sk->msg( 'bm-booktools-section' ); ?></h5><?php
358 - ?><div class="body"><?php
359 - ?><ul><?php
360 - ?><li id="t-rating"><?php
361 - ?><a href="<?php echo htmlspecialchars( self::pageText( $wgParser, $currenttitletext, 'rand' )->getLocalURL()) ?>"><?php
362 - echo $sk->msg( 'bm-randomchapter-link' );
363 - ?></a><?php
364 - ?></li><?php
365 - ?></ul><?php
 356+ if ( $randchapter ){
 357+ ?><div class="portal" id='p-tb'><?php
 358+ ?><h5><?php $sk->msg( 'bm-booktools-section' ); ?></h5><?php
 359+ ?><div class="body"><?php
 360+ ?><ul><?php
 361+ ?><li id="t-rating"><?php
 362+ ?><a href="<?php echo htmlspecialchars( $randchapter->getLocalURL() ) ?>"><?php
 363+ echo $sk->msg( 'bm-randomchapter-link' );
 364+ ?></a><?php
 365+ ?></li><?php
 366+ ?></ul><?php
 367+ ?></div><?php
366368 ?></div><?php
367 - ?></div><?php
368 -
 369+ }
369370 return true;
370371 }
371 -
372 -
373372 }
374373 /**
375374 * BookManager Functions [PrintVersion]
Index: trunk/extensions/BookManager/BookManager.php
@@ -67,9 +67,11 @@
6868 'localBasePath' => $dir. '/client',
6969 'remoteExtPath' => 'BookManager/client'
7070 );
 71+
7172 $wgBookManagerNamespaces = array( NS_MAIN );
7273 $wgBookManagerVariables = true ;
7374 $wgBookManagerNavBar = true;
 75+
7476 /* Copyied from extensions/Collection/Collection.php */
7577 /** Namespace for "community books" */
7678 $wgBookManagerPrefixNamespace = NS_PROJECT;
@@ -85,5 +87,5 @@
8688 }
8789 /**** Navbar ****/
8890 $wgHooks['BeforePageDisplay'][] = 'BookManagerNavBar::addNavBar';
89 -# Sidebar section
90 -$wgHooks['BaseTemplateToolbox'][] = 'BookManagerNavBar::ratingToolboxLink';
 91+# Rating link
 92+$wgHooks['BaseTemplateToolbox'][] = 'BookManagerNavBar::bookToolboxSection';

Status & tagging log