r72057 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72056‎ | r72057 | r72058 >
Date:22:11, 31 August 2010
Author:tomasz
Status:deferred
Tags:
Comment:
Sync'ing up to trunk head at 71997
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/CentralNotice (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.db.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.i18n.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/SpecialCentralNotice.php
@@ -6,12 +6,11 @@
77 }
88
99 class CentralNotice extends SpecialPage {
10 - var $centralNoticeDB;
11 - /* Functions */
12 -
13 - function CentralNotice() {
 10+ var $centralNoticeDB, $editable, $centralNoticeError;
 11+
 12+ function __construct() {
1413 // Register special page
15 - parent::SpecialPage( 'CentralNotice' );
 14+ parent::__construct( 'CentralNotice' );
1615
1716 // Internationalization
1817 wfLoadExtensionMessages( 'CentralNotice' );
@@ -36,6 +35,9 @@
3736
3837 // Check permissions
3938 $this->editable = $wgUser->isAllowed( 'centralnotice-admin' );
 39+
 40+ // Initialize error variable
 41+ $this->centralNoticeError = false;
4042
4143 // Show summary
4244 $wgOut->addWikiText( wfMsg( 'centralnotice-summary' ) );
@@ -48,7 +50,15 @@
4951
5052 $method = $wgRequest->getVal( 'method' );
5153
52 - // Handle form submissions
 54+ // Switch to campaign detail interface if requested
 55+ if ( $method == 'listNoticeDetail' ) {
 56+ $notice = $wgRequest->getVal ( 'notice' );
 57+ $this->listNoticeDetail( $notice );
 58+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
 59+ return;
 60+ }
 61+
 62+ // Handle form submissions from "Manage campaigns" or "Add a campaign" interface
5363 if ( $this->editable && $wgRequest->wasPosted() ) {
5464
5565 // Check authentication token
@@ -56,13 +66,13 @@
5767
5868 // Handle removing campaigns
5969 $toRemove = $wgRequest->getArray( 'removeNotices' );
60 - if ( isset( $toRemove ) ) {
 70+ if ( $toRemove ) {
6171 // Remove campaigns in list
6272 foreach ( $toRemove as $notice ) {
6373 $this->removeNotice( $notice );
6474 }
6575
66 - // Show list of campaigns
 76+ // Skip subsequent form handling and show list of campaigns
6777 $this->listNotices();
6878 $wgOut->addHTML( Xml::closeElement( 'div' ) );
6979 return;
@@ -70,119 +80,64 @@
7181
7282 // Handle locking/unlocking campaigns
7383 $lockedNotices = $wgRequest->getArray( 'locked' );
74 - if ( isset( $lockedNotices ) ) {
75 - if ( $method == 'listNoticeDetail' ) {
76 - $notice = $wgRequest->getVal ( 'notice' );
 84+ if ( $lockedNotices ) {
 85+ // Build list of campaigns to lock
 86+ $unlockedNotices = array_diff( $this->getNoticesName(), $lockedNotices );
 87+
 88+ // Set locked/unlocked flag accordingly
 89+ foreach ( $lockedNotices as $notice ) {
7790 $this->updateLock( $notice, '1' );
78 - } else {
79 - // Build list of campaigns to lock
80 - $unlockedNotices = array_diff( $this->getNoticesName(), $lockedNotices );
81 -
82 - // Set locked/unlocked flag accordingly
83 - foreach ( $lockedNotices as $notice ) {
84 - $this->updateLock( $notice, '1' );
85 - }
86 - foreach ( $unlockedNotices as $notice ) {
87 - $this->updateLock( $notice, '0' );
88 - }
8991 }
 92+ foreach ( $unlockedNotices as $notice ) {
 93+ $this->updateLock( $notice, '0' );
 94+ }
 95+ // Handle updates if no post content came through (all checkboxes unchecked)
 96+ } elseif ( $method !== 'addNotice' ) {
 97+ $allNotices = $this->getNoticesName();
 98+ foreach ( $allNotices as $notice ) {
 99+ $this->updateLock( $notice, '0' );
 100+ }
90101 }
91102
92103 // Handle enabling/disabling campaigns
93104 $enabledNotices = $wgRequest->getArray( 'enabled' );
94 - if ( isset( $enabledNotices ) ) {
95 - if ( $method == 'listNoticeDetail' ) {
96 - $notice = $wgRequest->getVal ( 'notice' );
 105+ if ( $enabledNotices ) {
 106+ // Build list of campaigns to disable
 107+ $disabledNotices = array_diff( $this->getNoticesName(), $enabledNotices );
 108+
 109+ // Set enabled/disabled flag accordingly
 110+ foreach ( $enabledNotices as $notice ) {
97111 $this->updateEnabled( $notice, '1' );
98 - } else {
99 - // Build list of campaigns to disable
100 - $disabledNotices = array_diff( $this->getNoticesName(), $enabledNotices );
101 -
102 - // Set enabled/disabled flag accordingly
103 - foreach ( $enabledNotices as $notice ) {
104 - $this->updateEnabled( $notice, '1' );
105 - }
106 - foreach ( $disabledNotices as $notice ) {
107 - $this->updateEnabled( $notice, '0' );
108 - }
109112 }
 113+ foreach ( $disabledNotices as $notice ) {
 114+ $this->updateEnabled( $notice, '0' );
 115+ }
 116+ // Handle updates if no post content came through (all checkboxes unchecked)
 117+ } elseif ( $method !== 'addNotice' ) {
 118+ $allNotices = $this->getNoticesName();
 119+ foreach ( $allNotices as $notice ) {
 120+ $this->updateEnabled( $notice, '0' );
 121+ }
110122 }
111123
112124 // Handle setting preferred campaigns
113125 $preferredNotices = $wgRequest->getArray( 'preferred' );
114 - if ( isset( $preferredNotices ) ) {
115 - // Set since this is a single display
116 - if ( $method == 'listNoticeDetail' ) {
117 - $notice = $wgRequest->getVal ( 'notice' );
118 - $this->centralNoticeDB->updatePreferred( $notice, '1' );
119 - }
120 - else {
121 - // Build list of campaigns to unset
122 - $unsetNotices = array_diff( $this->getNoticesName(), $preferredNotices );
123 -
124 - // Set flag accordingly
125 - foreach ( $preferredNotices as $notice ) {
126 - $this->centralNoticeDB->updatePreferred( $notice, '1' );
127 - }
128 - foreach ( $unsetNotices as $notice ) {
129 - $this->centralNoticeDB->updatePreferred( $notice, '0' );
130 - }
131 - }
132 - }
 126+ if ( $preferredNotices ) {
 127+ // Build list of campaigns to unset
 128+ $unsetNotices = array_diff( $this->getNoticesName(), $preferredNotices );
133129
134 - $noticeName = $wgRequest->getVal( 'notice' );
135 -
136 - // Handle range setting
137 - $start = $wgRequest->getArray( 'start' );
138 - $end = $wgRequest->getArray( 'end' );
139 - if ( isset( $start ) && isset( $end ) ) {
140 - $updatedStart = sprintf( "%04d%02d%02d%02d%02d00",
141 - $start['year'],
142 - $start['month'],
143 - $start['day'],
144 - $start['hour'],
145 - $start['min'] );
146 - $updatedEnd = sprintf( "%04d%02d%02d000000",
147 - $end['year'],
148 - $end['month'],
149 - $end['day'] );
150 - $this->updateNoticeDate( $noticeName, $updatedStart, $updatedEnd );
151 - }
152 -
153 - // Handle updates if no post content came through
154 - if ( !isset( $lockedNotices ) && $method !== 'addNotice' ) {
155 - if ( $method == 'listNoticeDetail' ) {
156 - $notice = $wgRequest->getVal ( 'notice' );
157 - $this->updateLock( $notice, 0 );
158 - } else {
159 - $allNotices = $this->getNoticesName();
160 - foreach ( $allNotices as $notice ) {
161 - $this->updateLock( $notice, '0' );
162 - }
 130+ // Set flag accordingly
 131+ foreach ( $preferredNotices as $notice ) {
 132+ $this->updatePreferred( $notice, '1' );
163133 }
164 - }
165 -
166 - if ( !isset( $enabledNotices ) && $method !== 'addNotice' ) {
167 - if ( $method == 'listNoticeDetail' ) {
168 - $notice = $wgRequest->getVal ( 'notice' );
169 - $this->updateEnabled( $notice, 0 );
170 - } else {
171 - $allNotices = $this->getNoticesName();
172 - foreach ( $allNotices as $notice ) {
173 - $this->updateEnabled( $notice, '0' );
174 - }
 134+ foreach ( $unsetNotices as $notice ) {
 135+ $this->updatePreferred( $notice, '0' );
175136 }
176 - }
177 -
178 - if ( !isset( $preferredNotices ) && $method !== 'addNotice' ) {
179 - if ( $method == 'listNoticeDetail' ) {
180 - $notice = $wgRequest->getVal ( 'notice' );
181 - $this->centralNoticeDB->updatePreferred( $notice, 0 );
182 - } else {
183 - $allNotices = $this->getNoticesName();
184 - foreach ( $allNotices as $notice ) {
185 - $this->centralNoticeDB->updatePreferred( $notice, '0' );
186 - }
 137+ // Handle updates if no post content came through (all checkboxes unchecked)
 138+ } elseif ( $method !== 'addNotice' ) {
 139+ $allNotices = $this->getNoticesName();
 140+ foreach ( $allNotices as $notice ) {
 141+ $this->updatePreferred( $notice, '0' );
187142 }
188143 }
189144
@@ -193,34 +148,24 @@
194149 $project_name = $wgRequest->getVal( 'project_name' );
195150 $project_languages = $wgRequest->getArray( 'project_languages' );
196151 if ( $noticeName == '' ) {
197 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-null-string' );
 152+ $this->showError( 'centralnotice-null-string' );
198153 } else {
199154 $this->addNotice( $noticeName, '0', $start, $project_name, $project_languages );
200155 }
201156 }
202157
203 - // Handle weight change
204 - $updatedWeights = $wgRequest->getArray( 'weight' );
205 - if ( isset( $updatedWeights ) ) {
206 - foreach ( $updatedWeights as $templateId => $weight ) {
207 - $this->updateWeight( $noticeName, $templateId, $weight );
208 - }
 158+ // If there were no errors, reload the page to prevent duplicate form submission
 159+ if ( !$this->centralNoticeError ) {
 160+ $wgOut->redirect( $this->getTitle()->getLocalUrl() );
 161+ return;
209162 }
210 -
 163+
211164 } else {
212 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'sessionfailure' );
 165+ $this->showError( 'sessionfailure' );
213166 }
214167
215168 }
216169
217 - // Handle showing campaign detail
218 - if ( $method == 'listNoticeDetail' ) {
219 - $notice = $wgRequest->getVal ( 'notice' );
220 - $this->listNoticeDetail( $notice );
221 - $wgOut->addHTML( Xml::closeElement( 'div' ) );
222 - return;
223 - }
224 -
225170 // Show list of campaigns
226171 $this->listNotices();
227172
@@ -228,19 +173,6 @@
229174 $wgOut->addHTML( Xml::closeElement( 'div' ) );
230175 }
231176
232 - /**
233 - * Update the enabled/disabled state of a campaign
234 - */
235 - private function updateEnabled( $notice, $state ) {
236 - $dbw = wfGetDB( DB_MASTER );
237 - $dbw->begin();
238 - $res = $dbw->update( 'cn_notices',
239 - array( 'not_enabled' => $state ),
240 - array( 'not_name' => $notice )
241 - );
242 - $dbw->commit();
243 - }
244 -
245177 public static function printHeader() {
246178 global $wgOut, $wgTitle, $wgUser;
247179 $sk = $wgUser->getSkin();
@@ -529,11 +461,7 @@
530462 $startArray['min'] . '00'
531463 ;
532464 $projectSelected = $wgRequest->getVal( 'project_name' );
533 - if ( $wgRequest->getArray( 'project_languages' ) ) {
534 - $noticeLanguages = $wgRequest->getArray( 'project_languages' );
535 - } else {
536 - $noticeLanguages = array();
537 - }
 465+ $noticeLanguages = $wgRequest->getArray( 'project_languages', array() );
538466 } else { // Defaults
539467 $startTimestamp = null;
540468 $projectSelected = '';
@@ -599,56 +527,114 @@
600528 function listNoticeDetail( $notice ) {
601529 global $wgOut, $wgRequest, $wgUser;
602530
603 - if ( $wgRequest->wasPosted() ) {
 531+ // Make sure notice exists
 532+ if ( !$this->noticeExists( $notice ) ) {
 533+ $this->showError( 'centralnotice-notice-doesnt-exist' );
 534+ } else {
 535+
 536+ // Handle form submissions from campaign detail interface
 537+ if ( $this->editable && $wgRequest->wasPosted() ) {
 538+
 539+ // Check authentication token
 540+ if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) {
 541+
 542+ // Handle removing campaign
 543+ if ( $wgRequest->getVal( 'remove' ) ) {
 544+ $this->removeNotice( $notice );
 545+ if ( !$this->centralNoticeError ) {
 546+ // Leave campaign detail interface
 547+ $wgOut->redirect( $this->getTitle()->getLocalUrl() );
 548+ return;
 549+ }
 550+ }
 551+
 552+ // Handle locking/unlocking campaign
 553+ if ( $wgRequest->getArray( 'locked' ) ) {
 554+ $this->updateLock( $notice, '1' );
 555+ } else {
 556+ $this->updateLock( $notice, 0 );
 557+ }
 558+
 559+ // Handle enabling/disabling campaign
 560+ if ( $wgRequest->getArray( 'enabled' ) ) {
 561+ $this->updateEnabled( $notice, '1' );
 562+ } else {
 563+ $this->updateEnabled( $notice, 0 );
 564+ }
 565+
 566+ // Handle setting campaign to preferred/not preferred
 567+ if ( $wgRequest->getArray( 'preferred' ) ) {
 568+ $this->updatePreferred( $notice, '1' );
 569+ } else {
 570+ $this->updatePreferred( $notice, 0 );
 571+ }
 572+
 573+ // Handle updating the start and end settings
 574+ $start = $wgRequest->getArray( 'start' );
 575+ $end = $wgRequest->getArray( 'end' );
 576+ if ( $start && $end ) {
 577+ $updatedStart = sprintf( "%04d%02d%02d%02d%02d00",
 578+ $start['year'],
 579+ $start['month'],
 580+ $start['day'],
 581+ $start['hour'],
 582+ $start['min'] );
 583+ $updatedEnd = sprintf( "%04d%02d%02d000000",
 584+ $end['year'],
 585+ $end['month'],
 586+ $end['day'] );
 587+ $this->updateNoticeDate( $notice, $updatedStart, $updatedEnd );
 588+ }
 589+
 590+ // Handle adding of banners to the campaign
 591+ $templatesToAdd = $wgRequest->getArray( 'addTemplates' );
 592+ if ( $templatesToAdd ) {
 593+ $weight = $wgRequest->getArray( 'weight' );
 594+ foreach ( $templatesToAdd as $templateName ) {
 595+ $templateId = $this->getTemplateId( $templateName );
 596+ $this->addTemplateTo( $notice, $templateName, $weight[$templateId] );
 597+ }
 598+ }
604599
605 - // Check authentication token
606 - if ( $wgUser->matchEditToken( $wgRequest->getVal( 'authtoken' ) ) ) {
607 -
608 - // Handle adding of banners to the campaign
609 - $templatesToAdd = $wgRequest->getArray( 'addTemplates' );
610 - if ( isset( $templatesToAdd ) ) {
611 - $weight = $wgRequest->getArray( 'weight' );
612 - foreach ( $templatesToAdd as $templateName ) {
613 - $templateId = $this->getTemplateId( $templateName );
614 - $this->addTemplateTo( $notice, $templateName, $weight[$templateId] );
 600+ // Handle removing of banners from the campaign
 601+ $templateToRemove = $wgRequest->getArray( 'removeTemplates' );
 602+ if ( $templateToRemove ) {
 603+ foreach ( $templateToRemove as $template ) {
 604+ $this->removeTemplateFor( $notice, $template );
 605+ }
615606 }
616 - }
 607+
 608+ // Handle weight changes
 609+ $updatedWeights = $wgRequest->getArray( 'weight' );
 610+ if ( $updatedWeights ) {
 611+ foreach ( $updatedWeights as $templateId => $weight ) {
 612+ $this->updateWeight( $notice, $templateId, $weight );
 613+ }
 614+ }
617615
618 - // Handle removing of banners from the campaign
619 - $templateToRemove = $wgRequest->getArray( 'removeTemplates' );
620 - if ( isset( $templateToRemove ) ) {
621 - foreach ( $templateToRemove as $template ) {
622 - $this->removeTemplateFor( $notice, $template );
 616+ // Handle new project name
 617+ $projectName = $wgRequest->getVal( 'project_name' );
 618+ if ( $projectName ) {
 619+ $this->updateProjectName ( $notice, $projectName );
623620 }
 621+
 622+ // Handle new project languages
 623+ $projectLangs = $wgRequest->getArray( 'project_languages' );
 624+ if ( $projectLangs ) {
 625+ $this->updateProjectLanguages( $notice, $projectLangs );
 626+ }
 627+
 628+ // If there were no errors, reload the page to prevent duplicate form submission
 629+ if ( !$this->centralNoticeError ) {
 630+ $wgOut->redirect( $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" ) );
 631+ return;
 632+ }
 633+ } else {
 634+ $this->showError( 'sessionfailure' );
624635 }
625 -
626 - // Handle new project name
627 - $projectName = $wgRequest->getVal( 'project_name' );
628 - if ( isset( $projectName ) ) {
629 - $this->updateProjectName ( $notice, $projectName );
630 - }
631 -
632 - // Handle new project languages
633 - $projectLangs = $wgRequest->getArray( 'project_languages' );
634 - if ( isset( $projectLangs ) ) {
635 - $this->updateProjectLanguages( $notice, $projectLangs );
636 - }
637 -
638 - $wgOut->redirect( $this->getTitle()->getLocalUrl( "method=listNoticeDetail&notice=$notice" ) );
639 - return;
640636
641 - } else {
642 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'sessionfailure' );
643637 }
644 -
645 - }
646638
647 - $noticeId = $this->getNoticeId( $notice );
648 -
649 - // Make sure notice exists
650 - if ( !$noticeId ) {
651 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-notice-doesnt-exist' );
652 - } else {
653639 $htmlOut = '';
654640
655641 // Begin Campaign detail fieldset
@@ -753,15 +739,17 @@
754740 $endArray['month'] .
755741 $endArray['day'] . '000000'
756742 ;
 743+ $isEnabled = $wgRequest->getCheck( 'enabled' );
 744+ $isPreferred = $wgRequest->getCheck( 'preferred' );
 745+ $isLocked = $wgRequest->getCheck( 'locked' );
757746 $projectSelected = $wgRequest->getVal( 'project_name' );
758 - if ( $wgRequest->getArray( 'project_languages' ) ) {
759 - $noticeLanguages = $wgRequest->getArray( 'project_languages' );
760 - } else {
761 - $noticeLanguages = array();
762 - }
 747+ $noticeLanguages = $wgRequest->getArray( 'project_languages', array() );
763748 } else { // Defaults
764749 $startTimestamp = $row->not_start;
765750 $endTimestamp = $row->not_end;
 751+ $isEnabled = ( $row->not_enabled == '1' );
 752+ $isPreferred = ( $row->not_preferred == '1' );
 753+ $isLocked = ( $row->not_locked == '1' );
766754 $projectSelected = $row->not_project;
767755 $noticeLanguages = $this->getNoticeLanguages( $notice );
768756 }
@@ -799,24 +787,24 @@
800788 $htmlOut .= Xml::closeElement( 'tr' );
801789 // Enabled
802790 $htmlOut .= Xml::openElement( 'tr' );
803 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-enabled' ), 'enabled[]' ) );
804 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled[]', ( $row->not_enabled == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled[]' ) ) ) );
 791+ $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-enabled' ), 'enabled' ) );
 792+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'enabled', $isEnabled, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'enabled' ) ) ) );
805793 $htmlOut .= Xml::closeElement( 'tr' );
806794 // Preferred
807795 $htmlOut .= Xml::openElement( 'tr' );
808 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-preferred' ), 'preferred[]' ) );
809 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred[]', ( $row->not_preferred == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred[]' ) ) ) );
 796+ $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-preferred' ), 'preferred' ) );
 797+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'preferred', $isPreferred, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'preferred' ) ) ) );
810798 $htmlOut .= Xml::closeElement( 'tr' );
811799 // Locked
812800 $htmlOut .= Xml::openElement( 'tr' );
813 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-locked' ), 'locked[]' ) );
814 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked[]', ( $row->not_locked == '1' ), wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked[]' ) ) ) );
 801+ $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-locked' ), 'locked' ) );
 802+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'locked', $isLocked, wfArrayMerge( $readonly, array( 'value' => $row->not_name, 'id' => 'locked' ) ) ) );
815803 $htmlOut .= Xml::closeElement( 'tr' );
816804 if ( $this->editable ) {
817805 // Locked
818806 $htmlOut .= Xml::openElement( 'tr' );
819 - $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-remove' ), 'removeNotices[]' ) );
820 - $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'removeNotices[]', false, array( 'value' => $row->not_name, 'id' => 'removeNotices[]' ) ) );
 807+ $htmlOut .= Xml::tags( 'td', array(), Xml::label( wfMsgHtml( 'centralnotice-remove' ), 'remove' ) );
 808+ $htmlOut .= Xml::tags( 'td', array(), Xml::check( 'remove', false, array( 'value' => $row->not_name, 'id' => 'remove' ) ) );
821809 $htmlOut .= Xml::closeElement( 'tr' );
822810 }
823811 $htmlOut .= Xml::closeElement( 'table' );
@@ -1008,13 +996,11 @@
1009997 function addNotice( $noticeName, $enabled, $start, $project_name, $project_languages ) {
1010998 global $wgOut;
1011999
1012 - $dbr = wfGetDB( DB_SLAVE );
1013 - $res = $dbr->select( 'cn_notices', 'not_name', array( 'not_name' => $noticeName ) );
1014 - if ( $dbr->numRows( $res ) > 0 ) {
1015 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-notice-exists' );
 1000+ if ( $this->noticeExists( $noticeName ) ) {
 1001+ $this->showError( 'centralnotice-notice-exists' );
10161002 return;
10171003 } elseif ( empty( $project_languages ) ) {
1018 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-no-language' );
 1004+ $this->showError( 'centralnotice-no-language' );
10191005 return;
10201006 } else {
10211007 $dbw = wfGetDB( DB_MASTER );
@@ -1037,8 +1023,8 @@
10381024 $res = $dbw->insert( 'cn_notices',
10391025 array( 'not_name' => $noticeName,
10401026 'not_enabled' => $enabled,
1041 - 'not_start' => $dbr->timestamp( $startTs ),
1042 - 'not_end' => $dbr->timestamp( $endTs ),
 1027+ 'not_start' => $dbw->timestamp( $startTs ),
 1028+ 'not_end' => $dbw->timestamp( $endTs ),
10431029 'not_project' => $project_name
10441030 )
10451031 );
@@ -1064,22 +1050,22 @@
10651051 array( 'not_name' => $noticeName )
10661052 );
10671053 if ( $dbr->numRows( $res ) < 1 ) {
1068 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-remove-notice-doesnt-exist' );
1069 - return;
 1054+ $this->showError( 'centralnotice-remove-notice-doesnt-exist' );
 1055+ return;
10701056 }
10711057 $row = $dbr->fetchObject( $res );
10721058 if ( $row->not_locked == '1' ) {
1073 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-notice-is-locked' );
1074 - return;
 1059+ $this->showError( 'centralnotice-notice-is-locked' );
 1060+ return;
10751061 } else {
1076 - $dbw = wfGetDB( DB_MASTER );
1077 - $dbw->begin();
1078 - $noticeId = htmlspecialchars( $this->getNoticeId( $noticeName ) );
1079 - $res = $dbw->delete( 'cn_assignments', array ( 'not_id' => $noticeId ) );
1080 - $res = $dbw->delete( 'cn_notices', array ( 'not_name' => $noticeName ) );
1081 - $res = $dbw->delete( 'cn_notice_languages', array ( 'nl_notice_id' => $noticeId ) );
1082 - $dbw->commit();
1083 - return;
 1062+ $dbw = wfGetDB( DB_MASTER );
 1063+ $dbw->begin();
 1064+ $noticeId = htmlspecialchars( $this->getNoticeId( $noticeName ) );
 1065+ $res = $dbw->delete( 'cn_assignments', array ( 'not_id' => $noticeId ) );
 1066+ $res = $dbw->delete( 'cn_notices', array ( 'not_name' => $noticeName ) );
 1067+ $res = $dbw->delete( 'cn_notice_languages', array ( 'nl_notice_id' => $noticeId ) );
 1068+ $dbw->commit();
 1069+ return;
10841070 }
10851071 }
10861072
@@ -1098,7 +1084,7 @@
10991085 )
11001086 );
11011087 if ( $dbr->numRows( $res ) > 0 ) {
1102 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-template-already-exists' );
 1088+ $this->showError( 'centralnotice-template-already-exists' );
11031089 } else {
11041090 $dbw = wfGetDB( DB_MASTER );
11051091 $dbw->begin();
@@ -1124,7 +1110,7 @@
11251111 if ( $row ) {
11261112 return $row->not_id;
11271113 } else {
1128 - return;
 1114+ return null;
11291115 }
11301116 }
11311117
@@ -1174,14 +1160,14 @@
11751161
11761162 // Start/end don't line up
11771163 if ( $start > $end || $end < $start ) {
1178 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-invalid-date-range3' );
1179 - return;
 1164+ $this->showError( 'centralnotice-invalid-date-range' );
 1165+ return;
11801166 }
11811167
11821168 // Invalid campaign name
1183 - $res = $dbr->select( 'cn_notices', 'not_name', array( 'not_name' => $noticeName ) );
1184 - if ( $dbr->numRows( $res ) < 1 ) {
1185 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-notice-doesnt-exist' );
 1169+ if ( !$this->noticeExists( $noticeName ) ) {
 1170+ $this->showError( 'centralnotice-notice-doesnt-exist' );
 1171+ return;
11861172 }
11871173
11881174 // Overlap over a date within the same project and language
@@ -1189,7 +1175,6 @@
11901176 $endDate = $dbr->timestamp( $end );
11911177
11921178 $dbw = wfGetDB( DB_MASTER );
1193 - $dbw->begin();
11941179 $res = $dbw->update( 'cn_notices',
11951180 array(
11961181 'not_start' => $startDate,
@@ -1197,26 +1182,56 @@
11981183 ),
11991184 array( 'not_name' => $noticeName )
12001185 );
1201 - $dbw->commit();
12021186 }
12031187
 1188+ /**
 1189+ * Update the enabled/disabled state of a campaign
 1190+ */
 1191+ private function updateEnabled( $noticeName, $isEnabled ) {
 1192+ global $wgOut;
 1193+
 1194+ if ( !$this->noticeExists( $noticeName ) ) {
 1195+ $this->showError( 'centralnotice-doesnt-exist' );
 1196+ } else {
 1197+ $dbw = wfGetDB( DB_MASTER );
 1198+ $res = $dbw->update( 'cn_notices',
 1199+ array( 'not_enabled' => $isEnabled ),
 1200+ array( 'not_name' => $noticeName )
 1201+ );
 1202+ }
 1203+ }
 1204+
 1205+ /**
 1206+ * Update the preferred/not preferred state of a campaign
 1207+ */
 1208+ function updatePreferred( $noticeName, $isPreferred ) {
 1209+ global $wgOut;
 1210+
 1211+ if ( !$this->noticeExists( $noticeName ) ) {
 1212+ $this->showError( 'centralnotice-doesnt-exist' );
 1213+ } else {
 1214+ $dbw = wfGetDB( DB_MASTER );
 1215+ $res = $dbw->update( 'cn_notices',
 1216+ array( 'not_preferred' => $isPreferred ),
 1217+ array( 'not_name' => $noticeName )
 1218+ );
 1219+ }
 1220+ }
 1221+
 1222+ /**
 1223+ * Update the locked/unlocked state of a campaign
 1224+ */
12041225 function updateLock( $noticeName, $isLocked ) {
12051226 global $wgOut;
12061227
1207 - $dbr = wfGetDB( DB_SLAVE );
1208 - $res = $dbr->select( 'cn_notices', 'not_name',
1209 - array( 'not_name' => $noticeName )
1210 - );
1211 - if ( $dbr->numRows( $res ) < 1 ) {
1212 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-doesnt-exist' );
 1228+ if ( !$this->noticeExists( $noticeName ) ) {
 1229+ $this->showError( 'centralnotice-doesnt-exist' );
12131230 } else {
12141231 $dbw = wfGetDB( DB_MASTER );
1215 - $dbw->begin();
12161232 $res = $dbw->update( 'cn_notices',
12171233 array( 'not_locked' => $isLocked ),
12181234 array( 'not_name' => $noticeName )
12191235 );
1220 - $dbw->commit();
12211236 }
12221237 }
12231238
@@ -1305,14 +1320,12 @@
13061321
13071322 function updateProjectName( $notice, $projectName ) {
13081323 $dbw = wfGetDB( DB_MASTER );
1309 - $dbw->begin();
13101324 $res = $dbw->update( 'cn_notices',
13111325 array ( 'not_project' => $projectName ),
13121326 array(
13131327 'not_name' => $notice
13141328 )
13151329 );
1316 - $dbw->commit();
13171330 }
13181331
13191332 function updateProjectLanguages( $notice, $newLanguages ) {
@@ -1344,6 +1357,17 @@
13451358
13461359 $dbw->commit();
13471360 }
 1361+
 1362+ public static function noticeExists( $noticeName ) {
 1363+ $dbr = wfGetDB( DB_SLAVE );
 1364+ $eNoticeName = htmlspecialchars( $noticeName );
 1365+ $row = $dbr->selectRow( 'cn_notices', 'not_name', array( 'not_name' => $eNoticeName ) );
 1366+ if ( $row ) {
 1367+ return true;
 1368+ } else {
 1369+ return false;
 1370+ }
 1371+ }
13481372
13491373 public static function dropDownList( $text, $values ) {
13501374 $dropDown = "* {$text}\n";
@@ -1360,6 +1384,12 @@
13611385 }
13621386 return $text;
13631387 }
 1388+
 1389+ function showError( $message ) {
 1390+ global $wgOut;
 1391+ $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", $message );
 1392+ $this->centralNoticeError = true;
 1393+ }
13641394 }
13651395
13661396
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.i18n.php
@@ -79,7 +79,7 @@
8080 'centralnotice-template-already-exists' => 'Banner is already tied to campaign.
8181 Not adding.',
8282 'centralnotice-preview-template' => 'Preview banner',
83 - 'centralnotice-start-hour' => 'Start time (GMT)',
 83+ 'centralnotice-start-hour' => 'Start time (UTC)',
8484 'centralnotice-change-lang' => 'Change translation language',
8585 'centralnotice-weights' => 'Weights',
8686 'centralnotice-notice-is-locked' => 'Campaign is locked.
@@ -165,6 +165,7 @@
166166 {{Identical|Start date}}',
167167 'centralnotice-start-time' => 'Used in Special:CentralNotice',
168168 'centralnotice-available-templates' => 'Used in Special:NoticeTemplate',
 169+ 'centralnotice-start-hour' => 'UTC is "[http://en.wikipedia.org/wiki/Coordinated_Universal_Time Coordinated Universal Time]".',
169170 'centralnotice-notice-is-locked' => 'Error message displayed in Special:CentralNotice when trying to delete a locked notice',
170171 'centralnotice-invalid-date-range' => '{{Identical|Date}}',
171172 'centralnotice-no-notices-exist' => 'Used in Special:CentralNotice when there are no notices',
@@ -240,7 +241,7 @@
241242 'centralnotice-template-already-exists' => 'Die sjabloon is reeds aan \'n "campaign" gekoppel.
242243 Word nie bygevoeg nie',
243244 'centralnotice-preview-template' => 'Voorskou sjabloon',
244 - 'centralnotice-start-hour' => 'Begintyd',
 245+ 'centralnotice-start-hour' => 'Begintyd (UTC)',
245246 'centralnotice-change-lang' => 'Verander taal vir vertaling',
246247 'centralnotice-weights' => 'Gewigte',
247248 'centralnotice-notice-is-locked' => 'Kennisgewing is gesluit.
@@ -644,7 +645,7 @@
645646 'centralnotice-template-already-exists' => 'Паведамленьне ужо выкарыстоўваецца ў кампаніі.
646647 Не дададзенае.',
647648 'centralnotice-preview-template' => 'Папярэдні прагляд паведамленьня',
648 - 'centralnotice-start-hour' => 'Час пачатку (GMT)',
 649+ 'centralnotice-start-hour' => 'Час пачатку (UTC)',
649650 'centralnotice-change-lang' => 'Зьмяніць мову перакладу',
650651 'centralnotice-weights' => 'Вагі',
651652 'centralnotice-notice-is-locked' => 'Кампанія заблякаванае.
@@ -905,7 +906,7 @@
906907 'centralnotice-template-already-exists' => "Liammet eo c'hoazh ar patrom gant ur c'houlzad.
907908 N'eo ket bet ouzhpennet.",
908909 'centralnotice-preview-template' => 'Rakwelet ar patrom',
909 - 'centralnotice-start-hour' => 'Eurvezh kregiñ (GMT)',
 910+ 'centralnotice-start-hour' => 'Eurvezh kregiñ (UTC)',
910911 'centralnotice-change-lang' => 'Cheñch yezh an droidigezh',
911912 'centralnotice-weights' => 'Pouezioù',
912913 'centralnotice-notice-is-locked' => "Prenet eo an ali.
@@ -975,7 +976,8 @@
976977 'centralnotice-translate-to' => 'Prevedi na',
977978 'centralnotice-translate' => 'Prijevod',
978979 'centralnotice-english' => 'engleski jezik',
979 - 'centralnotice-banner-name' => 'Naslov šablona',
 980+ 'centralnotice-banner-name' => 'Naslov banera:',
 981+ 'centralnotice-banner' => 'Baner',
980982 'centralnotice-templates' => 'Šabloni',
981983 'centralnotice-weight' => 'Težina',
982984 'centralnotice-locked' => 'Zaključano',
@@ -995,6 +997,7 @@
996998 'centralnotice-hours' => 'sat',
997999 'centralnotice-min' => 'minut',
9981000 'centralnotice-project-lang' => 'Jezik projekta',
 1001+ 'centralnotice-top-ten-languages' => 'Najboljih 10 jezika',
9991002 'centralnotice-project-name' => 'Naslov projekta',
10001003 'centralnotice-start-date' => 'Početni datum',
10011004 'centralnotice-start-time' => 'Početno vrijeme (UTC)',
@@ -1024,6 +1027,7 @@
10251028 Dodaj jednu ispod',
10261029 'centralnotice-no-templates-translate' => 'Nema ni jednog šablona za uređivanje prijevoda',
10271030 'centralnotice-number-uses' => 'Upotreba',
 1031+ 'centralnotice-settings' => 'Postavke',
10281032 'centralnotice-edit-template' => 'Uredi šablon',
10291033 'centralnotice-message' => 'Poruka',
10301034 'centralnotice-message-not-set' => 'Poruka nije postavljena',
@@ -1173,7 +1177,7 @@
11741178 'centralnotice-translate-to' => 'Přeložit do jazyka',
11751179 'centralnotice-translate' => 'Přeložit',
11761180 'centralnotice-english' => 'Anglicky',
1177 - 'centralnotice-banner-name' => 'Název šablony',
 1181+ 'centralnotice-banner-name' => 'Název banneru:',
11781182 'centralnotice-banner' => 'Banner',
11791183 'centralnotice-banner-heading' => 'Banner: $1',
11801184 'centralnotice-templates' => 'Šablony',
@@ -1208,7 +1212,7 @@
12091213 'centralnotice-template-already-exists' => 'Šablona už byla s kampaní svázána.
12101214 Nebude přidána.',
12111215 'centralnotice-preview-template' => 'Náhled šablony',
1212 - 'centralnotice-start-hour' => 'Čas začátku (GMT)',
 1216+ 'centralnotice-start-hour' => 'Čas začátku (UTC)',
12131217 'centralnotice-change-lang' => 'Změnit překládaný jazyk',
12141218 'centralnotice-weights' => 'Váhy',
12151219 'centralnotice-notice-is-locked' => 'Oznámení je uzamčeno. Nebude odstraněno.',
@@ -1221,6 +1225,7 @@
12221226 Níže můžete vytvořit nové.',
12231227 'centralnotice-no-templates-translate' => 'Nejsou žádné šablony, které by šlo přeložit',
12241228 'centralnotice-number-uses' => 'Použití',
 1229+ 'centralnotice-settings' => 'Nastavení',
12251230 'centralnotice-edit-template' => 'Upravit šablonu',
12261231 'centralnotice-edit-template-summary' => 'Lokalizovatelnou zprávu vytvoříte uzavřením identifikátoru se spojovníky do složených závorek, např. {{{citát-jimbo}}}.',
12271232 'centralnotice-message' => 'Zpráva',
@@ -1279,7 +1284,7 @@
12801285 'centralnotice-translate-to' => "Cyfieithu i'r",
12811286 'centralnotice-translate' => 'Cyfieithu',
12821287 'centralnotice-english' => 'Saesneg',
1283 - 'centralnotice-banner-name' => "Enw'r nodyn",
 1288+ 'centralnotice-banner-name' => "Enw'r faner:",
12841289 'centralnotice-templates' => 'Nodiadau',
12851290 'centralnotice-weight' => 'Pwys',
12861291 'centralnotice-locked' => 'Ar glo',
@@ -1289,9 +1294,9 @@
12901295 'centralnotice-template-exists' => "Mae'r faner yn bodoli'n barod.
12911296 Ddim yn ychwanegu",
12921297 'centralnotice-notice-doesnt-exist' => "Nid yw'r ymgyrch i gael.",
1293 - 'centralnotice-template-still-bound' => "Mae'r faner yn perthyn i ymgyrch o hyd.
1294 -Ddim yn tynnu.",
1295 - 'centralnotice-template-body' => 'Corff y faner:',
 1298+ 'centralnotice-template-still-bound' => "Mae'r faner yn dal i fod ynghlwm wrth ymgyrch.
 1299+Ddim yn tynnu i ffwrdd.",
 1300+ 'centralnotice-template-body' => 'Testun y faner:',
12961301 'centralnotice-day' => 'Dydd',
12971302 'centralnotice-year' => 'Blwyddyn',
12981303 'centralnotice-month' => 'Mis',
@@ -1302,8 +1307,8 @@
13031308 'centralnotice-start-date' => 'Dyddiad cychwyn',
13041309 'centralnotice-start-time' => 'Amser cychwyn (UTC)',
13051310 'centralnotice-no-templates' => 'Ni chanfuwyd unrhyw faner.
1306 -Ychwanegu rhai!',
1307 - 'centralnotice-start-hour' => 'Amser dechrau',
 1311+Ychwanegwch rai!',
 1312+ 'centralnotice-start-hour' => 'Amser dechrau (UTC)',
13081313 'centralnotice-weights' => 'Pwysau',
13091314 'centralnotice-notice-is-locked' => "Mae'r hysbysiad wedi ei gloi.
13101315 Ni chaiff ei dynnu i ffwrdd",
@@ -1311,6 +1316,8 @@
13121317 Gallwch ychwanegu un isod.',
13131318 'centralnotice-edit-template' => "Golygu'r nodyn",
13141319 'centralnotice-message' => 'Neges',
 1320+ 'centralnotice-clone-name' => 'Enw:',
 1321+ 'centralnotice-banner-anonymous' => 'Defnyddwyr anhysbys',
13151322 'right-centralnotice-admin' => 'Gweinyddu hysbysiadau canolog',
13161323 'right-centralnotice-translate' => 'Cyfieithu hysbysiadau canolog',
13171324 'action-centralnotice-admin' => 'gweinyddu hysbysiadau canolog',
@@ -1327,7 +1334,7 @@
13281335 'centralnotice-preview' => 'Forhåndsvisning',
13291336 'centralnotice-add' => 'Tilføj',
13301337 'centralnotice-english' => 'Engelsk',
1331 - 'centralnotice-banner-name' => 'Skabelonnavn',
 1338+ 'centralnotice-banner-name' => 'Bannernavn:',
13321339 'centralnotice-templates' => 'Skabeloner',
13331340 'centralnotice-locked' => 'Låst',
13341341 'centralnotice-day' => 'Dag',
@@ -1382,7 +1389,7 @@
13831390 'centralnotice-translate-to' => 'Übersetzen in',
13841391 'centralnotice-translate' => 'Übersetzen',
13851392 'centralnotice-english' => 'Englisch',
1386 - 'centralnotice-banner-name' => 'Name der Vorlage',
 1393+ 'centralnotice-banner-name' => 'Name der Vorlage:',
13871394 'centralnotice-banner' => 'Vorlage',
13881395 'centralnotice-banner-heading' => 'Vorlage: $1',
13891396 'centralnotice-templates' => 'Vorlagen',
@@ -1422,7 +1429,7 @@
14231430 'centralnotice-template-already-exists' => 'Vorlage ist bereits mit der Meldung verbunden.
14241431 Sie wird daher nicht hinzugefügt.',
14251432 'centralnotice-preview-template' => 'Vorschau Vorlage',
1426 - 'centralnotice-start-hour' => 'Startzeit (GMT)',
 1433+ 'centralnotice-start-hour' => 'Startzeit (UTC)',
14271434 'centralnotice-change-lang' => 'Übersetzungssprache ändern',
14281435 'centralnotice-weights' => 'Gewicht',
14291436 'centralnotice-notice-is-locked' => 'Meldung ist gesperrt.
@@ -1642,7 +1649,7 @@
16431650 'centralnotice-template-already-exists' => 'Pśedłoga jo južo z kampanju zwězana.
16441651 Žedno pśidaśe',
16451652 'centralnotice-preview-template' => 'Pśeglěd pśedłogi',
1646 - 'centralnotice-start-hour' => 'Startowy cas (GMT)',
 1653+ 'centralnotice-start-hour' => 'Startowy cas (UTC)',
16471654 'centralnotice-change-lang' => 'Pśełožkowu rěc změniś',
16481655 'centralnotice-weights' => 'Wagi',
16491656 'centralnotice-notice-is-locked' => 'Powěźeńka jo zastajona.
@@ -2202,7 +2209,7 @@
22032210 'centralnotice-translate-to' => 'ترجمه به',
22042211 'centralnotice-translate' => 'ترجمه کردن',
22052212 'centralnotice-english' => 'انگلیسی',
2206 - 'centralnotice-banner-name' => 'نام الگو',
 2213+ 'centralnotice-banner-name' => 'نام پرچم:',
22072214 'centralnotice-banner' => 'پرچم',
22082215 'centralnotice-banner-heading' => 'پرچم: $1',
22092216 'centralnotice-templates' => 'الگوها',
@@ -2242,7 +2249,7 @@
22432250 'centralnotice-template-already-exists' => 'الگو از قبل به اعلان گره خورده است.
22442251 افزوده نشد',
22452252 'centralnotice-preview-template' => 'الگو نمایش',
2246 - 'centralnotice-start-hour' => 'زمان شروع (GMT)',
 2253+ 'centralnotice-start-hour' => 'زمان شروع (UTC)',
22472254 'centralnotice-change-lang' => 'تغییر زبان ترجمه',
22482255 'centralnotice-weights' => 'وزن‌ها',
22492256 'centralnotice-notice-is-locked' => 'اعلان قفل شده‌است.
@@ -2425,7 +2432,7 @@
24262433 'centralnotice-translate-to' => 'Traduire en',
24272434 'centralnotice-translate' => 'Traduire',
24282435 'centralnotice-english' => 'anglais',
2429 - 'centralnotice-banner-name' => 'Nom du modèle',
 2436+ 'centralnotice-banner-name' => 'Nom de la bannière :',
24302437 'centralnotice-banner' => 'Bannière',
24312438 'centralnotice-banner-heading' => 'Bannière : $1',
24322439 'centralnotice-templates' => 'Modèles',
@@ -2465,7 +2472,7 @@
24662473 'centralnotice-template-already-exists' => 'Le modèle est déjà attaché à une campagne.
24672474 Il n’a pas été ajouté.',
24682475 'centralnotice-preview-template' => 'Prévisualiser le modèle',
2469 - 'centralnotice-start-hour' => 'Heure de départ (GMT)',
 2476+ 'centralnotice-start-hour' => 'Heure de départ (UTC)',
24702477 'centralnotice-change-lang' => 'Modifier la langue de traduction',
24712478 'centralnotice-weights' => 'Poids',
24722479 'centralnotice-notice-is-locked' => 'L’avis est verrouillé.
@@ -2482,6 +2489,7 @@
24832490 Ajoutez-en ci-dessous.',
24842491 'centralnotice-no-templates-translate' => 'Il n’y a aucun modèle à traduire',
24852492 'centralnotice-number-uses' => 'Utilisations',
 2493+ 'centralnotice-settings' => 'Paramètres',
24862494 'centralnotice-edit-template' => 'Modifier le modèle',
24872495 'centralnotice-edit-template-summary' => 'Pour créer un message localisable, entourez une chaîne à trait d’union de trois accolades, par exemple {{{jimbo-quote}}}.',
24882496 'centralnotice-message' => 'Message',
@@ -2542,7 +2550,7 @@
25432551 'centralnotice-translate-to' => 'Traduire en',
25442552 'centralnotice-translate' => 'Traduire',
25452553 'centralnotice-english' => 'Anglès',
2546 - 'centralnotice-banner-name' => 'Nom du modèlo',
 2554+ 'centralnotice-banner-name' => 'Nom du modèlo :',
25472555 'centralnotice-banner' => 'Modèlo',
25482556 'centralnotice-banner-heading' => 'Modèlo : $1',
25492557 'centralnotice-templates' => 'Modèlos',
@@ -2614,7 +2622,7 @@
26152623 'centralnotice-donate-button' => 'Boton de donacion',
26162624 'centralnotice-expanded-banner' => 'Modèlo ètendu',
26172625 'centralnotice-collapsed-banner' => 'Modèlo rèduit',
2618 - 'centralnotice-banner-type' => 'Tipo de modèlo:',
 2626+ 'centralnotice-banner-type' => 'Tipo de modèlo :',
26192627 'centralnotice-banner-hidable' => 'Statico / cachâblo',
26202628 'centralnotice-banner-collapsible' => 'Rèductiblo',
26212629 'right-centralnotice-admin' => 'Administrar los avis centrâls',
@@ -2663,7 +2671,7 @@
26642672 'centralnotice-translate-to' => 'Traducir ao',
26652673 'centralnotice-translate' => 'Traducir',
26662674 'centralnotice-english' => 'inglés',
2667 - 'centralnotice-banner-name' => 'Nome do modelo',
 2675+ 'centralnotice-banner-name' => 'Nome do modelo:',
26682676 'centralnotice-banner' => 'Cartel',
26692677 'centralnotice-banner-heading' => 'Cartel: $1',
26702678 'centralnotice-templates' => 'Modelos',
@@ -2703,7 +2711,7 @@
27042712 'centralnotice-template-already-exists' => 'O modelo xa está atado á campaña.
27052713 Non se engade',
27062714 'centralnotice-preview-template' => 'Vista previa do modelo',
2707 - 'centralnotice-start-hour' => 'Hora de inicio (GMT)',
 2715+ 'centralnotice-start-hour' => 'Hora de inicio (UTC)',
27082716 'centralnotice-change-lang' => 'Cambiar a lingua de tradución',
27092717 'centralnotice-weights' => 'Pesos',
27102718 'centralnotice-notice-is-locked' => 'O aviso está bloqueado.
@@ -2807,7 +2815,7 @@
28082816 'centralnotice-translate-to' => 'Ibersetze in',
28092817 'centralnotice-translate' => 'Ibersetze',
28102818 'centralnotice-english' => 'Änglisch',
2811 - 'centralnotice-banner-name' => 'Name vu dr Vorlag',
 2819+ 'centralnotice-banner-name' => 'Bannername:',
28122820 'centralnotice-banner' => 'Banner',
28132821 'centralnotice-banner-heading' => 'Banner: $1',
28142822 'centralnotice-templates' => 'Vorlage',
@@ -2994,6 +3002,7 @@
29953003 /** Croatian (Hrvatski)
29963004 * @author Dalibor Bosits
29973005 * @author Ex13
 3006+ * @author SpeedyGonsales
29983007 */
29993008 $messages['hr'] = array(
30003009 'centralnotice' => 'Administracija središnjih obavijesti',
@@ -3006,24 +3015,32 @@
30073016 'centralnotice-end-date' => 'Završni datum',
30083017 'centralnotice-enabled' => 'Omogućeno',
30093018 'centralnotice-modify' => 'Postavi',
 3019+ 'centralnotice-save-banner' => 'Spremi poruku',
30103020 'centralnotice-preview' => 'Pregledaj',
30113021 'centralnotice-add-new' => 'Dodaj novu središnju obavijest',
30123022 'centralnotice-remove' => 'Ukloni',
30133023 'centralnotice-translate-heading' => 'Prijevod za $1',
30143024 'centralnotice-manage' => 'Uredi središnje obavijesti',
 3025+ 'centralnotice-manage-templates' => 'Upravljanje porukama',
30153026 'centralnotice-add' => 'Dodaj',
30163027 'centralnotice-add-notice' => 'Dodaj obavijest',
 3028+ 'centralnotice-edit-notice' => 'Uredi poruku',
30173029 'centralnotice-add-template' => 'Dodaj predložak',
30183030 'centralnotice-show-notices' => 'Pokaži obavijesti',
30193031 'centralnotice-list-templates' => 'Popis predložaka',
 3032+ 'centralnotice-multiple_languages' => 'više ($1)',
30203033 'centralnotice-translations' => 'Prijevodi',
30213034 'centralnotice-translate-to' => 'Prevedi na',
30223035 'centralnotice-translate' => 'Prevedi',
30233036 'centralnotice-english' => 'Engleski',
3024 - 'centralnotice-banner-name' => 'Naziv predloška',
 3037+ 'centralnotice-banner-name' => 'Naziv poruke:',
 3038+ 'centralnotice-banner' => 'Poruka',
 3039+ 'centralnotice-banner-heading' => 'Poruka: $1',
30253040 'centralnotice-templates' => 'Predlošci',
30263041 'centralnotice-weight' => 'Težina',
30273042 'centralnotice-locked' => 'Zaključano',
 3043+ 'centralnotice-notice' => 'Promidžba',
 3044+ 'centralnotice-notice-heading' => 'Promidžba: $1',
30283045 'centralnotice-notices' => 'Obavijesti',
30293046 'centralnotice-notice-exists' => 'Obavijest već postoji.
30303047 Nije dodano',
@@ -3154,7 +3171,7 @@
31553172 'centralnotice-template-already-exists' => 'Předłoha je hižo z kampanju zwjazana.
31563173 Njepřidawa so',
31573174 'centralnotice-preview-template' => 'Přehlad předłohi',
3158 - 'centralnotice-start-hour' => 'Startowy čas (GMT)',
 3175+ 'centralnotice-start-hour' => 'Startowy čas (UTC)',
31593176 'centralnotice-change-lang' => 'Přełožowansku rěč změnić',
31603177 'centralnotice-weights' => 'Wahi',
31613178 'centralnotice-notice-is-locked' => 'Powěsć je zawrjena.
@@ -3322,7 +3339,7 @@
33233340 'centralnotice-translate-to' => 'Traducer in',
33243341 'centralnotice-translate' => 'Traducer',
33253342 'centralnotice-english' => 'Anglese',
3326 - 'centralnotice-banner-name' => 'Nomine del bandiera',
 3343+ 'centralnotice-banner-name' => 'Nomine del bandiera:',
33273344 'centralnotice-banner' => 'Bandiera',
33283345 'centralnotice-banner-heading' => 'Bandiera: $1',
33293346 'centralnotice-templates' => 'Bandieras',
@@ -3362,7 +3379,7 @@
33633380 'centralnotice-template-already-exists' => 'Le bandiera es ja ligate a un campania.
33643381 Non es addite.',
33653382 'centralnotice-preview-template' => 'Previsualisar bandiera',
3366 - 'centralnotice-start-hour' => 'Hora de initio (GMT)',
 3383+ 'centralnotice-start-hour' => 'Hora de initio (UTC)',
33673384 'centralnotice-change-lang' => 'Cambiar lingua de traduction',
33683385 'centralnotice-weights' => 'Pesos',
33693386 'centralnotice-notice-is-locked' => 'Le campania es serrate.
@@ -3379,6 +3396,7 @@
33803397 Adde un hic infra.',
33813398 'centralnotice-no-templates-translate' => 'Non existe bandieras pro le quales modificar traductiones.',
33823399 'centralnotice-number-uses' => 'Usos',
 3400+ 'centralnotice-settings' => 'Configurationes',
33833401 'centralnotice-edit-template' => 'Modificar bandiera',
33843402 'centralnotice-edit-template-summary' => 'Pro crear un message localisabile, include un texto con tracto de union in tres accolladas, p.ex. {{{jimbo-quote}}}.',
33853403 'centralnotice-message' => 'Message',
@@ -3444,7 +3462,7 @@
34453463 'centralnotice-translate-to' => 'Terjemahkan ke',
34463464 'centralnotice-translate' => 'Terjemahkan',
34473465 'centralnotice-english' => 'Bahasa Inggris',
3448 - 'centralnotice-banner-name' => 'Nama templat',
 3466+ 'centralnotice-banner-name' => 'Nama templat:',
34493467 'centralnotice-banner' => 'Spanduk',
34503468 'centralnotice-banner-heading' => 'Panji: $1',
34513469 'centralnotice-templates' => 'Templat',
@@ -3484,7 +3502,7 @@
34853503 'centralnotice-template-already-exists' => 'Templat sudah digunakan dalam kampanye.
34863504 Batal menambahkan',
34873505 'centralnotice-preview-template' => 'Lihat pratayang templat',
3488 - 'centralnotice-start-hour' => 'Waktu mulai (GMT)',
 3506+ 'centralnotice-start-hour' => 'Waktu mulai (UTC)',
34893507 'centralnotice-change-lang' => 'Ubah bahasa terjemahan',
34903508 'centralnotice-weights' => 'Bobot',
34913509 'centralnotice-notice-is-locked' => 'Pengumuman terkunci.
@@ -3501,6 +3519,7 @@
35023520 Tambahkan di bawah ini.',
35033521 'centralnotice-no-templates-translate' => 'Tidak ada templat yang dapat diterjemahkan',
35043522 'centralnotice-number-uses' => 'Menggunakan',
 3523+ 'centralnotice-settings' => 'Pengaturan',
35053524 'centralnotice-edit-template' => 'Sunting templat',
35063525 'centralnotice-edit-template-summary' => 'Untuk membuat dilokalisasi pesan, sertakan string ditulis dengan tanda penghubung di tiga kurung, misalnya {{{jimbo-quote}}}.',
35073526 'centralnotice-message' => 'Pesan',
@@ -3699,7 +3718,7 @@
37003719 'centralnotice-translate-to' => '翻訳先',
37013720 'centralnotice-translate' => '翻訳',
37023721 'centralnotice-english' => '英語',
3703 - 'centralnotice-banner-name' => 'テンプレート名',
 3722+ 'centralnotice-banner-name' => 'テンプレート名:',
37043723 'centralnotice-banner' => 'テンプレート',
37053724 'centralnotice-banner-heading' => 'テンプレート:$1',
37063725 'centralnotice-templates' => 'テンプレート',
@@ -3744,6 +3763,7 @@
37453764 'centralnotice-no-notices-exist' => '通知はひとつもありません。以下に追加してください。',
37463765 'centralnotice-no-templates-translate' => '翻訳すべきテンプレートはありません。',
37473766 'centralnotice-number-uses' => '使用目的',
 3767+ 'centralnotice-settings' => '設定',
37483768 'centralnotice-edit-template' => 'テンプレートを編集する',
37493769 'centralnotice-edit-template-summary' => 'ローカライズ可能なメッセージを作成するには、ハイフンで結合した文字列を3つの波括弧で囲います。例: {{{jimbo-quote}}}。',
37503770 'centralnotice-message' => 'メッセージ',
@@ -4038,7 +4058,7 @@
40394059 'centralnotice-available-templates' => '사용 가능한 템플릿 목록',
40404060 'centralnotice-template-already-exists' => '템플릿이 이미 설정되어 있습니다. 추가할 수 없습니다.',
40414061 'centralnotice-preview-template' => '틀 미리 보기',
4042 - 'centralnotice-start-hour' => '시작 시간 (GMT)',
 4062+ 'centralnotice-start-hour' => '시작 시간 (UTC)',
40434063 'centralnotice-change-lang' => '번역할 언어 변경',
40444064 'centralnotice-weights' => '중요도',
40454065 'centralnotice-notice-is-locked' => '공지가 잠겼습니다.
@@ -4200,7 +4220,7 @@
42014221 'centralnotice-translate-to' => 'Iwwersetzen op',
42024222 'centralnotice-translate' => 'Iwwersetzen',
42034223 'centralnotice-english' => 'Englesch',
4204 - 'centralnotice-banner-name' => 'Numm vum Banner',
 4224+ 'centralnotice-banner-name' => 'Numm vum Banner:',
42054225 'centralnotice-banner' => 'Banner',
42064226 'centralnotice-banner-heading' => 'Banner: $1',
42074227 'centralnotice-templates' => 'Banneren',
@@ -4240,7 +4260,7 @@
42414261 'centralnotice-template-already-exists' => 'De Banner ass schonn enger Campagne zougedeelt.
42424262 Net derbäisetzen',
42434263 'centralnotice-preview-template' => 'Schabloun weisen ouni ze späicheren',
4244 - 'centralnotice-start-hour' => 'Ufankszäit (GMT)',
 4264+ 'centralnotice-start-hour' => 'Ufankszäit (UTC)',
42454265 'centralnotice-change-lang' => 'Sprooch vun der Iwwersetzung änneren',
42464266 'centralnotice-weights' => 'Gewiicht',
42474267 'centralnotice-notice-is-locked' => "D'Matdeelung ass gespaart.
@@ -4327,7 +4347,7 @@
43284348 'centralnotice-translate-to' => 'Euverzètte nao',
43294349 'centralnotice-translate' => 'Euverzètte',
43304350 'centralnotice-english' => 'Ingels',
4331 - 'centralnotice-banner-name' => 'Sjabloonnaam',
 4351+ 'centralnotice-banner-name' => 'Vaannaam:',
43324352 'centralnotice-banner' => 'Vaan',
43334353 'centralnotice-banner-heading' => 'Vaan: $1',
43344354 'centralnotice-templates' => 'Sjablone',
@@ -4340,8 +4360,7 @@
43414361 Deze weurt neet biegedoon.',
43424362 'centralnotice-template-exists' => "'t Sjabloon besjteit al.
43434363 Dit weurt neet biegedoon.",
4344 - 'centralnotice-notice-doesnt-exist' => 'De sitemitdeiling besjteit neet.
4345 -Niks weurt eweggesjaf.',
 4364+ 'centralnotice-notice-doesnt-exist' => 'De campagne besteit neet.',
43464365 'centralnotice-template-still-bound' => "'t Sjabloon is nog neet gekoppeld aan 'n sitemitdeiling.
43474366 't Weurt neet eweggesjaf.",
43484367 'centralnotice-template-body' => 'Sjablooninhoud:',
@@ -4351,6 +4370,8 @@
43524371 'centralnotice-hours' => 'Oer',
43534372 'centralnotice-min' => 'Menuut',
43544373 'centralnotice-project-lang' => 'Projektaal',
 4374+ 'centralnotice-select' => 'Selecteer: $1',
 4375+ 'centralnotice-top-ten-languages' => 'Top-10 tale',
43554376 'centralnotice-project-name' => 'Projeknaam',
43564377 'centralnotice-start-date' => 'Sjtartdatum',
43574378 'centralnotice-start-time' => 'Sjtarttied (UTC)',
@@ -4363,7 +4384,7 @@
43644385 'centralnotice-template-already-exists' => "'t Sjabloon is al gekoppeld aan 'n campagne.
43654386 't Weurt neet biegedoon.",
43664387 'centralnotice-preview-template' => 'Veursjouw sjabloon',
4367 - 'centralnotice-start-hour' => 'Sjtarttied (GMT)',
 4388+ 'centralnotice-start-hour' => 'Sjtarttied (UTC)',
43684389 'centralnotice-change-lang' => 'Euver te zètte taal verangere',
43694390 'centralnotice-weights' => 'Gewichte',
43704391 'centralnotice-notice-is-locked' => 'De sitenotice is toe.
@@ -4380,6 +4401,7 @@
43814402 De kins hiejónger ein biedoon.",
43824403 'centralnotice-no-templates-translate' => "D'r zeen gein sjablone woeveur euverzèttinge gemaak kinne waere",
43834404 'centralnotice-number-uses' => 'Gebroeke',
 4405+ 'centralnotice-settings' => 'Insjtellinge',
43844406 'centralnotice-edit-template' => 'Sjabloon bewirke',
43854407 'centralnotice-message' => 'Berich',
43864408 'centralnotice-message-not-set' => "'t Berich is neet ingesjtèld",
@@ -4530,7 +4552,7 @@
45314553 'centralnotice-translate-to' => 'Преведи на',
45324554 'centralnotice-translate' => 'Преведи',
45334555 'centralnotice-english' => 'англиски',
4534 - 'centralnotice-banner-name' => 'Назив на шаблонот',
 4556+ 'centralnotice-banner-name' => 'Назив на плакатот:',
45354557 'centralnotice-banner' => 'Плакат',
45364558 'centralnotice-banner-heading' => 'Плакат: $1',
45374559 'centralnotice-templates' => 'Шаблони',
@@ -4570,7 +4592,7 @@
45714593 'centralnotice-template-already-exists' => 'Шаблонот е веќе врзан за кампањата.
45724594 Нема да биде додаден',
45734595 'centralnotice-preview-template' => 'Преглед на шаблонот',
4574 - 'centralnotice-start-hour' => 'Започнува (GMT):',
 4596+ 'centralnotice-start-hour' => 'Започнува (UTC):',
45754597 'centralnotice-change-lang' => 'Смени јазик на превод',
45764598 'centralnotice-weights' => 'Тегови',
45774599 'centralnotice-notice-is-locked' => 'Известувањето е заклучено.
@@ -4632,6 +4654,7 @@
46334655 'centralnotice-end-date' => 'അവസാനിക്കുന്ന തീയ്യതി',
46344656 'centralnotice-enabled' => 'സജ്ജമാക്കിയിരിക്കുന്നു',
46354657 'centralnotice-modify' => 'സമർപ്പിക്കുക',
 4658+ 'centralnotice-save-banner' => 'എഴുത്തുപട്ട സേവ് ചെയ്യുക',
46364659 'centralnotice-preview' => 'എങ്ങനെയുണ്ടെന്നു കാണുക',
46374660 'centralnotice-add-new' => 'പുതിയൊരു കേന്ദ്രീകൃത അറിയിപ്പ് ചേർക്കുക',
46384661 'centralnotice-remove' => 'നീക്കംചെയ്യുക',
@@ -4649,15 +4672,18 @@
46504673 'centralnotice-translate-to' => 'ഇതിലേയ്ക്ക് തർജ്ജമ ചെയ്യുക',
46514674 'centralnotice-translate' => 'തർജ്ജമ ചെയ്യുക',
46524675 'centralnotice-english' => 'ഇംഗ്ലീഷ്',
4653 - 'centralnotice-banner-name' => 'ഫലകത്തിന്റെ പേര്',
 4676+ 'centralnotice-banner-name' => 'എഴുത്തുപട്ടയുടെ പേര്:',
46544677 'centralnotice-banner' => 'ബാനർ',
 4678+ 'centralnotice-banner-heading' => 'എഴുത്തുപട്ട: $1',
46554679 'centralnotice-templates' => 'ഫലകങ്ങൾ',
46564680 'centralnotice-weight' => 'ഘനം',
46574681 'centralnotice-locked' => 'പൂട്ടിയിരിക്കുന്നു',
46584682 'centralnotice-notice' => 'പ്രചാരണപ്രവർത്തനം',
 4683+ 'centralnotice-notice-heading' => 'പ്രചരണം: $1',
46594684 'centralnotice-notices' => 'അറിയിപ്പുകൾ',
46604685 'centralnotice-notice-exists' => 'അറിയിപ്പ് ഇപ്പോൾ തന്നെ ഉണ്ട്.
46614686 കൂട്ടിച്ചേർക്കുന്നില്ല',
 4687+ 'centralnotice-no-language' => 'പ്രചരണത്തിനായി ഭാഷയൊന്നും തിരഞ്ഞെടുക്കപ്പെട്ടിട്ടില്ല. കൂട്ടിച്ചേർക്കുന്നില്ല.',
46624688 'centralnotice-template-exists' => 'ഫലകം നിലവിലുണ്ട്.
46634689 കൂട്ടിച്ചേർക്കുന്നില്ല',
46644690 'centralnotice-notice-doesnt-exist' => 'പ്രചാരണപ്രവർത്തനം നിലനിൽക്കുന്നില്ല',
@@ -4703,6 +4729,7 @@
47044730 താഴെ ഒരെണ്ണം കൂട്ടിച്ചേർക്കുക',
47054731 'centralnotice-no-templates-translate' => 'ഇതിന്റെ തർജ്ജമകൾ തിരുത്താനായി ഒരു ഫലകവും ഇപ്പോഴില്ല',
47064732 'centralnotice-number-uses' => 'ഉപയോഗങ്ങൾ',
 4733+ 'centralnotice-settings' => 'സജ്ജീകരണങ്ങൾ',
47074734 'centralnotice-edit-template' => 'ഫലകം തിരുത്തുക',
47084735 'centralnotice-edit-template-summary' => 'പ്രാദേശീകരിക്കാവുന്ന സന്ദേശം സൃഷ്ടിക്കാൻ, മൂന്ന് വളയൻ കോഷ്ഠകങ്ങൾക്കുള്ളിൽ ഹൈഫൻ ഉപയോഗിച്ച് ചേർത്ത പദങ്ങൾ നൽകുക, ഉദാ: {{{jimbo-quote}}}.',
47094736 'centralnotice-message' => 'സന്ദേശം',
@@ -4717,9 +4744,12 @@
47184745 'centralnotice-expand-button' => '{{int:centralnotice-shared-expand}} ബട്ടൺ',
47194746 'centralnotice-translate-button' => 'പരിഭാഷാസഹായി ബട്ടൺ',
47204747 'centralnotice-donate-button' => 'സംഭാവനാ ബട്ടൺ',
 4748+ 'centralnotice-expanded-banner' => 'വികസിപ്പിച്ച എഴുത്തുപട്ട',
 4749+ 'centralnotice-collapsed-banner' => 'ചുരുക്കിയ എഴുത്തുപട്ട',
47214750 'centralnotice-banner-display' => 'പ്രദർശിപ്പിക്കേണ്ടത്:',
47224751 'centralnotice-banner-anonymous' => 'അജ്ഞാത ഉപയോക്താക്കൾ',
47234752 'centralnotice-banner-logged-in' => 'പ്രവേശിച്ചിട്ടുള്ള ഉപയോക്താക്കൾ',
 4753+ 'centralnotice-banner-type' => 'എഴുത്തുപട്ടയുടെ തരം:',
47244754 'centralnotice-banner-hidable' => 'സ്ഥിരസ്ഥിതി/മറയ്ക്കാവുന്നത്',
47254755 'centralnotice-banner-collapsible' => 'ചുരുക്കാവുന്നത്',
47264756 'right-centralnotice-admin' => 'കേന്ദ്രീകൃത അറിയിപ്പുകൾ കൈകാര്യം ചെയ്യുക',
@@ -5018,7 +5048,7 @@
50195049 'centralnotice-translate-to' => 'Vertalen naar',
50205050 'centralnotice-translate' => 'Vertalen',
50215051 'centralnotice-english' => 'Engels',
5022 - 'centralnotice-banner-name' => 'Sjabloonnaam',
 5052+ 'centralnotice-banner-name' => 'Bannernaam:',
50235053 'centralnotice-banner' => 'Banner',
50245054 'centralnotice-banner-heading' => 'Banner: $1',
50255055 'centralnotice-templates' => 'Sjablonen',
@@ -5058,7 +5088,7 @@
50595089 'centralnotice-template-already-exists' => 'Het sjabloon is al gekoppeld aan een campagne.
50605090 Het wordt niet toegevoegd.',
50615091 'centralnotice-preview-template' => 'Voorvertoning sjabloon',
5062 - 'centralnotice-start-hour' => 'Starttijd (in GMT)',
 5092+ 'centralnotice-start-hour' => 'Starttijd (in UTC)',
50635093 'centralnotice-change-lang' => 'Te vertalen taal wijzigen',
50645094 'centralnotice-weights' => 'Gewichten',
50655095 'centralnotice-notice-is-locked' => 'De sitenotice is afgesloten.
@@ -5261,7 +5291,7 @@
52625292 'centralnotice-template-already-exists' => 'Mal er allerede knyttet til kampanje.
52635293 Ikke lagt inn',
52645294 'centralnotice-preview-template' => 'Forhåndsvis mal',
5265 - 'centralnotice-start-hour' => 'Starttid (GMT)',
 5295+ 'centralnotice-start-hour' => 'Starttid (UTC)',
52665296 'centralnotice-change-lang' => 'Endre oversettelsesspråk',
52675297 'centralnotice-weights' => 'Tyngder',
52685298 'centralnotice-notice-is-locked' => 'Melding er låst.
@@ -5460,7 +5490,7 @@
54615491 'centralnotice-translate-to' => 'Przetłumacz na',
54625492 'centralnotice-translate' => 'Przetłumacz',
54635493 'centralnotice-english' => 'Angielski',
5464 - 'centralnotice-banner-name' => 'Nazwa szablonu',
 5494+ 'centralnotice-banner-name' => 'Nazwa banera',
54655495 'centralnotice-banner' => 'Baner',
54665496 'centralnotice-banner-heading' => 'Baner – $1',
54675497 'centralnotice-templates' => 'Banery',
@@ -5573,7 +5603,7 @@
55745604 'centralnotice-translate-to' => 'Volté an',
55755605 'centralnotice-translate' => 'Volté',
55765606 'centralnotice-english' => 'Anglèis',
5577 - 'centralnotice-banner-name' => 'Nòm ëd lë stamp',
 5607+ 'centralnotice-banner-name' => 'Nòm dël tilèt:',
55785608 'centralnotice-banner' => 'Tilèt',
55795609 'centralnotice-banner-heading' => 'Tilèt: $1',
55805610 'centralnotice-templates' => 'Stamp',
@@ -5613,7 +5643,7 @@
56145644 'centralnotice-template-already-exists' => "Lë stamp a l'é già gropà a na campagna.
56155645 Pa giontà",
56165646 'centralnotice-preview-template' => 'Previsualisassion stamp',
5617 - 'centralnotice-start-hour' => "Ora d'inissi (GMT)",
 5647+ 'centralnotice-start-hour' => "Ora d'inissi (UTC)",
56185648 'centralnotice-change-lang' => 'Cangé lenga ëd tradussion',
56195649 'centralnotice-weights' => 'Pèis',
56205650 'centralnotice-notice-is-locked' => 'Neuva blocà.
@@ -5734,7 +5764,7 @@
57355765 'centralnotice-translate-to' => 'Traduzir para',
57365766 'centralnotice-translate' => 'Traduzir',
57375767 'centralnotice-english' => 'Inglês',
5738 - 'centralnotice-banner-name' => 'Nome do modelo',
 5768+ 'centralnotice-banner-name' => 'Nome do modelo:',
57395769 'centralnotice-banner' => 'Modelo',
57405770 'centralnotice-banner-heading' => 'Modelo: $1',
57415771 'centralnotice-templates' => 'Modelos',
@@ -5774,7 +5804,7 @@
57755805 'centralnotice-template-already-exists' => 'O modelo já está ligado a um aviso.
57765806 Não adicionado.',
57775807 'centralnotice-preview-template' => 'Antever modelo',
5778 - 'centralnotice-start-hour' => 'Hora de início (GMT)',
 5808+ 'centralnotice-start-hour' => 'Hora de início (UTC)',
57795809 'centralnotice-change-lang' => 'Alterar língua de tradução',
57805810 'centralnotice-weights' => 'Pesos',
57815811 'centralnotice-notice-is-locked' => 'O aviso está bloqueado.
@@ -5855,7 +5885,7 @@
58565886 'centralnotice-translate-to' => 'Traduzir para',
58575887 'centralnotice-translate' => 'Traduzir',
58585888 'centralnotice-english' => 'Inglês',
5859 - 'centralnotice-banner-name' => 'Nome do modelo',
 5889+ 'centralnotice-banner-name' => 'Nome do banner:',
58605890 'centralnotice-banner' => 'Banner',
58615891 'centralnotice-banner-heading' => 'Banner: $1',
58625892 'centralnotice-templates' => 'Modelos',
@@ -5895,7 +5925,7 @@
58965926 'centralnotice-template-already-exists' => 'O modelo já está ligado a campanha.
58975927 Não adicionado',
58985928 'centralnotice-preview-template' => 'Prever modelo',
5899 - 'centralnotice-start-hour' => 'Hora de início (GMT)',
 5929+ 'centralnotice-start-hour' => 'Hora de início (UTC)',
59005930 'centralnotice-change-lang' => 'Alterar língua de tradução',
59015931 'centralnotice-weights' => 'Pesos',
59025932 'centralnotice-notice-is-locked' => 'O aviso está bloqueado.
@@ -5912,6 +5942,7 @@
59135943 Adicione um abaixo',
59145944 'centralnotice-no-templates-translate' => 'Não há quaisquer modelos para os quais seja possível editar traduções',
59155945 'centralnotice-number-uses' => 'Utilizações',
 5946+ 'centralnotice-settings' => 'Configurações',
59165947 'centralnotice-edit-template' => 'Editar modelo',
59175948 'centralnotice-edit-template-summary' => 'Para criar uma mensagem localizável, coloque entre três chaves um texto que contenha um hífen; por exemplo, {{{texto-citado}}}.',
59185949 'centralnotice-message' => 'Mensagem',
@@ -6158,7 +6189,7 @@
61596190 'centralnotice-translate-to' => 'Перевод на',
61606191 'centralnotice-translate' => 'Перевод',
61616192 'centralnotice-english' => 'английский',
6162 - 'centralnotice-banner-name' => 'Название баннера',
 6193+ 'centralnotice-banner-name' => 'Название баннера:',
61636194 'centralnotice-banner' => 'Баннер',
61646195 'centralnotice-banner-heading' => 'Баннер: $1',
61656196 'centralnotice-templates' => 'Шаблоны',
@@ -6198,7 +6229,7 @@
61996230 'centralnotice-template-already-exists' => 'Шаблон уже привязан.
62006231 Не добавлен',
62016232 'centralnotice-preview-template' => 'Предпросмотр шаблона',
6202 - 'centralnotice-start-hour' => 'Время начала (GMT)',
 6233+ 'centralnotice-start-hour' => 'Время начала (UTC)',
62036234 'centralnotice-change-lang' => 'Изменить язык перевода',
62046235 'centralnotice-weights' => 'Веса',
62056236 'centralnotice-notice-is-locked' => 'Уведомление заблокировано.
@@ -6302,7 +6333,7 @@
63036334 'centralnotice-translate-to' => 'Манна тылбаас',
63046335 'centralnotice-translate' => 'Тылбаас',
63056336 'centralnotice-english' => 'Аҥылычаан',
6306 - 'centralnotice-banner-name' => 'Халыып аата',
 6337+ 'centralnotice-banner-name' => 'Бааннер аата:',
63076338 'centralnotice-templates' => 'Халыыптар',
63086339 'centralnotice-weight' => 'Кэтитэ',
63096340 'centralnotice-locked' => 'Хааччахтаммыт/бобуллубут',
@@ -7553,7 +7584,7 @@
75547585 'centralnotice-available-templates' => 'Үрнәкләр',
75557586 'centralnotice-template-already-exists' => 'Үрнәк өстәлмәде',
75567587 'centralnotice-preview-template' => 'Алдан карау',
7557 - 'centralnotice-start-hour' => 'Башлау сәгате (GMT)',
 7588+ 'centralnotice-start-hour' => 'Башлау сәгате (UTC)',
75587589 'centralnotice-change-lang' => 'Тәрҗемә телен үзгәртү',
75597590 'centralnotice-weights' => 'Үлчәү',
75607591 'centralnotice-notice-is-locked' => 'Хәбәр чикләнде',
@@ -7624,7 +7655,7 @@
76257656 'centralnotice-translate-to' => 'Переклад на',
76267657 'centralnotice-translate' => 'Переклад',
76277658 'centralnotice-english' => 'англійську',
7628 - 'centralnotice-banner-name' => 'Назва шаблону',
 7659+ 'centralnotice-banner-name' => 'Назва банера:',
76297660 'centralnotice-banner' => 'Банер',
76307661 'centralnotice-banner-heading' => 'Банер: $1',
76317662 'centralnotice-templates' => 'Шаблони',
@@ -7660,7 +7691,7 @@
76617692 'centralnotice-template-already-exists' => "Шаблон вже прив'язаний.
76627693 Не доданий",
76637694 'centralnotice-preview-template' => 'Попередній перегляд шаблону',
7664 - 'centralnotice-start-hour' => 'Час початку (GMT)',
 7695+ 'centralnotice-start-hour' => 'Час початку (UTC)',
76657696 'centralnotice-change-lang' => 'Змінити мову перекладу',
76667697 'centralnotice-weights' => 'Ваги',
76677698 'centralnotice-notice-is-locked' => 'Повідомлення заблоковано.
@@ -7817,7 +7848,7 @@
78187849 'centralnotice-translate-to' => 'Dịch ra',
78197850 'centralnotice-translate' => 'Biên dịch',
78207851 'centralnotice-english' => 'tiếng Anh',
7821 - 'centralnotice-banner-name' => 'Tên bảng',
 7852+ 'centralnotice-banner-name' => 'Tên bảng:',
78227853 'centralnotice-banner' => 'Bảng',
78237854 'centralnotice-banner-heading' => 'Bảng: $1',
78247855 'centralnotice-templates' => 'Bảng',
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -6,7 +6,7 @@
77 }
88
99 class SpecialNoticeTemplate extends UnlistedSpecialPage {
10 - var $editable;
 10+ var $editable, $centralNoticeError;
1111
1212 function __construct() {
1313 parent::__construct( 'NoticeTemplate' );
@@ -32,6 +32,9 @@
3333
3434 // Check permissions
3535 $this->editable = $wgUser->isAllowed( 'centralnotice-admin' );
 36+
 37+ // Initialize error variable
 38+ $this->centralNoticeError = false;
3639
3740 // Show summary
3841 $wgOut->addWikiMsg( 'centralnotice-summary' );
@@ -73,10 +76,9 @@
7477 }
7578
7679 // Handle adding banner
77 - // FIXME: getText()? weak comparison
7880 if ( $method == 'addTemplate' ) {
79 - $newTemplateName = $wgRequest->getVal( 'templateName' );
80 - $newTemplateBody = $wgRequest->getVal( 'templateBody' );
 81+ $newTemplateName = $wgRequest->getText( 'templateName' );
 82+ $newTemplateBody = $wgRequest->getText( 'templateBody' );
8183 if ( $newTemplateName != '' && $newTemplateBody != '' ) {
8284 $this->addTemplate(
8385 $newTemplateName,
@@ -86,15 +88,15 @@
8789 );
8890 $sub = 'view';
8991 } else {
90 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-null-string' );
 92+ $this->showError( 'centralnotice-null-string' );
9193 }
9294 }
9395
9496 // Handle editing banner
9597 if ( $method == 'editTemplate' ) {
9698 $this->editTemplate(
97 - $wgRequest->getVal( 'template' ),
98 - $wgRequest->getVal( 'templateBody' ),
 99+ $wgRequest->getText( 'template' ),
 100+ $wgRequest->getText( 'templateBody' ),
99101 $wgRequest->getBool( 'displayAnon' ),
100102 $wgRequest->getBool( 'displayAccount' )
101103 );
@@ -102,7 +104,7 @@
103105 }
104106
105107 } else {
106 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'sessionfailure' );
 108+ $this->showError( 'sessionfailure' );
107109 }
108110
109111 }
@@ -144,7 +146,7 @@
145147 return;
146148
147149 } else {
148 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'sessionfailure' );
 150+ $this->showError( 'sessionfailure' );
149151 }
150152
151153 }
@@ -328,15 +330,12 @@
329331 $bodyPage = Title::newFromText( "Centralnotice-template-{$currentTemplate}", NS_MEDIAWIKI );
330332 $curRev = Revision::newFromTitle( $bodyPage );
331333 $body = $curRev ? $curRev->getText() : '';
332 -
 334+
333335 // Extract message fields from the banner body
334336 $fields = array();
335337 $allowedChars = Title::legalChars();
336338 preg_match_all( "/\{\{\{([$allowedChars]+)\}\}\}/u", $body, $fields );
337 -
338 - // Restore banner body state in the event of an error on form submit
339 - $body = $wgRequest->getVal( 'templateBody', $body );
340 -
 339+
341340 // If there are any message fields in the banner, display translation tools.
342341 if ( count( $fields[0] ) > 0 ) {
343342 if ( $this->editable ) {
@@ -353,20 +352,20 @@
354353 'width' => '100%'
355354 )
356355 );
357 -
 356+
358357 // Table headers
359358 $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ), wfMsg( 'centralnotice-message' ) );
360359 $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ), wfMsg ( 'centralnotice-number-uses' ) );
361360 $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-english' ) );
362361 $languages = Language::getLanguageNames();
363362 $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), $languages[$wpUserLang] );
364 -
 363+
365364 // Remove duplicate message fields
366365 $filteredFields = array();
367366 foreach ( $fields[1] as $field ) {
368367 $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 : 1;
369368 }
370 -
 369+
371370 // Table rows
372371 foreach ( $filteredFields as $field => $count ) {
373372 // Message
@@ -463,22 +462,22 @@
464463 $htmlOut .= Xml::hidden( 'wpMethod', 'editTemplate' );
465464 }
466465
 466+ // If there was an error, we'll need to restore the state of the form
 467+ if ( $wgRequest->wasPosted() && $wgRequest->getVal( 'mainform' ) ) {
 468+ $displayAnon = $wgRequest->getCheck( 'displayAnon' );
 469+ $displayAccount = $wgRequest->getCheck( 'displayAccount' );
 470+ $body = $wgRequest->getVal( 'templateBody', $body );
 471+ } else { // Defaults
 472+ $displayAnon = ( $row->tmp_display_anon == 1 );
 473+ $displayAccount = ( $row->tmp_display_account == 1 );
 474+ }
 475+
467476 // Show banner settings
468477 $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-settings' ) );
469478 $htmlOut .= Xml::openElement( 'p', null );
470479 $htmlOut .= wfMsg( 'centralnotice-banner-display' );
471 - if ( $wgRequest->wasPosted() ) {
472 - $displayAnon = $wgRequest->getCheck( 'displayAnon' ); // Restore checkbox state in event of error
473 - } else {
474 - $displayAnon = ( $row->tmp_display_anon == 1 ); // Default to saved state
475 - }
476480 $htmlOut .= Xml::check( 'displayAnon', $displayAnon, wfArrayMerge( $disabled, array( 'id' => 'displayAnon' ) ) );
477481 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-anonymous' ), 'displayAnon' );
478 - if ( $wgRequest->wasPosted() ) {
479 - $displayAccount = $wgRequest->getCheck( 'displayAccount' ); // Restore checkbox state in event of error
480 - } else {
481 - $displayAccount = ( $row->tmp_display_account == 1 ); // Default to saved state
482 - }
483482 $htmlOut .= Xml::check( 'displayAccount', $displayAccount, wfArrayMerge( $disabled, array( 'id' => 'displayAccount' ) ) );
484483 $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-logged-in' ), 'displayAccount' );
485484 $htmlOut .= Xml::closeElement( 'p' );
@@ -499,6 +498,7 @@
500499 $htmlOut .= Xml::textarea( 'templateBody', $body, 60, 20, $readonly );
501500 $htmlOut .= Xml::closeElement( 'fieldset' );
502501 if ( $this->editable ) {
 502+ $htmlOut .= Xml::hidden( 'mainform', 'true' ); // Indicate which form was submitted
503503 $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() );
504504 $htmlOut .= Xml::tags( 'div',
505505 array( 'class' => 'cn-buttons' ),
@@ -614,7 +614,7 @@
615615 $res = $dbr->select( 'cn_assignments', 'asn_id', array( 'tmp_id' => $id ), __METHOD__ );
616616
617617 if ( $dbr->numRows( $res ) > 0 ) {
618 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-template-still-bound' );
 618+ $this->showError( 'centralnotice-template-still-bound' );
619619 return;
620620 } else {
621621 $dbw = wfGetDB( DB_MASTER );
@@ -639,7 +639,7 @@
640640 global $wgOut;
641641
642642 if ( $body == '' || $name == '' ) {
643 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-null-string' );
 643+ $this->showError( 'centralnotice-null-string' );
644644 return;
645645 }
646646
@@ -655,7 +655,7 @@
656656 );
657657
658658 if ( $dbr->numRows( $res ) > 0 ) {
659 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-template-exists' );
 659+ $this->showError( 'centralnotice-template-exists' );
660660 return false;
661661 } else {
662662 $dbw = wfGetDB( DB_MASTER );
@@ -684,7 +684,7 @@
685685 global $wgOut;
686686
687687 if ( $body == '' || $name == '' ) {
688 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-null-string' );
 688+ $this->showError( 'centralnotice-null-string' );
689689 return;
690690 }
691691
@@ -807,4 +807,10 @@
808808 }
809809 return $translations;
810810 }
 811+
 812+ function showError( $message ) {
 813+ global $wgOut;
 814+ $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", $message );
 815+ $this->centralNoticeError = true;
 816+ }
811817 }
Index: branches/wmf/1.16wmf4/extensions/CentralNotice/CentralNotice.db.php
@@ -9,7 +9,7 @@
1010
1111 /* Functions */
1212
13 - function CentralNoticeDB() {
 13+ function __construct() {
1414 // Internationalization
1515 wfLoadExtensionMessages( 'CentralNotice' );
1616 }
@@ -118,20 +118,5 @@
119119 }
120120 return $templates;
121121 }
122 -
123 - public function updatePreferred( $notice, $preferred ) {
124 - $dbw = wfGetDB( DB_MASTER );
125 - $dbw->begin();
126 -
127 - $res = $dbw->update( 'cn_notices',
128 - array(
129 - 'not_preferred' => $preferred,
130 - ),
131 - array(
132 - 'not_name' => $notice
133 - )
134 - );
135 - $dbw->commit();
136 - return $res;
137 - }
 122+
138123 }
Property changes on: branches/wmf/1.16wmf4/extensions/CentralNotice
___________________________________________________________________
Modified: svn:mergeinfo
139124 Merged /trunk/extensions/CentralNotice:r71774-71997

Status & tagging log