r84902 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84901‎ | r84902 | r84903 >
Date:13:49, 28 March 2011
Author:raylton.sousa
Status:deferred (Comments)
Tags:
Comment:
Add more configurations options
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
@@ -24,7 +24,7 @@
2525 */
2626 protected static function getBookPagePrefixes() {
2727 // global $wgUser;
28 - global $wgCommunityCollectionNamespace;
 28+ global $wgBookManagerPrefixNamespace;
2929
3030 $result = array();
3131 /*
@@ -40,7 +40,7 @@
4141 $t = wfMsgForContent( 'coll-community_book_prefix' );
4242 if ( wfEmptyMsg( 'coll-community_book_prefix', $t ) || $t == '-' ) {
4343 $title = Title::makeTitle(
44 - $wgCommunityCollectionNamespace,
 44+ $wgBookManagerPrefixNamespace,
4545 wfMsgForContent( 'coll-collections' )
4646 );
4747 $result['community-prefix'] = $title->getPrefixedText() . '/';
@@ -295,7 +295,7 @@
296296 # Return True if Message is non empty
297297 $MsgIsEmpty = ( wfEmptyMsg( "BookManager" )
298298 && wfEmptyMsg( "BookManager-top" )
299 - && wfEmptyMsg( "BookManager-bottom" ));
 299+ && wfEmptyMsg( "BookManager-bottom" ) );
300300 # Generate HTML or system messages values( $1 for $prev, $2 for $prevtext, $3 for $base, $4 for $basetext, $5 for $next and $6 for $nexttext ).
301301 $prevtext = ( $prev !== '' ) ? Title::newFromText( $prev )->getSubpageText(): '' ;
302302 $nexttext = ( $next !== '' ) ? Title::newFromText( $next )->getSubpageText(): '' ;
@@ -364,7 +364,7 @@
365365 $this->outputHeader();
366366
367367 $book = !is_null( $book ) ? $book : $wgRequest->getVal( 'book' );
368 - if( !isset( $book ) ){
 368+ if ( !isset( $book ) ) {
369369 $wgOut->addWikiMsg( 'printversion-no-book' );
370370 return;
371371 }
@@ -384,4 +384,8 @@
385385 }
386386 $wgOut->addWikiText( $text );
387387 }
 388+
388389 }
 390+
 391+
 392+
Index: trunk/extensions/BookManager/BookManager.php
@@ -37,14 +37,13 @@
3838 }
3939 $dir = dirname( __FILE__ );
4040 $wgAutoloadClasses['BookManagerCore'] = $dir . '/BookManager.body.php';
41 -$wgAutoloadClasses['BookManagerVariables'] = $dir . '/BookManager.body.php';
 41+
4242 $wgAutoloadClasses['BookManagerNavBar'] = $dir . '/BookManager.body.php';
4343 $wgAutoloadClasses['PrintVersion'] = $dir . '/BookManager.body.php';
4444 $wgExtensionMessagesFiles['PrintVersion'] = $dir . '/PrintVersion.i18n.php';
4545 $wgExtensionAliasesFiles['PrintVersion'] = $dir . '/PrintVersion.alias.php';
4646 $wgSpecialPages['PrintVersion'] = 'PrintVersion';
4747 $wgSpecialPageGroups['PrintVersion'] = 'other';
48 -$wgExtensionMessagesFiles['BookManager'] = $dir . '/BookManager.i18n.php';
4948
5049
5150
@@ -55,7 +54,7 @@
5655 'version' => BookManagerCore::VERSION,
5756 'author' => array( 'Raylton P. Sousa', 'Helder.wiki' ),
5857 'url' => 'http://www.mediawiki.org/wiki/Extension:BookManager',
59 - 'descriptionmsg' => 'bookmanager-desc',
 58+ 'description' => 'Tools for books',
6059 );
6160 /* Add CSS and JS */
6261 $wgResourceModules['ext.BookManager'] = array(
@@ -67,12 +66,15 @@
6867 'remoteExtPath' => 'BookManager'
6968 );
7069 $wgBookManagerNamespaces = array( NS_MAIN );
 70+$wgBookManagerVariables = true ;
7171 $wgBookManagerNavBar = true;
7272 /* Copyied from extensions/Collection/Collection.php */
7373 /** Namespace for "community books" */
74 -$wgCommunityCollectionNamespace = NS_PROJECT;
 74+$wgBookManagerPrefixNamespace = NS_PROJECT;
 75+/**** Register magic words ****/
 76+if ( $wgBookManagerVariables ) {
 77+$wgAutoloadClasses['BookManagerVariables'] = $dir . '/BookManager.body.php';
7578
76 -/**** Register magic words ****/
7779 $wgHooks['ParserFirstCallInit'][] = 'BookManagerVariables::register';
7880
7981 $wgHooks['LanguageGetMagic'][] = 'BookManagerVariables::LanguageGetMagic';
@@ -80,9 +82,9 @@
8183 $wgHooks['MagicWordwgVariableIDs'][] = 'BookManagerVariables::DeclareVarIds';
8284
8385 $wgHooks['ParserGetVariableValueSwitch'][] = 'BookManagerVariables::AssignAValue';
84 -
 86+}
 87+/**** Navbar ****/
8588 $wgHooks['OutputPageBeforeHTML'][] = 'BookManagerNavBar::addText';
8689
8790 $wgHooks['BeforePageDisplay'][] = 'BookManagerNavBar::injectStyleAndJS';
8891
89 -

Comments

#Comment by He7d3r (talk | contribs)   00:15, 29 March 2011
$wgBookManagerPrefixNamespace

doesn't seems a good name, since the pages in the specified namespace will have "lists of chapters" instead of "prefixes". Maybe $wgBookManagerListNamespace, or $wgBookManagerBookNamespace.

I think you reverted part of r84601 by accident:

-	'descriptionmsg' => 'bookmanager-desc',
+	'description'	=> 'Tools for books',

Status & tagging log