From 68cd2b920517c80c797d4578c6228a9aaeed0a6c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 10 Oct 2019 15:43:21 +0100 Subject: [PATCH] Beginning of calendar screen --- daemon.py | 12 +++ epicyon-calendar.css | 176 +++++++++++++++++++++++++++++++++++++++++++ theme | 81 +++++++++++++++++--- webinterface.py | 24 ++++++ 4 files changed, 281 insertions(+), 12 deletions(-) create mode 100644 epicyon-calendar.css diff --git a/daemon.py b/daemon.py index 187117025..19b093b36 100644 --- a/daemon.py +++ b/daemon.py @@ -99,6 +99,7 @@ from webinterface import htmlSuspended from webinterface import htmlGetLoginCredentials from webinterface import htmlNewPost from webinterface import htmlFollowConfirm +from webinterface import htmlCalendar from webinterface import htmlSearch from webinterface import htmlSearchEmoji from webinterface import htmlSearchEmojiTextEntry @@ -1043,6 +1044,17 @@ class PubServer(BaseHTTPRequestHandler): self.server.GETbusy=False return + # Show the calendar for a user + if htmlGET and '/users/' in self.path: + if self.path.endswith('/calendar'): + # show the calendar screen + msg=htmlCalendar(self.server.translate, \ + self.server.baseDir,self.path).encode() + self._set_headers('text/html',len(msg),cookie) + self.wfile.write(msg) + self.server.GETbusy=False + return + # search for emoji by name if htmlGET and '/users/' in self.path: if self.path.endswith('/searchemoji'): diff --git a/epicyon-calendar.css b/epicyon-calendar.css new file mode 100644 index 000000000..161a08b71 --- /dev/null +++ b/epicyon-calendar.css @@ -0,0 +1,176 @@ +@charset "UTF-8"; + +:root { + --main-bg-color: #282c37; + --main-fg-color: #dddddd; + --main-link-color: #999; + --main-visited-color: #888; + --border-color: #505050; + --font-size-header: 18px; + --font-color-header: #ccc; + --font-size: 40px; + --text-entry-foreground: #ccc; + --text-entry-background: #111; + --time-color: #aaa; + --button-text: #FFFFFF; + --button-background: #999; + --button-selected: #666; +} + +body, html { + background-color: var(--main-bg-color); + color: var(--main-fg-color); + + height: 100%; + font-family: Arial, Helvetica, sans-serif; + max-width: 100%; + min-width: 600px; + margin: 5% auto; +} + +a, u { + color: var(--main-fg-color); +} + +a:visited{ + color: var(--main-visited-color); + font-weight: bold; +} + +a:link { + color: var(--main-link-color); + font-weight: bold; +} + +.calendar { + background-image: url("calendar-background.png"); + height: 100%; + background-position: center; + background-repeat: no-repeat; + background-size: cover; + position: relative; + background-color: var(--main-bg-color); +} + +.calendarAvatar { + margin: 15% 0; +} + +.calendarAvatar img { + border-radius: 10%; + width: 20%; + min-width: 200px; +} + +.calendarText { + font-size: var(--font-size); +} + +.button { + border-radius: 4px; + background-color: var(--button-background); + border: none; + color: var(--button-text); + text-align: center; + padding: 10px; + font-size: var(--font-size); + width: 20%; + max-width: 200px; + min-width: 100px; + cursor: pointer; + margin: 30px; +} + +.button:hover { + background-color: #555; + color: white; +} + +input[type=text] { + width: 90%; + clear: both; + font-size: var(--font-size); + text-align: center; + color: var(--text-entry-foreground); + background-color: var(--text-entry-background); +} + +.cwButton { + border-radius: 4px; + background-color: #999; + border: none; + color: var(--button-text); + text-align: center; + font-size: var(--font-size); + padding: 2px; + cursor: pointer; + margin: 5px; +} + +.cwText { + display: none; +} + +.options { + font-size: var(--font-size); +} + +.options img { + width: 20%; +} + +@media screen and (min-width: 400px) { + .calendarText { + font-size: 24px; + } + input[type=text] { + width: 90%; + clear: both; + font-size: 24px; + text-align: center; + color: var(--text-entry-foreground); + background-color: var(--text-entry-background); + } + .button { + border-radius: 4px; + background-color: var(--button-background); + border: none; + color: var(--button-text); + text-align: center; + padding: 10px; + font-size: 24px; + width: 20%; + max-width: 200px; + min-width: 100px; + cursor: pointer; + margin: 30px; + } +} + +@media screen and (max-width: 1000px) { + .calendarText { + font-size: 40px; + } + input[type=text] { + width: 90%; + clear: both; + font-size: 40px; + text-align: center; + color: var(--text-entry-foreground); + background-color: var(--text-entry-background); + } + .button { + border-radius: 4px; + background-color: var(--button-background); + border: none; + color: var(--button-text); + text-align: center; + padding: 10px; + font-size: 40px; + width: 20%; + max-width: 200px; + min-width: 100px; + cursor: pointer; + margin: 30px; + } +} diff --git a/theme b/theme index fb2775efc..5ba4ac627 100755 --- a/theme +++ b/theme @@ -25,6 +25,9 @@ if [[ "$themeName" == 'default' ]]; then if [ -f suspended.css ]; then rm suspended.css fi + if [ -f calendar.css ]; then + rm calendar.css + fi fi if [[ "$themeName" == 'purple'* ]]; then @@ -36,8 +39,24 @@ if [[ "$themeName" == 'purple'* ]]; then sed -i 's|"theme"| "theme"|g' config.json fi fi - cp epicyon-profile.css epicyon.css filename=epicyon.css + cp epicyon-profile.css "$filename" + sed -i "s|--main-bg-color:.*|--main-bg-color: #1f152d;|g" "$filename" + sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #1a142d;|g" "$filename" + sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #12152d;|g" "$filename" + sed -i "s|--main-header-color-roles:.*|--main-header-color-roles: #1f192d;|g" "$filename" + sed -i "s|--main-fg-color:.*|--main-fg-color: #f98bb0;|g" "$filename" + sed -i "s|--border-color:.*|--border-color: #3f2145;|g" "$filename" + sed -i "s|--main-link-color:.*|--main-link-color: #ff42a0;|g" "$filename" + sed -i "s|--main-visited-color:.*|--main-visited-color: #f93bb0;|g" "$filename" + sed -i "s|--time-color:.*|--time-color: #f98bb0;|g" "$filename" + sed -i "s|--button-selected:.*|--button-selected: #c042a0;|g" "$filename" + sed -i "s|--button-background:.*|--button-background: #ff42a0;|g" "$filename" + sed -i "s|--button-text:.*|--button-text: white;|g" "$filename" + sed -i "s|background-color: #554;|background-color: #ff42a0;|g" "$filename" + sed -i "s|color: #FFFFFE;|color: #1f152d;|g" "$filename" + filename=calendar.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #1f152d;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #1a142d;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #12152d;|g" "$filename" @@ -52,8 +71,8 @@ if [[ "$themeName" == 'purple'* ]]; then sed -i "s|--button-text:.*|--button-text: white;|g" "$filename" sed -i "s|background-color: #554;|background-color: #ff42a0;|g" "$filename" sed -i "s|color: #FFFFFE;|color: #1f152d;|g" "$filename" - cp epicyon-login.css login.css filename=login.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #1f152d;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #1a142d;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #12152d;|g" "$filename" @@ -68,8 +87,8 @@ if [[ "$themeName" == 'purple'* ]]; then sed -i "s|--button-text:.*|--button-text: white;|g" "$filename" sed -i "s|background-color: #554;|background-color: #ff42a0;|g" "$filename" sed -i "s|color: #FFFFFE;|color: #1f152d;|g" "$filename" - cp epicyon-follow.css follow.css filename=follow.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #1f152d;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #1a142d;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #12152d;|g" "$filename" @@ -84,8 +103,8 @@ if [[ "$themeName" == 'purple'* ]]; then sed -i "s|--button-text:.*|--button-text: white;|g" "$filename" sed -i "s|background-color: #554;|background-color: #ff42a0;|g" "$filename" sed -i "s|color: #FFFFFE;|color: #1f152d;|g" "$filename" - cp epicyon-suspended.css suspended.css filename=suspended.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #1f152d;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #1a142d;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #12152d;|g" "$filename" @@ -111,8 +130,27 @@ if [[ "$themeName" == 'hack'* || "$themeName" == 'hax'* ]]; then sed -i 's|"theme"| "theme"|g' config.json fi fi - cp epicyon-profile.css epicyon.css filename=epicyon.css + cp epicyon-profile.css "$filename" + sed -i "s|--main-bg-color:.*|--main-bg-color: black;|g" "$filename" + sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #030202;|g" "$filename" + sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #050202;|g" "$filename" + sed -i "s|--main-header-color-roles:.*|--main-header-color-roles: #1f192d;|g" "$filename" + sed -i "s|--main-fg-color:.*|--main-fg-color: green;|g" "$filename" + sed -i "s|--border-color:.*|--border-color: darkgreen;|g" "$filename" + sed -i "s|--main-link-color:.*|--main-link-color: #266020;|g" "$filename" + sed -i "s|--main-visited-color:.*|--main-visited-color: #3c8234;|g" "$filename" + sed -i "s|--time-color:.*|--time-color: green;|g" "$filename" + sed -i "s|--button-selected:.*|--button-selected: #063200;|g" "$filename" + sed -i "s|--button-background:.*|--button-background: #062200;|g" "$filename" + sed -i "s|--button-text:.*|--button-text: green;|g" "$filename" + sed -i "s|--button-corner-radius:.*|--button-corner-radius: 4px;|g" "$filename" + sed -i "s|--timeline-border-radius:.*|--timeline-border-radius: 4px;|g" "$filename" + sed -i "s|font-family:.*|font-family: Courier;|g" "$filename" + sed -i "s|background-color: #554;|background-color: #062200;|g" "$filename" + sed -i "s|color: #FFFFFE;|color: green;|g" "$filename" + filename=calendar.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: black;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #030202;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #050202;|g" "$filename" @@ -130,8 +168,8 @@ if [[ "$themeName" == 'hack'* || "$themeName" == 'hax'* ]]; then sed -i "s|font-family:.*|font-family: Courier;|g" "$filename" sed -i "s|background-color: #554;|background-color: #062200;|g" "$filename" sed -i "s|color: #FFFFFE;|color: green;|g" "$filename" - cp epicyon-login.css login.css filename=login.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: black;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #030202;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #050202;|g" "$filename" @@ -148,8 +186,8 @@ if [[ "$themeName" == 'hack'* || "$themeName" == 'hax'* ]]; then sed -i "s|font-family:.*|font-family: Courier;|g" "$filename" sed -i "s|background-color: #554;|background-color: #062200;|g" "$filename" sed -i "s|color: #FFFFFE;|color: green;|g" "$filename" - cp epicyon-follow.css follow.css filename=follow.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: black;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #030202;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #050202;|g" "$filename" @@ -166,8 +204,8 @@ if [[ "$themeName" == 'hack'* || "$themeName" == 'hax'* ]]; then sed -i "s|font-family:.*|font-family: Courier;|g" "$filename" sed -i "s|background-color: #554;|background-color: #062200;|g" "$filename" sed -i "s|color: #FFFFFE;|color: green;|g" "$filename" - cp epicyon-suspended.css suspended.css filename=suspended.css + cp "epicyon-$filename" "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: black;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #030202;|g" "$filename" sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #050202;|g" "$filename" @@ -195,8 +233,27 @@ if [[ "$themeName" == 'light'* ]]; then sed -i 's|"theme"| "theme"|g' config.json fi fi - cp epicyon-profile.css epicyon.css filename=epicyon.css + cp epicyon-profile.css "$filename" + sed -i 's|rgba(0, 0, 0, 0.5)|rgba(0, 0, 0, 0.0)|g' "$filename" + sed -i "s|--main-bg-color:.*|--main-bg-color: #e6ebf0;|g" "$filename" + sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #e0dbf0;|g" "$filename" + sed -i "s|--main-bg-color-report:.*|--main-bg-color-report: #e3dbf0;|g" "$filename" + sed -i "s|--main-header-color-roles:.*|--main-header-color-roles: #ebebf0;|g" "$filename" + sed -i "s|--main-fg-color:.*|--main-fg-color: #2d2c37;|g" "$filename" + sed -i "s|--border-color:.*|--border-color: #c0cdd9;|g" "$filename" + sed -i "s|--main-link-color:.*|--main-link-color: #2a2c37;|g" "$filename" + sed -i "s|--main-visited-color:.*|--main-visited-color: #232c37;|g" "$filename" + sed -i "s|--time-color:.*|--time-color: #555;|g" "$filename" + sed -i "s|--text-entry-foreground:.*|--text-entry-foreground: #111;|g" "$filename" + sed -i "s|--text-entry-background:.*|--text-entry-background: white;|g" "$filename" + sed -i "s|--font-color-header:.*|--font-color-header: black;|g" "$filename" + sed -i "s|--dropdown-bg-color:.*|--dropdown-bg-color: white;|g" "$filename" + sed -i "s|--dropdown-bg-color-hover:.*|--dropdown-bg-color-hover: lightgrey;|g" "$filename" + sed -i "s|background-color: #554;|background-color: white;|g" "$filename" + sed -i "s|color: #FFFFFE;|color: black;|g" "$filename" + filename=calendar.css + cp "epicyon-$filename" "$filename" sed -i 's|rgba(0, 0, 0, 0.5)|rgba(0, 0, 0, 0.0)|g' "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #e6ebf0;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #e0dbf0;|g" "$filename" @@ -214,8 +271,8 @@ if [[ "$themeName" == 'light'* ]]; then sed -i "s|--dropdown-bg-color-hover:.*|--dropdown-bg-color-hover: lightgrey;|g" "$filename" sed -i "s|background-color: #554;|background-color: white;|g" "$filename" sed -i "s|color: #FFFFFE;|color: black;|g" "$filename" - cp epicyon-login.css login.css filename=login.css + cp "epicyon-$filename" "$filename" sed -i 's|rgba(0, 0, 0, 0.5)|rgba(0, 0, 0, 0.0)|g' "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #e6ebf0;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #e0dbf0;|g" "$filename" @@ -233,8 +290,8 @@ if [[ "$themeName" == 'light'* ]]; then sed -i "s|--dropdown-bg-color-hover:.*|--dropdown-bg-color-hover: lightgrey;|g" "$filename" sed -i "s|background-color: #554;|background-color: white;|g" "$filename" sed -i "s|color: #FFFFFE;|color: black;|g" "$filename" - cp epicyon-follow.css follow.css filename=follow.css + cp "epicyon-$filename" "$filename" sed -i 's|rgba(0, 0, 0, 0.5)|rgba(0, 0, 0, 0.0)|g' "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #e6ebf0;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #e0dbf0;|g" "$filename" @@ -252,8 +309,8 @@ if [[ "$themeName" == 'light'* ]]; then sed -i "s|--dropdown-bg-color-hover:.*|--dropdown-bg-color-hover: lightgrey;|g" "$filename" sed -i "s|background-color: #554;|background-color: white;|g" "$filename" sed -i "s|color: #FFFFFE;|color: black;|g" "$filename" - cp epicyon-suspended.css suspended.css filename=suspended.css + cp "epicyon-$filename" "$filename" sed -i 's|rgba(0, 0, 0, 0.5)|rgba(0, 0, 0, 0.0)|g' "$filename" sed -i "s|--main-bg-color:.*|--main-bg-color: #e6ebf0;|g" "$filename" sed -i "s|--main-bg-color-reply:.*|--main-bg-color-reply: #e0dbf0;|g" "$filename" diff --git a/webinterface.py b/webinterface.py index 9425b4691..d3d5c6278 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2743,6 +2743,30 @@ def htmlSearchEmojiTextEntry(translate: {}, \ emojiStr+=htmlFooter() return emojiStr +def htmlCalendar(translate: {}, \ + baseDir: str,path: str) -> str: + """Show the calendar for a person + """ + actor=path.replace('/calendar','') + nickname=getNicknameFromActor(actor) + domain,port=getDomainFromActor(actor) + + if os.path.isfile(baseDir+'/img/calendar-background.png'): + if not os.path.isfile(baseDir+'/accounts/calendar-background.png'): + copyfile(baseDir+'/img/calendar-background.png',baseDir+'/accounts/calendar-background.png') + + cssFilename=baseDir+'/epicyon-calendar.css' + if os.path.isfile(baseDir+'/calendar.css'): + cssFilename=baseDir+'/calendar.css' + with open(cssFilename, 'r') as cssFile: + calendarStyle = cssFile.read() + + calendarStr=htmlHeader(cssFilename,calendarStyle) + #TODO + calendarStr+=htmlFooter() + + return calendarStr + def htmlSearch(translate: {}, \ baseDir: str,path: str) -> str: """Search called from the timeline icon