aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/fileset_view.html
blob: e4d7b687d03dce619d8926fb272e88790cc95492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{% set fileset = entity %}
{% set entity_view = "overview" %}
{% import "entity_macros.html" as entity_macros %}
{% extends "entity_base.html" %}

{% macro file_mimetype_icon(mimetype) -%}
  {%- if not mimetype -%}file outline
  {%- elif mimetype in ["application/pdf"] -%}file pdf outline
  {%- elif mimetype in ["application/x-hdf"] -%}database
  {%- elif mimetype in ["text/csv", "text/tab-separated-values"] -%}table
  {%- elif mimetype in ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] -%}table
  {%- elif mimetype in ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] -%}file alternate outline
  {%- elif mimetype in ["application/zip", "application/gzip", "application/x-tar", "application/x-rar", "application/x-bzip2"] -%}file archive outline
  {%- elif mimetype in ["application/octet-stream"] -%}save outline
  {%- elif mimetype.startswith("text/") -%}file alternate outline
  {%- elif mimetype.startswith("image/") -%}file image outline
  {%- elif mimetype.startswith("video/") -%}film
  {%- else -%}file outline{% endif %}
{%- endmacro %}

{% block entity_main %}

<div class="ui stackable mobile reversed grid centered">
<div class="column" style="font-size: 16px; flex: 1;">

<h3>Associated Releases</h3>
{% if entity.releases != [] %}
  {{ entity_macros.release_list(entity.releases) }}
{% else %}
  <p>
  This File Set is not associated with any fatcat release.
{% endif %}

<h3>Public Access URLs</h3>
{% if entity.urls %}
  {{ entity_macros.url_list(entity.urls) }}
{% else %}
No known public URL, mirror, or archive for this File Set.
{% endif %}

{% set fileset_vars = namespace(archiveorg_base=None, webarchiveorg_base=None) %}
{% for u in (entity.urls or []) %}
  {% if u.rel in ["archive-base"] %}
    {% set fileset_vars.archiveorg_base = u.url %}
  {% elif u.rel in ["webarchive-base"] %}
    {% set fileset_vars.webarchiveorg_base = u.url %}
  {% endif %}
{% endfor %}

<h3>File Manifest ({{ fileset.manifest|count }})</h3>
{% if fileset.manifest %}
<table class="ui compact single line table">
  <thead>
    <tr>
      <th class="collapsing"></th>
      <th>Path</th>
      <th>Type</th>
      <th>Size</th>
      <th class="collapsing"></th>
    </tr>
  </thead>
  <tbody>
    {% for file in fileset.manifest %}
    <tr>
      <td><i class="{{ file_mimetype_icon(file.mimetype) }} icon" style="font-size: x-large;"></i></td>
      <td>
        <b><code>{{ file.path }}</code></b>
        <br><div style="color: #666; margin-left: 0em;"><small>
        {% if file.sha1 %}  sha1:{{ file.sha1 }}<br>
        {% elif file.sha256 %}sha256:{{ file.sha256 }}<br>
        {% elif file.md5 %}   md5:{{ file.md5 }}<br>
        {% endif %}
        </small></div>
      </td>
      <td>{% if file.mimetype %}<code style="font-size: smaller;">{{ file.mimetype }}</code>{% endif %}</td>
      <td>{{ file.size|filesizeformat }}</td>
      <td>
        {% if fileset_vars.archiveorg_base %}
          <a href="{{ fileset_vars.archiveorg_base }}/{{ file.path }}">[archive.org]</a><br>
        {% endif %}
        {% if fileset_vars.webarchiveorg_base %}
          <a href="{{ fileset_vars.webarchiveorg_base }}/{{ file.path }}">[web.archive.org]</a><br>
        {% endif %}
        {% if file.extra and file.extra.original_url %}
          <a href="{{ file.extra.original_url }}">[platform]</a><br>
        {% endif %}
        {% if file.extra and file.extra.webarchive_url%}
          <a href="{{ file.extra.webarchive_url }}">[web.archive.org]</a><br>
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% else %}
<p>This File Set is empty (contains no files).
{% endif %}


</div>
<div class="column" style="flex: 0 0 24em;">

{% if fileset._total_size != None %}
<div class="ui segment attached">
  <p><b>Total Size</b> &nbsp;{{ fileset._total_size|filesizeformat }}
</div>
{% endif %}

{{ entity_macros.fatcat_bits(entity, "fileset", "", editgroup) }}

</div>
</div>

{% endblock %}