r97181 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97180‎ | r97181 | r97182 >
Date:17:57, 15 September 2011
Author:pgehres
Status:ok
Tags:
Comment:
Webitects_1 working and ready to be tested live
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_1.html (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_1.html
@@ -9,7 +9,7 @@
1010 html { overflow-y: scroll; }
1111 */
1212 /* Accordion */
13 - #accordion h3 { background: #a4d4a6; border-bottom: 1px solid #5eac58; font-size: 1em; margin: 0; padding: 0.5em 0.9em; }
 13+ #accordion h3 { background: #a4d4a6; border-bottom: 1px solid #5eac58; font-size: 1em; margin: 0; padding: 0.5em 0.9em; outline: 0; }
1414 .accordion-content { padding: 0.9em; }
1515 #step2accordion { display:none; }
1616
@@ -77,7 +77,7 @@
7878 </div>
7979
8080 <h3>2. Billing and payment</h3>
81 - <div id="step2accordion" class="accordion-content">
 81+ <div class="accordion-content">
8282 <div id="errorMessages"></div>
8383 <div class="name-fields">
8484 <span class="name-first"><input class="txt hint" id="fname" name="fname" title="First name" value="@fname" /></span>
@@ -118,15 +118,15 @@
119119 <span class="label">Expiration date</span>
120120 <select id="mos" name="mos">
121121 <option value="">Month</option>
122 - <option value="1">01 - January</option>
123 - <option value="2">02 - February</option>
124 - <option value="3">03 - March</option>
125 - <option value="4">04 - April</option>
126 - <option value="5">05 - May</option>
127 - <option value="6">06 - June</option>
128 - <option value="7">07 - July</option>
129 - <option value="8">08 - August</option>
130 - <option value="9">09 - September</option>
 122+ <option value="01">01 - January</option>
 123+ <option value="02">02 - February</option>
 124+ <option value="03">03 - March</option>
 125+ <option value="04">04 - April</option>
 126+ <option value="05">05 - May</option>
 127+ <option value="06">06 - June</option>
 128+ <option value="07">07 - July</option>
 129+ <option value="08">08 - August</option>
 130+ <option value="09">09 - September</option>
131131 <option value="10">10 - October</option>
132132 <option value="11">11 - November</option>
133133 <option value="12">12 - December</option>
@@ -161,12 +161,12 @@
162162 <p class="mute"><img alt="" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif" /> Your credit card will be securely processed.</p>
163163 </dd>
164164 </dl>
165 - <input type="hidden" name="gateway" value="payflowpro" />
 165+ <input type="hidden" name="gateway" value="payflowpro" id="gateway" />
166166 <input type="hidden" name="returnto" value="Thank_You/en" />
167167
168168 <input type="hidden" value="@amount" name="amount" />
169 - <input type="hidden" value="US" name="country" id="country" />
170 -
 169+ <input type="hidden" value="@country" name="country" id="country" />
 170+ <input type="hidden" value="@expiration" name="expiration" />
171171 <input type="hidden" value="@currency_code" name="currency" />
172172 <input type="hidden" value="@utm_source" name="utm_source"/>
173173 <input type="hidden" value="@utm_medium" name="utm_medium"/>
@@ -206,6 +206,11 @@
207207 $j = $;
208208 $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ezpz_hint.min.js', function() {
209209 $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.min.js', function() {
 210+ // Init accordion
 211+ $("#accordion").accordion({
 212+ autoHeight: false
 213+ });
 214+
210215 // check for RapidHtml errors and display, if any
211216 var errors = ['#general','#retryMsg','#amount','#card_num','#card','#cvv','#fname',
212217 '#lname','#city','#country','#street','#state','#zip','#emailAdd'];
@@ -213,47 +218,45 @@
214219 var count = 0;
215220 for( var i=0; i < errors.length; i++ ){
216221 if ( errors[i].length > 0 ){
217 - console.log(errors[i]);
218222 count++;
219223 if ( count > 1 )
220224 $('#errorMessages').append('<br />');
221225 $('#errorMessages').append(errors[i]);
222226 }
223227 }
 228+ if( count > 0 ){
 229+ // show the second step with the error
 230+ $("#accordion").accordion( "activate" , 1 );
 231+ }
224232 // Inline labels
225233 $(".hint").ezpz_hint();
226234
227 - // Init accordion
228 - $("#accordion").accordion({
229 - autoHeight: false
230 - });
231 - $("#cc").click(function(){
232 - console.log('Clicked: CC');
 235+ $("#cc").click(function(){
233236 if ( validateAmount(document.paypalcontribution) ){
234 - console.log('Amount: OK');
235 - console.log('Target: Credit Card');
236237 showAmount( $("input[name=amount]") );
237238 $("#accordion").accordion("activate", 1);
238239 $("#change-amount").show();
239240 }
240241
241242 });
242 - $("#pp").click(function(){
243 - console.log('Clicked: PP');
 243+ $("#pp").click(function(){
244244 if ( validateAmount(document.paypalcontribution) ){
245 - console.log('Amount: OK');
246 - console.log('Target: PayPal');
247245 // set the action to go to PayPal
 246+ $("input[name=gateway]").val("paypal");
248247 document.paypalcontribution.action = "https://wikimediafoundation.org/wiki/Special:ContributionTracking/en";
249248 $("#loading").html("<img src='../images/loading.gif' /> Redirecting to PayPal...")
250249 document.paypalcontribution.submit();
251250 }
252251 });
253 - $("#submitcreditcard").click(function(){
254 - console.log('Clicked: Submit CC');
 252+ $("#submitcreditcard").click(function(){
 253+ // set country to US
 254+ $("input[name=country]").val("US");
 255+
255256 if ( validate_form(document.paypalcontribution) ){
256 - console.log('Form: OK');
257 - console.log('Target: Submit Credit Card');
 257+ // set expiration date
 258+ $("input[name=expiration]").val(
 259+ $("select[name=mos]").val() + $("select[name=year]").val().substring(2,4)
 260+ )
258261
259262 document.paypalcontribution.action = "@action";
260263 document.paypalcontribution.submit()
@@ -295,6 +298,7 @@
296299 error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
297300 // Check amount is at least the minimum
298301 var currency = 'USD'; // hard-coded for these forms and tests
 302+ $("input[name=currency]").val(currency);
299303 if ( typeof( minimums[currency] ) == 'undefined' ) {
300304 minimums[currency] = 1;
301305 }

Status & tagging log