Merge branch 'master' into bugfix/ldap-group-to-roles-assignment-not-working-9950

This commit is contained in:
Johannes Meyer 2015-09-28 11:05:00 +02:00
commit 2ef36e2a92
11 changed files with 125 additions and 62 deletions

View File

@ -35,6 +35,10 @@ class ErrorController extends ActionController
Logger::error($exception); Logger::error($exception);
Logger::error('Stacktrace: %s', $exception->getTraceAsString()); Logger::error('Stacktrace: %s', $exception->getTraceAsString());
if (! ($isAuthenticated = $this->Auth()->isAuthenticated())) {
$this->innerLayout = 'error';
}
switch ($error->type) { switch ($error->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
@ -45,11 +49,13 @@ class ErrorController extends ActionController
$path = array_shift($path); $path = array_shift($path);
$this->getResponse()->setHttpResponseCode(404); $this->getResponse()->setHttpResponseCode(404);
$this->view->message = $this->translate('Page not found.'); $this->view->message = $this->translate('Page not found.');
if ($this->Auth()->isAuthenticated() && $modules->hasInstalled($path) && ! $modules->hasEnabled($path)) { if ($isAuthenticated) {
$this->view->message .= ' ' . sprintf( if ($modules->hasInstalled($path) && ! $modules->hasEnabled($path)) {
$this->translate('Enabling the "%s" module might help!'), $this->view->message .= ' ' . sprintf(
$path $this->translate('Enabling the "%s" module might help!'),
); $path
);
}
} }
break; break;
@ -93,5 +99,6 @@ class ErrorController extends ActionController
} }
$this->view->request = $error->request; $this->view->request = $error->request;
$this->view->hideControls = ! $isAuthenticated;
} }
} }

View File

@ -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>

View File

@ -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'); ?>" > <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> </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> <h1><?= $this->translate('Welcome to Icinga Web 2'); ?></h1>
<?php if ($requiresSetup): ?> <?php if ($requiresSetup): ?>
<p class="config-note"><?= sprintf( <p class="config-note"><?= sprintf(

View File

@ -1,10 +1,12 @@
<?php if (! $hideControls): ?>
<div class="controls"> <div class="controls">
<?= $this->tabs->showOnlyCloseButton() ?> <?= $tabs->showOnlyCloseButton(); ?>
</div> </div>
<div class="content">
<p><strong><?= nl2br($this->escape($message)) ?></strong></p>
<?php if (isset($stackTrace)) : ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?> <?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>

View File

@ -36,6 +36,13 @@ class NavigationItemRenderer
*/ */
protected $internalLinkTargets; protected $internalLinkTargets;
/**
* Whether to escape the label
*
* @var bool
*/
protected $escapeLabel;
/** /**
* Create a new NavigationItemRenderer * Create a new NavigationItemRenderer
* *
@ -126,6 +133,29 @@ class NavigationItemRenderer
return $this->item; return $this->item;
} }
/**
* Set whether to escape the label
*
* @param bool $state
*
* @return $this
*/
public function setEscapeLabel($state = true)
{
$this->escapeLabel = (bool) $state;
return $this;
}
/**
* Return whether to escape the label
*
* @return bool
*/
public function getEscapeLabel()
{
return $this->escapeLabel !== null ? $this->escapeLabel : true;
}
/** /**
* Render the given navigation item as HTML anchor * Render the given navigation item as HTML anchor
* *
@ -144,7 +174,9 @@ class NavigationItemRenderer
); );
} }
$label = $this->view()->escape($item->getLabel()); $label = $this->getEscapeLabel()
? $this->view()->escape($item->getLabel())
: $item->getLabel();
if (($icon = $item->getIcon()) !== null) { if (($icon = $item->getIcon()) !== null) {
$label = $this->view()->icon($icon) . $label; $label = $this->view()->icon($icon) . $label;
} }

View File

@ -28,6 +28,7 @@ class StyleSheet
'css/icinga/pagination.less', 'css/icinga/pagination.less',
'css/icinga/selection-toolbar.less', 'css/icinga/selection-toolbar.less',
'css/icinga/login.less', 'css/icinga/login.less',
'css/icinga/logo.less',
'css/icinga/controls.less' 'css/icinga/controls.less'
); );

View File

@ -16,7 +16,11 @@ foreach ($object->getActionUrls() as $i => $link) {
'Action ' . ($i + 1) . $newTabInfo, 'Action ' . ($i + 1) . $newTabInfo,
array( array(
'url' => $link, 'url' => $link,
'target' => '_blank' 'target' => '_blank',
'renderer' => array(
'NavigationItemRenderer',
'escape_label' => false
)
) )
); );
} }

View File

@ -26,7 +26,11 @@ if (! empty($links)) {
$this->escape($link) . $newTabInfo, $this->escape($link) . $newTabInfo,
array( array(
'url' => $link, 'url' => $link,
'target' => '_blank' 'target' => '_blank',
'renderer' => array(
'NavigationItemRenderer',
'escape_label' => false
)
) )
); );
} }

View File

@ -280,14 +280,7 @@ html {
} }
#login { #login {
.logo .image img { .below-logo label {
width: 70%;
}
.form {
width: 100%;
margin: auto;
}
.form label {
width: 100%; width: 100%;
margin: 0; margin: 0;
text-align: center; text-align: center;

View File

@ -4,47 +4,12 @@
width: 100%; width: 100%;
height: 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 { .error {
margin-left:auto; margin-left:auto;
margin-right:auto; margin-right:auto;
} }
.image img { .below-logo h1 {
width: 375px;
}
.form {
position: absolute;
font-size: 0.9em;
top: 45%;
left: 0;
bottom: 0;
right: 0;
}
.form h1 {
text-align: center; text-align: center;
font-size: 1.5em; font-size: 1.5em;
margin-left: 2.3em; margin-left: 2.3em;
@ -53,7 +18,7 @@
font-variant: unset; font-variant: unset;
} }
.form div.element { .below-logo div.element {
margin: 0; margin: 0;
ul.errors { ul.errors {
@ -61,7 +26,7 @@
} }
} }
.form label { .below-logo label {
font-weight: normal; font-weight: normal;
display: inline-block; display: inline-block;
line-height: 2.5em; line-height: 2.5em;

View File

@ -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;
}
}