könnte so klappen #32

Merged
anton merged 2 commits from 31_templates_vereinfachen into master 2024-02-21 22:30:37 +00:00
14 changed files with 204 additions and 187 deletions

3
.gitignore vendored
View file

@ -10,4 +10,5 @@ flask_session/
/test/.pytest_cache/ /test/.pytest_cache/
/test/flask_session/ /test/flask_session/
/Website/__pycache__/ /Website/__pycache__/
/Website/.pytest_cache/ /Website/.pytest_cache/
/.idea

View file

@ -1,26 +1,25 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block customscript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> <script type="text/javascript" charset="utf-8">
<script type="text/javascript" charset="utf-8"> var socket = io();
var socket = io(); var user = {{ user }}
var user = {{ user }} socket.on('connect', function() {
socket.on('connect', function() { socket.emit('addtag', {data: user});
socket.emit('addtag', {data: user}); });
}); socket.on("busy", function(){
socket.on("busy", function(){ document.write('<p>the nfc reader is busy at the moment. Pleas Wait ...</p>')
document.write('<p>the nfc reader is busy at the moment. Pleas Wait ...</p>') socket.emit('addtag', {data: user})
socket.emit('addtag', {data: user}) });
}); socket.on("wait", function(){
socket.on("wait", function(){ document.write('<p>Pleas hold your tag on to the nfc reader</p>')
document.write('<p>Pleas hold your tag on to the nfc reader</p>') });
}); socket.on("error", function(data) {
socket.on("error", function(data) { alert(data)
alert(data) window.location="http://matekasse.server.c3h/"
window.location="http://matekasse.server.c3h/" });
}); socket.on("finished", function(data){
socket.on("finished", function(data){ alert(data)
alert(data) window.location="http://matekasse.server.c3h/"
window.location="http://matekasse.server.c3h/" });
}); </script>
</script> {% endblock %}
</html>

View file

@ -1,8 +1,10 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block title %}
<title>add user</title> add user
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> {% endblock %}
<p> {% block content %}
<form action="/adduser/user" method="post"><input name="username" type="search" placeholder="Username"><button>Add user</button></form> <form action="/adduser/user" method="post"><input name="username" type="search" placeholder="Username">
</p> <button>Add user</button>
</html> </form>
</p>
{% endblock %}

View file

@ -1,17 +1,24 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title> <title>{% block title %}{% endblock %}</title>
{% block title %} {% endblock %} - FlaskApp <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"
</title> integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA=="
</head> crossorigin="anonymous"
<body> ></script>
<nav> <link rel="shortcut icon" type="Logo/png" href="ccc_logo.png"/>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> {% block customscript %}{% endblock %}
</nav> </head>
<hr> <body>
<div class="conntent"> <nav>
{% block content %} {% endblock %} <p><a href="/">index page</a>
</div> | <a href="/list">user and tag list</a>
</body> | <a href="/documentation">Documentation</a>
</p>
</nav>
<hr>
<div class="conntent">
{% block content %} {% endblock %}
</div>
</body>
</html> </html>

View file

@ -1,6 +1,5 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block customscript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
var socket = io(); var socket = io();
var change = {{change}} var change = {{change}}
@ -23,4 +22,4 @@
window.location="http://matekasse.server.c3h/" window.location="http://matekasse.server.c3h/"
}); });
</script> </script>
</html> {% endblock %}

View file

@ -1,17 +1,16 @@
<html> {% extends "base.html" %}
<script src="/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> {% block customscript %}
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
if (confirm("{message}") == true) { if (confirm("{message}") == true) {
fetch("{{destination}}", { fetch("{{destination}}", {
method: "POST", method: "POST",
body: JSON.stringify({data}), body: JSON.stringify({data}),
headers: { headers: {
"Content-type": "application/json; charset=UTF-8" "Content-type": "application/json; charset=UTF-8"
} }
}) })
} } else {
else { window.location = "/list"
window.location="/list" }
} </script>
</script> {% endblock %}
</html>

View file

@ -1,16 +1,11 @@
<html> {% extends "base.html" %}
{% block title %}
<head> Documentation
<title>Documentation</title> {% endblock %}
<link rel="stylesheet" type="text/css" href="documentation.css"> {% block customscript %}
<link rel="shortcut icon" type="Logo/png" href="ccc_logo.png"/> <link rel="stylesheet" type="text/css" href="documentation.css">
</head> {% endblock %}
{% block content %}
<body>
<div id="Infos">
<p> <a href="/">index page</a> | <a href="/list">user and tag list</a></p>
<p><a href="https://hannover.ccc.de/gitlab/anton/matekasse">https://hannover.ccc.de/gitlab/anton/matekasse</a></p>
</div>
<h1 class="header"> <u>Documentation</u> </h1> <h1 class="header"> <u>Documentation</u> </h1>
<p>&nbsp;</p> <p>&nbsp;</p>
@ -46,6 +41,4 @@
<p>638: Wrong Input</p> <p>638: Wrong Input</p>
<P>418: I'm a teapot</P> <P>418: I'm a teapot</P>
</div> </div>
</body> {% endblock %}
</html>

View file

@ -1,8 +1,8 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block title %}Error{% endblock %}
<title>Error</title> {% block customscript %}
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> <p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p>
<p> <p>
Error: {{error_code}} Error: {{error_code}}
</p> </p>
</html> {% endblock %}

View file

@ -1,11 +1,12 @@
<html> {% extends "base.html" %}
<a href="/list">user and tag list</a> {% block customscript %}
<script type="text/javascript" charset="utf-8">
window.location="/list"
</script>
{% endblock %}
{% block content %}
<a href="/list">user and tag list</a>
<p>The creator of this website accepts no liability for any linguistic or technical errors!</p> <p>The creator of this website accepts no liability for any linguistic or technical errors!</p>
<br style="line-height: 500%;"></br> <br style="line-height: 500%;"></br>
<a href="/documentation">Doumentation</a> <a href="/documentation">Doumentation</a>
<script src="/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"> {% endblock %}
</script>
<script type="text/javascript" charset="utf-8">
window.location="/list"
</script>
</html>

View file

@ -1,29 +1,35 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en-150"> {% block title %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> Strichliste
<script type="text/javascript" charset="utf-8"> {% endblock %}
var socket = io(); {% block customscript %}
socket.on("update", function(){ <script type="text/javascript" charset="utf-8">
window.location="http://matekasse.server.c3h/list" var socket = io();
}); socket.on("update", function () {
</script> window.location = "http://matekasse.server.c3h/list"
<title>Strichliste</title> });
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> </script>
<form action="/list/user" method="get"><input name="user" type="search" placeholder="Search for user"><button>Search</button></form> {% endblock %}
<form action="/adduser" method="post"><button type="submit">Add User</button></form> {% block content %}
<br></br> <form action="/list/user" method="get"><input name="user" type="search" placeholder="Search for user">
{% for i in users %} <button>Search</button>
<form action="/change" method="post" style="display: inline;"> </form>
<p style="display: inline;"> <form action="/adduser" method="post">
<a href="list/user?id={{i[0]}}">{{i[1]|safe}}</a>: {{i[2]/100}}€ <button type="submit">Add User</button>
</p> </form>
<input name="id" type="hidden" value="{{i[0]}}"> <br></br>
<input name="change" type="number" lang="nb" step="0.01" placeholder="add to balance"> {% for i in users %}
</form> <form action="/change" method="post" style="display: inline;">
<form action="/change" method="post" style="display: inline"> <p style="display: inline;">
<input name="id" type="hidden" value="{{i[0]}}"> <a href="list/user?id={{i[0]}}">{{i[1]|safe}}</a>: {{i[2]/100}}€
<button type="submit" name="change" value=-{{preis}}>-{{preis}}€</button> </p>
</form> <input name="id" type="hidden" value="{{i[0]}}">
<br style="line-height: 50%;"></br> <input name="change" type="number" lang="nb" step="0.01" placeholder="add to balance">
{% endfor %} </form>
</html> <form action="/change" method="post" style="display: inline">
<input name="id" type="hidden" value="{{i[0]}}">
<button type="submit" name="change" value=-{{preis}}>-{{preis}}€</button>
</form>
<br style="line-height: 50%;"></br>
{% endfor %}
{% endblock %}

View file

@ -1,8 +1,12 @@
<html> {% extends "base.html" %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> {% block title %}
<script type="text/javascript" charset="utf-8"> {% endblock %}
window.location="/list"; {% block content %}
</script> <p>redirekting</p>
<p>redirekting</p> <a href="/list">destination</a>
<a href="/list">destination</a> {% endblock %}
</html> {% block customscript %}
<script type="text/javascript" charset="utf-8">
window.location = "/list";
</script>
{% endblock %}

View file

@ -1,7 +1,6 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block customscript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> <script type="text/javascript" charset="utf-8">
<script type="text/javascript" charset="utf-8">
var socket = io(); var socket = io();
var user = {{ user }} var user = {{ user }}
socket.on('connect', function() { socket.on('connect', function() {
@ -23,4 +22,4 @@
window.location="http://matekasse.server.c3h/" window.location="http://matekasse.server.c3h/"
}); });
</script> </script>
</html> {% endblock %}

View file

@ -1,9 +1,10 @@
<html> {% extends "base.html" %}
<title>remove user</title> {% block title %}
remove user
{% endblock %}
{% block content %}
<p> <p>
<p>
<a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a>
</p>
<p>Deleted user {{user_name|safe}}</p> <p>Deleted user {{user_name|safe}}</p>
<a href="/list">return to the tags and user list</a> <a href="/list">return to the tags and user list</a>
</p> </p>
{% endblock %}

View file

@ -1,39 +1,45 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en-150"> {% block customscript %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script> <script type="text/javascript" charset="utf-8">
<script type="text/javascript" charset="utf-8"> var socket = io();
var socket = io(); socket.on("update", function () {
socket.on("update", function(){ window.location="/list/user?id={{user[0]}}"}); window.location = "/list/user?id={{user[0]}}"
</script> });
<title>{{user[1]|safe}}</title> </script>
<p><a href="/list">user and tag list</a> | <a href="/documentation">Documentation</a></p> {% endblock %}
<p> {{user[1]|safe}} : {{user[2]/100}}€ <p> {% block title %}
<form action="/addtag" method="post"> {{user[1]|safe}}
<input name="id" type="hidden" value="{{user[0]}}"> {% endblock %}
<button type="submit">Add Tag</button> {% block content %}
</form> <p> {{user[1]|safe}} : {{user[2]/100}}€ <p>
<form action="/removetag" method="post"> <form action="/addtag" method="post">
<input name="id" type="hidden" value="{{user[0]}}"> <input name="id" type="hidden" value="{{user[0]}}">
<button type="submit">Remove Tag</button> <button type="submit">Add Tag</button>
</form> </form>
</p> <form action="/removetag" method="post">
<form action="/change" method="post"> <input name="id" type="hidden" value="{{user[0]}}">
<input name="id" type="hidden" value="{{user[0]}}"> <button type="submit">Remove Tag</button>
<input name="change" type="number" lang="nb" step="0.01" placeholder="change balance"> </form>
</form> </p>
</p> <form action="/change" method="post">
<br></br> <input name="id" type="hidden" value="{{user[0]}}">
<p>Tags:</p> <input name="change" type="number" lang="nb" step="0.01" placeholder="change balance">
{% for tag in tags %} </form>
<p> </p>
<form action="/removetag" method="post"> <br></br>
<label for="removetag">{{tag[0]}} </label> <p>Tags:</p>
<input name="id" type="hidden" value="{{user[0]}}"> {% for tag in tags %}
<input name="tagid" type="hidden" value="{{tag[0]}}"> <p>
<button id="removetag" type="submit">Remove Tag</button> <form action="/removetag" method="post">
</form> <label for="removetag">{{tag[0]}} </label>
</p> <input name="id" type="hidden" value="{{user[0]}}">
{% endfor %} <input name="tagid" type="hidden" value="{{tag[0]}}">
<br></br> <button id="removetag" type="submit">Remove Tag</button>
<form action="/removeuser" method="post"><input name="id" type="hidden" value="{{user[0]}}"><button type="submit">Remove User</button></form> </form>
</html> </p>
{% endfor %}
<br></br>
<form action="/removeuser" method="post"><input name="id" type="hidden" value="{{user[0]}}">
<button type="submit">Remove User</button>
</form>
{% endblock %}