r107015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107014‎ | r107015 | r107016 >
Date:23:56, 21 December 2011
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/CentralNotice (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.db.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticeBannerLogPager.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticeCampaignLogPager.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticePageLogPager.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/bannerstats.js (added) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/centralnotice.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerAllocation.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNotice.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNotice.php
@@ -1102,6 +1102,7 @@
11031103 function addCampaign( $noticeName, $enabled, $start, $projects,
11041104 $project_languages, $geotargeted, $geo_countries )
11051105 {
 1106+ $noticeName = trim( $noticeName );
11061107 if ( CentralNoticeDB::campaignExists( $noticeName ) ) {
11071108 $this->showError( 'centralnotice-notice-exists' );
11081109 return null;
@@ -1669,7 +1670,9 @@
16701671 * @return multiple select list
16711672 */
16721673 function geoMultiSelector( $selected = array() ) {
1673 - $countries = CentralNoticeDB::getCountriesList();
 1674+ global $wgLang;
 1675+ $userLanguageCode = $wgLang->getCode();
 1676+ $countries = CentralNoticeDB::getCountriesList( $userLanguageCode );
16741677 $options = "\n";
16751678 foreach( $countries as $code => $name ) {
16761679 $options .= Xml::option(
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNotice.php
___________________________________________________________________
Modified: svn:mergeinfo
16771680 Merged /trunk/extensions/CentralNotice/special/SpecialCentralNotice.php:r103297,104003,104210,104999,105015,105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerAllocation.php
@@ -14,7 +14,7 @@
1515 * Handle different types of page requests
1616 */
1717 function execute( $sub ) {
18 - global $wgOut, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode, $wgNoticeProject;
 18+ global $wgOut, $wgLang, $wgRequest, $wgExtensionAssetsPath, $wgNoticeProjects, $wgLanguageCode, $wgNoticeProject;
1919
2020 $locationSubmitted = false;
2121
@@ -32,7 +32,7 @@
3333 $this->setHeaders();
3434
3535 // Output ResourceLoader module for styling and javascript functions
36 - $wgOut->addModules( 'ext.centralNotice.interface' );
 36+ $wgOut->addModules( array( 'ext.centralNotice.interface', 'ext.centralNotice.bannerStats' ) );
3737
3838 // Initialize error variable
3939 $this->centralNoticeError = false;
@@ -99,7 +99,8 @@
100100 $htmlOut .= Xml::tags( 'td', array(), wfMsg( 'centralnotice-country' ) );
101101 $htmlOut .= Html::openElement( 'td' );
102102
103 - $countries = CentralNoticeDB::getCountriesList();
 103+ $userLanguageCode = $wgLang->getCode();
 104+ $countries = CentralNoticeDB::getCountriesList( $userLanguageCode );
104105
105106 $htmlOut .= Html::openElement( 'select', array( 'name' => 'country' ) );
106107
@@ -160,23 +161,34 @@
161162
162163 $bannerList = $bannerLister->getJsonList();
163164 $banners = FormatJson::decode( $bannerList, true );
 165+ $campaigns = array();
164166 $anonBanners = array();
165167 $accountBanners = array();
166168 $anonWeight = 0;
167169 $accountWeight = 0;
168170
169171 if ( $banners ) {
 172+
170173 foreach ( $banners as $banner ) {
171 - if ($banner['display_anon']) {
 174+ if ( $banner['display_anon'] ) {
172175 $anonBanners[] = $banner;
173176 $anonWeight += $banner['weight'];
174177 }
175178
176 - if ($banner['display_account']) {
 179+ if ( $banner['display_account'] ) {
177180 $accountBanners[] = $banner;
178181 $accountWeight += $banner['weight'];
179182 }
 183+
 184+ if ( $banner['campaign'] ) {
 185+ $campaigns[] = $banner['campaign'];
 186+ }
180187 }
 188+
 189+ // Build campaign list for bannerstats.js
 190+ $campaignList = FormatJson::encode( $campaigns );
 191+ $js = "wgCentralNoticeAllocationCampaigns = $campaignList;";
 192+ $htmlOut .= Html::inlineScript( $js );
181193
182194 if ( $anonBanners && $anonWeight > 0 ) {
183195 $htmlOut .= $this->getTable( wfMsg ( 'centralnotice-banner-anonymous' ), $anonBanners, $anonWeight );
@@ -223,12 +235,16 @@
224236
225237 $htmlOut .= wfMsg ( 'percent', $wgLang->formatNum( $percentage ) );
226238 $htmlOut .= Html::closeElement( 'td' );
227 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 239+
 240+ $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) );
 241+ // The span class is used by bannerstats.js to find where to insert the stats
 242+ $htmlOut .= Html::openElement( 'span',
 243+ array( 'class' => 'cn-'.$banner['campaign'].'-'.$banner['name'] ) );
 244+ $htmlOut .= $sk->makeLinkObj( $viewBanner, htmlspecialchars( $banner['name'] ),
 245+ 'template=' . urlencode( $banner['name'] ) );
 246+ $htmlOut .= Html::closeElement( 'span' );
 247+ $htmlOut .= Html::closeElement( 'td' );
228248
229 - $sk->makeLinkObj( $viewBanner, htmlspecialchars( $banner['name'] ),
230 - 'template=' . urlencode( $banner['name'] ) )
231 - );
232 -
233249 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
234250
235251 $sk->makeLinkObj( $viewCampaign, htmlspecialchars( $banner['campaign'] ),
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerAllocation.php
___________________________________________________________________
Modified: svn:mergeinfo
236252 Merged /trunk/extensions/CentralNotice/special/SpecialBannerAllocation.php:r104003,104210,104999,105015,105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php
@@ -111,6 +111,8 @@
112112
113113 /**
114114 * Extract a message name and send to getMessage() for translation
 115+ * If the field is 'amount', get the current fundraiser donation amount and pass it as a
 116+ * parameter to the message.
115117 * @param $match A message array with 2 members: raw match, short name of message
116118 * @return translated messsage string
117119 * @throws SpecialBannerLoaderException
@@ -118,9 +120,17 @@
119121 function getNoticeField( $match ) {
120122 $field = $match[1];
121123 $params = array();
122 - if ( $field == 'amount' ) {
123 - $params = array( $this->toMillions( $this->getDonationAmount() ) );
 124+
 125+ // Handle "magic messages"
 126+ switch ( $field ) {
 127+ case 'amount': // total fundraising amount
 128+ $params = array( $this->toMillions( $this->getDonationAmount() ) );
 129+ break;
 130+ case 'daily-amount': // daily fundraising amount
 131+ $params = array( $this->toThousands( $this->getDailyDonationAmount() ) );
 132+ break;
124133 }
 134+
125135 $message = "centralnotice-{$this->bannerName}-$field";
126136 $source = $this->getMessage( $message, $params );
127137 return $source;
@@ -137,6 +147,15 @@
138148 $lang = Language::factory( $this->language );
139149 return $lang->formatNum( $num );
140150 }
 151+
 152+ /**
 153+ * Convert number of dollars to thousands of dollars
 154+ */
 155+ private function toThousands( $num ) {
 156+ $num = sprintf( "%d", $num / 1000 );
 157+ $lang = Language::factory( $this->language );
 158+ return $lang->formatNum( $num );
 159+ }
141160
142161 /**
143162 * Retrieve a translated message
@@ -196,6 +215,37 @@
197216 return $count;
198217 }
199218
 219+ /**
 220+ * Pull the amount raised so far today during a fundraiser
 221+ * @throws SpecialBannerLoaderException
 222+ */
 223+ private function getDailyDonationAmount() {
 224+ global $wgNoticeDailyCounterSource, $wgMemc;
 225+ // Pull short-cached amount
 226+ $count = intval( $wgMemc->get( wfMemcKey( 'centralnotice', 'dailycounter' ) ) );
 227+ if ( !$count ) {
 228+ // Pull from dynamic counter
 229+ $counter_value = Http::get( $wgNoticeDailyCounterSource );
 230+ if( !$counter_value ) {
 231+ throw new RemoteServerProblemException();
 232+ }
 233+ $count = intval( $counter_value );
 234+ if ( !$count ) {
 235+ // Pull long-cached amount
 236+ $count = intval( $wgMemc->get(
 237+ wfMemcKey( 'centralnotice', 'dailycounter', 'fallback' ) ) );
 238+ if ( !$count ) {
 239+ throw new DonationAmountUnknownException();
 240+ }
 241+ }
 242+ // Expire in 60 seconds
 243+ $wgMemc->set( wfMemcKey( 'centralnotice', 'dailycounter' ), $count, 60 );
 244+ // No expiration
 245+ $wgMemc->set( wfMemcKey( 'centralnotice', 'dailycounter', 'fallback' ), $count );
 246+ }
 247+ return $count;
 248+ }
 249+
200250 function getFundraising( $bannerName ) {
201251 global $wgCentralDBname;
202252 $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialBannerLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
203253 Merged /trunk/extensions/CentralNotice/special/SpecialBannerLoader.php:r105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialNoticeTemplate.php
@@ -513,7 +513,8 @@
514514 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-change-lang' ) );
515515 $htmlOut .= Html::hidden( 'template', $currentTemplate );
516516 $htmlOut .= Html::openElement( 'table', array ( 'cellpadding' => 9 ) );
517 - list( $lsLabel, $lsSelect ) = Xml::languageSelector( $wpUserLang );
 517+ // Retrieve the language list
 518+ list( $lsLabel, $lsSelect ) = Xml::languageSelector( $wpUserLang, true, $wgLang->getCode() );
518519
519520 $newPage = $this->getTitle( 'view' );
520521
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialNoticeTemplate.php
___________________________________________________________________
Modified: svn:mergeinfo
521522 Merged /trunk/extensions/CentralNotice/special/SpecialNoticeTemplate.php:r106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php
@@ -90,7 +90,7 @@
9191 '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/collapsed.png" id="cn-collapsed-filter-arrow" style="display:inline-block;position:relative;top:-2px;"/>'.
9292 '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/uncollapsed.png" id="cn-uncollapsed-filter-arrow" style="display:none;position:relative;top:-2px;"/>'.
9393 '</a>';
94 - $htmlOut .= Xml::tags( 'span', array( 'style' => 'margin-left: 0.3em;' ), 'Log filters' );
 94+ $htmlOut .= Xml::tags( 'span', array( 'style' => 'margin-left: 0.3em;' ), wfMsg( 'centralnotice-filters' ) );
9595 $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters', 'style' => 'display:none;' ) );
9696 }
9797
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php
___________________________________________________________________
Modified: svn:mergeinfo
9898 Merged /trunk/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php
@@ -47,6 +47,7 @@
4848
4949 // Source for live counter information
5050 $wgNoticeCounterSource = 'http://wikimediafoundation.org/wiki/Special:ContributionTotal?action=raw';
 51+$wgNoticeDailyCounterSource = 'http://wikimediafoundation.org/wiki/Special:DailyTotal?action=raw';
5152
5253 // Domain to set global cookies for.
5354 // Example: '.wikipedia.org'
@@ -86,8 +87,16 @@
8788 'remoteExtPath' => 'CentralNotice',
8889 'scripts' => 'centralnotice.js',
8990 'styles' => 'centralnotice.css',
90 - 'messages' => 'centralnotice-documentwrite-error'
 91+ 'messages' => array(
 92+ 'centralnotice-documentwrite-error',
 93+ 'centralnotice-close-title',
 94+ )
9195 );
 96+$wgResourceModules['ext.centralNotice.bannerStats'] = array(
 97+ 'localBasePath' => dirname( __FILE__ ),
 98+ 'remoteExtPath' => 'CentralNotice',
 99+ 'scripts' => 'bannerstats.js',
 100+);
92101
93102 // Temporary setting to enable and configure info for Harvard banner on en.wikipedia.org
94103 $wgNoticeBanner_Harvard2011 = array(
@@ -105,6 +114,9 @@
106115 return true;
107116 }
108117
 118+/**
 119+ * Called through wgExtensionFunctions
 120+ */
109121 function efCentralNoticeSetup() {
110122 global $wgHooks, $wgNoticeInfrastructure, $wgAutoloadClasses, $wgSpecialPages;
111123 global $wgCentralNoticeLoader, $wgSpecialPageGroups;
@@ -148,7 +160,7 @@
149161
150162 $wgSpecialPages['CentralNoticeLogs'] = 'SpecialCentralNoticeLogs';
151163 $wgAutoloadClasses['SpecialCentralNoticeLogs'] = $specialDir . 'SpecialCentralNoticeLogs.php';
152 -
 164+
153165 $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php';
154166 $wgAutoloadClasses['CentralNoticePager'] = $dir . 'CentralNoticePager.php';
155167 $wgAutoloadClasses['CentralNoticeCampaignLogPager'] = $dir . 'CentralNoticeCampaignLogPager.php';
@@ -255,9 +267,7 @@
256268
257269 // Initialize global Javascript variables. We initialize Geo with empty values so if the geo
258270 // IP lookup fails we don't have any surprises.
259 - $geo = (object)array();
260 - $geo->{'city'} = '';
261 - $geo->{'country'} = '';
 271+ $geo = array( 'city' => '', 'country' => '' );
262272 $vars['Geo'] = $geo; // change this to wgGeo as soon as Mark updates on his end
263273 $vars['wgNoticeProject'] = $wgNoticeProject;
264274
@@ -319,7 +329,7 @@
320330 // "username" the user's username
321331 $postData['username'] = $wgUser->getName();
322332
323 - // Security checksum. Prevent users from entering the survey with invalid metrics
 333+ // Security checksum. Prevent users from entering the survey with invalid metrics
324334 $postData['secretkey'] = md5( $salt . serialize( $hashData ) );
325335
326336 // MD5 hash
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.php
___________________________________________________________________
Modified: svn:mergeinfo
327337 Merged /trunk/extensions/CentralNotice/CentralNotice.php:r104003,104210,104999,105015,105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticeBannerLogPager.php
@@ -6,17 +6,17 @@
77 function __construct( $special ) {
88 $this->special = $special;
99 parent::__construct($special);
10 -
 10+
1111 $this->viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' );
1212 }
13 -
 13+
1414 /**
1515 * Sort the log list by timestamp
1616 */
1717 function getIndexField() {
1818 return 'tmplog_timestamp';
1919 }
20 -
 20+
2121 /**
2222 * Pull log entries from the database
2323 */
@@ -26,29 +26,29 @@
2727 'fields' => '*',
2828 );
2929 }
30 -
 30+
3131 /**
3232 * Generate the content of each table row (1 row = 1 log entry)
3333 */
3434 function formatRow( $row ) {
3535 global $wgLang, $wgExtensionAssetsPath;
36 -
 36+
3737 // Create a user object so we can pull the name, user page, etc.
3838 $loggedUser = User::newFromId( $row->tmplog_user_id );
3939 // Create the user page link
40 - $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
 40+ $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
4141 $loggedUser->getName() );
42 - $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
 42+ $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
4343 wfMsg ( 'centralnotice-talk-link' ) );
44 -
 44+
4545 // Create the banner link
4646 $bannerLink = $this->getSkin()->makeLinkObj( $this->viewPage,
4747 htmlspecialchars( $row->tmplog_template_name ),
4848 'template=' . urlencode( $row->tmplog_template_name ) );
49 -
 49+
5050 // Begin log entry primary row
5151 $htmlOut = Xml::openElement( 'tr' );
52 -
 52+
5353 $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) );
5454 if ( $row->tmplog_action !== 'removed' ) {
5555 $htmlOut .= '<a href="javascript:toggleLogDisplay(\''.$row->tmplog_id.'\')">'.
@@ -64,7 +64,7 @@
6565 wfMsg ( 'centralnotice-user-links', $userLink, $userTalkLink )
6666 );
6767 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ),
68 - $row->tmplog_action
 68+ wfMsg ( 'centralnotice-action-'.$row->tmplog_action )
6969 );
7070 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ),
7171 $bannerLink
@@ -72,32 +72,32 @@
7373 $htmlOut .= Xml::tags( 'td', array(),
7474 '&nbsp;'
7575 );
76 -
 76+
7777 // End log entry primary row
7878 $htmlOut .= Xml::closeElement( 'tr' );
79 -
 79+
8080 if ( $row->tmplog_action !== 'removed' ) {
8181 // Begin log entry secondary row
8282 $htmlOut .= Xml::openElement( 'tr', array( 'id' => 'cn-log-details-'.$row->tmplog_id, 'style' => 'display:none;' ) );
83 -
 83+
8484 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
8585 '&nbsp;' // force a table cell in older browsers
8686 );
8787 $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top', 'colspan' => '5' ) );
8888 if ( $row->tmplog_action == 'created' ) {
8989 $htmlOut .= $this->showInitialSettings( $row );
90 - } else if ( $row->tmplog_action == 'modified' ) {
 90+ } elseif ( $row->tmplog_action == 'modified' ) {
9191 $htmlOut .= $this->showChanges( $row );
9292 }
9393 $htmlOut .= Xml::closeElement( 'td' );
94 -
 94+
9595 // End log entry primary row
9696 $htmlOut .= Xml::closeElement( 'tr' );
9797 }
98 -
 98+
