Module:Protection banner: Difference between revisions

finish making blurb parameter functions
(add some more blurb functions - up to no. 13 now)
(finish making blurb parameter functions)
Line 49: Line 49:
self._protectionDate = args.date
self._protectionDate = args.date
self._username = args.user
self._username = args.user
self._deletionDiscussionPage = args.xfd
end
end


Line 77: Line 78:
function ProtectionStatus:getUsername()
function ProtectionStatus:getUsername()
return self._username
return self._username
end
function ProtectionStatus:getDeletionDiscussionPage()
return self._deletionDiscussionPage
end
end


Line 208: Line 213:
return self:_makeSubjectPageLinksParameter()
return self:_makeSubjectPageLinksParameter()
end
end
 
parameterFuncs[15] = function ()
parameterFuncs[15] = function ()
return self:_makeDeletionDiscussionParameter()
return self:_makeDeletionBlurbParameter()
end
end


parameterFuncs[16] = function ()
parameterFuncs[16] = function ()
return self:_makeDeletionDiscussionLinkParameter()
end
parameterFuncs[17] = function ()
return self:_makeDeletionLogParameter()
return self:_makeDeletionLogParameter()
end
end
Line 426: Line 435:
return self._configObj:getMessage('request-unprotection-blurb')
return self._configObj:getMessage('request-unprotection-blurb')
end
end
end
function Blurb:_makeSubjectPageLinksParameter()
-- parameter $14
-- Don't display these links if we are on a talk page.
if not self._titleObj.isTalkPage then
local msg = self._config:getMessage('semi-subject-page-links')
return self._substituteParameters(msg)
end
end
function Blurb:_makeDeletionBlurbParameter()
-- parameter $15
local deletionDiscussionPage = getDeletionDiscussionPage()
local key
if deletionDiscussionPage then
key = 'deletion-discussion-blurb-xfd'
else
key = 'deletion-discussion-blurb-noxfd'
end
local msg = self._configObj:getMessage(msg)
return self._substituteParameters(msg)
end
function Blurb:_makeDeletionDiscussionLinkParameter()
-- parameter $16
local deletionDiscussionPage = getDeletionDiscussionPage()
if deletionDiscussionPage then
local display = self._configObj:getMessage('deletion-discussion-link-display')
return string.format('[[%s|%s]]', deletionDiscussionPage, display)
end
end
function Blurb:_makeDeletionLogParameter()
-- parameter $17
return Blurb.makeFullUrl(
'Special:Log',
{type = 'delete', page = self._titleObj.prefixedText},
self._configObj:getMessage('deletion-log-link-display')
)
end
end