r74373 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74372‎ | r74373 | r74374 >
Date:18:11, 6 October 2010
Author:kaldari
Status:deferred
Tags:
Comment:
moving some stuff around for new designs
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php
@@ -21,6 +21,7 @@
2222 */
2323 public function getForm() {
2424 $form = $this->generateFormStart();
 25+ $form .= $this->generateCommentFields();
2526 $form .= $this->getCaptchaHTML();
2627 $form .= $this->generateFormSubmit();
2728 $form .= $this->generateFormEnd();
@@ -87,7 +88,7 @@
8889 $form .= Xml::closeElement( 'div' ); // close div#right-column
8990 $form .= Xml::closeElement( 'form' );
9091 $form .= Xml::closeElement( 'div' ); // close div#mw-creditcard-form
91 - $form .= $this->generateDonationFooter();
 92+ //$form .= $this->generateDonationFooter();
9293 $form .= Xml::closeElement( 'div' ); // div#close mw-creditcard
9394 return $form;
9495 }
@@ -139,47 +140,6 @@
140141 $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) .
141142 '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['emailAdd'] . '</span></td>';
142143 $form .= '</tr>';
143 -
144 - // amount
145 - $form .= '<tr>';
146 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
147 - $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "0.00" )', 'maxlength' => '10', 'id' => 'amount' ) ) .
148 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['invalidamount'] . '</span></td>';
149 - $form .= '</tr>';
150 -
151 - // currency
152 - $form .= '<tr>';
153 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency' ) . '</td>';
154 - $form .= '<td>' . $this->generateCurrencyDropdown() . '</td>';
155 - $form .= '</tr>';
156 -
157 - // card logos
158 - $form .= '<tr>';
159 - $form .= '<td />';
160 - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
161 - $form .= '</tr>';
162 -
163 - // card number
164 - $form .= '<tr>';
165 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) . '</td>';
166 - $form .= '<td>' . Xml::input( 'card_num', '30', $card_num, array( 'type' => 'text', 'maxlength' => '100', 'id' => 'card_num', 'class' => 'fullwidth', 'autocomplete' => 'off' ) ) .
167 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card_num'] . '</span>' .
168 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card'] . '</span></td>';
169 - $form .= '</tr>';
170 -
171 - // cvv
172 - $form .= '<tr>';
173 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . '</td>';
174 - $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off') ) .
175 - ' ' . '<a href="javascript:PopupCVV();">' . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' .
176 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['cvv'] . '</span></td>';
177 - $form .= '</tr>';
178 -
179 - // expiry
180 - $form .= '<tr>';
181 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>';
182 - $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>';
183 - $form .= '</tr>';
184144
185145 // street
186146 $form .= '<tr>';
@@ -237,7 +197,90 @@
238198 $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : '';
239199
240200 $form = '';
 201+
 202+ // amount
 203+ $form .= '<tr>';
 204+ $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 205+ $form .= '<td>' . Xml::radio( 'amount', 250 ) . '$250 ' .
 206+ Xml::radio( 'amount', 100 ) . '$100 ' .
 207+ Xml::radio( 'amount', 75 ) . '$75 ' .
 208+ Xml::radio( 'amount', 35 ) . '$35 ' .
 209+ Xml::radio( 'amount', -1, null, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amount'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "0.00" )', 'onblur' => 'document.getElementById("otherRadio").value = this.value', 'maxlength' => '10', 'id' => 'amount' ) ) .
 210+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['invalidamount'] . '</span></td>';
 211+ $form .= '</tr>';
 212+
 213+ // currency
 214+ $form .= '<tr>';
 215+ $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency' ) . '</td>';
 216+ $form .= '<td>' . $this->generateCurrencyDropdown() . '</td>';
 217+ $form .= '</tr>';
 218+
 219+ // card logos
 220+ $form .= '<tr>';
 221+ $form .= '<td />';
 222+ $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
 223+ $form .= '</tr>';
 224+
 225+ // card number
 226+ $form .= '<tr>';
 227+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) . '</td>';
 228+ $form .= '<td>' . Xml::input( 'card_num', '30', $card_num, array( 'type' => 'text', 'maxlength' => '100', 'id' => 'card_num', 'class' => 'fullwidth', 'autocomplete' => 'off' ) ) .
 229+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card_num'] . '</span>' .
 230+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card'] . '</span></td>';
 231+ $form .= '</tr>';
 232+
 233+ // cvv
 234+ $form .= '<tr>';
 235+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . '</td>';
 236+ $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off') ) .
 237+ ' ' . '<a href="javascript:PopupCVV();">' . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' .
 238+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['cvv'] . '</span></td>';
 239+ $form .= '</tr>';
 240+
 241+ // expiry
 242+ $form .= '<tr>';
 243+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>';
 244+ $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>';
 245+ $form .= '</tr>';
