Page MenuHomePhabricator

add MultiBoilerplate.page.php component - list boilerplates
Closed, ResolvedPublic

Description

Author: alfred.maghi

Description:
Patch extension and extension messages

Addition of a parameter to display a special page listing boilerplates. Default is false i.e. no special page.


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/Extension:MultiBoilerplate/Special_page

attachment OptionalSpecialPage.patch ignored as obsolete

Details

Reference
bz19433

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:38 PM
bzimport set Reference to bz19433.

alfred.maghi wrote:

Code of special page listing boilerplates

attachment SpecialBoilerplates.php ignored as obsolete

alfred.maghi wrote:

no more hard-coded english

With ^demon suggest: "and youve got a bunch of hard-coded english"

attachment PatchToGetSpecialPageOption.patch ignored as obsolete

alfred.maghi wrote:

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."

attachment SpecialBoilerplates.txt ignored as obsolete

alfred.maghi wrote:

Patch to be commited

attachment Add-on patch.patch ignored as obsolete

alfred.maghi wrote:

Make the boilerplates listing includable

attachment Add-on patch.patch ignored as obsolete

(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?

alfred.maghi wrote:

Clean code thanks to Niklas Laxström

attachment Add-on patch3.patch ignored as obsolete

alfred.maghi wrote:

parent class in constructor

attachment Add-on patch3.patch ignored as obsolete

alfred.maghi wrote:

(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

alfred.maghi wrote:

cleaning .i18n

attachment Add-on patch.patch ignored as obsolete

alfred.maghi wrote:

+ MediaWiki:Multiboilerplate customization

for MediaWiki:Multiboilerplate customization:

+ if (substr(ltrim($row), 0, 1)=="*")

Attached:

robert wrote:

Done in r54083. Thanks!