addon_manager: Backported sortable columns to 1.4.

This commit is contained in:
Elias Pschernig 2008-10-11 10:57:33 +00:00
parent a90131bbce
commit 2f3b017d4f
5 changed files with 29 additions and 9 deletions

View file

@ -12,7 +12,8 @@ def output(path, url, data):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href=\"style.css\" type=\"text/css\">
<link rel=stylesheet href="style.css" type="text/css">
<script src="sorttable.js"></script>
</head>
<body>""")
@ -30,12 +31,13 @@ Select the add-on you want to install from the list and click "OK". The download
<p>Note: Hover over the icons to see the description of the add-on.</p>
<br/>""")
os.system("cp -u utils/campaigns_client/style.css " + path)
os.system("cp -u utils/addon_manager/style.css " + path)
os.system("cp -u utils/addon_manager/sorttable.js " + path)
campaigns = data.get_or_create_sub("campaigns")
w("<table id=\"campaigns\">")
w("<table class=\"sortable\" id=\"campaigns\">")
w("<tr>")
w("<th></th>")
w("<th class=\"sorttable_nosort\"></th>")
w("<th>Addon</th>")
w("<th>Size</th>")
w("<th>Traffic</th>")
@ -81,10 +83,14 @@ Select the add-on you want to install from the list and click "OK". The download
w("<br/><a href=\"%s\">download</a></td>" % link)
else:
w("</td>")
w("<td><b>%s</b> down<br/>" % v("downloads", "unknown"))
downloads = int(v("downloads", "0"))
w("<td sorttable_customkey=\"%d\"><b>%d</b> down<br/>" % (downloads,
downloads))
w("%s up</td>" % v("uploads", "unknown"))
t = time.localtime(int(v("timestamp", "unknown")))
w("<td>%s</td>" % time.strftime("%b %d %Y", t))
timestamp = int(v("timestamp", "0"))
t = time.localtime(timestamp)
w("<td sorttable_customkey=\"%d\">%s</td>" % (timestamp,
time.strftime("%b %d %Y", t)))
w("<td>%s</td>" % v("translate", ""))
w("</tr>")
w("</table>")

File diff suppressed because one or more lines are too long

View file

@ -304,8 +304,8 @@ if __name__ == "__main__":
cs = CampaignClient(address)
data = cs.list_campaigns()
if data:
import campaigns_client.html
campaigns_client.html.output(options.html, options.url, data)
import addon_manager.html
addon_manager.html.output(options.html, options.url, data)
else:
sys.stderr.write("Could not connect.\n")