iwla

iwla Commit Details

Date:2014-12-21 15:36:39 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:15047f91f1d82478279c50afb6d61e0bd302e62c
Parents: 1003a8659344e9d2109c8a9bc47b4c97a22504e2
Message:First version of referers_diff

Changes:
Aplugins/display/referers_diff.py (full)
Mconf.py (1 diff)
Mdocs/index.md (7 diffs)
Mdocs/modules.md (7 diffs)
Mplugins/display/referers.py (1 diff)
Mresources/css/iwla.css (2 diffs)

File differences

conf.py
1212
1313
1414
15
15
1616
1717
1818
# Hooks used
pre_analysis_hooks = ['page_to_hit', 'robots']
post_analysis_hooks = ['referers', 'top_pages', 'top_downloads', 'top_hits']#, 'reverse_dns']
display_hooks = ['top_visitors', 'all_visits', 'referers', 'top_pages', 'top_downloads', 'top_hits']
display_hooks = ['top_visitors', 'all_visits', 'referers', 'top_pages', 'top_downloads', 'top_hits', 'referers_diff']
# Reverse DNS timeout
reverse_dns_timeout = 0.2
docs/index.md
175175
176176
177177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206178
207179
208180
......
230202
231203
232204
233
205
234206
235207
236208
237209
238
210
239211
240212
241
213
242214
243215
244
245
216
217
218
219
246220
247221
248
222
223
249224
250225
251226
......
258233
259234
260235
261
262
236
237
263238
264239
265240
266
241
267242
268243
269
244
270245
271246
272
273
274
275
247
248
276249
277250
278
279
251
280252
281253
282254
......
289261
290262
291263
292
293
264
265
294266
295267
296268
297
269
298270
299271
300
272
301273
302274
303
275
276
304277
305278
279
306280
307281
308282
......
343317
344318
345319
346
347
320
321
348322
349
323
350324
351
325
352326
353327
354328
355329
356330
357
331
358332
359333
360
334
361335
362336
363337
364338
365339
366
367
368
340
369341
370342
371343
372344
373345
374
375
346
347
376348
377
349
378350
379
351
380352
381353
382
354
383355
384356
385357
......
391363
392364
393365
394
395
396
366
397367
398368
399369
......
465435
466436
467437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
468494
469495
470496
None
plugins.display.top_downloads
-----------------------------
Display hook
Create TOP downloads page
Plugin requirements :
post_analysis/top_downloads
Conf values needed :
max_downloads_displayed*
create_all_downloads_page*
Output files :
OUTPUT_ROOT/year/month/top_downloads.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
plugins.display.all_visits
--------------------------
None
plugins.display.top_hits
plugins.display.referers
------------------------
Display hook
Create TOP hits page
Create Referers page
Plugin requirements :
post_analysis/top_hits
post_analysis/referers
Conf values needed :
max_hits_displayed*
create_all_hits_page*
max_referers_displayed*
create_all_referers_page*
max_key_phrases_displayed*
create_all_key_phrases_page*
Output files :
OUTPUT_ROOT/year/month/top_hits.html
OUTPUT_ROOT/year/month/referers.html
OUTPUT_ROOT/year/month/key_phrases.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.display.referers
------------------------
plugins.display.top_downloads
-----------------------------
Display hook
Create Referers page
Create TOP downloads page
Plugin requirements :
post_analysis/referers
post_analysis/top_downloads
Conf values needed :
max_referers_displayed*
create_all_referers_page*
max_key_phrases_displayed*
create_all_key_phrases_page*
max_downloads_displayed*
create_all_downloads_page*
Output files :
OUTPUT_ROOT/year/month/referers.html
OUTPUT_ROOT/year/month/key_phrases.html
OUTPUT_ROOT/year/month/top_downloads.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.display.top_visitors
----------------------------
plugins.display.top_hits
------------------------
Display hook
Create TOP visitors block
Create TOP hits page
Plugin requirements :
None
post_analysis/top_hits
Conf values needed :
display_visitor_ip*
max_hits_displayed*
create_all_hits_page*
Output files :
OUTPUT_ROOT/year/month/top_hits.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.post_analysis.top_downloads
-----------------------------------
plugins.display.top_visitors
----------------------------
Post analysis hook
Display hook
Count TOP downloads
Create TOP visitors block
Plugin requirements :
None
Conf values needed :
None
display_visitor_ip*
Output files :
None
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
month_stats:
top_downloads =>
uri
None
Statistics deletion :
None
plugins.post_analysis.top_hits
------------------------------
plugins.display.referers_diff
-----------------------------
Post analysis hook
Display hook
Count TOP hits
Enlight new and updated key phrases in in all_key_phrases.html
Plugin requirements :
None
display/referers
Conf values needed :
None
None
Statistics update :
month_stats:
top_hits =>
uri
None
Statistics deletion :
None
None
plugins.post_analysis.top_downloads
-----------------------------------
Post analysis hook
Count TOP downloads
Plugin requirements :
None
Conf values needed :
None
Output files :
None
Statistics creation :
None
Statistics update :
month_stats:
top_downloads =>
uri
Statistics deletion :
None
plugins.post_analysis.top_hits
------------------------------
Post analysis hook
Count TOP hits
Plugin requirements :
None
Conf values needed :
None
Output files :
None
Statistics creation :
None
Statistics update :
month_stats:
top_hits =>
uri
Statistics deletion :
None
plugins.post_analysis.top_pages
-------------------------------
docs/modules.md
8383
8484
8585
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
11486
11587
11688
......
138110
139111
140112
141
113
142114
143115
144116
145117
146
118
147119
148120
149
121
150122
151123
152
153
124
125
126
127
154128
155129
156
130
131
157132
158133
159134
......
166141
167142
168143
169
170
144
145
171146
172147
173148
174
149
175150
176151
177
152
178153
179154
180
181
182
183
155
156
184157
185158
186
187
159
188160
189161
190162
......
197169
198170
199171
200
201
172
173
202174
203175
204176
205
177
206178
207179
208
180
209181
210182
211
183
184
212185
213186
187
214188
215189
216190
......
251225
252226
253227
254
255
228
229
256230
257
231
258232
259
233
260234
261235
262236
263237
264238
265
239
266240
267241
268
242
269243
270244
271245
272246
273247
274
275
276
248
277249
278250
279251
280252
281253
282
283
254
255
284256
285
257
286258
287
259
288260
289261
290
262
291263
292264
293265
......
299271
300272
301273
302
303
304
274
305275
306276
307277
......
373343
374344
375345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
376402
377403
378404
None
plugins.display.top_downloads
-----------------------------
Display hook
Create TOP downloads page
Plugin requirements :
post_analysis/top_downloads
Conf values needed :
max_downloads_displayed*
create_all_downloads_page*
Output files :
OUTPUT_ROOT/year/month/top_downloads.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
plugins.display.all_visits
--------------------------
None
plugins.display.top_hits
plugins.display.referers
------------------------
Display hook
Create TOP hits page
Create Referers page
Plugin requirements :
post_analysis/top_hits
post_analysis/referers
Conf values needed :
max_hits_displayed*
create_all_hits_page*
max_referers_displayed*
create_all_referers_page*
max_key_phrases_displayed*
create_all_key_phrases_page*
Output files :
OUTPUT_ROOT/year/month/top_hits.html
OUTPUT_ROOT/year/month/referers.html
OUTPUT_ROOT/year/month/key_phrases.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.display.referers
------------------------
plugins.display.top_downloads
-----------------------------
Display hook
Create Referers page
Create TOP downloads page
Plugin requirements :
post_analysis/referers
post_analysis/top_downloads
Conf values needed :
max_referers_displayed*
create_all_referers_page*
max_key_phrases_displayed*
create_all_key_phrases_page*
max_downloads_displayed*
create_all_downloads_page*
Output files :
OUTPUT_ROOT/year/month/referers.html
OUTPUT_ROOT/year/month/key_phrases.html
OUTPUT_ROOT/year/month/top_downloads.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.display.top_visitors
----------------------------
plugins.display.top_hits
------------------------
Display hook
Create TOP visitors block
Create TOP hits page
Plugin requirements :
None
post_analysis/top_hits
Conf values needed :
display_visitor_ip*
max_hits_displayed*
create_all_hits_page*
Output files :
OUTPUT_ROOT/year/month/top_hits.html
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
plugins.post_analysis.top_downloads
-----------------------------------
plugins.display.top_visitors
----------------------------
Post analysis hook
Display hook
Count TOP downloads
Create TOP visitors block
Plugin requirements :
None
Conf values needed :
None
display_visitor_ip*
Output files :
None
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
month_stats:
top_downloads =>
uri
None
Statistics deletion :
None
plugins.post_analysis.top_hits
------------------------------
plugins.display.referers_diff
-----------------------------
Post analysis hook
Display hook
Count TOP hits
Enlight new and updated key phrases in in all_key_phrases.html
Plugin requirements :
None
display/referers
Conf values needed :
None
None
Statistics update :
month_stats:
top_hits =>
uri
None
Statistics deletion :
None
None
plugins.post_analysis.top_downloads
-----------------------------------
Post analysis hook
Count TOP downloads
Plugin requirements :
None
Conf values needed :
None
Output files :
None
Statistics creation :
None
Statistics update :
month_stats:
top_downloads =>
uri
Statistics deletion :
None
plugins.post_analysis.top_hits
------------------------------
Post analysis hook
Count TOP hits
Plugin requirements :
None
Conf values needed :
None
Output files :
None
Statistics creation :
None
Statistics update :
month_stats:
top_hits =>
uri
Statistics deletion :
None
plugins.post_analysis.top_pages
-------------------------------
plugins/display/referers.py
197197
198198
199199
200
200
201201
202202
203203
total_search = [0]*2
page = display.createPage(title, path, self.iwla.getConfValue('css_path', []))
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Top key phrases'), [self.iwla._(u'Key phrase'), self.iwla._(u'Search')])
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'All key phrases'), [self.iwla._(u'Key phrase'), self.iwla._(u'Search')])
table.setColsCSSClass(['', 'iwla_search'])
new_list = self.max_key_phrases and top_key_phrases[:self.max_key_phrases] or top_key_phrases
for phrase in new_list:
plugins/display/referers_diff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- coding: utf-8 -*-
#
# Copyright Grégory Soutadé 2015
# This file is part of iwla
# iwla is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iwla is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iwla. If not, see <http://www.gnu.org/licenses/>.
#
from iwla import IWLA
from iplugin import IPlugin
from display import *
"""
Display hook
Enlight new and updated key phrases in in all_key_phrases.html
Plugin requirements :
display/referers
Conf values needed :
None
Output files :
None
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
"""
class IWLADisplayReferersDiff(IPlugin):
def __init__(self, iwla):
super(IWLADisplayReferersDiff, self).__init__(iwla)
self.API_VERSION = 1
self.requires = ['IWLADisplayReferers']
def load(self):
if not self.iwla.getConfValue('create_all_key_phrases_page', True):
return False
month_stats = self.iwla.getMonthStats()
self.cur_key_phrases = {k:v for (k,v) in month_stats.get('key_phrases', {})}
return True
def hook(self):
display = self.iwla.getDisplay()
month_stats = self.iwla.getMonthStats()
filename = 'key_phrases.html'
path = self.iwla.getCurDisplayPath(filename)
page = display.getPage(path)
if not page: return
title = self.iwla._(u'All key phrases')
referers_block = page.getBlock(title)
kp_diff = {}
for (k, v) in month_stats['key_phrases'].items():
new_value = self.cur_key_phrases.get(k, 0)
if new_value:
if new_value != v:
kp_diff[k] = 'iwla_update'
else:
kp_diff[k] = 'iwla_new'
for (idx, row) in enumerate(referers_block.rows):
if row[0] in kp_diff.keys():
referers_block.setCellCSSClass(idx, 0, kp_diff[row[0]])
resources/css/iwla.css
6969
7070
7171
72
73
74
7275
7376
7477
......
8588
8689
8790
91
.iwla_weekend { background : #ECECEC; }
.iwla_curday { font-weight: bold; }
.iwla_others { color: #668; }
.iwla_update { background : orange; }
.iwla_new { background : green }
.iwla_graph_table
{
margin-left:auto;
{
text-align:center;
}

Archive Download the corresponding diff file

Branches

Tags