Add weekend coloration

This commit is contained in:
Grégory Soutadé 2014-12-02 21:16:27 +01:00
parent 7d45b45e8a
commit 273bcd3526
3 changed files with 10 additions and 6 deletions

View File

@ -57,13 +57,13 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock):
super(DisplayHTMLBlockTable, self).__init__(title=title)
self.cols = cols
self.rows = []
self.cols_cssclasses = ['' for e in cols]
self.cols_cssclasses = [''] * len(cols)
self.rows_cssclasses = []
self.table_css = 'iwla_table'
def appendRow(self, row):
self.rows.append(listToStr(row))
self.rows_cssclasses.append(['' for e in row])
self.rows_cssclasses.append([''] * len(row))
def getCellValue(self, row, col):
if row < 0 or col < 0 or\
@ -103,8 +103,7 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock):
if row < 0 or row >= len(self.rows):
raise ValueError('Invalid indice %d' % (row))
for i in range(0, self.rows_cssclasses[row]):
self.rows_cssclasses[row][i] = value
self.rows_cssclasses[row] = [value] * len(self.rows_cssclasses[row])
def setColCSSClass(self, col, value):
if col < 0 or col >= len(self.cols):
@ -155,7 +154,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
self.icon_path = 'resources/icon'
# self.icon_path = self.iwla.getConfValue('icon_path', '/')
self.raw_rows = []
self.maxes = [0 for c in cols]
self.maxes = [0] * len(cols)
self.table_graph_css = 'iwla_graph_table'
def appendRow(self, row):
@ -213,7 +212,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
html += '</tr>'
html += '<tr>'
for i in range(0, len(self.short_titles)):
style = self.getCellCSSClass(0, j)
style = self.getCellCSSClass(i, 0)
if style: style = ' class="%s"' % (style)
html += '<td%s>%s</td>' % (style, self.short_titles[i])
html += '</tr>'

View File

@ -7,6 +7,7 @@ import pickle
import gzip
import importlib
from calendar import monthrange
from datetime import date
import default_conf as conf
import conf as _
@ -260,6 +261,9 @@ class IWLA(object):
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()
if week_day == 5 or week_day == 6:
days.setRowCSSClass(i, 'iwla_weekend')
stats = self.current_analysis['month_stats']

View File

@ -61,6 +61,7 @@ td:first-child
.iwla_hit { background : #66DDEE; }
.iwla_bandwidth { background : #2EA495; }
.iwla_search { background : #F4F090; }
.iwla_weekend { background : #ECECEC; }
.iwla_graph_table
{