cleanup, classes lifted to bootstrap 5

This commit is contained in:
Tealk 2021-03-18 23:20:41 +01:00
parent 12531401a5
commit 82c9ecbaad
No known key found for this signature in database
GPG Key ID: 5FE349ABC863E7F9
11 changed files with 136 additions and 114 deletions

View File

@ -36,13 +36,13 @@ Template::render_header(_("Dashboard"), true);
<div class="timeline">
<div class="line text-muted"></div>
<h3><?php echo _("New incident"); ?></h3>
<form id="new-incident" action="<?php echo WEB_URL; ?>/admin/?new=incident" method="POST" class="">
<form id="new-incident" action="<?php echo WEB_URL; ?>/admin/?new=incident" method="POST">
<div class="card">
<?php if (isset($message)) { ?>
<p class="alert alert-danger"><?php echo $message ?></p>
<?php
} ?>
<div id="status-container" class="">
<div id="status-container">
<?php
if (isset($_POST['services']) && !is_array($_POST['services'])) {
$post_services = array($_POST['services']);
@ -73,8 +73,8 @@ Template::render_header(_("Dashboard"), true);
<div class="card-colore card-header bg-primary border-primary">
<input type="text" name="title" id="title" placeholder="<?php echo _("Title"); ?>" value="<?php echo (isset($_POST['title']) ? htmlspecialchars($_POST['title']) : ''); ?>" required>
<span id="time" class="float-end">
<input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time']) ? htmlspecialchars($_POST['time']) : ''); ?>" class="pull-right" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time"); ?>">
<input id="time_input_js" name="time_js" type="hidden" class="pull-right">
<input id="time_input" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="time" value="<?php echo (isset($_POST['time']) ? htmlspecialchars($_POST['time']) : ''); ?>" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" placeholder="<?php echo _("Time"); ?>">
<input id="time_input_js" name="time_js" type="hidden">
</span>
</div>
<div class="card-body text-primary">
@ -83,8 +83,8 @@ Template::render_header(_("Dashboard"), true);
<div class="card-footer bg-transparent border-primary">
<small><?php echo _("Posted by"); ?>: <?php echo $user->get_username(); ?></small>
<span class="float-end" id="end_time_wrapper"><?php echo _("Ending"); ?>:&nbsp;
<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" class="pull-right" placeholder="<?php echo _("End time"); ?>" value="<?php echo (isset($_POST['end_time']) ? htmlspecialchars($_POST['end_time']) : ''); ?>">
<input id="end_time_js" name="end_time_js" type="hidden" class="pull-right">
<input id="end_time" title="Use ISO 8601 format (e.g. 2017-11-23T19:50:51+00:00)" type="text" pattern="(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))" name="end_time" placeholder="<?php echo _("End time"); ?>" value="<?php echo (isset($_POST['end_time']) ? htmlspecialchars($_POST['end_time']) : ''); ?>">
<input id="end_time_js" name="end_time_js" type="hidden">
</span>
</div>
</article>

View File

@ -38,10 +38,10 @@ Template::render_header(_("Lost password"));
<form action="<?php echo WEB_URL; ?>/admin/?do=lost-password" method="post">
<?php if (!isset($_GET['id']) || !isset($_GET['token'])) { ?>
<label for="email"><?php echo _("Email"); ?>:</label>
<div class="input-group pull-right">
<div class="input-group float-end">
<input class="form-control" name="email" id="email" placeholder="<?php echo _("Email"); ?>" type="email" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-success pull-right"><?php echo _("Submit request"); ?></button>
<button type="submit" class="btn btn-success float-end"><?php echo _("Submit request"); ?></button>
</span>
</div>
<?php } else {
@ -54,7 +54,7 @@ Template::render_header(_("Lost password"));
<input id="new_password" placeholder="<?php echo _("New password"); ?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password"); ?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password"); ?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password"); ?></button>
<button type="submit" class="btn btn-primary float-end margin-top"><?php echo _("Change password"); ?></button>
<?php
}
?>

View File

@ -43,5 +43,5 @@ Template::render_header(_("New user"), true); ?>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
</form>

View File

@ -182,5 +182,5 @@ Template::render_header(_("Options"), true);
<button class="btn btn-primary pull-right" type="submit">Save Settings</button>
<button class="btn btn-primary float-end" type="submit">Save Settings</button>
</form>

View File

