Index: trunk/extensions/BookManager/BookManager.body.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * BookManager protected functions [Core] |
5 | 5 | */ |
| 6 | +$wgBookSidebarSection = false; |
6 | 7 | class BookManagerCore extends SpecialPage { |
7 | 8 | const VERSION = "0.1.6 "; |
8 | 9 | private static $chapterList; |
— | — | @@ -343,32 +344,30 @@ |
344 | 345 | $out->addHTML( "<div>$bottom</div>" ); |
345 | 346 | # adds CSS and JS to navigation bar |
346 | 347 | $out->addModuleStyles( 'ext.BookManager' ); |
347 | | - //$out->addModules( 'ext.BookManager' ); |
| 348 | + $out->addModules( 'ext.BookManager' ); |
348 | 349 | return true; |
349 | 350 | } |
350 | | - |
351 | | - |
352 | | - public static function ratingToolboxLink( &$sk, &$toolbox ) { |
353 | | - global $wgTitle; |
| 351 | + static function bookToolboxSection( &$sk, &$toolbox ) { |
| 352 | + global $wgTitle, $wgParser; |
354 | 353 | $currenttitletext = $wgTitle->getText(); |
| 354 | + $randchapter = self::pageText( $wgParser, $currenttitletext, 'rand' ); |
355 | 355 | # 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 |
366 | 368 | ?></div><?php |
367 | | - ?></div><?php |
368 | | - |
| 369 | + } |
369 | 370 | return true; |
370 | 371 | } |
371 | | - |
372 | | - |
373 | 372 | } |
374 | 373 | /** |
375 | 374 | * BookManager Functions [PrintVersion] |
Index: trunk/extensions/BookManager/BookManager.php |
— | — | @@ -67,9 +67,11 @@ |
68 | 68 | 'localBasePath' => $dir. '/client', |
69 | 69 | 'remoteExtPath' => 'BookManager/client' |
70 | 70 | ); |
| 71 | + |
71 | 72 | $wgBookManagerNamespaces = array( NS_MAIN ); |
72 | 73 | $wgBookManagerVariables = true ; |
73 | 74 | $wgBookManagerNavBar = true; |
| 75 | + |
74 | 76 | /* Copyied from extensions/Collection/Collection.php */ |
75 | 77 | /** Namespace for "community books" */ |
76 | 78 | $wgBookManagerPrefixNamespace = NS_PROJECT; |
— | — | @@ -85,5 +87,5 @@ |
86 | 88 | } |
87 | 89 | /**** Navbar ****/ |
88 | 90 | $wgHooks['BeforePageDisplay'][] = 'BookManagerNavBar::addNavBar'; |
89 | | -# Sidebar section |
90 | | -$wgHooks['BaseTemplateToolbox'][] = 'BookManagerNavBar::ratingToolboxLink'; |
| 91 | +# Rating link |
| 92 | +$wgHooks['BaseTemplateToolbox'][] = 'BookManagerNavBar::bookToolboxSection'; |