Key shortcuts on calendar screen

main
Bob Mottram 2021-04-23 20:42:35 +01:00
parent 775255125b
commit ca62645f1f
2 changed files with 17 additions and 5 deletions

View File

@ -11959,6 +11959,14 @@ class PubServer(BaseHTTPRequestHandler):
# Show the calendar for a user
if htmlGET and usersInPath:
if '/calendar' in self.path:
nickname = self.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]
# show the calendar screen
msg = htmlCalendar(self.server.personCache,
self.server.cssCache,
@ -11966,7 +11974,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.baseDir, self.path,
self.server.httpPrefix,
self.server.domainFull,
self.server.textModeBanner).encode('utf-8')
self.server.textModeBanner,
accessKeys).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen, cookie, callingDomain)
self._write(msg)

View File

@ -243,7 +243,7 @@ def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {},
def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
baseDir: str, path: str,
httpPrefix: str, domainFull: str,
textModeBanner: str) -> str:
textModeBanner: str, accessKeys: {}) -> str:
"""Show the calendar for a person
"""
domain = domainFull
@ -348,17 +348,20 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
calendarStr += '<caption class="calendar__banner--month">\n'
calendarStr += \
' <a href="' + calActor + '/calendar?year=' + str(prevYear) + \
'?month=' + str(prevMonthNumber) + '">'
'?month=' + str(prevMonthNumber) + '" ' + \
'accesskey="' + accessKeys['Page up'] + '">'
calendarStr += \
' <img loading="lazy" alt="' + translate['Previous month'] + \
'" title="' + translate['Previous month'] + '" src="/icons' + \
'/prev.png" class="buttonprev"/></a>\n'
calendarStr += ' <a href="' + calActor + '/inbox" title="'
calendarStr += translate['Switch to timeline view'] + '">'
calendarStr += translate['Switch to timeline view'] + '" ' + \
'accesskey="' + accessKeys['menuTimeline'] + '">'
calendarStr += ' <h1>' + monthName + '</h1></a>\n'
calendarStr += \
' <a href="' + calActor + '/calendar?year=' + str(nextYear) + \
'?month=' + str(nextMonthNumber) + '">'
'?month=' + str(nextMonthNumber) + '" ' + \
'accesskey="' + accessKeys['Page down'] + '">'
calendarStr += \
' <img loading="lazy" alt="' + translate['Next month'] + \
'" title="' + translate['Next month'] + '" src="/icons' + \