Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion publications/templates/authenticated_menu_snippet.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class="nav-item dropdown">
<a class="nav-link dropdown" href="#"id="navbarDarkDropdown" role="button" data-toggle="dropdown" aria-expanded="false">
<a class="nav-link dropdown" href="#" id="navbarDarkDropdown" role="button" data-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-circle-user fa-3x"></i>
</a>
<ul class="dropdown-menu dropdown-menu-right"
Expand Down
26 changes: 25 additions & 1 deletion publications/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

Expand All @@ -21,7 +22,30 @@
<script src="{% static 'js/jquery-3.4.1.slim.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>

{% block head %}{% endblock %}
{{ block.super }}

<!-- RSS feed autodiscovery -->
<link
rel="alternate"
type="application/rss+xml"
title="OPTIMAP Geo RSS"
href="{% url 'optimap:georss_feed' %}"
/>
<!-- Atom feed autodiscovery -->
<link
rel="alternate"
type="application/atom+xml"
title="OPTIMAP Geo Atom"
href="{% url 'optimap:geoatom_feed' %}"
/>
<!-- JSON feed autodiscovery -->
<link
rel="alternate"
type="application/xml"
title="OPTIMAP W3C Geo Feed"
href="{% url 'optimap:w3cgeo_feed' %}"
/>
{% endblock head %}

<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}" />
</head>
Expand Down
94 changes: 47 additions & 47 deletions publications/templates/feeds.html
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
{% extends "base.html" %} {% block content %}
{% extends "base.html" %}
{% block title %}Feeds | {% endblock title %}

{% block content %}
<div class="container px-4 py-8 max-w-3xl text-wrap">

<h1 class="text-3xl mb-6 py-4">Predefined Feeds</h1>
<h1 class="text-3xl mb-6 py-4">OPTIMAP feeds</h1>

{% if global_feeds %}
<h2 class="text-2xl mb-4">General feeds</h2>
<p>Subscribe to research works from all sources, time periods, and regions.</p>
<ul class="list-disc list-inside mb-8">
{% for feed in global_feeds %}
<li>
<a href="{{ feed.url }}" class="text-blue-600 hover:underline">
{{ feed.title }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}

<h2 class="text-2xl mb-4">Global region feeds</h2>
<p>Subscribe to research works from all sources and time periods for selected regions.</p>
<ul class="list-disc list-inside space-y-2 mb-8">
{% for region in regions %}
<li class="flex flex-wrap items-center space-x-2">
<strong>{{ region.name }}</strong>
<span>({{ region.get_region_type_display }})</span>:<br>

<p class="lead">Follow your favourite countinent or ocean with these predefined feeds.</p>
<a href="{% url 'optimap:feed-georss-by-slug' region.name|slugify %}"
class="text-blue-600 hover:underline"
title="GeoRSS for {{ region.name }}">GeoRSS</a>
<span>|</span>

<a href="{{% url 'optimap:feed-geoatom-by-slug' region.name|slugify %}"
class="text-blue-600 hover:underline"
title="Atom for {{ region.name }}">GeoAtom</a>

<ul class="list-disc list-inside space-y-2">
{% for region in regions %}
<li class="flex flex-wrap items-center space-x-2">
<strong>{{ region.name }}</strong> ({{ region.get_region_type_display }}):

