1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
sql = context.select_tb_publications_ethz
#result = sql(owner=owner_publications,category=int(publication_category),year=publication_year)
result = sql(owner=owner_publications,category=publication_category,year=publication_year)
category = publication_category
year = publication_year
out_tmpl = """<li style="background-position:0px 8px; list-style-type:none; background-image:url(../../img/arrow-small-right.gif); background-repeat:no-repeat; border-bottom:1px dashed #cccccc; padding:5px 0px 5px 10px;">%s</li>"""
dicts = result.dictionaries()
if not len(dicts):
return "There is no entry for that section."
#out_tb = []
out = []
if category == "%":
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'], item['fd_journal'], item['fd_volume'], item['fd_issue'], item['fd_pages'], item['fd_doi'], item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_journal', 'fd_volume', 'fd_issue', 'fd_pages', 'fd_doi', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_journal'] = d['fd_journal'] and "<i>%s</i>" % d['fd_journal' ] or ""
d['fd_issue'] = d['fd_issue'] and "(%s)" % d['fd_issue' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "1": #Journal Article
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'], item['fd_journal'], item['fd_volume'], item['fd_issue'], item['fd_pages'], item['fd_doi'], item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_journal', 'fd_volume', 'fd_issue', 'fd_pages', 'fd_doi', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_journal'] = d['fd_journal'] and "<i>%s</i>" % d['fd_journal' ] or ""
d['fd_issue'] = d['fd_issue'] and "(%s)" % d['fd_issue' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "2": # Book
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'], item['fd_volume'], item['fd_editors'], item['fd_issn'], item['fd_publishing_house'], item['fd_location'],item['fd_pages'],item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_volume', 'fd_editors', 'fd_issn', 'fd_publishing_house', 'fd_location', 'fd_pages', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_title'] = d['fd_title'] and "<i>%s</i>" % d['fd_title' ] or ""
d['fd_volume'] = d['fd_volume'] and "Vol. %s" % d['fd_volume' ] or ""
d['fd_editors'] = d['fd_editors'] and "(ed. %s)" % d['fd_editors' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "3": #Research Reort
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'], item['fd_issue'], item['fd_publishing_house'], item['fd_location'], item['fd_pages'], item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_issue', 'fd_publishing_house', 'fd_location', 'fd_pages', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_title'] = d['fd_title'] and "%s" % d['fd_title' ] or ""
d['fd_issue'] = d['fd_issue'] and "No. %s" % d['fd_issue' ] or ""
d['fd_volume'] = d['fd_volume'] and "s" % d['fd_volume' ] or ""
d['fd_editors'] = d['fd_editors'] and "%s" % d['fd_editors' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "4": # paper in proceeding volume
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'],item['fd_volume'], item['fd_editors'], item['fd_issn'], item['fd_publishing_house'], item['fd_location'], item['fd_pages'], item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_volume', 'fd_editors', 'fd_issn', 'fd_publishing_house', 'fd_location', 'fd_pages', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_subtitle'] = d['fd_subtitle'] and "In: <i>%s</i>" % d['fd_subtitle' ] or ""
d['fd_volume'] = d['fd_volume'] and "Vol. %s" % d['fd_volume' ] or ""
d['fd_editors'] = d['fd_editors'] and "(ed. %s)" % d['fd_editors' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "5": # Chapter in Book
#out.append(out_tmpl %(item['fd_author'], item['fd_year'], item['fd_title'], item['fd_subtitle'], item['fd_volume'], item['fd_editors'], item['fd_issn'], item['fd_publishing_house'], item['fd_location'],item['fd_pages'],item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_volume', 'fd_editors', 'fd_issn', 'fd_publishing_house', 'fd_location', 'fd_pages', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_title'] = d['fd_title'] and "%s" % d['fd_title' ] or ""
d['fd_subtitle'] = d['fd_subtitle'] and "In: <i>%s</i>" % d['fd_subtitle' ] or ""
d['fd_volume'] = d['fd_volume'] and "Vol. %s" % d['fd_volume' ] or ""
d['fd_editors'] = d['fd_editors'] and "(ed. %s)" % d['fd_editors' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "6": # Poster and Oral Presentation
#out.append(out_tmpl %(item['fd_author'], item['fd_title'], item['fd_conference'], item['fd_year'], item['fd_mounth'], item['fd_day'], item['fd_location'], item['fd_type']))
fields = ['fd_author', 'fd_title', 'fd_conference', 'fd_year', 'fd_mounth', 'fd_day', 'fd_location', 'fd_journal', 'fd_volume', 'fd_issue', 'fd_pages']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>, " % d['fd_author' ] or ""
d['fd_title'] = d['fd_title'] and "<i>%s</i>, " % d['fd_title' ] or ""
d['fd_conference'] = d['fd_conference'] and "%s, " % d['fd_conference' ] or ""
d['fd_year'] = d['fd_year'] and "%s"% d['fd_year' ] or ""
d['fd_mounth'] = d['fd_mounth'] and "-%s" % d['fd_mounth' ] or ""
d['fd_day'] = d['fd_day'] and "-%s" % d['fd_day' ] or ""
d['fd_location'] = d['fd_location'] and ", %s" % d['fd_location' ] or ""
d['fd_journal'] = d['fd_journal'] and ", %s" % d['fd_journal' ] or ""
d['fd_volume'] = d['fd_volume'] and ", %s" % d['fd_volume' ] or ""
d['fd_issue'] = d['fd_issue'] and ", %s" % d['fd_issue' ] or ""
d['fd_pages'] = d['fd_pages'] and ", %s" % d['fd_pages' ] or ""
out.append(out_tmpl % "".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
if category == "7": # Anything else
#out.append(out_tmpl %(item['fd_author'], item['fd_title'], item['fd_subtitle'], item['fd_editors'],item['fd_publishing_house'], item['fd_location'], item['fd_volume'], item['fd_issue'], item['fd_pages'], item['fd_url']))
fields = ['fd_author', 'fd_year', 'fd_title', 'fd_subtitle', 'fd_editors', 'fd_publishing_house', 'fd_location', 'fd_volume', 'fd_issue', 'fd_pages', 'fd_url']
for d in dicts:
d['fd_author'] = d['fd_author'] and "<b>%s</b>" % d['fd_author' ] or ""
d['fd_title'] = d['fd_title'] and "<i>%s</i>" % d['fd_title' ] or ""
d['fd_editors'] = d['fd_editors'] and "(ed. %s)" % d['fd_editors' ] or ""
d['fd_volume'] = d['fd_volume'] and "Vol. %s" % d['fd_volume' ] or ""
d['fd_issue'] = d['fd_issue'] and "(%s)" % d['fd_issue' ] or ""
out.append(out_tmpl % ", ".join(["<span>%s</span>" % d[k] for k in fields if d[k]]))
return """<ul style="margin:0px;">%s</ul>""" %"\n".join(out) |
Partager