http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73268

Revision: 73268
Author:   kaldari
Date:     2010-09-18 01:21:50 +0000 (Sat, 18 Sep 2010)

Log Message:
-----------
retain form state (interface not yet localizable)

Modified Paths:
--------------
    trunk/extensions/CentralNotice/SpecialBannerAllocation.php

Modified: trunk/extensions/CentralNotice/SpecialBannerAllocation.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerAllocation.php  2010-09-18 
01:09:40 UTC (rev 73267)
+++ trunk/extensions/CentralNotice/SpecialBannerAllocation.php  2010-09-18 
01:21:50 UTC (rev 73268)
@@ -6,7 +6,9 @@
 }
 
 class SpecialBannerAllocation extends UnlistedSpecialPage {
-       var $centralNoticeError;
+       public $project = 'wikipedia';
+       public $language = 'en';
+       public $location = 'US';
        
        function __construct() {
                // Register special page
@@ -21,6 +23,12 @@
         */
        function execute( $sub ) {
                global $wgOut, $wgUser, $wgRequest, $wgScriptPath, 
$wgNoticeProjects, $wgLanguageCode;
+               
+               if ( $wgRequest->wasPosted() ) {
+                       $this->project = $wgRequest->getText( 'project', 
'wikipedia' );
+                       $this->language = $wgRequest->getText( 'language', 'en' 
);
+                       $this->location = $wgRequest->getText( 'country', 'US' 
);
+               }
 
                // Begin output
                $this->setHeaders();
@@ -58,7 +66,7 @@
                $htmlOut .= Xml::openElement( 'td' );
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'project' ) );
                foreach ( $wgNoticeProjects as $value ) {
-                       $htmlOut .= Xml::option( $value, $value, $value == 
'wikipedia' );
+                       $htmlOut .= Xml::option( $value, $value, $value == 
$this->project );
                }
                $htmlOut .= Xml::closeElement( 'select' );
                $htmlOut .= Xml::closeElement( 'td' );
@@ -74,11 +82,7 @@
                ksort( $languages );
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'language' ) );
                foreach( $languages as $code => $name ) {
-                       $htmlOut .= Xml::option(
-                               wfMsg( 'centralnotice-language-listing', $code, 
$name ),
-                               $code,
-                               $code == 'en'
-                       );
+                       $htmlOut .= Xml::option( wfMsg( 
'centralnotice-language-listing', $code, $name ), $code, $code == 
$this->language );
                }
                $htmlOut .= Xml::closeElement( 'select' );
                $htmlOut .= Xml::closeElement( 'td' );
@@ -89,11 +93,7 @@
                $countries = CentralNoticeDB::getCountriesList();
                $htmlOut .= Xml::openElement( 'select', array( 'name' => 
'country' ) );
                foreach( $countries as $code => $name ) {
-                       $htmlOut .= Xml::option(
-                               $name,
-                               $code,
-                               $code == 'US'
-                       );
+                       $htmlOut .= Xml::option( $name, $code, $code == 
$this->location );
                }
                $htmlOut .= Xml::closeElement( 'select' );
                $htmlOut .= Xml::closeElement( 'td' );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to