Back button on search screen

main
Bob Mottram 2019-12-17 13:09:08 +00:00
parent e87f66f62d
commit fc089022f5
2 changed files with 9 additions and 8 deletions

View File

@ -1674,8 +1674,7 @@ class PubServer(BaseHTTPRequestHandler):
self.path=self.path.split('?')[0]
# show the search screen
msg=htmlSearch(self.server.translate, \
self.server.baseDir,self.path, \
self.server.defaultTimeline).encode()
self.server.baseDir,self.path).encode()
self._set_headers('text/html',len(msg),cookie)
self._write(msg)
self.server.GETbusy=False
@ -4646,6 +4645,11 @@ class PubServer(BaseHTTPRequestHandler):
self.path.replace('/searchhandle','')
length = int(self.headers['Content-length'])
searchParams=self.rfile.read(length).decode('utf-8')
if 'submitBack=' in searchParams:
# go back on search screen
self._redirect_headers(actorStr+'/'+self.server.defaultTimeline,cookie)
self.server.POSTbusy=False
return
if 'searchtext=' in searchParams:
searchStr=searchParams.split('searchtext=')[1]
if '&' in searchStr:

View File

@ -3808,23 +3808,20 @@ def htmlHashTagSwarm(baseDir: str,actor: str) -> str:
return tagSwarmHtml
def htmlSearch(translate: {}, \
baseDir: str,path: str, \
defaultTimeline:str) -> str:
baseDir: str,path: str) -> str:
"""Search called from the timeline icon
"""
actor=path.replace('/search','')
nickname=getNicknameFromActor(actor)
domain,port=getDomainFromActor(actor)
backUrl=actor+'/'+defaultTimeline
if os.path.isfile(baseDir+'/img/search-background.png'):
if not os.path.isfile(baseDir+'/accounts/search-background.png'):
copyfile(baseDir+'/img/search-background.png',baseDir+'/accounts/search-background.png')
cssFilename=baseDir+'/epicyon-follow.css'
if os.path.isfile(baseDir+'/follow.css'):
cssFilename=baseDir+'/follow.css'
cssFilename=baseDir+'/follow.css'
with open(cssFilename, 'r') as cssFile:
profileStyle = cssFile.read()
followStr=htmlHeader(cssFilename,profileStyle)
@ -3835,7 +3832,7 @@ def htmlSearch(translate: {}, \
followStr+=' <form method="POST" accept-charset="UTF-8" action="'+actor+'/searchhandle">'
followStr+=' <input type="hidden" name="actor" value="'+actor+'">'
followStr+=' <input type="text" name="searchtext" autofocus><br>'
followStr+=' <a href="'+backUrl+'"><button class="button">'+translate['Go Back']+'</button></a>'
followStr+=' <button type="submit" class="button" name="submitBack">'+translate['Go Back']+'</button>'
followStr+=' <button type="submit" class="button" name="submitSearch">'+translate['Submit']+'</button>'
followStr+=' </form>'
followStr+=' <p class="hashtagswarm">'+htmlHashTagSwarm(baseDir,actor)+'</p>'