Admin can edit about text and ToS from left column

main
Bob Mottram 2020-11-10 12:20:46 +00:00
parent f56bc33465
commit c1e2e3ae5d
1 changed files with 40 additions and 3 deletions

View File

@ -291,9 +291,6 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
' <p class="new-post-text">' + translate['Edit Links'] + '</p>' ' <p class="new-post-text">' + translate['Edit Links'] + '</p>'
editLinksForm += \ editLinksForm += \
' <div class="container">\n' ' <div class="container">\n'
# editLinksForm += \
# ' <a href="' + pathOriginal + '"><button class="cancelbtn">' + \
# translate['Go Back'] + '</button></a>\n'
editLinksForm += \ editLinksForm += \
' <center>\n' + \ ' <center>\n' + \
' <input type="submit" name="submitLinks" value="' + \ ' <input type="submit" name="submitLinks" value="' + \
@ -320,5 +317,45 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
editLinksForm += \ editLinksForm += \
'</div>' '</div>'
# the admin can edit terms of service and about text
adminNickname = getConfigParam(baseDir, 'admin')
if adminNickname:
if nickname == adminNickname:
aboutFilename = baseDir + '/accounts/about.txt'
aboutStr = ''
if os.path.isfile(aboutFilename):
with open(aboutFilename, 'r') as fp:
aboutStr = fp.read()
editLinksForm += \
'<div class="container">'
editLinksForm += \
' ' + \
translate['About this Instance'] + \
'<br>'
editLinksForm += \
' <textarea id="message" name="editedAbout" ' + \
'style="height:100vh">' + aboutStr + '</textarea>'
editLinksForm += \
'</div>'
TOSFilename = baseDir + '/accounts/tos.txt'
TOSStr = ''
if os.path.isfile(TOSFilename):
with open(TOSFilename, 'r') as fp:
TOSStr = fp.read()
editLinksForm += \
'<div class="container">'
editLinksForm += \
' ' + \
translate['Terms of Service'] + \
'<br>'
editLinksForm += \
' <textarea id="message" name="editedTOS" ' + \
'style="height:100vh">' + TOSStr + '</textarea>'
editLinksForm += \
'</div>'
editLinksForm += htmlFooter() editLinksForm += htmlFooter()
return editLinksForm return editLinksForm