r83149 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83148‎ | r83149 | r83150 >
Date:15:41, 3 March 2011
Author:raylton.sousa
Status:deferred (Comments)
Tags:
Comment:
solving inconsistencies that made the navigation bar appears on the page while it was edited (or something), reorganizing some comments.
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
@@ -64,7 +64,16 @@
6565 return true;
6666 }
6767 /**** 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+ }
6978 private static function newTitleObject( &$parser, $text = null ) {
7079 $t = Title::newFromText( $text );
7180 if ( is_null( $t ) ) {
@@ -282,7 +291,7 @@
283292 $prevtext = ( $prev !== '' ) ? Title::newFromText( $prev )->getSubpageText(): '' ;
284293 $nexttext = ( $next !== '' ) ? Title::newFromText( $next )->getSubpageText(): '' ;
285294
286 - if ( $ns === 0 ) {
 295+ if ( $ns === 0 && self::isViewAction() ) {
287296 $BookManager = wfMsgExt( "BookManager", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
288297 $BookManagerTop = wfMsgExt( "BookManager-top", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
289298 $BookManagerBottom = wfMsgExt( "BookManager-bottom", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
Index: trunk/extensions/BookManager/BookManager.php
@@ -35,21 +35,33 @@
3636 if ( !defined( 'MEDIAWIKI' ) ) {
3737 die( 'This file is a MediaWiki extension, it is not a valid entry point' );
3838 }
 39+$dir = dirname( __FILE__ );
3940
40 -/* Copyied from extensions/Collection/Collection.php */
41 -/** Namespace for "community books" */
42 -$dir = dirname( __FILE__ );
43 -$wgCommunityCollectionNamespace = NS_PROJECT;
4441 $wgAutoloadClasses['BookManagerFunctions'] = $dir . '/BookManager.body.php';
 42+
4543 /**** extension basics ****/
4644 $wgExtensionCredits['parserhook'][] = array(
 45+ 'path' => __FILE__,
4746 'name' => 'BookManager',
4847 'version' => BookManagerFunctions::VERSION,
49 - 'author' => 'Raylton P. Sousa & Helder.wiki',
 48+ 'author' => array('Raylton P. Sousa', 'Helder.wiki'),
5049 'url' => 'http://www.mediawiki.org/wiki/Extension:BookManager',
51 - 'description' => 'Tools for books',
 50+ 'description' => 'Tools for books',
5251 );
 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+);
5361
 62+/* Copyied from extensions/Collection/Collection.php */
 63+/** Namespace for "community books" */
 64+$wgCommunityCollectionNamespace = NS_PROJECT;
 65+
5466 /**** Register magic words ****/
5567 $wgExtensionFunctions[] = 'BookManagerFunctions::register';
5668
@@ -61,14 +73,7 @@
6274 define( 'MAG_ROOTPAGENAMEE', 'magicbookmanagercustomvar5' );
6375 define( 'MAG_CHAPTERNAME', 'magicbookmanagercustomvar6' );
6476 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+
7378 $wgHooks['LanguageGetMagic'][] = 'BookManagerFunctions::LanguageGetMagic';
7479
7580 $wgHooks['MagicWordwgVariableIDs'][] = 'BookManagerFunctions::DeclareVarIds';

Follow-up revisions

RevisionCommit summaryAuthorDate
r83164correcting error in r83149raylton.sousa19:50, 3 March 2011

Comments

#Comment by He7d3r (talk | contribs)   17:56, 4 March 2011

The navigation bar should also be displayed on preview, as currently happens with (manual) navigation templates.

#Comment by He7d3r (talk | contribs)   21:59, 4 March 2011

I mean, the manual navigation should be always present if the HTML text of the page is present. This includes not only 'view' action, but also 'submit' and 'purge'. This is the current behaviour of the script on MediaWiki:Common.js.

Status & tagging log