Do a bunch of CSS and presentation

This commit is contained in:
Grégory Soutadé 2014-12-02 21:53:20 +01:00
parent 273bcd3526
commit 95023a5db3
3 changed files with 28 additions and 11 deletions

View File

@ -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 += '<img%s align="bottom" src="%s" height="%d" width="6" alt="%s" title="%s" />' % (style, icon, height, alt, alt)
height = 1
html += '<img%s src="%s" height="%d" width="6" alt="%s" title="%s" />' % (style, icon, height, alt, alt)
html += '</td>'
html += '</tr>'
html += '<tr>'

18
iwla.py
View File

@ -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<br/>%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']

View File

@ -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;
}
}
table.iwla_graph_table td
{
text-align:center;
}