\n'
emojiStr += '
\n'
@@ -336,16 +323,7 @@ def htmlSearch(cssCache: {}, translate: {},
if os.path.isfile(baseDir + '/search.css'):
cssFilename = baseDir + '/search.css'
- profileStyle = getCSS(baseDir, cssFilename, cssCache)
-
- if not os.path.isfile(baseDir + '/accounts/' +
- 'follow-background.jpg'):
- profileStyle = \
- profileStyle.replace('background-image: ' +
- 'url("follow-background.jpg");',
- 'background-image: none;')
-
- followStr = htmlHeader(cssFilename, profileStyle)
+ followStr = htmlHeaderWithExternalStyle(cssFilename)
# show a banner above the search box
searchBannerFile, searchBannerFilename = \
@@ -390,8 +368,6 @@ def htmlSearch(cssCache: {}, translate: {},
followStr += \
' \n'
followStr += ' \n'
- # followStr += ' ' + translate['Go Back'] + ' \n'
followStr += ' ' + translate['Submit'] + ' \n'
followStr += ' \n'
@@ -503,7 +479,7 @@ def htmlHashtagSearch(cssCache: {},
print('WARN: hashtag file not found ' + hashtagIndexFile)
return None
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
separatorStr = htmlPostSeparator(baseDir, None)
# check that the directory for the nickname exists
@@ -521,13 +497,6 @@ def htmlHashtagSearch(cssCache: {},
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
- hashtagSearchCSS = getCSS(baseDir, cssFilename, cssCache)
- if hashtagSearchCSS:
- if httpPrefix != 'https':
- hashtagSearchCSS = \
- hashtagSearchCSS.replace('https://',
- httpPrefix + '://')
-
# ensure that the page number is in bounds
if not pageNumber:
pageNumber = 1
@@ -542,7 +511,8 @@ def htmlHashtagSearch(cssCache: {},
endIndex = noOfLines - 1
# add the page title
- hashtagSearchForm = htmlHeader(cssFilename, hashtagSearchCSS)
+ hashtagSearchForm = \
+ htmlHeaderWithExternalStyle(cssFilename)
if nickname:
hashtagSearchForm += '\n' + \
' '
+ iconsPath + '/logorss.png" /> '
if startIndex > 0:
# previous page link
@@ -566,7 +536,7 @@ def htmlHashtagSearch(cssCache: {},
'
\n \n'
@@ -598,10 +568,10 @@ def htmlHashtagSearch(cssCache: {},
if nickname:
showIndividualPostIcons = True
allowDeletion = False
- hashtagSearchForm += separatorStr + \
+ postStr = \
individualPostAsHtml(True, recentPostsCache,
maxRecentPosts,
- iconsDir, translate, None,
+ iconsPath, translate, None,
baseDir, session, wfRequest,
personCache,
nickname, domain, port,
@@ -614,6 +584,8 @@ def htmlHashtagSearch(cssCache: {},
showIndividualPostIcons,
showIndividualPostIcons,
False, False, False)
+ if postStr:
+ hashtagSearchForm += separatorStr + postStr
index += 1
if endIndex < noOfLines - 1:
@@ -622,7 +594,7 @@ def htmlHashtagSearch(cssCache: {},
'
\n' + \
' ' + \
' '
@@ -830,13 +802,7 @@ def htmlSkillsSearch(cssCache: {}, translate: {}, baseDir: str,
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
- skillSearchCSS = getCSS(baseDir, cssFilename, cssCache)
- if skillSearchCSS:
- if httpPrefix != 'https':
- skillSearchCSS = \
- skillSearchCSS.replace('https://',
- httpPrefix + '://')
- skillSearchForm = htmlHeader(cssFilename, skillSearchCSS)
+ skillSearchForm = htmlHeaderWithExternalStyle(cssFilename)
skillSearchForm += \
'
' + translate['Skills search'] + ': ' + \
skillsearch + ' '
@@ -899,13 +865,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
- historySearchCSS = getCSS(baseDir, cssFilename, cssCache)
- if historySearchCSS:
- if httpPrefix != 'https':
- historySearchCSS = \
- historySearchCSS.replace('https://',
- httpPrefix + '://')
- historySearchForm = htmlHeader(cssFilename, historySearchCSS)
+ historySearchForm = \
+ htmlHeaderWithExternalStyle(cssFilename)
# add the page title
historySearchForm += \
@@ -917,7 +878,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
''
return historySearchForm
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
separatorStr = htmlPostSeparator(baseDir, None)
# ensure that the page number is in bounds
@@ -945,10 +906,10 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
continue
showIndividualPostIcons = True
allowDeletion = False
- historySearchForm += separatorStr + \
+ postStr = \
individualPostAsHtml(True, recentPostsCache,
maxRecentPosts,
- iconsDir, translate, None,
+ iconsPath, translate, None,
baseDir, session, wfRequest,
personCache,
nickname, domain, port,
@@ -961,6 +922,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
showIndividualPostIcons,
showIndividualPostIcons,
False, False, False)
+ if postStr:
+ historySearchForm += separatorStr + postStr
index += 1
historySearchForm += htmlFooter()
diff --git a/webapp_suspended.py b/webapp_suspended.py
index cbcc1a23e..4ea824936 100644
--- a/webapp_suspended.py
+++ b/webapp_suspended.py
@@ -7,8 +7,7 @@ __email__ = "bob@freedombone.net"
__status__ = "Production"
import os
-from utils import getCSS
-from webapp_utils import htmlHeader
+from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
@@ -20,12 +19,10 @@ def htmlSuspended(cssCache: {}, baseDir: str) -> str:
if os.path.isfile(baseDir + '/suspended.css'):
cssFilename = baseDir + '/suspended.css'
- suspendedCSS = getCSS(baseDir, cssFilename, cssCache)
- if suspendedCSS:
- suspendedForm = htmlHeader(cssFilename, suspendedCSS)
- suspendedForm += '
\n'
- suspendedForm += ' Account Suspended
\n'
- suspendedForm += ' See Terms of Service
\n'
- suspendedForm += ' \n'
- suspendedForm += htmlFooter()
+ suspendedForm = htmlHeaderWithExternalStyle(cssFilename)
+ suspendedForm += '
\n'
+ suspendedForm += ' Account Suspended
\n'
+ suspendedForm += ' See Terms of Service
\n'
+ suspendedForm += ' \n'
+ suspendedForm += htmlFooter()
return suspendedForm
diff --git a/webapp_timeline.py b/webapp_timeline.py
index 9e65b3d64..eed526c0d 100644
--- a/webapp_timeline.py
+++ b/webapp_timeline.py
@@ -9,13 +9,12 @@ __status__ = "Production"
import os
from datetime import datetime
import time
-from utils import getCSS
from utils import removeIdEnding
from follow import followerApprovalActive
from person import isPersonSnoozed
from happening import todaysEventsCheck
from happening import thisWeeksEventsCheck
-from webapp_utils import getIconsDir
+from webapp_utils import getIconsWebPath
from webapp_utils import htmlPostSeparator
from webapp_utils import getBannerFile
from webapp_utils import htmlHeaderWithExternalStyle
@@ -102,7 +101,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# directory where icons are found
# This changes depending upon theme
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
separatorStr = ''
if boxName != 'tlmedia':
@@ -121,17 +120,6 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 1 = ' + str(timeDiff))
- profileStyle = getCSS(baseDir, cssFilename, cssCache)
- if not profileStyle:
- print('ERROR: css file not found ' + cssFilename)
- return None
-
- # replace any https within the css with whatever prefix is needed
- if httpPrefix != 'https':
- profileStyle = \
- profileStyle.replace('https://',
- httpPrefix + '://')
-
# is the user a moderator?
if not moderator:
moderator = isModerator(baseDir, nickname)
@@ -224,7 +212,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
'class="timelineicon" alt="' + \
translate['Approve follow requests'] + \
'" title="' + translate['Approve follow requests'] + \
- '" src="/' + iconsDir + '/person.png"/>\n'
+ '" src="/' + iconsPath + '/person.png"/>\n'
break
# benchmark 3
@@ -263,7 +251,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
eventsButton + '">
' + translate['Events'] + \
' '
- tlStr = htmlHeaderWithExternalStyle(cssFilename, profileStyle)
+ tlStr = htmlHeaderWithExternalStyle(cssFilename)
# benchmark 4
timeDiff = int((time.time() - timelineStartTime) * 1000)
@@ -287,7 +275,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
newPostButtonStr += \
'
\n'
@@ -301,7 +289,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
newPostButtonStr += \
'
\n'
@@ -315,7 +303,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
newPostButtonStr += \
'
\n'
@@ -330,7 +318,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
newPostButtonStr += \
'
\n'
@@ -344,7 +332,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
newPostButtonStr += \
'
\n'
@@ -379,7 +367,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
sharesButtonStr, bookmarksButtonStr,
eventsButtonStr, moderationButtonStr,
newPostButtonStr, baseDir, nickname,
- domain, iconsDir, timelineStartTime,
+ domain, iconsPath, timelineStartTime,
newCalendarEvent, calendarPath,
calendarImage, followApprovals,
iconsAsButtons)
@@ -402,7 +390,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# left column
leftColumnStr = \
getLeftColumnContent(baseDir, nickname, domainFull,
- httpPrefix, translate, iconsDir,
+ httpPrefix, translate, iconsPath,
editor, False, None, rssIconAtTop,
True, False)
tlStr += '
' + \
@@ -420,7 +408,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
sharesButtonStr, bookmarksButtonStr,
eventsButtonStr, moderationButtonStr,
newPostButtonStr, baseDir, nickname,
- domain, iconsDir, timelineStartTime,
+ domain, iconsPath, timelineStartTime,
newCalendarEvent, calendarPath,
calendarImage, followApprovals,
iconsAsButtons)
@@ -494,7 +482,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
' \n' + \
' \n'
@@ -554,7 +542,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
currTlStr = \
individualPostAsHtml(False, recentPostsCache,
maxRecentPosts,
- iconsDir, translate, pageNumber,
+ iconsPath, translate, pageNumber,
baseDir, session, wfRequest,
personCache,
nickname, domain, port,
@@ -591,7 +579,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
' \n' + \
' \n'
@@ -601,7 +589,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
# right column
rightColumnStr = getRightColumnContent(baseDir, nickname, domainFull,
- httpPrefix, translate, iconsDir,
+ httpPrefix, translate, iconsPath,
moderator, editor,
newswire, positiveVoting,
False, None, True,
@@ -674,13 +662,13 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
timelineStr = ''
if pageNumber > 1:
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
timelineStr += \
' \n' + \
' \n' + \
' \n'
@@ -697,13 +685,13 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
showContactButton, showRemoveButton)
if not lastPage:
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
timelineStr += \
' \n' + \
' \n' + \
' \n'
@@ -743,7 +731,7 @@ def headerButtonsTimeline(defaultTimeline: str,
newPostButtonStr: str,
baseDir: str,
nickname: str, domain: str,
- iconsDir: str,
+ iconsPath: str,
timelineStartTime,
newCalendarEvent: bool,
calendarPath: str,
@@ -922,7 +910,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
' '
@@ -949,7 +937,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
' \n'
@@ -966,7 +954,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
' \n'
@@ -974,7 +962,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
'' + \
- '' + translate['Expand'] + \
+ '' + translate['Show/Hide Buttons'] + \
' '
if newsHeader:
@@ -988,7 +976,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
'' + \
- ' '
@@ -1006,7 +994,7 @@ def headerButtonsTimeline(defaultTimeline: str,
tlStr += \
'' + \
- ' '
diff --git a/webapp_tos.py b/webapp_tos.py
index 707a29d42..346b86b6a 100644
--- a/webapp_tos.py
+++ b/webapp_tos.py
@@ -8,9 +8,8 @@ __status__ = "Production"
import os
from shutil import copyfile
-from utils import getCSS
from utils import getConfigParam
-from webapp_utils import htmlHeader
+from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
@@ -38,20 +37,15 @@ def htmlTermsOfService(cssCache: {}, baseDir: str,
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
- termsCSS = getCSS(baseDir, cssFilename, cssCache)
- if termsCSS:
- if httpPrefix != 'https':
- termsCSS = termsCSS.replace('https://', httpPrefix+'://')
-
- TOSForm = htmlHeader(cssFilename, termsCSS)
- TOSForm += '' + TOSText + '
\n'
- if adminNickname:
- adminActor = httpPrefix + '://' + domainFull + \
- '/users/' + adminNickname
- TOSForm += \
- '\n'
- TOSForm += htmlFooter()
+ TOSForm = htmlHeaderWithExternalStyle(cssFilename)
+ TOSForm += '' + TOSText + '
\n'
+ if adminNickname:
+ adminActor = httpPrefix + '://' + domainFull + \
+ '/users/' + adminNickname
+ TOSForm += \
+ '\n'
+ TOSForm += htmlFooter()
return TOSForm
diff --git a/webapp_utils.py b/webapp_utils.py
index 8e5894fe1..8b3c8bc6a 100644
--- a/webapp_utils.py
+++ b/webapp_utils.py
@@ -280,15 +280,15 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {},
return None
-def getIconsDir(baseDir: str) -> str:
- """Returns the directory where icons exist
+def getIconsWebPath(baseDir: str) -> str:
+ """Returns the web path where icons exist
"""
- iconsDir = 'icons'
+ iconsPath = 'icons'
theme = getConfigParam(baseDir, 'theme')
if theme:
- if os.path.isdir(baseDir + '/img/icons/' + theme):
- iconsDir = 'icons/' + theme
- return iconsDir
+ if os.path.isdir(baseDir + '/theme/' + theme + '/icons'):
+ iconsPath = 'icons/' + theme
+ return iconsPath
def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool:
@@ -419,34 +419,12 @@ def getRightImageFile(baseDir: str,
nickname, domain)
-def htmlHeader(cssFilename: str, css: str, lang='en') -> str:
+def htmlHeaderWithExternalStyle(cssFilename: str, lang='en') -> str:
htmlStr = '\n'
htmlStr += '\n'
htmlStr += ' \n'
htmlStr += ' \n'
- fontName, fontFormat = getFontFromCss(css)
- if fontName:
- htmlStr += ' \n'
- htmlStr += ' \n'
- htmlStr += ' \n'
- htmlStr += ' \n'
- htmlStr += ' Epicyon \n'
- htmlStr += ' \n'
- htmlStr += ' \n'
- return htmlStr
-
-
-def htmlHeaderWithExternalStyle(cssFilename: str, css: str, lang='en') -> str:
- htmlStr = '\n'
- htmlStr += '\n'
- htmlStr += ' \n'
- htmlStr += ' \n'
- fontName, fontFormat = getFontFromCss(css)
- if fontName:
- htmlStr += ' \n'
- cssFile = cssFilename.split('/')[-1]
+ cssFile = '/' + cssFilename.split('/')[-1]
htmlStr += ' \n'
htmlStr += ' \n'
htmlStr += ' \n'
@@ -747,16 +725,17 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {},
def htmlPostSeparator(baseDir: str, column: str) -> str:
"""Returns the html for a timeline post separator image
"""
- iconsDir = getIconsDir(baseDir)
+ iconsPath = getIconsWebPath(baseDir)
+ theme = getConfigParam(baseDir, 'theme')
filename = 'separator.png'
if column:
filename = 'separator_' + column + '.png'
- separatorImageFilename = baseDir + '/img/' + iconsDir + '/' + filename
+ separatorImageFilename = baseDir + '/theme/' + theme + '/icons/' + filename
separatorStr = ''
if os.path.isfile(separatorImageFilename):
separatorStr = \
'' + \
- ' ' + \
+ ' ' + \
' \n'
return separatorStr
@@ -765,7 +744,7 @@ def headerButtonsFrontScreen(translate: {},
nickname: str, boxName: str,
authorized: bool,
iconsAsButtons: bool,
- iconsDir: bool) -> str:
+ iconsPath: bool) -> str:
"""Returns the header buttons for the front page of a news instance
"""
headerStr = ''
@@ -806,13 +785,13 @@ def headerButtonsFrontScreen(translate: {},
headerStr += \
' ' + \
- ' \n'
headerStr += \
' ' + \
- ' \n'
else:
diff --git a/website/EN/index.html b/website/EN/index.html
index e4b6be5cc..26f5138b6 100644
--- a/website/EN/index.html
+++ b/website/EN/index.html
@@ -1164,8 +1164,8 @@