r110901 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110900‎ | r110901 | r110902 >
Date:00:09, 8 February 2012
Author:werdna
Status:ok
Tags:
Comment:
Two fixes for ArticleCreationWorkflow:
1. Made the pages marginally non-JS-compatible.
2. Stopped :visited from overriding the colouring of the links
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/SpecialArticleCreationLanding.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/includes/ArticleCreationTemplates.php (modified) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css (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,7 +5,7 @@
66 */
77 class ArticleCreationTemplates {
88
9 - public static function getLandingPage() {
 9+ public static function getLandingPage( $page ) {
1010 $action = wfMessage( 'ac-action-indicator' )->escaped();
1111
1212 global $wgUser, $wgArticleCreationButtons;
@@ -17,7 +17,7 @@
1818 $buttons = $wgArticleCreationButtons['logged-in'];
1919 }
2020
21 - $buttons = self::formatButtons( $buttons );
 21+ $buttons = self::formatButtons( $buttons, $page );
2222
2323 $html = <<<HTML
2424 <span class="article-creation-heading">$action</span>
@@ -29,21 +29,22 @@
3030 return $html;
3131 }
3232
33 - public static function formatButtons( $description ) {
 33+ public static function formatButtons( $description, $page ) {
3434 $buttons = '';
3535
3636 foreach ( $description as $button => $info ) {
3737 $buttons .= self::formatButton(
3838 $button,
3939 wfMessage($info['title']),
40 - wfMessage($info['text'])
 40+ wfMessage($info['text']),
 41+ $page
4142 );
4243 }
4344
4445 return $buttons;
4546 }
4647
47 - public static function formatButton( $button, $buttonTitle, $buttonText ) {
 48+ public static function formatButton( $button, $buttonTitle, $buttonText, $page ) {
4849 if ( $buttonTitle instanceof Message ) {
4950 $buttonTitle = $buttonTitle->escaped();
5051 }
@@ -52,11 +53,18 @@
5354 $buttonText = $buttonText->escaped();
5455 }
5556
56 - global $wgArticleCreationConfig;
 57+ global $wgArticleCreationConfig, $wgScript, $wgUser;
5758
58 - //$target = htmlspecialchars( $wgArticleCreationConfig['action-url'][$button] );
59 - $target = '#';
 59+ $target = htmlspecialchars( $wgArticleCreationConfig['action-url'][$button] );
6060
 61+ $replacements = array(
 62+ '{{SCRIPT}}' => $wgScript,
 63+ '{{USER}}' => $wgUser,
 64+ '{{PAGE}}' => $page,
 65+ );
 66+
 67+ $target = strtr( $target, $replacements );
 68+
6169 return <<<HTML
6270 <div class="ac-button-wrap">
6371 <a class="ac-article-button ac-button ac-button-blue ac-article-$button" data-ac-button="$button" href="$target">
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -143,6 +143,7 @@
144144 .end()
145145 .find('.ac-action-button')
146146 .click( function(e) {
 147+ e.preventDefault();
147148 ac.executeAction(button);
148149 } )
149150 .end()
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css
@@ -21,7 +21,7 @@
2222 .ac-button {
2323 display: inline-block;
2424 border-radius: 5px;
25 - color: #FFFFFF;
 25+ color: #FFFFFF !important;
2626 padding: 5px 10px;
2727 margin: 8px 0;
2828 cursor: pointer;
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreationWorkflow.php
@@ -112,6 +112,6 @@
113113 'create' => '{{SCRIPT}}?title={{PAGE}}&action=edit',
114114 'login' => '{{SCRIPT}}?title=Special:Userlogin&returnto=Special:ArticleCreationLanding/{{PAGE}}',
115115 'signup' => '{{SCRIPT}}?title=Special:Userlogin/signup&returnto=Special:ArticleCreationLanding/{{PAGE}}',
116 - 'request' => 'http://google.com/?q=dsa'
 116+ 'request' => 'http://google.com/?q={{PAGE}}'
117117 )
118118 );
Index: trunk/extensions/ArticleCreationWorkflow/SpecialArticleCreationLanding.php
@@ -32,7 +32,7 @@
3333 $wgOut->setRobotPolicy( 'noindex,nofollow' );
3434 $wgOut->addModules( 'ext.articleCreation.core' );
3535 $wgOut->addModules( 'ext.articleCreation.user' );
36 - $wgOut->addHtml( ArticleCreationTemplates::getLandingPage() );
 36+ $wgOut->addHtml( ArticleCreationTemplates::getLandingPage($par) );
3737 }
3838
3939 }

Status & tagging log