if (!$this->data['form_refresh']) { $graphTab->setSelected(0); } $graphTab->addTab('graphTab', empty($this->data['parent_discoveryid']) ? _('Graph') : _('Graph prototype'), $graphFormList); /* * Preview tab */ $chartImage = new CImg('chart3.php?period=3600'); $chartImage->preload(); $graphPreviewTable = new CTable(null, 'center maxwidth'); $graphPreviewTable->addRow(new CDiv($chartImage, null, 'previewChar')); $graphTab->addTab('previewTab', _('Preview'), $graphPreviewTable); $graphForm->addItem($graphTab); // append buttons to form if (!empty($this->data['graphid'])) { $updateButton = new CSubmit('update', _('Update')); $deleteButton = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete graph prototype?') : _('Delete graph?'), url_params(array('graphid', 'parent_discoveryid', 'hostid'))); if (!empty($this->data['templateid'])) { $updateButton->setEnabled(false); $deleteButton->setEnabled(false); } $graphForm->addItem(makeFormFooter($updateButton, array(new CSubmit('clone', _('Clone')), $deleteButton, new CButtonCancel(url_param('parent_discoveryid'))))); } else { $graphForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('parent_discoveryid')))); } // insert js (depended from some variables inside the file) insert_show_color_picker_javascript(); require_once dirname(__FILE__) . '/js/configuration.graph.edit.js.php'; // append form to widget $graphWidget->addItem($graphForm); return $graphWidget;
$inventoryFormList = new CFormList('inventorylist'); // radio buttons for inventory type choice $inventoryMode = isset($hostPrototype['inventory']['inventory_mode']) ? $hostPrototype['inventory']['inventory_mode'] : HOST_INVENTORY_DISABLED; $inventoryDisabledBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_DISABLED, null, 'host_inventory_radio_' . HOST_INVENTORY_DISABLED, $inventoryMode == HOST_INVENTORY_DISABLED); $inventoryDisabledBtn->setEnabled(!$hostPrototype['templateid']); $inventoryManualBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_MANUAL, null, 'host_inventory_radio_' . HOST_INVENTORY_MANUAL, $inventoryMode == HOST_INVENTORY_MANUAL); $inventoryManualBtn->setEnabled(!$hostPrototype['templateid']); $inventoryAutomaticBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_AUTOMATIC, null, 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC, $inventoryMode == HOST_INVENTORY_AUTOMATIC); $inventoryAutomaticBtn->setEnabled(!$hostPrototype['templateid']); $inventoryTypeRadioButton = array($inventoryDisabledBtn, new CLabel(_('Disabled'), 'host_inventory_radio_' . HOST_INVENTORY_DISABLED), $inventoryManualBtn, new CLabel(_('Manual'), 'host_inventory_radio_' . HOST_INVENTORY_MANUAL), $inventoryAutomaticBtn, new CLabel(_('Automatic'), 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC)); $inventoryFormList->addRow(new CDiv($inventoryTypeRadioButton, 'jqueryinputset')); // clearing the float $clearFixDiv = new CDiv(); $clearFixDiv->addStyle('clear: both;'); $inventoryFormList->addRow('', $clearFixDiv); $divTabs->addTab('inventoryTab', _('Host inventory'), $inventoryFormList); $frmHost->addItem($divTabs); /* * footer */ $others = array(); if ($hostPrototype['hostid']) { $btnDelete = new CButtonDelete(_('Delete selected host prototype?'), url_param('form') . url_param('hostid') . url_param('parent_discoveryid')); $btnDelete->setEnabled(!$hostPrototype['templateid']); $others[] = new CSubmit('clone', _('Clone')); $others[] = $btnDelete; } $others[] = new CButtonCancel(url_param('parent_discoveryid')); $frmHost->addItem(makeFormFooter(new CSubmit('save', _('Save')), $others)); $widget->addItem($frmHost); return $widget;
$divTabs->addTab('macroTab', _('Macros'), $macrosView->render()); } $inventoryFormList = new CFormList('inventorylist'); // radio buttons for inventory type choice $inventoryMode = isset($hostPrototype['inventory']['inventory_mode']) ? $hostPrototype['inventory']['inventory_mode'] : HOST_INVENTORY_DISABLED; $inventoryDisabledBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_DISABLED, null, 'host_inventory_radio_' . HOST_INVENTORY_DISABLED, $inventoryMode == HOST_INVENTORY_DISABLED); $inventoryDisabledBtn->setEnabled(!$hostPrototype['templateid']); $inventoryManualBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_MANUAL, null, 'host_inventory_radio_' . HOST_INVENTORY_MANUAL, $inventoryMode == HOST_INVENTORY_MANUAL); $inventoryManualBtn->setEnabled(!$hostPrototype['templateid']); $inventoryAutomaticBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_AUTOMATIC, null, 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC, $inventoryMode == HOST_INVENTORY_AUTOMATIC); $inventoryAutomaticBtn->setEnabled(!$hostPrototype['templateid']); $inventoryTypeRadioButton = array($inventoryDisabledBtn, new CLabel(_('Disabled'), 'host_inventory_radio_' . HOST_INVENTORY_DISABLED), $inventoryManualBtn, new CLabel(_('Manual'), 'host_inventory_radio_' . HOST_INVENTORY_MANUAL), $inventoryAutomaticBtn, new CLabel(_('Automatic'), 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC)); $inventoryFormList->addRow(new CDiv($inventoryTypeRadioButton, 'jqueryinputset')); // clearing the float $clearFixDiv = new CDiv(); $clearFixDiv->addStyle('clear: both;'); $inventoryFormList->addRow('', $clearFixDiv); $divTabs->addTab('inventoryTab', _('Host inventory'), $inventoryFormList); $frmHost->addItem($divTabs); /* * footer */ if (isset($hostPrototype['hostid'])) { $btnDelete = new CButtonDelete(_('Delete selected host prototype?'), url_param('form') . url_param('hostid') . url_param('parent_discoveryid')); $btnDelete->setEnabled($hostPrototype['templateid'] == 0); $frmHost->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CSubmit('clone', _('Clone')), $btnDelete, new CButtonCancel(url_param('parent_discoveryid'))))); } else { $frmHost->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('parent_discoveryid')))); } $widget->addItem($frmHost); return $widget;