#!/usr/bin/python
import sys

#data = ['%d' % int(time.time())]

tag = sys.argv[1]

period_nice =  { '1day':'a day', 'week':'week', 'month':'month', 'halfyear':'half a year', 'fullyear':'year' }

periods = [ '1day', 'week', 'month', 'halfyear', 'fullyear' ]

header = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html lang="en">\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">\n<title>Graphs for %s</title>\n</head>\n<body>\n<h1>Graphs of bugs tagged %s</h1>''' % (tag, tag)

footer = '''</body></html>'''

print '''%s''' % (header)
for period in periods:
    print '''<h2>Triaging for %s</h2>''' % ( period_nice[period] )
    print '''<p><img src=plots/%s-%s-triaging.png></p>''' % ( tag.lower(), period ) 
#    for status in sort_status_relationship:
#        print '''<p><a title="%s tagged %s" href="%s&field.status:list=%s"><img src=plots/%s-%s-%s.png></a></p>''' % ( status, tag.lower(), status_url, status_relationship[status], tag.lower(), period, status ) 
    print '''<h2>Fixing for %s</h2>''' % ( period_nice[period] )
    print '''<p><img src=plots/%s-%s-fixing.png></p>''' % ( tag.lower(), period ) 
#    for importance in importances:
#        print '''<p><a title="%s tagged %s" href="%s&field.importance:list=%s"><img src=plots/%s-%s-%s.png></a></p>''' % ( importance, tag.lower(), importance_url, importance, tag.lower(), period, importance.lower() ) 
print '''%s''' % (footer)

#print ', '.join(data)
