summaryrefslogtreecommitdiffstats
path: root/application/layouts/scripts/layout.phtml
blob: 880c2a9f19dd323a481de531b137c45b90f0eb28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php

use ipl\I18n\Locale;
use ipl\I18n\GettextTranslator;
use ipl\I18n\StaticTranslator;
use ipl\Web\Widget\Icon;

if (array_key_exists('_dev', $_GET)) {
  $jsfile  = 'js/icinga.dev.js';
  $cssfile = 'css/icinga.css';
} else {
  $jsfile  = 'js/icinga.min.js';
  $cssfile = 'css/icinga.min.css';
}

/** @var GettextTranslator $translator */
$translator = StaticTranslator::$instance;

$lang = (new Locale())->parseLocale($translator->getLocale())->language;
$timezone = date_default_timezone_get();
$isIframe = $this->layout()->isIframe;
$showFullscreen = $this->layout()->showFullscreen;
$iframeClass = $isIframe ? ' iframe' : '';
$innerLayoutScript = $this->layout()->innerLayout . '.phtml';

?><!DOCTYPE html>
<html class="no-js<?= $iframeClass ?>" lang="<?= $lang ?>">
<head>
  <meta charset="utf-8">
  <meta name="google" value="notranslate">
  <meta http-equiv="cleartype" content="on">
  <title><?= $this->title ? $this->escape($this->title) . ' :: ' : '' ?><?= $this->defaultTitle ?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="application-name" content="Icinga Web 2">
  <meta name="apple-mobile-web-app-title" content="Icinga">
  <link rel="mask-icon" href="<?= $this->baseUrl('img/website-icon.svg') ?>" color="#0096BF">
<?php if ($isIframe): ?>
  <base target="_parent">
<?php else: ?>
  <base href="<?= $this->baseUrl(); ?>/">
  <script type="text/javascript">
  (function() {
    var html = document.getElementsByTagName('html')[0];
    html.className = html.className.replace(/no-js/, 'js');
  }());
  </script>
<?php endif ?>
  <link rel="stylesheet" href="<?= $this->href($cssfile) ?>" media="all" type="text/css" />
  <link type="image/png" rel="shortcut icon" href="<?= $this->baseUrl('img/favicon.png') ?>" />
  <link rel="apple-touch-icon" href="<?= $this->baseUrl('img/touch-icon.png') ?>">
</head>
<body id="body" class="loading">
<pre id="responsive-debug"></pre>
<div id="layout" class="default-layout<?php if ($showFullscreen): ?> fullscreen-layout<?php endif ?>">
<?= $this->render($innerLayoutScript); ?>
</div>
<script type="text/javascript">
  (function() {
    if (document.defaultView && document.defaultView.getComputedStyle) {
      var matched;
      var html = document.getElementsByTagName('html')[0];
      var element = document.getElementById('layout');
      var name = document.defaultView
        .getComputedStyle(html)['font-family']
        .replace(/['",]/g, '');

      if (null !== (matched = name.match(/^([a-z]+)-layout$/))) {
        element.className = element.className.replace('default-layout', name);
        if ('object' === typeof window.console) {
          window.console.log('Icinga Web 2: setting initial layout to ' + name);
        }
      }
    }
  }());
</script>
<div id="collapsible-control-ghost" class="collapsible-control">
    <button type="button">
        <!-- TODO: Accessibility attributes are missing since usage of the Icon class -->
        <?= new Icon('angle-double-down', ['class' => 'expand-icon', 'title' => $this->translate('Expand')]) ?>
        <?= new Icon('angle-double-up', ['class' => 'collapse-icon', 'title' => $this->translate('Collapse')]) ?>
    </button>
</div>
<div id="modal-ghost">
    <div>
        <section class="modal-window">
            <div class="modal-header">
                <h1></h1>
                <button type="button"><?= $this->icon('cancel') ?></button>
            </div>
            <div class="modal-area">
                <div id="modal-content" data-base-target="modal-content" tabindex data-no-icinga-ajax></div>
            </div>
        </section>
    </div>
</div>
<script type="text/javascript" src="<?= $this->href($jsfile) ?>"></script>
<script type="text/javascript">
window.name = '<?= $this->protectId('Icinga') ?>';
var icinga = new Icinga({
  baseUrl: '<?= $this->baseUrl(); ?>',
  locale: '<?= $lang; ?>',
  timezone: '<?= $timezone ?>'
});
</script>
</body>
</html>