Restyle object flags

This commit is contained in:
Thomas Gelf 2014-03-08 08:23:48 +00:00
parent c9af498d81
commit 3e09931f2c
3 changed files with 81 additions and 158 deletions

View File

@ -56,9 +56,6 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
{ {
$form = new Form(); $form = new Form();
$form->setIgnoreChangeDiscarding(true); $form->setIgnoreChangeDiscarding(true);
$form->setAttrib('data-icinga-component', 'app/ajaxPostSubmitForm');
$form->setAttrib('class', 'inline-form');
$form->setRequest(Zend_Controller_Front::getInstance()->getRequest()); $form->setRequest(Zend_Controller_Front::getInstance()->getRequest());
// Filter work only from get parts. Put important // Filter work only from get parts. Put important
@ -184,15 +181,14 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
$form->addElement($submit_identifier); $form->addElement($submit_identifier);
$form->getElement('btn_submit')->setDecorators(array('ViewHelper')); $form->getElement('btn_submit')->setDecorators(array('ViewHelper'));
$out = '<label class="label-horizontal label-configuration" for="' . $uniqueName . '">' if ($label) {
. $label $out = '<label for="' . $uniqueName . '">'
. '</label>' . $label
. '<div class="pull-right">'; . '</label>';
}
if ($changed === true) { if ($changed === true) {
$out .= '<span class="config-changed">' $out .= $this->getView()->icon('config_changed.png') . ' (modified)';
. '<i class="icinga-icon-edit"></i> (modified)'
. '</span>';
} }
$formCode = (string) $form; $formCode = (string) $form;
@ -203,8 +199,7 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
$formCode = str_replace('</form>', $jsLessSubmit, $formCode); $formCode = str_replace('</form>', $jsLessSubmit, $formCode);
$out .= $formCode $out .= $formCode;
. '</div>';
return $out; return $out;
} }
@ -229,4 +224,4 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
} }
} }
// @codingStandardsIgnoreStop // @codingStandardsIgnoreStop

View File

@ -1,148 +1,77 @@
<?php <?php
$o = $this->object;
/** @var Zend_View_Helper_CommandForm $cf */ $o = $this->object;
$cf = $this->getHelper('CommandForm'); $cf = $this->getHelper('CommandForm');
$data = array( $data = array(
'host' => $o->host_name, 'host' => $o->host_name,
'service' => $o->service_description 'service' => $o->service_description
); );
$modified_attributes = false;
if ($o->service_description && $o->service_modified_service_attributes) {
$modified_attributes = true;
} elseif ($o->host_modified_host_attributes) {
$modified_attributes = true;
}
$test_db_modified = (
($o->passive_checks_enabled_changed === '0')
&& ($o->active_checks_enabled_changed === '0')
&& ($o->obsessing_changed === '0')
&& ($o->notifications_enabled_changed === '0')
&& ($o->event_handler_enabled_changed === '0')
&& ($o->flap_detection_enabled_changed === '0')
) ? false : true;
if ($modified_attributes && !$test_db_modified) {
$modified_attributes = false;
}
?> ?>
<div> <tr>
<div class="panel-heading"> <th>Passive Checks</th>
<div class="panel-hostname"> <td><?= $cf->toggleSubmitForm(
Configuration '',
</div> $o->passive_checks_enabled,
</div> 'startacceptingpassivechecks',
'stopacceptingpassivechecks',
<hr class="separator" /> $o->passive_checks_enabled_changed === '1',
$data
<div class="panel-body"> ) ?></td>
<table class="table table-bordered"> </tr>
<tbody> <tr>
<tr> <th>Active Checks</th>
<td> <td><?= $cf->toggleSubmitForm(
<?= '',
$cf->toggleSubmitForm( $o->active_checks_enabled,
'Passive Checks enabled', 'enableactivechecks',
$o->passive_checks_enabled, 'disableactivechecks',
'startacceptingpassivechecks', $o->active_checks_enabled_changed === '1',
'stopacceptingpassivechecks', $data
(($o->passive_checks_enabled_changed === '1') ? true : false), ) ?></td>
$data </tr>
); <tr>
?> <th>Notifications</th>
</td> <td><?= $cf->toggleSubmitForm(
</tr> '',
$o->notifications_enabled,
<tr> 'enablenotifications',
<td> 'disablenotifications',
<?= $o->notifications_enabled_changed === '1',
$cf->toggleSubmitForm( $data
'Active Checks enabled', ) ?></td>
$o->active_checks_enabled, </tr>
'enableactivechecks', <tr>
'disableactivechecks', <th>Event Handler</th>
(($o->active_checks_enabled_changed === '1') ? true : false), <td><?= $cf->toggleSubmitForm(
$data '',
); $o->event_handler_enabled,
?> 'enableeventhandler',
</td> 'disableeventhandler',
</tr> $o->event_handler_enabled_changed === '1',
$data
<tr> ) ?></td>
<td> </tr>
<?= <tr>
$cf->toggleSubmitForm( <th>Flap Detection</th>
'Obsessing enabled', <td><?= $cf->toggleSubmitForm(
$o->obsessing, '',
'startobsessing', $o->flap_detection_enabled,
'stopobsessing', 'enableflapdetection',
(($o->obsessing_changed === '1') ? true : false), 'disableflapdetection',
$data $o->flap_detection_enabled_changed === '1',
); $data
?> ) ?></td>
</td> </tr>
</tr> <tr>
<tr> <th>Obsessing</th>
<td> <td><?= $cf->toggleSubmitForm(
<?= '',
$cf->toggleSubmitForm( $o->obsessing,
'Notifications enabled', 'startobsessing',
$o->notifications_enabled, 'stopobsessing',
'enablenotifications', $o->obsessing_changed === '1',
'disablenotifications', $data
(($o->notifications_enabled_changed === '1') ? true : false), ) ?></td>
$data </tr>
);
?>
</td>
</tr>
<tr>
<td>
<?=
$cf->toggleSubmitForm(
'Eventhandler enabled',
$o->event_handler_enabled,
'enableeventhandler',
'disableeventhandler',
(($o->event_handler_enabled_changed === '1') ? true : false),
$data
);
?>
</td>
</tr>
<tr>
<td>
<?=
$cf->toggleSubmitForm(
'Flap Detection enabled',
$o->flap_detection_enabled,
'enableflapdetection',
'disableflapdetection',
(($o->flap_detection_enabled_changed === '1') ? true : false),
$data
);
?>
</td>
</tr>
</tbody>
</table>
<?php if ($modified_attributes === true): ?>
<?=
$cf->labelSubmitForm(
'Reset modified attributes',
'Reset configuration to initial values after a system restart',
'btn-cta',
'resetattributes',
$data
);
?>
<?php endif; ?>
</div>
</div>

View File

@ -18,7 +18,6 @@
<?= $this->render('show/components/contacts.phtml') ?> <?= $this->render('show/components/contacts.phtml') ?>
<?= $this->render('show/components/checkstatistics.phtml') ?> <?= $this->render('show/components/checkstatistics.phtml') ?>
<?= $this->render('show/components/customvars.phtml') ?> <?= $this->render('show/components/customvars.phtml') ?>
</table>
<?= $this->render('show/components/properties.phtml') ?>
<?= $this->render('show/components/flags.phtml') ?> <?= $this->render('show/components/flags.phtml') ?>
</table>
</div> </div>