Modulo:RichiestaCU: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
nuove funzioni riga() e p.righe() |
|||
Riga 1:
local p = {}
function colore(arg1, arg2)
local colori = {
positivo = 'F0B090',
Riga 10:
altro = 'E0F0FF'
}
if arg1 ~= nil and arg1 ~= '' then
if colori[arg1] ~= nil then
return colori[arg1]
end
elseif colori[arg2] ~= nil then
return colori[arg2]
else
Riga 20:
end
return ''
end
function riga(utente, risultato, sign)
local links = {
string.format('[[Utente:%s|%s]] <small class="plainlinks">[[Speciale:Contributi/%s|contributi]]', utente, utente, utente),
string.format('[[Speciale:DeletedContributions/%s|(cancellati)]]', utente),
string.format('[{{fullurl:Speciale:Log|type=block&page=Utente:{{urlencode:%s}}}} blocchi]', utente),
string.format('[[Wikipedia:Check user/Richieste/Archivio/Utenti/%s|Prec]]</small>', utente),
string.format('<span class="plainlinks">[{{fullurl:Speciale:CheckUser|user={{urlencode:%s}}}} CU]</span>', utente)
}
return '|-\n| bgcolor=#'..colore(risultato, sign)..' | '..table.concat(links, ' · ')
end
function p.righe(frame)
local args = frame:getParent().args
local sign = args.RISULTATOSIGN or ''
local res = ''
local numero = 1
while true do
if args['UTENTE'..numero] then
local utente = mw.text.trim(args['UTENTE'..numero])
if utente ~= '' then
res = res..riga(utente, args['RISULTATO_UTENTE'..numero], sign)
numero = numero + 1
elseif numero == 1 then
return '<small><span class="error">ERRORE#1: Richiesta non valida: non è stata indicata alcuna utenza.</span></small>'
elseif numero == 2 then
return '<small><span class="error">ERRORE#2: Non è possibile accogliere la richiesta: devono essere indicate almeno due utenze.</span></small>'
end
else
break
end
end
return res
end
|