Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnPayPal.php |
— | — | @@ -50,25 +50,14 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | protected function generatePersonalFields() { |
54 | | - global $wgScriptPath, $wgPayflowGatewayTest, $wgPayflowGatewayPaypalURL; |
55 | | - $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
56 | | - $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
57 | | - $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : ''; |
| 54 | + global $wgPayflowGatewayPaypalURL; |
58 | 55 | $form = ''; |
59 | 56 | |
60 | 57 | // name |
61 | | - $form .= '<tr>'; |
62 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-name' ), 'fname' ) . '</td>'; |
63 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "First" )', 'maxlength' => '15', 'class' => 'required', 'id' => 'fname' ) ) . |
64 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "Last" )', 'maxlength' => '15', 'id' => 'lname' ) ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['fname'] . '</span></td>'; |
65 | | - $form .= "</tr>"; |
| 58 | + $form .= $this->getNameField(); |
66 | 59 | |
67 | 60 | // email |
68 | | - $form .= '<tr>'; |
69 | | - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) . '</td>'; |
70 | | - $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
71 | | - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['emailAdd'] . '</span></td>'; |
72 | | - $form .= '</tr>'; |
| 61 | + $form .= $this->getEmailField(); |
73 | 62 | |
74 | 63 | //comment message |
75 | 64 | $form .= '<tr>'; |
— | — | @@ -84,38 +73,17 @@ |
85 | 74 | $form .= '</tr>'; |
86 | 75 | |
87 | 76 | // anonymous |
88 | | - $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true; |
89 | | - $form .= '<tr>'; |
90 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
91 | | - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
92 | | - $form .= '</tr>'; |
| 77 | + $fom .= $this->getCommentOptionField(); |
93 | 78 | |
94 | 79 | // email agreement |
95 | | - $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true; |
96 | | - $form .= '<tr>'; |
97 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
98 | | - $form .= ' '; |
99 | | - // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?) |
100 | | - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' )); |
101 | | - $form .= wfMsg( 'donate_interface-email-agreement' ); |
102 | | - $form .= Xml::closeElement( 'label' ); |
103 | | - $form .= '</td>'; |
104 | | - $form .= '</tr>'; |
| 80 | + $form .= $this->getEmailOptField(); |
105 | 81 | |
106 | 82 | // amount |
107 | 83 | $form .= $this->getAmountField(); |
108 | 84 | |
109 | 85 | // PayPal button |
110 | 86 | if ( strlen( $wgPayflowGatewayPaypalURL )) { |
111 | | - $form .= '<tr>'; |
112 | | - $form .= '<td class="paypal-button" colspan="2">'; |
113 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
114 | | - $form .= Xml::tags( 'div', |
115 | | - array(), |
116 | | - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
117 | | - ); |
118 | | - $form .= '</td>'; |
119 | | - $form .= '</tr>'; |
| 87 | + $form .= $this->getPaypalButton(); |
120 | 88 | } |
121 | 89 | |
122 | 90 | return $form; |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php |
— | — | @@ -148,10 +148,6 @@ |
149 | 149 | } |
150 | 150 | |
151 | 151 | protected function generatePersonalFields() { |
152 | | - global $wgScriptPath, $wgPayflowGatewayTest; |
153 | | - $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway"; |
154 | | - $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
155 | | - $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : ''; |
156 | 152 | $form = ''; |
157 | 153 | |
158 | 154 | // name |
— | — | @@ -174,23 +170,10 @@ |
175 | 171 | $form .= '</tr>'; |
176 | 172 | |
177 | 173 | // anonymous |
178 | | - $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true; |
179 | | - $form .= '<tr>'; |
180 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
181 | | - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
182 | | - $form .= '</tr>'; |
| 174 | + $form .= $this->getCommentOptionField(); |
183 | 175 | |
184 | 176 | // email agreement |
185 | | - $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true; |
186 | | - $form .= '<tr>'; |
187 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
188 | | - $form .= ' '; |
189 | | - // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?) |
190 | | - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' )); |
191 | | - $form .= wfMsg( 'donate_interface-email-agreement' ); |
192 | | - $form .= Xml::closeElement( 'label' ); |
193 | | - $form .= '</td>'; |
194 | | - $form .= '</tr>'; |
| 177 | + $form .= $this->getEmailOptField(); |
195 | 178 | |
196 | 179 | // amount |
197 | 180 | $form .= $this->getAmountField(); |
— | — | @@ -214,8 +197,6 @@ |
215 | 198 | |
216 | 199 | protected function generatePaymentFields() { |
217 | 200 | global $wgScriptPath, $wgPayflowGatewayTest; |
218 | | - |
219 | | - |
220 | 201 | |
221 | 202 | $form = ''; |
222 | 203 | |
— | — | @@ -383,4 +364,45 @@ |
384 | 365 | $form .= "</tr>"; |
385 | 366 | return $form; |
386 | 367 | } |
| 368 | + |
| 369 | + protected function getCommentOptionField() { |
| 370 | + global $wgRequest; |
| 371 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 372 | + $form = '<tr>'; |
| 373 | + $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
| 374 | + $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
| 375 | + $form .= '</tr>'; |
| 376 | + return $form; |
| 377 | + } |
| 378 | + |
| 379 | + protected function getEmailOptField() { |
| 380 | + global $wgRequest; |
| 381 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
| 382 | + $form = '<tr>'; |
| 383 | + $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
| 384 | + $form .= ' '; |
| 385 | + // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?) |
| 386 | + $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' )); |
| 387 | + $form .= wfMsg( 'donate_interface-email-agreement' ); |
| 388 | + $form .= Xml::closeElement( 'label' ); |
| 389 | + $form .= '</td>'; |
| 390 | + $form .= '</tr>'; |
| 391 | + return $form; |
| 392 | + } |
| 393 | + |
| 394 | + protected function getPaypalButton() { |
| 395 | + global $wgScriptPath; |
| 396 | + $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
| 397 | + |
| 398 | + $form = '<tr>'; |
| 399 | + $form .= '<td class="paypal-button" colspan="2">'; |
| 400 | + $form .= Xml::hidden( 'PaypalRedirect', false ); |
| 401 | + $form .= Xml::tags( 'div', |
| 402 | + array(), |
| 403 | + '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
| 404 | + ); |
| 405 | + $form .= '</td>'; |
| 406 | + $form .= '</tr>'; |
| 407 | + return $form; |
| 408 | + } |
387 | 409 | } |
\ No newline at end of file |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | } |
92 | 92 | |
93 | 93 | protected function generateBillingFields() { |
94 | | - global $wgScriptPath, $wgPayflowGatewayTest, $wgPayflowGatewayPaypalURL; |
| 94 | + global $wgScriptPath, $wgPayflowGatewayPaypalURL; |
95 | 95 | $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes"; |
96 | 96 | |
97 | 97 | $form = ''; |
— | — | @@ -115,23 +115,10 @@ |
116 | 116 | $form .= '</tr>'; |
117 | 117 | |
118 | 118 | // anonymous |
119 | | - $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true; |
120 | | - $form .= '<tr>'; |
121 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
122 | | - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
123 | | - $form .= '</tr>'; |
| 119 | + $form .= $this->getCommentOptionField(); |
124 | 120 | |
125 | 121 | // email agreement |
126 | | - $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true; |
127 | | - $form .= '<tr>'; |
128 | | - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
129 | | - $form .= ' '; |
130 | | - // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?) |
131 | | - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' )); |
132 | | - $form .= wfMsg( 'donate_interface-email-agreement' ); |
133 | | - $form .= Xml::closeElement( 'label' ); |
134 | | - $form .= '</td>'; |
135 | | - $form .= '</tr>'; |
| 122 | + $form .= $this->getEmailOptField(); |
136 | 123 | |
137 | 124 | // amount |
138 | 125 | $form .= $this->getAmountField(); |
— | — | @@ -140,15 +127,7 @@ |
141 | 128 | // PayPal button |
142 | 129 | // make sure we have a paypal url set to redirect the user to before displaying the button |
143 | 130 | if ( strlen( $wgPayflowGatewayPaypalURL )) { |
144 | | - $form .= '<tr>'; |
145 | | - $form .= '<td class="paypal-button" colspan="2">'; |
146 | | - $form .= Xml::hidden( 'PaypalRedirect', false ); |
147 | | - $form .= Xml::tags( 'div', |
148 | | - array(), |
149 | | - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>' |
150 | | - ); |
151 | | - $form .= '</td>'; |
152 | | - $form .= '</tr>'; |
| 131 | + $form .= $this->getPaypalButton(); |
153 | 132 | } |
154 | 133 | |
155 | 134 | // card logos |