Highlight calendar when a new event arrives

main2
Bob Mottram 2019-10-12 15:31:07 +01:00
parent 714f34609d
commit 76ba1858ff
8 changed files with 23 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -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: [], \

View File

@ -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, \
' <a href="'+actor+'/outbox"><button class="'+sentButton+'"><span>'+translate['Outbox']+'</span></button></a>'+ \
moderationButtonStr+newPostButtonStr+ \
' <a href="'+actor+'/search"><img src="/'+iconsDir+'/search.png" title="'+translate['Search and follow']+'" alt="'+translate['Search and follow']+'" class="timelineicon"/></a>'+ \
' <a href="'+actor+'/calendar"><img src="/'+iconsDir+'/calendar.png" title="'+translate['Calendar']+'" alt="'+translate['Calendar']+'" class="timelineicon"/></a>'+ \
' <a href="'+actor+calendarPath'"><img src="/'+iconsDir+'/'+calendarImage+'" title="'+translate['Calendar']+'" alt="'+translate['Calendar']+'" class="timelineicon"/></a>'+ \
' <a href="'+actor+'/'+boxName+'"><img src="/'+iconsDir+'/refresh.png" title="'+translate['Refresh']+'" alt="'+translate['Refresh']+'" class="timelineicon"/></a>'+ \
followApprovals+ \
'</div>'
@ -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'