Extension:PopupPages

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
PopupPages

Release status: beta

Implementation MyWiki
Description This extension displays a "popup" panel when a page is displayed, depending on related display-policies. Required __NOCACHE__ on the page.
Author(s) John McClure
Latest version 1.0 (March 1, 2013)
MediaWiki 1.19+
PHP 5.3+
Database changes no
License GNU GENERAL PUBLIC LICENSE, Version 2, June 1991
Download
Example example
Hooks used
LanguageGetMagic

Translate the PopupPages extension if possible

Check usage and version matrix; code metrics

PopupPages is an extension that provides three parser functions to (a) display another wiki page within the page containing the parser function, in a "policy"-based manner (b) closes the panel optionally creating a user-cookie and (c) creates (or removes) a cookie if the user clicks a checkbox.

Display Policies[edit | edit source]

Display policies determine which users are to see the popup. Policies are specified on the {{#popup:}} parser function, e.g.

{{#popup:|policy=cookie-out,groups-out}}
cookie-out
if the user has a certain cookie, then the popup is NOT displayed to the user
cookie-in
if the user has a certain cookie, then the popup IS displayed to the user
groups-out
if the user is a member of any designated group, then the popup is NOT displayed to the user
groups-in
if the user is a member of any designated group, then the popup IS displayed to the user

Parser Functions[edit | edit source]

{{#popup:page |class= |popupID= |policy= |cookieName= |cookieValue= |groups= }}
  • page - the name of the page to be transcluded (ie formatted) as a popup. Default= 'Mediawiki:PopupPage Default'
  • class - the class to be assigned to the popup container. Default= popupPanel
  • popupID - the id to be assigned to the popup container. Default= none
  • policy - comma-separated list of policies for the popup. Default= cookie-out, group-out
  • cookieName - case-sensitive name of a cookie to be tested against policy. Default=PopupPage
  • cookieValue - a value to be tested against policy. Default= PopupPage
  • groups - comma-separated list of user-groups for a policy. Default= none
Note: This parser function is normally used once on a transcluding page, allowing all users to opt-out. However multiple instances of this function may appear on the transcluding page, each testing different cookies or user groups.
Note: Every transcluding page must have the __NOCACHE__ magic word.
{{#popup-putter:checkbox label |class= |putterID= |cookieName= |cookieValue= |cookieDays= }}
  • checkbox label - a label placed to the right of a checkbox. Default= Opt-out of this message
  • class - the class to be assigned to the button container. Default= popupPutter
  • putterID - the token to be assigned to the checkbox container. Default= popupPutter
  • cookieName - case-sensitive name of a cookie to be created or removed. Default=PopupPage
  • cookieValue - a value to be stored for the cookie. Default= PopupPage
  • cookieDays - the lifetime for the cookie. Default= 1
Note: This parser function is used on the transcluded page. Multiple cookie-setting checkboxes may appear on a page, each setting different cookies.
{{#popup-closer:button label |class= |popupClass= |cookieName= |cookieValue= |cookieDays= }}
  • button label - a label for the button. Default= Close message
  • class - the class to be assigned to the checkbox container. Default= popupCloseButton
  • popupClass - the class of the parent element that is to be closed. Default= popupPanel
  • cookieName - case-sensitive name of a cookie to be created by button cick. Default=none
  • cookieValue - a value to be stored for the cookie upon button-click. Default= none
  • cookieDays - the lifetime for the cookie. Default= 1
Note: This parser function is normally used once on a transcluded page, to simply close the popup. Multiple close-buttons may exist, each setting different cookies.

Setup[edit | edit source]

To install PopupPages, please follow the steps indicated below.

Download instructions
The latest release may be found at https://gerrit.wikimedia.org/r/#/admin/projects/mediawiki/extensions/PopupPages.
Prerequisites
Extension:MagicNoCache - the transcluding page must have the __NOCACHE__ magic word.
Copy Files
Extract the downloaded archive into folder $IP/extensions/PopupPages/
LocalSettings.php
Add the following to LocalSettings.php:
include_once("$IP/extensions/PopupPages/PopupPages.php");

See also[edit | edit source]