http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73240
Revision: 73240
Author: kaldari
Date: 2010-09-17 18:54:40 +0000 (Fri, 17 Sep 2010)
Log Message:
-----------
beginning support for viewing banner allocation
Modified Paths:
--------------
trunk/extensions/CentralNotice/CentralNotice.i18n.php
trunk/extensions/CentralNotice/CentralNotice.php
trunk/extensions/CentralNotice/SpecialCentralNotice.php
Added Paths:
-----------
trunk/extensions/CentralNotice/SpecialBannerAllocation.php
Modified: trunk/extensions/CentralNotice/CentralNotice.i18n.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.i18n.php 2010-09-17
18:45:53 UTC (rev 73239)
+++ trunk/extensions/CentralNotice/CentralNotice.i18n.php 2010-09-17
18:54:40 UTC (rev 73240)
@@ -11,7 +11,8 @@
$messages['en'] = array(
'centralnotice' => 'Central notice admin',
- 'noticetemplate' => 'Central notice banner',
+ 'noticetemplate' => 'Central notice banners',
+ 'bannerallocation' => 'Central notice banner allocation',
'centralnotice-desc' => 'Adds a central sitenotice',
'centralnotice-summary' => 'This module allows you to edit your
currently setup central notices.
It can also be used to add or remove old notices.',
@@ -122,6 +123,7 @@
'centralnotice-banner-collapsible' => 'Collapsible',
'centralnotice-geotargeted' => 'Geotargeted',
'centralnotice-countries' => 'Countries',
+ 'centralnotice-allocation' => 'Allocation',
'right-centralnotice-admin' => 'Manage central notices',
'right-centralnotice-translate' => 'Translate central notices',
Modified: trunk/extensions/CentralNotice/CentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/CentralNotice.php 2010-09-17 18:45:53 UTC
(rev 73239)
+++ trunk/extensions/CentralNotice/CentralNotice.php 2010-09-17 18:54:40 UTC
(rev 73240)
@@ -104,6 +104,9 @@
$wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
$wgAutoloadClasses['SpecialNoticeTemplate'] = $dir .
'SpecialNoticeTemplate.php';
+ $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
+ $wgAutoloadClasses['SpecialBannerAllocation'] = $dir .
'SpecialBannerAllocation.php';
+
$wgAutoloadClasses['CentralNoticeDB'] = $dir .
'CentralNotice.db.php';
$wgAutoloadClasses['TemplatePager'] = $dir .
'TemplatePager.php';
}
Added: trunk/extensions/CentralNotice/SpecialBannerAllocation.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialBannerAllocation.php
(rev 0)
+++ trunk/extensions/CentralNotice/SpecialBannerAllocation.php 2010-09-17
18:54:40 UTC (rev 73240)
@@ -0,0 +1,88 @@
+<?php
+
+if ( !defined( 'MEDIAWIKI' ) ) {
+ echo "CentralNotice extension\n";
+ exit( 1 );
+}
+
+class SpecialBannerAllocation extends UnlistedSpecialPage {
+ var $centralNoticeError;
+
+ function __construct() {
+ // Register special page
+ parent::__construct( "BannerAllocation" );
+
+ // Internationalization
+ wfLoadExtensionMessages( 'CentralNotice' );
+ }
+
+ /**
+ * Handle different types of page requests
+ */
+ function execute( $sub ) {
+ global $wgOut, $wgUser, $wgRequest, $wgScriptPath;
+
+ // Begin output
+ $this->setHeaders();
+
+ // Add style file to the output headers
+ $wgOut->addExtensionStyle(
"$wgScriptPath/extensions/CentralNotice/centralnotice.css" );
+
+ // Add script file to the output headers
+ $wgOut->addScriptFile(
"$wgScriptPath/extensions/CentralNotice/centralnotice.js" );
+
+ // Initialize error variable
+ $this->centralNoticeError = false;
+
+ // Show summary
+ $wgOut->addWikiMsg( 'centralnotice-summary' );
+
+ // Show header
+ CentralNotice::printHeader();
+
+ // Begin Banners tab content
+ $wgOut->addHTML( Xml::openElement( 'div', array( 'id' =>
'preferences' ) ) );
+
+ $htmlOut = '';
+
+ // Begin Allocation selection fieldset
+ $htmlOut .= Xml::openElement( 'fieldset', array( 'class' =>
'prefsection' ) );
+
+ $htmlOut .= 'Coming soon!';
+
+ // End Allocation selection fieldset
+ $htmlOut .= Xml::closeElement( 'fieldset' );
+
+ $wgOut->addHTML( $htmlOut );
+
+ // Handle form submissions
+ if ( $wgRequest->wasPosted() ) {
+
+ // Show list of banners by default
+ $this->showList();
+
+ }
+
+ // End Banners tab content
+ $wgOut->addHTML( Xml::closeElement( 'div' ) );
+ }
+
+ /**
+ * Show a list of banners with allocation. Newer banners are shown
first.
+ */
+ function showList() {
+ // Begin building HTML
+ $htmlOut = '';
+
+ // Begin Allocation list fieldset
+ $htmlOut .= Xml::openElement( 'fieldset', array( 'class' =>
'prefsection' ) );
+
+ $htmlOut .= "List goes here";
+
+ // End Allocation list fieldset
+ $htmlOut .= Xml::closeElement( 'fieldset' );
+
+ $wgOut->addHTML( $htmlOut );
+ }
+
+}
Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-17
18:45:53 UTC (rev 73239)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-17
18:54:40 UTC (rev 73240)
@@ -179,7 +179,8 @@
$pages = array(
'CentralNotice' => wfMsg( 'centralnotice-notices' ),
- 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' )
+ 'NoticeTemplate' => wfMsg ( 'centralnotice-templates' ),
+ 'BannerAllocation' => wfMsg (
'centralnotice-allocation' )
);
$htmlOut = Xml::openElement( 'ul', array( 'id' => 'preftoc' ) );
foreach ( $pages as $page => $msg ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs