Module:Protection banner/config: Difference between revisions
(add error message blurb) |
(convert the following parameters to use functions inside the config: DISPUTEBLURB, DISPUTESECTION, OFFICEBLURB, RESETBLURB) |
||
| Line 16: | Line 16: | ||
-- display message "current-version-edit-display" or | -- display message "current-version-edit-display" or | ||
-- "current-version-move-display". | -- "current-version-move-display". | ||
-- | -- | ||
-- ${EDITREQUEST} - a link to create an edit request for the current page. | -- ${EDITREQUEST} - a link to create an edit request for the current page. | ||
| Line 41: | Line 32: | ||
-- is set. E.g. "Editing of this page by new or unregistered users is currently | -- is set. E.g. "Editing of this page by new or unregistered users is currently | ||
-- disabled until dd Month YYYY" | -- disabled until dd Month YYYY" | ||
-- | -- | ||
-- ${PAGETYPE} - the type of the page, e.g. "article" or "template". | -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". | ||
| Line 60: | Line 47: | ||
-- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, | -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, | ||
-- depending on the protection action. | -- depending on the protection action. | ||
-- | -- | ||
-- ${TALKPAGE} - a link to the talk page. If a section is specified, links | -- ${TALKPAGE} - a link to the talk page. If a section is specified, links | ||
| Line 130: | Line 113: | ||
dispute = { | dispute = { | ||
description = 'For pages protected due to editing disputes.', | description = 'For pages protected due to editing disputes.', | ||
text = '${ | text = function (protectionObj, blurbData) | ||
-- Find the value of "disputes". | |||
local display = 'disputes' | |||
local disputes | |||
if blurbData.section then | |||
disputes = string.format( | |||
'[[%s:%s#%s|%s]]', | |||
mw.site.namespaces[protectionObj.title.namespace].talk.name, | |||
protectionObj.title.text, | |||
blurbData.section, | |||
display | |||
) | |||
else | |||
disputes = display | |||
end | |||
-- Make the blurb, depending on the expiry. | |||
local msg | |||
if type(protectionObj.expiry) == 'number' then | |||
msg = '${INTROBLURB} or until editing %s have been resolved.' | |||
else | |||
msg = '${INTROBLURB} until editing %s have been resolved.' | |||
end | |||
return string.format(msg, disputes) | |||
end, | |||
explanation = "This protection is '''not''' an endorsement of the" | explanation = "This protection is '''not''' an endorsement of the" | ||
.. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', | .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', | ||
| Line 155: | Line 162: | ||
office = { | office = { | ||
description = 'For pages protected by the Wikimedia Foundation.', | description = 'For pages protected by the Wikimedia Foundation.', | ||
text = '${ | text = function (protectionDate, blurbData) | ||
local ret = 'This ${PAGETYPE} is currently under the' | |||
.. ' scrutiny of the' | |||
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]' | |||
.. ' and is protected.' | |||
if protectiobObj.protectionDate then | |||
ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' | |||
end | |||
return ret | |||
end, | |||
explanation = "If you can edit this page, please discuss all changes and" | explanation = "If you can edit this page, please discuss all changes and" | ||
.. " additions on the ${TALKPAGE} first. '''Do not remove protection from this" | .. " additions on the ${TALKPAGE} first. '''Do not remove protection from this" | ||
| Line 162: | Line 178: | ||
image = 'Padlock-black.svg', | |||