Changes
		
		
		
		
		
		
		Jump to navigation
		Jump to search
		
	
	
	
 
	
	
		Config = Config,
		
		
		
		
		
		
		
	
try to merge the edit conflict, one variable at a time, starting with action
-- Lazily initialise modules and objects we don't always need.
local mArguments, mMessageBox, lang ---------------------------------------------------------------------------------- Config class-------------------------------------------------------------------------------- local Config = class('Config') function Config:initialize(data)	data = data or mw.loadData('Module:Protection banner/, config')	self._cfg = data.cfg	self._msg = data.msg	self._bannerConfigTables = {}end function Config:getBannerConfig(protectionObj)	if self._bannerConfigTables[protectionObj] then		return self._bannerConfigTables[protectionObj]	else		local ret = {}		local cfg = self._cfg		local action = protectionObj.action		local level = protectionObj.level		local reason = protectionObj.reason		local fields = {			'text',			'explanation',			'tooltip',			'alt',			'link',			'image'		}		local configTables = {}		if cfg.banners[action] then			configTables[#configTables + 1] = cfg.banners[action][reason]		end		if cfg.defaultBanners[action] then			configTables[#configTables + 1] = cfg.defaultBanners[action][level]			configTables[#configTables + 1] = cfg.defaultBanners[action].default		end		configTables[#configTables + 1] = cfg.masterBanner		for i, field in ipairs(fields) do			for j, t in ipairs(configTables) do				if t[field] then					ret[field] = t[field]					break				end			end		end		self._bannerConfigTables[protectionObj] = ret		return ret	endend function Config:getConfigTable(key)	local blacklist = {		banners = true,		defaultBanners = true,		masterBanner = true	}	if not blacklist[key] then		return self._cfg[key]	else		return nil	endend function Config:getMessage(key)	return self._msg[key]end
--------------------------------------------------------------------------------
			level = '*'
		end
		self.level _level = level or '*'
	end
	-- Set expiry
	if args.expiry then
		local indefStrings = configObj:getConfigTable('.cfg.indefStrings')
		if indefStrings[args.expiry] then
			self.expiry _expiry = 'indef'
		elseif type(args.expiry) == 'number' then
			self.expiry _expiry = args.expiry
		else
			self.expiry _expiry = validateDate(args.expiry, 'expiry date')
		end
	end
		local reason = args.reason or args[1]
		if reason then
			self.reason _reason = reason:lower()
		end
	end
	-- Set protection date
	self.protectionDate _protectionDate = validateDate(args.date, 'protection date')		-- Set banner config	do		self.bannerConfig = {}		local cfg = configObj.cfg		local fields = {			'text',			'explanation',			'tooltip',			'alt',			'link',			'image'		}		local configTables = {}		if cfg.banners[self.action] then			configTables[#configTables + 1] = cfg.banners[self.action][self._reason]		end		if cfg.defaultBanners[self.action] then			configTables[#configTables + 1] = cfg.defaultBanners[self.action][self._level]			configTables[#configTables + 1] = cfg.defaultBanners[self.action].default		end		configTables[#configTables + 1] = cfg.masterBanner		for i, field in ipairs(fields) do			for j, t in ipairs(configTables) do				if t[field] then					self.bannerConfig[field] = t[field]					break				end			end		end	end
end
	self._configObj = configObj
	self._protectionObj = protectionObj
	self._bannerConfig = configObj:getBannerConfig(protectionObj).bannerConfig
	self._titleObj = titleObj
end
function Blurb:_getExpandedMessage(msg)
	local msg = self._configObj:getMessage(.msg)[msg]
	return self:_substituteParameters(msg)
end
function Blurb:_makeDisputeBlurbParameter()
	local expiry = self._protectionObj.expiry:getExpiry()
	if type(expiry) == 'number' then
		return self:_getExpandedMessage('dispute-blurb-expiry')
	local mEditRequest = require('Module:Submit an edit request')
	local action = self._protectionObj.action
	local level = self._protectionObj.level:getLevel()
	-- Get the display message key.
function Blurb:_makeExpiryParameter()
	local expiry = self._protectionObj.expiry:getExpiry()
	if expiry == 'indef' then
		return nil
function Blurb:_makeExplanationBlurbParameter()
	local action = self._protectionObj.action
	local level = self._protectionObj.level:getLevel()
	local namespace = self._titleObj.namespace
	local isTalk = self._titleObj.isTalkPage
function Blurb:_makeImageLinkParameter()
	local imageLinks = self._configObj:getConfigTable('.cfg.imageLinks')
	local action = self._protectionObj.action
	local level = self._protectionObj.level:getLevel()
	local msg
	if imageLinks[action][level] then
function Blurb:_makeIntroBlurbParameter()
	local expiry = self._protectionObj.expiry:getExpiry()
	if type(expiry) == 'number' then
		return self:_getExpandedMessage('intro-blurb-expiry')
function Blurb:_makeOfficeBlurbParameter()
	local protectionDate = self._protectionObj.protectionDate:getProtectionDate()
	if protectionDate then
		return self:_getExpandedMessage('office-blurb-protectiondate')
function Blurb:_makePagetypeParameter()
	local pagetypes = self._configObj:getConfigTable('.cfg.pagetypes')
	local namespace = self._titleObj.namespace
	return pagetypes[namespace] or pagetypes.default or error('no default pagetype defined')
function Blurb:_makeProtectionBlurbParameter()
	local protectionBlurbs = self._configObj:getConfigTable('.cfg.protectionBlurbs')
	local action = self._protectionObj.action
	local level = self._protectionObj.level:getLevel()
	local msg
	if protectionBlurbs[action][level] then
function Blurb:_makeProtectionDateParameter()
	local protectionDate = self._protectionObj.protectionDate:getProtectionDate()
	if type(protectionDate) == 'number' then
		return Blurb.formatDate(protectionDate)
function Blurb:_makeProtectionLevelParameter()
	local protectionLevels = self._configObj:getConfigTable('.cfg.protectionLevels')
	local action = self._protectionObj.action
	local level = self._protectionObj.level:getLevel()
	local msg
	if protectionLevels[action][level] then
function Blurb:_makeResetBlurbParameter()
	local protectionDate = self._protectionObj.protectionDate:getProtectionDate()
	if protectionDate then
		return self:_getExpandedMessage('reset-blurb-protectiondate')
function Blurb:_makeTooltipBlurbParameter()
	local expiry = self._protectionObj.expiry:getExpiry()
	if type(expiry) == 'number' then
		return self:_getExpandedMessage('tooltip-blurb-expiry')
	local action = protectionObj.action
	local level = protectionObj.level:getLevel()	local expiry = protectionObj.expiry:getExpiry()
	local namespace = titleObj.namespace
		-- Fully protected modules and templates get the special red "indef"
		-- padlock.
		self._imageFilename = self._configObj:getMessage(.msg['image-filename-indef')]
		return nil
	end
	-- Deal with regular protection types.
	local images = self._configObj:getConfigTable('.cfg.images')
	if images[action] then
		if images[action][level] then
function BannerTemplate:renderImage()
	local filename = self._imageFilename
		or self._configObj:getMessage(.msg['image-filename-default')]
		or 'Transparent.gif'
	return newFileLink(filename)
	-- Get the expiry.
	local expiry = protectionObj.expiry:getExpiry()
	if type(expiry) == 'number' then
		expiry = 'temp'
	do
		local namespace = titleObj.namespace
		local categoryNamespaces = configObj:getConfigTable('.cfg.categoryNamespaceKeys')
		nskey = categoryNamespaces[namespace]
		if not nskey and namespace % 2 == 1 then
	-- Get the other inputs.
	local reason = protectionObj.reason:getReason()
	local action = protectionObj.action
	local level = protectionObj.level:getLevel()
	--[[
	local configOrder = {}
	do
		local reasonsWithNamespacePriority = configObj:getConfigTable('.cfg.reasonsWithNamespacePriority')
		local namespaceFirst = reason and reasonsWithNamespacePriority[reason] or false
		for propertiesKey, t in pairs(properties) do
	-- pos field in the property table.
	--]]
	local cats = configObj:getConfigTable('.cfg.protectionCategories')
	local cat
	for i = 1, 2^noActive do
function ExpiryCategory:render()
	local reasonsWithoutExpiryCheck configObj = self._configObj:getConfigTable('	local protectionObj = self._protectionObj		local reasonsWithoutExpiryCheck = configObj.cfg.reasonsWithoutExpiryCheck')	local expiryCheckActions = selfconfigObj.cfg._configObj:getConfigTable('expiryCheckActions')	local expiry = self._protectionObj.expiryprotectionObj:getExpiry()	local action = self._protectionObjprotectionObj.action	local reason = self._protectionObj.reasonprotectionObj:getReason()
	if not expiry
		and not reasonsWithoutExpiryCheck[reason]
	then
		self:setName(configObj:getMessage(.msg['tracking-category-expiry')])
	end
	return Category.render(self)
	local configObj = self._configObj
	local protectionObj = self._protectionObj
		local expiry = protectionObj.expiry:getExpiry()
	local action = protectionObj.action
	local level = protectionObj.level:getLevel()
	if not protectionObj:isProtected()
		or type(expiry) == 'number' and expiry < os.time()
	then
		self:setName(configObj:getMessage(.msg['tracking-category-incorrect')])
	end
	return Category.render(self)
function TemplateCategory:render()
	local configObj = self._configObj
	local action protectionObj = self._protectionObj.action	local level titleObj = self._protectionObj_titleObj		local action = protectionObj.action	local level= protectionObj:getLevel()	local namespace = self._titleObjtitleObj.namespace
	if level == 'templateeditor'
		)
	then
		self:setName(configObj:getMessage(.msg['tracking-category-template')])
	end
	return Category.render(self)
	-- Get data objects
	if not config then		config = mw.loadData('Module:Protection banner/config')	end	local configObj = Config:new()config
	local protectionObj = Protection:new(args, configObj, titleObj)
		-- Set the image fields
		local bannerConfig = configObj:getBannerConfig(protectionObj).bannerConfig
		bannerObj:setImageFilename(bannerConfig.image, protectionObj, titleObj)
		if isPadlock then
	return {
		Protection = Protection,
		Blurb = Blurb,
		BannerTemplate = BannerTemplate,