Commit a712e35e authored by Merret Buurman's avatar Merret Buurman
Browse files

Added info on older version to cmip6 dataset landing page.

parent 6bf99474
......@@ -16,7 +16,8 @@ KEYS = dict(
data_node = 'HOSTING_NODE',
drs_id = 'DRS_ID',
vers_num = 'VERSION_NUMBER',
replaced_by = 'REPLACED_BY'
replaced_by = 'REPLACED_BY',
replaces = 'REPLACES'
)
......
......@@ -67,6 +67,9 @@ def get_version_number_from_record(record):
def get_replaced_by_from_record(record):
return _get_replaced_by_from_record(record)
def get_replaces_from_record(record):
return _get_replaces_from_record(record)
def get_hosts_original_from_record(record):
return _get_hosts_original_from_record(record)
......@@ -264,6 +267,11 @@ def _get_replaced_by_from_record(record):
handle = _remove_hdl_from_handle(value)
return handle
def _get_replaces_from_record(record):
value = get_value_from_record(record, KEYS['replaces'])
handle = _remove_hdl_from_handle(value)
return handle
def _get_hosts_original_from_record(record):
field_string = get_value_from_record(record, KEYS['data_node'])
parsed = _extract_url_info_from_field(field_string, XML_ATTRIBUTES['host'])
......
......@@ -42,6 +42,11 @@ def _get_context(json_record):
if val is not None:
context['newerversion'] = val
# older version
val = parser.get_replaces_from_record(json_record)
if val is not None:
context['olderversion'] = val
# hosts original
val = parser.get_hosts_original_from_record(json_record)
if val is not None:
......
......@@ -50,10 +50,7 @@
<div class="section">
<h2>General information</h2>
<table>
<!-- Newer version exists: Table with 2 columns: -->
{% if newerversion %}
<table>
{% if drs %}
<tr>
<td class="leftcol">DRS name</td>
......@@ -66,48 +63,50 @@
<td>{{version}}</td>
</tr>
{% endif %}
<tr>
<td class="leftcol">Persistent identifier</td>
<td>
<a href="http://hdl.handle.net/{{handle}}">hdl:{{handle}}</a>
<br/><br/>
<span class="note"><img height="20px" src="/lp/static/warning_cmip6_green_transparent.png"><strong>&nbsp;This dataset was replaced by a newer version.</strong> Please refer to the dataset's errata description to get more information. You can find information on the errata on the dataset's landing page or at the ESGF Errata Service.</span>
</td>
</tr>
<tr>
<td class="leftcol">Newer version</td>
<td>
<a href="http://hdl.handle.net/{{handle}}">hdl:{{newerversion}}</a>
<br/><br/>
<span class="note"><img height="20px" src="/lp/static/warning_cmip6_green_transparent.png"><strong>&nbsp;This is not necessarily the most recent version.</strong> Please refer to this version's landing page to find out if it has been replaced by an even newer version.</span>
</td>
</tr>
{% else %}
<!-- No newer version: Table with 2 columns: -->
{% if drs %}
<tr>
<td class="leftcol">DRS name</td>
<td>{{drs}}</td>
</tr>
{% endif %}
{% if version %}
<tr>
<td class="leftcol">Version number</td>
<td>{{version}}</td>
</tr>
{% endif %}
<tr>
<td class="leftcol">Persistent identifier</td>
<td><a href="http://hdl.handle.net/{{handle}}">hdl:{{handle}}</a></td>
</tr>
{% endif %}
<tr>
<td class="leftcol">Newer version</td>
<td>
<span>No information on newer versions found.<span>
</td>
</tr>
{% if newerversion %}
<tr>
<td class="leftcol">Persistent identifier</td>
<td>
<a href="http://hdl.handle.net/{{handle}}">hdl:{{handle}}</a>
<br/><br/>
<span class="note"><img height="20px" src="/lp/static/warning_cmip6_green_transparent.png"><strong>&nbsp;This dataset was replaced by a newer version.</strong> Please refer to the dataset's errata description to get more information. You can find information on the errata on the dataset's landing page or at the ESGF Errata Service.</span>
</td>
</tr>
<tr>
<td class="leftcol">Newer version</td>
<td>
<a href="http://hdl.handle.net/{{handle}}">hdl:{{newerversion}}</a>
<br/><br/>
<span class="note"><img height="20px" src="/lp/static/warning_cmip6_green_transparent.png"><strong>&nbsp;This is not necessarily the most recent version.</strong> Please refer to this version's landing page to find out if it has been replaced by an even newer version.</span>
</td>
</tr>
{% else %}
<tr>
<td class="leftcol">Persistent identifier</td>
<td><a href="http://hdl.handle.net/{{handle}}">hdl:{{handle}}</a></td>
</tr>
<tr>
<td class="leftcol">Newer version</td>
<td>
<span>No information on newer versions found.<span>
</td>
</tr>
{% endif %}
{% if olderversion %}
<tr>
<td class="leftcol">Older version</td>
<td>
<a href="http://hdl.handle.net/{{handle}}">hdl:{{olderversion}}</a>
</td>
</tr>
{% else %}
<tr>
<td class="leftcol">Older version</td>
<td>
<span>No information on older versions found.<span>
</td>
</tr>
{% endif %}
</table>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment