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,10 @@ class IWLADisplayTopHits(IPlugin):
page = DisplayHTMLPage(title, path, self.iwla.getConfValue('css_path', []))
table = DisplayHTMLBlockTable('All Hits', ['URI', 'Entrance'])
table.setColsCSSClass(['', 'iwla_hit'])
total_hits = [0]*2
for (uri, entrance) in top_hits:
table.appendRow([generateHTMLLink(uri), entrance])
total_hits[1] += entrance
page.appendBlock(table)
self.iwla.getDisplay().addPage(page)
@@ -38,4 +40,9 @@ class IWLADisplayTopHits(IPlugin):
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_hits[:10]:
table.appendRow([generateHTMLLink(uri), entrance])
total_hits[1] -= entrance
if total_hits[1]:
total_hits[0] = 'Others'
table.appendRow(total_hits)
table.setCellCSSClass(table.getNbRows()-1, 0, 'iwla_others')
index.appendBlock(table)