r42937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42936‎ | r42937 | r42938 >
Date:20:41, 31 October 2008
Author:tparscal
Status:old
Tags:
Comment:
Restructured the Template and Translate pages into one.
Modified paths:
  • /branches/CentralNotice-SpecialPage-Integration/CentralNotice.i18n.php (modified) (history)
  • /branches/CentralNotice-SpecialPage-Integration/CentralNotice.php (modified) (history)
  • /branches/CentralNotice-SpecialPage-Integration/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: branches/CentralNotice-SpecialPage-Integration/CentralNotice.php
@@ -97,11 +97,8 @@
9898 $wgGroupPermissions['sysop']['centralnotice_translate_rights'] = true; // Only sysops can make change
9999
100100 $wgSpecialPages['CentralNotice'] = 'CentralNotice';
101 -$wgSpecialPages['NoticeTranslate'] = 'SpecialNoticeTranslate';
102101 $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
103102 $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools"
104 -$wgSpecialPageGroups['NoticeTranslate'] = 'wiki'; // Wiki data and tools"
105 -$wgSpecialPageGroups['NoticeTemplate'] = 'wiki'; // Wiki data and tools"
106103
107104 function efCentralNoticeSetup() {
108105 global $wgHooks, $wgNoticeInfrastructure, $wgAutoloadClasses, $wgSpecialPages;
@@ -133,9 +130,6 @@
134131
135132 $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
136133 $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php';
137 -
138 - $wgSpecialPages['NoticeTranslate'] = 'SpecialNoticeTranslate';
139 - $wgAutoloadClasses['SpecialNoticeTranslate'] = $dir . 'SpecialNoticeTranslate.php';
140134 }
141135 }
142136
Index: branches/CentralNotice-SpecialPage-Integration/SpecialNoticeTemplate.php
@@ -48,11 +48,21 @@
4949 foreach ( $toRemove as $template ) {
5050 $this->removeTemplate( $template );
5151 }
52 -
53 - // Show a list of templates
54 - $this->listTemplates();
55 - return;
5652 }
 53+
 54+ // Handle translation message update
 55+ $update = $wgRequest->getArray('updateText');
 56+ $token = $wgRequest->getArray('token');
 57+ if (isset ( $update ) ) {
 58+ foreach ( $update as $lang => $messages ) {
 59+ foreach ( $messages as $text => $translation) {
 60+ // If we actually have text
 61+ if ( $translation ) {
 62+ $this->updateMessage( $text, $translation, $lang, $token );
 63+ }
 64+ }
 65+ }
 66+ }
5767 }
5868
5969 // Handle adding
@@ -61,51 +71,38 @@
6272 $wgRequest->getVal( 'templateName' ),
6373 $wgRequest->getVal( 'templateBody' )
6474 );
 75+ $sub = 'view';
6576 }
6677
67 - // If this is a sub-page, show list of templates
68 - if ( $sub == 'listTemplates' ) {
69 - $this->listTemplates();
 78+ // Handle Editing
 79+ if ( $wgRequest->getVal( 'wpMethod' ) == 'editTemplate' ) {
 80+ $this->editTemplate(
 81+ $wgRequest->getVal( 'template' ),
 82+ $wgRequest->getVal( 'templateBody' )
 83+ );
 84+ $sub = 'view';
 85+ }
 86+
 87+ // Handle viewing a specific template
 88+ if ( $sub == 'view' && $wgRequest->getText( 'template' ) != '' ) {
 89+ $this->showView();
7090 return;
7191 }
72 - if ( $sub == 'preview' ) {
73 -
74 - $userLang = $wgRequest->getVal( 'wpUserLanguage' );
75 - $template = $wgRequest->getText( 'template' );
76 -
77 - $htmlOut = $this->previewTemplate( $template, $userLang );
78 - $wgOut->addHTML( $htmlOut );
79 -
 92+
 93+ // Handle viewing a specific template
 94+ if ( $sub == 'add' ) {
 95+ $this->showAdd();
8096 return;
8197 }
8298
83 - $this->listTemplates();
 99+ // Show list by default
 100+ $this->showList();
84101 }
85102
86 - static function queryTemplates() {
87 - $dbr = wfGetDB( DB_SLAVE );
88 - $res = $dbr->select( 'cn_templates',
89 - array( 'tmp_name', 'tmp_id' ),
90 - '',
91 - __METHOD__,
92 - array( 'ORDER BY' => 'tmp_id' )
93 - );
 103+ function showList() {
 104+ global $wgOut, $wgTitle, $wgUser, $wgRequest;
94105
95 - $templates = array();
96 - while ( $row = $dbr->fetchObject( $res ) ) {
97 - array_push( $templates, $row->tmp_name );
98 - }
99 -
100 - return $templates;
101 - }
102 -
103 - function listTemplates() {
104106 $templates = $this->queryTemplates();
105 - return $this->templatesForm( $templates );
106 - }
107 -
108 - function templatesForm( $templates ) {
109 - global $wgOut, $wgTitle, $wgUser;
110107
111108 // Templates
112109 $templates = $this->queryTemplates();
@@ -117,54 +114,54 @@
118115 )
119116 );
120117 $htmlOut .= Xml::fieldset( 'Available Templates' );
121 - $htmlOut .= Xml::openElement( 'table', array ( 'cellpadding' => 9 ) ) ;
122 - $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-template-name' ) );
123 - $htmlOut .= Xml::element( 'th' );
124 - $htmlOut .= Xml::element( 'th' );
125 - $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-remove' ) );
 118+ $htmlOut .= Xml::openElement( 'table',
 119+ array(
 120+ 'cellpadding' => 9,
 121+ 'width' => '100%'
 122+ )
 123+ ) ;
 124+ $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'width' => '5%' ),
 125+ wfMsg ( 'centralnotice-remove' )
 126+ );
 127+ $htmlOut .= Xml::element( 'th', array( 'align' => 'left' ),
 128+ wfMsg ( 'centralnotice-template-name' )
 129+ );
126130
127131 $msgConfirmDelete = wfMsgHTML( 'centralnotice-confirm-delete' );
128132 foreach ( $templates as $templateName ) {
129 - $templateTitle = Title::newFromText( "MediaWiki:Centralnotice-template-{$templateName}" );
130 - $translateTitle = Title::newFromText( 'Special:NoticeTranslate' );
131 - $templatePage = SpecialPage::getTitleFor( 'NoticeTemplate/preview' );
132 - $htmlOut .= Xml::tags( 'tr', null,
133 - Xml::tags( 'td', null,
134 - Xml::element( 'a',
135 - array(
136 - 'href' => $templatePage->getFullUrl( "template=$templateName" )
137 - ),
138 - $templateName
139 - )
 133+ $viewPage = SpecialPage::getTitleFor( 'NoticeTemplate/view' );
 134+ $htmlOut .= Xml::openElement( 'tr' );
 135+
 136+ // Remove box
 137+ $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
 138+ Xml::check( 'removeTemplates[]', false,
 139+ array(
 140+ 'value' => $templateName,
 141+ 'onchange' => "if(this.checked){this.checked=confirm('{$msgConfirmDelete}')}"
 142+ )
 143+ )
 144+ );
 145+
 146+ // Link and Preview
 147+ $render = new SpecialNoticeText();
 148+ $render->project = 'wikipedia';
 149+ $render->language = $wgRequest->getVal( 'wpUserLanguage' );
 150+ $htmlOut .= Xml::tags( 'td', null,
 151+ Xml::element( 'a',
 152+ array(
 153+ 'href' => $viewPage->getFullUrl( "template=$templateName" )
 154+ ),
 155+ $templateName
140156 ) .
141 - Xml::tags( 'td' , null,
142 - Xml::element( 'a',
143 - array(
144 - 'href' => $templateTitle->getEditURL(),
145 - ),
146 - wfMsg ( 'centralnotice-edit' )
147 - )
148 - ) .
149 - Xml::tags( 'td', null,
150 - Xml::element( 'a',
151 - array(
152 - 'href' => $translateTitle->getFullURL( "template={$templateName}" ),
153 - ),
154 - wfMsg ( 'centralnotice-translate' )
155 - )
156 - ) .
157 - Xml::tags( 'td', null,
158 - Xml::check( 'removeTemplates[]', false,
159 - array(
160 - 'value' => $templateName,
161 - 'onchange' => "if(this.checked){this.checked=confirm('{$msgConfirmDelete}')}"
162 - )
163 - )
164 - )
 157+ Xml::fieldset( wfMsg( 'centralnotice-preview' ),
 158+ $render->getHtmlNotice( $templateName )
 159+ )
165160 );
 161+
 162+ $htmlOut .= Xml::closeElement( 'tr' );
166163 }
167164 $htmlOut .= Xml::tags( 'tr', null,
168 - Xml::tags( 'td', null,
 165+ Xml::tags( 'td', array( 'colspan' => 3 ),
169166 Xml::submitButton( wfMsg( 'centralnotice-modify' ) )
170167 )
171168 );
@@ -177,13 +174,24 @@
178175 $htmlOut .= XML::closeElement( 'fieldset' );
179176 $htmlOut .= XML::closeElement( 'form' );
180177
181 - // Notices
182 - $htmlOut .= Xml::openElement( 'form',
183 - array(
184 - 'method' => 'post',
185 - 'action' => SpecialPage::getTitleFor( 'NoticeTemplate' )->getFullUrl()
186 - )
 178+ // Show add link
 179+ $newPage = SpecialPage::getTitleFor( 'NoticeTemplate/add' );
 180+ $htmlOut .= Xml::element( 'a',
 181+ array(
 182+ 'href' => $newPage->getFullUrl()
 183+ ),
 184+ wfMsg( 'centralnotice-add-template' )
187185 );
 186+
 187+ // Output HTML
 188+ $wgOut->addHtml( $htmlOut );
 189+ }
 190+
 191+ function showAdd() {
 192+ global $wgOut, $wgTitle, $wgUser;
 193+
 194+ // Build HTML
 195+ $htmlOut = Xml::openElement( 'form', array( 'method' => 'post' ) );
188196 $htmlOut .= Xml::openElement( 'fieldset' );
189197 $htmlOut .= Xml::element( 'legend', null, wfMsg( 'centralnotice-add-template' ) );
190198 $htmlOut .= Xml::hidden( 'wpMethod', 'addTemplate' );
@@ -208,46 +216,219 @@
209217 $wgOut->addHtml( $htmlOut );
210218 }
211219
212 - function listTemplateDetail ( $template ) {
213 - global $wgOut, $wgUser;
 220+ private function showView() {
 221+ global $wgOut, $wgUser, $wgRequest, $wgContLanguageCode;
214222
 223+ // Get token
 224+ $token = $wgUser->editToken();
 225+
 226+ // Get user's language
 227+ $wpUserLang = $wgRequest->getVal('wpUserLanguage') ? $wgRequest->getVal('wpUserLanguage') : $wgContLanguageCode;
 228+
 229+ // Get current template
 230+ $currentTemplate = $wgRequest->getText( 'template' );
 231+
 232+ // Show preview
 233+ $render = new SpecialNoticeText();
 234+ $render->project = 'wikipedia';
 235+ $render->language = $wgRequest->getVal( 'wpUserLanguage' );
 236+ $htmlOut = Xml::fieldset( wfMsg( 'centralnotice-preview' ),
 237+ $render->getHtmlNotice( $wgRequest->getText( 'template' ) )
 238+ );
 239+
 240+ // Build HTML
 241+ $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 242+ $htmlOut .= Xml::fieldset( wfMsgHtml( 'centralnotice-translate-heading', $currentTemplate ) );
 243+ $htmlOut .= Xml::openElement( 'table',
 244+ array (
 245+ 'cellpadding' => 9,
 246+ 'width' => '100%'
 247+ )
 248+ );
 249+
 250+ // Headers
 251+ $htmlOut .= Xml::element( 'th', array( 'width' => '15%' ), wfMsg( 'centralnotice-message' ) );
 252+ $htmlOut .= Xml::element( 'th', array( 'width' => '5%' ), wfMsg ( 'centralnotice-number-uses') );
 253+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), wfMsg ( 'centralnotice-english') );
 254+ $languages = Language::getLanguageNames();
 255+ $htmlOut .= Xml::element( 'th', array( 'width' => '40%' ), $languages[$wpUserLang] );
 256+
 257+ $body = wfMsg( "Centralnotice-template-{$currentTemplate}" );
 258+
 259+ // Generate fields from parsing the body
 260+ $fields = array();
 261+ preg_match_all( '/\{\{\{([A-Za-z0-9\_\-}]+)\}\}\}/', $body, $fields );
 262+
 263+ // Remove duplicates
 264+ $filteredFields = array();
 265+ foreach( $fields[1] as $field ) {
 266+ $filteredFields[$field] = array_key_exists( $field, $filteredFields ) ? $filteredFields[$field] + 1 : 1;
 267+ }
 268+
 269+ // Rows
 270+ foreach( $filteredFields as $field => $count ) {
 271+ // Message
 272+ $message = ( $wpUserLang == 'en' ) ? "Centralnotice-{$currentTemplate}-{$field}" : "Centralnotice-{$currentTemplate}-{$field}/{$wpUserLang}";
 273+
 274+ // English value
 275+ $htmlOut .= Xml::openElement( 'tr' );
 276+
 277+ $title = Title::newFromText( "MediaWiki:{$message}" );
 278+ $htmlOut .= Xml::tags( 'td', null,
 279+ Xml::element( 'a', array( 'href' => $title->getFullURL() ), $field )
 280+ );
 281+
 282+ $htmlOut .= Xml::element( 'td', null, $count);
 283+
 284+ $htmlOut .= Xml::element( 'td', null,
 285+ wfMsgExt( "Centralnotice-{$currentTemplate}-{$field}", array( 'language' => 'en') )
 286+ );
 287+
 288+ // Input
 289+ $text = '';
 290+ if( Title::newFromText( $message, NS_MEDIAWIKI )->exists() ) {
 291+ $text = wfMsgExt( "Centralnotice-{$currentTemplate}-{$field}",
 292+ array( 'language' => $wpUserLang )
 293+ );
 294+ }
 295+ $htmlOut .= Xml::tags( 'td', null,
 296+ Xml::input( "updateText[{$wpUserLang}][{$currentTemplate}-{$field}]", '', $text,
 297+ array( 'style' => 'width:100%;' . ( $text == '' ? 'color:red' : '' ) )
 298+ )
 299+ );
 300+
 301+ $htmlOut .= Xml::closeElement( 'tr' );
 302+ }
 303+ $htmlOut .= Xml::hidden( 'token', $token );
 304+ $htmlOut .= Xml::hidden( 'wpUserLanguage', $wpUserLang );
 305+ $htmlOut .= Xml::openElement( 'tr' );
 306+ $htmlOut .= Xml::tags( 'td', array( 'colspan' => 4 ),
 307+ Xml::submitButton( wfMsg('centralnotice-modify', array( 'name' => 'update') ) )
 308+ );
 309+
 310+ $htmlOut .= Xml::closeElement( 'tr' );
 311+ $htmlOut .= Xml::closeElement( 'table' );
 312+ $htmlOut .= Xml::closeElement( 'fieldset' );
 313+ $htmlOut .= Xml::closeElement( 'form' );
 314+
215315 /*
216 - * What is this supposed to be?
217 - *
218 - $form .= 'Preview';
219 - $form .= 'Template';
220 - $form .= 'Button';
221 - $form .= 'Link';
 316+ * Show language selection form
222317 */
 318+ $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 319+ $htmlOut .= Xml::fieldset( wfMsgHtml( 'centralnotice-change-lang' ) );
 320+ $htmlOut .= Xml::openElement( 'table', array ( 'cellpadding' => 9 ) );
 321+ list( $lsLabel, $lsSelect) = Xml::languageSelector( $wpUserLang );
 322+ $htmlOut .= Xml::tags( 'tr', null,
 323+ Xml::tags( 'td', null, $lsLabel ) .
 324+ Xml::tags( 'td', null, $lsSelect ) .
 325+ Xml::tags( 'td', array( 'colspan' => 2 ),
 326+ Xml::submitButton( wfMsgHtml('centralnotice-modify') )
 327+ )
 328+ );
 329+ $htmlOut .= Xml::closeElement( 'table' );
 330+ $htmlOut .= Xml::closeElement( 'fieldset' );
 331+ $htmlOut .= Xml::closeElement( 'form' );
223332
224 - if ( $wgUser->isAllowed( 'centralnotice-template-edit' ) ) {
225 - $form .= Xml::tags( 'tr', null,
226 - Xml::tags( 'td', null,
227 - Xml::submitButton(
228 - wfMsgHtml( 'centralnotice-modify' ),
229 - array(
230 - 'id' => 'centralnoticesubmit',
231 - 'name' => 'centralnoticesubmit'
232 - )
233 - )
234 - )
 333+ /*
 334+ * Show edit form
 335+ */
 336+ $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 337+ $htmlOut .= Xml::fieldset( wfMsgHtml( 'centralnotice-edit-template' ) );
 338+ $htmlOut .= Xml::hidden( 'wpMethod', 'editTemplate' );
 339+ $htmlOut .= Xml::openElement( 'table',
 340+ array(
 341+ 'cellpadding' => 9,
 342+ 'width' => '100%'
 343+ )
 344+ );
 345+ $htmlOut .= Xml::tags( 'tr', null,
 346+ Xml::tags( 'td', null, Xml::textarea( 'templateBody', $body, 60, 20 ) )
 347+ );
 348+ $htmlOut .= Xml::tags( 'tr', null,
 349+ Xml::tags( 'td', null, Xml::submitButton( wfMsgHtml('centralnotice-modify') ) )
 350+ );
 351+ $htmlOut .= Xml::closeElement( 'table' );
 352+ $htmlOut .= Xml::closeElement( 'fieldset' );
 353+ $htmlOut .= Xml::closeElement( 'form' );
 354+
 355+ // Output HTML
 356+ $wgOut->addHTML( $htmlOut );
 357+ }
 358+
 359+ private function updateMessage( $text, $translation, $lang, $token ) {
 360+ global $wgUser;
 361+
 362+ $title = Title::newFromText(
 363+ ( $lang == 'en' ) ? "Centralnotice-{$text}" : "Centralnotice-{$text}/{$lang}",
 364+ NS_MEDIAWIKI
 365+ );
 366+ $article = new Article( $title );
 367+ $article->doEdit( $translation, '' );
 368+ }
 369+
 370+ static function queryTemplates() {
 371+ $dbr = wfGetDB( DB_SLAVE );
 372+ $res = $dbr->select( 'cn_templates',
 373+ array( 'tmp_name', 'tmp_id' ),
 374+ '',
 375+ __METHOD__,
 376+ array( 'ORDER BY' => 'tmp_id' )
 377+ );
 378+
 379+ $templates = array();
 380+ while ( $row = $dbr->fetchObject( $res ) ) {
 381+ array_push( $templates, $row->tmp_name );
 382+ }
 383+
 384+ return $templates;
 385+ }
 386+
 387+ private function getTemplateId ( $templateName ) {
 388+ global $wgOut, $egCentralNoticeTables;
 389+
 390+ $dbr = wfGetDB( DB_SLAVE );
 391+ $res = $dbr->select( 'cn_templates', 'tmp_id',
 392+ array( 'tmp_name' => $templateName ),
 393+ __METHOD__
 394+ );
 395+
 396+ $row = $dbr->fetchObject( $res );
 397+ if( $row ) {
 398+ return $row->tmp_id;
 399+ }
 400+ return null;
 401+ }
 402+
 403+ private function removeTemplate ( $name ) {
 404+ global $wgOut, $egCentralNoticeTables;
 405+
 406+ if ( $name == '' ) {
 407+ $wgOut->addHtml( wfMsg( 'centralnotice-template-doesnt-exist' ) );
 408+ return;
 409+ }
 410+
 411+ $id = $this->getTemplateId( $name );
 412+ $dbr = wfGetDB( DB_SLAVE );
 413+ $res = $dbr->select( 'cn_assignments', 'asn_id', array( 'tmp_id' => $id ), __METHOD__ );
 414+
 415+ if ( $dbr->numRows( $res ) > 0 ) {
 416+ $wgOut->addHtml( wfMsg( 'centralnotice-template-still-bound' ) );
 417+ return;
 418+ } else {
 419+ $dbw = wfGetDB( DB_MASTER );
 420+ $res = $dbw->delete( 'cn_templates',
 421+ array( 'tmp_id' => $id ),
 422+ __METHOD__
235423 );
236 - $form .= Xml::tags( 'tr', null,
237 - Xml::tags( 'td', null,
238 - Xml::submitButton(
239 - wfMsgHtml( 'centralnotice-preview' ),
240 - array(
241 - 'id' => 'centralnoticepreview',
242 - 'name' => 'centralnoticepreview'
243 - )
244 - )
245 - )
 424+
 425+ $article = new Article(
 426+ Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI )
246427 );
 428+ $article->doDelete( 'CentralNotice Automated Removal', true );
247429 }
248 - $wgOut->addHTML( $form );
249430 }
250431
251 - function addTemplate ( $name, $body ) {
 432+ private function addTemplate ( $name, $body ) {
252433 global $wgOut, $egCentralNoticeTables;
253434
254435 if ( $body == '' || $name == '' ) {
@@ -284,81 +465,30 @@
285466 return;
286467 }
287468 }
288 -
289 - function removeTemplate ( $templateName ) {
 469+
 470+ private function editTemplate ( $name, $body ) {
290471 global $wgOut, $egCentralNoticeTables;
291 -
292 - if ( $templateName == '' ) {
293 - $wgOut->addHtml( wfMsg( 'centralnotice-template-doesnt-exist' ) );
 472+
 473+ if ( $body == '' || $name == '' ) {
 474+ $wgOut->addHtml( wfMsg( 'centralnotice-null-string' ) );
294475 return;
295476 }
296477
297 - $templateId = $this->getTemplateId( $templateName );
298478 $dbr = wfGetDB( DB_SLAVE );
299 - $res = $dbr->select( 'cn_assignments', 'asn_id',
300 - array( 'tmp_id' => $templateId ),
 479+ $res = $dbr->select( 'cn_templates', 'tmp_name',
 480+ array( 'tmp_name' => $name ),
301481 __METHOD__
302482 );
303483
304 - if ( $dbr->numRows( $res ) > 0 ) {
305 - $wgOut->addHtml( wfMsg( 'centralnotice-template-still-bound' ) );
 484+ if ( $dbr->numRows( $res ) > 0 ) {
 485+ /*
 486+ * Perhaps these should move into the db as blob
 487+ */
 488+ $article = new Article(
 489+ Title::newFromText( "centralnotice-template-{$name}", NS_MEDIAWIKI )
 490+ );
 491+ $article->doEdit( $body, '' );
306492 return;
307 - } else {
308 - $dbw = wfGetDB( DB_MASTER );
309 - $res = $dbw->delete( 'cn_templates',
310 - array( 'tmp_id' => $templateId ),
311 - __METHOD__
312 - );
313493 }
314494 }
315 -
316 - function getTemplateId ( $templateName ) {
317 - global $wgOut, $egCentralNoticeTables;
318 -
319 - $dbr = wfGetDB( DB_SLAVE );
320 - $res = $dbr->select( 'cn_templates', 'tmp_id',
321 - array( 'tmp_name' => $templateName ),
322 - __METHOD__
323 - );
324 -
325 - $row = $dbr->fetchObject( $res );
326 - if( $row ) {
327 - return $row->tmp_id;
328 - }
329 - return null;
330 - }
331 -
332 - public static function previewTemplate ( $template, $userLang ) {
333 - $render = new SpecialNoticeText();
334 - $render->project = 'wikipedia';
335 - $render->language = $userLang;
336 - $htmlOut = Xml::fieldset( wfMsg( 'centralnotice-preview' ),
337 - $render->getHtmlNotice( $template )
338 - );
339 - $htmlOut .= Xml::openElement( 'form',
340 - array (
341 - 'method' => 'post',
342 - 'action' => SpecialPage::getTitleFor( 'NoticeTemplate','preview' )->getLocalUrl( "template=$template")
343 - )
344 - );
345 - list( $lsLabel, $lsSelect) = Xml::languageSelector( $userLang );
346 - $htmlOut .= Xml::tags( 'tr', null,
347 - Xml::tags( 'td', null, $lsLabel ) .
348 - Xml::tags( 'td', null, $lsSelect )
349 - );
350 - $htmlOut .= Xml::tags( 'tr', null,
351 - Xml::tags( 'td', null,
352 - Xml::submitButton( wfMsgHtml('centralnotice-modify'),
353 - array(
354 - 'id' => 'centralnoticesubmit',
355 - 'name' => 'centralnoticesubmit'
356 - )
357 - )
358 - )
359 - );
360 - $htmlOut .= Xml::closeElement( 'form');
361 -
362 - return $htmlOut;
363 -
364 - }
365495 }
Index: branches/CentralNotice-SpecialPage-Integration/CentralNotice.i18n.php
@@ -38,6 +38,7 @@
3939 'centralnotice-locked' => 'Locked',
4040 'centralnotice-notices' => 'Notices',
4141 'centralnotice-notice-exists' => 'Notice already exists. Not adding',
 42+ 'centralnotice-template-exists' => 'Template already exists. Not adding',
4243 'centralnotice-notice-doesnt-exist' => 'Notice doesnt exist. Nothing to remove',
4344 'centralnotice-template-still-bound' => 'Template is still bound to a notice. Not removing.',
4445 'centralnotice-template-body' => 'Template Body: ',
@@ -67,7 +68,7 @@
6869 'centralnotice-no-templates-translate' => 'There are not any templates to edit translations for',
6970 'centralnotice-no-templates' => 'There are no templates in the system. Create one',
7071 'centralnotice-number-uses' => 'Uses',
71 - 'centralnotice-edit' => 'Edit',
 72+ 'centralnotice-edit-template' => 'Edit Template',
7273 'centralnotice-message' => 'Message',
7374 );
7475

Status & tagging log