isIframe: clean up, load less html and js

We use isIframe only when we have no JS, therefore it makes no sense
to load JS files in an iFrame. Also removed sidebar.
This commit is contained in:
Thomas Gelf 2014-06-22 16:30:06 +02:00
parent 3b84078b2f
commit 216f0f3f55
4 changed files with 10 additions and 6 deletions

View File

@ -32,9 +32,11 @@ if ($notifications->hasMessages()) {
</div> </div>
</div> </div>
<?php if (!$this->layout()->isIframe): ?>
<div id="sidebar"> <div id="sidebar">
<?php echo $this->render('parts/navigation.phtml') ?> <?php echo $this->render('parts/navigation.phtml') ?>
</div> </div>
<?php endif ?>
<div id="main" role="main"> <div id="main" role="main">
<div id="col1" class="container<?= $moduleClass ?>"<?php if ($moduleName): ?> data-icinga-module="<?= $moduleName ?>" <?php endif ?> data-icinga-url="<?= Url::fromRequest() ?>"<?= $refresh ?> style="display: block"> <div id="col1" class="container<?= $moduleClass ?>"<?php if ($moduleName): ?> data-icinga-module="<?= $moduleName ?>" <?php endif ?> data-icinga-url="<?= Url::fromRequest() ?>"<?= $refresh ?> style="display: block">
<?= $this->render('inline.phtml') ?> <?= $this->render('inline.phtml') ?>

View File

@ -13,7 +13,7 @@ if (array_key_exists('_dev', $_GET)) {
$ie8jsfile = 'js/icinga.ie8.js'; $ie8jsfile = 'js/icinga.ie8.js';
$lang = Translator::getLanguage(); $lang = Translator::getLanguage();
$isIframe = isset($_GET['isIframe']); $isIframe = $this->layout()->isIframe;
$iframeClass = $isIframe ? ' iframe' : ''; $iframeClass = $isIframe ? ' iframe' : '';
?><!DOCTYPE html> ?><!DOCTYPE html>
@ -30,15 +30,16 @@ $iframeClass = $isIframe ? ' iframe' : '';
<!-- TODO: viewport and scale settings make no sense for us, fix this --> <!-- TODO: viewport and scale settings make no sense for us, fix this -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="<?= $this->href($cssfile) ?>" media="screen" type="text/css" /> <link rel="stylesheet" href="<?= $this->href($cssfile) ?>" media="screen" type="text/css" />
<? if ($isIframe): ?>
<base target="_parent"/>
<?php else: ?>
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
var html = document.getElementsByTagName('html')[0]; var html = document.getElementsByTagName('html')[0];
html.className = html.className.replace(/no-js/, 'js'); html.className = html.className.replace(/no-js/, 'js');
}()); }());
</script> </script>
<? if ($isIframe): ?> <?php endif ?>
<base target="_parent"/>
<? endif ?>
<!-- Respond.js IE8 support of media queries --> <!-- Respond.js IE8 support of media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="<?= $this->baseUrl('js/vendor/respond.min.js');?>"></script> <script src="<?= $this->baseUrl('js/vendor/respond.min.js');?>"></script>
@ -50,6 +51,7 @@ $iframeClass = $isIframe ? ' iframe' : '';
<div id="layout" class="default-layout"> <div id="layout" class="default-layout">
<?= $this->render('body.phtml') ?> <?= $this->render('body.phtml') ?>
</div> </div>
<?php if (! $isIframe): ?>
<!--[if IE 8]> <!--[if IE 8]>
<script type="text/javascript" src="<?= $this->href($ie8jsfile) ?>"></script> <script type="text/javascript" src="<?= $this->href($ie8jsfile) ?>"></script>
<![endif]--> <![endif]-->
@ -61,5 +63,6 @@ var icinga = new Icinga({
baseUrl: '<?= $this->href('/') ?>' baseUrl: '<?= $this->href('/') ?>'
}); });
</script> </script>
<?php endif ?>
</body> </body>
</html> </html>

View File

@ -109,7 +109,7 @@ class ActionController extends Zend_Controller_Action
$this->handlerBrowserWindows(); $this->handlerBrowserWindows();
$this->view->translationDomain = 'icinga'; $this->view->translationDomain = 'icinga';
$this->_helper->layout()->isIframe = (bool) $this->params->shift('isIframe', false);
if ($this->requiresConfig()) { if ($this->requiresConfig()) {
$this->redirectNow(Url::fromPath('install')); $this->redirectNow(Url::fromPath('install'));
} }

View File

@ -442,7 +442,6 @@ class Monitoring_ListController extends Controller
$params = clone $this->params; $params = clone $this->params;
$params->shift('_render'); $params->shift('_render');
$params->shift('isIframe');
$limit = $params->shift('limit'); $limit = $params->shift('limit');
$sort = $params->shift('sort'); $sort = $params->shift('sort');
$dir = $params->shift('dir'); $dir = $params->shift('dir');