Modulo:Progetti interessati: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
+classi
-testo alternativo dalle icone, sono soltanto decorative
 
(32 versioni intermedie di 4 utenti non mostrate)
Riga 1:
--[[
* Modulo che implementa il template MonitoraggioProgetti interessati.
]]--
 
require('Modulo:No globalsstrict')
 
local getArgs = require('Modulo:Arguments').getArgs
local cfg = mw.loadData('Modulo:Progetti interessati/Configurazione')
 
local catPrefix = mw.loadData('Modulo:Progetti interessati/Categorie')
-- Configurazione
-- Nomi e valori consentiti dei parametri di monitoraggio/importanza richiesti da più funzioni
local cfg = mw.loadData('Modulo:Monitoraggio/Configurazione')
 
-- Variabili globali
local projParams = { 'progetto', 'progetto2', 'progetto3', 'progetto4' }
local gradeParams = { 'accuratezza', 'scrittura', 'fonti', 'immagini' }
local validGrades = { a = true, b = true, c = true, d = true, e = true }
local validImportances = { massima = true, alta = true }
--local importanceParams = { 'importanza', 'importanza2', 'importanza3', 'importanza4' }
--local validImportances = { massima = true, alta = true, media = true, bassa = true }
 
-- =============================================================================
-------------------------------------------------------------------------------
-- Funzioni di utilità
-- =============================================================================
-------------------------------------------------------------------------------
 
-- Wrapper di mw.title.exists, verifica sia che name sia valido, sia che esista.
--
-- @param {string} name
-- @return {boolean}
local function titleExists(name)
local title = mw.title.new(name)
Riga 27 ⟶ 26:
end
 
-- Restituisce il valore della valutazione ("a", "b", "c" o "d") più bassa inserita
local function project(param, args, subpage)
-- nei quattro parametri "accuratezza", "scrittura", "fonti" e "immagini".
local ret = cfg.alias[args[param] and args[param]:lower()] or
--
mw.language.getContentLanguage():ucfirst(args[param])
-- @param {table} args
-- subpage: per le icone e per l'etichetta del wikilink del progetto
-- @return {string}
if ret and subpage then
ret = mw.title.new('Progetto:' .. ret).subpageText
end
return ret
end
 
local function grade(param, args)
return args[param] or 'nc'
end
 
--local function importanceFromProject(projParam, args)
-- local num = mw.ustring.match(projParam, '^progetto(%d)$')
-- local param = num and ('importanza' .. num) or
-- (projParam == 'progetto' and 'importanza' or nil)
-- return args[param] or 'sconosciuta'
--end
 
local function lowestGrade(args)
local t = { args.accuratezza, args.scrittura, args.fonti, args.immagini }
Riga 54 ⟶ 37:
end
 
-- Restituisce l'icona da visualizzare per il progetto specificato,
-- utilizzando il template Icona argomento e verificando se è un sottoprogetto.
--
-- @param {string} name
-- @return {string}
local function getIcon(name)
local icon = mw.getCurrentFrame():expandTemplate {
title = 'Icona argomento',
args = { name }
}
if icon == '' then
local subpage = mw.title.new('Progetto:' .. name).subpageText
if subpage ~= name then
icon = mw.getCurrentFrame():expandTemplate {
title = 'Icona argomento',
args = { subpage }
}
end
end
icon = icon == '' and 'Crystal Clear app ksirtet.png' or icon
 
return string.format('[[File:%s|20x20px|alt= ]]', icon)
end
 
-- Restituisce il valore del parametro importanzaN relativo al progettoN specificato,
-- o nil se non usato dall'utente.
--
-- @param {string} projParam
-- @param {table} args
-- @return {string}
local function getImportance(projParam, args)
local num = mw.ustring.match(projParam, '^progetto(%d)$')
local param = num and ('importanza' .. num) or
(projParam == 'progetto' and 'importanza' or nil)
return args[param]
end
 
