Snake case

main
Bob Mottram 2022-01-04 10:33:30 +00:00
parent 347691bddc
commit ced5acc8f6
1 changed files with 186 additions and 185 deletions

View File

@ -34,13 +34,13 @@ from webapp_utils import html_keyboard_navigation
def html_person_options(default_timeline: str, def html_person_options(default_timeline: str,
css_cache: {}, translate: {}, base_dir: str, css_cache: {}, translate: {}, base_dir: str,
domain: str, domain_full: str, domain: str, domain_full: str,
originPathStr: str, origin_path_str: str,
optionsActor: str, options_actor: str,
optionsProfileUrl: str, options_profile_url: str,
optionsLink: str, options_link: str,
pageNumber: int, page_number: int,
donate_url: str, donate_url: str,
webAddress: str, web_address: str,
xmpp_address: str, xmpp_address: str,
matrix_address: str, matrix_address: str,
ssb_address: str, ssb_address: str,
@ -54,19 +54,19 @@ def html_person_options(default_timeline: str,
pgp_fingerprint: str, pgp_fingerprint: str,
email_address: str, email_address: str,
dormant_months: int, dormant_months: int,
backToPath: str, back_to_path: str,
lockedAccount: bool, locked_account: bool,
movedTo: str, moved_to: str,
alsoKnownAs: [], also_known_as: [],
text_mode_banner: str, text_mode_banner: str,
news_instance: bool, news_instance: bool,
authorized: bool, authorized: bool,
access_keys: {}, access_keys: {},
isGroup: bool) -> str: is_group: bool) -> str:
"""Show options for a person: view/follow/block/report """Show options for a person: view/follow/block/report
""" """
optionsDomain, optionsPort = get_domain_from_actor(optionsActor) options_domain, options_port = get_domain_from_actor(options_actor)
optionsDomainFull = get_full_domain(optionsDomain, optionsPort) options_domain_full = get_full_domain(options_domain, options_port)
if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'): if os.path.isfile(base_dir + '/accounts/options-background-custom.jpg'):
if not os.path.isfile(base_dir + '/accounts/options-background.jpg'): if not os.path.isfile(base_dir + '/accounts/options-background.jpg'):
@ -74,184 +74,184 @@ def html_person_options(default_timeline: str,
base_dir + '/accounts/options-background.jpg') base_dir + '/accounts/options-background.jpg')
dormant = False dormant = False
followStr = 'Follow' follow_str = 'Follow'
if isGroup: if is_group:
followStr = 'Join' follow_str = 'Join'
blockStr = 'Block' block_str = 'Block'
nickname = None nickname = None
optionsNickname = None options_nickname = None
followsYou = False follows_you = False
if originPathStr.startswith('/users/'): if origin_path_str.startswith('/users/'):
nickname = originPathStr.split('/users/')[1] nickname = origin_path_str.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname = nickname.split('/')[0] nickname = nickname.split('/')[0]
if '?' in nickname: if '?' in nickname:
nickname = nickname.split('?')[0] nickname = nickname.split('?')[0]
followerDomain, followerPort = get_domain_from_actor(optionsActor) # follower_domain, follower_port = get_domain_from_actor(options_actor)
if is_following_actor(base_dir, nickname, domain, optionsActor): if is_following_actor(base_dir, nickname, domain, options_actor):
followStr = 'Unfollow' follow_str = 'Unfollow'
if isGroup: if is_group:
followStr = 'Leave' follow_str = 'Leave'
dormant = \ dormant = \
is_dormant(base_dir, nickname, domain, optionsActor, is_dormant(base_dir, nickname, domain, options_actor,
dormant_months) dormant_months)
optionsNickname = get_nickname_from_actor(optionsActor) options_nickname = get_nickname_from_actor(options_actor)
optionsDomainFull = get_full_domain(optionsDomain, optionsPort) options_domain_full = get_full_domain(options_domain, options_port)
followsYou = \ follows_you = \
is_follower_of_person(base_dir, is_follower_of_person(base_dir,
nickname, domain, nickname, domain,
optionsNickname, optionsDomainFull) options_nickname, options_domain_full)
if is_blocked(base_dir, nickname, domain, if is_blocked(base_dir, nickname, domain,
optionsNickname, optionsDomainFull): options_nickname, options_domain_full):
blockStr = 'Block' block_str = 'Block'
optionsLinkStr = '' options_link_str = ''
if optionsLink: if options_link:
optionsLinkStr = \ options_link_str = \
' <input type="hidden" name="postUrl" value="' + \ ' <input type="hidden" name="postUrl" value="' + \
optionsLink + '">\n' options_link + '">\n'
css_filename = base_dir + '/epicyon-options.css' css_filename = base_dir + '/epicyon-options.css'
if os.path.isfile(base_dir + '/options.css'): if os.path.isfile(base_dir + '/options.css'):
css_filename = base_dir + '/options.css' css_filename = base_dir + '/options.css'
# To snooze, or not to snooze? That is the question # To snooze, or not to snooze? That is the question
snoozeButtonStr = 'Snooze' snooze_button_str = 'Snooze'
if nickname: if nickname:
if is_person_snoozed(base_dir, nickname, domain, optionsActor): if is_person_snoozed(base_dir, nickname, domain, options_actor):
snoozeButtonStr = 'Unsnooze' snooze_button_str = 'Unsnooze'
donateStr = '' donate_str = ''
if donate_url: if donate_url:
donateStr = \ donate_str = \
' <a href="' + donate_url + \ ' <a href="' + donate_url + \
' tabindex="-1""><button class="button" name="submitDonate">' + \ ' tabindex="-1""><button class="button" name="submitDonate">' + \
translate['Donate'] + '</button></a>\n' translate['Donate'] + '</button></a>\n'
instanceTitle = \ instance_title = \
get_config_param(base_dir, 'instanceTitle') get_config_param(base_dir, 'instanceTitle')
optionsStr = \ options_str = \
html_header_with_external_style(css_filename, instanceTitle, None) html_header_with_external_style(css_filename, instance_title, None)
optionsStr += html_keyboard_navigation(text_mode_banner, {}, {}) options_str += html_keyboard_navigation(text_mode_banner, {}, {})
optionsStr += '<br><br>\n' options_str += '<br><br>\n'
optionsStr += '<div class="options">\n' options_str += '<div class="options">\n'
optionsStr += ' <div class="optionsAvatar">\n' options_str += ' <div class="optionsAvatar">\n'
optionsStr += ' <center>\n' options_str += ' <center>\n'
optionsStr += ' <a href="' + optionsActor + '">\n' options_str += ' <a href="' + options_actor + '">\n'
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + \ options_str += ' <img loading="lazy" src="' + options_profile_url + \
'" alt="" ' + get_broken_link_substitute() + '/></a>\n' '" alt="" ' + get_broken_link_substitute() + '/></a>\n'
handle = get_nickname_from_actor(optionsActor) + '@' + optionsDomain handle = get_nickname_from_actor(options_actor) + '@' + options_domain
handleShown = handle handle_shown = handle
if lockedAccount: if locked_account:
handleShown += '🔒' handle_shown += '🔒'
if movedTo: if moved_to:
handleShown += '' handle_shown += ''
if dormant: if dormant:
handleShown += ' 💤' handle_shown += ' 💤'
optionsStr += \ options_str += \
' <p class="optionsText">' + translate['Options for'] + \ ' <p class="optionsText">' + translate['Options for'] + \
' @' + handleShown + '</p>\n' ' @' + handle_shown + '</p>\n'
if followsYou: if follows_you:
optionsStr += \ options_str += \
' <p class="optionsText">' + translate['Follows you'] + '</p>\n' ' <p class="optionsText">' + translate['Follows you'] + '</p>\n'
if movedTo: if moved_to:
newNickname = get_nickname_from_actor(movedTo) new_nickname = get_nickname_from_actor(moved_to)
newDomain, newPort = get_domain_from_actor(movedTo) new_domain, _ = get_domain_from_actor(moved_to)
if newNickname and newDomain: if new_nickname and new_domain:
newHandle = newNickname + '@' + newDomain new_handle = new_nickname + '@' + new_domain
optionsStr += \ options_str += \
' <p class="optionsText">' + \ ' <p class="optionsText">' + \
translate['New account'] + \ translate['New account'] + \
': <a href="' + movedTo + '">@' + newHandle + '</a></p>\n' ': <a href="' + moved_to + '">@' + new_handle + '</a></p>\n'
elif alsoKnownAs: elif also_known_as:
otherAccountsHtml = \ other_accounts_html = \
' <p class="optionsText">' + \ ' <p class="optionsText">' + \
translate['Other accounts'] + ': ' translate['Other accounts'] + ': '
ctr = 0 ctr = 0
if isinstance(alsoKnownAs, list): if isinstance(also_known_as, list):
for altActor in alsoKnownAs: for alt_actor in also_known_as:
if altActor == optionsActor: if alt_actor == options_actor:
continue continue
if ctr > 0: if ctr > 0:
otherAccountsHtml += ' ' other_accounts_html += ' '
ctr += 1 ctr += 1
altDomain, altPort = get_domain_from_actor(altActor) alt_domain, _ = get_domain_from_actor(alt_actor)
otherAccountsHtml += \ other_accounts_html += \
'<a href="' + altActor + '">' + altDomain + '</a>' '<a href="' + alt_actor + '">' + alt_domain + '</a>'
elif isinstance(alsoKnownAs, str): elif isinstance(also_known_as, str):
if alsoKnownAs != optionsActor: if also_known_as != options_actor:
ctr += 1 ctr += 1
altDomain, altPort = get_domain_from_actor(alsoKnownAs) alt_domain, _ = get_domain_from_actor(also_known_as)
otherAccountsHtml += \ other_accounts_html += \
'<a href="' + alsoKnownAs + '">' + altDomain + '</a>' '<a href="' + also_known_as + '">' + alt_domain + '</a>'
otherAccountsHtml += '</p>\n' other_accounts_html += '</p>\n'
if ctr > 0: if ctr > 0:
optionsStr += otherAccountsHtml options_str += other_accounts_html
if email_address: if email_address:
optionsStr += \ options_str += \
'<p class="imText">' + translate['Email'] + \ '<p class="imText">' + translate['Email'] + \
': <a href="mailto:' + \ ': <a href="mailto:' + \
email_address + '">' + remove_html(email_address) + '</a></p>\n' email_address + '">' + remove_html(email_address) + '</a></p>\n'
if xmpp_address: if xmpp_address:
optionsStr += \ options_str += \
'<p class="imText">' + translate['XMPP'] + \ '<p class="imText">' + translate['XMPP'] + \
': <a href="xmpp:' + remove_html(xmpp_address) + '">' + \ ': <a href="xmpp:' + remove_html(xmpp_address) + '">' + \
xmpp_address + '</a></p>\n' xmpp_address + '</a></p>\n'
if matrix_address: if matrix_address:
optionsStr += \ options_str += \
'<p class="imText">' + translate['Matrix'] + ': ' + \ '<p class="imText">' + translate['Matrix'] + ': ' + \
remove_html(matrix_address) + '</p>\n' remove_html(matrix_address) + '</p>\n'
if ssb_address: if ssb_address:
optionsStr += \ options_str += \
'<p class="imText">SSB: ' + remove_html(ssb_address) + '</p>\n' '<p class="imText">SSB: ' + remove_html(ssb_address) + '</p>\n'
if blog_address: if blog_address:
optionsStr += \ options_str += \
'<p class="imText">Blog: <a href="' + \ '<p class="imText">Blog: <a href="' + \
remove_html(blog_address) + '">' + \ remove_html(blog_address) + '">' + \
remove_html(blog_address) + '</a></p>\n' remove_html(blog_address) + '</a></p>\n'
if tox_address: if tox_address:
optionsStr += \ options_str += \
'<p class="imText">Tox: ' + remove_html(tox_address) + '</p>\n' '<p class="imText">Tox: ' + remove_html(tox_address) + '</p>\n'
if briar_address: if briar_address:
if briar_address.startswith('briar://'): if briar_address.startswith('briar://'):
optionsStr += \ options_str += \
'<p class="imText">' + \ '<p class="imText">' + \
remove_html(briar_address) + '</p>\n' remove_html(briar_address) + '</p>\n'
else: else:
optionsStr += \ options_str += \
'<p class="imText">briar://' + \ '<p class="imText">briar://' + \
remove_html(briar_address) + '</p>\n' remove_html(briar_address) + '</p>\n'
if jami_address: if jami_address:
optionsStr += \ options_str += \
'<p class="imText">Jami: ' + remove_html(jami_address) + '</p>\n' '<p class="imText">Jami: ' + remove_html(jami_address) + '</p>\n'
if cwtch_address: if cwtch_address:
optionsStr += \ options_str += \
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n' '<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
if enigma_pub_key: if enigma_pub_key:
optionsStr += \ options_str += \
'<p class="imText">Enigma: ' + \ '<p class="imText">Enigma: ' + \
remove_html(enigma_pub_key) + '</p>\n' remove_html(enigma_pub_key) + '</p>\n'
if pgp_fingerprint: if pgp_fingerprint:
optionsStr += '<p class="pgp">PGP: ' + \ options_str += '<p class="pgp">PGP: ' + \
remove_html(pgp_fingerprint).replace('\n', '<br>') + '</p>\n' remove_html(pgp_fingerprint).replace('\n', '<br>') + '</p>\n'
if pgp_pub_key: if pgp_pub_key:
optionsStr += '<p class="pgp">' + \ options_str += '<p class="pgp">' + \
remove_html(pgp_pub_key).replace('\n', '<br>') + '</p>\n' remove_html(pgp_pub_key).replace('\n', '<br>') + '</p>\n'
optionsStr += ' <form method="POST" action="' + \ options_str += ' <form method="POST" action="' + \
originPathStr + '/personoptions">\n' origin_path_str + '/personoptions">\n'
optionsStr += ' <input type="hidden" name="pageNumber" value="' + \ options_str += ' <input type="hidden" name="pageNumber" value="' + \
str(pageNumber) + '">\n' str(page_number) + '">\n'
optionsStr += ' <input type="hidden" name="actor" value="' + \ options_str += ' <input type="hidden" name="actor" value="' + \
optionsActor + '">\n' options_actor + '">\n'
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \ options_str += ' <input type="hidden" name="avatarUrl" value="' + \
optionsProfileUrl + '">\n' options_profile_url + '">\n'
if authorized: if authorized:
if originPathStr == '/users/' + nickname: if origin_path_str == '/users/' + nickname:
if optionsNickname: if options_nickname:
# handle = optionsNickname + '@' + optionsDomainFull # handle = options_nickname + '@' + options_domain_full
petname = get_pet_name(base_dir, nickname, domain, handle) petname = get_pet_name(base_dir, nickname, domain, handle)
optionsStr += \ options_str += \
' ' + translate['Petname'] + ': \n' + \ ' ' + translate['Petname'] + ': \n' + \
' <input type="text" name="optionpetname" value="' + \ ' <input type="text" name="optionpetname" value="' + \
petname + '" ' + \ petname + '" ' + \
@ -261,8 +261,8 @@ def html_person_options(default_timeline: str,
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
# Notify when a post arrives from this person # Notify when a post arrives from this person
if is_following_actor(base_dir, nickname, domain, optionsActor): if is_following_actor(base_dir, nickname, domain, options_actor):
checkboxStr = \ checkbox_str = \
' <input type="checkbox" class="profilecheckbox" ' + \ ' <input type="checkbox" class="profilecheckbox" ' + \
'name="notifyOnPost" checked> 🔔' + \ 'name="notifyOnPost" checked> 🔔' + \
translate['Notify me when this account posts'] + \ translate['Notify me when this account posts'] + \
@ -270,12 +270,12 @@ def html_person_options(default_timeline: str,
'name="submitNotifyOnPost">' + \ 'name="submitNotifyOnPost">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
if not notify_when_person_posts(base_dir, nickname, domain, if not notify_when_person_posts(base_dir, nickname, domain,
optionsNickname, options_nickname,
optionsDomainFull): options_domain_full):
checkboxStr = checkboxStr.replace(' checked>', '>') checkbox_str = checkbox_str.replace(' checked>', '>')
optionsStr += checkboxStr options_str += checkbox_str
checkboxStr = \ checkbox_str = \
' <input type="checkbox" ' + \ ' <input type="checkbox" ' + \
'class="profilecheckbox" name="onCalendar" checked> ' + \ 'class="profilecheckbox" name="onCalendar" checked> ' + \
translate['Receive calendar events from this account'] + \ translate['Receive calendar events from this account'] + \
@ -283,22 +283,23 @@ def html_person_options(default_timeline: str,
'name="submitOnCalendar">' + \ 'name="submitOnCalendar">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
if not receiving_calendar_events(base_dir, nickname, domain, if not receiving_calendar_events(base_dir, nickname, domain,
optionsNickname, options_nickname,
optionsDomainFull): options_domain_full):
checkboxStr = checkboxStr.replace(' checked>', '>') checkbox_str = checkbox_str.replace(' checked>', '>')
optionsStr += checkboxStr options_str += checkbox_str
# checkbox for permission to post to newswire # checkbox for permission to post to newswire
newswirePostsPermitted = False newswire_posts_permitted = False
if optionsDomainFull == domain_full: if options_domain_full == domain_full:
admin_nickname = get_config_param(base_dir, 'admin') admin_nickname = get_config_param(base_dir, 'admin')
if (nickname == admin_nickname or if (nickname == admin_nickname or
(is_moderator(base_dir, nickname) and (is_moderator(base_dir, nickname) and
not is_moderator(base_dir, optionsNickname))): not is_moderator(base_dir, options_nickname))):
newswireBlockedFilename = \ newswire_blocked_filename = \
base_dir + '/accounts/' + \ base_dir + '/accounts/' + \
optionsNickname + '@' + optionsDomain + '/.nonewswire' options_nickname + '@' + options_domain + \
checkboxStr = \ '/.nonewswire'
checkbox_str = \
' <input type="checkbox" ' + \ ' <input type="checkbox" ' + \
'class="profilecheckbox" ' + \ 'class="profilecheckbox" ' + \
'name="postsToNews" checked> ' + \ 'name="postsToNews" checked> ' + \
@ -306,37 +307,37 @@ def html_person_options(default_timeline: str,
'\n <button type="submit" class="buttonsmall" ' + \ '\n <button type="submit" class="buttonsmall" ' + \
'name="submitPostToNews">' + \ 'name="submitPostToNews">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
if os.path.isfile(newswireBlockedFilename): if os.path.isfile(newswire_blocked_filename):
checkboxStr = checkboxStr.replace(' checked>', '>') checkbox_str = checkbox_str.replace(' checked>', '>')
else: else:
newswirePostsPermitted = True newswire_posts_permitted = True
optionsStr += checkboxStr options_str += checkbox_str
# whether blogs created by this account are moderated on # whether blogs created by this account are moderated on
# the newswire # the newswire
if newswirePostsPermitted: if newswire_posts_permitted:
moderatedFilename = \ moderated_filename = \
base_dir + '/accounts/' + \ base_dir + '/accounts/' + \
optionsNickname + '@' + \ options_nickname + '@' + \
optionsDomain + '/.newswiremoderated' options_domain + '/.newswiremoderated'
checkboxStr = \ checkbox_str = \
' <input type="checkbox" ' + \ ' <input type="checkbox" ' + \
'class="profilecheckbox" name="modNewsPosts" checked> ' + \ 'class="profilecheckbox" name="modNewsPosts" checked> ' + \
translate['News posts are moderated'] + \ translate['News posts are moderated'] + \
'\n <button type="submit" class="buttonsmall" ' + \ '\n <button type="submit" class="buttonsmall" ' + \
'name="submitModNewsPosts">' + \ 'name="submitModNewsPosts">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
if not os.path.isfile(moderatedFilename): if not os.path.isfile(moderated_filename):
checkboxStr = checkboxStr.replace(' checked>', '>') checkbox_str = checkbox_str.replace(' checked>', '>')
optionsStr += checkboxStr options_str += checkbox_str
# checkbox for permission to post to featured articles # checkbox for permission to post to featured articles
if news_instance and optionsDomainFull == domain_full: if news_instance and options_domain_full == domain_full:
admin_nickname = get_config_param(base_dir, 'admin') admin_nickname = get_config_param(base_dir, 'admin')
if (nickname == admin_nickname or if (nickname == admin_nickname or
(is_moderator(base_dir, nickname) and (is_moderator(base_dir, nickname) and
not is_moderator(base_dir, optionsNickname))): not is_moderator(base_dir, options_nickname))):
checkboxStr = \ checkbox_str = \
' <input type="checkbox" ' + \ ' <input type="checkbox" ' + \
'class="profilecheckbox" ' + \ 'class="profilecheckbox" ' + \
'name="postsToFeatures" checked> ' + \ 'name="postsToFeatures" checked> ' + \
@ -344,92 +345,92 @@ def html_person_options(default_timeline: str,
'\n <button type="submit" class="buttonsmall" ' + \ '\n <button type="submit" class="buttonsmall" ' + \
'name="submitPostToFeatures">' + \ 'name="submitPostToFeatures">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
if not is_featured_writer(base_dir, optionsNickname, if not is_featured_writer(base_dir, options_nickname,
optionsDomain): options_domain):
checkboxStr = checkboxStr.replace(' checked>', '>') checkbox_str = checkbox_str.replace(' checked>', '>')
optionsStr += checkboxStr options_str += checkbox_str
optionsStr += optionsLinkStr options_str += options_link_str
backPath = '/' back_path = '/'
if nickname: if nickname:
backPath = '/users/' + nickname + '/' + default_timeline back_path = '/users/' + nickname + '/' + default_timeline
if 'moderation' in backToPath: if 'moderation' in back_to_path:
backPath = '/users/' + nickname + '/moderation' back_path = '/users/' + nickname + '/moderation'
if authorized and originPathStr == '/users/' + nickname: if authorized and origin_path_str == '/users/' + nickname:
optionsStr += \ options_str += \
' <a href="' + backPath + '"><button type="button" ' + \ ' <a href="' + back_path + '"><button type="button" ' + \
'class="buttonIcon" name="submitBack" ' + \ 'class="buttonIcon" name="submitBack" ' + \
'accesskey="' + access_keys['menuTimeline'] + '">' + \ 'accesskey="' + access_keys['menuTimeline'] + '">' + \
translate['Go Back'] + '</button></a>\n' translate['Go Back'] + '</button></a>\n'
else: else:
optionsStr += \ options_str += \
' <a href="' + originPathStr + '"><button type="button" ' + \ ' <a href="' + origin_path_str + '"><button type="button" ' + \
'class="buttonIcon" name="submitBack" accesskey="' + \ 'class="buttonIcon" name="submitBack" accesskey="' + \
access_keys['menuTimeline'] + '">' + translate['Go Back'] + \ access_keys['menuTimeline'] + '">' + translate['Go Back'] + \
'</button></a>\n' '</button></a>\n'
if authorized: if authorized:
optionsStr += \ options_str += \
' <button type="submit" class="button" ' + \ ' <button type="submit" class="button" ' + \
'name="submitView" accesskey="' + \ 'name="submitView" accesskey="' + \
access_keys['viewButton'] + '">' + \ access_keys['viewButton'] + '">' + \
translate['View'] + '</button>\n' translate['View'] + '</button>\n'
optionsStr += donateStr options_str += donate_str
if authorized: if authorized:
optionsStr += \ options_str += \
' <button type="submit" class="button" name="submit' + \ ' <button type="submit" class="button" name="submit' + \
followStr + \ follow_str + \
'" accesskey="' + access_keys['followButton'] + '">' + \ '" accesskey="' + access_keys['followButton'] + '">' + \
translate[followStr] + '</button>\n' translate[follow_str] + '</button>\n'
optionsStr += \ options_str += \
' <button type="submit" class="button" name="submit' + \ ' <button type="submit" class="button" name="submit' + \
blockStr + '" accesskey="' + access_keys['blockButton'] + '">' + \ block_str + '" accesskey="' + access_keys['blockButton'] + '">' + \
translate[blockStr] + '</button>\n' translate[block_str] + '</button>\n'
optionsStr += \ options_str += \
' <button type="submit" class="button" name="submitDM" ' + \ ' <button type="submit" class="button" name="submitDM" ' + \
'accesskey="' + access_keys['menuDM'] + '">' + \ 'accesskey="' + access_keys['menuDM'] + '">' + \
translate['DM'] + '</button>\n' translate['DM'] + '</button>\n'
optionsStr += \ options_str += \
' <button type="submit" class="button" name="submit' + \ ' <button type="submit" class="button" name="submit' + \
snoozeButtonStr + '" accesskey="' + \ snooze_button_str + '" accesskey="' + \
access_keys['snoozeButton'] + '">' + translate[snoozeButtonStr] + \ access_keys['snoozeButton'] + '">' + \
'</button>\n' translate[snooze_button_str] + '</button>\n'
optionsStr += \ options_str += \
' <button type="submit" class="button" ' + \ ' <button type="submit" class="button" ' + \
'name="submitReport" accesskey="' + \ 'name="submitReport" accesskey="' + \
access_keys['reportButton'] + '">' + \ access_keys['reportButton'] + '">' + \
translate['Report'] + '</button>\n' translate['Report'] + '</button>\n'
if is_moderator(base_dir, nickname): if is_moderator(base_dir, nickname):
optionsStr += \ options_str += \
' <button type="submit" class="button" ' + \ ' <button type="submit" class="button" ' + \
'name="submitPersonInfo" accesskey="' + \ 'name="submitPersonInfo" accesskey="' + \
access_keys['infoButton'] + '">' + \ access_keys['infoButton'] + '">' + \
translate['Info'] + '</button>\n' translate['Info'] + '</button>\n'
personNotes = '' person_notes = ''
if originPathStr == '/users/' + nickname: if origin_path_str == '/users/' + nickname:
personNotesFilename = \ person_notes_filename = \
acct_dir(base_dir, nickname, domain) + \ acct_dir(base_dir, nickname, domain) + \
'/notes/' + handle + '.txt' '/notes/' + handle + '.txt'
if os.path.isfile(personNotesFilename): if os.path.isfile(person_notes_filename):
with open(personNotesFilename, 'r') as fp: with open(person_notes_filename, 'r') as fp_notes:
personNotes = fp.read() person_notes = fp_notes.read()
optionsStr += \ options_str += \
' <br><br>' + translate['Notes'] + ': \n' ' <br><br>' + translate['Notes'] + ': \n'
optionsStr += ' <button type="submit" class="buttonsmall" ' + \ options_str += ' <button type="submit" class="buttonsmall" ' + \
'name="submitPersonNotes">' + \ 'name="submitPersonNotes">' + \
translate['Submit'] + '</button><br>\n' translate['Submit'] + '</button><br>\n'
optionsStr += \ options_str += \
' <textarea id="message" ' + \ ' <textarea id="message" ' + \
'name="optionnotes" style="height:400px" spellcheck="true" ' + \ 'name="optionnotes" style="height:400px" spellcheck="true" ' + \
'accesskey="' + access_keys['enterNotes'] + '">' + \ 'accesskey="' + access_keys['enterNotes'] + '">' + \
personNotes + '</textarea>\n' person_notes + '</textarea>\n'
optionsStr += \ options_str += \
' </form>\n' + \ ' </form>\n' + \
'</center>\n' + \ '</center>\n' + \
'</div>\n' + \ '</div>\n' + \
'</div>\n' '</div>\n'
optionsStr += html_footer() options_str += html_footer()
return optionsStr return options_str