r110510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110509‎ | r110510 | r110511 >
Date:19:15, 1 February 2012
Author:rmoen
Status:ok (Comments)
Tags:
Comment:
create base extension, hook in front end modules. Commit for transition to Kaldari. Not ready for deployment
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreation.hooks.php (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreation.i18n.php (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/ArticleCreation.php (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.js (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.png (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.xcf (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.loginSignup (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.loginSignup/images (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.css (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js (added) (history)
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/images (added) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.hooks.php
@@ -0,0 +1,55 @@
 2+<?php /* Article Creation Hooks */
 3+
 4+class ArticleCreationHooks {
 5+
 6+ /**
 7+ * Loads ArticleCreation Modules to the output on ShowMissingArticle Hook
 8+ *
 9+ * @param $page Missing Page Object
 10+ */
 11+ public static function loadArticleCreationModules ( $page ) {
 12+ global $wgOut;
 13+
 14+ //dev html, need to localize
 15+ $htmlOut = <<<HTML
 16+ <span class="article-creation-heading">I want to...</span>
 17+ <div id="article-creation-panel">
 18+ <div class="ac-button-wrap">
 19+ <a class="ac-article-button ac-button-blue ac-article-create" data-ac-button="normal">
 20+ <div class="ac-arrow ac-arrow-forward">&nbsp;</div>
 21+ <div class="ac-button-text">
 22+ <div class="ac-button-title">Create this article myself</div>
 23+ <div class="ac-button-body">I know what I'm doing</div>
 24+ </div>
 25+ </a>
 26+ </div>
 27+ <div class="ac-button-wrap">
 28+ <a class="ac-article-button ac-button-blue ac-article-wizard" data-ac-button="wizard">
 29+ <div class="ac-arrow ac-arrow-forward">&nbsp;</div>
 30+ <div class="ac-button-text">
 31+ <div class="ac-button-title">Follow a step-by-step process</div>
 32+ <div class="ac-button-body">I'll use the article creation wizard</div>
 33+ </div>
 34+ </a>
 35+ </div>
 36+ <div class="ac-button-wrap">
 37+ <a class="ac-article-button ac-button-red" data-ac-button="getOut">
 38+ <div class="ac-arrow ac-arrow-backward">&nbsp;</div>
 39+ <div class="ac-button-text">
 40+ <div class="ac-button-title">Get out of here</div>
 41+ <div class="ac-button-body">Oops. This isn't what I wanted</div>
 42+ </div>
 43+ </a>
 44+ </div>
 45+ </div>
 46+HTML;
 47+
 48+ //only loadiong user module now for development
 49+
 50+ $wgOut->addModules( 'ext.articleCreation.core' );
 51+ $wgOut->addModules( 'ext.articleCreation.user' );
 52+ $wgOut->addHtml( $htmlOut );
 53+ return true;
 54+ }
 55+
 56+}
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.hooks.php
___________________________________________________________________
Added: svn:eol-style
157 + native
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -0,0 +1,99 @@
 2+/* JavaScript for the Article Creation Extension */
 3+
 4+(function( $, mw, undefined ) {
 5+
 6+ var ac = mw.articleCreation;
 7+ $.extend(ac, {
 8+ init: function() {
 9+ //store a reference to the panel
 10+ ac.panel = $('#article-creation-panel');
 11+
 12+ //setup button hover states
 13+ ac.panel
 14+ .find( '.ac-article-button' )
 15+ .each( function (i, e) {
 16+ var button = $(this).data('ac-button'),
 17+ $tooltip;
 18+
 19+ $(this)
 20+ .after( ac.setupHoverTooltip( button ) )
 21+ //attach other events here, just making first tooltip for now
 22+ //testing hover effects
 23+ .hover (function (){
 24+ $( this ).next().show();
 25+ }, function(){
 26+ $( this ).next().hide();
 27+ });
 28+
 29+ //set the pointy position
 30+ $tooltip = $(this).next();
 31+ $tooltip
 32+ .find( '.mw-ac-tooltip-pointy' )
 33+ .css('top', (( $tooltip.height() / 2) -10) + 'px' )
 34+ .end();
 35+ //set the tooltip position
 36+ $tooltip
 37+ .css('top', '-'+( ( ($tooltip.height() / 2 ) - ( $(this).height() / 2) ) - 10 ) + 'px');
 38+
 39+ });
 40+
 41+ // setup button click states
 42+ ac.panel
 43+ .find('.ac-article-wizard, .ac-article-create')
 44+ .click (function () {
 45+
 46+ $('.ac-article-wizard, .ac-article-create')
 47+ //remove green states and hide their tooltips
 48+ .removeClass('ac-button-green')
 49+ .each ( function (i, e) {
 50+ $(this).next().hide();
 51+ });
 52+
 53+ $( this )
 54+ //make it green
 55+ .addClass('ac-button-green');
 56+ //build click state here.
 57+
 58+ });
 59+
 60+ //setup hover / fade effects
 61+ ac.panel
 62+ .find('.ac-article-button')
 63+ .hover (function (){
 64+ $( '.ac-article-button' )
 65+ .not( this )
 66+ .addClass( 'ac-faded' );
 67+ }, function(){
 68+ $( '.ac-article-button' )
 69+ .removeClass( 'ac-faded' );
 70+ });
 71+
 72+ },
 73+
 74+ setupHoverTooltip: function ( button ) {
 75+
 76+ var $tooltip = $( ac.tooltip.base );
 77+ var $tooltipInards = $( ac.tooltip[button+'Hover']);
 78+
 79+ $tooltip
 80+ .find ( '.mw-ac-tooltip-innards')
 81+ .html( $tooltipInards )
 82+ .end()
 83+ .find( '.mw-ac-tooltip-title' )
 84+ .text( mw.msg( 'ac-hover-tooltip-title' ) )
 85+ .end()
 86+ .find( '.mw-ac-tooltip-body' )
 87+ .html( mw.msg ( 'ac-hover-tooltip-body-' + button ) )
 88+ .end()
 89+ .hide();
 90+
 91+ console.log( mw.msg ('ac-hover-tooltip-title' ));
 92+
 93+ return $tooltip;
 94+ }
 95+
 96+ });
 97+
 98+ ac.init();
 99+
 100+})( jQuery, window.mw );
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
___________________________________________________________________
Added: svn:eol-style
1101 + native
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.css
@@ -0,0 +1 @@
 2+/* Styles for the Article Creation Extension */
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.css
___________________________________________________________________
Added: svn:eol-style
13 + native
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css
@@ -0,0 +1,148 @@
 2+/* Article Creation Text */
 3+.article-creation-heading {
 4+ font-size: 2.5em;
 5+ font-weight: 590;
 6+ display: block;
 7+ margin: 20px 0;
 8+}
 9+
 10+/* Article Creation Panel */
 11+#article-creation-panel {
 12+ position: relative;
 13+ margin-left: 100px;
 14+}
 15+
 16+
 17+/* Buttons */
 18+.ac-article-button {
 19+ display: inline-block;
 20+ border-radius: 5px;
 21+ color: #FFFFFF;
 22+ padding: 5px 10px;
 23+ margin: 8px 0;
 24+ width: 250px;
 25+ cursor: pointer;
 26+ text-decoration: none;
 27+}
 28+
 29+.ac-article-button:hover {
 30+ text-decoration: none;
 31+}
 32+
 33+.ac-faded {
 34+ opacity: .5;
 35+}
 36+
 37+.ac-create-article {
 38+ background-color: #3365ba;
 39+}
 40+
 41+.ac-article-wizard {
 42+ background-color: #3365ba;
 43+}
 44+
 45+.ac-button-blue {
 46+ background-image: linear-gradient(bottom, rgb(33,67,122) 32%, rgb(51,101,186) 66%);
 47+ background-image: -o-linear-gradient(bottom, rgb(33,67,122) 32%, rgb(51,101,186) 66%);
 48+ background-image: -moz-linear-gradient(bottom, rgb(33,67,122) 32%, rgb(51,101,186) 66%);
 49+ background-image: -webkit-linear-gradient(bottom, rgb(33,67,122) 32%, rgb(51,101,186) 66%);
 50+ background-image: -ms-linear-gradient(bottom, rgb(33,67,122) 32%, rgb(51,101,186) 66%);
 51+
 52+ background-image: -webkit-gradient(
 53+ linear,
 54+ left bottom,
 55+ left top,
 56+ color-stop(0.3, rgb(33,67,122)),
 57+ color-stop(0.6, rgb(51,101,186))
 58+ );
 59+}
 60+
 61+.ac-button-red {
 62+ background-image: linear-gradient(bottom, rgb(133,0,0) 32%, rgb(203,0,0) 66%);
 63+ background-image: -o-linear-gradient(bottom, rgb(133,0,0) 32%, rgb(203,0,0) 66%);
 64+ background-image: -moz-linear-gradient(bottom, rgb(133,0,0) 32%, rgb(203,0,0) 66%);
 65+ background-image: -webkit-linear-gradient(bottom, rgb(133,0,0) 32%, rgb(203,0,0) 66%);
 66+ background-image: -ms-linear-gradient(bottom, rgb(133,0,0) 32%, rgb(203,0,0) 66%);
 67+
 68+ background-image: -webkit-gradient(
 69+ linear,
 70+ left bottom,
 71+ left top,
 72+ color-stop(0.3, rgb(133,0,0)),
 73+ color-stop(0.6, rgb(203,0,0))
 74+ );
 75+}
 76+
 77+.ac-button-green {
 78+ background-color: #3cb878;
 79+ background-image: linear-gradient(bottom, rgb(39,120,78) 22%, rgb(60,184,120) 61%);
 80+ background-image: -o-linear-gradient(bottom, rgb(39,120,78) 22%, rgb(60,184,120) 61%);
 81+ background-image: -moz-linear-gradient(bottom, rgb(39,120,78) 22%, rgb(60,184,120) 61%);
 82+ background-image: -webkit-linear-gradient(bottom, rgb(39,120,78) 22%, rgb(60,184,120) 61%);
 83+ background-image: -ms-linear-gradient(bottom, rgb(39,120,78) 22%, rgb(60,184,120) 61%);
 84+
 85+ background-image: -webkit-gradient(
 86+ linear,
 87+ left bottom,
 88+ left top,
 89+ color-stop(0.22, rgb(39,120,78)),
 90+ color-stop(0.61, rgb(60,184,120))
 91+ );
 92+}
 93+
 94+.ac-button-wrap {
 95+ position: relative;
 96+}
 97+
 98+.ac-button-title, .ac-button-body {
 99+ float: left;
 100+}
 101+
 102+
 103+.ac-button-title {
 104+ font-size: 1.1em;
 105+ font-weight: bold;
 106+}
 107+
 108+.ac-button-body {
 109+ font-size: .9em;
 110+}
 111+
 112+/* Power Arrows */
 113+
 114+.ac-arrow {
 115+ float: right;
 116+}
 117+
 118+/* Tooltip Magic */
 119+
 120+.mw-ac-tooltip {
 121+ position: absolute;
 122+ left: 290px;
 123+ background-color: #3cb878;
 124+ border-radius: 2px;
 125+ padding: 2px;
 126+}
 127+
 128+.mw-ac-tooltip-pointy {
 129+ background: url(images/ac-tooltip-pointy.png) left top no-repeat;
 130+ height: 22px;
 131+ width: 12px;
 132+ left: -10px;
 133+ position: absolute;
 134+
 135+}
 136+
 137+.mw-ac-tooltip-innards {
 138+ background-color: #f5f5f5;
 139+ padding: 10px;
 140+}
 141+
 142+.mw-ac-tooltip-title {
 143+ font-size: 1.1em;
 144+ font-weight: bold;
 145+}
 146+
 147+.ac-clearfix {
 148+ clear: both;
 149+}
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.css
___________________________________________________________________
Added: svn:eol-style
1150 + native
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.xcf
Cannot display: file marked as a binary type.
svn:mime-type = image/x-xcf
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.xcf
___________________________________________________________________
Added: svn:mime-type
2151 + image/x-xcf
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/images/ac-tooltip-pointy.png
___________________________________________________________________
Added: svn:mime-type
3152 + image/png
Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.js
@@ -0,0 +1,35 @@
 2+/* Core JavaScript for the Article Creation Extension */
 3+
 4+(function( mw, undefined ) {
 5+ mw.articleCreation = {
 6+ tooltip: {
 7+ /* base tooltip template */
 8+ base: '\
 9+ <div class="mw-ac-tooltip"> \
 10+ <div class="mw-ac-tooltip-pointy"></div>\
 11+ <div class="mw-ac-tooltip-innards">\
 12+ </div>\
 13+ </div>\
 14+ ',
 15+ /* tooltip state templates */
 16+ normalHover: '\
 17+ <div class="mw-ac-tooltip-title"></div>\
 18+ <div class="mw-ac-tooltip-body"></div>\
 19+ ',
 20+ normalClick: '',
 21+
 22+ wizardHover: '\
 23+ <div class="mw-ac-tooltip-title"></div>\
 24+ <div class="mw-ac-tooltip-body"></div>\
 25+ ',
 26+ wizardClick: '',
 27+
 28+ getOutHover: '\
 29+ <div class="mw-ac-tooltip-title"></div>\
 30+ <div class="mw-ac-tooltip-body"></div>\
 31+ '
 32+
 33+ }
 34+ };
 35+
 36+})( window.mw );
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.core/ext.articleCreation.core.js
___________________________________________________________________
Added: svn:eol-style
137 + native
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.i18n.php
@@ -0,0 +1,31 @@
 2+<?php
 3+/* Internationalization File for Article Creation Extension
 4+ *
 5+ * @file
 6+ * @ingroup Extensions
 7+ */
 8+
 9+$messages = array();
 10+
 11+/** English
 12+ * @author Rob Moen
 13+ */
 14+$messages['en'] = array(
 15+ 'ac-hover-tooltip-title' => 'Select this if...',
 16+ 'ac-hover-tooltip-body-normal' => '* You have created articles before',
 17+ 'ac-hover-tooltip-body-wizard' => '* You <b>have not</b> created articles before',
 18+ 'ac-hover-tooltip-body-getOut' => '* You got to this page accidentally',
 19+);
 20+
 21+/*
 22+ac-hover-tooltip-body-getOut
 23+ "&lt;ac-hover-tooltip-body-getOut&gt;"
 24+
 25+ac-hover-tooltip-body-normal
 26+ "&lt;ac-hover-tooltip-body-normal&gt;"
 27+
 28+ac-hover-tooltip-body-wizard
 29+ "&lt;ac-hover-tooltip-body-wizard&gt;"
 30+
 31+ac-hover-tooltip-title
 32+ "&lt;ac-hover-tooltip-title&gt;" */
\ No newline at end of file
Property changes on: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.i18n.php
___________________________________________________________________
Added: svn:eol-style
133 + native
Index: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.php
@@ -0,0 +1,54 @@
 2+<?php
 3+/* MediaWiki ArticleCreation Extension
 4+ Authors: Rob Moen, Benny Situ, Brandon Harris
 5+*/
 6+
 7+$wgExtensionCredits['other'][] = array(
 8+ 'author' => array( 'Rob Moen', 'Benny Situ' ),
 9+ 'descriptionmsg' => 'article-creation-desc',
 10+ 'name' => 'ArticleCreation',
 11+ 'url' => 'http://www.mediawiki.org/wiki/Article_Creation_Landing_System',
 12+ 'version' => '0.1',
 13+ 'path' => __FILE__,
 14+);
 15+
 16+$articleCreationDir = dirname(__FILE__) . '/';
 17+
 18+/* Hooks */
 19+$wgAutoloadClasses['ArticleCreationHooks'] = $articleCreationDir . 'ArticleCreation.hooks.php';
 20+$wgHooks['ShowMissingArticle'][] = 'ArticleCreationHooks::loadArticleCreationModules';
 21+/* Resources */
 22+
 23+/* Internationalization */
 24+$wgExtensionMessageFiles['ArticleCreation'] = $articleCreationDir . 'ArticleCreation.i18n.php';
 25+
 26+// Resources
 27+$acResourceTemplate = array(
 28+ 'localBasePath' => $articleCreationDir . 'modules',
 29+ 'remoteExtPath' => 'ArticleCreation/modules'
 30+);
 31+
 32+$wgResourceModules['ext.articleCreation.core'] = $acResourceTemplate + array (
 33+ 'styles' => 'ext.articleCreation.core/ext.articleCreation.core.css',
 34+ 'scripts' => 'ext.articleCreation.core/ext.articleCreation.core.js',
 35+ 'dependencies' => array(
 36+ 'mediawiki.util',
 37+ 'jquery.localize',
 38+ 'user.tokens',
 39+ ),
 40+);
 41+
 42+$wgResourceModules['ext.articleCreation.user'] = $acResourceTemplate + array (
 43+ 'styles' => 'ext.articleCreation.user/ext.articleCreation.user.css',
 44+ 'scripts' => 'ext.articleCreation.user/ext.articleCreation.user.js',
 45+ 'messages' => array(
 46+ 'ac-hover-tooltip-title',
 47+ 'ac-hover-tooltip-body-normal',
 48+ 'ac-hover-tooltip-body-wizard',
 49+ 'ac-hover-tooltip-body-getOut',
 50+ ),
 51+ 'dependencies' => array(
 52+ 'ext.articleCreation.core',
 53+ ),
 54+);
 55+
Property changes on: trunk/extensions/ArticleCreationWorkflow/ArticleCreation.php
___________________________________________________________________
Added: svn:eol-style
156 + native

Comments

#Comment by Reedy (talk | contribs)   18:57, 2 February 2012

Wouldn't it make sense to use i18n messages from the start, rather than having to transfer and update the code in the near future?

#Comment by Robmoen (talk | contribs)   21:43, 2 February 2012

That does make sense. However, yesterday I was moved to the Visual Editor team and my goal with this commit was to pass off the code to Kaldari. Otherwise, I would have most definitely waited until the code was more complete.

Status & tagging log