r76143 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76142‎ | r76143 | r76144 >
Date:21:20, 5 November 2010
Author:tomasz
Status:ok
Tags:
Comment:
Picking up large changeset from r75908
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/CentralNotice (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerLoader.php
@@ -53,7 +53,8 @@
5454
5555 /**
5656 * Generate the JS for the requested banner
57 - * @return a string of Javascript containing a call to insertBanner() with JSON containing the banner content as the parameter
 57+ * @return a string of Javascript containing a call to insertBanner()
 58+ * with JSON containing the banner content as the parameter
5859 */
5960 function getJsNotice( $bannerName ) {
6061 // Make sure the banner exists
@@ -161,16 +162,18 @@
162163 wfRestoreWarnings();
163164 if ( !$count ) {
164165 // Pull long-cached amount
165 - $count = intval( $wgMemc->get( wfMemcKey( 'centralnotice', 'counter', 'fallback' ) ) );
 166+ $count = intval( $wgMemc->get(
 167+ wfMemcKey( 'centralnotice', 'counter', 'fallback' ) ) );
166168 if ( !$count ) {
167169 // Return hard-coded amount if all else fails
168170 return 1100000; // Update as needed during fundraiser
169171 }
170172 }
171 - $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), $count, 60 ); // Expire in 60 seconds
172 - $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 'fallback' ), $count ); // No expiration
 173+ // Expire in 60 seconds
 174+ $wgMemc->set( wfMemcKey( 'centralnotice', 'counter' ), $count, 60 );
 175+ // No expiration
 176+ $wgMemc->set( wfMemcKey( 'centralnotice', 'counter', 'fallback' ), $count );
173177 }
174178 return $count;
175179 }
176 -
177180 }
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerController.php
@@ -45,7 +45,7 @@
4646 global $wgCentralPagePath;
4747
4848 $js = $this->getScriptFunctions() . $this->getToggleScripts();
49 - $js .= <<<EOT
 49+ $js .= <<<JAVASCRIPT
5050 ( function( $ ) {
5151 $.ajaxSetup({ cache: true });
5252 $.centralNotice = {
@@ -55,12 +55,18 @@
5656 'fn': {
5757 'loadBanner': function( bannerName ) {
5858 // Get the requested banner
59 - var bannerPageQuery = $.param( { 'banner': bannerName, 'userlang': wgUserLanguage, 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country } );
 59+ var bannerPageQuery = $.param( {
 60+ 'banner': bannerName, 'userlang': wgUserLanguage,
 61+ 'db': wgDBname, 'sitename': wgSiteName, 'country': Geo.country } );
6062 var bannerPage = '?title=Special:BannerLoader&' + bannerPageQuery;
61 -EOT;
62 - $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"".Xml::escapeJsString( $wgCentralPagePath )."' + bannerPage + '\"></script>';\n";
63 - $js .= <<<EOT
64 - $( '#siteNotice' ).prepend( '<div id="centralNotice" class="' + ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) + '">'+bannerScript+'</div>' );
 63+JAVASCRIPT;
 64+ $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"" .
 65+ Xml::escapeJsString( $wgCentralPagePath ) .
 66+ "' + bannerPage + '\"></script>';\n";
 67+ $js .= <<<JAVASCRIPT
 68+ $( '#siteNotice' ).prepend( '<div id="centralNotice" class="' +
 69+ ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) +
 70+ '">'+bannerScript+'</div>' );
6571 },
6672 'loadBannerList': function( geoOverride ) {
6773 if ( geoOverride ) {
@@ -87,7 +93,9 @@
8894
8995 for( var i = 0; i < bannerList.length; i++ ) {
9096 // Only include this banner if it's inteded for the current user
91 - if( ( wgUserName && bannerList[i].display_account ) || ( !wgUserName && bannerList[i].display_anon == 1 ) ) {
 97+ if( ( wgUserName && bannerList[i].display_account ) ||
 98+ ( !wgUserName && bannerList[i].display_anon == 1 ) )
 99+ {
92100 // add the banner to our list once per weight
93101 for( var j=0; j < bannerList[i].weight; j++ ) {
94102 groomedBannerList.push( bannerList[i] );
@@ -100,7 +108,9 @@
101109
102110 // Load a random banner from our groomed list
103111 $.centralNotice.fn.loadBanner(
104 - groomedBannerList[ Math.floor( Math.random() * groomedBannerList.length ) ].name
 112+ groomedBannerList[
 113+ Math.floor( Math.random() * groomedBannerList.length )
 114+ ].name
105115 );
106116 },
107117 'getQueryStringVariables': function() {
@@ -125,19 +135,19 @@
126136 }
127137 } ); //document ready
128138 } )( jQuery );
129 -EOT;
 139+JAVASCRIPT;
130140 return $js;
131141
132142 }
133143
134144 function getToggleScripts() {
135 - $showStyle = <<<END
 145+ $showStyle = <<<HTML
136146 <style type="text/css">
137147 #centralNotice .siteNoticeSmall {display:none;}
138148 #centralNotice.collapsed .siteNoticeBig {display:none;}
139149 #centralNotice.collapsed .siteNoticeSmall {display:block;}
140150 </style>
141 -END;
 151+HTML;
142152 $encShowStyle = Xml::encodeJsVar( $showStyle );
143153
144154 $script = "
@@ -147,7 +157,7 @@
148158 }
149159
150160 function getScriptFunctions() {
151 - $script = "
 161+ $script = <<<JAVASCRIPT
152162 function insertBanner(bannerJson) {
153163 jQuery('div#centralNotice').prepend( bannerJson.banner );
154164 }
@@ -172,7 +182,9 @@
173183 e.setTime( e.getTime() + (7*24*60*60*1000) ); // one week
174184 var work='hidesnmessage='+state+'; expires=' + e.toGMTString() + '; path=/';
175185 document.cookie = work;
176 -}\n\n";
 186+}
 187+
 188+JAVASCRIPT;
177189 return $script;
178190 }
179191
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerAllocation.php
@@ -59,7 +59,9 @@
6060
6161 $htmlOut .= Xml::openElement( 'table', array ( 'id' => 'envpicker', 'cellpadding' => 7 ) );
6262 $htmlOut .= Xml::openElement( 'tr' );
63 - $htmlOut .= Xml::tags( 'td', array( 'style' => 'width: 20%;' ), wfMsg( 'centralnotice-project-name' ) );
 63+ $htmlOut .= Xml::tags( 'td',
 64+ array( 'style' => 'width: 20%;' ),
 65+ wfMsg( 'centralnotice-project-name' ) );
