http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97836

Revision: 97836
Author:   pgehres
Date:     2011-09-22 18:57:41 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Adding back webitects form for this week as well as some fixes for PayPal 
donations. FU r97776 and r97832

Added Paths:
-----------
    
trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_2_3step.html

Added: 
trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_2_3step.html
===================================================================
--- 
trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_2_3step.html
                           (rev 0)
+++ 
trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_2_3step.html
   2011-09-22 18:57:41 UTC (rev 97836)
@@ -0,0 +1,488 @@
+<!-- load styles from original first steps -->
+<link rel="stylesheet" 
href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/lp1.css"
 />
+<!--[if lt IE 7]><style 
type="text/css">body{behavior:url("/w/skins-1.17/vector/csshover.min.htc")}</style><![endif]-->
+<!-- start Webitects styles -->
+<link rel="stylesheet" 
href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/Webitects.css"
 />
+<style type="text/css">
+       #errorMessages { font-size: 0.75em; color: #FF0000; }
+       /* Force vertical scrollbar 
+       html { overflow-y: scroll; }
+       */
+       /* Accordion */
+       #accordion h3 { background: #FFFFFF; border: none; font-size: 1.1em; 
margin: 0; padding: 0.5em 0.9em; outline: 0; }
+       .accordion-content { padding: 0.9em; }
+       #step2accordion { display:none; }
+        
+       /* Callouts */
+       .call-l, .call-r { width: 270px; }
+        
+       /* Layout */
+       #appeal { float: left; width: 100%; }
+       #appeal-content { padding-right: 380px; }
+       .clear { clear: both; }
+       #donate { float: left; margin-left: -350px; width: 350px; }
+       #donate-content { background-color: #FFFFFF; border: 1px solid #000000; 
padding: 1em 0; 
+                                         font-size: 0.95em;
+                      /* Maybe */ width: 348px;
+       }
+       #amount-table-white label { font-size: 1.1em; }
+       
+       #donate-body { width: 348px; }
+       #donate-body h3 { font-size: 17px; }
+       
+       #step1wrapper, #step2wrapper, #step3wrapper { width: 325px; }
+    /* Initially hide steps 2 and 3 */
+    #step2wrapper, #step2header, #step3wrapper, #step3header { display: none; }
+       #where-content { font-size: 13px; line-height: 19px; width: 325px; }
+
+    #amountErrorMessages, #billingErrorMessages, #paymentErrorMessages { 
color: #F00; }
+       
+</style> 
+<!--[if lt IE 7]><style>
+/* style for IE6 + IE5.5 + IE5.0 */
+.gainlayout { height: 0; }
+</style><![endif]-->
+ 
+<!--[if IE 7]><style>
+.gainlayout { zoom: 1; height: 1%; }
+</style><![endif]-->
+
+<div class="ltr">
+    <div id="appeal">
+        <div id="appeal-content">
+            <h2 id="appeal-head"> <span class="mw-headline" 
id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon 
Harris</span></h2>
+            <div id="appeal-body" class="plainlinks">
+                <p>I feel like I'm living the first line of my obituary.</p>
+                <p>I don't think there will be anything else that I do in my 
life as important as what I do now for Wikipedia. We're not just building an 
encyclopedia, we're working to make people free. When we have access to free 
knowledge, we are better people. We understand the world is bigger than us, and 
we become infected with tolerance and understanding.</p>
+                <p>Wikipedia is the 5th largest website in the world. I work 
at the small non-profit that keeps it on the web. We don't run ads because 
doing so would sacrifice our independence. The site is not and should never be 
a propaganda tool.</p>
+                <p>Our work is possible because of donations from our readers. 
Will you help protect Wikipedia by donating $5, $10, $20 or whatever you can 
afford?</p>
+                <p>I work at the Wikimedia Foundation because everything in my 
soul tells me it's the right thing to do. I've worked at huge tech companies, 
doing some job to build some crappy thing that's designed to steal money from 
some kid who doesn't know it. I would come home from work crushed.</p>
+                <p>You might not know this, but the Wikimedia Foundation 
operates with a very small staff. Most other top-ten sites have tens of 
thousands of people and massive budgets. But they produce a fraction of what we 
pull off with sticks and wire.</p>
+                <p>When you give to Wikipedia, you're supporting free 
knowledge around the world. You're not only leaving a legacy for your children 
and for their children, you're elevating people around the world who have 
access to this treasure. You're assuring that one day everyone else will 
too.</p>
+                <p>Thank you,</p>
+                <p><strong>Brandon Harris</strong><br /></p>
+                <p>Programmer, Wikimedia Foundation</p>
+            </div>
+        </div>
+    </div>
+
+    <div id="donate">
+        <div id="donate-content">
+            <div id="donate-body" style="padding: 0 1em;">
+                <div id="step1header"><h3>Donation amount <span 
id="selected-amount"></span> <span class="mute" id="change-amount" 
style="display: none;">(<a href="#">Change</a>)</span></h3></div>
+
+                <form method="post" name="paypalcontribution">
+                    <div id="step1wrapper">
+                        <div id="amountErrorMessages" class="small"></div>
+                        <table id="amount-table-white">
+                            <tr>
+                                <td><label><input type="radio" 
name="amountRadio" value="5" /> $5</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" value="10" /> $10</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" value="20" /> $20</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" value="35" /> $35</label></td>
+                            </tr>
+                            <tr>
+                                <td><label><input type="radio" 
name="amountRadio" value="50" /> $50</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" value="100" /> $100</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" value="250" /> $250</label></td>
+                                <td><label><input type="radio" 
name="amountRadio" id="input_amount_other" value="other" /> $<input type="text" 
class="txt-sm hint"  name="amountGiven" size="4" id="other-amount" 
title="Other..."  
onfocus="this.form.input_amount_other.checked=true;"/></label></td>
+                            </tr>
+                        </table>
+
+                        <p class="donate-options">
+                            <input class="btn" id="cc" type="button" 
value="Donate by Credit Card" /><br />
+                            <input class="btn" id="pp" type="button" 
value="Donate via PayPal"/><span id='loading'></span>
+                        </p>
+                    </div>
+                                       <div id="step2header"><h3>Billing 
Address <span class="mute" id="change-billing" style="display: none;">(<a 
href="#">Change</a>)</span></h3></div>
+                                       <div id="step2wrapper">
+                        <div id="billing-content" class="gainlayout">
+                            <div id="billingErrorMessages" class="small"></div>
+                            <div class="name-fields">
+                                <span class="name-first"><input class="txt 
hint" id="fname" name="fname" title="First name" value="@fname" /></span>
+                                <span class="name-last"><input class="txt 
hint" id="lname" name="lname" title="Last name" value="@lname" /></span>
+                            </div>
+                            <div class="loc-fields">
+                                <span class="loc-street"><input class="txt 
hint" id="street" name="street" title="Street address" value="@street" /></span>
+                                <span class="loc-city"><input class="txt hint" 
id="city" name="city" title="City" value="@city" /></span>
+                                <span class="loc-state">
+                                <select id="state" name="state" class="txt" 
value="@state" >
+                                    <option value=""></option>
+                                    <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>
+                                </span>
+                                <span class="loc-postal"><input class="txt 
hint" id="zip" name="zip" title="Zip" value="@zip"/></span>
+                            </div>
+                            <p><input class="txt hint" title="Email address" 
id="emailAdd" name="emailAdd" value="@emailAdd"/></p>
+
+                            <dl class="">
+                                <dt><span class="label">Select credit 
card</span></dt>
+                                <dd class="field" style="margin-bottom: 0;">
+                                    <ul class="options-h" id="cards" 
style="margin: 0;">
+                                        <li><input id="cc-visa" 
name="cardtype" type="radio" value="Visa" class="cardradio" /> <label 
for="cc-visa"><img alt="Visa" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png"
 /></label></li>
