diff --git a/.gitignore b/.gitignore index 20c9fa253..3148512dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,59 +1,59 @@ *.clisp.mem *.cmucl.core *.fas *.fasl *.kdev4 *.kdevelop *.kdevses *.lib *.pyc *.sbcl.core *.sse2f *.x86f *~ .coverage .kdev4/ .noseids .project .pydevproject .settings .version Invenio.egg-info Makefile Makefile.in TAGS aclocal.m4 autom4te.cache bower_components/ build compile compile config.cache config.guess config.log config.nice config.status config.status.lineno config.sub configure configure.lineno dist docs/_build docs/db docs/static dump.rdb install-sh instance/ invenio-autotools.conf invenio/base/translations/*/LC_MESSAGES/messages.mo missing node_modules/ org.eclipse.core.resources.prefs po/*.gmo po/*.mo po/*.sed po/POTFILES po/POTFILES-py po/POTFILES-webdoc po/stamp-po -tags +/tags diff --git a/invenio/modules/annotations/__init__.py b/invenio/modules/annotations/__init__.py index de5629230..9919a7f1f 100644 --- a/invenio/modules/annotations/__init__.py +++ b/invenio/modules/annotations/__init__.py @@ -1,58 +1,52 @@ # -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2014 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. """ +Annotations. - invenio.modules.annotations - --------------------------- +invenio.modules.annotations +--------------------------- - To enable the module, make sure to remove it from ``PACKAGES_EXCLUDE``, - where it is placed by default. +To enable the module, make sure to remove it from ``PACKAGES_EXCLUDE``, +where it is placed by default. - To enable Web page annotations, add the following to your templates: +To enable Web page annotations, add the following to your templates: - .. code-block:: jinja +.. code-block:: jinja - {%- from "annotations/macros.html" import annotations_toolbar, - annotations_js, - annotations_css -%} + {%- from "annotations/macros.html" import annotations_toolbar -%} - {%- block global_css -%} - {{ super() }} - {{ annotations_css() }} - {%- endblock global_css -%} + {%- block global_bundles -%} + {{ super() }} + {% bundle "30-annotations.js", "30-annotations.css" %} + {%- endblock global_javascript -%} - {%- block global_javascript -%} - {{ super() }} - {{ annotations_js() }} - {%- endblock global_javascript -%} + {%- block page_body -%} + {{ annotations_toolbar() }} + {{ super() }} + {%- endblock page_body -%} - {%- block page_body -%} - {{ annotations_toolbar() }} - {{ super() }} - {%- endblock page_body -%} +To enable document annotations, along with the previewer, set the following +configuration variables to ``True``: - To enable document annotations, along with the previewer, set the following - configuration variables to ``True``: +.. code-block:: python - .. code-block:: python - - ANNOTATIONS_NOTES_ENABLED = True - ANNOTATIONS_PREVIEW_ENABLED = True + ANNOTATIONS_NOTES_ENABLED = True + ANNOTATIONS_PREVIEW_ENABLED = True """ diff --git a/invenio/modules/annotations/templates/__init__.py b/invenio/modules/annotations/bundles.py similarity index 51% copy from invenio/modules/annotations/templates/__init__.py copy to invenio/modules/annotations/bundles.py index 0eab0f888..ae9322448 100644 --- a/invenio/modules/annotations/templates/__init__.py +++ b/invenio/modules/annotations/bundles.py @@ -1,18 +1,47 @@ # -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2014 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. + +"""Annotations bundles.""" + + +from invenio.ext.assets import Bundle + +from invenio.modules.previewer.bundles import pdfjs as _pdfjs +from invenio.modules.comments.bundles import (js as _commentsjs, + css as _commentscss) + + +_pdfjs.contents += ("js/annotations/pdf_notes_helpers.js",) + +_commentsjs.contents += ("js/annotations/notes_popover.js",) +_commentscss.contents += ("css/annotations/annotations.css",) + + +js = Bundle( + "plupload/moxie.js", + "plupload/plupload.dev.js", + "js/annotations/annotations.js", + "js/annotations/plupload_helper.js", + filters="uglifyjs", + output="gen/annotations.js", + name="30-annotations.js", + bower={ + "plupload": "latest" + } +) diff --git a/invenio/modules/annotations/templates/annotations/macros_base.html b/invenio/modules/annotations/templates/annotations/macros_base.html index f652e2809..1dd20073f 100644 --- a/invenio/modules/annotations/templates/annotations/macros_base.html +++ b/invenio/modules/annotations/templates/annotations/macros_base.html @@ -1,93 +1,80 @@ {# ## This file is part of Invenio. ## Copyright (C) 2014 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. #} {% from "_formhelpers.html" import render_field with context %} {% from "_macros.html" import flashed_messages %} {%- macro annotations_toolbar() -%} {%- endmacro -%} - -{%- macro annotations_js() -%} - {%- js 'plupload/plupload.full.min.js', '100-annotation' -%} - {%- js url_for('annotations.static', filename='js/annotations/annotations.js'), '100-annotation' -%} - {%- js url_for('annotations.static', filename='js/annotations/plupload_helper.js'), '100-annotation' -%} -{%- endmacro -%} - - -{%- macro annotations_css() -%} - {%- css url_for('annotations.static', filename='css/annotations/annotations.css'), '100-annotation' -%} -{%- endmacro -%} - - {%- macro add() -%} {{ flashed_messages() }}
{{ form.csrf_token }} {%- for field in form -%} {{ render_field(field) }} {%- endfor -%}
{% endmacro %} {%- macro view(annotations) -%} {%- if annotations.count() > 0 -%} {%- else -%} {{ _("This page has not been annotated yet.") }} {%- endif -%} {%- endmacro -%} diff --git a/invenio/modules/annotations/templates/annotations/notes_base.html b/invenio/modules/annotations/templates/annotations/notes_base.html index 9cdc31739..14c47f41d 100644 --- a/invenio/modules/annotations/templates/annotations/notes_base.html +++ b/invenio/modules/annotations/templates/annotations/notes_base.html @@ -1,43 +1,40 @@ {# ## This file is part of Invenio. ## Copyright (C) 2013, 2014 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. #} {%- extends "comments/base.html" -%} {%- import "annotations/notes_fragment.html" as nf -%} {%- from "previewer/pdf_base.html" import pdf_pane with context -%} -{%- if config.ANNOTATIONS_PREVIEW_ENABLED -%} - {%- css url_for('previewer.static', filename='css/previewer/pdf_viewer.css'), '20-previews' -%} -{%- endif -%} - -{%- js url_for('annotations.static', filename='js/annotations/notes_popover.js'), '10-comments' -%} -{%- if config.ANNOTATIONS_PREVIEW_ENABLED -%} - {%- js url_for('previews.static', filename='js/previewer/pdf_viewer.js'), '110-annos' -%} - {%- js url_for('annotations.static', filename='js/annotations/pdf_notes_helpers.js'), '110-annos' -%} -{%- endif -%} - +{%- block global_bundles -%} + {{ super() }} + {%- if config.ANNOTATIONS_PREVIEW_ENABLED -%} + {%- bundles "20-previewer.css", "20-previewer.js"} + {%- endif -%} + {%- bundles "10-comments.css", "30-annotations.js" -%} +{%- endblock -%} {%- block custom -%}
{%- if config.ANNOTATIONS_PREVIEW_ENABLED -%} {{ pdf_pane() }} {%- endif -%}
{{ nf.show_notes(current_user, recid, notes, note_is_collapsed, wash_html_id, get_note_title, get_original_comment) }}
{%- endblock custom -%} diff --git a/invenio/modules/comments/templates/comments/base_base.html b/invenio/modules/comments/templates/comments/base_base.html index 85ec9bd89..8ab122c68 100644 --- a/invenio/modules/comments/templates/comments/base_base.html +++ b/invenio/modules/comments/templates/comments/base_base.html @@ -1,132 +1,127 @@ {# ## This file is part of Invenio. ## Copyright (C) 2013, 2014 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. #} {% from "_macros.html" import js_bundle, css_bundle with context %} {%- if not request.is_xhr -%} {%- extends "records/base.html" -%} {%- endif -%} {% bundles "10-comments.js", "10-comments.css" %} -{# FIXME: This hack should be done from the annotations module itself. -{%- if config.ANNOTATIONS_NOTES_ENABLED -%} - {% css url_for('annotations.static', filename='css/annotations/annotations.css', '10-comments.css') %} -{%- endif -%} -#} {%- macro controls() -%}
{%- if option == 'comments' -%} {%- if current_user.is_guest -%} {%- else -%} {%- endif-%} {{ _('Add comment') }} {%- elif option == 'notes' and config.ANNOTATIONS_PREVIEW_ENABLED -%} {%- endif -%}   {%- if config.ANNOTATIONS_NOTES_ENABLED -%}
{%- if option == 'comments' -%} {%- else -%} {%- endif -%} {{ _('Comments') }} {%- if option == 'notes' -%} {%- else -%} {%- endif -%} {{ _('Annotations') }}
{%- endif -%}
{%- endmacro %} {%- block record_content -%} {%- from "_translate.html" import translate -%} {{ translate(["Page", "of", "Show all annotations", "Show page annotations"]) }} {%- block custom -%} {#{ controls() }#} {%- endblock custom -%}

{%- if record.user_comment_subscritions|length -%}
{%- set info_subs=_('%(open_tag)s Unsubscribe %(close_tag)s from this discussion. You will not receive any new comments by email.', open_tag=''|format(url_for('comments.unsubscribe', recid=recid))|safe, close_tag=''|safe) -%} {{ info_subs|safe }}
{%- else -%}
{%- set info_subs=_('%(open_tag)s Subscribe %(close_tag)s to this discussion. You will then receive all new comments by email.', open_tag=''|format(url_for('comments.subscribe', recid=recid))|safe, close_tag=''|safe) -%} {{ info_subs|safe }}
{%- endif -%} {%- endblock record_content -%} {%- if request.is_xhr -%} {{ css_bundle() }} {{ js_bundle() }} {%- endif -%} diff --git a/invenio/modules/annotations/templates/annotations/__init__.py b/invenio/modules/formatter/bundles.py similarity index 75% rename from invenio/modules/annotations/templates/annotations/__init__.py rename to invenio/modules/formatter/bundles.py index 0eab0f888..15fa2f344 100644 --- a/invenio/modules/annotations/templates/annotations/__init__.py +++ b/invenio/modules/formatter/bundles.py @@ -1,18 +1,30 @@ # -*- coding: utf-8 -*- -## ## This file is part of Invenio. ## Copyright (C) 2014 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. + +"""Formatter bundles.""" + +from invenio.ext.assets import Bundle + + +css = Bundle( + "css/formatter/templates_brief.css", + "css/formatter/templates_detailed.css", + output="gen/formatter.js", + name="60-formatter.css", + filters="cleancss" +) diff --git a/invenio/modules/annotations/templates/__init__.py b/invenio/modules/previewer/bundles.py similarity index 68% copy from invenio/modules/annotations/templates/__init__.py copy to invenio/modules/previewer/bundles.py index 0eab0f888..c08b73ad6 100644 --- a/invenio/modules/annotations/templates/__init__.py +++ b/invenio/modules/previewer/bundles.py @@ -1,18 +1,37 @@ # -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2014 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. + +"""Previewer bundles.""" + + +from invenio.ext.assets import Bundle + +pdfjs = Bundle( + "js/previewer/pdf_viewer.js", + filters="uglifyjs", + output="gen/previewer/pdf.js", + name="20-previewer-pdf.js" +) + +pdfcss = Bundle( + "css/previewer/pdf_viewer.css", + filters="cleancss", + output="gen/previewer/pdf.css", + name="20-previewer-pdf.css" +) diff --git a/invenio/modules/annotations/templates/__init__.py b/invenio/modules/search/bundles.py similarity index 64% copy from invenio/modules/annotations/templates/__init__.py copy to invenio/modules/search/bundles.py index 0eab0f888..681108c5a 100644 --- a/invenio/modules/annotations/templates/__init__.py +++ b/invenio/modules/search/bundles.py @@ -1,18 +1,31 @@ # -*- coding: utf-8 -*- -## ## This file is part of Invenio. ## Copyright (C) 2014 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. + +"""Search bundles.""" + +from invenio.base.bundles import invenio as _js, styles as _css + + +_js.contents += ('js/search/search_parser.js', + 'js/search/typeahead.js', + 'js/search/default_typeahead_configuration.js', + 'js/search/facet.js') + +_css.contents += ('css/typeahead.js-bootstrap.css', + 'css/search/search.css', + 'css/search/searchbar.css') diff --git a/invenio/modules/search/templates/search/search_base.html b/invenio/modules/search/templates/search/search_base.html index cd8554de6..cf72642ea 100644 --- a/invenio/modules/search/templates/search/search_base.html +++ b/invenio/modules/search/templates/search/search_base.html @@ -1,432 +1,430 @@ {# ## This file is part of Invenio. ## Copyright (C) 2012, 2014 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. #} {% extends "search/searchbar_frame.html" %} {% from "search/results.html" import render_search_results with context %} -{% block global_css %} +{% block global_bundles %} {{ super() }} - {%- css url_for('static', filename='css/formatter/templates_brief.css'), '00-search' -%} - {%- css url_for('static', filename='css/search/search.css'), '00-search' -%} - {%- js url_for('webtag.static', filename='js/tags/record_editor.js'), '00-search' -%} + {% bundles "60-formatter.css", "20-tags.js" %} {% endblock %} {%- set portalboxes = dict() -%} {%- for k,l in collection.portalboxes_ln|groupby('position') -%} {%- do portalboxes.update({k:l}) -%} {%- endfor -%} {% block title %} {{ portalboxes.tp }} {{ super() }} {{ portalboxes.te }} {% endblock %} {% block header %} {{ super() }} {%- set args = request.args.copy().to_dict() -%} {%- set jrec = (pagination.page-2)*pagination.per_page+1 if pagination.has_prev else 1 -%} {%- do args.update({'jrec': jrec}) -%} {%- if pagination.has_prev -%} {%- endif -%} {%- if pagination.has_next -%} {%- set jrec = (pagination.page)*pagination.per_page+1 if pagination.has_next else (pagination.pages-1)*pagination.per_page+1 -%} {%- do args.update({'jrec': jrec}) -%} {%- endif -%} {% endblock %} {%- block inner_content -%} {%- block index -%} {%- if not recids|length -%} {%- block index_noresult -%}

{{ _('Your search did not match any records. Please try again.') }}

{{ create_nearest_terms_box()|safe }}
{%- endblock index_noresult -%} {%- else -%} {%- block index_results -%}
{%- block facets %}
{%- endblock facets %} {%- block index_right -%}
{%- block facets_filter %}
{%- endblock facets_filter %} {%- block results %}
{%- block search_results -%} {{ render_search_results(recids, collection, pagination, format_record) }} {%- endblock search_results -%}
{%- endblock results %}
{%- endblock index_right -%}
{%- block filter_modal -%} {%- endblock filter_modal -%} {%- endblock index_results -%} {%- endif -%} {%- endblock index -%} {%- endblock -%} {% block javascript %} {{ super() }} {% if recids|length %} {% endif %} {% endblock %} diff --git a/invenio/modules/search/templates/search/searchbar_frame_base.html b/invenio/modules/search/templates/search/searchbar_frame_base.html index 015e607fd..d31458635 100644 --- a/invenio/modules/search/templates/search/searchbar_frame_base.html +++ b/invenio/modules/search/templates/search/searchbar_frame_base.html @@ -1,48 +1,33 @@ {# ## This file is part of Invenio. ## Copyright (C) 2012, 2014 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. #} {% from "search/helpers.html" import search_form_javascript with context %} {% extends "page.html" %} {# set title = collection.name_ln if collection.id > 1 else None #} -{% block header %} - {{ super() }} - {%- js url_for('static', filename='js/jquery-caret.js') -%} - {%- js url_for('static', filename='js/typeahead.js'), '10-invenio' -%} - {%- js url_for('search.static', filename='js/search/search_parser.js') -%} - {%- js url_for('search.static', filename='js/search/typeahead.js') -%} - {%- js url_for('search.static', filename='js/search/default_typeahead_configuration.js') -%} - {%- js url_for('search.static', filename='js/search/facet.js') -%} - {%- js url_for('static', filename='js/bootstrap-select.js') -%} -{# {% js url_for('static', 'js/jquery.hotkeys.js') %}#} -{# {% js url_for('search.static', filename='js/search/hotkeys.js') %}#} - - {%- css url_for('static', filename='css/typeahead.js-bootstrap.css'), '50-search' -%} - {%- css url_for('search.static', filename='css/search/searchbar.css'), '50-search' -%} -{% endblock %} {% block body %} {%- include "search/form/index.html" -%} {% block inner_content %}{% endblock %} {% endblock %} {% block javascript %} {{ super() }} {{ search_form_javascript(collection) }} {% endblock %} diff --git a/invenio/modules/annotations/templates/__init__.py b/invenio/modules/tags/bundles.py similarity index 77% rename from invenio/modules/annotations/templates/__init__.py rename to invenio/modules/tags/bundles.py index 0eab0f888..88f5b9ef3 100644 --- a/invenio/modules/annotations/templates/__init__.py +++ b/invenio/modules/tags/bundles.py @@ -1,18 +1,29 @@ # -*- coding: utf-8 -*- -## ## This file is part of Invenio. ## Copyright (C) 2014 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. + +"""Tags bundles.""" + +from invenio.ext.assets import Bundle + + +js = Bundle( + "js/tags/record_editor.js", + output="gen/tags.js", + name="20-tags.js", + filters="uglifyjs" # beautify couldn't do anything here ;-) +)