admin_user.hbs 2.45 KB
Newer Older
1
<a href="/admin/"> Neue Suche </a>
2

3
4
5
6
7
<h1>{{firstname}} {{lastname}}</h1>
<h2>{{#if admin}}Administrator{{else}}{{#if teacher}}Lehrer{{else}}Schüler{{/if}}{{/if}}</h2>

<p>
<strong>Id: {{userid}}</strong><br>
8
9
Vorname: {{firstname}}<br>
Nachname: {{lastname}}<br>
10
Jahrgangsstufe: {{grade}}<br>
11
12
{{#if username}}Benutzername: {{username}}<br>{{/if}}
{{#if logincode}}Logincode: {{logincode}}<br>{{/if}}
13
{{#if oauthid}}OAuth-Login: {{oauthprovider}} ({{oauthprovider}}-id: {{oauthid}})<br>{{/if}}
14
{{#if logged_id}}Ist eingeloggt <br>{{/if}}
15
</p>
16
17
18
19

<h2>Gruppen</h2>
{{#if group}}
   <h3>Admin von</h3>
20
21
22
23
24
      <table>
         <tr>
            <th>Id</th>
            <th>Name</th>
            <th>Gruppencode</th>
25
            <th>Klassen-/Kursbez.</th>
26
27
28
29
30
31
32
33
34
35
36
         </tr>

         {{#each group}}
            <tr>
               <td><a href="/admin/group/{{id}}">{{id}}:</a></td>
               <td><a href="/admin/group/{{id}}">{{name}}</a></td>
               <td>{{code}}</td>
               <td>{{tag}}</td>
            </tr>
         {{/each}}
      </table>
37
38
39
{{/if}}

{{#if group_id }}
40
<h3>Mitglied von</h3>
41
<ul>
42
   <li><a href="/admin/group/{{group_id}}">{{group_id}}: {{group_name}}</a></li>
43
44
45
</ul>
{{/if}}

46
47
48
49
50
51
<h2>Teilnahmen</h2>
<ul>
{{#each participations}}
   <li><a href="/admin/user/{{ ../userid }}/{{ this.0 }}">{{this.0}}: {{this.1}}</a></li>
{{/each}}
</ul>
52

53
54
<h2>Benutzer löschen</h2>
<form id="delete" action="" method="post">
55
  <input type="hidden" name="csrf_token" value="{{csrf_token}}">
56
  <input type="submit" value="Benutzer löschen!">
57
</form>
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
<div id="deleted" style="color:black;"></div>
<script>
  document.getElementById("delete").onsubmit = function(event) {
    var xhr = new XMLHttpRequest();
    xhr.open("POST", window.location.href, true);
    xhr.onreadystatechange = function() {
      if (this.readyState === XMLHttpRequest.DONE) {
        if (this.status === 200) {
          result = JSON.parse(this.responseText);
          if (result.status == "ok") {
            document.getElementsByTagName("body")[0].style.color = "gray";
            document.getElementById("delete").style.display = "None";
            document.getElementById("deleted").innerText = "Benutzer gelöscht.";
          } else {
            alert("Kann Benutzer nicht löschen: " + result.reason);
          }
        }
        else {
          alert("Request error " + this.status + ": " + this.statusText);
        }
      }
    }
    xhr.send("csrf_token={{csrf_token}}");
    return false;
  };
</script>