r100903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100902‎ | r100903 | r100904 >
Date:23:19, 26 October 2011
Author:kaldari
Status:ok
Tags:fundraising 
Comment:
more form validation fixes for msg migration
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_forms/rapidhtml/html/globalcollect_test.html (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/rapidhtml/js/globalcollect_test_2.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/html/globalcollect_test.html
@@ -8,9 +8,7 @@
99
1010 <script type="text/javascript">
1111 function formCheck( ccform ) {
12 - var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip' ];
13 -
14 - var fields = ["emailAdd","fname","lname","street","city","zip" ],
 12+ var fields = ['emailAdd','fname','lname','street','city','zip'],
1513 numFields = fields.length,
1614 i,
1715 output = '',
@@ -18,30 +16,30 @@
1917
2018 for( i = 0; i < numFields; i++ ) {
2119 if( document.getElementById( fields[i] ).value == '' ) {
22 - currField = window['payflowproGatewayErrorMsg'+ msg[i]];
23 - output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n';
 20+ currField = mw.msg( 'donate_interface-error-msg-' + fields[i] );
 21+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n';
2422 }
2523 }
2624
2725 if (document.getElementById('fname').value == '$first') {
28 - output += payflowproGatewayErrorMsgJs + ' first name.\r\n';
 26+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' first name.\r\n';
2927 }
3028 if (document.getElementById('lname').value == '$last') {
31 - output += payflowproGatewayErrorMsgJs + ' last name.\r\n';
 29+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' last name.\r\n';
3230 }
3331 if (document.getElementById('street').value == '$street') {
34 - output += payflowproGatewayErrorMsgJs + ' street address.\r\n';
 32+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' street address.\r\n';
3533 }
3634 if (document.getElementById('city').value == '$city') {
37 - output += payflowproGatewayErrorMsgJs + ' city.\r\n';
 35+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' city.\r\n';
3836 }
3937 if (document.getElementById('zip').value == '$zip') {
40 - output += payflowproGatewayErrorMsgJs + ' zip code.\r\n';
 38+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' zip code.\r\n';
4139 }
4240
4341 var stateField = document.getElementById( 'state' );
4442 if( stateField.options[stateField.selectedIndex].value == '' ) {
45 - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\r\n';
 43+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-error-msg-state' ) + '.\r\n';
4644 }
4745
4846 // validate email address
@@ -49,7 +47,7 @@
5048 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
5149
5250 if( apos < 1 || dotpos-apos < 2 ) {
53 - output += payflowproGatewayErrorMsgEmail;
 51+ output += mw.msg( 'donate_interface-error-msg-email' );
5452 }
5553
5654 if( output ) {
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/js/globalcollect_test_2.js
@@ -24,9 +24,7 @@
2525 });
2626
2727 window.formCheck = function( ccform ) {
28 - var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'Zip' ];
29 -
30 - var fields = ["emailAdd","fname","lname","street","city","zip" ],
 28+ var fields = ['emailAdd','fname','lname','street','city','zip'],
3129 numFields = fields.length,
3230 i,
3331 output = '',
@@ -34,30 +32,30 @@
3533
3634 for( i = 0; i < numFields; i++ ) {
3735 if( document.getElementById( fields[i] ).value == '' ) {
38 - currField = window['payflowproGatewayErrorMsg'+ msg[i]];
39 - output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n';
 36+ currField = mw.msg( 'donate_interface-error-msg-' + fields[i] );
 37+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + currField + '.\r\n';
4038 }
4139 }
4240
4341 if (document.getElementById('fname').value == '$first') {
44 - output += payflowproGatewayErrorMsgJs + ' first name.\r\n';
 42+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' first name.\r\n';
4543 }
4644 if (document.getElementById('lname').value == '$last') {
47 - output += payflowproGatewayErrorMsgJs + ' last name.\r\n';
 45+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' last name.\r\n';
4846 }
4947 if (document.getElementById('street').value == '$street') {
50 - output += payflowproGatewayErrorMsgJs + ' street address.\r\n';
 48+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' street address.\r\n';
5149 }
5250 if (document.getElementById('city').value == '$city') {
53 - output += payflowproGatewayErrorMsgJs + ' city.\r\n';
 51+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' city.\r\n';
5452 }
5553 if (document.getElementById('zip').value == '$zip') {
56 - output += payflowproGatewayErrorMsgJs + ' zip code.\r\n';
 54+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' zip code.\r\n';
5755 }
5856
5957 var stateField = document.getElementById( 'state' );
6058 if( stateField.options[stateField.selectedIndex].value == '' ) {
61 - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsgState'] + '.\r\n';
 59+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-error-msg-state' ) + '.\r\n';
6260 }
6361
6462 // validate email address
@@ -65,7 +63,7 @@
6664 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
6765
6866 if( apos < 1 || dotpos-apos < 2 ) {
69 - output += payflowproGatewayErrorMsgEmail;
 67+ output += mw.msg( 'donate_interface-error-msg-email' );
7068 }
7169
7270 if( output ) {

Status & tagging log