Skip to content

Commit 2a6928d

Browse files
committed
Next pass at bootstrap conversion
1 parent 49634ae commit 2a6928d

File tree

2 files changed

+46
-62
lines changed

2 files changed

+46
-62
lines changed

src/static/a/BNETDocs.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* BNETDocs, the documentation and discussion website for Blizzard protocols
3-
* Copyright (C) 2003-2020 "Arta", Don Cullen "Kyro", Carl Bennett, others
3+
* Copyright (C) 2003-2021 "Arta", Don Cullen "Kyro", Carl Bennett, others
44
* This file is part of BNETDocs.
55
*
66
* BNETDocs is free software: you can redistribute it and/or modify
@@ -53,18 +53,6 @@ function BNETDocs() {
5353
}
5454
};
5555

56-
this.fHookNavigationMenu = function() {
57-
var mobile_nav = document.getElementById("mobile-nav");
58-
mobile_nav.onclick = function(e) {
59-
var nav = document.getElementsByTagName("nav")[0];
60-
if (nav.style.display != "block") {
61-
nav.style.display = "block";
62-
} else {
63-
nav.style.display = "";
64-
}
65-
};
66-
};
67-
6856
this.fSelectText = function(obj) {
6957
// copied from <http://goo.gl/dDuR8U>
7058
// adapted from Denis Sadowski (via StackOverflow.com)
@@ -92,7 +80,6 @@ function BNETDocs() {
9280

9381
window.onload = function() {
9482
self.fHookExternalAnchors();
95-
self.fHookNavigationMenu();
9683
self.fTimeToLocale();
9784
};
9885

src/templates/Servers.phtml

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,63 @@
1-
<?php
2-
1+
<?php /* vim: set colorcolumn=: */
32
namespace BNETDocs\Templates;
4-
53
use \BNETDocs\Libraries\Server;
64
use \BNETDocs\Libraries\ServerType;
75
use \CarlBennett\MVC\Libraries\Common;
86
use \CarlBennett\MVC\Libraries\Pair;
9-
10-
$title = "Servers";
11-
$description = "A list of servers that our automated system checks the status of. The status represents if the port is opened or closed, not if the service is functioning correctly.";
12-
$this->opengraph->attach(new Pair("url", "/servers"));
7+
$title = 'Servers';
8+
$description = 'A list of servers that our automated system checks the status of. The status represents if the port is opened or closed, not if the service is functioning correctly.';
9+
$this->opengraph->attach(new Pair('url', '/servers'));
1310

1411
$servers_by_type = [];
1512
foreach ($this->context->servers as $server) {
1613
$servers_by_type[$server->getTypeId()][] = $server;
1714
}
1815
ksort($servers_by_type);
1916

20-
$this->additional_css[] = "/a/servers.css";
21-
require("./header.inc.phtml");
17+
require('./header.inc.phtml');
2218
?>
23-
<article>
24-
<header>Server List</header>
25-
<section>
26-
<p>Below is a list of servers that our automated system checks the status of. The status represents if the port is opened or closed, not if the service is functioning correctly.</p>
27-
<p>We have a total of <strong><?php echo number_format(count($this->context->servers)); ?> servers</strong> that we monitor. <a href="<?php echo Common::relativeUrlToAbsolute("/servers.json"); ?>">Click here</a> to see this list in JSON format.</p>
28-
</section>
29-
<section>
30-
<table class="servers">
31-
<thead>
32-
<tr>
33-
<th class="status">Status</th>
34-
<th class="label">Label</th>
35-
<th class="address">Address</th>
36-
<th class="details"></th>
37-
</tr>
38-
</thead>
39-
<tbody>
40-
<?php foreach ($servers_by_type as $type_id => $servers) {
19+
<div class="container mb-3">
20+
<h1>Server List</h1>
21+
<div class="row"><div class="col">
22+
<p>Below is a list of servers that our automated system checks the status of. The status represents if the port is opened or closed, not if the service is functioning correctly.</p>
23+
<p>We have a total of <strong><? echo number_format(count($this->context->servers)); ?> servers</strong> that we monitor. <a href="<? echo Common::relativeUrlToAbsolute("/servers.json"); ?>">Click here</a> to see this list in JSON format.</p>
24+
</div></div>
25+
<div class="row"><div class="col">
26+
<table class="table table-hover table-sm table-striped" id="servers_tbl">
27+
<thead><tr><th scope="col">Status</th><th scope="col">Label</th><th scope="col">Address</th><th scope="col"></th></tr></thead><tbody>
28+
<? foreach ($servers_by_type as $type_id => $servers)
29+
{
4130
$server_type = new ServerType($type_id);
42-
?>
43-
<tr><th colspan="4"><?php echo $server_type->getLabel(); ?></th></tr>
44-
<?php foreach ($servers as $server) {
31+
echo '<tr><th colspan="4">' . filter_var($server_type->getLabel(), FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '</th></tr>';
32+
foreach ($servers as $server)
33+
{
4534
$status_bitmask = $server->getStatusBitmask();
4635
if ($status_bitmask & Server::STATUS_ONLINE) {
47-
$status_subclass = "online"; $status = "Online";
36+
$status_subclass = 'success'; $status = 'Online';
4837
} else if ($status_bitmask & Server::STATUS_DISABLED) {
49-
$status_subclass = "disabled"; $status = "Disabled";
38+
$status_subclass = 'danger'; $status = 'Disabled';
5039
} else {
51-
$status_subclass = "offline"; $status = "Offline";
52-
}
53-
?>
54-
<tr>
55-
<td class="status center <?php echo $status_subclass; ?>"><?php echo $status; ?></td>
56-
<td class="label"><?php echo ($server->getLabel() != $server->getAddress() && !empty($server->getLabel()) ? $server->getLabel() : "&nbsp;"); ?></td>
57-
<td class="address" onclick="bnetdocs.fSelectText(this);"><?php echo $server->getAddress(); ?>:<?php echo $server->getPort(); ?></td>
58-
<td class="details center"><a href="<?php echo $server->getURI(); ?>">View Details</a></td>
59-
</tr>
60-
<?php } ?>
61-
<?php } ?>
62-
</tbody>
63-
</table>
64-
</section>
65-
</article>
66-
<?php require("./footer.inc.phtml"); ?>
40+
$status_subclass = 'danger'; $status = 'Offline';
41+
} ?>
42+
<tr>
43+
<td class="text-center"><span class="text-<?=$status_subclass?>"><?=$status?></span></td>
44+
<td><?=($server->getLabel() != $server->getAddress() && !empty($server->getLabel()) ? $server->getLabel() : '&nbsp;')?></td>
45+
<td><code><? echo $server->getAddress(); ?>:<? echo $server->getPort(); ?></code></td>
46+
<td><a class="btn btn-sm btn-primary" href="<? echo $server->getURI(); ?>" title="Details">ℹ</a></td>
47+
</tr>
48+
<? }
49+
} ?>
50+
</tbody>
51+
</table>
52+
</div></div>
53+
</div>
54+
<? ob_start(); ?>
55+
<script type="text/javascript">
56+
$(document).ready(function(){
57+
$('#servers_tbl').DataTable({
58+
"language": {"zeroRecords": "No matching servers found"},
59+
"responsive": true,
60+
});
61+
});
62+
</script>
63+
<? $_footer_script = ob_get_clean(); require('./footer.inc.phtml'); ?>

0 commit comments

Comments
 (0)