Module:Task: Difference between revisions

From atwg
No edit summary
No edit summary
 
(38 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}
 
function p.displayTextCell( s )
if ( s ) then
return '| style="vertical-align:top;" | ' .. table.concat( s, ', ' ) .. '\n'
else
return '|\n'
end
end
 
function p.displayTable(frame)
function p.displayTable(frame)


local query = '[[Category:Outcomes]]|?Description|limit=100'
local query = '[[Category:Outcomes]][[Archived::!true]]|?Long Name|limit=100'
     local outcomes = mw.smw.getQueryResult( query )
     local outcomes = mw.smw.getQueryResult( query )
     if outcomes == nil or #outcomes.results == 0 then
     if outcomes == nil or #outcomes.results == 0 then
Line 12: Line 20:
s = s .. '! Output\n'
s = s .. '! Output\n'
s = s .. '! Task\n'
s = s .. '! Task\n'
s = s .. '! style="min-width:300px;" | Description\n'
s = s .. '! Depends On Tasks\n'
s = s .. '! Type\n'
s = s .. '! Type\n'
s = s .. '! Associated Outputs\n'
s = s .. '! Primary Team\n'
s = s .. '! Primary TeamCollaborating Teams\n'
s = s .. '! Collaborating Teams\n'
s = s .. '! Start Year\n'
s = s .. '! Start Year\n'
s = s .. '! Duration\n'
s = s .. '! Duration\n'
s = s .. '! Depends On Tasks\n'
s = s .. '! Risks\n'
s = s .. '! Risks\n'
s = s .. '! Contingencies\n'
s = s .. '! Contingencies\n'
Line 23: Line 32:
s = s .. '! Assumptions\n'
s = s .. '! Assumptions\n'
s = s .. '! Implications\n'
s = s .. '! Implications\n'
s = s .. '! Notes\n'
s = s .. '! style="min-width:300px;" | Notes\n'
s = s .. '|-\n'
s = s .. '|-\n'
for k1,v1 in pairs( outcomes.results ) do
for k1,v1 in pairs( outcomes.results ) do
query = '[[Category:Outputs]][[Parent Outcome::' .. v1.fulltext .. ']]|limit=100'
query = '[[Category:Outputs]][[Parent Outcome::' .. v1.fulltext .. ']][[Archived::!true]]|?Long Name|limit=100'
    local outputs = mw.smw.getQueryResult( query )
local outputs = mw.smw.getQueryResult( query )
    if outputs == nil or #outputs.results == 0 then
if outputs == nil or #outputs.results == 0 then
         return ""
         return ""
    end
end
     
     
    s = s .. '| rowspan="' .. #outputs.results .. '" | [[' .. v1.fulltext .. '|' .. v1.displaytitle .. ']]\n'
local rowcount = 0
   
local rows = ''
    for k2,v2 in pairs ( outputs.results ) do
for k2,v2 in pairs( outputs.results ) do
    s = s .. '| [[' .. v2.fulltext .. ']]\n'
query = '[[Category:Tasks]][[Associated Output::' .. v2.fulltext .. ']][[Archived::!true]]' ..
    -- task stuff
'|?Description' ..
    s = s .. '|-\n'
'|?Depends On Task' ..
    end
'|?Type' ..
    end
'|?Primary Team' ..
   
'|?Collaborating Team' ..
 
'|? Start Year' ..
--[[]
'|?Duration' ..
result = result .. '! rowspan="2" | Issue\n'
'|?Risks' ..
result = result .. '! colspan=' .. #v.values .. ' | ' .. v.name .. '\n'
'|?Contingencies' ..
end
'|?Benefits' ..
result = result .. '|-\n'
'|?Assumptions' ..
for k1,v1 in ipairs( p.Taxonomy ) do
'|?Implications' ..
for k2,v2 in ipairs( v1.values ) do
'|?Notes' ..
result = result .. '! ' ..
'|limit=100'
frame:expandTemplate{ title = 'Tag Link', args = { v2 } } .. '\n'
local tasks = mw.smw.getQueryResult( query )
end
if tasks ~= nil then
end
rows = rows .. '| rowspan="' .. #tasks.results .. '" style="vertical-align:top;" | [[' .. v2.fulltext .. '|' .. table.concat( v2.printouts['Long Name'] ) .. ']]\n'
 
if ( #tasks.results == 0 ) then
result = result .. '|-\n!<br/>'
rowcount = rowcount + 1
for k1,v1 in ipairs( p.Taxonomy ) do
rows = rows .. '|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|-\n'
for k2,v2 in ipairs( v1.values ) do
else
result = result .. '!!'
rowcount = rowcount + #tasks.results
end
for k3,v3 in pairs( tasks.results ) do
end
rows = rows .. '| style="vertical-align:top;" | [[' .. v3.fulltext .. ']]\n'
result = result .. '\n'
rows = rows .. p.displayTextCell( v3.printouts.Description )
 
rows = rows .. '| style="vertical-align:top;" |\n'
for k1,v1 in pairs( issues.results ) do
for k4,v4 in pairs ( v3.printouts['Depends On Task'] ) do
result = result .. '|-\n'
rows = rows .. '* [[' .. v4.fulltext .. ']]\n'
]]
end
-- result = result .. '| [[' .. v1.fulltext .. '|' .. v1.printouts['Description'][1] .. ']]\n'
rows = rows .. '\n'
--[[]
rows = rows .. p.displayTextCell( v3.printouts.Type )
for k2,v2 in ipairs( p.Taxonomy ) do
rows = rows .. p.displayTextCell( v3.printouts['Primary Team'] )
local query_values = v1.printouts[v2.property]
rows = rows .. '| style="vertical-align:top;" |\n'
for k3,v3 in ipairs( v2.values ) do
for k4,v4 in pairs ( v3.printouts['Collaborating Team'] ) do
result = result .. '| style="text-align:center;min-width:60px;" |'
rows = rows .. '* ' .. v4 .. '\n'
for k4,v4 in pairs(query_values) do
end
if v3 == v4 then
rows = rows .. '\n'
result = result .. 'X'
rows = rows .. p.displayTextCell( v3.printouts['Start Year'] )
rows = rows .. p.displayTextCell( v3.printouts.Duration )
rows = rows .. p.displayTextCell( v3.printouts.Risks )
rows = rows .. p.displayTextCell( v3.printouts.Contingencies )
rows = rows .. p.displayTextCell( v3.printouts.Benefits )
rows = rows .. p.displayTextCell( v3.printouts.Assumptions )
rows = rows .. p.displayTextCell( v3.printouts.Implications )
rows = rows .. p.displayTextCell( v3.printouts.Notes )
rows = rows .. '|-\n'
end
end
end
end
result = result .. '\n'
end
end
end
end
end
s = s .. '| rowspan="' .. rowcount .. '" style="vertical-align:top;" | [[' .. v1.fulltext .. '|' .. table.concat( v1.printouts['Long Name'] ) .. ']]\n'
s = s .. rows


]]
    end
   
s = s .. '|}'
s = s .. '|}'
     return s
     return s

Latest revision as of 09:56, 20 February 2018

Documentation for this module may be created at Module:Task/doc

local p = {}

function p.displayTextCell( s )
	if ( s ) then
		return '| style="vertical-align:top;" | ' .. table.concat( s, ', ' ) .. '\n'
	else
		return '|\n'
	end
end

