http://www.mediawiki.org/wiki/Special:Code/MediaWiki/68271
Revision: 68271 Author: ashley Date: 2010-06-19 12:55:41 +0000 (Sat, 19 Jun 2010) Log Message: ----------- SocialProfile: version 1.5 -- YUI dependency removed, now uses jQuery. also added almost-but-not-quite-working Renameuser integration code (commented out for now) Modified Paths: -------------- trunk/extensions/SocialProfile/SocialProfile.php trunk/extensions/SocialProfile/UserBoard/BoardBlast.js trunk/extensions/SocialProfile/UserGifts/UserGifts.js trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js Removed Paths: ------------- trunk/extensions/SocialProfile/YUI/ Modified: trunk/extensions/SocialProfile/SocialProfile.php =================================================================== --- trunk/extensions/SocialProfile/SocialProfile.php 2010-06-19 12:16:36 UTC (rev 68270) +++ trunk/extensions/SocialProfile/SocialProfile.php 2010-06-19 12:55:41 UTC (rev 68271) @@ -3,13 +3,14 @@ * Protect against register_globals vulnerabilities. * This line must be present before any global variable is referenced. */ -if ( !defined( 'MEDIAWIKI' ) ) +if ( !defined( 'MEDIAWIKI' ) ) { die(); +} /** * This is the *main* (but certainly not the only) loader file for SocialProfile extension. * - * For more info about SocialProfile, please see the README file that was included with SocialProfile. + * For more info about SocialProfile, please see http://www.mediawiki.org/wiki/Extension:SocialProfile. */ $dir = dirname( __FILE__ ) . '/'; @@ -93,7 +94,7 @@ 'path' => __FILE__, 'name' => 'SocialProfile', 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ), - 'version' => '1.4', + 'version' => '1.5', 'url' => 'http://www.mediawiki.org/wiki/Extension:SocialProfile', 'description' => 'A set of Social Tools for MediaWiki', ); @@ -190,7 +191,6 @@ $wgUserRelationshipScripts = "$wgScriptPath/extensions/SocialProfile/UserRelationship"; // Loader files -require_once( "$IP/extensions/SocialProfile/YUI/YUI.php" ); // YUI stand-alone library require_once( "{$wgUserProfileDirectory}/UserProfile.php" ); // Profile page configuration loader file require_once( "$IP/extensions/SocialProfile/UserGifts/Gifts.php" ); // UserGifts (user-to-user gifting functionality) loader file require_once( "$IP/extensions/SocialProfile/SystemGifts/SystemGifts.php" ); // SystemGifts (awards functionality) loader file @@ -216,4 +216,49 @@ $wgExtNewTables[] = array( 'user_system_messages', "$dir/UserSystemMessages/user_system_messages.sql" ); } return true; -} \ No newline at end of file +} + +/* +// For Renameuser extension +$wgHooks['RenameUserSQL'][] = 'efSystemGiftsOnUserRename'; +$wgHooks['RenameUserSQL'][] = 'efUserBoardOnUserRename'; +$wgHooks['RenameUserSQL'][] = 'efUserGiftsOnUserRename'; +$wgHooks['RenameUserSQL'][] = 'efUserRelationshipOnUserRename'; +$wgHooks['RenameUserSQL'][] = 'efUserStatsOnUserRename'; +$wgHooks['RenameUserSQL'][] = 'efUserSystemMessagesOnUserRename'; + +function efSystemGiftsOnUserRename( $renameUserSQL ) { + $renameUserSQL->tables['user_system_gift'] = array( 'sg_user_name', 'sg_user_id' ); + return true; +} + +function efUserBoardOnUserRename( $renameUserSQL ) { + $renameUserSQL->tables['user_board'] = array( 'ub_user_name_from', 'ub_user_id_from' ); + return true; +} + +function efUserGiftsOnUserRename( $renameUserSQL ) { + $renameUserSQL->tables['user_gift'] = array( 'ug_user_name_to', 'ug_user_id_to' ); + $renameUserSQL->tables['gift'] = array( 'gift_creator_user_name', 'gift_creator_user_id' ); + return true; +} + +function efUserRelationshipOnUserRename( $renameUserSQL ) { + // <fixme> This sucks and only updates half of the rows...wtf? + $renameUserSQL->tables['user_relationship'] = array( 'r_user_name_relation', 'r_user_id_relation' ); + $renameUserSQL->tables['user_relationship'] = array( 'r_user_name', 'r_user_id' ); + // </fixme> + $renameUserSQL->tables['user_relationship_request'] = array( 'ur_user_name_from', 'ur_user_id_from' ); + return true; +} + +function efUserStatsOnUserRename( $renameUserSQL ) { + $renameUserSQL->tables['user_stats'] = array( 'stats_user_name', 'stats_user_id' ); + return true; +} + +function efUserSystemMessagesOnUserRename( $renameUserSQL ) { + $renameUserSQL->tables['user_system_messages'] = array( 'um_user_name', 'um_user_id' ); + return true; +} +*/ \ No newline at end of file Modified: trunk/extensions/SocialProfile/UserBoard/BoardBlast.js =================================================================== --- trunk/extensions/SocialProfile/UserBoard/BoardBlast.js 2010-06-19 12:16:36 UTC (rev 68270) +++ trunk/extensions/SocialProfile/UserBoard/BoardBlast.js 2010-06-19 12:55:41 UTC (rev 68271) @@ -1,27 +1,27 @@ function toggle_user( user_id ) { - if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-friend-selected' ) ) { - YAHOO.util.Dom.replaceClass( 'user-' + user_id, 'blast-friend-selected', 'blast-friend-unselected' ); - } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-friend-unselected' ) ) { - YAHOO.util.Dom.replaceClass( 'user-' + user_id, 'blast-friend-unselected', 'blast-friend-selected' ); + if( jQuery( '#user-' + user_id ).hasClass( 'blast-friend-selected' ) ) { + jQuery( '#user-' + user_id ).removeClass( 'blast-friend-selected' ).addClass( 'blast-friend-unselected' ); + } else if( jQuery( '#user-' + user_id ).hasClass( 'blast-friend-unselected' ) ) { + jQuery( '#user-' + user_id ).removeClass( 'blast-friend-unselected' ).addClass( 'blast-friend-selected' ); } - if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-foe-selected' ) ) { - YAHOO.util.Dom.replaceClass( 'user-' + user_id, 'blast-foe-selected', 'blast-foe-unselected' ); - } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-foe-unselected' ) ) { - YAHOO.util.Dom.replaceClass( 'user-' + user_id, 'blast-foe-selected', 'blast-foe-unselected' ); + if( jQuery( '#user-' + user_id ).hasClass( 'blast-foe-selected' ) ) { + jQuery( '#user-' + user_id ).removeClass( 'blast-foe-selected' ).addClass( 'blast-foe-unselected' ); + } else if( jQuery( '#user-' + user_id ).hasClass( 'blast-foe-unselected' ) ) { + jQuery( '#user-' + user_id ).removeClass( 'blast-foe-unselected' ).addClass( 'blast-foe-selected' ); } } function toggle_type( method, on, off ) { - list = YAHOO.util.Dom.getElementsByClassName( ( ( method == 1 ) ? off : on ), 'div', 'blast-friends-list' ); + list = jQuery( '#blast-friends-list div.' + ( ( method == 1 ) ? off : on ) ); for( x = 0; x <= list.length - 1; x++ ) { el = list[x]; - if( YAHOO.util.Dom.hasClass( el, on ) || YAHOO.util.Dom.hasClass( el, off ) ) { + if( jQuery( el ).hasClass( on ) || jQuery( el ).hasClass( off ) ) { if( method == 1 ) { - YAHOO.util.Dom.replaceClass( el, off, on ); + jQuery( el ).removeClass( off ).addClass( on ); } else { - YAHOO.util.Dom.replaceClass( el, on, off ); + jQuery( el ).removeClass( on ).addClass( off ); } } } @@ -54,7 +54,7 @@ selected = 0; user_ids_to = ''; - list = YAHOO.util.Dom.getElementsByClassName( 'blast-friend-selected', 'div', 'blast-friends-list' ); + list = jQuery( '#blast-friends-list div.blast-friend-selected' ); for( x = 0; x <= list.length - 1; x++ ) { el = list[x]; selected++; @@ -62,7 +62,7 @@ user_ids_to += ( ( user_ids_to ) ? ',' : '' ) + user_id; } - list = YAHOO.util.Dom.getElementsByClassName( 'blast-foe-selected', 'div', 'blast-friends-list' ); + list = jQuery( '#blast-friends-list div.blast-foe-selected' ); for( x = 0; x <= list.length - 1; x++ ) { el = list[x]; selected++; @@ -76,16 +76,16 @@ return 0; } - if( !document.getElementById('message').value ) { + if( !document.getElementById( 'message' ).value ) { alert( 'Please enter a message' ); submitted = 0; return 0; } - document.getElementById('ids').value = user_ids_to; + document.getElementById( 'ids' ).value = user_ids_to; document.blast.message.style.color = '#ccc'; document.blast.message.readOnly = true; - document.getElementById('blast-friends-list').innerHTML = 'Sending messages...'; + document.getElementById( 'blast-friends-list' ).innerHTML = 'Sending messages...'; document.blast.submit(); } Modified: trunk/extensions/SocialProfile/UserGifts/UserGifts.js =================================================================== --- trunk/extensions/SocialProfile/UserGifts/UserGifts.js 2010-06-19 12:16:36 UTC (rev 68270) +++ trunk/extensions/SocialProfile/UserGifts/UserGifts.js 2010-06-19 12:55:41 UTC (rev 68271) @@ -3,21 +3,21 @@ function selectGift( id ) { // Un-select previously selected gift if( selected_gift ) { - YAHOO.util.Dom.removeClass( 'give_gift_' + selected_gift, 'g-give-all-selected' ); + jQuery( '#give_gift_' + selected_gift ).removeClass( 'g-give-all-selected' ); } // Select new gift - YAHOO.util.Dom.addClass( 'give_gift_' + id, 'g-give-all-selected' ); + jQuery( '#give_gift_' + id ).addClass( 'g-give-all-selected' ); selected_gift = id; } function highlightGift( id ) { - YAHOO.util.Dom.addClass( 'give_gift_' + id, 'g-give-all-highlight' ); + jQuery( '#give_gift_' + id ).addClass( 'g-give-all-highlight' ); } function unHighlightGift( id ) { - YAHOO.util.Dom.removeClass( 'give_gift_' + id, 'g-give-all-highlight' ); + jQuery( '#give_gift_' + id ).removeClass( 'g-give-all-highlight' ); } function sendGift() { Modified: trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js =================================================================== --- trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js 2010-06-19 12:16:36 UTC (rev 68270) +++ trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js 2010-06-19 12:55:41 UTC (rev 68271) @@ -8,6 +8,8 @@ sajax_request_type = 'POST'; sajax_do_call( 'wfRelationshipRequestResponse', [ response, id ], function( request ) { document.getElementById( 'request_action_' + id ).innerHTML = request.responseText; - YAHOO.widget.Effects.Appear( 'request_action_' + id, { duration:2.0 } ); + jQuery( '#request_action_' + id ).fadeIn( 2000 ); + document.getElementById( 'request_action_' + id ).style.display = 'block'; + document.getElementById( 'request_action_' + id ).style.visibility = 'visible'; } ); } \ No newline at end of file _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs