モジュール:サンドボックス/Dragoniez/UserAN
表示
モジュールの解説[作成]
local p = {}
function p.Main(frame)
--テンプレート引数
local arg = {
username = frame.args['target'], -- 1=, user=, User=
type = string.lower(frame.args["type"]), -- t=, type=, Type=
status = string.lower(frame.args["status"]), -- 2=
manualstatus = frame.args["status2"] -- s=, status=, Status=, 状態=
}
--表示リンク群
local reguser = "[[利用者:" .. arg.username .. "]]"
local reguserNL = "利用者:" .. arg.username
local talk = "[[User talk:" .. arg.username .. "|会話]]"
local contribs = "[[特別:投稿記録/" .. arg.username .. "|投稿記録]]"
local log = "[//ja-two.iwiki.icu/w/index.php?title=特別:Log&page=User:" .. arg.username .. " 記録]"
local ca = "[[特別:CentralAuth/" .. arg.username .. "|CA]]"
local block = "[[特別:block/" .. arg.username .. "|ブロック]]"
local userlinks = '(' .. talk .. ' / ' .. contribs .. ' / ' .. log .. ' / ' .. ca .. ' / ' .. block .. ')'
local ipuser = "IP:" .. arg.username
local guc = "[//xtools.wmflabs.org/globalcontribs/ipr-" .. arg.username .. " xtool]"
local whois4 = "[//whois.domaintools.com/" .. arg.username .. " IPv4]"
local whois6 = "[//www.ultratools.com/tools/ipv6InfoResult?ipAddress=" .. arg.username .. " IPv6]"
local iplinks = '(' .. talk .. ' / ' .. contribs .. ' / ' .. log .. ' / ' .. guc .. ' / Whois' .. whois4 .. ' / ' .. whois6 .. ' / ' .. block .. ')'
local function plainlink(links)
return '<span class="plainlinks" style="font-size:smaller">' .. links .. '</span>'
end
local report = {
user = reguser .. plainlink(userlinks),
userNL = reguserNL .. plainlink(userlinks),
ip = ipuser .. plainlink(iplinks),
logid = "[[特別:転送/logid/" .. arg.username .. "|Logid/" .. arg.username .. "]]",
diff = "[[特別:差分/" .. arg.username .. "|差分/" .. arg.username .. "]]の投稿者"
}
local icon = {
yellow = '[[File:Nuvola filesystems folder yellow open.png|25px|<span class="doing">未了</span>]]',
orange = '[[File:Nuvola filesystems folder orange open.png|25px|<span class="pending">保留</span>]]',
red = '[[File:Nuvola filesystems folder red open.png|25px|<span class="rejected">却下</span>]]',
green = '[[File:Nuvola filesystems folder green open.png|25px|<span class="done">済</span>]]'
}
-- type判定
local types = {
unl = report.userNL,
usernolink = report.userNL,
ip2 = report.ip,
ipuser2 = report.ip,
log = report.logid,
logid = report.logid,
dif = report.diff,
diff = report.diff,
none = arg.username
}
local displayStr
if types[arg.type] == nil then
displayStr = report.user
else
displayStr = types[arg.type]
end
-- status判定
local displayIcon = icon.yellow
local statusSwitch = {
['済'] = icon.green .. ' <small><b>済</b></small>',
['済み'] = icon.green .. ' <small><b>済</b></small>',
['done'] = icon.green .. ' <small><b>済</b></small>',
['却下'] = icon.red .. ' <small><b>却下</b></small>',
['非対処'] = icon.red .. ' <small><b>却下</b></small>',
['取り下げ'] = icon.red .. ' <small><b>取り下げ</b></small>',
['not done'] = icon.red .. ' <small><b>却下</b></small>',
['保留'] = icon.orange,
['pending'] = icon.orange,
}
if arg.status == '' then
if statusSwitch[arg.manualstatus] ~= nil then
displayIcon = statusSwitch[arg.manualstatus]
end
else
displayIcon = icon.green .. ' <small><b>' .. arg.status .. '</b></small>'
end
return displayIcon .. ' ' .. displayStr
end
return p