Jump to content

Module:Protection banner/config: Difference between revisions

convert the following parameters to use functions inside the config: DISPUTEBLURB, DISPUTESECTION, OFFICEBLURB, RESETBLURB
(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".
--
-- ${DISPUTEBLURB} - a blurb about editing disputes, using the INTROBLURB
-- parameter and the DISPUTESECTION parameter. E.g. "This page is protected
-- from editing until disputes have been resolved."
--
-- ${DISPUTESECTION} - if a section link is passed to the module, this is
-- a link to that section with the display message
-- "dispute-section-link-display". Otherwise it is just the display
-- message with no link.
--
--
-- ${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"
--
-- ${OFFICEBLURB} - a blurb about pages protected by the WMF office. If the
-- protection date has been specified, includes a sentence saying when the page
-- was protected.
--
--
-- ${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.
--
-- ${RESETBLURB} - a blurb for pages using {{pp-reset}}. If the protection
-- date is specified, this includes information about when the page was
-- protected.
--
--
-- ${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 = '${DISPUTEBLURB}',
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 = '${OFFICEBLURB}',
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',
image = 'Padlock-black.svg',
},
},
--------------------------------------------------------------------------------
-- Reset blurb
--------------------------------------------------------------------------------
['reset-blurb-protectiondate'] = 'On ${PROTECTIONDATE} this article was'
.. ' reduced to a simplified, "bare bones" version so that it may be'
.. ' completely rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].',
['reset-blurb-noprotectiondate'] = 'This article has been reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].',
reset = {
reset = {
description = 'For pages protected by the Wikimedia Foundation and'
description = 'For pages protected by the Wikimedia Foundation and'
.. ' "reset" to a bare-bones version.',
.. ' "reset" to a bare-bones version.',
text = '${RESETBLURB}'
text = function (protectionObj, blurbData)
local ret = ''
if protectionObj.protectionDate then
ret = ret .. 'On ${PROTECTIONDATE} this article was'
else
ret = ret .. 'This article has been'
end
ret = ret .. 'reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' Standard Wikipedia policies will apply to its rewriting—which'
.. ' will eventually be open to all editors—and will be strictly'
.. ' will eventually be open to all editors—and will be strictly'
Line 176: Line 216:
.. " same date.\n\n'''Administrators may not override this action"
.. " same date.\n\n'''Administrators may not override this action"
.. ' without approval from someone from the [[WP:OFFICE|Office]].'
.. ' without approval from someone from the [[WP:OFFICE|Office]].'
.. " No editor may remove this notice.'''",
.. " No editor may remove this notice.'''"
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 578: Line 620:
.. ' page protection#Current requests for reduction in protection level'
.. ' page protection#Current requests for reduction in protection level'
.. '|ask]] for it to be unprotected.',
.. '|ask]] for it to be unprotected.',
--------------------------------------------------------------------------------
-- Dispute blurb
--------------------------------------------------------------------------------
['dispute-blurb-expiry'] = '${INTROBLURB} or until editing ${DISPUTESECTION}'
.. ' have been resolved.',
['dispute-blurb-noexpiry'] = '${INTROBLURB} until editing ${DISPUTESECTION}'
.. ' have been resolved.',
['dispute-section-link-display'] = 'disputes',


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 617: Line 647:
['edit-request-full-display'] = 'submit a request',
['edit-request-full-display'] = 'submit a request',
['edit-request-semi-display'] = 'request an edit',
['edit-request-semi-display'] = 'request an edit',
--------------------------------------------------------------------------------
-- Office blurb
--------------------------------------------------------------------------------
['office-blurb-protectiondate'] = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected. It has been protected since ${PROTECTIONDATE}.',
['office-blurb-noprotectiondate'] = 'This ${PAGETYPE} is currently under the'
.. ' scrutiny of the'
.. ' [[Wikipedia:Office actions|Wikimedia Foundation Office]]'
.. ' and is protected.',
--------------------------------------------------------------------------------
-- Reset blurb
--------------------------------------------------------------------------------
['reset-blurb-protectiondate'] = 'On ${PROTECTIONDATE} this article was'
.. ' reduced to a simplified, "bare bones" version so that it may be'
.. ' completely rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].',
['reset-blurb-noprotectiondate'] = 'This article has been reduced to a'
.. ' simplified, "bare bones" version so that it may be completely'
.. ' rewritten to ensure it meets the policies of'
.. ' [[WP:NPOV|Neutral Point of View]] and [[WP:V|Verifiability]].',


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Cookies help us deliver our services. By using our services, you agree to our use of cookies.