Give iwla to each display class
Add generic functions createPage() and createBlock() in DisplayHTMLBuild Add and display IWLA version
This commit is contained in:
14
iwla.py
14
iwla.py
@@ -24,6 +24,7 @@ class IWLA(object):
|
||||
|
||||
ANALYSIS_CLASS = 'HTTP'
|
||||
API_VERSION = 1
|
||||
IWLA_VERSION = '0.1'
|
||||
|
||||
def __init__(self):
|
||||
print '==> Start'
|
||||
@@ -44,6 +45,9 @@ class IWLA(object):
|
||||
(conf.POST_HOOK_DIRECTORY , conf.post_analysis_hooks),
|
||||
(conf.DISPLAY_HOOK_DIRECTORY , conf.display_hooks)]
|
||||
|
||||
def getVersion(self):
|
||||
return IWLA.IWLA_VERSION
|
||||
|
||||
def getConfValue(self, key, default=None):
|
||||
if not key in dir(conf):
|
||||
return default
|
||||
@@ -242,10 +246,10 @@ class IWLA(object):
|
||||
title = 'Stats %d/%d' % (cur_time.tm_mon, cur_time.tm_year)
|
||||
filename = self.getCurDisplayPath('index.html')
|
||||
print '==> Generate display (%s)' % (filename)
|
||||
page = DisplayHTMLPage(title, filename, conf.css_path)
|
||||
page = self.display.createPage(title, filename, conf.css_path)
|
||||
|
||||
_, nb_month_days = monthrange(cur_time.tm_year, cur_time.tm_mon)
|
||||
days = DisplayHTMLBlockTableWithGraph('By day', ['Day', 'Visitors', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth'], nb_valid_rows=nb_month_days, graph_cols=range(1,6))
|
||||
days = self.display.createBlock(DisplayHTMLBlockTableWithGraph, 'By day', ['Day', 'Visitors', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth'], None, nb_month_days, range(1,6))
|
||||
days.setColsCSSClass(['', 'iwla_visitor', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
|
||||
nb_visits = 0
|
||||
nb_days = 0
|
||||
@@ -300,7 +304,7 @@ class IWLA(object):
|
||||
title = 'Summary %d' % (year)
|
||||
cols = ['Month', 'Visitors', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth', 'Details']
|
||||
graph_cols=range(1,6)
|
||||
months = DisplayHTMLBlockTableWithGraph(title, cols, nb_valid_rows=12, graph_cols=graph_cols)
|
||||
months = self.display.createBlock(DisplayHTMLBlockTableWithGraph, title, cols, None, 12, graph_cols)
|
||||
months.setColsCSSClass(['', 'iwla_visitor', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth', ''])
|
||||
total = [0] * len(cols)
|
||||
for i in range(1, 13):
|
||||
@@ -336,10 +340,10 @@ class IWLA(object):
|
||||
filename = 'index.html'
|
||||
print '==> Generate main page (%s)' % (filename)
|
||||
|
||||
page = DisplayHTMLPage(title, filename, conf.css_path)
|
||||
page = self.display.createPage(title, filename, conf.css_path)
|
||||
|
||||
last_update = '<b>Last update</b> %s<br />' % (time.strftime('%d %b %Y %H:%M', time.localtime()))
|
||||
page.appendBlock(DisplayHTMLRaw(last_update))
|
||||
page.appendBlock(self.display.createBlock(DisplayHTMLRaw, last_update))
|
||||
|
||||
for year in self.meta_infos['stats'].keys():
|
||||
self._generateDisplayMonthStats(page, year, self.meta_infos['stats'][year])
|
||||
|
||||
Reference in New Issue
Block a user