r54662 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54661‎ | r54662 | r54663 >
Date:14:46, 9 August 2009
Author:catrope
Status:deferred (Comments)
Tags:
Comment:
EditWarning: Add preference for EditWarning so users can disable it (enabled by default)
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php
@@ -185,7 +185,7 @@
186186 * GetPreferences hook
187187 * Add toolbar related items to the preferences
188188 */
189 - public static function addPreferences( $user, $defaultPreferences ) {
 189+ public static function addPreferences( $user, &$defaultPreferences ) {
190190 global $wgEditToolbarGlobalEnable, $wgEditToolbarUserEnable;
191191
192192 // Checks if...
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php
@@ -15,6 +15,7 @@
1616 'editwarning' => 'Edit warning',
1717 'editwarning-desc' => 'Show a warning when a user tries to leave the edit form without saving',
1818 'editwarning-warning' => 'Leaving this page will cause you to lose any changes you have made.',
 19+ 'editwarning-preference' => 'Warn me when I leave an edit page with unsaved changes',
1920 );
2021
2122 /** Message documentation (Message documentation)
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.php
@@ -46,3 +46,7 @@
4747
4848 // Registers Hooks
4949 $wgHooks['EditPage::showEditForm:initial'][] = 'EditWarningHooks::initialize';
 50+$wgHooks['GetPreferences'][] = 'EditWarningHooks::addPreferences';
 51+
 52+// Enable EditWarning by default
 53+$wgDefaultUserOptions['useeditwarning'] = 1;
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.hooks.php
@@ -18,7 +18,7 @@
1919 global $wgEditWarningStyleVersion, $wgRequest, $wgUser;
2020
2121 $skin = $wgUser->getSkin();
22 - if ( $skin->skinname == 'vector' ) {
 22+ if ( $skin->skinname == 'vector' && $wgUser->getOption( 'useeditwarning' ) ) {
2323 UsabilityInitiativeHooks::initialize();
2424 // Adds script to document
2525 UsabilityInitiativeHooks::addScript(
@@ -34,4 +34,22 @@
3535 // Continue
3636 return true;
3737 }
 38+
 39+ /**
 40+ * GetPreferences hook
 41+ * Add EditWarning-related items to the preferences
 42+ */
 43+ public static function addPreferences( $user, &$defaultPreferences ) {
 44+ global $wgEditToolbarGlobalEnable, $wgEditToolbarUserEnable;
 45+
 46+ wfLoadExtensionMessages( 'EditWarning' );
 47+ // Adds preference for enabling/disabling EditWarning
 48+ $defaultPreferences['useeditwarning'] =
 49+ array(
 50+ 'type' => 'toggle',
 51+ 'label-message' => 'editwarning-preference',
 52+ 'section' => 'editing/advancedediting',
 53+ );
 54+ return true;
 55+ }
3856 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -58,7 +58,8 @@
5959 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) )
6060 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
6161 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
62 -// Get a refrence to the outter container
 62+
 63+// Get a reference to the outer container
6364 context.$ui = $(this).parent().parent().parent();
6465 context.$ui.after( $( '<div style="clear:both;"></div>' ) );
6566 // Attach a container in the top

Follow-up revisions

RevisionCommit summaryAuthorDate
r54752Merge a bunch of UsabilityInitiative fixes. This commit may mess up svn:merge...catrope22:12, 10 August 2009

Comments

#Comment by MZMcBride (talk | contribs)   20:42, 10 August 2009

This is related to bug 20138.

Status & tagging log