r102826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102825‎ | r102826 | r102827 >
Date:00:17, 12 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
adding more cookie checking, lots more form validation fixes. The ones that have English hard-coded messages are English-only forms.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremiumUS.php (modified) (history)
  • /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)
  • /trunk/extensions/DonationInterface/modules/validate_input.js (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/form_placeholders.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/form_placeholders.js
@@ -32,14 +32,24 @@
3333 if (document.getElementById('lname').value == mw.msg( 'donate_interface-donor-lname' )) {
3434 output += mw.msg( 'donate_interface-error-msg-js' ) + ' last name.\r\n';
3535 }
 36+
3637 var stateField = document.getElementById( 'state' );
37 - var stateFieldSelected = stateField.options[stateField.selectedIndex].value;
38 - if( stateFieldSelected == '' || stateFieldSelected == 'YY' ) {
39 - output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-state-province' ) + '.\r\n';
 38+ if ( stateField && stateField.type == 'select-one' ) { // state is a dropdown select
 39+ var selectedState = stateField.options[stateField.selectedIndex].value;
 40+ if ( selectedState == 'YY' || selectedState == '' ) {
 41+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-state-province' ) + '.\r\n';
 42+ }
4043 }
 44+
4145 var countryField = document.getElementById( 'country' );
42 - if( countryField.options[countryField.selectedIndex].value == '' ) {
43 - output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-error-msg-country' ) + '.\r\n';
 46+ if ( countryField && countryField.type == 'select-one' ) { // country is a dropdown select
 47+ if ( countryField.options[countryField.selectedIndex].value == '' ) {
 48+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-error-msg-country' ) + '.\r\n';
 49+ }
 50+ } else { // country is a hidden or text input
 51+ if ( countryField.value == '' ) {
 52+ output += mw.msg( 'donate_interface-error-msg-js' ) + ' ' + mw.msg( 'donate_interface-error-msg-country' ) + '.\r\n';
 53+ }
4454 }
4555
4656 // validate email address
@@ -47,9 +57,17 @@
4858 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
4959
5060 if( apos < 1 || dotpos-apos < 2 ) {
51 - output += mw.msg( 'donate_interface-error-msg-email' );
 61+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
5262 }
5363
 64+ // Make sure cookies are enabled
 65+ document.cookie = 'wmf_test=1;';
 66+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 67+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 68+ } else {
 69+ output += mw.msg( 'donate_interface-error-msg-cookies' ); // display error
 70+ }
 71+
5472 if( output ) {
5573 alert( output );
5674 return false;
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/html/globalcollect_test.html
@@ -47,9 +47,17 @@
4848 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
4949
5050 if( apos < 1 || dotpos-apos < 2 ) {
51 - output += mw.msg( 'donate_interface-error-msg-email' );
 51+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
5252 }
5353
 54+ // Make sure cookies are enabled
 55+ document.cookie = 'wmf_test=1;';
 56+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 57+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 58+ } else {
 59+ output += mw.msg( 'donate_interface-error-msg-cookies' ); // display error
 60+ }
 61+
5462 if( output ) {
5563 alert( output );
5664 return false;
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/js/globalcollect_test_2.js
@@ -63,9 +63,17 @@
6464 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
6565
6666 if( apos < 1 || dotpos-apos < 2 ) {
67 - output += mw.msg( 'donate_interface-error-msg-email' );
 67+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
6868 }
6969
 70+ // Make sure cookies are enabled
 71+ document.cookie = 'wmf_test=1;';
 72+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 73+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 74+ } else {
 75+ output += mw.msg( 'donate_interface-error-msg-cookies' ); // display error
 76+ }
 77+
7078 if( output ) {
7179 alert( output );
7280 return false;
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php
@@ -110,9 +110,17 @@
111111 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
112112
113113 if( apos < 1 || dotpos-apos < 2 ) {
114 - output += payflowproGatewayErrorMsgEmail;
 114+ output += payflowproGatewayErrorMsgEmail + '.\\r\\n';
115115 }
116116 }
 117+
 118+ // Make sure cookies are enabled
 119+ document.cookie = 'wmf_test=1;';
 120+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 121+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 122+ } else {
 123+ output += 'Please enable cookies in your browser.'; // display error
 124+ }
117125
118126 if( output ) {
119127 alert( output );
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php
@@ -93,8 +93,16 @@
9494 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
9595
9696 if( apos < 1 || dotpos-apos < 2 ) {
97 - output += mw.msg( 'donate_interface-error-msg-email' );
 97+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\\r\\n';
9898 }
 99+
 100+ // Make sure cookies are enabled
 101+ document.cookie = 'wmf_test=1;';
 102+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 103+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 104+ } else {
 105+ output += mw.msg( 'donate_interface-error-msg-cookies' ); // display error
 106+ }
99107
100108 if( output ) {
101109 alert( output );
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremiumUS.php
@@ -99,8 +99,16 @@
100100 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
101101
102102 if( apos < 1 || dotpos-apos < 2 ) {
103 - output += payflowproGatewayErrorMsgEmail;
 103+ output += payflowproGatewayErrorMsgEmail + '.\\r\\n';
104104 }
 105+
 106+ // Make sure cookies are enabled
 107+ document.cookie = 'wmf_test=1;';
 108+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 109+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 110+ } else {
 111+ output += 'Please enable cookies in your browser.'; // display error
 112+ }
105113
106114 if( output ) {
107115 alert( output );
Index: trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php
@@ -81,9 +81,17 @@
8282 var dotpos = document.payment.emailAdd.value.lastIndexOf(".");
8383
8484 if( apos < 1 || dotpos-apos < 2 ) {
85 - output += payflowproGatewayErrorMsgEmail;
 85+ output += payflowproGatewayErrorMsgEmail + '.\\r\\n';
8686 }
8787 }
 88+
 89+ // Make sure cookies are enabled
 90+ document.cookie = 'wmf_test=1;';
 91+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 92+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 93+ } else {
 94+ output += 'Please enable cookies in your browser.'; // display error
 95+ }
8896
8997 if( output ) {
9098 alert( output );
Index: trunk/extensions/DonationInterface/modules/validate_input.js
@@ -82,11 +82,13 @@
8383 }
8484
8585 // validate email address
86 - var apos = form.emailAdd.value.indexOf("@");
87 - var dotpos = form.emailAdd.value.lastIndexOf(".");
88 -
89 - if( apos < 1 || dotpos-apos < 2 ) {
90 - output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
 86+ if( document.getElementById( 'emailAdd' ).value != '' && document.getElementById( 'emailAdd' ).value != mw.msg( 'donate_interface-donor-emailAdd' ) ) {
 87+ var apos = form.emailAdd.value.indexOf("@");
 88+ var dotpos = form.emailAdd.value.lastIndexOf(".");
 89+
 90+ if( apos < 1 || dotpos-apos < 2 ) {
 91+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
 92+ }
9193 }
9294
9395 // Make sure cookies are enabled
@@ -146,11 +148,13 @@
147149 }
148150
149151 // validate email address
150 - var apos = form.emailAdd.value.indexOf("@");
151 - var dotpos = form.emailAdd.value.lastIndexOf(".");
152 -
153 - if( apos < 1 || dotpos-apos < 2 ) {
154 - output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
 152+ if( document.getElementById( 'emailAdd' ).value != '' && document.getElementById( 'emailAdd' ).value != mw.msg( 'donate_interface-donor-emailAdd' ) ) {
 153+ var apos = form.emailAdd.value.indexOf("@");
 154+ var dotpos = form.emailAdd.value.lastIndexOf(".");
 155+
 156+ if( apos < 1 || dotpos-apos < 2 ) {
 157+ output += mw.msg( 'donate_interface-error-msg-email' ) + '.\r\n';
 158+ }
155159 }
156160
157161 // Make sure cookies are enabled

Follow-up revisions

RevisionCommit summaryAuthorDate
r102842MFT r102576, r102577, r102579, r102581, r102804, r102805, r102812, r102819, r...awjrichards02:20, 12 November 2011
r102929Re-attempting MFT r102576, r102577, r102578, r102579, r102581, r102689, r1027...khorn00:50, 14 November 2011

Status & tagging log