r94858 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94857‎ | r94858 | r94859 >
Date:03:27, 18 August 2011
Author:nad
Status:deferred
Tags:
Comment:
use jQuery submit so we can block it by returning false
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)
  • /trunk/extensions/RecordAdmin/recordadmin.js (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/recordadmin.js
@@ -2,7 +2,7 @@
33 for( i = 0; i < window.forms.length; i++ ) {
44 var type = forms[i];
55 var form = document.getElementById( type.toLowerCase() + '-form' );
6 - form.onsubmit();
 6+ if( form.onsubmit() === false ) return false;
77 var tags = [ 'input', 'select', 'textarea' ];
88 for( j = 0; j < tags.length; j++ ) {
99 var inputs = form.getElementsByTagName( tags[j] );
@@ -22,4 +22,4 @@
2323 }
2424 }
2525 };
26 -jQuery( '#editform' ).attr( 'onsubmit', 'raRecordForms()' );
 26+jQuery( '#editform' ).submit( raRecordForms );
Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -113,9 +113,7 @@
114114 global $wgRecordAdminExtPath;
115115 $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$wgRecordAdminExtPath/recordadmin.js\"></script>" );
116116 $wgOut->addScript( "<script type=\"$wgJsMimeType\">
117 - function raAddRecordFormSubmit() {
118 - jQuery( '#editform' ).attr( 'onsubmit', 'raRecordForms()' );
119 - }
 117+ function raAddRecordFormSubmit() { jQuery( '#editform' ).submit( raRecordForms ); }
120118 addOnloadHook( raAddRecordFormSubmit );</script>"
121119 );
122120 }
@@ -270,11 +268,11 @@
271269 case '=':
272270 $cond = $re ? preg_match( $b, $a ) : ( empty( $b ) ? true : ( $a == $b ) );
273271 break;
274 -
 272+
275273 case '!=':
276274 $cond = $re ? !preg_match( $b, $a ) : ( empty( $b ) ? true : ( $a != $b ) );
277275 break;
278 -
 276+
279277 default:
280278 $a = preg_replace( "|(\d\d)[-/](\d\d)[-/](\d\d\d\d)|", "$3/$2/$1", $a ); # hack for dd/mm/yyyy format - best to use yyyy-mm-dd
281279 $b = preg_replace( "|(\d\d)[-/](\d\d)[-/](\d\d\d\d)|", "$3/$2/$1", $b );
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -10,7 +10,7 @@
1111 * @author Siebrand Mazeland
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
14 -define( 'RECORDADMIN_VERSION', '1.3.1, 2011-08-18' );
 14+define( 'RECORDADMIN_VERSION', '1.3.2, 2011-08-18' );
1515
1616 $wgRecordAdminExtPath = preg_replace( "|^.*(/extensions/.*$)|", "$wgScriptPath$1", dirname( __FILE__ ) );
1717

Status & tagging log