r73246 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73245‎ | r73246 | r73247 >
Date:21:15, 17 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Finished cleaning things up. Now this is tested and working. Also - moved token generation to the client - allowing click tracking for anonomous users (finally!)
Modified paths:
  • /trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php
@@ -38,7 +38,7 @@
3939 global $wgOut, $wgUser;
4040
4141 $wgOut->addModules( 'clickTracking.special' );
42 -
 42+
4343 // Check permissions
4444 if ( !$this->userCanExecute( $wgUser ) ) {
4545 $this->displayRestrictionError();
Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php
@@ -51,7 +51,7 @@
5252 public static function beforePageDisplay( $out, $skin ) {
5353 global $wgClickTrackThrottle;
5454
55 - if ( !( $wgClickTrackThrottle >= 0 && rand() % $wgClickTrackThrottle == 0 ) ) {
 55+ if ( $wgClickTrackThrottle >= 0 && rand() % $wgClickTrackThrottle == 0 ) {
5656 $out->addModules( 'clickTracking' );
5757 }
5858 return true;
@@ -84,8 +84,10 @@
8585 'clickTracking.special' => new ResourceLoaderFileModule( array(
8686 'scripts' => 'extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js',
8787 'styles' => 'extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css',
 88+ 'dependencies' => array( 'jquery.ui.datepicker', 'jquery.ui.dialog' ),
8889 ) ),
8990 ) );
 91+ return true;
9092 }
9193
9294 /**
Index: trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js
@@ -7,11 +7,11 @@
88 $(document).ready( function() {
99 $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' ).each( function() {
1010 var href = $(this).attr( 'href' );
11 - var token = mediaWiki.config.get( 'wgTrackingToken' );
 11+ var token = $.cookie( 'clicktracking-session' );
1212 // Only modify local URLs
1313 if ( href.length > 0 && href[0] == '/' && ( href.length == 1 || href[1] != '/' ) ) {
1414 var id = 'leftnav-' + skin + '-' + ( $(this).attr( 'id' ) || $(this).parent().attr( 'id' ) );
15 - href = wgScriptPath + '/api.php?action=clicktracking' +
 15+ href = mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?action=clicktracking' +
1616 '&eventid=' + id + '&token=' + token + '&redirectto=' + escape( href );
1717 $(this).attr( 'href', href );
1818 }
Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.php
@@ -38,6 +38,8 @@
3939 $wgAutoloadClasses['ApiSpecialClickTracking'] = dirname( __FILE__ ) . '/ApiSpecialClickTracking.php';
4040 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ClickTrackingHooks::loadExtensionSchemaUpdates';
4141 $wgHooks['BeforePageDisplay'][] = 'ClickTrackingHooks::beforePageDisplay';
 42+$wgHooks['MakeGlobalVariablesScript'][] = 'ClickTrackingHooks::makeGlobalVariablesScript';
 43+$wgHooks['ResourceLoaderRegisterModules'][] = 'ClickTrackingHooks::resourceLoaderRegisterModules';
4244 $wgHooks['ParserTestTables'][] = 'ClickTrackingHooks::parserTestTables';
4345 $wgAPIModules['clicktracking'] = 'ApiClickTracking';
4446 $wgAPIModules['specialclicktracking'] = 'ApiSpecialClickTracking';

Status & tagging log