index-scons.html 6.85 KB
Newer Older
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Index of {{filename|default("/", True)}}</title>
  {%- for stylesheet in stylesheets %}
  <link rel="stylesheet" type="text/css" href="{{stylesheet}}">
  {%- endfor %}
  {%- for script in scripts %}
  <script src="{{script}}"></script>
  {%- endfor %}
</head>
<body vocab="http://activearchives.org/terms/" typeof="mediafolder">
    <h1 class="breadcrumbs">{% for b in breadcrumbs %}
        {%- if not loop.last -%}
        <a href="{{b.relpath}}">
        {%- else -%}
        <b class="active" property="dcterms:title" content="{% if title %}{{title}}{%else%}{{b.name|filename2title}}{%endif%}">
        {%- endif -%}
        {%- if b.name == "/" -%}&blacktriangle;{%- else -%}{{b.name|filename2title}}{%endif%}
        {%- if not loop.last -%}</a> /{%- else -%} </b>{%endif%}
      {% endfor %}
    </h1>
    <div class="description" property="dcterms:description">{% if description %}{{description|markdown|add_attribute_to_links("property", "hasTag")}}{% endif %}</div>
    <!-- <h1>{{filename|default("/", True)}}</h1> -->
{% set colcount = 5 %}
{% with items=contents %}
<table>
  <thead>
    <tr>
      <th valign="top">&nbsp;</th>
      <th>Name</th>
      <th>Last modified</th>
      <th>Size</th>
      {% if 'pages' in allkeys %}<th>Pages</th>{% set colcount=colcount+1 %}{% endif %}
      {# {% if 'title' in allkeys %}<th>Title</th>{% set colcount=colcount+1 %}{% endif %} #}
      {# {% if 'author' in allkeys %}<th>Author</th>{% set colcount=colcount+1 %}{% endif %} #}
      {% if 'duration' in allkeys %}<th>Duration</th>{% set colcount=colcount+1 %}{% endif %}
      <th>Description</th>
     </tr>
     <tr><td colspan="{{ colcount }}"><hr></td></tr>
   </thead>
   <tbody class="files">
{% for i in items %}
{% if i.type != 'file' %}
  <!-- DIRECTORY -->
  {% set d = i %}
  <tr class="folder" property="dcterms:hasPart" resource="{{d.id}}" typeof="mediafolder">
    <td class="icon" valign="top">📁</td>
    <td class="name"><a href="{{d.id}}">{{d.filename}}/</a></td>
    <td class="lastmod" align="right">{% if d.last_modification %}{{d.last_modification|strftime}}{%else%}&mdash;{%endif%}</td>
    <td class="size" align="right" content="{{d.total_bytes}}">{{d.total_bytes|filesizeformat}}</td>
    {% if 'pages' in allkeys %}<td class="pages">&mdash;</td>{% endif %}
    {# {% if 'title' in allkeys %}<td class="title">&mdash;</td>{% endif %} #}
    {# {% if 'author' in allkeys %}<td class="author">&mdash;</td>{% endif %} #}
    {% if 'duration' in allkeys %}<td class="duration">&mdash;</td>{% endif %}
    <td class="description">{{d.total_files}} file{% if d.total_files != 1 %}s{% endif %}{% if d.total_folders > 1 %}, {{d.total_folders-1}} subfolder{% if d.total_folders-1!=1%}s{%endif%}{% endif %}</td>
  </tr>
{% else %}
  <!-- FILE -->
  {% set f = i %}
  {% if f.play %}
  {% set play_link = f.play %}
  {%else%}
  {% set play_link = f.id %}
  {% endif %}
  <tr class="file" property="dcterms:hasPart" resource="{{f.id}}" typeof="{% if f.mediatype %}mediaitem {%endif%}file">
    <td class="icon" valign="top">
      <a href="{{play_link}}">
        {% if f.thumbnail and not f.mediatype == "audio" %}
          <img src="{{f.thumbnail}}" class="icon" alt="[FILE]">
        {% elif f.mediatype == "image" %}
          🖼️
        {% elif f.mediatype == "video" %}
        🎞️
        {% elif f.mediatype == "audio" %}
        🔊
        {% else %}
        🗋
        {% endif %}
      </a>
      {% if f.thumbnail %}
      <!-- rdf outside of link above which seems to reset the subject -->
      <a class="metadata" property="hasThumbnail" href="{{f.thumbnail}}"></a>
      {% endif %}
    </td>
    <td class="name">
        <a {% if f.play %}property="hasPlay dcterms:hasFormat" href="{{f.play}}"{%else%}href="{{f.id}}"{% endif %}><span property="dcterms:title" content="{%if f.title%}{{f.title}}{% else %}{{f.filename|filename2title}}{% endif %}">{{f.filename|wbr_}}</span></a>
        {% if f.play %}<a class="original" href="{{f.id}}">&crarr;</a>{% endif %}        
        {% if f.mediatype == "pdf" %}
        <span property="mediatype" content="pdf"></span>
        {% elif f.mediatype == "video" %}
        <span property="mediatype" content="video"></span>
        {% elif f.mediatype == "audio" %}
        <span property="mediatype" content="audio"></span>
        {% elif f.mediatype == "image" %}
        <span property="mediatype" content="image"></span>
        {% endif %}
        {% if f.ext %}<span property="dcterms:format" content="{{f.ext}}"></span>{% endif %}
        {% if f.poster %}
        <a class="rdf" property="hasPoster dcterms:hasFormat" href="{{f.poster}}"></a>
        {% endif %}
    </td>
    <td class="lastmod" align="right" property="dcterms:modified" datatype="xsd:dateTime" content="{{f.mtime}}">{{f.mtime|strftime}}</td>
    <td class="size" align="right" data-sort-numeric="{{f.size}}">{{f.size|filesizeformat}}</td>
    {% if 'pages' in allkeys %}<td class="pages" data-sort-numeric="{{f.pages|default(0,True)}}" {% if f.pages %}property="pages" content="{{f.pages}}"{%endif%}>{% if f.pages %}{{f.pages}}{% else %}&mdash;{%endif%}</td>{% endif %}
    {# {% if 'author' in allkeys %}<td class="author">{% if f.author %}{{f.author}}{% else %}&mdash;{%endif%}</td>{% endif %} #}
    {% if 'duration' in allkeys %}{% if f.duration %}<td class="duration" data-sort-numeric="{{f.duration}}" property="duration dcterms:extent" content="{{f.duration|isoduration}}" datatype="xsd:duration">{{f.duration|timecode(fract=False)}}</td>{% else %}<td class="duration" data-sort-numeric="0">&mdash;</td>{%endif%}{% endif %}
    {% if f.description %}
    <td class="description" property="dcterms:description">{{f.description|markdown|add_attribute_to_links("property", "hasTag")}}</td>
    {% else %}
    <td class="description">&mdash;</td>
    {%endif%}
  </tr>
{% endif %}
{% endfor %}
</tbody>
<tbody class="summary">
  <tr><td colspan="{{ colcount }}"><hr></td></tr>
  <tr class="summary">
    <td>&nbsp;</td>
    <td>
      {{total_files}} file{% if total_files != 1 %}s{%endif%}{% if total_folders %}, {{total_folders}} folder{% if total_folders != 1 %}s{%endif%}{%endif%}
      {% if 'play' in allkeys %}<span class="legend_original">(original: &crarr;)</span>{%endif%}
    </td>
    <td align="right">{% if last_modification%}<span property="dcterms:modified" datatype="xsd:dateTime" content="{{last_modification}}">{{last_modification|strftime}}</span>{%else %}&nbsp;{%endif%}</td>
    <td align="right">{{total_bytes|filesizeformat}}</td>
    <!-- TODO: sums of other values -->
    {% if 'pages' in allkeys %}<td>&nbsp;</td>{% endif %}
    {% if 'title' in allkeys %}<td>&nbsp;</td>{% endif %}
    {% if 'author' in allkeys %}<td>&nbsp;</td>{% endif %}
    {% if 'duration' in allkeys %}<td>&nbsp;</td>{% endif %}
    <td></td>
  </tr>
</tbody>
</table>
{% endwith %}
</body>
</html>