iwla

iwla Commit Details

Date:2016-04-12 09:35:03 (5 years 3 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:9a593713d10cdb0d92f41a9a25b8e844de09ead2
Parents: bc2556fbc1cc6c3e676256776ae6d7e032043b5d
Message:Add real names to icons/flags instead of generic ones

Changes:
Mdisplay.py (1 diff)
Mplugins/display/browsers.py (2 diffs)
Mplugins/display/ip_to_geo.py (3 diffs)
Mplugins/display/operating_systems.py (2 diffs)

File differences

display.py
364364
365365
366366
367
367
368368
369369
370370
for block in self.blocks:
block.build(f, filters=filters)
if displayVersion:
f.write(u'<span style="text-align:center">Generated by <a href="%s">IWLA %s</a></span>' %
f.write(u'<div style="text-align:center;width:100%%">Generated by <a href="%s">IWLA %s</a></div>' %
("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion()))
f.write(u'</body></html>')
f.close()
plugins/display/browsers.py
8383
8484
8585
86
86
87
8788
88
89
8990
90
91
9192
9293
9394
......
115116
116117
117118
118
119
120
119121
120
122
121123
122
124
123125
124126
125127
for (browser, entrance) in new_list:
if browser != 'unknown':
try:
icon = '<img alt="Browser icon" src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
name = awstats_data.browsers_icons[self.icon_names[browser]]
icon = '<img alt="%s icon" src="/%s/browser/%s.png"/>' % (name, self.icon_path, name)
except:
icon = '<img alt="Browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
icon = '<img alt="Unknown browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
else:
icon = '<img alt="Browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
icon = '<img alt="Unknown browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
browser = 'Unknown'
table.appendRow([icon, browser, entrance])
total_browsers[2] += entrance
for (browser, entrance) in browsers[:10]:
if browser != 'unknown':
try:
icon = '<img alt="Browser icon" src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
name = awstats_data.browsers_icons[self.icon_names[browser]]
icon = '<img alt="%s icon" src="/%s/browser/%s.png"/>' % (name, self.icon_path, name)
except:
icon = '<img alt="Browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
icon = '<img alt="Unknown browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
else:
icon = '<img alt="Browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
icon = '<img alt="Unknown browser icon" src="/%s/browser/unknown.png"/>' % (self.icon_path)
browser = self.iwla._(u'Unknown')
table.appendRow([icon, browser, entrance])
total_browsers[2] -= entrance
plugins/display/ip_to_geo.py
7777
7878
7979
80
80
8181
8282
8383
......
9696
9797
9898
99
99
100100
101101
102102
......
114114
115115
116116
117
117
118118
119119
120120
cc = visitor.get('country_code', None)
break
if not cc or cc == 'ip': return None
icon = '<img alt="Country flag" src="/%s/flags/%s.png"/>' % (self.icon_path, cc)
icon = '<img alt="%s flag" src="/%s/flags/%s.png"/>' % (cc, self.icon_path, cc)
return '%s %s' % (icon ,host)
def hook(self):
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Countries'), ['', self.iwla._(u'Country'), self.iwla._(u'Visitors')])
table.setColsCSSClass(['', '', 'iwla_hit'])
for (cc, visitors) in geo:
icon = '<img alt="Country flag" src="/%s/flags/%s.png"/>' % (self.icon_path, cc)
icon = '<img alt="%s flag" src="/%s/flags/%s.png"/>' % (cc, self.icon_path, cc)
table.appendRow([icon, cc, visitors])
table.computeRatio(2)
page.appendBlock(table)
table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Countries'), self.iwla._(u'Visitors')])
table.setColsCSSClass(['', '', 'iwla_hit'])
for (cc, visitors) in geo[:10]:
icon = '<img alt="Country flag" src="/%s/flags/%s.png"/>' % (self.icon_path, cc)
icon = '<img alt="%s flag" src="/%s/flags/%s.png"/>' % (cc, self.icon_path, cc)
table.appendRow([icon, cc, visitors])
table.computeRatio(2)
index.appendBlock(table)
plugins/display/operating_systems.py
7878
7979
8080
81
81
8282
8383
8484
......
9595
9696
9797
98
98
9999
100100
101101
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Operating Systems'), ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')])
table.setColsCSSClass(['', '', 'iwla_hit'])
for (os_name, entrance) in operating_systems:
icon = '<img alt="Operating system icon" src="/%s/os/%s.png"/>' % (self.icon_path, os_name)
icon = '<img alt="%s icon" src="/%s/os/%s.png"/>' % (os_name, self.icon_path, os_name)
table.appendRow([icon, os_name, entrance])
page.appendBlock(table)
table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')])
table.setColsCSSClass(['', '', 'iwla_hit'])
for (family, entrance) in os_families:
icon = '<img alt="Operating system icon" src="/%s/os/%s.png"/>' % (self.icon_path, self.icon_names[family])
icon = '<img alt="%s icon" src="/%s/os/%s.png"/>' % (self.icon_names[family], self.icon_path, self.icon_names[family])
table.appendRow([icon, family, entrance])
table.computeRatio(2)
index.appendBlock(table)

Archive Download the corresponding diff file

Branches

Tags