From 95023a5db3d2e90a20dff62fcf9944cb6bce4d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Tue, 2 Dec 2014 21:53:20 +0100 Subject: [PATCH] Do a bunch of CSS and presentation --- display.py | 6 +++--- iwla.py | 18 ++++++++++++------ resources/css/iwla.css | 15 +++++++++++++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/display.py b/display.py index ab9e582..012ab66 100644 --- a/display.py +++ b/display.py @@ -204,10 +204,10 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): if style: style = ' class="%s"' % (style) alt = '%s: %s' % (row[j], self.cols[j]) if self.maxes[j]: - height = int((self.raw_rows[i][j] * 100) / self.maxes[j]) + height = int((self.raw_rows[i][j] * 100) / self.maxes[j]) or 1 else: - height = 0 - html += '' % (style, icon, height, alt, alt) + height = 1 + html += '' % (style, icon, height, alt, alt) html += '' html += '' html += '' diff --git a/iwla.py b/iwla.py index 16b3b08..a82f858 100755 --- a/iwla.py +++ b/iwla.py @@ -247,23 +247,29 @@ class IWLA(object): nb_visits = 0 nb_days = 0 for i in range(0, nb_month_days): - cur_day = '%d %s' % (i+1, time.strftime('%b', cur_time)) - full_cur_day = '%s %d' % (cur_day, cur_time.tm_year) + day = '%d
%s' % (i+1, time.strftime('%b', cur_time)) + full_day = '%d %s %d' % (i+1, time.strftime('%b', cur_time), cur_time.tm_year) if i in self.current_analysis['days_stats'].keys(): stats = self.current_analysis['days_stats'][i] - row = [full_cur_day, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'], + row = [full_day, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'], stats['viewed_bandwidth'], stats['not_viewed_bandwidth']] nb_visits += stats['nb_visitors'] nb_days += 1 else: - row = [full_cur_day, 0, 0, 0, 0, 0] + row = [full_day, 0, 0, 0, 0, 0] days.appendRow(row) days.setCellValue(i, 4, bytesToStr(row[4])) days.setCellValue(i, 5, bytesToStr(row[5])) - days.appendShortTitle(cur_day) - week_day = date(cur_time.tm_year, cur_time.tm_mon, i+1).weekday() + days.appendShortTitle(day) + adate = date(cur_time.tm_year, cur_time.tm_mon, i+1) + week_day = adate.weekday() if week_day == 5 or week_day == 6: days.setRowCSSClass(i, 'iwla_weekend') + if adate == date.today(): + css = days.getCellCSSClass(i, 0) + if css: css = '%s %s' % (css, 'iwla_curday') + else: css = 'iwla_curday' + days.setCellCSSClass(i, 0, css) stats = self.current_analysis['month_stats'] diff --git a/resources/css/iwla.css b/resources/css/iwla.css index a1be30c..6caeee3 100644 --- a/resources/css/iwla.css +++ b/resources/css/iwla.css @@ -49,6 +49,11 @@ td vertical-align:middle; } +td img +{ + vertical-align:bottom; +} + td:first-child { text-align:left; @@ -62,6 +67,7 @@ td:first-child .iwla_bandwidth { background : #2EA495; } .iwla_search { background : #F4F090; } .iwla_weekend { background : #ECECEC; } +.iwla_curday { font-weight: bold; } .iwla_graph_table { @@ -69,8 +75,13 @@ td:first-child margin-right:auto; } -table.iwla_graph_table > table.iwla_table +table.iwla_graph_table + table.iwla_table { margin-left:auto; margin-right:auto; -} \ No newline at end of file +} + +table.iwla_graph_table td +{ + text-align:center; +}