Module:Protection banner/config: Difference between revisions
more conversion of the data to the bannerConfig table
(use a new approach to the banner config, allowing more fine-grained control and less hopping around between parameter definitions) |
(more conversion of the data to the bannerConfig table) |
||
Line 4: | Line 4: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- BANNER DATA | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 84: | Line 84: | ||
-- | -- | ||
-- | -- | ||
-- | -- PARAMETERS | ||
-- | -- | ||
-- The values in the banner data can take parameters. These are specified | -- The values in the banner data can take parameters. These are specified | ||
Line 93: | Line 93: | ||
-- Defined in the cfg.pagetypes table. | -- Defined in the cfg.pagetypes table. | ||
-- | -- | ||
-- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or | |||
-- "semi-protected". | |||
-- | -- | ||
-- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If | |||
-- protection is indefinite or is not set, this is the blank string. | |||
-- | |||
-- ${EDITREQUEST} - a link to create an edit request for the current page. | |||
-- | |||
-- ${TALKPAGELINK} - a link to the talk page. If a section is specified, links | |||
-- straight to that talk page section. | |||
-- | |||
-- ${DELETIONREASONSBLURB} - a blurb about why the page was deleted. For | |||
-- example, "Please see the deletion discussion or the protection log for | |||
-- details of why this page was deleted." Uses the message | |||
-- "deletion-discussion-blurb-xfd" if a link to a deletion discussion is | |||
-- present, or "deletion-discussion-blurb-noxfd" if not. | |||
--]] | --]] | ||
Line 110: | Line 125: | ||
[ 4] = 'project', | [ 4] = 'project', | ||
[ 6] = 'file', | [ 6] = 'file', | ||
[ 8] = 'mediawiki', | |||
[ 10] = 'template', | [ 10] = 'template', | ||
[ 12] = 'project', | [ 12] = 'project', | ||
Line 116: | Line 132: | ||
} | } | ||
-------------------------------------------------------------------------------- | |||
-- Intro text | |||
-------------------------------------------------------------------------------- | |||
-- Shared intro text for the bannerData table. | |||
local introText = {} | |||
introText.full = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]' | |||
.. ' from editing' | |||
introText.semi = 'Editing of this ${PAGETYPE} by [[Wikipedia:User access levels' | |||
['all-all-office-all-all'] | .. '#New users|new]] or [[Wikipedia:User access levels#Unregistered users' | ||
.. '|unregistered]] users is currently [[Help:Protection|disabled]]' | |||
introText.move = 'This ${PAGETYPE} is currently [[Help:Protection|protected]]' | |||
['all-all-reset-all-all'] | .. ' from [[Help:Moving a page|page moves]]' | ||
introText.create = '[[Help:Starting a new page|Recreation]] of this ${PAGETYPE}' | |||
.. ' [[Help:Protection|has been disabled]]' | |||
['all-template-all-all-edit'] | |||
-------------------------------------------------------------------------------- | |||
-- Banner data table | |||
['all-all-all-autoconfirmed-edit'] | -------------------------------------------------------------------------------- | ||
cfg.bannerData = {} | |||
['indef-all-all-autoconfirmed-edit'] | |||
-- Set the defaults for all protection types. | |||
cfg.bannerData['all-all-all-all-all'] = { | |||
['all-all-blp-autoconfirmed-edit'] | text = introText.full .. '.', | ||
explanation = 'Please discuss any changes on the ${TALKPAGELINK}; you' | |||
.. ' may ${EDITREQUEST} to ask an' | |||
['temp-all-blp-autoconfirmed-edit'] | .. ' [[Wikipedia:Administrators|administrator]] to make an edit if it' | ||
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit' | |||
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus' | |||
['all-all-dispute-autoconfirmed-edit'] | .. '|consensus]]. You may also [[Wikipedia:Requests for' | ||
.. ' page protection#Current requests for reduction in protection level' | |||
.. '|request]] that this page be unprotected.', | |||
['all-all-sock-autoconfirmed-edit'] | tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', | ||
alt = 'Page ${PROTECTIONLEVEL}', | |||
image = 'Transparent.gif', | |||
['all-all-vandalism-autoconfirmed-edit'] | category = 'Wikipedia protected pages' | ||
} | |||
['all-category-all-autoconfirmed-edit'] | -- Move-protection defaults. | ||
cfg.bannerData['all-all-all-all-move'] = { | |||
explanation = 'The page may still be edited but cannot be moved' | |||
['all-file-all-autoconfirmed-edit'] | .. ' until unprotected. Please discuss any suggested moves on the' | ||
.. ' ${TALKPAGELINK} or at [[Wikipedia:Requested moves]]. You can also' | |||
.. ' [[Wikipedia:Requests for page protection|request]] that the page be' | |||
['all-portal-all-autoconfirmed-edit'] | .. ' unprotected.', | ||
} | |||
['all-project-all-autoconfirmed-edit'] | -- Create-protection defaults. | ||
cfg.bannerData['all-all-all-all-create'] = { | |||
explanation = '${DELETIONBLURB} If you would like to create a page' | |||
['all-talk-all-autoconfirmed-edit'] | .. ' at this title, you must first' | ||
.. ' [[Wikipedia:Requests for page protection|request]] for it to be' | |||
.. ' unprotected, or contact the administrator who deleted the page for the' | |||
['all-template-all-autoconfirmed-edit'] | .. ' deleted material to be restored. If unsuccessful, you can use' | ||
.. ' [[Wikipedia:Deletion review|deletion review]].', | |||
} | |||
['all-template-all-autoconfirmed-edit'] | |||
-- Don't make an unprotection request link for pages in the MediaWiki namespace. | |||
cfg.bannerData['all-mediawiki-all-all-all'] = { | |||
['all-user-all-autoconfirmed-edit'] | text = introText.full .. '.', | ||
explanation = 'Please discuss any changes on the ${TALKPAGELINK}; you' | |||
.. ' may ${EDITREQUEST} to ask an' | |||
['all-all-blp-sysop-edit'] | .. ' [[Wikipedia:Administrators|administrator]] to make an edit if it' | ||
.. ' is [[Help:Minor edit#When to mark an edit as a minor edit' | |||
.. '|uncontroversial]] or supported by [[Wikipedia:Consensus' | |||
['temp-all-blp-sysop-edit'] | .. '|consensus]].', | ||
} | |||
['all-all-dispute-sysop-edit'] | -- Set defaults for temporarily-protected pages. | ||
cfg.bannerData['temp-all-all-all-all'] = { | |||
text = introText.full .. ' until ${EXPIRY}.', | |||
['all-all-sock-sysop-edit'] | tooltip = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.' | ||
} | |||
['all-all-vandalism-sysop-edit'] | cfg.bannerData['all-all-all-autoconfirmed-edit'] = { | ||
text = introText.semi .. '.' | |||
} | |||
['all-category-all-sysop-edit'] | |||
cfg.bannerData['temp-all-all-autoconfirmed-edit'] = { | |||
text = introText.semi .. ' until ${EXPIRY}.' | |||
['all-file-all-sysop-edit'] | } | ||
-------------------------------------------------------------------------------- | |||
['all-project-all-sysop-edit'] | -- Protection categories | ||
-------------------------------------------------------------------------------- | |||
['all-talk-all-sysop-edit'] | local bannerDataCategories = { | ||
['all-all-office-all-all'] = 'Wikipedia Office-protected pages', | |||
['all-all-reset-all-all'] = 'Wikipedia Office-protected pages', | |||
['all-template-all-sysop-edit'] | ['all-template-all-all-edit'] = 'Wikipedia protected templates', | ||
['all-all-all-autoconfirmed-edit'] = 'Wikipedia semi-protected pages', | |||
['indef-all-all-autoconfirmed-edit'] = 'Wikipedia indefinitely semi-protected pages', | |||
['all-user-all-sysop-edit'] | ['all-all-blp-autoconfirmed-edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', | ||
['temp-all-blp-autoconfirmed-edit'] = 'Wikipedia temporarily semi-protected biographies of living people', | |||
['all-all-dispute-autoconfirmed-edit'] = 'Wikipedia pages semi-protected due to dispute', | |||
['all-all-all-sysop-move'] | ['all-all-sock-autoconfirmed-edit'] = 'Wikipedia pages semi-protected from banned users', | ||
['all-all-vandalism-autoconfirmed-edit'] = 'Wikipedia pages semi-protected against vandalism', | |||
['all-category-all-autoconfirmed-edit'] = 'Wikipedia semi-protected categories', | |||
['indef-all-all-sysop-move'] | ['all-file-all-autoconfirmed-edit'] = 'Semi-protected images', | ||
['all-portal-all-autoconfirmed-edit'] = 'Semi-protected portals', | |||
['all-project-all-autoconfirmed-edit'] = 'Semi-protected project pages', | |||
['all-all-dispute-sysop-move'] | ['all-talk-all-autoconfirmed-edit'] = 'Semi-protected talk pages', | ||
['all-template-all-autoconfirmed-edit'] = 'Wikipedia semi-protected templates', | |||
['all-template-all-autoconfirmed-edit'] = 'Wikipedia semi-protected templates', | |||
['all-all-vandalism-sysop-move'] | ['all-user-all-autoconfirmed-edit'] = 'Wikipedia semi-protected user and user talk pages', | ||
['all-all-blp-sysop-edit'] = 'Wikipedia indefinitely protected biographies of living people', | |||
['temp-all-blp-sysop-edit'] = 'Wikipedia temporarily protected biographies of living people', | |||
['all-portal-all-sysop-move'] | ['all-all-dispute-sysop-edit'] = 'Wikipedia pages protected due to dispute', | ||
['all-all-sock-sysop-edit'] = 'Wikipedia pages protected from banned users', | |||
['all-all-vandalism-sysop-edit'] = 'Wikipedia pages protected against vandalism', | |||
['all-portal-all-sysop-move'] | ['all-category-all-sysop-edit'] = 'Wikipedia protected categories', | ||
['all-file-all-sysop-edit'] = 'Protected images', | |||
['all-project-all-sysop-edit'] = 'Protected project pages', | |||
['all-project-all-sysop-move'] | ['all-talk-all-sysop-edit'] = 'Protected talk pages', | ||
['all-template-all-sysop-edit'] = 'Wikipedia protected templates', | |||
['all-user-all-sysop-edit'] = 'Wikipedia protected user and user talk pages', | |||
['all-talk-all-sysop-move'] | ['all-all-all-sysop-move'] = 'Wikipedia move-protected pages', | ||
['indef-all-all-sysop-move'] = 'Wikipedia indefinitely move-protected pages', | |||
['all-all-dispute-sysop-move'] = 'Wikipedia pages move-protected due to dispute', | |||
['all-template-all-sysop-move'] | ['all-all-vandalism-sysop-move'] = 'Wikipedia pages move-protected due to vandalism', | ||
['all-portal-all-sysop-move'] = 'Wikipedia move-protected portals', | |||
['all-portal-all-sysop-move'] = 'Wikipedia move-protected portals', | |||
['all-user-all-sysop-move'] | ['all-project-all-sysop-move'] = 'Wikipedia move-protected project pages', | ||
['all-talk-all-sysop-move'] = 'Wikipedia move-protected talk pages', | |||
['all-template-all-sysop-move'] = 'Wikipedia move-protected templates', | |||
['all-all-all-autoconfirmed-autoreview'] | ['all-user-all-sysop-move'] = 'Wikipedia move-protected user and user talk pages', | ||
['all-all-all-autoconfirmed-autoreview'] = 'Wikipedia pending changes protected pages (level 1)', | |||
['all-all-all-reviewer-autoreview'] = 'Wikipedia pending changes protected pages (level 2)', | |||
['all-all-all-reviewer-autoreview'] | |||
} | } | ||
for key, cat in pairs(bannerDataCategories) do | |||
local t = cfg.bannerData[key] or {} | |||
t.category = cat | |||
cfg.bannerData[key] = t | |||
end | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 617: | Line 636: | ||
msg['edit-request-semi-display'] = 'request an edit' | msg['edit-request-semi-display'] = 'request an edit' | ||
msg['semi-subject-page-links'] = ' $12, discuss changes on the $11,' | msg['semi-subject-page-links'] = ' $12, discuss changes on the $11,' | ||
Line 628: | Line 644: | ||
msg['deletion-discussion-blurb-noxfd'] = 'Please see the $17 for' | msg['deletion-discussion-blurb-noxfd'] = 'Please see the $17 for' | ||
.. ' details of why this page was deleted.' | .. ' details of why this page was deleted.' | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |