main
Bob Mottram 2021-07-06 11:18:56 +01:00
parent 06eb2b96a3
commit 5af5f5cd27
1 changed files with 78 additions and 75 deletions

View File

@ -1601,64 +1601,66 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
def _htmlEditProfileChangePassword(translate: {}) -> str: def _htmlEditProfileChangePassword(translate: {}) -> str:
"""Change password section of edit profile screen """Change password section of edit profile screen
""" """
editProfileForm = ' <details><summary class="cw">' + \ editProfileForm = \
translate['Change Password'] + '</summary>\n' ' <details><summary class="cw">' + \
editProfileForm += ' <div class="container">\n' translate['Change Password'] + '</summary>\n' + \
editProfileForm += \ ' <div class="container">\n' + \
'<label class="labels">' + translate['Change Password'] + \ '<label class="labels">' + translate['Change Password'] + \
'</label><br>\n' '</label><br>\n' + \
editProfileForm += ' <input type="text" name="password" ' + \ ' <input type="text" name="password" ' + \
'value=""><br>\n' 'value=""><br>\n' + \
editProfileForm += \
'<label class="labels">' + translate['Confirm Password'] + \ '<label class="labels">' + translate['Confirm Password'] + \
'</label><br>\n' '</label><br>\n' + \
editProfileForm += \ ' <input type="text" name="passwordconfirm" value="">\n' + \
' <input type="text" name="passwordconfirm" value="">\n' ' </div></details>\n'
editProfileForm += ' </div></details>\n'
return editProfileForm return editProfileForm
def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str: def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str:
"""Background images section of edit profile screen """Background images section of edit profile screen
""" """
editProfileForm = ' <details><summary class="cw">' + \
translate['Background Images'] + '</summary>\n'
editProfileForm += ' <div class="container">\n'
idx = 'The files attached below should be no larger than ' + \ idx = 'The files attached below should be no larger than ' + \
'10MB in total uploaded at once.' '10MB in total uploaded at once.'
editProfileForm += \ editProfileForm = \
' <details><summary class="cw">' + \
translate['Background Images'] + '</summary>\n' + \
' <div class="container">\n' + \
' <label class="labels">' + translate[idx] + '</label><br><br>\n' ' <label class="labels">' + translate[idx] + '</label><br><br>\n'
if not newsInstance: if not newsInstance:
imageFormats = getImageFormats() imageFormats = getImageFormats()
editProfileForm += \ editProfileForm += \
' <label class="labels">' + \ ' <label class="labels">' + \
translate['Background image'] + '</label>\n' translate['Background image'] + '</label>\n' + \
editProfileForm += ' <input type="file" id="image" name="image"' ' <input type="file" id="image" name="image"' + \
editProfileForm += ' accept="' + imageFormats + '">\n' ' accept="' + imageFormats + '">\n'
editProfileForm += ' <br><label class="labels">' + \ editProfileForm += \
translate['Timeline banner image'] + '</label>\n' ' <br><label class="labels">' + \
editProfileForm += ' <input type="file" id="banner" name="banner"' translate['Timeline banner image'] + '</label>\n' + \
editProfileForm += ' accept="' + imageFormats + '">\n' ' <input type="file" id="banner" name="banner"' + \
' accept="' + imageFormats + '">\n'
editProfileForm += ' <br><label class="labels">' + \ editProfileForm += \
translate['Search banner image'] + '</label>\n' ' <br><label class="labels">' + \
editProfileForm += ' <input type="file" id="search_banner" ' translate['Search banner image'] + '</label>\n' + \
editProfileForm += 'name="search_banner"' ' <input type="file" id="search_banner" ' + \
editProfileForm += ' accept="' + imageFormats + '">\n' 'name="search_banner"' + \
' accept="' + imageFormats + '">\n'
editProfileForm += ' <br><label class="labels">' + \ editProfileForm += \
translate['Left column image'] + '</label>\n' ' <br><label class="labels">' + \
editProfileForm += ' <input type="file" id="left_col_image" ' translate['Left column image'] + '</label>\n' + \
editProfileForm += 'name="left_col_image"' ' <input type="file" id="left_col_image" ' + \
editProfileForm += ' accept="' + imageFormats + '">\n' 'name="left_col_image"' + \
' accept="' + imageFormats + '">\n'
editProfileForm += ' <br><label class="labels">' + \ editProfileForm += \
translate['Right column image'] + '</label>\n' ' <br><label class="labels">' + \
editProfileForm += ' <input type="file" id="right_col_image" ' translate['Right column image'] + '</label>\n' + \
editProfileForm += 'name="right_col_image"' ' <input type="file" id="right_col_image" ' + \
editProfileForm += ' accept="' + imageFormats + '">\n' 'name="right_col_image"' + \
' accept="' + imageFormats + '">\n'
editProfileForm += ' </div></details>\n' editProfileForm += ' </div></details>\n'
return editProfileForm return editProfileForm
@ -1696,48 +1698,45 @@ def _htmlEditProfileContactInfo(nickname: str,
' <input type="text" name="matrixAddress" value="' + \ ' <input type="text" name="matrixAddress" value="' + \
matrixAddress + '">\n' matrixAddress + '">\n'
editProfileForm += '<label class="labels">SSB</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">SSB</label><br>\n' + \
' <input type="text" name="ssbAddress" value="' + \ ' <input type="text" name="ssbAddress" value="' + \
ssbAddress + '">\n' ssbAddress + '">\n'
editProfileForm += '<label class="labels">Tox</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">Tox</label><br>\n' + \
' <input type="text" name="toxAddress" value="' + \ ' <input type="text" name="toxAddress" value="' + \
toxAddress + '">\n' toxAddress + '">\n'
editProfileForm += '<label class="labels">Briar</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">Briar</label><br>\n' + \
' <input type="text" name="briarAddress" value="' + \ ' <input type="text" name="briarAddress" value="' + \
briarAddress + '">\n' briarAddress + '">\n'
editProfileForm += '<label class="labels">Jami</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">Jami</label><br>\n' + \
' <input type="text" name="jamiAddress" value="' + \ ' <input type="text" name="jamiAddress" value="' + \
jamiAddress + '">\n' jamiAddress + '">\n'
editProfileForm += '<label class="labels">Cwtch</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">Cwtch</label><br>\n' + \
' <input type="text" name="cwtchAddress" value="' + \ ' <input type="text" name="cwtchAddress" value="' + \
cwtchAddress + '">\n' cwtchAddress + '">\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \ '<label class="labels">' + \
translate['PGP Fingerprint'] + '</label><br>\n' translate['PGP Fingerprint'] + '</label><br>\n' + \
editProfileForm += \
' <input type="text" name="openpgp" value="' + \ ' <input type="text" name="openpgp" value="' + \
PGPfingerprint + '">\n' PGPfingerprint + '">\n' + \
editProfileForm += \ '<label class="labels">' + translate['PGP'] + '</label><br>\n' + \
'<label class="labels">' + translate['PGP'] + '</label><br>\n'
editProfileForm += \
' <textarea id="message" placeholder=' + \ ' <textarea id="message" placeholder=' + \
'"-----BEGIN PGP PUBLIC KEY BLOCK-----" name="pgp" ' + \ '"-----BEGIN PGP PUBLIC KEY BLOCK-----" name="pgp" ' + \
'style="height:600px" spellcheck="false">' + \ 'style="height:600px" spellcheck="false">' + \
PGPpubKey + '</textarea>\n' PGPpubKey + '</textarea>\n' + \
editProfileForm += '<a href="/users/' + nickname + \ '<a href="/users/' + nickname + \
'/followingaccounts"><label class="labels">' + \ '/followingaccounts"><label class="labels">' + \
translate['Following'] + '</label></a><br>\n' translate['Following'] + '</label></a><br>\n' + \
editProfileForm += ' </div></details>\n' ' </div></details>\n'
return editProfileForm return editProfileForm
@ -1790,30 +1789,32 @@ def _htmlEditProfileMain(displayNickname: str, bioStr: str,
imageFormats = getImageFormats() imageFormats = getImageFormats()
editProfileForm = ' <div class="container">\n' editProfileForm = ' <div class="container">\n'
editProfileForm += ' <label class="labels">' + \
translate['Nickname'] + '</label>\n'
editProfileForm += \ editProfileForm += \
' <label class="labels">' + \
translate['Nickname'] + '</label>\n' + \
' <input type="text" name="displayNickname" value="' + \ ' <input type="text" name="displayNickname" value="' + \
displayNickname + '"><br>\n' displayNickname + '"><br>\n'
editProfileForm += \ editProfileForm += \
' <label class="labels">' + translate['Your bio'] + '</label>\n' ' <label class="labels">' + \
editProfileForm += \ translate['Your bio'] + '</label>\n' + \
' <textarea id="message" name="bio" style="height:200px" ' + \ ' <textarea id="message" name="bio" style="height:200px" ' + \
'spellcheck="true">' + bioStr + '</textarea>\n' 'spellcheck="true">' + bioStr + '</textarea>\n'
editProfileForm += \ editProfileForm += \
' <label class="labels">' + translate['Avatar image'] + \ ' <label class="labels">' + translate['Avatar image'] + \
'</label>\n' '</label>\n' + \
editProfileForm += \ ' <input type="file" id="avatar" name="avatar"' + \
' <input type="file" id="avatar" name="avatar"' ' accept="' + imageFormats + '">\n'
editProfileForm += ' accept="' + imageFormats + '">\n'
occupationName = '' occupationName = ''
if actorJson.get('hasOccupation'): if actorJson.get('hasOccupation'):
occupationName = getOccupationName(actorJson) occupationName = getOccupationName(actorJson)
editProfileForm += '<label class="labels">' + \
translate['Occupation'] + ':</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \
translate['Occupation'] + ':</label><br>\n' + \
' <input type="text" ' + \ ' <input type="text" ' + \
'name="occupationName" value="' + occupationName + '">\n' 'name="occupationName" value="' + occupationName + '">\n'
@ -1827,27 +1828,29 @@ def _htmlEditProfileMain(displayNickname: str, bioStr: str,
ctr += 1 ctr += 1
alsoKnownAsStr += altActor alsoKnownAsStr += altActor
editProfileForm += '<label class="labels">' + \
translate['Other accounts'] + ':</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \
translate['Other accounts'] + ':</label><br>\n' + \
' <input type="text" placeholder="https://..." ' + \ ' <input type="text" placeholder="https://..." ' + \
'name="alsoKnownAs" value="' + alsoKnownAsStr + '">\n' 'name="alsoKnownAs" value="' + alsoKnownAsStr + '">\n'
editProfileForm += '<label class="labels">' + \
translate['Moved to new account address'] + ':</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \
translate['Moved to new account address'] + ':</label><br>\n' + \
' <input type="text" placeholder="https://..." ' + \ ' <input type="text" placeholder="https://..." ' + \
'name="movedTo" value="' + movedTo + '">\n' 'name="movedTo" value="' + movedTo + '">\n'
editProfileForm += '<label class="labels">' + \
translate['Donations link'] + '</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \
translate['Donations link'] + '</label><br>\n' + \
' <input type="text" placeholder="https://..." ' + \ ' <input type="text" placeholder="https://..." ' + \
'name="donateUrl" value="' + donateUrl + '">\n' 'name="donateUrl" value="' + donateUrl + '">\n'
editProfileForm += '<label class="labels">Blog</label><br>\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">Blog</label><br>\n' + \
' <input type="text" name="blogAddress" value="' + \ ' <input type="text" name="blogAddress" value="' + \
blogAddress + '">\n' blogAddress + '">\n' + \
editProfileForm += ' </div>\n' ' </div>\n'
return editProfileForm return editProfileForm
@ -1858,8 +1861,8 @@ def _htmlEditProfileTopBanner(baseDir: str,
"""top banner on edit profile screen """top banner on edit profile screen
""" """
editProfileForm = \ editProfileForm = \
'<a href="/users/' + nickname + '/' + defaultTimeline + '">' '<a href="/users/' + nickname + '/' + defaultTimeline + '">' + \
editProfileForm += '<img loading="lazy" class="timeline-banner" src="' + \ '<img loading="lazy" class="timeline-banner" src="' + \
'/users/' + nickname + '/' + bannerFile + '" alt="" /></a>\n' '/users/' + nickname + '/' + bannerFile + '" alt="" /></a>\n'
editProfileForm += \ editProfileForm += \
@ -2157,7 +2160,7 @@ def _individualFollowAsHtml(translate: {},
'?options=' + followUrl + \ '?options=' + followUrl + \
';1;' + avatarUrl + '"><button class="buttonunfollow">' + \ ';1;' + avatarUrl + '"><button class="buttonunfollow">' + \
translate['Block'] + '</button></a>\n' translate['Block'] + '</button></a>\n'
if b == 'unfollow': elif b == 'unfollow':
buttonsStr += \ buttonsStr += \
'<a href="/users/' + actorNickname + \ '<a href="/users/' + actorNickname + \
'?options=' + followUrl + \ '?options=' + followUrl + \