Changes

Jump to navigation Jump to search

Module:Protection banner

772 bytes added, 06:08, 17 March 2014
more data table restructuring, plus some fiddling around with the category name function; this is a progress save, so the code is horribly broken at the moment
cfg.reasons = {
blp = {
categoryOrder = 'reason',
banner = 'blp'
},
dispute = {
categoryOrder = 'reason',
banner = 'dispute'
},
office = {
categoryOrder = 'reason',
banner = 'office'
},
sock = {
categoryOrder = 'reason',
banner = 'sock'
},
usertalk = {
banner = 'usertalk'
},
vandalism = {
categoryOrder = 'namespace',
banner = 'vandalism'
}
}
 
cfg.banners = {
-- $1 = "until" or "or until" depending on the expiry
-- $2 = "disputes", with or without a section link
blp = {
behavior = 'reasonFirst'
},
dispute = {
behavior = 'reasonFirst', reason text = '$1 editing $2 have been resolved', iconReason tooltip = 'due to editing disputes',
dispute = true
},
office = {
behavior = 'reasonFirst'
},
sock = {
}, usertalk = { text = '', behavior explanation = 'reasonFirstIf you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' [[Wikipedia:Requests for page protection#' .. 'Current requests for edits to a protected page|request an edit]],' .. ' [[Wikipedia:Requests for page protection#' .. 'Current requests for reduction in protection level|request unprotection]],' .. ' [[Special:Userlogin|log in]],' .. ' or [[Special:UserLogin/signup|create an account]].'
},
vandalism = {
behavior = 'namespaceFirst', reason text = 'due to [[Wikipedia:Vandalism|vandalism]]', iconReason tooltip = 'due to vandalism'
},
}
 
cfg.protectionLevels = {
foo
}
end
function p.getCategoryName(cats, protTypeaction, protLevellevel, namespace, reason, expiry)
--[[
-- Gets a category name from the category table, given a combination of
--]]
local properties = {
expiry = {pos = 5, val = expiry}, namespace = {'namespace', pos = 3, val = p.matchNamespace(namespace)}, reason = {pos = 4, val = reason}, level = {pos = 2, val = protLevellevel}, action = {pos = 1, val = protTypeaction}
}
-- vandalism categories if they were available.
--]]
local behaviorcategoryOrder
if not reason then
behavior categoryOrder = 'reasonFirstreason'
else
behavior categoryOrder = cfg.reasons[reason].behaviorcategoryOrder
end
if behavior categoryOrder == 'namespaceFirstnamespace' then
toTableEnd(properties, 2) -- move namespace to end
elseif behavior categoryOrder == 'reasonFirstreason' then
toTableEnd(properties, 3) -- move reason to end
else
Anonymous user

Navigation menu