iwla

iwla Commit Details

Date:2014-12-04 19:15:15 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:5f72a9c91236654100c0e694e2f653d8f7eebfcd
Parents: 897f96232c2671a86bb8034031e467963a258408
Message:Fix presentation problems

Changes:
Mdisplay.py (3 diffs)
Miwla.py (3 diffs)
Mresources/css/iwla.css (2 diffs)

File differences

display.py
146146
147147
148148
149
149
150150
151151
152152
......
156156
157157
158158
159
160
159161
160162
161163
......
196198
197199
198200
199
200
201
202
203
204
201205
202206
203207
class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
def __init__(self, title, cols, short_titles=None, nb_valid_rows=0):
def __init__(self, title, cols, short_titles=None, nb_valid_rows=0, graph_cols=None):
super(DisplayHTMLBlockTableWithGraph, self).__init__(title=title, cols=cols)
self.short_titles = short_titles or []
self.nb_valid_rows = nb_valid_rows
self.raw_rows = []
self.maxes = [0] * len(cols)
self.table_graph_css = 'iwla_graph_table'
self.td_img_css = 'iwla_td_img'
self.graph_cols = graph_cols or []
def appendRow(self, row):
self.raw_rows.append(row)
html += '<tr>'
for i in range(0, self.nb_valid_rows):
row = self.rows[i]
html += '<td>'
for j in range(1, len(row)):
css = ''
if self.td_img_css: css=' class="%s"' % (self.td_img_css)
html += '<td%s>' % (css)
for j in self.graph_cols:
style = self.getColCSSClass(j)
icon = self._getIconFromStyle(style)
if not icon: continue
iwla.py
245245
246246
247247
248
248
249249
250250
251251
252
253
254
252
253
254
255255
256256
257257
......
261261
262262
263263
264
265
264
265
266266
267
267
268268
269269
270
270
271271
272272
273273
274274
275
275
276276
277277
278278
......
295295
296296
297297
298
298
299
299300
300
301
302
301
302
303
304
303305
304
305
306
306
307
308
307309
308310
311
309312
310
311
312
313
314
315
313316
314
317
315318
316
317
319
320
318321
319
320
321
322
323
324
325
326
327
322
323
324
325
326
328327
329328
330329
page = DisplayHTMLPage(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)
days = DisplayHTMLBlockTableWithGraph('By day', ['Day', 'Visitors', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth'], nb_valid_rows=nb_month_days, graph_cols=range(1,6))
days.setColsCSSClass(['', 'iwla_visitor', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
nb_visits = 0
nb_days = 0
for i in range(0, nb_month_days):
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)
for i in range(1, nb_month_days+1):
day = '%d<br/>%s' % (i, time.strftime('%b', cur_time))
full_day = '%d %s %d' % (i, 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_day, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
else:
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.setCellValue(i-1, 4, bytesToStr(row[4]))
days.setCellValue(i-1, 5, bytesToStr(row[5]))
days.appendShortTitle(day)
adate = date(cur_time.tm_year, cur_time.tm_mon, i+1)
adate = date(cur_time.tm_year, cur_time.tm_mon, i)
week_day = adate.weekday()
if week_day == 5 or week_day == 6:
days.setRowCSSClass(i, 'iwla_weekend')
days.setRowCSSClass(i-1, '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)
days.setCellCSSClass(i-1, 0, css)
stats = self.current_analysis['month_stats']
self.display.addPage(page)
def _generateDisplayMonthStats(self, page, year, month_stats):
cur_time = time.localtime()
months_name = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
title = 'Summary %d' % (year)
cols = ['Month', 'Visitors', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth']
months = DisplayHTMLBlockTableWithGraph(title, cols, nb_valid_rows=12)
months.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
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.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth', ''])
total = [0] * len(cols)
for i in range(0, 12):
month = '%s<br/>%d' % ('Jan', year)
full_month = '%s %d' % ('Jan', year)
for i in range(1, 13):
month = '%s<br/>%d' % (months_name[i], year)
full_month = '%s %d' % (months_name[i], year)
if i in month_stats.keys():
stats = month_stats[i]
link = '<a href="%d/%d/index.html">Details</a>' % (year, i)
row = [full_month, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
stats['viewed_bandwidth'], stats['not_viewed_bandwidth']]
for i in range(1, len(row[1:])):
total[i] += row[i]
stats['viewed_bandwidth'], stats['not_viewed_bandwidth'], link]
for j in graph_cols:
total[j] += row[j]
else:
row = [full_month, 0, 0, 0, 0, 0]
row = [full_month, 0, 0, 0, 0, 0, '']
months.appendRow(row)
months.setCellValue(i, 4, bytesToStr(row[4]))
months.setCellValue(i, 5, bytesToStr(row[5]))
months.setCellValue(i-1, 4, bytesToStr(row[4]))
months.setCellValue(i-1, 5, bytesToStr(row[5]))
months.appendShortTitle(month)
# adate = date(cur_time.tm_year, cur_time.tm_mon, i+1)
# week_day = adate.weekday()
# if week_day == 5 or week_day == 6:
# months.setRowCSSClass(i, 'iwla_weekend')
# if adate == date.today():
# css = months.getCellCSSClass(i, 0)
# if css: css = '%s %s' % (css, 'iwla_curday')
# else: css = 'iwla_curday'
# months.setCellCSSClass(i, 0, css)
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)
total[0] = 'Total'
total[4] = bytesToStr(total[4])
resources/css/iwla.css
2020
2121
2222
23
23
2424
2525
2626
......
4949
5050
5151
52
52
5353
5454
5555
width: 60%;
}
.iwla_block_title > a
a
{
font: 11px verdana, arial, helvetica, sans-serif;
font-weight: normal;
vertical-align:middle;
}
td img
.iwla_td_img
{
vertical-align:bottom;
}

Archive Download the corresponding diff file

Branches

Tags