Give iwla to each display class
Add generic functions createPage() and createBlock() in DisplayHTMLBuild Add and display IWLA version
This commit is contained in:
@@ -11,6 +11,7 @@ class IWLADisplayTopDownloads(IPlugin):
|
||||
self.requires = ['IWLAPostAnalysisTopDownloads']
|
||||
|
||||
def hook(self):
|
||||
display = self.iwla.getDisplay()
|
||||
top_downloads = self.iwla.getMonthStats()['top_downloads']
|
||||
top_downloads = sorted(top_downloads.items(), key=lambda t: t[1], reverse=True)
|
||||
|
||||
@@ -19,8 +20,8 @@ class IWLADisplayTopDownloads(IPlugin):
|
||||
path = self.iwla.getCurDisplayPath(filename)
|
||||
title = time.strftime('All Downloads - %B %Y', self.iwla.getCurTime())
|
||||
|
||||
page = DisplayHTMLPage(title, path, self.iwla.getConfValue('css_path', []))
|
||||
table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit'])
|
||||
page = display.createPage(title, path, self.iwla.getConfValue('css_path', []))
|
||||
table = display.createBlock(DisplayHTMLBlockTable, 'All Downloads', ['URI', 'Hit'])
|
||||
table.setColsCSSClass(['', 'iwla_hit'])
|
||||
|
||||
total_entrance = [0]*2
|
||||
@@ -29,7 +30,7 @@ class IWLADisplayTopDownloads(IPlugin):
|
||||
total_entrance[1] += entrance
|
||||
page.appendBlock(table)
|
||||
|
||||
self.iwla.getDisplay().addPage(page)
|
||||
display.addPage(page)
|
||||
|
||||
link = '<a href=\'%s\'>All Downloads</a>' % (filename)
|
||||
title = '%s - %s' % ('Top Downloads', link)
|
||||
@@ -37,7 +38,7 @@ class IWLADisplayTopDownloads(IPlugin):
|
||||
# Top in index
|
||||
index = self.iwla.getDisplayIndex()
|
||||
|
||||
table = DisplayHTMLBlockTable(title, ['URI', 'Hits'])
|
||||
table = display.createBlock(DisplayHTMLBlockTable, title, ['URI', 'Hits'])
|
||||
table.setColsCSSClass(['', 'iwla_hit'])
|
||||
for (uri, entrance) in top_downloads[:10]:
|
||||
table.appendRow([generateHTMLLink(uri), entrance])
|
||||
|
||||
Reference in New Issue
Block a user