r61615 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61614‎ | r61615 | r61616 >
Date:23:31, 27 January 2010
Author:adam
Status:ok
Tags:
Comment:
Updating insert link dialog to change status on click of a radio button. Addresses bug 22291
Modified paths:
  • /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)

Diff [purge]

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' => 38 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 39 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 40 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 41 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 40 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 41 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -929,26 +929,27 @@
930930 }
931931 return s.match( arguments.callee.regex );
932932 }
 933+ // Updates the status indicator above the target link
 934+ function updateWidget( status ) {
 935+ $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide();
 936+ $j( '#wikieditor-toolbar-link-int-target' ).parent()
 937+ .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' );
 938+ if ( status ) {
 939+ $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show();
 940+ $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status );
 941+ }
 942+ if ( status == 'invalid' ) {
 943+ $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
 944+ .attr( 'disabled', true )
 945+ .addClass( 'disabled' );
 946+ } else {
 947+ $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
 948+ .removeAttr('disabled')
 949+ .removeClass('disabled');
 950+ }
 951+ }
933952 // Updates the UI to show if the page title being inputed by the user exists or not
934953 function updateExistence() {
935 - function updateWidget( status ) {
936 - $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide();
937 - $j( '#wikieditor-toolbar-link-int-target' ).parent()
938 - .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' );
939 - if ( status ) {
940 - $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show();
941 - $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status );
942 - }
943 - if ( status == 'invalid' ) {
944 - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
945 - .attr( 'disabled', true )
946 - .addClass( 'disabled' );
947 - } else {
948 - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
949 - .removeAttr('disabled')
950 - .removeClass('disabled');
951 - }
952 - }
953954 // Abort previous request
954955 var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' );
955956 if ( request ) {
@@ -1008,6 +1009,12 @@
10091010 } )
10101011 );
10111012 }
 1013+ $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).click( function() {
 1014+ if( $j( '#wikieditor-toolbar-link-type-ext' ).is( ':checked' ) )
 1015+ updateWidget( 'external' );
 1016+ if( $j( '#wikieditor-toolbar-link-type-int' ).is( ':checked' ) )
 1017+ updateExistence();
 1018+ });
10121019 // Set labels of tabs based on rel values
10131020 var u = mw.usability;
10141021 $j(this).find( '[rel]' ).each( function() {
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -27,9 +27,9 @@
2828 </div>\
2929 </fieldset>',init:function(){function isExternalLink(s){if(typeof arguments.callee.regex=='undefined'){arguments.callee.regex=new RegExp("(^("+wgUrlProtocols+"))|(^www\\.)|([^.]\\.[a-z]{2,}($|\\/))",'i');}
3030 return s.match(arguments.callee.regex);}
31 -function updateExistence(){function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);}
 31+function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);}
3232 if(status=='invalid'){$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').attr('disabled',true).addClass('disabled');}else{$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').removeAttr('disabled').removeClass('disabled');}}
33 -var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();}
 33+function updateExistence(){var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();}
3434 var target=$j('#wikieditor-toolbar-link-int-target').val();var cache=$j('#wikieditor-toolbar-link-int-target-status').data('existencecache');if(cache[target]){updateWidget(cache[target]);return;}
3535 if(target==''){updateWidget(false);return;}
3636 if(isExternalLink(target)){updateWidget('external');return;}
@@ -38,7 +38,9 @@
3939 status='notexists';else if(typeof page.invalid!='undefined')
4040 status='invalid';}
4141 cache[target]=status;updateWidget(status);}}));}
42 -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()=='')
 42+$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked'))
 43+updateWidget('external');if($j('#wikieditor-toolbar-link-type-int').is(':checked'))
 44+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()=='')
4345 $j(this).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');}).focus(function(){$j(this).removeClass('wikieditor-toolbar-dialog-hint');if($j(this).val()==$j(this).data('tooltip'))
4446 $j(this).val('');}).bind('blur change',function(){if($j(this).val()=='')
4547 $j(this).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');else
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -880,26 +880,27 @@
881881 }
882882 return s.match( arguments.callee.regex );
883883 }
 884+ // Updates the status indicator above the target link
 885+ function updateWidget( status ) {
 886+ $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide();
 887+ $j( '#wikieditor-toolbar-link-int-target' ).parent()
 888+ .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' );
 889+ if ( status ) {
 890+ $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show();
 891+ $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status );
 892+ }
 893+ if ( status == 'invalid' ) {
 894+ $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
 895+ .attr( 'disabled', true )
 896+ .addClass( 'disabled' );
 897+ } else {
 898+ $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
 899+ .removeAttr('disabled')
 900+ .removeClass('disabled');
 901+ }
 902+ }
884903 // Updates the UI to show if the page title being inputed by the user exists or not
885904 function updateExistence() {
886 - function updateWidget( status ) {
887 - $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide();
888 - $j( '#wikieditor-toolbar-link-int-target' ).parent()
889 - .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' );
890 - if ( status ) {
891 - $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show();
892 - $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status );
893 - }
894 - if ( status == 'invalid' ) {
895 - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
896 - .attr( 'disabled', true )
897 - .addClass( 'disabled' );
898 - } else {
899 - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' )
900 - .removeAttr('disabled')
901 - .removeClass('disabled');
902 - }
903 - }
904905 // Abort previous request
905906 var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' );
906907 if ( request ) {
@@ -959,6 +960,12 @@
960961 } )
961962 );
962963 }
 964+ $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).click( function() {
 965+ if( $j( '#wikieditor-toolbar-link-type-ext' ).is( ':checked' ) )
 966+ updateWidget( 'external' );
 967+ if( $j( '#wikieditor-toolbar-link-type-int' ).is( ':checked' ) )
 968+ updateExistence();
 969+ });
963970 // Set labels of tabs based on rel values
964971 var u = mw.usability;
965972 $j(this).find( '[rel]' ).each( function() {

Status & tagging log