Add real names to icons/flags instead of generic ones

This commit is contained in:
Gregory Soutade 2016-04-12 09:35:03 +02:00
parent bc2556fbc1
commit 9a593713d1
4 changed files with 14 additions and 12 deletions

View File

@ -364,7 +364,7 @@ class DisplayHTMLPage(object):
for block in self.blocks: for block in self.blocks:
block.build(f, filters=filters) block.build(f, filters=filters)
if displayVersion: 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())) ("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion()))
f.write(u'</body></html>') f.write(u'</body></html>')
f.close() f.close()

View File

@ -83,11 +83,12 @@ class IWLADisplayBrowsers(IPlugin):
for (browser, entrance) in new_list: for (browser, entrance) in new_list:
if browser != 'unknown': if browser != 'unknown':
try: 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: 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: 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' browser = 'Unknown'
table.appendRow([icon, browser, entrance]) table.appendRow([icon, browser, entrance])
total_browsers[2] += entrance total_browsers[2] += entrance
@ -115,11 +116,12 @@ class IWLADisplayBrowsers(IPlugin):
for (browser, entrance) in browsers[:10]: for (browser, entrance) in browsers[:10]:
if browser != 'unknown': if browser != 'unknown':
try: 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: 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: 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') browser = self.iwla._(u'Unknown')
table.appendRow([icon, browser, entrance]) table.appendRow([icon, browser, entrance])
total_browsers[2] -= entrance total_browsers[2] -= entrance

View File

@ -77,7 +77,7 @@ class IWLADisplayTopGeo(IPlugin):
cc = visitor.get('country_code', None) cc = visitor.get('country_code', None)
break break
if not cc or cc == 'ip': return None 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) return '%s %s' % (icon ,host)
def hook(self): def hook(self):
@ -96,7 +96,7 @@ class IWLADisplayTopGeo(IPlugin):
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Countries'), ['', self.iwla._(u'Country'), self.iwla._(u'Visitors')]) table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Countries'), ['', self.iwla._(u'Country'), self.iwla._(u'Visitors')])
table.setColsCSSClass(['', '', 'iwla_hit']) table.setColsCSSClass(['', '', 'iwla_hit'])
for (cc, visitors) in geo: 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.appendRow([icon, cc, visitors])
table.computeRatio(2) table.computeRatio(2)
page.appendBlock(table) page.appendBlock(table)
@ -114,7 +114,7 @@ class IWLADisplayTopGeo(IPlugin):
table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Countries'), self.iwla._(u'Visitors')]) table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Countries'), self.iwla._(u'Visitors')])
table.setColsCSSClass(['', '', 'iwla_hit']) table.setColsCSSClass(['', '', 'iwla_hit'])
for (cc, visitors) in geo[:10]: 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.appendRow([icon, cc, visitors])
table.computeRatio(2) table.computeRatio(2)
index.appendBlock(table) index.appendBlock(table)

View File

@ -78,7 +78,7 @@ class IWLADisplayTopOperatingSystems(IPlugin):
table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Operating Systems'), ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')]) table = display.createBlock(DisplayHTMLBlockTable, self.iwla._(u'Operating Systems'), ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')])
table.setColsCSSClass(['', '', 'iwla_hit']) table.setColsCSSClass(['', '', 'iwla_hit'])
for (os_name, entrance) in operating_systems: 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]) table.appendRow([icon, os_name, entrance])
page.appendBlock(table) page.appendBlock(table)
@ -95,7 +95,7 @@ class IWLADisplayTopOperatingSystems(IPlugin):
table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')]) table = display.createBlock(DisplayHTMLBlockTable, title, ['', self.iwla._(u'Operating System'), self.iwla._(u'Entrance')])
table.setColsCSSClass(['', '', 'iwla_hit']) table.setColsCSSClass(['', '', 'iwla_hit'])
for (family, entrance) in os_families: 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.appendRow([icon, family, entrance])
table.computeRatio(2) table.computeRatio(2)
index.appendBlock(table) index.appendBlock(table)