r76829 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76828‎ | r76829 | r76830 >
Date:19:43, 16 November 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Merging from r76758 thru r76828 of trunk
Modified paths:
  • /branches/fundraising/deployment/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js
@@ -59,16 +59,6 @@
6060 if ( document.payment.country.value != '840' ) {
6161 document.payment.state.value = 'XX';
6262 }
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 - */
7363
7464 // validate email address
7565 var apos = document.payment.emailAdd.value.indexOf("@");
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php
@@ -96,7 +96,7 @@
9797 $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) );
9898 $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
9999 // $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' ) );
101101 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
102102 $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) .
103103 wfMsg( 'payflowpro_gateway-donate-click' );
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php
@@ -11,7 +11,102 @@
1212
1313 parent::__construct( $form_data, $form_errors );
1414 }
 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 );
1560
 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+
16111 public function generateFormStart() {
17112 global $wgOut, $wgRequest;
18113
@@ -54,62 +149,66 @@
55150
56151 // Xml::element seems to convert html to htmlentities
57152 $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' ) );
59154
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+
61159 return $form;
62160 }
63161
64162 public function generateFormSubmit() {
65163 global $wgScriptPath;
 164+
 165+ $form = '<tr>';
 166+ $form .= '<td class="label"> </td>';
 167+ $form .= '<td>';
 168+
66169 // submit button
67 - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) );
68170 $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
69171 // $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 .= '&nbsp;<br/>' . Xml::element( 'input', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/submit-donation-button.png", 'alt' => 'Submit donation', 'type' => 'image' ) );
71173 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
72174 $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.';
74176 $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>';
76180 return $form;
77181 }
78182
79183 public function generateFormEnd() {
80184 $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();
90185 $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
91186 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info
92 -
 187+ $form .= $this->generateFormClose();
93188 return $form;
94189 }
95190
96191 protected function generateBillingFields() {
97 - global $wgScriptPath;
 192+ global $wgScriptPath, $wgPayflowGatewayTest;
98193
99194 $form = '';
100195
101196 // amount
102197 $form .= '<tr>';
103198 $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">';
105200 $form .= '<tr>';
106201 $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>';
109204 $form .= '</tr>';
110205 $form .= '<tr>';
111206 $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>';
114213 $form .= '</tr>';
115214 $form .= '</table>';
116215 $form .= '</td>';
@@ -127,7 +226,23 @@
128227 $form .= '</tr>';
129228
130229 // 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>';
132247
133248 // expiry
134249 $form .= '<tr>';
@@ -152,19 +267,38 @@
153268 $form .= "</tr>";
154269
155270 // 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>';
157279
158280 // 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>';
160292
161 - // state
162 - $form .= $this->getStateField();
163 -
164 - // zip
165 - $form .= $this->getZipField();
166 -
167293 // 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+ */
169303
170304 // email
171305 $form .= '<tr>';
@@ -203,12 +337,39 @@
204338 $form = '';
205339 $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) );
206340 $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;' ), '* * *' );
208342 $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' ) );
210344 $form .= Xml::tags( 'div', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) );
211345 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text
212346 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info
213347 return $form;
214348 }
 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+ }
215376 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css
@@ -16,6 +16,25 @@
1717 margin-bottom: 0;
1818 font-weight: normal;
1919 }
 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+
2039 .payflow-cc-form-section {
2140 float: none;
2241 margin-right: 0em;
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php
@@ -198,7 +198,7 @@
199199 'payflowpro_gateway-please-complete' => 'Please complete your donation below ...',
200200 'payflowpro_gateway-description' => 'Description',
201201 'payflowpro_gateway-donation' => 'Donation',
202 - 'payflowpro_gateway-email-receipt' => 'Email receipt to',
 202+ 'payflowpro_gateway-email-receipt' => 'E-mail receipt to',
203203
204204 // For more USA states, see payflowpro_gateway.us-states.i18n.php.
205205 'payflowpro_gateway-state-dropdown-YY' => 'Select a State',
Property changes on: branches/fundraising/deployment/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
206206 Merged /trunk/extensions/DonationInterface:r76758-76828

Follow-up revisions

RevisionCommit summaryAuthorDate
r76840Merging from r76829 thru r76839 of trunkawjrichards21:45, 16 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76758Merging from r76614 thru r76757 of trunkawjrichards01:45, 16 November 2010
r76828no more double error messageskaldari19:38, 16 November 2010

Status & tagging log