summaryrefslogtreecommitdiff
path: root/templates/admin.html
blob: e62979edaba200657dcaba034cb75dd9e92bda4e (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
<!DOCTYPE html>
<html>
<head>
<title>Filer Admin</title>
<meta charset="UTF-8">
{{ dropzone.load_css() }}
{{ dropzone.style('border: 2px dashed #0087F7; min-height: 3em;') }}
<link rel="stylesheet" href="/static/style.css">
<script>
function generatePassword() {
  var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+,-./:;<=>?@_{|}~";
  var randarray = new Uint16Array(32);
  var retval = "";
  window.crypto.getRandomValues(randarray);
  for (var i = 0, n = chars.length; i < randarray.length; ++i)
    retval += chars.charAt(Math.floor(randarray[i] * n / 65336));
  console.log(retval);
  document.getElementById("password").value = retval;
}
</script>
</head>
<body>
{{ dropzone.load_js() }}
<h1>Kanzlei Hubrig – Administration</h1>
<h2>Mandanten</h2>
<ul>
{%- for item in users %}
  <li>
    <form action="/admin/del-user/{{item}}" method="post" style="display: inline;" onsubmit="return confirm('Sind Sie sicher?');">
        <input type="hidden" name="_method" value="DELETE">
        <button class="delete">löschen</button>
    </form>
    <button class="edit" onclick="document.getElementById('user').value='{{item}}'">edit</button>
    <a href="/admin/Dokumente/{{item}}">{{item}}</a> <small>Mandanten-URL: {{url_root}}Dokumente/{{item}}</small>
  </li>
{%- endfor %}
<li>
  <form action="/admin/new-user" method="post">
  <input id="user" name="user" type="text" placeholder="Name" required></input>
  <input id="password" name="password" type="text" placeholder="Passwort" autocomplete="off" required></input>
  <script>generatePassword()</script>
  <button class="add" type="button" onclick="generatePassword()">Zufall</button>
  <button class="add">Hinzufügen</button>
  </form>
</li>
</ul>

<h2>Öffentliche Dokumente</h2>
<ul>
{%- for item in tree.children recursive %}
    <li><form action="/admin/{{ item.name }}" method="post" style="display: inline;" onsubmit="return confirm('Are you sure?');">
        <input type="hidden" name="_method" value="DELETE">
        <button class="delete">löschen</button>
        </form>
        <a href="{{ item.name }}" download="{{item.download}}">{{ item.download }}</a>
    {%- if item.children -%}
        <ul>{{ loop(item.children) }}</ul>
    {%- endif %}</li>
{%- endfor %}
</ul>

<h2>Öffentliches Dokument hochladen</h2>
<div class="droppy">{{ dropzone.create(action='/admin') }}</div>

{{ dropzone.config() }}
</body>
</html>