roundabout,
created on Sunday, 8 September 2024, 10:31:59 (1725791519),
received on Sunday, 8 September 2024, 10:58:33 (1725793113)
Author identity: vlad <vlad.muntoiu@gmail.com>
b75a2e055e92157b5400d374e89337549a145ffb
app.py
@@ -438,9 +438,12 @@ def picture(id):
image = Image.open(path.join(config.DATA_PATH, "pictures", str(resource.id)))
current_user = db.session.get(User, flask.session.get("username"))
have_permission = current_user and (current_user == resource.author or current_user.admin)
return flask.render_template("picture.html", resource=resource,
file_extension=mimetypes.guess_extension(resource.file_format),
size=image.size, copies=resource.copies)
size=image.size, copies=resource.copies, have_permission=have_permission)
templates/picture.html
@@ -14,17 +14,19 @@
<p>
<a href="{{ resource.origin_url }}">Original source</a> |
<a href="/raw/picture/{{ resource.id }}">View</a> |
<a href="/raw/picture/{{ resource.id }}" download="GigadataPicture_{{ resource.id }}{{ file_extension }}">Download</a> |
<a href="/picture/{{ resource.id }}/get-annotations">Download annotations</a> |
<a href="/raw/picture/{{ resource.id }}" download="GigadataPicture_{{ resource.id }}{{ file_extension }}">Download</a> {% if have_permission %}|
<a href="/picture/{{ resource.id }}/annotate">Annotate</a> |
<a href="/picture/{{ resource.id }}/put-annotations-form">Submit JSON annotations</a> |
<a href="/picture/{{ resource.id }}/get-annotations">Download annotations</a> |
<a href="/picture/{{ resource.id }}/edit-metadata">Edit title or description</a> |
<a href="/picture/{{ resource.id }}/copy">Copy</a>
<a href="/picture/{{ resource.id }}/edit-metadata">Edit title or description</a>{% endif %} {% if current_user %}|
<a href="/picture/{{ resource.id }}/copy">Copy</a>{% endif %}
</p>
<details>
<summary>Delete</summary>
<a href="/picture/{{ resource.id }}/delete">Delete</a>
</details>
{% if have_permission %}
<details>
<summary>Delete</summary>
<a href="/picture/{{ resource.id }}/delete">Delete</a>
</details>
{% endif %}
<div id="annotation-zone">
<img id="annotation-image" src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}">
{% for region in resource.regions %}