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) Run 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 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. This is currently only available for EN wiki.
 * Locked - A locked notice can not be deleted unless it is unset.
 * 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.

Special variables
There are a couple of special variables available for use in banners (or within translated banner messages).
 * $sitename - This outputs the name of the local wiki, for example "Wiktionary". $sitename replaces the use of the magic word which is no longer supported.
 * $amount - This outputs the current amount of money raised, in millions of dollars, during a fundraiser. The amount is pulled from whatever URL is assigned to $wgNoticeCounterSource in CentralNotice.php (usually http://donate.wikimedia.org/counter.php).

These variables are case-sensitive but can be placed directly next to other text, for example "foo$sitenamebar".

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.)

Development

 * /Phase 2
 * /Phase 3