http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73400

Revision: 73400
Author:   tparscal
Date:     2010-09-20 19:53:17 +0000 (Mon, 20 Sep 2010)

Log Message:
-----------
Moved ResourceLoader modules into the ext.* space - this is the convention that 
should be followed in the future.

Modified Paths:
--------------
    trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php
    trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/jquery.clickTracking.js
    trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.hooks.php
    trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php

Added Paths:
-----------
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.js
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.css
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.js
    trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css
    trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js

Removed Paths:
-------------
    trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css
    
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js
    trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css
    trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js

Modified: 
trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php
===================================================================
--- trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php  
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php  
2010-09-20 19:53:17 UTC (rev 73400)
@@ -52,7 +52,7 @@
                global $wgClickTrackThrottle;
                
                if ( $wgClickTrackThrottle >= 0 && rand() % 
$wgClickTrackThrottle == 0 ) {
-                       $out->addModules( 'clickTracking' );
+                       $out->addModules( 'ext.clickTracking' );
                }
                return true;
        }
@@ -77,13 +77,13 @@
                                'scripts' => 
'extensions/UsabilityInitiative/ClickTracking/modules/jquery.clickTracking.js',
                                'dependencies' => 'jquery.cookie',
                        ) ),
-                       'clickTracking' => new ResourceLoaderFileModule( array(
-                               'scripts' => 
'extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js',
+                       'ext.clickTracking' => new ResourceLoaderFileModule( 
array(
+                               'scripts' => 
'extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.js',
                                'dependencies' => 'jquery.clickTracking',
                        ) ),
-                       'clickTracking.special' => new 
ResourceLoaderFileModule( array(
-                               'scripts' => 
'extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js',
-                               'styles' => 
'extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css',
+                       'ext.clickTracking.special' => new 
ResourceLoaderFileModule( array(
+                               'scripts' => 
'extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.js',
+                               'styles' => 
'extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.css',
                                'dependencies' => array( 
'jquery.ui.datepicker', 'jquery.ui.dialog' ),
                        ) ),
                ) );

Modified: 
trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php
===================================================================
--- trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php 
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.php 
2010-09-20 19:53:17 UTC (rev 73400)
@@ -37,7 +37,7 @@
        function execute( $par ) {
                global $wgOut, $wgUser;
 
-               $wgOut->addModules( 'clickTracking.special' );
+               $wgOut->addModules( 'ext.clickTracking.special' );
 
                // Check permissions
                if ( !$this->userCanExecute( $wgUser ) ) {

Deleted: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js
===================================================================
--- trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js 
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js 
2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,20 +0,0 @@
-/*
- * JavaScript for Click Tracking
- */
-
-( function( $ ) {
-       // Add click tracking hooks to the sidebar
-       $(document).ready( function() {
-               $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' 
).each( function() {
-                       var href = $(this).attr( 'href' );
-                       var token = $.cookie( 'clicktracking-session' );
-                       // Only modify local URLs
-                       if ( href.length > 0 && href[0] == '/' && ( href.length 
== 1 || href[1] != '/' ) ) {
-                               var id = 'leftnav-' + skin + '-' + ( 
$(this).attr( 'id' ) || $(this).parent().attr( 'id' ) );
-                               href = mediaWiki.config.get( 'wgScriptPath' ) + 
'/api.php?action=clicktracking' +
-                                       '&eventid=' + id + '&token=' + token + 
'&redirectto=' + escape( href );
-                               $(this).attr( 'href', href );
-                       }
-               } );
-       } );
-} )( jQuery );

Deleted: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css
        2010-09-20 19:44:04 UTC (rev 73399)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css
        2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,53 +0,0 @@
-/*
- * CSS for Click Tracking special page
- */
-
-.table_headers {
-       font-weight: bold;
-       border: bottom;
-}
-.table_data_row {
-       text-align: center;
-}
-.table_data_row .event_name {
-       text-align: left;
-       font-weight: bold;
-}
-#clicktrack_data_table {
-       float: left;
-}
-#chart_img {
-       float: left;
-       margin-left: 90px;
-}
-#change_graph_cell {
-       text-align: right;
-}
-.disabled_option {
-       color: #999999;
-}
-.hidden {
-       display: none;
-}
-.control_div {
-       margin: 10px;
-       clear: both;
-}
-.sub_option_div {
-       margin-top: 4px;
-       margin-left: 15px;
-}
-.sub_option_div input[type="text"] {
-       width: 20px;
-       margin-left: 10px;
-}
-#date_range {
-       display: inline;
-       float: left;
-       width: 200px;
-}
-.add_condition_button {
-       float: right;
-       color: blue;
-       cursor: pointer;
-}
\ No newline at end of file

Deleted: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js
 2010-09-20 19:44:04 UTC (rev 73399)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js
 2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,530 +0,0 @@
-/*
- * JavaScript for Click Tracking special page
- */
-
-( function( $ ) {
-       /* Very limited JSON encoder */
-       $.json_encode = function( js_obj ) {
-               var returnstr = "{ ";
-               
-               // trailing commas and json don't mix
-               var propertynum = 0;
-               for ( property in js_obj ) {
-                       if ( propertynum > 0 ) {
-                               returnstr += ", ";
-                       }
-                       returnstr += "\"" + property + "\"" + " : ";
-                       if ( typeof js_obj[property] == 'object' ) {
-                               returnstr += $.json_encode( js_obj[property] );
-                       } else {
-                               returnstr += "\"" + js_obj[property] + "\" ";
-                       }
-                       propertynum++;
-               }
-               
-               returnstr += " }";
-               return returnstr;
-       };
-       
-       $.getUserDefsFromDialog = function() {
-               var currUserDefs = new Array();
-               if ( $( "#anon_users_checkbox" ).is( ":checked" ) ) {
-                       currUserDefs['anonymous'] = 1;
-               } else {
-                       currUserDefs['anonymous'] = 0;
-               }
-               
-               var getCheckBoxData = function( contribName ) {
-                       if ( $( "#" + contribName + "_checkbox" ).is( 
":checked" ) ) {
-                               currUserDefs[contribName] = new Array();
-                       } else {
-                               return;
-                       }
-                       var totalConds = $( "#" + contribName + "_div" ).data( 
"totalConditions" );
-                       var i;
-                       
-                       for ( i = 1; i <= totalConds; i++ ) {
-                               if ( $( "#" + contribName + "_" + i + 
"_checkbox" ).is( ":checked" ) ) {
-                                       $( "#" + contribName + "_" + i + 
"_ltgt" ).children().each( function() {
-                                               if ( $( this ).is( ":selected" 
) ) {
-                                                       var currentCond = new 
Array();
-                                                       switch ( $( this 
).attr( "value" ) ) {
-                                                               case 'lt':
-                                                                       
currentCond['operation'] = '<';
-                                                                       break;
-                                                               case 'lteq':
-                                                                       
currentCond['operation'] = '<=';
-                                                                       break;
-                                                               case 'gt':
-                                                                       
currentCond['operation'] = '>';
-                                                                       break;
-                                                               case 'gteq':
-                                                                       
currentCond['operation'] = '>=';
-                                                                       break;
-                                                               default:
-                                                                       
currentCond['operation'] = '<';
-                                                                       break;
-                                                       }
-                                                       currentCond['value'] = 
$( "#" + contribName + "_" + i + "_text" ).val();
-                                                       
currUserDefs[contribName].push( currentCond );
-                                               }
-                                       } );
-                               } // ifchecked
-                       } // forloop
-               };
-               
-               getCheckBoxData( "total_contribs" );
-               getCheckBoxData( "contribs_span_1" );
-               getCheckBoxData( "contribs_span_2" );
-               getCheckBoxData( "contribs_span_3" );
-               wgClickTrackUserDefs[$( "#user_def_alter_legend" ).data( 
"currentlyEditing" )] = currUserDefs;
-       };
-       
-       $.renderUserDefDialogWith = function( userDef, defName ) {
-               // change name
-               $( "#user_def_alter_legend" ).text( $( "#user_def_alter_legend" 
).data( "defaultChangeText" ) + " " + defName );
-               $( "#user_def_alter_legend" ).data( "currentlyEditing", defName 
);
-               
-               var setContribs = function( conditionArray, contribName ) {
-                       initialDiv = $( "<div></div>" ).attr( 'id', contribName 
+ '_div' );
-                       initialDiv.addClass( 'checkbox_div' );
-                       initialDiv.addClass( 'control_div' );
-                       
-                       textDiv = $( "<div></div>" ).attr( 'id', contribName + 
'_text_div' );
-                       mainCheckbox = $( "<input>" ).attr( 'id', contribName + 
'_checkbox' );
-                       mainCheckbox.attr( 'type', 'checkbox' );
-                       mainCheckbox.addClass( 'user_def_checkbox' );
-                       
-                       if ( conditionArray.length > 0 ) {
-                               mainCheckbox.attr( 'checked', true );
-                       }
-                       
-                       textDiv.append( mainCheckbox );
-                       textDiv.text( contribName ); // i18n txt here
-                       textDiv.css( 'display', 'inline' );
-                       initialDiv.append( mainCheckbox );
-                       initialDiv.append( textDiv );
-                       
-                       var buildConditionDiv = function( condition, counter, 
isChecked ) {
-                               conditionDiv = $( "<div></div>" ).attr( 'id', 
contribName + '_range_' + counter + '_div' );
-                               conditionDiv.addClass( 'checkbox_div' );
-                               conditionDiv.addClass( 'sub_option_div' );
-                               
-                               // initialDiv.append(conditionDiv);
-                               cCheckbox = $( "<input 
type=\"checkbox\"></input>" ).attr( 'id',
-                                       contribName + '_' + counter + 
'_checkbox' );
-                               // cCheckbox.attr('type', 'checkbox');
-                               if ( isChecked ) {
-                                       cCheckbox.attr( 'checked', true );
-                               }
-                               
-                               cCheckbox.addClass( 'number_select_checkbox' );
-                               conditionDiv.append( cCheckbox );
-                               
-                               cSelect = $( "<select></select>" ).attr( 'id', 
contribName + '_' + counter + '_ltgt' );
-                               cSelect.addClass( 'number_select_ltgt' );
-                               
-                               cOpt1 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_lt' );
-                               cOpt1.addClass( 'number_select_ltgt_opt' );
-                               cOpt1.attr( 'value', 'lt' );
-                               cOpt1.text( '<' );
-                               if ( condition['operation'] == '<' ) {
-                                       cOpt1.attr( 'selected', true );
-                               }
-                               
-                               cOpt2 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_gt' );
-                               cOpt2.addClass( 'number_select_ltgt_opt' );
-                               cOpt2.attr( 'value', 'gt' );
-                               cOpt2.text( '>' );
-                               if ( condition['operation'] == '>' ) {
-                                       cOpt2.attr( 'selected', true );
-                               }
-                               
-                               cOpt3 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_lteq' );
-                               cOpt3.addClass( 'number_select_ltgt_opt' );
-                               cOpt3.attr( 'value', 'lteq' );
-                               cOpt3.text( '<=' );
-                               if ( condition['operation'] == '<=' ) {
-                                       cOpt3.attr( 'selected', true );
-                               }
-                               
-                               cOpt4 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_gteq' );
-                               cOpt4.addClass( 'number_select_ltgt_opt' );
-                               cOpt4.attr( 'value', 'gteq' );
-                               cOpt4.text( '>=' );
-                               if ( condition['operation'] == '>=' ) {
-                                       cOpt4.attr( 'selected', true );
-                               }
-                               
-                               cSelect.append( cOpt1 );
-                               cSelect.append( cOpt2 );
-                               cSelect.append( cOpt3 );
-                               cSelect.append( cOpt4 );
-                               conditionDiv.append( cSelect );
-                               
-                               cTextInput = $( "<input></input>" ).attr( 'id', 
contribName + '_' + counter + '_text' );
-                               cTextInput.addClass( 'number_select_text' );
-                               cTextInput.attr( 'value', condition['value'] );
-                               conditionDiv.append( cTextInput );
-                               
-                               return conditionDiv;
-                       };
-                       
-                       var i = 0;
-                       for ( var condition in conditionArray ) {
-                               i++;
-                               var conditionDiv = buildConditionDiv( 
conditionArray[condition], i, true );
-                               initialDiv.append( conditionDiv );
-                       } // forloop
-                       
-                       initialDiv.data( 'totalConditions', i );
-                       addConditions = $( "<div></div>" ).attr( 'id', 
contribName + '_addbutton' );
-                       addConditions.data( 'contribName', contribName );
-                       addConditions.addClass( 'add_condition_button' );
-                       addConditions.text( '+' );
-                       initialDiv.append( addConditions );
-                       addConditions.click( function() {
-                               var initDiv = $( "#" + $( this ).data( 
'contribName' ) + '_div' );
-                               var totalConds = initDiv.data( 
'totalConditions' );
-                               totalConds++;
-                               initDiv.data( 'totalConditions', totalConds );
-                               var tmpCond = new Array();
-                               tmpCond['operation'] = ' ';
-                               tmpCond['value'] = ' ';
-                               
-                               buildConditionDiv( tmpCond, totalConds 
).insertBefore( $( this ) );
-                               initDiv.data( 'totalConditions', totalConds, 
false );
-                       } );
-                       
-                       return initialDiv;
-               }; // setcontribs
-               
-               // check anonymous
-               var anon = false;
-               if ( parseInt( userDef['anonymous'] ) == 1 ) {
-                       anon = true;
-               }
-               $( "#anon_users_checkbox" ).attr( 'checked', anon );
-               
-               // clear out old contents
-               $( "#contrib_opts_container" ).empty();
-               
-               var setup_set_contribs = function( contribName ) {
-                       var current_contribs = userDef[contribName];
-                       if ( current_contribs == undefined ) {
-                               current_contribs = new Array();
-                       }
-                       $( "#contrib_opts_container" ).append( setContribs( 
current_contribs, contribName ) );
-               };
-               
-               // total contribs
-               setup_set_contribs( 'total_contribs' );
-               setup_set_contribs( 'contribs_span_1' );
-               setup_set_contribs( 'contribs_span_2' );
-               setup_set_contribs( 'contribs_span_3' );
-               
-               // OK button
-               var okButton = $( "<input>" ).attr( 'id', 'ok_button' );
-               okButton.attr( 'type', 'button' );
-               okButton.attr( 'value', 'ok' );
-               okButton.click( function() {
-                       $.getUserDefsFromDialog();
-                       $( "#user_def_dialog" ).dialog( 'close' );
-               } );
-               $( "#contrib_opts_container" ).append( okButton );
-       }; // renderUserDefDialogWith
-       
-       // functions
-       $.updateChart = function() {
-               event_name = $( "#chart_img" ).data( 'event_name' );
-               
-               var processChartJSON = function( data, status ) {
-                       
-                       var getMax = function( findMax ) {
-                               var retval = Number.MIN_VALUE;
-                               for ( var i in findMax ) {
-                                       if ( findMax[i] > retval ) {
-                                               retval = findMax[i];
-                                       }
-                               }
-                               return retval;
-                       };
-                       
-                       max1 = getMax( data['datapoints']['expert'] );
-                       max2 = getMax( data['datapoints']['intermediate'] );
-                       max3 = getMax( data['datapoints']['basic'] );
-                       max = Math.max( max3, Math.max( max1, max2 ) );
-                       chartURL = 'http://chart.apis.google.com/chart?' + 
'chs=400x400&' + 'cht=lc&'
-                               + 'chco=FF0000,0000FF,00FF00&' + 'chtt=' + 
event_name + ' from ' + $( "#start_date" ).val()
-                               + ' to ' + $( "#end_date" ).val() + "&" + 
'chdl=' + 'Expert|Intermediate|Beginner' + "&"
-                               + 'chxt=x,y&' + 'chd=t:' + 
data['datapoints']['expert'].join( ',' ) + "|"
-                               + data['datapoints']['intermediate'].join( ',' 
) + "|" + data['datapoints']['basic'].join( ',' )
-                               + "&" + 'chds=0,' + max + ',0,' + max + ',0,' + 
max;
-                       $( "#chart_img" ).attr( 'src', chartURL );
-               };
-               
-               start_date = $( "#start_date" ).val();
-               if ( $( "#start_date" ).hasClass( 'hidden' ) ) {
-                       start_date = '0';
-               }
-               
-               end_date = $( "#end_date" ).val();
-               if ( $( "#end_date" ).hasClass( 'hidden' ) ) {
-                       end_date = '0';
-               }
-               
-               // post relevant info
-               $.post( wgScriptPath + '/api.php', {
-                   'action' : 'specialclicktracking',
-                   'format' : 'json',
-                   'eventid' : $( "#chart_img" ).data( 'eventid' ),
-                   'increment' : $( "#chart_increment" ).val(),
-                   'startdate' : start_date,
-                   'enddate' : end_date,
-                   'userdefs' : $.json_encode( wgClickTrackUserDefs )
-               }, processChartJSON, 'json' );
-       };
-       
-       // pretty colors for the table
-       $.colorizeTable = function() {
-               // expert
-               
-               // get totals
-               var expert_total = 0;
-               
-               $( ".expert_data" ).each( function() {
-                       expert_total += parseInt( $( this ).attr( 'value' ) );
-               } );
-               
-               // set proper red shade
-               $( ".expert_data" ).each( function() {
-                       var rval = 255;
-                       var gval = ( expert_total == 0 ? 255 : 255 - ( 255 * $( 
this ).attr( 'value' ) / expert_total ) );
-                       var bval = gval;
-                       rgbString = "rgb(" + parseInt( rval ) + "," + parseInt( 
gval ) + "," + parseInt( bval ) + ")";
-                       $( this ).data( 'rgb', rgbString );
-                       $( this ).css( 'color', rgbString );
-                       $( this ).css( 'background-color', rgbString );
-               } );
-               
-               // intermediate
-               
-               // total
-               var intermediate_total = 0;
-               $( ".intermediate_data" ).each( function() {
-                       intermediate_total += parseInt( $( this ).attr( 'value' 
) );
-               } );
-               
-               // blue shade
-               $( ".intermediate_data" ).each(
-                       function() {
-                               var rval = ( intermediate_total == 0 ? 255
-                                       : 255 - ( 255 * $( this ).attr( 'value' 
) / intermediate_total ) );
-                               var gval = rval;
-                               var bval = 255;
-                               rgbString = "rgb(" + parseInt( rval ) + "," + 
parseInt( gval ) + "," + parseInt( bval ) + ")";
-                               $( this ).data( 'rgb', rgbString );
-                               $( this ).css( 'color', rgbString );
-                               $( this ).css( 'background-color', rgbString );
-                       } );
-               
-               // total
-               var basic_total = 0;
-               $( ".basic_data" ).each( function() {
-                       basic_total += parseInt( $( this ).attr( 'value' ) );
-               } );
-               
-               // green shade
-               $( ".basic_data" ).each( function() {
-                       var rval = ( basic_total == 0 ? 255 : 255 - ( 255 * $( 
this ).attr( 'value' ) / basic_total ) );
-                       var gval = 255;
-                       var bval = rval;
-                       rgbString = "rgb(" + parseInt( rval ) + "," + parseInt( 
gval ) + "," + parseInt( bval ) + ")";
-                       $( this ).data( 'rgb', rgbString );
-                       $( this ).css( 'color', rgbString );
-                       $( this ).css( 'background-color', rgbString );
-               } );
-               
-               // I wanted to do this with classes, but the element's style 
rule wins over class rule
-               // and each element has its own alternative color
-               $( ".event_data" ).mouseover( function() {
-                       $( this ).css( 'color', '#000000' );
-                       $( this ).css( 'background-color', '#FFFFFF' );
-               } );
-               
-               $( ".event_data" ).mouseout( function() {
-                       rgbString = $( this ).data( "rgb" );
-                       $( this ).css( 'color', rgbString );
-                       $( this ).css( 'background-color', rgbString );
-               } );
-               
-       }; // colorize
-       
-       $.updateTable = function() {
-               var processTableJSON = function( data, status ) {
-                       // clear
-                       $( ".table_data_row" ).each( function() {
-                               $( this ).remove();
-                       } );
-                       
-                       var row_count = 0;
-                       for ( var row_iter in data['tablevals']['vals'] ) {
-                               var row = data['tablevals']['vals'][row_iter]; 
// really, JS?
-                               row_count++;
-                               
-                               var outputRow = $( "<tr></tr>" );
-                               outputRow.addClass( 'table_data_row' );
-                               
-                               var cell = $( "<td></td>" ).attr( 'id', 
'event_name_' + row_count );
-                               cell.addClass( 'event_name' );
-                               cell.attr( 'value', row['event_id'] );
-                               cell.text( row['event_name'] );
-                               outputRow.append( cell );
-                               
-                               var createClassCell = function( userclass ) {
-                                       var newcell = $( "<td></td>" ).attr( 
'id', 'event_' + userclass + '_' + row_count );
-                                       newcell.addClass( 'event_data' );
-                                       newcell.addClass( userclass + '_data' );
-                                       newcell.text( row[userclass] );
-                                       newcell.attr( 'value', row[userclass] );
-                                       outputRow.append( newcell );
-                               };
-                               
-                               createClassCell( 'expert' );
-                               createClassCell( 'intermediate' );
-                               createClassCell( 'basic' );
-                               createClassCell( 'total' );
-                               $( "#clicktrack_data_table" ).append( outputRow 
);
-                       }
-                       
-                       $.colorizeTable();
-                       $.changeDataLinks();
-               };
-               
-               start_date = $( "#start_date" ).val();
-               if ( $( "#start_date" ).hasClass( 'hidden' ) ) {
-                       start_date = '0';
-               }
-               
-               end_date = $( "#end_date" ).val();
-               if ( $( "#end_date" ).hasClass( 'hidden' ) ) {
-                       end_date = '0';
-               }
-               
-               // post relevant info
-               $.post( wgScriptPath + '/api.php', {
-                   'action' : 'specialclicktracking',
-                   'format' : 'json',
-                   'eventid' : 1,
-                   'increment' : $( "#chart_increment" ).val(),
-                   'startdate' : start_date,
-                   'enddate' : end_date,
-                   'userdefs' : $.json_encode( wgClickTrackUserDefs ),
-                   'tabledata' : 1
-               }, processTableJSON, 'json' );
-               
-       }; // updateTable
-       
-       $.setUIControls = function() {
-               // SET UP DATE RANGES
-               
-               // date-pickers for start and end dates
-               $( '.date_range_input' ).each( function() {
-                       $( this ).datepicker();
-                       $( this ).datepicker( 'option', 'dateFormat', 'yymmdd' 
);
-               } );
-               var startDate = new Date();
-               $( '#start_date' ).val( "20091009" ); // click_tracking start 
date as default
-               
-               var toggleDateInput = function( tableRow ) {
-                       var checked = false;
-                       tableRow.children().each( function() {
-                               if ( checked == false ) {
-                                       checked = $( this ).children( 
"input:checkbox" ).eq( 0 ).is( ":checked" );
-                               }
-                       } );
-                       
-                       if ( checked ) {
-                               tableRow.removeClass( 'disabled_option' );
-                               tableRow.children( "td" ).each( function() {
-                                       $( this ).children( ".date_range_input" 
).removeClass( 'hidden' );
-                               } );
-                       } else {
-                               tableRow.children( "td" ).each( function() {
-                                       $( this ).children( ".date_range_input" 
).addClass( 'hidden' );
-                               } );
-                               tableRow.addClass( 'disabled_option' );
-                       }
-               };
-               
-               $( '.date_range_checkbox' ).click( function() {
-                       toggleDateInput( $( this ).closest( 'tr' ) );
-               } );
-               
-               // update table
-               $( '#update_table_button' ).click( $.updateTable );
-               
-               // CHART DIALOG
-               $( "#chart_dialog" ).dialog( {
-                   autoOpen : false,
-                   width : 400
-               } );
-               $( "#chart_img" ).css( 'cursor', 'pointer' );
-               $( "#chart_img" ).click( function() {
-                       $( "#chart_dialog" ).dialog( 'open' );
-               } );
-               
-               $( "#chart_increment" ).data( 'value', $( "#chart_increment" 
).val() );
-               
-               $( "#change_graph" ).click( function() {
-                       $( "#chart_dialog" ).dialog( 'close' );
-                       
-                       // check if the value actually changed, if so, update 
and increment things accordingly
-                           if ( $( "#chart_increment" ).data( 'value' ) != $( 
"#chart_increment" ).val() ) {
-                                   $( "#chart_increment" ).data( 'value', $( 
"#chart_increment" ).val() );
-                                   $.updateChart();
-                           }
-                           
-                   } );
-               
-               // CHANGE USER INFO DIALOG
-               $( "#user_def_dialog" ).dialog( {
-                   autoOpen : false,
-                   width : 400
-               } );
-               $( "#user_def_alter_legend" ).data( 'defaultChangeText', $( 
"#user_def_alter_legend" ).text() );
-               
-               // CHANGE USER/INTERMEDIATE/EXPERT DIALOGS
-               var loadHeaderInfo = function( headerName ) {
-                       $( "#" + headerName + "_header" ).css( 'cursor', 
'pointer' );
-                       $( "#" + headerName + "_header" ).click( function() {
-                               $.renderUserDefDialogWith( 
wgClickTrackUserDefs[headerName], headerName );
-                               $( "#user_def_dialog" ).dialog( 'open' );
-                       } );
-               }; // headername
-               
-               loadHeaderInfo( 'basic' );
-               loadHeaderInfo( 'intermediate' );
-               loadHeaderInfo( 'expert' );
-               
-       };
-       
-       $.changeDataLinks = function() {
-               $( ".event_name" ).each( function() {
-                       $( this ).css( 'cursor', 'pointer' );
-                       
-                       $( this ).click( function() {
-                               $( "#chart_img" ).data( 'eventid', $( this 
).attr( 'value' ) );
-                               $( "#chart_img" ).data( 'event_name', $( this 
).text() );
-                               $.updateChart();
-                       } ); // click
-                   } ); // each
-       }; // addlink
-       
-       return $( this );
-} )( jQuery );
-
-// colorize the table on document.ready
-$( document ).ready( $.colorizeTable );
-$( document ).ready( $.changeDataLinks );
-$( document ).ready( $.setUIControls );

Copied: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.js 
(from rev 73387, 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.js)
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.js 
                            (rev 0)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.js 
    2010-09-20 19:53:17 UTC (rev 73400)
@@ -0,0 +1,20 @@
+/*
+ * JavaScript for ClickTracking extension
+ */
+
+( function( $ ) {
+       // Add click tracking hooks to the sidebar
+       $(document).ready( function() {
+               $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' 
).each( function() {
+                       var href = $(this).attr( 'href' );
+                       var token = $.cookie( 'clicktracking-session' );
+                       // Only modify local URLs
+                       if ( href.length > 0 && href[0] == '/' && ( href.length 
== 1 || href[1] != '/' ) ) {
+                               var id = 'leftnav-' + skin + '-' + ( 
$(this).attr( 'id' ) || $(this).parent().attr( 'id' ) );
+                               href = mediaWiki.config.get( 'wgScriptPath' ) + 
'/api.php?action=clicktracking' +
+                                       '&eventid=' + id + '&token=' + token + 
'&redirectto=' + escape( href );
+                               $(this).attr( 'href', href );
+                       }
+               } );
+       } );
+} )( jQuery );

Copied: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.css
 (from rev 73387, 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.css)
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.css
                            (rev 0)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.css
    2010-09-20 19:53:17 UTC (rev 73400)
