跳转到内容

模組:AFC submission/RejectReasonSheet

维基百科,自由的百科全书

这是本页的一个历史版本,由Hotaru Natsumi留言 | 贡献2022年9月14日 (三) 05:00编辑。这可能和当前版本存在着巨大的差异。

local p = {}

local seriousRejectReasons = {}
local rejectReasons = {}
local possibleRejectReasons = {}
local fixNeeded = {}

local function catWikitext(prefix, arr, color) 
	local str = '<div><span style="color:'.. color  ..';">' .. prefix .. '</span>:'
	if arr[1] == nil then
		return ''
	end
	for k, v in pairs(arr) do 
		str = str .. '\n*' .. arr[k]
	end
	return str .. '</div>'
end

local function assignArgs(t) 
	local i = 1
	while true do 
		local iStr = tostring(i)
		if t['srr'..iStr] == nil then
			break
		end
		seriousRejectReasons[i] = t['srr'..iStr]
		i = i + 1
	end
	i = 1
	while true do 
		local iStr = tostring(i)
		if t['rr'..iStr] == nil then
			break
		end
		rejectReasons[i] = t['rr'..iStr]
		i = i + 1
	end
	i = 1
	while true do 
		local iStr = tostring(i)
		if t['prr'..iStr] == nil then
			break
		end
		possibleRejectReasons[i] = t['prr'..iStr]
		i = i + 1
	end
	i = 1
	while true do 
		local iStr = tostring(i)
		if t['fn'..iStr] == nil then
			break
		end
		fixNeeded[i] = t['fn'..iStr]
		i = i + 1
	end
end

function p.main(frame)
	assignArgs(frame:getParent().args)
	srrStr = catWikitext('以下项目严重阻止条目审核通过', seriousRejectReasons, 'darkred')
	rrStr = catWikitext('以下项目阻止条目审核通过', rejectReasons, 'red')
	prrStr = catWikitext('以下项目可能影响条目审核通过', possibleRejectReasons, 'orange')
	fnStr = catWikitext('以下项目建议修正', fixNeeded, 'blue')
	footer = ''
	if srrStr == '' and rrStr == '' then
		footer = '注意:此次拒绝不代表此审核员认为该版本不可发布,但仍可能被其他审核员拒绝,您若确实无念修正上述问题,可直接重新提交。'
	end
	if srrStr == '' and rrStr == '' and prrStr == '' then
		footer = '注意:此次拒绝不代表此审核员认为该版本不可发布,仅作为修改意见,您若不愿接受该修改意见,可直接重新提交。'
	end
	if frame:getParent().args['suffix'] ~= nil then
		if footer == '' then
			footer = frame:getParent().args['suffix']
		else
			footer = footer .. '\n\n' .. frame:getParent().args['suffix']
		end
	end
	local div = mw.html.create( 'div' )
	div
	     :css('width', 'auto')
	     :css('border-left', '4px solid #66ccff')
	     :css('background', '#dcfdff')
	     :css('padding', '10px')
	     :wikitext(srrStr .. rrStr .. prrStr .. fnStr .. footer)
	return div
end

return p