Module:Protection banner/config: Difference between revisions

    From Nonbinary Wiki
    (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',