Skip to content

Commit

Permalink
Merge branch 'bugfix/Prettify-page-layout-when-accessing-a-non-existe…
Browse files Browse the repository at this point in the history
…nt-route-while-not-being-authenticated-10009'

fixes #10009
  • Loading branch information
Johannes Meyer committed Sep 28, 2015
2 parents d627f41 + 2f9bd78 commit ee7e7a1
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 59 deletions.
17 changes: 12 additions & 5 deletions application/controllers/ErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public function errorAction()
Logger::error($exception);
Logger::error('Stacktrace: %s', $exception->getTraceAsString());

if (! ($isAuthenticated = $this->Auth()->isAuthenticated())) {
$this->innerLayout = 'error';
}

switch ($error->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
Expand All @@ -45,11 +49,13 @@ public function errorAction()
$path = array_shift($path);
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = $this->translate('Page not found.');
if ($this->Auth()->isAuthenticated() && $modules->hasInstalled($path) && ! $modules->hasEnabled($path)) {
$this->view->message .= ' ' . sprintf(
$this->translate('Enabling the "%s" module might help!'),
$path
);
if ($isAuthenticated) {
if ($modules->hasInstalled($path) && ! $modules->hasEnabled($path)) {
$this->view->message .= ' ' . sprintf(
$this->translate('Enabling the "%s" module might help!'),
$path
);
}
}

break;
Expand Down Expand Up @@ -93,5 +99,6 @@ public function errorAction()
}

$this->view->request = $error->request;
$this->view->hideControls = ! $isAuthenticated;
}
}
8 changes: 8 additions & 0 deletions application/layouts/scripts/error.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="logo">
<div class="image">
<img aria-hidden="true" src="<?= $this->baseUrl('img/logo_icinga_big.png'); ?>" alt="<?= $this->translate('The Icinga logo'); ?>" >
</div>
</div>
<div class="below-logo">
<?= $this->render('inline.phtml') ?>
</div>
2 changes: 1 addition & 1 deletion application/views/scripts/authentication/login.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<img aria-hidden="true" class="fade-in one" src="<?= $this->baseUrl('img/logo_icinga_big.png'); ?>" alt="<?= $this->translate('The Icinga logo'); ?>" >
</div>
</div>
<div class="form" data-base-target="layout">
<div class="below-logo" data-base-target="layout">
<h1><?= $this->translate('Welcome to Icinga Web 2'); ?></h1>
<?php if ($requiresSetup): ?>
<p class="config-note"><?= sprintf(
Expand Down
16 changes: 9 additions & 7 deletions application/views/scripts/error/error.phtml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php if (! $hideControls): ?>
<div class="controls">
<?= $this->tabs->showOnlyCloseButton() ?>
<?= $tabs->showOnlyCloseButton(); ?>
</div>
<div class="content">
<p><strong><?= nl2br($this->escape($message)) ?></strong></p>
<?php if (isset($stackTrace)) : ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
</div>
<div class="content">
<p><strong><?= nl2br($this->escape($message)); ?></strong></p>
<?php if (isset($stackTrace)): ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
</div>
1 change: 1 addition & 0 deletions library/Icinga/Web/StyleSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class StyleSheet
'css/icinga/pagination.less',
'css/icinga/selection-toolbar.less',
'css/icinga/login.less',
'css/icinga/logo.less',
'css/icinga/controls.less'
);

Expand Down
9 changes: 1 addition & 8 deletions public/css/icinga/layout-structure.less
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,7 @@ html {
}

#login {
.logo .image img {
width: 70%;
}
.form {
width: 100%;
margin: auto;
}
.form label {
.below-logo label {
width: 100%;
margin: 0;
text-align: center;
Expand Down
41 changes: 3 additions & 38 deletions public/css/icinga/login.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,12 @@
width: 100%;
height: 100%;

.logo {
background-color: @colorPetrol;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 60%;
border-bottom: 1px solid #d9d9d9d;
text-align: center;
-webkit-box-shadow: 0 3px 7px -3px #000;
-moz-box-shadow: 0 3px 7px -3px #000;
box-shadow: 0 3px 7px -3px #000;
}

.image {
position: absolute;
bottom: 1em;
left: 0px;
right: 0px;
text-align: center;
}

.error {
margin-left:auto;
margin-right:auto;
}

.image img {
width: 375px;
}

.form {
position: absolute;
font-size: 0.9em;
top: 45%;
left: 0;
bottom: 0;
right: 0;
}

.form h1 {
.below-logo h1 {
text-align: center;
font-size: 1.5em;
margin-left: 2.3em;
Expand All @@ -53,15 +18,15 @@
font-variant: unset;
}

.form div.element {
.below-logo div.element {
margin: 0;

ul.errors {
margin-left: 10.5em;
}
}

.form label {
.below-logo label {
font-weight: normal;
display: inline-block;
line-height: 2.5em;
Expand Down
47 changes: 47 additions & 0 deletions public/css/icinga/logo.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */

.logo {
background-color: @colorPetrol;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 60%;
border-bottom: 1px solid #d9d9d9d;
text-align: center;
-webkit-box-shadow: 0 3px 7px -3px #000;
-moz-box-shadow: 0 3px 7px -3px #000;
box-shadow: 0 3px 7px -3px #000;

.image {
position: absolute;
bottom: 1em;
left: 0px;
right: 0px;
text-align: center;

img {
width: 375px;
}
}
}

.below-logo {
position: absolute;
font-size: 0.9em;
top: 45%;
left: 0;
bottom: 0;
right: 0;
}

#layout.minimal-layout {
.logo .image img {
width: 70%;
}

.below-logo {
width: 100%;
margin: auto;
}
}

0 comments on commit ee7e7a1

Please sign in to comment.