# $Id$ # $URL$ logger = logging.getLogger('meresco.searchform') logger.debug("Starting logger") websiteConfig = configs['website'] #from sys import stderr def main(arguments={}, path='', *args, **kwargs): # Anton: for the moment default to english language = 'en' #path.startswith('/en/') and 'en' or 'nl' #{'nl':'Zoeken', 'en':'Search'}[language] query = arguments.get('query', [''])[0] logger.debug('query: ' + query) httpQuery = escapeHtml(query) nlPath = '/'.join(['nl'] + path.split('/')[2:]) + '?' + urlencode(arguments) enPath = '/'.join(['en'] + path.split('/')[2:]) + '?' + urlencode(arguments) drilldown='' websiteConfig.setDefaults('searchform') search = websiteConfig.get('searchButton') goback = websiteConfig.get('gobackButton') reset = websiteConfig.get('resetButton') if 'drilldown' in arguments: for value in arguments['drilldown']: drilldown += '&drilldown='+value sortKeys = arguments.get('sortKeys', [''])[0] optionRelevance = "" optionYearDown = "" optionYearUp = "" if not sortKeys or sortKeys == "norm.date.year,,1": optionYearDown = "selected" elif sortKeys == "norm.date.year,," or sortKeys == "norm.date.year,,0": optionYearUp = "selected" elif sortKeys == ",,": optionRelevance = "selected" yield backtick('searchForm.template', { 'drilldown': drilldown, 'httpQuery': httpQuery, 'search': search, 'goback': goback, 'reset': reset, 'optionRelevance': optionRelevance, 'optionYearDown': optionYearDown, 'optionYearUp': optionYearUp })