6466 $htmlOut .= Xml::openElement( 'td' );
6567 $htmlOut .= Xml::openElement( 'select', array( 'name' => 'project' ) );
6668 foreach ( $wgNoticeProjects as $value ) {
@@ -69,9 +71,12 @@
7072 $htmlOut .= Xml::closeElement( 'td' );
7173 $htmlOut .= Xml::closeElement( 'tr' );
7274 $htmlOut .= Xml::openElement( 'tr' );
73 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsg( 'centralnotice-project-language' ) );
 75+ $htmlOut .= Xml::tags( 'td',
 76+ array( 'valign' => 'top' ),
 77+ wfMsg( 'centralnotice-project-language' ) );
7478 $htmlOut .= Xml::openElement( 'td' );
75 - // Make sure the site language is in the list; a custom language code might not have a defined name...
 79+ // Make sure the site language is in the list; a custom language code
 80+ // might not have a defined name...
7681 $languages = Language::getLanguageNames( true );
7782 if( !array_key_exists( $wgLanguageCode, $languages ) ) {
7883 $languages[$wgLanguageCode] = $wgLanguageCode;
@@ -79,7 +84,9 @@
8085 ksort( $languages );
8186 $htmlOut .= Xml::openElement( 'select', array( 'name' => 'language' ) );
8287 foreach( $languages as $code => $name ) {
83 - $htmlOut .= Xml::option( wfMsg( 'centralnotice-language-listing', $code, $name ), $code, $code === $this->language );
 88+ $htmlOut .= Xml::option(
 89+ wfMsg( 'centralnotice-language-listing', $code, $name ),
 90+ $code, $code === $this->language );
8491 }
8592 $htmlOut .= Xml::closeElement( 'select' );
8693 $htmlOut .= Xml::closeElement( 'td' );
@@ -153,10 +160,13 @@
154161 $totalWeight += $banner['weight'];
155162 }
156163 if ( $banners ) {
157 - $htmlOut .= Xml::openElement( 'table', array ( 'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
 164+ $htmlOut .= Xml::openElement( 'table',
 165+ array ( 'cellpadding' => 9, 'class' => 'wikitable sortable' ) );
158166 $htmlOut .= Xml::openElement( 'tr' );
159 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-percentage' ) );
160 - $htmlOut .= Xml::element( 'th', array( 'width' => '60%' ), wfMsg ( 'centralnotice-banner' ) );
 167+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 168+ wfMsg ( 'centralnotice-percentage' ) );
 169+ $htmlOut .= Xml::element( 'th', array( 'width' => '60%' ),
 170+ wfMsg ( 'centralnotice-banner' ) );
161171 $htmlOut .= Xml::closeElement( 'tr' );
162172 foreach ( $banners as $banner ) {
163173 $htmlOut .= Xml::openElement( 'tr' );
@@ -165,7 +175,8 @@
166176 $htmlOut .= wfMsg ( 'percent', $wgLang->formatNum( $percentage ) );
167177 $htmlOut .= Xml::closeElement( 'td' );
168178 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
169 - $sk->makeLinkObj( $viewPage, htmlspecialchars( $banner['name'] ), 'template=' . urlencode( $banner['name'] ) )
 179+ $sk->makeLinkObj( $viewPage, htmlspecialchars( $banner['name'] ),
 180+ 'template=' . urlencode( $banner['name'] ) )
170181 );
171182 $htmlOut .= Xml::closeElement( 'tr' );
172183 }
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -146,7 +146,8 @@
147147 $newTemplate = $wgRequest->getVal( 'newTemplate' );
148148 // We use the returned name in case any special characters had to be removed
149149 $template = $this->cloneTemplate( $oldTemplate, $newTemplate );
150 - $wgOut->redirect( $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) );
 150+ $wgOut->redirect(
 151+ $this->getTitle( 'view' )->getLocalUrl( "template=$template" ) );
151152 return;
152153
153154 } else {
@@ -188,9 +189,11 @@
189190 $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-manage-templates' ) );
190191
191192 // Show paginated list of banners
192 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 193+ $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ),
 194+ $pager->getNavigationBar() );
193195 $htmlOut .= $pager->getBody();
194 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 196+ $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ),
 197+ $pager->getNavigationBar() );
195198
196199 if ( $this->editable ) {
197200 $htmlOut .= Xml::closeElement( 'form' );
@@ -219,40 +222,53 @@
220223 // Build HTML
221224 $htmlOut = '';
222225 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
223 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
 226+ $htmlOut .= Xml::openElement( 'form',
 227+ array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
224228 $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) );
225229 $htmlOut .= Xml::hidden( 'wpMethod', 'addTemplate' );
226230 $htmlOut .= Xml::tags( 'p', null,
227 - Xml::inputLabel( wfMsg( 'centralnotice-banner-name' ), 'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' ) )
 231+ Xml::inputLabel(
 232+ wfMsg( 'centralnotice-banner-name' ),
 233+ 'templateName', 'templateName', 25, $wgRequest->getVal( 'templateName' )
 234+ )
228235 );
229236
230237 $htmlOut .= Xml::openElement( 'p', null );
231238 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
232239 if ( $wgRequest->wasPosted() ) {
233 - $displayAnon = $wgRequest->getCheck( 'displayAnon' ); // Restore checkbox state in event of error
 240+ // Restore checkbox state in event of error
 241+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
234242 } else {
235 - $displayAnon = true; // Default is checked
 243+ // Default is checked
 244+ $displayAnon = true;
236245 }
237246 $htmlOut .= Xml::check( 'displayAnon', $displayAnon, array( 'id' => 'displayAnon' ) );
238247 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
239248 if ( $wgRequest->wasPosted() ) {
240 - $displayAccount = $wgRequest->getCheck( 'displayAccount' ); // Restore checkbox state in event of error
 249+ // Restore checkbox state in event of error
 250+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
241251 } else {
242 - $displayAccount = true; // Default is checked
 252+ // Default is checked
 253+ $displayAccount = true;
243254 }
244 - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, array( 'id' => 'displayAccount' ) );
 255+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
 256+ array( 'id' => 'displayAccount' ) );
245257 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
246258 $htmlOut .= Xml::closeElement( 'p' );
247259
248260 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
249261 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
250262 $buttons = array();
251 - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . wfMsg( 'centralnotice-close-button' ) . '</a>';
252 - $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' . wfMsg( 'centralnotice-hide-button' ) . '</a>';
253 - $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' . wfMsg( 'centralnotice-translate-button' ) . '</a>';
 263+ $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' .
 264+ wfMsg( 'centralnotice-close-button' ) . '</a>';
 265+ $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' .
 266+ wfMsg( 'centralnotice-hide-button' ) . '</a>';
 267+ $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' .
 268+ wfMsg( 'centralnotice-translate-button' ) . '</a>';
254269 $htmlOut .= Xml::tags( 'div',
255270 array( 'style' => 'margin-bottom: 0.2em;' ),
256 - '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
 271+ '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' .
 272+ wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
257273 );
258274
259275 // Restore banner body state in the event of an error on form submit
@@ -319,14 +335,16 @@
320336 // Begin View Banner fieldset
321337 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
322338
323 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner-heading', $currentTemplate ) );
 339+ $htmlOut .= Xml::element( 'h2', null,
 340+ wfMsg( 'centralnotice-banner-heading', $currentTemplate ) );
324341
325342 // Show preview of banner
326343 $render = new SpecialBannerLoader();
327344 $render->siteName = 'Wikipedia';
328345 $render->language = $wpUserLang;
329346 if ( $render->language != '' ) {
330 - $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-preview' ) . " ($render->language)",
 347+ $htmlOut .= Xml::fieldset(
 348+ wfMsg( 'centralnotice-preview' ) . " ($render->language)",
331349 $render->getHtmlNotice( $wgRequest->getText( 'template' ) )
332350 );
333351 } else {
@@ -336,7 +354,8 @@
337355 }
338356
339357 // Pull banner text and respect any inc: markup
340 - $bodyPage = Title::newFromText( "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
 358+ $bodyPage = Title::newFromText(
 359+ "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
341360 $curRev = Revision::newFromTitle( $bodyPage );
342361 $body = $curRev ? $curRev->getText() : '';
343362
@@ -363,22 +382,29 @@
364383 );
365384
366385 // Table headers
367 - $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ), wfMsg( 'centralnotice-message' ) );
368 - $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ), wfMsg ( 'centralnotice-number-uses' ) );
369 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-english' ) );
 386+ $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ),
 387+ wfMsg( 'centralnotice-message' ) );
 388+ $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ),
 389+ wfMsg ( 'centralnotice-number-uses' ) );
 390+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 391+ wfMsg ( 'centralnotice-english' ) );
370392 $languages = Language::getLanguageNames();
371 - $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), $languages[$wpUserLang] );
 393+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ),
 394+ $languages[$wpUserLang] );
372395
373396 // Remove duplicate message fields
374397 $filteredFields = array();
375398 foreach ( $fields[1] as $field ) {
376 - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 : 1;
 399+ $filteredFields[$field] = array_key_exists( $field, $filteredFields )
 400+ ? $filteredFields[$field] + 1 : 1;
377401 }
378402
379403 // Table rows
380404 foreach ( $filteredFields as $field => $count ) {
381405 // Message
382 - $message = ( $wpUserLang == 'en' ) ? "Centralnotice-{$currentTemplate}-{$field}" : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
 406+ $message = ( $wpUserLang == 'en' )
 407+ ? "Centralnotice-{$currentTemplate}-{$field}"
 408+ : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
383409
384410 // English value
385411 $htmlOut .= Xml::openElement( 'tr' );
@@ -393,7 +419,11 @@
394420 // English text
395421 $englishText = wfMsg( 'centralnotice-message-not-set' );
396422 $englishTextExists = false;
397 - if ( Title::newFromText( "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI )->exists() ) {
 423+ if (
 424+ Title::newFromText(
 425+ "Centralnotice-{$currentTemplate}-{$field}", NS_MEDIAWIKI
 426+ )->exists() )
 427+ {
398428 $englishText = wfMsgExt( "Centralnotice-{$currentTemplate}-{$field}",
399429 array( 'language' => 'en' )
400430 );
@@ -401,7 +431,10 @@
402432 }
403433 $htmlOut .= Xml::tags( 'td', null,
404434 Xml::element( 'span',
405 - array( 'style' => 'font-style:italic;' . ( !$englishTextExists ? 'color:silver' : '' ) ),
 435+ array(
 436+ 'style' => 'font-style:italic;' .
 437+ ( !$englishTextExists ? 'color:silver' : '' )
 438+ ),
406439 $englishText
407440 )
408441 );
@@ -416,9 +449,13 @@
417450 $foreignTextExists = true;
418451 }
419452 $htmlOut .= Xml::tags( 'td', null,
420 - Xml::input( "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", '', $foreignText,
 453+ Xml::input(
 454+ "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]",
 455+ '',
 456+ $foreignText,
421457 wfArrayMerge( $readonly,
422 - array( 'style' => 'width:100%;' . ( !$foreignTextExists ? 'color:red' : '' ) ) )
 458+ array( 'style' => 'width:100%;' .
 459+ ( !$foreignTextExists ? 'color:red' : '' ) ) )
423460 )
424461 );
425462 $htmlOut .= Xml::closeElement( 'tr' );
@@ -430,7 +467,10 @@
431468 $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() );
432469 $htmlOut .= Xml::tags( 'div',
433470 array( 'class' => 'cn-buttons' ),
434 - Xml::submitButton( wfMsg( 'centralnotice-modify' ), array( 'name' => 'update' ) )
 471+ Xml::submitButton(
 472+ wfMsg( 'centralnotice-modify' ),
 473+ array( 'name' => 'update' )
 474+ )
435475 );
436476 }
437477
@@ -457,7 +497,12 @@
458498 );
459499 $htmlOut .= Xml::tags( 'tr', null,
460500 Xml::tags( 'td', null, '' ) .
461 - Xml::tags( 'td', null, $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-preview-all-template-translations' ), "template=$currentTemplate&wpUserLanguage=all" ) )
 501+ Xml::tags( 'td', null,
 502+ $sk->makeLinkObj(
 503+ $newPage,
 504+ wfMsgHtml( 'centralnotice-preview-all-template-translations' ),
 505+ "template=$currentTemplate&wpUserLanguage=all" )
 506+ )
462507 );
463508 $htmlOut .= Xml::closeElement( 'table' );
464509 $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() );
@@ -467,7 +512,12 @@
468513
469514 // Show edit form
470515 if ( $this->editable ) {
471 - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post', 'onsubmit' => 'return validateBannerForm(this)' ) );
 516+ $htmlOut .= Xml::openElement( 'form',
 517+ array(
 518+ 'method' => 'post',
 519+ 'onsubmit' => 'return validateBannerForm(this)'
 520+ )
 521+ );
472522 $htmlOut .= Xml::hidden( 'wpMethod', 'editTemplate' );
473523 }
474524
@@ -485,9 +535,11 @@
486536 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) );
487537 $htmlOut .= Xml::openElement( 'p', null );
488538 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
489 - $htmlOut .= Xml::check( 'displayAnon', $displayAnon, wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
 539+ $htmlOut .= Xml::check( 'displayAnon', $displayAnon,
 540+ wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
490541 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
491 - $htmlOut .= Xml::check( 'displayAccount', $displayAccount, wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
 542+ $htmlOut .= Xml::check( 'displayAccount', $displayAccount,
 543+ wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
492544 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
493545 $htmlOut .= Xml::closeElement( 'p' );
494546 $htmlOut .= Xml::closeElement( 'fieldset' );
@@ -495,12 +547,17 @@
496548 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-edit-template' ) );
497549 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
498550 $buttons = array();
499 - $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' . wfMsg( 'centralnotice-close-button' ) . '</a>';
500 - $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' . wfMsg( 'centralnotice-hide-button' ) . '</a>';
501 - $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' . wfMsg( 'centralnotice-translate-button' ) . '</a>';
 551+ $buttons[] = '<a href="#" onclick="insertButton(\'close\');return false;">' .
 552+ wfMsg( 'centralnotice-close-button' ) . '</a>';
 553+ $buttons[] = '<a href="#" onclick="insertButton(\'hide\');return false;">' .
 554+ wfMsg( 'centralnotice-hide-button' ) . '</a>';
 555+ $buttons[] = '<a href="#" onclick="insertButton(\'translate\');return false;">' .
 556+ wfMsg( 'centralnotice-translate-button' ) . '</a>';
502557 $htmlOut .= Xml::tags( 'div',
503558 array( 'style' => 'margin-bottom: 0.2em;' ),
504 - '<img src="'.$scriptPath.'/down-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
 559+ '<img src="' . $scriptPath . '/down-arrow.png" ' .
 560+ 'style="vertical-align:baseline;"/>' .
 561+ wfMsg( 'centralnotice-insert', $wgLang->commaList( $buttons ) )
505562 );
506563 } else {
507564 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
@@ -508,8 +565,9 @@
509566 $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20, $readonly );
510567 $htmlOut .= Xml::closeElement( 'fieldset' );
511568 if ( $this->editable ) {
512 - $htmlOut .= Xml::hidden( 'mainform', 'true' ); // Indicate which form was submitted
513 - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() );
 569+ // Indicate which form was submitted
 570+ $htmlOut .= Html::hidden( 'mainform', 'true' );
 571+ $htmlOut .= Html::hidden( 'authtoken', $wgUser->editToken() );
514572 $htmlOut .= Xml::tags( 'div',
515573 array( 'class' => 'cn-buttons' ),
516574 Xml::submitButton( wfMsg( 'centralnotice-save-banner' ) )
@@ -529,8 +587,12 @@
530588 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-clone-notice' ) );
531589 $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) );
532590 $htmlOut .= Xml::openElement( 'tr' );
533 - $htmlOut .= Xml::inputLabel( wfMsg( 'centralnotice-clone-name' ), 'newTemplate', 'newTemplate', '25' );
534 - $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-clone' ), array ( 'id' => 'clone' ) );
 591+ $htmlOut .= Xml::inputLabel(
 592+ wfMsg( 'centralnotice-clone-name' ),
 593+ 'newTemplate', 'newTemplate', '25' );
 594+ $htmlOut .= Xml::submitButton(
 595+ wfMsg( 'centralnotice-clone' ),
 596+ array ( 'id' => 'clone' ) );
535597 $htmlOut .= Xml::hidden( 'oldTemplate', $currentTemplate );
536598
537599 $htmlOut .= Xml::closeElement( 'tr' );
@@ -783,8 +845,9 @@
784846 // Remove duplicates
785847 $filteredFields = array();
786848 foreach ( $fields[1] as $field ) {
787 - $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 :
788 - 1;
 849+ $filteredFields[$field] = array_key_exists( $field, $filteredFields )
 850+ ? $filteredFields[$field] + 1
 851+ : 1;
789852 }
790853 return $filteredFields;
791854 }
@@ -807,7 +870,9 @@
808871 // Iterate through all possible message fields
809872 foreach ( $fields as $field => $count ) {
810873 // Put all message fields together for a lookup
811 - $message = ( $lang == 'en' ) ? "Centralnotice-{$template}-{$field}" : "Centralnotice-{$template}-{$field}/{$lang}";
 874+ $message = ( $lang == 'en' )
 875+ ? "Centralnotice-{$template}-{$field}"
 876+ : "Centralnotice-{$template}-{$field}/{$lang}";
812877 if ( Title::newFromText( $message, NS_MEDIAWIKI )->exists() ) {
813878 $translations[$lang][$field] = wfMsgExt(
814879 "Centralnotice-{$template}-{$field}",
@@ -828,7 +893,8 @@
829894 public static function templateExists( $templateName ) {
830895 $dbr = wfGetDB( DB_SLAVE );
831896 $eTemplateName = htmlspecialchars( $templateName );
832 - $row = $dbr->selectRow( 'cn_templates', 'tmp_name', array( 'tmp_name' => $eTemplateName ) );
 897+ $row = $dbr->selectRow( 'cn_templates', 'tmp_name',
 898+ array( 'tmp_name' => $eTemplateName ) );
833899 if ( $row ) {
834900 return true;
835901 } else {
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialBannerListLoader.php
@@ -72,7 +72,8 @@
7373
7474 if ( !$templates && $this->project == 'wikipedia' ) {
7575 // See if we have any preferred notices for this language wikipedia
76 - $notices = CentralNoticeDB::getNotices( 'wikipedia', $this->language, false, 1, 1, $this->location );
 76+ $notices = CentralNoticeDB::getNotices( 'wikipedia', $this->language,
 77+ false, 1, 1, $this->location );
7778
7879 if ( $notices ) {
7980 // Pull banners
@@ -82,7 +83,8 @@
8384
8485 // Didn't find any preferred matches so do an old style lookup
8586 if ( !$templates ) {
86 - $templates = CentralNotice::selectNoticeTemplates( $this->project, $this->language, $this->location );
 87+ $templates = CentralNotice::selectNoticeTemplates(
 88+ $this->project, $this->language, $this->location );
8789 }
8890
8991 return FormatJson::encode( $templates );
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.php
@@ -122,19 +122,29 @@
123123 global $wgDBtype, $wgExtNewTables, $wgExtNewFields;
124124
125125 if ( $wgDBtype == 'mysql' ) {
126 - $wgExtNewTables[] = array( 'cn_notices', $base . '/CentralNotice.sql' );
127 - $wgExtNewFields[] = array( 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' );
128 - $wgExtNewTables[] = array( 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' );
129 - $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' );
130 - $wgExtNewTables[] = array( 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' );
 126+ $wgExtNewTables[] = array( 'cn_notices',
 127+ $base . '/CentralNotice.sql' );
 128+ $wgExtNewFields[] = array( 'cn_notices', 'not_preferred',
 129+ $base . '/patches/patch-notice_preferred.sql' );
 130+ $wgExtNewTables[] = array( 'cn_notice_languages',
 131+ $base . '/patches/patch-notice_languages.sql' );
 132+ $wgExtNewFields[] = array( 'cn_templates', 'tmp_display_anon',
 133+ $base . '/patches/patch-template_settings.sql' );
 134+ $wgExtNewTables[] = array( 'cn_notice_countries',
 135+ $base . '/patches/patch-notice_countries.sql' );
131136 }
132137 } else {
133138 if ( $updater->getDB()->getType() == 'mysql' ) {
134 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notices', $base . '/CentralNotice.sql' ) );
135 - $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred', $base . '/patches/patch-notice_preferred.sql' ) );
136 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages', $base . '/patches/patch-notice_languages.sql' ) );
137 - $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon', $base . '/patches/patch-template_settings.sql' ) );
138 - $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries', $base . '/patches/patch-notice_countries.sql' ) );
 139+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notices',
 140+ $base . '/CentralNotice.sql' ) );
 141+ $updater->addExtensionUpdate( array( 'addField', 'cn_notices', 'not_preferred',
 142+ $base . '/patches/patch-notice_preferred.sql' ) );
 143+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_languages',
 144+ $base . '/patches/patch-notice_languages.sql' ) );
 145+ $updater->addExtensionUpdate( array( 'addField', 'cn_templates', 'tmp_display_anon',
 146+ $base . '/patches/patch-template_settings.sql' ) );
 147+ $updater->addExtensionUpdate( array( 'addTable', 'cn_notice_countries',
 148+ $base . '/patches/patch-notice_countries.sql' ) );
139149 }
140150 }
141151 return true;
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialCentralNotice.php
@@ -147,7 +147,8 @@
148148 if ( $noticeName == '' ) {
149149 $this->showError( 'centralnotice-null-string' );
150150 } else {
151 - $this->addNotice( $noticeName, '0', $start, $project_name, $project_languages, $geotargeted, $geo_countries );
 151+ $this->addNotice( $noticeName, '0', $start, $project_name,
 152+ $project_languages, $geotargeted, $geo_countries );
152153 }
153154 }
154155
@@ -419,7 +420,10 @@
420421
421422 // If campaign is currently active, set special class on table row.
422423 $attribs = array();
423 - if ( wfTimestamp() > wfTimestamp( TS_UNIX , $row->not_start ) && wfTimestamp() < wfTimestamp( TS_UNIX , $row->not_end ) && $row->not_enabled == '1' ) {
 424+ if ( wfTimestamp() > wfTimestamp( TS_UNIX , $row->not_start )
 425+ && wfTimestamp() < wfTimestamp( TS_UNIX , $row->not_end )
 426+ && $row->not_enabled == '1' )
 427+ {
424428 $attribs = array( 'class' => 'cn-active-campaign' );
425429 }
426430
@@ -482,7 +486,8 @@
483487 // Name
484488 $htmlOut .= Xml::openElement( 'tr' );
485489 $htmlOut .= Xml::tags( 'td', array(), wfMsgHtml( 'centralnotice-notice-name' ) );
486 - $htmlOut .= Xml::tags( 'td', array(), Xml::input( 'noticeName', 25, $wgRequest->getVal( 'noticeName' ) ) );
 490+ $htmlOut .= Xml::tags( 'td', array(),
 491+ Xml::input( 'noticeName', 25, $wgRequest->getVal( 'noticeName' ) ) );
487492 $htmlOut .= Xml::closeElement( 'tr' );
488493 // Start Date
489494 $htmlOut .= Xml::openElement( 'tr' );
@@ -502,15 +507,21 @@
503508 // Languages
504509 $htmlOut .= Xml::openElement( 'tr' );
505510 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'yourlanguage' ) );
506 - $htmlOut .= Xml::tags( 'td', array(), $this->languageMultiSelector( $noticeLanguages ) );
 511+ $htmlOut .= Xml::tags( 'td', array(),
 512+ $this->languageMultiSelector( $noticeLanguages ) );
507513 $htmlOut .= Xml::closeElement( 'tr' );
508514 // Countries
509515 $htmlOut .= Xml::openElement( 'tr' );
510 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
511 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'geotargeted', false, wfArrayMerge( $readonly, array( 'value' => 1, 'id' => 'geotargeted' ) ) ) );
 516+ $htmlOut .= Xml::tags( 'td', array(),
 517+ Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
 518+ $htmlOut .= Xml::tags( 'td', array(),
 519+ Xml::check( 'geotargeted', false,
 520+ wfArrayMerge( $readonly, array( 'value' => 1, 'id' => 'geotargeted' ) ) ) );
512521 $htmlOut .= Xml::closeElement( 'tr' );
513 - $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
514 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'centralnotice-countries' ) );
 522+ $htmlOut .= Xml::openElement( 'tr',
 523+ array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
 524+ $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 525+ wfMsgHtml( 'centralnotice-countries' ) );
515526 $htmlOut .= Xml::tags( 'td', array(), $this->geoMultiSelector() );
516527 $htmlOut .= Xml::closeElement( 'tr' );
517528
@@ -652,7 +663,8 @@
653664
654665 // If there were no errors, reload the page to prevent duplicate form submission
655666 if ( !$this->centralNoticeError ) {
656 - $wgOut->redirect( $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" ) );
 667+ $wgOut->redirect( $this->getTitle()->getLocalUrl(
 668+ "method=listNoticeDetail&notice=$notice" ) );
657669 return;
658670 }
659671 } else {
@@ -670,7 +682,8 @@
671683 $htmlOut .= Xml::openElement( 'form',
672684 array(
673685 'method' => 'post',
674 - 'action' => $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" )
 686+ 'action' => $this->getTitle()->getLocalUrl(
 687+ "method=listNoticeDetail&notice=$notice" )
675688 )
676689 );
677690 }
@@ -821,41 +834,64 @@
822835 // Languages
823836 $htmlOut .= Xml::openElement( 'tr' );
824837 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'yourlanguage' ) );
825 - $htmlOut .= Xml::tags( 'td', array(), $this->languageMultiSelector( $noticeLanguages ) );
 838+ $htmlOut .= Xml::tags( 'td', array(),
 839+ $this->languageMultiSelector( $noticeLanguages ) );
826840 $htmlOut .= Xml::closeElement( 'tr' );
827841 // Countries
828842 $htmlOut .= Xml::openElement( 'tr' );
829 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
830 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'geotargeted', $isGeotargeted, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'geotargeted' ) ) ) );
 843+ $htmlOut .= Xml::tags( 'td', array(),
 844+ Xml::label( wfMsg( 'centralnotice-geotargeted' ), 'geotargeted' ) );
 845+ $htmlOut .= Xml::tags( 'td', array(),
 846+ Xml::check( 'geotargeted', $isGeotargeted,
 847+ wfArrayMerge(
 848+ $readonly,
 849+ array( 'value' => $row->not_name, 'id' => 'geotargeted' ) ) ) );
831850 $htmlOut .= Xml::closeElement( 'tr' );
832851 if ( $isGeotargeted ) {
833852 $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector' ) );
834853 } else {
835 - $htmlOut .= Xml::openElement( 'tr', array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
 854+ $htmlOut .= Xml::openElement( 'tr',
 855+ array( 'id'=>'geoMultiSelector', 'style'=>'display:none;' ) );
836856 }
837 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), wfMsgHtml( 'centralnotice-countries' ) );
 857+ $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 858+ wfMsgHtml( 'centralnotice-countries' ) );
838859 $htmlOut .= Xml::tags( 'td', array(), $this->geoMultiSelector( $countries ) );
839860 $htmlOut .= Xml::closeElement( 'tr' );
840861 // Enabled
841862 $htmlOut .= Xml::openElement( 'tr' );
842 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-enabled' ), 'enabled' ) );
843 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled', $isEnabled, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
 863+ $htmlOut .= Xml::tags( 'td', array(),
 864+ Xml::label( wfMsg( 'centralnotice-enabled' ), 'enabled' ) );
 865+ $htmlOut .= Xml::tags( 'td', array(),
 866+ Xml::check( 'enabled', $isEnabled,
 867+ wfArrayMerge( $readonly,
 868+ array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
844869 $htmlOut .= Xml::closeElement( 'tr' );
845870 // Preferred
846871 $htmlOut .= Xml::openElement( 'tr' );
847 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-preferred' ), 'preferred' ) );
848 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred', $isPreferred, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
 872+ $htmlOut .= Xml::tags( 'td', array(),
 873+ Xml::label( wfMsg( 'centralnotice-preferred' ), 'preferred' ) );
 874+ $htmlOut .= Xml::tags( 'td', array(),
 875+ Xml::check( 'preferred', $isPreferred,
 876+ wfArrayMerge( $readonly,
 877+ array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
849878 $htmlOut .= Xml::closeElement( 'tr' );
850879 // Locked
851880 $htmlOut .= Xml::openElement( 'tr' );
852 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-locked' ), 'locked' ) );
853 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked', $isLocked, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
 881+ $htmlOut .= Xml::tags( 'td', array(),
 882+ Xml::label( wfMsg( 'centralnotice-locked' ), 'locked' ) );
 883+ $htmlOut .= Xml::tags( 'td', array(),
 884+ Xml::check( 'locked', $isLocked,
 885+ wfArrayMerge( $readonly,
 886+ array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
854887 $htmlOut .= Xml::closeElement( 'tr' );
855888 if ( $this->editable ) {
856889 // Locked
857890 $htmlOut .= Xml::openElement( 'tr' );
858 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsg( 'centralnotice-remove' ), 'remove' ) );
859 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'remove', false, array( 'value' => $row->not_name, 'id' => 'remove' ) ) );
 891+ $htmlOut .= Xml::tags( 'td', array(),
 892+ Xml::label( wfMsg( 'centralnotice-remove' ), 'remove' ) );
 893+ $htmlOut .= Xml::tags( 'td', array(),
 894+ Xml::check( 'remove', false,
 895+ array( 'value' => $row->not_name, 'id' => 'remove' ) ) );
860896 $htmlOut .= Xml::closeElement( 'tr' );
861897 }
862898 $htmlOut .= Xml::closeElement( 'table' );
@@ -983,9 +1019,13 @@
9841020 $htmlOut = Xml::fieldset( wfMsg( "centralnotice-available-templates" ) );
9851021
9861022 // Show paginated list of banners
987 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 1023+ $htmlOut .= Xml::tags( 'div',
 1024+ array( 'class' => 'cn-pager' ),
 1025+ $pager->getNavigationBar() );
9881026 $htmlOut .= $pager->getBody();
989 - $htmlOut .= Xml::tags( 'div', array( 'class' => 'cn-pager' ), $pager->getNavigationBar() );
 1027+ $htmlOut .= Xml::tags( 'div',
 1028+ array( 'class' => 'cn-pager' ),
 1029+ $pager->getNavigationBar() );
9901030
9911031 $htmlOut .= Xml::closeElement( 'fieldset' );
9921032 } else {
@@ -1075,7 +1115,9 @@
10761116 return $templates;
10771117 }
10781118
1079 - function addNotice( $noticeName, $enabled, $start, $project_name, $project_languages, $geotargeted, $geo_countries ) {
 1119+ function addNotice( $noticeName, $enabled, $start, $project_name,
 1120+ $project_languages, $geotargeted, $geo_countries )
 1121+ {
10801122 global $wgOut;
10811123
10821124 if ( $this->noticeExists( $noticeName ) ) {
@@ -1096,12 +1138,17 @@
10971139 $end['month'] = '10';
10981140 $end['year'] = $start['year'];
10991141 } else {
1100 - $end['month'] = ( substr( $start['month'], 0, 1 ) ) == 0 ? 0 . ( intval( $start['month'] ) + 1 ) : ( $start['month'] + 1 );
 1142+ $end['month'] =
 1143+ ( substr( $start['month'], 0, 1 ) ) == 0
 1144+ ? 0 . ( intval( $start['month'] ) + 1 )
 1145+ : ( $start['month'] + 1 );
11011146 $end['year'] = $start['year'];
11021147 }
11031148
1104 - $startTs = wfTimeStamp( TS_MW, "{$start['year']}:{$start['month']}:{$start['day']} {$start['hour']}:{$start['min']}:00" );
1105 - $endTs = wfTimeStamp( TS_MW, "{$end['year']}:{$end['month']}:{$start['day']} {$start['hour']}:{$start['min']}:00" );
 1149+ $startTs = wfTimeStamp( TS_MW, "{$start['year']}:{$start['month']}:{$start['day']} " .
 1150+ "{$start['hour']}:{$start['min']}:00" );
 1151+ $endTs = wfTimeStamp( TS_MW, "{$end['year']}:{$end['month']}:{$start['day']} " .
 1152+ "{$start['hour']}:{$start['min']}:00" );
11061153
11071154 $res = $dbw->insert( 'cn_notices',
11081155 array( 'not_name' => $noticeName,
@@ -1119,7 +1166,8 @@
11201167 foreach( $project_languages as $code ) {
11211168 $insertArray[] = array( 'nl_notice_id' => $not_id, 'nl_language' => $code );
11221169 }
1123 - $res = $dbw->insert( 'cn_notice_languages', $insertArray, __METHOD__, array( 'IGNORE' ) );
 1170+ $res = $dbw->insert( 'cn_notice_languages', $insertArray,
 1171+ __METHOD__, array( 'IGNORE' ) );
11241172
11251173 if ( $geotargeted ) {
11261174 // Do multi-row insert for campaign countries
@@ -1127,7 +1175,8 @@
11281176 foreach( $geo_countries as $code ) {
11291177 $insertArray[] = array( 'nc_notice_id' => $not_id, 'nc_country' => $code );
11301178 }
1131 - $res = $dbw->insert( 'cn_notice_countries', $insertArray, __METHOD__, array( 'IGNORE' ) );
 1179+ $res = $dbw->insert( 'cn_notice_countries', $insertArray,
 1180+ __METHOD__, array( 'IGNORE' ) );
11321181 }
11331182
11341183 $dbw->commit();
@@ -1213,7 +1262,8 @@
12141263 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
12151264 $languages = array();
12161265 if ( $row ) {
1217 - $res = $dbr->select( 'cn_notice_languages', 'nl_language', array( 'nl_notice_id' => $row->not_id ) );
 1266+ $res = $dbr->select( 'cn_notice_languages', 'nl_language',
 1267+ array( 'nl_notice_id' => $row->not_id ) );
12181268 foreach ( $res as $langRow ) {
12191269 $languages[] = $langRow->nl_language;
12201270 }
@@ -1227,7 +1277,8 @@
12281278 $row = $dbr->selectRow( 'cn_notices', 'not_id', array( 'not_name' => $eNoticeName ) );
12291279 $countries = array();
12301280 if ( $row ) {
1231 - $res = $dbr->select( 'cn_notice_countries', 'nc_country', array( 'nc_notice_id' => $row->not_id ) );
 1281+ $res = $dbr->select( 'cn_notice_countries', 'nc_country',
 1282+ array( 'nc_notice_id' => $row->not_id ) );
12321283 foreach ( $res as $countryRow ) {
12331284 $countries[] = $countryRow->nc_country;
12341285 }
@@ -1400,7 +1451,8 @@
14011452 function languageMultiSelector( $selected = array(), $customisedOnly = true ) {
14021453 global $wgContLanguageCode, $wgExtensionAssetsPath, $wgLang;
14031454 $scriptPath = "$wgExtensionAssetsPath/CentralNotice";
1404 - // Make sure the site language is in the list; a custom language code might not have a defined name...
 1455+ // Make sure the site language is in the list; a custom language code
 1456+ // might not have a defined name...
14051457 $languages = Language::getLanguageNames( $customisedOnly );
14061458 if( !array_key_exists( $wgContLanguageCode, $languages ) ) {
14071459 $languages[$wgContLanguageCode] = $wgContLanguageCode;
@@ -1422,16 +1474,26 @@
14231475 $options
14241476 );
14251477 $buttons = array();
1426 - $buttons[] = '<a href="#" onclick="selectLanguages(true);return false;">' . wfMsg( 'powersearch-toggleall' ) . '</a>';
1427 - $buttons[] = '<a href="#" onclick="selectLanguages(false);return false;">' . wfMsg( 'powersearch-togglenone' ) . '</a>';
1428 - $buttons[] = '<a href="#" onclick="top10Languages();return false;">' . wfMsg( 'centralnotice-top-ten-languages' ) . '</a>';
 1478+ $buttons[] = '<a href="#" onclick="selectLanguages(true);return false;">' .
 1479+ wfMsg( 'powersearch-toggleall' ) . '</a>';
 1480+ $buttons[] = '<a href="#" onclick="selectLanguages(false);return false;">' .
 1481+ wfMsg( 'powersearch-togglenone' ) . '</a>';
 1482+ $buttons[] = '<a href="#" onclick="top10Languages();return false;">' .
 1483+ wfMsg( 'centralnotice-top-ten-languages' ) . '</a>';
14291484 $htmlOut .= Xml::tags( 'div',
14301485 array( 'style' => 'margin-top: 0.2em;' ),
1431 - '<img src="'.$scriptPath.'/up-arrow.png" style="vertical-align:baseline;"/>' . wfMsg( 'centralnotice-select', $wgLang->commaList( $buttons ) )
 1486+ '<img src="'.$scriptPath.'/up-arrow.png" style="vertical-align:baseline;"/>' .
 1487+ wfMsg( 'centralnotice-select', $wgLang->commaList( $buttons ) )
14321488 );
14331489 } else {
14341490 $htmlOut .= Xml::tags( 'select',
1435 - array( 'multiple' => 'multiple', 'size' => 4, 'id' => 'project_languages[]', 'name' => 'project_languages[]', 'disabled' => 'disabled' ),
 1491+ array(
 1492+ 'multiple' => 'multiple',
 1493+ 'size' => 4,
 1494+ 'id' => 'project_languages[]',
 1495+ 'name' => 'project_languages[]',
 1496+ 'disabled' => 'disabled'
 1497+ ),
14361498 $options
14371499 );
14381500 }
@@ -1559,12 +1621,23 @@
15601622 $htmlOut = '';
15611623 if ( $this->editable ) {
15621624 $htmlOut .= Xml::tags( 'select',
1563 - array( 'multiple' => 'multiple', 'size' => 5, 'id' => 'geo_countries[]', 'name' => 'geo_countries[]' ),
 1625+ array(
 1626+ 'multiple' => 'multiple',
 1627+ 'size' => 5,
 1628+ 'id' => 'geo_countries[]',
 1629+ 'name' => 'geo_countries[]'
 1630+ ),
15641631 $options
15651632 );
15661633 } else {
15671634 $htmlOut .= Xml::tags( 'select',
1568 - array( 'multiple' => 'multiple', 'size' => 5, 'id' => 'geo_countries[]', 'name' => 'geo_countries[]', 'disabled' => 'disabled' ),
 1635+ array(
 1636+ 'multiple' => 'multiple',
 1637+ 'size' => 5,
 1638+ 'id' => 'geo_countries[]',
 1639+ 'name' => 'geo_countries[]',
 1640+ 'disabled' => 'disabled'
 1641+ ),
15691642 $options
15701643 );
15711644 }
@@ -1595,7 +1668,8 @@
15961669 'join_conds' => array(
15971670 'cn_assignments' => array(
15981671 'LEFT JOIN',
1599 - "cn_assignments.tmp_id = cn_templates.tmp_id AND cn_assignments.not_id = $noticeId"
 1672+ "cn_assignments.tmp_id = cn_templates.tmp_id " .
 1673+ "AND cn_assignments.not_id = $noticeId"
16001674 )
16011675 )
16021676 );
@@ -1624,7 +1698,9 @@
16251699 // Weight select
16261700 $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
16271701 Xml::listDropDown( "weight[$row->tmp_id]",
1628 - CentralNotice::dropDownList( wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 ) ) ,
 1702+ CentralNotice::dropDownList(
 1703+ wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5 )
 1704+ ) ,
16291705 '',
16301706 '25',
16311707 '',
Property changes on: branches/wmf/1.16wmf4/extensions/CentralNotice
___________________________________________________________________
Modified: svn:mergeinfo
16321708 Merged /trunk/extensions/CentralNotice:r75908

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75908* Break long lines....tstarling05:25, 3 November 2010

Status & tagging log