- Add dynamic string

- Make header biger
This commit is contained in:
Dorian Zedler 2021-07-11 10:34:02 +02:00
parent 61cc21d199
commit ec50558e9c
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 71 additions and 70 deletions

View file

@ -2,50 +2,38 @@
defined('L_EXEC') or die(); defined('L_EXEC') or die();
// Available placeholders: $translations['home']['menu']['manageTimerLabel'] = "Manage timer";
// {$customizationConfig['organizationName']} $translations['home']['menu']['changePasswordLabel'] = "Change password";
// {$customizationConfig['fullOrganizationName']} $translations['home']['menu']['openTimerLabel'] = "OpenTimer";
// {$customizationConfig['supportEmailAddress']} $translations['home']['menu']['logoutLabel'] = "Logout";
$translations['home']['hello'] = "Hallo"; $translations['currentTimer'] = "Current timer";
$translations['home']['welcomeMessage'] = "Wilkommen bei deinem {$customizationConfig['organizationName']}-Account - Ein Login für alles"; $translations['manageTimer'] = "Manage timer";
$translations['home']['menu']['linksLabel'] = "{$customizationConfig['organizationName']} Dienste"; $translations['header'] = "Header";
$translations['home']['menu']['changePasswordLabel'] = "Passwort ändern"; $translations['time'] = "Time";
$translations['home']['menu']['changeEmailLabel'] = "E-Mail-Adresse ändern"; $translations['startTimer'] = "Start timer";
$translations['home']['menu']['generateJitsiLinkLabel'] = "Jitsi Link generieren"; $translations['loading'] = "Loading...";
$translations['home']['menu']['logoutLabel'] = "Abmelden";
$translations['home']['menu']['loginLabel'] = "Anmelden";
// These rules are currently hard coded!
$translations['passwordRules'][0] = "Das Passwort muss mindestens 7 Zeichen lang sein.";
$translations['passwordRules'][1] = "Das Passwort muss mindestens eine Zahl oder ein Sonderzeichen enthalten.";
$translations['passwordRules'][2] = "Das Passwort muss mindestens einen Klein- und einen Großbuchstaben enthalten.";
$translations['results']['internalError'] = "Interner Fehler. Falls das Problem bestehen bleibt, kontaktieren sie bitte <a href=\"mailto:{$customizationConfig['supportEmailAddress']}?body=Fehlercode: %ERR%; URI: {$_SERVER['REQUEST_URI']}\">{$customizationConfig['supportEmailAddress']}</a> (%ERR%)"; $translations['results']['permissionDenied'] = "Access denied";
$translations['results']['permissionDenied'] = "Zugriff verweigert"; $translations['results']['loginFailed'] = "Invalid credentials";
$translations['results']['noPermissionToAnyPage'] = str_replace("%ERR%", "0005", $translations['results']['internalError']); $translations['results']['loginRequired'] = "Please sign in first!";
$translations['results']['loginSuccess'] = "Erfolgreich angemeldet"; $translations['results']['oldPasswordIsWrong'] = "The current password is wrong!";
$translations['results']['loginFailed'] = "Ungültige Zugangsdaten"; $translations['results']['newPasswordAndRepeatDidNotMatch'] = "The passwords are not equal.";
$translations['results']['loginRequired'] = "Bitte zuerst anmelden!"; $translations['results']['newPasswordMustNotBeOldPassword'] = "The new password must not be the old password.";
$translations['results']['oldPasswordIsWrong'] = "Das aktulle Passwort ist falsch"; $translations['results']['passwordChangedSuccessfully'] = "Your password was successfully changed.";
$translations['results']['newPasswordMustNotBeEqualToOldPassword'] = "Das neue Passwort darf nicht mit dem Alten übereinstimmen"; $translations['results']['timerSetSuccessfully'] = "The timer was started successfully.";
$translations['results']['newPasswordAndRepeatDidNotMatch'] = "Die Passwörter stimmen nicht überein";
$translations['results']['passwordIsTooShort'] = $translations['passwordRules'][0];
$translations['results']['newPasswordMustNotBeOldPassword'] = "Das neue Passwort darf nicht mit dem Alten übereinstimmen.";
$translations['results']['passwordChangedSuccessfully'] = "Dein Passwort wurde erfolgreich geändert.";
$translations['results']['timerSetSuccessfully'] = "The timer was started successfully";
$translations['globals']['title'] = "{$customizationConfig['organizationName']} Account"; $translations['globals']['title'] = "Itsblue synced timer";
$translations['globals']['usernameLabel'] = "Benutzername"; $translations['globals']['usernameLabel'] = "Username";
$translations['globals']['passwordLabel'] = "Passwort"; $translations['globals']['passwordLabel'] = "Password";
$translations['globals']['emailAddress'] = "E-Mail-Adresse"; $translations['globals']['emailAddress'] = "E-Mail-Address";
$translations['login']['title'] = "Bitte anmelden"; $translations['login']['title'] = "Please sign in";
$translations['login']['submitLabel'] = "Anmelden"; $translations['login']['submitLabel'] = "Sign in";
$translations['login']['footnote'] = "Login für Mitglieder des {$customizationConfig['fullOrganizationName']}"; $translations['login']['footnote'] = "Login for the itsblue synced timer. <a href=\"https://itsblue.de\">itsblue.de</a>";
$translations['changePassword']['passwordRulesHeader'] = "Regeln für Passwörter:"; $translations['changePassword']['currentPasswordLabel'] = "Current password";
$translations['changePassword']['currentPasswordLabel'] = "Aktuelles Passwort"; $translations['changePassword']['newPasswordLabel'] = "New password";
$translations['changePassword']['newPasswordLabel'] = "Neues Passwort"; $translations['changePassword']['repeatNewPasswordLabel'] = "Repeat new password";
$translations['changePassword']['repeatNewPasswordLabel'] = "Neues Password Wiederholen"; $translations['changePassword']['submitLabel'] = "Change password";
$translations['changePassword']['submitLabel'] = "Passwort ändern";

