Theme designer screen

merge-requests/30/head
Bob Mottram 2021-12-04 16:59:50 +00:00
parent 1f06093819
commit 84607912cc
40 changed files with 161 additions and 36 deletions

View File

@ -154,6 +154,7 @@ from blog import htmlBlogPage
from blog import htmlBlogPost
from blog import htmlEditBlog
from blog import getBlogAddress
from webapp_themeDesigner import htmlThemeDesigner
from webapp_minimalbutton import setMinimal
from webapp_minimalbutton import isMinimal
from webapp_utils import getAvatarImageUrl
@ -10849,6 +10850,7 @@ class PubServer(BaseHTTPRequestHandler):
currNickname = currNickname.split('/')[0]
moderator = isModerator(baseDir, currNickname)
editor = isEditor(baseDir, currNickname)
artist = isArtist(baseDir, currNickname)
fullWidthTimelineButtonHeader = \
self.server.fullWidthTimelineButtonHeader
minimalNick = isMinimal(baseDir, domain, nickname)
@ -10881,7 +10883,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
moderator, editor,
moderator, editor, artist,
self.server.positiveVoting,
self.server.showPublishAsIcon,
fullWidthTimelineButtonHeader,
@ -14363,6 +14365,32 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug)
return
if htmlGET and usersInPath and authorized and \
self.path.endswith('/themedesigner'):
nickname = self.path.split('/users/')[1]
if '/' in nickname:
nickname = nickname.split('/')[0]
if not isArtist(self.server.baseDir, nickname):
self._403()
return
msg = \
htmlThemeDesigner(self.server.cssCache,
self.server.baseDir,
nickname, self.server.domain,
self.server.translate,
self.server.defaultTimeline,
self.server.themeName)
msg = msg.encode('utf-8')
msglen = len(msg)
self._login_headers('text/html', msglen, callingDomain)
self._write(msg)
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', 'show theme designer screen',
self.server.debug)
return
fitnessPerformance(GETstartTime, self.server.fitness,
'_GET', 'show about screen done',
self.server.debug)
@ -18330,6 +18358,7 @@ def runDaemon(contentLicenseUrl: str,
'enterNotes': 'n',
'menuTimeline': 't',
'menuEdit': 'e',
'menuThemeDesigner': 'z',
'menuProfile': 'p',
'menuInbox': 'i',
'menuSearch': '/',

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -498,5 +498,6 @@
"Select reaction": "حدد رد الفعل",
"Don't show the Reaction button": "لا تظهر زر رد الفعل",
"New feed URL": "موجز جديد URL",
"New link title and URL": "عنوان الارتباط الجديد وعنوان URL"
"New link title and URL": "عنوان الارتباط الجديد وعنوان URL",
"Theme Designer": "مصمم المظهر"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Seleccioneu la reacció",
"Don't show the Reaction button": "No mostris el botó de reacció",
"New feed URL": "URL de feed nou",
"New link title and URL": "Títol i URL de l'enllaç nous"
"New link title and URL": "Títol i URL de l'enllaç nous",
"Theme Designer": "Dissenyador temàtic"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Dewiswch adwaith",
"Don't show the Reaction button": "Peidiwch â dangos y botwm Adwaith",
"New feed URL": "URL porthiant newydd",
"New link title and URL": "Teitl dolen ac URL newydd"
"New link title and URL": "Teitl dolen ac URL newydd",
"Theme Designer": "Dylunydd Thema"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Reaktion auswählen",
"Don't show the Reaction button": "Reaktionstaste nicht anzeigen",
"New feed URL": "Neue Feed-URL",
"New link title and URL": "Neuer Linktitel und URL"
"New link title and URL": "Neuer Linktitel und URL",
"Theme Designer": "Themendesigner"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Select reaction",
"Don't show the Reaction button": "Don't show the Reaction button",
"New feed URL": "New feed URL",
"New link title and URL": "New link title and URL"
"New link title and URL": "New link title and URL",
"Theme Designer": "Theme Designer"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Seleccionar reacción",
"Don't show the Reaction button": "No mostrar el botón de reacción",
"New feed URL": "URL de nuevo feed",
"New link title and URL": "Nuevo título de enlace y URL"
"New link title and URL": "Nuevo título de enlace y URL",
"Theme Designer": "Diseñadora de temas"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Sélectionnez la réaction",
"Don't show the Reaction button": "Ne pas afficher le bouton Réaction",
"New feed URL": "Nouvelle URL de flux",
"New link title and URL": "Nouveau titre et URL du lien"
"New link title and URL": "Nouveau titre et URL du lien",
"Theme Designer": "Concepteur de thème"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Roghnaigh imoibriú",
"Don't show the Reaction button": "Ná taispeáin an cnaipe Imoibriú",
"New feed URL": "URL beathaithe nua",
"New link title and URL": "Teideal nasc nua agus URL"
"New link title and URL": "Teideal nasc nua agus URL",
"Theme Designer": "Dearthóir Téama"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "प्रतिक्रिया का चयन करें",
"Don't show the Reaction button": "प्रतिक्रिया बटन न दिखाएं",
"New feed URL": "नया फ़ीड URL",
"New link title and URL": "नया लिंक शीर्षक और URL"
"New link title and URL": "नया लिंक शीर्षक और URL",
"Theme Designer": "थीम डिजाइनर"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Seleziona reazione",
"Don't show the Reaction button": "Non mostrare il pulsante Reazione",
"New feed URL": "Nuovo URL del feed",
"New link title and URL": "Nuovo titolo e URL del collegamento"
"New link title and URL": "Nuovo titolo e URL del collegamento",
"Theme Designer": "Progettista di temi"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "反応を選択",
"Don't show the Reaction button": "反応ボタンを表示しない",
"New feed URL": "新しいフィードURL",
"New link title and URL": "新しいリンクのタイトルとURL"
"New link title and URL": "新しいリンクのタイトルとURL",
"Theme Designer": "テーマデザイナー"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Reaksiyonê hilbijêrin",
"Don't show the Reaction button": "Bişkoka Reaksiyonê nîşan nede",
"New feed URL": "URL-ya feed nû",
"New link title and URL": "Sernav û URL-ya girêdana nû"
"New link title and URL": "Sernav û URL-ya girêdana nû",
"Theme Designer": "Theme Designer"
}

