Index: trunk/extensions/CentralNotice/special/SpecialBannerAllocation.php |
— | — | @@ -19,13 +19,19 @@ |
20 | 20 | * Handle different types of page requests |
21 | 21 | */ |
22 | 22 | function execute( $sub ) { |
23 | | - global $wgOut, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode; |
| 23 | + global $wgOut, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode, $wgNoticeProject; |
| 24 | + |
| 25 | + $locationSubmitted = false; |
24 | 26 | |
25 | | - if ( $wgRequest->wasPosted() ) { |
26 | | - $this->project = $wgRequest->getText( 'project', 'wikipedia' ); |
27 | | - $this->language = $wgRequest->getText( 'language', 'en' ); |
28 | | - $this->location = $wgRequest->getText( 'country', 'US' ); |
29 | | - } |
| 27 | + $this->project = $wgRequest->getText( 'project', 'wikipedia', $wgNoticeProject ); |
| 28 | + $this->language = $wgRequest->getText( 'language', $wgLanguageCode ); |
| 29 | + |
| 30 | + // If the form has been submitted, the country code should be passed along. |
| 31 | + $locationSubmitted = $wgRequest->getVal( 'country' ); |
| 32 | + $this->location = $locationSubmitted ? $locationSubmitted : $this->location; |
| 33 | + |
| 34 | + // Convert submitted location to boolean value. If it true, showList() will be called. |
| 35 | + $locationSubmitted = (boolean) $locationSubmitted; |
30 | 36 | |
31 | 37 | // Begin output |
32 | 38 | $this->setHeaders(); |
— | — | @@ -53,7 +59,7 @@ |
54 | 60 | // Begin Allocation selection fieldset |
55 | 61 | $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
56 | 62 | |
57 | | - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) ); |
| 63 | + $htmlOut .= Xml::openElement( 'form', array( 'method' => 'get' ) ); |
58 | 64 | $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-view-allocation' ) ); |
59 | 65 | $htmlOut .= Xml::tags( 'p', null, wfMsg( 'centralnotice-allocation-instructions' ) ); |
60 | 66 | |
— | — | @@ -116,7 +122,7 @@ |
117 | 123 | $wgOut->addHTML( $htmlOut ); |
118 | 124 | |
119 | 125 | // Handle form submissions |
120 | | - if ( $wgRequest->wasPosted() ) { |
| 126 | + if ( $locationSubmitted ) { |
121 | 127 | $this->showList(); |
122 | 128 | } |
123 | 129 | |