Admin can edit about text and ToS from left column

merge-requests/8/head
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>'
editLinksForm += \
' <div class="container">\n'
# editLinksForm += \
# ' <a href="' + pathOriginal + '"><button class="cancelbtn">' + \
# translate['Go Back'] + '</button></a>\n'
editLinksForm += \
' <center>\n' + \
' <input type="submit" name="submitLinks" value="' + \
@ -320,5 +317,45 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
editLinksForm += \
'</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()
return editLinksForm