From d2412d1db58b80410706d6e1f89941d63f071ac6 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 17:24:00 +0200 Subject: [PATCH 1/8] =?UTF-8?q?Ank=C3=BCndigung=20auch=20w=C3=A4hrend=20de?= =?UTF-8?q?s=20Wartungsmodus=20beibehalten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fragments/maintenance/frontend.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fragments/maintenance/frontend.php b/fragments/maintenance/frontend.php index 9b95a0c..c1612a0 100644 --- a/fragments/maintenance/frontend.php +++ b/fragments/maintenance/frontend.php @@ -46,10 +46,18 @@
-

Maintenance
Wartung

+

Maintenance
Wartung

This website is temporarily unavailable

-

Diese Website ist temporär nicht erreichbar

+

Diese Website ist temporär nicht erreichbar

+ = date('Y-m-d H:i:s')) { + ?> +
+ +
+
From 29d6faf3d11738fba188eb9156c71fd4c2ae730f Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 17:26:47 +0200 Subject: [PATCH 2/8] Update frontend.php --- fragments/maintenance/frontend.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fragments/maintenance/frontend.php b/fragments/maintenance/frontend.php index c1612a0..0fa9260 100644 --- a/fragments/maintenance/frontend.php +++ b/fragments/maintenance/frontend.php @@ -51,13 +51,17 @@

Diese Website ist temporär nicht erreichbar

= date('Y-m-d H:i:s')) { - ?> -
- -
- + $announcement = rex_config::get('maintenance', 'announcement', ''); + $start_date = rex_config::get('maintenance', 'announcement_start_date'); + $end_date = rex_config::get('maintenance', 'announcement_end_date'); + $current_date = date('Y-m-d H:i:s'); + + if ($announcement !== '' && $start_date <= $current_date && $end_date >= $current_date) { + ?> +
+ +
+ From 905e2eb35ed14b7fcd7825a74748d6f0fe651a37 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 18:24:46 +0200 Subject: [PATCH 3/8] Update frontend_password.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vorbereitend für Zusammenführung der Fragmente --- fragments/maintenance/frontend_password.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fragments/maintenance/frontend_password.php b/fragments/maintenance/frontend_password.php index c1694ba..6bc02df 100644 --- a/fragments/maintenance/frontend_password.php +++ b/fragments/maintenance/frontend_password.php @@ -24,13 +24,13 @@ line-height: 1.5; text-align: center; } - .maintenance-error a { + .maintenance-login a { color: #666; } - .maintenance-error a:hover { + .maintenance-login a:hover { color: #111; } - .maintenance-error-title { + .maintenance-login-title { margin: 0; font-size: 40px; font-weight: 700; @@ -38,7 +38,7 @@ text-shadow: 0 4px 2px rgba(255, 255, 255, 1); line-height: 1.2em; } - .maintenance-error-message { + .maintenance-login-message { padding: 0 20px; } @@ -65,8 +65,8 @@
-
-

Login

+ - From 5b131f9ca5708ade4da52bcafc2900740976d643 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 23:56:20 +0200 Subject: [PATCH 4/8] outsource frontend-css --- assets/css/maintenance-frontend.css | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 assets/css/maintenance-frontend.css diff --git a/assets/css/maintenance-frontend.css b/assets/css/maintenance-frontend.css new file mode 100644 index 0000000..e5056b4 --- /dev/null +++ b/assets/css/maintenance-frontend.css @@ -0,0 +1,74 @@ +html, body { + height: 100%; + background-color: #f7f7f7; +} +body { + display: flex; + align-items: center; +} +.maintenance-container { + max-width: 500px; + min-width: 300px; + width: 50%; + margin: 0 auto; + color: #999; + font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; + font-size: 15px; + line-height: 1.5; + text-align: center; +} +.maintenance-error a { + color: #666; +} +.maintenance-error a:hover { + color: #111; +} +.maintenance-error-title { + margin: 0; + font-size: 40px; + font-weight: 700; + color: #5b98d7; + text-shadow: 0 4px 2px rgba(255, 255, 255, 1); + line-height: 1.2em; +} +.maintenance-error-message { + padding: 0 20px; +} + +.maintenance-login a { + color: #666; +} +.maintenance-login a:hover { + color: #111; +} +.maintenance-login-title { + margin: 0; + font-size: 40px; + font-weight: 700; + color: #5b98d7; + text-shadow: 0 4px 2px rgba(255, 255, 255, 1); + line-height: 1.2em; +} +.maintenance-login-message { + padding: 0 20px; +} + +.maintenance-pw-input { + margin: 1em 1em 1em 1em; + padding: 1em 2em 1em 1em; + background: rgba(255,255,255,1); + border-radius: 30px; + border: none; + font-size: 1em; + } + +.maintenance-pw-btn { + margin: 1em 1em 1em 1em; + padding: 1em 1em 1em 1em; + background: #5b98d7; + border-radius: 10px; + color: #ffffff; + border: none; + font-size: 1em; + cursor: default; + } From 45e475f6b10c31f5cfd769044966d8f8e5eecf02 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 23:57:02 +0200 Subject: [PATCH 5/8] re-sort fragments and integrate password as subfragment --- fragments/maintenance/announcement.php | 12 ++++ fragments/maintenance/frontend.php | 62 +++-------------- fragments/maintenance/frontend_password.php | 77 --------------------- fragments/maintenance/login.php | 10 +++ lib/Maintenance.php | 4 +- 5 files changed, 32 insertions(+), 133 deletions(-) create mode 100644 fragments/maintenance/announcement.php delete mode 100644 fragments/maintenance/frontend_password.php create mode 100644 fragments/maintenance/login.php diff --git a/fragments/maintenance/announcement.php b/fragments/maintenance/announcement.php new file mode 100644 index 0000000..26278aa --- /dev/null +++ b/fragments/maintenance/announcement.php @@ -0,0 +1,12 @@ += $current_date) { + ?> +
+ +
+ diff --git a/fragments/maintenance/frontend.php b/fragments/maintenance/frontend.php index 0fa9260..1a34e7f 100644 --- a/fragments/maintenance/frontend.php +++ b/fragments/maintenance/frontend.php @@ -3,65 +3,21 @@ - Maintenance - + <?= rex::getServerName() ?> - Maintenance +
-

Maintenance
Wartung

-

This website is temporarily unavailable

-

Diese Website ist temporär nicht erreichbar

+

Maintenance / Wartung

+

This website is temporarily unavailable.

+

Diese Website ist vorübergehend nicht erreichbar.

= $current_date) { - ?> -
- -
- + // Subfragment announcement.php ausgeben + echo $this->subfragment('maintenance/announcement.php'); + echo $this->subfragment('maintenance/login.php'); + ?>
diff --git a/fragments/maintenance/frontend_password.php b/fragments/maintenance/frontend_password.php deleted file mode 100644 index 6bc02df..0000000 --- a/fragments/maintenance/frontend_password.php +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - Maintenance - - - -
- -
- - diff --git a/fragments/maintenance/login.php b/fragments/maintenance/login.php new file mode 100644 index 0000000..bc0a3d1 --- /dev/null +++ b/fragments/maintenance/login.php @@ -0,0 +1,10 @@ + + + diff --git a/lib/Maintenance.php b/lib/Maintenance.php index 3405531..769015b 100644 --- a/lib/Maintenance.php +++ b/lib/Maintenance.php @@ -196,9 +196,7 @@ public static function checkFrontend(): void $responsecode = strval($addon->getConfig('http_response_code')); // @phpstan-ignore-line $mpage = new rex_fragment(); - if (strval($addon->getConfig('authentification_mode')) === 'password') { // @phpstan-ignore-line - exit($mpage->parse('maintenance/frontend_password.php')); - } elseif ($redirect_url !== '') { + if ($redirect_url !== '') { rex_response::setStatus(rex_response::HTTP_MOVED_TEMPORARILY); rex_response::sendRedirect($redirect_url); } From 37362c250c2cd7d24cf2795715775b2ed92e256a Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sun, 18 Aug 2024 23:57:15 +0200 Subject: [PATCH 6/8] Add preview mode --- lang/de_de.lang | 2 ++ package.yml | 4 ++++ pages/frontend.php | 10 ++++++++++ pages/preview.php | 7 +++++++ 4 files changed, 23 insertions(+) create mode 100644 pages/preview.php diff --git a/lang/de_de.lang b/lang/de_de.lang index 1725171..94a1348 100644 --- a/lang/de_de.lang +++ b/lang/de_de.lang @@ -86,3 +86,5 @@ maintenance_allowed_yrewrite_domains_label = Liste erlaubter YRewrite-Domains maintenance_allowed_yrewrite_domains_notice = YRewrite-Domains eintragen, die nicht gesperrt werden sollen. maintenance_copy_url_title = URL kopieren + +maintenance_preview_title = Vorschau diff --git a/package.yml b/package.yml index d21831b..9ed82f3 100644 --- a/package.yml +++ b/package.yml @@ -17,6 +17,10 @@ page: backend: title: translate:maintenance_backend_title icon: rex-icon fa-user-gear + preview: + title: translate:maintenance_preview_title + icon: rex-icon fa-eye + hidden: true help: title: translate:maintenance_docs_title subPath: README.md diff --git a/pages/frontend.php b/pages/frontend.php index dbb4026..a517115 100644 --- a/pages/frontend.php +++ b/pages/frontend.php @@ -136,7 +136,16 @@ ' . rex_i18n::msg('maintenance_preview') . ''; +$fragment = new rex_fragment(); +$fragment->setVar('class', 'info', false); +$fragment->setVar('title', rex_i18n::msg('maintenance_preview_title'), false); +$fragment->setVar('body', $preview, false); +echo $fragment->parse('core/page/section.php'); + +/* Kopieren der URL für den Wartungsmodus */ $copy = '
    '; $url = '' . rex::getServer() . '?maintenance_secret=' . rex_config::get('maintenance', 'maintenance_secret'); $copy .= '
  • @@ -172,6 +181,7 @@ $fragment->setVar('title', rex_i18n::msg('maintenance_copy_url_title'), false); $fragment->setVar('body', $copy, false); echo $fragment->parse('core/page/section.php'); + ?>
diff --git a/pages/preview.php b/pages/preview.php new file mode 100644 index 0000000..07f08db --- /dev/null +++ b/pages/preview.php @@ -0,0 +1,7 @@ +parse('maintenance/frontend.php'); +exit; From 0bdfc2c2ed5fe3120c570c15590c3950d6e213e4 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Mon, 19 Aug 2024 00:00:08 +0200 Subject: [PATCH 7/8] Update de_de.lang --- lang/de_de.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/de_de.lang b/lang/de_de.lang index 94a1348..1805b1c 100644 --- a/lang/de_de.lang +++ b/lang/de_de.lang @@ -88,3 +88,4 @@ maintenance_allowed_yrewrite_domains_notice = YRewrite-Domains eintragen, die ni maintenance_copy_url_title = URL kopieren maintenance_preview_title = Vorschau +maintenance_preview = Vorschau in neuem Fenster anzeigen From aed886c9ef107abbc41a5014445046e8d40422f7 Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Mon, 19 Aug 2024 00:13:08 +0200 Subject: [PATCH 8/8] add reload-button (better ux) --- assets/css/maintenance-frontend.css | 16 ++++++++++++++-- fragments/maintenance/frontend.php | 1 + fragments/maintenance/reload.php | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 fragments/maintenance/reload.php diff --git a/assets/css/maintenance-frontend.css b/assets/css/maintenance-frontend.css index e5056b4..2e561b3 100644 --- a/assets/css/maintenance-frontend.css +++ b/assets/css/maintenance-frontend.css @@ -60,7 +60,7 @@ body { border-radius: 30px; border: none; font-size: 1em; - } +} .maintenance-pw-btn { margin: 1em 1em 1em 1em; @@ -70,5 +70,17 @@ body { color: #ffffff; border: none; font-size: 1em; - cursor: default; + cursor: pointer; +} + +.maintenance-btn { + display: inline-block; + text-decoration: none; + margin: 1em 1em 1em 1em; + padding: 1em 1em 1em 1em; + background: #5b98d7; + border-radius: 10px; + color: #ffffff; + border: none; + font-size: 1em; } diff --git a/fragments/maintenance/frontend.php b/fragments/maintenance/frontend.php index 1a34e7f..32caf59 100644 --- a/fragments/maintenance/frontend.php +++ b/fragments/maintenance/frontend.php @@ -17,6 +17,7 @@ // Subfragment announcement.php ausgeben echo $this->subfragment('maintenance/announcement.php'); echo $this->subfragment('maintenance/login.php'); + echo $this->subfragment('maintenance/reload.php'); ?> diff --git a/fragments/maintenance/reload.php b/fragments/maintenance/reload.php new file mode 100644 index 0000000..30ae048 --- /dev/null +++ b/fragments/maintenance/reload.php @@ -0,0 +1,6 @@ + +
+ Reload +