Last edited one week ago
by WikiSysop

IndicatorAudit

no content


local p = {} -- p stands for package

function p.forDate( frame )
    local todayU = frame:callParserFunction( '#time:U' )
    local pastU = frame:callParserFunction( '#time:U', '-2 months' )
    local timeU = frame:callParserFunction( '#time:U', frame.args[1] )
    local closed = frame.args[2]
    local color = 'green'
    local shape = '◉'  -- different shapes for accessibility WCAG 1.4.1
    local statusind = 'aktuell'
    if ( timeU < todayU ) then
    	color = '#CC8500'
    end
    if ( timeU < pastU ) then
    	color = 'red'
    	shape = '&#9678;'
    	statusind = 'überfällig'
    end
    if ( closed == 'closed' ) or ( closed == 'geschlossen' ) then
    	color = 'blue'
        shape = '&#9677;'
    	statusind = 'geschlossen'
    end
    return p.getIndicator( frame, color, shape, statusind )
end

function p.getIndicator( frame, color, shape, statusind )
	-- adding the statusind in hidden text makes the indicator sortable in tables
    return "<span class='date-indicator' title='" .. statusind .. "' role='img' style='color: " .. color .. ";font-size:1em;' aria-label='" .. statusind .. "'>" .. shape .. "<span style='display:none'>" .. statusind .. "</span></span>";
end

return p