From 775255125b896f24cd7cad464f476464dca67047 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 23 Apr 2021 20:23:29 +0100 Subject: [PATCH] Key shortcuts on edit newswire screen --- daemon.py | 11 ++++++++++- webapp_column_right.py | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index 8dc85be6c..129235956 100644 --- a/daemon.py +++ b/daemon.py @@ -10469,6 +10469,14 @@ class PubServer(BaseHTTPRequestHandler): """Show the newswire from the right column """ if '/users/' in path and path.endswith('/editnewswire'): + nickname = path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + + accessKeys = self.server.accessKeys + if self.server.keyShortcuts.get(nickname): + accessKeys = self.server.keyShortcuts[nickname] + msg = htmlEditNewswire(self.server.cssCache, translate, baseDir, @@ -10476,7 +10484,8 @@ class PubServer(BaseHTTPRequestHandler): port, httpPrefix, self.server.defaultTimeline, - self.server.themeName).encode('utf-8') + self.server.themeName, + accessKeys).encode('utf-8') if msg: msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/webapp_column_right.py b/webapp_column_right.py index 65b157a53..a430fece8 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -516,7 +516,8 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str, domain: str, port: int, httpPrefix: str, - defaultTimeline: str, theme: str) -> str: + defaultTimeline: str, theme: str, + accessKeys: {}) -> str: """Shows the edit newswire screen """ if '/users/' not in path: @@ -549,7 +550,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str, '
' + \ '\n' + translate['Switch to timeline view'] + '" ' + \ + 'accesskey="' + accessKeys['menuTimeline'] + '">\n' editNewswireForm += '\n
' @@ -565,7 +567,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str, '
\n' editNewswireForm += \ ' \n' + translate['Submit'] + '" ' + \ + 'accesskey="' + accessKeys['submitButton'] + '">\n' editNewswireForm += \ '
\n'