Bu modulun sənədləşdirmə səhifəsi Modul:Səlahiyyətlilərin siyahısı/doc səhifəsində yaradıla bilər
local export = {}
local function formatUsername(username, mode)
local tab = {
['bürokrat'] = 'style="text-align: left" | {{Bürokrat fəaliyyət keçidi|' .. username .. '}}',
['təftişçi'] = 'style="text-align: left" | ' .. username,
['gizlədici'] = 'style="text-align: left" | ' .. username,
['inzibatçı'] = 'style="text-align: left" | {{İnzibatçı fəaliyyət keçidi|' .. username .. '}}'
}
return tab[mode]
end
local function formatActivityStatus(username, status)
local tab = {
['aktiv'] = 'style="background-color: #90ff90" | [[Xüsusi:Jurnal/' .. username .. '|Aktiv]]',
['qismən aktiv'] = 'style="background-color: #f0e68c" | [[Xüsusi:Jurnal/' .. username .. '|Qismən aktiv]]',
['passiv'] = 'style="background-color: #ff9090" | [[Xüsusi:Jurnal/' .. username .. '|Passiv]]',
[''] = 'Bilinmir',
}
return tab[status]
end
local function formatBoolean(bool)
return bool and '[[Fayl:Yes check.svg|Hə|15px|link=]]' or ''
end
local function formatUsers(args, mode)
local users = {}
for k, v in pairs(args) do
if mw.ustring.match(k, '^istifadəçi') then
local n = mw.ustring.match(k, "%d+")
if n and v then
users[tonumber(n)] = {
['istifadəçi'] = formatUsername(v, mode),
['tarix'] = args['tarix' .. n] or '',
['irc'] = args['irc' .. n] or '',
['aktiv'] = formatActivityStatus(v, args['aktiv' .. n] or ''),
['bürokrat'] = formatBoolean(args['bürokrat' .. n] == '1' or nil),
['təftişçi'] = formatBoolean(args['təftişçi' .. n] == '1' or nil),
['gizlədici'] = formatBoolean(args['gizlədici' .. n] == '1' or nil),
['inzibatçı'] = formatBoolean(args['inzibatçı' .. n] == '1' or nil)
}
end
end
end
return users
end
function export.show(frame)
local args = frame:getParent().args
local modes = {'bürokrat', 'təftişçi', 'gizlədici', 'inzibatçı'}
local mode = modes[tonumber(args['gizlət'])] or 'inzibatçı'
local users = formatUsers(args, mode)
local wikicode = ''
for k, v in ipairs(users) do
wikicode = wikicode
.. '\n|' .. tostring(k)
.. '\n|' .. v['istifadəçi']
.. '\n|' .. v['tarix']
.. '\n|' .. v['irc']
.. '\n|' .. v['aktiv']
.. (not (mode == 'bürokrat') and ('\n|' .. v['bürokrat']) or '')
.. (not (mode == 'təftişçi') and ('\n|' .. v['təftişçi']) or '')
.. (not (mode == 'gizlədici') and ('\n|' .. v['gizlədici']) or '')
.. (not (mode == 'inzibatçı') and ('\n|' .. v['inzibatçı']) or '')
.. '\n|-'
end
return frame:preprocess(wikicode)
end
return export