@@ -0,0 +1,53 @@
+/*
+ * CSS for ClickTracking extension special page
+ */
+
+.table_headers {
+       font-weight: bold;
+       border: bottom;
+}
+.table_data_row {
+       text-align: center;
+}
+.table_data_row .event_name {
+       text-align: left;
+       font-weight: bold;
+}
+#clicktrack_data_table {
+       float: left;
+}
+#chart_img {
+       float: left;
+       margin-left: 90px;
+}
+#change_graph_cell {
+       text-align: right;
+}
+.disabled_option {
+       color: #999999;
+}
+.hidden {
+       display: none;
+}
+.control_div {
+       margin: 10px;
+       clear: both;
+}
+.sub_option_div {
+       margin-top: 4px;
+       margin-left: 15px;
+}
+.sub_option_div input[type="text"] {
+       width: 20px;
+       margin-left: 10px;
+}
+#date_range {
+       display: inline;
+       float: left;
+       width: 200px;
+}
+.add_condition_button {
+       float: right;
+       color: blue;
+       cursor: pointer;
+}
\ No newline at end of file

Copied: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.js
 (from rev 73387, 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/clickTracking.special.js)
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.js
                             (rev 0)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/ext.clickTracking.special.js
     2010-09-20 19:53:17 UTC (rev 73400)
@@ -0,0 +1,530 @@
+/*
+ * JavaScript for ClickTracking extension special page
+ */
+
+( function( $ ) {
+       /* Very limited JSON encoder */
+       $.json_encode = function( js_obj ) {
+               var returnstr = "{ ";
+               
+               // trailing commas and json don't mix
+               var propertynum = 0;
+               for ( property in js_obj ) {
+                       if ( propertynum > 0 ) {
+                               returnstr += ", ";
+                       }
+                       returnstr += "\"" + property + "\"" + " : ";
+                       if ( typeof js_obj[property] == 'object' ) {
+                               returnstr += $.json_encode( js_obj[property] );
+                       } else {
+                               returnstr += "\"" + js_obj[property] + "\" ";
+                       }
+                       propertynum++;
+               }
+               
+               returnstr += " }";
+               return returnstr;
+       };
+       
+       $.getUserDefsFromDialog = function() {
+               var currUserDefs = new Array();
+               if ( $( "#anon_users_checkbox" ).is( ":checked" ) ) {
+                       currUserDefs['anonymous'] = 1;
+               } else {
+                       currUserDefs['anonymous'] = 0;
+               }
+               
+               var getCheckBoxData = function( contribName ) {
+                       if ( $( "#" + contribName + "_checkbox" ).is( 
":checked" ) ) {
+                               currUserDefs[contribName] = new Array();
+                       } else {
+                               return;
+                       }
+                       var totalConds = $( "#" + contribName + "_div" ).data( 
"totalConditions" );
+                       var i;
+                       
+                       for ( i = 1; i <= totalConds; i++ ) {
+                               if ( $( "#" + contribName + "_" + i + 
"_checkbox" ).is( ":checked" ) ) {
+                                       $( "#" + contribName + "_" + i + 
"_ltgt" ).children().each( function() {
+                                               if ( $( this ).is( ":selected" 
) ) {
+                                                       var currentCond = new 
Array();
+                                                       switch ( $( this 
).attr( "value" ) ) {
+                                                               case 'lt':
+                                                                       
currentCond['operation'] = '<';
+                                                                       break;
+                                                               case 'lteq':
+                                                                       
currentCond['operation'] = '<=';
+                                                                       break;
+                                                               case 'gt':
+                                                                       
currentCond['operation'] = '>';
+                                                                       break;
+                                                               case 'gteq':
+                                                                       
currentCond['operation'] = '>=';
+                                                                       break;
+                                                               default:
+                                                                       
currentCond['operation'] = '<';
+                                                                       break;
+                                                       }
+                                                       currentCond['value'] = 
$( "#" + contribName + "_" + i + "_text" ).val();
+                                                       
currUserDefs[contribName].push( currentCond );
+                                               }
+                                       } );
+                               } // ifchecked
+                       } // forloop
+               };
+               
+               getCheckBoxData( "total_contribs" );
+               getCheckBoxData( "contribs_span_1" );
+               getCheckBoxData( "contribs_span_2" );
+               getCheckBoxData( "contribs_span_3" );
+               wgClickTrackUserDefs[$( "#user_def_alter_legend" ).data( 
"currentlyEditing" )] = currUserDefs;
+       };
+       
+       $.renderUserDefDialogWith = function( userDef, defName ) {
+               // change name
+               $( "#user_def_alter_legend" ).text( $( "#user_def_alter_legend" 
).data( "defaultChangeText" ) + " " + defName );
+               $( "#user_def_alter_legend" ).data( "currentlyEditing", defName 
);
+               
+               var setContribs = function( conditionArray, contribName ) {
+                       initialDiv = $( "<div></div>" ).attr( 'id', contribName 
+ '_div' );
+                       initialDiv.addClass( 'checkbox_div' );
+                       initialDiv.addClass( 'control_div' );
+                       
+                       textDiv = $( "<div></div>" ).attr( 'id', contribName + 
'_text_div' );
+                       mainCheckbox = $( "<input>" ).attr( 'id', contribName + 
'_checkbox' );
+                       mainCheckbox.attr( 'type', 'checkbox' );
+                       mainCheckbox.addClass( 'user_def_checkbox' );
+                       
+                       if ( conditionArray.length > 0 ) {
+                               mainCheckbox.attr( 'checked', true );
+                       }
+                       
+                       textDiv.append( mainCheckbox );
+                       textDiv.text( contribName ); // i18n txt here
+                       textDiv.css( 'display', 'inline' );
+                       initialDiv.append( mainCheckbox );
+                       initialDiv.append( textDiv );
+                       
+                       var buildConditionDiv = function( condition, counter, 
isChecked ) {
+                               conditionDiv = $( "<div></div>" ).attr( 'id', 
contribName + '_range_' + counter + '_div' );
+                               conditionDiv.addClass( 'checkbox_div' );
+                               conditionDiv.addClass( 'sub_option_div' );
+                               
+                               // initialDiv.append(conditionDiv);
+                               cCheckbox = $( "<input 
type=\"checkbox\"></input>" ).attr( 'id',
+                                       contribName + '_' + counter + 
'_checkbox' );
+                               // cCheckbox.attr('type', 'checkbox');
+                               if ( isChecked ) {
+                                       cCheckbox.attr( 'checked', true );
+                               }
+                               
+                               cCheckbox.addClass( 'number_select_checkbox' );
+                               conditionDiv.append( cCheckbox );
+                               
+                               cSelect = $( "<select></select>" ).attr( 'id', 
contribName + '_' + counter + '_ltgt' );
+                               cSelect.addClass( 'number_select_ltgt' );
+                               
+                               cOpt1 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_lt' );
+                               cOpt1.addClass( 'number_select_ltgt_opt' );
+                               cOpt1.attr( 'value', 'lt' );
+                               cOpt1.text( '<' );
+                               if ( condition['operation'] == '<' ) {
+                                       cOpt1.attr( 'selected', true );
+                               }
+                               
+                               cOpt2 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_gt' );
+                               cOpt2.addClass( 'number_select_ltgt_opt' );
+                               cOpt2.attr( 'value', 'gt' );
+                               cOpt2.text( '>' );
+                               if ( condition['operation'] == '>' ) {
+                                       cOpt2.attr( 'selected', true );
+                               }
+                               
+                               cOpt3 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_lteq' );
+                               cOpt3.addClass( 'number_select_ltgt_opt' );
+                               cOpt3.attr( 'value', 'lteq' );
+                               cOpt3.text( '<=' );
+                               if ( condition['operation'] == '<=' ) {
+                                       cOpt3.attr( 'selected', true );
+                               }
+                               
+                               cOpt4 = $( "<option></option>" ).attr( 'id', 
contribName + '_' + counter + '_gteq' );
+                               cOpt4.addClass( 'number_select_ltgt_opt' );
+                               cOpt4.attr( 'value', 'gteq' );
+                               cOpt4.text( '>=' );
+                               if ( condition['operation'] == '>=' ) {
+                                       cOpt4.attr( 'selected', true );
+                               }
+                               
+                               cSelect.append( cOpt1 );
+                               cSelect.append( cOpt2 );
+                               cSelect.append( cOpt3 );
+                               cSelect.append( cOpt4 );
+                               conditionDiv.append( cSelect );
+                               
+                               cTextInput = $( "<input></input>" ).attr( 'id', 
contribName + '_' + counter + '_text' );
+                               cTextInput.addClass( 'number_select_text' );
+                               cTextInput.attr( 'value', condition['value'] );
+                               conditionDiv.append( cTextInput );
+                               
+                               return conditionDiv;
+                       };
+                       
+                       var i = 0;
+                       for ( var condition in conditionArray ) {
+                               i++;
+                               var conditionDiv = buildConditionDiv( 
conditionArray[condition], i, true );
+                               initialDiv.append( conditionDiv );
+                       } // forloop
+                       
+                       initialDiv.data( 'totalConditions', i );
+                       addConditions = $( "<div></div>" ).attr( 'id', 
contribName + '_addbutton' );
+                       addConditions.data( 'contribName', contribName );
+                       addConditions.addClass( 'add_condition_button' );
+                       addConditions.text( '+' );
+                       initialDiv.append( addConditions );
+                       addConditions.click( function() {
+                               var initDiv = $( "#" + $( this ).data( 
'contribName' ) + '_div' );
+                               var totalConds = initDiv.data( 
'totalConditions' );
+                               totalConds++;
+                               initDiv.data( 'totalConditions', totalConds );
+                               var tmpCond = new Array();
+                               tmpCond['operation'] = ' ';
+                               tmpCond['value'] = ' ';
+                               
+                               buildConditionDiv( tmpCond, totalConds 
).insertBefore( $( this ) );
+                               initDiv.data( 'totalConditions', totalConds, 
false );
+                       } );
+                       
+                       return initialDiv;
+               }; // setcontribs
+               
+               // check anonymous
+               var anon = false;
+               if ( parseInt( userDef['anonymous'] ) == 1 ) {
+                       anon = true;
+               }
+               $( "#anon_users_checkbox" ).attr( 'checked', anon );
+               
+               // clear out old contents
+               $( "#contrib_opts_container" ).empty();
+               
+               var setup_set_contribs = function( contribName ) {
+                       var current_contribs = userDef[contribName];
+                       if ( current_contribs == undefined ) {
+                               current_contribs = new Array();
+                       }
+                       $( "#contrib_opts_container" ).append( setContribs( 
current_contribs, contribName ) );
+               };
+               
+               // total contribs
+               setup_set_contribs( 'total_contribs' );
+               setup_set_contribs( 'contribs_span_1' );
+               setup_set_contribs( 'contribs_span_2' );
+               setup_set_contribs( 'contribs_span_3' );
+               
+               // OK button
+               var okButton = $( "<input>" ).attr( 'id', 'ok_button' );
+               okButton.attr( 'type', 'button' );
+               okButton.attr( 'value', 'ok' );
+               okButton.click( function() {
+                       $.getUserDefsFromDialog();
+                       $( "#user_def_dialog" ).dialog( 'close' );
+               } );
+               $( "#contrib_opts_container" ).append( okButton );
+       }; // renderUserDefDialogWith
+       
+       // functions
+       $.updateChart = function() {
+               event_name = $( "#chart_img" ).data( 'event_name' );
+               
+               var processChartJSON = function( data, status ) {
+                       
+                       var getMax = function( findMax ) {
+                               var retval = Number.MIN_VALUE;
+                               for ( var i in findMax ) {
+                                       if ( findMax[i] > retval ) {
+                                               retval = findMax[i];
+                                       }
+                               }
+                               return retval;
+                       };
+                       
+                       max1 = getMax( data['datapoints']['expert'] );
+                       max2 = getMax( data['datapoints']['intermediate'] );
+                       max3 = getMax( data['datapoints']['basic'] );
+                       max = Math.max( max3, Math.max( max1, max2 ) );
+                       chartURL = 'http://chart.apis.google.com/chart?' + 
'chs=400x400&' + 'cht=lc&'
+                               + 'chco=FF0000,0000FF,00FF00&' + 'chtt=' + 
event_name + ' from ' + $( "#start_date" ).val()
+                               + ' to ' + $( "#end_date" ).val() + "&" + 
'chdl=' + 'Expert|Intermediate|Beginner' + "&"
+                               + 'chxt=x,y&' + 'chd=t:' + 
data['datapoints']['expert'].join( ',' ) + "|"
+                               + data['datapoints']['intermediate'].join( ',' 
) + "|" + data['datapoints']['basic'].join( ',' )
+                               + "&" + 'chds=0,' + max + ',0,' + max + ',0,' + 
max;
+                       $( "#chart_img" ).attr( 'src', chartURL );
+               };
+               
+               start_date = $( "#start_date" ).val();
+               if ( $( "#start_date" ).hasClass( 'hidden' ) ) {
+                       start_date = '0';
+               }
+               
+               end_date = $( "#end_date" ).val();
+               if ( $( "#end_date" ).hasClass( 'hidden' ) ) {
+                       end_date = '0';
+               }
+               
+               // post relevant info
+               $.post( wgScriptPath + '/api.php', {
+                   'action' : 'specialclicktracking',
+                   'format' : 'json',
+                   'eventid' : $( "#chart_img" ).data( 'eventid' ),
+                   'increment' : $( "#chart_increment" ).val(),
+                   'startdate' : start_date,
+                   'enddate' : end_date,
+                   'userdefs' : $.json_encode( wgClickTrackUserDefs )
+               }, processChartJSON, 'json' );
+       };
+       
+       // pretty colors for the table
+       $.colorizeTable = function() {
+               // expert
+               
+               // get totals
+               var expert_total = 0;
+               
+               $( ".expert_data" ).each( function() {
+                       expert_total += parseInt( $( this ).attr( 'value' ) );
+               } );
+               
+               // set proper red shade
+               $( ".expert_data" ).each( function() {
+                       var rval = 255;
+                       var gval = ( expert_total == 0 ? 255 : 255 - ( 255 * $( 
this ).attr( 'value' ) / expert_total ) );
+                       var bval = gval;
+                       rgbString = "rgb(" + parseInt( rval ) + "," + parseInt( 
gval ) + "," + parseInt( bval ) + ")";
+                       $( this ).data( 'rgb', rgbString );
+                       $( this ).css( 'color', rgbString );
+                       $( this ).css( 'background-color', rgbString );
+               } );
+               
+               // intermediate
+               
+               // total
+               var intermediate_total = 0;
+               $( ".intermediate_data" ).each( function() {
+                       intermediate_total += parseInt( $( this ).attr( 'value' 
) );
+               } );
+               
+               // blue shade
+               $( ".intermediate_data" ).each(
+                       function() {
+                               var rval = ( intermediate_total == 0 ? 255
+                                       : 255 - ( 255 * $( this ).attr( 'value' 
) / intermediate_total ) );
+                               var gval = rval;
+                               var bval = 255;
+                               rgbString = "rgb(" + parseInt( rval ) + "," + 
parseInt( gval ) + "," + parseInt( bval ) + ")";
+                               $( this ).data( 'rgb', rgbString );
+                               $( this ).css( 'color', rgbString );
+                               $( this ).css( 'background-color', rgbString );
+                       } );
+               
+               // total
+               var basic_total = 0;
+               $( ".basic_data" ).each( function() {
+                       basic_total += parseInt( $( this ).attr( 'value' ) );
+               } );
+               
+               // green shade
+               $( ".basic_data" ).each( function() {
+                       var rval = ( basic_total == 0 ? 255 : 255 - ( 255 * $( 
this ).attr( 'value' ) / basic_total ) );
+                       var gval = 255;
+                       var bval = rval;
+                       rgbString = "rgb(" + parseInt( rval ) + "," + parseInt( 
gval ) + "," + parseInt( bval ) + ")";
+                       $( this ).data( 'rgb', rgbString );
+                       $( this ).css( 'color', rgbString );
+                       $( this ).css( 'background-color', rgbString );
+               } );
+               
+               // I wanted to do this with classes, but the element's style 
rule wins over class rule
+               // and each element has its own alternative color
+               $( ".event_data" ).mouseover( function() {
+                       $( this ).css( 'color', '#000000' );
+                       $( this ).css( 'background-color', '#FFFFFF' );
+               } );
+               
+               $( ".event_data" ).mouseout( function() {
+                       rgbString = $( this ).data( "rgb" );
+                       $( this ).css( 'color', rgbString );
+                       $( this ).css( 'background-color', rgbString );
+               } );
+               
+       }; // colorize
+       
+       $.updateTable = function() {
+               var processTableJSON = function( data, status ) {
+                       // clear
+                       $( ".table_data_row" ).each( function() {
+                               $( this ).remove();
+                       } );
+                       
+                       var row_count = 0;
+                       for ( var row_iter in data['tablevals']['vals'] ) {
+                               var row = data['tablevals']['vals'][row_iter]; 
// really, JS?
+                               row_count++;
+                               
+                               var outputRow = $( "<tr></tr>" );
+                               outputRow.addClass( 'table_data_row' );
+                               
+                               var cell = $( "<td></td>" ).attr( 'id', 
'event_name_' + row_count );
+                               cell.addClass( 'event_name' );
+                               cell.attr( 'value', row['event_id'] );
+                               cell.text( row['event_name'] );
+                               outputRow.append( cell );
+                               
+                               var createClassCell = function( userclass ) {
+                                       var newcell = $( "<td></td>" ).attr( 
'id', 'event_' + userclass + '_' + row_count );
+                                       newcell.addClass( 'event_data' );
+                                       newcell.addClass( userclass + '_data' );
+                                       newcell.text( row[userclass] );
+                                       newcell.attr( 'value', row[userclass] );
+                                       outputRow.append( newcell );
+                               };
+                               
+                               createClassCell( 'expert' );
+                               createClassCell( 'intermediate' );
+                               createClassCell( 'basic' );
+                               createClassCell( 'total' );
+                               $( "#clicktrack_data_table" ).append( outputRow 
);
+                       }
+                       
+                       $.colorizeTable();
+                       $.changeDataLinks();
+               };
+               
+               start_date = $( "#start_date" ).val();
+               if ( $( "#start_date" ).hasClass( 'hidden' ) ) {
+                       start_date = '0';
+               }
+               
+               end_date = $( "#end_date" ).val();
+               if ( $( "#end_date" ).hasClass( 'hidden' ) ) {
+                       end_date = '0';
+               }
+               
+               // post relevant info
+               $.post( wgScriptPath + '/api.php', {
+                   'action' : 'specialclicktracking',
+                   'format' : 'json',
+                   'eventid' : 1,
+                   'increment' : $( "#chart_increment" ).val(),
+                   'startdate' : start_date,
+                   'enddate' : end_date,
+                   'userdefs' : $.json_encode( wgClickTrackUserDefs ),
+                   'tabledata' : 1
+               }, processTableJSON, 'json' );
+               
+       }; // updateTable
+       
+       $.setUIControls = function() {
+               // SET UP DATE RANGES
+               
+               // date-pickers for start and end dates
+               $( '.date_range_input' ).each( function() {
+                       $( this ).datepicker();
+                       $( this ).datepicker( 'option', 'dateFormat', 'yymmdd' 
);
+               } );
+               var startDate = new Date();
+               $( '#start_date' ).val( "20091009" ); // click_tracking start 
date as default
+               
+               var toggleDateInput = function( tableRow ) {
+                       var checked = false;
+                       tableRow.children().each( function() {
+                               if ( checked == false ) {
+                                       checked = $( this ).children( 
"input:checkbox" ).eq( 0 ).is( ":checked" );
+                               }
+                       } );
+                       
+                       if ( checked ) {
+                               tableRow.removeClass( 'disabled_option' );
+                               tableRow.children( "td" ).each( function() {
+                                       $( this ).children( ".date_range_input" 
).removeClass( 'hidden' );
+                               } );
+                       } else {
+                               tableRow.children( "td" ).each( function() {
+                                       $( this ).children( ".date_range_input" 
).addClass( 'hidden' );
+                               } );
+                               tableRow.addClass( 'disabled_option' );
+                       }
+               };
+               
+               $( '.date_range_checkbox' ).click( function() {
+                       toggleDateInput( $( this ).closest( 'tr' ) );
+               } );
+               
+               // update table
+               $( '#update_table_button' ).click( $.updateTable );
+               
+               // CHART DIALOG
+               $( "#chart_dialog" ).dialog( {
+                   autoOpen : false,
+                   width : 400
+               } );
+               $( "#chart_img" ).css( 'cursor', 'pointer' );
+               $( "#chart_img" ).click( function() {
+                       $( "#chart_dialog" ).dialog( 'open' );
+               } );
+               
+               $( "#chart_increment" ).data( 'value', $( "#chart_increment" 
).val() );
+               
+               $( "#change_graph" ).click( function() {
+                       $( "#chart_dialog" ).dialog( 'close' );
+                       
+                       // check if the value actually changed, if so, update 
and increment things accordingly
+                           if ( $( "#chart_increment" ).data( 'value' ) != $( 
"#chart_increment" ).val() ) {
+                                   $( "#chart_increment" ).data( 'value', $( 
"#chart_increment" ).val() );
+                                   $.updateChart();
+                           }
+                           
+                   } );
+               
+               // CHANGE USER INFO DIALOG
+               $( "#user_def_dialog" ).dialog( {
+                   autoOpen : false,
+                   width : 400
+               } );
+               $( "#user_def_alter_legend" ).data( 'defaultChangeText', $( 
"#user_def_alter_legend" ).text() );
+               
+               // CHANGE USER/INTERMEDIATE/EXPERT DIALOGS
+               var loadHeaderInfo = function( headerName ) {
+                       $( "#" + headerName + "_header" ).css( 'cursor', 
'pointer' );
+                       $( "#" + headerName + "_header" ).click( function() {
+                               $.renderUserDefDialogWith( 
wgClickTrackUserDefs[headerName], headerName );
+                               $( "#user_def_dialog" ).dialog( 'open' );
+                       } );
+               }; // headername
+               
+               loadHeaderInfo( 'basic' );
+               loadHeaderInfo( 'intermediate' );
+               loadHeaderInfo( 'expert' );
+               
+       };
+       
+       $.changeDataLinks = function() {
+               $( ".event_name" ).each( function() {
+                       $( this ).css( 'cursor', 'pointer' );
+                       
+                       $( this ).click( function() {
+                               $( "#chart_img" ).data( 'eventid', $( this 
).attr( 'value' ) );
+                               $( "#chart_img" ).data( 'event_name', $( this 
).text() );
+                               $.updateChart();
+                       } ); // click
+                   } ); // each
+       }; // addlink
+       
+       return $( this );
+} )( jQuery );
+
+// colorize the table on document.ready
+$( document ).ready( $.colorizeTable );
+$( document ).ready( $.changeDataLinks );
+$( document ).ready( $.setUIControls );

