maposmatic/www/maposmatic/templates/maposmatic/maps.html

229 wiersze
9.7 KiB
HTML

{% extends "maposmatic/base.html" %}
{% comment %}
coding: utf-8
maposmatic, the web front-end of the MapOSMatic city map generation system
Copyright (C) 2012 David Decotigny
Copyright (C) 2012 Frédéric Lehobey
Copyright (C) 2012 Pierre Mauduit
Copyright (C) 2012 David Mentré
Copyright (C) 2012 Maxime Petazzoni
Copyright (C) 2012 Thomas Petazzoni
Copyright (C) 2012 Gaël Utard
Copyright (C) 2018 Hartmut Holzgraefe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n %}
{% load l10n %}
{% load extratags %}
{% block body-class %}maps{% endblock %}
{% block menu-maps %}active{% endblock %}
{% block title %}{% trans "Maps" %}{% endblock %}
{% block page %}
{% with maps as data %}
{% with form.cleaned_data.query as query %}
{% include "maposmatic/pagination.html" %}
{% endwith %}
{% endwith %}
<h1>{% trans "Maps" %}</h1>
<br style="clear: both;" />
{% for map in maps.object_list %}
<div class="span12 map map-status-{{ map.status }}">
<div class="card card-info">
<div class="card-header">
<a href="{% url "map-by-id" map.id %}">{{ map.maptitle|default:_("(*** untitled map ***)")}}</a>
</div>
<div class="container mt-3">
<div class="row">
<div class="col-9">
<table class="table table-striped" width="95%">
<tbody>
<tr>
{% if map.administrative_osmid %}
<td><strong>{% trans "City" %}</strong></td>
<td>{{ map.administrative_city }} ({{ map.administrative_osmid }})</td>
{% else %}
<td><strong>{% trans "Bounding Box" %}</strong></td>
<td>
{{ map.lat_upper_left|latitude }}, {{ map.lon_upper_left|longitude }}
&#8600; <!-- South-East-Arrow -->
{{ map.lat_bottom_right|latitude }}, {{ map.lon_bottom_right|longitude }}
&nbsp;&nbsp;&nbsp;({{ map|bbox_km }})
</td>
{% endif %}
</tr>
<tr><td><strong>{% trans "Layout" %}</strong></td><td>{{ map.layout }}</td></tr>
<tr><td><strong>{% trans "Stylesheet" %}</strong></td><td>{{ map.stylesheet }}</td></tr>
{% if map.overlay %}
<tr><td><strong>{% trans "Overlay(s)" %}</strong></td><td>{{ map.overlay|add_blank_after_comma }}</td></tr>
{% endif %}
{% if map.indexer %}
<tr><td><strong>{% trans "Indexer" %}</strong></td><td>{{ map.indexer }}</td></tr>
{% endif %}
{% if map.track %}
<tr><td><strong>{% trans "GPX track" %}</strong></td><td>{{ map.track|file_basename }}</td></tr>
{% endif %}
{% if map.umap %}
<tr><td><strong>{% trans "UMAP file" %}</strong></td><td>{{ map.umap|file_basename }}</td></tr>
{% endif %}
{% if map.uploads.all %}
<tr><td><strong>{% trans "Uploaded files" %}</strong></td><td>
{% for upload in map.uploads.all %}
<tt>{{ upload.uploaded_file|file_basename }}</tt> <em>({{ upload.file_type }}, {{ upload.uploaded_file.size|filesizeformat }})</em><br/>
{% endfor %}
</td></tr>
{% endif %}
<tr><td><strong>{% trans "Paper format" %}</strong></td><td>{{ map|paper_size }}</td></tr>
<tr><td><strong>{% trans "Map locale" %}</strong></td><td>{{ MAP_LANGUAGES|getitem:map.map_language }}</td></tr>
{% with date=map.submission_time|date:"DATETIME_FORMAT" %}
<tr><td><strong>{% trans "Request submitted" %}</strong></td><td title="{{ date }}">{% blocktrans with map.submission_time|timesince as since %}{{since}} ago{% endblocktrans %}</td></tr>
{% endwith %}
{% if map.is_rendering %}
{% with date=map.startofrendering_time|date:"DATETIME_FORMAT" duration=map.submission_time|timesince:map.startofrendering_time %}
<tr><td><strong>{% trans "Rendering started" %}</strong></td><td title="{{ date }}">{% blocktrans with map.startofrendering_time|timesince as since %}{{since}} ago{% endblocktrans %}, {% blocktrans %}after {{ duration}} in the queue{% endblocktrans %}</td></tr>
{% endwith %}
{% endif %}
{% if map.is_done or map.is_obsolete %}
{% with date=map.startofrendering_time|date:"DATETIME_FORMAT" duration=map.submission_time|timesince:map.startofrendering_time %}
<tr><td><strong>{% trans "Rendering started" %}</strong></td><td title="{{ date }}">{% blocktrans with map.startofrendering_time|timesince as since %}{{since}} ago{% endblocktrans %}, {% blocktrans %}after {{ duration}} in the queue{% endblocktrans %}</td></tr>
{% endwith %}
{% with date=map.endofrendering_time|date:"DATETIME_FORMAT" duration=map.startofrendering_time|timesince:map.endofrendering_time %}
<tr><td><strong>{% trans "Rendering completed" %}</strong></td><td title="{{ date }}">{% blocktrans with map.endofrendering_time|timesince as since %}{{since}} ago{% endblocktrans %}, {% blocktrans %}after {{ duration }} {% endblocktrans %}</td></tr>
{% endwith %}
{% endif %}
{% if map.is_cancelled %}
{% with map.endofrendering_time|date:"DATETIME_FORMAT" as date %}
<tr><td><strong>{% trans "Rendering cancelled" %}</strong></td><td>{{ date }}</td></tr>
{% endwith %}
{% endif %}
</tbody>
</table>
</div>
<div class="col-3">
{% if map.get_thumbnail %}
<img align="center" class="thumbnail" src="{{ map.get_thumbnail }}" />
{% endif %}
{% if map.needs_waiting and map.current_position_in_queue %}
<p class="queue-position">#{{ map.current_position_in_queue }}</p>
<p class="queue-name">{% trans "in queue:" %} {{ map.queue }}</p>
{% endif %}
</div>
</div>
<div class="row">
<div class="col-6">
{% if map.is_waiting %}
<a class="btn disabled tooltipped"
data-placement="top"
data-original-title="{% with map.submission_time|timesince as date %}
{% blocktrans %}Pending, submitted {{ date }} ago{% endblocktrans %}
{% endwith %}">
<i class="fas fa-hourglas"></i> {% trans "Pending..." %}
</a>
{% endif %}
{% if map.is_rendering %}
<a class="btn disabled tooltipped"
data-placement="top"
data-original-title="
{% with map.startofrendering_time|timesince:map.endofrendering_time as date %}
{% blocktrans %}Rendering is in progress, started {{ date }} ago{% endblocktrans %}
{% endwith %}">
<i class="fas fa-cogs"></i> {% trans "Rendering..." %}
</a>
{% endif %}
{% if map.is_done_ok and map.has_output_files %}
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="download_{{ map.id }}" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fas fa-download"></i> {% trans "Download" %}
</button>
<ul class="dropdown-menu" aria-labelledby="download_{{ map.id ]}">
{% for format,file in map.output_files.maps.items %}
<li><a class="dropdown-item" href="{{ file.0 }}" title="{{ file.1 }}">{{ format|upper }} {% trans "map" %} ({{ file.2|filesizeformat }})</a></li>
{% endfor %}
{% if map.output_files.indeces|length %}
<li class="divider"></li>
{% for format,file in map.output_files.indeces.items %}
<li><a class="dropdown-item" href="{{ file.0 }}" title="{{ file.1 }}">{{ format|upper }} {% trans "index" %}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
{% endif %}
{% if not map.is_done_ok and not map.needs_waiting %}
{% if map.get_errorlog %}
<a class="btn btn-large tooltipped"
href="{{map.get_errorlog}}"
target="_blank"
data-placement="right"
data-original-title="{% trans "Something went wrong while processing this job." %}">
<i class="fas fa-ban"></i> {% trans "Error log" %}
</a>
{% else %}
<a class="btn disabled tooltipped"
data-placement="top"
data-original-title="{{ map.status|job_status_to_str }}">
<i class="fas fa-ban"></i> {% trans "Download" %}
</a>
{% endif %}
{% endif %}
</div>
<div class="col-6">
<form class="form-horizontal pull-right" method="post" action="{% url "recreate" %}">
<input type="hidden" name="id" value="{{ map.id }}" />
<button class="btn btn-primary tooltipped"
data-original-title="{% trans "Recreate map" %}"
type="submit" {% if map.needs_waiting or not map.can_recreate %}disabled="disabled"{% endif %}>
<i class="fas fa-redo"></i> {% trans "Recreate" %}
</button>
</form>
</div>
</div>
</div>
</div>
</div>
{% empty %}
<p>
{% ifequal form.cleaned_data.query "" %}
{% blocktrans %}Our database does not contain any rendered maps for the moment.{% endblocktrans %}
{% else %}
{% blocktrans %}No map matches your query.{% endblocktrans %} <a href="{% url "new" %}">{% trans "Create a new map!" %}</a>
{% endifequal %}
</p>
{% endfor %}
{% with maps as data %}
{% with form.cleaned_data.query as query %}
{% include "maposmatic/pagination.html" %}
{% endwith %}
{% endwith %}
<div class="clearfix"></div>
{% endblock %}