__filename__ = "webinterface.py" __author__ = "Bob Mottram" __license__ = "AGPL3+" __version__ = "0.0.1" __maintainer__ = "Bob Mottram" __email__ = "bob@freedombone.net" __status__ = "Production" import json from pprint import pprint from person import personBoxJson from utils import getNicknameFromActor from utils import getDomainFromActor from posts import getPersonBox def htmlHeader(css=None,lang='en') -> str: if not css: htmlStr= \ '\n' \ '\n' \ ' \n' \ ' \n' \ '
\n' else: htmlStr= \ '\n' \ '\n' \ ' \n' \ ' \n' \ ' \n' return htmlStr def htmlFooter() -> str: htmlStr= \ ' \n' \ '\n' return htmlStr def htmlProfilePosts(baseDir: str,httpPrefix: str, \ authorized: bool,ocapAlways: bool, \ nickname: str,domain: str,port: int, \ session,wfRequest: {},personCache: {}) -> str: """Shows posts on the profile screen """ profileStr='' outboxFeed= \ personBoxJson(baseDir,domain, \ port,'/users/'+nickname+'/outbox?page=1', \ httpPrefix, \ 4, 'outbox', \ authorized, \ ocapAlways) for item in outboxFeed['orderedItems']: if item['type']=='Create': profileStr+= \ individualPostAsHtml(session,wfRequest,personCache, \ domain,item) return profileStr def htmlProfileFollowing(baseDir: str,httpPrefix: str, \ authorized: bool,ocapAlways: bool, \ nickname: str,domain: str,port: int, \ session,wfRequest: {},personCache: {}, \ followingJson: {}) -> str: """Shows following on the profile screen """ profileStr='' for item in followingJson['orderedItems']: profileStr+=individualFollowAsHtml(session,wfRequest,personCache,domain,item) return profileStr def htmlProfileRoles(nickname: str,domain: str,rolesJson: {}) -> str: """Shows roles on the profile screen """ profileStr='' for project,rolesList in rolesJson.items(): profileStr+='@'+nickname+'@'+domain+' has no roles assigned
' else: profileStr='@'+nickname+'@'+domain+' has no skills assigned
' else: profileStr='@'+nickname+'@'+domainFull+'
' \ ''+profileDescription+'
' \ ''+titleStr+'
'+ \ ''+titleStr+'
'+ \ postJsonObject['object']['content']+'\n'+ \ attachmentStr+ \ ''+postJsonObject['object']['published']+'\n'+ \ '