diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
commit | a4a4a84d79e95d34f80346c423b4e84f7af3f03d (patch) | |
tree | 91608c01e82676102457ffff2219f321ec474657 /application/views/scripts/index/index.phtml | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-map-a4a4a84d79e95d34f80346c423b4e84f7af3f03d.tar.xz icingaweb2-module-map-a4a4a84d79e95d34f80346c423b4e84f7af3f03d.zip |
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/views/scripts/index/index.phtml')
-rw-r--r-- | application/views/scripts/index/index.phtml | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml new file mode 100644 index 0000000..220dec7 --- /dev/null +++ b/application/views/scripts/index/index.phtml @@ -0,0 +1,57 @@ +<?php +?> +<script type="text/javascript"> + <?php + echo 'var map_default_zoom = ' . (!empty($this->default_zoom) ? $this->default_zoom : "null") . ";\n"; + echo 'var map_default_long = ' . (!empty($this->default_long) ? $this->default_long : "null") . ";\n"; + echo 'var map_default_lat = ' . (!empty($this->default_lat) ? $this->default_lat : "null") . ";\n"; + echo 'var map_max_zoom = ' . $this->max_zoom . ";\n"; + echo 'var map_max_native_zoom = ' . $this->max_native_zoom . ";\n"; + echo 'var map_min_zoom = ' . $this->min_zoom . ";\n"; + echo 'var disable_cluster_at_zoom = ' . $this->disable_cluster_at_zoom . ";\n"; + echo "var tile_url = '" . $this->tile_url . "';\n"; + echo "var cluster_problem_count = " . $this->cluster_problem_count . ";\n"; + echo 'var map_show_host = "' . $this->host . "\";\n"; + ?> + var service_status = {}; + service_status[0] = ['<?= $this->translate('OK', 'icinga.state') ?>', 'OK']; + service_status[1] = ['<?= $this->translate('WARNING', 'icinga.state') ?>', 'WARNING']; + service_status[2] = ['<?= $this->translate('CRITICAL', 'icinga.state') ?>', 'CRITICAL']; + service_status[3] = ['<?= $this->translate('UNKNOWN', 'icinga.state') ?>', 'UNKNOWN']; + service_status[99] = ['<?= $this->translate('PENDING', 'icinga.state') ?>', 'PENDING']; + + // @TODO: Is there a better way of translation in JS-Code? + <?php + $toTranslate = array( + "btn-zoom-in" => "Zoom in", + "btn-zoom-out" => "Zoom out", + "btn-dashboard" => "Add to dashboard", + "btn-fullscreen" => "Fullscreen", + "btn-default" => "Show default view", + "btn-locate" => "Show current location", + "host-down" => "Host is down" + ); + + print("var translation = {"); + foreach ($toTranslate as $key => $value) { + printf("'%s': '%s',", $key, $this->translate($value)); + } + print("};\n"); + ?> + + var url_parameters = "<?=$this->url_parameters; ?>"; + var id = '<?= $this->id ?>'; + var dashlet = <?= $this->compact ? 'true' : 'false' ?>; + var expand = <?= $this->expand ? 'true' : 'false' ?>; +</script> +<div class="controls"> + <?php if (!$this->compact && !$this->fullscreen): ?> + <?= $this->tabs ?> + <?php endif ?> +</div> +<div class="content"> + <div <?= ($this->compact ? 'style="height:' . $this->dashletHeight . 'px;" ' : ""); ?>id="map-<?= $this->id ?>" + class="map<?php if ($this->compact): ?> + compact +<?php endif ?>"></div> +</div> |