Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php |
— | — | @@ -274,8 +274,10 @@ |
275 | 275 | |
276 | 276 | protected function getAmountField() { |
277 | 277 | $otherChecked = false; |
| 278 | + $amount = -1; |
278 | 279 | if ( $this->form_data['amount'] != 250 && $this->form_data['amount'] != 100 && $this->form_data['amount'] != 75 && $this->form_data['amount'] != 35 && $this->form_data['amountOther'] > 0 ) { |
279 | 280 | $otherChecked = true; |
| 281 | + $amount = $this->form_data['amountOther']; |
280 | 282 | } |
281 | 283 | $form = '<tr>'; |
282 | 284 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
— | — | @@ -290,7 +292,7 @@ |
291 | 293 | $form .= '</tr>'; |
292 | 294 | $form .= '<tr>'; |
293 | 295 | $form .= '<td class="label"></td>'; |
294 | | - $form .= '<td>' . Xml::radio( 'amount', -1, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "Other" )', 'onblur' => 'document.getElementById("otherRadio").value = this.value', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
| 296 | + $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "Other" )', 'onblur' => 'document.getElementById("otherRadio").value = this.value', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
295 | 297 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
296 | 298 | $form .= '</tr>'; |
297 | 299 | return $form; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php |
— | — | @@ -1,6 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class PayflowProGateway_Form_TwoColumnLetter extends PayflowProGateway_Form_TwoColumn { |
| 5 | + public $paypal = false; // true for paypal only version |
5 | 6 | |
6 | 7 | public function __construct( &$form_data, &$form_errors ) { |
7 | 8 | global $wgOut, $wgScriptPath; |
— | — | @@ -18,6 +19,9 @@ |
19 | 20 | |
20 | 21 | public function generateFormStart() { |
21 | 22 | global $wgOut, $wgRequest; |
| 23 | + |
| 24 | + $this->paypal = $wgRequest->getBool( 'paypal', false ); |
| 25 | + |
22 | 26 | $form = parent::generateBannerHeader(); |
23 | 27 | |
24 | 28 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-cc_form_container')); |
— | — | @@ -90,6 +94,7 @@ |
91 | 95 | protected function generateBillingFields() { |
92 | 96 | global $wgScriptPath, $wgPayflowGatewayTest, $wgPayflowGatewayPaypalURL; |
93 | 97 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
| 98 | + |
94 | 99 | $form = ''; |
95 | 100 | |
96 | 101 | // name |
— | — | @@ -133,59 +138,80 @@ |
134 | 139 | // amount |
135 | 140 | $form .= $this->getAmountField(); |
136 | 141 | |
137 | | - // PayPal button |
138 | | - // make sure we have a paypal url set to redirect the user to before displaying the button |
139 | | - if ( strlen( $wgPayflowGatewayPaypalURL )) { |
| 142 | + if ( !$this->paypal ) { |
| 143 | + // PayPal button |
| 144 | + // make sure we have a paypal url set to redirect the user to before displaying the button |
| 145 | + if ( strlen( $wgPayflowGatewayPaypalURL )) { |
| 146 | + $form .= '<tr>'; |
| 147 | + $form .= '<td class="paypal-button" colspan="2">'; |
| 148 | + $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 149 | + $form .= Xml::tags( 'div', |
| 150 | + array(), |
| 151 | + '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
| 152 | + ); |
| 153 | + $form .= '</td>'; |
| 154 | + $form .= '</tr>'; |
| 155 | + } |
| 156 | + |
| 157 | + // card logos |
140 | 158 | $form .= '<tr>'; |
141 | | - $form .= '<td class="paypal-button" colspan="2">'; |
142 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
143 | | - $form .= Xml::tags( 'div', |
144 | | - array(), |
145 | | - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
146 | | - ); |
147 | | - $form .= '</td>'; |
| 159 | + $form .= '<td />'; |
| 160 | + $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
148 | 161 | $form .= '</tr>'; |
| 162 | + |
| 163 | + // card number |
| 164 | + $form .= $this->getCardNumberField(); |
| 165 | + |
| 166 | + // cvv |
| 167 | + $form .= $this->getCvvField(); |
| 168 | + |
| 169 | + // expiry |
| 170 | + $form .= '<tr>'; |
| 171 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
| 172 | + $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>'; |
| 173 | + $form .= '</tr>'; |
| 174 | + |
| 175 | + // street |
| 176 | + $form .= $this->getStreetField(); |
| 177 | + |
| 178 | + // city |
| 179 | + $form .= $this->getCityField(); |
| 180 | + |
| 181 | + // state |
| 182 | + $form .= '<tr>'; |
| 183 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . '</td>'; |
| 184 | + $form .= '<td>' . $this->generateStateDropdown() . ' ' . wfMsg( 'payflowpro_gateway-state-in-us' ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['state'] . '</span></td>'; |
| 185 | + $form .= '</tr>'; |
| 186 | + |
| 187 | + // zip |
| 188 | + $form .= $this->getZipField(); |
| 189 | + |
| 190 | + // country |
| 191 | + $form .= '<tr>'; |
| 192 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>'; |
| 193 | + $form .= '<td>' . $this->generateCountryDropdown() . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['country'] . '</span></td>'; |
| 194 | + $form .= '</tr>'; |
149 | 195 | } |
150 | | - |
151 | | - // card logos |
152 | | - $form .= '<tr>'; |
153 | | - $form .= '<td />'; |
154 | | - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
155 | | - $form .= '</tr>'; |
156 | | - |
157 | | - // card number |
158 | | - $form .= $this->getCardNumberField(); |
159 | | - |
160 | | - // cvv |
161 | | - $form .= $this->getCvvField(); |
162 | | - |
163 | | - // expiry |
164 | | - $form .= '<tr>'; |
165 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>'; |
166 | | - $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>'; |
167 | | - $form .= '</tr>'; |
168 | 196 | |
169 | | - // street |
170 | | - $form .= $this->getStreetField(); |
171 | | - |
172 | | - // city |
173 | | - $form .= $this->getCityField(); |
174 | | - |
175 | | - // state |
176 | | - $form .= '<tr>'; |
177 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . '</td>'; |
178 | | - $form .= '<td>' . $this->generateStateDropdown() . ' ' . wfMsg( 'payflowpro_gateway-state-in-us' ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['state'] . '</span></td>'; |
179 | | - $form .= '</tr>'; |
180 | | - |
181 | | - // zip |
182 | | - $form .= $this->getZipField(); |
| 197 | + return $form; |
| 198 | + } |
| 199 | + |
| 200 | + public function generateFormSubmit() { |
| 201 | + // submit button |
| 202 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit')); |
| 203 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' )); |
| 204 | + if ( $this->paypal ) { |
| 205 | + $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 206 | + $form .= Xml::element( 'input', array( 'class' => 'input-button button-navyblue', 'value' => wfMsg( 'payflowpro_gateway-submit-button'), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit')); |
| 207 | + } else { |
| 208 | + $form .= Xml::element( 'input', array( 'class' => 'input-button button-navyblue', 'value' => wfMsg( 'payflowpro_gateway-submit-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
| 209 | + $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
| 210 | + $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
| 211 | + wfMsg( 'payflowpro_gateway-donate-click' ); |
| 212 | + } |
| 213 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
| 214 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
183 | 215 | |
184 | | - // country |
185 | | - $form .= '<tr>'; |
186 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>'; |
187 | | - $form .= '<td>' . $this->generateCountryDropdown() . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['country'] . '</span></td>'; |
188 | | - $form .= '</tr>'; |
189 | | - |
190 | 216 | return $form; |
191 | 217 | } |
192 | 218 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | .button-navyblue { |
71 | 71 | background-image:url("https://payments.wikimedia.org/images/0/06/Button-wavy-blue.png"); |
72 | 72 | color:#FFFFFF; |
| 73 | + cursor:pointer; |
73 | 74 | } |
74 | 75 | |
75 | 76 | .input-button { |