From 4125e471523db66a54ec0062b8ce3712c15a2033 Mon Sep 17 00:00:00 2001 From: Emanuel Dima Date: Mon, 7 Apr 2014 18:56:29 +0200 Subject: [PATCH 1/2] original invenio file --- .../format_templates/Default_HTML_brief.tpl | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 invenio/templates/format_templates/Default_HTML_brief.tpl diff --git a/invenio/templates/format_templates/Default_HTML_brief.tpl b/invenio/templates/format_templates/Default_HTML_brief.tpl new file mode 100644 index 0000000000..8ddf8ed257 --- /dev/null +++ b/invenio/templates/format_templates/Default_HTML_brief.tpl @@ -0,0 +1,142 @@ +{% macro render_record_footer(number_of_displayed_authors) %} +

+ {% if record.get('number_of_authors', 0) > 0 %} + by + {% set authors = record.get('authors[:].full_name', []) %} + {% set sep = joiner("; ") %} + {% for full_name in authors[0:number_of_displayed_authors] %} {{ sep() }} + + {{ full_name }} + + {% endfor %} + {% if record.get('number_of_authors', 0) > number_of_displayed_authors %} + {{ sep() }} + + {{ _(' et al') }} + + {% endif %} + + | + {% endif %} + {{ record['creation_date']|invenio_format_date() }} + {# Citations link #} + {%- if config.CFG_BIBRANK_SHOW_CITATION_LINKS -%} + {%- set num_citations = record['_cited_by_count'] -%} + {%- if num_citations -%} + | + + + {{ _("%i citations") % num_citations if num_citations > 1 else _("1 citation") }} + + {%- endif -%} + {%- endif -%} + + {# Comments link #} + {%- if config.CFG_WEBCOMMENT_ALLOW_COMMENTS and config.CFG_WEBSEARCH_SHOW_COMMENT_COUNT -%} + {%- set num_comments = record['_number_of_comments'] -%} + {%- if num_comments -%} + | + + + {{ _("%i comments") % num_comments if num_comments > 1 else _("1 comment") }} + + {%- endif -%} + {%- endif -%} + + {# Reviews link #} + {%- if config.CFG_WEBCOMMENT_ALLOW_REVIEWS and config.CFG_WEBSEARCH_SHOW_REVIEW_COUNT -%} + {%- set num_reviews = record['_number_of_reviews'] -%} + {%- if num_reviews -%} + | + + + {{ _("%i reviews") % num_reviews if num_reviews > 1 else _("1 review") }} + + {%- endif -%} + {%- endif -%} + + | {{ _("Similar records") }} + + {% if record['keywords']|length %} | + {% for keyword in record['keywords'] %} + + + {{ keyword['term'] }} + + + {% endfor %} + {% endif %} + + {# WebTags #} + {{ tfn_webtag_record_tags(record['recid'], current_user.get_id())|prefix('|') }} +

+ {% if record.get('number_of_authors', 0) > number_of_displayed_authors %} + {% set sep = joiner("; ") %} + + {% endif %} +{% endmacro %} + +{% macro render_fulltext_snippets() %} + {{ tfn_get_fulltext_snippets(record['recid'], request.args['p'], current_user) | wrap(prefix='

', suffix='

') }} +{% endmacro %} + +{% macro record_info() %} + {{ bfe_primary_report_number(bfo, prefix=' ') }} + {{ bfe_additional_report_numbers(bfo, prefix=' ', + separator=' ') }} + + {{ bfe_publi_info(bfo, prefix='| ') }} + {{ bfe_doi(bfo, prefix='| ') }} + {# ' %(doi)s'|format(doi=record['doi']) if record.get('doi') #} + +{% endmacro %} + +{% block record_brief %} +
+ {{ bfe_fulltext(bfo, show_icons="yes", prefix='', focus_on_main_file="yes") }} + {% block record_header %} +

+ + {{ record.get('title.title', '') }} + {{- record.get('title.volume', '')|prefix(', ') }} + {{- record.get('title.subtitle', '')|prefix(': ') }} + {{- record.get('edition_statement', '')|prefix('; ') }} + +

+ {% endblock %} + {% block record_content %} +
+

+ {{ record.get('abstract.summary', '')|sentences(3) }} +

+ +

+ {{ record_info() }} +

+
+ {% endblock %} + +
+ {% block fulltext_snippets %} + {{ render_fulltext_snippets() }} + {% endblock %} + + {% block record_footer %} + {{ render_record_footer(4) }} + {% endblock %} +
+{% endblock %} From e03431e436f55c17875587b902b3298f6d104c44 Mon Sep 17 00:00:00 2001 From: Emanuel Dima Date: Mon, 7 Apr 2014 19:55:32 +0200 Subject: [PATCH 2/2] fixed #213 --- deployment/deploy_overlay-rh.sh | 2 +- invenio/lib/bibformat_elements/bfe_fulltext.py | 10 ++++------ invenio/lib/bibformat_elements/bfe_fulltext_mini.py | 12 ++++++------ .../format_templates/Default_HTML_brief.tpl | 4 +++- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/deployment/deploy_overlay-rh.sh b/deployment/deploy_overlay-rh.sh index 0fadd43e30..36f3b09fc2 100755 --- a/deployment/deploy_overlay-rh.sh +++ b/deployment/deploy_overlay-rh.sh @@ -25,7 +25,7 @@ if [ -f /opt/invenio/lib/python/invenio/bibfield_functions/is_type_isbn_issn_uni fi # add invenio-specific overlay -cp -vf invenio/templates/* /opt/invenio/etc/templates/ +cp -vrf invenio/templates/* /opt/invenio/etc/templates/ cp -vrf invenio/lib/* /opt/invenio/lib/python/invenio/ cp -vrf invenio/etc/* /opt/invenio/etc/ cp -vrf invenio/var/* /opt/invenio/var/ diff --git a/invenio/lib/bibformat_elements/bfe_fulltext.py b/invenio/lib/bibformat_elements/bfe_fulltext.py index 50f768eed8..4912fe3536 100644 --- a/invenio/lib/bibformat_elements/bfe_fulltext.py +++ b/invenio/lib/bibformat_elements/bfe_fulltext.py @@ -78,7 +78,7 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi style = 'class="'+style+'"' if show_icons.lower() == 'yes': - file_icon = '%s' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s' % _("Download fulltext") else: file_icon = '' @@ -87,11 +87,11 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi additional_str = '' if additionals: - additional_str = ' (%s)' % _("additional files") + additional_str = ' (%s)' % _("additional files") versions_str = '' #if old_versions: - #versions_str = ' (%s)' % _("older versions") + #versions_str = ' (%s)' % _("older versions") if main_urls: out = [] @@ -177,8 +177,6 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi out += separator.join(url_list) if others_urls: - external_link = len(others_urls) == 1 and _('external link') or _('external links') - out += '%s: ' % external_link.capitalize() url_list = [] for url, descr in others_urls: url_list.append(''+ \ @@ -275,7 +273,7 @@ def get_files(bfo, distinguish_main_and_additional_files=True, include_subformat ## This format should be hidden. continue - descr = _("Fulltext") + descr = filename if complete_url.has_key('y'): descr = complete_url['y'] if descr == 'Fulltext': diff --git a/invenio/lib/bibformat_elements/bfe_fulltext_mini.py b/invenio/lib/bibformat_elements/bfe_fulltext_mini.py index c70ec039af..0c6abc65f3 100644 --- a/invenio/lib/bibformat_elements/bfe_fulltext_mini.py +++ b/invenio/lib/bibformat_elements/bfe_fulltext_mini.py @@ -69,10 +69,10 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi if len(main_urls.keys()) == 1 and len(main_urls.items()[0][1]) == 1 and \ (not CFG_CERN_SITE or len(cern_urls) == 0) and len(others_urls) == 0 and \ show_icons.lower() == 'yes': - file_icon = '%s
' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s
' % _("Download fulltext") elif show_icons.lower() == 'yes': - file_icon = '%s' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s' % _("Download fulltext") else: file_icon = '' @@ -110,10 +110,10 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi if len(main_urls.keys()) == 0 and \ len(cern_urls) == 1 and len(others_urls) == 0 and \ show_icons.lower() == 'yes': - file_icon = '%s
' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s
' % _("Download fulltext") elif show_icons.lower() == 'yes': - file_icon = '%s' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s' % _("Download fulltext") else: file_icon = '' @@ -130,9 +130,9 @@ def format_element(bfo, style, separator='; ', show_icons='no', focus_on_main_fi if len(main_urls.keys()) == 0 and \ (not CFG_CERN_SITE or len(cern_urls) == 0) and len(others_urls) == 1 and \ show_icons.lower() == 'yes': - file_icon = '%s
' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s
' % _("Download fulltext") elif show_icons.lower() == 'yes': - file_icon = '%s' % (CFG_SITE_URL, _("Download fulltext")) + file_icon = '%s' % _("Download fulltext") else: file_icon = '' external_link = len(others_urls) == 1 and _('external link') or _('external links') diff --git a/invenio/templates/format_templates/Default_HTML_brief.tpl b/invenio/templates/format_templates/Default_HTML_brief.tpl index 8ddf8ed257..a6a3c29401 100644 --- a/invenio/templates/format_templates/Default_HTML_brief.tpl +++ b/invenio/templates/format_templates/Default_HTML_brief.tpl @@ -107,7 +107,9 @@ {% block record_brief %}
- {{ bfe_fulltext(bfo, show_icons="yes", prefix='', focus_on_main_file="yes") }} + {{ bfe_fulltext(bfo, show_icons="yes", + prefix='', focus_on_main_file="yes", separator="
  • ") }} {% block record_header %}