Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -104,6 +104,9 @@ |
105 | 105 | $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate'; |
106 | 106 | $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php'; |
107 | 107 | |
| 108 | + $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation'; |
| 109 | + $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php'; |
| 110 | + |
108 | 111 | $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php'; |
109 | 112 | $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php'; |
110 | 113 | } |
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -179,7 +179,8 @@ |
180 | 180 | |
181 | 181 | $pages = array( |
182 | 182 | 'CentralNotice' => wfMsg( 'centralnotice-notices' ), |
183 | | - 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ) |
| 183 | + 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ), |
| 184 | + 'BannerAllocation' => wfMsg ( 'centralnotice-allocation' ) |
184 | 185 | ); |
185 | 186 | $htmlOut = Xml::openElement( 'ul', array( 'id' => 'preftoc' ) ); |
186 | 187 | foreach ( $pages as $page => $msg ) { |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -11,7 +11,8 @@ |
12 | 12 | |
13 | 13 | $messages['en'] = array( |
14 | 14 | 'centralnotice' => 'Central notice admin', |
15 | | - 'noticetemplate' => 'Central notice banner', |
| 15 | + 'noticetemplate' => 'Central notice banners', |
| 16 | + 'bannerallocation' => 'Central notice banner allocation', |
16 | 17 | 'centralnotice-desc' => 'Adds a central sitenotice', |
17 | 18 | 'centralnotice-summary' => 'This module allows you to edit your currently setup central notices. |
18 | 19 | It can also be used to add or remove old notices.', |
— | — | @@ -122,6 +123,7 @@ |
123 | 124 | 'centralnotice-banner-collapsible' => 'Collapsible', |
124 | 125 | 'centralnotice-geotargeted' => 'Geotargeted', |
125 | 126 | 'centralnotice-countries' => 'Countries', |
| 127 | + 'centralnotice-allocation' => 'Allocation', |
126 | 128 | |
127 | 129 | 'right-centralnotice-admin' => 'Manage central notices', |
128 | 130 | 'right-centralnotice-translate' => 'Translate central notices', |
Index: trunk/extensions/CentralNotice/SpecialBannerAllocation.php |
— | — | @@ -0,0 +1,88 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 5 | + echo "CentralNotice extension\n"; |
| 6 | + exit( 1 ); |
| 7 | +} |
| 8 | + |
| 9 | +class SpecialBannerAllocation extends UnlistedSpecialPage { |
| 10 | + var $centralNoticeError; |
| 11 | + |
| 12 | + function __construct() { |
| 13 | + // Register special page |
| 14 | + parent::__construct( "BannerAllocation" ); |
| 15 | + |
| 16 | + // Internationalization |
| 17 | + wfLoadExtensionMessages( 'CentralNotice' ); |
| 18 | + } |
| 19 | + |
| 20 | + /** |
| 21 | + * Handle different types of page requests |
| 22 | + */ |
| 23 | + function execute( $sub ) { |
| 24 | + global $wgOut, $wgUser, $wgRequest, $wgScriptPath; |
| 25 | + |
| 26 | + // Begin output |
| 27 | + $this->setHeaders(); |
| 28 | + |
| 29 | + // Add style file to the output headers |
| 30 | + $wgOut->addExtensionStyle( "$wgScriptPath/extensions/CentralNotice/centralnotice.css" ); |
| 31 | + |
| 32 | + // Add script file to the output headers |
| 33 | + $wgOut->addScriptFile( "$wgScriptPath/extensions/CentralNotice/centralnotice.js" ); |
| 34 | + |
| 35 | + // Initialize error variable |
| 36 | + $this->centralNoticeError = false; |
| 37 | + |
| 38 | + // Show summary |
| 39 | + $wgOut->addWikiMsg( 'centralnotice-summary' ); |
| 40 | + |
| 41 | + // Show header |
| 42 | + CentralNotice::printHeader(); |
| 43 | + |
| 44 | + // Begin Banners tab content |
| 45 | + $wgOut->addHTML( Xml::openElement( 'div', array( 'id' => 'preferences' ) ) ); |
| 46 | + |
| 47 | + $htmlOut = ''; |
| 48 | + |
| 49 | + // Begin Allocation selection fieldset |
| 50 | + $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
| 51 | + |
| 52 | + $htmlOut .= 'Coming soon!'; |
| 53 | + |
| 54 | + // End Allocation selection fieldset |
| 55 | + $htmlOut .= Xml::closeElement( 'fieldset' ); |
| 56 | + |
| 57 | + $wgOut->addHTML( $htmlOut ); |
| 58 | + |
| 59 | + // Handle form submissions |
| 60 | + if ( $wgRequest->wasPosted() ) { |
| 61 | + |
| 62 | + // Show list of banners by default |
| 63 | + $this->showList(); |
| 64 | + |
| 65 | + } |
| 66 | + |
| 67 | + // End Banners tab content |
| 68 | + $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * Show a list of banners with allocation. Newer banners are shown first. |
| 73 | + */ |
| 74 | + function showList() { |
| 75 | + // Begin building HTML |
| 76 | + $htmlOut = ''; |
| 77 | + |
| 78 | + // Begin Allocation list fieldset |
| 79 | + $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
| 80 | + |
| 81 | + $htmlOut .= "List goes here"; |
| 82 | + |
| 83 | + // End Allocation list fieldset |
| 84 | + $htmlOut .= Xml::closeElement( 'fieldset' ); |
| 85 | + |
| 86 | + $wgOut->addHTML( $htmlOut ); |
| 87 | + } |
| 88 | + |
| 89 | +} |