View file

@ -146,55 +146,68 @@ class LandingpageTheme
$this->_printHeader(); $this->_printHeader();
?> ?>
<style> <style>
.flex-equal>* {
flex: 1;
}
@media (min-width: 768px) {
.flex-md-equal>* {
flex: 1;
}
}
</style> </style>
<body> <body>
<main> <main>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="#">Itsblue synced timer</a> <a class="navbar-brand" href="#"><?= $this->_trId("globals.title") ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo02"> <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
<ul class="navbar-nav nav-pills me-auto mb-2 mb-lg-0"> <ul class="navbar-nav nav-pills me-auto mb-2 mb-lg-0">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a> <a class="nav-link active" aria-current="page" href="#"><?= $this->_trId("home.menu.manageTimerLabel") ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" aria-current="page" target="blank" href="<?= $this->_globalConfig["basePath"] ?>/t/<?= $_SESSION["auth"]["username"] ?>">Open timer</a> <a class="nav-link" aria-current="page" target="blank" href="<?= $this->_globalConfig["basePath"] ?>/t/<?= $_SESSION["auth"]["username"] ?>"><?= $this->_trId("home.menu.openTimerLabel") ?></a>
</li> </li>
</ul> </ul>
<form action="logout/submit" method="post" class="d-felx"> <form action="logout/submit" method="post" class="d-felx">
<input type="submit" value="logout" class="btn btn-secondary"> <input type="submit" value="<?= $this->_trId("home.menu.logoutLabel") ?>" class="btn btn-secondary">
</form> </form>
</div> </div>
</div> </div>
</nav> </nav>
<div class="container" style="margin-top: 20px;"> <div class="container mt-3">
<h1>Curent timer</h1> <div class="card text-white bg-dark mb-3">
<h4 id="header">Loading ...</h4> <div class="card-header"><?= $this->_trId("currentTimer") ?></div>
<h4 id="timer">00:00:00</h4> <div class="card-body">
<h1>Manage timer</h1> <h3 id="header"><?= $this->_trId("loading") ?></h3>
<h1 class="card-title" id="timer">00:00:00</h1>
</div>
</div>
<div class="card text-dark bg-light mb-3">
<div class="card-header w-100"><?= $this->_trId("manageTimer") ?></div>
<div class="card-body w-100" style="text-align: left;">
<?php $this->_printResultAlert(); ?> <?php $this->_printResultAlert(); ?>
<form method="post" action="manage/submit"> <form method="post" action="manage/submit">
<div class="form-group">
</div>
<input name="cat" type="hidden" value="5-6">
<div class="mb-3"> <div class="mb-3">
<label for="header">Header</label> <label for="header"><?= $this->_trId("header") ?></label>
<textarea class="form-control" name="header" rows="3" required><?= $userData["header"] ?></textarea> <textarea class="form-control" name="header" rows="3" required><?= $userData["header"] ?></textarea>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="time">Time</label> <label for="time"><?= $this->_trId("time") ?></label>
<input type="number" name="time" class="form-control" value="<?= $userData["time"] ?>" required> <input type="number" name="time" class="form-control" value="<?= $userData["time"] ?>" required>
</div> </div>
<button type="submit" class="btn btn-primary">Start timer</button> <button type="submit" class="btn btn-primary"><?= $this->_trId("startTimer") ?></button>
</form> </form>
</div> </div>
</div>
</div>
</main> </main>
</body> </body>
<?php <?php
@ -247,8 +260,8 @@ class LandingpageTheme
<div class="d-flex w-100 h-100 p-3 mx-auto flex-column"> <div class="d-flex w-100 h-100 p-3 mx-auto flex-column">
<main class="px-3 h-100 mt-auto w-100"> <main class="px-3 h-100 mt-auto w-100">
<h4 id="header">Loading ...</h4> <h4 id="header"><?= $this->_trId("loading") ?></h4>
<div style="justify-content:center; align-items:center; display:flex;"> <div class="h-80" style="justify-content:center; align-items:center; display:flex;">
<h4 id="timer">00:00:00</h4> <h4 id="timer">00:00:00</h4>
</div> </div>
</main> </main>
@ -270,10 +283,11 @@ class LandingpageTheme
for (var i = 0; 3 > i; i++) { // Iterate for better better convergence for (var i = 0; 3 > i; i++) { // Iterate for better better convergence
curFontSize *= targetWidth / (textElem.offsetWidth / textElem.parentNode.offsetWidth); curFontSize *= targetWidth / (textElem.offsetWidth / textElem.parentNode.offsetWidth);
textElem.style.fontSize = curFontSize + "pt"; textElem.style.fontSize = curFontSize + "pt";
headerTextElem.fontSize = curFontSize / 2 + "pt" headerTextElem.style.fontSize = curFontSize * 0.3 + "pt"
} }
} }
updateTextSize(); updateTextSize();
window.onresize = updateTextSize;
</script> </script>
</footer> </footer>
@ -302,10 +316,9 @@ class LandingpageTheme
var processData = function() { var processData = function() {
if (this.readyState === 4 && this.status === 200) { if (this.readyState === 4 && this.status === 200) {
currentData = JSON.parse(this.responseText); currentData = JSON.parse(this.responseText);
if(currentData["status"] === 200) { if (currentData["status"] === 200) {
currentData = currentData["data"] currentData = currentData["data"]
} } else {
else {
document.getElementById("timer").innerHTML = "error: " + this.status document.getElementById("timer").innerHTML = "error: " + this.status
} }
} else if (this.readyState === 4 && this.status !== 0) { } else if (this.readyState === 4 && this.status !== 0) {