summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorGuillaume Mazoyer <gmazoyer@gravitons.in>2016-03-14 12:53:55 +0100
committerGuillaume Mazoyer <gmazoyer@gravitons.in>2016-03-14 12:53:55 +0100
commitb1bb5fdc0ab52342ae17da470f8368e75d9172c8 (patch)
treeb953fc5c90ab1fa061b67e8a967b73394659df49 /index.php
parent30a0e57a35215cf4efcaa5c3ab1e4cd4eba4e4cc (diff)
Peering Policy configuration options.
Add configuration variable to set the path to a file containing a peering policy. This file must be readable by the webserver and must contain HTML formatted text (on which CSS rules will be applied). If the variable is set to null, no peering policy will be displayed.
Diffstat (limited to 'index.php')
-rw-r--r--index.php39
1 files changed, 37 insertions, 2 deletions
diff --git a/index.php b/index.php
index 12ff3a4..3acee49 100644
--- a/index.php
+++ b/index.php
@@ -171,12 +171,17 @@ final class LookingGlass {
}
}
- if ($this->frontpage['disclaimer'] != null) {
+ if ($this->frontpage['disclaimer']) {
print($this->frontpage['disclaimer']);
print('<br /><br />');
}
- if (($this->contact['name'] != null) && ($this->contact['mail'] != null)) {
+ if ($this->frontpage['peering_policy_file']) {
+ print('<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#peering-policy"><span class="glyphicon glyphicon-list-alt"></span> Peering Policy</button>');
+ print('<br/><br/>');
+ }
+
+ if ($this->contact['name'] && $this->contact['mail']) {
print('Contact:&nbsp;');
print('<a href="mailto:'.$this->contact['mail'].'">'.
htmlentities($this->contact['name']).'</a>');
@@ -188,6 +193,33 @@ final class LookingGlass {
print('</div>');
}
+ private function render_peering_policy_modal() {
+ print('<div id="peering-policy" class="modal fade">');
+ print('<div class="modal-dialog">');
+ print('<div class="modal-content">');
+ print('<div class="modal-header">');
+ print('<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>');
+ print('<h4 class="modal-title">Peering Policy</h4>');
+ print('</div>');
+ print('<div class="modal-body">');
+ if (!file_exists($this->frontpage['peering_policy_file'])) {
+ print('The peering policy file ('.
+ $this->frontpage['peering_policy_file'].') does not exist.');
+ } else if (!is_readable($this->frontpage['peering_policy_file'])) {
+ print('The peering policy file ('.
+ $this->frontpage['peering_policy_file'].') is not readable.');
+ } else {
+ include($this->frontpage['peering_policy_file']);
+ }
+ print('</div>');
+ print('<div class="modal-footer">');
+ print('<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>');
+ print('</div>');
+ print('</div>');
+ print('</div>');
+ print('</div>');
+ }
+
private function render_help_modal() {
print('<div id="help" class="modal fade">');
print('<div class="modal-dialog">');
@@ -234,6 +266,9 @@ final class LookingGlass {
$this->render_content();
$this->render_footer();
$this->render_help_modal();
+ if ($this->frontpage['peering_policy_file']) {
+ $this->render_peering_policy_modal();
+ }
print('</body>');
print('<script src="libs/jquery-2.2.0.min.js"></script>');
print('<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>');