import paginate BASEURLJOURNALCOVERS = 'http://drcwww.uvt.nl/~place/elsevier/' import rating def renderSingleItem(index, link, metadata, recordId): record = any.createRecord(metadata) yield '' yield '%s.' % index if 'genre' in record: genre = record['genre'] else: genre = '' yield '%s' % genre yield '%s' % ( link, record['title'] ) if 'date' in record: date=record['date'] else: date='' if 'authors' in record: authors=record['authors'] else: authors='' yield '%s' % date yield '%s' % authors yield '' yield rating.showRating(recordId, imageSize='small') yield """ """ mods = any.getMods(metadata) url = any.createOpenURL(mods) coverUrl = getCoverUrlFor(record) if coverUrl: yield 'NO COVER AVAILABLE' %coverUrl else: yield '' if 'source' in record: source=record['source'] else: source='' yield '%s' %source yield """ """ # yield """ Locator \n""" % {'url' : url } def getCoverUrlFor(record): if 'issn' in record: return '%s/%s.gif' % (BASEURLJOURNALCOVERS, record['issn']) if 'isbn' in record: return 'http://syndetics.com/index.aspx?isbn=%s/sc.gif&client=univantilburg' % record['isbn'] def main(hits=None, duration=0, cqlQuery=None, httpQuery='', arguments={}, path='', *args, **kwargs): language = path.startswith('/en/') and 'en' or 'nl' offset = int(arguments.get('offset', ['0'])[0]) lo, hi = offset + 1, min(offset + 10, len(hits)) yield """
""" yield {'nl':'Resultaten %s - %s van %d (%.5s seconden).', 'en': 'Results %s - %s of %d (%.5s seconds).'}[language] % (lo, hi, len(hits), duration) yield """
""" yield paginate.main(offset, len(hits), arguments=arguments, path=path, *args, **kwargs) yield """
""" index = offset for recordId in hits[offset:offset+10]: ####### using the complete metadata record instead of only the mods part metadata = parse(any.getStream(recordId, 'metadata')) link = 'page/recordview?' + urlencode({ 'recordId': recordId}) index += 1 yield renderSingleItem(index, link, metadata, recordId) yield """
""" yield paginate.main(offset, len(hits), arguments=arguments, path=path, *args, **kwargs) yield """
"""