@ -84,5 +84,5 @@ if (!$boolEdit) {
echo '<input type="hidden" id="id" name="id" value="' . $group_id . '">';
}
?>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Submit"); ?></button>
</form>

View File

@ -85,5 +85,5 @@ if (!$boolEdit) {
echo '<input type="hidden" id="id" name="id" value="' . $service_id . '">';
}
?>
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Submit"); ?></button>
<button type="submit" class="btn btn-primary float-end><?php echo _("Submit"); ?></button>
</form>

View File

@ -18,17 +18,19 @@ if (isset($message)) {
<p class="alert alert-danger"><?php echo $message; ?></p>
<?php } ?>
<section>
<h3 class="pull-left"><?php echo _("Services"); ?></h3>
<?php if ($user->get_rank() <= 1) { ?>
<form action="?do=settings&new=service" method="post">
<div class="input-group pull-right new-service">
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service" class="btn btn-success pull-right"><?php echo _("Add new service"); ?></a>
</div>
</form>
<?php } ?>
<div class="table-responsive">
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() <= 1) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service" class="btn btn-success" role="button"><?php echo _("Add new service"); ?></a>
<?php } ?>
</div>
<div class="float-start">
<h3><?php echo _("Services"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
<div>
<table class="table">
<thead>
<tr>
<!--<th scope="col"><?php echo _("ID"); ?></th>-->
@ -51,7 +53,7 @@ if (isset($message)) {
echo "<td>" . $result['group_name'] . "</td>";
if ($user->get_rank() <= 1) {
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=service&delete=' . $result['id'] . '" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=service&delete=' . $result['id'] . '" class="elete-service"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
} ?>
@ -61,83 +63,95 @@ if (isset($message)) {
</section>
<section>
<h3 class="pull-left"><?php echo _("Services Groups"); ?></h3>
<?php if ($user->get_rank() <= 1) { ?>
<form action="?do=settings&new=service-group" method="post">
<div class="input-group pull-right new-service">
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service-group" class="btn btn-success pull-right"><?php echo _("Add new service group"); ?></a>
</div>
</form>
<?php } ?>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<!--<th scope="col"><?php echo _("ID"); ?></th>-->
<th scope="col"><?php echo _("Group Name"); ?></th>
<th scope="col"><?php echo _("In use by"); ?></th>
<th scope="col"><?php echo _("Description"); ?></th>
<th scope="col"><?php echo _("Visibility"); ?></th>
<?php if ($user->get_rank() <= 1) { ?>
<th scope="col" class="text-center"><?php echo _("Delete"); ?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT sg.* , (SELECT COUNT(*) FROM services WHERE services.group_id = sg.id) AS counter FROM services_groups AS sg ORDER BY sg.id ASC");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
//echo "<td>".$result['id']."</td>";
echo '<td><a href="' . WEB_URL . '/admin?do=edit-service-group&id=' . $result['id'] . '">' . $result['name'] . '</a></th>';
echo '<td> <span class="badge badge-danger ml-2">' . $result['counter'] . '</span>';
echo "<td>" . $result['description'] . "</td>";
echo "<td>" . $visibility[$result['visibility']] . "</td>";
if ($user->get_rank() <= 1) {
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=groups&delete=' . $result['id'] . '" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
} ?>
</tbody>
</table>
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() <= 1) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-service-group" class="btn btn-success" role="button"><?php echo _("Add new service group"); ?></a>
<?php } ?>
</div>
<div class="float-start">
<h3><?php echo _("Services Groups"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
<div>
<div>
<table class="table">
<thead>
<tr>
<!--<th scope="col"><?php echo _("ID"); ?></th>-->
<th scope="col"><?php echo _("Group Name"); ?></th>
<th scope="col"><?php echo _("In use by"); ?></th>
<th scope="col"><?php echo _("Description"); ?></th>
<th scope="col"><?php echo _("Visibility"); ?></th>
<?php if ($user->get_rank() <= 1) { ?>
<th scope="col" class="text-center"><?php echo _("Delete"); ?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT sg.* , (SELECT COUNT(*) FROM services WHERE services.group_id = sg.id) AS counter FROM services_groups AS sg ORDER BY sg.id ASC");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
//echo "<td>".$result['id']."</td>";
echo '<td><a href="' . WEB_URL . '/admin?do=edit-service-group&id=' . $result['id'] . '">' . $result['name'] . '</a></th>';
echo '<td> <span class="badge badge-danger ml-2">' . $result['counter'] . '</span>';
echo "<td>" . $result['description'] . "</td>";
echo "<td>" . $visibility[$result['visibility']] . "</td>";
if ($user->get_rank() <= 1) {
echo '<td class="text-center"><a href="' . WEB_URL . '/admin/?do=settings&type=groups&delete=' . $result['id'] . '" class=" delete-service"><i class="fa fa-trash"></i></a></td>';
}
echo "</tr>";
} ?>
</tbody>
</table>
</div>
</section>
<section>
<h3 class="pull-left"><?php echo _("Users"); ?></h3>
<?php if ($user->get_rank() == 0) { ?> <a href="<?php echo WEB_URL; ?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user"); ?></a><?php } ?>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col"><?php echo _("ID"); ?></th>
<th scope="col"><?php echo _("Username"); ?></th>
<th scope="col"><?php echo _("Name"); ?></th>
<th scope="col"><?php echo _("Surname"); ?></th>
<th scope="col"><?php echo _("Email"); ?></th>
<th scope="col"><?php echo _("Role"); ?></th>
<th scope="col" class="text-center">Active</th>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT * FROM users");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $result['id'] . "</td>";
echo "<td><a href='" . WEB_URL . "/admin/?do=user&id=" . $result['id'] . "'>" . $result['username'] . "</a></td>";
echo "<td>" . $result['name'] . "</td>";
echo "<td>" . $result['surname'] . "</td>";
echo "<td><a href=\"mailto:" . $result['email'] . "\">" . $result['email'] . "</a></td>";
echo "<td>" . $permissions[$result['permission']] . "</td>";
echo "<td class=\"text-center\"><i class='fa fa-" . ($result['active'] ? "check success" : "times danger") . "'></i></td>";
echo "</tr>";
} ?>
</tbody>
</table>
<div class="settings-header">
<div class="float-end">
<?php if ($user->get_rank() == 0) { ?>
<a href="<?php echo WEB_URL; ?>/admin/?do=new-user" class="btn btn-success" role="button"><?php echo _("Add new user"); ?></a>
<?php } ?>
</div>
<div class="float-start">
<h3><?php echo _("Users"); ?></h3>
</div>
<div class="clearfix"></div>
</div>
<div>
<div>
<table class="table">
<thead>
<tr>
<th scope="col"><?php echo _("ID"); ?></th>
<th scope="col"><?php echo _("Username"); ?></th>
<th scope="col"><?php echo _("Name"); ?></th>
<th scope="col"><?php echo _("Surname"); ?></th>
<th scope="col"><?php echo _("Email"); ?></th>
<th scope="col"><?php echo _("Role"); ?></th>
<th scope="col" class="text-center">Active</th>
</tr>
</thead>
<tbody>
<?php
$query = $mysqli->query("SELECT * FROM users");
while ($result = $query->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $result['id'] . "</td>";
echo "<td><a href='" . WEB_URL . "/admin/?do=user&id=" . $result['id'] . "'>" . $result['username'] . "</a></td>";
echo "<td>" . $result['name'] . "</td>";
echo "<td>" . $result['surname'] . "</td>";
echo "<td><a href=\"mailto:" . $result['email'] . "\">" . $result['email'] . "</a></td>";
echo "<td>" . $permissions[$result['permission']] . "</td>";
echo "<td class=\"text-center\"><i class='fa fa-" . ($result['active'] ? "check success" : "times danger") . "'></i></td>";
echo "</tr>";
} ?>
</tbody>
</table>
</div>
</section>

View File

@ -186,12 +186,12 @@ class Incident implements JsonSerializable
<div class="card-colore icon bg-<?php echo $classes[$this->type]; ?>"><i class="<?php echo $icons[$this->type]; ?>"></i></div>
<div class="card-header bg-<?php echo $classes[$this->type]; ?> border-<?php echo $classes[$this->type]; ?>">
<?php echo $this->title; ?>
<time class="pull-right timeago" datetime="<?php echo $this->date; ?>"><?php echo $this->date; ?></time>
<div class="float-end">
<?php if ($admin) {
echo '<a href="' . WEB_URL . '/admin/?delete=' . $this->id . '" class="pull-right delete"><i class="fa fa-trash"></i></a>';
echo '<a href="' . WEB_URL . '/admin/?delete=' . $this->id . '" class="delete"><i class="fa fa-trash"></i></a>';
} ?>
</div>
<time class="float-end timeago" datetime="<?php echo $this->date; ?>"><?php echo $this->date; ?></time>
</div>
<div class="card-body">
<?php echo $Parsedown->setBreaksEnabled(true)->text($this->text); ?>
@ -199,10 +199,10 @@ class Incident implements JsonSerializable
<div class="card-footer bg-transparent border-<?php echo $classes[$this->type]; ?>">
<?php echo _("Impacted service(s): ");
foreach ($this->service_name as $value) {
echo '<span class="label label-default">' . $value . '</span>&nbsp;';
echo '<br><span class="badge bg-secondary">' . $value . '</span>&nbsp;';
}
if (isset($this->end_date)) { ?>
<span class="pull-right"><?php echo strtotime($this->end_date) > time() ? _("Ending") : _("Ended"); ?>:&nbsp;<time class="pull-right timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<span class="float-end"><?php echo strtotime($this->end_date) > time() ? _("Ending") : _("Ended"); ?>:&nbsp;<time class="timeago" datetime="<?php echo $this->end_date; ?>"><?php echo $this->end_date; ?></time></span>
<?php } ?>
</div>
</article>

View File

@ -311,7 +311,7 @@ class User
</div>
</div>
<div class="input-group">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change name"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change name"); ?></button>
</div>
</form>
<?php
@ -331,16 +331,16 @@ class User
<div class="input-group">
<input type="text" class="form-control" name="username" required value="<?php echo htmlspecialchars($this->username, ENT_QUOTES); ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change username"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change username"); ?></button>
</span>
</div>
<?php
} else { ?><?php echo $this->username . " ";
if ($user->get_rank() >= 1) {
echo "<i class='fa fa-" . ($this->active ? "check success" : "times danger") . "'></i>";
}
}
?>
if ($user->get_rank() >= 1) {
echo "<i class='fa fa-" . ($this->active ? "check success" : "times danger") . "'></i>";
}
}
?>
</div>
</div>
</form>
@ -354,7 +354,7 @@ class User
echo "<option value='$key' " . ($key == $this->rank ? "selected" : "") . ">$value</option>";
} ?>
</select><span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change role"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change role"); ?></button>
</span>
</div><?php } else {
echo $permissions[$this->rank];
@ -371,7 +371,7 @@ class User
<div class="input-group">
<input type="email" class="form-control" name="email" value="<?php echo $this->email; ?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-primary pull-right"><?php echo _("Change email"); ?></button>
<button type="submit" class="btn btn-primary float-end"><?php echo _("Change email"); ?></button>
</span>
</div>
</div>
@ -401,7 +401,7 @@ class User
<input id="new_password" placeholder="<?php echo _("New password"); ?>" type="password" class="form-control" name="password">
<label for="new_password_check"><?php echo _("Repeat password"); ?></label>
<input id="new_password_check" placeholder="<?php echo _("Repeat password"); ?>" type="password" class="form-control" name="password_repeat">
<button type="submit" class="btn btn-primary pull-right margin-top"><?php echo _("Change password"); ?></button>
<button type="submit" class="btn btn-primary float-end margin-top"><?php echo _("Change password"); ?></button>
</div>
</div>
</form>

View File

@ -222,7 +222,7 @@ article.card textarea {
}
.new-service {
width: 40%;
width: 100%;
min-width: 250px;
}
@ -285,6 +285,14 @@ body h3 {
margin-top: 18px;
}
.settings-header {
padding-top: 20px;
}
.settings-header .float-start h3 {
margin: 0;
}
.row.user .input-group {
width: 100%;
margin-bottom: 5px;

View File

@ -300,7 +300,7 @@ if (!empty($message)) {
<div class="col-sm-6"><label for="password"><?php echo _("Password"); ?>:</label><input type="password" name="password" value="<?php echo ((isset($_POST['password'])) ? htmlspecialchars($_POST['password'], ENT_QUOTES) : ''); ?>" id="password" placeholder="<?php echo _("Password"); ?>" class="form-control" required></div>
<div class="col-sm-6">
<input type="hidden" value="0" name="permission">
<button type="submit" class="btn btn-success pull-right"><?php echo _("Run install!"); ?></button>
<button type="submit" class="btn btn-success float-end"><?php echo _("Run install!"); ?></button>
</div>
</div>
</section>