r103036 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103035‎ | r103036 | r103037 >
Date:21:27, 14 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
fixing problems with amount validation
Modified paths:
  • /trunk/extensions/DonationInterface/donationinterface.php (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd-US.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step-CA.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3stepB-US.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd-US.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd.js (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_3step.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/donationinterface.php
@@ -611,6 +611,7 @@
612612 'donate_interface-error-msg-captcha',
613613 'donate_interface-error-msg-captcha-please',
614614 'donate_interface-error-msg-cookies',
 615+ 'donate_interface-smallamount-error',
615616 'donate_interface-donor-fname',
616617 'donate_interface-donor-lname',
617618 'donate_interface-donor-street',
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/webitects_2_3step.js
@@ -228,7 +228,7 @@
229229 wgCurrencyMinimums[currency_code] = 1;
230230 }
231231 if ( amount < wgCurrencyMinimums[currency_code] || error ) {
232 - alert( 'You must contribute at least $1'.replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 232+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
233233 error = true;
234234 }
235235 return !error;
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd.html
@@ -6,7 +6,6 @@
77 var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
88 var actionURL = "@action";
99 var scriptPath = "@script_path";
10 - var ajaxError = "%donate_interface-error-msg-general%";
1110 </script>
1211 <!--[if lt IE 7]>
1312 <script type="text/javascript">
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3stepB-US.html
@@ -6,7 +6,6 @@
77 var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
88 var actionURL = "@action";
99 var scriptPath = "@script_path";
10 - var ajaxError = "%donate_interface-error-msg-general%";
1110 </script>
1211 <!--[if lt IE 7]>
1312 <script type="text/javascript">
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd-US.html
@@ -6,7 +6,6 @@
77 var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
88 var actionURL = "@action";
99 var scriptPath = "@script_path";
10 - var ajaxError = "%donate_interface-error-msg-general%";
1110 </script>
1211 <!--[if lt IE 7]>
1312 <script type="text/javascript">
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step.html
@@ -6,7 +6,6 @@
77 var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
88 var actionURL = "@action";
99 var scriptPath = "@script_path";
10 - var ajaxError = "%donate_interface-error-msg-general%";
1110 </script>
1211 <!--[if lt IE 7]>
1312 <script type="text/javascript">
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step-CA.html
@@ -6,7 +6,6 @@
77 var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
88 var actionURL = "@action";
99 var scriptPath = "@script_path";
10 - var ajaxError = "%donate_interface-error-msg-general%";
1110 </script>
1211 <!--[if lt IE 7]>
1312 <script type="text/javascript">
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js
@@ -119,7 +119,7 @@
120120 wgCurrencyMinimums[currency_code] = 1;
121121 }
122122 if ( amount < wgCurrencyMinimums[currency_code] || error ) {
123 - alert( 'You must contribute at least $1'.replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 123+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
124124 error = true;
125125 }
126126 return !error;
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd.js
@@ -44,13 +44,13 @@
4545 }
4646
4747 $( "#paymentContinueBtn" ).live( "click", function() {
48 - if ( validate_personal( document.paypalcontribution ) ) {
 48+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
4949 displayCreditCardForm()
5050 }
5151 } );
5252 // Set the cards to progress to step 3
5353 $( ".cardradio" ).live( "click", function() {
54 - if ( validate_personal( document.paypalcontribution ) ) {
 54+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
5555 displayCreditCardForm()
5656 }
5757 else {
@@ -62,10 +62,14 @@
6363
6464 // init all of the header actions
6565 $( "#step2header" ).click( function() {
66 - showStep2();
 66+ if ( validateAmount() ) {
 67+ showStep2();
 68+ }
6769 } );
6870 $( "#step3header" ).click( function() {
69 - displayCreditCardForm();
 71+ if ( validateAmount() ) {
 72+ displayCreditCardForm();
 73+ }
7074 } );
7175
7276 // check to see if amount was passed from the previous step
@@ -140,7 +144,7 @@
141145 wgCurrencyMinimums[currency_code] = 1;
142146 }
143147 if ( amount < wgCurrencyMinimums[currency_code] || error ) {
144 - alert( 'You must contribute at least $1'.replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 148+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
145149 error = true;
146150 }
147151 return !error;
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects2nd-US.js
@@ -44,13 +44,13 @@
4545 }
4646
4747 $( "#paymentContinueBtn" ).live( "click", function() {
48 - if ( validate_personal( document.paypalcontribution ) ) {
 48+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
4949 displayCreditCardForm()
5050 }
5151 } );
5252 // Set the cards to progress to step 3
5353 $( ".cardradio" ).live( "click", function() {
54 - if ( validate_personal( document.paypalcontribution ) ) {
 54+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
5555 displayCreditCardForm()
5656 }
5757 else {
@@ -62,10 +62,14 @@
6363
6464 // init all of the header actions
6565 $( "#step2header" ).click( function() {
66 - showStep2();
 66+ if ( validateAmount() ) {
 67+ showStep2();
 68+ }
6769 } );
6870 $( "#step3header" ).click( function() {
69 - displayCreditCardForm();
 71+ if ( validateAmount() ) {
 72+ displayCreditCardForm();
 73+ }
7074 } );
7175
7276 // check to see if amount was passed from the previous step
@@ -144,7 +148,7 @@
145149 wgCurrencyMinimums[currency_code] = 1;
146150 }
147151 if ( amount < wgCurrencyMinimums[currency_code] || error ) {
148 - alert( 'You must contribute at least $1'.replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 152+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
149153 error = true;
150154 }
151155 return !error;
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -107,13 +107,13 @@
108108 }
109109 } );
110110 $( "#paymentContinueBtn" ).live( "click", function() {
111 - if ( validate_personal( document.paypalcontribution ) ) {
 111+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
112112 displayCreditCardForm()
113113 }
114114 } );
115115 // Set the cards to progress to step 3
116116 $( ".cardradio" ).live( "click", function() {
117 - if ( validate_personal( document.paypalcontribution ) ) {
 117+ if ( validate_personal( document.paypalcontribution ) && validateAmount() ) {
118118 displayCreditCardForm()
119119 } else {
120120 // show the continue button to indicate how to get to step 3 since they
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
@@ -64,7 +64,7 @@
6565 'type': 'GET',
6666 'success': function( data ) {
6767 if ( typeof data.error !== 'undefined' ) {
68 - alert( ajaxError );
 68+ alert( mw.msg( 'donate_interface-error-msg-general' ) );
6969 $( "#paymentContinue" ).show(); // Show continue button in 2nd section
7070 showStep2();
7171 } else if ( typeof data.result !== 'undefined' ) {
@@ -88,7 +88,7 @@
8989 }
9090 },
9191 'error': function( xhr ) {
92 - alert( ajaxError );
 92+ alert( mw.msg( 'donate_interface-error-msg-general' ) );
9393 showStep1();
9494 }
9595 } );
@@ -124,7 +124,7 @@
125125 wgCurrencyMinimums[currency_code] = 1;
126126 }
127127 if ( amount < wgCurrencyMinimums[currency_code] || error ) {
128 - alert( 'You must contribute at least $1'.replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 128+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
129129 error = true;
130130 }
131131 return !error;

Follow-up revisions

RevisionCommit summaryAuthorDate
r103052MFT r102807, r102942, r102953, r102960, r102961, r102943, r103009, r103023, r...awjrichards22:17, 14 November 2011

Status & tagging log