From 1315311e1bed2fc1346969ac12307bdfbdc49037 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 30 Nov 2021 10:36:05 +0000 Subject: [PATCH] Extra text entry for new newswire feed Makes adding new feeds easier on mobile of the textarea is full --- daemon.py | 24 ++++++++++++++++++++---- translations/ar.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ku.json | 3 ++- translations/oc.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/zh.json | 3 ++- webapp_column_right.py | 3 +++ webapp_utils.py | 7 +++++-- 20 files changed, 62 insertions(+), 23 deletions(-) diff --git a/daemon.py b/daemon.py index 1ff0b4e8e..f49768ac4 100644 --- a/daemon.py +++ b/daemon.py @@ -4199,18 +4199,34 @@ class PubServer(BaseHTTPRequestHandler): extractTextFieldsInPOST(postBytes, boundary, debug) if fields.get('editedNewswire'): newswireStr = fields['editedNewswire'] + # append a new newswire entry + if fields.get('newNewswireFeed'): + if newswireStr: + if not newswireStr.endswith('\n'): + newswireStr += '\n' + newswireStr += fields['newNewswireFeed'] + '\n' try: with open(newswireFilename, 'w+') as newswireFile: newswireFile.write(newswireStr) except OSError: print('EX: unable to write ' + newswireFilename) else: - if os.path.isfile(newswireFilename): + if fields.get('newNewswireFeed'): + # the text area is empty but there is a new feed added + newswireStr = fields['newNewswireFeed'] + '\n' try: - os.remove(newswireFilename) + with open(newswireFilename, 'w+') as newswireFile: + newswireFile.write(newswireStr) except OSError: - print('EX: _newswireUpdate unable to delete ' + - newswireFilename) + print('EX: unable to write ' + newswireFilename) + else: + # text area has been cleared and there is no new feed + if os.path.isfile(newswireFilename): + try: + os.remove(newswireFilename) + except OSError: + print('EX: _newswireUpdate unable to delete ' + + newswireFilename) # save filtered words list for the newswire filterNewswireFilename = \ diff --git a/translations/ar.json b/translations/ar.json index ab669c49b..07006e8b2 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -496,5 +496,6 @@ "Reaction by": "رد فعل", "Notify on emoji reactions": "يخطر على ردود الفعل الرموز التعبيرية", "Select reaction": "حدد رد الفعل", - "Don't show the Reaction button": "لا تظهر زر رد الفعل" + "Don't show the Reaction button": "لا تظهر زر رد الفعل", + "New feed URL": "موجز جديد URL" } diff --git a/translations/ca.json b/translations/ca.json index 5390e4a18..75f0192fb 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -496,5 +496,6 @@ "Reaction by": "Reacció de", "Notify on emoji reactions": "Notificar sobre les reaccions dels emojis", "Select reaction": "Seleccioneu la reacció", - "Don't show the Reaction button": "No mostris el botó de reacció" + "Don't show the Reaction button": "No mostris el botó de reacció", + "New feed URL": "URL de feed nou" } diff --git a/translations/cy.json b/translations/cy.json index 4858fd0d7..a232eb1f5 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -496,5 +496,6 @@ "Reaction by": "Ymateb gan", "Notify on emoji reactions": "Hysbysu ar ymatebion emoji", "Select reaction": "Dewiswch adwaith", - "Don't show the Reaction button": "Peidiwch â dangos y botwm Adwaith" + "Don't show the Reaction button": "Peidiwch â dangos y botwm Adwaith", + "New feed URL": "URL porthiant newydd" } diff --git a/translations/de.json b/translations/de.json index ae339248f..9140eac79 100644 --- a/translations/de.json +++ b/translations/de.json @@ -496,5 +496,6 @@ "Reaction by": "Reaktion von", "Notify on emoji reactions": "Bei Emoji-Reaktionen benachrichtigen", "Select reaction": "Reaktion auswählen", - "Don't show the Reaction button": "Reaktionstaste nicht anzeigen" + "Don't show the Reaction button": "Reaktionstaste nicht anzeigen", + "New feed URL": "Neue Feed-URL" } diff --git a/translations/en.json b/translations/en.json index 4104895f6..17291a2b2 100644 --- a/translations/en.json +++ b/translations/en.json @@ -496,5 +496,6 @@ "Reaction by": "Reaction by", "Notify on emoji reactions": "Notify on emoji reactions", "Select reaction": "Select reaction", - "Don't show the Reaction button": "Don't show the Reaction button" + "Don't show the Reaction button": "Don't show the Reaction button", + "New feed URL": "New feed URL" } diff --git a/translations/es.json b/translations/es.json index 1c4782b74..bfdd09109 100644 --- a/translations/es.json +++ b/translations/es.json @@ -496,5 +496,6 @@ "Reaction by": "Reacción de", "Notify on emoji reactions": "Notificar sobre reacciones emoji", "Select reaction": "Seleccionar reacción", - "Don't show the Reaction button": "No mostrar el botón de reacción" + "Don't show the Reaction button": "No mostrar el botón de reacción", + "New feed URL": "URL de nuevo feed" } diff --git a/translations/fr.json b/translations/fr.json index bced31ac3..581270bb5 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -496,5 +496,6 @@ "Reaction by": "Réaction par", "Notify on emoji reactions": "Avertir sur les réactions emoji", "Select reaction": "Sélectionnez la réaction", - "Don't show the Reaction button": "Ne pas afficher le bouton Réaction" + "Don't show the Reaction button": "Ne pas afficher le bouton Réaction", + "New feed URL": "Nouvelle URL de flux" } diff --git a/translations/ga.json b/translations/ga.json index 6d26ad938..cb9385a64 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -496,5 +496,6 @@ "Reaction by": "Imoibriú le", "Notify on emoji reactions": "Fógra a thabhairt faoi imoibrithe emoji", "Select reaction": "Roghnaigh imoibriú", - "Don't show the Reaction button": "Ná taispeáin an cnaipe Imoibriú" + "Don't show the Reaction button": "Ná taispeáin an cnaipe Imoibriú", + "New feed URL": "URL beathaithe nua" } diff --git a/translations/hi.json b/translations/hi.json index 09f390289..b4e9e6614 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -496,5 +496,6 @@ "Reaction by": "द्वारा प्रतिक्रिया", "Notify on emoji reactions": "इमोजी प्रतिक्रियाओं पर सूचित करें", "Select reaction": "प्रतिक्रिया का चयन करें", - "Don't show the Reaction button": "प्रतिक्रिया बटन न दिखाएं" + "Don't show the Reaction button": "प्रतिक्रिया बटन न दिखाएं", + "New feed URL": "नया फ़ीड URL" } diff --git a/translations/it.json b/translations/it.json index 656ff16b5..402a585e6 100644 --- a/translations/it.json +++ b/translations/it.json @@ -496,5 +496,6 @@ "Reaction by": "Reazione di", "Notify on emoji reactions": "Notifica sulle reazioni emoji", "Select reaction": "Seleziona reazione", - "Don't show the Reaction button": "Non mostrare il pulsante Reazione" + "Don't show the Reaction button": "Non mostrare il pulsante Reazione", + "New feed URL": "Nuovo URL del feed" } diff --git a/translations/ja.json b/translations/ja.json index c5f67b34c..feb56bee5 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -496,5 +496,6 @@ "Reaction by": "による反応", "Notify on emoji reactions": "絵文字の反応を通知する", "Select reaction": "反応を選択", - "Don't show the Reaction button": "反応ボタンを表示しない" + "Don't show the Reaction button": "反応ボタンを表示しない", + "New feed URL": "新しいフィードURL" } diff --git a/translations/ku.json b/translations/ku.json index a5d1a2efd..b9eea499a 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -496,5 +496,6 @@ "Reaction by": "Reaction by", "Notify on emoji reactions": "Li ser reaksiyonên emoji agahdar bikin", "Select reaction": "Reaksiyonê hilbijêrin", - "Don't show the Reaction button": "Bişkoka Reaksiyonê nîşan nede" + "Don't show the Reaction button": "Bişkoka Reaksiyonê nîşan nede", + "New feed URL": "URL-ya feed nû" } diff --git a/translations/oc.json b/translations/oc.json index 821c9cef2..becb4d5fb 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -492,5 +492,6 @@ "Reaction by": "Reaction by", "Notify on emoji reactions": "Notify on emoji reactions", "Select reaction": "Select reaction", - "Don't show the Reaction button": "Don't show the Reaction button" + "Don't show the Reaction button": "Don't show the Reaction button", + "New feed URL": "New feed URL" } diff --git a/translations/pt.json b/translations/pt.json index 90805fc67..1777f9f4e 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -496,5 +496,6 @@ "Reaction by": "Reazione di", "Notify on emoji reactions": "Notificar sobre reações de emoji", "Select reaction": "Selecione a reação", - "Don't show the Reaction button": "Não mostrar o botão de reação" + "Don't show the Reaction button": "Não mostrar o botão de reação", + "New feed URL": "Novo URL de feed" } diff --git a/translations/ru.json b/translations/ru.json index 8529e9935..158e3628f 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -496,5 +496,6 @@ "Reaction by": "Реакция со стороны", "Notify on emoji reactions": "Уведомлять о реакции на смайлики", "Select reaction": "Выберите реакцию", - "Don't show the Reaction button": "Не показывать кнопку реакции" + "Don't show the Reaction button": "Не показывать кнопку реакции", + "New feed URL": "URL нового канала" } diff --git a/translations/sw.json b/translations/sw.json index 487a73bb4..87debe744 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -496,5 +496,6 @@ "Reaction by": "Majibu kwa", "Notify on emoji reactions": "Arifu kuhusu maitikio ya emoji", "Select reaction": "Chagua majibu", - "Don't show the Reaction button": "Usionyeshe kitufe cha Majibu" + "Don't show the Reaction button": "Usionyeshe kitufe cha Majibu", + "New feed URL": "URL mpya ya mipasho" } diff --git a/translations/zh.json b/translations/zh.json index e339fb9a0..9df446e38 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -496,5 +496,6 @@ "Reaction by": "反应由", "Notify on emoji reactions": "通知表情符号反应", "Select reaction": "选择反应", - "Don't show the Reaction button": "不显示“反应”按钮" + "Don't show the Reaction button": "不显示“反应”按钮", + "New feed URL": "新供稿网址" } diff --git a/webapp_column_right.py b/webapp_column_right.py index 93febdfb5..93b41080b 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -28,6 +28,7 @@ from webapp_utils import htmlFooter from webapp_utils import getBannerFile from webapp_utils import htmlPostSeparator from webapp_utils import headerButtonsFrontScreen +from webapp_utils import editTextField def _votesIndicator(totalVotes: int, positiveVoting: bool) -> str: @@ -588,6 +589,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str, ' ' + \ translate['Add RSS feed links below.'] + \ '
' + newFeedStr = translate['New feed URL'] + editNewswireForm += editTextField(None, 'newNewswireFeed', '', newFeedStr) editNewswireForm += \ '