Open main menu

Changes

Module:Protection banner

94 bytes removed, 18:19, 28 June 2014
condense _main and switch Blurb arg order
local Blurb = class('Blurb')
function Blurb:initialize(protectionObj, cfg, protectionObj)
self._cfg = cfg
self._protectionObj = protectionObj
-- Initialise protection and blurb objects
local protectionObj = Protection:new(args, cfg)
local blurbObj = Blurb:new(protectionObj, cfg, protectionObj)
blurbObj:setDeletionDiscussionPage(args.xfd)
blurbObj:setUsername(args.user)
if protectionObj:isProtected() then
-- Get the banner object
local isPadlock = yesno(args.small)
local bannerObj
if isPadlock yesno(args.small) then
bannerObj = Padlock:new(cfg)
else
bannerObj = Banner:new(cfg)
end
 
-- Set the image fields
local bannerConfig = protectionObj.bannerConfig
bannerObj:setImageFilename(bannerConfig.image, protectionObj)
if isPadlock then
bannerObj:setImageTooltip(blurbObj:makeTooltipText())
bannerObj:setImageAlt(blurbObj:makeAltText())
bannerObj:setImageLink(blurbObj:makeLinkText())
else
bannerObj = Banner:new(cfg)
-- Large banners use the alt text for the tooltip.
bannerObj:setImageTooltip(blurbObj:makeAltText())
end  -- Set the text fields and the page name. if not isPadlock then
bannerObj:setReasonText(blurbObj:makeReasonText())
bannerObj:setExplanationText(blurbObj:makeExplanationText())
bannerObj:setPage(protectionObj.title.prefixedText)
end
-- Set the image fields
local bannerConfig = protectionObj.bannerConfig
bannerObj:setImageFilename(bannerConfig.image, protectionObj)
ret[#ret + 1] = tostring(bannerObj)
Anonymous user