r76696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76695‎ | r76696 | r76697 >
Date:19:26, 15 November 2010
Author:kaldari
Status:deferred
Tags:
Comment:
new form
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php (added) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css (added) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter3.php
@@ -0,0 +1,151 @@
 2+<?php
 3+
 4+class PayflowProGateway_Form_TwoStepTwoColumnLetter3 extends PayflowProGateway_Form_TwoStepTwoColumn {
 5+ public function __construct( &$form_data, &$form_errors ) {
 6+ global $wgScriptPath;
 7+
 8+ // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this
 9+ if ( !strlen( $this->getStylePath() ) ) {
 10+ $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css' );
 11+ }
 12+
 13+ parent::__construct( $form_data, $form_errors );
 14+ }
 15+
 16+ public function generateFormStart() {
 17+ global $wgOut, $wgRequest;
 18+
 19+ $form = parent::generateBannerHeader();
 20+
 21+ $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) );
 22+ $form .= Xml::openElement( 'tr' );
 23+ $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) );
 24+
 25+ $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' );
 26+ // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string
 27+ if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ];
 28+
 29+ $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : '';
 30+ // if the template doesn't exist, prevent the display of the red link
 31+ if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL;
 32+ $form .= $template;
 33+
 34+ $form .= Xml::closeElement( 'td' );
 35+
 36+ $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) );
 37+
 38+ // add noscript tags for javascript disabled browsers
 39+ $form .= $this->getNoScript();
 40+
 41+ $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) );
 42+
 43+ // provide a place at the top of the form for displaying general messages
 44+ if ( $this->form_errors['general'] ) {
 45+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 46+ if ( is_array( $this->form_errors['general'] ) ) {
 47+ foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
 48+ $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
 49+ }
 50+ } else {
 51+ $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
 52+ }
 53+ $form .= Xml::closeElement( 'div' ); // close div#mw-payflow-general-error
 54+ }
 55+
 56+ // Xml::element seems to convert html to htmlentities
 57+ $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' ) );
 59+
 60+ $form .= $this->generateBillingContainer();
 61+ return $form;
 62+ }
 63+
 64+ public function generateFormEnd() {
 65+ $form = '';
 66+ $form .= $this->generateFormClose();
 67+ return $form;
 68+ }
 69+
 70+ protected function generateBillingContainer() {
 71+ $form = '';
 72+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) );
 73+ $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
 74+ $form .= $this->generateBillingFields();
 75+ $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
 76+ $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-personal-info
 77+
 78+ return $form;
 79+ }
 80+
 81+ protected function generateBillingFields() {
 82+ global $wgScriptPath;
 83+
 84+ $form = '';
 85+
 86+ // name
 87+ $form .= $this->getNameField();
 88+
 89+ // email
 90+ $form .= $this->getEmailField();
 91+
 92+ // amount
 93+ $form .= '<tr>';
 94+ $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>';
 95+ $form .= '</tr>';
 96+ $form .= '<tr>';
 97+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>';
 98+ $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) .
 99+ ' ' . $this->generateCurrencyDropdown() . '</td>';
 100+ $form .= '</tr>';
 101+
 102+ // card logos
 103+ $form .= '<tr>';
 104+ $form .= '<td />';
 105+ $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>';
 106+ $form .= '</tr>';
 107+
 108+ // card number
 109+ $form .= $this->getCardNumberField();
 110+
 111+ // cvv
 112+ $form .= $this->getCvvField();
 113+
 114+ // expiry
 115+ $form .= $this->getExpiryField();
 116+
 117+ // street
 118+ $form .= $this->getStreetField();
 119+
 120+ // city
 121+ $form .= $this->getCityField();
 122+
 123+ // state
 124+ $form .= $this->getStateField();
 125+ // zip
 126+ $form .= $this->getZipField();
 127+
 128+ // country
 129+ $form .= $this->getCountryField();
 130+
 131+ return $form;
 132+ }
 133+
 134+ /**
 135+ * Generate form closing elements
 136+ */
 137+ public function generateFormClose() {
 138+ $form = '';
 139+ // add hidden fields
 140+ $hidden_fields = $this->getHiddenFields();
 141+ foreach ( $hidden_fields as $field => $value ) {
 142+ $form .= Html::hidden( $field, $value );
 143+ }
 144+
 145+ $form .= Xml::closeElement( 'form' ); // close form 'payment'
 146+ $form .= $this->generateDonationFooter();
 147+ $form .= Xml::closeElement( 'td' );
 148+ $form .= Xml::closeElement( 'tr' );
 149+ $form .= Xml::closeElement( 'table' );
 150+ return $form;
 151+ }
 152+}
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter3.css
@@ -0,0 +1,104 @@
 2+.payflow-cc-form-section {
 3+ float: none;
 4+ margin-right: 0em;
 5+ margin-bottom: 1em;
 6+}
 7+
 8+#payflowpro_gateway-cc_form_container {
 9+ width: 100%;
 10+}
 11+
 12+#payflowpro_gateway-cc_form_form {
 13+ width: 475px;
 14+ float: right;
 15+ margin-left: 2em;
 16+ padding-left: 2em;
 17+ border-left: 1px solid #BBBBBB;
 18+}
 19+
 20+#payflowpro_gateway-cc_form_letter {
 21+ height: 100%;
 22+}
 23+
 24+#payflowpro_gateway-cc_form_letter p {
 25+ font-size: 1.125em;
 26+ margin-bottom: 1.2em;
 27+}
 28+
 29+#payflowpro_gateway-personal-info {
 30+ margin-right:0 !important;
 31+}
 32+
 33+#payflowpro_gateway-donate-addl-info-secure-logos {
 34+ float: left;
 35+ margin-right: 2em;
 36+}
 37+
 38+#payflowpro_gateway-cc_form_letter_inside {
 39+ padding-top: .5em;
 40+}
 41+
 42+#payflowpro_gateway-cc_otherways {
 43+ padding-top: .5em;
 44+ display: block;
 45+}
 46+#payflowpro_gateway-donate-addl-info {
 47+ margin-top:3em !important;
 48+ margin-bottom:1em !important;
 49+}
 50+
 51+#appeal {
 52+ background-color:transparent;
 53+ border-color:transparent;
 54+ border-style:solid;
 55+ border-width:1px 0 1px 1px;
 56+ padding:16px 24px 24px;
 57+}
 58+#appeal-head {
 59+ font-size:1.5em;
 60+ line-height:1.125em;
 61+ padding-bottom:0.5em;
 62+ padding-top:0.125em;
 63+}
 64+#appeal-body {
 65+ font-size:1.125em;
 66+ margin-bottom:1em;
 67+ padding:0.2em 0;
 68+}
 69+#donate {
 70+ background-color:#A9D9A3;
 71+ border:1px solid #5EAC58;
 72+ padding:16px 24px 24px;
 73+ width:400px;
 74+}
 75+#donate-head {
 76+ border-color:#5EAC58;
 77+ font-size:1.5em;
 78+ line-height:1.125em;
 79+ padding-bottom:0.5em;
 80+ padding-top:0.125em;
 81+}
 82+#donate-body {
 83+ font-size:1.125em;
 84+ margin-bottom:1em;
 85+}
 86+
 87+/* Hiding content border */
 88+table {
 89+ background-color: transparent;
 90+}
 91+div#content {
 92+ background-color: transparent !important;
 93+ background-image: none !important;
 94+}
 95+div#mw-head-base {
 96+ background-image: none !important;
 97+}
 98+#footer {
 99+ background-image: none !important;
 100+}
 101+
 102+/* Hiding stuff we don't need */
 103+h1#firstHeading, div#contentSub {
 104+ display: none;
 105+}

Status & tagging log