* Macros */ if (empty($macros)) { $macros = array(array('macro' => '', 'value' => '')); } $macrosView = new CView('common.macros', array('macros' => $macros, 'readonly' => $isDiscovered)); $divTabs->addTab('macroTab', _('Macros'), $macrosView->render()); $inventoryFormList = new CFormList('inventorylist'); // radio buttons for inventory type choice $inventoryMode = isset($dbHost['inventory']['inventory_mode']) ? $dbHost['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(!$isDiscovered); $inventoryManualBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_MANUAL, null, 'host_inventory_radio_' . HOST_INVENTORY_MANUAL, $inventoryMode == HOST_INVENTORY_MANUAL); $inventoryManualBtn->setEnabled(!$isDiscovered); $inventoryAutomaticBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_AUTOMATIC, null, 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC, $inventoryMode == HOST_INVENTORY_AUTOMATIC); $inventoryAutomaticBtn->setEnabled(!$isDiscovered); $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(SPACE, new CDiv($inventoryTypeRadioButton, 'jqueryinputset')); $hostInventoryTable = DB::getSchema('host_inventory'); $hostInventoryFields = getHostInventories(); foreach ($hostInventoryFields as $inventoryNo => $inventoryInfo) { if (!isset($host_inventory[$inventoryInfo['db_field']])) { $host_inventory[$inventoryInfo['db_field']] = ''; } if ($hostInventoryTable['fields'][$inventoryInfo['db_field']]['type'] == DB::FIELD_TYPE_TEXT) { $input = new CTextArea('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]); $input->addStyle('width: 64em;'); } else { $fieldLength = $hostInventoryTable['fields'][$inventoryInfo['db_field']]['length']; $input = new CTextBox('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]); $input->setAttribute('maxlength', $fieldLength);
$ipmiList->addRow(_('Username'), new CTextBox('ipmi_username', $parentHost['ipmi_username'], ZBX_TEXTBOX_SMALL_SIZE, true)); $ipmiList->addRow(_('Password'), new CTextBox('ipmi_password', $parentHost['ipmi_password'], ZBX_TEXTBOX_SMALL_SIZE, true)); $divTabs->addTab('ipmiTab', _('IPMI'), $ipmiList); // macros $macrosView = new CView('common.macros', array('macros' => $parentHost['macros'], 'readonly' => true)); $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 */ $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']);