Index: trunk/extensions/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -22,6 +22,17 @@ |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
| 26 | +function switchToPayPal() { |
| 27 | + document.getElementById('payflow-table-cc').style.display = 'none'; |
| 28 | + document.getElementById('payflowpro_gateway-form-submit').style.display = 'none'; |
| 29 | + document.getElementById('payflowpro_gateway-form-submit-paypal').style.display = 'block'; |
| 30 | +} |
| 31 | +function switchToCreditCard() { |
| 32 | + document.getElementById('payflow-table-cc').style.display = 'table'; |
| 33 | + document.getElementById('payflowpro_gateway-form-submit').style.display = 'block'; |
| 34 | + document.getElementById('payflowpro_gateway-form-submit-paypal').style.display = 'none'; |
| 35 | +} |
| 36 | + |
26 | 37 | function validate_form( form ) { |
27 | 38 | var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
28 | 39 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter5.php |
— | — | @@ -101,31 +101,16 @@ |
102 | 102 | |
103 | 103 | $form .= '<tr>'; |
104 | 104 | $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-payment-type' ), 'payment_method' ) . '</td>'; |
105 | | - $form .= '<td>' . Xml::radio( 'payment_method', 1, $this->form_data['payment_method'] == 1, array( 'onclick' => 'document.getElementById(\'payflow-table-paypal\').style.display = \'none\';document.getElementById(\'payflow-table-cc\').style.display = \'table\';' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ) . |
106 | | - Xml::radio( 'payment_method', 2, $this->form_data['payment_method'] == 2, array( 'onclick' => 'document.getElementById(\'payflow-table-paypal\').style.display = \'none\';document.getElementById(\'payflow-table-cc\').style.display = \'table\';' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ) . |
107 | | - Xml::radio( 'payment_method', 3, $this->form_data['payment_method'] == 3, array( 'onclick' => 'document.getElementById(\'payflow-table-paypal\').style.display = \'none\';document.getElementById(\'payflow-table-cc\').style.display = \'table\';' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ) . |
108 | | - Xml::radio( 'payment_method', 4, $this->form_data['payment_method'] == 4, array( 'onclick' => 'document.getElementById(\'payflow-table-paypal\').style.display = \'none\';document.getElementById(\'payflow-table-cc\').style.display = \'table\';' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ) . |
109 | | - Xml::radio( 'payment_method', 5, $this->form_data['payment_method'] == 5, array( 'onclick' => 'document.getElementById(\'payflow-table-cc\').style.display = \'none\';document.getElementById(\'payflow-table-paypal\').style.display = \'table\';' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . |
| 105 | + $form .= '<td>' . Xml::radio( 'payment_method', 'cc1', $this->form_data['payment_method'] == 'cc1', array( 'onclick' => 'switchToCreditCard()' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-visa.png" ) ) . |
| 106 | + Xml::radio( 'payment_method', 'cc2', $this->form_data['payment_method'] == 'cc2', array( 'onclick' => 'switchToCreditCard()' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-mastercard.png" ) ) . |
| 107 | + Xml::radio( 'payment_method', 'cc3', $this->form_data['payment_method'] == 'cc3', array( 'onclick' => 'switchToCreditCard()' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-amex.png" ) ) . |
| 108 | + Xml::radio( 'payment_method', 'cc4', $this->form_data['payment_method'] == 'cc4', array( 'onclick' => 'switchToCreditCard()' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-discover.png" ) ) . |
| 109 | + Xml::radio( 'payment_method', 'pp', $this->form_data['payment_method'] == 'pp', array( 'onclick' => 'switchToPayPal()' ) ) . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/card-paypal.png" ) ) . |
110 | 110 | '</td>'; |
111 | 111 | $form .= '</tr>'; |
112 | 112 | |
113 | 113 | $form .= '</table>'; |
114 | 114 | |
115 | | - $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-paypal', 'style' => 'display:none;' ) ); |
116 | | - if ( strlen( $wgPayflowGatewayPaypalURL ) ) { |
117 | | - $form .= '<tr>'; |
118 | | - $form .= '<td class="label"></td>'; |
119 | | - $form .= '<td>'; |
120 | | - $form .= Html::hidden( 'PaypalRedirect', false ); |
121 | | - $form .= Xml::tags( 'div', |
122 | | - array(), |
123 | | - 'test' |
124 | | - ); |
125 | | - $form .= '</td>'; |
126 | | - $form .= '</tr>'; |
127 | | - } |
128 | | - $form .= '</table>'; |
129 | | - |
130 | 115 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
131 | 116 | |
132 | 117 | // card number |
— | — | @@ -165,20 +150,23 @@ |
166 | 151 | } |
167 | 152 | |
168 | 153 | public function generateFormSubmit() { |
169 | | - // submit button |
| 154 | + // cc submit button |
170 | 155 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
171 | 156 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
172 | | - if ( $this->paypal ) { |
173 | | - $form .= Html::hidden( 'PaypalRedirect', false ); |
174 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) ); |
175 | | - } else { |
176 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
177 | | - $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
178 | | - $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
179 | | - wfMsg( 'payflowpro_gateway-donate-click' ); |
180 | | - } |
| 157 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
| 158 | + $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
| 159 | + $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
| 160 | + wfMsg( 'payflowpro_gateway-donate-click' ); |
181 | 161 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
182 | 162 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
| 163 | + |
| 164 | + // paypal submit button |
| 165 | + $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal' ) ); |
| 166 | + $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
| 167 | + $form .= Html::hidden( 'PaypalRedirect', false ); |
| 168 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) ); |
| 169 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
| 170 | + $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
183 | 171 | |
184 | 172 | return $form; |
185 | 173 | } |