r57046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57045‎ | r57046 | r57047 >
Date:09:46, 29 September 2009
Author:catrope
Status:ok
Tags:
Comment:
EditToolbar: (bug 20869) Validate input in table dialog (rows and columns must be numbers); also don't allow insertion of tables with zero rows or columns
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php
@@ -100,6 +100,8 @@
101101 'edittoolbar-tool-table-insert' => 'Insert',
102102 'edittoolbar-tool-table-cancel' => 'Cancel',
103103 'edittoolbar-tool-table-toomany' => 'Inserting a table with more than $1 cells is not possible with this dialog.',
 104+ 'edittoolbar-tool-table-invalidnumber' => 'You have not entered a valid number of rows or columns.',
 105+ 'edittoolbar-tool-table-zero' => 'You cannot insert a table with zero rows or columns.',
104106 'edittoolbar-tool-replace' => 'Search and replace',
105107 'edittoolbar-tool-replace-title' => 'Search and replace',
106108 'edittoolbar-tool-replace-search' => 'Search for:',
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 41;
 23+$wgEditToolbarStyleVersion = 42;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php
@@ -106,6 +106,8 @@
107107 'edittoolbar-tool-table-insert',
108108 'edittoolbar-tool-table-cancel',
109109 'edittoolbar-tool-table-toomany',
 110+ 'edittoolbar-tool-table-invalidnumber',
 111+ 'edittoolbar-tool-table-zero',
110112 'edittoolbar-tool-replace',
111113 'edittoolbar-tool-replace-title',
112114 'edittoolbar-tool-replace-search',
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -1109,6 +1109,14 @@
11101110 var cols = parseInt( $j( '#edittoolbar-table-dimensions-columns' ).val() );
11111111 var header = Math.min( 1, $j( '#edittoolbar-table-dimensions-header:checked' ).size() );
11121112 var table = "{|\n";
 1113+ if ( isNaN( rows ) || isNaN( cols ) ) {
 1114+ alert( gM( 'edittoolbar-tool-table-invalidnumber' ) );
 1115+ return;
 1116+ }
 1117+ if ( rows + header == 0 || cols == 0 ) {
 1118+ alert( gM( 'edittoolbar-tool-table-zero' ) );
 1119+ return;
 1120+ }
11131121 if ( rows * cols > 1000 ) {
11141122 alert( gM( 'edittoolbar-tool-table-toomany', 1000 ) );
11151123 return;

Follow-up revisions

RevisionCommit summaryAuthorDate
r57432EditToolbar: (bug 20869) Validate numbers in table dialog a bit bettercatrope19:46, 6 October 2009

Status & tagging log