{# CODE UPDATED BY Francesco Mangiacrapa USE TO DEBUG {% print "role for user: "+role_for_user %} {% print "role for user:" +role_for_user %} {% print "username_id = "+username_id %} {% print "pkg_creator_user_id= "+pkg_creator_user_id %} #} {% extends "package/base.html" %} {% block subtitle %}{{ pkg.title or pkg.name }} - {{ super() }}{% endblock %} {% block head_extras -%} {{ super() }} {% set description = h.d4science_theme_markdown_extract_html(pkg.notes, extract_length=200)|forceescape %} {% endblock -%} {% block content_action %} {% if h.check_access('package_update', {'id':pkg.id }) %} {# CODE ADDED BY Francesco Mangiacrapa #} {% set hide = h.get_cookie_value('ckan_hide_header') %} {# INTO PORTAL - FROM D4SCIENCE PORTAL #} {% if hide and hide == 'true' %} {% set username_id = c.userobj.id %} {% set pkg_creator_user_id = pkg.creator_user_id %} {% set role_for_user = h.d4science_theme_get_user_role_for_group_or_org(pkg.organization.id, username_id) %} {% if role_for_user %} {% if role_for_user == 'admin' %} {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} {% else %} {% if role_for_user == 'editor' %} {# IF THE USER HAS ROLE EDITOR HE/SHE CAN EDIT ONLY ITS DATASET, see related ticket #5119 #} {% if username_id == pkg_creator_user_id %} {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} {% endif %} {% endif %} {# NOT SHOW 'Manage' #} {% endif %} {% endif %} {% else %} {% link_for _('Manage'), controller='package', action='edit', id=pkg.name, class_='btn', icon='wrench' %} {% endif %} {% endif %} {% endblock %} {% block content_primary_nav %} {{ h.build_nav_icon('dataset_read', _('Dataset'), id=pkg.name) }} {{ h.build_nav_icon('dataset_groups', _('Groups'), id=pkg.name) }} {% if h.check_access('package_update', {'id':pkg.id }) %} {% set role_for_user = h.d4science_theme_get_user_role_for_group_or_org(pkg.organization.id, c.userobj.name) %} {% if role_for_user and role_for_user == 'admin' %} {{ h.build_nav_icon('dataset_activity', _('Activity Stream'), id=pkg.name) }} {% endif %} {% endif %} {% endblock %} {% block primary_content_inner %} {% block package_revision_info %} {% if c.revision_date %}

{% set timestamp = h.render_datetime(c.revision_date, with_hours=True) %} {% set url = h.url(controller='package', action='read', id=pkg.name) %} {% trans timestamp=timestamp, url=url %}This is an old revision of this dataset, as edited at {{ timestamp }}. It may differ significantly from the current revision.{% endtrans %}

{% endif %} {% endblock %} {% endblock %} {% block secondary_content %} {% block secondary_help_content %}{% endblock %} {% block package_info %} {% snippet 'package/snippets/info.html', pkg=pkg %} {% endblock %} {% block package_organization %} {% if pkg.organization %} {% set org = h.get_organization(pkg.organization.name) %} {% snippet "snippets/organization.html", organization=org, has_context_title=true %} {% endif %} {% endblock %} {% block package_social %} {# See: #7055 {% snippet "snippets/social.html" %} #} {% endblock %} {% block package_license %} {% snippet "snippets/license.html", pkg_dict=pkg %} {% endblock %} {% endblock %}