r90503 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90502‎ | r90503 | r90504 >
Date:00:38, 21 June 2011
Author:kaldari
Status:ok
Tags:
Comment:
setting up new tab for CentralNotice logs - no logs to actually display yet
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.i18n.php (modified) (history)
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialCentralNoticeLogs.php (added) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -119,6 +119,9 @@
120120
121121 $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
122122 $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php';
 123+
 124+ $wgSpecialPages['CentralNoticeLogs'] = 'SpecialCentralNoticeLogs';
 125+ $wgAutoloadClasses['SpecialCentralNoticeLogs'] = $dir . 'SpecialCentralNoticeLogs.php';
123126 }
124127 }
125128
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -169,6 +169,9 @@
170170 $wgOut->addHTML( Xml::closeElement( 'div' ) );
171171 }
172172
 173+ /**
 174+ * Output the tabs for the different CentralNotice interfaces (Allocation, Logs, etc.)
 175+ */
173176 public static function printHeader() {
174177 global $wgOut, $wgTitle, $wgUser;
175178 $sk = $wgUser->getSkin();
@@ -176,7 +179,8 @@
177180 $pages = array(
178181 'CentralNotice' => wfMsg( 'centralnotice-notices' ),
179182 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ),
180 - 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' )
 183+ 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' ),
 184+ 'CentralNoticeLogs' => wfMsg ( 'centralnotice-logs' )
181185 );
182186 $htmlOut = Xml::openElement( 'ul', array( 'id' => 'preftoc' ) );
183187 foreach ( $pages as $page => $msg ) {
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php
@@ -13,6 +13,7 @@
1414 'centralnotice' => 'Central notice admin',
1515 'noticetemplate' => 'Central notice admin',
1616 'bannerallocation' => 'Central notice admin',
 17+ 'centralnoticelogs' => 'Central notice admin',
1718 'right-centralnotice-admin' => 'Manage central notices',
1819 'action-centralnotice-admin' => 'manage central notices',
1920 'centralnotice-desc' => 'Adds a central sitenotice',
@@ -143,6 +144,8 @@
144145 'centralnotice-percentage' => 'Percentage',
145146 'centralnotice-documentwrite-error' => "document.write() cannot be used within a banner.\nSee http://meta.wikimedia.org/wiki/Help:CentralNotice for more information.",
146147 'centralnotice-preferred' => 'Preferred',
 148+ 'centralnotice-logs' => 'Logs',
 149+ 'centralnotice-view-logs' => 'View logs',
147150 );
148151
149152 /** Message documentation (Message documentation)
@@ -163,6 +166,7 @@
164167 'centralnotice' => 'Name of Special:CentralNotice in Special:SpecialPages and title of Special:CentralNotice page',
165168 'noticetemplate' => 'Title of Special:NoticeTemplate page, should be identical to centralnotice message. (Since the extension uses a secondary tab interface, the effective page title is actually centralnotice-manage-templates.)',
166169 'bannerallocation' => 'Title of Special:BannerAllocation page, should be identical to centralnotice message. (Since the extension uses a secondary tab interface, the effective page title is actually centralnotice-view-allocation.)',
 170+ 'centralnoticelogs' => 'Title of Special:CentralNoticeLogs page, should be identical to centralnotice message. (Since the extension uses a secondary tab interface, the effective page title is actually centralnotice-view-logs.)',
167171 'right-centralnotice-admin' => '{{doc-right}}',
168172 'action-centralnotice-admin' => '{{doc-action}}',
169173 'centralnotice-desc' => '{{desc}}',
@@ -212,6 +216,7 @@
213217 * $1 is the language code for the site (e.g "en").
214218 * $2 is the project name for the site (e.g. "wikipedia").
215219 * $3 is the country code (e.g. "US").',
 220+ 'centralnotice-logs' => 'Label for tab which displays a log of changes',
216221 );
217222
218223 /** Afrikaans (Afrikaans)
Index: trunk/extensions/CentralNotice/SpecialCentralNoticeLogs.php
@@ -0,0 +1,78 @@
 2+<?php
 3+
 4+if ( !defined( 'MEDIAWIKI' ) ) {
 5+ echo "CentralNotice extension\n";
 6+ exit( 1 );
 7+}
 8+
 9+class SpecialCentralNoticeLogs extends UnlistedSpecialPage {
 10+ public $logType = 'campaignsettings';
 11+
 12+ function __construct() {
 13+ // Register special page
 14+ parent::__construct( "CentralNoticeLogs" );
 15+ }
 16+
 17+ /**
 18+ * Handle different types of page requests
 19+ */
 20+ function execute( $sub ) {
 21+ global $wgOut, $wgRequest, $wgExtensionAssetsPath;
 22+
 23+ if ( $wgRequest->wasPosted() ) {
 24+ $this->logType = $wgRequest->getText( 'log', 'campaignsettings' );
 25+ }
 26+
 27+ // Begin output
 28+ $this->setHeaders();
 29+
 30+ // Add style file to the output headers
 31+ $wgOut->addExtensionStyle( "$wgExtensionAssetsPath/CentralNotice/centralnotice.css" );
 32+
 33+ // Add script file to the output headers
 34+ $wgOut->addScriptFile( "$wgExtensionAssetsPath/CentralNotice/centralnotice.js" );
 35+
 36+ // Initialize error variable
 37+ $this->centralNoticeError = false;
 38+
 39+ // Show summary
 40+ $wgOut->addWikiMsg( 'centralnotice-summary' );
 41+
 42+ // Show header
 43+ CentralNotice::printHeader();
 44+
 45+ // Begin Banners tab content
 46+ $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'preferences' ) ) );
 47+
 48+ $htmlOut = '';
 49+
 50+ // Begin Allocation selection fieldset
 51+ $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
 52+
 53+ $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) );
 54+ $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-view-logs' ) );
 55+ $htmlOut .= Xml::closeElement( 'form' );
 56+
 57+ // End Allocation selection fieldset
 58+ $htmlOut .= Xml::closeElement( 'fieldset' );
 59+
 60+ $wgOut->addHTML( $htmlOut );
 61+
 62+ $this->showLog( $this->logType );
 63+
 64+ // End Banners tab content
 65+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
 66+ }
 67+
 68+ /**
 69+ * Show a log.
 70+ */
 71+ function showLog( $logType ) {
 72+ global $wgOut;
 73+
 74+ $htmlOut = '';
 75+
 76+ $wgOut->addHTML( $htmlOut );
 77+ }
 78+
 79+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r90539Followup r90503: Register new special page in alias file too.raymond18:03, 21 June 2011

Status & tagging log