forked from indymedia/epicyon
Simplify header banner html generation
parent
f7507500b7
commit
720354066d
|
@ -16,9 +16,9 @@ from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import getLeftImageFile
|
from webapp_utils import getLeftImageFile
|
||||||
from webapp_utils import headerButtonsFrontScreen
|
from webapp_utils import headerButtonsFrontScreen
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
||||||
|
from webapp_utils import htmlHeaderBanner
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
from webapp_headerbuttons import headerNewsTabs
|
|
||||||
|
|
||||||
|
|
||||||
def _linksExist(baseDir: str) -> bool:
|
def _linksExist(baseDir: str) -> bool:
|
||||||
|
@ -282,33 +282,13 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
|
||||||
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
||||||
usersPath = '/users/' + nickname
|
usersPath = '/users/' + nickname
|
||||||
|
|
||||||
htmlStr += '<div class="header">\n'
|
|
||||||
|
|
||||||
if not defaultTimeline == 'tlfeatures':
|
|
||||||
htmlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/{defaultTimeline}\" "
|
|
||||||
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
|
||||||
f"{translate['Switch to profile view']}</a>\n")
|
|
||||||
else:
|
|
||||||
# TODO: News instances should ignore personalised banners
|
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
htmlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
'followers', 'newfollowers']
|
'followers', 'newfollowers']
|
||||||
|
|
||||||
# Full row "navbar"
|
htmlStr += htmlHeaderBanner(defaultTimeline, 'linksmobile', baseDir, usersPath,
|
||||||
if defaultTimeline == 'tlfeatures':
|
authorized, translate, userPages, bannerFile)
|
||||||
# Show "tab" links instead of standard "buttons"
|
|
||||||
htmlStr += headerNewsTabs('linksmobile', translate, usersPath, baseDir, authorized, userPages)
|
|
||||||
|
|
||||||
# Close banner div
|
|
||||||
htmlStr += '</div>\n'
|
|
||||||
|
|
||||||
htmlStr += '<div class="col-left-mobile">\n'
|
htmlStr += '<div class="col-left-mobile">\n'
|
||||||
htmlStr += '<center>' + \
|
htmlStr += '<center>' + \
|
||||||
|
|
|
@ -19,11 +19,11 @@ from posts import isModerator
|
||||||
from webapp_utils import getRightImageFile
|
from webapp_utils import getRightImageFile
|
||||||
from webapp_utils import getImageFile
|
from webapp_utils import getImageFile
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
||||||
|
from webapp_utils import htmlHeaderBanner
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
from webapp_utils import htmlPostSeparator
|
from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import headerButtonsFrontScreen
|
from webapp_utils import headerButtonsFrontScreen
|
||||||
from webapp_headerbuttons import headerNewsTabs
|
|
||||||
|
|
||||||
|
|
||||||
def _votesIndicator(totalVotes: int, positiveVoting: bool) -> str:
|
def _votesIndicator(totalVotes: int, positiveVoting: bool) -> str:
|
||||||
|
@ -218,6 +218,8 @@ def _htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool,
|
||||||
continue
|
continue
|
||||||
dateShown = publishedDate.strftime("%Y-%m-%d %H:%M")
|
dateShown = publishedDate.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|
||||||
|
#print(f'[DEBUG] mod: {moderator}\ndata: {item}') # DEBUG
|
||||||
|
|
||||||
dateStrLink = dateStr.replace('T', ' ')
|
dateStrLink = dateStr.replace('T', ' ')
|
||||||
dateStrLink = dateStrLink.replace('Z', '')
|
dateStrLink = dateStrLink.replace('Z', '')
|
||||||
url = item[1]
|
url = item[1]
|
||||||
|
@ -455,33 +457,13 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
|
||||||
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
||||||
usersPath = '/users/' + nickname
|
usersPath = '/users/' + nickname
|
||||||
|
|
||||||
htmlStr += '<div class="header">\n'
|
|
||||||
|
|
||||||
if not defaultTimeline == 'tlfeatures':
|
|
||||||
htmlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/{defaultTimeline}\" "
|
|
||||||
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
|
||||||
f"{translate['Switch to profile view']}</a>\n")
|
|
||||||
else:
|
|
||||||
# TODO: News instances should ignore personalised banners
|
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
htmlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
'followers', 'newfollowers']
|
'followers', 'newfollowers']
|
||||||
|
|
||||||
# Full row "navbar"
|
htmlStr += htmlHeaderBanner(defaultTimeline, 'newswiremobile', baseDir, usersPath,
|
||||||
if defaultTimeline == 'tlfeatures':
|
authorized, translate, userPages, bannerFile)
|
||||||
# Show "tab" links instead of standard "buttons"
|
|
||||||
htmlStr += headerNewsTabs('newswiremobile', translate, usersPath, baseDir, authorized, userPages)
|
|
||||||
|
|
||||||
# Close banner div
|
|
||||||
htmlStr += '</div>\n'
|
|
||||||
|
|
||||||
htmlStr += '<div class="col-right-mobile">\n'
|
htmlStr += '<div class="col-right-mobile">\n'
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,9 @@ from utils import getImageFormats
|
||||||
from utils import getMediaFormats
|
from utils import getMediaFormats
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
from webapp_utils import htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyles
|
||||||
|
from webapp_utils import htmlHeaderBanner
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_headerbuttons import headerButtonsTimeline, headerNewsTabs
|
from webapp_headerbuttons import headerButtonsTimeline
|
||||||
from posts import isModerator
|
from posts import isModerator
|
||||||
|
|
||||||
|
|
||||||
|
@ -574,38 +575,16 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
||||||
|
|
||||||
usersPath = '/users/' + nickname
|
usersPath = '/users/' + nickname
|
||||||
|
|
||||||
newPostForm += '<div class="header">\n'
|
|
||||||
|
|
||||||
if not defaultTimeline == 'tlfeatures':
|
|
||||||
newPostForm += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/{defaultTimeline}\" "
|
|
||||||
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
|
||||||
f"{translate['Switch to timeline view']}</a>\n")
|
|
||||||
else:
|
|
||||||
# TODO: News instances should ignore personalised banners
|
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
newPostForm += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
# TODO: Better solution - Currently this is a duplicate of list created in 'webapp_timeline.py'
|
# TODO: Better solution - Currently this is a duplicate of list created in 'webapp_timeline.py'
|
||||||
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent']
|
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent']
|
||||||
|
|
||||||
# Full row "navbar"
|
# 'authorized' is assumed to be True if this function is being called
|
||||||
if defaultTimeline == 'tlfeatures':
|
# TODO: Confirm this assumption
|
||||||
# Show "tab" links instead of standard "buttons"
|
newPostForm += htmlHeaderBanner(defaultTimeline, 'inbox', baseDir, usersPath,
|
||||||
# NOTE: "inbox" is used as a generic boxName, as with 'User' pages
|
True, translate, userPages, bannerFile)
|
||||||
# NOTE: It should be "safe" to assume that this code would not be running,
|
|
||||||
# unless the user was already deemed 'authorized',
|
|
||||||
# thus allowing us to pass True directly
|
|
||||||
newPostForm += headerNewsTabs('inbox', translate, usersPath, baseDir, True, userPages)
|
|
||||||
|
|
||||||
# Close banner div
|
|
||||||
newPostForm += '</div>\n'
|
|
||||||
|
|
||||||
mentionsStr = ''
|
mentionsStr = ''
|
||||||
for m in mentions:
|
for m in mentions:
|
||||||
|
|
|
@ -12,11 +12,10 @@ from utils import getDomainFromActor
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from person import personBoxJson
|
from person import personBoxJson
|
||||||
from webapp_utils import htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyles
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlHeaderBanner, htmlFooter
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
from webapp_utils import htmlPostSeparator
|
from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import headerButtonsFrontScreen
|
from webapp_utils import headerButtonsFrontScreen
|
||||||
from webapp_headerbuttons import headerNewsTabs
|
|
||||||
from webapp_column_left import getLeftColumnContent
|
from webapp_column_left import getLeftColumnContent
|
||||||
from webapp_column_right import getRightColumnContent
|
from webapp_column_right import getRightColumnContent
|
||||||
from webapp_post import individualPostAsHtml
|
from webapp_post import individualPostAsHtml
|
||||||
|
@ -111,21 +110,9 @@ def htmlFrontScreen(rssIconAtTop: bool,
|
||||||
# If this is the news account then show a different banner
|
# If this is the news account then show a different banner
|
||||||
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain)
|
||||||
|
|
||||||
profileHeaderStr = '<div class="header">\n'
|
# NOTE: This currently more-or-less assumes being run only if 'news' instance
|
||||||
|
profileHeaderStr = htmlHeaderBanner(defaultTimeline, 'frontpage', baseDir, '/users/news',
|
||||||
# TODO: News instances should ignore personalised banners
|
authorized, translate, None, bannerFile);
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
profileHeaderStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
# Show "tab" links instead of standard "buttons"
|
|
||||||
profileHeaderStr += headerNewsTabs('tlfeatures', translate, '/users/news', baseDir, authorized, None)
|
|
||||||
|
|
||||||
# Close banner div
|
|
||||||
profileHeaderStr += '</div>\n'
|
|
||||||
|
|
||||||
# TODO: Should probably use a more generic class, easier to re-use and help simplify CSS
|
# TODO: Should probably use a more generic class, easier to re-use and help simplify CSS
|
||||||
# NOTE: Related also to class "page" added to 'webapp_create_post.py'
|
# NOTE: Related also to class "page" added to 'webapp_create_post.py'
|
||||||
|
@ -164,8 +151,11 @@ def htmlFrontScreen(rssIconAtTop: bool,
|
||||||
profileStr += ' <div class="section main">\n'
|
profileStr += ' <div class="section main">\n'
|
||||||
|
|
||||||
licenseStr = ''
|
licenseStr = ''
|
||||||
bannerFile, bannerFilename = \
|
|
||||||
getBannerFile(baseDir, nickname, domain, theme)
|
# NOTE: Redundant
|
||||||
|
# bannerFile, bannerFilename = \
|
||||||
|
# getBannerFile(baseDir, nickname, domain)
|
||||||
|
|
||||||
profileStr += \
|
profileStr += \
|
||||||
_htmlFrontScreenPosts(recentPostsCache, maxRecentPosts,
|
_htmlFrontScreenPosts(recentPostsCache, maxRecentPosts,
|
||||||
translate,
|
translate,
|
||||||
|
|
|
@ -361,61 +361,3 @@ def headerButtonsTimeline(defaultTimeline: str,
|
||||||
tlStr += '\t</div>\n'
|
tlStr += '\t</div>\n'
|
||||||
|
|
||||||
return tlStr
|
return tlStr
|
||||||
|
|
||||||
|
|
||||||
def headerNewsTabs(boxName: str,
|
|
||||||
translate: {},
|
|
||||||
usersPath: str,
|
|
||||||
baseDir: str,
|
|
||||||
authorized: bool,
|
|
||||||
userPages: []) -> str:
|
|
||||||
navTabList = []
|
|
||||||
|
|
||||||
navTabList.append(('tlfeatures',
|
|
||||||
{'pageRef': '/tlfeatures',
|
|
||||||
'translateText': 'Features'}
|
|
||||||
))
|
|
||||||
navTabList.append(('newswiremobile',
|
|
||||||
{'pageRef': '/newswiremobile',
|
|
||||||
'translateText': 'Newswire',
|
|
||||||
'class': 'tab-news'}
|
|
||||||
))
|
|
||||||
# navTabList.append(('calendar',
|
|
||||||
# {'pageRef': '/calendar',
|
|
||||||
# 'translateText': 'Calendar'}
|
|
||||||
# ))
|
|
||||||
navTabList.append(('linksmobile',
|
|
||||||
{'pageRef': '/linksmobile',
|
|
||||||
'translateText': 'Links',
|
|
||||||
'class': 'tab-links'}
|
|
||||||
))
|
|
||||||
|
|
||||||
if authorized:
|
|
||||||
navTabList.append(('inbox',
|
|
||||||
{'pageRef': '/inbox',
|
|
||||||
'translateText': 'User'}
|
|
||||||
))
|
|
||||||
|
|
||||||
navStr = '\t\t<div class="section navtabs">\n'
|
|
||||||
navStr += '\t\t\t<ul>\n'
|
|
||||||
|
|
||||||
for name, config in navTabList:
|
|
||||||
classStr = ''
|
|
||||||
|
|
||||||
if name == boxName:
|
|
||||||
classStr = 'tab-highlight'
|
|
||||||
elif name == 'inbox' and userPages and boxName in userPages:
|
|
||||||
classStr = 'tab-highlight'
|
|
||||||
|
|
||||||
if 'class' in config:
|
|
||||||
classStr += ' ' + config['class']
|
|
||||||
|
|
||||||
textStr = translate[config['translateText']]
|
|
||||||
|
|
||||||
navStr += (f"\t\t\t\t<a class=\"{classStr}\" href=\"{usersPath}{config['pageRef']}\">\n"
|
|
||||||
f'\t\t\t\t\t<li>{textStr}</li>\n'
|
|
||||||
f'\t\t\t\t</a>\n')
|
|
||||||
|
|
||||||
navStr += '\t\t\t</ul>\n\t\t</div>\n'
|
|
||||||
|
|
||||||
return navStr
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ from webapp_frontscreen import htmlFrontScreen
|
||||||
from webapp_utils import scheduledPostsExist
|
from webapp_utils import scheduledPostsExist
|
||||||
from webapp_utils import getPersonAvatarUrl
|
from webapp_utils import getPersonAvatarUrl
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
||||||
|
from webapp_utils import htmlHeaderBanner
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from webapp_utils import addEmojiToDisplayName
|
from webapp_utils import addEmojiToDisplayName
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
|
@ -51,7 +52,7 @@ from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import getBlogAddress
|
from webapp_utils import getBlogAddress
|
||||||
from webapp_post import individualPostAsHtml
|
from webapp_post import individualPostAsHtml
|
||||||
from webapp_timeline import htmlIndividualShare
|
from webapp_timeline import htmlIndividualShare
|
||||||
from webapp_headerbuttons import headerButtonsTimeline, headerNewsTabs
|
from webapp_headerbuttons import headerButtonsTimeline
|
||||||
|
|
||||||
|
|
||||||
def htmlProfileAfterSearch(cssCache: {},
|
def htmlProfileAfterSearch(cssCache: {},
|
||||||
|
@ -1205,37 +1206,15 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||||
|
|
||||||
usersPath = '/users/' + nickname
|
usersPath = '/users/' + nickname
|
||||||
|
|
||||||
# top banner
|
|
||||||
editProfileForm += '<div class="header">\n'
|
|
||||||
|
|
||||||
if not defaultTimeline == 'tlfeatures':
|
|
||||||
editProfileForm += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/{defaultTimeline}\" "
|
|
||||||
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
|
||||||
f"{translate['Switch to timeline view']}</a>\n")
|
|
||||||
else:
|
|
||||||
# TODO: News instances should ignore personalised banners
|
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
editProfileForm += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent', 'editprofile']
|
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent', 'editprofile']
|
||||||
|
|
||||||
# Full row "navbar"
|
# Safe to assume this function would not be called if user was not authorized
|
||||||
if defaultTimeline == 'tlfeatures':
|
# TODO: Confirm this assumption
|
||||||
# Show "tab" links instead of standard "buttons"
|
editProfileForm += htmlHeaderBanner(defaultTimeline, 'editprofile', baseDir, usersPath,
|
||||||
# NOTE: It should be "safe" to assume that this code would not be running,
|
True, translate, userPages, bannerFile)
|
||||||
# unless the user was already deemed 'authorized',
|
|
||||||
# thus allowing us to pass True directly
|
|
||||||
editProfileForm += headerNewsTabs('editprofile', translate, usersPath, baseDir, True, userPages)
|
|
||||||
|
|
||||||
# Close banner div
|
|
||||||
editProfileForm += '</div>\n'
|
|
||||||
|
|
||||||
# TODO: Place form inside a "page" div for 'News' instances
|
# TODO: Place form inside a "page" div for 'News' instances
|
||||||
# NOTE: Duplicate of code from webapp_create_post.py
|
# NOTE: Duplicate of code from webapp_create_post.py
|
||||||
|
|
|
@ -17,14 +17,14 @@ from person import isPersonSnoozed
|
||||||
from webapp_utils import htmlPostSeparator
|
from webapp_utils import htmlPostSeparator
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlHeaderBanner, htmlFooter
|
||||||
from webapp_utils import sharesTimelineJson
|
from webapp_utils import sharesTimelineJson
|
||||||
from webapp_utils import htmlHighlightLabel
|
from webapp_utils import htmlHighlightLabel
|
||||||
from webapp_post import preparePostFromHtmlCache
|
from webapp_post import preparePostFromHtmlCache
|
||||||
from webapp_post import individualPostAsHtml
|
from webapp_post import individualPostAsHtml
|
||||||
from webapp_column_left import getLeftColumnContent
|
from webapp_column_left import getLeftColumnContent
|
||||||
from webapp_column_right import getRightColumnContent
|
from webapp_column_right import getRightColumnContent
|
||||||
from webapp_headerbuttons import headerButtonsTimeline, headerNewsTabs
|
from webapp_headerbuttons import headerButtonsTimeline
|
||||||
from posts import isModerator
|
from posts import isModerator
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,45 +141,18 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
||||||
if defaultTimeline == 'tlfeatures':# and boxName == 'tlfeatures':
|
if defaultTimeline == 'tlfeatures':# and boxName == 'tlfeatures':
|
||||||
newsHeader = True
|
newsHeader = True
|
||||||
|
|
||||||
# Banner and "profile toggle" link
|
|
||||||
|
|
||||||
tlStr += '<div class="header">\n'
|
|
||||||
|
|
||||||
# TODO: This CSS should be moved out of the code
|
|
||||||
# Items like this that can be different per user should be kept
|
|
||||||
# in the user's folder and loaded as final CSS, to allow overwrite(s)
|
|
||||||
if not newsHeader:
|
|
||||||
tlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}\" "
|
|
||||||
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
|
||||||
f"{translate['Switch to profile view']}</a>\n")
|
|
||||||
else:
|
|
||||||
# TODO: News instances should ignore personalised banners
|
|
||||||
# Currently uses the 'news' actor banner - as it remains unchanged
|
|
||||||
tlStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"/users/{nickname}/tlfeatures\">"
|
|
||||||
f"{translate['Features']}</a>\n"
|
|
||||||
f"\t<div class=\"title\">\n"
|
|
||||||
f"\t\t<span>#IndymediaBack</span>\n"
|
|
||||||
f"\t</div>\n")
|
|
||||||
|
|
||||||
|
|
||||||
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
# Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
# TODO: The 'new...' pages appear to require handling elsewhere
|
# TODO: The 'new...' pages appear to require handling elsewhere
|
||||||
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent', 'editprofile']
|
'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent', 'editprofile']
|
||||||
|
|
||||||
# Full row "navbar"
|
# Banner and "profile toggle" link
|
||||||
if defaultTimeline == 'tlfeatures':
|
|
||||||
# Show "tab" links instead of standard "buttons"
|
|
||||||
tlStr += headerNewsTabs(boxName, translate, usersPath, baseDir, authorized, userPages)
|
|
||||||
|
|
||||||
# Close banner div
|
tlStr += htmlHeaderBanner(defaultTimeline, boxName, baseDir, usersPath,
|
||||||
tlStr += '</div>\n'
|
authorized, translate, userPages, bannerFile);
|
||||||
|
|
||||||
elif fullWidthTimelineButtonHeader:
|
|
||||||
# Close banner div
|
|
||||||
tlStr += '</div>\n'
|
|
||||||
|
|
||||||
|
if not newsHeader and fullWidthTimelineButtonHeader:
|
||||||
tlStr += \
|
tlStr += \
|
||||||
headerButtonsTimeline(defaultTimeline, boxName, pageNumber,
|
headerButtonsTimeline(defaultTimeline, boxName, pageNumber,
|
||||||
translate, usersPath,
|
translate, usersPath,
|
||||||
|
@ -188,9 +161,6 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
||||||
baseDir, nickname,
|
baseDir, nickname,
|
||||||
domain, timelineStartTime,
|
domain, timelineStartTime,
|
||||||
iconsAsButtons, userPages)
|
iconsAsButtons, userPages)
|
||||||
else:
|
|
||||||
# Close banner div
|
|
||||||
tlStr += '</div>\n'
|
|
||||||
|
|
||||||
# TODO: Should probably use a more generic class, easier to re-use and help simplify CSS
|
# TODO: Should probably use a more generic class, easier to re-use and help simplify CSS
|
||||||
# NOTE: Related also to class "page" added to 'webapp_create_post.py'
|
# NOTE: Related also to class "page" added to 'webapp_create_post.py'
|
||||||
|
|
|
@ -19,6 +19,7 @@ from cache import getPersonFromCache
|
||||||
from cache import storePersonInCache
|
from cache import storePersonInCache
|
||||||
from content import addHtmlTags
|
from content import addHtmlTags
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
|
from webapp_headernewstabs import headerNewsTabs
|
||||||
|
|
||||||
|
|
||||||
def getBrokenLinkSubstitute() -> str:
|
def getBrokenLinkSubstitute() -> str:
|
||||||
|
@ -552,6 +553,58 @@ def htmlHeaderWithExternalStyles(cssFiles: [], lang='en') -> str:
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Determine if bannerFile should really only be determined here
|
||||||
|
def htmlHeaderBanner(defaultTimeline, boxName,
|
||||||
|
baseDir, usersPath, authorized,
|
||||||
|
translate, userPages,
|
||||||
|
bannerFile) -> str:
|
||||||
|
|
||||||
|
newsHeader = False
|
||||||
|
if defaultTimeline == 'tlfeatures' or \
|
||||||
|
(defaultTimeline == 'inbox' and boxName == 'frontpage'):
|
||||||
|
newsHeader = True
|
||||||
|
|
||||||
|
# Banner and "profile toggle" link
|
||||||
|
|
||||||
|
bannerStr = '<div class="header">\n'
|
||||||
|
|
||||||
|
# TODO: This CSS should be moved out of the code
|
||||||
|
# Items like this that can be different per user should be kept
|
||||||
|
# in the user's folder and loaded as final CSS, to allow overwrite(s)
|
||||||
|
# This needs further thought
|
||||||
|
if not newsHeader:
|
||||||
|
bannerStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"{usersPath}\" "
|
||||||
|
f"style=\"background-image: url('{usersPath}/{bannerFile}');\">"
|
||||||
|
f"{translate['Switch to profile view']}</a>\n")
|
||||||
|
else:
|
||||||
|
# TODO: News instances should ignore personalised banners
|
||||||
|
# Currently uses the 'news' actor banner - as it remains unchanged
|
||||||
|
# More sensible location would be within each theme directory
|
||||||
|
# e.g. as 'banner_news.png' to keep with existing naming convention
|
||||||
|
bannerStr += (f"\t<a class=\"timeline-banner hidden-text\" href=\"{usersPath}/tlfeatures\">"
|
||||||
|
f"{translate['Features']}</a>\n"
|
||||||
|
f"\t<div class=\"title\">\n"
|
||||||
|
f"\t\t<span>#IndymediaBack</span>\n"
|
||||||
|
f"\t</div>\n")
|
||||||
|
|
||||||
|
# TODO: Should this be "global" for importers of this module?
|
||||||
|
# # Certain Epciyon pages should only be accessible via the 'User' page for News instances
|
||||||
|
# # TODO: The 'new...' pages appear to require handling elsewhere
|
||||||
|
# userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \
|
||||||
|
# 'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \
|
||||||
|
# 'followers', 'newfollowers', 'newdm', 'newpost', 'newblog', 'newevent', 'editprofile']
|
||||||
|
|
||||||
|
# Full row "navbar"
|
||||||
|
if newsHeader:
|
||||||
|
# Show "tab" links instead of standard "buttons"
|
||||||
|
bannerStr += headerNewsTabs(boxName, translate, usersPath, baseDir, authorized, userPages)
|
||||||
|
|
||||||
|
# Close banner div
|
||||||
|
bannerStr += '</div>\n'
|
||||||
|
|
||||||
|
return bannerStr
|
||||||
|
|
||||||
|
|
||||||
def htmlFooter() -> str:
|
def htmlFooter() -> str:
|
||||||
htmlStr = ' <div class="section footer">\n'
|
htmlStr = ' <div class="section footer">\n'
|
||||||
htmlStr += ' <ul>\n'
|
htmlStr += ' <ul>\n'
|
||||||
|
|
Loading…
Reference in New Issue