r76907 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76906‎ | r76907 | r76908 >
Date:21:23, 17 November 2010
Author:kaldari
Status:deferred
Tags:
Comment:
fix for canada
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php (modified) (history)
  • /trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetterCA.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetterCA.php
@@ -186,4 +186,38 @@
187187
188188 return $state_menu;
189189 }
 190+
 191+ public function generateCountryDropdown( $defaultCountry = 124 ) {
 192+ $country_options = '';
 193+
 194+ // create a new array of countries with potentially translated country names for alphabetizing later
 195+ foreach ( $this->getCountries() as $iso_value => $full_name ) {
 196+ $countries[ $iso_value ] = wfMsg( 'payflowpro_gateway-country-dropdown-' . $iso_value );
 197+ }
 198+
 199+ // alphabetically sort the country names
 200+ asort( $countries, SORT_STRING );
 201+
 202+ // generate a dropdown option for each country
 203+ foreach ( $countries as $iso_value => $full_name ) {
 204+ if ( $this->form_data[ 'country' ] ) {
 205+ $selected = ( $iso_value == $this->form_data[ 'country' ] ) ? true : false;
 206+ } else {
 207+ $selected = ( $iso_value == $defaultCountry ) ? true : false; // Select default
 208+ }
 209+ $country_options .= Xml::option( $full_name, $iso_value, $selected );
 210+ }
 211+
 212+ // build the actual select
 213+ $country_menu = Xml::openElement(
 214+ 'select',
 215+ array(
 216+ 'name' => 'country',
 217+ 'id' => 'country'
 218+ ) );
 219+ $country_menu .= $country_options;
 220+ $country_menu .= Xml::closeElement( 'select' );
 221+
 222+ return $country_menu;
 223+ }
190224 }
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/Form.php
@@ -153,7 +153,7 @@
154154 if ( $this->form_data[ 'country' ] ) {
155155 $selected = ( $iso_value == $this->form_data[ 'country' ] ) ? true : false;
156156 } else {
157 - $selected = ( $iso_value == $defaultCountry ) ? true : false; // Default to United States
 157+ $selected = ( $iso_value == $defaultCountry ) ? true : false; // Select default
158158 }
159159 $country_options .= Xml::option( $full_name, $iso_value, $selected );
160160 }

Status & tagging log