Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter2.php |
— | — | @@ -0,0 +1,171 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class PayflowProGateway_Form_TwoColumnLetter2 extends PayflowProGateway_Form_OneStepTwoColumn { |
| 5 | + |
| 6 | + public function __construct( &$form_data, &$form_errors ) { |
| 7 | + global $wgOut, $wgScriptPath; |
| 8 | + |
| 9 | + // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this |
| 10 | + if ( !strlen( $this->getStylePath())) { |
| 11 | + $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' ); |
| 12 | + } |
| 13 | + |
| 14 | + parent::__construct( $form_data, $form_errors ); |
| 15 | + } |
| 16 | + |
| 17 | + public function generateFormStart() { |
| 18 | + global $wgOut, $wgRequest; |
| 19 | + |
| 20 | + $form = parent::generateBannerHeader(); |
| 21 | + |
| 22 | + $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0)); |
| 23 | + $form .= Xml::openElement( 'tr' ); |
| 24 | + $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
| 25 | + |
| 26 | + $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
| 27 | + // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
| 28 | + if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ]; |
| 29 | + |
| 30 | + $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : ''; |
| 31 | + // if the template doesn't exist, prevent the display of the red link |
| 32 | + if ( preg_match( '/redlink\=1/', $template )) $template = NULL; |
| 33 | + $form .= $template; |
| 34 | + |
| 35 | + $form .= Xml::closeElement( 'td' ); |
| 36 | + |
| 37 | + $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) ); |
| 38 | + |
| 39 | + // add noscript tags for javascript disabled browsers |
| 40 | + $form .= $this->getNoScript(); |
| 41 | + |
| 42 | + $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' )); |
| 43 | + |
| 44 | + // provide a place at the top of the form for displaying general messages |
| 45 | + if ( $this->form_errors['general'] ) { |
| 46 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' )); |
| 47 | + if ( is_array( $this->form_errors['general'] )) { |
| 48 | + foreach ( $this->form_errors['general'] as $this->form_errors_msg ) { |
| 49 | + $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
| 50 | + } |
| 51 | + } else { |
| 52 | + $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg ); |
| 53 | + } |
| 54 | + $form .= Xml::closeElement( 'div' ); // close div#mw-payflow-general-error |
| 55 | + } |
| 56 | + |
| 57 | + // Xml::element seems to convert html to htmlentities |
| 58 | + $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
| 59 | + $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) ); |
| 60 | + |
| 61 | + $form .= $this->generateBillingContainer(); |
| 62 | + return $form; |
| 63 | + } |
| 64 | + |
| 65 | + public function generateFormEnd() { |
| 66 | + $form = ''; |
| 67 | + $form .= $this->generateFormClose(); |
| 68 | + return $form; |
| 69 | + } |
| 70 | + |
| 71 | + protected function generateBillingContainer() { |
| 72 | + $form = ''; |
| 73 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); |
| 74 | + $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
| 75 | + $form .= $this->generateBillingFields(); |
| 76 | + $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
| 77 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info |
| 78 | + |
| 79 | + return $form; |
| 80 | + } |
| 81 | + |
| 82 | + protected function generateBillingFields() { |
| 83 | + global $wgScriptPath, $wgPayflowGatewayPaypalURL, $wgRequest; |
| 84 | + $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
| 85 | + |
| 86 | + $form = ''; |
| 87 | + |
| 88 | + // PayPal button |
| 89 | + // make sure we have a paypal url set to redirect the user to before displaying the button |
| 90 | + if ( strlen( $wgPayflowGatewayPaypalURL )) { |
| 91 | + $form .= '<tr>'; |
| 92 | + $form .= '<td class="label"></td>'; |
| 93 | + $form .= '<td class="paypal-button">'; |
| 94 | + $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 95 | + $form .= Xml::tags( 'div', |
| 96 | + array(), |
| 97 | + '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
| 98 | + ); |
| 99 | + $form .= '</td>'; |
| 100 | + $form .= '</tr>'; |
| 101 | + } |
| 102 | + |
| 103 | + // name |
| 104 | + $form .= $this->getNameField(); |
| 105 | + |
| 106 | + // email |
| 107 | + $form .= $this->getEmailField(); |
| 108 | + |
| 109 | + // anonymous |
| 110 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 111 | + $form .= '<tr>'; |
| 112 | + $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
| 113 | + $form .= ' ' . Xml::label( wfMsg( 'payflowpro_gateway-anon-message' ), 'comment-option' ) . '</td>'; |
| 114 | + $form .= '</tr>'; |
| 115 | + |
| 116 | + // email agreement |
| 117 | + $form .= $this->getEmailOptField(); |
| 118 | + |
| 119 | + // amount |
| 120 | + $form .= $this->getAmountField(); |
| 121 | + |
| 122 | + // card logos |
| 123 | + $form .= '<tr>'; |
| 124 | + $form .= '<td />'; |
| 125 | + $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>'; |
| 126 | + $form .= '</tr>'; |
| 127 | + |
| 128 | + // card number |
| 129 | + $form .= $this->getCardNumberField(); |
| 130 | + |
| 131 | + // cvv |
| 132 | + $form .= $this->getCvvField(); |
| 133 | + |
| 134 | + // expiry |
| 135 | + $form .= $this->getExpiryField(); |
| 136 | + |
| 137 | + // street |
| 138 | + $form .= $this->getStreetField(); |
| 139 | + |
| 140 | + // city |
| 141 | + $form .= $this->getCityField(); |
| 142 | + |
| 143 | + // state |
| 144 | + $form .= $this->getStateField(); |
| 145 | + // zip |
| 146 | + $form .= $this->getZipField(); |
| 147 | + |
| 148 | + // country |
| 149 | + $form .= $this->getCountryField(); |
| 150 | + |
| 151 | + return $form; |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Generate form closing elements |
| 156 | + */ |
| 157 | + public function generateFormClose() { |
| 158 | + $form = ''; |
| 159 | + // add hidden fields |
| 160 | + $hidden_fields = $this->getHiddenFields(); |
| 161 | + foreach ( $hidden_fields as $field => $value ) { |
| 162 | + $form .= Xml::hidden( $field, $value ); |
| 163 | + } |
| 164 | + |
| 165 | + $form .= Xml::closeElement( 'form' ); // close form 'payment' |
| 166 | + $form .= $this->generateDonationFooter(); |
| 167 | + $form .= Xml::closeElement( 'td' ); |
| 168 | + $form .= Xml::closeElement( 'tr' ); |
| 169 | + $form .= Xml::closeElement( 'table' ); |
| 170 | + return $form; |
| 171 | + } |
| 172 | +} |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | // we only want to load this JS if the form is being rendered |
12 | 12 | $this->loadValidateJs(); // validation JS |
13 | 13 | |
| 14 | + // form placeholder values |
14 | 15 | $first = wfMsg( 'payflowpro_gateway-first' ); |
15 | 16 | $last = wfMsg( 'payflowpro_gateway-last' ); |
16 | 17 | $js = <<<EOT |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/Form.php |
— | — | @@ -432,7 +432,7 @@ |
433 | 433 | protected function getAmountField() { |
434 | 434 | $otherChecked = false; |
435 | 435 | $amount = -1; |
436 | | - 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 ) { |
| 436 | + if ( $this->form_data['amount'] != 100 && $this->form_data['amount'] != 50 && $this->form_data['amount'] != 35 && $this->form_data['amount'] != 20 && $this->form_data['amountOther'] > 0 ) { |
437 | 437 | $otherChecked = true; |
438 | 438 | $amount = $this->form_data['amountOther']; |
439 | 439 | } |
— | — | @@ -441,10 +441,10 @@ |
442 | 442 | $form .= '</tr>'; |
443 | 443 | $form .= '<tr>'; |
444 | 444 | $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>'; |
445 | | - $form .= '<td>' . Xml::radio( 'amount', 250, $this->form_data['amount'] == 250 ) . '250 ' . |
| 445 | + $form .= '<td>' . Xml::radio( 'amount', 20, $this->form_data['amount'] == 20 ) . '20 ' . |
| 446 | + Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
| 447 | + Xml::radio( 'amount', 50, $this->form_data['amount'] == 50 ) . '50 ' . |
446 | 448 | Xml::radio( 'amount', 100, $this->form_data['amount'] == 100 ) . '100 ' . |
447 | | - Xml::radio( 'amount', 75, $this->form_data['amount'] == 75 ) . '75 ' . |
448 | | - Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
449 | 449 | '</td>'; |
450 | 450 | $form .= '</tr>'; |
451 | 451 | $form .= '<tr>'; |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php |
— | — | @@ -15,7 +15,30 @@ |
16 | 16 | $this->loadValidateJs(); // validation JS |
17 | 17 | |
18 | 18 | $this->loadApiJs(); // API/Ajax JS |
| 19 | + |
| 20 | + // form placeholder values |
| 21 | + $first = wfMsg( 'payflowpro_gateway-first' ); |
| 22 | + $last = wfMsg( 'payflowpro_gateway-last' ); |
| 23 | + $js = <<<EOT |
| 24 | +<script type="text/javascript"> |
| 25 | +function loadPlaceholders() { |
| 26 | + var fname = document.getElementById('fname'); |
| 27 | + var lname = document.getElementById('lname'); |
| 28 | + var amountOther = document.getElementById('amountOther'); |
| 29 | + if (fname.value == '') { |
| 30 | + fname.style.color = '#999999'; |
| 31 | + fname.value = '$first'; |
19 | 32 | } |
| 33 | + if (lname.value == '') { |
| 34 | + lname.style.color = '#999999'; |
| 35 | + lname.value = '$last'; |
| 36 | + } |
| 37 | +} |
| 38 | +addEvent( window, 'load', loadPlaceholders ); |
| 39 | +</script> |
| 40 | +EOT; |
| 41 | + $wgOut->addHeadItem( 'placeholders', $js ); |
| 42 | + } |
20 | 43 | |
21 | 44 | /** |
22 | 45 | * Required method for constructing the entire form |
— | — | @@ -83,7 +106,7 @@ |
84 | 107 | $form .= Xml::hidden( 'PaypalRedirect', false ); |
85 | 108 | $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')); |
86 | 109 | } else { |
87 | | - $form .= Xml::element( 'input', array( 'class' => 'input-button button-navyblue', 'value' => wfMsg( 'payflowpro_gateway-submit-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
| 110 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit')); |
88 | 111 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
89 | 112 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
90 | 113 | wfMsg( 'payflowpro_gateway-donate-click' ); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -110,7 +110,8 @@ |
111 | 111 | 'payflowpro_gateway-last' => 'Last', |
112 | 112 | 'payflowpro_gateway-noscript-msg' => 'It appears that you do not have JavaScript enabled, or your browser does not support it. |
113 | 113 | In order to provide a safe, secure and pleasant experience, our donation form requires JavaScript.', |
114 | | - 'payflowpro_gateway-noscript-redirect-msg' => 'If you cannot or do not wish to enable JavaScript, you may still contribute by visiting:' |
| 114 | + 'payflowpro_gateway-noscript-redirect-msg' => 'If you cannot or do not wish to enable JavaScript, you may still contribute by visiting:', |
| 115 | + 'payflowpro_gateway-anon-message' => 'Please list my name on the public donor list.' |
115 | 116 | ); |
116 | 117 | |
117 | 118 | /** Message documentation (Message documentation) |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.php |
— | — | @@ -26,6 +26,7 @@ |
27 | 27 | $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumn' ] = $dir . 'forms/TwoStepTwoColumn.php'; |
28 | 28 | $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnPayPal' ] = $dir . 'forms/TwoColumnPayPal.php'; |
29 | 29 | $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter' ] = $dir . 'forms/TwoColumnLetter.php'; |
| 30 | +$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter2' ] = $dir . 'forms/TwoColumnLetter2.php'; |
30 | 31 | $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoStepTwoColumnLetter' ] = $dir . 'forms/TwoStepTwoColumnLetter.php'; |
31 | 32 | $wgAutoloadClasses[ 'PayflowProGateway_Form_SingleColumn' ] = $dir . 'forms/SingleColumn.php'; |
32 | 33 | $wgExtensionMessagesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.i18n.php'; |
Property changes on: branches/fundraising/deployment/DonationInterface |
___________________________________________________________________ |
Added: svn:mergeinfo |
33 | 34 | Merged /trunk/extensions/DonationInterface:r75105-75120 |