Index: trunk/extensions/DonationInterface/donationinterface.php |
— | — | @@ -585,6 +585,7 @@ |
586 | 586 | |
587 | 587 | $wgResourceModules[ 'ext.donationInterface.errorMessages' ] = array( |
588 | 588 | 'messages' => array( |
| 589 | + 'donate_interface-error-msg-general', |
589 | 590 | 'donate_interface-error-msg-js', |
590 | 591 | 'donate_interface-error-msg-invalid-amount', |
591 | 592 | 'donate_interface-error-msg-email', |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/lightbox1.html |
— | — | @@ -1,10 +1,12 @@ |
2 | 2 | <!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins-1.17/vector/csshover.min.htc")}</style><![endif]--> |
3 | 3 | <script type="text/javascript"> |
4 | | -mw.loader.load( 'jquery.ui.button' ); |
5 | | -mw.loader.load( 'jquery.ui.dialog' ); |
6 | | -var extensionPath = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/DonationInterface'; |
7 | | -mw.loader.load( extensionPath + '/payflowpro_gateway/forms/js/lightbox1.js', 'text/javascript' ); |
8 | | -mw.loader.load( extensionPath + '/payflowpro_gateway/forms/css/lightbox1.css', 'text/css' ); |
| 4 | +mw.loader.load('pfp.form.rapidhtml.lightbox'); |
| 5 | +// these must go through RapidHTML and thus are inline |
| 6 | +var amountErrors = ['#general|escape','#retryMsg|escape','#amount|escape']; |
| 7 | +var billingErrors = ['#fname|escape','#lname|escape','#city|escape','#country|escape','#street|escape','#state|escape','#zip|escape','#emailAdd|escape']; |
| 8 | +var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape']; |
| 9 | +var actionURL = "@action"; |
| 10 | +var scriptPath = "@script_path"; |
9 | 11 | </script> |
10 | 12 | |
11 | 13 | <div class="ltr"> |
— | — | @@ -16,7 +18,7 @@ |
17 | 19 | |
18 | 20 | <form method="post" name="paypalcontribution"> |
19 | 21 | <div style="display: block;" id="amount-content"> |
20 | | - |
| 22 | + <div id="amtErrorMessages" class="small"></div> |
21 | 23 | <table id="amount-table"> |
22 | 24 | <tr> |
23 | 25 | <td><label><input type="radio" name="amountRadio" value="5" /> $5</label></td> |
— | — | @@ -54,40 +56,8 @@ |
55 | 57 | </div> |
56 | 58 | </div> |
57 | 59 | |
58 | | - <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2> |
59 | | - <div id="appeal-body" class="plainlinks"> |
60 | | - <p>I feel like I'm living the first line of my obituary.</p> |
61 | | - <p>I don't think there will be anything else that I do in my |
62 | | - life as important as what I do now for Wikipedia. We're not just |
63 | | -building an encyclopedia, we're working to make people free. When we |
64 | | -have access to free knowledge, we are better people. We understand the |
65 | | -world is bigger than us, and we become infected with tolerance and |
66 | | -understanding.</p> |
67 | | - <p>Wikipedia is the 5th largest website in the world. I work |
68 | | - at the small non-profit that keeps it on the web. We don't run ads |
69 | | -because doing so would sacrifice our independence. The site is not and |
70 | | -should never be a propaganda tool.</p> |
71 | | - <p>Our work is possible because of donations from our |
72 | | -readers. Will you help protect Wikipedia by donating $5, $10, $20 or |
73 | | -whatever you can afford?</p> |
74 | | - <p>I work at the Wikimedia Foundation because everything in |
75 | | -my soul tells me it's the right thing to do. I've worked at huge tech |
76 | | -companies, doing some job to build some crappy thing that's designed to |
77 | | -steal money from some kid who doesn't know it. I would come home from |
78 | | -work crushed.</p> |
79 | | - <p>You might not know this, but the Wikimedia Foundation |
80 | | -operates with a very small staff. Most other top-ten sites have tens of |
81 | | -thousands of people and massive budgets. But they produce a fraction of |
82 | | -what we pull off with sticks and wire.</p> |
83 | | - <p>When you give to Wikipedia, you're supporting free |
84 | | -knowledge around the world. You're not only leaving a legacy for your |
85 | | -children and for their children, you're elevating people around the |
86 | | -world who have access to this treasure. You're assuring that one day |
87 | | -everyone else will too.</p> |
88 | | - <p>Thank you,</p> |
89 | | - <p><strong>Brandon Harris</strong><br></p> |
90 | | - <p>Programmer, Wikimedia Foundation</p> |
91 | | - </div> |
| 60 | + <h2 id="appeal-head"> <span class="mw-headline">{{LanguageSwitch|2011FR/@appeal-title|@language}}</span></h2> |
| 61 | + <div id="appeal-body" class="plainlinks">{{LanguageSwitch|2011FR/@appeal|@language}}</div> |
92 | 62 | </div> |
93 | 63 | </div> |
94 | 64 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/js/lightbox1.js |
— | — | @@ -1,5 +1,45 @@ |
2 | | -$(function() { |
| 2 | +$( document ).ready( function () { |
3 | 3 | |
| 4 | + // check for RapidHtml errors and display, if any |
| 5 | + var amountErrorString = ""; |
| 6 | + var billingErrorString = ""; |
| 7 | + var paymentErrorString = ""; |
| 8 | + |
| 9 | + // generate formatted errors to display |
| 10 | + var temp = []; |
| 11 | + for ( var e in amountErrors ) |
| 12 | + if ( amountErrors[e] != "" ) |
| 13 | + temp[temp.length] = amountErrors[e]; |
| 14 | + amountErrorString = temp.join( "<br />" ); |
| 15 | + |
| 16 | + temp = []; |
| 17 | + for ( var f in billingErrors ) |
| 18 | + if ( billingErrors[f] != "" ) |
| 19 | + temp[temp.length] = billingErrors[f]; |
| 20 | + billingErrorString = temp.join( "<br />" ); |
| 21 | + |
| 22 | + temp = []; |
| 23 | + for ( var g in paymentErrors ) |
| 24 | + if ( paymentErrors[g] != "" ) |
| 25 | + temp[temp.length] = paymentErrors[g]; |
| 26 | + paymentErrorString = temp.join( "<br />" ); |
| 27 | + |
| 28 | + // show the errors |
| 29 | + var prevError = false; |
| 30 | + if ( amountErrorString != "" ) { |
| 31 | + $( "#amtErrorMessages" ).html( amountErrorString ); |
| 32 | + prevError = true; |
| 33 | + } |
| 34 | + if ( billingErrorString != "" ) { |
| 35 | + $( "#billingErrorMessages" ).html( billingErrorString ); |
| 36 | + if ( !prevError ) { |
| 37 | + prevError = true; |
| 38 | + } |
| 39 | + } |
| 40 | + if ( paymentErrorString != "" ) { |
| 41 | + $( "#paymentErrorMessages" ).html( paymentErrorString ); |
| 42 | + } |
| 43 | + |
4 | 44 | $( '#dialog' ).dialog( { |
5 | 45 | width: 600, |
6 | 46 | resizable: false, |
Index: trunk/extensions/DonationInterface/gateway_forms/rapidhtml/RapidHtmlResources.php |
— | — | @@ -13,10 +13,13 @@ |
14 | 14 | * LIGHTBOX |
15 | 15 | */ |
16 | 16 | // RapidHtml lightbox form resources |
17 | | -$wgResourceModules[ 'pfp.form.rapidhtml.lightbox.js' ] = array( |
| 17 | +$wgResourceModules[ 'pfp.form.rapidhtml.lightbox' ] = array( |
18 | 18 | 'scripts' => array( |
19 | 19 | 'js/lightbox1.js', |
20 | 20 | ), |
| 21 | + 'styles' => array( |
| 22 | + 'css/lightbox1.css', |
| 23 | + ), |
21 | 24 | 'dependencies' => array( |
22 | 25 | 'jquery.ui.core', |
23 | 26 | 'jquery.ui.widget', |
— | — | @@ -32,18 +35,6 @@ |
33 | 36 | 'position' => 'top', |
34 | 37 | ); |
35 | 38 | |
36 | | -// RapidHtml lightbox form css resources (these are separate from the js |
37 | | -// resources for a good reason but I forget what - I believe to facilitate |
38 | | -// ensuring proper load order? |
39 | | -$wgResourceModules[ 'pfp.form.rapidhtml.lightbox.css' ] = array( |
40 | | - 'styles' => array( |
41 | | - 'css/lightbox1.css', |
42 | | - ), |
43 | | - 'localBasePath' => dirname( __FILE__ ), |
44 | | - 'remoteExtPath' => $wgPayflowRapidHtmlRemoteExtPath, |
45 | | - 'position' => 'top', |
46 | | -); |
47 | | - |
48 | 39 | /** |
49 | 40 | * webitects |
50 | 41 | */ |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/lightbox1.html |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | var extensionPath = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/DonationInterface'; |
7 | 7 | mw.loader.load( extensionPath + '/globalcollect_gateway/forms/js/lightbox1.js', 'text/javascript' ); |
8 | 8 | mw.loader.load( extensionPath + '/globalcollect_gateway/forms/css/lightbox1.css', 'text/css' ); |
| 9 | +var ajaxError = "%donate_interface-error-msg-general%"; |
9 | 10 | </script> |
10 | 11 | |
11 | 12 | <div class="ltr"> |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/html/webitects_2_3step.html |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | var paymentErrors = ['#card_num|escape','#card_type|escape','#cvv|escape']; |
8 | 8 | var actionURL = "@action"; |
9 | 9 | var scriptPath = "@script_path"; |
| 10 | + var ajaxError = "%donate_interface-error-msg-general%"; |
10 | 11 | </script> |
11 | 12 | <!--[if lt IE 7]> |
12 | 13 | <script type="text/javascript"> |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/webitects.js |
— | — | @@ -63,7 +63,11 @@ |
64 | 64 | 'dataType': 'json', |
65 | 65 | 'type': 'GET', |
66 | 66 | 'success': function( data ) { |
67 | | - if ( typeof data.result !== 'undefined' ) { |
| 67 | + if ( typeof data.error !== 'undefined' ) { |
| 68 | + alert( ajaxError ); |
| 69 | + $( "#paymentContinue" ).show(); // Show continue button in 2nd section |
| 70 | + showStep1(); |
| 71 | + } else if ( typeof data.result !== 'undefined' ) { |
68 | 72 | if ( data.result.errors ) { |
69 | 73 | var errors = new Array(); |
70 | 74 | $.each( data.result.errors, function( index, value ) { |
— | — | @@ -82,6 +86,10 @@ |
83 | 87 | } |
84 | 88 | } |
85 | 89 | } |
| 90 | + }, |
| 91 | + 'error': function( xhr ) { |
| 92 | + alert( ajaxError ); |
| 93 | + showStep1(); |
86 | 94 | } |
87 | 95 | } ); |
88 | 96 | } |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/js/lightbox1.js |
— | — | @@ -167,17 +167,31 @@ |
168 | 168 | 'dataType': 'json', |
169 | 169 | 'type': 'GET', |
170 | 170 | 'success': function( data ) { |
171 | | - if ( data.result.errors ) { |
172 | | - var errors = new Array(); |
173 | | - for( var key in data.result.errors ){ |
174 | | - errors.push( data.result.errors[key] ); |
| 171 | + if ( typeof data.error !== 'undefined' ) { |
| 172 | + alert( ajaxError ); |
| 173 | + // Send them back to the beginning |
| 174 | + } else if ( typeof data.result !== 'undefined' ) { |
| 175 | + if ( data.result.errors ) { |
| 176 | + var errors = new Array(); |
| 177 | + $.each( data.result.errors, function( index, value ) { |
| 178 | + alert( value ); // Show them the error |
| 179 | + // Send them back to the beginning |
| 180 | + } ); |
| 181 | + } else { |
| 182 | + if ( data.result.formaction ) { |
| 183 | + $( '#payment' ).empty(); |
| 184 | + // Insert the iframe into the form |
| 185 | + $( '#payment' ).append( |
| 186 | + '<iframe src="'+data.result.formaction+'" width="318" height="314" frameborder="0"></iframe>' |
| 187 | + ); |
| 188 | + |
| 189 | + } |
175 | 190 | } |
176 | | - alert ( errors.join( '\r\n' ) ); |
177 | | - } else { |
178 | | - if ( data.result.returnurl ) { |
179 | | - window.location = data.result.returnurl; |
180 | | - } |
181 | 191 | } |
| 192 | + }, |
| 193 | + 'error': function( xhr ) { |
| 194 | + alert( ajaxError ); |
| 195 | + // Send them back to the beginning |
182 | 196 | } |
183 | 197 | } ); |
184 | 198 | //document.donationForm.action = $( "input[name='action']" ).val(); |
Index: trunk/extensions/DonationInterface/gateway_common/interface.i18n.php |
— | — | @@ -157,6 +157,7 @@ |
158 | 158 | 'donate_interface-card-name-mc' => 'Mastercard', |
159 | 159 | 'donate_interface-card-name-discover' => 'Discover', |
160 | 160 | // The key names for the error messages should mostly match up with the donate_interface-donor keys above. (There are a few exceptions for backwards compat.) |
| 161 | + 'donate_interface-error-msg-general' => 'There was an error processing your request.', |
161 | 162 | 'donate_interface-error-msg-nopaypal' => 'Due to a technical error, we cannot send your request to PayPal. Please try using our regular credit card donation form.', |
162 | 163 | 'donate_interface-error-msg' => 'Please enter your $1', |
163 | 164 | 'donate_interface-error-msg-js' => 'Please enter your', |
— | — | @@ -543,6 +544,7 @@ |
544 | 545 | 'donate_interface-donor-submit' => '{{Identical|Donate}}', |
545 | 546 | 'donate_interface-donor-currency-msg' => '* $1 is 3 letter currency code', |
546 | 547 | 'donate_interface-card-name-discover' => "Trademark name of credit card Discover®, '''not''' the verb \"to discover\".", |
| 548 | + 'donate_interface-error-msg-general' => 'A generic error message.', |
547 | 549 | 'donate_interface-error-msg-nopaypal' => 'Error message.', |
548 | 550 | 'donate_interface-error-msg' => "{{doc-important|If grammatical issues in your language prevent you from translating this literally, translate the following: \"The following field is required: \$1\".}} |
549 | 551 | |