Módulo:Avaliação: diferenças entre revisões
Conteúdo apagado Conteúdo adicionado
Remoção do teste "if mw.title.getCurrentTitle().basePageTitle == 'Marca de projeto' then" que só era necessário para categorizar as subpáginas da Predefinição:Marca de projeto (que não são mais usadas) |
Separação entre a interface e a lógica (discussão) |
||
Linha 18:
['format'] = 'predefinição',
['date'] = 'rev',
['reason'] = 'motivo',
['default-image'] = 'Exemplo.svg',
['nominate-to-GA'] = 'indique para EAD quando o artigo satisfizer os critérios de artigo bom',
['image-importance'] = 'Escala-laranja-$1de4.svg',
['image-importance-unknown'] = 'Escala-laranja-PA.svg',
['image-quality'] = 'Escala-azul-$1de6.svg',
['pagetype-0'] = 'artigo',
['pagetype-100'] = 'portal',
['pagetype-102'] = 'anexo',
['pagetype-other'] = 'conteúdo', -- "página" teria problemas de concordância
['importance-text'] = 'Para o \'\'\'[[$1|$2]]\'\'\' este $3 possui \'\'\'[[Predefinição:Escala de importância|importância]] $4\'\'\'. ' ..
'Se você se interessa pelo assunto, visite o projeto para conhecer as tarefas e [[$5|discussões]] em curso.',
['importance-unknown'] = 'ainda não avaliada',
['project-talk-page'] = 'Wikipédia Discussão:Projetos/$1',
['no-reason'] = 'motivo não informado',
['category-quality'] = '!Artigos de qualidade $1 sobre $2',
['category-quality-5'] = '!Artigos bons sobre $2',
['category-quality-6'] = '!Artigos destacados sobre $2',
['category-quality-unknown'] = '!Artigos de qualidade desconhecida sobre $1',
['category-quality-outdated'] = '!Artigos sobre $1 por reavaliar',
['category-quality-reviewed'] = '!Artigos com avaliação revisada',
['category-quality-conflict'] = '!Artigos com avaliações conflitantes-$1',
['category-quality-by-module'] = '!Artigos com qualidade estimada automaticamente',
['category-importance'] = '!Artigos de importância $1 sobre $2',
['category-importance-unknown'] = '!Artigos de importância desconhecida sobre $1',
['quality-aliases'] = {
['AB'] = 5,
['AD'] = 6
},
['quality-min'] = 1,
['quality-max'] = 6,
['quality-format'] = 'Qualidade $1 ($2)',
['project-contact'] = 'Se não tiver suas questões respondidas nesta página de discussão procure o(s) wikiprojeto(s) acima.',
['page-evaluated'] = 'Este $1 foi avaliado $2',
['page-evaluated-by-module'] = 'Este $1 foi avaliado [[Wikipédia:Avaliação automática|automaticamente]] $2',
['page-elected'] = 'Este $1 foi eleito $2',
['quality-value'] = 'com <b title="$2">[[Wikipédia:Qualidade|qualidade]] $1</b>',
['quality-value-5'] = 'um <b>$3 bom</b>',
['quality-value-6'] = 'um <b>$3 destacado</b>',
['quality-text'] = '$1.',
['quality-text-and-projects'] = '$1 e faz parte do âmbito de $2: $3.',
['quality-text-with-date'] = '$1 em $2.',
['quality-text-with-date-and-projects'] = '$1 em $2 e faz parte do âmbito de $3: $4.',
['projects-singular'] = 'um WikiProjeto',
['projects-plural'] = '$1 WikiProjetos'
}
local function msg(m, ...)
return mw.message.newRawMessage(m):params{...}:plain()
end
quality[2] = {
Linha 265 ⟶ 313:
-- Nada encontrado; Nothing found
return {4, msg(cfg['nominate-to-GA'])}
end
Linha 292 ⟶ 340:
quality = nil
end
local image = args['image'] or cfg['
local size = args['size'] or '75x50px'
local imgImportance
if importance then
imgImportance = msg(cfg['image-importance'], importance )
else
imgImportance = msg(cfg['image-importance-unknown'] )
end
local row = mw.html.create( 'tr' )
:tag( 'td' )
Linha 301 ⟶ 355:
:css( 'padding', '2px 0px 2px 0.9em' )
:css( 'text-align', 'center' )
:wikitext( '[[
:done()
:tag( 'td' )
Linha 307 ⟶ 361:
:css( 'border-bottom', '1px solid #fc8' )
:css( 'text-align', 'center' )
:wikitext( '[[File:' .. imgImportance .. ']]' )
:done()
local textCell = row:tag( 'td' )
Linha 326 ⟶ 376:
page = args['page'] or mw.title.getCurrentTitle().subjectPageTitle.prefixedText
local nsNum = mw.title.new( page ).namespace
local lang = mw.language.getContentLanguage()
local link = args['link']
Linha 349 ⟶ 395:
end
local text = args['text'] or link
local pageType =
local about = args['category'] or args['title']
local importanceText = importance or msg( cfg['importance-unknown'] )
local projPage = msg( cfg['project-talk-page'], args['talk'] or lang:ucfirst( about or '' ) )
textCell:wikitext( msg(cfg['importance-text'], link, text, pageType, importanceText, projPage ) )
local cats = {}
if mw.site.contentNamespaces[nsNum] and about then
if quality then
table.insert( cats, msg(cfg['category-quality-' .. quality] or cfg['category-quality'], quality, about) )
else
table.insert( cats, msg(cfg['category-quality-unknown'], about) )
end
end
if importance then
table.insert( cats, msg(cfg['category-importance'], importance, about) )
else
table.insert( cats, msg(cfg['category-importance-unknown'], about) )
end
if args['date'] then
if lang:formatDate( 'Ymd', '-6 months' ) > ( args['date'] or '99999999' ) then
table.insert( cats, msg(cfg['category-quality-outdated'], about) )
end
end
return tostring( row ) .. ( #cats ~= 0 and ( '[[Category:' .. table.concat(cats, ']]\n[[Category:') .. ']]' ) or '' )
end
Linha 392 ⟶ 426:
local qualityByUser = args[1] or args[cfg['quality']]
local qualityByModule = getClassForPage( page )
local reason = args[cfg['reason']] or msg(cfg['
local lang = mw.language.getContentLanguage()
-- Convert to numbers
qualityByUser = tonumber( cfg['quality-aliases'][ qualityByUser ] or qualityByUser )
end
Linha 445 ⟶ 469:
:css( 'text-align', 'right' )
:css( 'background', 'transparent' )
:wikitext( '[[
local qualityCell = firstRow:tag( #proj > 0 and 'th' or 'td' )
Linha 456 ⟶ 480:
local nsNum = mw.title.new( page ).namespace
local pageType = msg( cfg['pagetype-' .. nsNum] or cfg['pagetype-other'] )
local pageEvaluation
local pageQuality = msg(cfg['quality-value-' .. quality[1]] or cfg['quality-value'], quality[1], quality[2], pageType )
if quality[1] >= 5 then
pageEvaluation = msg(cfg['page-elected'], pageType, pageQuality )
else
pageEvaluation = msg(cfg['page-evaluated'], pageType, pageQuality )
else
pageEvaluation = msg(cfg['page-evaluated-by-module'], pageType, pageQuality )
end
end
if dateOfLastestReview and mw.ustring.len( dateOfLastestReview ) == 8 then
if #proj > 0 then
local projects
if #proj == 1 then
projects = msg(cfg['projects-singular'])
else
projects = msg(cfg['projects-plural'], #proj)
end
qualityCell:wikitext( msg(
cfg['quality-text-with-date-and-projects'],
pageEvaluation,
lang:formatDate( 'd "de" F "de" Y', dateOfLastestReview ),
projects,
mw.text.listToText( proj )
else
qualityCell:wikitext( msg(cfg['quality-text-with-date'], pageEvaluation ) )
end
else
if #proj > 0 then
local projects
projects = msg(cfg['projects-singular'])
else
projects = msg(cfg['projects-plural'], #proj)
end
qualityCell:wikitext( msg(
cfg['quality-text-and-projects'],
pageEvaluation,
projects,
mw.text.listToText( proj )
) )
else
qualityCell:wikitext( msg(cfg['quality-text'], pageEvaluation ) )
end
local banners = mw.loadData( 'Módulo:Avaliação/Marcas' )
Linha 542 ⟶ 568:
:css( 'text-align', 'center' )
:css( 'font-size', '90%' )
:wikitext( msg( cfg['project-contact'] ) )
end
Linha 549 ⟶ 575:
args = mw.title.new( page ).prefixedText
} ) or 0
local cats =
-- Categorizar somente se a página for um artigo (ou anexo)
if mw.site.contentNamespaces[nsNum] then
Linha 561 ⟶ 587:
if articleTimestamp <= userTimestamp then
-- A revisão atual do artigo é a mesma que foi analisada por um usuário
table.insert( cats, msg( cfg['category-quality-reviewed'] ) )
if qualityByUser[1] ~= qualityByModule[1] then
end
-- else
Linha 573 ⟶ 599:
end
else
table.insert( cats, msg( cfg['category-quality-by-module'] ) )
end
-- else
Linha 579 ⟶ 605:
end
return tostring( root ) .. ( #cats ~= 0 and ( '[[Category:' .. table.concat(cats, ']]\n[[Category:') .. ']]' ) or '' )
end
Linha 596 ⟶ 622:
local args = getArgs( frame )
local page = args[cfg['page']] or args[1]
local template = args[cfg['format']] or args[2] or msg( cfg['
if page == nil then
|