r110983 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110982‎ | r110983 | r110984 >
Date:23:34, 8 February 2012
Author:werdna
Status:ok
Tags:
Comment:
Add lots of documentation to ArticleCreationTemplates.php
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php
@@ -5,6 +5,11 @@
66 */
77 class ArticleCreationTemplates {
88
 9+ /**
 10+ * Retrieves an ArticleCreationLanding page for the given page title.
 11+ * @param $page String: The page name passed on the URL.
 12+ * @return String HTML
 13+ */
914 public static function getLandingPage( $page ) {
1015 $action = wfMessage( 'ac-action-indicator' )->escaped();
1116 global $wgUser, $wgArticleCreationButtons;
@@ -32,6 +37,14 @@
3338 return $html;
3439 }
3540
 41+ /**
 42+ * Formats a set of buttons from an array.
 43+ * @param $description Associative array. Keys are button names,
 44+ * Values are associative arrays suitable to pass to formatButton
 45+ * @param $page String: The page name passed on the URL.
 46+ * @return String HTML
 47+ * @see ArticleCreationTemplates::formatButton
 48+ */
3649 public static function formatButtons( $description, $page ) {
3750 $buttons = '';
3851
@@ -46,6 +59,26 @@
4760 return $buttons;
4861 }
4962
 63+ /**
 64+ * Formats a single button.
 65+ * @param $button String name of the button.
 66+ * @param $info Associative array. Valid keys:
 67+ * title: (required) Message key to use for the button's major text.
 68+ * text: (required) Message key for help message to display on the
 69+ * lower part of the button.
 70+ * color: (default: blue) The colour to show the button in
 71+ * tooltip: Associative array with keys title and text, message keys.
 72+ * For a tooltip that is displayed when the button is hovered over.
 73+ * Both messages will be parsed as Wikitext before display.
 74+ * interstitial: HTML to be passed through jquery.localize() for an
 75+ * interstitial to be shown before going ahead with the action.
 76+ * Should contain a button with the class ac-action-button that
 77+ * proceeds with the action.
 78+ * *MAY* also contain a checkbox with the class ac-dismiss-interstitial
 79+ * that will be used to dismiss that interstitial.
 80+ * @param $page String: The page name passed on the URL.
 81+ * @return String HTML
 82+ */
5083 public static function formatButton( $button, $info, $page ) {
5184 global $wgArticleCreationConfig, $wgScript, $wgUser;
5285
@@ -108,6 +141,12 @@
109142 HTML;
110143 }
111144
 145+ /**
 146+ * Formats a tooltip for a button.
 147+ * @param $titleMsg Message key for the title text of the tooltip. Will be parsed.
 148+ * @param $bodyMsg Message key for the tooltip content. Will be parsed.
 149+ * @return String HTML
 150+ */
112151 public static function formatTooltip( $titleMsg, $bodyMsg ) {
113152 if ( ! $titleMsg ) {
114153 return '';
@@ -132,6 +171,11 @@
133172 HTML;
134173 }
135174
 175+ /**
 176+ * Formats an interstitial tooltip shown when certain buttons are clicked.
 177+ * @param $content String HTML content, to be passed through jQuery.localize() on the client side.
 178+ * @return String HTML
 179+ */
136180 public static function formatInterstitial( $content ) {
137181 if ( ! $content ) {
138182 return '';
@@ -147,6 +191,11 @@
148192 HTML;
149193 }
150194
 195+ /**
 196+ * Stub for a replacement Missing Page.
 197+ * @param $article Article object for the page that was requested.
 198+ * @return String HTML
 199+ */
151200 public static function showMissingPage( $article ) {
152201 $link = wfMessage( 'ac-link-create-article' )->params(
153202 SpecialPage::getTitleFor( 'ArticleCreationLanding', $article->getTitle()->getPrefixedText()
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -123,7 +123,7 @@
124124 },
125125
126126 executeAction : function( action ) {
127 - if ( $('#mw-ac-dismiss-interstitial').is(':checked') ) {
 127+ if ( $('.ac-dismiss-interstitial').is(':checked') ) {
128128 ac.disableInterstitial( action );
129129 }
130130
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php
@@ -75,6 +75,10 @@
7676 ),
7777 );
7878
 79+/**
 80+ * Configuration for the buttons to appear on the ArticleCreationLanding page.
 81+ * @see ArticleCreationTemplates::formatButtons
 82+ **/
7983 $wgArticleCreationButtons = array(
8084 'anonymous' => array(
8185 'login' => array(
@@ -142,8 +146,9 @@
143147 </div>
144148 <input
145149 type="checkbox"
146 - id="mw-ac-dismiss-interstitial" />
147 - <label for="mw-ac-dismiss-interstitial">
 150+ id="mw-ac-dismiss-create"
 151+ class="ac-dismiss-interstitial" />
 152+ <label for="mw-ac-dismiss-create">
148153 <html:msg key="ac-create-dismiss" />
149154 </label>
150155 <div style="clear: both"></div>

Status & tagging log