diff --git a/display.py b/display.py index 7982028..16c4593 100644 --- a/display.py +++ b/display.py @@ -52,6 +52,9 @@ class DisplayHTMLRaw(object): self._buildHTML() self._build(f, self.html) + def getTitle(self): + return '' + class DisplayHTMLBlock(DisplayHTMLRaw): def __init__(self, iwla, title=''): @@ -287,7 +290,7 @@ class DisplayHTMLPage(object): def appendBlock(self, block): self.blocks.append(block) - def build(self, root): + def build(self, root, displayVersion=True): filename = os.path.join(root, self.filename) base = os.path.dirname(filename) @@ -308,8 +311,9 @@ class DisplayHTMLPage(object): f.write(u'') for block in self.blocks: block.build(f) - f.write(u'
Generated by IWLA %s
' % - ("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion())) + if displayVersion: + f.write(u'
Generated by IWLA %s
' % + ("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion())) f.write(u'') f.close() diff --git a/iwla.py b/iwla.py index 0c0f331..3f50bac 100755 --- a/iwla.py +++ b/iwla.py @@ -59,6 +59,7 @@ Output files : DB_ROOT/meta.db DB_ROOT/year/month/iwla.db OUTPUT_ROOT/index.html + OUTPUT_ROOT/year/_stats.html OUTPUT_ROOT/year/month/index.html Statistics creation : @@ -371,6 +372,8 @@ class IWLA(object): filename = self.getCurDisplayPath('index.html') self.logger.info('==> Generate display (%s)' % (filename)) page = self.display.createPage(title, filename, conf.css_path) + link = DisplayHTMLRaw(self, '') + page.appendBlock(link) _, nb_month_days = monthrange(cur_time.tm_year, cur_time.tm_mon) days = self.display.createBlock(DisplayHTMLBlockTableWithGraph, self._('By day'), [self._('Day'), self._('Visits'), self._('Pages'), self._('Hits'), self._('Bandwidth'), self._('Not viewed Bandwidth')], None, nb_month_days, range(1,6)) @@ -430,6 +433,8 @@ class IWLA(object): graph_cols=range(1,7) months = self.display.createBlock(DisplayHTMLBlockTableWithGraph, title, cols, None, 12, graph_cols) months.setColsCSSClass(['', 'iwla_visitor', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth', '']) + months_ = self.display.createBlock(DisplayHTMLBlockTableWithGraph, title, cols[:-1], None, 12, graph_cols[:-1]) + months_.setColsCSSClass(['', 'iwla_visitor', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth']) total = [0] * len(cols) for i in range(1, 13): month = '%s
%d' % (months_name[i], year) @@ -447,11 +452,16 @@ class IWLA(object): months.setCellValue(i-1, 5, bytesToStr(row[5])) months.setCellValue(i-1, 6, bytesToStr(row[6])) months.appendShortTitle(month) + months_.appendRow(row[:-1]) + months_.setCellValue(i-1, 5, bytesToStr(row[5])) + months_.setCellValue(i-1, 6, bytesToStr(row[6])) + months_.appendShortTitle(month) if year == cur_time.tm_year and i == cur_time.tm_mon: css = months.getCellCSSClass(i-1, 0) if css: css = '%s %s' % (css, 'iwla_curday') else: css = 'iwla_curday' months.setCellCSSClass(i-1, 0, css) + months_.setCellCSSClass(i-1, 0, css) total[0] = self._('Total') total[5] = bytesToStr(total[5]) @@ -460,6 +470,12 @@ class IWLA(object): months.appendRow(total) page.appendBlock(months) + months_.appendRow(total[:-1]) + filename = '%d/_stats.html' % (year) + page_ = self.display.createPage(u'', filename, conf.css_path) + page_.appendBlock(months_) + page_.build(conf.DISPLAY_ROOT, False) + def _generateDisplayWholeMonthStats(self): title = '%s %s' % (self._('Statistics for'), conf.domain_name) filename = 'index.html' diff --git a/resources/css/iwla.css b/resources/css/iwla.css index fe4d5ab..add0e57 100644 --- a/resources/css/iwla.css +++ b/resources/css/iwla.css @@ -89,3 +89,4 @@ table.iwla_graph_table td text-align:center; } +iframe {outline:none; border:0px; width:100%; height:500px; display:block;} \ No newline at end of file