Custom new post submit button text

main
Bob Mottram 2021-05-30 18:38:41 +01:00
parent 1a410dd8ca
commit d8dff6e804
19 changed files with 88 additions and 22 deletions

View File

@ -2324,6 +2324,10 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.keyShortcuts.get(nickname): if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname] accessKeys = self.server.keyShortcuts[nickname]
customSubmitText = \
getConfigParam(baseDir,
'customSubmitText')
msg = htmlNewPost(self.server.cssCache, msg = htmlNewPost(self.server.cssCache,
False, self.server.translate, False, self.server.translate,
baseDir, baseDir,
@ -2337,7 +2341,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName, self.server.themeName,
True, accessKeys).encode('utf-8') True, accessKeys,
customSubmitText).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain) cookie, callingDomain)
@ -2433,6 +2438,10 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.keyShortcuts.get(nickname): if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname] accessKeys = self.server.keyShortcuts[nickname]
customSubmitText = \
getConfigParam(baseDir,
'customSubmitText')
msg = htmlNewPost(self.server.cssCache, msg = htmlNewPost(self.server.cssCache,
False, self.server.translate, False, self.server.translate,
baseDir, baseDir,
@ -2445,7 +2454,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName, self.server.themeName,
True, accessKeys).encode('utf-8') True, accessKeys,
customSubmitText).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, callingDomain) cookie, callingDomain)
@ -4440,6 +4450,22 @@ class PubServer(BaseHTTPRequestHandler):
'youtubedomain', '') 'youtubedomain', '')
self.server.YTReplacementDomain = None self.server.YTReplacementDomain = None
# change custom post submit button text
currCustomSubmitText = \
getConfigParam(baseDir,
'customSubmitText')
if fields.get('customSubmitText'):
if fields['customSubmitText'] != \
currCustomSubmitText:
customText = fields['customSubmitText']
setConfigParam(baseDir,
'customSubmitText',
customText)
else:
if currCustomSubmitText:
setConfigParam(baseDir,
'customSubmitText', '')
# change instance description # change instance description
currInstanceDescriptionShort = \ currInstanceDescriptionShort = \
getConfigParam(baseDir, getConfigParam(baseDir,
@ -10421,6 +10447,10 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.keyShortcuts.get(nickname): if self.server.keyShortcuts.get(nickname):
accessKeys = self.server.keyShortcuts[nickname] accessKeys = self.server.keyShortcuts[nickname]
customSubmitText = \
getConfigParam(baseDir,
'customSubmitText')
msg = htmlNewPost(self.server.cssCache, msg = htmlNewPost(self.server.cssCache,
mediaInstance, mediaInstance,
translate, translate,
@ -10435,7 +10465,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.defaultTimeline, self.server.defaultTimeline,
self.server.newswire, self.server.newswire,
self.server.themeName, self.server.themeName,
noDropDown, accessKeys).encode('utf-8') noDropDown, accessKeys,
customSubmitText).encode('utf-8')
if not msg: if not msg:
print('Error replying to ' + inReplyToUrl) print('Error replying to ' + inReplyToUrl)
self._404() self._404()

View File

@ -446,5 +446,6 @@
"Artists": "الفنانين", "Artists": "الفنانين",
"Graphic Design": "التصميم الجرافيكي", "Graphic Design": "التصميم الجرافيكي",
"Import Theme": "استيراد الموضوع", "Import Theme": "استيراد الموضوع",
"Export Theme": "موضوع التصدير" "Export Theme": "موضوع التصدير",
"Custom post submit button text": "عرف نشر إرسال نص زر"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artistes", "Artists": "Artistes",
"Graphic Design": "Disseny gràfic", "Graphic Design": "Disseny gràfic",
"Import Theme": "Importació temàtica", "Import Theme": "Importació temàtica",
"Export Theme": "Tema d'exportació" "Export Theme": "Tema d'exportació",
"Custom post submit button text": "Text de botó d'enviament de publicacions personalitzades"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artistiaid", "Artists": "Artistiaid",
"Graphic Design": "Dylunio Graffig", "Graphic Design": "Dylunio Graffig",
"Import Theme": "Thema Mewnforio", "Import Theme": "Thema Mewnforio",
"Export Theme": "Thema Allforio" "Export Theme": "Thema Allforio",
"Custom post submit button text": "Testun Post Post Post"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Künstler", "Artists": "Künstler",
"Graphic Design": "Grafikdesign", "Graphic Design": "Grafikdesign",
"Import Theme": "Theme importieren", "Import Theme": "Theme importieren",
"Export Theme": "Theme exportieren" "Export Theme": "Theme exportieren",
"Custom post submit button text": "Benutzerdefinierte Post-Senden Schaltfläche Text"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artists", "Artists": "Artists",
"Graphic Design": "Graphic Design", "Graphic Design": "Graphic Design",
"Import Theme": "Import Theme", "Import Theme": "Import Theme",
"Export Theme": "Export Theme" "Export Theme": "Export Theme",
"Custom post submit button text": "Custom post submit button text"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artistas", "Artists": "Artistas",
"Graphic Design": "Diseño gráfico", "Graphic Design": "Diseño gráfico",
"Import Theme": "Tema de importación", "Import Theme": "Tema de importación",
"Export Theme": "Tema de exportación" "Export Theme": "Tema de exportación",
"Custom post submit button text": "POST POST PERSONALIZADO Botón Texto"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artistes", "Artists": "Artistes",
"Graphic Design": "Conception graphique", "Graphic Design": "Conception graphique",
"Import Theme": "Import thème", "Import Theme": "Import thème",
"Export Theme": "Thème d'exportation" "Export Theme": "Thème d'exportation",
"Custom post submit button text": "Texte de bouton d'envoi postal personnalisé"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Ealaíontóirí", "Artists": "Ealaíontóirí",
"Graphic Design": "Dearadh grafach", "Graphic Design": "Dearadh grafach",
"Import Theme": "Téama Iompórtáil", "Import Theme": "Téama Iompórtáil",
"Export Theme": "Téama Easpórtála" "Export Theme": "Téama Easpórtála",
"Custom post submit button text": "Post saincheaptha Cuir isteach an cnaipe Téacs"
} }

View File

@ -446,5 +446,6 @@
"Artists": "कलाकार की", "Artists": "कलाकार की",
"Graphic Design": "ग्राफ़िक डिज़ाइन", "Graphic Design": "ग्राफ़िक डिज़ाइन",
"Import Theme": "आयात विषय", "Import Theme": "आयात विषय",
"Export Theme": "निर्यात विषय" "Export Theme": "निर्यात विषय",
"Custom post submit button text": "कस्टम पोस्ट सबमिट बटन टेक्स्ट"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artiste", "Artists": "Artiste",
"Graphic Design": "Graphic design", "Graphic Design": "Graphic design",
"Import Theme": "Tema dell'importazione", "Import Theme": "Tema dell'importazione",
"Export Theme": "Esportare tema" "Export Theme": "Esportare tema",
"Custom post submit button text": "Pulsante di invio del post personalizzato"
} }

View File

@ -446,5 +446,6 @@
"Artists": "アーティスト", "Artists": "アーティスト",
"Graphic Design": "グラフィックデザイン", "Graphic Design": "グラフィックデザイン",
"Import Theme": "輸入テーマ", "Import Theme": "輸入テーマ",
"Export Theme": "テーマをエクスポートします" "Export Theme": "テーマをエクスポートします",
"Custom post submit button text": "カスタムポスト送信ボタンテキスト"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Hunermend", "Artists": "Hunermend",
"Graphic Design": "Sêwirana grafîkî", "Graphic Design": "Sêwirana grafîkî",
"Import Theme": "Mijara Import", "Import Theme": "Mijara Import",
"Export Theme": "Mijara Export" "Export Theme": "Mijara Export",
"Custom post submit button text": "Nivîsa bişkojka paşîn a paşîn"
} }

View File

@ -442,5 +442,6 @@
"Artists": "Artists", "Artists": "Artists",
"Graphic Design": "Graphic Design", "Graphic Design": "Graphic Design",
"Import Theme": "Import Theme", "Import Theme": "Import Theme",
"Export Theme": "Export Theme" "Export Theme": "Export Theme",
"Custom post submit button text": "Custom post submit button text"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Artistas", "Artists": "Artistas",
"Graphic Design": "Design gráfico", "Graphic Design": "Design gráfico",
"Import Theme": "Importar tema", "Import Theme": "Importar tema",
"Export Theme": "Exportar tema" "Export Theme": "Exportar tema",
"Custom post submit button text": "Texto de botão de envio de post personalizado"
} }

View File

@ -446,5 +446,6 @@
"Artists": "Художники", "Artists": "Художники",
"Graphic Design": "Графический дизайн", "Graphic Design": "Графический дизайн",
"Import Theme": "Импортировать тему", "Import Theme": "Импортировать тему",
"Export Theme": "Экспортная тема" "Export Theme": "Экспортная тема",
"Custom post submit button text": "Пользовательский пост Отправить кнопку текста"
} }

View File

@ -446,5 +446,6 @@
"Artists": "艺人", "Artists": "艺人",
"Graphic Design": "平面设计", "Graphic Design": "平面设计",
"Import Theme": "进口主题", "Import Theme": "进口主题",
"Export Theme": "出口主题" "Export Theme": "出口主题",
"Custom post submit button text": "自定义发布提交按钮文本"
} }

View File

@ -187,7 +187,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
domainFull: str, domainFull: str,
defaultTimeline: str, newswire: {}, defaultTimeline: str, newswire: {},
theme: str, noDropDown: bool, theme: str, noDropDown: bool,
accessKeys: {}) -> str: accessKeys: {}, customSubmitText: str) -> str:
"""New post screen """New post screen
""" """
replyStr = '' replyStr = ''
@ -702,9 +702,12 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
' <td><input type="submit" name="submitCitations" value="' + \ ' <td><input type="submit" name="submitCitations" value="' + \
translate['Citations'] + '"></td>\n' translate['Citations'] + '"></td>\n'
submitText = translate['Submit']
if customSubmitText:
submitText = customSubmitText
newPostForm += \ newPostForm += \
' <td><input type="submit" name="submitPost" value="' + \ ' <td><input type="submit" name="submitPost" value="' + \
translate['Submit'] + '" ' + \ submitText + '" ' + \
'accesskey="' + accessKeys['submitButton'] + '"></td>\n' 'accesskey="' + accessKeys['submitButton'] + '"></td>\n'
newPostForm += ' </tr>\n' newPostForm += ' </tr>\n'
@ -776,7 +779,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
newPostForm += ' <div class="container">\n' newPostForm += ' <div class="container">\n'
newPostForm += \ newPostForm += \
' <input type="submit" name="submitPost" value="' + \ ' <input type="submit" name="submitPost" value="' + \
translate['Submit'] + '">\n' submitText + '">\n'
newPostForm += ' </div>\n' newPostForm += ' </div>\n'
newPostForm += ' </div>\n' newPostForm += ' </div>\n'

View File

@ -1359,6 +1359,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
# Instance details section # Instance details section
instanceDescription = \ instanceDescription = \
getConfigParam(baseDir, 'instanceDescription') getConfigParam(baseDir, 'instanceDescription')
customSubmitText = \
getConfigParam(baseDir, 'customSubmitText')
instanceDescriptionShort = \ instanceDescriptionShort = \
getConfigParam(baseDir, 'instanceDescriptionShort') getConfigParam(baseDir, 'instanceDescriptionShort')
instanceTitle = \ instanceTitle = \
@ -1401,6 +1403,20 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
instanceStr += \ instanceStr += \
' <textarea id="message" name="instanceDescription" ' + \ ' <textarea id="message" name="instanceDescription" ' + \
'style="height:200px" spellcheck="true"></textarea>' 'style="height:200px" spellcheck="true"></textarea>'
instanceStr += \
' <label class="labels">' + \
translate['Custom post submit button text'] + '</label>'
if customSubmitText:
instanceStr += \
' <input type="text" ' + \
'name="customSubmitText" value="' + \
customSubmitText + '"><br>'
else:
instanceStr += \
' <input type="text" ' + \
'name="customSubmitText" value=""><br>'
instanceStr += \ instanceStr += \
' <label class="labels">' + \ ' <label class="labels">' + \
translate['Instance Logo'] + '</label>' translate['Instance Logo'] + '</label>'