241246
242247 return $form;
243248 }
 249+
 250+ public function generateCommentFields() {
 251+ global $wgRequest;
 252+
 253+ $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-comment_form' ));
 254+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-comments' ), wfMsg( 'donate_interface-comment-title' ));
 255+ $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
 256+ $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-comment' ) );
 257+
 258+ //comment
 259+ $form .= '<tr>';
 260+ $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
 261+ $form .= '<td class="comment-field">' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
 262+ $form .= '</tr>';
 263+
 264+ // anonymous
 265+ $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true;
 266+ $form .= '<tr>';
 267+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
 268+ $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
 269+ $form .= '</tr>';
 270+
 271+ // email agreement
 272+ $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true;
 273+ $form .= '<tr>';
 274+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
 275+ $form .= ' ';
 276+ // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
 277+ $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
 278+ $form .= wfMsg( 'donate_interface-email-agreement' );
 279+ $form .= Xml::closeElement( 'label' );
 280+ $form .= '</td>';
 281+ $form .= '</tr>';
 282+
 283+ $form .= Xml::closeElement( 'table' );
 284+ $form .= Xml::closeElement( 'div' );
 285+ return $form;
 286+ }
244287 }
\ No newline at end of file
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php
@@ -47,8 +47,7 @@
4848 $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>";
4949 $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => '', 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) );
5050
51 - $form .= parent::generatePersonalContainer();
52 - $form .= $this->generateCommentFields();
 51+ $form .= $this->generateBillingContainer();
5352 return $form;
5453 }
5554
@@ -74,42 +73,119 @@
7574 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-cc_form_letter_inside
7675 return $form;
7776 }
 77+
 78+ protected function generateBillingContainer() {
 79+ $form = '';
 80+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); ;
 81+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' ));
 82+ $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
 83+
 84+ $form .= $this->generateBillingFields();
 85+
 86+ $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
 87+ $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info
7888
79 - public function generateCommentFields() {
80 - global $wgRequest;
 89+ return $form;
 90+ }
 91+
 92+ protected function generateBillingFields() {
 93+ global $wgScriptPath, $wgPayflowGatewayTest;
 94+ $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : '';
 95+ $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : '';
 96+ $form = '';
8197
82 - $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-comment_form' ));
83 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-comments' ), wfMsg( 'donate_interface-comment-title' ));
84 - $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
85 - $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-comment' ) );
86 -
87 - //comment
 98+ // name
8899 $form .= '<tr>';
89 - $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
90 - $form .= '<td class="comment-field">' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
 100+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-name' ), 'fname' ) . '</td>';
 101+ $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "First" )', 'maxlength' => '15', 'class' => 'required', 'id' => 'fname' ) ) .
 102+ 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>';
 103+ $form .= "</tr>";
 104+
 105+ // email
 106+ $form .= '<tr>';
 107+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-email' ), 'emailAdd' ) . '</td>';
 108+ $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) .
 109+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['emailAdd'] . '</span></td>';
91110 $form .= '</tr>';
92111
93 - // anonymous
94 - $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true;
 112+ // amount
