diff --git a/webapp_column_left.py b/webapp_column_left.py index 41710f49..f4a9dcb1 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -9,14 +9,17 @@ __status__ = "Production" import os from utils import getConfigParam from utils import getNicknameFromActor -from utils import isEditor +from posts import isEditor +from posts import isModerator from webapp_utils import sharesTimelineJson from webapp_utils import htmlPostSeparator from webapp_utils import getLeftImageFile from webapp_utils import headerButtonsFrontScreen -from webapp_utils import htmlHeaderWithExternalStyle +from webapp_utils import getIconsWebPath +from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles from webapp_utils import htmlFooter from webapp_utils import getBannerFile +from webapp_headerbuttons import headerNewsTabs def _linksExist(baseDir: str) -> bool: @@ -90,15 +93,12 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, '\n' - if (editor or rssIconAtTop) and not showHeaderImage: + if (editor or rssIconAtTop): htmlStr += '
' if editImageClass == 'leftColEdit': htmlStr += '\n
\n' - if editor or rssIconAtTop: - htmlStr += '
\n' - if editor: # show the edit icon htmlStr += \ @@ -131,13 +131,10 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, if rssIconAtTop: htmlStr += rssIconStr - if editor or rssIconAtTop: - htmlStr += '
\n' - if editImageClass == 'leftColEdit': htmlStr += '
\n' - if (editor or rssIconAtTop) and not showHeaderImage: + if (editor or rssIconAtTop): htmlStr += '

' # if showHeaderImage: @@ -249,28 +246,70 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, """ htmlStr = '' + cssFiles = [] + # the css filename - cssFilename = baseDir + '/epicyon-profile.css' + cssFiles.append(baseDir + '/epicyon-profile.css') if os.path.isfile(baseDir + '/epicyon.css'): - cssFilename = baseDir + '/epicyon.css' + cssFiles[0] = baseDir + '/epicyon.css' + + # TODO: Clean up and remove this override + cssFiles[0] = 'base.css' + + # Get theme-specific css if exists - must be named '.css' + themeName = getConfigParam(baseDir, 'theme') + + themePath = f'{baseDir}/theme/{themeName}.css' + if os.path.isfile(themePath): + cssFiles.append('theme/' + themeName + '.css') # is the user a site editor? if nickname == 'news': editor = False + moderator = False else: + # is the user a moderator? + moderator = isModerator(baseDir, nickname) + + # is the user a site editor? editor = isEditor(baseDir, nickname) domain = domainFull if ':' in domain: domain = domain.split(':')[0] - htmlStr = htmlHeaderWithExternalStyle(cssFilename) - bannerFile, bannerFilename = \ - getBannerFile(baseDir, nickname, domain, theme) - htmlStr += \ - '' + \ - '\n' + htmlStr = htmlHeaderWithExternalStyles(cssFiles) + + bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain) + usersPath = '/users/' + nickname + + htmlStr += '
\n' + + if not defaultTimeline == 'tlfeatures': + htmlStr += (f"\t" + f"{translate['Switch to profile view']}\n") + else: + # TODO: News instances should ignore personalised banners + # Currently uses the 'news' actor banner - as it remains unchanged + htmlStr += (f"\t" + f"{translate['Features']}\n" + f"\t
\n" + f"\t\t#IndymediaBack\n" + f"\t
\n") + + # Certain Epciyon pages should only be accessible via the 'User' page for News instances + userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \ + 'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \ + 'followers', 'newfollowers'] + + # Full row "navbar" + if defaultTimeline == 'tlfeatures': + # Show "tab" links instead of standard "buttons" + htmlStr += headerNewsTabs('linksmobile', translate, usersPath, baseDir, userPages) + + # Close banner div + htmlStr += '
\n' htmlStr += '
\n' htmlStr += '
' + \ diff --git a/webapp_column_right.py b/webapp_column_right.py index fb214aae..5effe409 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -17,11 +17,14 @@ from utils import getNicknameFromActor from utils import isEditor from posts import isModerator from webapp_utils import getRightImageFile -from webapp_utils import htmlHeaderWithExternalStyle +from webapp_utils import getImageFile +from webapp_utils import htmlHeaderWithExternalStyle, htmlHeaderWithExternalStyles from webapp_utils import htmlFooter from webapp_utils import getBannerFile from webapp_utils import htmlPostSeparator from webapp_utils import headerButtonsFrontScreen +from webapp_utils import getIconsWebPath +from webapp_headerbuttons import headerNewsTabs def _votesIndicator(totalVotes: int, positiveVoting: bool) -> str: @@ -417,10 +420,22 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, """ htmlStr = '' + cssFiles = [] + # the css filename - cssFilename = baseDir + '/epicyon-profile.css' + cssFiles.append(baseDir + '/epicyon-profile.css') if os.path.isfile(baseDir + '/epicyon.css'): - cssFilename = baseDir + '/epicyon.css' + cssFiles[0] = baseDir + '/epicyon.css' + + # TODO: Clean up and remove this override + cssFiles[0] = 'base.css' + + # Get theme-specific css if exists - must be named '.css' + themeName = getConfigParam(baseDir, 'theme') + + themePath = f'{baseDir}/theme/{themeName}.css' + if os.path.isfile(themePath): + cssFiles.append('theme/' + themeName + '.css') if nickname == 'news': editor = False @@ -434,14 +449,38 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, showPublishButton = editor - htmlStr = htmlHeaderWithExternalStyle(cssFilename) + htmlStr = htmlHeaderWithExternalStyles(cssFiles) - bannerFile, bannerFilename = \ - getBannerFile(baseDir, nickname, domain, theme) - htmlStr += \ - '' + \ - '\n' + bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain) + usersPath = '/users/' + nickname + + htmlStr += '
\n' + + if not defaultTimeline == 'tlfeatures': + htmlStr += (f"\t" + f"{translate['Switch to profile view']}\n") + else: + # TODO: News instances should ignore personalised banners + # Currently uses the 'news' actor banner - as it remains unchanged + htmlStr += (f"\t" + f"{translate['Features']}\n" + f"\t
\n" + f"\t\t#IndymediaBack\n" + f"\t
\n") + + # Certain Epciyon pages should only be accessible via the 'User' page for News instances + userPages = ['inbox', 'outbox', 'dm', 'tlreplies', 'tlblogs', 'tlmedia', 'tlshares', \ + 'tlsaves', 'tlevents', 'tlbookmarks', 'moderation', 'search', \ + 'followers', 'newfollowers'] + + # Full row "navbar" + if defaultTimeline == 'tlfeatures': + # Show "tab" links instead of standard "buttons" + htmlStr += headerNewsTabs('newswiremobile', translate, usersPath, baseDir, userPages) + + # Close banner div + htmlStr += '
\n' htmlStr += '
\n'