Display RSS links to journal articles, in one or several
categories, or to the whole journal (if 'cc' parameter is used).
Note about 'cc': if we want an RSS of *all* articles (whathever
the category is), either we build an RSS url to each of the
categories/collections of the journal, or we simply link to the
main collection ('cc') of the journal (which implies that journal
categories exist as sub-collections of 'cc'). The second option is
preferred.
@param categories: comma-separated list of journal categories that will be linked from this RSS. If 'all', use all. If empty, try to use current category.
@param label: label of the RSS link
@param rss_icon_url: if provided, display the RSS icon in front of the label
@param rss_icon_width: if provided, declared width for the RSS icon
@param rss_icon_height: if provided, declared height for the RSS icon
@param cc: if provided, use as root collection for the journal, and ignore 'categories' parameter.
@param css_class: CSS class of the RSS link.
"""
args=parse_url_string(bfo.user_info['uri'])
category_name=args["category"]
journal_name=args["journal_name"]
ln=bfo.lang
_=gettext_set_language(ln)
ifcc:
categories=[]
elifcategories.lower()=='all':
categories=get_journal_categories(journal_name)
elifnotcategoriesandcategory_name:
categories=[category_name]
else:
categories=categories.split(',')
# Build the query definition for selected categories. If a
# category name can a match collection name, we can simply search
# in this collection. Otherwise we have to search using the query
# definition of the category.
# Note that if there is one category that does not match a
# collection name, we have to use collections queries for all
# categories (we cannot display all records of a collection +
# apply search constraint on other collections)
collections=[]
pattern=[]
must_use_pattern=False
forcategoryincategories:
dbquery=get_category_query(journal_name,category)
ifdbquery:
pattern.append(dbquery)
res=None
ifnotmust_use_pattern:
res=run_sql("SELECT name FROM collection WHERE dbquery=%s",
(dbquery,))
ifres:
collections.append(res[0][0])
else:
# Could not find corresponding collection. Maybe
# replace '980__a' by 'collection'?
ifnotmust_use_pattern:
res=run_sql("SELECT name FROM collection WHERE dbquery=%s",