iwla

iwla Commit Details

Date:2014-11-27 21:40:23 (6 years 8 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:3858127a6dbba4c27b5269d2b7ba0ade9d27658a
Parents: d2b0d0dae6e4851c367b34310315d9cec264d3de
Message:Work on CSS management

Changes:
Mdisplay.py (1 diff)
Miwla.py (1 diff)
Mplugins/display/all_visits.py (1 diff)
Mplugins/display/referers.py (4 diffs)
Mplugins/display/top_downloads.py (2 diffs)
Mplugins/display/top_hits.py (2 diffs)
Mplugins/display/top_pages.py (2 diffs)
Mplugins/display/top_visitors.py (1 diff)

File differences

display.py
6060
6161
6262
63
63
6464
6565
66
66
6767
6868
6969
70
70
7171
7272
73
73
7474
7575
7676
77
77
7878
7979
80
80
8181
8282
8383
84
84
85
86
87
88
89
90
91
92
93
94
95
96
97
8598
86
99
87100
88101
89102
90
103
104
105
106
107
108
109
110
111
112
113
114
115
91116
92117
93118
94
95
96
97
98
119
120
121
122
123
124
125
126
127
128
99129
100
101
130
131
132
133
134
102135
103136
104137
self.rows.append(listToStr(row))
self.rows_cssclasses.append(['' for e in row])
def getCellValue(row, col):
def getCellValue(self, row, col):
if row < 0 or col < 0 or\
row >= len(self.rows) or col >= len(self.cols):
raise ValueError('Invalid indices')
raise ValueError('Invalid indices %d,%d' % (row, col))
return self.rows[row][col]
def setCellValue(row, col, value):
def setCellValue(self, row, col, value):
if row < 0 or col < 0 or\
row >= len(self.rows) or col >= len(self.cols):
raise ValueError('Invalid indices')
raise ValueError('Invalid indices %d,%d' % (row, col))
return self.rows[row][col]
def setCellCSSClass(row, col, value):
def setCellCSSClass(self, row, col, value):
if row < 0 or col < 0 or\
row >= len(self.rows) or col >= len(self.cols):
raise ValueError('Invalid indices')
raise ValueError('Invalid indices %d,%d' % (row, col))
self.rows_cssclasses[row][col] = value
def setRowCSSClass(row, value):
def getCellCSSClass(self, row, col):
if row < 0 or col < 0 or\
row >= len(self.rows) or col >= len(self.cols):
raise ValueError('Invalid indices %d,%d' % (row, col))
return self.rows_cssclasses[row][col]
def getColCSSClass(self, col):
if col < 0 or col >= len(self.cols):
raise ValueError('Invalid indice %d' % (col))
return self.cols_cssclasses[col]
def setRowCSSClass(self, row, value):
if row < 0 or row >= len(self.rows):
raise ValueError('Invalid indice')
raise ValueError('Invalid indice %d' % (row))
for i in range(0, self.rows_cssclasses[row]):
self.rows_cssclasses[row][i] = value
def setColCSSClass(self, col, value):
if col < 0 or col >= len(self.cols):
raise ValueError('Invalid indice %d' % (col))
self.cols_cssclasses[col] = value
def setColsCSSClass(self, values):
if len(values) != len(self.cols):
raise ValueError('Invalid values size')
self.cols_cssclasses = values
def build(self, f):
if not self.html:
html = '<table>'
html += '<tr>'
for title in self.cols:
html += '<th>%s</th>' % (title)
html += '</tr>'
for row in self.rows:
if self.cols:
html += '<tr>'
for i in range (0, len(self.cols)):
title = self.cols[i]
style = self.getColCSSClass(i)
if style: style = ' class="%s"' % (style)
html += '<th%s>%s</th>' % (style, title)
html += '</tr>'
for i in range(0, len(self.rows)):
row = self.rows[i]
html += '<tr>'
for v in row:
html += '<td>%s</td>' % (v)
for j in range(0, len(row)):
v = row[j]
style = self.getCellCSSClass(i, j)
if style: style = ' class="%s"' % (style)
html += '<td%s>%s</td>' % (style, v)
html += '</tr>'
html += '</table>'
self.html = html
iwla.py
232232
233233
234234
235
235
236236
237237
238238
page = DisplayHTMLPage(title, filename)
days = DisplayHTMLBlockTable('By day', ['Day', 'Visits', 'Pages', 'Hits', 'Bandwidth', 'Not viewed Bandwidth'])
days.setColsCSSClass(['', 'iwla_visit', 'iwla_page', 'iwla_hit', 'iwla_bandwith', 'iwla_bandwith'])
keys = self.current_analysis['days_stats'].keys()
keys.sort()
nb_visits = 0
plugins/display/all_visits.py
2222
2323
2424
25
26
2527
2628
2729
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('Last seen', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit', 'iwla_bandwith', ''])
for super_hit in last_access:
address = super_hit['remote_addr']
if display_visitor_ip and\
plugins/display/referers.py
4040
4141
4242
43
43
44
4445
4546
4647
......
6768
6869
6970
71
72
7073
7174
7275
......
9295
9396
9497
98
9599
96100
97101
......
103107
104108
105109
110
106111
107112
108113
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('Connexion from', ['Origin', 'Pages', 'Hits'])
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit'])
table.appendRow(['<b>Search Engine</b>', '', ''])
for r,_ in top_search_engine_referers:
row = [r, search_engine_referers[r]['pages'], search_engine_referers[r]['hits']]
title = '%s - %s' % ('Connexion from', link)
table = DisplayHTMLBlockTable(title, ['Origin', 'Pages', 'Hits'])
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit'])
table.appendRow(['<b>Search Engine</b>', '', ''])
for r,_ in top_search_engine_referers[:10]:
row = [r, search_engine_referers[r]['pages'], search_engine_referers[r]['hits']]
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('Top key phrases', ['Key phrase', 'Search'])
table.setColsCSSClass(['', 'iwla_search'])
for phrase in top_key_phrases:
table.appendRow([phrase[0], phrase[1]])
page.appendBlock(table)
# Top key phrases in index
title = '%s - %s' % ('Top key phrases', link)
table = DisplayHTMLBlockTable(title, ['Key phrase', 'Search'])
table.setColsCSSClass(['', 'iwla_search'])
for phrase in top_key_phrases[:10]:
table.appendRow([phrase[0], phrase[1]])
index.appendBlock(table)
plugins/display/top_downloads.py
2020
2121
2222
23
23
24
2425
2526
2627
......
3334
3435
3536
36
37
38
3739
3840
3941
title = time.strftime('All Downloads - %B %Y', self.iwla.getCurTime())
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit'])
table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_downloads:
table.appendRow([uri, entrance])
page.appendBlock(table)
# Top in index
index = self.iwla.getDisplayIndex()
table = DisplayHTMLBlockTable(title, ['URI', 'Hits'])
table = DisplayHTMLBlockTable(title, ['URI', 'Hits'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_downloads[:10]:
table.appendRow([uri, entrance])
index.appendBlock(table)
plugins/display/top_hits.py
2121
2222
2323
24
2425
2526
2627
......
3435
3536
3637
38
3739
3840
3941
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('All Hits', ['URI', 'Entrance'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_hits:
table.appendRow([uri, entrance])
page.appendBlock(table)
index = self.iwla.getDisplayIndex()
table = DisplayHTMLBlockTable(title, ['URI', 'Entrance'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_hits[:10]:
table.appendRow([uri, entrance])
index.appendBlock(table)
plugins/display/top_pages.py
2020
2121
2222
23
23
24
2425
2526
2627
......
3334
3435
3536
36
37
38
3739
3840
3941
path = self.iwla.getCurDisplayPath(filename)
page = DisplayHTMLPage(title, path)
table = DisplayHTMLBlockTable('All Pages', ['URI', 'Entrance'])
table = DisplayHTMLBlockTable('All Pages', ['URI', 'Entrance'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_pages:
table.appendRow([uri, entrance])
page.appendBlock(table)
# Top in index
index = self.iwla.getDisplayIndex()
table = DisplayHTMLBlockTable(title, ['URI', 'Entrance'])
table = DisplayHTMLBlockTable(title, ['URI', 'Entrance'])
table.setColsCSSClass(['', 'iwla_hit'])
for (uri, entrance) in top_pages[:10]:
table.appendRow([uri, entrance])
index.appendBlock(table)
plugins/display/top_visitors.py
2121
2222
2323
24
2425
2526
2627
index = self.iwla.getDisplayIndex()
table = DisplayHTMLBlockTable('Top visitors', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen'])
table.setColsCSSClass(['', 'iwla_page', 'iwla_hit', 'iwla_bandwith', ''])
for super_hit in top_visitors:
address = super_hit['remote_addr']
if display_visitor_ip and\

Archive Download the corresponding diff file

Branches

Tags