main
Bob Mottram 2020-10-31 10:16:30 +00:00
parent 98ae8c40b5
commit b8032e0938
1 changed files with 102 additions and 102 deletions

View File

@ -3298,55 +3298,6 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
return timelineStr return timelineStr
def headerButtonsFrontScreen(translate: {},
nickname: str, boxName: str,
authorized: bool) -> str:
"""Returns the header buttons for the front page of a news instance
"""
headerStr = ' <div class="frontPageMobileButtons">\n'
if nickname == 'news':
buttonFeatures = 'buttonMobile'
buttonNewswire = 'buttonMobile'
buttonLinks = 'buttonMobile'
if boxName == 'features':
buttonFeatures = 'buttonselected'
elif boxName == 'newswire':
buttonNewswire = 'buttonselected'
elif boxName == 'links':
buttonLinks = 'buttonselected'
headerStr += \
' <a href="/">' + \
'<button class="' + buttonFeatures + '">' + \
'<span>' + translate['Features'] + \
'</span></button></a>\n'
if not authorized:
headerStr += \
' <a href="/login">' + \
'<button class="buttonMobile">' + \
'<span>' + translate['Login'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/newswiremobile">' + \
'<button class="' + buttonNewswire + '">' + \
'<span>' + translate['Newswire'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/linksmobile">' + \
'<button class="' + buttonLinks + '">' + \
'<span>' + translate['Links'] + \
'</span></button></a>\n'
else:
if not authorized:
headerStr += \
' <a href="/login' + \
'"><button class="buttonMobile">' + \
'<span>' + translate['Login'] + \
'</span></button></a>\n'
headerStr += ' </div>\n'
return headerStr
def htmlProfile(cssCache: {}, iconsAsButtons: bool, def htmlProfile(cssCache: {}, iconsAsButtons: bool,
defaultTimeline: str, defaultTimeline: str,
recentPostsCache: {}, maxRecentPosts: int, recentPostsCache: {}, maxRecentPosts: int,
@ -6060,35 +6011,84 @@ def getBannerFile(baseDir: str, nickname: str, domain: str) -> (str, str):
return bannerFile, bannerFilename return bannerFile, bannerFilename
def getTimelineButtonHeader(defaultTimeline: str, def headerButtonsFrontScreen(translate: {},
boxName: str, nickname: str, boxName: str,
pageNumber: int, authorized: bool) -> str:
translate: {}, """Returns the header buttons for the front page of a news instance
usersPath: str, """
mediaButton: str, headerStr = ' <div class="frontPageMobileButtons">\n'
blogsButton: str, if nickname == 'news':
newsButton: str, buttonFeatures = 'buttonMobile'
inboxButton: str, buttonNewswire = 'buttonMobile'
dmButton: str, buttonLinks = 'buttonMobile'
newDM: str, if boxName == 'features':
repliesButton: str, buttonFeatures = 'buttonselected'
newReply: str, elif boxName == 'newswire':
minimal: bool, buttonNewswire = 'buttonselected'
sentButton: str, elif boxName == 'links':
sharesButtonStr: str, buttonLinks = 'buttonselected'
bookmarksButtonStr: str,
eventsButtonStr: str, headerStr += \
moderationButtonStr: str, ' <a href="/">' + \
newPostButtonStr: str, '<button class="' + buttonFeatures + '">' + \
baseDir: str, '<span>' + translate['Features'] + \
nickname: str, domain: str, '</span></button></a>\n'
iconsDir: str, if not authorized:
timelineStartTime, headerStr += \
newCalendarEvent: bool, ' <a href="/login">' + \
calendarPath: str, '<button class="buttonMobile">' + \
calendarImage: str, '<span>' + translate['Login'] + \
followApprovals: str, '</span></button></a>\n'
iconsAsButtons: bool) -> str: headerStr += \
' <a href="/users/news/newswiremobile">' + \
'<button class="' + buttonNewswire + '">' + \
'<span>' + translate['Newswire'] + \
'</span></button></a>\n'
headerStr += \
' <a href="/users/news/linksmobile">' + \
'<button class="' + buttonLinks + '">' + \
'<span>' + translate['Links'] + \
'</span></button></a>\n'
else:
if not authorized:
headerStr += \
' <a href="/login' + \
'"><button class="buttonMobile">' + \
'<span>' + translate['Login'] + \
'</span></button></a>\n'
headerStr += ' </div>\n'
return headerStr
def headerButtonsTimeline(defaultTimeline: str,
boxName: str,
pageNumber: int,
translate: {},
usersPath: str,
mediaButton: str,
blogsButton: str,
newsButton: str,
inboxButton: str,
dmButton: str,
newDM: str,
repliesButton: str,
newReply: str,
minimal: bool,
sentButton: str,
sharesButtonStr: str,
bookmarksButtonStr: str,
eventsButtonStr: str,
moderationButtonStr: str,
newPostButtonStr: str,
baseDir: str,
nickname: str, domain: str,
iconsDir: str,
timelineStartTime,
newCalendarEvent: bool,
calendarPath: str,
calendarImage: str,
followApprovals: str,
iconsAsButtons: bool) -> str:
"""Returns the header at the top of the timeline, containing """Returns the header at the top of the timeline, containing
buttons for inbox, outbox, search, calendar, etc buttons for inbox, outbox, search, calendar, etc
""" """
@ -6695,18 +6695,18 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
if fullWidthTimelineButtonHeader: if fullWidthTimelineButtonHeader:
tlStr += \ tlStr += \
getTimelineButtonHeader(defaultTimeline, boxName, pageNumber, headerButtonsTimeline(defaultTimeline, boxName, pageNumber,
translate, usersPath, mediaButton, translate, usersPath, mediaButton,
blogsButton, newsButton, inboxButton, blogsButton, newsButton, inboxButton,
dmButton, newDM, repliesButton, dmButton, newDM, repliesButton,
newReply, minimal, sentButton, newReply, minimal, sentButton,
sharesButtonStr, bookmarksButtonStr, sharesButtonStr, bookmarksButtonStr,
eventsButtonStr, moderationButtonStr, eventsButtonStr, moderationButtonStr,
newPostButtonStr, baseDir, nickname, newPostButtonStr, baseDir, nickname,
domain, iconsDir, timelineStartTime, domain, iconsDir, timelineStartTime,
newCalendarEvent, calendarPath, newCalendarEvent, calendarPath,
calendarImage, followApprovals, calendarImage, followApprovals,
iconsAsButtons) iconsAsButtons)
# start the timeline # start the timeline
tlStr += '<table class="timeline">\n' tlStr += '<table class="timeline">\n'
@ -6736,18 +6736,18 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
if not fullWidthTimelineButtonHeader: if not fullWidthTimelineButtonHeader:
tlStr += \ tlStr += \
getTimelineButtonHeader(defaultTimeline, boxName, pageNumber, headerButtonsTimeline(defaultTimeline, boxName, pageNumber,
translate, usersPath, mediaButton, translate, usersPath, mediaButton,
blogsButton, newsButton, inboxButton, blogsButton, newsButton, inboxButton,
dmButton, newDM, repliesButton, dmButton, newDM, repliesButton,
newReply, minimal, sentButton, newReply, minimal, sentButton,
sharesButtonStr, bookmarksButtonStr, sharesButtonStr, bookmarksButtonStr,
eventsButtonStr, moderationButtonStr, eventsButtonStr, moderationButtonStr,
newPostButtonStr, baseDir, nickname, newPostButtonStr, baseDir, nickname,
domain, iconsDir, timelineStartTime, domain, iconsDir, timelineStartTime,
newCalendarEvent, calendarPath, newCalendarEvent, calendarPath,
calendarImage, followApprovals, calendarImage, followApprovals,
iconsAsButtons) iconsAsButtons)
# second row of buttons for moderator actions # second row of buttons for moderator actions
if moderator and boxName == 'moderation': if moderator and boxName == 'moderation':