Add Others field in index

This commit is contained in:
Grégory Soutadé
2014-12-05 16:03:09 +01:00
parent 4cb2736e22
commit fd858034fb
7 changed files with 79 additions and 4 deletions

View File

@@ -22,8 +22,11 @@ class IWLADisplayTopDownloads(IPlugin):
page = DisplayHTMLPage(title, path, self.iwla.getConfValue('css_path', []))
table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit'])
table.setColsCSSClass(['', 'iwla_hit'])
total_entrance = [0]*2
for (uri, entrance) in top_downloads:
table.appendRow([generateHTMLLink(uri), entrance])
total_entrance[1] += entrance
page.appendBlock(table)
self.iwla.getDisplay().addPage(page)
@@ -38,4 +41,9 @@ class IWLADisplayTopDownloads(IPlugin):
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_downloads[:10]:
table.appendRow([generateHTMLLink(uri), entrance])
total_entrance[1] -= entrance
if total_entrance[1]:
total_entrance[0] = 'Others'
table.appendRow(total_entrance)
table.setCellCSSClass(table.getNbRows()-1, 0, 'iwla_others')
index.appendBlock(table)