Module:Protection banner: Difference between revisions

some more work on the Blurb class
(make some image tweaks and start a function for substituting blurb parameters)
(some more work on the Blurb class)
Line 164: Line 164:
local Blurb = class('Blurb')
local Blurb = class('Blurb')


function Blurb:initialize(bannerConfig)
function Blurb:initialize(configObj, protectionStatusObj, namespace)
self._config = bannerConfig
self._configObj = configObj
self._protectionStatusObj = protectionStatusObj
self._bannerConfig = configObj:getBannerConfig(protectionStatusObj)
self._namespace = namespace
end
end


function Blurb:_substituteParameters(msg, configObj)
function Blurb:_makeIntroParameter()
end
 
function Blurb:_makePagetypeParameter()
local pagetypes = self._configObj:getConfigTable('pagetypeNamespaces')
return pagetypes[self._namespace] or pagetypes.default or 'page'
end
 
function Blurb:_substituteParameters(msg)
if not self._params then
if not self._params then
local params, parameterFuncs = {}, {}
local params, parameterFuncs = {}, {}
Line 183: Line 194:
parameterFuncs[1] = function ()
parameterFuncs[1] = function ()
return 'This page is currently [[Help:Protection|protected]] from editing'
return self:_makeIntroParameter()
end
end
-- TODO: Write parameter functions
-- TODO: Write parameter functions
self._params = params
self._params = params