r97182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97181‎ | r97182 | r97183 >
Date:18:11, 15 September 2011
Author:pgehres
Status:resolved (Comments)
Tags:
Comment:
adding webitects_1a; ready for testing
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_1a.html (added) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/html/webitects_1a.html
@@ -0,0 +1,319 @@
 2+<!-- load styles from original first steps -->
 3+<link rel="stylesheet" href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/lp1.css" />
 4+<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins-1.17/vector/csshover.min.htc")}</style><![endif]-->
 5+<!-- start Webitects styles -->
 6+<link rel="stylesheet" href="@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/css/Webitects.css" />
 7+<style type="text/css">
 8+ #errorMessages { font-size: 0.75em; color: #FF0000; }
 9+ /* Force vertical scrollbar
 10+ html { overflow-y: scroll; }
 11+ */
 12+ /* Accordion */
 13+ #accordion h3 { background: #a4d4a6; border-bottom: 1px solid #5eac58; font-size: 1em; margin: 0; padding: 0.5em 0.9em; outline: 0; }
 14+ .accordion-content { padding: 0.9em; }
 15+ #step2accordion { display:none; }
 16+
 17+ /* Callouts */
 18+ .call-l, .call-r { width: 270px; }
 19+
 20+ /* Layout */
 21+ #appeal { float: left; width: 100%; }
 22+ #appeal-content { padding-right: 380px; }
 23+ .clear { clear: both; }
 24+ #donate { float: left; margin-left: -350px; width: 350px; }
 25+</style>
 26+
 27+ <div class="ltr">
 28+ <div id="appeal">
 29+ <div id="appeal-content">
 30+ <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2>
 31+ <div id="appeal-body" class="plainlinks">
 32+ <p>I feel like I'm living the first line of my obituary.</p>
 33+ <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>
 34+ <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>
 35+ <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>
 36+ <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>
 37+ <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>
 38+ <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>
 39+ <p>Thank you,</p>
 40+ <p><strong>Brandon Harris</strong><br /></p>
 41+ <p>Programmer, Wikimedia Foundation</p>
 42+ </div>
 43+ </div>
 44+ </div>
 45+
 46+ <div id="donate">
 47+ <div id="donate-content">
 48+ <div id="donate-body">
 49+
 50+ <div id="accordion">
 51+ <h3>1. Donation amount <span id="selected-amount"></span> <span class="mute" id="change-amount" style="display: none;">(<a href="#">Change</a>)</span></h3>
 52+ <div class="accordion-content">
 53+ <form method="post" name="paypalcontribution">
 54+ <table id="amount-table">
 55+ <tr>
 56+ <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td>
 57+ <td><label><input type="radio" name="amountRadio" value="10" /> $10</label></td>
 58+ <td><label><input type="radio" name="amountRadio" value="20" /> $20</label></td>
 59+ <td><label><input type="radio" name="amountRadio" value="35" /> $35</label></td>
 60+ </tr>
 61+ <tr>
 62+ <td><label><input type="radio" name="amountRadio" value="50" /> $50</label></td>
 63+ <td><label><input type="radio" name="amountRadio" value="100" /> $100</label></td>
 64+ <td><label><input type="radio" name="amountRadio" value="250" /> $250</label></td>
 65+ <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>
 66+ </tr>
 67+ </table>
 68+
 69+ <p class="donate-options">
 70+ <input class="btn" id="cc" type="button" value="Donate by Credit Card" />
 71+ <input class="btn" id="pp" type="button" value="Donate via PayPal"/><span id='loading'></span>
 72+ </p>
 73+ </div>
 74+
 75+ <h3>2. Billing and payment</h3>
 76+ <div class="accordion-content">
 77+ <div id="errorMessages"></div>
 78+ <div class="name-fields">
 79+ <span class="name-first"><input class="txt hint" id="fname" name="fname" title="First name" value="@fname" /></span>
 80+ <span class="name-last"><input class="txt hint" id="lname" name="lname" title="Last name" value="@lname" /></span>
 81+ </div>
 82+ <div class="loc-fields">
 83+ <span class="loc-street"><input class="txt hint" id="street" name="street" title="Street address" value="@street" /></span>
 84+ <span class="loc-city"><input class="txt hint" id="city" name="city" title="City" value="@city" /></span>
 85+ <span class="loc-state">
 86+ <select id="state" name="state" class="txt" value="@state" >
 87+ <option value=""></option>
 88+ <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>
 89+ </select>
 90+ </span>
 91+ <span class="loc-postal"><input class="txt hint" id="zip" name="zip" title="Zip" value="@zip"/></span>
 92+ </div>
 93+ <p><input class="txt hint" title="Email address" id="emailAdd" name="emailAdd" value="@emailAdd"/></p>
 94+ <dl class="">
 95+ <dt><span class="label">Select credit card</span></dt>
 96+ <dd class="field" style="margin-bottom: 0;">
 97+ <ul class="options-h" id="cards" style="margin: 0;">
 98+ <li><input id="cc-visa" name="cardtype" type="radio" value="Visa" /> <label for="cc-visa"><img alt="Visa" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" /></label></li>
 99+ <li><input id="cc-mastercard" name="cardtype" type="radio" value="MasterCard" /> <label for="cc-mastercard"><img alt="MasterCard" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" /></label></li>
 100+ <li><input id="cc-amex" name="cardtype" type="radio" value="American Express" /> <label for="cc-amex"><img alt="American Express" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" /></label></li>
 101+ <li><input id="cc-discover" name="cardtype" type="radio" value="Discover" /> <label for="cc-discover"><img alt="Discover" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" /></label></li>
 102+ </ul>
 103+ </dd>
 104+ </dl>
 105+
 106+ <div id="payment">
 107+ <dl class="form">
 108+ <dt><span class="label"><label for="cardnumber">Card number</label></span></dt>
 109+ <dd class="field"><input class="txt" id="card_num" name="card_num" value="@card_num"/></dd>
 110+
 111+ <dt></dt>
 112+ <dd class="field">
 113+ <div class="l" style="margin-right: 5%;">
 114+ <span class="label">Expiration date</span>
 115+ <select id="mos" name="mos">
 116+ <option value="">Month</option>
 117+ <option value="01">01 - January</option>
 118+ <option value="02">02 - February</option>
 119+ <option value="03">03 - March</option>
 120+ <option value="04">04 - April</option>
 121+ <option value="05">05 - May</option>
 122+ <option value="06">06 - June</option>
 123+ <option value="07">07 - July</option>
 124+ <option value="08">08 - August</option>
 125+ <option value="09">09 - September</option>
 126+ <option value="10">10 - October</option>
 127+ <option value="11">11 - November</option>
 128+ <option value="12">12 - December</option>
 129+ </select>
 130+
 131+ <select id="year" name="year">
 132+ <option value="">Year</option>
 133+ <option value="2011">2011</option>
 134+ <option value="2012">2012</option>
 135+ <option value="2013">2013</option>
 136+ <option value="2014">2014</option>
 137+ <option value="2015">2015</option>
 138+ <option value="2016">2016</option>
 139+ <option value="2017">2017</option>
 140+ <option value="2018">2018</option>
 141+ <option value="2019">2019</option>
 142+ <option value="2020">2020</option>
 143+ </select>
 144+ </div>
 145+ <div class="l">
 146+ <label class="label" for="cvv">Security code</label>
 147+ <input class="txt-sm" id="cvv" name="cvv" value="@cvv"/>
 148+ <a class="mute" href="#" id="where">Where?</a>
 149+ </div>
 150+
 151+ <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>
 152+ </dd>
 153+
 154+ <dt></dt>
 155+ <dd class="field">
 156+ <input id="submitcreditcard" class="btn" type="button" value="Submit donation" />
 157+ <p class="mute"><img alt="" src="@script_path/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif" /> Your credit card will be securely processed.</p>
 158+ </dd>
 159+ </dl>
 160+ <input type="hidden" name="gateway" value="payflowpro" id="gateway" />
 161+ <input type="hidden" name="returnto" value="Thank_You/en" />
 162+
 163+ <input type="hidden" value="@amount" name="amount" />
 164+ <input type="hidden" value="@country" name="country" id="country" />
 165+ <input type="hidden" value="@expiration" name="expiration" />
 166+ <input type="hidden" value="@currency_code" name="currency" />
 167+ <input type="hidden" value="@utm_source" name="utm_source"/>
 168+ <input type="hidden" value="@utm_medium" name="utm_medium"/>
 169+ <input type="hidden" value="@utm_campaign" name="utm_campaign"/>
 170+ <input type="hidden" value="@language" name="language"/>
 171+ <input type="hidden" value="@referrer" name="referrer"/>
 172+ <input type="hidden" value="@comment" name="comment"/>
 173+ <input type="hidden" value="@comment-option" name="comment-option"/>
 174+ <input type="hidden" value="@email-opt" name="email-opt"/>
 175+ <input type="hidden" value="processed" name="payment_method"/>
 176+ <input type="hidden" value="@token" name="token"/>
 177+ <input type="hidden" value="@order_id" name="order_id"/>
 178+ <input type="hidden" value="@numAttempt" name="numAttempt"/>
 179+ <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/>
 180+ <input type="hidden" value="@data_hash" name="data_hash"/>
 181+ <input type="hidden" value="@owa_session" name="owa_session"/>
 182+ <input type="hidden" value="@owa_ref" name="owa_ref"/>
 183+ </form>
 184+ </div>
 185+ </div>
 186+ </div>
 187+
 188+ </div>
 189+ </div>
 190+
 191+ <div class="call-r" style="float: none; margin: 15px 0 0 0; width: auto;">
 192+ <h3>Where your donation goes</h3>
 193+ <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>
 194+ <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>
 195+ </div>
 196+
 197+ <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>
 198+ <p><a href="https://www.mediawiki.org/wiki/Ways_to_Give/en">More information or other ways to give</a><br /><a href="https://www.mediawiki.org/wiki/FAQ/en">Answers to frequently asked questions</a></p>
 199+ </div>
 200+ </div>
 201+ <!-- load jquery 1.4.2 -->
 202+ <script type='text/javascript' src='@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery-1.4.2.min.js'></script>
 203+ <script type="text/javascript">
 204+ ( function( $ ){
 205+ window.onload = function (){
 206+ // set all jQuery instances to 1.4.2
 207+ jQuery = $;
 208+ $j = $;
 209+ $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ezpz_hint.min.js', function() {
 210+ $.getScript('@script_path/extensions/DonationInterface/payflowpro_gateway/forms/rapidhtml/js/jquery.ui.min.js', function() {
 211+ // Init accordion
 212+ $("#accordion").accordion({
 213+ autoHeight: false
 214+ });
 215+
 216+ // check for RapidHtml errors and display, if any
 217+ var errors = ['#general','#retryMsg','#amount','#card_num','#card','#cvv','#fname',
 218+ '#lname','#city','#country','#street','#state','#zip','#emailAdd'];
 219+
 220+ var count = 0;
 221+ for( var i=0; i < errors.length; i++ ){
 222+ if ( errors[i].length > 0 ){
 223+ count++;
 224+ if ( count > 1 )
 225+ $('#errorMessages').append('<br />');
 226+ $('#errorMessages').append(errors[i]);
 227+ }
 228+ }
 229+ if( count > 0 ){
 230+ // show the second step with the error
 231+ $("#accordion").accordion( "activate" , 1 );
 232+ }
 233+ // Inline labels
 234+ $(".hint").ezpz_hint();
 235+
 236+ $("#cc").click(function(){
 237+ if ( validateAmount(document.paypalcontribution) ){
 238+ showAmount( $("input[name=amount]") );
 239+ $("#accordion").accordion("activate", 1);
 240+ $("#change-amount").show();
 241+ }
 242+
 243+ });
 244+ $("#pp").click(function(){
 245+ if ( validateAmount(document.paypalcontribution) ){
 246+ // set the action to go to PayPal
 247+ $("input[name=gateway]").val("paypal");
 248+ document.paypalcontribution.action = "https://wikimediafoundation.org/wiki/Special:ContributionTracking/en";
 249+ $("#loading").html("<img src='../images/loading.gif' /> Redirecting to PayPal...")
 250+ document.paypalcontribution.submit();
 251+ }
 252+ });
 253+ $("#submitcreditcard").click(function(){
 254+ // set country to US
 255+ $("input[name=country]").val("US");
 256+
 257+ if ( validate_form(document.paypalcontribution) ){
 258+ // set expiration date
 259+ $("input[name=expiration]").val(
 260+ $("select[name=mos]").val() + $("select[name=year]").val().substring(2,4)
 261+ )
 262+
 263+ document.paypalcontribution.action = "@action";
 264+ document.paypalcontribution.submit()
 265+ }
 266+ })
 267+
 268+ // Fix behavior of images in labels
 269+ $("label img").live("click", function() { $("#" + $(this).parents("label").attr("for")).click(); });
 270+
 271+ // Display selected amount
 272+ function showAmount(e){ $("#selected-amount").html("($" + e.val() + ")"); }
 273+
 274+ // Set selected amount to amount
 275+ $("input[name=amountRadio]").click(function(){ setAmount($(this)); });
 276+ $("#other-amount").change(function(){ setAmount($(this)); });
 277+ function setAmount(e){ $("input[name=amount]").val(e.val()); }
 278+
 279+ // Security codes
 280+ $("#where").click(function(){
 281+ $("#codes").toggle();
 282+ return false;
 283+ });
 284+
 285+ function validateAmount(){
 286+ var minimums = {
 287+ 'USD' : 1,
 288+ }
 289+ var error = true;
 290+ var amount = $("input[name=amount]").val(); // get the amount
 291+ var otherAmount = amount // create a working copy
 292+ otherAmount = otherAmount.replace(/[,.](\d)$/, '\:$10');
 293+ otherAmount = otherAmount.replace(/[,.](\d)(\d)$/, '\:$1$2');
 294+ otherAmount = otherAmount.replace(/[,.]/g, '');
 295+ otherAmount = otherAmount.replace(/:/, '.');
 296+ amount = otherAmount; // idk, reset amount to working copy amount
 297+ $("input[name=amount]").val(amount); // set the new amount back into the form
 298+
 299+ // Check amount is a real number, sets error as true (good) if no issues
 300+ error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
 301+ // Check amount is at least the minimum
 302+ var currency = 'USD'; // hard-coded for these forms and tests
 303+ $("input[name=currency]").val(currency);
 304+ if ( typeof( minimums[currency] ) == 'undefined' ) {
 305+ minimums[currency] = 1;
 306+ }
 307+ if ( amount < minimums[currency] || error ) {
 308+ alert( 'You must contribute at least $1'.replace('$1', minimums[currency] + ' ' + currency ) );
 309+ error = true;
 310+ }
 311+ return !error;
 312+ }
 313+ });
 314+ });
 315+ }
 316+ })(jQuery);
 317+ </script>
 318+<!-- Wikimedia Project logo
 319+<li id="footer-copyrightico"><a href="https://www.mediawiki.org//wikimediafoundation.org/"><img src="//bits.wikimedia.org/images/wikimedia-button.png" width="88" height="31" alt="Wikimedia Foundation"/></a></li>
 320+ -->

Follow-up revisions

RevisionCommit summaryAuthorDate
r97402Fixing relative links per r97182. Fixing css includes per r97009. Adding im...pgehres04:07, 18 September 2011

Comments

#Comment by Awjrichards (talk | contribs)   21:51, 15 September 2011
 <p><a href="https://www.mediawiki.org/wiki/Ways_to_Give/en">More information or other ways to give</a><br /><a href="https://www.mediawiki.org/wiki/FAQ/en">Answers to frequently asked questions</a></p> 

The URL should be prefaced with @script_path (if it's a local resource) or full url - as is, this path will not work on payments.

Status & tagging log