{# # This file is part of Invenio. # Copyright (C) 2012, 2014, 2015 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #} {% macro render_search_pagination(pagination) %}{%- block render_search_pagination scoped -%} {%- set args = request.args.copy().to_dict() -%} {%- set form_args = request.form.copy().to_dict() -%} {%- if form_args|length() and 'filter' in form_args -%} {%- do form_args.pop('filter') -%} {%- do args.update(form_args) -%} {%- set hash_tag = '#'+request.form.get('filter','') -%} {%- else -%} {%- set hash_tag = '' -%} {%- endif -%} {%- if pagination.pages > 1 -%} {%- endif -%} {% endblock %}{% endmacro %} {% macro results_actions() %}{%- block results_actions scoped -%}
{% if current_user.precached_usebaskets %} {% endif %}
{% endblock %}{% endmacro %} {% macro render_search_results(recids, collection, pagination, format_record) %}{%- block render_search_results scoped -%}
{%- block search_results_header scoped %} {{ results_actions() }} {% block search_result_nb_recs scoped %}
{% endblock search_result_nb_recs %} {% block search_result_settings scoped %}
{%- set args = request.values.copy().to_dict() -%} {%- set form_args = request.form.copy().to_dict() -%} {%- if form_args|length() and 'filter' in form_args -%} {%- do form_args.pop('filter') -%} {%- do args.update(form_args) -%} {%- endif -%} {%- set new_args = args.copy() -%} {% block search_result_settings_sort scoped %}
{%- if 'sf' not in new_args -%}{%- do new_args.update({'sf': config.CFG_BIBSORT_DEFAULT_FIELD}) -%}{%- endif -%} {%- set current_sf = new_args.get('sf') -%} {%- set current_so = new_args.get('so', config.CFG_BIBSORT_DEFAULT_FIELD_ORDER)-%} {%- set so_alternative = 'd' if current_so == 'a' else 'a' -%} {%- set used_args = new_args.copy() -%} {%- do used_args.update({'so': so_alternative}) -%} {{ _('Sort by') }} {%- do new_args.pop('sf', None) -%} {%- if 'so' not in new_args -%}{%- do new_args.update({'so': 'a'}) -%}{%- endif -%}
{%- endblock search_result_settings_sort %} {%- block search_result_settings_display scoped %}
{{ _('Display') }}
{%- endblock search_result_settings_display %}
{%- endblock search_result_settings %}
{%- endblock search_results_header %} {%- block search_results scoped -%} {%- for recid in recids -%}{% set recordloop = loop %}{%- block search_result scoped -%} {%- if of[0] == 'h' -%}
{%- block search_result_prefix scoped -%}
{%- endblock search_result_prefix -%} {%- block search_result_record scoped -%}
{{ format_record(recid, of, ln=g.ln, qid=qid, extra_context=dict(collection=collection))|safe }} {{ '
'|safe if not recordloop.last }}
{%- endblock search_result_record -%}
{%- else -%} {%- block search_result_record_nohtml scoped %} {{ format_record(recid, of, ln=g.ln, extra_context=dict(collection=collection)) }} {%- endblock search_result_record_nohtml %} {%- endif -%} {%- endblock search_result -%} {%- endfor -%} {%- endblock search_results -%} {%- block search_results_footer scoped %}
{{ results_actions() }} {%- block search_results_export scoped -%}
{%- endblock search_results_export -%} {%- block search_results_pagination scoped -%}
{{ render_search_pagination(pagination) }}
{%- endblock search_results_pagination -%}
{%- endblock search_results_footer %}
{% for category, msg in get_flashed_messages(with_categories=True, category_filter=['search-results-after']) %} {{ msg|safe }} {% endfor %} {% endblock %}{% endmacro %} {% if not request.is_xhr %} {% extends 'search/searchbar_frame.html' %} {% block body %} {{ render_search_results(recids, collection, pagination, format_record) }} {% endblock %} {% else %} {{ render_search_results(recids, collection, pagination, format_record) }} {% endif %}