95113 $form .= '<tr>';
96 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
97 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
 114+ $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 115+ $form .= '<td>' . Xml::radio( 'amount', 250 ) . '$250 ' .
 116+ Xml::radio( 'amount', 100 ) . '$100 ' .
 117+ Xml::radio( 'amount', 75 ) . '$75 ' .
 118+ Xml::radio( 'amount', 35 ) . '$35 ' .
 119+ Xml::radio( 'amount', -1, null, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amount'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "0.00" )', 'onblur' => 'document.getElementById("otherRadio").value = this.value', 'maxlength' => '10', 'id' => 'amount' ) ) .
 120+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['invalidamount'] . '</span></td>';
98121 $form .= '</tr>';
 122+
 123+ // currency
 124+ $form .= '<tr>';
 125+ $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency' ) . '</td>';
 126+ $form .= '<td>' . $this->generateCurrencyDropdown() . '</td>';
 127+ $form .= '</tr>';
 128+
 129+ // card logos
 130+ $form .= '<tr>';
 131+ $form .= '<td />';
 132+ $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
 133+ $form .= '</tr>';
 134+
 135+ // card number
 136+ $form .= '<tr>';
 137+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-card-num' ), 'card_num' ) . '</td>';
 138+ $form .= '<td>' . Xml::input( 'card_num', '30', $card_num, array( 'type' => 'text', 'maxlength' => '100', 'id' => 'card_num', 'class' => 'fullwidth', 'autocomplete' => 'off' ) ) .
 139+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card_num'] . '</span>' .
 140+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['card'] . '</span></td>';
 141+ $form .= '</tr>';
 142+
 143+ // cvv
 144+ $form .= '<tr>';
 145+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . '</td>';
 146+ $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off') ) .
 147+ ' ' . '<a href="javascript:PopupCVV();">' . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' .
 148+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['cvv'] . '</span></td>';
 149+ $form .= '</tr>';
 150+
 151+ // expiry
 152+ $form .= '<tr>';
 153+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>';
 154+ $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>';
 155+ $form .= '</tr>';
99156
100 - // email agreement
101 - $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true;
 157+ // street
102158 $form .= '<tr>';
103 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
104 - $form .= ' ';
105 - // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
106 - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
107 - $form .= wfMsg( 'donate_interface-email-agreement' );
108 - $form .= Xml::closeElement( 'label' );
109 - $form .= '</td>';
 159+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-street' ), 'street' ) . '</td>';
 160+ $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'maxlength' => '30', 'id' => 'street', 'class' => 'fullwidth' ) ) .
 161+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['street'] . '</span></td>';
110162 $form .= '</tr>';
111163
112 - $form .= Xml::closeElement( 'table' );
113 - $form .= Xml::closeElement( 'div' );
 164+ // city
 165+ $form .= '<tr>';
 166+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-city' ), 'city' ) . '</td>';
 167+ $form .= '<td>' . Xml::input( 'city', '30', $this->form_data['city'], array( 'type' => 'text', 'maxlength' => '20', 'id' => 'city', 'class' => 'fullwidth' ) ) .
 168+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['city'] . '</span></td>';
 169+ $form .= '</tr>';
 170+
 171+ // state
 172+ $form .= '<tr>';
 173+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . '</td>';
 174+ $form .= '<td>' . $this->generateStateDropdown() . ' ' . wfMsg( 'payflowpro_gateway-state-in-us' ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['state'] . '</span></td>';
 175+ $form .= '</tr>';
 176+
 177+ // zip
 178+ $form .= '<tr>';
 179+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip' ) . '</td>';
 180+ $form .= '<td>' . Xml::input( 'zip', '30', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '9', 'id' => 'zip', 'class' => 'fullwidth' ) ) .
 181+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['zip'] . '</span></td>';
 182+ $form .= '</tr>';
 183+
 184+ // country
 185+ $form .= '<tr>';
 186+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>';
 187+ $form .= '<td>' . $this->generateCountryDropdown() . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['country'] . '</span></td>';
 188+ $form .= '</tr>';
 189+
114190 return $form;
115191 }
116192

Status & tagging log