Extension:CentralNotice

CentralNotice adds the possibility to manage sitenotices from one central wiki. If you only need to post one global message (sitenotice) to a single wiki, you may want to use MediaWiki:Sitenotice instead.

Installation

 * 1) Download the latest snapshot and extract it to your extensions directory.
 * 2) From the wiki root, run php maintenance/sql.php extensions/CentralNotice/CentralNotice.sql
 * 3) Add  to LocalSettings.php.
 * 4) The extension should now be active.

Design
The CentralNotice system consists of both campaigns (a.k.a. notices) and banners (a.k.a. templates).


 * Banner - a single block of text/css/image that will display at the top of all set wiki pages.
 * Campaign - a collection of banners that are set to show according to a specified weight. You can configure as many campaigns at the same time as you want and each one will show with its configured banners at their own weighted percentages.
 * Preferred - A campaign with preferred set will always replace any other campaigns that happens to have the same language & wiki combo.
 * Locked - A locked notice can not be deleted unless it is unlocked.
 * Enabled - only campaigns that are enabled will show banners.

Required Settings

 * wgNoticeInfrastructure - Set to true on the controller wiki (the wiki you will be managing the campaigns from). Set to false on your target wikis.
 * wgCentralDBname - The name of the database for the controller wiki. (This is needed so that the target wikis can retrieve banners from the controller wiki.)

New Banner

 * 1) Load Special:NoticeTemplate
 * 2) Click on the add banner link at the bottom of the page (must be logged in as an admin).
 * 3) Enter in a name and the raw HTML for the given banner.
 * 4) If this banner is going to be translated then enclose any text to be translated with triple parens -.
 * 5) Submit

New Campaign

 * Each banner has its banner definition stored in MediaWiki:Centralnotice-template-
 * All of its messages are stored below the banner def ala MediaWiki:Centralnotice-template- - /


 * 1) Load Special:CentralNotice
 * 2) Add a campaign with a given start time at the bottom portion of the page and click submit.
 * 3) If this campaign is only run on a specific wiki and or language then select it from the pull downs.
 * 4) Click on the new campaign and add the banners you want within this running campaign and their respective weights.
 * 5) If all looks well then set this campaign to enabled and it will show at the corresponding time.

Shared messages
It was quickly realized that we were duplicating work when messages were copied over for such strings as Hide to each banner. Instead of this, the accepted practice to is to use a shared message for commonly used messages. Then use the following to reference it: Note only 2 curly brackets.

If there is a need to only do this for two banners then you might want to use the clone feature at the bottom of any banner page.

Testing
You can test-load any banner on any wiki by adding ?banner= to the end of the URL.

You can simulate loading a wiki page from any country (to test campaign geotargeting) by adding ?country= to the end of the URL. (Use the 2-letter ISO 3166-1 code.)

Developer documentation
CentralNotice consists of the following files:
 * 1x1.png - image used by SpecialHideBanners.php to load banner-hiding cookie
 * CentralNotice.alias.php - the aliases for all of the special pages
 * CentralNotice.db.php - static functions for retrieving campaigns and banners from the database
 * CentralNotice.i18n.php - localized messages
 * CentralNotice.php - configuration, special page registration, hook functions
 * CentralNotice.sql - database set-up
 * SpecialBannerAllocation.php - special page for viewing banner allocation
 * SpecialBannerController.php - generates Javascript file which controls banner selection on the client side
 * SpecialBannerListLoader.php
 * SpecialBannerLoader.php
 * SpecialCentralNotice.php
 * SpecialHideBanners.php
 * SpecialNoticeTemplate.php
 * TemplatePager.php
 * centralnotice.css
 * centralnotice.js
 * down-arrow.png
 * up-arrow.png
 * Several SQL patch files

Development

 * /Phase 2 - Completed
 * /Phase 3 - Completed