Merge remote-tracking branch 'origin/master' into feature/add-to-dashboard-4537

This commit is contained in:
Marius Hein 2014-11-18 12:52:02 +01:00
commit 8805e4af4b
4 changed files with 26 additions and 9 deletions

View File

@ -76,6 +76,7 @@ CREATE UNIQUE INDEX idx_icingaweb_user
CREATE TABLE "icingaweb_user_preference" ( CREATE TABLE "icingaweb_user_preference" (
"username" character varying(64) NOT NULL, "username" character varying(64) NOT NULL,
"name" character varying(64) NOT NULL, "name" character varying(64) NOT NULL,
"section" character varying(64) NOT NULL,
"value" character varying(255) NOT NULL, "value" character varying(255) NOT NULL,
"ctime" timestamp NULL DEFAULT NULL, "ctime" timestamp NULL DEFAULT NULL,
"mtime" timestamp NULL DEFAULT NULL "mtime" timestamp NULL DEFAULT NULL
@ -85,6 +86,7 @@ ALTER TABLE ONLY "icingaweb_user_preference"
ADD CONSTRAINT pk_icingaweb_user_preference ADD CONSTRAINT pk_icingaweb_user_preference
PRIMARY KEY ( PRIMARY KEY (
"username", "username",
"section",
"name" "name"
); );
@ -92,5 +94,6 @@ CREATE UNIQUE INDEX idx_icingaweb_user_preference
ON "icingaweb_user_preference" ON "icingaweb_user_preference"
USING btree ( USING btree (
lower((username)::text), lower((username)::text),
lower((section)::text),
lower((name)::text) lower((name)::text)
); );

View File

@ -428,7 +428,7 @@ class ActionController extends Zend_Controller_Action
} }
if ($this->autorefreshInterval !== null) { if ($this->autorefreshInterval !== null) {
// $resp->setHeader('X-Icinga-Refresh', $this->autorefreshInterval); $resp->setHeader('X-Icinga-Refresh', $this->autorefreshInterval);
} }
} }

View File

@ -47,7 +47,6 @@ class Number extends FormElement
*/ */
public function init() public function init()
{ {
$this->addValidator('Float', true); // true for breaking the validator chain on failure
if ($this->min !== null) { if ($this->min !== null) {
$this->addValidator('GreaterThan', true, array('min' => $this->min)); $this->addValidator('GreaterThan', true, array('min' => $this->min));
} }
@ -127,4 +126,19 @@ class Number extends FormElement
{ {
return $this->step; return $this->step;
} }
/**
* (non-PHPDoc)
* @see \Zend_Form_Element::isValid() For the method documentation.
*/
public function isValid($value, $context = null)
{
$this->setValue($value);
$value = $this->getValue();
if (! is_numeric($value)) {
$this->addError(sprintf($this->translate('\'%s\' is not a valid number'), $value));
return false;
}
return parent::isValid($value, $context);
}
} }

View File

@ -7,15 +7,15 @@ if ($object->getType() === $object::TYPE_HOST) {
'monitoring/host/reschedule-check', 'monitoring/host/reschedule-check',
array('host' => $object->getName()) array('host' => $object->getName())
); );
$check_attempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts; $checkAttempts = $object->host_current_check_attempt . '/' . $object->host_max_check_attempts;
$state_type = (int) $object->host_state_type; $stateType = (int) $object->host_state_type;
} else { } else {
$reschedule = $this->href( $reschedule = $this->href(
'monitoring/service/reschedule-check', 'monitoring/service/reschedule-check',
array('host' => $object->getHost()->getName(), 'service' => $object->getName()) array('host' => $object->getHost()->getName(), 'service' => $object->getName())
); );
$check_attempts = $object->service_attempt; $checkAttempts = $object->service_attempt;
$state_type = (int) $object->service_state_type; $stateType = (int) $object->service_state_type;
} }
?> ?>
@ -38,10 +38,10 @@ if ($object->getType() === $object::TYPE_HOST) {
</tr> </tr>
<tr> <tr>
<th><?= $this->translate('Check attempts') ?></th> <th><?= $this->translate('Check attempts') ?></th>
<?php if ($state_type === 0): ?> <?php if ($stateType === 0): ?>
<td><?= $check_attempts ?> <?= $this->translate('(soft state)') ?></td> <td><?= $checkAttempts ?> <?= $this->translate('(soft state)') ?></td>
<?php else: ?> <?php else: ?>
<td><?= $check_attempts ?> <?= $this->translate('(hard state)') ?></td> <td><?= $checkAttempts ?> <?= $this->translate('(hard state)') ?></td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<?php if ($object->check_execution_time): ?> <?php if ($object->check_execution_time): ?>