# $Id$ # $URL$ websiteConfig = infra.configRoot availabilityConfig = infra.configRoot drilldownConfig = infra.configRoot serverConfig = infra.configRoot def readJavascriptConfig(language): # BE AWARE The python configread converts all keys to lowercase! sysconfig = {} sysconfig ['minCoverWidth'] = int (websiteConfig.get('minCoverWidth' , section = 'behavior', default="16")) sysconfig ['loandeskBaseUrl'] = serverConfig.get('baseUrl', section = 'loandesk') sysconfig ['depotCollectionList'] = availabilityConfig.getValueAsList('collectionList', section = 'collections' ) sysconfig ['depotExceptionList'] = availabilityConfig.getValueAsList('exceptionList', section = 'collections' ) sysconfig ['availabilityGroups'] = availabilityConfig.getSectionDict(section = 'availabilityGroups', language=language) sysconfig ['availDisplayText'] = availabilityConfig.getSectionDict(section = 'availDisplayText', language=language) sysconfig ['availabilityRules'] = availabilityConfig.getValueAsList('availability', section = 'decisionRules') sysconfig ['ophaalRules'] = availabilityConfig.getValueAsList('ophaaltype', section = 'decisionRules') sysconfig ['translateHash'] = websiteConfig.getSectionDict(section = 'vocabulary', language=language ) # print('pageheader.sf: ' + infra.prpt('sysconfig', sysconfig)) sysconfigJSON = dumps(sysconfig) # any.spit(sysconfig) return base64.b64encode(sysconfigJSON) def main(*args, **kwargs): templatePrefix = ''; if isMobile(**kwargs): templatePrefix = 'mobile.' language = getLanguage( kwargs['Headers'] ) title = websiteConfig.get("applicationName", section = "userFeedback", default = "forgot it", language = language) if 'uid' in kwargs: text = websiteConfig.get('loggedInText', section = 'userFeedback', default = 'Logged in as:', language = language) login = backtick('login.template', {'text': text, 'uid': kwargs['uid']}) else: text = websiteConfig.get('logInText', section = 'userFeedback', default = 'Log in', language = language) login = backtick('nologin.template', {'text': text}) sysconfig = readJavascriptConfig(language) templateFile = templatePrefix + 'pageheader.template' yield backtick(templateFile, { 'language': language, 'title': title, 'login': login, 'sysconfig': sysconfig })