Index: trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php |
— | — | @@ -5,6 +5,11 @@ |
6 | 6 | */ |
7 | 7 | class ArticleCreationTemplates { |
8 | 8 | |
| 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 | + */ |
9 | 14 | public static function getLandingPage( $page ) { |
10 | 15 | $action = wfMessage( 'ac-action-indicator' )->escaped(); |
11 | 16 | global $wgUser, $wgArticleCreationButtons; |
— | — | @@ -32,6 +37,14 @@ |
33 | 38 | return $html; |
34 | 39 | } |
35 | 40 | |
| 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 | + */ |
36 | 49 | public static function formatButtons( $description, $page ) { |
37 | 50 | $buttons = ''; |
38 | 51 | |
— | — | @@ -46,6 +59,26 @@ |
47 | 60 | return $buttons; |
48 | 61 | } |
49 | 62 | |
| 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 | + */ |
50 | 83 | public static function formatButton( $button, $info, $page ) { |
51 | 84 | global $wgArticleCreationConfig, $wgScript, $wgUser; |
52 | 85 | |
— | — | @@ -108,6 +141,12 @@ |
109 | 142 | HTML; |
110 | 143 | } |
111 | 144 | |
| 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 | + */ |
112 | 151 | public static function formatTooltip( $titleMsg, $bodyMsg ) { |
113 | 152 | if ( ! $titleMsg ) { |
114 | 153 | return ''; |
— | — | @@ -132,6 +171,11 @@ |
133 | 172 | HTML; |
134 | 173 | } |
135 | 174 | |
| 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 | + */ |
136 | 180 | public static function formatInterstitial( $content ) { |
137 | 181 | if ( ! $content ) { |
138 | 182 | return ''; |
— | — | @@ -147,6 +191,11 @@ |
148 | 192 | HTML; |
149 | 193 | } |
150 | 194 | |
| 195 | + /** |
| 196 | + * Stub for a replacement Missing Page. |
| 197 | + * @param $article Article object for the page that was requested. |
| 198 | + * @return String HTML |
| 199 | + */ |
151 | 200 | public static function showMissingPage( $article ) { |
152 | 201 | $link = wfMessage( 'ac-link-create-article' )->params( |
153 | 202 | SpecialPage::getTitleFor( 'ArticleCreationLanding', $article->getTitle()->getPrefixedText() |
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | }, |
125 | 125 | |
126 | 126 | executeAction : function( action ) { |
127 | | - if ( $('#mw-ac-dismiss-interstitial').is(':checked') ) { |
| 127 | + if ( $('.ac-dismiss-interstitial').is(':checked') ) { |
128 | 128 | ac.disableInterstitial( action ); |
129 | 129 | } |
130 | 130 | |
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php |
— | — | @@ -75,6 +75,10 @@ |
76 | 76 | ), |
77 | 77 | ); |
78 | 78 | |
| 79 | +/** |
| 80 | + * Configuration for the buttons to appear on the ArticleCreationLanding page. |
| 81 | + * @see ArticleCreationTemplates::formatButtons |
| 82 | + **/ |
79 | 83 | $wgArticleCreationButtons = array( |
80 | 84 | 'anonymous' => array( |
81 | 85 | 'login' => array( |
— | — | @@ -142,8 +146,9 @@ |
143 | 147 | </div> |
144 | 148 | <input |
145 | 149 | 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"> |
148 | 153 | <html:msg key="ac-create-dismiss" /> |
149 | 154 | </label> |
150 | 155 | <div style="clear: both"></div> |