r74389 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74388‎ | r74389 | r74390 >
Date:21:12, 6 October 2010
Author:kaldari
Status:deferred
Tags:
Comment:
version of horizontal form with paypal button
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css
@@ -32,10 +32,6 @@
3333 margin-right:0 !important;
3434 }
3535
36 -#payflowpro_gateway-form-submit {
37 - margin-bottom: 5em;
38 -}
39 -
4036 #payflowpro_gateway-donate-addl-info-secure-logos {
4137 float: left;
4238 margin-right: 2em;
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumn.php
@@ -21,7 +21,6 @@
2222 */
2323 public function getForm() {
2424 $form = $this->generateFormStart();
25 - $form .= $this->generateCommentFields();
2625 $form .= $this->getCaptchaHTML();
2726 $form .= $this->generateFormSubmit();
2827 $form .= $this->generateFormEnd();
@@ -88,6 +87,25 @@
8988 }
9089 $form .= Xml::closeElement( 'div' ); // close div#right-column
9190 $form .= Xml::closeElement( 'form' );
 91+ $form .= <<<EOT
 92+<script type="text/javascript">
 93+var fname = document.getElementById('fname');
 94+var lname = document.getElementById('lname');
 95+var amountOther = document.getElementById('amountOther');
 96+if (fname.value == '') {
 97+ fname.style.color = '#999999';
 98+ fname.value = 'First';
 99+}
 100+if (lname.value == '') {
 101+ lname.style.color = '#999999';
 102+ lname.value = 'Last';
 103+}
 104+if (amountOther.value == '') {
 105+ amountOther.style.color = '#999999';
 106+ amountOther.value = 'Other';
 107+}
 108+</script>
 109+EOT;
92110 $form .= Xml::closeElement( 'div' ); // close div#mw-creditcard-form
93111 //$form .= $this->generateDonationFooter();
94112 $form .= Xml::closeElement( 'div' ); // div#close mw-creditcard
@@ -124,6 +142,7 @@
125143
126144 protected function generatePersonalFields() {
127145 global $wgScriptPath, $wgPayflowGatewayTest;
 146+ $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway";
128147 $card_num = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'card_num' ] : '';
129148 $cvv = ( $wgPayflowGatewayTest ) ? $this->form_data[ 'cvv' ] : '';
130149 $form = '';
@@ -141,40 +160,56 @@
142161 $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) .
143162 '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['emailAdd'] . '</span></td>';
144163 $form .= '</tr>';
145 -
146 - // street
 164+
 165+ //comment message
147166 $form .= '<tr>';
148 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-street' ), 'street' ) . '</td>';
149 - $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'maxlength' => '30', 'id' => 'street', 'class' => 'fullwidth' ) ) .
150 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['street'] . '</span></td>';
 167+ $form .= '<td colspan="2">';
 168+ $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
 169+ $form .= '</td>';
151170 $form .= '</tr>';
152 -
153 - // city
 171+
 172+ //comment
154173 $form .= '<tr>';
155 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-city' ), 'city' ) . '</td>';
156 - $form .= '<td>' . Xml::input( 'city', '30', $this->form_data['city'], array( 'type' => 'text', 'maxlength' => '20', 'id' => 'city', 'class' => 'fullwidth' ) ) .
157 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['city'] . '</span></td>';
 174+ $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
 175+ $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
158176 $form .= '</tr>';
 177+
 178+ // anonymous
 179+ $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true;
 180+ $form .= '<tr>';
 181+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
 182+ $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
 183+ $form .= '</tr>';
159184
160 - // state
 185+ // email agreement
 186+ $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true;
161187 $form .= '<tr>';
162 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . '</td>';
163 - $form .= '<td>' . $this->generateStateDropdown() . ' ' . wfMsg( 'payflowpro_gateway-state-in-us' ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['state'] . '</span></td>';
 188+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
 189+ $form .= ' ';
 190+ // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
 191+ $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
 192+ $form .= wfMsg( 'donate_interface-email-agreement' );
 193+ $form .= Xml::closeElement( 'label' );
 194+ $form .= '</td>';
164195 $form .= '</tr>';
165 -
166 - // zip
 196+
 197+ // amount
167198 $form .= '<tr>';
168 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip' ) . '</td>';
169 - $form .= '<td>' . Xml::input( 'zip', '30', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '9', 'id' => 'zip', 'class' => 'fullwidth' ) ) .
170 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['zip'] . '</span></td>';
 199+ $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 200+ $form .= '<td>' . Xml::radio( 'amount', 250 ) . '250 ' .
 201+ Xml::radio( 'amount', 100 ) . '100 ' .
 202+ Xml::radio( 'amount', 75 ) . '75 ' .
 203+ Xml::radio( 'amount', 35 ) . '35 ' .
 204+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['invalidamount'] . '</span></td>';
171205 $form .= '</tr>';
172206
173 - // country
 207+ // currency
174208 $form .= '<tr>';
175 - $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>';
176 - $form .= '<td>' . $this->generateCountryDropdown() . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['country'] . '</span></td>';
177 - $form .= '</tr>';
178 -
 209+ $form .= '<td class="label"></td>';
 210+ $form .= '<td>' . Xml::radio( 'amount', -1, null, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, "Other" )', 'onblur' => 'document.getElementById("otherRadio").value = this.value', 'maxlength' => '10', 'id' => 'amountOther' ) ) .
 211+ ' ' . $this->generateCurrencyDropdown() . '</td>';
 212+ $form .= '</tr>';
 213+
179214 return $form;
180215 }
181216
@@ -199,23 +234,6 @@
200235
201236 $form = '';
202237
203 - // amount
204 - $form .= '<tr>';
205 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
206 - $form .= '<td>' . Xml::radio( 'amount', 250 ) . '250 ' .
207 - Xml::radio( 'amount', 100 ) . '100 ' .
208 - Xml::radio( 'amount', 75 ) . '75 ' .
209 - Xml::radio( 'amount', 35 ) . '35 ' .
210 - 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' ) ) .
211 - '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['invalidamount'] . '</span></td>';
212 - $form .= '</tr>';
213 -
214 - // currency
215 - $form .= '<tr>';
216 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-currency-label' ), 'currency' ) . '</td>';
217 - $form .= '<td>' . $this->generateCurrencyDropdown() . '</td>';
218 - $form .= '</tr>';
219 -
220238 // card logos
221239 $form .= '<tr>';
222240 $form .= '<td />';
@@ -243,45 +261,40 @@
244262 $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-expiration' ), 'expiration' ) . '</td>';
245263 $form .= '<td>' . $this->generateExpiryMonthDropdown() . $this->generateExpiryYearDropdown() . '</td>';
246264 $form .= '</tr>';
247 -
248 - return $form;
249 - }
250 -
251 - public function generateCommentFields() {
252 - global $wgRequest;
253265
254 - $form = Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-comment_form' ));
255 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-comments' ), wfMsg( 'donate_interface-comment-title' ));
256 - $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
257 - $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-comment' ) );
258 -
259 - //comment
 266+ // street
260267 $form .= '<tr>';
261 - $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
262 - $form .= '<td class="comment-field">' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
 268+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-street' ), 'street' ) . '</td>';
 269+ $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'maxlength' => '30', 'id' => 'street', 'class' => 'fullwidth' ) ) .
 270+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['street'] . '</span></td>';
263271 $form .= '</tr>';
264 -
265 - // anonymous
266 - $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true;
 272+
 273+ // city
267274 $form .= '<tr>';
268 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
269 - $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
 275+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-city' ), 'city' ) . '</td>';
 276+ $form .= '<td>' . Xml::input( 'city', '30', $this->form_data['city'], array( 'type' => 'text', 'maxlength' => '20', 'id' => 'city', 'class' => 'fullwidth' ) ) .
 277+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['city'] . '</span></td>';
270278 $form .= '</tr>';
271279
272 - // email agreement
273 - $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true;
 280+ // state
274281 $form .= '<tr>';
275 - $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
276 - $form .= ' ';
277 - // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
278 - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
279 - $form .= wfMsg( 'donate_interface-email-agreement' );
280 - $form .= Xml::closeElement( 'label' );
281 - $form .= '</td>';
 282+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-state' ), 'state' ) . '</td>';
 283+ $form .= '<td>' . $this->generateStateDropdown() . ' ' . wfMsg( 'payflowpro_gateway-state-in-us' ) . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['state'] . '</span></td>';
282284 $form .= '</tr>';
 285+
 286+ // zip
 287+ $form .= '<tr>';
 288+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-postal' ), 'zip' ) . '</td>';
 289+ $form .= '<td>' . Xml::input( 'zip', '30', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '9', 'id' => 'zip', 'class' => 'fullwidth' ) ) .
 290+ '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['zip'] . '</span></td>';
 291+ $form .= '</tr>';
 292+
 293+ // country
 294+ $form .= '<tr>';
 295+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-country' ), 'country' ) . '</td>';
 296+ $form .= '<td>' . $this->generateCountryDropdown() . '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['country'] . '</span></td>';
 297+ $form .= '</tr>';
283298
284 - $form .= Xml::closeElement( 'table' );
285 - $form .= Xml::closeElement( 'div' );
286299 return $form;
287300 }
288301 }
\ No newline at end of file
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php
@@ -108,6 +108,38 @@
109109 '<span class="creditcard-error-msg">' . ' ' . $this->form_errors['emailAdd'] . '</span></td>';
110110 $form .= '</tr>';
111111
 112+ //comment message
 113+ $form .= '<tr>';
 114+ $form .= '<td colspan="2">';
 115+ $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
 116+ $form .= '</td>';
 117+ $form .= '</tr>';
 118+
 119+ //comment
 120+ $form .= '<tr>';
 121+ $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
 122+ $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
 123+ $form .= '</tr>';
 124+
 125+ // anonymous
 126+ $comment_opt_value = ( $this->form_data[ 'numAttempt' ] ) ? $this->form_data[ 'comment-option' ] : true;
 127+ $form .= '<tr>';
 128+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value );
 129+ $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>';
 130+ $form .= '</tr>';
 131+
 132+ // email agreement
 133+ $email_opt_value = ( $this->form_data[ 'numAttempt' ]) ? $this->form_data[ 'email-opt' ] : true;
 134+ $form .= '<tr>';
 135+ $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
 136+ $form .= ' ';
 137+ // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
 138+ $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
 139+ $form .= wfMsg( 'donate_interface-email-agreement' );
 140+ $form .= Xml::closeElement( 'label' );
 141+ $form .= '</td>';
 142+ $form .= '</tr>';
 143+
112144 // amount
113145 $form .= '<tr>';
114146 $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -23,6 +23,7 @@
2424 $wgAutoloadClasses['PayflowProGateway'] = $dir . 'payflowpro_gateway.body.php';
2525 $wgAutoloadClasses[ 'PayflowProGateway_Form' ] = $dir . 'forms/Form.php';
2626 $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumn' ] = $dir . 'forms/TwoColumn.php';
 27+$wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnPayPal' ] = $dir . 'forms/TwoColumnPayPal.php';
2728 $wgAutoloadClasses[ 'PayflowProGateway_Form_TwoColumnLetter' ] = $dir . 'forms/TwoColumnLetter.php';
2829 $wgAutoloadClasses[ 'PayflowProGateway_Form_SingleColumn' ] = $dir . 'forms/SingleColumn.php';
2930 $wgExtensionMessagesFiles['PayflowProGateway'] = $dir . 'payflowpro_gateway.i18n.php';
Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css
@@ -28,6 +28,7 @@
2929 #payflowpro_gateway-form-submit {
3030 margin-top: 1em;
3131 text-align: center;
 32+ margin-bottom: 5em;
3233 }
3334
3435 #payflowpro_gateway-donate-addl-info {
@@ -41,17 +42,13 @@
4243 #payflow-table-donor {
4344 }
4445
45 -#payflow-table-donor td.label, #payflow-table-comment td.label {
 46+#payflow-table-donor td.label, #payflow-table-comment td.label, #payflow-table-cc td.label {
4647 text-align: right;
4748 display: block;
4849 padding-right: 1em;
4950 width: 90px;
5051 }
5152
52 -#payflow-table-comment td.comment-field {
53 - width: 99%;
54 -}
55 -
5653 #payflow-table-comment td.check-option {
5754 padding-left: 3em;
5855 }

Status & tagging log