Enter news processing rules from the newswire edit screen

merge-requests/30/head
Bob Mottram 2020-10-17 22:23:46 +01:00
parent b0a80dbb61
commit b42d6f54a1
17 changed files with 76 additions and 16 deletions

View File

@ -2984,6 +2984,16 @@ class PubServer(BaseHTTPRequestHandler):
if os.path.isfile(filterNewswireFilename): if os.path.isfile(filterNewswireFilename):
os.remove(filterNewswireFilename) os.remove(filterNewswireFilename)
# save news tagging rules
hashtagRulesFilename = \
baseDir + '/accounts/hashtagrules.txt'
if fields.get('hashtagRulesList'):
with open(hashtagRulesFilename, 'w+') as rulesfile:
rulesfile.write(fields['hashtagRulesList'])
else:
if os.path.isfile(hashtagRulesFilename):
os.remove(hashtagRulesFilename)
newswireTrustedFilename = baseDir + '/accounts/newswiretrusted.txt' newswireTrustedFilename = baseDir + '/accounts/newswiretrusted.txt'
if fields.get('trustedNewswire'): if fields.get('trustedNewswire'):
newswireTrusted = fields['trustedNewswire'] newswireTrusted = fields['trustedNewswire']

View File

@ -311,5 +311,7 @@
"Site Editors": "محررو الموقع", "Site Editors": "محررو الموقع",
"Allow news posts": "السماح بنشر الأخبار", "Allow news posts": "السماح بنشر الأخبار",
"Publish": "ينشر", "Publish": "ينشر",
"Publish a news article": "انشر مقالة إخبارية" "Publish a news article": "انشر مقالة إخبارية",
"News tagging rules": "قواعد وسم الأخبار",
"See instructions": "انظر التعليمات"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Editors de llocs", "Site Editors": "Editors de llocs",
"Allow news posts": "Permet publicacions de notícies", "Allow news posts": "Permet publicacions de notícies",
"Publish": "Publica", "Publish": "Publica",
"Publish a news article": "Publicar un article de notícies" "Publish a news article": "Publicar un article de notícies",
"News tagging rules": "Regles d'etiquetatge de notícies",
"See instructions": "Consulteu les instruccions"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Golygyddion Safle", "Site Editors": "Golygyddion Safle",
"Allow news posts": "Caniatáu swyddi newyddion", "Allow news posts": "Caniatáu swyddi newyddion",
"Publish": "Cyhoeddi", "Publish": "Cyhoeddi",
"Publish a news article": "Cyhoeddi erthygl newyddion" "Publish a news article": "Cyhoeddi erthygl newyddion",
"News tagging rules": "Rheolau tagio newyddion",
"See instructions": "Gweler y cyfarwyddiadau"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Site-Editoren", "Site Editors": "Site-Editoren",
"Allow news posts": "Nachrichtenbeiträge zulassen", "Allow news posts": "Nachrichtenbeiträge zulassen",
"Publish": "Veröffentlichen", "Publish": "Veröffentlichen",
"Publish a news article": "Veröffentlichen Sie einen Nachrichtenartikel" "Publish a news article": "Veröffentlichen Sie einen Nachrichtenartikel",
"News tagging rules": "Regeln für das Markieren von Nachrichten",
"See instructions": "Siehe Anweisungen"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Site Editors", "Site Editors": "Site Editors",
"Allow news posts": "Allow news posts", "Allow news posts": "Allow news posts",
"Publish": "Publish", "Publish": "Publish",
"Publish a news article": "Publish a news article" "Publish a news article": "Publish a news article",
"News tagging rules": "News tagging rules",
"See instructions": "See instructions"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Editores del sitio", "Site Editors": "Editores del sitio",
"Allow news posts": "Permitir publicaciones de noticias", "Allow news posts": "Permitir publicaciones de noticias",
"Publish": "Publicar", "Publish": "Publicar",
"Publish a news article": "Publica un artículo de noticias" "Publish a news article": "Publica un artículo de noticias",
"News tagging rules": "Reglas de etiquetado de noticias",
"See instructions": "Vea las instrucciones"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Éditeurs du site", "Site Editors": "Éditeurs du site",
"Allow news posts": "Autoriser les articles d'actualité", "Allow news posts": "Autoriser les articles d'actualité",
"Publish": "Publier", "Publish": "Publier",
"Publish a news article": "Publier un article de presse" "Publish a news article": "Publier un article de presse",
"News tagging rules": "Règles de marquage des actualités",
"See instructions": "Voir les instructions"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Eagarthóirí Suímh", "Site Editors": "Eagarthóirí Suímh",
"Allow news posts": "Ceadaigh poist nuachta", "Allow news posts": "Ceadaigh poist nuachta",
"Publish": "Fhoilsiú", "Publish": "Fhoilsiú",
"Publish a news article": "Foilsigh alt nuachta" "Publish a news article": "Foilsigh alt nuachta",
"News tagging rules": "Rialacha clibeála nuachta",
"See instructions": "Féach na treoracha"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "साइट संपादकों", "Site Editors": "साइट संपादकों",
"Allow news posts": "समाचार पोस्ट की अनुमति दें", "Allow news posts": "समाचार पोस्ट की अनुमति दें",
"Publish": "प्रकाशित करना", "Publish": "प्रकाशित करना",
"Publish a news article": "एक समाचार लेख प्रकाशित करें" "Publish a news article": "एक समाचार लेख प्रकाशित करें",
"News tagging rules": "समाचार टैगिंग नियम",
"See instructions": "निर्देश देखें"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Editori del sito", "Site Editors": "Editori del sito",
"Allow news posts": "Consenti post di notizie", "Allow news posts": "Consenti post di notizie",
"Publish": "Pubblicare", "Publish": "Pubblicare",
"Publish a news article": "Pubblica un articolo di notizie" "Publish a news article": "Pubblica un articolo di notizie",
"News tagging rules": "Regole di tagging delle notizie",
"See instructions": "Vedere le istruzioni"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "サイト編集者", "Site Editors": "サイト編集者",
"Allow news posts": "ニュース投稿を許可する", "Allow news posts": "ニュース投稿を許可する",
"Publish": "公開する", "Publish": "公開する",
"Publish a news article": "ニュース記事を公開する" "Publish a news article": "ニュース記事を公開する",
"News tagging rules": "ニュースのタグ付けルール",
"See instructions": "手順を参照してください"
} }

View File

@ -307,5 +307,7 @@
"Site Editors": "Site Editors", "Site Editors": "Site Editors",
"Allow news posts": "Allow news posts", "Allow news posts": "Allow news posts",
"Publish": "Publish", "Publish": "Publish",
"Publish a news article": "Publish a news article" "Publish a news article": "Publish a news article",
"News tagging rules": "News tagging rules",
"See instructions": "See instructions"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Editores do site", "Site Editors": "Editores do site",
"Allow news posts": "Permitir postagens de notícias", "Allow news posts": "Permitir postagens de notícias",
"Publish": "Publicar", "Publish": "Publicar",
"Publish a news article": "Publique um artigo de notícias" "Publish a news article": "Publique um artigo de notícias",
"News tagging rules": "Regras de marcação de notícias",
"See instructions": "Veja as instruções"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "Редакторы сайта", "Site Editors": "Редакторы сайта",
"Allow news posts": "Разрешить публикации новостей", "Allow news posts": "Разрешить публикации новостей",
"Publish": "Публиковать", "Publish": "Публиковать",
"Publish a news article": "Опубликовать новостную статью" "Publish a news article": "Опубликовать новостную статью",
"News tagging rules": "Правила тегирования новостей",
"See instructions": "См. Инструкции"
} }

View File

@ -311,5 +311,7 @@
"Site Editors": "网站编辑", "Site Editors": "网站编辑",
"Allow news posts": "允许新闻发布", "Allow news posts": "允许新闻发布",
"Publish": "发布", "Publish": "发布",
"Publish a news article": "发布新闻文章" "Publish a news article": "发布新闻文章",
"News tagging rules": "新闻标记规则",
"See instructions": "见说明"
} }

View File

@ -1356,11 +1356,31 @@ def htmlEditNewswire(translate: {}, baseDir: str, path: str,
' <br><b><label class="labels">' + \ ' <br><b><label class="labels">' + \
translate['Filtered words'] + '</label></b>\n' translate['Filtered words'] + '</label></b>\n'
editNewswireForm += ' <br><label class="labels">' + \ editNewswireForm += ' <br><label class="labels">' + \
translate['One per line'] + '</label>\n' translate['One per line'] + '</label>'
editNewswireForm += ' <textarea id="message" ' + \ editNewswireForm += ' <textarea id="message" ' + \
'name="filteredWordsNewswire" style="height:200px">' + \ 'name="filteredWordsNewswire" style="height:200px">' + \
filterStr + '</textarea>\n' filterStr + '</textarea>\n'
hashtagRulesStr = ''
hashtagRulesFilename = \
baseDir + '/accounts/hashtagrules.txt'
if os.path.isfile(hashtagRulesFilename):
with open(hashtagRulesFilename, 'r') as rulesfile:
hashtagRulesStr = rulesfile.read()
editNewswireForm += \
' <br><b><label class="labels">' + \
translate['News tagging rules'] + '</label></b>\n'
editNewswireForm += ' <br><label class="labels">' + \
translate['One per line'] + '.</label>\n'
editNewswireForm += \
' <a href="' + \
'https://gitlab.com/bashrc2/epicyon/hashtagrules.txt' + \
'">' + translate['See instructions'] + '</a>\n'
editNewswireForm += ' <textarea id="message" ' + \
'name="hashtagRulesList" style="height:200px">' + \
hashtagRulesStr + '</textarea>\n'
editNewswireForm += \ editNewswireForm += \
'</div>' '</div>'