diff --git a/img/icons/calendar_notify.png b/img/icons/calendar_notify.png new file mode 100644 index 000000000..606e06a6b Binary files /dev/null and b/img/icons/calendar_notify.png differ diff --git a/img/icons/hacker/calendar_notify.png b/img/icons/hacker/calendar_notify.png new file mode 100644 index 000000000..6d6aebefe Binary files /dev/null and b/img/icons/hacker/calendar_notify.png differ diff --git a/img/icons/light/calendar_notify.png b/img/icons/light/calendar_notify.png new file mode 100644 index 000000000..606e06a6b Binary files /dev/null and b/img/icons/light/calendar_notify.png differ diff --git a/img/icons/light/person.png b/img/icons/light/person.png index e97623f16..d725b57ad 100644 Binary files a/img/icons/light/person.png and b/img/icons/light/person.png differ diff --git a/img/icons/person.png b/img/icons/person.png index e97623f16..d725b57ad 100644 Binary files a/img/icons/person.png and b/img/icons/person.png differ diff --git a/img/icons/purple/calendar_notify.png b/img/icons/purple/calendar_notify.png new file mode 100644 index 000000000..0c0876ea4 Binary files /dev/null and b/img/icons/purple/calendar_notify.png differ diff --git a/inbox.py b/inbox.py index 1618b811e..8d38ce2d9 100644 --- a/inbox.py +++ b/inbox.py @@ -1423,6 +1423,7 @@ def inboxUpdateCalendar(baseDir: str,handle: str,postJsonObject: {}) -> None: eventTime=datetime.datetime.strptime(tagDict['startTime'],"%Y-%m-%dT%H:%M:%S%z") eventYear=int(eventTime.strftime("%Y")) eventMonthNumber=int(eventTime.strftime("%m")) + eventDayOfMonth=int(eventTime.strftime("%d")) if not os.path.isdir(calendarPath+'/'+str(eventYear)): os.mkdir(calendarPath+'/'+str(eventYear)) @@ -1435,6 +1436,11 @@ def inboxUpdateCalendar(baseDir: str,handle: str,postJsonObject: {}) -> None: if calendarFile: calendarFile.write(postId+'\n') calendarFile.close() + calendarNotificationFilename=baseDir+'/accounts/'+handle+'/.newCalendar' + calendarNotificationFile=open(calendarFilename,'w') + if calendarNotificationFile: + calendarNotificationFile.write('/calendar?year='+str(eventYear)+'?month='+str(eventMonthNumber)+'?day='+str(eventDayOfMonth)) + calendarNotificationFile.close() def inboxAfterCapabilities(session,keyId: str,handle: str,messageJson: {}, \ baseDir: str,httpPrefix: str,sendThreads: [], \ diff --git a/webinterface.py b/webinterface.py index c96835254..4c6631d7a 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2100,9 +2100,19 @@ def htmlTimeline(translate: {},pageNumber: int, \ manuallyApproveFollowers: bool) -> str: """Show the timeline as html """ + accountDir=baseDir+'/accounts/'+nickname+'@'+domain + + # should the calendar icon be highlighted? + calendarImage='calendar.png' + calendarPath='/calendar' + calendarFile=accountDir+'/.newCalendar' + if os.path.isfile(calendarFile): + calendarImage='calendar_notify.png' + with open(calendarFile, 'r') as calfile: + calendarPath=calfile.read().replace('\n', '') + # should the DM button be highlighted? newDM=False - accountDir=baseDir+'/accounts/'+nickname+'@'+domain dmFile=accountDir+'/.newDM' if os.path.isfile(dmFile): newDM=True @@ -2201,7 +2211,7 @@ def htmlTimeline(translate: {},pageNumber: int, \ ' '+ \ moderationButtonStr+newPostButtonStr+ \ ' '+translate['Search and follow']+''+ \ - ' '+translate['Calendar']+''+ \ + ' '+translate['Calendar']+''+ \ ' '+translate['Refresh']+''+ \ followApprovals+ \ '' @@ -2876,6 +2886,11 @@ def htmlCalendarDay(translate: {}, \ monthName: str) -> str: """Show a day within the calendar """ + accountDir=baseDir+'/accounts/'+nickname+'@'+domain + calendarFile=accountDir+'/.newCalendar' + if os.path.isfile(calendarFile): + os.remove(calendarFile) + cssFilename=baseDir+'/epicyon-calendar.css' if os.path.isfile(baseDir+'/calendar.css'): cssFilename=baseDir+'/calendar.css'