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

View File

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