From 247d5a846cbba66edea74b08d85db4b6d7ead6ea Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 31 Oct 2020 13:33:47 +0000 Subject: [PATCH] Option to show icons on the front page button header --- daemon.py | 8 +++++-- webinterface.py | 55 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/daemon.py b/daemon.py index 294d0a63c..059317376 100644 --- a/daemon.py +++ b/daemon.py @@ -9519,6 +9519,7 @@ class PubServer(BaseHTTPRequestHandler): '/users/' + nickname + '/' + self.server.defaultTimeline showPublishAsIcon = self.server.showPublishAsIcon rssIconAtTop = self.server.rssIconAtTop + iconsAsButtons = htmlNewswireMobile msg = htmlNewswireMobile(self.server.cssCache, self.server.baseDir, nickname, @@ -9531,7 +9532,8 @@ class PubServer(BaseHTTPRequestHandler): timelinePath, showPublishAsIcon, authorized, - rssIconAtTop).encode('utf-8') + rssIconAtTop, + iconsAsButtons).encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) self._write(msg) @@ -9551,6 +9553,7 @@ class PubServer(BaseHTTPRequestHandler): return timelinePath = \ '/users/' + nickname + '/' + self.server.defaultTimeline + iconsAsButtons = self.server.iconsAsButtons msg = htmlLinksMobile(self.server.cssCache, self.server.baseDir, nickname, self.server.domainFull, @@ -9558,7 +9561,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.translate, timelinePath, authorized, - self.server.rssIconAtTop).encode('utf-8') + self.server.rssIconAtTop, + iconsAsButtons).encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) self._write(msg) self.server.GETbusy = False diff --git a/webinterface.py b/webinterface.py index 1b66aa676..ced96bddc 100644 --- a/webinterface.py +++ b/webinterface.py @@ -3409,7 +3409,8 @@ def htmlProfile(rssIconAtTop: bool, iconsDir = getIconsDir(baseDir) if not authorized: loginButton = headerButtonsFrontScreen(translate, nickname, - 'features', authorized) + 'features', authorized, + iconsAsButtons, iconsDir) else: editProfileStr = \ '' + \ @@ -5891,7 +5892,8 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, nickname: str, domainFull: str, httpPrefix: str, translate, timelinePath: str, authorized: bool, - rssIconAtTop: bool) -> str: + rssIconAtTop: bool, + iconsAsButtons: bool) -> str: """Show the left column links within mobile view """ htmlStr = '' @@ -5922,7 +5924,8 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, htmlStr += '
' + \ headerButtonsFrontScreen(translate, nickname, - 'links', authorized) + '
' + 'links', authorized, + iconsAsButtons, iconsDir) + '' htmlStr += \ getLeftColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, @@ -5941,7 +5944,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, timelinePath: str, showPublishAsIcon: bool, authorized: bool, - rssIconAtTop: bool) -> str: + rssIconAtTop: bool, + iconsAsButtons: bool) -> str: """Shows the mobile version of the newswire right column """ htmlStr = '' @@ -5979,7 +5983,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, htmlStr += '
' + \ headerButtonsFrontScreen(translate, nickname, - 'newswire', authorized) + '
' + 'newswire', authorized, + iconsAsButtons, iconsDir) + '' htmlStr += \ getRightColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, @@ -6019,7 +6024,9 @@ def getBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str): def headerButtonsFrontScreen(translate: {}, nickname: str, boxName: str, - authorized: bool) -> str: + authorized: bool, + iconsAsButtons: bool, + iconsDir: bool) -> str: """Returns the header buttons for the front page of a news instance """ headerStr = '' @@ -6045,16 +6052,32 @@ def headerButtonsFrontScreen(translate: {}, '
\n' - headerStr += \ - ' ' + \ - '\n' - headerStr += \ - ' ' + \ - '\n' + if iconsAsButtons: + headerStr += \ + ' ' + \ + '\n' + headerStr += \ + ' ' + \ + '\n' + else: + headerStr += \ + ' ' + \ + '| ' + translate['Newswire'] + \
+                '\n' + headerStr += \ + ' ' + \ + '| ' + translate['Links'] + \
+                '\n' else: if not authorized: headerStr += \