Fixed W12

This commit is contained in:
Andrew 2023-03-26 16:58:46 +07:00
parent ee0715c3b2
commit 8680f03b91
19 changed files with 444 additions and 253 deletions

View file

@ -1,35 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<b>{{user.login}}</b>, вы редактируете меню. <a href="/">На главную</a>
<hr>
<b>Меню:</b>
<div id="menuHolder">
{% if menu %}
{% for item in menu %}
<div>
<input type="text" name="url" value="{{item.url}}">
<input type="text" name="name" value="{{item.name}}">
<button class="removeItemBtn">X</button>
</div>
{% endfor %}
{% endif %}
</div>
{% extends "template.twig" %}
<hr>
{% block title %}Редактирование меню{% endblock %}
{% block head %}
{{ parent() }}
<style type="text/css">
</style>
{% endblock %}
{% block content %}
<b>{{user.login}}</b>, вы редактируете меню. <a href="/">На главную</a>
<hr>
<b>Меню:</b>
<div id="menuHolder">
{% if menu %}
{% for item in menu %}
<div>
<input class="inputData" type="text" name="url" placeholder="Ссылка">
<input class="inputData" type="text" name="name" placeholder="Название">
<button id="addItemBtn">+</button>
<input type="text" name="url" value="{{item.url}}">
<input type="text" name="name" value="{{item.name}}">
<button class="removeItemBtn">X</button>
</div>
<button id="saveBtn">Сохранить</button>
</body>
{% endfor %}
{% endif %}
</div>
<hr>
<div>
<input class="inputData" type="text" name="url" placeholder="Ссылка">
<input class="inputData" type="text" name="name" placeholder="Название">
<button id="addItemBtn">+</button>
</div>
<button id="saveBtn">Сохранить</button>
<script>
let menu = [];
@ -69,7 +71,7 @@
document.querySelector('input.inputData[name="url"]').value = '';
document.querySelector('input.inputData[name="name"]').value = '';
updateDeleteBtns()
updateDeleteBtns();
});
saveBtn.addEventListener('click', async function() {
@ -92,8 +94,10 @@
}
console.log(result);
});
updateDeleteBtns();
}
document.addEventListener('DOMContentLoaded', init);
</script>
</html>
{% endblock %}

View file

@ -1,20 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<b>{{user.login}}</b>, вы смотрите свою галерею. <a href="/">На главную</a>
<hr>
{% for image in images %}
<a href="/image/{{image.id}}">
<img src="/images?filename={{image.filename}}" alt="{{image.id}}">
</a>
{% else %}
<p>Нет изображений</p>
{% endfor %}
</body>
</html>
{% extends "template.twig" %}
{% block title %}Галерея{% endblock %}
{% block head %}
{{ parent() }}
<style type="text/css">
</style>
{% endblock %}
{% block content %}
<b>{{user.login}}</b>, вы смотрите свою галерею. <a href="/">На главную</a>
<hr>
{% for image in images %}
<a href="/image/{{image.id}}">
<img src="/images?filename={{image.filename}}" alt="{{image.id}}">
</a>
{% else %}
<p>Нет изображений</p>
{% endfor %}
{% endblock %}

View file

@ -1,26 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<b>{{user.login}}</b> осматривает картинку... <a href="/">На главную</a>
<hr>
<img src="/images?type=full&filename={{image.filename}}" alt="{{image.filename}}" style="max-width: 100%">
<hr>
<a href="/images?type=thumb&filename={{image.filename}}">Миниатюра</a>
<hr>
<form action="/image/{{image.id}}" method="post">
<input type="text" name="description" value="{{image.description}}">
<br>
Опубликовано?
<input type="checkbox" name="published" value="1" {{image.published ? 'checked' : ''}}>
<br>
<input type="submit" value="Сохранить">
</form>
<a href="/image/{{image.id}}/delete">Удалить</a>
</body>
</html>
{% extends "template.twig" %}
{% block title %}Просмотр изображения{% endblock %}
{% block head %}
{{ parent() }}
<style type="text/css">
</style>
{% endblock %}
{% block content %}
<b>{{user.login}}</b> осматривает картинку... <a href="/">На главную</a>
<hr>
<img src="/images?type=full&filename={{image.filename}}" alt="{{image.filename}}" style="max-width: 100%">
<hr>
<a href="/images?type=thumb&filename={{image.filename}}">Миниатюра</a>
<hr>
<form action="/image/{{image.id}}" method="post">
<input type="text" name="description" value="{{image.description}}">
<br>
Опубликовано?
<input type="checkbox" name="published" value="1" {{image.published ? 'checked' : ''}}>
<br>
<input type="submit" value="Сохранить">
</form>
<a href="/image/{{image.id}}/delete">Удалить</a>
{% endblock %}

View file

@ -1,26 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% if message %}
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
{% endif %}
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
{% endif %}
<h4>Import page</h4>
<p>Drop XML file on page or enter content down here</p>
<form action="/import" method="post">
<textarea name="xml" cols="30" rows="10"></textarea>
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
{% extends "template.twig" %}
{% block title %}Импорт пользователей{% endblock %}
{% block head %}
{{ parent() }}
<style>
</style>
{% endblock %}
{% block content %}
{% if message %}
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
{% endif %}
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
{% endif %}
<h4>Импорт</h4>
<p>Перенесите XML файл дампа на форму или вставьте содерживое в поле</p>
<form action="/import" method="post">
<textarea name="xml" cols="30" rows="10"></textarea>
<br>
<input type="submit" name="submit" value="submit">
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
let dropZone = document.body;
@ -48,4 +49,4 @@ document.addEventListener("DOMContentLoaded", function() {
}, false);
});
</script>
</html>
{% endblock %}

View file

@ -1,11 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
{% extends "template.twig" %}
{% block title %}Главная страница{% endblock %}
{% block head %}
{{ parent() }}
<style>
#imageDrop {
display: flex;
@ -18,8 +15,9 @@
border-radius: 1rem;
}
</style>
</head>
<body>
{% endblock %}
{% block content %}
Привет, {{user.login}}! <a href="/logout">Выйти</a>
<hr>
<b>Меню:</b>
@ -105,4 +103,4 @@ document.addEventListener("DOMContentLoaded", function() {
});
</script>
</html>
{% endblock %}

View file

@ -1,27 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% extends "template.twig" %}
{% block title %}Вход{% endblock %}
{% block head %}
{{ parent() }}
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
height: 100vh;
width: 100vw;
background: rgb(15 33 33);
}
.auth-holder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgb(185 255 245);
width: fit-content;
padding: 2rem;
border-radius: 1rem;
}
</style>
{% endblock %}
{% block content %}
<div class="auth-holder">
{% if message %}
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
{% endif %}
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
{% endif %}
<h4>Login page</h4>
<form action="/login" method="post">
<input type="text" name="login" placeholder="login">
<input type="password" name="password" placeholder="password">
<input type="submit" name="submit" value="submit">
</form>
<hr>
<a href="/register">Registration</a>
<br>
<a href="/recover-password">Recover password</a>
</body>
</html>
<h4>Вход</h4>
<form action="/login" method="post">
<input type="text" name="login" placeholder="Логин">
<input type="password" name="password" placeholder="Пароль">
<input type="submit" name="submit" value="Войти">
</form>
<hr>
<a href="/register">Зарегистрироваться</a>
<br>
<a href="/recover-password">Восстановить пароль</a>
</div>
{% endblock %}

View file

@ -1,12 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% extends "template.twig" %}
{% block title %}Просмотр таблиц{% endblock %}
{% block head %}
{{ parent() }}
<style>
</style>
{% endblock %}
{% block content %}
{% if table %}
<b>{{user.login}}</b>, вы смотрите таблицу <i>{{table}}</i>. <a href="/lookupTables">Отмена</a>
{% else %}
@ -46,5 +48,4 @@
<input type="submit" value="Перейти">
</form>
{% endif %}
</body>
</html>
{% endblock %}

View file

@ -1,12 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% extends "template.twig" %}
{% block title %}Гейтвей{% endblock %}
{% block head %}
{{ parent() }}
<style>
</style>
{% endblock %}
{% block content %}
Вам нужно <a href="/login">войти</a> или <a href="/register">зарегистрироваться</a> для работы с системой.
</body>
</html>
{% endblock %}

View file

@ -1,4 +1,4 @@
Hello, {{login}}!
You have requested password change, so we generated you a new one (without backtics): `<b>{{password}}</b>`.
<br>
Please be sure to delete this message after you have logged in. For now you cannot change your password by yourself.
Привет, {{login}}!
Похоже, ты ззабыл свой пароль, вот тебе новый (без кавычек): `<b>{{password}}</b>`.
<hr>
Удали это сообщение после входа, чтобы его никто не прочитал!

View file

@ -1,32 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% if mail %}
<div id="mail" style="padding: 1rem; border: 2px solid black; background-color: lightsteelblue; color: stellblue">{{mail | raw}}</div>
<br>
{% endif %}
{% if message %}
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
<br>
{% endif %}
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
<br>
{% endif %}
<h4>Password recovery page</h4>
<form action="/recover-password" method="post">
<input type="text" name="login" placeholder="login">
<input type="submit" name="submit" value="submit">
</form>
<hr>
<a href="/register">Registration</a>
<br>
<a href="/login">Login</a>
</body>
</html>
{% extends "template.twig" %}
{% block title %}Восстановление парля{% endblock %}
{% block head %}
{{ parent() }}
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
height: 100vh;
width: 100vw;
background: rgb(15 33 33);
}
.auth-holder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgb(185 255 245);
width: fit-content;
padding: 2rem;
border-radius: 1rem;
}
</style>
{% endblock %}
{% block content %}
<div class="auth-holder">
{% if mail %}
<div id="mail" style="padding: 1rem; border: 2px solid black; background-color: lightsteelblue; color: stellblue">{{mail | raw}}</div>
<br>
{% endif %}
{% if message %}
<div id="message" style="padding: 1rem; border: 2px solid black; background-color: green; color: white">{{message}}</div>
<br>
{% endif %}
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
<br>
{% endif %}
<h4>Восстановление пароля</h4>
<form action="/recover-password" method="post">
<input type="text" name="login" placeholder="Логин">
<input type="submit" name="submit" value="Восстановить">
</form>
<hr>
<a href="/register">Зарегистрироваться</a>
<br>
<a href="/login">Войти</a>
</div>
{% endblock %}

View file

@ -1,24 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
{% endif %}
<h4>Registration page</h4>
<form action="/register" method="post">
<input type="text" name="login" placeholder="login">
<input type="password" name="password" placeholder="password">
<input type="submit" name="submit" value="submit">
</form>
<hr>
<a href="/login">Login</a>
<br>
<a href="/recover-password">Recover password</a>
</body>
</html>
{% extends "template.twig" %}
{% block title %}Регистрация{% endblock %}
{% block head %}
{{ parent() }}
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
height: 100vh;
width: 100vw;
background: rgb(15 33 33);
}
.auth-holder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgb(185 255 245);
width: fit-content;
padding: 2rem;
border-radius: 1rem;
}
</style>
{% endblock %}
{% block content %}
<div class="auth-holder">
{% if error %}
<div id="error" style="padding: 1rem; border: 2px solid black; background-color: red; color: white">{{error}}</div>
{% endif %}
<h4>Регистрация</h4>
<form action="/register" method="post">
<input type="text" name="login" placeholder="Логин">
<input type="password" name="password" placeholder="Пароль">
<input type="submit" name="submit" value="Войти">
</form>
<hr>
<a href="/login">Войти</a>
<br>
<a href="/recover-password">Восстановить пароль</a>
</div>
{% endblock %}

View file

@ -1,11 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
{% extends "template.twig" %}
{% block title %}Импорт пользователей{% endblock %}
{% block head %}
{{ parent() }}
<style>
#imageDrop {
display: flex;
@ -18,8 +15,9 @@
border-radius: 1rem;
}
</style>
</head>
<body>
{% endblock %}
{% block content %}
<b>{{user.login}}</b> что-то ищет 🤔 <a href="/">На главную</a>
<hr>
<form action="/search" method="get">
@ -46,5 +44,4 @@
<p>Пусто</p>
{% endif %}
</div>
</body>
</html>
{% endblock %}

15
w12/views/template.twig Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block head %}
<!--link rel="stylesheet" href="style.css"/-->
<title>{% block title %}{% endblock %}</title>
{% endblock %}
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
<div id="footer">{% block footer %}{% endblock %}</div>
</body>
</html>