From 7a145a98cc7517084be69483e80b1a37fd597649 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 30 Nov 2021 11:05:54 +0000 Subject: [PATCH] Mobile friendly adding of links --- daemon.py | 21 ++++++++++++++++++--- 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_left.py | 3 +++ 19 files changed, 55 insertions(+), 20 deletions(-) diff --git a/daemon.py b/daemon.py index f49768ac4..79566d31e 100644 --- a/daemon.py +++ b/daemon.py @@ -3975,18 +3975,33 @@ class PubServer(BaseHTTPRequestHandler): if fields.get('editedLinks'): linksStr = fields['editedLinks'] + if fields.get('newColLink'): + if linksStr: + if not linksStr.endswith('\n'): + linksStr += '\n' + linksStr += fields['newColLink'] + '\n' try: with open(linksFilename, 'w+') as linksFile: linksFile.write(linksStr) except OSError: print('EX: _linksUpdate unable to write ' + linksFilename) else: - if os.path.isfile(linksFilename): + if fields.get('newColLink'): + # the text area is empty but there is a new link added + linksStr = fields['newColLink'] + '\n' try: - os.remove(linksFilename) + with open(linksFilename, 'w+') as linksFile: + linksFile.write(linksStr) except OSError: - print('EX: _linksUpdate unable to delete ' + + print('EX: _linksUpdate unable to write ' + linksFilename) + else: + if os.path.isfile(linksFilename): + try: + os.remove(linksFilename) + except OSError: + print('EX: _linksUpdate unable to delete ' + + linksFilename) adminNickname = \ getConfigParam(baseDir, 'admin') diff --git a/translations/ar.json b/translations/ar.json index 07006e8b2..6be457d55 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "يخطر على ردود الفعل الرموز التعبيرية", "Select reaction": "حدد رد الفعل", "Don't show the Reaction button": "لا تظهر زر رد الفعل", - "New feed URL": "موجز جديد URL" + "New feed URL": "موجز جديد URL", + "New link title and URL": "عنوان الارتباط الجديد وعنوان URL" } diff --git a/translations/ca.json b/translations/ca.json index 75f0192fb..eff74f19f 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -497,5 +497,6 @@ "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ó", - "New feed URL": "URL de feed nou" + "New feed URL": "URL de feed nou", + "New link title and URL": "Títol i URL de l'enllaç nous" } diff --git a/translations/cy.json b/translations/cy.json index a232eb1f5..1f581c474 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Hysbysu ar ymatebion emoji", "Select reaction": "Dewiswch adwaith", "Don't show the Reaction button": "Peidiwch â dangos y botwm Adwaith", - "New feed URL": "URL porthiant newydd" + "New feed URL": "URL porthiant newydd", + "New link title and URL": "Teitl dolen ac URL newydd" } diff --git a/translations/de.json b/translations/de.json index 9140eac79..32ecda261 100644 --- a/translations/de.json +++ b/translations/de.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Bei Emoji-Reaktionen benachrichtigen", "Select reaction": "Reaktion auswählen", "Don't show the Reaction button": "Reaktionstaste nicht anzeigen", - "New feed URL": "Neue Feed-URL" + "New feed URL": "Neue Feed-URL", + "New link title and URL": "Neuer Linktitel und URL" } diff --git a/translations/en.json b/translations/en.json index 17291a2b2..69b356595 100644 --- a/translations/en.json +++ b/translations/en.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Notify on emoji reactions", "Select reaction": "Select reaction", "Don't show the Reaction button": "Don't show the Reaction button", - "New feed URL": "New feed URL" + "New feed URL": "New feed URL", + "New link title and URL": "New link title and URL" } diff --git a/translations/es.json b/translations/es.json index bfdd09109..abefe5114 100644 --- a/translations/es.json +++ b/translations/es.json @@ -497,5 +497,6 @@ "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", - "New feed URL": "URL de nuevo feed" + "New feed URL": "URL de nuevo feed", + "New link title and URL": "Nuevo título de enlace y URL" } diff --git a/translations/fr.json b/translations/fr.json index 581270bb5..ddeeec4ff 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -497,5 +497,6 @@ "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", - "New feed URL": "Nouvelle URL de flux" + "New feed URL": "Nouvelle URL de flux", + "New link title and URL": "Nouveau titre et URL du lien" } diff --git a/translations/ga.json b/translations/ga.json index cb9385a64..f4a56899c 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -497,5 +497,6 @@ "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ú", - "New feed URL": "URL beathaithe nua" + "New feed URL": "URL beathaithe nua", + "New link title and URL": "Teideal nasc nua agus URL" } diff --git a/translations/hi.json b/translations/hi.json index b4e9e6614..a84efb9ba 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "इमोजी प्रतिक्रियाओं पर सूचित करें", "Select reaction": "प्रतिक्रिया का चयन करें", "Don't show the Reaction button": "प्रतिक्रिया बटन न दिखाएं", - "New feed URL": "नया फ़ीड URL" + "New feed URL": "नया फ़ीड URL", + "New link title and URL": "नया लिंक शीर्षक और URL" } diff --git a/translations/it.json b/translations/it.json index 402a585e6..aef9a5bc8 100644 --- a/translations/it.json +++ b/translations/it.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Notifica sulle reazioni emoji", "Select reaction": "Seleziona reazione", "Don't show the Reaction button": "Non mostrare il pulsante Reazione", - "New feed URL": "Nuovo URL del feed" + "New feed URL": "Nuovo URL del feed", + "New link title and URL": "Nuovo titolo e URL del collegamento" } diff --git a/translations/ja.json b/translations/ja.json index feb56bee5..0c3931b82 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "絵文字の反応を通知する", "Select reaction": "反応を選択", "Don't show the Reaction button": "反応ボタンを表示しない", - "New feed URL": "新しいフィードURL" + "New feed URL": "新しいフィードURL", + "New link title and URL": "新しいリンクのタイトルとURL" } diff --git a/translations/ku.json b/translations/ku.json index b9eea499a..2e2734eaa 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -497,5 +497,6 @@ "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", - "New feed URL": "URL-ya feed nû" + "New feed URL": "URL-ya feed nû", + "New link title and URL": "Sernav û URL-ya girêdana nû" } diff --git a/translations/oc.json b/translations/oc.json index becb4d5fb..06ba6a7c7 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -493,5 +493,6 @@ "Notify on emoji reactions": "Notify on emoji reactions", "Select reaction": "Select reaction", "Don't show the Reaction button": "Don't show the Reaction button", - "New feed URL": "New feed URL" + "New feed URL": "New feed URL", + "New link title and URL": "New link title and URL" } diff --git a/translations/pt.json b/translations/pt.json index 1777f9f4e..c94d0ce55 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -497,5 +497,6 @@ "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", - "New feed URL": "Novo URL de feed" + "New feed URL": "Novo URL de feed", + "New link title and URL": "Novo título e URL do link" } diff --git a/translations/ru.json b/translations/ru.json index 158e3628f..8a35c0d59 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Уведомлять о реакции на смайлики", "Select reaction": "Выберите реакцию", "Don't show the Reaction button": "Не показывать кнопку реакции", - "New feed URL": "URL нового канала" + "New feed URL": "URL нового канала", + "New link title and URL": "Новое название ссылки и URL" } diff --git a/translations/sw.json b/translations/sw.json index 87debe744..63b5b571c 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "Arifu kuhusu maitikio ya emoji", "Select reaction": "Chagua majibu", "Don't show the Reaction button": "Usionyeshe kitufe cha Majibu", - "New feed URL": "URL mpya ya mipasho" + "New feed URL": "URL mpya ya mipasho", + "New link title and URL": "Kichwa kipya cha kiungo na URL" } diff --git a/translations/zh.json b/translations/zh.json index 9df446e38..d7cf7ddd7 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -497,5 +497,6 @@ "Notify on emoji reactions": "通知表情符号反应", "Select reaction": "选择反应", "Don't show the Reaction button": "不显示“反应”按钮", - "New feed URL": "新供稿网址" + "New feed URL": "新供稿网址", + "New link title and URL": "新链接标题和 URL" } diff --git a/webapp_column_left.py b/webapp_column_left.py index 44382a1d8..51f738390 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -20,6 +20,7 @@ from webapp_utils import headerButtonsFrontScreen from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import getBannerFile +from webapp_utils import editTextField from shares import shareCategoryIcon @@ -474,6 +475,8 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str, ' ' + \ translate['One link per line. Description followed by the link.'] + \ '
' + newColLinkStr = translate['New link title and URL'] + editLinksForm += editTextField(None, 'newColLink', '', newColLinkStr) editLinksForm += \ ' '