r103624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103623‎ | r103624 | r103625 >
Date:23:04, 18 November 2011
Author:khorn
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/donationinterface.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/Form.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/css/lightbox1.css (deleted) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/html/lightbox1.html (deleted) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/js/lightbox1.js (deleted) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/css/lightbox1.css (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/js/lightbox1.js (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/donationinterface.php
@@ -585,8 +585,11 @@
586586
587587 $wgResourceModules[ 'ext.donationInterface.errorMessages' ] = array(
588588 'messages' => array(
 589+ 'donate_interface-noscript-msg',
 590+ 'donate_interface-noscript-redirect-msg',
589591 'donate_interface-error-msg-general',
590592 'donate_interface-error-msg-js',
 593+ 'donate_interface-error-msg-validation',
591594 'donate_interface-error-msg-invalid-amount',
592595 'donate_interface-error-msg-email',
593596 'donate_interface-error-msg-card-num',
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html
@@ -9,69 +9,70 @@
1010 var scriptPath = "@script_path";
1111 </script>
1212
13 - <div class="ltr">
14 - <div id="appeal">
15 - <div id="appeal-content">
16 - <div class="call-r">
17 - <div id="donate">
18 - <h3 id="amount-heading">Donate</h3>
19 -
20 - <form method="post" name="paypalcontribution">
21 - <div style="display: block;" id="amount-content">
22 - <div id="amtErrorMessages" class="small"></div>
23 - <table id="amount-table">
24 - <tr>
25 - <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td>
26 - <td><label><input type="radio" name="amountRadio" value="10" /> $10</label></td>
27 - <td><label><input type="radio" name="amountRadio" value="20" /> $20</label></td>
28 - <td><label><input type="radio" name="amountRadio" value="35" /> $35</label></td>
29 - </tr>
30 - <tr>
31 - <td><label><input type="radio" name="amountRadio" value="50" /> $50</label></td>
32 - <td><label><input type="radio" name="amountRadio" value="100" /> $100</label></td>
33 - <td><label><input type="radio" name="amountRadio" value="250" /> $250</label></td>
34 - <td><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> <label>$<input type="text" name="amountGiven" size="4" id="other-amount" placeholder="Other" onfocus="this.form.input_amount_other.checked=true;"/></label></td>
35 - </tr>
36 - </table>
37 -
38 - <p class="donate-options">
39 - <input class="btn" id="cc" value="Donate by Credit Card" type="button">
40 - <br><input class="btn" id="pp" value="Donate via PayPal" type="button"><span id="loading"></span>
41 - </p>
42 - </div>
43 -
44 - </form>
45 - </div>
46 -
47 - <div id="callout-content">
48 - <hr>
49 - <h3>Where your donation goes</h3>
50 - <p><strong>Technology:</strong> Servers, bandwidth,
51 -maintenance, development. Wikipedia is the #5 website in the world and
52 -it runs on a fraction of what other top websites spend.</p>
53 - <p><strong>People:</strong> The other top 10 website
54 -have thousands of employees. We have fewer than 100, making your
55 -donation a great investment in a highly-efficient not-for-profit
56 -organization.</p>
57 - </div>
58 - </div>
59 -
60 - <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2>
61 - <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div>
62 - </div>
63 - </div>
64 -
65 - <hr>
66 -
67 - <p>We do not store your credit card information, and your personal data is subject to our <a target="_blank" href="http://wikimediafoundation.org/wiki/Donor_policy"> donor privacy policy</a>.</p>
68 - <p><a href="http://wikipedia.webitects.com/wiki/Ways_to_Give/en">More information or other ways to give</a><br><a href="http://wikipedia.webitects.com/wiki/FAQ/en">Answers to frequently asked questions</a></p>
69 - </div>
 13+<div class="ltr">
 14+ <div id="appeal">
 15+ <div id="appeal-content">
 16+ <div class="call-r">
 17+ <div id="donate">
 18+ <noscript>
 19+ <div id="noscript">
 20+ <p id="noscript-msg">%donate_interface-noscript-msg%</p>
 21+ <p id="noscript-redirect-msg">%donate_interface-noscript-redirect-msg%</p>
 22+ <p id="noscript-redirect-link"><a href="http://wikimediafoundation.org/wiki/DonateNonJS/en">http://wikimediafoundation.org/wiki/DonateNonJS/en</a></p>
 23+ </div>
 24+ </noscript>
 25+ <div id="topError" class="creditcard-error-msg"></div>
 26+ <h3 id="amount-heading">%donate_interface-amount-legend%</h3>
 27+ <form method="post" name="paypalcontribution">
 28+ <div style="display: block;" id="amount-content">
 29+ <div id="amtErrorMessages" class="small"></div>
 30+ <table id="amount-table">
 31+ <tr>
 32+ <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td>
 33+ <td><label><input type="radio" name="amountRadio" value="10" /> $10</label></td>
 34+ <td><label><input type="radio" name="amountRadio" value="20" /> $20</label></td>
 35+ <td><label><input type="radio" name="amountRadio" value="35" /> $35</label></td>
 36+ </tr>
 37+ <tr>
 38+ <td><label><input type="radio" name="amountRadio" value="50" /> $50</label></td>
 39+ <td><label><input type="radio" name="amountRadio" value="100" /> $100</label></td>
 40+ <td><label><input type="radio" name="amountRadio" value="250" /> $250</label></td>
 41+ <td><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> <label>$<input type="text" name="amountGiven" size="4" id="other-amount" placeholder="Other" onfocus="this.form.input_amount_other.checked=true;"/></label></td>
 42+ </tr>
 43+ </table>
 44+
 45+ <p class="donate-options">
 46+ <input class="btn" id="cc" value="%donate_interface-ccdc-button%" type="button"/><br/>
 47+ <input class="btn" id="pp" value="%donate_interface-paypal-button%" type="button"/>
 48+ </p>
 49+ </div>
 50+ </form>
 51+ </div>
 52+ <hr/>
 53+ <div id="callout-content">
 54+ <p id="informationsharing">%donate_interface-informationsharing|url%</p>
 55+ <div id="secure-logo">@verisign_logo</div>
 56+ <ul id="moreinfolinks">
 57+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Monthly_donations&language=@language&uselang=@language&country=@country">%donate_interface-monthly-donation%</a></li>
 58+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Ways_to_Give&language=@language&uselang=@language&country=@country">%donate_interface-otherways-short%</a></li>
 59+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=FAQ&language=@language&uselang=@language&country=@country">%donate_interface-faqs%</a></li>
 60+ <li><a href="http://wikimediafoundation.org/wiki/Special:LandingCheck?landing_page=Tax_Deductibility&language=@language&uselang=@language&country=@country">%donate_interface-tax-info%</a></li>
 61+ </ul>
 62+ </div>
 63+ </div>
 64+ <!-- The appeal -->
 65+ <h2 id="appeal-head"><span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2>
 66+ <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div>
 67+ </div>
 68+ </div>
 69+
 70+</div>
7071
7172 <div id="dialog">
7273 <div id="steps">
7374 <form id="donationForm" name="donationForm" action="" method="post">
7475 <fieldset class="step">
75 - <legend>Personal Information</legend>
 76+ <legend>%donate_interface-cc-form-header-personal%</legend>
7677 <input type="hidden" name="gateway" value="payflowpro" id="gateway" />
7778 <input type="hidden" name="returnto" value="Thank_You/en" />
7879 <input type="hidden" value="@action" name="action" />
@@ -140,11 +141,11 @@
141142 </tr>
142143 </table>
143144 </div>
144 - <a href="#" class="continue-button">Continue</a>
 145+ <a href="#" id="personal-continue" class="continue-button">Continue</a>
145146 </div>
146147 </fieldset>
147148 <fieldset class="step">
148 - <legend>Payment</legend>
 149+ <legend>%donate_interface-cc-form-header-payment%</legend>
149150 <div class="step-content">
150151 <div class="stuff">
151152 <div id="card-errors"></div>
@@ -205,13 +206,15 @@
206207 <label for="email">Security Code</label>
207208 </td>
208209 <td>
209 - <input name="cvv" size="30" value="@cvv" type="text" maxlength="100" class="required" id="cvv" style="width: 50px;" />
 210+ <input name="cvv" size="30" value="@cvv" type="text" maxlength="100" class="required" id="cvv" style="width: 50px;" />&#160;
 211+ <a href="#" onclick="PopupCVV(); return false;" id="cvv-link">What is this?</a>
210212 </td>
211213 </tr>
212214 </table>
213215 </div>
214216 <a href="#" class="back-button" id="goback">Back</a>
215 - <a href="#" class="continue-button" id="submitcreditcard">Continue</a>
 217+ <a href="#" id="cc-continue" class="continue-button">Continue</a>
 218+ <div id="spinner"><img src="@script_path/extensions/DonationInterface/gateway_forms/includes/loading-white.gif"/></div>
216219 </div>
217220 </fieldset>
218221 </form>
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/css/lightbox1.css
@@ -67,9 +67,6 @@
6868 .donate-options {
6969 text-align: center;
7070 }
71 -.donate-options input {
72 - width: 15em;
73 -}
7471
7572 input.button, select#input_currency_code {
7673 font-size: 95%;
@@ -138,6 +135,8 @@
139136 .call-r {
140137 float: right;
141138 margin: 0.2em 0 1em 1em;
 139+ background-color: #CCE7CD;
 140+ border: 1px solid #5EAC58;
142141 }
143142 #loading {
144143 font-size: 12px;
@@ -174,8 +173,9 @@
175174 font-size: 0.8em;
176175 }
177176 input.btn {
178 - font-size: 15px;
179 - margin-bottom: 3px;
 177+ font-size: 14px;
 178+ margin-bottom: 4px;
 179+ width: 18em;
180180 }
181181 #dialog{
182182 overflow: hidden;
@@ -286,6 +286,15 @@
287287 right: 25px;
288288 margin: 0 !important;
289289 }
 290+#spinner {
 291+ position: absolute;
 292+ width: 16px;
 293+ height: 16px;
 294+ bottom: 37px;
 295+ right: 133px;
 296+ z-index: 2000;
 297+ display: none;
 298+}
290299 #steps #card-errors {
291300 font-size: 13px;
292301 line-height: 15px;
@@ -293,4 +302,18 @@
294303 }
295304 #steps #card-errors .error-msg {
296305 margin-bottom: 1em;
297 -}
\ No newline at end of file
 306+}
 307+#informationsharing {
 308+ font-size: 11px;
 309+ line-height: 13px;
 310+}
 311+#secure-logo {
 312+ float: right;
 313+}
 314+#moreinfolinks {
 315+ font-size: 12px;
 316+}
 317+#cvv-link {
 318+ color: #2779AA;
 319+ font-size: 0.8em;
 320+}
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms/js/lightbox1.js
@@ -25,27 +25,20 @@
2626 paymentErrorString = temp.join( "<br />" );
2727
2828 // show the errors
29 - var prevError = false;
3029 if ( amountErrorString != "" ) {
31 - $( "#amtErrorMessages" ).html( amountErrorString );
32 - prevError = true;
 30+ $( "#topError" ).html( amountErrorString );
 31+ } else if ( billingErrorString != "" ) {
 32+ $( "#topError" ).html( billingErrorString );
 33+ } else if ( paymentErrorString != "" ) {
 34+ $( "#topError" ).html( paymentErrorString );
3335 }
34 - if ( billingErrorString != "" ) {
35 - $( "#billingErrorMessages" ).html( billingErrorString );
36 - if ( !prevError ) {
37 - prevError = true;
38 - }
39 - }
40 - if ( paymentErrorString != "" ) {
41 - $( "#paymentErrorMessages" ).html( paymentErrorString );
42 - }
4336
4437 $( '#dialog' ).dialog( {
4538 width: 600,
4639 resizable: false,
4740 autoOpen: false,
4841 modal: true,
49 - title: 'Donate by Credit Card'
 42+ title: mw.msg( 'donate_interface-ccdc-button' )
5043 } );
5144
5245 // If the form is being reloaded, restore the amount
@@ -65,22 +58,52 @@
6659 }
6760
6861 $( '#cc' ).click( function() {
69 - if ( validateAmount( document.paypalcontribution ) ) {
 62+
 63+ // Make sure cookies are enabled
 64+ document.cookie = 'wmf_test=1;';
 65+ if ( document.cookie.indexOf( 'wmf_test=1' ) != -1 ) {
 66+ document.cookie = 'wmf_test=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; // unset the cookie
 67+ } else {
 68+ alert( mw.msg( 'donate_interface-error-msg-cookies' ) ); // display error
 69+ return false;
 70+ }
 71+
 72+ if ( validateAmount() ) {
7073 $( '#dialog' ).dialog( 'open' );
 74+ $( "#spinner" ).hide(); // just in case
7175 }
7276 });
7377 $( '#pp' ).click( function() {
74 - if ( validateAmount( document.paypalcontribution ) ) {
 78+ if ( validateAmount() ) {
 79+ //$( 'input#pp' ).attr( 'disabled', 'disabled' );
7580 $( "input[name='gateway']" ).val( 'paypal' );
76 - document.paypalcontribution.action = "https://wikimediafoundation.org/wiki/Special:ContributionTracking/en";
77 - $( '#loading' ).html( "<img src='../images/loading.gif' /> Redirecting to PayPal..." );
 81+ $( 'input[name="PaypalRedirect"]' ).val( "1" );
 82+ document.paypalcontribution.action = actionURL;
7883 document.paypalcontribution.submit();
7984 }
8085 });
8186
82 - /* Set selected amount to amount */
83 - $( "input[name='amountRadio']" ).click( function() { setAmount( $( this ) ); } );
84 - $( "#other-amount" ).change( function() { setAmount( $( this ) ); } );
 87+ // Set amount when a radio button is clicked
 88+ $( 'input[name="amountRadio"]' ).click( function() {
 89+ if ( !isNaN( $( this ).val() ) ) {
 90+ setAmount( $( this ) );
 91+ }
 92+ if ( $( this ).val() == 'other' ) {
 93+ setAmount( $( '#other-amount' ) );
 94+ }
 95+ } );
 96+ // Change the amount when "other" is focused
 97+ $( "#other-amount" ).focus( function() {
 98+ $( '#input_amount_other' ).attr( 'checked', true );
 99+ setAmount( $( '#other-amount' ) );
 100+ } );
 101+ // Reset the amount field when "other" is changed
 102+ $( "#other-amount" ).keyup( function() {
 103+ if ( $( '#input_amount_other' ).is( ':checked' ) ) {
 104+ setAmount( $( this ) );
 105+ }
 106+ } );
 107+
85108 function setAmount(e) { $("input[name='amount']").val( e.val() ); }
86109
87110 /* number of fieldsets */
@@ -94,10 +117,7 @@
95118 Set the final sum as the total width of the steps element.
96119 */
97120 var stepsWidth = 0;
98 - var widths = new Array();
99121 $( '#steps .step' ).each( function(i) {
100 - var $step = $( this );
101 - widths[i] = stepsWidth;
102122 stepsWidth += 600; // Hard-coding as $.width() is not working for some reason
103123 } );
104124 $( '#steps' ).width( stepsWidth );
@@ -107,37 +127,33 @@
108128
109129 /* make continue buttons */
110130 $( 'a.continue-button' ).button();
111 - $( 'a.continue-button' ).click( function(e) {
112 - var $this = $( this );
113 - current = $( this ).parent().parent().index() + 1;
114 - if ( current == fieldsetCount ) {
115 - finalSubmit();
116 - return false;
117 - }
118 - if ( validateStep( current ) === 1 ) {
119 - current = current + 1;
120 - $( '#steps' ).stop().animate( { marginLeft: '-' + widths[current - 1] + 'px' }, 500,
 131+ $( 'a#personal-continue' ).click( function(e) {
 132+ if ( validatePersonal() ) {
 133+ // Advance to the next step
 134+ $( '#steps' ).stop().animate( { marginLeft: '-600px' }, 500,
121135 function() {
122 - $( '#donationForm' ).children( ':nth-child(' + parseInt(current) + ')' ).find( ':input:first' ).focus();
 136+ $( '#donationForm' ).children( ':nth-child(1)' ).find( ':input:first' ).focus();
123137 }
124138 );
125 - } else {
126 - $this.blur();
127139 }
128 -
129 - e.preventDefault();
 140+ $( this ).blur();
 141+ e.preventDefault();
 142+ return false;
130143 });
 144+ $( 'a#cc-continue' ).click( function(e) {
 145+ finalSubmit();
 146+ e.preventDefault();
 147+ return false;
 148+ });
131149
132150 /* Make back button */
133151 $( 'a.back-button' ).button();
134152 $( 'a.back-button' ).click( function(e) {
135 - var $this = $( this );
136153 /* Set current to 1 less than previous step */
137154 current = $( this ).parent().parent().index();
138 -
139 - $( '#steps' ).stop().animate( { marginLeft: '+' + widths[current - 1] + 'px' }, 500 );
140 -
141 - e.preventDefault();
 155+ $( '#steps' ).stop().animate( { marginLeft: '0px' }, 500 );
 156+ $( this ).blur();
 157+ e.preventDefault();
142158 });
143159
144160 /* Hitting tab on the last input of each fieldset makes the form slide to the next step. */
@@ -152,37 +168,42 @@
153169 });
154170 });
155171
156 - /*
157 - Validates errors on all the fieldsets.
158 - Records if the form has errors in $( '#donationForm' ).data().
159 - */
160 - function validateSteps() {
161 - var formErrors = false;
162 - for( var i = 1; i < fieldsetCount; ++i ) {
163 - var error = validateStep(i);
164 - if ( error == -1 ) formErrors = true;
165 - }
166 - $( '#donationForm' ).data( 'errors', formErrors );
167 - }
168 -
169172 function finalSubmit() {
170 -
171 - // Reset the error display
172 - $( '#card-errors' ).empty();
 173+ var step = 2;
 174+ var errors = false;
173175
174 - var formErrors = false;
175 - for( var i = 1; i <= fieldsetCount; ++i ) {
176 - var error = validateStep(i);
177 - if ( error == -1 ) formErrors = true;
 176+ $( '#donationForm' ).children( ':nth-child(' + step + ')' ).find( ':input:not(button).required' ).each( function() {
 177+ var $this = $( this );
 178+ var valueLength = $.trim( $this.val() ).length;
 179+ if ( valueLength == 0 ) {
 180+ errors = true;
 181+ $this.css( 'background-color', '#FFEAEC' );
 182+ } else {
 183+ $this.css( 'background-color', '#FFFFFF' );
 184+ }
 185+ });
 186+
 187+ // Validate credit card number
 188+ cardNumber = $( '#card_num' ).val();
 189+ cardNumber = $.trim( cardNumber );
 190+ if ( cardNumber != '' ) {
 191+ cardNumber = cardNumber.replace(/ /g,''); // remove any spaces
 192+ // Make sure it contains only digits
 193+ var ccCheckRegExp = /[^\d]/;
 194+ if ( ccCheckRegExp.test(cardNumber) ) {
 195+ errors = true;
 196+ $( '#card_num' ).css( 'background-color', '#FFEAEC' );
 197+ } else {
 198+ $( '#card_num' ).css( 'background-color', '#FFFFFF' );
 199+ }
178200 }
179 - $( '#donationForm' ).data( 'errors', formErrors );
180201
181 - if ( $( '#donationForm' ).data( 'errors' ) ) {
182 - alert( 'Please correct the errors in the form.' );
 202+ if ( errors ) {
 203+ //alert( mw.msg( 'donate_interface-error-msg-validation' ) );
183204 return false;
184205 } else {
185206 /* Set country to US */
186 - $( "input[name='country']" ).val('US' );
 207+ $( "input[name='country']" ).val( 'US' );
187208
188209 /* Set expiration date */
189210 $( "input[name='expiration']" ).val(
@@ -190,98 +211,88 @@
191212 )
192213
193214 /* Submit the form */
194 - var sendData = {
195 - 'action': 'donate',
196 - 'gateway': 'payflowpro',
197 - 'currency_code': 'USD',
198 - 'amount': $( "input[name='amount']" ).val(),
199 - 'fname': $( "input[name='fname']" ).val(),
200 - 'lname': $( "input[name='lname']" ).val(),
201 - 'street': $( "input[name='street']" ).val(),
202 - 'city': $( "input[name='city']" ).val(),
203 - 'state': $( 'select#state option:selected' ).val(),
204 - 'zip': $( "input[name='zip']" ).val(),
205 - 'emailAdd': $( "input[name='emailAdd']" ).val(),
206 - 'country': 'US',
207 - 'payment_method': 'cc',
208 - 'language': 'en',
209 -
210 - 'expiration': $( "input[name='expiration']" ).val(),
211 - 'card_num': $( "input[name='card_num']" ).val(),
212 - 'cvv': $( "input[name='cvv']" ).val(),
213 - 'card_type': '',
214 -
215 - 'format': 'json'
216 - };
217 -
218 - $.ajax( {
219 - 'url': mw.util.wikiScript( 'api' ),
220 - 'data': sendData,
221 - 'dataType': 'json',
222 - 'type': 'POST',
223 - 'success': function( data ) {
224 - console.debug( data );
225 - if ( data.result.errors ) {
226 - var errors = new Array();
227 - $.each( data.result.errors, function( index, value ) {
228 - $( '#card-errors' ).append( '<div class="error-msg">'+value+'</div>' );
229 - } );
230 - } else {
231 - if ( data.result.returnurl ) {
232 - window.location = data.result.returnurl;
233 - }
234 - }
235 - }
236 - } );
237 - //document.donationForm.action = $( "input[name='action']" ).val();
238 - //document.donationForm.submit();
 215+ document.donationForm.action = $( "input[name='action']" ).val();
 216+ $( "#spinner" ).show();
 217+ document.donationForm.submit();
239218 }
240219 }
241 -
242 - /*
243 - validates one fieldset
244 - returns -1 if errors found, or 1 if not
245 - */
246 - function validateStep( step ) {
247 - var error = 1;
248 - $( '#donationForm' ).children( ':nth-child(' + parseInt(step) + ')' ).find( ':input:not(button).required' ).each( function() {
 220+
 221+ function validatePersonal() {
 222+ var step = 1;
 223+ var errors = false;
 224+
 225+ $( '#donationForm' ).children( ':nth-child(' + step + ')' ).find( ':input:not(button).required' ).each( function() {
249226 var $this = $( this );
250 - var valueLength = jQuery.trim( $this.val() ).length;
251 -
252 - if ( valueLength == '' ) {
253 - error = -1;
254 - $this.css( 'background-color', '#FFEDEF' );
 227+ var valueLength = $.trim( $this.val() ).length;
 228+ if ( valueLength == 0 ) {
 229+ errors = true;
 230+ $this.css( 'background-color', '#FFEAEC' );
255231 } else {
256232 $this.css( 'background-color', '#FFFFFF' );
257233 }
258234 });
 235+
 236+ // Validate email address
 237+ email = $( '#email' ).val();
 238+ email = $.trim( email );
 239+ if( email != '' ) {
 240+ var apos = email.indexOf("@");
 241+ var dotpos = email.lastIndexOf(".");
 242+ if( apos < 1 || dotpos-apos < 2 ) {
 243+ errors = true;
 244+ $( '#email' ).css( 'background-color', '#FFEAEC' );
 245+ } else {
 246+ $( '#email' ).css( 'background-color', '#FFFFFF' );
 247+ }
 248+ }
 249+
 250+ if ( errors ) {
 251+ return false;
 252+ } else {
 253+ return true;
 254+ }
 255+ }
259256
260 - return error;
261 - }
262 -
263 - function validateAmount(){
264 - var error = true;
 257+ /**
 258+ * Validate the donation amount to make sure it is formatted correctly and at least a minimum amount.
 259+ */
 260+ function validateAmount() {
 261+ var errors = false;
265262 var amount = $( "input[name='amount']" ).val(); // get the amount
266 - var otherAmount = amount // create a working copy
267 - otherAmount = otherAmount.replace( /[,.](\d)$/, '\:$10' );
268 - otherAmount = otherAmount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
269 - otherAmount = otherAmount.replace( /[,.]/g, '' );
270 - otherAmount = otherAmount.replace( /:/, '.' );
271 - amount = otherAmount; // reset amount to working copy amount
272 - $( "input[name='amount']" ).val( amount ); // set the new amount back into the form
273263
274 - // Check amount is a real number, sets error as true (good) if no issues
275 - error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
 264+ // Normalize weird amount formats.
 265+ // Don't mess with these unless you know what you're doing.
 266+ amount = amount.replace( /[,.](\d)$/, '\:$10' );
 267+ amount = amount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
 268+ amount = amount.replace( /[,.]/g, '' );
 269+ amount = amount.replace( /:/, '.' );
 270+ $( 'input[name="amount"]' ).val( amount ); // set the new amount back into the form
 271+
 272+ // Check amount is a real number greater than 0
 273+ errors = ( amount == null || isNaN( amount ) || parseFloat( amount ) <= 0 );
 274+
 275+ // Find out the currency code
 276+ if ( $( 'input[name="currency_code"]' ).val() == '' ) {
 277+ var currency_code = 'USD'; // hard-code since we're only running this in the US
 278+ $( "input[name='currency_code']" ).val( currency_code );
 279+ } else {
 280+ var currency_code = $( 'input[name="currency_code"]' ).val();
 281+ }
 282+
276283 // Check amount is at least the minimum
277 - var currency = 'USD'; // hard-coded for these forms and tests
278 - $( "input[name='currency_code']" ).val( currency );
279 - if ( typeof( wgCurrencyMinimums[currency] ) == 'undefined' ) {
280 - wgCurrencyMinimums[currency] = 1;
 284+ if ( typeof( wgCurrencyMinimums[currency_code] ) == 'undefined' ) {
 285+ wgCurrencyMinimums[currency_code] = 1;
281286 }
282 - if ( amount < wgCurrencyMinimums[currency] || error ) {
283 - alert( 'You must contribute at least $1'.replace('$1', wgCurrencyMinimums[currency] + ' ' + currency ) );
284 - error = true;
 287+ if ( amount < wgCurrencyMinimums[currency_code] || errors ) {
 288+ errors = true;
 289+ alert( mw.msg( 'donate_interface-smallamount-error' ).replace( '$1', wgCurrencyMinimums[currency_code] + ' ' + currency_code ) );
 290+ $( '#other-amount' ).val( '' );
 291+ $( '#other-amount' ).focus();
285292 }
286 - return !error;
 293+ if ( errors ) {
 294+ return false;
 295+ } else {
 296+ return true;
 297+ }
287298 };
288299 });
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/forms
___________________________________________________________________
Modified: svn:mergeinfo
289300 Merged /trunk/extensions/DonationInterface/payflowpro_gateway/forms:r103434,103537,103541,103548
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway
___________________________________________________________________
Modified: svn:mergeinfo
290301 Merged /trunk/extensions/DonationInterface/payflowpro_gateway:r103434,103537,103541,103548
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/html/lightbox1.html
@@ -1,245 +0,0 @@
2 -<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins-1.17/vector/csshover.min.htc")}</style><![endif]-->
3 -<script type="text/javascript">
4 -mw.loader.load('pfp.form.rapidhtml.lightbox.js');
5 -mw.loader.load('pfp.form.rapidhtml.lightbox.css');
6 -</script>
7 -
8 - <div class="ltr">
9 - <div id="appeal">
10 - <div id="appeal-content">
11 - <div class="call-r">
12 - <div id="donate">
13 - <h3 id="amount-heading">Donate</h3>
14 -
15 - <form method="post" name="paypalcontribution">
16 - <div style="display: block;" id="amount-content">
17 -
18 - <table id="amount-table">
19 - <tr>
20 - <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td>
21 - <td><label><input type="radio" name="amountRadio" value="10" /> $10</label></td>
22 - <td><label><input type="radio" name="amountRadio" value="20" /> $20</label></td>
23 - <td><label><input type="radio" name="amountRadio" value="35" /> $35</label></td>
24 - </tr>
25 - <tr>
26 - <td><label><input type="radio" name="amountRadio" value="50" /> $50</label></td>
27 - <td><label><input type="radio" name="amountRadio" value="100" /> $100</label></td>
28 - <td><label><input type="radio" name="amountRadio" value="250" /> $250</label></td>
29 - <td><input type="radio" name="amountRadio" id="input_amount_other" value="other" /> <label>$<input type="text" name="amountGiven" size="4" id="other-amount" placeholder="Other" onfocus="this.form.input_amount_other.checked=true;"/></label></td>
30 - </tr>
31 - </table>
32 -
33 - <p class="donate-options">
34 - <input class="btn" id="cc" value="Donate by Credit Card" type="button">
35 - <br><input class="btn" id="pp" value="Donate via PayPal" type="button"><span id="loading"></span>
36 - </p>
37 - </div>
38 -
39 - </form>
40 - </div>
41 -
42 - <div id="callout-content">
43 - <hr>
44 - <h3>Where your donation goes</h3>
45 - <p><strong>Technology:</strong> Servers, bandwidth,
46 -maintenance, development. Wikipedia is the #5 website in the world and
47 -it runs on a fraction of what other top websites spend.</p>
48 - <p><strong>People:</strong> The other top 10 website
49 -have thousands of employees. We have fewer than 100, making your
50 -donation a great investment in a highly-efficient not-for-profit
51 -organization.</p>
52 - </div>
53 - </div>
54 -
55 - <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2>
56 - <div id="appeal-body" class="plainlinks">
57 - <p>I feel like I'm living the first line of my obituary.</p>
58 - <p>I don't think there will be anything else that I do in my
59 - life as important as what I do now for Wikipedia. We're not just
60 -building an encyclopedia, we're working to make people free. When we
61 -have access to free knowledge, we are better people. We understand the
62 -world is bigger than us, and we become infected with tolerance and
63 -understanding.</p>
64 - <p>Wikipedia is the 5th largest website in the world. I work
65 - at the small non-profit that keeps it on the web. We don't run ads
66 -because doing so would sacrifice our independence. The site is not and
67 -should never be a propaganda tool.</p>
68 - <p>Our work is possible because of donations from our
69 -readers. Will you help protect Wikipedia by donating $5, $10, $20 or
70 -whatever you can afford?</p>
71 - <p>I work at the Wikimedia Foundation because everything in
72 -my soul tells me it's the right thing to do. I've worked at huge tech
73 -companies, doing some job to build some crappy thing that's designed to
74 -steal money from some kid who doesn't know it. I would come home from
75 -work crushed.</p>
76 - <p>You might not know this, but the Wikimedia Foundation
77 -operates with a very small staff. Most other top-ten sites have tens of
78 -thousands of people and massive budgets. But they produce a fraction of
79 -what we pull off with sticks and wire.</p>
80 - <p>When you give to Wikipedia, you're supporting free
81 -knowledge around the world. You're not only leaving a legacy for your
82 -children and for their children, you're elevating people around the
83 -world who have access to this treasure. You're assuring that one day
84 -everyone else will too.</p>
85 - <p>Thank you,</p>
86 - <p><strong>Brandon Harris</strong><br></p>
87 - <p>Programmer, Wikimedia Foundation</p>
88 - </div>
89 - </div>
90 - </div>
91 -
92 - <hr>
93 -
94 - <p>We do not store your credit card information, and your personal data is subject to our <a target="_blank" href="http://wikimediafoundation.org/wiki/Donor_policy"> donor privacy policy</a>.</p>
95 - <p><a href="http://wikipedia.webitects.com/wiki/Ways_to_Give/en">More information or other ways to give</a><br><a href="http://wikipedia.webitects.com/wiki/FAQ/en">Answers to frequently asked questions</a></p>
96 - </div>
97 -
98 -<div id="dialog">
99 - <div id="steps">
100 - <form id="donationForm" name="donationForm" action="" method="post">
101 - <fieldset class="step">
102 - <legend>Personal Information</legend>
103 - <input type="hidden" name="gateway" value="payflowpro" id="gateway" />
104 - <input type="hidden" name="returnto" value="Thank_You/en" />
105 - <input type="hidden" value="@action" name="action" />
106 - <input type="hidden" value="@amount" name="amount" />
107 - <input type="hidden" value="@country" name="country" id="country" />
108 - <input type="hidden" value="@expiration" name="expiration" />
109 - <input type="hidden" value="@currency_code" name="currency" />
110 - <input type="hidden" value="@utm_source" name="utm_source"/>
111 - <input type="hidden" value="@utm_medium" name="utm_medium"/>
112 - <input type="hidden" value="@utm_campaign" name="utm_campaign"/>
113 - <input type="hidden" value="@language" name="language"/>
114 - <input type="hidden" value="@referrer" name="referrer"/>
115 - <input type="hidden" value="@comment" name="comment"/>
116 - <input type="hidden" value="@comment-option" name="comment-option"/>
117 - <input type="hidden" value="@email-opt" name="email-opt"/>
118 - <input type="hidden" value="processed" name="payment_method"/>
119 - <input type="hidden" value="@token" name="token"/>
120 - <input type="hidden" value="@order_id" name="order_id"/>
121 - <input type="hidden" value="@numAttempt" name="numAttempt"/>
122 - <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/>
123 - <input type="hidden" value="@data_hash" name="data_hash"/>
124 - <input type="hidden" value="@owa_session" name="owa_session"/>
125 - <input type="hidden" value="@owa_ref" name="owa_ref"/>
126 - <div class="step-content">
127 - <div class="stuff">
128 - <table>
129 - <tr>
130 - <td class="label">
131 - <label for="fname">Name</label>
132 - </td>
133 - <td>
134 - <input name="fname" placeholder="First name" size="25" value="@fname" type="text" maxlength="30" class="required" id="fname" style="width: 136px;" />&#160;<input name="lname" placeholder="Last name" size="25" value="@lname" type="text" maxlength="30" class="required" id="lname" style="width: 136px;" />
135 - </td>
136 - </tr>
137 - </table>
138 - </div>
139 - <div class="stuff">
140 - <table>
141 - <tr>
142 - <td class="label">
143 - <label for="street">Billing Address</label>
144 - </td>
145 - <td>
146 - <input name="street" placeholder="Street" size="30" value="@street" type="text" maxlength="100" class="required" id="street" style="width: 258px;" />
147 - </td>
148 - </tr>
149 - <tr>
150 - <td class="label">&#160;</td>
151 - <td>
152 - <input name="city" placeholder="City" class="required" size="18" value="@city" type="text" maxlength="40" id="city" style="width: 136px;"/>
153 - <select name="state" class="required" id="state" value="@state"><option value="" /><option value="AK">AK</option><option value="AL">AL</option><option value="AR">AR</option><option value="AZ">AZ</option><option value="CA">CA</option><option value="CO">CO</option><option value="CT">CT</option><option value="DC">DC</option><option value="DE">DE</option><option value="FL">FL</option><option value="GA">GA</option><option value="HI">HI</option><option value="IA">IA</option><option value="ID">ID</option><option value="IL">IL</option><option value="IN">IN</option><option value="KS">KS</option><option value="KY">KY</option><option value="LA">LA</option><option value="MA">MA</option><option value="MD">MD</option><option value="ME">ME</option><option value="MI">MI</option><option value="MN">MN</option><option value="MO">MO</option><option value="MS">MS</option><option value="MT">MT</option><option value="NC">NC</option><option value="ND">ND</option><option value="NE">NE</option><option value="NH">NH</option><option value="NJ">NJ</option><option value="NM">NM</option><option value="NV">NV</option><option value="NY">NY</option><option value="OH">OH</option><option value="OK">OK</option><option value="OR">OR</option><option value="PA">PA</option><option value="PR">PR</option><option value="RI">RI</option><option value="SC">SC</option><option value="SD">SD</option><option value="TN">TN</option><option value="TX">TX</option><option value="UT">UT</option><option value="VA">VA</option><option value="VT">VT</option><option value="WA">WA</option><option value="WI">WI</option><option value="WV">WV</option><option value="WY">WY</option><option value="AA">AA</option><option value="AE">AE</option><option value="AP">AP</option></select>
154 - <input name="zip" placeholder="Zip" class="required" size="5" value="@zip" type="text" maxlength="10" id="zip" style="width: 48px;" /><input type="hidden" value="US" name="country" />
155 - </td>
156 - </tr>
157 - </table>
158 - </div>
159 - <div class="stuff">
160 - <table>
161 - <tr>
162 - <td class="label">
163 - <label for="email">Email</label>
164 - </td>
165 - <td>
166 - <input name="emailAdd" placeholder="Email address" size="30" value="@emailAdd" type="text" maxlength="100" class="required" id="email" style="width: 258px;" />
167 - </td>
168 - </tr>
169 - </table>
170 - </div>
171 - <a href="#" class="continue-button">Continue</a>
172 - </div>
173 - </fieldset>
174 - <fieldset class="step">
175 - <legend>Payment</legend>
176 - <div class="step-content">
177 - <div class="stuff">
178 - <table>
179 - <tr>
180 - <td class="label">
181 - <label for="email">Card Number</label>
182 - </td>
183 - <td>
184 - <input name="card_num" size="30" value="@card_num" type="text" maxlength="100" class="required" id="card_num" style="width: 258px;" />
185 - </td>
186 - </tr>
187 - </table>
188 - </div>
189 - <div class="stuff">
190 - <table>
191 - <tr>
192 - <td class="label">
193 - <label for="expiration">Expiration Date</label>
194 - </td>
195 - <td>
196 - <select name="mos" id="expiration">
197 - <option value="01">1 (January)</option>
198 - <option value="02">2 (February)</option>
199 - <option value="03">3 (March)</option>
200 - <option value="04">4 (April)</option>
201 - <option value="05">5 (May)</option>
202 - <option value="06">6 (June)</option>
203 - <option value="07">7 (July)</option>
204 - <option value="08">8 (August)</option>
205 - <option value="09">9 (September)</option>
206 - <option value="10">10 (October)</option>
207 - <option value="11">11 (November)</option>
208 - <option value="12">12 (December)</option>
209 - </select>
210 - /
211 - <select name="year" id="year">
212 - <option value="2011">2011</option>
213 - <option value="2012">2012</option>
214 - <option value="2013">2013</option>
215 - <option value="2014">2014</option>
216 - <option value="2015">2015</option>
217 - <option value="2016">2016</option>
218 - <option value="2017">2017</option>
219 - <option value="2018">2018</option>
220 - <option value="2019">2019</option>
221 - <option value="2020">2020</option>
222 - <option value="2021">2021</option>
223 - </select>
224 - </td>
225 - </tr>
226 - </table>
227 - </div>
228 - <div class="stuff">
229 - <table>
230 - <tr>
231 - <td class="label">
232 - <label for="email">Security Code</label>
233 - </td>
234 - <td>
235 - <input name="cvv" size="30" value="@cvv" type="text" maxlength="100" class="required" id="cvv" style="width: 50px;" />
236 - </td>
237 - </tr>
238 - </table>
239 - </div>
240 - <a href="#" class="back-button" id="goback">Back</a>
241 - <a href="#" class="continue-button" id="submitcreditcard">Continue</a>
242 - </div>
243 - </fieldset>
244 - </form>
245 - </div>
246 -</div>
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php
@@ -18,10 +18,9 @@
1919 'js/lightbox1.js',
2020 ),
2121 'styles' => array(
22 - 'css/lightbox1.css',
 22+ 'css/lightbox1.css',
2323 ),
2424 'dependencies' => array(
25 - 'jquery.ui.core',
2625 'jquery.ui.widget',
2726 'jquery.ui.mouse',
2827 'jquery.ui.position',
@@ -29,10 +28,15 @@
3029 'jquery.ui.resizable',
3130 'jquery.ui.button',
3231 'jquery.ui.dialog',
 32+ 'ext.donationInterface.errorMessages',
3333 ),
34 - 'localBasePath' => dirname( __FILE__ ),
 34+ 'messages' => array(
 35+ 'donate_interface-cc-button',
 36+ 'donate_interface-ccdc-button',
 37+ 'donate_interface-paypal-button',
 38+ ),
 39+ 'localBasePath' => dirname( __FILE__ ).'/../../payflowpro_gateway/forms',
3540 'remoteExtPath' => $wgPayflowRapidHtmlRemoteExtPath,
36 - 'position' => 'top',
3741 );
3842
3943 /**
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/css/lightbox1.css
@@ -1,288 +0,0 @@
2 -/* Pitch */
3 -#pitch {
4 - height: 236px;
5 - background-image: url(http://upload.wikimedia.org/wikipedia/foundation/d/dc/Jimmy_Appeal_2009.jpg);
6 - background-position: right top;
7 - background-repeat: no-repeat;
8 - background-color: #1e1e1e;
9 - border: 1px solid gray;
10 - border-bottom-width: 0;
11 -}
12 -#pitch-head {
13 - width: 50%;
14 - font-size: 1.75em;
15 - line-height: 1.5em;
16 - color: white;
17 - margin-top: 16px;
18 - margin-left: 24px;
19 -}
20 -#pitch-body {
21 - width: 50%;
22 - font-size: 1em;
23 - line-height: 1.5em;
24 - color: white;
25 - margin-top: 16px;
26 - margin-left: 24px;
27 -}
28 -
29 -#appeal-head {
30 - font-size: 1.5em;
31 - line-height: 1.125em;
32 - padding-bottom: 0.5em;
33 - padding-top: 0.125em;
34 -}
35 -#appeal-body {
36 - padding: 0.2em 0em;
37 - font-size: 1.125em;
38 - margin-bottom: 1em;
39 -}
40 -/* Donate */
41 -#donate {
42 - font-size: 16px;
43 -}
44 -#amount-table td {
45 - font-size: 100%;
46 - padding: 4px;
47 -}
48 -
49 -#donate-content {
50 - background-color: #CCE7CD;
51 - border: 1px solid #5eac58;
52 -}
53 -#donate-head {
54 - font-size: 1.5em;
55 - line-height: 1.125em;
56 - padding-bottom: 0.5em;
57 - padding-top: 0.125em;
58 - border-color: #5eac58;
59 -}
60 -#donate-body {
61 - font-size: 1.25em;
62 -}
63 -
64 -.donate-body-small {
65 - font-size: .75em;
66 - margin-bottom:1em;
67 -}
68 -.donate-options {
69 - text-align: center;
70 -}
71 -.donate-options input {
72 - width: 15em;
73 -}
74 -
75 -input.button, select#input_currency_code {
76 - font-size: 95%;
77 -}
78 -
79 -table {
80 - background-color: transparent;
81 -}
82 -
83 -#footer {
84 - background-image: none !important;
85 -}
86 -
87 -#mw-head-base {
88 - height: 1em !important;
89 -}
90 -
91 -#mw-panel div.portal {
92 - display: none !important;
93 -}
94 -
95 -#p-namespaces, #p-views, #p-cactions, #p-search, #p-personal, #catlinks, #firstHeading, #contentSub, #siteSub {
96 - display: none;
97 -}
98 -
99 -div#content {
100 - background-color: transparent !important;
101 - background-image: none !important;
102 -}
103 -
104 -div#mw-head-base {
105 - background-image: none !important;
106 -}
107 -
108 -.l {
109 - float: left;
110 -}
111 -.r {
112 - float: right;
113 -}
114 -hr {
115 - margin: 1.5em 0 0.5em;
116 -}
117 -h3 span {
118 - font-weight: normal;
119 -}
120 -#amount-table td {
121 - white-space: nowrap;
122 -}
123 -.call-l {
124 - float: left;
125 - margin: 0.2em 1em 1em 0;
126 -}
127 -.call-l, .call-r {
128 - background: none repeat scroll 0 0 #FFFFFF;
129 - border: 1px solid #444444;
130 - font-size: 13px;
131 - padding: 15px 20px;
132 -}
133 -.call-l h3, .call-r h3 {
134 - font-size: 17px;
135 -}
136 -.call-l .loading, .call-r .loading {
137 - background-image: url("../images/loading-white.gif");
138 -}
139 -.call-r {
140 - float: right;
141 - margin: 0.2em 0 1em 1em;
142 -}
143 -#loading {
144 - font-size: 12px;
145 - margin-left: 0.5em;
146 - vertical-align: middle;
147 -}
148 -.loading {
149 - background: url("../images/loading-green.gif") no-repeat scroll 50% 50% transparent;
150 - padding: 10px;
151 -}
152 -.mute {
153 - font-size: 12px;
154 -}
155 -
156 -/* Callouts */
157 -.call-l, .call-r { width: 310px; }
158 -
159 -/* Layout */
160 -.clear { clear: both; }
161 -
162 -/* Lightbox */
163 -div.ui-dialog {
164 - width: 600px;
165 - overflow: hidden;
166 -}
167 -.ui-dialog .ui-dialog-title {
168 - font-size: 1em;
169 - font-weight: normal;
170 -}
171 -.ui-widget {
172 - font-size: 1em;
173 -}
174 -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
175 - font-size: 0.8em;
176 -}
177 -input.btn {
178 - font-size: 15px;
179 - margin-bottom: 3px;
180 -}
181 -#dialog{
182 - overflow: hidden;
183 -}
184 -.ui-dialog .ui-dialog-content {
185 - padding: 0;
186 -}
187 -#steps{
188 - width:600px;
189 - overflow:hidden;
190 - font-family:sans-serif;
191 -}
192 -.step{
193 - float:left;
194 - width:600px;
195 - position: relative;
196 -}
197 -.step-content {
198 - padding: 20px;
199 - height: 260px;
200 -}
201 -
202 -#steps form fieldset{
203 - border:none;
204 - padding: 0;
205 - margin: 0;
206 -}
207 -#steps form legend{
208 - text-align:left;
209 - color:#666;
210 - font-size:24px;
211 - /* text-shadow:1px 1px 1px #aaa; */
212 - font-weight:bold;
213 - float:left;
214 - width:580px;
215 - padding:8px 0px 5px 20px;
216 - margin:10px 0px;
217 -}
218 -#steps form div.stuff{
219 - clear:both;
220 - margin:3px 0px;
221 - width:auto;
222 - padding:5px 10px;
223 - /*
224 - background-color:#f4f4f4;
225 - border:1px solid #fff;
226 - -moz-border-radius: 5px;
227 - -webkit-border-radius: 5px;
228 - border-radius: 5px;
229 - -moz-box-shadow:0px 0px 3px #aaa;
230 - -webkit-box-shadow:0px 0px 3px #aaa;
231 - box-shadow:0px 0px 3px #aaa;
232 - */
233 -}
234 -#steps form div.stuff label{
235 - width:140px;
236 - float:left;
237 - text-align:right;
238 - margin-right:12px;
239 - line-height:26px;
240 - color:#666;
241 - /* text-shadow:1px 1px 1px #fff; */
242 - font-weight:bold;
243 - font-size: 15px;
244 -}
245 -#steps form input:not([type=radio]),
246 -#steps form textarea,
247 -#steps form select{
248 - background: #ffffff;
249 - border: 1px solid #ccc;
250 - -moz-border-radius: 3px;
251 - -webkit-border-radius: 3px;
252 - border-radius: 3px;
253 - outline: none;
254 - padding: 5px;
255 -}
256 -#steps form input.widefield{
257 - width: 200px;
258 - float:left;
259 -}
260 -#steps form input.large{
261 - font-size: 20px;
262 - line-height: 22px;
263 - width: 62px;
264 -}
265 -#steps form input:focus{
266 - -moz-box-shadow:0px 0px 3px #aaa;
267 - -webkit-box-shadow:0px 0px 3px #aaa;
268 - box-shadow:0px 0px 3px #aaa;
269 - background-color:#FFFEEF;
270 -}
271 -#steps form p.submit{
272 - background:none;
273 - border:none;
274 - -moz-box-shadow:none;
275 - -webkit-box-shadow:none;
276 - box-shadow:none;
277 -}
278 -#steps form a.back-button {
279 - position: absolute;
280 - bottom: 25px;
281 - left: 25px;
282 - margin: 0 !important;
283 -}
284 -#steps form a.continue-button {
285 - position: absolute;
286 - bottom: 25px;
287 - right: 25px;
288 - margin: 0 !important;
289 -}
\ No newline at end of file
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/rapidhtml/js/lightbox1.js
@@ -1,200 +0,0 @@
2 -$(function() {
3 -
4 - $( '#dialog' ).dialog( {
5 - width: 600,
6 - resizable: false,
7 - autoOpen: false,
8 - modal: true,
9 - title: 'Donate by Credit Card'
10 - } );
11 -
12 - // If the form is being reloaded, restore the amount
13 - var previousAmount = $( 'input[name="amount"]' ).val();
14 - if ( previousAmount && previousAmount > 0 ) {
15 - var matched = false;
16 - $( 'input[name="amountRadio"]' ).each( function( index ) {
17 - if ( $( this ).val() == previousAmount ) {
18 - $( this ).attr( 'checked', true );
19 - matched = true;
20 - }
21 - } );
22 - if ( !matched ) {
23 - $( 'input#input_amount_other' ).attr( 'checked', true );
24 - $( 'input#other-amount' ).val( previousAmount );
25 - }
26 - }
27 -
28 - $( '#cc' ).click( function() {
29 - if ( validateAmount( document.paypalcontribution ) ) {
30 - $( '#dialog' ).dialog( 'open' );
31 - }
32 - });
33 - $( '#pp' ).click( function() {
34 - if ( validateAmount( document.paypalcontribution ) ) {
35 - $( "input[name='gateway']" ).val( 'paypal' );
36 - document.paypalcontribution.action = "https://wikimediafoundation.org/wiki/Special:ContributionTracking/en";
37 - $( '#loading' ).html( "<img src='../images/loading.gif' /> Redirecting to PayPal..." );
38 - document.paypalcontribution.submit();
39 - }
40 - });
41 -
42 - /* Set selected amount to amount */
43 - $( "input[name='amountRadio']" ).click( function() { setAmount( $( this ) ); } );
44 - $( "#other-amount" ).change( function() { setAmount( $( this ) ); } );
45 - function setAmount(e) { $("input[name='amount']").val( e.val() ); }
46 -
47 - /* number of fieldsets */
48 - var fieldsetCount = $( '#donationForm' ).children().length;
49 -
50 - /* current position of fieldset / navigation link */
51 - var current = 1;
52 -
53 - /*
54 - Sum and save the widths of each one of the fieldsets.
55 - Set the final sum as the total width of the steps element.
56 - */
57 - var stepsWidth = 0;
58 - var widths = new Array();
59 - $( '#steps .step' ).each( function(i) {
60 - var $step = $( this );
61 - widths[i] = stepsWidth;
62 - stepsWidth += 600; // Hard-coding as $.width() is not working for some reason
63 - } );
64 - $( '#steps' ).width( stepsWidth );
65 -
66 - /* To avoid problems in IE, focus the first input of the form */
67 - $( '#donationForm' ).children( ':first' ).find( ':input:first' ).focus();
68 -
69 - /* make continue buttons */
70 - $( 'a.continue-button' ).button();
71 - $( 'a.continue-button' ).click( function(e) {
72 - var $this = $( this );
73 - current = $( this ).parent().parent().index() + 1;
74 - if ( current == fieldsetCount ) {
75 - finalSubmit();
76 - return false;
77 - }
78 - if ( validateStep( current ) === 1 ) {
79 - current = current + 1;
80 - $( '#steps' ).stop().animate( { marginLeft: '-' + widths[current - 1] + 'px' }, 500,
81 - function() {
82 - $( '#donationForm' ).children( ':nth-child(' + parseInt(current) + ')' ).find( ':input:first' ).focus();
83 - }
84 - );
85 - } else {
86 - $this.blur();
87 - }
88 -
89 - e.preventDefault();
90 - });
91 -
92 - /* Make back button */
93 - $( 'a.back-button' ).button();
94 - $( 'a.back-button' ).click( function(e) {
95 - var $this = $( this );
96 - /* Set current to 1 less than previous step */
97 - current = $( this ).parent().parent().index();
98 -
99 - $( '#steps' ).stop().animate( { marginLeft: '+' + widths[current - 1] + 'px' }, 500 );
100 -
101 - e.preventDefault();
102 - });
103 -
104 - /* Hitting tab on the last input of each fieldset makes the form slide to the next step. */
105 - $( '#donationForm > fieldset' ).each( function() {
106 - var $fieldset = $( this );
107 - $fieldset.find( ':input:last' ).keydown( function(e) {
108 - if ( e.which == 9 ){ // 9 is the char code for tab
109 - $fieldset.find( 'a.continue-button' ).click();
110 - /* Force the blur for validation */
111 - e.preventDefault();
112 - }
113 - });
114 - });
115 -
116 - /*
117 - Validates errors on all the fieldsets.
118 - Records if the form has errors in $( '#donationForm' ).data().
119 - */
120 - function validateSteps() {
121 - var formErrors = false;
122 - for( var i = 1; i < fieldsetCount; ++i ) {
123 - var error = validateStep(i);
124 - if ( error == -1 ) formErrors = true;
125 - }
126 - $( '#donationForm' ).data( 'errors', formErrors );
127 - }
128 -
129 - function finalSubmit() {
130 - var formErrors = false;
131 - for( var i = 1; i <= fieldsetCount; ++i ) {
132 - var error = validateStep(i);
133 - if ( error == -1 ) formErrors = true;
134 - }
135 - $( '#donationForm' ).data( 'errors', formErrors );
136 -
137 - if ( $( '#donationForm' ).data( 'errors' ) ) {
138 - alert( 'Please correct the errors in the form.' );
139 - return false;
140 - } else {
141 - /* Set country to US */
142 - $( "input[name='country']" ).val('US' );
143 -
144 - /* Set expiration date */
145 - $( "input[name='expiration']" ).val(
146 - $( "select[name='mos']" ).val() + $( "select[name='year']" ).val().substring( 2, 4 )
147 - )
148 -
149 - /* Submit the form */
150 - document.donationForm.action = $( "input[name='action']" ).val();
151 - document.donationForm.submit();
152 - }
153 - }
154 -
155 - /*
156 - validates one fieldset
157 - returns -1 if errors found, or 1 if not
158 - */
159 - function validateStep( step ) {
160 - var error = 1;
161 - $( '#donationForm' ).children( ':nth-child(' + parseInt(step) + ')' ).find( ':input:not(button).required' ).each( function() {
162 - var $this = $( this );
163 - var valueLength = jQuery.trim( $this.val() ).length;
164 -
165 - if ( valueLength == '' ) {
166 - error = -1;
167 - $this.css( 'background-color', '#FFEDEF' );
168 - } else {
169 - $this.css( 'background-color', '#FFFFFF' );
170 - }
171 - });
172 -
173 - return error;
174 - }
175 -
176 - function validateAmount(){
177 - var error = true;
178 - var amount = $( "input[name='amount']" ).val(); // get the amount
179 - var otherAmount = amount // create a working copy
180 - otherAmount = otherAmount.replace( /[,.](\d)$/, '\:$10' );
181 - otherAmount = otherAmount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
182 - otherAmount = otherAmount.replace( /[,.]/g, '' );
183 - otherAmount = otherAmount.replace( /:/, '.' );
184 - amount = otherAmount; // reset amount to working copy amount
185 - $( "input[name='amount']" ).val( amount ); // set the new amount back into the form
186 -
187 - // Check amount is a real number, sets error as true (good) if no issues
188 - error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
189 - // Check amount is at least the minimum
190 - var currency = 'USD'; // hard-coded for these forms and tests
191 - $( "input[name='currency_code']" ).val( currency );
192 - if ( typeof( wgCurrencyMinimums[currency] ) == 'undefined' ) {
193 - wgCurrencyMinimums[currency] = 1;
194 - }
195 - if ( amount < wgCurrencyMinimums[currency] || error ) {
196 - alert( 'You must contribute at least $1'.replace('$1', wgCurrencyMinimums[currency] + ' ' + currency ) );
197 - error = true;
198 - }
199 - return !error;
200 - };
201 -});
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms/Form.php
@@ -958,9 +958,9 @@
959959 */
960960 protected function getSmallSecureLogo() {
961961
962 - $form = '<table id="secureLogo" width="135" border="0" cellpadding="2" cellspacing="0" title=' . wfMsg('donate_interface-securelogo-title') . '>';
 962+ $form = '<table id="secureLogo" width="130" border="0" cellpadding="2" cellspacing="0" title=' . wfMsg('donate_interface-securelogo-title') . '>';
963963 $form .= '<tr>';
964 - $form .= '<td width="135" align="center" valign="top"><script type="text/javascript" src="https://seal.verisign.com/getseal?host_name=payments.wikimedia.org&size=S&use_flash=NO&use_transparent=NO&lang=en"></script><br /><a href="http://www.verisign.com/ssl-certificate/" target="_blank" style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">' . wfMsg('donate_interface-secureLogo-text') . '</a></td>';
 964+ $form .= '<td width="130" align="center" valign="top"><script type="text/javascript" src="https://seal.verisign.com/getseal?host_name=payments.wikimedia.org&size=S&use_flash=NO&use_transparent=NO&lang=en"></script><br /><a href="http://www.verisign.com/ssl-certificate/" target="_blank" style="color:#000000; text-decoration:none; font:bold 7px verdana,sans-serif; letter-spacing:.5px; text-align:center; margin:0px; padding:0px;">' . wfMsg('donate_interface-secureLogo-text') . '</a></td>';
965965 $form .= '</tr>';
966966 $form .= '</table>';
967967 return $form;
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_forms
___________________________________________________________________
Modified: svn:mergeinfo
968968 Merged /trunk/extensions/DonationInterface/gateway_forms:r103434,103537,103541,103548
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php
@@ -124,6 +124,7 @@
125125 // Migrated messages
126126 'donate_interface-accessible' => 'This page is only accessible from the donation page.',
127127 'donate_interface-paypal-button' => 'Donate via PayPal',
 128+ 'donate_interface-paypal-redirect' => 'Redirecting to PayPal…',
128129 'donate_interface-cc-button' => 'Donate by credit card',
129130 'donate_interface-ccdc-button' => 'Donate by credit/debit card',
130131 'donate_interface-dd-button' => 'Donate by direct debit',
@@ -164,6 +165,7 @@
165166 'donate_interface-error-msg-nopaypal' => 'Due to a technical error, we cannot send your request to PayPal. Please try using our regular credit card donation form.',
166167 'donate_interface-error-msg' => 'Please enter your $1',
167168 'donate_interface-error-msg-js' => 'Please enter your',
 169+ 'donate_interface-error-msg-validation' => 'Please correct the errors in the form.',
168170 'donate_interface-error-msg-invalid-amount' => 'Please enter a valid amount',
169171 'donate_interface-error-msg-email' => 'Please enter a valid e-mail address',
170172 'donate_interface-error-msg-card-num' => 'Please enter a valid credit card number for one of the accepted credit card types',
@@ -599,6 +601,7 @@
600602 An alternative to 'field' in the translation could be 'information'.
601603
602604 This is an error message which appears if one or more of the above fields is left empty.",
 605+ 'donate_interface-error-msg-validation' => 'Generic error message for form validation failure',
603606 'donate_interface-error-msg-invalid-amount' => 'Error message for invalid amount (e.g. if you put a letter in the amount field).',
604607 'donate_interface-error-msg-email' => 'Error message if the e-mail address is not valid (e.g. non-ASCII characters, spaces or lacking @).',
605608 'donate_interface-error-msg-card-num' => 'The stars are to attract attention to the message in a drop-down box. The stars are not interpreted as wiki code when in use in the extension.',
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
606609 Merged /trunk/extensions/DonationInterface/gateway_common/interface.i18n.php:r103434,103537,103541,103548
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
607610 Merged /trunk/extensions/DonationInterface:r103434,103537,103541,103548

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103434lightbox updateskaldari01:37, 17 November 2011
r103537payflowpro lightbox formkaldari00:28, 18 November 2011
r103541follow-up to r103537, forgot to enable form submissionkaldari00:42, 18 November 2011
r103548slightly redder red for errorskaldari00:52, 18 November 2011

Status & tagging log