r102152 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102151‎ | r102152 | r102153 >
Date:04:21, 6 November 2011
Author:pgehres
Status:ok
Tags:
Comment:
Adding BT form for GlobalCollect. Refactored JS to allow for common include of validation functions without any onpageload actions where not required.
Modified paths:
  • /trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php (modified) (history)
  • /trunk/extensions/DonationInterface/gateway_forms/rapidhtml/css/webitects2nd.css (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/bt (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/bt/bt.html (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd.html (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step-CA.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step.html (modified) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js (added) (history)
  • /trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php
@@ -64,17 +64,17 @@
6565 'localBasePath' => dirname( __FILE__ ),
6666 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath,
6767 );
68 -//$wgResourceModules[ 'di.form.rapidhtml.webitects.2nd' ] = array(
69 -// 'styles' => 'css/webitects2nd.css',
70 -// 'dependencies' => 'di.form.rapidhtml.webitects',
71 -// 'localBasePath' => dirname( __FILE__ ),
72 -// 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath,
73 -//);
 68+$wgResourceModules[ 'di.form.rapidhtml.webitects.2nd' ] = array(
 69+ 'styles' => 'css/webitects2nd.css',
 70+ 'dependencies' => 'di.form.rapidhtml.webitects',
 71+ 'localBasePath' => dirname( __FILE__ ),
 72+ 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath,
 73+);
7474
7575 // GlobalCollect
7676 $wgResourceModules[ 'gc.form.rapidhtml.webitects' ] = array(
77 - 'styles' => '', //'css/webitects_2_3step.css',
78 - 'scripts' => 'js/webitects_2_3step.js',
 77+ 'styles' => '',
 78+ 'scripts' => 'js/webitects.js',
7979 'dependencies' => 'di.form.rapidhtml.webitects',
8080 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
8181 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
@@ -87,15 +87,31 @@
8888 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
8989 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
9090 );
91 -//$wgResourceModules[ 'gc.form.rapidhtml.webitects.2nd' ] = array(
92 -// 'styles' => '',
93 -// 'dependencies' => array(
94 -// 'gc.form.rapidhtml.webitects',
95 -// 'di.form.rapidhtml.webitects.2nd'
96 -// ),
97 -// 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
98 -// 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
99 -//);
 91+$wgResourceModules[ 'gc.form.rapidhtml.webitects.1st' ] = array(
 92+ 'styles' => '',
 93+ 'scripts' => 'js/webitects_2_3step.js',
 94+ 'dependencies' => array(
 95+ 'gc.form.rapidhtml.webitects',
 96+ ),
 97+ 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
 98+ 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
 99+);
 100+$wgResourceModules[ 'gc.form.rapidhtml.webitects.2nd' ] = array(
 101+ 'styles' => '',
 102+ 'dependencies' => array(
 103+ 'gc.form.rapidhtml.webitects',
 104+ 'di.form.rapidhtml.webitects.2nd'
 105+ ),
 106+ 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
 107+ 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
 108+);
 109+$wgResourceModules[ 'gc.form.rapidhtml.webitects.bt' ] = array(
 110+ 'styles' => '',
 111+ 'scripts' => 'js/webitects.bt.js',
 112+ 'dependencies' => 'gc.form.rapidhtml.webitects.2nd',
 113+ 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms',
 114+ 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath,
 115+);
100116
101117 // PayflowPro
102118 $wgResourceModules[ 'pfp.form.rapidhtml.webitects' ] = array(
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/css/webitects2nd.css
@@ -0,0 +1,3 @@
 2+#step2wrapper, #step2header {
 3+ display: block !important;
 4+}
\ No newline at end of file
Property changes on: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/css/webitects2nd.css
___________________________________________________________________
Added: svn:eol-style
15 + native
Index: trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php
@@ -113,8 +113,9 @@
114114 if ( is_array( $form_errors['general'] ) && count( $form_errors['general'] ) ) {
115115 $general_errors = "";
116116 foreach ( $form_errors['general'] as $general_error ) {
117 - $general_errors .= "<p class='creditcard'>$general_error</p>";
 117+ $general_errors .= "$general_error<br />";
118118 }
 119+
119120 $form_errors['general'] = $general_errors;
120121 }
121122
@@ -183,7 +184,8 @@
184185 }
185186 $escape_errors = array();
186187 foreach ( $this->form_errors as $error ) {
187 - $escape_errors[] = addslashes($error);
 188+ $error_c = str_replace( array("\r\n", "\n", "\r"), " ", $error );
 189+ $escape_errors[] = addslashes($error_c);
188190 }
189191 $form = str_replace($escape_error_tokens, $escape_errors, $form);
190192
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd.html
@@ -0,0 +1,134 @@
 2+<script type="text/javascript">
 3+ mw.loader.load('gc.form.rapidhtml.webitects.2nd');
 4+ // these must go through RapidHTML and thus are inline
 5+ var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape'];
 6+ var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape'];
 7+ var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
 8+ var actionURL = "@action";
 9+ var scriptPath = "@script_path";
 10+</script>
 11+<!--[if lt IE 7]>
 12+<script type="text/javascript">
 13+ mw.loader.load('gc.form.rapidhtml.webitects.ie6');
 14+</script>
 15+<style type="text/css">
 16+ body{
 17+ behavior: url("@script_path/skins/vector/csshover.min.htc");
 18+ }
 19+</style><![endif]-->
 20+<!--[if IE 7]>
 21+<style>
 22+ .gainlayout {
 23+ zoom: 1;
 24+ height: 1%;
 25+ }
 26+</style>
 27+<![endif]-->
 28+
 29+<div class="ltr">
 30+ <table id="layouttable">
 31+ <tr>
 32+ <td>
 33+ <div id="appeal">
 34+ <div id="appeal-content">
 35+ <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2>
 36+ <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div>
 37+ </div>
 38+ </div>
 39+ </td>
 40+ <td>
 41+ <div id="donate">
 42+ <div id="donate-content">
 43+ <div id="donate-body" style="padding: 0 1em;">
 44+ <form method="post" name="paypalcontribution">
 45+ <div id="step1header"><h3>%donate_interface-amount-legend% <span id="selected-amount">@amount @currency_code</span></h3></div>
 46+ <div id="step2header"><h3>%donate_interface-billing-address% <span class="mute" id="change-billing" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 47+ <div id="step2wrapper">
 48+ <div id="billing-content" class="gainlayout">
 49+ <div id="billingErrorMessages" class="small"></div>
 50+ <div class="name-fields">
 51+ <span class="name-first"><input class="txt" id="fname" name="fname" title="%donate_interface-donor-fname%" value="@fname" placeholder="%donate_interface-donor-fname%"/></span>
 52+ <span class="name-last"><input class="txt" id="lname" name="lname" title="%donate_interface-donor-lname%" value="@lname" placeholder="%donate_interface-donor-lname%"/></span>
 53+ </div>
 54+ <div class="loc-fields">
 55+ <span class="loc-street"><input class="txt" id="street" name="street" title="%donate_interface-donor-street%" value="@street" placeholder="%donate_interface-donor-street%"/></span>
 56+ <span class="loc-city"><input class="txt" id="city" name="city" title="%donate_interface-donor-city%" value="@city" placeholder="%donate_interface-donor-city%"/></span>
 57+ <span class="loc-state">
 58+ <select id="state" name="state" class="txt" value="@state" >
 59+ <option value=""></option>
 60+ <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>
 61+ </select>
 62+ </span>
 63+ <span class="loc-postal"><input class="txt" id="zip" name="zip" title="%donate_interface-zip%" value="@zip" placeholder="%donate_interface-donor-zip%"/></span> <!-- TODO: use postal code on non-US -->
 64+ </div>
 65+ <p><input class="txt" title="%donate_interface-donor-email%" id="emailAdd" name="emailAdd" value="@emailAdd" placeholder="%donate_interface-donor-email%"/></p>
 66+
 67+ <dl class="">
 68+ <dt><span id="select-credit-card" class="label">%donate_interface-select-credit-card%</span></dt>
 69+ <dd class="field" style="margin-bottom: 0;">
 70+ <ul class="options-h" id="cards" style="margin: 0;">
 71+ <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/gateway_forms/includes/card-visa.png" /></label></li>
 72+ <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/gateway_forms/includes/card-mastercard.png" /></label></li>
 73+ <!--<li><input id="cc-amex" name="cardtype" type="radio" value="american" class="cardradio" /> <label for="cc-amex"><img alt="American Express" src="@script_path/extensions/DonationInterface/gateway_forms/includes/card-amex.png" /></label></li>-->
 74+ <!--<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/gateway_forms/includes/card-discover.png" /></label></li>-->
 75+ </ul>
 76+ <div id="paymentContinue" style="margin-top: 10px; display: none;"> <input class="btn" id="paymentContinueBtn" type="button" value="%donate_interface-continue%" /></div>
 77+ </dd>
 78+ </dl>
 79+ </div>
 80+ </div>
 81+ <div id="step3header"><h3>%donate_interface-cc-form-header-payment% <span class="mute" id="change-payment" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 82+ <div id="step3wrapper" style="display: none;">
 83+ <div id="payment" class="gainlayout" style="height:314px;text-align:center;"></div>
 84+ </div>
 85+
 86+ <input type="hidden" name="returnto" value="Thank_You/en" />
 87+ <input type="hidden" value="0" name="PaypalRedirect" id="PaypalRedirect">
 88+
 89+ <input type="hidden" value="@amount" name="amount" />
 90+ <input type="hidden" value="@country" name="country" id="country" />
 91+ <input type="hidden" value="@currency_code" name="currency_code" />
 92+ <input type="hidden" value="@utm_source" name="utm_source"/>
 93+ <input type="hidden" value="@utm_medium" name="utm_medium"/>
 94+ <input type="hidden" value="@utm_campaign" name="utm_campaign"/>
 95+ <input type="hidden" value="@language" name="language"/>
 96+ <input type="hidden" value="@referrer" name="referrer"/>
 97+ <input type="hidden" value="@comment" name="comment"/>
 98+ <input type="hidden" value="@comment-option" name="comment-option"/>
 99+ <input type="hidden" value="1" name="email-opt"/>
 100+ <input type="hidden" value="@token" name="token"/>
 101+ <input type="hidden" value="@order_id" name="order_id"/>
 102+ <input type="hidden" value="@numAttempt" name="numAttempt"/>
 103+ <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/>
 104+ <input type="hidden" value="@data_hash" name="data_hash"/>
 105+ <input type="hidden" value="@owa_session" name="owa_session"/>
 106+ <input type="hidden" value="@owa_ref" name="owa_ref"/>
 107+ <!-- new required fields -->
 108+ <input type="hidden" value="@gateway" name="gateway"/>
 109+ <input type="hidden" value="@payment_method" name="payment_method"/>
 110+ </form>
 111+ <div id="where-content">
 112+ {{LanguageSwitch|2011FR/core-appeal-whitebox-nodiv|@language}}
 113+ </div>
 114+ </div>
 115+ </div>
 116+ <p id="informationsharing">%donate_interface-informationsharing|url%</p>
 117+ <!-- TODO: links inside the message or not? -->
 118+ <ul id="moreinfolinks">
 119+ <li><a href="http://wikimediafoundation.org/wiki/Monthly_donations/en/US">%donate_interface-monthly-donation%</a></li><!-- TODO: localize the link -->
 120+ <li>%donate_interface-otherways-short|url%</li><!-- TODO: localize the link -->
 121+ <li><a href="http://wikimediafoundation.org/wiki/FAQ/en">%donate_interface-faqs%</a></li><!-- TODO: localize the link -->
 122+ <!--<li><a href="">%donate_interface-tax-info%</a></li>--><!-- TODO: localize the link -->
 123+ </ul>
 124+ </div>
 125+ </td>
 126+ </tr>
 127+ </table>
 128+
 129+
 130+
 131+</div>
 132+
 133+<!-- Wikimedia Project logo
 134+<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>
 135+ -->
Property changes on: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects2nd.html
___________________________________________________________________
Added: svn:eol-style
1136 + native
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/bt/bt.html
@@ -0,0 +1,125 @@
 2+<script type="text/javascript">
 3+ mw.loader.load('gc.form.rapidhtml.webitects.bt');
 4+ // these must go through RapidHTML and thus are inline
 5+ var amountErrors = ["#general|escape",'#retryMsg|escape','#amount|escape'];
 6+ var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape'];
 7+ var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape'];
 8+ var actionURL = "@action";
 9+ var scriptPath = "@script_path";
 10+</script>
 11+<!--[if lt IE 7]>
 12+<script type="text/javascript">
 13+ mw.loader.load('gc.form.rapidhtml.webitects.ie6');
 14+</script>
 15+<style type="text/css">
 16+ body{
 17+ behavior: url("@script_path/skins/vector/csshover.min.htc");
 18+ }
 19+</style><![endif]-->
 20+<!--[if IE 7]>
 21+<style>
 22+ .gainlayout {
 23+ zoom: 1;
 24+ height: 1%;
 25+ }
 26+</style>
 27+<![endif]-->
 28+
 29+<div class="ltr">
 30+ <table id="layouttable">
 31+ <tr>
 32+ <td>
 33+ <div id="appeal">
 34+ <div id="appeal-content">
 35+ <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2>
 36+ <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div>
 37+ </div>
 38+ </div>
 39+ </td>
 40+ <td>
 41+ <div id="donate">
 42+ <div id="donate-content">
 43+ <div id="donate-body" style="padding: 0 1em;">
 44+ <form method="post" name="paypalcontribution">
 45+ <div id="step1header"><h3>%donate_interface-amount-legend% <span id="selected-amount">@amount @currency_code</span></h3></div>
 46+ <div id="amtErrorMessages" class="small"></div>
 47+ <div id="step2header"><h3>%donate_interface-billing-address% <span class="mute" id="change-billing" style="display: none;">(<a href="#">%donate_interface-change%</a>)</span></h3></div>
 48+ <div id="step2wrapper">
 49+ <div id="billing-content" class="gainlayout">
 50+ <div id="billingErrorMessages" class="small"></div>
 51+ <div id="paymentErrorMessages" class="small"></div>
 52+ <div class="name-fields">
 53+ <span class="name-first"><input class="txt" id="fname" name="fname" title="%donate_interface-donor-fname%" value="@fname" placeholder="%donate_interface-donor-fname%"/></span>
 54+ <span class="name-last"><input class="txt" id="lname" name="lname" title="%donate_interface-donor-lname%" value="@lname" placeholder="%donate_interface-donor-lname%"/></span>
 55+ </div>
 56+ <div class="loc-fields">
 57+ <span class="loc-street"><input class="txt" id="street" name="street" title="%donate_interface-donor-street%" value="@street" placeholder="%donate_interface-donor-street%"/></span>
 58+ <span class="loc-city"><input class="txt" id="city" name="city" title="%donate_interface-donor-city%" value="@city" placeholder="%donate_interface-donor-city%"/></span>
 59+ <span class="loc-state">
 60+ <select id="state" name="state" class="txt" value="@state" >
 61+ <option value=""></option>
 62+ <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>
 63+ </select>
 64+ </span>
 65+ <span class="loc-postal"><input class="txt" id="zip" name="zip" title="%donate_interface-zip%" value="@zip" placeholder="%donate_interface-donor-zip%"/></span> <!-- TODO: use postal code on non-US -->
 66+ </div>
 67+ <p><input class="txt" title="%donate_interface-donor-email%" id="emailAdd" name="emailAdd" value="@emailAdd" placeholder="%donate_interface-donor-email%"/></p>
 68+ <div id="bt-continue" style="margin-top: 10px;"> <input class="btn" id="bt-continueBtn" type="button" value="%donate_interface-continue%" /></div>
 69+ </div>
 70+ </div>
 71+
 72+
 73+
 74+ <input type="hidden" name="returnto" value="Thank_You/en" />
 75+ <input type="hidden" value="0" name="PaypalRedirect" id="PaypalRedirect">
 76+
 77+ <input type="hidden" value="@amount" name="amount" />
 78+ <input type="hidden" value="@country" name="country" id="country" />
 79+ <input type="hidden" value="@currency_code" name="currency_code" />
 80+ <input type="hidden" value="@utm_source" name="utm_source"/>
 81+ <input type="hidden" value="@utm_medium" name="utm_medium"/>
 82+ <input type="hidden" value="@utm_campaign" name="utm_campaign"/>
 83+ <input type="hidden" value="@language" name="language"/>
 84+ <input type="hidden" value="@referrer" name="referrer"/>
 85+ <input type="hidden" value="@comment" name="comment"/>
 86+ <input type="hidden" value="@comment-option" name="comment-option"/>
 87+ <input type="hidden" value="1" name="email-opt"/>
 88+ <input type="hidden" value="@token" name="token"/>
 89+ <input type="hidden" value="@order_id" name="order_id"/>
 90+ <input type="hidden" value="@numAttempt" name="numAttempt"/>
 91+ <input type="hidden" value="@contribution_tracking_id" name="contribution_tracking_id"/>
 92+ <input type="hidden" value="@data_hash" name="data_hash"/>
 93+ <input type="hidden" value="@owa_session" name="owa_session"/>
 94+ <input type="hidden" value="@owa_ref" name="owa_ref"/>
 95+ <!-- new required fields -->
 96+ <input type="hidden" value="@gateway" name="gateway"/>
 97+ <input type="hidden" value="@payment_method" name="payment_method"/>
 98+ <!-- required fields for bt and dd -->
 99+ <input type="hidden" value="bt" name="payment_method"/>
 100+ <input type="hidden" value="bt" name="payment_submethod"/>
 101+ </form>
 102+ <div id="where-content">
 103+ {{LanguageSwitch|2011FR/core-appeal-whitebox-nodiv|@language}}
 104+ </div>
 105+ </div>
 106+ </div>
 107+ <p id="informationsharing">%donate_interface-informationsharing|url%</p>
 108+ <!-- TODO: links inside the message or not? -->
 109+ <ul id="moreinfolinks">
 110+ <li><a href="http://wikimediafoundation.org/wiki/Monthly_donations/en/US">%donate_interface-monthly-donation%</a></li><!-- TODO: localize the link -->
 111+ <li>%donate_interface-otherways-short|url%</li><!-- TODO: localize the link -->
 112+ <li><a href="http://wikimediafoundation.org/wiki/FAQ/en">%donate_interface-faqs%</a></li><!-- TODO: localize the link -->
 113+ <!--<li><a href="">%donate_interface-tax-info%</a></li>--><!-- TODO: localize the link -->
 114+ </ul>
 115+ </div>
 116+ </td>
 117+ </tr>
 118+ </table>
 119+
 120+
 121+
 122+</div>
 123+
 124+<!-- Wikimedia Project logo
 125+<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>
 126+ -->
Property changes on: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/bt/bt.html
___________________________________________________________________
Added: svn:eol-style
1127 + native
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step.html
@@ -1,5 +1,5 @@
22 <script type="text/javascript">
3 - mw.loader.load('gc.form.rapidhtml.webitects');
 3+ mw.loader.load('gc.form.rapidhtml.webitects.1st');
44 // these must go through RapidHTML and thus are inline
55 var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape'];
66 var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape'];
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step-CA.html
@@ -1,5 +1,5 @@
22 <script type="text/javascript">
3 - mw.loader.load('gc.form.rapidhtml.webitects');
 3+ mw.loader.load('gc.form.rapidhtml.webitects.1st');
44 // these must go through RapidHTML and thus are inline
55 var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape'];
66 var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape'];
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects_2_3step.js
@@ -138,69 +138,7 @@
139139
140140 } );
141141
142 -function displayCreditCardForm() {
143 - $( '#payment' ).empty();
144 - // Load wait spinner
145 - $( '#payment' ).append( '<br/><br/><br/><img alt="loading" src="'+mw.config.get( 'wgScriptPath' )+'/extensions/DonationInterface/gateway_forms/includes/loading-white.gif" />' );
146 - showStep3(); // Open the 3rd section
147 - var language = 'en'; // default value is English
148 - var matches = document.location.href.match(/uselang=(\w+)/i); // fine the real language
149 - if ( matches && matches[1] ) {
150 - language = matches[1];
151 - }
152 - var sendData = {
153 - 'action': 'donate',
154 - 'gateway': 'globalcollect',
155 - 'currency': $( "input[name='currency_code']" ).val(),
156 - 'amount': $( "input[name='amount']" ).val(),
157 - 'fname': $( "input[name='fname']" ).val(),
158 - 'lname': $( "input[name='lname']" ).val(),
159 - 'street': $( "input[name='street']" ).val(),
160 - 'city': $( "input[name='city']" ).val(),
161 - 'state': $( "input[name='state']" ).val(),
162 - 'zip': $( "input[name='zip']" ).val(),
163 - 'emailAdd': $( "input[name='emailAdd']" ).val(),
164 - 'country': $( "input[name='country']" ).val(),
165 - 'payment_method': 'cc',
166 - 'language': language,
167 - 'card_type': $( "input[name='cardtype']:checked" ).val().toLowerCase(),
168 - 'contribution_tracking_id': $( "input[name='contribution_tracking_id']" ).val(),
169 - 'numAttempt': $( "input[name='numAttempt']" ).val(),
170 - 'utm_source': $( "input[name='utm_source']" ).val(),
171 - 'utm_campaign': $( "input[name='utm_campaign']" ).val(),
172 - 'utm_medium': $( "input[name='utm_medium']" ).val(),
173 - 'format': 'json'
174 - };
175 - $.ajax( {
176 - 'url': mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php?',
177 - 'data': sendData,
178 - 'dataType': 'json',
179 - 'type': 'GET',
180 - 'success': function( data ) {
181 - if ( typeof data.result !== 'undefined' ) {
182 - if ( data.result.errors ) {
183 - var errors = new Array();
184 - $.each( data.result.errors, function( index, value ) {
185 - alert( value ); // Show them the error
186 - $( "#paymentContinue" ).show(); // Show continue button in 2nd section
187 - showStep2(); // Switch back to 2nd section of form
188 - } );
189 - } else {
190 - if ( data.result.formaction ) {
191 - $( '#payment' ).empty();
192 - // Insert the iframe into the form
193 - $( '#payment' ).append(
194 - '<iframe src="'+data.result.formaction+'" width="318" height="314" frameborder="0"></iframe>'
195 - );
196 -
197 - }
198 - }
199 - }
200 - }
201 - } );
202 -}
203 -
204 -function showStep1() {
 142+window.showStep1 = function() {
205143 // show the correct sections
206144 $( "#step1wrapper" ).slideDown();
207145 $( "#step2wrapper" ).slideUp();
@@ -211,7 +149,7 @@
212150 $( "#step1header" ).show(); // just in case
213151 }
214152
215 -function showStep2() {
 153+window.showStep2 = function() {
216154 if ( $( '#step3wrapper' ).is(":visible") ) {
217155 $( "#paymentContinue" ).show(); // Show continue button in 2nd section
218156 }
@@ -225,7 +163,7 @@
226164 $( "#step2header" ).show(); // just in case
227165 }
228166
229 -function showStep3() {
 167+window.showStep3 = function() {
230168 // show the correct sections
231169 $( "#step1wrapper" ).slideUp();
232170 $( "#step2wrapper" ).slideUp();
@@ -238,71 +176,3 @@
239177 // Fix behavior of images in labels
240178 // TODO: check that disabling this is okay in things other than Chrome
241179 // $("label img").live("click", function() { $("#" + $(this).parents( "label" ).attr( "for" )).click(); });
242 -
243 -// set the hidden amount input to the value of the selected element
244 -function setAmount( e ) {
245 - $( 'input[name="amount"]' ).val( e.val() );
246 -}
247 -// Display selected amount
248 -function showAmount( e ) {
249 - $( "#selected-amount" ).html( "($" + e.val() + ")" );
250 - $( "#change-amount" ).show();
251 -}
252 -function validateAmount() {
253 -
254 - // TODO: THIS NEEDS TO BE REPLACED WITH KALDARI'S CURRENCIES
255 - var minimums = {
256 - 'USD' : 1,
257 - 'CAD' : 1
258 - };
259 - var error = true;
260 - var amount = $( 'input[name="amount"]' ).val(); // get the amount
261 - amount = amount.replace( /[,.](\d)$/, '\:$10' );
262 - amount = amount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
263 - amount = amount.replace( /[,.]/g, '' );
264 - amount = amount.replace( /:/, '.' );
265 - $( 'input[name="amount"]' ).val( amount ); // set the new amount back into the form
266 -
267 - // Check amount is a real number, sets error as true (good) if no issues
268 - error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
269 -
270 - // Check amount is at least the minimum
271 - var currency_code = $( 'input[name="currency_code"]' ).val();
272 - if ( typeof( minimums[currency_code] ) == 'undefined' ) {
273 - minimums[currency_code] = 1;
274 - }
275 - if ( amount < minimums[currency_code] || error ) {
276 - alert( 'You must contribute at least $1'.replace( '$1', minimums[currency_code] + ' ' + currency_code ) );
277 - error = true;
278 - }
279 - return !error;
280 -}
281 -
282 -function validate_cc() {
283 - // reset the errors
284 - $( "#paymentErrorMessages" ).html( '' );
285 - var error = false;
286 - if ( $( 'input[name="card_num"]' ).val() == '' ) {
287 - $( "#paymentErrorMessages" ).append( "Please enter a valid credit card number" );
288 - error = true;
289 - }
290 - if ( $( 'select[name="mos"]' ).val() == '' ) {
291 - if ( $( "#paymentErrorMessages" ).html() != "" )
292 - $( "#paymentErrorMessages" ).append( "<br />" );
293 - $( "#paymentErrorMessages" ).append( "Please enter a valid month for the expiration date" );
294 - error = true;
295 - }
296 - if ( $( 'select[name="year"]' ).val() == '' ) {
297 - if ( $( "#paymentErrorMessages" ).html() != "" )
298 - $( "#paymentErrorMessages" ).append( "<br />" );
299 - $( "#paymentErrorMessages" ).append( "Please enter a valid year for the expiration date" );
300 - error = true;
301 - }
302 - if ( $( 'input[name="cvv"]' ).val() == '' ) {
303 - if ( $( "#paymentErrorMessages" ).html() != "" )
304 - $( "#paymentErrorMessages" ).append( "<br />" );
305 - $( "#paymentErrorMessages" ).append( "Please enter a valid security code" );
306 - error = true;
307 - }
308 - return !error;
309 -}
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
@@ -0,0 +1,131 @@
 2+
 3+window.displayCreditCardForm = function() {
 4+ $( '#payment' ).empty();
 5+ // Load wait spinner
 6+ $( '#payment' ).append( '<br/><br/><br/><img alt="loading" src="'+mw.config.get( 'wgScriptPath' )+'/extensions/DonationInterface/gateway_forms/includes/loading-white.gif" />' );
 7+ showStep3(); // Open the 3rd section
 8+ var language = 'en'; // default value is English
 9+ var matches = document.location.href.match(/uselang=(\w+)/i); // fine the real language
 10+ if ( matches && matches[1] ) {
 11+ language = matches[1];
 12+ }
 13+ var sendData = {
 14+ 'action': 'donate',
 15+ 'gateway': 'globalcollect',
 16+ 'currency': $( "input[name='currency_code']" ).val(),
 17+ 'amount': $( "input[name='amount']" ).val(),
 18+ 'fname': $( "input[name='fname']" ).val(),
 19+ 'lname': $( "input[name='lname']" ).val(),
 20+ 'street': $( "input[name='street']" ).val(),
 21+ 'city': $( "input[name='city']" ).val(),
 22+ 'state': $( "input[name='state']" ).val(),
 23+ 'zip': $( "input[name='zip']" ).val(),
 24+ 'emailAdd': $( "input[name='emailAdd']" ).val(),
 25+ 'country': $( "input[name='country']" ).val(),
 26+ 'payment_method': 'cc',
 27+ 'language': language,
 28+ 'card_type': $( "input[name='cardtype']:checked" ).val().toLowerCase(),
 29+ 'contribution_tracking_id': $( "input[name='contribution_tracking_id']" ).val(),
 30+ 'numAttempt': $( "input[name='numAttempt']" ).val(),
 31+ 'utm_source': $( "input[name='utm_source']" ).val(),
 32+ 'utm_campaign': $( "input[name='utm_campaign']" ).val(),
 33+ 'utm_medium': $( "input[name='utm_medium']" ).val(),
 34+ 'format': 'json'
 35+ };
 36+ $.ajax( {
 37+ 'url': mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php?',
 38+ 'data': sendData,
 39+ 'dataType': 'json',
 40+ 'type': 'GET',
 41+ 'success': function( data ) {
 42+ if ( typeof data.result !== 'undefined' ) {
 43+ if ( data.result.errors ) {
 44+ var errors = new Array();
 45+ $.each( data.result.errors, function( index, value ) {
 46+ alert( value ); // Show them the error
 47+ $( "#paymentContinue" ).show(); // Show continue button in 2nd section
 48+ showStep2(); // Switch back to 2nd section of form
 49+ } );
 50+ } else {
 51+ if ( data.result.formaction ) {
 52+ $( '#payment' ).empty();
 53+ // Insert the iframe into the form
 54+ $( '#payment' ).append(
 55+ '<iframe src="'+data.result.formaction+'" width="318" height="314" frameborder="0"></iframe>'
 56+ );
 57+
 58+ }
 59+ }
 60+ }
 61+ }
 62+ } );
 63+}
 64+
 65+
 66+// set the hidden amount input to the value of the selected element
 67+window.setAmount = function( e ) {
 68+ $( 'input[name="amount"]' ).val( e.val() );
 69+}
 70+// Display selected amount
 71+window.showAmount = function( e ) {
 72+ $( "#selected-amount" ).html( "($" + e.val() + ")" );
 73+ $( "#change-amount" ).show();
 74+}
 75+window.validateAmount = function() {
 76+
 77+ // TODO: THIS NEEDS TO BE REPLACED WITH KALDARI'S CURRENCIES
 78+ var minimums = {
 79+ 'USD' : 1,
 80+ 'CAD' : 1
 81+ };
 82+ var error = true;
 83+ var amount = $( 'input[name="amount"]' ).val(); // get the amount
 84+ amount = amount.replace( /[,.](\d)$/, '\:$10' );
 85+ amount = amount.replace( /[,.](\d)(\d)$/, '\:$1$2' );
 86+ amount = amount.replace( /[,.]/g, '' );
 87+ amount = amount.replace( /:/, '.' );
 88+ $( 'input[name="amount"]' ).val( amount ); // set the new amount back into the form
 89+
 90+ // Check amount is a real number, sets error as true (good) if no issues
 91+ error = ( amount == null || isNaN( amount ) || amount.value <= 0 );
 92+
 93+ // Check amount is at least the minimum
 94+ var currency_code = $( 'input[name="currency_code"]' ).val();
 95+ if ( typeof( minimums[currency_code] ) == 'undefined' ) {
 96+ minimums[currency_code] = 1;
 97+ }
 98+ if ( amount < minimums[currency_code] || error ) {
 99+ alert( 'You must contribute at least $1'.replace( '$1', minimums[currency_code] + ' ' + currency_code ) );
 100+ error = true;
 101+ }
 102+ return !error;
 103+}
 104+
 105+window.validate_cc = function() {
 106+ // reset the errors
 107+ $( "#paymentErrorMessages" ).html( '' );
 108+ var error = false;
 109+ if ( $( 'input[name="card_num"]' ).val() == '' ) {
 110+ $( "#paymentErrorMessages" ).append( "Please enter a valid credit card number" );
 111+ error = true;
 112+ }
 113+ if ( $( 'select[name="mos"]' ).val() == '' ) {
 114+ if ( $( "#paymentErrorMessages" ).html() != "" )
 115+ $( "#paymentErrorMessages" ).append( "<br />" );
 116+ $( "#paymentErrorMessages" ).append( "Please enter a valid month for the expiration date" );
 117+ error = true;
 118+ }
 119+ if ( $( 'select[name="year"]' ).val() == '' ) {
 120+ if ( $( "#paymentErrorMessages" ).html() != "" )
 121+ $( "#paymentErrorMessages" ).append( "<br />" );
 122+ $( "#paymentErrorMessages" ).append( "Please enter a valid year for the expiration date" );
 123+ error = true;
 124+ }
 125+ if ( $( 'input[name="cvv"]' ).val() == '' ) {
 126+ if ( $( "#paymentErrorMessages" ).html() != "" )
 127+ $( "#paymentErrorMessages" ).append( "<br />" );
 128+ $( "#paymentErrorMessages" ).append( "Please enter a valid security code" );
 129+ error = true;
 130+ }
 131+ return !error;
 132+}
\ No newline at end of file
Property changes on: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js
___________________________________________________________________
Added: svn:eol-style
1133 + native
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js
@@ -0,0 +1,47 @@
 2+
 3+$( document ).ready( function () {
 4+
 5+ // check for RapidHtml errors and display, if any
 6+ var amountErrorString = "",
 7+ billingErrorString = "",
 8+ paymentErrorString = "";
 9+
 10+ // generate formatted errors to display
 11+ var temp = [];
 12+ for ( var e in amountErrors )
 13+ if ( amountErrors[e] != "" )
 14+ temp[temp.length] = amountErrors[e];
 15+ amountErrorString = temp.join( "<br />" );
 16+
 17+ temp = [];
 18+ for ( var f in billingErrors )
 19+ if ( billingErrors[f] != "" )
 20+ temp[temp.length] = billingErrors[f];
 21+ billingErrorString = temp.join( "<br />" );
 22+
 23+ temp = [];
 24+ for ( var g in paymentErrors )
 25+ if ( paymentErrors[g] != "" )
 26+ temp[temp.length] = paymentErrors[g];
 27+ paymentErrorString = temp.join( "<br />" );
 28+
 29+ // show the errors
 30+ var prevError = false;
 31+ if ( amountErrorString != "" ) {
 32+ $( "#amtErrorMessages" ).html( amountErrorString );
 33+ }
 34+ if ( billingErrorString != "" ) {
 35+ $( "#billingErrorMessages" ).html( billingErrorString );
 36+ showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show
 37+ }
 38+ if ( paymentErrorString != "" ) {
 39+ $( "#paymentErrorMessages" ).html( paymentErrorString );
 40+ showAmount( $( 'input[name="amount"]' ) ); // lets go ahead and assume there is something to show
 41+ }
 42+ $( "#bt-continueBtn" ).live( "click", function() {
 43+ if ( validate_personal( document.paypalcontribution ) ) {
 44+ document.paypalcontribution.action = actionURL;
 45+ document.paypalcontribution.submit();
 46+ }
 47+ } );
 48+} );
\ No newline at end of file
Property changes on: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.bt.js
___________________________________________________________________
Added: svn:eol-style
149 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r102236MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:06, 7 November 2011
r102237MFT r90286, r100671, r100837, r100950, r101060, r101063, r101064, r101073, r1......khorn03:07, 7 November 2011

Status & tagging log