feature/private_dataset_integration #2
|
@ -18,47 +18,108 @@
|
|||
{% set truncate_title = truncate_title or 80 %}
|
||||
{% set title = package.title or package.name %}
|
||||
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}
|
||||
<!-- TODO: remove this comments after implementing privateDatasets
|
||||
{% set acquired = h.is_dataset_acquired(package) %}
|
||||
{% set owner = h.is_owner(package) %} -->
|
||||
{% set owner = h.is_owner(package) %}
|
||||
|
||||
{# {% resource 'd4science_theme/privatedatasets.css' %}#}
|
||||
|
||||
{#
|
||||
{% resource 'd4science_theme/custom.css' %}
|
||||
CHANGED BY FRANCESCO.MANGIACRAPA
|
||||
#}
|
||||
|
||||
{% block package_item_content %}
|
||||
<!--Added by Francesco Mangiacrapa, See #6569, #7544, #8032, #8127 -->
|
||||
{#
|
||||
{{ package.extras }}
|
||||
#}
|
||||
|
||||
{% block toolbar %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<script type="text/javascript" >
|
||||
|
||||
flinktogateway = function (event, orgTitle) {
|
||||
|
||||
var myDiv = document.getElementById("d4s_modal-div");
|
||||
var clickPosition = CKAN_D4S_Functions_Util.getPosition(myDiv, event)
|
||||
var myPosition = JSON.parse(clickPosition);
|
||||
//console.log('msg')
|
||||
|
||||
var mypopup = document.getElementById("myD4SModal");
|
||||
mypopup.style.display = "block";
|
||||
|
||||
var offset = myDiv.offsetHeight? myDiv.offsetHeight/2 : 0;
|
||||
myDiv.style.top = (myPosition.posY - Number(offset))+"px";
|
||||
|
||||
// Get the <span> element that closes the modal
|
||||
var span = document.getElementById("d4s_span_modal");
|
||||
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
span.onclick = function() {
|
||||
mypopup.style.display = "none";
|
||||
}
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function(event) {
|
||||
if (event.target == myD4SModal) {
|
||||
mypopup.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
var myPopupContent = document.getElementById("d4s_p_content");
|
||||
var msgComplete = "This {{ _('dataset') }} is private to the VRE: <b>"+orgTitle+"</b>.<br/>You can request access to VREs using 'Explore Virtual Research Environments'";
|
||||
|
||||
if(window.linktogateway != null)
|
||||
myPopupContent.innerHTML= msgComplete + " <a target=\"_blank\" href="+window.linktogateway+">Go to Explore...</a>";
|
||||
else {
|
||||
myPopupContent.innerHTML= msgComplete;
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
{% if package.private and not h.can_read(package) %}
|
||||
<li class="{{ item_class or "dataset-item" }}">
|
||||
<div class="dataset-content">
|
||||
<!-- The Modal -->
|
||||
<div id="myD4SModal" class="d4s_modal">
|
||||
<!-- Modal content -->
|
||||
<div id="d4s_modal-div" class="d4s_modal-content">
|
||||
<h3>Access required...</h3>
|
||||
<span id="d4s_span_modal" class="d4s_close">×</span>
|
||||
<p id="d4s_p_content"></p>
|
||||
</div>
|
||||
</div>
|
||||
{% set orgTitle = package.organization.title %}
|
||||
<div class="dataset-content d4s_div_clickable" onclick="flinktogateway(event, '{{orgTitle}}')" title="This {{ _('dataset') }} is private to the VRE: {{package.organization.title}}. You can request access to VREs using 'Explore Virtual Research Environments'">
|
||||
<div class="show_meatadatatype">
|
||||
{% set mvalue = h.d4science_theme_get_systemtype_value_from_extras(package, package.extras) %}
|
||||
{% set mcolor = h.d4science_get_color_for_type(mvalue) %}
|
||||
<span class="button__badge" style="color: {{ mcolor }}">{{ mvalue }}</span>
|
||||
</div>
|
||||
<h3 class="dataset-heading">
|
||||
{% if package.private and not h.can_read(package) %}
|
||||
<span class="dataset-private label label-inverse">
|
||||
<i class="icon-lock"></i>
|
||||
{{ _('Private') }}
|
||||
</span>
|
||||
{{ _(h.truncate(title, truncate_title)) }}
|
||||
{% endif %}
|
||||
<!-- TODO: remove this comments after implementing privateDatasets
|
||||
{% if acquired and not owner %}
|
||||
<span class="dataset-private label label-acquired">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
{{ _('Acquired') }}
|
||||
</span>
|
||||
{% endif %} -->
|
||||
|
||||
{% endif %}
|
||||
<!-- Customizations Acquire Button -->
|
||||
{% if package.private and not h.can_read(package) %}
|
||||
{# {{ _(h.truncate(title, truncate_title)) }} #} <!-- THIS IS PACKAGE TITLE -->
|
||||
Dataset
|
||||
{# {{ _(h.truncate(title, truncate_title)) }} Dataset#} <!-- THIS IS PACKAGE TITLE -->
|
||||
<div class="divider"/>
|
||||
{{ 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)) }}
|
||||
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='package', action='read', id=package.name)) }}
|
||||
{% endif %}
|
||||
<!-- End of customizations Acquire Button -->
|
||||
|
||||
|
||||
{% if package.get('state', '').startswith('draft') %}
|
||||
<span class="label label-info">{{ _('Draft') }}</span>
|
||||
{% elif package.get('state', '').startswith('deleted') %}
|
||||
|
@ -70,13 +131,18 @@
|
|||
<span class="banner">{{ _('Popular') }}</span>
|
||||
{% endif %}
|
||||
{% if notes %}
|
||||
<!-- <div>{{ notes|urlize }}</div>--><!-- THIS IS PACKAGE DESCRIPTION -->
|
||||
<div style="word-wrap:break-word;">{{ notes|urlize(70,target='_blank') }}</div><!-- THIS IS PACKAGE DESCRIPTION -->
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="{{ item_class or "dataset-item" }}">
|
||||
<div class="dataset-content">
|
||||
<div class="show_meatadatatype">
|
||||
{% set mvalue = h.d4science_theme_get_systemtype_value_from_extras(package, package.extras)%}
|
||||
{% set mcolor = h.d4science_get_color_for_type(mvalue) %}
|
||||
<span class="button__badge" style="color: {{ mcolor }}">{{ mvalue }}</span>
|
||||
</div>
|
||||
<h3 class="dataset-heading">
|
||||
{% if package.private and not h.can_read(package) %}
|
||||
<span class="dataset-private label label-inverse">
|
||||
|
@ -84,7 +150,6 @@
|
|||
{{ _('Private') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
<!-- TODO: remove this comments after implementing privateDatasets
|
||||
{% if acquired and not owner %}
|
||||
<span class="dataset-private label label-acquired">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
|
@ -96,19 +161,19 @@
|
|||
<i class="icon-user"></i>
|
||||
{{ _('Owner') }}
|
||||
</span>
|
||||
{% endif %} -->
|
||||
|
||||
{% endif %}
|
||||
|
||||
<!-- Customizations Acquire Button -->
|
||||
{% if package.private and not h.can_read(package) %}
|
||||
{{ _(h.truncate(title, truncate_title)) }}
|
||||
<div class="divider"/>
|
||||
{{ 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)) }}
|
||||
{# CHANGED BY FRANCESCO MANGIACRAPA #}
|
||||
{{ h.link_to(h.truncate(title, truncate_title), h.url_for(controller='dataset', action='read', id=package.name)) }}
|
||||
{% endif %}
|
||||
<!-- End of customizations Acquire Button -->
|
||||
|
||||
|
||||
{% if package.get('state', '').startswith('draft') %}
|
||||
<span class="label label-info">{{ _('Draft') }}</span>
|
||||
{% elif package.get('state', '').startswith('deleted') %}
|
||||
|
@ -120,20 +185,36 @@
|
|||
<span class="banner">{{ _('Popular') }}</span>
|
||||
{% endif %}
|
||||
{% if notes %}
|
||||
<div>{{ notes|urlize }}</div>
|
||||
<div style="word-wrap:break-word;">{{ notes|urlize(70,target='_blank') }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if package.resources and not hide_resources %}
|
||||
<ul class="dataset-resources unstyled">
|
||||
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
|
||||
<li>
|
||||
{# <a href="{{ h.url_for(controller='package', action='read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a> #}
|
||||
<a href="{{ url_for('dataset.read', id=package.name) }}" class="label" data-format="{{ resource.lower() }}">{{ resource }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{# CHANGED BY FRANCESCO MANGIACRAPA, see: #7055 #}
|
||||
<ul class="dataset-resources unstyled">
|
||||
{% for resource in package.resources %}
|
||||
{% set resource_format = resource.format %}
|
||||
{# TO INTERNAL RESOURCE PAGE set url = h.url_for(controller='package', action='resource_read', id=package.name, resource_id=resource.id) #}
|
||||
<li>
|
||||
|
||||
{% if c.userobj %}
|
||||
{# USER IS LOGGED #}
|
||||
{# CHANGED BY FRANCESCO MANGIACRAPA #11178 #}
|
||||
<a href="{{ resource.url }}" target="_blank" title="{{ resource.name or resource.description }}" class="label" data-format="{{ resource_format.lower() }}">{{ resource_format }}</a>
|
||||
{% else %}
|
||||
{# CHANGED BY FRANCESCO MANGIACRAPA #12377 #}
|
||||
<a class="label" href="javascript:CKAN_D4S_Functions_Util.showPopupD4S(null, 'myPopup_{{resource.id}}');" title="{{ resource.name or resource.description }}" class="label" data-format="{{ resource.format.lower() }}">{{ resource.format }}</a>
|
||||
<div class="popupD4SNoArrow" style="display: inline;" onclick="CKAN_D4S_Functions_Util.showPopupD4S(event, 'myPopup_{{resource.id}}')">
|
||||
<span class="popuptext" id="myPopup_{{resource.id}}">The resource: '{{ h.resource_display_name(resource) | truncate(30) }}' is not accessible as guest user. You must login to access it!</span>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue