From b97a9861c8141f6af125546b223af143506770d0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 23 Feb 2020 11:20:02 +0000 Subject: [PATCH] Delete event button --- happening.py | 2 ++ translations/ar.json | 1 + translations/ca.json | 1 + translations/cy.json | 1 + translations/de.json | 1 + translations/en.json | 1 + translations/es.json | 1 + translations/fr.json | 1 + translations/ga.json | 1 + translations/hi.json | 1 + translations/it.json | 1 + translations/ja.json | 1 + translations/oc.json | 3 ++- translations/pt.json | 1 + translations/ru.json | 1 + translations/zh.json | 1 + webinterface.py | 21 ++++++++++++++++----- 17 files changed, 34 insertions(+), 6 deletions(-) diff --git a/happening.py b/happening.py index 42ced2ab1..263c22d8b 100644 --- a/happening.py +++ b/happening.py @@ -88,6 +88,8 @@ def getTodaysEvents(baseDir: str,nickname: str,domain: str, \ calendarPostIds.append(postId) if not events.get(dayOfMonth): events[dayOfMonth]=[] + # link to the id so that the event can be easily deleted + postEvent['postId']=postId events[dayOfMonth].append(postEvent) # if some posts have been deleted then regenerate the calendar file diff --git a/translations/ar.json b/translations/ar.json index 25c17ae61..dd708795b 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -9,6 +9,7 @@ "Like this post": "هل أعجبتك هذه التدوينة", "Undo the like": "التراجع عن مثل", "Delete this post": "احذف هذا المنشور", + "Delete this event": "احذف هذا الحدث", "Reply to this post": "الرد على هذا المنصب", "Write your post text below.": "اكتب نص المنشور أدناه.", "Write your reply to": "اكتب ردك على", diff --git a/translations/ca.json b/translations/ca.json index 502b13ffb..7783bb47f 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -9,6 +9,7 @@ "Like this post": "M'agrada aquesta publicació", "Undo the like": "Desfer els similars", "Delete this post": "Suprimeix aquesta publicació", + "Delete this event": "Suprimeix aquest esdeveniment", "Reply to this post": "Respon a aquesta publicació", "Write your post text below.": "Escriviu el vostre text a continuació.", "Write your reply to": "Escriviu la vostra resposta a", diff --git a/translations/cy.json b/translations/cy.json index cdc3c40ee..3a4df53b9 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -9,6 +9,7 @@ "Like this post": "Hoffwch y swydd hon", "Undo the like": "Dadwneud y tebyg", "Delete this post": "Dileu'r swydd hon", + "Delete this event": "Dileu'r digwyddiad hwn", "Reply to this post": "Ymateb i'r swydd hon", "Write your post text below.": "Ysgrifennwch destun eich post isod.", "Write your reply to": "Ysgrifennwch eich ateb i", diff --git a/translations/de.json b/translations/de.json index 554594edd..ae7ad88a0 100644 --- a/translations/de.json +++ b/translations/de.json @@ -9,6 +9,7 @@ "Like this post": "Gefällt mir", "Undo the like": "Gefällt mir nicht mehr", "Delete this post": "Löschen", + "Delete this event": "Löschen Sie dieses Ereignis", "Reply to this post": "Antworten", "Write your post text below.": "Schreiben Sie unten Ihren Beitrag.", "Write your reply to": "Schreiben Sie Ihre Antwort ", diff --git a/translations/en.json b/translations/en.json index 029f6e5ae..aa844d4c9 100644 --- a/translations/en.json +++ b/translations/en.json @@ -9,6 +9,7 @@ "Like this post": "Like this post", "Undo the like": "Undo the like", "Delete this post": "Delete this post", + "Delete this event": "Delete this event", "Reply to this post": "Reply to this post", "Write your post text below.": "Write your post text below.", "Write your reply to": "Write your reply to", diff --git a/translations/es.json b/translations/es.json index bcb68b6e0..3b2c235ca 100644 --- a/translations/es.json +++ b/translations/es.json @@ -9,6 +9,7 @@ "Like this post": "Como esta publicación", "Undo the like": "Deshacer el me gusta", "Delete this post": "Borra esta publicación", + "Delete this event": "Eliminar este evento", "Reply to this post": "Responder a esta publicación", "Write your post text below.": "Escribe el texto de tu publicación a continuación.", "Write your reply to": "Escribe tu respuesta a", diff --git a/translations/fr.json b/translations/fr.json index 7605cbd6e..4816a0e0d 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -9,6 +9,7 @@ "Like this post": "Comme ce poste", "Undo the like": "Annuler le même", "Delete this post": "Supprimer ce post", + "Delete this event": "Supprimer cet événement", "Reply to this post": "Répondre à ce post", "Write your post text below.": "Entrez votre message ci-dessous.", "Write your reply to": "Écrivez votre réponse à", diff --git a/translations/ga.json b/translations/ga.json index f1bc80b2e..af41aa597 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -9,6 +9,7 @@ "Like this post": "Cosúil leis an bpost seo", "Undo the like": "Cealaigh a leithéid", "Delete this post": "Scrios an post seo", + "Delete this event": "Scrios an imeacht seo", "Reply to this post": "Freagra ar an bpost seo", "Write your post text below.": "Scríobh do théacs poist thíos.", "Write your reply to": "Scríobh do fhreagra", diff --git a/translations/hi.json b/translations/hi.json index 84537ccff..442391159 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -9,6 +9,7 @@ "Like this post": "इस डाक की तरह", "Undo the like": "की तरह पूर्ववत करें", "Delete this post": "इस पोस्ट को मिटायें", + "Delete this event": "इस ईवेंट को हटा दें", "Reply to this post": "इस पोस्ट का जवाब दें", "Write your post text below.": "अपना पोस्ट टेक्स्ट नीचे लिखें।", "Write your reply to": "अपना उत्तर लिखें", diff --git a/translations/it.json b/translations/it.json index 26d0c5d57..6ca07a796 100644 --- a/translations/it.json +++ b/translations/it.json @@ -9,6 +9,7 @@ "Like this post": "Mi piace questo post", "Undo the like": "Annulla il mi piace", "Delete this post": "Elimina questo post", + "Delete this event": "Elimina questo evento", "Reply to this post": "Rispondi a questo post", "Write your post text below.": "Scrivi il testo del tuo post qui sotto.", "Write your reply to": "Scrivi la tua risposta a", diff --git a/translations/ja.json b/translations/ja.json index d44ae936c..3cdea16cf 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -9,6 +9,7 @@ "Like this post": "この投稿のように", "Undo the like": "元に戻す", "Delete this post": "この投稿を削除", + "Delete this event": "このイベントを削除", "Reply to this post": "この投稿への返信", "Write your post text below.": "以下に投稿テキストを書いてください。", "Write your reply to": "への返信を書く", diff --git a/translations/oc.json b/translations/oc.json index 39b8dc9a2..51b1da798 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -104,7 +104,8 @@ "Options for": "Opcions per", "Stop following": "Quitar de seguir", "Follow": "Seguir", - "Delete this post?": "Suprimir aquesta publicacion ?", + "Delete this post": "Suprimir aquesta publicacion ?", + "Delete this event": "Suprimir aquesta publicacion ?", "No": "Non", "Yes": "Òc", "Info": "Info", diff --git a/translations/pt.json b/translations/pt.json index 6e3544c13..a4c0d38d8 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -9,6 +9,7 @@ "Like this post": "Curtir este post", "Undo the like": "Desfazer o gosto", "Delete this post": "Excluir esta postagem", + "Delete this event": "Excluir este evento", "Reply to this post": "Responder a este post", "Write your post text below.": "Escreva o texto da sua postagem abaixo.", "Write your reply to": "Escreva sua resposta para", diff --git a/translations/ru.json b/translations/ru.json index b3d389bb7..61f36518d 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -9,6 +9,7 @@ "Like this post": "Мне нравится этот пост", "Undo the like": "Отменить подобное", "Delete this post": "Удалить этот пост", + "Delete this event": "Удалить это событие", "Reply to this post": "Ответить на этот пост", "Write your post text below.": "Напишите текст вашего поста ниже.", "Write your reply to": "Напишите свой ответ", diff --git a/translations/zh.json b/translations/zh.json index 6536148f4..c75f94038 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -9,6 +9,7 @@ "Like this post": "喜欢这篇文章", "Undo the like": "撤消喜欢", "Delete this post": "删除此帖子", + "Delete this event": "删除此活动", "Reply to this post": "回复此帖子", "Write your post text below.": "在下面写您的帖子文字。", "Write your reply to": "写您的回覆", diff --git a/webinterface.py b/webinterface.py index 0c4943eef..60c56d2ce 100644 --- a/webinterface.py +++ b/webinterface.py @@ -3665,13 +3665,19 @@ def htmlCalendarDay(translate: {}, \ calendarStr+='\n' calendarStr+='\n' + iconsDir=getIconsDir(baseDir) + if dayEvents: for eventPost in dayEvents: eventTime=None eventDescription=None eventPlace=None + postId=None + # get the time place and description for ev in eventPost: if ev['type']=='Event': + if ev.get('postId'): + postId=ev['postId'] if ev.get('startTime'): eventDate=datetime.strptime(ev['startTime'],"%Y-%m-%dT%H:%M:%S%z") eventTime=eventDate.strftime("%H:%M").strip() @@ -3680,16 +3686,21 @@ def htmlCalendarDay(translate: {}, \ elif ev['type']=='Place': if ev.get('name'): eventPlace=ev['name'] + + deleteButtonStr='' + if postId: + deleteButtonStr=''+translate['Delete this event']+' |' + if eventTime and eventDescription and eventPlace: - calendarStr+=''+eventTime+''+eventPlace+'
'+eventDescription+'\n' + calendarStr+=''+eventTime+''+eventPlace+'
'+eventDescription+''+deleteButtonStr+'\n' elif eventTime and eventDescription and not eventPlace: - calendarStr+=''+eventTime+''+eventDescription+'\n' + calendarStr+=''+eventTime+''+eventDescription+''+deleteButtonStr+'\n' elif not eventTime and eventDescription and not eventPlace: - calendarStr+=''+eventDescription+'\n' + calendarStr+=''+eventDescription+''+deleteButtonStr+'\n' elif not eventTime and eventDescription and eventPlace: - calendarStr+=''+eventPlace+'
'+eventDescription+'\n' + calendarStr+=''+eventPlace+'
'+eventDescription+''+deleteButtonStr+'\n' elif eventTime and not eventDescription and eventPlace: - calendarStr+=''+eventTime+''+eventPlace+'\n' + calendarStr+=''+eventTime+''+eventPlace+''+deleteButtonStr+'\n' calendarStr+='\n' calendarStr+='\n'