mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
Merge branch 'master' into feature/generate-webserver-config-6120
This commit is contained in:
commit
b52adcc2ab
81
library/Icinga/Web/Form/Element/Button.php
Normal file
81
library/Icinga/Web/Form/Element/Button.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Web\Form\Element;
|
||||||
|
|
||||||
|
use Zend_Form_Element;
|
||||||
|
use Icinga\Web\Request;
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A button
|
||||||
|
*/
|
||||||
|
class Button extends Zend_Form_Element
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Use formButton view helper by default
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $helper = 'formButton';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param string|array|Zend_Config $spec Element name or configuration
|
||||||
|
* @param string|array|Zend_Config $options Element value or configuration
|
||||||
|
*/
|
||||||
|
public function __construct($spec, $options = null)
|
||||||
|
{
|
||||||
|
if (is_string($spec) && ((null !== $options) && is_string($options))) {
|
||||||
|
$options = array('label' => $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($options['ignore'])) {
|
||||||
|
$options['ignore'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct($spec, $options);
|
||||||
|
|
||||||
|
if ($label = $this->getLabel()) {
|
||||||
|
// Necessary to get the label shown on the generated HTML
|
||||||
|
$this->content = $label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate element value (pseudo)
|
||||||
|
*
|
||||||
|
* There is no need to reset the value
|
||||||
|
*
|
||||||
|
* @param mixed $value Is always ignored
|
||||||
|
* @param mixed $context Is always ignored
|
||||||
|
*
|
||||||
|
* @return bool Returns always TRUE
|
||||||
|
*/
|
||||||
|
public function isValid($value, $context = null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has this button been selected?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isChecked()
|
||||||
|
{
|
||||||
|
return $this->getRequest()->getParam($this->getName()) === $this->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current request
|
||||||
|
*
|
||||||
|
* @return Request
|
||||||
|
*/
|
||||||
|
protected function getRequest()
|
||||||
|
{
|
||||||
|
return Icinga::app()->getFrontController()->getRequest();
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ use LogicException;
|
|||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Icinga\Web\Session\SessionNamespace;
|
use Icinga\Web\Session\SessionNamespace;
|
||||||
use Icinga\Web\Form\Decorator\ElementDoubler;
|
use Icinga\Web\Form\Decorator\ElementDoubler;
|
||||||
|
use Icinga\Web\Form\Element\Button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container and controller for form based wizards
|
* Container and controller for form based wizards
|
||||||
@ -426,55 +427,60 @@ class Wizard
|
|||||||
$index = array_search($page, $pages, true);
|
$index = array_search($page, $pages, true);
|
||||||
if ($index === 0) {
|
if ($index === 0) {
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'button',
|
new Button(
|
||||||
static::BTN_NEXT,
|
static::BTN_NEXT,
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => $pages[1]->getName(),
|
'value' => $pages[1]->getName(),
|
||||||
'label' => t('Next'),
|
'label' => t('Next'),
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} elseif ($index < count($pages) - 1) {
|
} elseif ($index < count($pages) - 1) {
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'button',
|
new Button(
|
||||||
static::BTN_PREV,
|
static::BTN_PREV,
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => $pages[$index - 1]->getName(),
|
'value' => $pages[$index - 1]->getName(),
|
||||||
'label' => t('Back'),
|
'label' => t('Back'),
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'button',
|
new Button(
|
||||||
static::BTN_NEXT,
|
static::BTN_NEXT,
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => $pages[$index + 1]->getName(),
|
'value' => $pages[$index + 1]->getName(),
|
||||||
'label' => t('Next'),
|
'label' => t('Next'),
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'button',
|
new Button(
|
||||||
static::BTN_PREV,
|
static::BTN_PREV,
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => $pages[$index - 1]->getName(),
|
'value' => $pages[$index - 1]->getName(),
|
||||||
'label' => t('Back'),
|
'label' => t('Back'),
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$page->addElement(
|
$page->addElement(
|
||||||
'button',
|
new Button(
|
||||||
static::BTN_NEXT,
|
static::BTN_NEXT,
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
'value' => $page->getName(),
|
'value' => $page->getName(),
|
||||||
'label' => t('Finish'),
|
'label' => t('Finish'),
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
$helpMessage = $this->translate('Press and hold the Ctrl key while clicking on rows to select multiple rows or press and hold the Shift key to select a range of rows.', 'multiselection');
|
||||||
|
?>
|
||||||
|
<div class="selection-info">
|
||||||
|
<span class="selection-info-count">0</span> <?= $this->translate('row(s) selected', 'multiselection') ?> <?= $this->icon('unhandled.png', $helpMessage) ?>
|
||||||
|
</div>
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?= $this->filterEditor ?>
|
<?= $this->filterEditor ?>
|
||||||
<?php if (empty($downtimes)): ?>
|
<?php if (count($downtimes) === 0): ?>
|
||||||
<?= $this->translate('No downtimes matching the filter'); ?>
|
<?= $this->translate('No active downtimes'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php return; endif ?>
|
<?php return; endif ?>
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ if ($this->compact): ?>
|
|||||||
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
|
<?= $this->widget('limiter')->setMaxLimit($this->hosts->count()) ?>
|
||||||
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
|
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?>
|
||||||
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?>
|
<?= $this->selectionToolbar('multi', $this->href('monitoring/hosts/show?' . $this->filter->toQueryString())) ?>
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -20,6 +20,7 @@ if (!$this->compact): ?>
|
|||||||
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
|
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?= $this->selectionToolbar('multi', $this->href('monitoring/services/show?' . $this->filter->toQueryString())) ?>
|
<?= $this->selectionToolbar('multi', $this->href('monitoring/services/show?' . $this->filter->toQueryString())) ?>
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->render('show/components/header.phtml') ?>
|
<?= $this->render('show/components/header.phtml') ?>
|
||||||
<h1><?= $this->translate("This service's current state") ?></h1>
|
<h1><?= $this->translate("Service detail information") ?></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" data-base-target="_next">
|
<div class="content" data-base-target="_next">
|
||||||
<?= $this->render('show/components/output.phtml') ?>
|
<?= $this->render('show/components/output.phtml') ?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php if ($object->host_name !== false): ?>
|
<?php if ($object->host_name !== false): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->render('show/components/header.phtml') ?>
|
<?= $this->render('show/components/header.phtml') ?>
|
||||||
<h1><?= $this->translate("This service's current state") ?></h1>
|
<h1><?= $this->translate("Service detail information") ?></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" data-base-target="_next">
|
<div class="content" data-base-target="_next">
|
||||||
<?= $this->render('show/components/output.phtml') ?>
|
<?= $this->render('show/components/output.phtml') ?>
|
||||||
|
@ -141,3 +141,7 @@ table.avp .customvar ul {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
padding-left: 1.5em;
|
padding-left: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.selection-info {
|
||||||
|
padding-top:1em;
|
||||||
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
namespace Icinga\Module\Setup;
|
namespace Icinga\Module\Setup;
|
||||||
|
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use Zend_Version;
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Wizard;
|
use Icinga\Web\Wizard;
|
||||||
use Icinga\Web\Request;
|
use Icinga\Web\Request;
|
||||||
@ -384,20 +383,6 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
sprintf(mt('setup', 'You are running PHP version %s.'), $phpVersion)
|
sprintf(mt('setup', 'You are running PHP version %s.'), $phpVersion)
|
||||||
);
|
);
|
||||||
|
|
||||||
// The only reason for requiring 1.12.2 is a bug in Zend_Form_Decorator_ViewHelper in older versions causing a
|
|
||||||
// Zend_Form_Element_Button's value not being rendered. Feel free to adjust this in case we require an earlier
|
|
||||||
// version!
|
|
||||||
$zendVersion = Zend_Version::VERSION;
|
|
||||||
$requirements->addMandatory(
|
|
||||||
mt('setup', 'Zend Framework 1'),
|
|
||||||
mt(
|
|
||||||
'setup',
|
|
||||||
'Icinga Web 2 requires at least Zend Framework 1.12.2 to work properly.'
|
|
||||||
),
|
|
||||||
Zend_Version::compareVersion('1.12.2') !== 1,
|
|
||||||
sprintf(mt('setup', 'You have got Zend Framwork %s installed.'), $zendVersion)
|
|
||||||
);
|
|
||||||
|
|
||||||
$defaultTimezone = Platform::getPhpConfig('date.timezone');
|
$defaultTimezone = Platform::getPhpConfig('date.timezone');
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
mt('setup', 'Default Timezone'),
|
mt('setup', 'Default Timezone'),
|
||||||
@ -507,8 +492,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO(7464): Re-enable or remove this entirely once a decision has been made regarding shipping Zend with Iw2
|
$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
|
||||||
/*$mysqlAdapterFound = Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
|
|
||||||
$requirements->addOptional(
|
$requirements->addOptional(
|
||||||
mt('setup', 'Zend Database Adapter For MySQL'),
|
mt('setup', 'Zend Database Adapter For MySQL'),
|
||||||
mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
|
mt('setup', 'The Zend database adapter for MySQL is required to access a MySQL database.'),
|
||||||
@ -526,7 +510,7 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
$pgsqlAdapterFound ? mt('setup', 'The Zend database adapter for PostgreSQL is available.') : (
|
$pgsqlAdapterFound ? mt('setup', 'The Zend database adapter for PostgreSQL is available.') : (
|
||||||
mt('setup', 'The Zend database adapter for PostgreSQL is missing.')
|
mt('setup', 'The Zend database adapter for PostgreSQL is missing.')
|
||||||
)
|
)
|
||||||
);*/
|
);
|
||||||
|
|
||||||
$configDir = $this->getConfigDir();
|
$configDir = $this->getConfigDir();
|
||||||
$requirements->addMandatory(
|
$requirements->addMandatory(
|
||||||
|
@ -306,17 +306,20 @@
|
|||||||
var query = icinga.ui.selectionDataToQuery(selectionData);
|
var query = icinga.ui.selectionDataToQuery(selectionData);
|
||||||
icinga.loader.loadUrl(url + '?' + query, $target);
|
icinga.loader.loadUrl(url + '?' + query, $target);
|
||||||
icinga.ui.storeSelectionData(selectionData);
|
icinga.ui.storeSelectionData(selectionData);
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
} else if ($trs.length === 1) {
|
} else if ($trs.length === 1) {
|
||||||
// display a single row
|
// display a single row
|
||||||
$tr = $trs.first();
|
$tr = $trs.first();
|
||||||
icinga.loader.loadUrl($tr.attr('href'), $target);
|
icinga.loader.loadUrl($tr.attr('href'), $target);
|
||||||
icinga.ui.storeSelectionData($tr.attr('href'));
|
icinga.ui.storeSelectionData($tr.attr('href'));
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
} else {
|
} else {
|
||||||
// display nothing
|
// display nothing
|
||||||
if ($target.attr('id') === 'col2') {
|
if ($target.attr('id') === 'col2') {
|
||||||
icinga.ui.layout1col();
|
icinga.ui.layout1col();
|
||||||
}
|
}
|
||||||
icinga.ui.storeSelectionData(null);
|
icinga.ui.storeSelectionData(null);
|
||||||
|
icinga.ui.provideSelectionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -470,9 +470,25 @@
|
|||||||
* (when only a single row was selected) or Null when nothing was selected.
|
* (when only a single row was selected) or Null when nothing was selected.
|
||||||
*/
|
*/
|
||||||
loadSelectionData: function() {
|
loadSelectionData: function() {
|
||||||
|
this.provideSelectionCount();
|
||||||
return selectionData;
|
return selectionData;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the selections row count hint info
|
||||||
|
*/
|
||||||
|
provideSelectionCount: function() {
|
||||||
|
var $count = $('.selection-info-count');
|
||||||
|
|
||||||
|
if (typeof selectionData === 'string') {
|
||||||
|
$count.text(1);
|
||||||
|
} else if (selectionData.length > 1) {
|
||||||
|
$count.text(selectionData.length);
|
||||||
|
} else {
|
||||||
|
$count.text(0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focus the given table by deselecting all selections on all other tables.
|
* Focus the given table by deselecting all selections on all other tables.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user