-- Controlla gli argomenti importanzaN e quelli per la valutazione del monitoraggio.
-- Per ogni parametro progettoN specificato crea una table con i dati del progetto.
--
-- @param {table} args
-- @return {table} gli argomenti passati alla funzione
-- @return {table} una sequence di table che descrivono i singoli progetti
-- @return {table} eventuali categorie di errore
-- @return {string} un eventuale messaggio di errore per i progetti non esistenti
local function parseArgs(args)
local errcat = {}
local projects = {}
local nonexistingProjects = {}
local errmsg
local importanceParams = { 'importanza' }
local projectParams = { 'progetto' }
 
-- controllo importanza
--for _,i param= in2, ipairs(importanceParams)cfg.max_progetti do
table.insert(importanceParams, 'importanza' .. i)
-- if args[param] and not validImportances[args[param]] then
end
-- args[param] = nil
for _, param in ipairs(importanceParams) do
-- table.insert(errcat, '[[Categoria:Pagine con template Monitoraggio con importanza invalida]]')
if args[param] and not validImportances[args[param]] then
-- end
args[param] = nil
--end
table.insert(errcat, '[[Categoria:Pagine con template Progetti interessati con importanza invalida]]')
end
end
 
-- controllo valutazioni
Riga 69 ⟶ 105:
if args[param] and not validGrades[args[param]] then
if args[param] ~= 'nc' then
table.insert(errcat, '[[Categoria:Pagine con template MonitoraggioProgetti interessati con valutazione invalida]]')
end
args[param] = nil
Riga 76 ⟶ 112:
args.data = args.data and args.data:lower() or nil
 
