mirror of https://gitlab.com/bashrc2/epicyon
Check that events exist
parent
c98e72febc
commit
8b08d5d5c2
|
@ -3650,13 +3650,13 @@ def htmlCalendarDay(translate: {}, \
|
||||||
calendarFile=accountDir+'/.newCalendar'
|
calendarFile=accountDir+'/.newCalendar'
|
||||||
if os.path.isfile(calendarFile):
|
if os.path.isfile(calendarFile):
|
||||||
os.remove(calendarFile)
|
os.remove(calendarFile)
|
||||||
|
|
||||||
cssFilename=baseDir+'/epicyon-calendar.css'
|
cssFilename=baseDir+'/epicyon-calendar.css'
|
||||||
if os.path.isfile(baseDir+'/calendar.css'):
|
if os.path.isfile(baseDir+'/calendar.css'):
|
||||||
cssFilename=baseDir+'/calendar.css'
|
cssFilename=baseDir+'/calendar.css'
|
||||||
with open(cssFilename, 'r') as cssFile:
|
with open(cssFilename, 'r') as cssFile:
|
||||||
calendarStyle = cssFile.read()
|
calendarStyle = cssFile.read()
|
||||||
|
|
||||||
calendarStr=htmlHeader(cssFilename,calendarStyle)
|
calendarStr=htmlHeader(cssFilename,calendarStyle)
|
||||||
calendarStr+='<main><table class="calendar">\n'
|
calendarStr+='<main><table class="calendar">\n'
|
||||||
calendarStr+='<caption class="calendar__banner--month">\n'
|
calendarStr+='<caption class="calendar__banner--month">\n'
|
||||||
|
@ -3665,31 +3665,32 @@ def htmlCalendarDay(translate: {}, \
|
||||||
calendarStr+='</caption>\n'
|
calendarStr+='</caption>\n'
|
||||||
calendarStr+='<tbody>\n'
|
calendarStr+='<tbody>\n'
|
||||||
|
|
||||||
for eventPost in dayEvents:
|
if dayEvents:
|
||||||
eventTime=None
|
for eventPost in dayEvents:
|
||||||
eventDescription=None
|
eventTime=None
|
||||||
eventPlace=None
|
eventDescription=None
|
||||||
for ev in eventPost:
|
eventPlace=None
|
||||||
if ev['type']=='Event':
|
for ev in eventPost:
|
||||||
if ev.get('startTime'):
|
if ev['type']=='Event':
|
||||||
eventDate=datetime.strptime(ev['startTime'],"%Y-%m-%dT%H:%M:%S%z")
|
if ev.get('startTime'):
|
||||||
eventTime=eventDate.strftime("%H:%M").strip()
|
eventDate=datetime.strptime(ev['startTime'],"%Y-%m-%dT%H:%M:%S%z")
|
||||||
if ev.get('name'):
|
eventTime=eventDate.strftime("%H:%M").strip()
|
||||||
eventDescription=ev['name'].strip()
|
if ev.get('name'):
|
||||||
elif ev['type']=='Place':
|
eventDescription=ev['name'].strip()
|
||||||
if ev.get('name'):
|
elif ev['type']=='Place':
|
||||||
eventPlace=ev['name']
|
if ev.get('name'):
|
||||||
if eventTime and eventDescription and eventPlace:
|
eventPlace=ev['name']
|
||||||
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span><br>'+eventDescription+'</td></tr>\n'
|
if eventTime and eventDescription and eventPlace:
|
||||||
elif eventTime and eventDescription and not eventPlace:
|
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span><br>'+eventDescription+'</td></tr>\n'
|
||||||
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
|
elif eventTime and eventDescription and not eventPlace:
|
||||||
elif not eventTime and eventDescription and not eventPlace:
|
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
|
||||||
calendarStr+='<tr><td class="calendar__day__time"></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
|
elif not eventTime and eventDescription and not eventPlace:
|
||||||
elif not eventTime and eventDescription and eventPlace:
|
calendarStr+='<tr><td class="calendar__day__time"></td><td class="calendar__day__event">'+eventDescription+'</td></tr>\n'
|
||||||
calendarStr+='<tr><td class="calendar__day__time"></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span><br>'+eventDescription+'</td></tr>\n'
|
elif not eventTime and eventDescription and eventPlace:
|
||||||
elif eventTime and not eventDescription and eventPlace:
|
calendarStr+='<tr><td class="calendar__day__time"></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span><br>'+eventDescription+'</td></tr>\n'
|
||||||
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span></td></tr>\n'
|
elif eventTime and not eventDescription and eventPlace:
|
||||||
|
calendarStr+='<tr><td class="calendar__day__time"><b>'+eventTime+'</b></td><td class="calendar__day__event"><span class="place">'+eventPlace+'</span></td></tr>\n'
|
||||||
|
|
||||||
calendarStr+='</tbody>\n'
|
calendarStr+='</tbody>\n'
|
||||||
calendarStr+='</table></main>\n'
|
calendarStr+='</table></main>\n'
|
||||||
calendarStr+=htmlFooter()
|
calendarStr+=htmlFooter()
|
||||||
|
@ -3747,8 +3748,9 @@ def htmlCalendar(translate: {}, \
|
||||||
if dayNumber:
|
if dayNumber:
|
||||||
dayEvents=None
|
dayEvents=None
|
||||||
events=getTodaysEvents(baseDir,nickname,domain,year,monthNumber,dayNumber)
|
events=getTodaysEvents(baseDir,nickname,domain,year,monthNumber,dayNumber)
|
||||||
if events.get(str(dayNumber)):
|
if events:
|
||||||
dayEvents=events[str(dayNumber)]
|
if events.get(str(dayNumber)):
|
||||||
|
dayEvents=events[str(dayNumber)]
|
||||||
return htmlCalendarDay(translate,baseDir,path, \
|
return htmlCalendarDay(translate,baseDir,path, \
|
||||||
year,monthNumber,dayNumber, \
|
year,monthNumber,dayNumber, \
|
||||||
nickname,domain,dayEvents, \
|
nickname,domain,dayEvents, \
|
||||||
|
|
Loading…
Reference in New Issue