Index: trunk/extensions/MultiBoilerplate/MultiBoilerplate.i18n.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | */ |
15 | 15 | $messages['en'] = array( |
16 | 16 | 'multiboilerplate' => '', |
17 | | - 'multiboilerplate-desc' => 'Displays a box at the top of the edit page to select and load a boilerplate', |
| 17 | + 'multiboilerplate-desc' => 'Allows a boilerplate to be selected from a drop down box located above the edit form when editing pages', |
18 | 18 | 'multiboilerplate-label' => '', |
19 | 19 | 'multiboilerplate-legend' => 'Select boilerplate', |
20 | 20 | 'multiboilerplate-submit' => 'Load', |
Index: trunk/extensions/MultiBoilerplate/MultiBoilerplate.php |
— | — | @@ -1,8 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Extension for allowing a boilerplate to be selected from a drop down box at |
6 | | - * the top of the article edit page. |
| 5 | + * Allows a boilerplate to be selected from a drop down box located above the |
| 6 | + * edit form when editing non-exstant pages or, optionally (based upon |
| 7 | + * configuration variable $wgMultiBoilerplateOverwrite), load the template |
| 8 | + * over the current contents. |
| 9 | + * |
7 | 10 | * |
8 | 11 | * @addtogroup Extensions |
9 | 12 | * |
— | — | @@ -19,15 +22,15 @@ |
20 | 23 | // Extension credits. |
21 | 24 | $wgExtensionCredits[ 'other' ][] = array( |
22 | 25 | 'name' => 'MultiBoilerplate', |
23 | | - 'description' => 'Displays a box at the top of the edit page to select and load a boilerplate.', |
| 26 | + 'description' => 'Allows a boilerplate to be selected from a drop down box located above the edit form when editing pages.', |
24 | 27 | 'descriptionmsg' => 'multiboilerplate-desc', |
25 | 28 | 'author' => 'MinuteElectron', |
26 | 29 | 'url' => 'http://www.mediawiki.org/wiki/Extension:MultiBoilerplate', |
27 | | - 'version' => '1.5', |
| 30 | + 'version' => '1.6', |
28 | 31 | ); |
29 | 32 | |
30 | 33 | // Hook into EditPage::showEditForm:initial to modify the edit page header. |
31 | | -$wgHooks[ 'EditPage::showEditForm:initial' ][] = 'wfMultiBoilerplate'; |
| 34 | +$wgHooks[ 'EditPage::showEditForm:initial' ][] = 'efMultiBoilerplate'; |
32 | 35 | |
33 | 36 | // Set extension messages file. |
34 | 37 | $wgExtensionMessagesFiles[ 'MultiBoilerplate' ] = dirname( __FILE__ ) . '/MultiBoilerplate.i18n.php'; |
— | — | @@ -44,11 +47,11 @@ |
45 | 48 | $wgMultiBoilerplateOverwrite = false; |
46 | 49 | |
47 | 50 | /** |
48 | | - * Generate the form to be displayed at the top of the edit page and insert it into the page. |
| 51 | + * Generate the form to be displayed at the top of the edit page and insert it. |
49 | 52 | * @param $form EditPage object. |
50 | 53 | * @return true |
51 | 54 | */ |
52 | | -function wfMultiBoilerplate( $form ) { |
| 55 | +function efMultiBoilerplate( $form ) { |
53 | 56 | |
54 | 57 | // Get various variables needed for this extension. |
55 | 58 | global $wgMultiBoilerplateOptions, $wgMultiBoilerplateOverwrite, $wgArticle, $wgTitle, $wgRequest; |
— | — | @@ -76,7 +79,7 @@ |
77 | 80 | $options = ''; |
78 | 81 | $things = explode( "\n", str_replace( "\r", "\n", str_replace( "\r\n", "\n", $things ) ) ); // Ensure line-endings are \n |
79 | 82 | foreach( $things as $row ) { |
80 | | - $row = preg_replace( '#^\*( *)#', '', $row ); // Remove the asterix (and a space if found) from the start of the line. |
| 83 | + $row = ltrim( $row, '* ' ); // Remove the asterix (and a space if found) from the start of the line. |
81 | 84 | $row = explode( '|', $row ); |
82 | 85 | if( !isset( $row[ 1 ] ) ) return true; // Invalid syntax, abort. |
83 | 86 | $selected = false; |
— | — | @@ -84,9 +87,10 @@ |
85 | 88 | $options .= Xml::option( $row[ 0 ], $row[ 1 ], $selected ); |
86 | 89 | } |
87 | 90 | } |
88 | | - |
89 | | - if( $options == '' ) return true; // No options found in either configuration file, abort. |
90 | 91 | |
| 92 | + // No options found in either configuration file, abort. |
| 93 | + if( $options == '' ) return true; |
| 94 | + |
91 | 95 | // Append the selection form to the top of the edit page. |
92 | 96 | $form->editFormPageTop .= |
93 | 97 | Xml::openElement( 'form', array( 'id' => 'multiboilerplateform', 'name' => 'multiboilerplateform', 'method' => 'get', 'action' => $wgTitle->getEditURL() ) ) . |
Index: trunk/extensions/MultiBoilerplate/README |
— | — | @@ -0,0 +1,97 @@ |
| 2 | +MultiBoilerplate
|
| 3 | +
|
| 4 | + Version 1.6
|
| 5 | + Copyright © 2007-2008 MinuteElectron.
|
| 6 | + Licensed under the GNU General Public License 2.0 or later.
|
| 7 | +
|
| 8 | +The MultiBoilerplate extension allows a boilerplate to be selected from a drop
|
| 9 | +down box located above the edit form when editing non-exstant pages or
|
| 10 | +optionally (based upon configuration variable $wgMultiBoilerplateOverwrite),
|
| 11 | +load the template over the current contents.
|
| 12 | +
|
| 13 | +== Requirements ==
|
| 14 | +
|
| 15 | +The MultiBoilerplate extension requires MediaWiki 1.11.0 or later.
|
| 16 | +
|
| 17 | +== Installation ==
|
| 18 | +
|
| 19 | +1. Place the MultiBoilerplater.php source code into
|
| 20 | + extensions/MultiBoilerplate/MultiBoilerplate.php.
|
| 21 | +2. Place the MultiBoilerplater.i18n.php source code into
|
| 22 | + extensions/MultiBoilerplate/MultiBoilerplate.i18n.php.
|
| 23 | +3. Add require_once( "$IP/extensions/MultiBoilerplate/MultiBoilerplate.php" );
|
| 24 | + to LocalSettings.php.
|
| 25 | +4. Enjoy!
|
| 26 | +
|
| 27 | +Installation can be verified through the [[Special:Version]] page on the wiki.
|
| 28 | +
|
| 29 | +== Using the extension ==
|
| 30 | +
|
| 31 | +MultiBoilerplate adds a box to the edit page above the edit form
|
| 32 | +allowing users to load a boilerplate into the edit window.
|
| 33 | +
|
| 34 | +Fill the $wgMultiBoilerplateOptions variable with a list of boilerplate names
|
| 35 | +to templates; e.g.
|
| 36 | +$wgMultiBoilerplateOptions[ "My Boilerplate" ] = "Template:My Boilerplate";
|
| 37 | +
|
| 38 | +Alternatively set the variable to false and use the MediaWiki:Multiboilerplate
|
| 39 | +page to set options
|
| 40 | +
|
| 41 | +LocalSettings.php:
|
| 42 | + $wgMultiBoilerplateOptions = false;
|
| 43 | +MediaWiki:Multiboilerplate:
|
| 44 | + * My Boilerplate|Template:My Boilerplate
|
| 45 | +
|
| 46 | +Optionally set whether or not the selection box is displayed on pages that
|
| 47 | +already exist (defaults to false) using $wgMultiBoilerplateOverwrite.
|
| 48 | +$wgMultiBoilerplateOverwrite = true;
|
| 49 | +
|
| 50 | +== Change log ==
|
| 51 | +
|
| 52 | +Version 1.1
|
| 53 | +2007-12-18
|
| 54 | + Original version.
|
| 55 | +
|
| 56 | +Version 1.2
|
| 57 | +2008-01-07
|
| 58 | + Refactor code, fix major bug that made the extension useless and add
|
| 59 | + comments.
|
| 60 | +
|
| 61 | +Version 1.3
|
| 62 | +2008-01-19
|
| 63 | + Use Xml:: instead of manually created HTML, converted all double-quotes to
|
| 64 | + single-quotes.
|
| 65 | + Added an optional message multiboilerplate-label to display a label before
|
| 66 | + the drop-down box, and rename multiboilerplate-select to
|
| 67 | + multiboilerplate-legend and multiboilerplate-load to
|
| 68 | + multiboilerplate-submit to be less ambiguous.
|
| 69 | +
|
| 70 | +Version 1.4
|
| 71 | +2008-02-06
|
| 72 | + It is now (optionally) possible to specify boilerplates in a MediaWiki
|
| 73 | + namespace message instead of a LocalSettings.php configuration variable.
|
| 74 | + The extension now uses descriptionmsg (allowing description
|
| 75 | + internationalisation).
|
| 76 | + Part of the code that used direct database interfacing to check for article
|
| 77 | + existence has been replaced with a call to the $wgTitle global.
|
| 78 | + The $wgMultiBoilerplateThings global has been renamed to
|
| 79 | + $wgMultiBoilerplateOptions for a greater level of self-explanation.
|
| 80 | + The boilerplate selection box is no longer displayed if there are no
|
| 81 | + options.
|
| 82 | +
|
| 83 | +Version 1.5
|
| 84 | +2008-02-06
|
| 85 | + Now handles <noinclude> and<includeonly> tags.
|
| 86 | +
|
| 87 | +Version 1.6
|
| 88 | +2008-02-26
|
| 89 | + Added README.
|
| 90 | + ltrim() now used instead of preg_replace().
|
| 91 | +
|
| 92 | +== Feedback ==
|
| 93 | +
|
| 94 | +Bugs and feature requests should be reported via MediaZilla
|
| 95 | +<http://bugzilla.wikimedia.org/> and placed in the 'MediaWiki extensions'
|
| 96 | +product under the 'MultiBoilerplate' component. Alternatively send an e-mail to
|
| 97 | +<minuteelectron@googlemail.com> with any comments or suggestions, all are
|
| 98 | +welcome. |
\ No newline at end of file |
Index: trunk/extensions/CategoryStepper/CategoryStepper.i18n.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | */ |
15 | 15 | $messages['en'] = array( |
16 | 16 | 'categorystepper' => '', |
17 | | - 'categorystepper-desc' => 'Display a category stepper box on pages that are in a set of categories.', |
| 17 | + 'categorystepper-desc' => 'Displays a category stepper box allowing one to navigate forward and backwards alphabetically through one or more categories a page is in', |
18 | 18 | 'categorystepper-end' => '(End of category)', |
19 | 19 | 'categorystepper-start' => '(Start of category)', |
20 | 20 | ); |
— | — | @@ -36,7 +36,6 @@ |
37 | 37 | ); |
38 | 38 | |
39 | 39 | /** Bengali (বাংলা) |
40 | | - * @author Zaheen |
41 | 40 | */ |
42 | 41 | $messages['bn'] = array( |
43 | 42 | 'categorystepper-desc' => 'যেসব পাতা বিষয়শ্রেণীসমূহের একটি সেটে আছে, সেসব পাতাতে একটি বিষয়শ্রেণী স্টেপার বক্স দেখানো হোক।', |
Index: trunk/extensions/CategoryStepper/CategoryStepper.php |
— | — | @@ -1,7 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Display a category stepper box on pages that are in a set set of categories. |
| 5 | + * Displays a category stepper box allowing one to navigate forward and |
| 6 | + * backwards alphabetically through one or more categories a page is in, |
| 7 | + * as specified via a MediaWiki: namespace page or the $wgCategoryStepper |
| 8 | + * configuration variable. |
6 | 9 | * |
7 | 10 | * @addtogroup Extensions |
8 | 11 | * |
— | — | @@ -18,15 +21,15 @@ |
19 | 22 | // Extension credits. |
20 | 23 | $wgExtensionCredits[ 'other' ][] = array( |
21 | 24 | 'name' => 'CategoryStepper', |
22 | | - 'description' => 'Display a category stepper box on pages that are in a set of categories.', |
| 25 | + 'description' => 'Displays a category stepper box allowing one to navigate forward and backwards alphabetically through one or more categories a page is in.', |
23 | 26 | 'descriptionmsg' => 'categorystepper-desc', |
24 | 27 | 'author' => 'MinuteElectron', |
25 | 28 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CategoryStepper', |
26 | | - 'version' => '1.4', |
| 29 | + 'version' => '1.5', |
27 | 30 | ); |
28 | 31 | |
29 | | -// Hook into OutputPageBeforeHTML to add content to the end of the content. |
30 | | -$wgHooks[ 'OutputPageBeforeHTML' ][] = 'wfCategoryStepper'; |
| 32 | +// Hook into OutputPageBeforeHTML to add code to the end of the content area. |
| 33 | +$wgHooks[ 'OutputPageBeforeHTML' ][] = 'efCategoryStepper'; |
31 | 34 | |
32 | 35 | // Set extension messages file. |
33 | 36 | $wgExtensionMessagesFiles[ 'CategoryStepper' ] = dirname( __FILE__ ) . '/CategoryStepper.i18n.php'; |
— | — | @@ -51,10 +54,10 @@ |
52 | 55 | * |
53 | 56 | * @return true |
54 | 57 | */ |
55 | | -function wfCategoryStepper( &$out, &$text ) { |
| 58 | +function efCategoryStepper( $out, $text ) { |
56 | 59 | |
57 | 60 | // Get various variables needed for this extension. |
58 | | - global $wgCategoryStepper, $wgTitle, $wgArticlePath, $wgRequest; |
| 61 | + global $wgCategoryStepper, $wgTitle, $wgArticlePath, $wgRequest, $IP, $wgOut; |
59 | 62 | |
60 | 63 | // Only render on the actual view page; not edit, delete etc. |
61 | 64 | if( $wgRequest->getBool( 'action' ) ) return true; |
— | — | @@ -71,7 +74,7 @@ |
72 | 75 | $things = wfMsg( 'categorystepper' ); |
73 | 76 | $things = explode( "\n", str_replace( "\r", "\n", str_replace( "\r\n", "\n", $things ) ) ); // Ensure line-endings are \n |
74 | 77 | foreach( $things as $row ) { |
75 | | - $row = preg_replace( '#^\*( *)#', '', $row ); // Remove the asterix (and a space if found) from the start of the line. |
| 78 | + $row = ltrim( $row, '* ' ); // Remove the asterix (and a space if found) from the start of the line. |
76 | 79 | $row = explode( '|', $row ); |
77 | 80 | if( !isset( $row[ 1 ] ) ) $row[ 1 ] = $row[ 0 ]; |
78 | 81 | $wgCategoryStepper[ $row[ 0 ] ] = $row[ 1 ]; |
— | — | @@ -116,7 +119,8 @@ |
117 | 120 | $next = Xml::element( "span", array( "style" => "font-style:italic;" ), wfMsg( "categorystepper-end" ) ); |
118 | 121 | } |
119 | 122 | |
120 | | - // Generate the table at the bottom of the page and add it to the page text. |
| 123 | + // Generate the table at the bottom of the page and add it to the |
| 124 | + // page text. |
121 | 125 | $text .= |
122 | 126 | Xml::openElement( "table", array( "class" => 'categorystepper', 'style' => 'margin-left:auto;margin-right:auto;' ) ) . |
123 | 127 | Xml::openElement( "tr" ) . |
— | — | @@ -135,6 +139,9 @@ |
136 | 140 | |
137 | 141 | } |
138 | 142 | |
| 143 | + // Add style file to the output headers if it exists. |
| 144 | + if( file_exists( "$IP/skins/CategoryStepper.css" ) ) $wgOut->addStyle( 'CategoryStepper.css' ); |
| 145 | + |
139 | 146 | // Return true so things don't break. |
140 | 147 | return true; |
141 | 148 | |
Index: trunk/extensions/CategoryStepper/CategoryStepper.css |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +/**
|
| 3 | + * Style file for the CategoryStepper extension.
|
| 4 | + *
|
| 5 | + * @addtogroup Extensions
|
| 6 | + */
|
| 7 | +
|
| 8 | +table.categorystepper {
|
| 9 | + margin: 1em 1em 1em 0;
|
| 10 | + background: #f9f9f9;
|
| 11 | + border: 1px #aaa solid;
|
| 12 | + border-collapse: collapse;
|
| 13 | +}
|
| 14 | +
|
| 15 | +table.categorystepper th, table.categorystepper td {
|
| 16 | + border: 1px #aaa solid;
|
| 17 | + padding: 0.2em;
|
| 18 | +}
|
| 19 | +
|
| 20 | +table.categorystepper th {
|
| 21 | + background: #f2f2f2;
|
| 22 | + text-align: center;
|
| 23 | +}
|
| 24 | +
|
| 25 | +table.categorystepper caption {
|
| 26 | + margin-left: inherit;
|
| 27 | + margin-right: inherit;
|
| 28 | + font-weight: bold;
|
| 29 | +}
|
| 30 | +
|
| 31 | +table.categorystepper {
|
| 32 | + background-color: transparent;
|
| 33 | +}
|
Index: trunk/extensions/CategoryStepper/README |
— | — | @@ -0,0 +1,85 @@ |
| 2 | +CategoryStepper
|
| 3 | +
|
| 4 | + Version 1.5
|
| 5 | + Copyright © 2007-2008 MinuteElectron.
|
| 6 | + Licensed under the GNU General Public License 2.0 or later.
|
| 7 | +
|
| 8 | +The CategoryStepper extension displays a category stepper box allowing one to
|
| 9 | +navigate forward and backwards alphabetically through one or more categories a
|
| 10 | +page is in, as specified via a MediaWiki: namespace page or the
|
| 11 | +$wgCategoryStepper configuration variable.
|
| 12 | +
|
| 13 | +== Requirements ==
|
| 14 | +
|
| 15 | +The CategoryStepper extension requires MediaWiki 1.11.0 or later.
|
| 16 | +
|
| 17 | +== Installation ==
|
| 18 | +
|
| 19 | +1. Place the CategoryStepper.php source code into
|
| 20 | + extensions/CategoryStepper/CategoryStepper.php.
|
| 21 | +2. Place the CategoryStepper.i18n.php source code into
|
| 22 | + extensions/CategoryStepper/CategoryStepper.i18n.php.
|
| 23 | +3. If desired place the CategoryStepper.css source code into
|
| 24 | + skins/CategoryStepper.css.
|
| 25 | +4. Add require_once( "$IP/extensions/CategoryStepper/CategoryStepper.php" ); to
|
| 26 | + LocalSettings.php.
|
| 27 | +5. Enjoy!
|
| 28 | +
|
| 29 | +Installation can be verified through the [[Special:Version]] page on the wiki.
|
| 30 | +
|
| 31 | +== Using the extension ==
|
| 32 | +
|
| 33 | +CategoryStepper adds a box to the bottom of the content area on pages which are
|
| 34 | +in a specified category. Categories can be configured either via using the
|
| 35 | +$wgCategoryStepper configuration variable or by mofifying the page
|
| 36 | +MediaWiki:categorystepper.
|
| 37 | +
|
| 38 | +Fill the $wgCategoryStepper variable with a list of category names to stepper
|
| 39 | +box titles; e.g.
|
| 40 | +$wgCategoryStepper[ "Astronauts" ] = "Astronauts Box Title";
|
| 41 | +
|
| 42 | +Alternatively set the $wgCategoryStepper variable to false and use the
|
| 43 | +MediaWiki:Categorystepper page to set options; e.g.
|
| 44 | +
|
| 45 | +LocalSettings.php:
|
| 46 | + $wgCategoryStepper = false;
|
| 47 | +MediaWiki:Categorystepper:
|
| 48 | + * Astronauts|Astronauts Box Title
|
| 49 | +
|
| 50 | +== Change log ==
|
| 51 | +
|
| 52 | +Version 1.1
|
| 53 | +2008-01-19
|
| 54 | + Original version.
|
| 55 | +
|
| 56 | +Version 1.2
|
| 57 | +2008-01-20
|
| 58 | + Added missing space in i18n file.
|
| 59 | +
|
| 60 | +Version 1.3
|
| 61 | +2008-02-16
|
| 62 | + No longer render on edit, protect or delete pages.
|
| 63 | + Allow modification of categories and title via the
|
| 64 | + MediaWiki:categorystepper page.
|
| 65 | +
|
| 66 | +Version 1.4
|
| 67 | +2008-02-17
|
| 68 | + The second parameter of each row on the MediaWiki:categorystepper page is
|
| 69 | + now optional and defaults to the first parameter.
|
| 70 | +
|
| 71 | +Version 1.5
|
| 72 | +2008-02-26
|
| 73 | + Default wikitable-like styling is now included and can optionally be used,
|
| 74 | + or overridden via MediaWiki:Common.css or the individual skins CSS
|
| 75 | + MediaWiki namespace pages.
|
| 76 | + README added.
|
| 77 | + Function wfCategoryStepper renamed to efCategoryStepper.
|
| 78 | + ltrim() now used instead of preg_replace().
|
| 79 | +
|
| 80 | +== Feedback ==
|
| 81 | +
|
| 82 | +Bugs and feature requests should be reported via MediaZilla
|
| 83 | +<http://bugzilla.wikimedia.org/> and placed in the 'MediaWiki extensions'
|
| 84 | +product under the CategoryStepper component. Alternatively send an e-mail to
|
| 85 | +<minuteelectron@googlemail.com> with any comments or suggestions, all are
|
| 86 | +welcome.
|