https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106973
Revision: 106973 Author: rmoen Date: 2011-12-21 20:06:09 +0000 (Wed, 21 Dec 2011) Log Message: ----------- updated js globals hook to load inline Modified Paths: -------------- trunk/extensions/MoodBar/MoodBar.hooks.php trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js Modified: trunk/extensions/MoodBar/MoodBar.hooks.php =================================================================== --- trunk/extensions/MoodBar/MoodBar.hooks.php 2011-12-21 19:51:19 UTC (rev 106972) +++ trunk/extensions/MoodBar/MoodBar.hooks.php 2011-12-21 20:06:09 UTC (rev 106973) @@ -103,21 +103,20 @@ * ResourceLoaderGetConfigVars hook */ public static function resourceLoaderGetConfigVars( &$vars ) { - global $wgMoodBarConfig, $wgUser, $wgEnableEmail; + global $wgMoodBarConfig, $wgUser; $vars['mbConfig'] = array( 'validTypes' => MBFeedbackItem::getValidTypes(), - 'userBuckets' => MoodBarHooks::getUserBuckets( $wgUser ), - 'emailEnabled' => $wgEnableEmail, - 'userEmail' => strlen( $wgUser->getEmail() ) > 0 ? true : false, - 'isEmailConfirmationPending' => $wgUser->isEmailConfirmationPending() //returns false if email authentication off, and if email is confimed already - + 'userBuckets' => MoodBarHooks::getUserBuckets( $wgUser ) ) + $wgMoodBarConfig; return true; } public static function makeGlobalVariablesScript( &$vars ) { - global $wgUser; + global $wgUser, $wgEnableEmail; $vars['mbEditToken'] = $wgUser->editToken(); + $vars['mbEmailEnabled'] = $wgEnableEmail; + $vars['mbUserEmail'] = strlen( $wgUser->getEmail() ) > 0 ? true : false; + $vars['mbIsEmailConfirmationPending'] = $wgUser->isEmailConfirmationPending(); //returns false if email authentication off, and if email is confimed already return true; } Modified: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js =================================================================== --- trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js 2011-12-21 19:51:19 UTC (rev 106972) +++ trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js 2011-12-21 20:06:09 UTC (rev 106973) @@ -137,11 +137,11 @@ var emailFlag,emailOptOut = ($.cookie( mb.cookiePrefix() + 'emailOptOut' ) == '1'); // if opt out cookie not set and if email is on globally, proceed with email prompt - if( emailOptOut === false && mb.conf.emailEnabled ) { + if( emailOptOut === false && mw.config.get( 'mbEmailEnabled' ) ) { - if( mb.conf.userEmail ) { // if user has email + if( mw.config.get( 'mbUserEmail' ) ) { // if user has email - if ( !mb.conf.isEmailConfirmationPending ) { // if no confirmation pending, show form. + if ( !mw.config.get( 'mbIsEmailConfirmationPending' ) ) { // if no confirmation pending, show form. mb.showSuccess(); } else { //show email confirmation form @@ -179,8 +179,7 @@ callback: function( data ) { mb.showSuccess(); //set email flag to true so we do not ask again on this page load. - mb.conf.userEmail = true; - mb.conf.isEmailConfirmationPending = true; + mw.config.set({'mbUserEmail': true, 'mbIsEmailConfirmationPending': true}); } }, @@ -188,7 +187,7 @@ callback: function ( data ) { mb.showSuccess(); //set conf pending flag to false so we do not ask again on this page load. - mb.conf.isEmailConfirmationPending = false; + mw.config.set({'mbIsEmailConfirmationPending': false}); } }, _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs