Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -119,6 +119,9 @@ |
120 | 120 | |
121 | 121 | $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation'; |
122 | 122 | $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php'; |
| 123 | + |
| 124 | + $wgSpecialPages['CentralNoticeLogs'] = 'SpecialCentralNoticeLogs'; |
| 125 | + $wgAutoloadClasses['SpecialCentralNoticeLogs'] = $dir . 'SpecialCentralNoticeLogs.php'; |
123 | 126 | } |
124 | 127 | } |
125 | 128 | |
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -169,6 +169,9 @@ |
170 | 170 | $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
171 | 171 | } |
172 | 172 | |
| 173 | + /** |
| 174 | + * Output the tabs for the different CentralNotice interfaces (Allocation, Logs, etc.) |
| 175 | + */ |
173 | 176 | public static function printHeader() { |
174 | 177 | global $wgOut, $wgTitle, $wgUser; |
175 | 178 | $sk = $wgUser->getSkin(); |
— | — | @@ -176,7 +179,8 @@ |
177 | 180 | $pages = array( |
178 | 181 | 'CentralNotice' => wfMsg( 'centralnotice-notices' ), |
179 | 182 | 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ), |
180 | | - 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' ) |
| 183 | + 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' ), |
| 184 | + 'CentralNoticeLogs' => wfMsg ( 'centralnotice-logs' ) |
181 | 185 | ); |
182 | 186 | $htmlOut = Xml::openElement( 'ul', array( 'id' => 'preftoc' ) ); |
183 | 187 | foreach ( $pages as $page => $msg ) { |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | 'centralnotice' => 'Central notice admin', |
15 | 15 | 'noticetemplate' => 'Central notice admin', |
16 | 16 | 'bannerallocation' => 'Central notice admin', |
| 17 | + 'centralnoticelogs' => 'Central notice admin', |
17 | 18 | 'right-centralnotice-admin' => 'Manage central notices', |
18 | 19 | 'action-centralnotice-admin' => 'manage central notices', |
19 | 20 | 'centralnotice-desc' => 'Adds a central sitenotice', |
— | — | @@ -143,6 +144,8 @@ |
144 | 145 | 'centralnotice-percentage' => 'Percentage', |
145 | 146 | 'centralnotice-documentwrite-error' => "document.write() cannot be used within a banner.\nSee http://meta.wikimedia.org/wiki/Help:CentralNotice for more information.", |
146 | 147 | 'centralnotice-preferred' => 'Preferred', |
| 148 | + 'centralnotice-logs' => 'Logs', |
| 149 | + 'centralnotice-view-logs' => 'View logs', |
147 | 150 | ); |
148 | 151 | |
149 | 152 | /** Message documentation (Message documentation) |
— | — | @@ -163,6 +166,7 @@ |
164 | 167 | 'centralnotice' => 'Name of Special:CentralNotice in Special:SpecialPages and title of Special:CentralNotice page', |
165 | 168 | '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.)', |
166 | 169 | '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.)', |
167 | 171 | 'right-centralnotice-admin' => '{{doc-right}}', |
168 | 172 | 'action-centralnotice-admin' => '{{doc-action}}', |
169 | 173 | 'centralnotice-desc' => '{{desc}}', |
— | — | @@ -212,6 +216,7 @@ |
213 | 217 | * $1 is the language code for the site (e.g "en"). |
214 | 218 | * $2 is the project name for the site (e.g. "wikipedia"). |
215 | 219 | * $3 is the country code (e.g. "US").', |
| 220 | + 'centralnotice-logs' => 'Label for tab which displays a log of changes', |
216 | 221 | ); |
217 | 222 | |
218 | 223 | /** 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 | +} |