iwla

iwla Commit Details

Date:2014-12-02 20:49:56 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:7d45b45e8af6ec10b70238791e25228215dee92d
Parents: 63a9b40b4699c6f54bdb98089b9006ad23ec4241
Message:class DisplayHTMLBlockTableWithGraph() seems to work Fix a bug : month_stats override if iwla.py called twice

Changes:
Mdefault_conf.py (1 diff)
Mdisplay.py (5 diffs)
Miwla.py (2 diffs)
Mresources/css/iwla.css (1 diff)

File differences

default_conf.py
3131
3232
3333
34
35
34
35
'css', 'js']
resources_path = ['resources']
icon_path = ['/%s/%s' % (os.path.basename(resources_path[0]), 'icon')]
css_path = ['/%s/%s/%s' % (os.path.basename(resources_path[0]), 'css', 'iwla.css')]
icon_path = ['%s/%s' % (os.path.basename(resources_path[0]), 'icon')]
css_path = ['%s/%s/%s' % (os.path.basename(resources_path[0]), 'css', 'iwla.css')]
display.py
5959
6060
6161
62
6263
6364
6465
......
7677
7778
7879
79
80
8081
8182
8283
......
118119
119120
120121
121
122
123
124
122125
123126
124127
......
149152
150153
151154
152
155
153156
154157
155158
159
156160
157161
158162
......
187191
188192
189193
190
194
195
196
191197
192198
193199
self.rows = []
self.cols_cssclasses = ['' for e in cols]
self.rows_cssclasses = []
self.table_css = 'iwla_table'
def appendRow(self, row):
self.rows.append(listToStr(row))
row >= len(self.rows) or col >= len(self.cols):
raise ValueError('Invalid indices %d,%d' % (row, col))
return self.rows[row][col]
self.rows[row][col] = value
def setCellCSSClass(self, row, col, value):
if row < 0 or col < 0 or\
self.cols_cssclasses = values
def _buildHTML(self):
html = '<table>'
style = ''
if self.table_css: style = ' class="%s"' % (self.table_css)
html = '<table%s>' % (style)
if self.cols:
html += '<tr>'
for i in range (0, len(self.cols)):
self.short_titles = short_titles
self.nb_valid_rows = nb_valid_rows
# TOFIX
self.icon_path = '/resources/icon'
self.icon_path = 'resources/icon'
# self.icon_path = self.iwla.getConfValue('icon_path', '/')
self.raw_rows = []
self.maxes = [0 for c in cols]
self.table_graph_css = 'iwla_graph_table'
def appendRow(self, row):
self.raw_rows.append(row)
def _buildHTML(self):
self._computeMax()
html = '<table>'
style = ''
if self.table_graph_css: style = ' class="%s"' % (self.table_graph_css)
html = '<table%s>' % (style)
html += '<tr>'
for i in range(0, self.nb_valid_rows):
row = self.rows[i]
iwla.py
245245
246246
247247
248
248
249
250
249251
250252
251
253
252254
253255
254256
255257
256
258
257259
258260
259261
260
262
261263
262264
263265
......
326328
327329
328330
329
331
332
333
334
335
330336
331337
332338
days.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwidth', 'iwla_bandwidth'])
nb_visits = 0
nb_days = 0
for i in range(0, nb_month_days+1):
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)
if i in self.current_analysis['days_stats'].keys():
stats = self.current_analysis['days_stats'][i]
row = [i, stats['nb_visitors'], stats['viewed_pages'], stats['viewed_hits'],
row = [full_cur_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 = [i, 0, 0, 0, 0, 0]
row = [full_cur_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(str(i))
days.appendShortTitle(cur_day)
stats = self.current_analysis['month_stats']
print "== Stats for %d/%d ==" % (cur_time.tm_year, cur_time.tm_mon)
print stats
self.current_analysis['month_stats'] = stats
if not 'month_stats' in self.current_analysis.keys():
self.current_analysis['month_stats'] = stats
else:
for (k,v) in stats.items():
self.current_analysis['month_stats'][k] = v
self.valid_visitors = {}
for (k,v) in visits.items():
resources/css/iwla.css
6060
6161
6262
63
63
64
65
66
67
68
69
70
71
72
73
74
75
.iwla_page { background : #4477DD; }
.iwla_hit { background : #66DDEE; }
.iwla_bandwidth { background : #2EA495; }
.iwla_search { background : #F4F090; }
.iwla_search { background : #F4F090; }
.iwla_graph_table
{
margin-left:auto;
margin-right:auto;
}
table.iwla_graph_table > table.iwla_table
{
margin-left:auto;
margin-right:auto;
}

Archive Download the corresponding diff file

Branches

Tags