Option to show only reminders on calendar

main
Bob Mottram 2024-01-22 16:49:23 +00:00
parent a4602fa8d7
commit a5da249f2e
29 changed files with 117 additions and 33 deletions

View File

@ -28,6 +28,7 @@ from utils import get_status_number
from utils import get_full_domain
from utils import text_in_file
from utils import remove_eol
from utils import is_reminder
from filters import is_filtered
from context import get_individual_post_context
from session import get_method
@ -548,9 +549,11 @@ def get_month_events_icalendar(base_dir: str, nickname: str, domain: str,
text_match: str) -> str:
"""Returns today's events in icalendar format
"""
only_show_reminders = False
month_events = \
get_calendar_events(base_dir, nickname, domain, year,
month_number, text_match)
month_number, text_match,
only_show_reminders)
ical_str = \
'BEGIN:VCALENDAR\n' + \
@ -697,7 +700,8 @@ def get_this_weeks_events(base_dir: str, nickname: str, domain: str) -> {}:
def get_calendar_events(base_dir: str, nickname: str, domain: str,
year: int, month_number: int,
text_match: str) -> {}:
text_match: str,
only_show_reminders: bool) -> {}:
"""Retrieves calendar events
Returns a dictionary indexed by day number of lists containing
Event and Place activities
@ -725,6 +729,9 @@ def get_calendar_events(base_dir: str, nickname: str, domain: str,
continue
if not _is_happening_post(post_json_object):
continue
if only_show_reminders:
if not is_reminder(post_json_object):
continue
if post_json_object.get('object'):
if post_json_object['object'].get('content'):

View File

@ -654,5 +654,7 @@
"add a rating": "إضافة تقييم",
"Rating": "تقييم",
"reading": "قراءة",
"Birthday": "عيد ميلاد"
"Birthday": "عيد ميلاد",
"Only show reminders": "عرض التذكيرات فقط",
"Show all events": "عرض كافة الأحداث"
}

View File

@ -654,5 +654,7 @@
"add a rating": "একটি রেটিং যোগ করুন",
"Rating": "রেটিং",
"reading": "পড়া",
"Birthday": "জন্মদিন"
"Birthday": "জন্মদিন",
"Only show reminders": "শুধুমাত্র অনুস্মারক দেখান",
"Show all events": "সমস্ত ঘটনা দেখান"
}

View File

@ -654,5 +654,7 @@
"add a rating": "afegir una qualificació",
"Rating": "Valoració",
"reading": "lectura",
"Birthday": "Aniversari"
"Birthday": "Aniversari",
"Only show reminders": "Mostra només recordatoris",
"Show all events": "Mostra tots els esdeveniments"
}

View File

@ -654,5 +654,7 @@
"add a rating": "ychwanegu sgôr",
"Rating": "Graddio",
"reading": "darllen",
"Birthday": "Penblwydd"
"Birthday": "Penblwydd",
"Only show reminders": "Dangoswch nodiadau atgoffa yn unig",
"Show all events": "Dangos pob digwyddiad"
}

View File

@ -654,5 +654,7 @@
"add a rating": "Fügen Sie eine Bewertung hinzu",
"Rating": "Bewertung",
"reading": "lektüre",
"Birthday": "Geburtstag"
"Birthday": "Geburtstag",
"Only show reminders": "Nur Erinnerungen anzeigen",
"Show all events": "Alle Veranstaltungen anzeigen"
}

View File

@ -654,5 +654,7 @@
"add a rating": "προσθέστε μια βαθμολογία",
"Rating": "Εκτίμηση",
"reading": "ΑΝΑΓΝΩΣΗ",
"Birthday": "Γενέθλια"
"Birthday": "Γενέθλια",
"Only show reminders": "Εμφάνιση μόνο υπενθυμίσεων",
"Show all events": "Εμφάνιση όλων των συμβάντων"
}

View File

@ -654,5 +654,7 @@
"add a rating": "add a rating",
"Rating": "Rating",
"reading": "reading",
"Birthday": "Birthday"
"Birthday": "Birthday",
"Only show reminders": "Only show reminders",
"Show all events": "Show all events"
}

View File

@ -654,5 +654,7 @@
"add a rating": "agregar una calificación",
"Rating": "Clasificación",
"reading": "lectura",
"Birthday": "Cumpleaños"
"Birthday": "Cumpleaños",
"Only show reminders": "Mostrar solo recordatorios",
"Show all events": "Mostrar todos los eventos"
}

View File

@ -654,5 +654,7 @@
"add a rating": "امتیاز اضافه کنید",
"Rating": "رتبه بندی",
"reading": "خواندن",
"Birthday": "روز تولد"
"Birthday": "روز تولد",
"Only show reminders": "فقط یادآوری ها را نشان دهید",
"Show all events": "نمایش همه رویدادها"
}

View File

@ -654,5 +654,7 @@
"add a rating": "ajouter une note",
"Rating": "Notation",
"reading": "en lisant",
"Birthday": "Anniversaire"
"Birthday": "Anniversaire",
"Only show reminders": "Afficher uniquement les rappels",
"Show all events": "Afficher tous les événements"
}

View File

@ -654,5 +654,7 @@
"add a rating": "cuir rátáil",
"Rating": "Rátáil",
"reading": "ag léamh",
"Birthday": "Breithlá"
"Birthday": "Breithlá",
"Only show reminders": "Ná taispeáin ach meabhrúcháin",
"Show all events": "Taispeáin gach imeacht"
}

View File

@ -654,5 +654,7 @@
"add a rating": "להוסיף דירוג",
"Rating": "דֵרוּג",
"reading": "קריאה",
"Birthday": "יום הולדת"
"Birthday": "יום הולדת",
"Only show reminders": "הצג רק תזכורות",
"Show all events": "הצג את כל האירועים"
}

View File

@ -654,5 +654,7 @@
"add a rating": "एक रेटिंग जोड़ें",
"Rating": "रेटिंग",
"reading": "पढ़ना",
"Birthday": "जन्मदिन"
"Birthday": "जन्मदिन",
"Only show reminders": "केवल अनुस्मारक दिखाएँ",
"Show all events": "सभी घटनाएँ दिखाएँ"
}

View File

@ -654,5 +654,7 @@
"add a rating": "aggiungi una valutazione",
"Rating": "Valutazione",
"reading": "lettura",
"Birthday": "Compleanno"
"Birthday": "Compleanno",
"Only show reminders": "Mostra solo promemoria",
"Show all events": "Mostra tutti gli eventi"
}

View File

@ -654,5 +654,7 @@
"add a rating": "評価を追加する",
"Rating": "評価",
"reading": "読む",
"Birthday": "誕生日"
"Birthday": "誕生日",
"Only show reminders": "リマインダーのみを表示",
"Show all events": "すべてのイベントを表示"
}

View File

@ -654,5 +654,7 @@
"add a rating": "평점 추가",
"Rating": "평가",
"reading": "독서",
"Birthday": "생일"
"Birthday": "생일",
"Only show reminders": "알림만 표시",
"Show all events": "모든 이벤트 표시"
}

View File

@ -654,5 +654,7 @@
"add a rating": "rêjeyek zêde bike",
"Rating": "Rating",
"reading": "xwendinî",
"Birthday": "Rojbûn"
"Birthday": "Rojbûn",
"Only show reminders": "Tenê bîranînan nîşan bidin",
"Show all events": "Hemî bûyeran nîşan bide"
}

View File

@ -654,5 +654,7 @@
"add a rating": "een beoordeling toevoegen",
"Rating": "Beoordeling",
"reading": "lezing",
"Birthday": "Verjaardag"
"Birthday": "Verjaardag",
"Only show reminders": "Toon alleen herinneringen",
"Show all events": "Toon alle evenementen"
}

View File

@ -650,5 +650,7 @@
"add a rating": "add a rating",
"Rating": "Rating",
"reading": "reading",
"Birthday": "Birthday"
"Birthday": "Birthday",
"Only show reminders": "Only show reminders",
"Show all events": "Show all events"
}

View File

@ -654,5 +654,7 @@
"add a rating": "dodaj ocenę",
"Rating": "Ocena",
"reading": "czytanie",
"Birthday": "Urodziny"
"Birthday": "Urodziny",
"Only show reminders": "Pokazuj tylko przypomnienia",
"Show all events": "Pokaż wszystkie wydarzenia"
}

View File

@ -654,5 +654,7 @@
"add a rating": "adicionar uma classificação",
"Rating": "Avaliação",
"reading": "leitura",
"Birthday": "Aniversário"
"Birthday": "Aniversário",
"Only show reminders": "Mostrar apenas lembretes",
"Show all events": "Mostrar todos os eventos"
}

View File

@ -654,5 +654,7 @@
"add a rating": "добавить оценку",
"Rating": "Рейтинг",
"reading": "чтение",
"Birthday": "День рождения"
"Birthday": "День рождения",
"Only show reminders": "Показывать только напоминания",
"Show all events": "Показать все события"
}

View File

@ -654,5 +654,7 @@
"add a rating": "ongeza ukadiriaji",
"Rating": "Ukadiriaji",
"reading": "kusoma",
"Birthday": "Siku ya kuzaliwa"
"Birthday": "Siku ya kuzaliwa",
"Only show reminders": "Onyesha vikumbusho pekee",
"Show all events": "Onyesha matukio yote"
}

View File

@ -654,5 +654,7 @@
"add a rating": "derecelendirme ekle",
"Rating": "Değerlendirme",
"reading": "okuma",
"Birthday": "Doğum günü"
"Birthday": "Doğum günü",
"Only show reminders": "Yalnızca hatırlatıcıları göster",
"Show all events": "Tüm etkinlikleri göster"
}

View File

@ -654,5 +654,7 @@
"add a rating": "додати оцінку",
"Rating": "Рейтинг",
"reading": "читання",
"Birthday": "день народження"
"Birthday": "день народження",
"Only show reminders": "Показувати лише нагадування",
"Show all events": "Показати всі події"
}

View File

@ -654,5 +654,7 @@
"add a rating": "לייגן אַ ראַנג",
"Rating": "שאַץ",
"reading": "לייענען",
"Birthday": "דיין געבורסטאָג"
"Birthday": "דיין געבורסטאָג",
"Only show reminders": "בלויז ווייַזן רימיינדערז",
"Show all events": "ווייַזן אַלע געשעענישן"
}

View File

@ -654,5 +654,7 @@
"add a rating": "添加评级",
"Rating": "评分",
"reading": "阅读",
"Birthday": "生日"
"Birthday": "生日",
"Only show reminders": "只显示提醒",
"Show all events": "显示所有活动"
}

View File

@ -364,6 +364,7 @@ def html_calendar(person_cache: {}, translate: {},
day_number = None
year = default_year
actor = http_prefix + '://' + domain_full + path.replace('/calendar', '')
only_show_reminders = False
if '?' in actor:
first = True
for part in actor.split('?'):
@ -388,6 +389,10 @@ def html_calendar(person_cache: {}, translate: {},
bool_str = part.split('=')[1]
if bool_str.lower().startswith('t'):
icalendar = True
elif part.split('=')[0] == 'onlyShowReminders':
bool_str = part.split('=')[1]
if bool_str.lower().startswith('t'):
only_show_reminders = True
first = False
actor = actor.split('?')[0]
@ -441,7 +446,7 @@ def html_calendar(person_cache: {}, translate: {},
events = \
get_calendar_events(base_dir, nickname, domain, year, month_number,
text_match)
text_match, only_show_reminders)
prev_year = year
prev_month_number = month_number - 1
@ -500,7 +505,8 @@ def html_calendar(person_cache: {}, translate: {},
# previous month
calendar_str += \
' <a href="' + cal_actor + '/calendar?year=' + str(prev_year) + \
'?month=' + str(prev_month_number) + '" ' + \
'?month=' + str(prev_month_number) + \
'?onlyShowReminders=' + str(only_show_reminders) + '" ' + \
'accesskey="' + access_keys['Page up'] + \
'" tabindex="2" class="imageAnchor">'
calendar_str += \
@ -521,7 +527,8 @@ def html_calendar(person_cache: {}, translate: {},
# next month
calendar_str += \
' <a href="' + cal_actor + '/calendar?year=' + str(next_year) + \
'?month=' + str(next_month_number) + '" ' + \
'?month=' + str(next_month_number) + \
'?onlyShowReminders=' + str(only_show_reminders) + '" ' + \
'accesskey="' + access_keys['Page down'] + \
'" tabindex="2" class="imageAnchor">'
calendar_str += \
@ -627,11 +634,27 @@ def html_calendar(person_cache: {}, translate: {},
month_name)
# '?month=' + str(month_number) + ';year=' + str(year) + \
if not only_show_reminders:
show_reminders_link = \
'<a href="' + cal_actor + '/calendar?year=' + str(year) + \
'?month=' + str(month_number) + \
'?onlyShowReminders=true" ' + \
'tabindex="2" class="imageAnchor">' + \
translate['Only show reminders'] + '</a>\n'
else:
show_reminders_link = \
'<a href="' + cal_actor + '/calendar?year=' + str(year) + \
'?month=' + str(month_number) + \
'?onlyShowReminders=false" ' + \
'tabindex="2" class="imageAnchor">' + \
translate['Show all events'] + '</a>\n'
new_event_str = \
'<br><center>\n<p>\n' + \
'<a href="' + cal_actor + '/newreminder' + \
'" tabindex="2"> ' + \
translate['Add to the calendar'] + '</a>\n</p>\n</center>\n'
translate['Add to the calendar'] + '</a>\n' + \
show_reminders_link + '</p>\n</center>\n'
calendar_icon_str = \
' <a href="' + path + '?ical=true" ' + \