{# GeoRSS feed link #}
<a
href="{% url 'optimap:feed-georss-by-slug' region.name|slugify %}"
class="text-blue-600 hover:underline"
title="GeoRSS feed for {{ region.name }}"
>
GeoRSS
</a>
<span>|</span>

{# Atom feed link #}
<a
href="{% url 'optimap:feed-geoatom-by-slug' region.name|slugify %}"
class="text-blue-600 hover:underline"
title="Atom feed for {{ region.name }}"
>
GeoAtom
</a>

<small class="text-gray-500">
(updated {{ region.last_loaded|date:"Y-m-d H:i" }})
</small>
</li>
<small class="text-gray-500">(updated {{ region.last_loaded|date:"Y-m-d H:i" }})</small>
</li>
{% endfor %}
</ul>

<strong class="font-semibold mt-8 mb-4">Sources &amp; Licenses</strong>

<ul class="list-disc list-inside space-y-2 text-sm text-gray-700">
<span class="mt-8 mb-4">Sources &amp; licenses for region data:</span>
<ul class="list-inline text-sm text-gray-700">
{% for region in regions %}
<li class="flex items-center space-x-2">
<span class="flex-shrink-0"></span>
<a
href="{{ region.source_url }}"
title="Source for geospatial extent of {{ region.name }}"
target="_blank"
class="flex-1 min-w-0 truncate text-blue-600 hover:underline"
>
{{ region.name }}
</a>
<span class="flex-shrink-0">(<a href="{{ region.license }}">license URL</a>)</span>
</li>
<li class="list-inline-item flex mr-0">
<a href="{{ region.source_url }}"
class="flex-1 min-w-0 truncate text-blue-600 hover:underline"
target="_blank"
title="Source for {{ region.name }}">{{ region.name|safe }}</a>&nbsp;<span>(<a href="{{ region.license }}">license</a>)</span>
{% if not forloop.last %}, {% endif %}
</li>
{% endfor %}
</ul>

</div>
{% endblock %}
{% endblock content %}
2 changes: 1 addition & 1 deletion publications/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a class="px-2 text-white" title="Privacy information / Datenschutzerklärung" href="{% url 'optimap:privacy' %}">Privacy</a>
<a class="px-2 text-white" title="Accessibility / Barrierefreiheit" href="{% url 'optimap:accessibility' %}">Accessibility</a>
<a class="px-2 text-white" title="Data & API documentation and browser" href="{% url 'optimap:data' %}">Data & API</a>
<a class="px-3 text-white" title="Feeds" href="{% url 'optimap:feeds_list' %}">Feeds</a>
<a class="px-3 text-white" title="Feeds" href="{% url 'optimap:feeds' %}">Feeds</a>
<a class="px-2 text-white" title="Link to source code project" href="https://github.com/GeoinformationSystems/optimap">Code&nbsp;(v{{ optimap_version }})</a>
<a class="px-2 text-white" title="About / Contact / Imprint" href="{% url 'optimap:about' %}">About / Contact / Imprint</a>
<span class="px-3">Data license: <a class="text-white" title="Publication metadata license" href='https://creativecommons.org/publicdomain/zero/1.0/'>CC-0</a></span>
Expand Down
8 changes: 5 additions & 3 deletions publications/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
{% load static %}

{% block head %}
<!-- Leaflet-->

{{ block.super }}

<!-- Leaflet-->
<link rel="stylesheet" href="{% static 'css/leaflet.css' %}" />
{# <script type="text/javascript" src="https://unpkg.com/vis-timeline@latest/standalone/umd/vis-timeline-graph2d.min.js"></script> #}
<script src="{% static 'js/leaflet.js' %}"></script>
{% endblock %}

{% endblock head %}

{% block navbar %}

Expand Down
5 changes: 3 additions & 2 deletions publications/templates/subscriptions.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% extends "base.html" %}
{% load static %}

{% block head %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css" integrity="sha512-mSYUmp1HYZDFaVKK//63EcZq4iFWFjxSL+Z3T/aCt4IO9Cejm03q3NKKYN6pFQzY0SBOr8h+eCIAZHPXcpZaNw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static 'css/main.css' %}" />
{% endblock %}
{% endblock head %}

{% block navbar %}

Expand All @@ -16,7 +17,7 @@
{% endif %}
</ul>

{% endblock %}
{% endblock navbar %}

{% block content %}
<div id="accordion">
Expand Down
3 changes: 2 additions & 1 deletion publications/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView
from publications.api import router as publications_router
from publications.api import router as publications_router


app_name = "optimap"
Expand Down Expand Up @@ -47,10 +48,10 @@
path("subscriptions/", views.user_subscriptions, name="subscriptions"),
path("unsubscribe/", views.unsubscribe, name="unsubscribe"),
path("usersettings/", views.user_settings, name="usersettings"),
path("feeds/", views.feeds, name="feeds"),
path("feeds/georss/<slug:geometry_slug>/",
GeoFeedByGeometry(feed_type_variant="georss"), name="feed-georss-by-slug",),
path("feeds/geoatom/<slug:geometry_slug>/",
GeoFeedByGeometry(feed_type_variant="geoatom"), name="feed-geoatom-by-slug"),
path("feeds/", views.feeds_list, name="feeds_list"),

]
27 changes: 16 additions & 11 deletions publications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@
from django.views.decorators.cache import never_cache
from django.urls import reverse
import uuid
from django.contrib.gis.serializers import geojson
from django.http import JsonResponse
from django.utils import timezone
from django.utils.timezone import now, get_default_timezone
from django.utils.timezone import get_default_timezone
from datetime import datetime
import imaplib
import time
from math import floor
from urllib.parse import unquote
from django.conf import settings
from django.core.serializers import serialize
from publications.models import BlockedEmail, BlockedDomain, Subscription, UserProfile, Publication, GlobalRegion
from django.contrib.auth import get_user_model
User = get_user_model()
import tempfile, os, glob
import tempfile, os
from pathlib import Path
from publications.tasks import regenerate_geojson_cache, regenerate_geopackage_cache
from osgeo import ogr, osr
Expand Down Expand Up @@ -527,6 +523,20 @@ def finalize_account_deletion(request):
del request.session[USER_DELETE_TOKEN_PREFIX]
request.session.modified = True

def feeds(request):
global_feeds = [
{ "title": "Geo RSS", "url": reverse("optimap:georss_feed") },
{ "title": "Geo Atom", "url": reverse("optimap:geoatom_feed") },
{ "title": "W3C Geo", "url": reverse("optimap:w3cgeo_feed") },
]

regions = GlobalRegion.objects.all().order_by("region_type", "name")

return render(request, "feeds.html", {
"global_feeds": global_feeds,
"regions": regions,
})

class RobotsView(View):
http_method_names = ['get']
def get(self, request):
Expand All @@ -536,8 +546,3 @@ def get(self, request):
)
return response

def feeds_list(request):
regions = GlobalRegion.objects.all().order_by("region_type", "name")
return render(request,
"feeds.html",
{"regions": regions})