+                                        <li><input id="cc-mastercard" 
name="cardtype" type="radio" value="MasterCard" class="cardradio" /> <label 
for="cc-mastercard"><img alt="MasterCard" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png"
 /></label></li>
+                                        <li><input id="cc-amex" 
name="cardtype" type="radio" value="American Express" class="cardradio" /> 
<label for="cc-amex"><img alt="American Express" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png"
 /></label></li>
+                                        <li><input id="cc-discover" 
name="cardtype" type="radio" value="Discover" class="cardradio" /> <label 
for="cc-discover"><img alt="Discover" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png"
 /></label></li>
+                                    </ul>
+                                    <div id="paymentContinue" 
style="margin-top: 10px; display: none;"> <input class="btn" 
id="paymentContinueBtn" type="button" value="Continue" /></div>
+                                </dd>
+                            </dl>
+                        </div>
+                                   </div>
+                                   <div id="step3header"><h3>Payment 
Information <span class="mute" id="change-payment" style="display: none;">(<a 
href="#">Change</a>)</span></h3></div>
+                    <div id="step3wrapper" style="display: none;">
+                        <div id="payment"  class="gainlayout">
+                            <div id="paymentErrorMessages" class="small"></div>
+                            <dl class="form">
+                                <dt><span class="label"><label 
for="card_num">Card number</label></span></dt>
+                                <dd class="field"><input class="txt" 
id="card_num" name="card_num" value="@card_num"/></dd>
+
+                                <dt></dt>
+                                <dd class="field">
+                                    <div class="l" style="margin-right: 5%;">
+                                        <span class="label">Expiration 
date</span>
+                                        <select id="mos" name="mos">
+                                            <option value="">Month</option>
+                                            <option value="01">01 - 
January</option>
+                                            <option value="02">02 - 
February</option>
+                                            <option value="03">03 - 
March</option>
+                                            <option value="04">04 - 
April</option>
+                                            <option value="05">05 - 
May</option>
+                                            <option value="06">06 - 
June</option>
+                                            <option value="07">07 - 
July</option>
+                                            <option value="08">08 - 
August</option>
+                                            <option value="09">09 - 
September</option>
+                                            <option value="10">10 - 
October</option>
+                                            <option value="11">11 - 
November</option>
+                                            <option value="12">12 - 
December</option>
+                                        </select>
+
+                                        <select id="year" name="year">
+                                            <option value="">Year</option>
+                                            <option value="2011">2011</option>
+                                            <option value="2012">2012</option>
+                                            <option value="2013">2013</option>
+                                            <option value="2014">2014</option>
+                                            <option value="2015">2015</option>
+                                            <option value="2016">2016</option>
+                                            <option value="2017">2017</option>
+                                            <option value="2018">2018</option>
+                                            <option value="2019">2019</option>
+                                            <option value="2020">2020</option>
+                                        </select>
+                                    </div>
+                                    <div class="l">
+                                        <label class="label" 
for="cvv">Security code</label>
+                                        <input class="txt-sm" id="cvv" 
name="cvv"  value="@cvv"/>
+                                        <a class="mute" href="#" 
id="where">Where?</a>
+                                    </div>
+
+                                    <div class="clear" id="codes" 
style="display: none;"><img alt="Security codes" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/images/security-code.png"
 /></div>
+                                </dd>
+
+                                <dt></dt>
+                                <dd class="field">
+                                    <input id="submitcreditcard" class="btn" 
type="button" value="Submit donation" />
+                                    <p class="mute"><img alt="" 
src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif"
 /> Your credit card will be securely processed.</p>
+                                </dd>
+                            </dl>
+                        </div>
+                    </div>
+
+                    <input type="hidden" name="gateway" value="payflowpro" 
id="gateway" />
+                    <input type="hidden" name="returnto" value="Thank_You/en" 
/>
+                                       <input type="hidden" value="0" 
name="PaypalRedirect" id="PaypalRedirect">
+                    <input type="hidden" value="@card" name="card" id="card">
+
+                    <input type="hidden" value="@amount" name="amount" />
+                    <input type="hidden" value="US" name="country" 
id="country" />
+                    <input type="hidden" value="@expiration" name="expiration" 
id="expiration"/>
+                    <input type="hidden" value="@currency_code" 
name="currency_code" />
+                    <input type="hidden" value="@utm_source" 
name="utm_source"/>
+                    <input type="hidden" value="@utm_medium" 
name="utm_medium"/>
+                    <input type="hidden" value="@utm_campaign" 
name="utm_campaign"/>
+                    <input type="hidden" value="@language" name="language"/>
+                    <input type="hidden" value="@referrer" name="referrer"/>
+                    <input type="hidden" value="@comment" name="comment"/>
+                    <input type="hidden" value="@comment-option" 
name="comment-option"/>
+                    <input type="hidden" value="@email-opt" name="email-opt"/>
+                    <input type="hidden" value="processed" 
name="payment_method"/>
+                    <input type="hidden" value="@token" name="token"/>
+                    <input type="hidden" value="@order_id"  name="order_id"/>
+                    <input type="hidden" value="@numAttempt" 
name="numAttempt"/>
+                    <input type="hidden" value="@contribution_tracking_id" 
name="contribution_tracking_id"/>
+                    <input type="hidden" value="@data_hash" name="data_hash"/>
+                    <input type="hidden" value="@owa_session" 
name="owa_session"/>
+                    <input type="hidden" value="@owa_ref" name="owa_ref"/>
+                </form>
+                <div id="where-content">
+                           <hr>
+                           <h3>Where your donation goes</h3>
+                           <p><strong>Technology:</strong> Servers, bandwidth, 
maintenance, development. Wikipedia is the #5 website in the world and it runs 
on a fraction of what other top websites spend.</p>
+                           <p><strong>People:</strong> The other top 10 
website have thousands of employees. We have fewer than 100, making your 
donation a great investment in a highly-efficient not-for-profit 
organization.</p>
+                       </div>
+            </div>
+        </div>
+        <p>We do not store your credit card information, and your personal 
data is subject to our <a target="_blank" 
href="//wikimediafoundation.org/wiki/Donor_policy"> donor privacy 
policy</a>.</p>
+        <p><a target="_blank" 
href="//wikimediafoundation.org/wiki/Ways_to_Give/en">More information or other 
ways to give</a><br /><a target="_blank" 
href="//wikimediafoundation.org/wiki/FAQ/en">Answers to frequently asked 
questions</a></p>
+    </div>
+</div>
+
+    <!-- load jquery (newer) -->
+    <script type='text/javascript' 
src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.js'></script>
+    <script type='text/javascript' 
src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.core.js'></script>
+    <script type='text/javascript' 
src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.widget.js'></script>
+    <script type='text/javascript' 
src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.accordion.js'></script>
+    <script type='text/javascript' 
src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ezpz_hint.js'></script>
+    <script type="text/javascript">
+       ( function( $ ){
+               window.onload = function (){
+                       // ensure all jQuery instances are set to 1.4.2
+                       jQuery = $;
+                       $j = $;
+                           
+                           // This form is radically broken in IE6
+                           // Redirecting them to another page
+                           // TODO: handle this in the banner
+                           if (jQuery.browser.msie && 
jQuery.browser.version.substr(0,1)<7){
+                               //get the current querystring
+                               var qs = window.location.search.substring(1);
+                               // redirect IE6 people to another form
+                               
window.location.replace("https://wikimediafoundation.org/wiki/Special:LandingCheck?language=en&landing_page=L11_ExtraInfo_0902_N&utm_campaign=C_0916_Webitects_US_ie6&utm_source=B_BR_0916_US&country_code=US&referrer=webitects2";);
+                           }
+                           
+
+                       // check for RapidHtml errors and display, if any
+                var amountErrors = 
['#general|escape','#retryMsg|escape','#amount|escape'],
+                    amountErrorString = "";
+                       var billingErrors = 
['#fname|escape','#lname|escape','#city|escape','#country|escape',
+                        
'#street|escape','#state|escape','#zip|escape','#emailAdd|escape'],
+                    billingErrorString = "";
+                var paymentErrors = 
['#card_num|escape','#card|escape','#cvv|escape'],
+                    paymentErrorString = "";
+
+                // generate formatted errors to display
+                var temp = []
+                for( var e in amountErrors )
+                    if( amountErrors[e] != "" )
+                        temp[temp.length] = amountErrors[e];
+                amountErrorString = temp.join( "<br />" );
+
+                temp = []
+                for( var e in billingErrors )
+                    if( billingErrors[e] != "" )
+                        temp[temp.length] = billingErrors[e];
+                billingErrorString = temp.join( "<br />" );
+
+                temp = []
+                for( var e in paymentErrors )
+                    if( paymentErrors[e] != "" )
+                        temp[temp.length] = paymentErrors[e];
+                paymentErrorString = temp.join( "<br />" );
+
+                // show the errors
+                var prevError = false;
+                if( amountErrorString != ""){
+                    $("#amountErrorMessages").html( amountErrorString );
+                    prevError = true;
+                    showStep1(); // should be default, but ensure
+                }
+                if( billingErrorString != ""){
+                    $("#billingErrorMessages").html( billingErrorString );
+                    if( !prevError ){
+                        showStep2();
+                        prevError = true;
+                    }
+                    showAmount( $('input[name="amount"]') ); // lets go ahead 
and assume there is something to show
+                }
+                if( paymentErrorString != ""){
+                    $("#paymentErrorMessages").html( paymentErrorString );
+                    if( !prevError )
+                        showStep3();
+                    showAmount( $('input[name="amount"]') ); // lets go ahead 
and assume there is something to show
+                }
+                       
+                       // Init inline labels
+                           $(".hint").ezpz_hint();
+
+                $("#cc").click(function(){
+                               if ( validateAmount() ){
+                                       showAmount( $('input[name="amount"]') );
+                                       showStep2();
+                               }
+                           });
+                           
+                           $("#pp").click(function(){
+                               if ( validateAmount() ){
+                        // set the action to go to PayPal
+                                       
$('input[name="gateway"]').val("paypal");
+                                               
$('input[name="PaypalRedirect"]').val("1");
+                                               $("#loading").html("<img 
src='../images/loading.gif' /> Redirecting to PayPal…");
+                                       document.paypalcontribution.action = 
"@action";
+                                       document.paypalcontribution.submit();
+                                       }
+                           });
+                               $("#paymentContinueBtn").live("click", 
function() {
+                                       if ( validate_personal( 
document.paypalcontribution ) ){
+                                               showStep3();
+                                       }
+                               });
+                           // Set the cards to progress to step 3
+                           $(".cardradio").live("click", function() {
+                               if ( validate_personal( 
document.paypalcontribution ) ){
+                                   showStep3();
+                    }
+                    else {
+                        // show the continue button to indicate how to get to 
step 3 since they
+                        // have already clicked on a card image
+                        $("#paymentContinue").show();
+                    }
+                           });
+                           
+                           $("#submitcreditcard").click(function(){
+                               // set country to US TODO: make this dynamic
+                               $('input[name="country"]').val("US");
+
+                               if ( validate_cc() ){
+                                       // set the hidden expiration date input 
from the two selects
+                                       $('input[name="expiration"]').val(
+                                               $("select[name=mos]").val() + 
$('select[name="year"]').val().substring(2,4)
+                                       );
+                                       document.paypalcontribution.action = 
"@action";
+                                       document.paypalcontribution.submit();
+                               }
+                           })
+                           
+                           // init all of the header actions
+                           $("#step1header").click(function(){
+                                       showStep1();
+                   });
+                    $("#step2header").click(function(){
+                                       showStep2();
+                   });
+                   $("#step3header").click(function(){
+                                       showStep3();
+                   });
+                           
+                           function showStep1(){
+                               // show the correct sections
+                               $("#step1wrapper").slideDown();
+                                       $("#step2wrapper").slideUp();
+                                       $("#step3wrapper").slideUp();
+                                       $("#change-amount").hide();
+                                       $("#change-billing").show();
+                                       $("#change-payment").show();
+                                       $("#step1header").show(); // just in 
case
+                           }
+                           function showStep2(){
+                               // show the correct sections
+                               $("#step1wrapper").slideUp();
+                                       $("#step2wrapper").slideDown();
+                                       $("#step3wrapper").slideUp();
+                                       $("#change-amount").show();
+                                       $("#change-billing").hide();
+                                       $("#change-payment").show();
+                                       $("#step2header").show(); // just in 
case
+                           }
+                           function showStep3(){
+                               // show the correct sections
+                               $("#step1wrapper").slideUp();
+                                       $("#step2wrapper").slideUp();
+                                       $("#step3wrapper").slideDown();
+                                       $("#change-amount").show();
+                                       $("#change-billing").show();
+                                       $("#change-payment").hide();
+                                       $("#step3header").show(); // just in 
case       
+                           }
+                           
+                                                   
+                           // Fix behavior of images in labels
+                // TODO: check that disabling this is okay in things other 
than Chrome
+//                         $("label img").live("click", function() { $("#" + 
$(this).parents( "label" ).attr( "for" )).click(); });
+                           
+                           // Display selected amount
+                           function showAmount(e){ 
+                               $("#selected-amount").html( "($" + e.val() + 
")" );
+                               $("#change-amount").show();
+                           }
+                           
+                           // Set selected amount to amount
+                           $('input[name="amountRadio"]').click( function(){
+                    setAmount( $(this) );
+                });
+                // reset the amount field when "other" is changed
+                           $("#other-amount").change(function(){
+                    setAmount( $(this) );
+                });
+                // set the hidden amount input to the value of the selected 
element
+                           function setAmount(e){
+                    $("input[name=amount]").val( e.val() );
+                }
+                           
+                           // show the CVV help image on click
+                           $("#where").click(function(){
+                             $("#codes").toggle();
+                             return false;
+                           });
+
+                           function validateAmount(){
+                               var minimums = {
+                                       'USD' : 1
+                                   };
+                               var error = true;
+                                       var amount = 
$('input[name="amount"]').val(); // get the amount
+                                       amount = amount.replace(/[,.](\d)$/, 
'\:$10');
+                                       amount = 
amount.replace(/[,.](\d)(\d)$/, '\:$1$2');
+                                       amount = amount.replace(/[,.]/g, '');
+                                       amount = amount.replace(/:/, '.');
+                                       $('input[name="amount"]').val( amount 
); // set the new amount back into the form
+
+                                       // Check amount is a real number, sets 
error as true (good) if no issues
+                                       error = ( amount == null || isNaN( 
amount ) || amount.value <= 0 );
+
+                                       // Check amount is at least the minimum
+                                       var currency_code = 'USD'; // 
hard-coded for these forms and tests
+                                       $('input[name="currency_code"]').val( 
currency_code );
+                                       if ( typeof( minimums[currency_code] ) 
== 'undefined' ) {
+                                               minimums[currency_code] = 1;
+                                       }
+                                       if ( amount < minimums[currency_code] 
|| error ) {
+                                               alert( 'You must contribute at 
least $1'.replace('$1', minimums[currency_code] + ' ' + currency_code ) );
+                                               error = true;
+                                       }
+                                       return !error;
+                           }
+                function validate_cc(){
+                    // reset the errors
+                    $("#paymentErrorMessages").html('');
+                    var error = false;
+                    if( $('input[name="card_num"]').val() == '' ){
+                        $("#paymentErrorMessages").append( "Please enter a 
valid credit card number" );
+                        error = true;
+                    }
+                               if( $('select[name="mos"]').val() == '' ){
+                        if( $("#paymentErrorMessages").html() != "" )
+                            $("#paymentErrorMessages").append( "<br />" );
+                        $("#paymentErrorMessages").append( "Please enter a 
valid month for the expiration date" );
+                        error = true;
+                    }
+                    if( $('select[name="year"]').val() == '' ){
+                        if( $("#paymentErrorMessages").html() != "" )
+                            $("#paymentErrorMessages").append( "<br />" );
+                        $("#paymentErrorMessages").append( "Please enter a 
valid year for the expiration date" );
+                        error = true;
+                    }
+                    if( $('input[name="cvv"]').val() == '' ){
+                        if( $("#paymentErrorMessages").html() != "" )
+                            $("#paymentErrorMessages").append( "<br />" );
+                        $("#paymentErrorMessages").append( "Please enter a 
valid security code" );
+                        error = true;
+                    }
+                    return !error;
+                           }
+               }
+               })(jQuery);
+    </script>
+<!-- Wikimedia Project logo
+<li id="footer-copyrightico"><a href="//wikimediafoundation.org/"><img 
src="//bits.wikimedia.org/images/wikimedia-button.png" width="88" height="31" 
alt="Wikimedia Foundation"/></a></li> 
+ -->
\ No newline at end of file


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to