Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | * GetPreferences hook |
187 | 187 | * Add toolbar related items to the preferences |
188 | 188 | */ |
189 | | - public static function addPreferences( $user, $defaultPreferences ) { |
| 189 | + public static function addPreferences( $user, &$defaultPreferences ) { |
190 | 190 | global $wgEditToolbarGlobalEnable, $wgEditToolbarUserEnable; |
191 | 191 | |
192 | 192 | // Checks if... |
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.i18n.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | 'editwarning' => 'Edit warning', |
17 | 17 | 'editwarning-desc' => 'Show a warning when a user tries to leave the edit form without saving', |
18 | 18 | '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', |
19 | 20 | ); |
20 | 21 | |
21 | 22 | /** Message documentation (Message documentation) |
Index: trunk/extensions/UsabilityInitiative/EditWarning/EditWarning.php |
— | — | @@ -46,3 +46,7 @@ |
47 | 47 | |
48 | 48 | // Registers Hooks |
49 | 49 | $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 @@ |
19 | 19 | global $wgEditWarningStyleVersion, $wgRequest, $wgUser; |
20 | 20 | |
21 | 21 | $skin = $wgUser->getSkin(); |
22 | | - if ( $skin->skinname == 'vector' ) { |
| 22 | + if ( $skin->skinname == 'vector' && $wgUser->getOption( 'useeditwarning' ) ) { |
23 | 23 | UsabilityInitiativeHooks::initialize(); |
24 | 24 | // Adds script to document |
25 | 25 | UsabilityInitiativeHooks::addScript( |
— | — | @@ -34,4 +34,22 @@ |
35 | 35 | // Continue |
36 | 36 | return true; |
37 | 37 | } |
| 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 | + } |
38 | 56 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -58,7 +58,8 @@ |
59 | 59 | .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui' ) ) |
60 | 60 | .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) ) |
61 | 61 | .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) ); |
62 | | -// Get a refrence to the outter container |
| 62 | + |
| 63 | +// Get a reference to the outer container |
63 | 64 | context.$ui = $(this).parent().parent().parent(); |
64 | 65 | context.$ui.after( $( '<div style="clear:both;"></div>' ) ); |
65 | 66 | // Attach a container in the top |