From f8b4e4961def5d094fed3a30f94c9ee440c47751 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 23 Nov 2019 14:13:25 +0000 Subject: [PATCH] Setting theme via profile screen --- daemon.py | 3 +++ translations/ar.json | 8 +++++++- translations/ca.json | 8 +++++++- translations/cy.json | 8 +++++++- translations/de.json | 8 +++++++- translations/en.json | 8 +++++++- translations/es.json | 8 +++++++- translations/fr.json | 8 +++++++- translations/ga.json | 8 +++++++- translations/hi.json | 8 +++++++- translations/it.json | 8 +++++++- translations/ja.json | 8 +++++++- translations/oc.json | 8 +++++++- translations/pt.json | 8 +++++++- translations/ru.json | 8 +++++++- translations/zh.json | 8 +++++++- webinterface.py | 16 ++++++++++++++-- 17 files changed, 122 insertions(+), 17 deletions(-) diff --git a/daemon.py b/daemon.py index 842527b4..9b2a700a 100644 --- a/daemon.py +++ b/daemon.py @@ -150,6 +150,7 @@ from media import removeMetaData from cache import storePersonInCache from cache import getPersonFromCache from httpsig import verifyPostHeaders +from theme import setTheme import os import sys @@ -3809,6 +3810,8 @@ class PubServer(BaseHTTPRequestHandler): if fields['displayNickname']!=actorJson['name']: actorJson['name']=fields['displayNickname'] actorChanged=True + if fields.get('themeDropdown'): + setTheme(self.server.baseDir,fields['themeDropdown']) if fields.get('donateUrl'): currentDonateUrl=getDonationUrl(actorJson) if fields['donateUrl']!=currentDonateUrl: diff --git a/translations/ar.json b/translations/ar.json index ff5a1346..3bebcc77 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/ca.json b/translations/ca.json index c27869bf..9dc9cc91 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/cy.json b/translations/cy.json index e8ac0f6d..0b819247 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/de.json b/translations/de.json index e1c36579..15044e44 100644 --- a/translations/de.json +++ b/translations/de.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/en.json b/translations/en.json index 40d63aaa..c8841ba7 100644 --- a/translations/en.json +++ b/translations/en.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/es.json b/translations/es.json index a3359750..070cdd8c 100644 --- a/translations/es.json +++ b/translations/es.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/fr.json b/translations/fr.json index 2cad067e..04a2244e 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/ga.json b/translations/ga.json index 793a6c5f..f4a67491 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/hi.json b/translations/hi.json index 7647a7c6..a67d4f8a 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/it.json b/translations/it.json index a64b5494..a9f72f8f 100644 --- a/translations/it.json +++ b/translations/it.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/ja.json b/translations/ja.json index b859743c..715d988e 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/oc.json b/translations/oc.json index 9469fb46..30b23038 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -176,5 +176,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/pt.json b/translations/pt.json index 148c77d9..17f308cb 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/ru.json b/translations/ru.json index 11b0e9cb..c2c9dfb9 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/translations/zh.json b/translations/zh.json index 45064e34..d73bafad 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -180,5 +180,11 @@ "Instance Logo": "Instance Logo", "Bookmark this post": "Bookmark this post", "Undo the bookmark": "Undo the bookmark", - "Bookmarks": "Saves" + "Bookmarks": "Saves", + "Theme": "Theme", + "Default": "Default", + "Light": "Light", + "Purple": "Purple", + "Hacker": "Hacker", + "HighVis": "HighVis" } diff --git a/webinterface.py b/webinterface.py index c6ec076b..6fdc8023 100644 --- a/webinterface.py +++ b/webinterface.py @@ -593,6 +593,7 @@ def htmlEditProfile(translate: {},baseDir: str,path: str,domain: str,port: int) instanceStr='' moderatorsStr='' + themesDropdown='' adminNickname=getConfigParam(baseDir,'admin') if path.startswith('/users/'+adminNickname+'/'): instanceDescription=getConfigParam(baseDir,'instanceDescription') @@ -620,7 +621,18 @@ def htmlEditProfile(translate: {},baseDir: str,path: str,domain: str,port: int) moderatorsStr+=' '+translate['A list of moderator nicknames. One per line.'] moderatorsStr+=' ' moderatorsStr+='' - + + themesDropdown= '
' + themesDropdown+=' '+translate['Theme']+'
' + themesDropdown+=' ' + themesDropdown+='
' + editProfileForm=htmlHeader(cssFilename,editProfileCSS) editProfileForm+='
' editProfileForm+='
' @@ -671,7 +683,7 @@ def htmlEditProfile(translate: {},baseDir: str,path: str,domain: str,port: int) editProfileForm+='
' editProfileForm+=' '+translate['Skills']+'
' editProfileForm+=' '+translate['If you want to participate within organizations then you can indicate some skills that you have and approximate proficiency levels. This helps organizers to construct teams with an appropriate combination of skills.'] - editProfileForm+=skillsStr+moderatorsStr + editProfileForm+=skillsStr+themesDropdown+moderatorsStr editProfileForm+='
'+instanceStr editProfileForm+='
' editProfileForm+=' '+translate['Danger Zone']+'
'