Modified: 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/jquery.clickTracking.js
===================================================================
--- 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/jquery.clickTracking.js
  2010-09-20 19:44:04 UTC (rev 73399)
+++ 
trunk/extensions/UsabilityInitiative/ClickTracking/modules/jquery.clickTracking.js
  2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,5 +1,5 @@
 /*
- * JavaScript for Click Tracking jQuery plugin
+ * JavaScript for ClickTracking jQuery plugin
  */
 
 ( function( $ ) {

Modified: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.hooks.php
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.hooks.php        
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.hooks.php        
2010-09-20 19:53:17 UTC (rev 73400)
@@ -11,9 +11,9 @@
        /* Protected Static Members */
        
        protected static $modules = array(
-               'prefSwitch' => array(
-                       'scripts' => 
'extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js',
-                       'styles' => 
'extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css',
+               'ext.prefSwitch' => array(
+                       'scripts' => 
'extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js',
+                       'styles' => 
'extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css',
                        'dependencies' => 'jquery.client',
                ),
        );

Modified: trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php       
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/SpecialPrefSwitch.php       
2010-09-20 19:53:17 UTC (rev 73400)
@@ -104,7 +104,6 @@
        
        public function __construct() {
                parent::__construct( 'PrefSwitch' );
-               wfLoadExtensionMessages( 'PrefSwitch' );
        }
        public function execute( $par ) {
                global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, 
$wgPrefSwitchStyleVersion, $wgPrefSwitchGlobalOptOut;
@@ -129,7 +128,7 @@
                }
                // Begin output
                $this->setHeaders();
-               $wgOut->addModules( 'prefSwitch' );
+               $wgOut->addModules( 'ext.prefSwitch' );
                $wgOut->addHtml( '<div class="plainlinks">' );
                // Handle various modes
                if ( $wgRequest->getCheck( 'mode' ) && $wgUser->isLoggedIn() ) {

Copied: 
trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css 
(from rev 73395, 
trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css)
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css  
                        (rev 0)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css  
2010-09-20 19:53:17 UTC (rev 73400)
@@ -0,0 +1,65 @@
+/*
+ * CSS for PrefSwitch extension
+ */
+
+div.prefswitch-intro {
+       font-size: large;
+       margin-bottom: 1em;
+}
+form.prefswitch-survey {
+       width: 32em;
+       margin: 0;
+       padding: 0;
+}
+form.prefswitch-survey dl {
+       border-top: dashed 1px silver;
+       margin: 0;
+       padding: 0;
+       margin-top: 1em;
+       padding-top: 1em;
+       width: 32em;
+}
+form.prefswitch-survey dl dt,
+form.prefswitch-survey dl dd {
+       margin: 0;
+       margin-bottom: 0.5em;
+}
+form.prefswitch-survey dl dt {
+       margin-top: 1em;
+       font-size: 1.1em;
+}
+form.prefswitch-survey dl dd {
+       margin-left: 2em;
+}
+form.prefswitch-survey dl dt textarea {
+       width: 30em;
+       height: 4em;
+}
+form.prefswitch-survey dl blockquote {
+       padding: 0em;
+       margin: 0em;
+       margin-left: 2em;
+}
+form.prefswitch-survey dl blockquote dd {
+       margin-left: 2em;
+}
+form.prefswitch-survey dl blockquote dd textarea {
+       width: 28em;
+}
+form.prefswitch-survey dl dt p {
+       margin: 0;
+       padding: 0;
+}
+form.prefswitch-survey dl dd p {
+       margin: 0;
+       padding: 0;
+       line-height: 2em;
+}
+form.prefswitch-survey .prefswitch-survey-submit {
+       margin-top: 1em;
+       margin-bottom: 1em;
+       text-align: right;
+}
+form.prefswitch-survey input.prefswitch-need-other {
+       clear: both;
+}
\ No newline at end of file

Copied: 
trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js (from 
rev 73395, 
trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js)
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js   
                        (rev 0)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js   
2010-09-20 19:53:17 UTC (rev 73400)
@@ -0,0 +1,83 @@
+/*
+ * JavaScript for PrefSwitch extension
+ */
+
+$(document).ready( function() {
+       var client = $.client.profile();
+       function detect() {
+               // Detect browser
+               var browser = 'other';
+               switch ( client.name ) {
+                       case 'msie':
+                               var v = parseInt( client.versionNumber );
+                               // IE8 supports Document mode while IE7 does 
not support it - other versions don't lie about their age
+                               browser = ( v == 7 ? ( document.documentMode ? 
'ie8' : 'ie7' ) : 'ie' + v );
+                               break;
+                       case 'firefox': browser = 'ff' + parseInt( 
client.versionNumber ); break;
+                       case 'chrome': browser = 'c' + parseInt( 
client.versionNumber ); break;
+                       case 'safari': browser = 's' + parseInt( 
client.versionNumber ); break;
+                       case 'opera':
+                               if ( parseInt( client.versionNumber ) == 9 ) {
+                                       if ( client.version.substr( 0, 3 ) == 
'9.5' ) {
+                                               browser = 'o9.5';
+                                       } else {
+                                               browser = 'o9';
+                                       }
+                               } else if ( parseInt( client.versionNumber ) == 
10 ) {
+                                       browser = 'o10';
+                               }
+                               break;
+               }
+               // Detect operating system
+               var platform = 'other';
+               switch ( client.platform ) {
+                       case 'win': platform = 'windows'; break;
+                       case 'mac': platform = 'macos'; break;
+                       case 'linux': platform = 'linux'; break;
+               }
+               switch ( client.name ) {
+                       case 'iemobile': platform = 'windowsmobile'; break;
+                       case 'iphone': platform = 'iphoneos'; break;
+                       case 'ipod': platform = 'iphoneos'; break;
+                       case 'ipad': platform = 'iphoneos'; break;
+               }
+               return {
+                       'survey-browser': browser, 'survey-os': platform, 
'survey-res-x': screen.width, 'survey-res-y': screen.height
+               };
+       }
+       // Auto-hide/show "other" explanation fields for selects
+       $( '.prefswitch-survey-other-select' ).parent().hide();
+       $( 'select.prefswitch-survey-need-other' ).change( function() {
+               if ( $(this).val() == 'other' ) {
+                       $( '#' + $(this).attr( 'id' ) + '-other' 
).parent().slideDown( 'fast' );
+               } else {
+                       $( '#' + $(this).attr( 'id' ) + '-other' 
).parent().slideUp( 'fast' );
+               }
+       });
+       // Auto-select the check or radio next to an "other" explaination on 
click
+       $( '.prefswitch-survey-other-radios, .prefswitch-survey-other-checks' 
).click( function() {
+               $(this).prev().prev().attr( 'checked', true );
+       });
+       // Auto-hide/show explanation fields for boolean
+       $( '.prefswitch-survey-iftrue, .prefswitch-survey-iffalse' ).hide();
+       $( '.prefswitch-survey-true, .prefswitch-survey-false' ).change( 
function() {
+               $ifTrueRow = $( '#' + $(this).attr( 'name' ) + '-iftrue-row' );
+               $ifFalseRow = $( '#' + $(this).attr( 'name' ) + '-iffalse-row' 
);
+               if ( $(this).is( '.prefswitch-survey-true:checked' ) ) {
+                       $ifTrueRow.slideDown( 'fast' );
+                       $ifFalseRow.slideUp( 'fast' );
+               } else if ( $(this).is( '.prefswitch-survey-false:checked' ) ) {
+                       $ifTrueRow.slideUp( 'fast' );
+                       $ifFalseRow.slideDown( 'fast' );
+               }
+       } );
+       $( '.prefswitch-survey-true, .prefswitch-survey-false' ).change();
+       // Auto-detect browser, os and screen size
+       var detected = detect();
+       $( '#prefswitch-survey-browser' ).val( detected['survey-browser'] );
+       $( '#prefswitch-survey-os' ).val( detected['survey-os'] );
+       if ( detected['survey-res-x'] && detected['survey-res-y'] ) {
+               $( '#prefswitch-survey-res-x' ).val( detected['survey-res-x'] );
+               $( '#prefswitch-survey-res-y' ).val( detected['survey-res-y'] );
+       }
+});

Deleted: trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css      
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.css      
2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,61 +0,0 @@
-div.prefswitch-intro {
-       font-size: large;
-       margin-bottom: 1em;
-}
-form.prefswitch-survey {
-       width: 32em;
-       margin: 0;
-       padding: 0;
-}
-form.prefswitch-survey dl {
-       border-top: dashed 1px silver;
-       margin: 0;
-       padding: 0;
-       margin-top: 1em;
-       padding-top: 1em;
-       width: 32em;
-}
-form.prefswitch-survey dl dt,
-form.prefswitch-survey dl dd {
-       margin: 0;
-       margin-bottom: 0.5em;
-}
-form.prefswitch-survey dl dt {
-       margin-top: 1em;
-       font-size: 1.1em;
-}
-form.prefswitch-survey dl dd {
-       margin-left: 2em;
-}
-form.prefswitch-survey dl dt textarea {
-       width: 30em;
-       height: 4em;
-}
-form.prefswitch-survey dl blockquote {
-       padding: 0em;
-       margin: 0em;
-       margin-left: 2em;
-}
-form.prefswitch-survey dl blockquote dd {
-       margin-left: 2em;
-}
-form.prefswitch-survey dl blockquote dd textarea {
-       width: 28em;
-}
-form.prefswitch-survey dl dt p {
-       margin: 0;
-       padding: 0;
-}
-form.prefswitch-survey dl dd p {
-       margin: 0;
-       padding: 0;
-       line-height: 2em;
-}
-form.prefswitch-survey .prefswitch-survey-submit {
-       margin-top: 1em;
-       margin-bottom: 1em;
-       text-align: right;
-}
-form.prefswitch-survey input.prefswitch-need-other {
-       clear: both;
-}
\ No newline at end of file

Deleted: trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js
===================================================================
--- trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js       
2010-09-20 19:44:04 UTC (rev 73399)
+++ trunk/extensions/UsabilityInitiative/PrefSwitch/modules/prefSwitch.js       
2010-09-20 19:53:17 UTC (rev 73400)
@@ -1,83 +0,0 @@
-/*
- * JavaScript for PrefSwitch extension
- */
-
-$(document).ready( function() {
-       var client = $.client.profile();
-       function detect() {
-               // Detect browser
-               var browser = 'other';
-               switch ( client.name ) {
-                       case 'msie':
-                               var v = parseInt( client.versionNumber );
-                               // IE8 supports Document mode while IE7 does 
not support it - other versions don't lie about their age
-                               browser = ( v == 7 ? ( document.documentMode ? 
'ie8' : 'ie7' ) : 'ie' + v );
-                               break;
-                       case 'firefox': browser = 'ff' + parseInt( 
client.versionNumber ); break;
-                       case 'chrome': browser = 'c' + parseInt( 
client.versionNumber ); break;
-                       case 'safari': browser = 's' + parseInt( 
client.versionNumber ); break;
-                       case 'opera':
-                               if ( parseInt( client.versionNumber ) == 9 ) {
-                                       if ( client.version.substr( 0, 3 ) == 
'9.5' ) {
-                                               browser = 'o9.5';
-                                       } else {
-                                               browser = 'o9';
-                                       }
-                               } else if ( parseInt( client.versionNumber ) == 
10 ) {
-                                       browser = 'o10';
-                               }
-                               break;
-               }
-               // Detect operating system
-               var platform = 'other';
-               switch ( client.platform ) {
-                       case 'win': platform = 'windows'; break;
-                       case 'mac': platform = 'macos'; break;
-                       case 'linux': platform = 'linux'; break;
-               }
-               switch ( client.name ) {
-                       case 'iemobile': platform = 'windowsmobile'; break;
-                       case 'iphone': platform = 'iphoneos'; break;
-                       case 'ipod': platform = 'iphoneos'; break;
-                       case 'ipad': platform = 'iphoneos'; break;
-               }
-               return {
-                       'survey-browser': browser, 'survey-os': platform, 
'survey-res-x': screen.width, 'survey-res-y': screen.height
-               };
-       }
-       // Auto-hide/show "other" explanation fields for selects
-       $( '.prefswitch-survey-other-select' ).parent().hide();
-       $( 'select.prefswitch-survey-need-other' ).change( function() {
-               if ( $(this).val() == 'other' ) {
-                       $( '#' + $(this).attr( 'id' ) + '-other' 
).parent().slideDown( 'fast' );
-               } else {
-                       $( '#' + $(this).attr( 'id' ) + '-other' 
).parent().slideUp( 'fast' );
-               }
-       });
-       // Auto-select the check or radio next to an "other" explaination on 
click
-       $( '.prefswitch-survey-other-radios, .prefswitch-survey-other-checks' 
).click( function() {
-               $(this).prev().prev().attr( 'checked', true );
-       });
-       // Auto-hide/show explanation fields for boolean
-       $( '.prefswitch-survey-iftrue, .prefswitch-survey-iffalse' ).hide();
-       $( '.prefswitch-survey-true, .prefswitch-survey-false' ).change( 
function() {
-               $ifTrueRow = $( '#' + $(this).attr( 'name' ) + '-iftrue-row' );
-               $ifFalseRow = $( '#' + $(this).attr( 'name' ) + '-iffalse-row' 
);
-               if ( $(this).is( '.prefswitch-survey-true:checked' ) ) {
-                       $ifTrueRow.slideDown( 'fast' );
-                       $ifFalseRow.slideUp( 'fast' );
-               } else if ( $(this).is( '.prefswitch-survey-false:checked' ) ) {
-                       $ifTrueRow.slideUp( 'fast' );
-                       $ifFalseRow.slideDown( 'fast' );
-               }
-       } );
-       $( '.prefswitch-survey-true, .prefswitch-survey-false' ).change();
-       // Auto-detect browser, os and screen size
-       var detected = detect();
-       $( '#prefswitch-survey-browser' ).val( detected['survey-browser'] );
-       $( '#prefswitch-survey-os' ).val( detected['survey-os'] );
-       if ( detected['survey-res-x'] && detected['survey-res-y'] ) {
-               $( '#prefswitch-survey-res-x' ).val( detected['survey-res-x'] );
-               $( '#prefswitch-survey-res-y' ).val( detected['survey-res-y'] );
-       }
-});



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to