Give iwla to each display class

Add generic functions createPage() and createBlock() in DisplayHTMLBuild
Add and display IWLA version
This commit is contained in:
Grégory Soutadé
2014-12-08 14:13:26 +01:00
parent fd858034fb
commit 010c16caca
9 changed files with 58 additions and 42 deletions
+4 -4
View File
@@ -10,6 +10,7 @@ class IWLADisplayAllVisits(IPlugin):
self.API_VERSION = 1
def hook(self):
display = self.iwla.getDisplay()
hits = self.iwla.getValidVisitors()
display_visitor_ip = self.iwla.getConfValue('display_visitor_ip', False)
@@ -20,8 +21,8 @@ class IWLADisplayAllVisits(IPlugin):
filename = 'all_visits.html'
path = self.iwla.getCurDisplayPath(filename)
page = DisplayHTMLPage(title, path, self.iwla.getConfValue('css_path', []))
table = DisplayHTMLBlockTable('Last seen', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
page = display.createPage(title, path, self.iwla.getConfValue('css_path', []))
table = display.createBlock(DisplayHTMLBlockTable, 'Last seen', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', ''])
for super_hit in last_access:
@@ -40,7 +41,6 @@ class IWLADisplayAllVisits(IPlugin):
table.appendRow(row)
page.appendBlock(table)
display = self.iwla.getDisplay()
display.addPage(page)
index = self.iwla.getDisplayIndex()
@@ -49,6 +49,6 @@ class IWLADisplayAllVisits(IPlugin):
if block:
block.setTitle('%s - %s' % (block.getTitle(), link))
else:
block = DisplayHTMLRawBlock()
block = display.createBlock(DisplayHTMLRawBlock)
block.setRawHTML(link)
index.appendBlock(block)