-- popola la tabella projects
-- controllo progetto
if args.progetto then
for _,i param= in2, ipairs(projParams)cfg.max_progetti do
table.insert(projectParams, 'progetto' .. i)
end
for _, param in ipairs(projectParams) do
if args[param] then
local titlename = 'Progetto:' cfg.. project(alias[args[param,] and args[param]:lower()] or
mw.language.getContentLanguage():ucfirst(args[param])
if titleExists(title) then
if titleExists('Progetto:' .. name) then
-- verifica se esiste il monitoraggio in base alla presenza
table.insert(projects, {
-- della sottopagina Monitoraggio voci
name = name,
if not titleExists(title .. '/Monitoraggio voci') then
subpage = mw.title.new('Progetto:' .. name).subpageText,
table.insert(errcat, '[[Categoria:Errori di compilazione del template Monitoraggio]]')
monitoraggio = titleExists(string.format('Progetto:%s/Monitoraggio voci', name)),
break
importance = getImportance(param, args),
end
icon = getIcon(name),
catPrefix = catPrefix[name:lower()]
})
else
table.insert(errcat, '[[Categoria:Pagine con template MonitoraggioProgetti interessati con progetto non esistente]]')
table.insert(nonexistingProjects, name)
break
end
end
Riga 96 ⟶ 138:
else
-- almeno un progetto deve essere specificato
table.insert(errcat, '[[Categoria:Errori di compilazione del template MonitoraggioProgetti interessati]]')
end
 
-- messaggio d'errore con progetti non esistenti
return args, table.concat(errcat)
if #nonexistingProjects > 0 then
local descr = #nonexistingProjects > 1 and 'non esistono i progetti' or 'non esiste il progetto'
errmsg = string.format('<span class="error" style="margin:5px 10%%">Errore: %s %s</span>',
descr, mw.text.listToText(nonexistingProjects))
end
 
return args, projects, errcat, errmsg
end
 
-- Formatta i valori assegnati ai parametri "accuratezza", "scrittura", "fonti" e "immagini".
local function getSpanGrade(value)
--
local spanStyle = {
-- @param {string} value
-- @return {table}
local function getLabelGrade(value)
local codeStyle = {
['font-weight'] = 'bold',
['font-size'] = '155%',
['borderpadding-left'] = '1px solid lightsteelblue.2em',
['padding-right'] = '.2em',
border = '1px solid lightsteelblue',
background = cfg.colors[value] or 'white'
}
local spanNode =return mw.html.create('spancode')
:css(codeStyle)
value = string.format("&thinsp;'''<tt>%s&thinsp;</tt>'''",
:wikitext(value and value:upper() or '<small>nc</small>')
end
spanNode
 
:css(spanStyle)
-- Restituisce true se almeno un progetto tra quelli specificati
:wikitext(value)
-- ha attivato il monitoraggio.
return spanNode
--
-- @param {table} projects
-- @return {boolean}
local function hasMonitoraggio(projects)
local ret = false
for _, project in ipairs(projects) do
if project.monitoraggio then
ret = true
break
end
end
return ret
end
 
-- =============================================================================
-------------------------------------------------------------------------------
-- Funzioni base del Monitoraggio
-- =============================================================================
-------------------------------------------------------------------------------
 
-- Restituisce il risultato del monitoraggio in base alle valutazioni inserite
-- nei quattro parametri "accuratezza", "scrittura", "fonti" e "immagini".
-- Il valore restituito, dal basso verso l'alto, può essere:
-- "0.2", "0.3", "0.4", "0.5", "IMMAGINI", "F", "W", "BOZZA", "1", "2", "3", "4".
--
-- @param {table} args
-- @return {string}
local function getLivello(args)
local ret
Riga 160 ⟶ 234:
end
 
-- Restituisce le categorie di servizio in base al livello del monitoraggio ottenuto,
local function getCategories(livello, args)
-- agli eventuali parametri "importanza" e alla presenza di errori utente di compilazione.
--
-- @param {string} livello
-- @param {table} args
-- @param {table} projects
-- @return {table}
local function getCategories(livello, args, projects)
local ret = {}
local cat
Riga 170 ⟶ 251:
table.insert(ret, cat)
 
for _, paramproject in ipairs(projParamsprojects) do
if args[param]project.monitoraggio then
cat = string.format('[[Categoria:Voci monitorate Progetto %s]]', project(param, args).name)
table.insert(ret, cat)
end
Riga 180 ⟶ 261:
-- per la "Situazione monitoraggio per parametro" di [[Progetto:Qualità/Monitoraggio voci/Tabella]]
cat = string.format('[[Categoria:Voci monitorate - %s %s]]',
gradeParam, grade(args[gradeParam,] argsor 'nc'):upper())
table.insert(ret, cat)
 
-- categorie per il [[template:Tabella monitoraggio]]
for _, projParamproject in ipairs(projParamsprojects) do
if args[projParam]project.monitoraggio then
cat = string.format('Categoria:Progetto:%s/Tabella monitoraggio automatico - %s %s',
project(projParam, args).name, gradeParam, grade(args[gradeParam,] args)or 'nc')
if titleExists(cat) then
table.insert(ret, '[[' .. cat .. ']]')
Riga 196 ⟶ 277:
 
-- categorie per il [[template:Tabella monitoraggio]]
for _, paramproject in ipairs(projParamsprojects) do
if args[param]project.monitoraggio then
cat = string.format('Categoria:Voci monitorate Progetto %s - %s',
project(param, args).name, suffix)
if titleExists(cat) then
table.insert(ret, '[[' .. cat .. ']]')
end
end
--cat = string.format('Categoria:Voci monitorate Progetto %s - importanza %s',
if project.importance and project.catPrefix then
-- project(param, args), importanceFromProject(param, args))
cat = string.format('Categoria:%s - importanza %s', project.catPrefix, project.importance)
--table.insert(ret, '[[' .. cat .. ']]')
table.insert(ret, '[[' .. cat .. ']]')
end
end
 
-- per la "Situazione monitoraggio per mese" di [[Progetto:Qualità/Monitoraggio voci/Tabella]]
if args.datalivello then
if args.data then
cat = string.format('Categoria:Voci monitorate - %s', args.data)
if titleExists(cat) then
table.insert(ret, '[[' .. cat .. ']]')
else
table.insert(ret, '[[Categoria:Errori di compilazione del template Progetti interessati]]')
end
else
table.insert(ret, '[[Categoria:ErroriVoci dimonitorate compilazione- delnon template Monitoraggiodatate]]')
end
elseif (args.data or args.utente) and not args.note then
else
table.insert(ret, '[[Categoria:VociPagine monitoratecon -template nonProgetti datateinteressati con utente o data e senza monitoraggio]]')
end
 
Riga 224 ⟶ 310:
end
 
-- =============================================================================
-------------------------------------------------------------------------------
-- classe Classe ProjectsTable
-- =============================================================================
-------------------------------------------------------------------------------
 
-- La classe ProjectsTable rappresenta la prima delle due tabelle HTML
-- prodotte dal modulo, quella per elencare i wikiprogetti.
 
local ProjectsTable = {}
 
function-- Costruttore della classe ProjectsTable:new(args).
--
-- @param {table} projects
-- @return {table} un nuovo oggetto ProjectsTable
function ProjectsTable:new(projects)
local self = {}
setmetatable(self, { __index = ProjectsTable })
self.argsprojects = argsprojects
return self
end
 
-- Restituisce la tabella HTML con una riga di introduzione e una per la sottotabella progetti.
--
-- @return {string}
function ProjectsTable:getHTML()
local tableStyle = {
margin = '5px 10% 0 10%',
width = '80%',
border = '1px solid #a7d7f9',
['background-color'] = '#EAF7ED'cfg.bgcolor,
}
local text = #self.projects > 1 and cfg.progetti.text2 or cfg.progetti.text
local tableNode = mw.html.create('table'):css(tableStyle)
 
-- intestazione
local projects = {}
for _, param in ipairs(projParams) do
if self.args[param] then
table.insert(projects, self.args[param])
end
end
local text = 'La voce <b>' .. mw.title.getCurrentTitle().text .. '</b> rientra tra gli argomenti trattati' ..
(#projects > 1 and " dai seguenti [[Wikipedia:Progetto|progetti]]:" or
" dal seguente [[Wikipedia:Progetto|progetto]]:")
tableNode
:tag('tr')
:tag('td')
:css('padding-leftwidth', '.3em52px')
:wikitextcss('text-align', 'center')
:wikitext(cfg.progetti.icon)
:done()
:tag('td')
:wikitext(mw.getCurrentFrame():preprocess(text))
:done()
tableNode
:tag('tr')
:tag('td')
:nodeattr(self:getNodeProjects()'colspan', '2')
:node(self:_getNodeProjects())
:done()
 
if titleExists(mw.getCurrentFrame():preprocess('WP:Bibliografia/{{SUBJECTPAGENAME}}')) then
tableNode
:tag('tr')
:tag('td')
:css('text-align', 'center')
:attr('colspan', '2') :wikitext(mw.getCurrentFrame():preprocess('[[WP:Bibliografia/{{SUBJECTPAGENAME}}|Bibliografia utilizzabile]]'))
:done()
end
 
return tostring(tableNode)
end
 
-- Restituisce la sottotabella HTML con un progetto per riga.
function ProjectsTable:getNodeProjects()
--
-- @return {table}
function ProjectsTable:_getNodeProjects()
local tableStyle = {
width = '100%',
Riga 278 ⟶ 382:
 
-- progetti
for _, paramproject in ipairs(projParamsself.projects) do
tableNode:tag('tr')
if self.args[param] then
:css('background-color', 'white')
tableNode:tag('tr')
:css('background-colorborder', 'whitethin solid #D8D8D8')
:tag('td')
:css('border', 'thin solid #D8D8D8')
:tagcss('tdwidth', '28px')
:css('widthtext-align', '28pxcenter')
:wikitext(project.icon)
:css('text-align', 'center')
:done()
:wikitext(self:getIconProject(project(param, self.args, true)))
:donetag('td')
:tagcss('tdwidth', '1px')
:css('widthwhite-space', '1pxnowrap')
:wikitext(string.format("'''[[Progetto:%s|%s]]'''", project.name, project.subpage))
:css('white-space', 'nowrap')
:done()
:wikitext(string.format("'''[[Progetto:%s|%s]]'''", project(param, self.args), project(param, self.args, true)))
:donetag('td')
:tagaddClass('tdplainlinks')
:wikitextcss('<div class="plainlinks" style="padding-left: 5px">' .. self:getWlinkProject(param) .., '</div>5px')
:wikitext(self:_getWlinkProject(project))
:done()
:done()
end
:tag('td')
:css('width', '11em')
:wikitext((project.importance and project.catPrefix) and
string.format('[[:Categoria:%s - importanza %s|importanza %s]]',
project.catPrefix, project.importance, project.importance) or '')
:done()
end
 
Riga 302 ⟶ 412:
end
 
-- Restituisce il link al progetto, al bar di progetto e all'eventuale monitoraggio delle voci.
function ProjectsTable:getIconProject(name)
--
local icon = mw.getCurrentFrame():expandTemplate {
-- @param {table} project
title = 'Icona argomento',
-- @return {string}
args = { name }
function ProjectsTable:_getWlinkProject(project)
}
local links = {}
icon = icon == '' and 'Crystal Clear app ksirtet.png' or icon
local fmtIcon = '[[File:Rpb dialog icon.svg|23x15px|bar di progetto|link=Discussioni progetto:%s]]'
local fmtIcon2 = '[[File:VisualEditor - Icon - Search-big.svg|20x20px|monitoraggio voci|link=Progetto:%s/Monitoraggio voci]]'
 
returntable.insert(links, string.format('[[File:%s|25x40px]]'fmtIcon, iconproject.name))
table.insert(links, string.format('[[Discussioni progetto:%s|bar di progetto]]', project.name))
-- link monitoraggio opzionale
if project.monitoraggio then
table.insert(links, string.format(fmtIcon2, project.name))
table.insert(links, string.format('[[Progetto:%s/Monitoraggio voci|monitoraggio voci]]', project.name))
end
 
return table.concat(links, ' ')
end
 
-- =============================================================================
function ProjectsTable:getWlinkProject(param)
-- Classe MonitoraggioTable
local fmt = '<small>([[Discussioni progetto:%s|leggi discussioni]]' ..
-- =============================================================================
' <b>·</b> [%s nuova discussione]' ..
' <b>·</b> [[Progetto:%s/Monitoraggio voci|monitoraggio]])</small>'
return string.format(fmt,
project(param, self.args),
mw.title.new('Discussioni progetto:' ..
project(param, self.args)):fullUrl( { action = 'edit', section = 'new' } ),
project(param, self.args))
--importanceFromProject(param, self.args))
end
 
-- La classe ProjectsTable rappresenta la seconda delle due tabelle HTML
-------------------------------------------------------------------------------
-- prodotte dal modulo, quella per visualizzare la valutazione del monitoraggio.
-- classe AssessmentTable
-------------------------------------------------------------------------------
 
local AssessmentTableMonitoraggioTable = {}
 
-- Costruttore della classe MonitoraggioTable.
function AssessmentTable:new(livello, args)
--
-- @param {string} livello
-- @param {table} args
-- @return {table} un nuovo oggetto MonitoraggioTable
function MonitoraggioTable:new(livello, args)
local self = {}
setmetatable(self, { __index = AssessmentTableMonitoraggioTable })
self.livello = livello
self.args = args
Riga 338 ⟶ 454:
end
 
-- Restituisce la tabella HTML con una riga di introduzione e una per la sottotabella
function AssessmentTable:getHTML()
-- collassabile per "accuratezza", "scrittura", "fonti" e "immagini".
-- Termina con due righe opzionali in base alla presenza delle note e della data.
--
-- @return {string}
function MonitoraggioTable:getHTML()
local tableStyle = {
margin = '05px 10% 5px 10%',
width = '80%',
border = '1px solid #a7d7f9',
['background-color'] = '#EAF7ED',cfg.bgcolor
['border-top'] = '0',
}
local tableNode = mw.html.create('table')
Riga 351 ⟶ 471:
:css(tableStyle)
 
-- livello
tableNode
:node(self:getNodeLivello_getNodeLivello())
-- valutazioni
tableNode
Riga 364 ⟶ 484:
:css('width', '100%')
:css('border-collapse', 'collapse')
:node(self:getNodeGrade_getNodeGrade('accuratezza'))
:node(self:getNodeGrade_getNodeGrade('scrittura'))
:node(self:getNodeGrade_getNodeGrade('fonti'))
:node(self:getNodeGrade_getNodeGrade('immagini'))
-- note
if self.args.note then
Riga 373 ⟶ 493:
:tag('tr')
:tag('td')
:css('padding-left', '0.2em')
:attr('colspan', '3')
:wikitext(string.format("<ul><li>''note'Note:''' %s</li></ul>%s", self.args.note))
self.args.note:match('^[#*]') and '\n' or '',
self.args.note))
end
-- data
if self.args.data then
local data = self:_getTextData()
tableNode
:tag('tr')
:tag('td')
:css('text-align', 'right')
:css('font-size', '80%')
:css('line-height', '1')
:attr('colspan', '3')
:wikitext(string.format('Monitoraggio effettuato %s%s',
data:match('^[ao]') and 'nell\'' or 'nel ', data))
end
 
Riga 380 ⟶ 516:
end
 
-- Restituisce la prima riga della tabella HTML, contenente il risultato del monitoraggio
function AssessmentTable:getNodeLivello()
-- oppure l'indicazione che il monitoraggio non è ancora stato effettuato.
local url = mw.title.getCurrentTitle():fullUrl( { action = 'edit' } )
--
local trNode = mw.html.create('tr')
-- @return {table}
trNode
function MonitoraggioTable:_getNodeLivello()
local text, icon
if self.livello then
if self.livello:sub(1, 1) == '0' then
icon, text = cfg.monitoraggio.icon_pc, cfg.monitoraggio.text_pc
else
icon, text = cfg.monitoraggio.icon, cfg.monitoraggio.text
text = string.format('%s<br />Ha ottenuto una valutazione di livello %s <small>(%s)</small>.',
text, self:_getWlinkLivello(), self:_getTextData())
end
else
icon, text = cfg.monitoraggio.icon_nc, cfg.monitoraggio.text_nc
end
return mw.html.create('tr')
:tag('td')
:css('background-colorwidth', 'none52px')
:css('widthtext-align', '90pxcenter')
:wikitext(icon)
:node(self:getWlinkLivello())
:done()
:tag('td')
:wikitext(mw.getCurrentFrame():preprocess(text))
:wikitext(self.livello and cfg.livello[self.livello].msg .. ' ' .. self:getTextData() or
"<div class=\"plainlinks\">La voce non è stata ancora monitorata, [" .. url .. " fallo ora]!</div>")
:done()
:tag('td')
:css('width', '80px')
:wikitext('')
:done()
 
return trNode
end
 
-- Restituisce il wikilink del risultato del monitoraggio, formattato opportunamente.
function AssessmentTable:getWlinkLivello()
--
local spanStyle = {
-- @return {string}
function MonitoraggioTable:_getWlinkLivello()
local codeStyle = {
['font-weight'] = 'bold',
['fontpadding-sizeleft'] = '125%.4em',
['padding-right'] = '.4em',
border = '1px solid lightsteelblue',
background = (self.livello and cfg.livello[self.livello].color) and cfg.livello[self.livello].color or 'white',
color = 'blue'
}
local text = string.format('[[:Categoria:Voci monitorate - %s|%s]]',
local spanNode = mw.html.create('span')
cfg.livello[self.livello].cat, cfg.livello[self.livello].label)
local text
local codeNode = mw.html.create('code')
if self.livello and cfg.livello[self.livello].label then
codeNode:css(codeStyle)
text = string.format('[[:Categoria:Voci monitorate - %s|%s]]',
codeNode:wikitext(text)
cfg.livello[self.livello].cat, cfg.livello[self.livello].label)
return tostring(codeNode)
elseif not self.livello then
text = '[[:Categoria:Voci monitorate - non compilate|NC]]'
end
if text then
spanNode:css(spanStyle)
text = string.format("'''<tt>&nbsp;%s&nbsp;</tt>'''", text)
else
text = '[[File:Symbol stub class.svg|25px|center]]'
end
spanNode:wikitext(text)
 
return spanNode
end
 
-- Restituisce la data del monitoraggio se esiste la relativa categoria
function AssessmentTable:getTextData()
-- di monitoraggio per mese oppure un messaggio di errore.
--
-- @return {string}
function MonitoraggioTable:_getTextData()
local ret
 
if self.args.data then
local cat = string.format('Categoria:Voci monitorate - %s', self.args.data)
if titleExists(cat) then
ret = '<small>(' .. self.args.data .. ')</small>'
end
end
return ret or "<span style=\"color:red;\">'''''mese e anno'''''</span>"
 
return ret or "(<span style=\"color:red;\"><small>'''''mese e anno'''''</small></span>)"
end
 
-- Restituisce la riga della tabella HTML per ciascuna delle quattro valutazioni di
function AssessmentTable:getNodeGrade(param)
-- "accuratezza", "scrittura", "fonti" e "immagini", formattata opportunamente.
local trNode = mw.html.create('tr')
--
local descr = cfg[param][self.args[param] or 'nc'] .. ' ' .. cfg[param].help
-- @param {string} param
trNode
-- @return {table}
function MonitoraggioTable:_getNodeGrade(param)
return mw.html.create('tr')
:css('background-color', 'white')
:css('border', 'thin solid #D8D8D8')
:tag('td')
:css('width', '40px52px')
:css('paddingtext-leftalign', '5pxcenter')
:node(getSpanGradegetLabelGrade(self.args[param]))
:done()
:tag('td')
:wikitext(cfg[param][self.args[param] or 'nc'] .. ' ' .. cfg[param].help)
:wikitext(descr)
:done()
 
return trNode
end
 
-- =============================================================================
-------------------------------------------------------------------------------
-- Funzioni APIesportate
-- =============================================================================
-------------------------------------------------------------------------------
 
local p = {}
 
-- PerFunzione per l'utilizzo da un altro modulo.
function p._livello(args)
return getLivello(parseArgs(args))
end
 
-- Entry-pointFunzione per {{#invoke:monitoraggioProgetti interessati|livello}}.
function p.livello(frame)
return p._livello(getArgs(frame))
end
 
-- Entry-pointFunzione per {{#invoke:monitoraggioProgetti interessati|categorie}}.
function p.categorie(frame)
local args, projects = parseArgs(getArgs(frame))
local livello = getLivello(args)
local categories = getCategories(livello, args, projects)
return args.debug and ( table.concat(categories, '<br />'):gsub('%[%[', '[[:') ) .. '<br />' or
table.concat(categories)
end
 
-- Entry-pointFunzione per il sottotemplate {{MonitoraggioProgetti interessati/classe}}
-- per retrocompatibilità con template che lo usavano.
function p.classe(frame)
local value = frame:getParent().args[1]
return tostring(getSpanGradegetLabelGrade(validGrades[value] and value or nil))
end
 
-- Entry-pointFunzione per il template {{MonitoraggioProgetti interessati}}.
function p.main(frame)
local args, errorCatprojects, errcat, errmsg = parseArgs(getArgs(frame, { parentOnly = true }))
if hasMonitoraggio(projects) then
local livello = getLivello(args)
local livello = getLivello(args)
local categories = mw.title.getCurrentTitle().namespace == 1 and
(table.concat(getCategories(livello, args, projects)) .. errorCattable.concat(errcat)) or ''
return ProjectsTable:new(args):getHTML(errmsg or '') ..
AssessmentTableProjectsTable:new(livello, argsprojects):getHTML() ..
MonitoraggioTable:new(livello, args):getHTML() ..
categories
categories
else
return (errmsg or '') ..
ProjectsTable:new(projects):getHTML() ..
table.concat(errcat)
end
end