r59809 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59808‎ | r59809 | r59810 >
Date:23:55, 7 December 2009
Author:nimishg
Status:ok (Comments)
Tags:
Comment:
Created skeleton for "TemplateEditor" module
Modified paths:
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor (added) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.i18n.php (added) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.js (added) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.php
@@ -25,6 +25,7 @@
2626 'publish' => array( 'global' => false, 'user' => true ),
2727 'toc' => array( 'global' => false, 'user' => true ),
2828 'toolbar' => array( 'global' => false, 'user' => true ),
 29+ 'templateEditor' => array( 'global' => false, 'user' => true ),
2930 );
3031
3132 /* Setup */
@@ -55,6 +56,7 @@
5657 $wgExtensionMessagesFiles['WikiEditorPublish'] = dirname( __FILE__ ) . '/Modules/Publish/Publish.i18n.php';
5758 $wgExtensionMessagesFiles['WikiEditorToc'] = dirname( __FILE__ ) . '/Modules/Toc/Toc.i18n.php';
5859 $wgExtensionMessagesFiles['WikiEditorToolbar'] = dirname( __FILE__ ) . '/Modules/Toolbar/Toolbar.i18n.php';
 60+$wgExtensionMessagesFiles['WikiEditorTemplateEditor'] = dirname( __FILE__ ) . '/Modules/TemplateEditor/TemplateEditor.i18n.php';
5961
6062 // Register Hooks
6163 $wgHooks['EditPageBeforeEditToolbar'][] = 'WikiEditorHooks::addModules';
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -17,6 +17,7 @@
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 2 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 2 ),
2020 array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 13 ),
 21+ array( 'src' => 'Modules/Toolbar/TemplateEditor.js', 'version' => 1 ),
2122 ),
2223 'combined' => array(
2324 array( 'src' => 'WikiEditor.combined.js', 'version' => 11 ),
@@ -47,6 +48,19 @@
4849 ),
4950 ),
5051 ),
 52+ 'templateEditor' => array(
 53+ 'i18n' => 'WikiEditorTemplateEditor',
 54+ 'preferences' => array(
 55+ 'enable' => array(
 56+ 'key' => 'wikieditor-template-editor',
 57+ 'ui' => array(
 58+ 'type' => 'toggle',
 59+ 'label-message' => 'wikieditor-template-editor-preference',
 60+ 'section' => 'editing/experimental',
 61+ ),
 62+ ),
 63+ ),
 64+ ),
5165 'preview' => array(
5266 'i18n' => 'WikiEditorPreview',
5367 'preferences' => array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.i18n.php
@@ -0,0 +1,16 @@
 2+<?php
 3+/**
 4+ * Internationalisation for the template editor module of the Usability Initiative wikiEditor extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Nimish Gautam
 14+ */
 15+$messages['en'] = array(
 16+ 'wikieditor-template-editor-preference' => 'Enable form-based editing of wiki templates',
 17+);
Property changes on: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.i18n.php
___________________________________________________________________
Name: svn:eol-style
118 + native
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.js
@@ -0,0 +1,12 @@
 2+/* JavaScript for WikiEditor Template Editor module */
 3+
 4+mw.addOnloadHook( function() {
 5+ // Check preferences for highlight
 6+ if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.templateEditor && wgWikiEditorPreferences.templateEditor.enable ) ) {
 7+ return true;
 8+ }
 9+ // Add the highlight module
 10+ if ( $j.wikiEditor ) {
 11+ $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' );
 12+ }
 13+});
Property changes on: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.js
___________________________________________________________________
Name: svn:eol-style
114 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r59825UsabilityInitiative: Recombine JS and bump style versions for r59813, r59814,...catrope13:54, 8 December 2009
r59860UsabilityInitiative: Fix stupid typo in r59809, recombine for r59854catrope23:45, 8 December 2009

Comments

#Comment by Catrope (talk | contribs)   13:06, 8 December 2009
+	if ( $j.wikiEditor ) {
+		$j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' );

This check is probably unnecessary; all the other modules work fine without it, and WikiEditor.hooks.php ensures the wikiEditor plugin is loaded before this file. Also, the check is wrong, as it should be checking for typeof $j.fn.wikiEditor != 'undefined' so as to actually check for the right variable and not throw errors on Firefox.

Status & tagging log