Module:Protection banner: Difference between revisions
add some more blurb functions - up to no. 13 now
(add more blurb functions) |
(add some more blurb functions - up to no. 13 now) |
||
Line 359: | Line 359: | ||
function Blurb:_makeProtectionLogParameter() | function Blurb:_makeProtectionLogParameter() | ||
-- parameter $10 | |||
local action = self._protectionStatusObj:getAction() | local action = self._protectionStatusObj:getAction() | ||
if action == 'autoreview' then | if action == 'autoreview' then | ||
Line 374: | Line 375: | ||
self._configObj:getMessage('more-details-protection-log-display') | self._configObj:getMessage('more-details-protection-log-display') | ||
) | ) | ||
end | |||
end | |||
function Blurb:_makeTalkLinkParameter() | |||
-- parameter $11 | |||
local section = self._protectionStatusObj:getSection() | |||
local display = self._configObj:getMessage('talk-page-link-display') | |||
return string.format( | |||
'[[%s:%s#%s|%s]]', | |||
mw.site.namespaces[self._titleObj.namespace].talk.name, | |||
self._titleObj.text, | |||
section or 'top', | |||
display | |||
) | |||
end | |||
function Blurb:_makeEditRequestParameter() | |||
-- parameter $12 | |||
local mEditRequest = require('Module:Submit an edit request') | |||
local action = self._protectionStatusObj:getAction() | |||
local level = self._protectionStatusObj:getLevel() | |||
-- Get the display message key. | |||
local key | |||
if action == 'edit' and level == 'autoconfirmed' then | |||
key = 'edit-request-semi-display' | |||
else | |||
key = 'edit-request-full-display' | |||
end | |||
local display = self._configObj:getMessage(key) | |||
-- Get the edit request type. | |||
local requestType | |||
if action == 'edit' then | |||
if level == 'autoconfirmed' then | |||
requestType = 'semi' | |||
elseif level == 'templateeditor' then | |||
requestType = 'template' | |||
end | |||
end | |||
requestType = requestType or 'full' | |||
return mEditRequest.exportLinkToLua{type = requestType, display = display} | |||
end | |||
function Blurb:_makeRequestUnprotectionParameter() | |||
-- parameter $13 | |||
if self._titleObj.namespace ~= 8 then | |||
-- MediaWiki pages can't be unprotected. | |||
return self._configObj:getMessage('request-unprotection-blurb') | |||
end | end | ||
end | end |