Zum Inhalt springen

Modul:Protection banner: Unterschied zwischen den Versionen

add some more blurb parameter functions
(move the parameter functions to the top level of the blurb class and add a new one)
(add some more blurb parameter functions)
Zeile 47: Zeile 47:
self._expiry = args.expiry or 'indef'
self._expiry = args.expiry or 'indef'
self._section = args.section
self._section = args.section
self._protectionDate = args.date
self._username = args.user
end
end


Zeile 67: Zeile 69:
function ProtectionStatus:getSection()
function ProtectionStatus:getSection()
return self._section
return self._section
end
function ProtectionStatus:getProtectionDate()
return self._protectionDate
end
function ProtectionStatus:getUsername()
return self._username
end
end


Zeile 167: Zeile 177:


parameterFuncs[9] = function ()
parameterFuncs[9] = function ()
return self:_makeDisputeLinkParameter() -- A link to the page history or the move log
-- A link to the page history or the move log
return self:_makeDisputeLinkParameter()
end
end


Zeile 187: Zeile 198:


parameterFuncs[14] = function ()
parameterFuncs[14] = function ()
return self:_makeSubjectPageLinksParameter() -- Adds links to edit requests and the talk page if we are on a subject page
-- Adds links to edit requests and the talk page if we are on a
-- subject page
return self:_makeSubjectPageLinksParameter()
end
end


Zeile 259: Zeile 272:
function Blurb:_makeProtectionDateParameter()
function Blurb:_makeProtectionDateParameter()
-- parameter $5
-- parameter $5
if self._protectionDate then
local protectionDate = self._protectionStatusObj:getProtectionDate()
if protectionDate then
local lang = mw.language.getContentLanguage()
local lang = mw.language.getContentLanguage()
local success, date = pcall(
local success, date = pcall(
Zeile 265: Zeile 279:
lang,
lang,
'j F Y',
'j F Y',
self._protectionDate
protectionDate
)
)
if success and date then
if success and date then
Zeile 271: Zeile 285:
end
end
end
end
end
function Blurb:_makeVandalTemplateParameter()
local mVandalM = require('Module:Vandal-m')
local username = self._protectionStatusObj:getUsername()
username = username or self._titleObj.baseText
return mVandalM.luaMain{username}
end
end


Anonymer Benutzer