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) {
$out = '<label for="' . $uniqueName . '">'
. $label . $label
. '</label>' . '</label>';
. '<div class="pull-right">'; }
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;
} }

View File

@ -1,7 +1,6 @@
<?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(
@ -9,140 +8,70 @@
'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>
<div class="panel-heading">
<div class="panel-hostname">
Configuration
</div>
</div>
<hr class="separator" />
<div class="panel-body">
<table class="table table-bordered">
<tbody>
<tr> <tr>
<td> <th>Passive Checks</th>
<?= <td><?= $cf->toggleSubmitForm(
$cf->toggleSubmitForm( '',
'Passive Checks enabled',
$o->passive_checks_enabled, $o->passive_checks_enabled,
'startacceptingpassivechecks', 'startacceptingpassivechecks',
'stopacceptingpassivechecks', 'stopacceptingpassivechecks',
(($o->passive_checks_enabled_changed === '1') ? true : false), $o->passive_checks_enabled_changed === '1',
$data $data
); ) ?></td>
?>
</td>
</tr> </tr>
<tr> <tr>
<td> <th>Active Checks</th>
<?= <td><?= $cf->toggleSubmitForm(
$cf->toggleSubmitForm( '',
'Active Checks enabled',
$o->active_checks_enabled, $o->active_checks_enabled,
'enableactivechecks', 'enableactivechecks',
'disableactivechecks', 'disableactivechecks',
(($o->active_checks_enabled_changed === '1') ? true : false), $o->active_checks_enabled_changed === '1',
$data $data
); ) ?></td>
?>
</td>
</tr>
<tr>
<td>
<?=
$cf->toggleSubmitForm(
'Obsessing enabled',
$o->obsessing,
'startobsessing',
'stopobsessing',
(($o->obsessing_changed === '1') ? true : false),
$data
);
?>
</td>
</tr> </tr>
<tr> <tr>
<td> <th>Notifications</th>
<?= <td><?= $cf->toggleSubmitForm(
$cf->toggleSubmitForm( '',
'Notifications enabled',
$o->notifications_enabled, $o->notifications_enabled,
'enablenotifications', 'enablenotifications',
'disablenotifications', 'disablenotifications',
(($o->notifications_enabled_changed === '1') ? true : false), $o->notifications_enabled_changed === '1',
$data $data
); ) ?></td>
?>
</td>
</tr> </tr>
<tr> <tr>
<td> <th>Event Handler</th>
<?= <td><?= $cf->toggleSubmitForm(
$cf->toggleSubmitForm( '',
'Eventhandler enabled',
$o->event_handler_enabled, $o->event_handler_enabled,
'enableeventhandler', 'enableeventhandler',
'disableeventhandler', 'disableeventhandler',
(($o->event_handler_enabled_changed === '1') ? true : false), $o->event_handler_enabled_changed === '1',
$data $data
); ) ?></td>
?>
</td>
</tr> </tr>
<tr> <tr>
<td> <th>Flap Detection</th>
<?= <td><?= $cf->toggleSubmitForm(
$cf->toggleSubmitForm( '',
'Flap Detection enabled',
$o->flap_detection_enabled, $o->flap_detection_enabled,
'enableflapdetection', 'enableflapdetection',
'disableflapdetection', 'disableflapdetection',
(($o->flap_detection_enabled_changed === '1') ? true : false), $o->flap_detection_enabled_changed === '1',
$data $data
); ) ?></td>
?>
</td>
</tr> </tr>
</tbody> <tr>
</table> <th>Obsessing</th>
<td><?= $cf->toggleSubmitForm(
<?php if ($modified_attributes === true): ?> '',
$o->obsessing,
<?= 'startobsessing',
$cf->labelSubmitForm( 'stopobsessing',
'Reset modified attributes', $o->obsessing_changed === '1',
'Reset configuration to initial values after a system restart',
'btn-cta',
'resetattributes',
$data $data
); ) ?></td>
?> </tr>
<?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>