function p.displayTable(frame)

	local query = '[[Category:Outcomes]][[Archived::!true]]|?Long Name|limit=100'
    local outcomes = mw.smw.getQueryResult( query )
    if outcomes == nil or #outcomes.results == 0 then
        return ""
    end
	s = '{| class="wikitable tasktable"\n'
	s = s .. '! Outcome\n'
	s = s .. '! Output\n'
	s = s .. '! Task\n'
	s = s .. '! style="min-width:300px;" | Description\n'
	s = s .. '! Depends On Tasks\n'
	s = s .. '! Type\n'
	s = s .. '! Primary Team\n'
	s = s .. '! Collaborating Teams\n'
	s = s .. '! Start Year\n'
	s = s .. '! Duration\n'
	s = s .. '! Risks\n'
	s = s .. '! Contingencies\n'
	s = s .. '! Benefits\n'
	s = s .. '! Assumptions\n'
	s = s .. '! Implications\n'
	s = s .. '! style="min-width:300px;" | Notes\n'
	s = s .. '|-\n'
	
	for k1,v1 in pairs( outcomes.results ) do
		query = '[[Category:Outputs]][[Parent Outcome::' .. v1.fulltext .. ']][[Archived::!true]]|?Long Name|limit=100'
		local outputs = mw.smw.getQueryResult( query )
		if outputs == nil or #outputs.results == 0 then
        	return ""
		end
	    
		local rowcount = 0
		local rows = ''
		for k2,v2 in pairs( outputs.results ) do
			query = '[[Category:Tasks]][[Associated Output::' .. v2.fulltext .. ']][[Archived::!true]]' ..
				'|?Description' ..
				'|?Depends On Task' ..
				'|?Type' ..
				'|?Primary Team' ..
				'|?Collaborating Team' ..
				'|? Start Year' ..
				'|?Duration' ..
				'|?Risks' ..
				'|?Contingencies' ..
				'|?Benefits' ..
				'|?Assumptions' ..
				'|?Implications' ..
				'|?Notes' ..
				'|limit=100'
			local tasks = mw.smw.getQueryResult( query )
			if tasks ~= nil then
				rows = rows .. '| rowspan="' .. #tasks.results .. '" style="vertical-align:top;" | [[' .. v2.fulltext .. '|' .. table.concat( v2.printouts['Long Name'] ) .. ']]\n'
				if ( #tasks.results == 0 ) then
					rowcount = rowcount + 1
					rows = rows .. '|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|-\n'
				else
					rowcount = rowcount + #tasks.results
					for k3,v3 in pairs( tasks.results ) do
						rows = rows .. '| style="vertical-align:top;" | [[' .. v3.fulltext .. ']]\n'
						rows = rows .. p.displayTextCell( v3.printouts.Description )
						rows = rows .. '| style="vertical-align:top;" |\n'
						for k4,v4 in pairs ( v3.printouts['Depends On Task'] ) do
							rows = rows .. '* [[' .. v4.fulltext .. ']]\n'
						end
						rows = rows .. '\n'
						rows = rows .. p.displayTextCell( v3.printouts.Type )
						rows = rows .. p.displayTextCell( v3.printouts['Primary Team'] )
						rows = rows .. '| style="vertical-align:top;" |\n'
						for k4,v4 in pairs ( v3.printouts['Collaborating Team'] ) do
							rows = rows .. '* ' .. v4 .. '\n'
						end
						rows = rows .. '\n'
						rows = rows .. p.displayTextCell( v3.printouts['Start Year'] )
						rows = rows .. p.displayTextCell( v3.printouts.Duration )
						rows = rows .. p.displayTextCell( v3.printouts.Risks )
						rows = rows .. p.displayTextCell( v3.printouts.Contingencies )
						rows = rows .. p.displayTextCell( v3.printouts.Benefits )
						rows = rows .. p.displayTextCell( v3.printouts.Assumptions )
						rows = rows .. p.displayTextCell( v3.printouts.Implications )
						rows = rows .. p.displayTextCell( v3.printouts.Notes )
						rows = rows .. '|-\n'
					end
				end
			end
		end
		
		s = s .. '| rowspan="' .. rowcount .. '" style="vertical-align:top;" | [[' .. v1.fulltext .. '|' .. table.concat( v1.printouts['Long Name'] ) .. ']]\n'
		s = s .. rows

    end
    
	s = s .. '|}'
    return s
end

return p