9999 return $htmlOut;
100100 }
101 -
 101+
102102 function getStartBody() {
103103 $htmlOut = '';
104104 $htmlOut .= Xml::openElement( 'table', array( 'id' => 'cn-campaign-logs', 'cellpadding' => 3 ) );
@@ -121,7 +121,7 @@
122122 $htmlOut .= Xml::closeElement( 'tr' );
123123 return $htmlOut;
124124 }
125 -
 125+
126126 /**
127127 * Close table
128128 */
@@ -130,40 +130,40 @@
131131 $htmlOut .= Xml::closeElement( 'table' );
132132 return $htmlOut;
133133 }
134 -
 134+
135135 function showInitialSettings( $row ) {
136136 global $wgLang;
137137 $details = '';
138138 $details .= wfMsg (
139139 'centralnotice-log-label',
140 - wfMsg ( 'centralnotice-anon' ),
 140+ wfMsg ( 'centralnotice-anon' ),
141141 ($row->tmplog_end_anon ? 'on' : 'off')
142142 )."<br/>";
143143 $details .= wfMsg (
144144 'centralnotice-log-label',
145 - wfMsg ( 'centralnotice-account' ),
 145+ wfMsg ( 'centralnotice-account' ),
146146 ($row->tmplog_end_account ? 'on' : 'off')
147147 )."<br/>";
148148 $details .= wfMsg (
149149 'centralnotice-log-label',
150 - wfMsg ( 'centralnotice-fundraising' ),
 150+ wfMsg ( 'centralnotice-fundraising' ),
151151 ($row->tmplog_end_fundraising ? 'on' : 'off')
152152 )."<br/>";
153153 $details .= wfMsg (
154154 'centralnotice-log-label',
155 - wfMsg ( 'centralnotice-autolink' ),
 155+ wfMsg ( 'centralnotice-autolink' ),
156156 ($row->tmplog_end_autolink ? 'on' : 'off')
157157 )."<br/>";
158158 if ( $row->tmplog_end_landingpages ) {
159159 $details .= wfMsg (
160160 'centralnotice-log-label',
161 - wfMsg ( 'centralnotice-landingpages' ),
 161+ wfMsg ( 'centralnotice-landingpages' ),
162162 $row->tmplog_end_landingpages
163163 )."<br/>";
164164 }
165165 return $details;
166166 }
167 -
 167+
168168 function showChanges( $row ) {
169169 global $wgLang;
170170 $details = '';
@@ -182,7 +182,7 @@
183183 }
184184 return $details;
185185 }
186 -
 186+
187187 private function testBooleanChange( $param, $row ) {
188188 $result = '';
189189 $beginField = 'tmplog_begin_'.$param;
@@ -192,8 +192,8 @@
193193 'centralnotice-log-label',
194194 wfMsg ( 'centralnotice-'.$param ),
195195 wfMsg (
196 - 'centralnotice-changed',
197 - ( $row->$beginField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ),
 196+ 'centralnotice-changed',
 197+ ( $row->$beginField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ),
198198 ( $row->$endField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) )
199199 )
200200 )."<br/>";
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticeBannerLogPager.php
___________________________________________________________________
Modified: svn:mergeinfo
201201 Merged /trunk/extensions/CentralNotice/CentralNoticeBannerLogPager.php:r104210,104999,105015,105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.i18n.php
@@ -121,6 +121,7 @@
122122 'centralnotice-collapse-button' => 'Collapse link',
123123 'centralnotice-expand-button' => 'Expand link',
124124 'centralnotice-close-button' => 'Close button',
 125+ 'centralnotice-close-title' => 'Close',
125126 'centralnotice-translate-button' => 'Help translate link',
126127 'centralnotice-donate-button' => 'Donate button',
127128 'centralnotice-expanded-banner' => 'Expanded banner',
@@ -154,6 +155,9 @@
155156 'centralnotice-timestamp' => 'Timestamp',
156157 'centralnotice-user' => 'User',
157158 'centralnotice-action' => 'Action',
 159+ 'centralnotice-action-created' => 'created',
 160+ 'centralnotice-action-modified' => 'modified',
 161+ 'centralnotice-action-removed' => 'removed',
158162 'centralnotice-changed' => 'Changed from <span class="cn-old-value">$1</span> to <span class="cn-new-value">$2</span>',
159163 'centralnotice-on' => 'on',
160164 'centralnotice-off' => 'off',
@@ -281,7 +285,12 @@
282286 'centralnotice-timestamp' => '{{Identical|Timestamp}}',
283287 'centralnotice-user' => '{{Identical|User}}',
284288 'centralnotice-action' => '{{Identical|Action}}',
285 - 'centralnotice-on' => 'indicates a notice is on air',
 289+ 'centralnotice-action-created' => 'Indicates which type of action was performed. Should be lower-case, as if it appeared in the middle of a sentence.',
 290+ 'centralnotice-action-modified' => 'Indicates which type of action was performed. Should be lower-case, as if it appeared in the middle of a sentence.',
 291+ 'centralnotice-action-removed' => 'Indicates which type of action was performed. Should be lower-case, as if it appeared in the middle of a sentence.',
 292+ 'centralnotice-on' => 'indicates a notice is on air
 293+
 294+{{Identical|On}}',
286295 'centralnotice-off' => 'indicates a notice is not on air
287296 {{Identical|Off}}',
288297 'centralnotice-no-assignments' => 'Appears in the middle of a sentence; should be all lower case.',
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
289298 Merged /trunk/extensions/CentralNotice/CentralNotice.i18n.php:r105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticePageLogPager.php
@@ -1,8 +1,8 @@
22 <?php
33
44 /**
5 - * This class generates a paginated log of recent changes to banner messages (the parts that get
6 - * translated). We use the rencentchanges table since it is lightweight, however, this means that
 5+ * This class generates a paginated log of recent changes to banner messages (the parts that get
 6+ * translated). We use the rencentchanges table since it is lightweight, however, this means that
77 * the log only goes back 30 days.
88 */
99 class CentralNoticePageLogPager extends ReverseChronologicalPager {
@@ -16,18 +16,18 @@
1717 function __construct( $special, $type = 'bannercontent' ) {
1818 $this->special = $special;
1919 parent::__construct( $special );
20 -
 20+
2121 $this->viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' );
2222 $this->logType = $type;
2323 }
24 -
 24+
2525 /**
2626 * Sort the log list by timestamp
2727 */
2828 function getIndexField() {
2929 return 'rc_timestamp';
3030 }
31 -
 31+
3232 /**
3333 * Pull log entries from the database
3434 */
@@ -54,29 +54,29 @@
5555 'conds' => $conds, // WHERE conditions
5656 );
5757 }
58 -
 58+
5959 /**
6060 * Generate the content of each table row (1 row = 1 log entry)
6161 */
6262 function formatRow( $row ) {
6363 global $wgLang, $wgExtensionAssetsPath;
64 -
 64+
6565 // Create a user object so we can pull the name, user page, etc.
6666 $loggedUser = User::newFromId( $row->rc_user );
6767 // Create the user page link
68 - $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
 68+ $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
6969 $loggedUser->getName() );
70 - $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
 70+ $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
7171 wfMsg ( 'centralnotice-talk-link' ) );
72 -
 72+
7373 $language = 'en'; // English is the default for CentralNotice messages
74 -
 74+
7575 if ( $this->logType == 'bannercontent' ) {
7676 // Extract the banner name from the title
7777 $pattern = '/Centralnotice-template-(.*)/';
7878 preg_match( $pattern, $row->rc_title, $matches );
7979 $banner = $matches[1];
80 - } else if ( $this->logType == 'bannermessages' ) {
 80+ } elseif ( $this->logType == 'bannermessages' ) {
8181 // Split the title into banner, message, and language
8282 $titlePieces = explode( "/", $row->rc_title, 2 );
8383 $titleBase = $titlePieces[0];
@@ -86,17 +86,17 @@
8787 $banner = $matches[1];
8888 $message = $matches[2];
8989 }
90 -
 90+
9191 // Create banner link
9292 $bannerLink = $this->getSkin()->makeLinkObj( $this->viewPage,
9393 htmlspecialchars( $banner ),
9494 'template=' . urlencode( $banner ) );
95 -
 95+
9696 // Create title object
9797 $title = Title::newFromText( "MediaWiki:{$row->rc_title}" );
98 -
 98+
9999 if ( $this->logType == 'bannercontent' ) {
100 - // If the banner was just created, show a link to the banner. If the banner was
 100+ // If the banner was just created, show a link to the banner. If the banner was
101101 // edited, show a link to the banner and a link to the diff.
102102 if ( $row->rc_new ) {
103103 $bannerCell = $bannerLink;
@@ -111,13 +111,13 @@
112112 // See ChangesList->preCacheMessages() for example.
113113 $bannerCell = $bannerLink . "&nbsp;(<a href=\"$diffUrl\">diff</a>)";
114114 }
115 - } else if ( $this->logType == 'bannermessages' ) {
 115+ } elseif ( $this->logType == 'bannermessages' ) {
116116 $bannerCell = $bannerLink;
117 -
 117+
118118 // Create the message link
119119 $messageLink = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $message ) );
120 -
121 - // If the message was just created, show a link to the message. If the message was
 120+
 121+ // If the message was just created, show a link to the message. If the message was
122122 // edited, show a link to the message and a link to the diff.
123123 if ( $row->rc_new ) {
124124 $messageCell = $messageLink;
@@ -133,10 +133,10 @@
134134 $messageCell = $messageLink . "&nbsp;(<a href=\"$diffUrl\">diff</a>)";
135135 }
136136 }
137 -
 137+
138138 // Begin log entry primary row
139139 $htmlOut = Xml::openElement( 'tr' );
140 -
 140+
141141 $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) );
142142 $htmlOut .= Xml::closeElement( 'td' );
143143 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ),
@@ -159,13 +159,13 @@
160160 $htmlOut .= Xml::tags( 'td', array(),
161161 '&nbsp;'
162162 );
163 -
 163+
164164 // End log entry primary row
165165 $htmlOut .= Xml::closeElement( 'tr' );
166 -
 166+
167167 return $htmlOut;
168168 }
169 -
 169+
170170 function getStartBody() {
171171 $htmlOut = '';
172172 $htmlOut .= Xml::openElement( 'table', array( 'id' => 'cn-campaign-logs', 'cellpadding' => 3 ) );
@@ -194,7 +194,7 @@
195195 $htmlOut .= Xml::closeElement( 'tr' );
196196 return $htmlOut;
197197 }
198 -
 198+
199199 /**
200200 * Close table
201201 */
@@ -203,5 +203,5 @@
204204 $htmlOut .= Xml::closeElement( 'table' );
205205 return $htmlOut;
206206 }
207 -
 207+
208208 }
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/bannerstats.js
@@ -0,0 +1,27 @@
 2+/**
 3+ * This script retrieves click-thru rates for all the banners in all the campaigns in
 4+ * wgCentralNoticeAllocationCampaigns. It then adds the rates to the allocation tables.
 5+ */
 6+$( document ).ready( function () {
 7+ /*
 8+ if ( typeof wgCentralNoticeAllocationCampaigns !== 'undefined' ) {
 9+ $.each( wgCentralNoticeAllocationCampaigns, function( index, campaignName ) {
 10+ var statUrl = 'http://fundraising-analytics.wikimedia.org/json_reporting/' + campaignName;
 11+ $.ajax( {
 12+ 'url': statUrl,
 13+ 'data': {},
 14+ 'dataType': 'jsonp',
 15+ 'type': 'GET',
 16+ 'success': function( data ) {
 17+ //console.debug( "Success" );
 18+ //console.debug( data );
 19+ },
 20+ 'error': function( xhr ) {
 21+ //console.debug( "Error" );
 22+ //console.debug( xhr );
 23+ }
 24+ } );
 25+ } )
 26+ }
 27+ */
 28+} );
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNoticeCampaignLogPager.php
@@ -7,27 +7,27 @@
88 global $wgRequest;
99 $this->special = $special;
1010 parent::__construct();
11 -
 11+
1212 // Override paging defaults
1313 list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset( 20, '' );
1414 $this->mLimitsShown = array( 20, 50, 100 );
15 -
 15+
1616 $this->viewPage = SpecialPage::getTitleFor( 'CentralNotice' );
1717 }
18 -
 18+
1919 /**
2020 * Sort the log list by timestamp
2121 */
2222 function getIndexField() {
2323 return 'notlog_timestamp';
2424 }
25 -
 25+
2626 /**
2727 * Pull log entries from the database
2828 */
2929 function getQueryInfo() {
3030 global $wgRequest;
31 -
 31+
3232 $filterStartDate = 0;
3333 $filterEndDate = 0;
3434 $startYear = $wgRequest->getVal( 'start_year' );
@@ -42,7 +42,7 @@
4343 if ( $endMonth === 'other' ) $endMonth = null;
4444 $endDay = $wgRequest->getVal( 'end_day' );
4545 if ( $endDay === 'other' ) $endDay = null;
46 -
 46+
4747 if ( $startYear && $startMonth && $startDay ) {
4848 $filterStartDate = $startYear . $startMonth . $startDay;
4949 }
@@ -52,13 +52,13 @@
5353 $filterCampaign = $wgRequest->getVal( 'campaign' );
5454 $filterUser = $wgRequest->getVal( 'user' );
5555 $reset = $wgRequest->getVal( 'centralnoticelogreset' );
56 -
 56+
5757 $info = array(
5858 'tables' => array( 'cn_notice_log' ),
5959 'fields' => '*',
6060 'conds' => array()
6161 );
62 -
 62+
6363 if ( !$reset ) {
6464 if ( $filterStartDate > 0 ) {
6565 $filterStartDate = intval( $filterStartDate.'000000' );
@@ -77,32 +77,32 @@
7878 $info['conds'][] = "notlog_user_id = $userId";
7979 }
8080 }
81 -
 81+
8282 return $info;
8383 }
84 -
85 - /**
 84+
 85+ /**
8686 * Generate the content of each table row (1 row = 1 log entry)
8787 */
8888 function formatRow( $row ) {
8989 global $wgLang, $wgExtensionAssetsPath;
90 -
 90+
9191 // Create a user object so we can pull the name, user page, etc.
9292 $loggedUser = User::newFromId( $row->notlog_user_id );
9393 // Create the user page link
94 - $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
 94+ $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(),
9595 $loggedUser->getName() );
96 - $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
 96+ $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(),
9797 wfMsg ( 'centralnotice-talk-link' ) );
98 -
 98+
9999 // Create the campaign link
100100 $campaignLink = $this->getSkin()->makeLinkObj( $this->viewPage,
101101 htmlspecialchars( $row->notlog_not_name ),
102102 'method=listNoticeDetail&notice=' . urlencode( $row->notlog_not_name ) );
103 -
 103+
104104 // Begin log entry primary row
105105 $htmlOut = Xml::openElement( 'tr' );
106 -
 106+
107107 $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) );
108108 if ( $row->notlog_action !== 'removed' ) {
109109 $htmlOut .= '<a href="javascript:toggleLogDisplay(\''.$row->notlog_id.'\')">'.
@@ -118,7 +118,7 @@
119119 wfMsg ( 'centralnotice-user-links', $userLink, $userTalkLink )
120120 );
121121 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ),
122 - $row->notlog_action
 122+ wfMsg ( 'centralnotice-action-'.$row->notlog_action )
123123 );
124124 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ),
125125 $campaignLink
@@ -126,38 +126,38 @@
127127 $htmlOut .= Xml::tags( 'td', array(),
128128 '&nbsp;'
129129 );
130 -
 130+
131131 // End log entry primary row
132132 $htmlOut .= Xml::closeElement( 'tr' );
133 -
 133+
134134 if ( $row->notlog_action !== 'removed' ) {
135135 // Begin log entry secondary row
136136 $htmlOut .= Xml::openElement( 'tr', array( 'id' => 'cn-log-details-'.$row->notlog_id, 'style' => 'display:none;' ) );
137 -
 137+
138138 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
139139 '&nbsp;' // force a table cell in older browsers
140140 );
141141 $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top', 'colspan' => '5' ) );
142142 if ( $row->notlog_action == 'created' ) {
143143 $htmlOut .= $this->showInitialSettings( $row );
144 - } else if ( $row->notlog_action == 'modified' ) {
 144+ } elseif ( $row->notlog_action == 'modified' ) {
145145 $htmlOut .= $this->showChanges( $row );
146146 }
147147 $htmlOut .= Xml::closeElement( 'td' );
148 -
 148+
149149 // End log entry primary row
150150 $htmlOut .= Xml::closeElement( 'tr' );
151151 }
152 -
 152+
153153 return $htmlOut;
154154 }
155 -
 155+
156156 function showInitialSettings( $row ) {
157157 global $wgLang;
158158 $details = '';
159159 $details .= wfMsg (
160160 'centralnotice-log-label',
161 - wfMsg ( 'centralnotice-start-date' ),
 161+ wfMsg ( 'centralnotice-start-date' ),
162162 $wgLang->date( $row->notlog_end_start ).' '.$wgLang->time( $row->notlog_end_start )
163163 )."<br/>";
164164 $details .= wfMsg (
@@ -203,7 +203,7 @@
204204 }
205205 return $details;
206206 }
207 -
 207+
208208 function showChanges( $row ) {
209209 global $wgLang;
210210 $details = '';
@@ -212,8 +212,8 @@
213213 'centralnotice-log-label',
214214 wfMsg ( 'centralnotice-start-date' ),
215215 wfMsg (
216 - 'centralnotice-changed',
217 - $wgLang->date( $row->notlog_begin_start ).' '.$wgLang->time( $row->notlog_begin_start ),
 216+ 'centralnotice-changed',
 217+ $wgLang->date( $row->notlog_begin_start ).' '.$wgLang->time( $row->notlog_begin_start ),
218218 $wgLang->date( $row->notlog_end_start ).' '.$wgLang->time( $row->notlog_end_start )
219219 )
220220 )."<br/>";
@@ -223,8 +223,8 @@
224224 'centralnotice-log-label',
225225 wfMsg ( 'centralnotice-end-date' ),
226226 wfMsg (
227 - 'centralnotice-changed',
228 - $wgLang->date( $row->notlog_begin_end ).' '.$wgLang->time( $row->notlog_begin_end ),
 227+ 'centralnotice-changed',
 228+ $wgLang->date( $row->notlog_begin_end ).' '.$wgLang->time( $row->notlog_begin_end ),
229229 $wgLang->date( $row->notlog_end_end ).' '.$wgLang->time( $row->notlog_end_end )
230230 )
231231 )."<br/>";
@@ -266,7 +266,7 @@
267267 }
268268 return $details;
269269 }
270 -
 270+
271271 private function testBooleanChange( $param, $row ) {
272272 $result = '';
273273 $beginField = 'notlog_begin_'.$param;
@@ -276,15 +276,15 @@
277277 'centralnotice-log-label',
278278 wfMsg ( 'centralnotice-'.$param ),
279279 wfMsg (
280 - 'centralnotice-changed',
281 - ( $row->$beginField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ),
 280+ 'centralnotice-changed',
 281+ ( $row->$beginField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ),
282282 ( $row->$endField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) )
283283 )
284284 )."<br/>";
285285 }
286286 return $result;
287287 }
288 -
 288+
289289 private function testSetChange( $param, $row ) {
290290 $result = '';
291291 $beginField = 'notlog_begin_'.$param;
@@ -316,7 +316,7 @@
317317 }
318318 return $result;
319319 }
320 -
 320+
321321 /**
322322 * Specify table headers
323323 */
@@ -343,7 +343,7 @@
344344 $htmlOut .= Xml::closeElement( 'tr' );
345345 return $htmlOut;
346346 }
347 -
 347+
348348 /**
349349 * Close table
350350 */
@@ -352,5 +352,5 @@
353353 $htmlOut .= Xml::closeElement( 'table' );
354354 return $htmlOut;
355355 }
356 -
 356+
357357 }
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.db.php
@@ -411,252 +411,268 @@
412412
413413 /**
414414 * Return all of the available countries for geotargeting
415 - * (This should probably be moved to a core database table at some point.)
 415+ * @param string $code The language code to return the country list in
416416 * @return array
417417 */
418 - static function getCountriesList() {
419 - return array(
420 - 'AF'=>'Afghanistan',
421 - 'AL'=>'Albania',
422 - 'DZ'=>'Algeria',
423 - 'AS'=>'American Samoa',
424 - 'AD'=>'Andorra',
425 - 'AO'=>'Angola',
426 - 'AI'=>'Anguilla',
427 - 'AQ'=>'Antarctica',
428 - 'AG'=>'Antigua and Barbuda',
429 - 'AR'=>'Argentina',
430 - 'AM'=>'Armenia',
431 - 'AW'=>'Aruba',
432 - 'AU'=>'Australia',
433 - 'AT'=>'Austria',
434 - 'AZ'=>'Azerbaijan',
435 - 'BS'=>'Bahamas',
436 - 'BH'=>'Bahrain',
437 - 'BD'=>'Bangladesh',
438 - 'BB'=>'Barbados',
439 - 'BY'=>'Belarus',
440 - 'BE'=>'Belgium',
441 - 'BZ'=>'Belize',
442 - 'BJ'=>'Benin',
443 - 'BM'=>'Bermuda',
444 - 'BT'=>'Bhutan',
445 - 'BO'=>'Bolivia',
446 - 'BA'=>'Bosnia and Herzegovina',
447 - 'BW'=>'Botswana',
448 - 'BV'=>'Bouvet Island',
449 - 'BR'=>'Brazil',
450 - 'IO'=>'British Indian Ocean Territory',
451 - 'BN'=>'Brunei Darussalam',
452 - 'BG'=>'Bulgaria',
453 - 'BF'=>'Burkina Faso',
454 - 'BI'=>'Burundi',
455 - 'KH'=>'Cambodia',
456 - 'CM'=>'Cameroon',
457 - 'CA'=>'Canada',
458 - 'CV'=>'Cape Verde',
459 - 'KY'=>'Cayman Islands',
460 - 'CF'=>'Central African Republic',
461 - 'TD'=>'Chad',
462 - 'CL'=>'Chile',
463 - 'CN'=>'China',
464 - 'CX'=>'Christmas Island',
465 - 'CC'=>'Cocos (Keeling) Islands',
466 - 'CO'=>'Colombia',
467 - 'KM'=>'Comoros',
468 - 'CD'=>'Congo, Democratic Republic of the',
469 - 'CG'=>'Congo',
470 - 'CK'=>'Cook Islands',
471 - 'CR'=>'Costa Rica',
472 - 'CI'=>'Côte d\'Ivoire',
473 - 'HR'=>'Croatia',
474 - //'CU'=>'Cuba',
475 - 'CY'=>'Cyprus',
476 - 'CZ'=>'Czech Republic',
477 - 'DK'=>'Denmark',
478 - 'DJ'=>'Djibouti',
479 - 'DM'=>'Dominica',
480 - 'DO'=>'Dominican Republic',
481 - 'EC'=>'Ecuador',
482 - 'EG'=>'Egypt',
483 - 'SV'=>'El Salvador',
484 - 'GQ'=>'Equatorial Guinea',
485 - 'ER'=>'Eritrea',
486 - 'EE'=>'Estonia',
487 - 'ET'=>'Ethiopia',
488 - 'FK'=>'Falkland Islands (Malvinas)',
489 - 'FO'=>'Faroe Islands',
490 - 'FJ'=>'Fiji',
491 - 'FI'=>'Finland',
492 - 'FR'=>'France',
493 - 'GF'=>'French Guiana',
494 - 'PF'=>'French Polynesia',
495 - 'TF'=>'French Southern Territories',
496 - 'GA'=>'Gabon',
497 - 'GM'=>'Gambia',
498 - 'GE'=>'Georgia',
499 - 'DE'=>'Germany',
500 - 'GH'=>'Ghana',
501 - 'GI'=>'Gibraltar',
502 - 'GR'=>'Greece',
503 - 'GL'=>'Greenland',
504 - 'GD'=>'Grenada',
505 - 'GP'=>'Guadeloupe',
506 - 'GU'=>'Guam',
507 - 'GT'=>'Guatemala',
508 - 'GW'=>'Guinea-Bissau',
509 - 'GN'=>'Guinea',
510 - 'GY'=>'Guyana',
511 - 'HT'=>'Haiti',
512 - 'HM'=>'Heard Island and McDonald Islands',
513 - 'VA'=>'Holy See (Vatican City State)',
514 - 'HN'=>'Honduras',
515 - 'HK'=>'Hong Kong',
516 - 'HU'=>'Hungary',
517 - 'IS'=>'Iceland',
518 - 'IN'=>'India',
519 - 'ID'=>'Indonesia',
520 - //'IR'=>'Iran',
521 - 'IQ'=>'Iraq',
522 - 'IE'=>'Ireland',
523 - 'IL'=>'Israel',
524 - 'IT'=>'Italy',
525 - 'JM'=>'Jamaica',
526 - 'JP'=>'Japan',
527 - 'JO'=>'Jordan',
528 - 'KZ'=>'Kazakhstan',
529 - 'KE'=>'Kenya',
530 - 'KI'=>'Kiribati',
531 - 'KW'=>'Kuwait',
532 - 'KG'=>'Kyrgyzstan',
533 - 'LA'=>'Lao People\'s Democratic Republic',
534 - 'LV'=>'Latvia',
535 - 'LB'=>'Lebanon',
536 - 'LS'=>'Lesotho',
537 - 'LR'=>'Liberia',
538 - 'LY'=>'Libyan Arab Jamahiriya',
539 - 'LI'=>'Liechtenstein',
540 - 'LT'=>'Lithuania',
541 - 'LU'=>'Luxembourg',
542 - 'MO'=>'Macao',
543 - 'MK'=>'Macedonia, Republic of',
544 - 'MG'=>'Madagascar',
545 - 'MW'=>'Malawi',
546 - 'MY'=>'Malaysia',
547 - 'MV'=>'Maldives',
548 - 'ML'=>'Mali',
549 - 'MT'=>'Malta',
550 - 'MH'=>'Marshall Islands',
551 - 'MQ'=>'Martinique',
552 - 'MR'=>'Mauritania',
553 - 'MU'=>'Mauritius',
554 - 'YT'=>'Mayotte',
555 - 'MX'=>'Mexico',
556 - 'FM'=>'Micronesia',
557 - 'MD'=>'Moldova, Republic of',
558 - 'MC'=>'Moldova',
559 - 'MN'=>'Mongolia',
560 - 'ME'=>'Montenegro',
561 - 'MS'=>'Montserrat',
562 - 'MA'=>'Morocco',
563 - 'MZ'=>'Mozambique',
564 - 'MM'=>'Myanmar',
565 - 'NA'=>'Namibia',
566 - 'NR'=>'Nauru',
567 - 'NP'=>'Nepal',
568 - 'AN'=>'Netherlands Antilles',
569 - 'NL'=>'Netherlands',
570 - 'NC'=>'New Caledonia',
571 - 'NZ'=>'New Zealand',
572 - 'NI'=>'Nicaragua',
573 - 'NE'=>'Niger',
574 - 'NG'=>'Nigeria',
575 - 'NU'=>'Niue',
576 - 'NF'=>'Norfolk Island',
577 - 'KP'=>'North Korea',
578 - 'MP'=>'Northern Mariana Islands',
579 - 'NO'=>'Norway',
580 - 'OM'=>'Oman',
581 - 'PK'=>'Pakistan',
582 - 'PW'=>'Palau',
583 - 'PS'=>'Palestinian Territory',
584 - 'PA'=>'Panama',
585 - 'PG'=>'Papua New Guinea',
586 - 'PY'=>'Paraguay',
587 - 'PE'=>'Peru',
588 - 'PH'=>'Philippines',
589 - 'PN'=>'Pitcairn',
590 - 'PL'=>'Poland',
591 - 'PT'=>'Portugal',
592 - 'PR'=>'Puerto Rico',
593 - 'QA'=>'Qatar',
594 - 'RE'=>'Reunion',
595 - 'RO'=>'Romania',
596 - 'RU'=>'Russian Federation',
597 - 'RW'=>'Rwanda',
598 - 'SH'=>'Saint Helena',
599 - 'KN'=>'Saint Kitts and Nevis',
600 - 'LC'=>'Saint Lucia',
601 - 'PM'=>'Saint Pierre and Miquelon',
602 - 'VC'=>'Saint Vincent and the Grenadines',
603 - 'WS'=>'Samoa',
604 - 'SM'=>'San Marino',
605 - 'ST'=>'Sao Tome and Principe',
606 - 'SA'=>'Saudi Arabia',
607 - 'SN'=>'Senegal',
608 - 'CS'=>'Serbia and Montenegro',
609 - 'RS'=>'Serbia',
610 - 'SC'=>'Seychelles',
611 - 'SL'=>'Sierra Leone',
612 - 'SG'=>'Singapore',
613 - 'SK'=>'Slovakia',
614 - 'SI'=>'Slovenia',
615 - 'SB'=>'Solomon Islands',
616 - 'SO'=>'Somalia',
617 - 'ZA'=>'South Africa',
618 - 'KR'=>'South Korea',
619 - 'SS'=>'South Sudan',
620 - 'ES'=>'Spain',
621 - 'LK'=>'Sri Lanka',
622 - 'SD'=>'Sudan',
623 - 'SR'=>'Suriname',
624 - 'SJ'=>'Svalbard and Jan Mayen',
625 - 'SZ'=>'Swaziland',
626 - 'SE'=>'Sweden',
627 - 'CH'=>'Switzerland',
628 - //'SY'=>'Syrian Arab Republic',
629 - 'TW'=>'Taiwan',
630 - 'TJ'=>'Tajikistan',
631 - 'TZ'=>'Tanzania',
632 - 'TH'=>'Thailand',
633 - 'TL'=>'Timor-Leste',
634 - 'TG'=>'Togo',
635 - 'TK'=>'Tokelau',
636 - 'TO'=>'Tonga',
637 - 'TT'=>'Trinidad and Tobago',
638 - 'TN'=>'Tunisia',
639 - 'TR'=>'Turkey',
640 - 'TM'=>'Turkmenistan',
641 - 'TC'=>'Turks and Caicos Islands',
642 - 'TV'=>'Tuvalu',
643 - 'UG'=>'Uganda',
644 - 'UA'=>'Ukraine',
645 - 'AE'=>'United Arab Emirates',
646 - 'GB'=>'United Kingdom',
647 - 'UM'=>'United States Minor Outlying Islands',
648 - 'US'=>'United States',
649 - 'UY'=>'Uruguay',
650 - 'UZ'=>'Uzbekistan',
651 - 'VU'=>'Vanuatu',
652 - 'VE'=>'Venezuela',
653 - 'VN'=>'Vietnam',
654 - 'VG'=>'Virgin Islands, British',
655 - 'VI'=>'Virgin Islands, U.S.',
656 - 'WF'=>'Wallis and Futuna',
657 - 'EH'=>'Western Sahara',
658 - 'YE'=>'Yemen',
659 - 'ZM'=>'Zambia',
660 - 'ZW'=>'Zimbabwe'
661 - );
 418+ static function getCountriesList( $code ) {
 419+
 420+ $countries = array();
 421+
 422+ if ( is_callable( array( 'CountryNames', 'getNames' ) ) ) {
 423+ // Retrieve the list of countries in user's language (via CLDR)
 424+ $countries = CountryNames::getNames( $code );
 425+ unset( $countries['CU'] ); // Cuba
 426+ unset( $countries['IR'] ); // Iran
 427+ unset( $countries['SY'] ); // Syria
 428+ }
 429+
 430+ if ( !$countries ) {
 431+ // Use this as fallback if CLDR extension is not enabled
 432+ $countries = array(
 433+ 'AF'=>'Afghanistan',
 434+ 'AL'=>'Albania',
 435+ 'DZ'=>'Algeria',
 436+ 'AS'=>'American Samoa',
 437+ 'AD'=>'Andorra',
 438+ 'AO'=>'Angola',
 439+ 'AI'=>'Anguilla',
 440+ 'AQ'=>'Antarctica',
 441+ 'AG'=>'Antigua and Barbuda',
 442+ 'AR'=>'Argentina',
 443+ 'AM'=>'Armenia',
 444+ 'AW'=>'Aruba',
 445+ 'AU'=>'Australia',
 446+ 'AT'=>'Austria',
 447+ 'AZ'=>'Azerbaijan',
 448+ 'BS'=>'Bahamas',
 449+ 'BH'=>'Bahrain',
 450+ 'BD'=>'Bangladesh',
 451+ 'BB'=>'Barbados',
 452+ 'BY'=>'Belarus',
 453+ 'BE'=>'Belgium',
 454+ 'BZ'=>'Belize',
 455+ 'BJ'=>'Benin',
 456+ 'BM'=>'Bermuda',
 457+ 'BT'=>'Bhutan',
 458+ 'BO'=>'Bolivia',
 459+ 'BA'=>'Bosnia and Herzegovina',
 460+ 'BW'=>'Botswana',
 461+ 'BV'=>'Bouvet Island',
 462+ 'BR'=>'Brazil',
 463+ 'IO'=>'British Indian Ocean Territory',
 464+ 'BN'=>'Brunei Darussalam',
 465+ 'BG'=>'Bulgaria',
 466+ 'BF'=>'Burkina Faso',
 467+ 'BI'=>'Burundi',
 468+ 'KH'=>'Cambodia',
 469+ 'CM'=>'Cameroon',
 470+ 'CA'=>'Canada',
 471+ 'CV'=>'Cape Verde',
 472+ 'KY'=>'Cayman Islands',
 473+ 'CF'=>'Central African Republic',
 474+ 'TD'=>'Chad',
 475+ 'CL'=>'Chile',
 476+ 'CN'=>'China',
 477+ 'CX'=>'Christmas Island',
 478+ 'CC'=>'Cocos (Keeling) Islands',
 479+ 'CO'=>'Colombia',
 480+ 'KM'=>'Comoros',
 481+ 'CD'=>'Congo, Democratic Republic of the',
 482+ 'CG'=>'Congo',
 483+ 'CK'=>'Cook Islands',
 484+ 'CR'=>'Costa Rica',
 485+ 'CI'=>'Côte d\'Ivoire',
 486+ 'HR'=>'Croatia',
 487+ //'CU'=>'Cuba',
 488+ 'CY'=>'Cyprus',
 489+ 'CZ'=>'Czech Republic',
 490+ 'DK'=>'Denmark',
 491+ 'DJ'=>'Djibouti',
 492+ 'DM'=>'Dominica',
 493+ 'DO'=>'Dominican Republic',
 494+ 'EC'=>'Ecuador',
 495+ 'EG'=>'Egypt',
 496+ 'SV'=>'El Salvador',
 497+ 'GQ'=>'Equatorial Guinea',
 498+ 'ER'=>'Eritrea',
 499+ 'EE'=>'Estonia',
 500+ 'ET'=>'Ethiopia',
 501+ 'FK'=>'Falkland Islands (Malvinas)',
 502+ 'FO'=>'Faroe Islands',
 503+ 'FJ'=>'Fiji',
 504+ 'FI'=>'Finland',
 505+ 'FR'=>'France',
 506+ 'GF'=>'French Guiana',
 507+ 'PF'=>'French Polynesia',
 508+ 'TF'=>'French Southern Territories',
 509+ 'GA'=>'Gabon',
 510+ 'GM'=>'Gambia',
 511+ 'GE'=>'Georgia',
 512+ 'DE'=>'Germany',
 513+ 'GH'=>'Ghana',
 514+ 'GI'=>'Gibraltar',
 515+ 'GR'=>'Greece',
 516+ 'GL'=>'Greenland',
 517+ 'GD'=>'Grenada',
 518+ 'GP'=>'Guadeloupe',
 519+ 'GU'=>'Guam',
 520+ 'GT'=>'Guatemala',
 521+ 'GW'=>'Guinea-Bissau',
 522+ 'GN'=>'Guinea',
 523+ 'GY'=>'Guyana',
 524+ 'HT'=>'Haiti',
 525+ 'HM'=>'Heard Island and McDonald Islands',
 526+ 'VA'=>'Holy See (Vatican City State)',
 527+ 'HN'=>'Honduras',
 528+ 'HK'=>'Hong Kong',
 529+ 'HU'=>'Hungary',
 530+ 'IS'=>'Iceland',
 531+ 'IN'=>'India',
 532+ 'ID'=>'Indonesia',
 533+ //'IR'=>'Iran',
 534+ 'IQ'=>'Iraq',
 535+ 'IE'=>'Ireland',
 536+ 'IL'=>'Israel',
 537+ 'IT'=>'Italy',
 538+ 'JM'=>'Jamaica',
 539+ 'JP'=>'Japan',
 540+ 'JO'=>'Jordan',
 541+ 'KZ'=>'Kazakhstan',
 542+ 'KE'=>'Kenya',
 543+ 'KI'=>'Kiribati',
 544+ 'KW'=>'Kuwait',
 545+ 'KG'=>'Kyrgyzstan',
 546+ 'LA'=>'Lao People\'s Democratic Republic',
 547+ 'LV'=>'Latvia',
 548+ 'LB'=>'Lebanon',
 549+ 'LS'=>'Lesotho',
 550+ 'LR'=>'Liberia',
 551+ 'LY'=>'Libyan Arab Jamahiriya',
 552+ 'LI'=>'Liechtenstein',
 553+ 'LT'=>'Lithuania',
 554+ 'LU'=>'Luxembourg',
 555+ 'MO'=>'Macao',
 556+ 'MK'=>'Macedonia, Republic of',
 557+ 'MG'=>'Madagascar',
 558+ 'MW'=>'Malawi',
 559+ 'MY'=>'Malaysia',
 560+ 'MV'=>'Maldives',
 561+ 'ML'=>'Mali',
 562+ 'MT'=>'Malta',
 563+ 'MH'=>'Marshall Islands',
 564+ 'MQ'=>'Martinique',
 565+ 'MR'=>'Mauritania',
 566+ 'MU'=>'Mauritius',
 567+ 'YT'=>'Mayotte',
 568+ 'MX'=>'Mexico',
 569+ 'FM'=>'Micronesia',
 570+ 'MD'=>'Moldova, Republic of',
 571+ 'MC'=>'Moldova',
 572+ 'MN'=>'Mongolia',
 573+ 'ME'=>'Montenegro',
 574+ 'MS'=>'Montserrat',
 575+ 'MA'=>'Morocco',
 576+ 'MZ'=>'Mozambique',
 577+ 'MM'=>'Myanmar',
 578+ 'NA'=>'Namibia',
 579+ 'NR'=>'Nauru',
 580+ 'NP'=>'Nepal',
 581+ 'AN'=>'Netherlands Antilles',
 582+ 'NL'=>'Netherlands',
 583+ 'NC'=>'New Caledonia',
 584+ 'NZ'=>'New Zealand',
 585+ 'NI'=>'Nicaragua',
 586+ 'NE'=>'Niger',
 587+ 'NG'=>'Nigeria',
 588+ 'NU'=>'Niue',
 589+ 'NF'=>'Norfolk Island',
 590+ 'KP'=>'North Korea',
 591+ 'MP'=>'Northern Mariana Islands',
 592+ 'NO'=>'Norway',
 593+ 'OM'=>'Oman',
 594+ 'PK'=>'Pakistan',
 595+ 'PW'=>'Palau',
 596+ 'PS'=>'Palestinian Territory',
 597+ 'PA'=>'Panama',
 598+ 'PG'=>'Papua New Guinea',
 599+ 'PY'=>'Paraguay',
 600+ 'PE'=>'Peru',
 601+ 'PH'=>'Philippines',
 602+ 'PN'=>'Pitcairn',
 603+ 'PL'=>'Poland',
 604+ 'PT'=>'Portugal',
 605+ 'PR'=>'Puerto Rico',
 606+ 'QA'=>'Qatar',
 607+ 'RE'=>'Reunion',
 608+ 'RO'=>'Romania',
 609+ 'RU'=>'Russian Federation',
 610+ 'RW'=>'Rwanda',
 611+ 'SH'=>'Saint Helena',
 612+ 'KN'=>'Saint Kitts and Nevis',
 613+ 'LC'=>'Saint Lucia',
 614+ 'PM'=>'Saint Pierre and Miquelon',
 615+ 'VC'=>'Saint Vincent and the Grenadines',
 616+ 'WS'=>'Samoa',
 617+ 'SM'=>'San Marino',
 618+ 'ST'=>'Sao Tome and Principe',
 619+ 'SA'=>'Saudi Arabia',
 620+ 'SN'=>'Senegal',
 621+ 'CS'=>'Serbia and Montenegro',
 622+ 'RS'=>'Serbia',
 623+ 'SC'=>'Seychelles',
 624+ 'SL'=>'Sierra Leone',
 625+ 'SG'=>'Singapore',
 626+ 'SK'=>'Slovakia',
 627+ 'SI'=>'Slovenia',
 628+ 'SB'=>'Solomon Islands',
 629+ 'SO'=>'Somalia',
 630+ 'ZA'=>'South Africa',
 631+ 'KR'=>'South Korea',
 632+ 'SS'=>'South Sudan',
 633+ 'ES'=>'Spain',
 634+ 'LK'=>'Sri Lanka',
 635+ 'SD'=>'Sudan',
 636+ 'SR'=>'Suriname',
 637+ 'SJ'=>'Svalbard and Jan Mayen',
 638+ 'SZ'=>'Swaziland',
 639+ 'SE'=>'Sweden',
 640+ 'CH'=>'Switzerland',
 641+ //'SY'=>'Syrian Arab Republic',
 642+ 'TW'=>'Taiwan',
 643+ 'TJ'=>'Tajikistan',
 644+ 'TZ'=>'Tanzania',
 645+ 'TH'=>'Thailand',
 646+ 'TL'=>'Timor-Leste',
 647+ 'TG'=>'Togo',
 648+ 'TK'=>'Tokelau',
 649+ 'TO'=>'Tonga',
 650+ 'TT'=>'Trinidad and Tobago',
 651+ 'TN'=>'Tunisia',
 652+ 'TR'=>'Turkey',
 653+ 'TM'=>'Turkmenistan',
 654+ 'TC'=>'Turks and Caicos Islands',
 655+ 'TV'=>'Tuvalu',
 656+ 'UG'=>'Uganda',
 657+ 'UA'=>'Ukraine',
 658+ 'AE'=>'United Arab Emirates',
 659+ 'GB'=>'United Kingdom',
 660+ 'UM'=>'United States Minor Outlying Islands',
 661+ 'US'=>'United States',
 662+ 'UY'=>'Uruguay',
 663+ 'UZ'=>'Uzbekistan',
 664+ 'VU'=>'Vanuatu',
 665+ 'VE'=>'Venezuela',
 666+ 'VN'=>'Vietnam',
 667+ 'VG'=>'Virgin Islands, British',
 668+ 'VI'=>'Virgin Islands, U.S.',
 669+ 'WF'=>'Wallis and Futuna',
 670+ 'EH'=>'Western Sahara',
 671+ 'YE'=>'Yemen',
 672+ 'ZM'=>'Zambia',
 673+ 'ZW'=>'Zimbabwe'
 674+ );
 675+ }
 676+
 677+ return $countries;
662678 }
663679 }
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/CentralNotice.db.php
___________________________________________________________________
Modified: svn:mergeinfo
664680 Merged /trunk/extensions/CentralNotice/CentralNotice.db.php:r106497,106552,106846,106849,106866,106873,106914
Index: branches/wmf/1.18wmf1/extensions/CentralNotice/centralnotice.js
@@ -67,9 +67,13 @@
6868 var bannerField = document.getElementById('templateBody');
6969 switch( buttonType ) {
7070 case 'close': // Insert close button
71 - var buttonValue = '<a href="#" onclick="hideBanner();return false;">'
 71+ var buttonValue = '<a href="#" title="'
 72+ + mw.msg( 'centralnotice-close-title' )
 73+ + '" onclick="hideBanner();return false;">'
7274 + '<img border="0" src="' + mw.config.get( 'stylepath' )
73 - + '/common/images/closewindow.png" alt="Close" /></a>';
 75+ + '/common/images/closewindow19x19.png" alt="'
 76+ + mw.msg( 'centralnotice-close-title' )
 77+ + '" /></a>';
7478 break;
7579 }
7680 if (document.selection) {
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice/centralnotice.js
___________________________________________________________________
Modified: svn:mergeinfo
7781 Merged /trunk/extensions/CentralNotice/centralnotice.js:r105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914
Property changes on: branches/wmf/1.18wmf1/extensions/CentralNotice
___________________________________________________________________
Modified: svn:mergeinfo
7882 Merged /trunk/extensions/CentralNotice:r103297,104003,104210,104999,105015,105740,105800,106166,106227,106497,106552,106846,106849,106866,106873,106914

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103297trim whitespace from campaign nameskaldari04:51, 16 November 2011
r104003skeleton of live banner stats systemkaldari04:48, 23 November 2011
r104210"else if" -> "elseif"reedy00:20, 25 November 2011
r104999[CentralNotice] Add function comments....krinkle20:39, 2 December 2011
r105015more logical setting for geokaldari22:28, 2 December 2011
r105740adding new larger hide button, and a comment for {{{amount}}}kaldari01:08, 10 December 2011
r105800Whitespace and documentationreedy15:41, 11 December 2011
r106166fix for bug 32901 - making the log action localizablekaldari05:17, 14 December 2011
r106227Fix Bug 33099 - “Log filters” hardcoded without localization on [[Special...mah19:02, 14 December 2011
r106497adding localized country nameskaldari02:07, 17 December 2011
r106552updating for new cldr codekaldari03:02, 18 December 2011
r106846adding support for daily-amount magic messagekaldari19:50, 20 December 2011
r106849fixing double-quoting, using json_encode for the campaign list, disabling ret...kaldari20:11, 20 December 2011
r106866follow-up to r106849, using FormatJson::encode instead for backwards compatkaldari21:27, 20 December 2011
r106873make sure we dont throw a js error when no campaigns are runningkaldari21:54, 20 December 2011
r106914now with CLDR! This rev depends on r106912kaldari01:15, 21 December 2011

Status & tagging log