Start of options screen

master
Bob Mottram 2019-08-24 22:10:20 +01:00
parent 509d62ba40
commit ed9f4b5bf0
3 changed files with 59 additions and 11 deletions

View File

@ -76,6 +76,7 @@ from roles import setRole
from roles import clearModeratorStatus from roles import clearModeratorStatus
from skills import outboxSkills from skills import outboxSkills
from availability import outboxAvailability from availability import outboxAvailability
from webinterface import htmlPersonOptions
from webinterface import htmlIndividualPost from webinterface import htmlIndividualPost
from webinterface import htmlProfile from webinterface import htmlProfile
from webinterface import htmlInbox from webinterface import htmlInbox
@ -808,6 +809,23 @@ class PubServer(BaseHTTPRequestHandler):
self.server.GETbusy=False self.server.GETbusy=False
return return
# show the person options screen with view/follow/block/report
if '/users/' in self.path:
if '?options=' in self.path:
optionsStr=self.path.split('?options=')[1]
originPathStr=self.path.split('?options=')[0]
if ';' in optionsStr:
optionsActor=optionsStr.split(';')[0]
optionsProfileUrl=optionsStr.split(';')[1]
msg=htmlPersonOptions(self.server.baseDir,originPathStr,optionsActor,optionsProfileUrl).encode()
self._set_headers('text/html',len(msg),cookie)
self.wfile.write(msg)
self.server.GETbusy=False
return
self._redirect_headers(originPathStr,cookie)
self.server.GETbusy=False
return
# hashtag search # hashtag search
if self.path.startswith('/tags/'): if self.path.startswith('/tags/'):
pageNumber=1 pageNumber=1

View File

@ -634,8 +634,8 @@ input[type=submit]:hover {
/* Links inside the dropdown */ /* Links inside the dropdown */
.dropdown-timeline-content a { .dropdown-timeline-content a {
color: var(--main-fg-color); color: var(--main-bg-color);
padding: 12px 16px; padding: 25px 16px;
text-decoration: none; text-decoration: none;
display: block; display: block;
} }
@ -649,10 +649,7 @@ input[type=submit]:hover {
/* Change the background color of the dropdown button when the dropdown content is shown */ /* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {background-color: var(--main-fg-color);} .dropdown:hover .dropbtn {background-color: var(--main-fg-color);}
.dropdown-timeline-content a:hover {background-color: #ddd;} .dropdown-timeline-content a:hover {color: white;}
/* Show the dropdown menu on hover */
.dropdown-timeline:hover .dropdown-timeline-content {display: block;}
/* Change the background color of the dropdown button when the dropdown content is shown */ /* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown-timeline:hover .dropbtn {background-color: var(--main-fg-color);} .dropdown-timeline:hover .dropbtn {background-color: var(--main-fg-color);}

View File

@ -1253,11 +1253,12 @@ def individualPostAsHtml(baseDir: str, \
avatarDropdown= \ avatarDropdown= \
' <div onclick="dropdown()" class="dropdown-timeline">' \ ' <div onclick="dropdown()" class="dropdown-timeline">' \
' <img src="'+avatarUrl+'" '+avatarPosition+'/>' \ ' <a href="/users/'+nickname+'?options='+postJsonObject['actor']+';'+avatarUrl+'">' \
' <div id="myDropdown" class="dropdown-timeline-content">' \ ' <img title="Show options for this person" src="'+avatarUrl+'" '+avatarPosition+'/></a>' \
' <a href="'+postJsonObject['actor']+'">Visit</a>'+ \ #' <div id="myDropdown" class="dropdown-timeline-content">' \
followUnfollowStr+blockUnblockStr+reportStr+ \ #' <a href="'+postJsonObject['actor']+'">Visit</a>'+ \
' </div>' \ #followUnfollowStr+blockUnblockStr+reportStr+ \
#' </div>' \
' </div>' ' </div>'
publishedStr=postJsonObject['object']['published'] publishedStr=postJsonObject['object']['published']
@ -1608,6 +1609,38 @@ def htmlUnfollowConfirm(baseDir: str,originPathStr: str,followActor: str,followP
followStr+=htmlFooter() followStr+=htmlFooter()
return followStr return followStr
def htmlPersonOptions(baseDir: str,originPathStr: str,optionsActor: str,optionsProfileUrl: str) -> str:
"""Show options for a person: view/follow/block/report
"""
optionsDomain,port=getDomainFromActor(optionsActor)
if os.path.isfile(baseDir+'/img/options-background.png'):
if not os.path.isfile(baseDir+'/accounts/options-background.png'):
copyfile(baseDir+'/img/options-background.png',baseDir+'/accounts/options-background.png')
with open(baseDir+'/epicyon-follow.css', 'r') as cssFile:
profileStyle = cssFile.read()
optionsStr=htmlHeader(profileStyle)
optionsStr+='<div class="options">'
optionsStr+=' <div class="optionsAvatar">'
optionsStr+=' <center>'
optionsStr+=' <a href="'+optionsActor+'">'
optionsStr+=' <img src="'+optionsProfileUrl+'"/></a>'
optionsStr+=' <p class="optionsText">Options '+getNicknameFromActor(optionsActor)+'@'+optionsDomain+' ?</p>'
optionsStr+= \
' <form method="POST" action="'+originPathStr+'/optionsconfirm">' \
' <input type="hidden" name="actor" value="'+optionsActor+'">' \
' <button type="submit" class="button" name="submitView">View</button>' \
' <button type="submit" class="button" name="submitFollow">Follow</button>' \
' <button type="submit" class="button" name="submitBlock">Block</button>' \
' <button type="submit" class="button" name="submitReport">Report</button>' \
' </form>'
optionsStr+='</center>'
optionsStr+='</div>'
optionsStr+='</div>'
optionsStr+=htmlFooter()
return optionsStr
def htmlBlockConfirm(baseDir: str,originPathStr: str,blockActor: str,blockProfileUrl: str) -> str: def htmlBlockConfirm(baseDir: str,originPathStr: str,blockActor: str,blockProfileUrl: str) -> str:
"""Asks to confirm a block """Asks to confirm a block
""" """