From 06f3c10cb270aa150d003ef0af27872826e3e273 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 6 Oct 2020 17:18:22 +0100 Subject: [PATCH] Newswire moderation items listed --- translations/ar.json | 5 +++- translations/ca.json | 5 +++- translations/cy.json | 5 +++- translations/de.json | 5 +++- translations/en.json | 5 +++- translations/es.json | 5 +++- translations/fr.json | 5 +++- translations/ga.json | 5 +++- translations/hi.json | 5 +++- translations/it.json | 5 +++- translations/ja.json | 5 +++- translations/oc.json | 5 +++- translations/pt.json | 5 +++- translations/ru.json | 5 +++- translations/zh.json | 5 +++- webinterface.py | 70 ++++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 130 insertions(+), 15 deletions(-) diff --git a/translations/ar.json b/translations/ar.json index 096198c27..ac05265f4 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -297,5 +297,8 @@ "Edit newswire": "تحرير الأخبار", "Add RSS feed links below.": "إضافة روابط تغذية RSS أدناه.", "Newswire RSS Feed": "Newswire موجز RSS", - "Nicknames whose blog entries appear on the newswire.": "الألقاب التي تظهر إدخالات المدونة الخاصة بها على موقع الأخبار." + "Nicknames whose blog entries appear on the newswire.": "الألقاب التي تظهر إدخالات المدونة الخاصة بها على موقع الأخبار.", + "Posts to be approved": "الوظائف المطلوب الموافقة عليها", + "Discuss": "مناقشة", + "Moderator Discussion": "مناقشة المنسق" } diff --git a/translations/ca.json b/translations/ca.json index 0e2fb495e..78fbff613 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -297,5 +297,8 @@ "Edit newswire": "Editeu newswire", "Add RSS feed links below.": "Afegiu enllaços de canals RSS a continuació.", "Newswire RSS Feed": "Feed RSS de Newswire", - "Nicknames whose blog entries appear on the newswire.": "Sobrenoms les entrades del bloc apareixen a newswire." + "Nicknames whose blog entries appear on the newswire.": "Sobrenoms les entrades del bloc apareixen a newswire.", + "Posts to be approved": "Missatges per aprovar", + "Discuss": "Discuteix", + "Moderator Discussion": "Discussió sobre moderadors" } diff --git a/translations/cy.json b/translations/cy.json index 8c0b0192a..c4ed63de5 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -297,5 +297,8 @@ "Edit newswire": "Golygu newyddion", "Add RSS feed links below.": "Ychwanegwch ddolenni porthiant RSS isod.", "Newswire RSS Feed": "Newswire RSS Feed", - "Nicknames whose blog entries appear on the newswire.": "Llysenwau y mae eu cofnodion blog yn ymddangos ar y we newyddion." + "Nicknames whose blog entries appear on the newswire.": "Llysenwau y mae eu cofnodion blog yn ymddangos ar y we newyddion.", + "Posts to be approved": "Swyddi i'w cymeradwyo", + "Discuss": "Trafodwch", + "Moderator Discussion": "Trafodaeth Cymedrolwr" } diff --git a/translations/de.json b/translations/de.json index b428e1a72..a5f935f93 100644 --- a/translations/de.json +++ b/translations/de.json @@ -297,5 +297,8 @@ "Edit newswire": "Newswire bearbeiten", "Add RSS feed links below.": "Fügen Sie unten RSS-Feed-Links hinzu.", "Newswire RSS Feed": "Newswire RSS Feed", - "Nicknames whose blog entries appear on the newswire.": "Spitznamen, deren Blogeinträge im Newswire erscheinen." + "Nicknames whose blog entries appear on the newswire.": "Spitznamen, deren Blogeinträge im Newswire erscheinen.", + "Posts to be approved": "Zu genehmigende Beiträge", + "Discuss": "Diskutieren", + "Moderator Discussion": "Moderatorendiskussion" } diff --git a/translations/en.json b/translations/en.json index 644161721..3f61e3366 100644 --- a/translations/en.json +++ b/translations/en.json @@ -297,5 +297,8 @@ "Edit newswire": "Edit newswire", "Add RSS feed links below.": "Add RSS feed links below.", "Newswire RSS Feed": "Newswire RSS Feed", - "Nicknames whose blog entries appear on the newswire.": "Nicknames whose blog entries appear on the newswire." + "Nicknames whose blog entries appear on the newswire.": "Nicknames whose blog entries appear on the newswire.", + "Posts to be approved": "Posts to be approved", + "Discuss": "Discuss", + "Moderator Discussion": "Moderator Discussion" } diff --git a/translations/es.json b/translations/es.json index 457acde58..1eaf08769 100644 --- a/translations/es.json +++ b/translations/es.json @@ -297,5 +297,8 @@ "Edit newswire": "Editar newswire", "Add RSS feed links below.": "Agregue los enlaces de fuentes RSS a continuación.", "Newswire RSS Feed": "Canal RSS de Newswire", - "Nicknames whose blog entries appear on the newswire.": "Apodos cuyas entradas de blog aparecen en el newswire." + "Nicknames whose blog entries appear on the newswire.": "Apodos cuyas entradas de blog aparecen en el newswire.", + "Posts to be approved": "Publicaciones a aprobar", + "Discuss": "Discutir", + "Moderator Discussion": "Discusión del moderador" } diff --git a/translations/fr.json b/translations/fr.json index b9b0c00e2..4fa45c874 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -297,5 +297,8 @@ "Edit newswire": "Modifier le fil d'actualité", "Add RSS feed links below.": "Ajoutez des liens de flux RSS ci-dessous.", "Newswire RSS Feed": "Flux RSS de Newswire", - "Nicknames whose blog entries appear on the newswire.": "Surnoms dont les entrées de blog apparaissent sur le fil de presse." + "Nicknames whose blog entries appear on the newswire.": "Surnoms dont les entrées de blog apparaissent sur le fil de presse.", + "Posts to be approved": "Postes à approuver", + "Discuss": "Discuter", + "Moderator Discussion": "Discussion du modérateur" } diff --git a/translations/ga.json b/translations/ga.json index 1853bd945..4bd8edfb2 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -297,5 +297,8 @@ "Edit newswire": "Cuir sreang nuachta in eagar", "Add RSS feed links below.": "Cuir naisc beatha RSS thíos.", "Newswire RSS Feed": "Newswire RSS Feed", - "Nicknames whose blog entries appear on the newswire.": "Leasainmneacha a bhfuil a n-iontrálacha blag le feiceáil ar an sreang nuachta." + "Nicknames whose blog entries appear on the newswire.": "Leasainmneacha a bhfuil a n-iontrálacha blag le feiceáil ar an sreang nuachta.", + "Posts to be approved": "Poist le ceadú", + "Discuss": "Pléigh", + "Moderator Discussion": "Plé Modhnóir" } diff --git a/translations/hi.json b/translations/hi.json index 45f6af94a..1df55af62 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -297,5 +297,8 @@ "Edit newswire": "नवांश संपादित करें", "Add RSS feed links below.": "नीचे आरएसएस फ़ीड लिंक जोड़ें।", "Newswire RSS Feed": "Newswire RSS फ़ीड", - "Nicknames whose blog entries appear on the newswire.": "उपनाम जिनकी ब्लॉग प्रविष्टियाँ न्यूज़वायर पर दिखाई देती हैं।" + "Nicknames whose blog entries appear on the newswire.": "उपनाम जिनकी ब्लॉग प्रविष्टियाँ न्यूज़वायर पर दिखाई देती हैं।", + "Posts to be approved": "स्वीकृत किए जाने वाले पद", + "Discuss": "चर्चा करें", + "Moderator Discussion": "मॉडरेटर चर्चा" } diff --git a/translations/it.json b/translations/it.json index eba3c33fe..390e7fce4 100644 --- a/translations/it.json +++ b/translations/it.json @@ -297,5 +297,8 @@ "Edit newswire": "Modifica newswire", "Add RSS feed links below.": "Aggiungi i link ai feed RSS di seguito.", "Newswire RSS Feed": "Feed RSS di Newswire", - "Nicknames whose blog entries appear on the newswire.": "Soprannomi le cui voci di blog compaiono nel newswire." + "Nicknames whose blog entries appear on the newswire.": "Soprannomi le cui voci di blog compaiono nel newswire.", + "Posts to be approved": "Post da approvare", + "Discuss": "Discutere", + "Moderator Discussion": "Discussione del moderatore" } diff --git a/translations/ja.json b/translations/ja.json index 4b9a9cbb4..34e7afbb9 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -297,5 +297,8 @@ "Edit newswire": "ニュースワイヤーを編集", "Add RSS feed links below.": "以下にRSSフィードリンクを追加します。", "Newswire RSS Feed": "NewswireRSSフィード", - "Nicknames whose blog entries appear on the newswire.": "ブログエントリがニュースワイヤーに表示されるニックネーム。" + "Nicknames whose blog entries appear on the newswire.": "ブログエントリがニュースワイヤーに表示されるニックネーム。", + "Posts to be approved": "承認される投稿", + "Discuss": "議論する", + "Moderator Discussion": "モデレーターディスカッション" } diff --git a/translations/oc.json b/translations/oc.json index 6f39c0ae5..14e8e3888 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -293,5 +293,8 @@ "Edit newswire": "Edit newswire", "Add RSS feed links below.": "Add RSS feed links below.", "Newswire RSS Feed": "Newswire RSS Feed", - "Nicknames whose blog entries appear on the newswire.": "Nicknames whose blog entries appear on the newswire." + "Nicknames whose blog entries appear on the newswire.": "Nicknames whose blog entries appear on the newswire.", + "Posts to be approved": "Posts to be approved", + "Discuss": "Discuss", + "Moderator Discussion": "Moderator Discussion" } diff --git a/translations/pt.json b/translations/pt.json index af16daa72..d4d23a91a 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -297,5 +297,8 @@ "Edit newswire": "Editar notícias", "Add RSS feed links below.": "Adicione links de feed RSS abaixo.", "Newswire RSS Feed": "Feed RSS da Newswire", - "Nicknames whose blog entries appear on the newswire.": "Apelidos cujas entradas de blog aparecem nos jornais." + "Nicknames whose blog entries appear on the newswire.": "Apelidos cujas entradas de blog aparecem nos jornais.", + "Posts to be approved": "Postagens a serem aprovadas", + "Discuss": "Discutir", + "Moderator Discussion": "Discussão do moderador" } diff --git a/translations/ru.json b/translations/ru.json index 37f5d6659..f41695c62 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -297,5 +297,8 @@ "Edit newswire": "Редактировать ленту новостей", "Add RSS feed links below.": "Добавьте ссылки на RSS-канал ниже.", "Newswire RSS Feed": "Лента новостей RSS", - "Nicknames whose blog entries appear on the newswire.": "Псевдонимы, чьи записи блога появляются в ленте новостей." + "Nicknames whose blog entries appear on the newswire.": "Псевдонимы, чьи записи блога появляются в ленте новостей.", + "Posts to be approved": "Посты на утверждение", + "Discuss": "Обсудить", + "Moderator Discussion": "Обсуждение модератором" } diff --git a/translations/zh.json b/translations/zh.json index 3c2711739..30417890a 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -297,5 +297,8 @@ "Edit newswire": "编辑新闻专线", "Add RSS feed links below.": "在下面添加RSS feed链接。", "Newswire RSS Feed": "Newswire RSS提要", - "Nicknames whose blog entries appear on the newswire.": "博客条目出现在新闻专线上的昵称。" + "Nicknames whose blog entries appear on the newswire.": "博客条目出现在新闻专线上的昵称。", + "Posts to be approved": "职位待批准", + "Discuss": "讨论", + "Moderator Discussion": "主持人讨论" } diff --git a/webinterface.py b/webinterface.py index 7eb2bd901..19d392952 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1274,6 +1274,67 @@ def htmlEditLinks(translate: {}, baseDir: str, path: str, return editLinksForm +def htmlNewswireModeration(baseDir: str, path: str, translate: {}) -> str: + """Get a list of newswire items to be moderated + """ + if '/users/' not in path: + return '' + + # load the file containing newswire posts to be moderated + newswireModerationFilename = baseDir + '/accounts/newswiremoderation.txt' + moderateJson = loadJson(newswireModerationFilename) + if not newswireJson: + return '' + + # get the nickname and actor path of the moderator + nickname = path.split('/users/')[1] + if '/' in nickname: + nickname = nickname.split('/')[0] + basePath = path.split('/users/')[0] + '/users/' + nickname + + resultStr = '' + + # for each post to be moderated + for dateStr, item in moderateJson.items(): + # details of this post + title = item[0] + url = item[1] + nick = item[2] + status = item[3] + postFilename = item[4].replace('/', '#') + + # create the html for this post + resultStr += '
' + resultStr += \ + '' + resultStr += \ + '' + \ + title + '' + + resultStr += \ + '' + resultStr += \ + '

' + + resultStr += \ + '' + resultStr += \ + '' + + resultStr += \ + '' + resultStr += \ + '' + resultStr += '
' + return resultStr + + def htmlEditNewswire(translate: {}, baseDir: str, path: str, domain: str, port: int, httpPrefix: str) -> str: """Shows the edit newswire screen @@ -1335,6 +1396,15 @@ def htmlEditNewswire(translate: {}, baseDir: str, path: str, editNewswireForm += \ '
' + + newswireModerationFilename = baseDir + '/accounts/newswiremoderation.txt' + if os.path.isfile(newswireModerationFilename): + editNewswireForm += \ + ' ' + \ + translate['Posts to be approved'] + ':
' + editNewswireForm += \ + htmlNewswireModeration(baseDir, path, translate) + '
' + editNewswireForm += \ ' ' + \ translate['Add RSS feed links below.'] + \