View File

@ -494,5 +494,6 @@
"Select reaction": "Select reaction",
"Don't show the Reaction button": "Don't show the Reaction button",
"New feed URL": "New feed URL",
"New link title and URL": "New link title and URL"
"New link title and URL": "New link title and URL",
"Theme Designer": "Theme Designer"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Selecione a reação",
"Don't show the Reaction button": "Não mostrar o botão de reação",
"New feed URL": "Novo URL de feed",
"New link title and URL": "Novo título e URL do link"
"New link title and URL": "Novo título e URL do link",
"Theme Designer": "Designer de Tema"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Выберите реакцию",
"Don't show the Reaction button": "Не показывать кнопку реакции",
"New feed URL": "URL нового канала",
"New link title and URL": "Новое название ссылки и URL"
"New link title and URL": "Новое название ссылки и URL",
"Theme Designer": "Дизайнер тем"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "Chagua majibu",
"Don't show the Reaction button": "Usionyeshe kitufe cha Majibu",
"New feed URL": "URL mpya ya mipasho",
"New link title and URL": "Kichwa kipya cha kiungo na URL"
"New link title and URL": "Kichwa kipya cha kiungo na URL",
"Theme Designer": "Mbuni wa Mandhari"
}

View File

@ -498,5 +498,6 @@
"Select reaction": "选择反应",
"Don't show the Reaction button": "不显示“反应”按钮",
"New feed URL": "新供稿网址",
"New link title and URL": "新链接标题和 URL"
"New link title and URL": "新链接标题和 URL",
"Theme Designer": "主题设计师"
}

View File

@ -11,6 +11,7 @@ import os
from utils import getConfigParam
from utils import getNicknameFromActor
from utils import isEditor
from utils import isArtist
from utils import removeDomainPort
from utils import localActorUrl
from webapp_utils import sharesTimelineJson
@ -113,7 +114,7 @@ def _getLeftColumnWanted(baseDir: str,
def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
httpPrefix: str, translate: {},
editor: bool,
editor: bool, artist: bool,
showBackButton: bool, timelinePath: str,
rssIconAtTop: bool, showHeaderImage: bool,
frontPage: bool, theme: str,
@ -154,6 +155,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
htmlStr += '\n <center>\n'
htmlStr += ' <div class="leftColIcons">\n'
if editor:
# show the edit icon
htmlStr += \
@ -163,6 +165,15 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
translate['Edit Links'] + ' | " title="' + \
translate['Edit Links'] + '" src="/icons/edit.png" /></a>\n'
if artist:
# show the theme designer icon
htmlStr += \
' <a href="/users/' + nickname + '/themedesigner" ' + \
'accesskey="' + accessKeys['menuThemeDesigner'] + '">' + \
'<img class="' + editImageClass + '" loading="lazy" alt="' + \
translate['Theme Designer'] + ' | " title="' + \
translate['Theme Designer'] + '" src="/icons/theme.png" /></a>\n'
# RSS icon
if nickname != 'news':
# rss feed for this account
@ -358,8 +369,10 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
# is the user a site editor?
if nickname == 'news':
editor = False
artist = False
else:
editor = isEditor(baseDir, nickname)
artist = isArtist(baseDir, nickname)
domain = removeDomainPort(domainFull)
@ -383,7 +396,7 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
htmlStr += \
getLeftColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate,
editor,
editor, artist,
False, timelinePath,
rssIconAtTop, False, False,
theme, accessKeys,

View File

@ -155,7 +155,8 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
profileHeaderStr += \
getLeftColumnContent(baseDir, 'news', domainFull,
httpPrefix, translate,
False, False, None, rssIconAtTop, True,
False, False,
False, None, rssIconAtTop, True,
True, theme, accessKeys,
sharedItemsFederatedDomains)
profileHeaderStr += \

View File

@ -66,7 +66,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
newswire, False, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, moderationActionStr, theme,

View File

@ -878,6 +878,10 @@ def htmlProfile(signingPrivateKeyPem: str,
menuSkills: userPathStr + '/skills#timeline',
menuLogout: '/logout'
}
if isArtist(baseDir, nickname):
menuThemeDesigner = \
htmlHideFromScreenReader('🎨') + ' ' + translate['Theme Designer']
navLinks[menuThemeDesigner] = userPathStr + '/themedesigner'
navAccessKeys = {}
for variableName, key in accessKeys.items():
if not locals().get(variableName):

View File

@ -0,0 +1,61 @@
__filename__ = "webapp_themeDesigner.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.2.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@libreserver.org"
__status__ = "Production"
__module_group__ = "Web Interface"
import os
from utils import loadJson
from utils import getConfigParam
from utils import acctDir
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
def htmlThemeDesigner(cssCache: {}, baseDir: str,
nickname: str, domain: str,
translate: {}, defaultTimeline: str,
themeName: str) -> str:
"""Edit theme settings
"""
themeFilename = \
acctDir(baseDir, nickname, domain) + '/theme/' + \
themeName + '/theme.json'
themeJson = {}
if os.path.isfile(themeFilename):
themeJson = loadJson(themeFilename)
themeForm = ''
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
themeForm = \
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
themeForm += '<div class="container">\n'
themeForm += \
' <h1>' + translate['Theme Designer'] + '</h1>\n'
themeForm += ' <form method="POST" action="' + \
'/users/' + nickname + '/changeThemeSettings">\n'
for variableName, value in themeJson.items():
if variableName.endswith('-color') or \
variableName.endswith('-text'):
themeForm += \
'<p><label class="labels">' + \
variableName.replace('-', ' ') + '</label>'
themeForm += \
'<input type="color" name="themeSetting_' + \
variableName + '" value="' + str(value) + '"></p>'
themeForm += ' </form>\n'
themeForm += '</div>\n'
themeForm += htmlFooter()
return themeForm

View File

@ -430,7 +430,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, moderator: bool,
editor: bool,
editor: bool, artist: bool,
positiveVoting: bool,
showPublishAsIcon: bool,
fullWidthTimelineButtonHeader: bool,
@ -744,7 +744,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
leftColumnStr = \
getLeftColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate,
editor, False, None, rssIconAtTop,
editor, artist, False, None, rssIconAtTop,
True, False, theme, accessKeys,
sharedItemsFederatedDomains)
tlStr += ' <td valign="top" class="col-left" ' + \
@ -1159,7 +1159,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1213,7 +1213,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1268,7 +1268,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1323,7 +1323,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1373,7 +1373,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
newswire, False, False, False, positiveVoting,
showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1424,7 +1424,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1475,7 +1475,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1526,7 +1526,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1578,7 +1578,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
newswire, False, False, False,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1601,7 +1601,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, moderator: bool, editor: bool,
newswire: {}, moderator: bool, editor: bool, artist: bool,
positiveVoting: bool, showPublishAsIcon: bool,
fullWidthTimelineButtonHeader: bool,
iconsAsButtons: bool,
@ -1629,7 +1629,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, moderator, editor,
newswire, moderator, editor, artist,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
@ -1682,7 +1682,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
newswire, False, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances,