Changes

Module:Documentation

362 bytes added, 01:17, 28 December 2013
internationalise the protection template code
cfg.sandboxNoticeTemplate = 'template sandbox notice' -- The name of the template to display at the top of sandbox pages.
cfg.sandboxNoticeLivepageParam = 1 -- The parameter of the sandbox notice template to send the cfg.livepageArg to.
cfg.protectionTemplate = 'pp-template' -- The name of the template that displays the protection icon (a padlock on enwiki).
cfg.protectionTemplateArgs = {docusage = 'yes'} -- Any arguments to send to the protection template.
-- Display settings
function p.protectionTemplate()
local protectionTemplate = cfg.protectionTemplate if not (protectionTemplate and currentTitle.namespace == 10 ) then -- We Don't display the protection template if we are not in the template namespace. return nil end local frame = mw.getCurrentFrame()  local function getProtectionLevel(protectionType) -- Gets the protection level for the current page. local level = frame:callParserFunction('PROTECTIONLEVEL', protectionType) if level ~= '' then return level else return nil -- The parser function returns the blank string if there is no match. end end  if getProtectionLevel('move') == 'sysop' or getProtectionLevel('edit') then -- The page is full-move protected, or full, template, or semi-protected. return frame:expandTemplate{title = 'pp-template', args = {docusage = 'yes'}}
end
end
if getProtectionLevel('move') == 'sysop' or getProtectionLevel('edit') then
-- The page is full-move protected, or full, template, or semi-protected.
return frame:expandTemplate{title = protectionTemplate, args = cfg.protectionTemplateArgs}
end
return nil
Anonymous user