- {% block package_info_inner %}
- {% block heading %}
-
{{ h.dataset_display_name(pkg) }}
- {% endblock %}
- {% block nums %}
- {% set num_followers = h.follow_count('dataset', pkg.id) %}
-
-
- - {{ _('Followers') }}
- - {{ h.SI_number_span(num_followers) }}
-
-
- {% endblock %}
- {% block follow_button %}
- {% if not hide_follow_button %}
-
-
- {% endif %}
-{% endblock %}
+
+ {% endif %}
+ {% endblock %}
+
\ No newline at end of file
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/qrcdode_show.html b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/qrcdode_show.html
new file mode 100644
index 0000000..a0ec361
--- /dev/null
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/qrcdode_show.html
@@ -0,0 +1,6 @@
+{% set qr_code_image = h.d4science_get_qrcode_for_url(package_url) %}
+{% block package_qrcode_for_url %}
+
+{% endblock %}
+
+
\ No newline at end of file
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resource_item.html b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resource_item.html
index 31d1c56..0f668fc 100644
--- a/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resource_item.html
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resource_item.html
@@ -1,82 +1,108 @@
-{#
- Renders a single resource with icons and view links.
-
- res - A resource dict to render
- pkg - A package dict that the resource belongs to
- can_edit - Whether the user is allowed to edit the resource
- url_is_edit - Whether the link to the resource should be to editing it (set to False to make the link view the resource)
- url - URL of the resource details page(resource edit/read depending on url_is_edit, by default).
-
- Example:
-
- {% snippet "package/snippets/resource_item.html", res=resource, pkg=pkg, can_edit=True, url_is_edit=False %}
-
-#}
-{% set url_action = pkg.type ~ ('_resource.edit' if url_is_edit and can_edit else '_resource.read') %}
-{% set url = url or h.url_for(url_action, id=pkg.name, resource_id=res.id) %}
-
+{% set can_edit = h.check_access('package_update', {'id':pkg.id }) %}
+{% set url_action = 'resource_edit' if url_is_edit and can_edit else 'resource_read' %}
+{# {% set url = h.url_for(controller='package', action=url_action, id=pkg.name, resource_id=res.id) %} #}
+{% set url = h.url_for('dataset_resource.read', id=pkg.name, resource_id=res.id) %}
+{# Added by Francesco Mangiacrapa block custom_view_on_resources see:4851 #}
+{% block custom_view_on_resources %}
+{% set user = c.user %}
+{% if user %}
{% block resource_item_title %}
- {{ h.resource_display_name(res) | truncate(50) }}{{ h.get_translated(res, 'format') }}
- {{ h.popular('views', res.tracking_summary.total, min=10) if res.tracking_summary }}
+ {{ h.resource_display_name(res) | truncate(50) }}{{ res.format }}
+ {{ h.popular('views', res.tracking_summary.total, min=10) }}
{% endblock %}
{% block resource_item_description %}
{% if res.description %}
- {{ h.markdown_extract(h.get_translated(res, 'description'), extract_length=80) }}
+ {{ h.markdown_extract(res.description, extract_length=80) }}
{% endif %}
{% endblock %}
{% block resource_item_explore %}
{% if not url_is_edit %}
+ {# Only if can edit, explorer button is shown with several facility #}
+ {% if can_edit %}
+ {% else %}
+
+ {{ _('Go to resource') }}
+
+ {% endif %}
{% endif %}
{% endblock %}
+{% else %}
+ {% block resource_item_title2 %}
+ {# Updated by Francesco Mangiacrapa, see: #10056 #}
+
+ {{ h.resource_display_name(res) | truncate(50) }}{{ res.format }}
+ {{ h.popular('views', res.tracking_summary.total, min=10) }}
+
+ {% endblock %}
+
+{% endif %}
+{% endblock %}
+
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resources_list.html b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resources_list.html
index 9c6dd63..3ab3b78 100644
--- a/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resources_list.html
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/templates/package/snippets/resources_list.html
@@ -1,37 +1,77 @@
-{#
+{#
Renders a list of resources with icons and view links.
-
- resources - A list of resources (dicts) to render
- pkg - A package dict that the resources belong to.
-
+
+ resources - A list of resources to render
+ pkg - A package object that the resources belong to.
+
Example:
-
- {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
-
+
+ {% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
+
#}
-
-
- {{ _('Data and Resources') }}
- {% block resource_list %}
- {% if resources %}
-
- {% block resource_list_inner %}
- {% set can_edit = can_edit or h.check_access('package_update', {'id':pkg.id }) %}
- {% for resource in resources %}
- {% snippet 'package/snippets/resource_item.html', pkg=pkg, res=resource, can_edit=can_edit %}
- {% endfor %}
- {% endblock %}
-
- {% else %}
- {% block resource_list_empty %}
- {% if h.check_access('resource_create', {'package_id': pkg['id']}) %}
- {% trans url=h.url_for(pkg.type ~ '_resource.new', id=pkg.name) %}
- This dataset has no data, why not add some?
- {% endtrans %}
- {% else %}
- {{ _('This dataset has no data') }}
- {% endif %}
- {% endblock %}
+
+
+
+
+ {{ _('Data and Resources') }}
+ {% set user = c.user %}
+ {# Added by Francesco Mangiacrapa #10389 #}
+ {% if not user %}
+ To access the resources you must log in
{% endif %}
- {% endblock %}
-
+ {# end #}
+ {% block resource_list %}
+ {% if resources %}
+
+ {% block resource_list_inner %}
+ {% for resource in resources %}
+ {% snippet 'package/snippets/resource_item.html', pkg=pkg, res=resource %}
+ {% endfor %}
+ {% endblock %}
+
+ {% else %}
+ {% if h.check_access('resource_create', {'package_id': pkg['id']}) %}
+ {% trans url=h.url_for(controller='package', action='new_resource', id=pkg.name) %}
+ This dataset has no data, why not add some?
+ {% endtrans %}
+ {% else %}
+ {{ _('This dataset has no data') }}
+ {% endif %}
+ {% endif %}
+ {% endblock %}
+
+
\ No newline at end of file
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/package_item.html b/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/package_item.html
index 801d9c8..0e16bed 100644
--- a/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/package_item.html
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/package_item.html
@@ -1,70 +1,139 @@
{#
-Displays a single of dataset.
-
-package - A package to display.
-item_class - The class name to use on the list item.
-hide_resources - If true hides the resources (default: false).
-
-Example:
-
- {% snippet 'snippets/package_item.html', package=c.datasets[0] %}
-
-#}
-{% set title = package.title or package.name %}
-{% set notes = h.markdown_extract(package.notes, extract_length=180) %}
-
-{% block package_item %}
+ Displays a single of dataset.
+
+ package - A package to display.
+ item_class - The class name to use on the list item.
+ hide_resources - If true hides the resources (default: false).
+ banner - If true displays a popular banner (default: false).
+ truncate - The length to trucate the description to (default: 180)
+ truncate_title - The length to truncate the title to (default: 80).
+
+ Example:
+
+ {% snippet 'snippets/package_item.html', package=c.datasets[0] %}
+
+ #}
+
+ {% set truncate = truncate or 180 %}
+ {% set truncate_title = truncate_title or 80 %}
+ {% set title = package.title or package.name %}
+ {% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}
+
+
+ {#
+ {% resource 'd4science_theme/custom.css' %}
+ CHANGED BY FRANCESCO.MANGIACRAPA
+ #}
+
+ {% block package_item_content %}
+
+ {% if package.private and not h.can_read(package) %}
- {% block content %}
- {% block heading %}
-
- {% block heading_private %}
- {% if package.private %}
-
-
- {{ _('Private') }}
-
- {% endif %}
- {% endblock %}
- {% block heading_title %}
-
- {{title|truncate(80)}}
-
- {% endblock %}
- {% block heading_meta %}
- {% if package.get('state', '').startswith('draft') %}
- {{ _('Draft') }}
- {% elif package.get('state', '').startswith('deleted') %}
- {{ _('Deleted') }}
- {% endif %}
- {{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
- {% endblock %}
-
- {% endblock %}
- {% block notes %}
- {% if notes %}
-
{{ notes|urlize }}
- {% else %}
-
{{ h.humanize_entity_type('package', package.type, 'no description') or _("There is no description for this dataset") }}
+
+ {% if package.private and not h.can_read(package) %}
+
+
+ {{ _('Private') }}
+
{% endif %}
- {% endblock %}
-
- {% block resources %}
- {% if package.resources and not hide_resources %}
- {% block resources_outer %}
-
- {% block resources_inner %}
- {% for resource in h.dict_list_reduce(package.resources, 'format') %}
- -
- {{ resource }}
-
- {% endfor %}
- {% endblock %}
-
- {% endblock %}
+
+
+
+ {% if package.private and not h.can_read(package) %}
+ {# {{ _(h.truncate(title, truncate_title)) }} #}
+ Dataset
+
+ {{ h.acquire_button(package) }}
+ {% else %}
+ {# {{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }} #}
+ {{ h.link_to(h.truncate(title, truncate_title), url_for('dataset.read', id=package.name)) }}
+ {% endif %}
+
+
+ {% if package.get('state', '').startswith('draft') %}
+ {{ _('Draft') }}
+ {% elif package.get('state', '').startswith('deleted') %}
+ {{ _('Deleted') }}
+ {% endif %}
+ {{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
+
+ {% if banner %}
+ {{ _('Popular') }}
{% endif %}
- {% endblock %}
- {% endblock %}
+ {% if notes %}
+
+ {% endif %}
+
+ {% endif %}
+ {% endblock %}
\ No newline at end of file
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/tag_list.html b/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/tag_list.html
index 77f753e..52c9c8d 100644
--- a/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/tag_list.html
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/templates/snippets/tag_list.html
@@ -13,7 +13,7 @@
diff --git a/ckanext-d4science_theme/ckanext/d4science_theme/validators.py b/ckanext-d4science_theme/ckanext/d4science_theme/validators.py
new file mode 100644
index 0000000..0168c54
--- /dev/null
+++ b/ckanext-d4science_theme/ckanext/d4science_theme/validators.py
@@ -0,0 +1,24 @@
+import ckan.plugins.toolkit as toolkit
+from logging import getLogger
+
+log = getLogger(__name__)
+
+def ignore_duplicate_keys(key, data, errors, context):
+ """
+ Validator che consente chiavi duplicate negli extras.
+ """
+ # Estrarre gli extras dalla richiesta
+ log.debug("controllo extra (data) %s", data)
+ extras = data.get(key, [])
+
+ # Log per il debugging
+ log.debug(f"Contenuto di 'data' per la chiave '{key}': {extras} (tipo: {type(extras)})")
+
+ # Se ci sono duplicati, evita di sollevare un'eccezione
+ if isinstance(extras, list): # Verifica che extras sia una lista
+ log.debug(f"Ignorando chiave duplicata: {extra['key']}")
+ else:
+ log.debug(f"Errore: 'extras' non è una lista, ma è di tipo {type(extras)}")
+
+ ## Mantieni la lista aggiornata, che consente chiavi duplicate
+ #data[key] = extras
\ No newline at end of file
diff --git a/ckanext-d4science_theme/requirements.txt b/ckanext-d4science_theme/requirements.txt
index 55f2a9b..0e23e19 100644
--- a/ckanext-d4science_theme/requirements.txt
+++ b/ckanext-d4science_theme/requirements.txt
@@ -1,3 +1,4 @@
webhelpers2
xmltodict
pyqrcode
+sqlalchemy
diff --git a/ckanext-d4science_theme/setup.py b/ckanext-d4science_theme/setup.py
index d3a3ba1..a616430 100644
--- a/ckanext-d4science_theme/setup.py
+++ b/ckanext-d4science_theme/setup.py
@@ -69,8 +69,7 @@ setup(
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
include_package_data=True,
- package_data={
- },
+ #package_data={},
# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages.