forked from indymedia/epicyon
Page up and down on following list on profile page
parent
d666581c54
commit
42740a6781
30
daemon.py
30
daemon.py
|
@ -1446,7 +1446,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
actorJson['roles']).encode('utf-8')
|
||||
actorJson['roles'], \
|
||||
None,None).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
else:
|
||||
|
@ -1481,7 +1482,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
actorJson['skills']).encode('utf-8')
|
||||
actorJson['skills'], \
|
||||
None,None).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
else:
|
||||
|
@ -1797,6 +1799,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
sharesPerPage)
|
||||
if shares:
|
||||
if self._requestHTTP():
|
||||
pageNumber=1
|
||||
if '?page=' not in self.path:
|
||||
searchPath=self.path
|
||||
# get a page of shares, not the summary
|
||||
|
@ -1805,6 +1808,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
sharesPerPage)
|
||||
else:
|
||||
pageNumberStr=self.path.split('?page=')[1]
|
||||
if pageNumberStr.isdigit():
|
||||
pageNumber=int(pageNumberStr)
|
||||
searchPath=self.path.split('?page=')[0]
|
||||
getPerson = personLookup(self.server.domain,searchPath.replace('/shares',''), \
|
||||
self.server.baseDir)
|
||||
|
@ -1823,7 +1829,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
shares).encode('utf-8')
|
||||
shares, \
|
||||
pageNumber,sharesPerPage).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
self.server.GETbusy=False
|
||||
|
@ -1841,6 +1848,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
authorized,followsPerPage)
|
||||
if following:
|
||||
if self._requestHTTP():
|
||||
pageNumber=1
|
||||
if '?page=' not in self.path:
|
||||
searchPath=self.path
|
||||
# get a page of following, not the summary
|
||||
|
@ -1849,6 +1857,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
authorized,followsPerPage)
|
||||
else:
|
||||
pageNumberStr==self.path.split('?page=')[1]
|
||||
if pageNumberStr.isdigit():
|
||||
pageNumber=int(pageNumberStr)
|
||||
searchPath=self.path.split('?page=')[0]
|
||||
getPerson = personLookup(self.server.domain,searchPath.replace('/following',''), \
|
||||
self.server.baseDir)
|
||||
|
@ -1868,7 +1879,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
following).encode('utf-8')
|
||||
following, \
|
||||
pageNumber,followsPerPage).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
self.server.GETbusy=False
|
||||
|
@ -1885,6 +1897,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
authorized,followsPerPage,'followers')
|
||||
if followers:
|
||||
if self._requestHTTP():
|
||||
pageNumber=1
|
||||
if '?page=' not in self.path:
|
||||
searchPath=self.path
|
||||
# get a page of followers, not the summary
|
||||
|
@ -1893,6 +1906,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.httpPrefix, \
|
||||
authorized,followsPerPage,'followers')
|
||||
else:
|
||||
pageNumberStr=self.path.split('?page=')[1]
|
||||
if pageNumberStr.isdigit():
|
||||
pageNumber=int(pageNumberStr)
|
||||
searchPath=self.path.split('?page=')[0]
|
||||
getPerson = personLookup(self.server.domain,searchPath.replace('/followers',''), \
|
||||
self.server.baseDir)
|
||||
|
@ -1911,7 +1927,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache, \
|
||||
followers).encode('utf-8')
|
||||
followers, \
|
||||
pageNumber,followsPerPage).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
self.server.GETbusy=False
|
||||
|
@ -1940,7 +1957,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
getPerson,'posts',
|
||||
self.server.session, \
|
||||
self.server.cachedWebfingers, \
|
||||
self.server.personCache).encode('utf-8')
|
||||
self.server.personCache, \
|
||||
None,None).encode('utf-8')
|
||||
self._set_headers('text/html',len(msg),cookie)
|
||||
self.wfile.write(msg)
|
||||
else:
|
||||
|
|
|
@ -920,10 +920,20 @@ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
|||
nickname: str,domain: str,port: int, \
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
followingJson: {},projectVersion: str, \
|
||||
buttons: []) -> str:
|
||||
buttons: [], \
|
||||
feedName: str,actor: str, \
|
||||
pageNumber: int, \
|
||||
maxItemsPerPage: int) -> str:
|
||||
"""Shows following on the profile screen
|
||||
"""
|
||||
profileStr=''
|
||||
|
||||
if authorized and pageNumber:
|
||||
if authorized and pageNumber>1:
|
||||
# page up arrow
|
||||
profileStr+= \
|
||||
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/icons/pageup.png" title="Page up" alt="Page up"></a></center>'
|
||||
|
||||
for item in followingJson['orderedItems']:
|
||||
profileStr+= \
|
||||
individualFollowAsHtml(baseDir,session, \
|
||||
|
@ -931,6 +941,11 @@ def htmlProfileFollowing(baseDir: str,httpPrefix: str, \
|
|||
domain,item,authorized,nickname, \
|
||||
httpPrefix,projectVersion, \
|
||||
buttons)
|
||||
if authorized and maxItemsPerPage and pageNumber:
|
||||
if len(followingJson['orderedItems'])>=maxItemsPerPage:
|
||||
# page down arrow
|
||||
profileStr+= \
|
||||
'<center><a href="'+actor+'/'+feedName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/icons/pagedown.png" title="Page down" alt="Page down"></a></center>'
|
||||
return profileStr
|
||||
|
||||
def htmlProfileRoles(nickname: str,domain: str,rolesJson: {}) -> str:
|
||||
|
@ -985,7 +1000,8 @@ def htmlProfile(projectVersion: str, \
|
|||
baseDir: str,httpPrefix: str,authorized: bool, \
|
||||
ocapAlways: bool,profileJson: {},selected: str, \
|
||||
session,wfRequest: {},personCache: {}, \
|
||||
extraJson=None) -> str:
|
||||
extraJson=None, \
|
||||
pageNumber=None,maxItemsPerPage=None) -> str:
|
||||
"""Show the profile page as html
|
||||
"""
|
||||
nickname=profileJson['preferredUsername']
|
||||
|
@ -1104,15 +1120,19 @@ def htmlProfile(projectVersion: str, \
|
|||
domain,port,session, \
|
||||
wfRequest,personCache,extraJson, \
|
||||
projectVersion, \
|
||||
["unfollow"])
|
||||
["unfollow"], \
|
||||
selected,actor, \
|
||||
pageNumber,maxItemsPerPage)
|
||||
if selected=='followers':
|
||||
profileStr+= \
|
||||
htmlProfileFollowing(baseDir,httpPrefix, \
|
||||
authorized,ocapAlways,nickname, \
|
||||
domain,port,session, \
|
||||
wfRequest,personCache,extraJson, \
|
||||
projectVersion,
|
||||
["block"])
|
||||
projectVersion, \
|
||||
["block"], \
|
||||
selected,actor, \
|
||||
pageNumber,maxItemsPerPage)
|
||||
if selected=='roles':
|
||||
profileStr+= \
|
||||
htmlProfileRoles(nickname,domainFull,extraJson)
|
||||
|
|
Loading…
Reference in New Issue