Last modified: 2009-07-31 09:55:59 UTC
Created attachment 6281 [details] Patch extension and extension messages Addition of a parameter to display a special page listing boilerplates. Default is false i.e. no special page.
Created attachment 6282 [details] Code of special page listing boilerplates
Created attachment 6283 [details] no more hard-coded english With ^demon suggest: "and youve got a bunch of hard-coded english"
Created attachment 6284 [details] Cleaner Code for SpecialPage With ^demon suggest: "^demon: almaghi: you dont need to pass '' and true in your SpecialPage constructor. ^demon: and you'll want newlines after "* [[$template]]" or it'll all end up on one line."
Created attachment 6335 [details] Patch to be commited
Created attachment 6336 [details] Make the boilerplates listing includable
(In reply to comment #5) > Created an attachment (id=6336) [details] > Make the boilerplates listing includable Why $ in messages? Variables aren't parsed in single quotes. > 'multiboilerplate-desc' => 'Allows a [[special:boilerplates|boilerplate]] to be selected from a drop down box located above the edit form when editing pages', > + 'description' => 'Allows a [[special:boilerplates|boilerplate]] to be selected from a drop down box located above the edit form when editing pages.', > + * Special:boilerplates, provides a list of MediaWiki:Multiboilerplate or $wgMultiBoilerplateOptions. Inconsistent casing. +if( !defined( 'MEDIAWIKI' ) ) { + echo( "not a valid entry point.\n" ); + die( 1 ); +} Unnecessary with a file which only has a class definition. > + IncludableSpecialPage::SpecialPage( 'Boilerplates' ); parent:: ? Can't remember right now if it was safe to call old-style construct with __construct or new style constructor with old style class name. + $wgOut->addWikiText( wfMsg( "multiboilerplate-special-pagetext" ) ); addWikiMsg for this and other similar instances + $wgOut->addHTML( '<h2>' ); + $wgOut->addWikiText( wfMsg( "boilerplates-name" ) ); + $wgOut->addHTML( '</h2>' ); wrapWikiMsg perhaps? + if( !$this->mIncluding ) $wgOut->addWikiText( wfMsg( "multiboilerplate-special-define-on-localsettings" ) ); there is also accessor including() + if( $wgRequest->getVal( 'boilerplate' ) == $template ) $selected = true; Usually constants like $wgRequest->getVal( 'boilerplate' ) are first put into variable outside of the loop. I'd also use getText and === to be sure. + $options .= Xml::option( $name, $template, $selected ); Wtf are you doing here? Building Xml options and not using them for anything. + $things = wfMsg( 'multiboilerplate' ); Is this supposed to change with user interface language? The patch has inconsistent spacing, possible mixing spaces and tabs for indentation. + if( $options == '' ) return true; + + } Something tells me there is shortway way to write this. + global $wgOut, $wgUser, $wgLang, $wgContLang, $wgMultiBoilerplateOptions, $wgMultiBoilerplateOverwrite, $wgArticle, $wgTitle, $wgRequest; There are unused globals in this list. +$wgMultiBoilerplateDiplaySpecialPage = true; What's the purpose of this? What is the purpose of the whole patch?
Created attachment 6343 [details] Clean code thanks to Niklas Laxström
Created attachment 6344 [details] parent class in constructor
(In reply to comment #6) > (In reply to comment #5) > +$wgMultiBoilerplateDiplaySpecialPage = true; > What's the purpose of this? What is the purpose of the whole patch? > I had a wiki user asking me "where are located the boilerplates" and he was looking for a special page. For wikis that don't want that extra special page, $wgMultiBoilerplateDiplaySpecialPage = False
Created attachment 6347 [details] cleaning .i18n
Created attachment 6382 [details] + MediaWiki:Multiboilerplate customization for MediaWiki:Multiboilerplate customization: + if (substr(ltrim($row), 0, 1)=="*")
Done in r54083. Thanks!