r63946 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63945‎ | r63946 | r63947 >
Date:11:26, 19 March 2010
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: (bug 22895) Fields in template dialogs weren't getting tabindexes. Refactored the tabindex assignment code to support the dynamic nature of the template dialog
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -75,17 +75,17 @@
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 178 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 51 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ),
79 - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 21 ),
 79+ array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 22 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 67 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 68 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 356 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 357 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 356 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 357 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,14 +16,14 @@
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
20 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 65 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 66 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 6 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 69 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 70 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 69 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 70 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1048,6 +1048,8 @@
10491049 $j(this).find( '[rel]' ).each( function() {
10501050 $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
10511051 });
 1052+ // Set tabindexes on form fields
 1053+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
10521054 // Setup the tooltips in the textboxes
10531055 $j( '#wikieditor-toolbar-link-int-target' )
10541056 .data( 'tooltip', u.getMsg( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
@@ -1487,6 +1489,9 @@
14881490 $j(this).find( '[rel]' ).each( function() {
14891491 $j(this).text( mw.usability.getMsg( $j(this).attr( 'rel' ) ) );
14901492 });
 1493+ // Set tabindexes on form fields
 1494+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
 1495+
14911496 $j( '#wikieditor-toolbar-table-dimensions-rows' ).val( 4 );
14921497 $j( '#wikieditor-toolbar-table-dimensions-columns' ).val( 3 );
14931498 $j( '#wikieditor-toolbar-table-wikitable' ).click( function() {
@@ -1686,6 +1691,8 @@
16871692 $j(this).find( '[rel]' ).each( function() {
16881693 $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
16891694 });
 1695+ // Set tabindexes on form fields
 1696+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
16901697
16911698 // TODO: Find a cleaner way to share this function
16921699 $j(this).data( 'replaceCallback', function( mode ) {
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -42,7 +42,7 @@
4343 $j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked')){var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();}
4444 updateWidget('external');}
4545 if($j('#wikieditor-toolbar-link-type-int').is(':checked'))
46 -updateExistence();});var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-target-tooltip'));$j('#wikieditor-toolbar-link-int-text').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-text-tooltip'));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').each(function(){var tooltip=u.getMsg($j(this).attr('id')+'-tooltip');if($j(this).val()=='')
 46+updateExistence();});var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j.wikiEditor.modules.dialogs.fn.setTabindexes($j(this).find('input').not('[tabindex]'));$j('#wikieditor-toolbar-link-int-target').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-target-tooltip'));$j('#wikieditor-toolbar-link-int-text').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-text-tooltip'));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').each(function(){var tooltip=u.getMsg($j(this).attr('id')+'-tooltip');if($j(this).val()=='')
4747 $j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}).focus(function(){if($j(this).val()==$j(this).data('tooltip')){$j(this).val('').removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('change',function(){if($j(this).val()!=$j(this).data('tooltip')){$j(this).removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('blur',function(){if($j(this).val()==''){$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val())){$j('#wikieditor-toolbar-link-type-ext').attr('checked','checked');updateWidget('external');}else{$j('#wikieditor-toolbar-link-type-int').attr('checked','checked');updateExistence();}
4848 if($j('#wikieditor-toolbar-link-int-text').data('untouched'))
4949 if($j('#wikieditor-toolbar-link-int-target').val()==$j('#wikieditor-toolbar-link-int-target').data('tooltip')){$j('#wikieditor-toolbar-link-int-text').addClass('wikieditor-toolbar-dialog-hint').val($j('#wikieditor-toolbar-link-int-text').data('tooltip')).change();}else{$j('#wikieditor-toolbar-link-int-text').val($j('#wikieditor-toolbar-link-int-target').val()).change();}},0);});$j('#wikieditor-toolbar-link-int-text').bind('change keydown paste cut',function(){var oldVal=$j(this).val();var that=this;setTimeout(function(){if($j(that).val()!=oldVal)
@@ -129,7 +129,7 @@
130130 </tr>\
131131 </table>\
132132 </div>\
133 - </div></div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);$j('#wikieditor-toolbar-table-wikitable').click(function(){$j('.wikieditor-toolbar-table-preview').toggleClass('wikitable');});$j('#wikieditor-toolbar-table-preview').clone().attr('id','wikieditor-toolbar-table-preview2').addClass('sortable').insertAfter($j('#wikieditor-toolbar-table-preview')).hide();if(typeof ts_makeSortable=='function')
 133+ </div></div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});$j.wikiEditor.modules.dialogs.fn.setTabindexes($j(this).find('input').not('[tabindex]'));$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);$j('#wikieditor-toolbar-table-wikitable').click(function(){$j('.wikieditor-toolbar-table-preview').toggleClass('wikitable');});$j('#wikieditor-toolbar-table-preview').clone().attr('id','wikieditor-toolbar-table-preview2').addClass('sortable').insertAfter($j('#wikieditor-toolbar-table-preview')).hide();if(typeof ts_makeSortable=='function')
134134 ts_makeSortable($j('#wikieditor-toolbar-table-preview2').get(0));$j('#wikieditor-toolbar-table-sortable').click(function(){$j('#wikieditor-toolbar-table-preview').hide().attr('id','wikieditor-toolbar-table-preview3');$j('#wikieditor-toolbar-table-preview2').attr('id','wikieditor-toolbar-table-preview').show();$j('#wikieditor-toolbar-table-preview3').attr('id','wikieditor-toolbar-table-preview2');});$j('#wikieditor-toolbar-table-dimensions-header').click(function(){var headerHTML=$j('.wikieditor-toolbar-table-preview-header').html();var hiddenHTML=$j('.wikieditor-toolbar-table-preview-hidden').html();$j('.wikieditor-toolbar-table-preview-header').html(hiddenHTML);$j('.wikieditor-toolbar-table-preview-hidden').html(headerHTML);if(typeof ts_makeSortable=='function')
135135 ts_makeSortable($j('#wikieditor-toolbar-table-preview, #wikieditor-toolbar-table-preview2').filter('.sortable').get(0));});},dialog:{resizable:false,dialogClass:'wikiEditor-toolbar-dialog',width:590,buttons:{'wikieditor-toolbar-tool-table-insert':function(){var rowsVal=$j('#wikieditor-toolbar-table-dimensions-rows').val();var colsVal=$j('#wikieditor-toolbar-table-dimensions-columns').val();var rows=parseInt(rowsVal,10);var cols=parseInt(colsVal,10);var header=$j('#wikieditor-toolbar-table-dimensions-header').is(':checked')?1:0;var u=mw.usability;if(isNaN(rows)||isNaN(cols)||rows!=rowsVal||cols!=colsVal){alert(u.getMsg('wikieditor-toolbar-tool-table-invalidnumber'));return;}
136136 if(rows+header==0||cols==0){alert(u.getMsg('wikieditor-toolbar-tool-table-zero'));return;}
@@ -166,7 +166,7 @@
167167 <input type="checkbox" id="wikieditor-toolbar-replace-regex" />\
168168 <label for="wikieditor-toolbar-replace-regex" rel="wikieditor-toolbar-tool-replace-regex"></label>\
169169 </div>\
170 - </fieldset>',init:function(){var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j(this).data('replaceCallback',function(mode){$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();var searchStr=$j('#wikieditor-toolbar-replace-search').val();if(searchStr==''){$j('#wikieditor-toolbar-replace-emptysearch').show();return;}
 170+ </fieldset>',init:function(){var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j.wikiEditor.modules.dialogs.fn.setTabindexes($j(this).find('input').not('[tabindex]'));$j(this).data('replaceCallback',function(mode){$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();var searchStr=$j('#wikieditor-toolbar-replace-search').val();if(searchStr==''){$j('#wikieditor-toolbar-replace-emptysearch').show();return;}
171171 var replaceStr=$j('#wikieditor-toolbar-replace-replace').val();var flags='m';var matchCase=$j('#wikieditor-toolbar-replace-case').is(':checked');var isRegex=$j('#wikieditor-toolbar-replace-regex').is(':checked');if(!matchCase){flags+='i';}
172172 if(mode=='replaceAll'){flags+='g';}
173173 if(!isRegex){searchStr=RegExp.escape(searchStr);}
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -999,6 +999,8 @@
10001000 $j(this).find( '[rel]' ).each( function() {
10011001 $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
10021002 });
 1003+ // Set tabindexes on form fields
 1004+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
10031005 // Setup the tooltips in the textboxes
10041006 $j( '#wikieditor-toolbar-link-int-target' )
10051007 .data( 'tooltip', u.getMsg( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
@@ -1438,6 +1440,9 @@
14391441 $j(this).find( '[rel]' ).each( function() {
14401442 $j(this).text( mw.usability.getMsg( $j(this).attr( 'rel' ) ) );
14411443 });
 1444+ // Set tabindexes on form fields
 1445+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
 1446+
14421447 $j( '#wikieditor-toolbar-table-dimensions-rows' ).val( 4 );
14431448 $j( '#wikieditor-toolbar-table-dimensions-columns' ).val( 3 );
14441449 $j( '#wikieditor-toolbar-table-wikitable' ).click( function() {
@@ -1637,6 +1642,8 @@
16381643 $j(this).find( '[rel]' ).each( function() {
16391644 $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
16401645 });
 1646+ // Set tabindexes on form fields
 1647+ $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
16411648
16421649 // TODO: Find a cleaner way to share this function
16431650 $j(this).data( 'replaceCallback', function( mode ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js
@@ -98,19 +98,22 @@
9999 configuration.title = $.wikiEditor.autoMsg( module, 'title' );
100100 // Transform messages in keys
101101 // Stupid JS won't let us do stuff like
102 - // foo = { mw.usability.getMsg ('bar'): baz }
 102+ // foo = { mw.usability.getMsg( 'bar' ): baz }
103103 configuration.newButtons = {};
104104 for ( msg in configuration.buttons )
105105 configuration.newButtons[mw.usability.getMsg( msg )] = configuration.buttons[msg];
106106 configuration.buttons = configuration.newButtons;
107107 // Create the dialog <div>
108 - var dialogDiv = $( '<div /> ' )
 108+ var dialogDiv = $( '<div />' )
109109 .attr( 'id', module.id )
110110 .html( module.html )
111111 .data( 'context', context )
112112 .appendTo( $( 'body' ) )
113113 .each( module.init )
114114 .dialog( configuration );
 115+ // Set tabindexes on buttons added by .dialog()
 116+ $.wikiEditor.modules.dialogs.fn.setTabindexes( dialogDiv.closest( '.ui-dialog' )
 117+ .find( 'button' ).not( '[tabindex]' ) );
115118 if ( !( 'resizeme' in module ) || module.resizeme ) {
116119 dialogDiv
117120 .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize )
@@ -122,22 +125,7 @@
123126 dialogDiv.bind( 'dialogclose', function() {
124127 context.fn.restoreSelection();
125128 } );
126 - // Add tabindexes to dialog form elements
127 - // Find the highest tabindex in use
128 - var maxTI = 0;
129 - $j( '[tabindex]' ).each( function() {
130 - var ti = parseInt( $j(this).attr( 'tabindex' ) );
131 - if ( ti > maxTI )
132 - maxTI = ti;
133 - });
134129
135 - var tabIndex = maxTI + 1;
136 - $j( '.ui-dialog input, .ui-dialog button' )
137 - .not( '[tabindex]' )
138 - .each( function() {
139 - $j(this).attr( 'tabindex', tabIndex++ );
140 - });
141 -
142130 // Let the outside world know we set up this dialog
143131 context.$textarea.trigger( 'wikiEditor-dialogs-loaded-' + mod );
144132 }
@@ -181,6 +169,23 @@
182170 oldHidden.each( function() {
183171 $(this).attr( 'style', $(this).data( 'oldstyle' ) );
184172 });
 173+ },
 174+ /**
 175+ * Set the right tabindexes on elements in a dialog
 176+ * @param $elements Elements to set tabindexes on. If they already have tabindexes, this function can behave a bit weird
 177+ */
 178+ setTabindexes: function( $elements ) {
 179+ // Find the highest tabindex in use
 180+ var maxTI = 0;
 181+ $j( '[tabindex]' ).each( function() {
 182+ var ti = parseInt( $j(this).attr( 'tabindex' ) );
 183+ if ( ti > maxTI )
 184+ maxTI = ti;
 185+ });
 186+ var tabIndex = maxTI + 1;
 187+ $elements.each( function() {
 188+ $j(this).attr( 'tabindex', tabIndex++ );
 189+ } );
185190 }
186191 },
187192 // This stuff is just hanging here, perhaps we could come up with a better home for this stuff
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -392,6 +392,16 @@
393393 // Ensure our close button doesn't recieve the ui-state-focus class
394394 $( this ).parent( '.ui-dialog' ).find( '.ui-dialog-titlebar-close' )
395395 .removeClass( 'ui-state-focus' );
 396+
 397+ // Set tabindexes on form fields if needed
 398+ // First unset the tabindexes on the buttons and existing form fields
 399+ // so the order doesn't get messed up
 400+ var $needTabindex = $( this ).closest( '.ui-dialog' ).find( 'button, textarea' );
 401+ if ( $needTabindex.not( '[tabindex]' ).length ) {
 402+ // Only do this if there actually are elements missing a tabindex
 403+ $needTabindex.removeAttr( 'tabindex' );
 404+ $.wikiEditor.modules.dialogs.fn.setTabindexes( $needTabindex );
 405+ }
396406 }
397407 }
398408 };
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -8450,19 +8450,22 @@
84518451 configuration.title = $.wikiEditor.autoMsg( module, 'title' );
84528452 // Transform messages in keys
84538453 // Stupid JS won't let us do stuff like
8454 - // foo = { mw.usability.getMsg ('bar'): baz }
 8454+ // foo = { mw.usability.getMsg( 'bar' ): baz }
84558455 configuration.newButtons = {};
84568456 for ( msg in configuration.buttons )
84578457 configuration.newButtons[mw.usability.getMsg( msg )] = configuration.buttons[msg];
84588458 configuration.buttons = configuration.newButtons;
84598459 // Create the dialog <div>
8460 - var dialogDiv = $( '<div /> ' )
 8460+ var dialogDiv = $( '<div />' )
84618461 .attr( 'id', module.id )
84628462 .html( module.html )
84638463 .data( 'context', context )
84648464 .appendTo( $( 'body' ) )
84658465 .each( module.init )
84668466 .dialog( configuration );
 8467+ // Set tabindexes on buttons added by .dialog()
 8468+ $.wikiEditor.modules.dialogs.fn.setTabindexes( dialogDiv.closest( '.ui-dialog' )
 8469+ .find( 'button' ).not( '[tabindex]' ) );
84678470 if ( !( 'resizeme' in module ) || module.resizeme ) {
84688471 dialogDiv
84698472 .bind( 'dialogopen', $.wikiEditor.modules.dialogs.fn.resize )
@@ -8474,22 +8477,7 @@
84758478 dialogDiv.bind( 'dialogclose', function() {
84768479 context.fn.restoreSelection();
84778480 } );
8478 - // Add tabindexes to dialog form elements
8479 - // Find the highest tabindex in use
8480 - var maxTI = 0;
8481 - $j( '[tabindex]' ).each( function() {
8482 - var ti = parseInt( $j(this).attr( 'tabindex' ) );
8483 - if ( ti > maxTI )
8484 - maxTI = ti;
8485 - });
84868481
8487 - var tabIndex = maxTI + 1;
8488 - $j( '.ui-dialog input, .ui-dialog button' )
8489 - .not( '[tabindex]' )
8490 - .each( function() {
8491 - $j(this).attr( 'tabindex', tabIndex++ );
8492 - });
8493 -
84948482 // Let the outside world know we set up this dialog
84958483 context.$textarea.trigger( 'wikiEditor-dialogs-loaded-' + mod );
84968484 }
@@ -8533,6 +8521,23 @@
85348522 oldHidden.each( function() {
85358523 $(this).attr( 'style', $(this).data( 'oldstyle' ) );
85368524 });
 8525+ },
 8526+ /**
 8527+ * Set the right tabindexes on elements in a dialog
 8528+ * @param $elements Elements to set tabindexes on. If they already have tabindexes, this function can behave a bit weird
 8529+ */
 8530+ setTabindexes: function( $elements ) {
 8531+ // Find the highest tabindex in use
 8532+ var maxTI = 0;
 8533+ $j( '[tabindex]' ).each( function() {
 8534+ var ti = parseInt( $j(this).attr( 'tabindex' ) );
 8535+ if ( ti > maxTI )
 8536+ maxTI = ti;
 8537+ });
 8538+ var tabIndex = maxTI + 1;
 8539+ $elements.each( function() {
 8540+ $j(this).attr( 'tabindex', tabIndex++ );
 8541+ } );
85378542 }
85388543 },
85398544 // This stuff is just hanging here, perhaps we could come up with a better home for this stuff
@@ -9696,6 +9701,16 @@
96979702 // Ensure our close button doesn't recieve the ui-state-focus class
96989703 $( this ).parent( '.ui-dialog' ).find( '.ui-dialog-titlebar-close' )
96999704 .removeClass( 'ui-state-focus' );
 9705+
 9706+ // Set tabindexes on form fields if needed
 9707+ // First unset the tabindexes on the buttons and existing form fields
 9708+ // so the order doesn't get messed up
 9709+ var $needTabindex = $( this ).closest( '.ui-dialog' ).find( 'button, textarea' );
 9710+ if ( $needTabindex.not( '[tabindex]' ).length ) {
 9711+ // Only do this if there actually are elements missing a tabindex
 9712+ $needTabindex.removeAttr( 'tabindex' );
 9713+ $.wikiEditor.modules.dialogs.fn.setTabindexes( $needTabindex );
 9714+ }
97009715 }
97019716 }
97029717 };
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -583,10 +583,10 @@
584584 mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(mod in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[mod];var filtered=false;if(typeof module.filters!='undefined'){for(var i=0;i<module.filters.length;i++){if($(module.filters[i]).length==0){filtered=true;break;}}}
585585 if(!filtered&&$.wikiEditor.isSupported(module)&&$('#'+module.id).size()==0){if(typeof context.$iframe=='undefined'&&$.wikiEditor.isRequired(module,'iframe')){context.fn.setupIframe();}
586586 var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons)
587 -configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});}
588 -dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
589 -maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);}
590 -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){$.wikiEditor.modules.highlight.currentScope=event.data.scope;if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context,'');$.wikiEditor.modules.highlight.fn.mark(context,'realchange','');}},ready:function(context,event){$.wikiEditor.modules.highlight.currentScope='ready';$.wikiEditor.modules.highlight.fn.scan(context,'');$.wikiEditor.modules.highlight.fn.mark(context,'','');}},fn:{create:function(context,config){context.modules.highlight.markersStr='';},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){function Token(offset,label,tokenStart,match){this.offset=offset;this.label=label;this.tokenStart=tokenStart;this.match=match;}
 587+configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div />').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);$.wikiEditor.modules.dialogs.fn.setTabindexes(dialogDiv.closest('.ui-dialog').find('button').not('[tabindex]'));if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});}
 588+dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);}
 589+$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});},setTabindexes:function($elements){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
 590+maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],cfg:{'styleVersion':3},evt:{delayedChange:function(context,event){$.wikiEditor.modules.highlight.currentScope=event.data.scope;if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context,'');$.wikiEditor.modules.highlight.fn.mark(context,'realchange','');}},ready:function(context,event){$.wikiEditor.modules.highlight.currentScope='ready';$.wikiEditor.modules.highlight.fn.scan(context,'');$.wikiEditor.modules.highlight.fn.mark(context,'','');}},fn:{create:function(context,config){context.modules.highlight.markersStr='';},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){function Token(offset,label,tokenStart,match){this.offset=offset;this.label=label;this.tokenStart=tokenStart;this.match=match;}
591591 var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var i=0;i<$.wikiEditor.modules[module].exp.length;i++){var regex=$.wikiEditor.modules[module].exp[i].regex;var label=$.wikiEditor.modules[module].exp[i].label;var markAfter=false;if(typeof $.wikiEditor.modules[module].exp[i].markAfter!='undefined'){markAfter=true;}
592592 match=text.match(regex);var oldOffset=0;while(match!=null){var markOffset=0;var tokenStart=match.index+oldOffset+markOffset;if(markAfter){markOffset+=match[0].length;}
593593 tokenArray.push(new Token(match.index+oldOffset+markOffset,label,tokenStart,match));oldOffset+=match.index+match[0].length;newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}}
@@ -665,7 +665,7 @@
666666 var params=templateModel.getAllInitialParams();var $fields=$(this).find('.wikiEditor-template-dialog-fields');var $rows=$fields.find('.wikiEditor-template-dialog-field-wrapper');for(var paramIndex in params){var param=params[paramIndex];if(typeof param.name=='undefined'){continue;}
667667 var paramText=typeof param=='string'?param.name.replace(/[\_\-]/g,' '):param.name;var paramVal=templateModel.getValue(param.name);if($rows.length>0){var $row=$rows.eq(0);$row.children('label').text(paramText);$row.children('textarea').data('name',param.name).val(paramVal).each(function(){$(this).css('height',$(this).val().length>24?'4.5em':'1.5em');})
668668 $rows=$rows.not($row);}else{var $paramRow=$('<div />').addClass('wikiEditor-template-dialog-field-wrapper');$('<label />').text(paramText).appendTo($paramRow);$('<textarea />').data('name',param.name).val(paramVal).each(function(){$(this).css('height',$(this).val().length>24?'4.5em':'1.5em');}).data('expanded',false).bind('cut paste keypress click change',function(e){if(e.keyCode=='9')return true;var $this=$(this);setTimeout(function(){var expanded=$this.data('expanded');if($this.val().indexOf('\n')!=-1||$this.val().length>24){if(!expanded){$this.animate({'height':'4.5em'},'fast');$this.data('expanded',true);}}else{if(expanded){$this.animate({'height':'1.5em'},'fast');$this.data('expanded',false);}}},0);}).appendTo($paramRow);$paramRow.append('<div style="clear:both"></div>').appendTo($fields);}}
669 -$rows.remove();$fields.find('label').autoEllipsis();$(this).parent('.ui-dialog').find('.ui-dialog-titlebar-close').removeClass('ui-state-focus');}}};context.$textarea.wikiEditor('addDialog',{'templateEditor':dialog});$('#'+dialog.id).data('templateDiv',$template).dialog('open');},updateModel:function($templateText,model){var context=$templateText.data('marker').context;var text;if(typeof model=='undefined'){text=context.fn.htmlToText($templateText.html());}else{text=model.getText();}
 669+$rows.remove();$fields.find('label').autoEllipsis();$(this).parent('.ui-dialog').find('.ui-dialog-titlebar-close').removeClass('ui-state-focus');var $needTabindex=$(this).closest('.ui-dialog').find('button, textarea');if($needTabindex.not('[tabindex]').length){$needTabindex.removeAttr('tabindex');$.wikiEditor.modules.dialogs.fn.setTabindexes($needTabindex);}}}};context.$textarea.wikiEditor('addDialog',{'templateEditor':dialog});$('#'+dialog.id).data('templateDiv',$template).dialog('open');},updateModel:function($templateText,model){var context=$templateText.data('marker').context;var text;if(typeof model=='undefined'){text=context.fn.htmlToText($templateText.html());}else{text=model.getText();}
670670 $templateText.text(text);$templateText.html($templateText.html().replace(/\n/g,'<br />'));$templateText.data('oldHTML',$templateText.html());if(typeof model=='undefined'){model=new $.wikiEditor.modules.templateEditor.fn.model(text);$templateText.data('model',model);}
671671 return model;},getTemplateDisplayName:function(model){var tName=model.getName();if(tName in $.wikiEditor.modules.templateEditor.nameMappings){return tName+': '+model.getValue($.wikiEditor.modules.templateEditor.nameMappings[tName]);}else if(model.getValue('name')!=''){return tName+': '+model.getValue('name');}else if(model.getValue('Name')!=''){return tName+': '+model.getValue('Name');}
672672 return tName;},model:function(wikitext){var collapsible=true;function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;}

Status & tagging log