Index: trunk/extensions/BookManager/BookManager.body.php |
— | — | @@ -64,7 +64,16 @@ |
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | /**** All the BookManager values functions ****/ |
68 | | - |
| 68 | + private static function isViewAction() { |
| 69 | + global $wgRequest; |
| 70 | + $action = $wgRequest->getVal( 'action', 'view' ); |
| 71 | + if( $action == 'view' || $action == 'purge'){ |
| 72 | + return true; |
| 73 | + } |
| 74 | + else{ |
| 75 | + return false; |
| 76 | + } |
| 77 | + } |
69 | 78 | private static function newTitleObject( &$parser, $text = null ) { |
70 | 79 | $t = Title::newFromText( $text ); |
71 | 80 | if ( is_null( $t ) ) { |
— | — | @@ -282,7 +291,7 @@ |
283 | 292 | $prevtext = ( $prev !== '' ) ? Title::newFromText( $prev )->getSubpageText(): '' ; |
284 | 293 | $nexttext = ( $next !== '' ) ? Title::newFromText( $next )->getSubpageText(): '' ; |
285 | 294 | |
286 | | - if ( $ns === 0 ) { |
| 295 | + if ( $ns === 0 && self::isViewAction() ) { |
287 | 296 | $BookManager = wfMsgExt( "BookManager", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext ); |
288 | 297 | $BookManagerTop = wfMsgExt( "BookManager-top", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext ); |
289 | 298 | $BookManagerBottom = wfMsgExt( "BookManager-bottom", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext ); |
Index: trunk/extensions/BookManager/BookManager.php |
— | — | @@ -35,21 +35,33 @@ |
36 | 36 | if ( !defined( 'MEDIAWIKI' ) ) { |
37 | 37 | die( 'This file is a MediaWiki extension, it is not a valid entry point' ); |
38 | 38 | } |
| 39 | +$dir = dirname( __FILE__ ); |
39 | 40 | |
40 | | -/* Copyied from extensions/Collection/Collection.php */ |
41 | | -/** Namespace for "community books" */ |
42 | | -$dir = dirname( __FILE__ ); |
43 | | -$wgCommunityCollectionNamespace = NS_PROJECT; |
44 | 41 | $wgAutoloadClasses['BookManagerFunctions'] = $dir . '/BookManager.body.php'; |
| 42 | + |
45 | 43 | /**** extension basics ****/ |
46 | 44 | $wgExtensionCredits['parserhook'][] = array( |
| 45 | + 'path' => __FILE__, |
47 | 46 | 'name' => 'BookManager', |
48 | 47 | 'version' => BookManagerFunctions::VERSION, |
49 | | - 'author' => 'Raylton P. Sousa & Helder.wiki', |
| 48 | + 'author' => array('Raylton P. Sousa', 'Helder.wiki'), |
50 | 49 | 'url' => 'http://www.mediawiki.org/wiki/Extension:BookManager', |
51 | | - 'description' => 'Tools for books', |
| 50 | + 'description' => 'Tools for books', |
52 | 51 | ); |
| 52 | +/* Add CSS and JS */ |
| 53 | +$wgResourceModules['ext.BookManager'] = array( |
| 54 | + 'scripts' => 'bookmanager.js', |
| 55 | + 'styles' => 'bookmanager.css', |
| 56 | + 'messages' => array( 'BookManager', 'BookManager-top', 'BookManager-bottom' ), |
| 57 | + 'dependencies' => array( 'jquery', 'mediawiki.util'), |
| 58 | + 'localBasePath' => $dir, |
| 59 | + 'remoteExtPath' => 'BookManager' |
| 60 | +); |
53 | 61 | |
| 62 | +/* Copyied from extensions/Collection/Collection.php */ |
| 63 | +/** Namespace for "community books" */ |
| 64 | +$wgCommunityCollectionNamespace = NS_PROJECT; |
| 65 | + |
54 | 66 | /**** Register magic words ****/ |
55 | 67 | $wgExtensionFunctions[] = 'BookManagerFunctions::register'; |
56 | 68 | |
— | — | @@ -61,14 +73,7 @@ |
62 | 74 | define( 'MAG_ROOTPAGENAMEE', 'magicbookmanagercustomvar5' ); |
63 | 75 | define( 'MAG_CHAPTERNAME', 'magicbookmanagercustomvar6' ); |
64 | 76 | define( 'MAG_CHAPTERNAMEE', 'magicbookmanagercustomvar7' ); |
65 | | -$wgResourceModules['ext.BookManager'] = array( |
66 | | - 'scripts' => 'bookmanager.js', |
67 | | - 'styles' => 'bookmanager.css', |
68 | | - 'messages' => array( 'BookManager', 'BookManager-top', 'BookManager-bottom' ), |
69 | | - 'dependencies' => array( 'jquery', 'mediawiki.util'), |
70 | | - 'localBasePath' => $dir, |
71 | | - 'remoteExtPath' => 'BookManager' |
72 | | -); |
| 77 | + |
73 | 78 | $wgHooks['LanguageGetMagic'][] = 'BookManagerFunctions::LanguageGetMagic'; |
74 | 79 | |
75 | 80 | $wgHooks['MagicWordwgVariableIDs'][] = 'BookManagerFunctions::DeclareVarIds'; |