Index: trunk/extensions/CentralNotice/SpecialBannerAllocation.php |
— | — | @@ -6,7 +6,9 @@ |
7 | 7 | } |
8 | 8 | |
9 | 9 | class SpecialBannerAllocation extends UnlistedSpecialPage { |
10 | | - var $centralNoticeError; |
| 10 | + public $project = 'wikipedia'; |
| 11 | + public $language = 'en'; |
| 12 | + public $location = 'US'; |
11 | 13 | |
12 | 14 | function __construct() { |
13 | 15 | // Register special page |
— | — | @@ -21,6 +23,12 @@ |
22 | 24 | */ |
23 | 25 | function execute( $sub ) { |
24 | 26 | global $wgOut, $wgUser, $wgRequest, $wgScriptPath, $wgNoticeProjects, $wgLanguageCode; |
| 27 | + |
| 28 | + if ( $wgRequest->wasPosted() ) { |
| 29 | + $this->project = $wgRequest->getText( 'project', 'wikipedia' ); |
| 30 | + $this->language = $wgRequest->getText( 'language', 'en' ); |
| 31 | + $this->location = $wgRequest->getText( 'country', 'US' ); |
| 32 | + } |
25 | 33 | |
26 | 34 | // Begin output |
27 | 35 | $this->setHeaders(); |
— | — | @@ -58,7 +66,7 @@ |
59 | 67 | $htmlOut .= Xml::openElement( 'td' ); |
60 | 68 | $htmlOut .= Xml::openElement( 'select', array( 'name' => 'project' ) ); |
61 | 69 | foreach ( $wgNoticeProjects as $value ) { |
62 | | - $htmlOut .= Xml::option( $value, $value, $value == 'wikipedia' ); |
| 70 | + $htmlOut .= Xml::option( $value, $value, $value == $this->project ); |
63 | 71 | } |
64 | 72 | $htmlOut .= Xml::closeElement( 'select' ); |
65 | 73 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -74,11 +82,7 @@ |
75 | 83 | ksort( $languages ); |
76 | 84 | $htmlOut .= Xml::openElement( 'select', array( 'name' => 'language' ) ); |
77 | 85 | foreach( $languages as $code => $name ) { |
78 | | - $htmlOut .= Xml::option( |
79 | | - wfMsg( 'centralnotice-language-listing', $code, $name ), |
80 | | - $code, |
81 | | - $code == 'en' |
82 | | - ); |
| 86 | + $htmlOut .= Xml::option( wfMsg( 'centralnotice-language-listing', $code, $name ), $code, $code == $this->language ); |
83 | 87 | } |
84 | 88 | $htmlOut .= Xml::closeElement( 'select' ); |
85 | 89 | $htmlOut .= Xml::closeElement( 'td' ); |
— | — | @@ -89,11 +93,7 @@ |
90 | 94 | $countries = CentralNoticeDB::getCountriesList(); |
91 | 95 | $htmlOut .= Xml::openElement( 'select', array( 'name' => 'country' ) ); |
92 | 96 | foreach( $countries as $code => $name ) { |
93 | | - $htmlOut .= Xml::option( |
94 | | - $name, |
95 | | - $code, |
96 | | - $code == 'US' |
97 | | - ); |
| 97 | + $htmlOut .= Xml::option( $name, $code, $code == $this->location ); |
98 | 98 | } |
99 | 99 | $htmlOut .= Xml::closeElement( 'select' ); |
100 | 100 | $htmlOut .= Xml::closeElement( 'td' ); |