Module:Protection banner: Difference between revisions

Reverted to revision 31218 by Tito Dutta (talk): Test. (TW)
m (1 revision)
 
(Reverted to revision 31218 by Tito Dutta (talk): Test. (TW))
 
Line 4: Line 4:
-- Initialise necessary modules.
-- Initialise necessary modules.
require('Module:No globals')
require('Module:No globals')
local makeFileLink = require('Module:File link')._main
local newFileLink = require('Module:File link').new
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local effectiveProtectionLevel = require('Module:Effective protection level')._main
local yesno = require('Module:Yesno')
local yesno = require('Module:Yesno')
Line 126: Line 126:


-- Set level
-- Set level
obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title)
obj.level = effectiveProtectionLevel(obj.action, obj.title)
if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
if obj.level == 'accountcreator' then
-- Lump titleblacklisted pages in with template-protected pages,
-- since templateeditors can do both.
obj.level = 'templateeditor'
elseif not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then
-- Users need to be autoconfirmed to move pages anyway, so treat
-- Users need to be autoconfirmed to move pages anyway, so treat
-- semi-move-protected pages as unprotected.
-- semi-move-protected pages as unprotected.
Line 768: Line 772:
or self._cfg.msg['image-filename-default']
or self._cfg.msg['image-filename-default']
or 'Transparent.gif'
or 'Transparent.gif'
return makeFileLink{
return newFileLink(filename)
file = filename,
:width(self._imageWidth or 20)
size = (self._imageWidth or 20) .. 'px',
:alt(self._imageAlt)
alt = self._imageAlt,
:link(self._imageLink)
link = self._imageLink,
:caption(self._imageCaption)
caption = self._imageCaption
:render()
}
end
end


Line 868: Line 871:
-- If a page's edit protection is equally or more restrictive than its protection from some other action,
-- If a page's edit protection is equally or more restrictive than its protection from some other action,
-- then don't bother displaying anything for the other action (except categories).
-- then don't bother displaying anything for the other action (except categories).
if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then
if protectionObj.action == 'edit' or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then
-- Initialise the blurb object
-- Initialise the blurb object
local blurbObj = Blurb.new(protectionObj, args, cfg)
local blurbObj = Blurb.new(protectionObj, args, cfg)
14,061

edits