From d8b74761c6cefdd83360d3f2add0e9ccdc6064c7 Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sat, 14 Sep 2024 17:59:13 +0200 Subject: Even more changes (devel commit messages are useless) --- .env.example | 4 + src/application/mystic/forum/orm/Post.php | 1 + src/application/views/form_login.php | 4 +- src/application/views/form_newtopic.php | 34 +- src/application/views/form_register.php | 40 +- src/application/views/nav_logged_in.php | 4 +- src/application/views/template_end.php | 25 +- .../views/template_navigation_start.php | 2 +- src/application/views/template_start.php | 14 +- src/application/views/view_post.php | 32 +- src/application/views/view_topic_start.php | 96 +- src/application/views/view_user.php | 29 +- src/composer.json | 4 + src/composer.lock | 1151 ++++++++++++++++++++ src/index.php | 166 ++- src/themes/default/theme.css | 10 + src/themes/slate/theme.css | 15 + src/ui/site.css | 2 +- src/ui/theme-default.css | 3 - src/ui/theme-slate.css | 8 - 20 files changed, 1545 insertions(+), 99 deletions(-) create mode 100644 src/composer.lock create mode 100644 src/themes/default/theme.css create mode 100644 src/themes/slate/theme.css delete mode 100644 src/ui/theme-default.css delete mode 100644 src/ui/theme-slate.css diff --git a/.env.example b/.env.example index 4b62cb4..0eba495 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,7 @@ POSTGRES_USER=postgres POSTGRES_DB=postgres POSTGRES_PASSWORD=postgres +#MYSTIC_FORUM_THEME=default +#REGISTRATION_ENABLED=1 +#MYSTIC_FORUM_TITLE= +#MYSTIC_FORUM_COPYRIGHT= diff --git a/src/application/mystic/forum/orm/Post.php b/src/application/mystic/forum/orm/Post.php index becbb9d..186ea61 100644 --- a/src/application/mystic/forum/orm/Post.php +++ b/src/application/mystic/forum/orm/Post.php @@ -16,4 +16,5 @@ class Post extends Entity { public \DateTimeImmutable $postDate; #[References("public.topics", onDelete: References::CASCADE)] public string $topicId; #[DefaultValue("false")] public bool $deleted; + #[DefaultValue("false")] public bool $edited; } diff --git a/src/application/views/form_login.php b/src/application/views/form_login.php index 8ddb22e..27924e8 100644 --- a/src/application/views/form_login.php +++ b/src/application/views/form_login.php @@ -9,7 +9,9 @@ if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; RequestUtils::clearLastForm(); ?> -

Log in

+
-
" method="post"> -Topic title:
-" required>
- -Message:
-
- - + + $_formError]); +} +?> +#form" method="post" enctype="multipart/form-data"> +
+ + " required autofocus> +
+
+ + +
+
+ + +
+
diff --git a/src/application/views/form_register.php b/src/application/views/form_register.php index 221f37d..6f62652 100644 --- a/src/application/views/form_register.php +++ b/src/application/views/form_register.php @@ -9,7 +9,9 @@ if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = []; RequestUtils::clearLastForm(); ?> -

Register

+
" method="post"> -
+
" required>
-
+
+ + " required> +
+ +
" required>
-
+
-
+
-
+
" required>
+
+ +
+ CAPTCHA +
+
+ +
+ +
+
+
+
@@ -53,3 +73,11 @@ if (($_formError = RequestUtils::getAndClearFormError()) !== null) {
+ + diff --git a/src/application/views/nav_logged_in.php b/src/application/views/nav_logged_in.php index f899ad8..8ed8d07 100644 --- a/src/application/views/nav_logged_in.php +++ b/src/application/views/nav_logged_in.php @@ -9,6 +9,6 @@ use mystic\forum\orm\User; displayName) ?>!

-
  • -
  • ">
  • +
  • View profile
  • +
  • ">Log out
  • diff --git a/src/application/views/template_end.php b/src/application/views/template_end.php index 27fc3ba..7757780 100644 --- a/src/application/views/template_end.php +++ b/src/application/views/template_end.php @@ -3,7 +3,8 @@
    - © + © . + Powered by Mystic Forum
    @@ -23,6 +24,28 @@ $(function() { var date = new Date($(e).text()); $(e).text(date.toLocaleTimeString()); }); + + $("input[type=file]").each(function(i, e) { + var isMultiple = !!$(e).prop("multiple"); + var $input = $('').attr("placeholder", "No file" + (isMultiple ? "s" : "") + " selected"); + $(e).after($('
    ').append( + $input, + $('').append( + $('').text("Select file" + (isMultiple ? "s" : "") + "...").click(function() { + $(e).click(); + }) + ) + )).addClass("sr-only"); + $(e).on("change", function() { + var files = $(e)[0].files; + if (files.length < 1) + $input.val(""); + else if (files.length === 1) + $input.val(files[0].name); + else + $input.val(files.length + " files selected"); + }); + }) }); diff --git a/src/application/views/template_navigation_start.php b/src/application/views/template_navigation_start.php index 48cdb9a..3c69bf4 100644 --- a/src/application/views/template_navigation_start.php +++ b/src/application/views/template_navigation_start.php @@ -7,6 +7,6 @@ - Forum +
    -
    +