-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathhtml.j2
58 lines (58 loc) · 1.77 KB
/
html.j2
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cronos Database Dump</title>
</head>
<body>
{% for table in db.enumerate_tables(files=True) %}
<table>
<caption>{{ table.tablename | e }}</caption>
<thead>
<tr>
{%- for field in table.fields %}
<th>{{ field.name | e }}</th>
{%- endfor %}
<th>Data</th>
</tr>
</thead>
<tbody>
{% for system_number, file in db.enumerate_files(table) %}
<tr>
<td>{{ system_number | e }}</td>
<td><a href="data:application/x-binary;base64,{{ base64.b64encode( file ).decode('utf-8') }}">File content</a></td>
<tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
{% for table in db.enumerate_tables(files=False) %}
{%- if table.tableimage -%}
<img src="data:image;base64,{{ base64.b64encode( table.tableimage.data ).decode('utf-8') }}"/>
{%- endif -%}
<table>
<caption>{{ table.tablename | e }}</caption>
<thead>
<tr>
{%- for field in table.fields %}
<th>{{ field.name | e }}</th>
{%- endfor %}
</tr>
</thead>
<tbody>
{%- for record in db.enumerate_records( table ) %}
<tr>
{%- for field in record.fields %}
{%- if field.typ == 6 and field.content -%}
<td><a download="{{ field.filename }}.{{ field.extname }}" href="data:application/x-binary;base64,{{ db.get_record( field.filedatarecord, True ) }}">{{ field.filename | e }}.{{ field.extname | e }}</a></td>
{%- else -%}
<td>{{ field.content | e }}</td>
{%- endif -%}
{%- endfor %}
</tr>
{%- endfor %}
</tbody>
</table>
{% endfor %}
</body>
</html>