Initialisierung: Übertragung aus altem Repository

This commit is contained in:
2021-07-12 00:49:07 +02:00
commit c7f0c6a1c4
80 changed files with 12063 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
{% extends 'base.html.j2' %}
{#
NateMan Nachschreibtermin-Manager
templates/admin/index.html.j2
Copyright © 2020 Niklas Elsbrock
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Administration{% endblock %}
{% block header %}Administration{% endblock %}
{% block content %}
<p><a href="{{ url_for('admin.lehrer.index') }}" data-icon="&#xf0c0;">Lehrerkonten</a></p>
<p><a href="{{ url_for('admin.sql_access') }}" data-icon="&#xf1c0;">SQL-Zugriff</a></p>
{% endblock %}
@@ -0,0 +1,45 @@
{% extends 'base.html.j2' %}
{#
NateMan Nachschreibtermin-Manager
templates/admin/lehrer/add.html.j2
Copyright © 2020 Niklas Elsbrock
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Lehrer(in) hinzufügen{% endblock %}
{% block header %}Lehrer(in) hinzufügen{% endblock %}
{% block content %}
<form method="post">
<div class="table-aligned">
<div>
<div><label for="kuerzel-input">Lehrerkürzel:</label></div>
<div><input type="text" name="kuerzel" id="kuerzel-input" autocomplete="off" required autofocus></div>
</div>
<div>
<div><label for="password-input">Passwort:</label></div>
<div><input type="password" name="password" id="password-input" autocomplete="off" required></div>
</div>
</div>
<label>
<input type="checkbox" name="force-password-change" id="force-password-change-cb">
bei Erstanmeldung Passwortänderung erzwingen
</label>
<p><input type="submit" value="Hinzufügen"></p>
</form>
{% endblock %}
@@ -0,0 +1,90 @@
{% extends 'base.html.j2' %}
{#
NateMan Nachschreibtermin-Manager
templates/admin/lehrer/edit.html.j2
Copyright © 2020 Niklas Elsbrock
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Lehrer(in): {{ lehrer.kuerzel }}{% endblock %}
{% block header %}Lehrer(in): {{ lehrer.kuerzel }}{% endblock %}
{# lehrer #}
{% set stufen_list = Stufe.query.all() %}
{% block js_head %}
var delete_warn = "Durch das Löschen eines Lehrerkontos werden alle Klausuren,\ndie dem gelöschten Konto zugeordnet "
+ "sind, unwiderruflich gelöscht.\nWollen Sie wirklich fortfahren?"
{% endblock %}
{% block content %}
<form method="post">
<input name="action" type="hidden" value="change-credentials">
<div class="table-aligned">
<div>
<div><label for="new-kuerzel-input">Lehrerkürzel:</label></div>
<div><input type="text" name="new-kuerzel" id="new-kuerzel-input" value="{{ lehrer.kuerzel }}" required></div>
</div>
<div>
<div><label for="new-email-input">E-Mail-Adresse:</label></div>
<div>
<input type="email" name="new-email" id="new-email-input"
value="{% if lehrer.email %}{{ lehrer.email }}{% endif %}" autocomplete="off">
</div>
{% if lehrer.email is not none %}
<div>
{% if lehrer.is_confirmed %}
<span class="positive-status" title="bestätigt"></span>
{% else %}
<span class="negative-status">nicht bestätigt</span>
{% endif %}
</div>
{% endif %}
</div>
<div>
<div><label for="new-password-input">Neues Passwort:</label></div>
<div><input type="password" name="new-password" id="new-password-input" autocomplete="new-password"></div>
</div>
<div>
<div><label for="new-beraet-select">Beratungslehrer(in) von:</label></div>
<div><select name="new-beraet" id="new-beraet-select">
<option value="">(keine Stufe)</option>
{% for stufe in stufen_list %}
<option {% if stufe.name == lehrer.beraet.name %}selected{% endif %}>{{ stufe.name }}</option>
{% endfor %}
</select></div>
</div>
<div>
<div><label for="new-admin-cb">Administrator(in):</label></div>
<div>
<input type="checkbox" name="new-admin" id="new-admin-cb" value="admin"
{% if lehrer.is_admin %}checked{% endif %}>
</div>
</div>
</div>
<p><input type="submit" value="Speichern"></p>
</form>
<br>
<form method="post">
<h3>Benutzerkonto löschen</h3>
<input name="action" type="hidden" value="delete-account">
<p><input onclick="return confirm(delete_warn)" type="submit" value="Benutzerkonto jetzt löschen"></p>
</form>
{% endblock %}
@@ -0,0 +1,69 @@
{% extends 'base.html.j2' %}
{#
NateMan Nachschreibtermin-Manager
templates/admin/lehrer/index.html.j2
Copyright © 2020 Niklas Elsbrock
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}Lehrerkonten{% endblock %}
{% block header %}Lehrerkonten{% endblock %}
{% set lehrer_list = Lehrer.query.order_by(Lehrer.kuerzel).all() %}
{% block content %}
<p><a href="{{ url_for('admin.lehrer.add') }}" data-icon="&#xf234;">Lehrer(in) hinzufügen</a></p>
<p>Klicken Sie eine Zeile aus der folgenden Übersicht an, um ein bestehendes Benutzerkonto zu bearbeiten.</p>
<table>
<thead>
<tr>
<th>Kürzel</th>
<th>E-Mail-Adresse</th>
<th>Admin</th>
<th>Beratungslehrer(in)</th>
<th>Passwort<br>gesetzt</th>
</tr>
</thead>
<tbody>
{% for l in lehrer_list %}
<tr class="clickable" tabindex="0" data-href="{{ url_for('admin.lehrer.edit', lehrer_id=l.id) }}">
<td>{{ l.kuerzel }}</td>
<td>
{% if l.email is not none %}
{{ l.email }}
{% if l.is_confirmed %}
<span class="positive-status" title="bestätigt"></span>
{% else %}
<span class="negative-status" title="nicht bestätigt"></span>
{% endif %}
{% else %}
<span class="detail">(keine)</span>
{% endif %}
</td>
<td>{{ 'ja' if l.is_admin else 'nein' }}</td>
<td>{{ l.beraet.name if l.beraet is not none else '<span class="detail">(keine Stufe)</span>' }}</td>
{% if l.pwd_changed %}
<td class="positive-status">ja</td>
{% else %}
<td class="negative-status">nein</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
@@ -0,0 +1,83 @@
{% extends 'base.html.j2' %}
{#
NateMan Nachschreibtermin-Manager
templates/admin/sql_access.html.j2
Copyright © 2020 Niklas Elsbrock
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% block title %}SQL-Zugriff{% endblock %}
{% block header %}SQL-Zugriff{% endblock %}
{# result: Ergebnis einer SQL-Abfrage als sqlalchemy.engine.ResultProxy #}
{% block content %}
<p>
Diese Seite erlaubt direkten Zugriff auf die SQL-Datenbank von NateMan durch die Eingabe von SQL-Abfragen.<br>
<b>
Bei falscher Anwendung können Daten unwiderruflich verloren gehen.<br>
Außerdem kann es bei der Veränderung bestimmter Daten zu unerwarteten Fehlern in der NateMan-Anwendung kommen.<br>
<span class="marked">Benutzen Sie diese Seite nur, wenn Sie wissen, was Sie tun.</span>
</b>
</p>
<p>
{% set nateman_erm_url = url_for('static', filename='img/nateman-erm.svg') %}
<a href="{{ nateman_erm_url }}" target="_blank" rel="noreferrer noopener">
<img src="{{ nateman_erm_url }}" height="500" alt="Entity-Relationship-Modell der NateMan-Datenbank"
title="Entity-Relationship-Modell der NateMan-Datenbank">
</a>
</p>
<form method="post">
<p>
<textarea name="query" class="monospace" rows="8" cols="96" placeholder="SQL-Abfrage hier eingeben"
required autofocus>{{ query }}</textarea>
</p>
<p><input type="submit" value="Ausführen"></p>
</form>
{% if result is not none and result.returns_rows %}
{% set result_rows = result.fetchall() %}
<h3>Ergebnis ({{ result_rows|length }} Zeilen):</h3>
<table class="monospace">
<thead>
<tr>
{% for col_name in result.keys() %}
<th>{{ col_name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result_rows %}
<tr>
{% for value in row._mapping.values() %}
{% if value is none %}
<td class="detail">NULL</td>
{% else %}
<td>{{ value }}</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}