Jump to content

Module:Protection banner: Difference between revisions

comment tweaks
(get rid of a few more unnecessary local variables)
(comment tweaks)
Line 682: Line 682:
function BannerTemplate:initialize(protectionObj, cfg)
function BannerTemplate:initialize(protectionObj, cfg)
self._cfg = cfg
self._cfg = cfg
-- Set the image filename.
local imageFilename = protectionObj.bannerConfig.image
local imageFilename = protectionObj.bannerConfig.image
if imageFilename then
if imageFilename then
self._imageFilename = imageFilename
self._imageFilename = imageFilename
else
else
-- If an image filename isn't specified explicitly in the banner config,
-- generate it from the protection status and the namespace.
local action = protectionObj.action
local action = protectionObj.action
local level = protectionObj.level
local level = protectionObj.level
Line 692: Line 696:
-- Deal with special cases first.
-- Deal with special cases first.
if (namespace == 10 or namespace == 828) -- Maybe we don't need the namespace check?
if (namespace == 10 or namespace == 828)
and action == 'edit'
and action == 'edit'
and level == 'sysop'
and level == 'sysop'
Line 741: Line 745:


function Banner:initialize(protectionObj, blurbObj, cfg)
function Banner:initialize(protectionObj, blurbObj, cfg)
BannerTemplate.initialize(self, protectionObj, cfg) -- this doesn't need the blurb
BannerTemplate.initialize(self, protectionObj, cfg) -- This doesn't need the blurb.
self:setImageWidth(40)
self:setImageWidth(40)
self:setImageTooltip(blurbObj:makeAltText()) -- Large banners use the alt text for the tooltip.
self:setImageTooltip(blurbObj:makeAltText()) -- Large banners use the alt text for the tooltip.
self._reasonText = blurbObj:makeReasonText()
self._reasonText = blurbObj:makeReasonText()
self._explanationText = blurbObj:makeExplanationText()
self._explanationText = blurbObj:makeExplanationText()
self._page = protectionObj.title.prefixedText -- This only affects Module:Message box if the page specified is not the current page.
self._page = protectionObj.title.prefixedText -- Only makes a difference in testing.
end
end


Line 774: Line 778:


function Padlock:initialize(protectionObj, blurbObj, cfg)
function Padlock:initialize(protectionObj, blurbObj, cfg)
BannerTemplate.initialize(self, protectionObj, cfg) -- this doesn't need the blurb
BannerTemplate.initialize(self, protectionObj, cfg) -- This doesn't need the blurb.
self:setImageWidth(20)
self:setImageWidth(20)
self:setImageTooltip(blurbObj:makeTooltipText())
self:setImageTooltip(blurbObj:makeTooltipText())
Cookies help us deliver our services. By using our services, you agree to our use of cookies.