From 1a752ef951684cb94b4a0924ab6efc1aebf26bd3 Mon Sep 17 00:00:00 2001 From: Sergey Morozov Date: Fri, 14 Nov 2014 23:39:45 +0300 Subject: [PATCH] Add custom links --- config-example.py | 11 +++++++++++ include/webInterface.py | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/config-example.py b/config-example.py index d715fa8..c1dc576 100644 --- a/config-example.py +++ b/config-example.py @@ -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': 'Formatted example', +# 'description': 'You can use HTML formatting'}] \ No newline at end of file diff --git a/include/webInterface.py b/include/webInterface.py index 7cd4075..51888a6 100644 --- a/include/webInterface.py +++ b/include/webInterface.py @@ -137,7 +137,24 @@ class pageParts(object): '\n'\ '\n' output += '
\n' - output += '

Все журналы Сегодня Завтра

\n' % (self.tomorrow.day, self.tomorrow.month, self.tomorrow.year) + output += ' \n' + output += ' \n' + output += ' \n' + output += ' \n' + output += ' \n' + output += '
\n' + + try: + for link in config.links: + if link['url'] == '': + output += '

%s

\n' % link['name'] + else: + output += ' %s\n' % (link['url'], link['description'], link['name']) + except: + None + output += '
\n' + output += '

Все журналы Сегодня Завтра

\n' % (self.tomorrow.day, self.tomorrow.month, self.tomorrow.year) + output += '
\n' output += '

Журнал командировок

\n' output += '
\n' if self.errStatus: