Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js |
— | — | @@ -59,16 +59,6 @@ |
60 | 60 | if ( document.payment.country.value != '840' ) { |
61 | 61 | document.payment.state.value = 'XX'; |
62 | 62 | } |
63 | | - |
64 | | - // validate name |
65 | | - /* |
66 | | - if (document.getElementById('fname').style.color == '#999999') { |
67 | | - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Fname']] + '.\r\n'; |
68 | | - } |
69 | | - if (document.getElementById('lname').style.color == '#999999') { |
70 | | - output += payflowproGatewayErrorMsgJs + ' ' + window['payflowproGatewayErrorMsg' + msg['Lname']] + '.\r\n'; |
71 | | - } |
72 | | - */ |
73 | 63 | |
74 | 64 | // validate email address |
75 | 65 | var apos = document.payment.emailAdd.value.indexOf("@"); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
98 | 98 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
99 | 99 | // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
100 | | - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) ); |
| 100 | + $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'type' => 'submit' ) ); |
101 | 101 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
102 | 102 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
103 | 103 | wfMsg( 'payflowpro_gateway-donate-click' ); |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -11,7 +11,102 @@ |
12 | 12 | |
13 | 13 | parent::__construct( $form_data, $form_errors ); |
14 | 14 | } |
| 15 | + |
| 16 | + public function loadPlaceholders() { |
| 17 | + global $wgOut; |
| 18 | + // form placeholder values |
| 19 | + $first = wfMsg( 'payflowpro_gateway-first' ); |
| 20 | + $last = wfMsg( 'payflowpro_gateway-last' ); |
| 21 | + $street = wfMsg( 'payflowpro_gateway-donor-street' ); |
| 22 | + $city = wfMsg( 'payflowpro_gateway-donor-city' ); |
| 23 | + $zip = wfMsg( 'payflowpro_gateway-zip-code' ); |
| 24 | + $email = wfMsg( 'payflowpro_gateway-donor-email' ); |
| 25 | + $js = <<<EOT |
| 26 | +<script type="text/javascript"> |
| 27 | +function loadPlaceholders() { |
| 28 | + var fname = document.getElementById('fname'); |
| 29 | + var lname = document.getElementById('lname'); |
| 30 | + var street = document.getElementById('street'); |
| 31 | + var city = document.getElementById('city'); |
| 32 | + var zip = document.getElementById('zip'); |
| 33 | + var email = document.getElementById('emailAdd'); |
| 34 | + if (fname.value == '') { |
| 35 | + fname.style.color = '#999999'; |
| 36 | + fname.value = '$first'; |
| 37 | + } |
| 38 | + if (lname.value == '') { |
| 39 | + lname.style.color = '#999999'; |
| 40 | + lname.value = '$last'; |
| 41 | + } |
| 42 | + if (street.value == '') { |
| 43 | + street.style.color = '#999999'; |
| 44 | + street.value = '$street'; |
| 45 | + } |
| 46 | + if (city.value == '') { |
| 47 | + city.style.color = '#999999'; |
| 48 | + city.value = '$city'; |
| 49 | + } |
| 50 | + if (zip.value == '') { |
| 51 | + zip.style.color = '#999999'; |
| 52 | + zip.value = '$zip'; |
| 53 | + } |
| 54 | + if (email.value == '') { |
| 55 | + email.style.color = '#999999'; |
| 56 | + email.value = '$email'; |
| 57 | + } |
| 58 | +} |
| 59 | +addEvent( window, 'load', loadPlaceholders ); |
15 | 60 | |
| 61 | +function formCheck( ccform ) { |
| 62 | + var msg = [ 'EmailAdd', 'Fname', 'Lname', 'Street', 'City', 'State', 'Zip', 'CardNum', 'Cvv' ]; |
| 63 | + |
| 64 | + var fields = ["emailAdd","fname","lname","street","city","state","zip","card_num","cvv" ], |
| 65 | + numFields = fields.length, |
| 66 | + i, |
| 67 | + output = '', |
| 68 | + currField = ''; |
| 69 | + |
| 70 | + for( i = 0; i < numFields; i++ ) { |
| 71 | + if( document.getElementById( fields[i] ).value == '' ) { |
| 72 | + currField = window['payflowproGatewayErrorMsg'+ msg[i]]; |
| 73 | + output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\\r\\n'; |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + if (document.getElementById('fname').value == '$first') { |
| 78 | + output += payflowproGatewayErrorMsgJs + ' first name.\\r\\n'; |
| 79 | + } |
| 80 | + if (document.getElementById('lname').value == '$last') { |
| 81 | + output += payflowproGatewayErrorMsgJs + ' last name.\\r\\n'; |
| 82 | + } |
| 83 | + if (document.getElementById('street').value == '$street') { |
| 84 | + output += payflowproGatewayErrorMsgJs + ' street address.\\r\\n'; |
| 85 | + } |
| 86 | + if (document.getElementById('city').value == '$city') { |
| 87 | + output += payflowproGatewayErrorMsgJs + ' city.\\r\\n'; |
| 88 | + } |
| 89 | + if (document.getElementById('zip').value == '$zip') { |
| 90 | + output += payflowproGatewayErrorMsgJs + ' zip code.\\r\\n'; |
| 91 | + } |
| 92 | + |
| 93 | + // validate email address |
| 94 | + var apos = document.payment.emailAdd.value.indexOf("@"); |
| 95 | + var dotpos = document.payment.emailAdd.value.lastIndexOf("."); |
| 96 | + |
| 97 | + if( apos < 1 || dotpos-apos < 2 ) { |
| 98 | + output += payflowproGatewayErrorMsgEmail; |
| 99 | + } |
| 100 | + |
| 101 | + if( output ) { |
| 102 | + alert( output ); |
| 103 | + return false; |
| 104 | + } |
| 105 | +} |
| 106 | +</script> |
| 107 | +EOT; |
| 108 | + $wgOut->addHeadItem( 'placeholders', $js ); |
| 109 | + } |
| 110 | + |
16 | 111 | public function generateFormStart() { |
17 | 112 | global $wgOut, $wgRequest; |
18 | 113 | |
— | — | @@ -54,62 +149,66 @@ |
55 | 150 | |
56 | 151 | // Xml::element seems to convert html to htmlentities |
57 | 152 | $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>"; |
58 | | - $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) ); |
| 153 | + $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return formCheck(this)', 'autocomplete' => 'off' ) ); |
59 | 154 | |
60 | | - $form .= $this->generateBillingContainer(); |
| 155 | + $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
| 156 | + $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
| 157 | + $form .= $this->generateBillingFields(); |
| 158 | + |
61 | 159 | return $form; |
62 | 160 | } |
63 | 161 | |
64 | 162 | public function generateFormSubmit() { |
65 | 163 | global $wgScriptPath; |
| 164 | + |
| 165 | + $form = '<tr>'; |
| 166 | + $form .= '<td class="label"> </td>'; |
| 167 | + $form .= '<td>'; |
| 168 | + |
66 | 169 | // submit button |
67 | | - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
68 | 170 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) ); |
69 | 171 | // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' )); |
70 | | - $form .= Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'onclick' => 'submit_form( this )', 'type' => 'image' ) ); |
| 172 | + $form .= ' <br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'type' => 'image' ) ); |
71 | 173 | $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button |
72 | 174 | $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) . |
73 | | - Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . wfMsg( 'payflowpro_gateway-donate-click' ); |
| 175 | + Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/padlock.gif", 'style' => 'vertical-align:baseline;margin-right:4px;' ) ) . 'Your credit / debit card will be securely processed.'; |
74 | 176 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-submessage |
75 | | - $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
| 177 | + |
| 178 | + $form .= '</td>'; |
| 179 | + $form .= '</tr>'; |
76 | 180 | return $form; |
77 | 181 | } |
78 | 182 | |
79 | 183 | public function generateFormEnd() { |
80 | 184 | $form = ''; |
81 | | - $form .= $this->generateFormClose(); |
82 | | - return $form; |
83 | | - } |
84 | | - |
85 | | - protected function generateBillingContainer() { |
86 | | - $form = ''; |
87 | | - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
88 | | - $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
89 | | - $form .= $this->generateBillingFields(); |
90 | 185 | $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor |
91 | 186 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info |
92 | | - |
| 187 | + $form .= $this->generateFormClose(); |
93 | 188 | return $form; |
94 | 189 | } |
95 | 190 | |
96 | 191 | protected function generateBillingFields() { |
97 | | - global $wgScriptPath; |
| 192 | + global $wgScriptPath, $wgPayflowGatewayTest; |
98 | 193 | |
99 | 194 | $form = ''; |
100 | 195 | |
101 | 196 | // amount |
102 | 197 | $form .= '<tr>'; |
103 | 198 | $form .= '<td colspan="2">'; |
104 | | - $form .= '<table cellspacing="2" cellpadding="2" border="1" id="donation_amount">'; |
| 199 | + $form .= '<table cellspacing="0" cellpadding="4" border="1" id="donation_amount">'; |
105 | 200 | $form .= '<tr>'; |
106 | 201 | $form .= '<td class="amount_header">'.wfMsg( 'payflowpro_gateway-description' ).'</td>'; |
107 | | - $form .= '<td class="amount_header">'.wfMsg( 'payflowpro_gateway-donor-amount' ).'</td>'; |
108 | | - $form .= '<td class="amount_header">'.wfMsg( 'payflowpro_gateway-donor-currency-label' ).'</td>'; |
| 202 | + $form .= '<td class="amount_header" style="text-align:right;width:75px;">'.wfMsg( 'payflowpro_gateway-donor-amount' ).'</td>'; |
| 203 | + $form .= '<td class="amount_header" style="text-align:right;width:75px;">'.wfMsg( 'payflowpro_gateway-donor-currency-label' ).'</td>'; |
109 | 204 | $form .= '</tr>'; |
110 | 205 | $form .= '<tr>'; |
111 | 206 | $form .= '<td class="amount_data">'.wfMsg( 'payflowpro_gateway-donation' ).'</td>'; |
112 | | - $form .= '<td class="amount_data">'.$this->form_data['amount'].'</td>'; |
113 | | - $form .= '<td class="amount_data">'.$this->form_data[ 'currency' ].'</td>'; |
| 207 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
| 208 | + Html::hidden( 'amount', $this->form_data['amount'] ) . |
| 209 | + '</td>'; |
| 210 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data[ 'currency' ] . |
| 211 | + Html::hidden( 'currency_code', $this->form_data['currency'] ) . |
| 212 | + '</td>'; |
114 | 213 | $form .= '</tr>'; |
115 | 214 | $form .= '</table>'; |
116 | 215 | $form .= '</td>'; |
— | — | @@ -127,7 +226,23 @@ |
128 | 227 | $form .= '</tr>'; |
129 | 228 | |
130 | 229 | // card number |
131 | | - $form .= $this->getCardNumberField(); |
| 230 | + $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : ''; |
| 231 | + $form .= ''; |
| 232 | + if ( $this->form_errors['card_num'] ) { |
| 233 | + $form .= '<tr>'; |
| 234 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card_num'] . '</span></td>'; |
| 235 | + $form .= '</tr>'; |
| 236 | + } |
| 237 | + if ( $this->form_errors['card'] ) { |
| 238 | + $form .= '<tr>'; |
| 239 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['card'] . '</span></td>'; |
| 240 | + $form .= '</tr>'; |
| 241 | + } |
| 242 | + $form .= '<tr>'; |
| 243 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) . '</td>'; |
| 244 | + $form .= '<td>' . Xml::input( 'card_num', '30', $card_num, array( 'type' => 'text', 'maxlength' => '100', 'id' => 'card_num', 'class' => 'fullwidth', 'autocomplete' => 'off' ) ) . |
| 245 | + '</td>'; |
| 246 | + $form .= '</tr>'; |
132 | 247 | |
133 | 248 | // expiry |
134 | 249 | $form .= '<tr>'; |
— | — | @@ -152,19 +267,38 @@ |
153 | 268 | $form .= "</tr>"; |
154 | 269 | |
155 | 270 | // street |
156 | | - $form .= $this->getStreetField(); |
| 271 | + $form .= '<tr>'; |
| 272 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['street'] . '</span></td>'; |
| 273 | + $form .= '</tr>'; |
| 274 | + $form .= '<tr>'; |
| 275 | + $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-billing-address' ), 'street' ) . '</td>'; |
| 276 | + $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
| 277 | + '</td>'; |
| 278 | + $form .= '</tr>'; |
157 | 279 | |
158 | 280 | // city |
159 | | - $form .= $this->getCityField(); |
| 281 | + $form .= '<tr>'; |
| 282 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['city'] . '</span></td>'; |
| 283 | + $form .= '</tr>'; |
| 284 | + $form .= '<tr>'; |
| 285 | + $form .= '<td class="label"> </td>'; |
| 286 | + $form .= '<td>' . Xml::input( 'city', '18', $this->form_data['city'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
| 287 | + $this->generateStateDropdown() . ' ' . |
| 288 | + Xml::input( 'zip', '5', $this->form_data['zip'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'payflowpro_gateway-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
| 289 | + Html::hidden( 'country', 840 ) . |
| 290 | + '</td>'; |
| 291 | + $form .= '</tr>'; |
160 | 292 | |
161 | | - // state |
162 | | - $form .= $this->getStateField(); |
163 | | - |
164 | | - // zip |
165 | | - $form .= $this->getZipField(); |
166 | | - |
167 | 293 | // country |
168 | | - $form .= $this->getCountryField(); |
| 294 | + /* |
| 295 | + $form .= '<tr>'; |
| 296 | + $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['country'] . '</span></td>'; |
| 297 | + $form .= '</tr>'; |
| 298 | + $form .= '<tr>'; |
| 299 | + $form .= '<td class="label"> </td>'; |
| 300 | + $form .= '<td>' . $this->generateCountryDropdown() . '</td>'; |
| 301 | + $form .= '</tr>'; |
| 302 | + */ |
169 | 303 | |
170 | 304 | // email |
171 | 305 | $form .= '<tr>'; |
— | — | @@ -203,12 +337,39 @@ |
204 | 338 | $form = ''; |
205 | 339 | $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) ); |
206 | 340 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) ); |
207 | | - $form .= Xml::tags( 'div', array( 'style' => 'text-align:center;' ), '***' ); |
| 341 | + $form .= Xml::tags( 'div', array( 'style' => 'text-align:center;' ), '* * *' ); |
208 | 342 | $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) ); |
209 | | - $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-short' ) ); |
| 343 | + $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-alt' ) ); |
210 | 344 | $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) ); |
211 | 345 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text |
212 | 346 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info |
213 | 347 | return $form; |
214 | 348 | } |
| 349 | + |
| 350 | + public function generateStateDropdown() { |
| 351 | + require_once( dirname( __FILE__ ) . '/../includes/stateAbbreviations.inc' ); |
| 352 | + |
| 353 | + $states = statesMenuXML(); |
| 354 | + |
| 355 | + $state_opts = Xml::option( '', '' ); |
| 356 | + |
| 357 | + // generate dropdown of state opts |
| 358 | + foreach ( $states as $value => $state_name ) { |
| 359 | + if ( $value !== 'YY' && $value !== 'XX' ) { |
| 360 | + $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 361 | + $state_opts .= Xml::option( $value, $value, $selected ); |
| 362 | + } |
| 363 | + } |
| 364 | + |
| 365 | + $state_menu = Xml::openElement( |
| 366 | + 'select', |
| 367 | + array( |
| 368 | + 'name' => 'state', |
| 369 | + 'id' => 'state' |
| 370 | + ) ); |
| 371 | + $state_menu .= $state_opts; |
| 372 | + $state_menu .= Xml::closeElement( 'select' ); |
| 373 | + |
| 374 | + return $state_menu; |
| 375 | + } |
215 | 376 | } |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css |
— | — | @@ -16,6 +16,25 @@ |
17 | 17 | margin-bottom: 0; |
18 | 18 | font-weight: normal; |
19 | 19 | } |
| 20 | +div#payflowpro_gateway-donate-addl-info-text { |
| 21 | + font-size: 90%; |
| 22 | + line-height: 120%; |
| 23 | +} |
| 24 | +div#payflowpro_gateway-donate-submessage { |
| 25 | + font-size: 90%; |
| 26 | + line-height: 120%; |
| 27 | +} |
| 28 | +#payflow-table-donor td.label, #payflow-table-comment td.label, #payflow-table-cc td.label { |
| 29 | + padding-right:0.5em; |
| 30 | + width: 100px; |
| 31 | +} |
| 32 | +input#city { |
| 33 | + width: 130px; |
| 34 | +} |
| 35 | +input#zip { |
| 36 | + width: 55px; |
| 37 | +} |
| 38 | + |
20 | 39 | .payflow-cc-form-section { |
21 | 40 | float: none; |
22 | 41 | margin-right: 0em; |
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php |
— | — | @@ -198,7 +198,7 @@ |
199 | 199 | 'payflowpro_gateway-please-complete' => 'Please complete your donation below ...', |
200 | 200 | 'payflowpro_gateway-description' => 'Description', |
201 | 201 | 'payflowpro_gateway-donation' => 'Donation', |
202 | | - 'payflowpro_gateway-email-receipt' => 'Email receipt to', |
| 202 | + 'payflowpro_gateway-email-receipt' => 'E-mail receipt to', |
203 | 203 | |
204 | 204 | // For more USA states, see payflowpro_gateway.us-states.i18n.php. |
205 | 205 | 'payflowpro_gateway-state-dropdown-YY' => 'Select a State', |
Property changes on: branches/fundraising/deployment/DonationInterface |
___________________________________________________________________ |
Modified: svn:mergeinfo |
206 | 206 | Merged /trunk/extensions/DonationInterface:r76758-76828 |