Add custom links

This commit is contained in:
Sergey Morozov 2014-11-14 23:39:45 +03:00
parent d1a61c47d4
commit 1a752ef951
2 changed files with 29 additions and 1 deletions

View File

@ -19,3 +19,14 @@ default_start_time_hour = '9'
default_start_time_minute = '30'
default_end_time_hour = '18'
default_end_time_minute = '15'
# Links
#links = [{'url': 'https://example-site1.com',
# 'name': 'Example site 1',
# 'description': 'Go to the example site 1'},
# {'url': '',
# 'name': 'Text without link',
# 'description': ''},
# {'url': 'http://example-site2.org',
# 'name': '<b>Formatted example</b>',
# 'description': 'You can use HTML formatting'}]

View File

@ -137,7 +137,24 @@ class pageParts(object):
'</head>\n'\
'<body bgcolor = "white">\n'
output += ' <table width="100%" bgcolor="#336299"><tr><td>\n'
output += ' <p align = "right"><a href="view-all.py" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Все журналы</a> <a href="index.py" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Сегодня</a> <a href="index.py?day=%s&month=%s&year=%s" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Завтра</a></p>\n' % (self.tomorrow.day, self.tomorrow.month, self.tomorrow.year)
output += ' <table width="100%">\n'
output += ' <tr>\n'
output += ' <td>\n'
try:
for link in config.links:
if link['url'] == '':
output += ' <p style = "display: inline; text-decoration: none; color: white;">%s</p>\n' % link['name']
else:
output += ' <a style = "text-decoration: none; border-bottom: 1px solid white; color: white;" href="%s" title="%s">%s</a>\n' % (link['url'], link['description'], link['name'])
except:
None
output += ' </td>\n'
output += ' <td>\n'
output += ' <p align = "right"><a href="view-all.py" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Все журналы</a> <a href="index.py" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Сегодня</a> <a href="index.py?day=%s&month=%s&year=%s" style = "text-decoration: none; border-bottom: 1px solid white; color: white;">Завтра</a></p>\n' % (self.tomorrow.day, self.tomorrow.month, self.tomorrow.year)
output += ' </td>\n'
output += ' </tr>\n'
output += ' </table>\n'
output += ' <H1><p align = "center"><font color = "white">Журнал командировок</font></p></H1>\n'
output += ' </td></tr></table>\n'
if self.errStatus: