private function makeRow($id) { $table = new CTable(); $tr = $this->makeSImgStr($id); $tr->addItem($this->tree[$id]['caption']); $table->addRow($tr); $tr = new CRow(); $tr->addItem($table); $tr->setAttribute('id', 'id_' . $id); $tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : ''); foreach ($this->fields as $value) { $tr->addItem($this->makeCol($id, $value)); } return $tr; }
$numSpan->addClass('rowNum'); $numSpan->setAttribute('id', 'current_step_' . $stepid); $name = new CSpan($step['name'], 'link'); $name->setAttribute('id', 'name_' . $stepid); $name->setAttribute('name_step', $stepid); $name->onClick('return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '&list_name=steps&stepid="+jQuery(this).attr("name_step")+"' . url_param($step['name'], false, 'name') . url_param($step['timeout'], false, 'timeout') . url_param($step['url'], false, 'url') . url_param($step['posts'], false, 'posts') . url_param($step['required'], false, 'required') . url_param($step['status_codes'], false, 'status_codes') . '", 600, 410);'); if (zbx_strlen($step['url']) > 70) { $url = new CSpan(substr($step['url'], 0, 35) . SPACE . '...' . SPACE . substr($step['url'], zbx_strlen($step['url']) - 25, 25)); $url->setHint($step['url']); } else { $url = $step['url']; } $removeButton = new CButton('remove_' . $stepid, _('Remove'), 'javascript: removeStep(this);', 'link_menu'); $removeButton->setAttribute('remove_step', $stepid); $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $name, $step['timeout'] . SPACE . _('sec'), $url, htmlspecialchars($step['required']), $step['status_codes'], $removeButton), 'sortable'); $row->setAttribute('id', 'steps_' . $stepid); $stepsTable->addRow($row); } $tmpColumn = new CCol(new CButton('add_step', _('Add'), 'return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '", 600, 410);', 'link_menu'), null, 8); $tmpColumn->setAttribute('style', 'vertical-align: middle;'); $stepsTable->addRow(new CRow($tmpColumn)); $httpStepFormList->addRow(_('Steps'), new CDiv($stepsTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append tabs to form $httpTab = new CTabView(array('remember' => true)); if (!$this->data['form_refresh']) { $httpTab->setSelected(0); } $httpTab->addTab('scenarioTab', _('Scenario'), $httpFormList); $httpTab->addTab('stepTab', _('Steps'), $httpStepFormList); $httpForm->addItem($httpTab); // append buttons to form
$ack = SPACE; } } if ($row_event['acknowledged'] == 0 && $row_event['value'] == TRIGGER_VALUE_TRUE) { $ack_cb = new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']); } else { $ack_cb = SPACE; } $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $trigger['triggerid'] . '&eventid=' . $row_event['eventid']); $next_clock = isset($trigger['events'][$enum - 1]) ? $trigger['events'][$enum - 1]['clock'] : time(); $empty_col = new CCol(SPACE); $empty_col->setColSpan(3); $ack_cb_col = new CCol($ack_cb); $ack_cb_col->setColSpan(2); $row = new CRow(array(SPACE, $config['event_ack_enable'] ? $ack_cb_col : null, $status, $clock, zbx_date2age($row_event['clock']), zbx_date2age($next_clock, $row_event['clock']), $config['event_ack_enable'] ? $ack : NULL, is_show_all_nodes() ? SPACE : null, $empty_col), 'odd_row'); $row->setAttribute('data-parentid', $trigger['triggerid']); $row->addStyle('display: none;'); $table->addRow($row); if ($i > $config['event_show_max']) { break; } } } } //----- GO ------ $footer = null; if ($config['event_ack_enable']) { $goBox = new CComboBox('go'); $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)');
} else { $row = new CRow(['', $checkbox, $hostColumn, (new CCol($item['name_expanded']))->addClass($state_css), (new CCol($lastClock))->addClass($state_css), (new CCol($lastValue))->addClass($state_css), (new CCol($change))->addClass($state_css), $actions]); } $hosts[$item['hostid']]['item_cnt']++; $tab_rows[$item['hostid']][] = $row; } foreach ($hosts as $hostId => $dbHost) { $host = $hosts[$dbHost['hostid']]; if (!isset($tab_rows[$hostId])) { continue; } $appRows = $tab_rows[$hostId]; $open_state = CProfile::get('web.latest.toggle_other', null, $host['hostid']); $hostName = null; if (!$singleHostSelected) { $hostName = (new CSpan($host['name']))->addClass(ZBX_STYLE_LINK_ACTION)->setMenuPopup(CMenuPopupHelper::getHost($host, $hostScripts[$host['hostid']])); if ($host['status'] == HOST_STATUS_NOT_MONITORED) { $hostName->addClass(ZBX_STYLE_RED); } } // add toggle row $table->addRow([(new CDiv())->addClass(ZBX_STYLE_TREEVIEW)->addClass('app-list-toggle')->setAttribute('data-host-id', $host['hostid'])->setAttribute('data-open-state', $open_state)->addItem(new CSpan()), '', $hostName, (new CCol([bold('- ' . 'other' . ' -'), ' (' . _n('%1$s Item', '%1$s Items', $dbHost['item_cnt']) . ')']))->setColSpan($filter['showDetails'] ? 10 : 5)]); // add toggle sub rows foreach ($appRows as $row) { $row->setAttribute('parent_host_id', $host['hostid']); $table->addRow($row); } } $form->addItem([$table, new CActionButtonList('graphtype', 'itemids', [GRAPH_TYPE_STACKED => ['name' => _('Display stacked graph')], GRAPH_TYPE_NORMAL => ['name' => _('Display graph')]])]); $widget->addItem($form)->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$groupList = new CFormList('grouplist'); // existing groups $groups = array(); foreach ($data['groups'] as $group) { $groups[] = array('id' => $group['groupid'], 'name' => $group['name']); } $groupList->addRow(_('Groups'), new CMultiSelect(array('name' => 'group_links[]', 'objectName' => 'hostGroup', 'objectOptions' => array('editable' => true, 'filter' => array('flags' => ZBX_FLAG_DISCOVERY_NORMAL)), 'data' => $groups, 'disabled' => (bool) $hostPrototype['templateid']))); // new group prototypes $customGroupTable = new CTable(SPACE, 'formElementTable'); $customGroupTable->setAttribute('id', 'tbl_group_prototypes'); // buttons $addButton = new CButton('group_prototype_add', _('Add'), null, 'link_menu'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_group_prototype'); $buttonRow->addItem($buttonColumn); $customGroupTable->addRow($buttonRow); $groupDiv = new CDiv($customGroupTable, 'objectgroup border_dotted ui-corner-all group-prototypes'); $groupList->addRow(_('Group prototypes'), $groupDiv); $divTabs->addTab('groupTab', _('Groups'), $groupList); // templates $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplateTable->attr('style', 'min-width: 400px;'); $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoreTemplates = array(); if ($hostPrototype['templates']) { foreach ($hostPrototype['templates'] as $template) {
$col->setAttribute('colspan', 6); $buttonRow = new CRow(array($buttonCol, $col)); $buttonRow->setAttribute('id', 'JMXIterfacesFooter'); $ifTab->addRow($buttonRow); $hostList->addRow(_('JMX interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row'); // table for IPMI interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'IPMIInterfaces'); $ifTab->setAttribute('data-type', 'ipmi'); $helpTextWhenDragInterfaceIPMI = new CSpan(_('Drag here to change the type of the interface to "IPMI" type.')); $helpTextWhenDragInterfaceIPMI->addClass('dragHelpText'); $buttonCol = new CCol(new CButton('addIPMIInterface', _('Add'), null, 'link_menu'), 'interface-add-control'); $col = new CCol($helpTextWhenDragInterfaceIPMI); $col->setAttribute('colspan', 6); $buttonRow = new CRow(array($buttonCol, $col)); $buttonRow->setAttribute('id', 'IPMIIterfacesFooter'); $ifTab->addRow($buttonRow); $hostList->addRow(_('IPMI interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row'); } else { $interfaces = array(); $existingInterfaceTypes = array(); foreach ($dbHost['interfaces'] as $interface) { $interface['locked'] = true; $existingInterfaceTypes[$interface['type']] = true; $interfaces[$interface['interfaceid']] = $interface; } zbx_add_post_js('hostInterfacesManager.add(' . CJs::encodeJson($interfaces) . ');'); zbx_add_post_js('hostInterfacesManager.disable()'); // table for agent interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'agentInterfaces');
$del_url = new CSpan(_('Delete'), 'link'); $del_url->setAttribute('onclick', 'javascript: if(confirm("' . _('Delete expression?') . '")) remove_expression("logtr' . $id . '"); return false;'); $row = new CRow(array(htmlspecialchars($expr['view']), $expr['type'] == REGEXP_INCLUDE ? _('Include') : _('Exclude'), array($imgup, SPACE, $imgdn), $del_url)); $row->setAttribute('id', 'logtr' . $id); $table->addRow($row); $frmTRLog->addVar('expressions[' . $id . '][value]', $expr['value']); $frmTRLog->addVar('expressions[' . $id . '][type]', $expr['type']); $frmTRLog->addVar('expressions[' . $id . '][view]', $expr['view']); $maxid = $maxid < $id ? $id : $maxid; } zbx_add_post_js('logexpr_count=' . ($maxid + 1)); $maxid = 0; foreach ($keys as $id => $val) { $del_url = new CLink(_('Delete'), '#', 'action', 'javascript: if(confirm("' . _('Delete keyword?') . '")) remove_keyword("keytr' . $id . '"); return false;'); $row = new CRow(array(htmlspecialchars($val['value']), $val['type'], $del_url)); $row->setAttribute('id', 'keytr' . $id); $keyTable->addRow($row); $frmTRLog->addVar('keys[' . $id . '][value]', $val['value']); $frmTRLog->addVar('keys[' . $id . '][type]', $val['type']); $maxid = $maxid < $id ? $id : $maxid; } zbx_add_post_js('key_count=' . ($maxid + 1)); $frmTRLog->addRow(SPACE, $keyTable); $frmTRLog->addRow(SPACE, $table); $sev_select = new CComboBox('priority', $priority); $sev_select->addItems(getSeverityCaption()); $frmTRLog->addRow(_('Severity'), $sev_select); $frmTRLog->addRow(_('Comments'), new CTextArea('comments', $comments)); $frmTRLog->addRow(_('URL'), new CTextBox('url', $url, 80)); $frmTRLog->addRow(_('Disabled'), new CCheckBox('status', $status == TRIGGER_STATUS_DISABLED ? 'yes' : 'no', null, 1)); $frmTRLog->addItemToBottomRow(new CSubmit('save_trigger', _('Save'), 'javascript: document.forms[0].action += \'?saction=1\';'));
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $output = array(); $stime = zbxDateToTime($this->timeline['stime']); $iv_string = array(ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1); $iv_numeric = array(ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1); if ($this->action == 'showvalues' || $this->action == 'showlatest') { $options = array('history' => $this->item['value_type'], 'itemids' => array_keys($this->items), 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN); if ($this->action == 'showlatest') { $options['limit'] = 500; } elseif ($this->action == 'showvalues') { $config = select_config(); $options['time_from'] = $stime - 10; // some seconds to allow script to execute $options['time_till'] = $stime + $this->timeline['period']; $options['limit'] = $config['search_limit']; } // text log if (isset($iv_string[$this->item['value_type']])) { $isManyItems = count($this->items) > 1; $useLogItem = $this->item['value_type'] == ITEM_VALUE_TYPE_LOG; $useEventLogItem = strpos($this->item['key_'], 'eventlog[') === 0; if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), $isManyItems ? _('Item') : null, $useLogItem ? _('Local time') : null, $useEventLogItem && $useLogItem ? _('Source') : null, $useEventLogItem && $useLogItem ? _('Severity') : null, $useEventLogItem && $useLogItem ? _('Event ID') : null, _('Value')), 'header'); } if (!zbx_empty($this->filter) && in_array($this->filterTask, array(FILTER_TASK_SHOW, FILTER_TASK_HIDE))) { $options['search'] = array('value' => $this->filter); if ($this->filterTask == FILTER_TASK_HIDE) { $options['excludeSearch'] = 1; } } $options['sortfield'] = 'id'; $historyData = API::History()->get($options); foreach ($historyData as $data) { $data['value'] = encode_log(trim($data['value'], "\r\n")); if (empty($this->plaintext)) { $item = $this->items[$data['itemid']]; $host = reset($item['hosts']); $color = null; if (isset($this->filter) && !zbx_empty($this->filter)) { $contain = zbx_stristr($data['value'], $this->filter); if ($contain && $this->filterTask == FILTER_TASK_MARK) { $color = $this->markColor; } if (!$contain && $this->filterTask == FILTER_TASK_INVERT_MARK) { $color = $this->markColor; } switch ($color) { case MARK_COLOR_RED: $color = 'red'; break; case MARK_COLOR_GREEN: $color = 'green'; break; case MARK_COLOR_BLUE: $color = 'blue'; break; } } $row = array(nbsp(zbx_date2str(_('Y.M.d H:i:s'), $data['clock']))); if ($isManyItems) { $row[] = $host['name'] . NAME_DELIMITER . $item['name_expanded']; } if ($useLogItem) { $row[] = $data['timestamp'] == 0 ? '-' : zbx_date2str(HISTORY_LOG_LOCALTIME_DATE_FORMAT, $data['timestamp']); // if this is a eventLog item, showing additional info if ($useEventLogItem) { $row[] = zbx_empty($data['source']) ? '-' : $data['source']; $row[] = $data['severity'] == 0 ? '-' : new CCol(get_item_logtype_description($data['severity']), get_item_logtype_style($data['severity'])); $row[] = $data['logeventid'] == 0 ? '-' : $data['logeventid']; } } $row[] = new CCol($data['value'], 'pre'); $newRow = new CRow($row); if (!is_null($color)) { $newRow->setAttribute('class', $color); } $historyTable->addRow($newRow); } else { $output[] = zbx_date2str(HISTORY_LOG_ITEM_PLAINTEXT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($data['value']) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } else { if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), _('Value'))); } $options['sortfield'] = array('itemid', 'clock'); $historyData = API::History()->get($options); foreach ($historyData as $data) { $item = $this->items[$data['itemid']]; $value = $data['value']; // format the value as float if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) { sscanf($data['value'], '%f', $value); } // html table if (empty($this->plaintext)) { if ($item['valuemapid']) { $value = applyValueMap($value, $item['valuemapid']); } $historyTable->addRow(array(zbx_date2str(HISTORY_ITEM_DATE_FORMAT, $data['clock']), zbx_nl2br($value))); } else { $output[] = zbx_date2str(HISTORY_PLAINTEXT_DATE_FORMAT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($value) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } } if ($this->action == 'showgraph' && !isset($iv_string[$this->item['value_type']])) { $this->dataId = 'historyGraph'; $containerId = 'graph_cont1'; $src = 'chart.php?itemid=' . $this->item['itemid'] . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stime'] . $this->getProfileUrlParams(); $output[] = new CDiv(null, 'center', $containerId); } // time control if (!$this->plaintext && str_in_array($this->action, array('showvalues', 'showgraph'))) { $graphDims = getGraphDims(); $this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($this->item['itemid'])); $timeControlData = array('periodFixed' => CProfile::get('web.history.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); if (!empty($this->dataId)) { $timeControlData['id'] = $this->getDataId(); $timeControlData['containerid'] = $containerId; $timeControlData['src'] = $src; $timeControlData['objDims'] = $graphDims; $timeControlData['loadSBox'] = 1; $timeControlData['loadImage'] = 1; $timeControlData['dynamic'] = 1; } else { $this->dataId = 'historyGraph'; $timeControlData['id'] = $this->getDataId(); $timeControlData['mainObject'] = 1; } if ($this->mode == SCREEN_MODE_JS) { $timeControlData['dynamic'] = 0; return 'timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'; } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'); } } if (!empty($this->plaintext)) { return $output; } else { if ($this->mode != SCREEN_MODE_JS) { $flickerfreeData = array('itemids' => $this->itemids, 'action' => $this->action, 'filter' => $this->filter, 'filterTask' => $this->filterTask, 'markColor' => $this->markColor); return $this->getOutput($output, true, $flickerfreeData); } } }
if ($eventLogItem) { $row[] = zbx_empty($data['source']) ? '-' : $data['source']; $row[] = $data['severity'] == 0 ? '-' : new CCol(get_item_logtype_description($data['severity']), get_item_logtype_style($data['severity'])); $row[] = $data['logeventid'] == 0 ? '-' : $data['logeventid']; } } $data['value'] = encode_log(trim($data['value'], "\r\n")); $row[] = new CCol($data['value'], 'pre'); $crow = new CRow($row); if (is_null($color_style)) { $min_color = 0x98; $max_color = 0xf8; $int_color = ($max_color - $min_color) / count($_REQUEST['itemid']); $int_color *= array_search($data['itemid'], $_REQUEST['itemid']); $int_color += $min_color; $crow->setAttribute('style', 'background-color: ' . sprintf("#%X%X%X", $int_color, $int_color, $int_color)); } else { if (!is_null($color_style)) { $crow->setClass($color_style); } } $table->addRow($crow); // Plain Text if (!isset($_REQUEST['plaintext'])) { continue; } $ptData['body'][] = zbx_date2str(S_HISTORY_LOG_ITEM_PLAINTEXT, $data['clock']); $ptData['body'][] = "\t" . $data['clock'] . "\t" . htmlspecialchars($data['value']) . "\n"; } } else { // NUMERIC, FLOAT
$numSpan->addClass('rowNum'); $profileLinksComboBox = new CComboBox('iconmap[mappings][#{iconmappingid}][inventory_link]'); $profileLinksComboBox->addItems($this->data['inventoryList']); $profileLinksComboBox->setAttribute('disabled', 'disabled'); $expressionTextBox = new CTextBox('iconmap[mappings][#{iconmappingid}][expression]'); $expressionTextBox->setAttribute('maxlength', 64); $expressionTextBox->setAttribute('disabled', 'disabled'); $iconsComboBox = new CComboBox('iconmap[mappings][#{iconmappingid}][iconid]', $firstIconId); $iconsComboBox->addClass('mappingIcon'); $iconsComboBox->addItems($this->data['iconList']); $iconsComboBox->setAttribute('disabled', 'disabled'); $iconPreviewImage = new CImg('imgstore.php?iconid=' . $firstIconId . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview'); $iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $firstIconId); // row template $hiddenRowTemplate = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, new CButton('remove', _('Remove'), '', 'link_menu removeMapping')), 'hidden'); $hiddenRowTemplate->setAttribute('id', 'rowTpl'); $iconMapTable->addRow($hiddenRowTemplate); // add row button $iconMapTable->addRow(new CCol(new CButton('addMapping', _('Add'), '', 'link_menu'), null, 7)); // <default icon row> $numSpan = new CSpan($i++ . ':'); $numSpan->addClass('rowNum'); $iconsComboBox = new CComboBox('iconmap[default_iconid]', $this->data['iconmap']['default_iconid']); $iconsComboBox->addClass('mappingIcon'); $iconsComboBox->addItems($this->data['iconList']); $iconPreviewImage = new CImg('imgstore.php?iconid=' . $this->data['iconmap']['default_iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview'); $iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $this->data['iconmap']['default_iconid']); $iconMapTable->addRow(array(new CCol(_('Default'), null, 4), $iconsComboBox, $iconPreviewImage)); // </default icon row> $iconMapTab->addRow(_('Mappings'), new CDiv($iconMapTable, 'objectgroup inlineblock border_dotted ui-corner-all')); $iconMapView = new CTabView();
$cmbWeekTo->AddItem($day_num, $day_str); } $time_param->AddRow(array(S_FROM, $cmbWeekFrom, new CTextBox('new_service_time[from]', 'H:i', 9))); $time_param->AddRow(array(S_TILL, $cmbWeekTo, new CTextBox('new_service_time[to]', 'H:i', 9))); $frmService->AddVar('new_service_time[note]', ''); } $frmService->AddRow(S_NEW_SERVICE_TIME, array($cmbTimeType, BR(), $time_param, new CButton('add_service_time', 'add', 'javascript: document.forms[0].action += \'?sform=1\'; submit();'))); //trigger $frmService->AddRow(S_LINK_TO_TRIGGER_Q, new CCheckBox("linktrigger", $linktrigger, "javascript: display_element('trigger_name');", 1)); if ($triggerid > 0) { $trigger = expand_trigger_description($triggerid); } else { $trigger = ""; } $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox("trigger", $trigger, 64, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $frmService->GetName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r'))); $row->setAttribute('id', 'trigger_name'); $row->setAttribute('style', $linktrigger == 1 ? '' : 'display: none;'); $frmService->AddRow($row); $frmService->AddVar("triggerid", $triggerid); //--------- //sortorder $frmService->AddRow(S_SORT_ORDER_0_999, new CTextBox("sortorder", $sortorder, 3)); //--------- $frmService->AddItemToBottomRow(new CButton("save_service", S_SAVE, 'javascript: document.forms[0].action += \'?saction=1\';')); if (isset($service["serviceid"])) { $frmService->AddItemToBottomRow(SPACE); $frmService->AddItemToBottomRow(new CButtonDelete("Delete selected service?", url_param("form") . url_param("serviceid") . '&saction=1')); } $frmService->AddItemToBottomRow(SPACE); $cb = new CButton('cancel', S_CANCEL); $cb->SetType('button');
function get_macros_widget($hostid = null) { if (isset($_REQUEST['form_refresh'])) { $macros = get_request('macros', array()); } else { if ($hostid > 0) { $macros = CUserMacro::get(array('output' => API_OUTPUT_EXTEND, 'hostids' => $hostid)); order_result($macros, 'macro'); } else { if ($hostid === null) { $macros = CUserMacro::get(array('output' => API_OUTPUT_EXTEND, 'globalmacro' => 1)); order_result($macros, 'macro'); } else { $macros = array(); } } } if (empty($macros)) { $macros = array(0 => array('macro' => '', 'value' => '')); } $macros_tbl = new CTable(SPACE, 'formElementTable'); $macros_tbl->setAttribute('id', 'tbl_macros'); $macros_tbl->addRow(array(SPACE, S_MACRO, SPACE, S_VALUE)); insert_js(' function addMacroRow(){ if(typeof(addMacroRow.macro_count) == "undefined"){ addMacroRow.macro_count = ' . count($macros) . '; } var tr = document.createElement("tr"); tr.className = (addMacroRow.macro_count % 2) ? "form_even_row" : "form_odd_row"; var td1 = document.createElement("td"); tr.appendChild(td1); var cb = document.createElement("input"); cb.setAttribute("type", "checkbox"); cb.className = "checkbox"; td1.appendChild(cb); td1.appendChild(document.createTextNode(" ")); var td2 = document.createElement("td"); tr.appendChild(td2); var text1 = document.createElement("input"); text1.setAttribute("type", "text"); text1.setAttribute("name", "macros["+addMacroRow.macro_count+"][macro]"); text1.className = "biginput"; text1.setAttribute("size",30); text1.setAttribute("placeholder","{$MACRO}"); td2.appendChild(text1); td2.appendChild(document.createTextNode(" ")); var td3 = document.createElement("td"); tr.appendChild(td3); var span = document.createElement("span"); span.innerHTML = "⇒"; span.setAttribute("style", "vertical-align:top;"); td3.appendChild(span); var td4 = document.createElement("td"); tr.appendChild(td4); var text2 = document.createElement("input"); text2.setAttribute("type", "text"); text2.setAttribute("placeholder","<' . S_VALUE . '>"); text2.setAttribute("name","macros["+addMacroRow.macro_count+"][value]"); text2.className = "biginput"; text2.setAttribute("size",40); td4.appendChild(text2); var sd = $("row_new_macro").insert({before : tr}); addMacroRow.macro_count++; } '); $macros = array_values($macros); foreach ($macros as $macroid => $macro) { $text1 = new CTextBox('macros[' . $macroid . '][macro]', $macro['macro'], 30); $text1->setAttribute('placeholder', '{$MACRO}'); $text2 = new CTextBox('macros[' . $macroid . '][value]', $macro['value'], 40); $text2->setAttribute('placeholder', '<' . S_VALUE . '>'); $span = new CSpan(RARR); $span->addStyle('vertical-align:top;'); $macros_tbl->addRow(array(new CCheckBox(), $text1, $span, $text2)); } $script = '$$("#tbl_macros input:checked").each(function(obj){ $(obj.parentNode.parentNode).remove(); if (typeof(deleted_macro_cnt) == \'undefined\') deleted_macro_cnt=1; else deleted_macro_cnt++; });'; $delete_btn = new CButton('macros_del', S_DELETE_SELECTED, $script); $delete_btn->setType('button'); $add_button = new CButton('macro_add', S_ADD, 'javascript: addMacroRow()'); $add_button->setType('button'); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_macro'); $col = new CCol(array($add_button, SPACE, $delete_btn)); $col->setAttribute('colspan', 4); $buttonRow->addItem($col); $macros_tbl->addRow($buttonRow); $footer = null; if ($hostid === null) { $footer = array(new CButton('save', S_SAVE, "if (deleted_macro_cnt > 0) return confirm('" . S_ARE_YOU_SURE_YOU_WANT_TO_DELETE . " '+deleted_macro_cnt+' " . S_MACROS_ES . "?');")); } return new CFormElement(S_MACROS, $macros_tbl, $footer); }
private function makeRow($id) { $table = new CTable(); $tr = $this->makeSImgStr($id); $tr->addItem($this->tree[$id]['caption']); $table->addRow($tr); $tr = new CRow(); $tr->addItem($table); $tr->setAttribute('id', 'id_' . $id); $tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : ''); foreach ($this->fields as $key => $value) { $style = null; if ($value == 'status' && $this->tree[$id]['serviceid'] > 0) { switch ($this->tree[$id][$value]) { case TRIGGER_SEVERITY_DISASTER: $this->tree[$id][$value] = S_DISASTER; $style = 'disaster'; break; case TRIGGER_SEVERITY_HIGH: $this->tree[$id][$value] = S_HIGH; $style = 'high'; break; case TRIGGER_SEVERITY_AVERAGE: $this->tree[$id][$value] = S_AVERAGE; $style = 'average'; break; case TRIGGER_SEVERITY_WARNING: $this->tree[$id][$value] = S_WARNING; $style = 'warning'; break; case TRIGGER_SEVERITY_INFORMATION: default: $this->tree[$id][$value] = new CSpan(S_OK_BIG, 'green'); break; } } $tr->addItem(new CCol($this->tree[$id][$value], $style)); } return $tr; }
$openState = CProfile::get('web.latest.toggle_other', null, $host['hostid']); $toggle = new CDiv(null, 'app-list-toggle icon-plus-9x9'); if ($openState) { $toggle->addClass('icon-minus-9x9'); } $toggle->setAttribute('data-app-id', '0_' . $host['hostid']); $toggle->setAttribute('data-open-state', $openState); $hostName = null; if (!$singleHostSelected) { $hostName = new CSpan($host['name'], 'link_menu menu-host' . ($host['status'] == HOST_STATUS_NOT_MONITORED ? ' not-monitored' : '')); $hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $hostScripts[$host['hostid']])); } // add toggle row $table->addRow(array($toggle, '', $hostName, new CCol(array(bold('- ' . 'other' . ' -'), ' (' . _n('%1$s Item', '%1$s Items', $dbHost['item_cnt']) . ')'), null, $filter['showDetails'] ? 10 : 5)), 'odd_row'); // add toggle sub rows foreach ($appRows as $row) { $row->setAttribute('parent_app_id', '0_' . $host['hostid']); $row->addClass('odd_row'); if (!$openState) { $row->addClass('hidden'); } $table->addRow($row); } } $goBox = new CComboBox('graphtype', GRAPH_TYPE_STACKED, null, array(GRAPH_TYPE_STACKED => _('Display stacked graph'), GRAPH_TYPE_NORMAL => _('Display graph'))); $goBox->setAttribute('id', 'action'); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $form->addItem(array($table, get_table_header(array($goBox, $goButton)))); $latestWidget->addItem($form); $latestWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
private function makeRow($id) { $table = new CTable(); $table->setCellSpacing(0); $table->setCellPadding(0); $table->setAttribute('border', '0'); $table->setAttribute('height', '100%'); $tr = $this->makeSImgStr($id); $td = new CCol($this->tree[$id]['caption']); $td->setAttribute('style', 'height: 100%; vertical-align: top; white-space: normal; padding-right: 10px; padding-left: 2px;'); $tr->addItem($td); $table->addRow($tr); $tr = new CRow(); $tr->addItem($table); $tr->setAttribute('id', 'id_' . $id); $tr->setAttribute('style', $this->tree[$id]['parentid'] != '0' ? 'display: none;' : ''); foreach ($this->fields as $key => $value) { $td = new CCol($this->tree[$id][$value]); $td->setAttribute('style', ' padding-right: 10px; padding-left: 2px;'); $tr->addItem($td); } return $tr; }
break; case SVC_SNMPv3: $form->addVar('new_check_snmp_community', ''); $external_param->addRow(array(S_SNMP_OID, new CTextBox('new_check_key', $new_check_key))); $external_param->addRow(array(S_SNMPV3_SECURITY_NAME, new CTextBox('new_check_snmpv3_securityname', $new_check_snmpv3_securityname))); $cmbSecLevel = new CComboBox('new_check_snmpv3_securitylevel', $new_check_snmpv3_securitylevel); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV, 'noAuthNoPriv'); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, 'authNoPriv'); $cmbSecLevel->addItem(ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, 'authPriv'); $external_param->addRow(array(S_SNMPV3_SECURITY_LEVEL, $cmbSecLevel)); // adding id to <tr> elements so they could be then hidden by cviewswitcher.js $row = new CRow(array(S_SNMPV3_AUTH_PASSPHRASE, new CTextBox('new_check_snmpv3_authpassphrase', $new_check_snmpv3_authpassphrase))); $row->setAttribute('id', 'row_snmpv3_authpassphrase'); $external_param->addRow($row); $row = new CRow(array(S_SNMPV3_PRIV_PASSPHRASE, new CTextBox('new_check_snmpv3_privpassphrase', $new_check_snmpv3_privpassphrase))); $row->setAttribute('id', 'row_snmpv3_privpassphrase'); $external_param->addRow($row); break; case SVC_AGENT: $form->addVar('new_check_snmp_community', ''); $form->addVar('new_check_snmpv3_securitylevel', ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV); $form->addVar('new_check_snmpv3_securityname', ''); $form->addVar('new_check_snmpv3_authpassphrase', ''); $form->addVar('new_check_snmpv3_privpassphrase', ''); $external_param->addRow(array(S_KEY, new CTextBox('new_check_key', $new_check_key), BR())); break; case SVC_ICMPPING: $form->addVar('new_check_ports', '0'); default: $form->addVar('new_check_snmp_community', ''); $form->addVar('new_check_key', '');
$urlTable->addRow($urlRow); $i++; } // append empty template row to url table $templateUrlLabel = new CTextBox('urls[#{id}][name]', '', 32); $templateUrlLabel->setAttribute('disabled', 'disabled'); $templateUrlLink = new CTextBox('urls[#{id}][url]', '', 32); $templateUrlLink->setAttribute('disabled', 'disabled'); $templateUrlEtype = new CComboBox('urls[#{id}][elementtype]'); $templateUrlEtype->setAttribute('disabled', 'disabled'); $templateUrlEtype->addItems(sysmap_element_types()); $templateRemoveButton = new CSpan(_('Remove'), 'link_menu'); $templateRemoveButton->addAction('onclick', '$("entry_#{id}").remove();'); $templateUrlRow = new CRow(array($templateUrlLabel, $templateUrlLink, $templateUrlEtype, $templateRemoveButton)); $templateUrlRow->addStyle('display: none'); $templateUrlRow->setAttribute('id', 'urlEntryTpl'); $urlTable->addRow($templateUrlRow); // append "add" button to url table $addButton = new CSpan(_('Add'), 'link_menu'); $addButton->addAction('onclick', 'cloneRow("urlEntryTpl", ' . $i . ')'); $addButtonColumn = new CCol($addButton); $addButtonColumn->setColSpan(4); $urlTable->addRow($addButtonColumn); // append url table to form list $sysmapList->addRow(_('URLs'), new CDiv($urlTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append sysmap to form $sysmapTab = new CTabView(); $sysmapTab->addTab('sysmapTab', _('Map'), $sysmapList); $sysmapForm->addItem($sysmapTab); // append buttons to form if (hasRequest('sysmapid') && getRequest('sysmapid') > 0) {
switch ($config) { default: case 1: $rep_form = valueDistributionFormForMultiplePeriods($validItems); break; case 2: $rep_form = valueDistributionFormForMultipleItems($validItems, $validPeriods); break; case 3: $rep_form = valueComparisonFormForMultiplePeriods(); break; } $rep6_wdgt->addFlicker($rep_form, CProfile::get('web.report6.filter.state', 1)); if (isset($_REQUEST['report_show'])) { $items = $config == 3 ? array(array('itemid' => get_request('itemid'))) : get_request('items'); if ($isValid && ($config != 3 ? $validItems : true) && ($config == 2 ? $validPeriods : true)) { $src = 'chart_bar.php?' . 'config=' . $config . url_param('title') . url_param('xlabel') . url_param('ylabel') . url_param('scaletype') . url_param('avgperiod') . url_param('showlegend') . url_param('sorttype') . url_param('report_timesince') . url_param('report_timetill') . url_param('periods') . url_param($items, false, 'items') . url_param('hostids') . url_param('groupids') . url_param('palette') . url_param('palettetype'); $rep_tab->addRow(new CImg($src, 'report')); } } $outer_table = new CTable(); $outer_table->setAttribute('border', 0); $outer_table->setAttribute('width', '100%'); $outer_table->setCellPadding(1); $outer_table->setCellSpacing(1); $tmp_row = new CRow($rep_tab); $tmp_row->setAttribute('align', 'center'); $outer_table->addRow($tmp_row); $rep6_wdgt->addItem($outer_table); $rep6_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$from = dowHrMinToStr($serviceTime['ts_from']); $to = dowHrMinToStr($serviceTime['ts_to'], true); break; case SERVICE_TIME_TYPE_DOWNTIME: $type = new CSpan(_('Downtime'), 'disabled'); $from = dowHrMinToStr($serviceTime['ts_from']); $to = dowHrMinToStr($serviceTime['ts_to'], true); break; case SERVICE_TIME_TYPE_ONETIME_DOWNTIME: $type = new CSpan(_('One-time downtime'), 'disabled'); $from = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_from']); $to = zbx_date2str(DATE_TIME_FORMAT, $serviceTime['ts_to']); break; } $row = new CRow(array(array($type, new CVar('times[' . $i . '][type]', $serviceTime['type']), new CVar('times[' . $i . '][ts_from]', $serviceTime['ts_from']), new CVar('times[' . $i . '][ts_to]', $serviceTime['ts_to']), new CVar('times[' . $i . '][note]', $serviceTime['note'])), $from . ' - ' . $to, htmlspecialchars($serviceTime['note']), new CButton('remove', _('Remove'), 'javascript: removeTime(\'' . $i . '\');', 'link_menu'))); $row->setAttribute('id', 'times_' . $i); $servicesTimeTable->addRow($row); $i++; } $servicesTimeFormList->addRow(_('Service times'), new CDiv($servicesTimeTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // create service time table $serviceTimeTable = new CTable(null, 'formElementTable'); if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) { // downtime since if (isset($_REQUEST['new_service_time']['from'])) { $fromYear = getRequest('new_service_time_from_year'); $fromMonth = getRequest('new_service_time_from_month'); $fromDay = getRequest('new_service_time_from_day'); $fromHours = getRequest('new_service_time_from_hour'); $fromMinutes = getRequest('new_service_time_from_minute'); $fromDate = array('y' => $fromYear, 'm' => $fromMonth, 'd' => $fromDay, 'h' => $fromHours, 'i' => $fromMinutes);
$text2 = new CTextBox('macros[' . $i . '][value]', $macro['value'], 40, $readonly, 255); $text2->setAttribute('placeholder', _('value')); $span = new CSpan('⇒'); $span->addStyle('vertical-align:top;'); $deleteButtonCell = null; if (!$readonly) { $deleteButtonCell = array(new CButton('macros_' . $i . '_remove', _('Remove'), null, 'link_menu element-table-remove')); if (isset($macro['globalmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][globalmacroid]', $macro['globalmacroid'], 'macros_' . $i . '_id'); } if (isset($macro['hostmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][hostmacroid]', $macro['hostmacroid'], 'macros_' . $i . '_id'); } } $row = array($text1, $span, $text2, $deleteButtonCell); $macrosTable->addRow($row, 'form_row'); } // buttons if (!$readonly) { $addButton = new CButton('macro_add', _('Add'), null, 'link_menu element-table-add'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_macro'); $buttonRow->addItem($buttonColumn); $macrosTable->addRow($buttonRow); } // form list $macrosFormList = new CFormList('macrosFormList'); $macrosFormList->addRow($macrosTable); return $macrosFormList;
function show_history($itemid, $from, $stime, $period) { //$till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600); //show_table_header(S_TILL.SPACE.$till.' ( '.zbx_date2age($stime,$stime+$period).' )'); $td = new CCol(get_js_sizeable_graph('graph', 'chart.php?itemid=' . $itemid . url_param($from, false, 'from') . url_param($stime, false, 'stime') . url_param($period, false, 'period'))); $td->setAttribute('align', 'center'); $tr = new CRow($td); $tr->setAttribute('bgcolor', '#dddddd'); $table = new CTable(); $table->setAttribute('width', '100%'); $table->setAttribute('bgcolor', '#cccccc'); $table->setAttribute('cellspacing', '1'); $table->setAttribute('cellpadding', '3'); $table->addRow($tr); $table->show(); }
$itemFormList->addRow(_('Update interval (in sec)'), new CNumericBox('delay', $this->data['delay'], 5), false, 'row_delay'); // append delay flex to form list $delayFlexTable = new CTable(_('No flexible intervals defined.'), 'formElementTable'); $delayFlexTable->setAttribute('style', 'min-width: 310px;'); $delayFlexTable->setAttribute('id', 'delayFlexTable'); $delayFlexTable->setHeader(array(_('Interval'), _('Period'), _('Action'))); $i = 0; $this->data['maxReached'] = false; foreach ($this->data['delay_flex'] as $delayFlex) { if (!isset($delayFlex['delay']) && !isset($delayFlex['period'])) { continue; } $itemForm->addVar('delay_flex[' . $i . '][delay]', $delayFlex['delay']); $itemForm->addVar('delay_flex[' . $i . '][period]', $delayFlex['period']); $row = new CRow(array($delayFlex['delay'], $delayFlex['period'], new CButton('remove', _('Remove'), 'javascript: removeDelayFlex(' . $i . ');', 'link_menu'))); $row->setAttribute('id', 'delayFlex_' . $i); $delayFlexTable->addRow($row); // limit count of intervals, 7 intervals by 30 symbols = 210 characters, db storage field is 256 $i++; if ($i == 7) { $this->data['maxReached'] = true; break; } } $itemFormList->addRow(_('Flexible intervals'), new CDiv($delayFlexTable, 'objectgroup inlineblock border_dotted ui-corner-all'), false, 'row_flex_intervals'); // append new flexible interval to form list $newFlexInt = new CSpan(array(_('Interval (in sec)'), SPACE, new CNumericBox('new_delay_flex[delay]', $this->data['new_delay_flex']['delay'], 5, 'no', false, false), SPACE, _('Period'), SPACE, new CTextBox('new_delay_flex[period]', $this->data['new_delay_flex']['period'], 20), SPACE, new CButton('add_delay_flex', _('Add'), null, 'formlist'))); $newFlexInt->setAttribute('id', 'row-new-delay-flex-fields'); $maxFlexMsg = new CSpan(_('Maximum number of flexible intervals added'), 'red'); $maxFlexMsg->setAttribute('id', 'row-new-delay-flex-max-reached'); $maxFlexMsg->setAttribute('style', 'display: none;');
} $hostFormList->addRow(array(_('Monitored by proxy'), SPACE, new CVisibilityBox('visible[proxy_hostid]', isset($this->data['visible']['proxy_hostid']), 'proxy_hostid', _('Original'))), $proxyComboBox); // append status to form list $statusComboBox = new CComboBox('status', $this->data['status']); $statusComboBox->addItem(HOST_STATUS_MONITORED, _('Monitored')); $statusComboBox->addItem(HOST_STATUS_NOT_MONITORED, _('Not monitored')); $hostFormList->addRow(array(_('Status'), SPACE, new CVisibilityBox('visible[status]', isset($this->data['visible']['status']), 'status', _('Original'))), $statusComboBox); // append templates table to from list $templatesTable = new CTable(_('No templates defined.'), 'formElementTable'); $templatesTable->setAttribute('style', 'min-width: 500px;'); $templatesTable->setAttribute('id', 'template_table'); $templatesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['templates'] as $templateid => $templateName) { $hostForm->addVar('templates[' . $templateid . ']', $templateName); $row = new CRow(array($templateName, new CButton('remove', _('Remove'), 'javascript: removeTemplate("' . $templateid . '");', 'link_menu'))); $row->setAttribute('id', 'template_row_' . $templateid); $templatesTable->addRow($row); } $templatesDiv = new CDiv(array($templatesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?srctbl=templates&srcfld1=hostid&srcfld2=host' . '&dstfrm=' . $hostForm->getName() . '&dstfld1=new_template&templated_hosts=1' . url_param($this->data['templates'], false, 'existed_templates') . '", 450, 450)', 'link_menu'), BR(), BR(), new CCheckBox('mass_replace_tpls', $this->data['mass_replace_tpls']), SPACE, _('Replace'), BR(), new CCheckBox('mass_clear_tpls', $this->data['mass_clear_tpls']), SPACE, _('Clear when unlinking')), 'objectgroup inlineblock border_dotted ui-corner-all'); $templatesDiv->setAttribute('id', 'templates_div'); $hostFormList->addRow(array(_('Link templates'), SPACE, new CVisibilityBox('visible[template_table]', !empty($this->data['visible']['template_table']) ? 'yes' : 'no', 'templates_div', _('Original'))), $templatesDiv); // append ipmi to form list $ipmiAuthtypeComboBox = new CComboBox('ipmi_authtype', $this->data['ipmi_authtype']); $ipmiAuthtypeComboBox->addItems(ipmiAuthTypes()); $hostFormList->addRow(array(_('IPMI authentication algorithm'), SPACE, new CVisibilityBox('visible[ipmi_authtype]', isset($this->data['visible']['ipmi_authtype']), 'ipmi_authtype', _('Original'))), $ipmiAuthtypeComboBox); $ipmiPrivilegeComboBox = new CComboBox('ipmi_privilege', $this->data['ipmi_privilege']); $ipmiPrivilegeComboBox->addItems(ipmiPrivileges()); $hostFormList->addRow(array(_('IPMI privilege level'), SPACE, new CVisibilityBox('visible[ipmi_privilege]', isset($this->data['visible']['ipmi_privilege']), 'ipmi_privilege', _('Original'))), $ipmiPrivilegeComboBox); $hostFormList->addRow(array(_('IPMI username'), SPACE, new CVisibilityBox('visible[ipmi_username]', isset($this->data['visible']['ipmi_username']), 'ipmi_username', _('Original'))), new CTextBox('ipmi_username', $this->data['ipmi_username'], ZBX_TEXTBOX_SMALL_SIZE)); $hostFormList->addRow(array(_('IPMI password'), SPACE, new CVisibilityBox('visible[ipmi_password]', isset($this->data['visible']['ipmi_password']), 'ipmi_password', _('Original'))), new CTextBox('ipmi_password', $this->data['ipmi_password'], ZBX_TEXTBOX_SMALL_SIZE)); // append inventories to form list
$dependenciesTable->setHeader(array(_('Name'), _('Action'))); foreach ($this->data['dependencies'] as $dependency) { $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']); $hostNames = array(); foreach ($dependency['hosts'] as $host) { $hostNames[] = CHtml::encode($host['name']); $hostNames[] = ', '; } array_pop($hostNames); if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) { $description = new CLink(array($hostNames, NAME_DELIMITER, CHtml::encode($dependency['description'])), 'triggers.php?form=update&hostid=' . $dependency['hostid'] . '&triggerid=' . $dependency['triggerid']); $description->setAttribute('target', '_blank'); } else { $description = array($hostNames, NAME_DELIMITER, $dependency['description']); } $row = new CRow(array($description, new CButton('remove', _('Remove'), 'javascript: removeDependency(\'' . $dependency['triggerid'] . '\');', 'link_menu'))); $row->setAttribute('id', 'dependency_' . $dependency['triggerid']); $dependenciesTable->addRow($row); } $dependenciesDiv = new CDiv(array($dependenciesTable, new CButton('btn1', _('Add'), 'return PopUp("popup.php?' . 'dstfrm=massupdate' . '&dstact=add_dependency' . '&reference=deptrigger' . '&dstfld1=new_dependency' . '&srctbl=triggers' . '&objname=triggers' . '&srcfld1=triggerid' . '&multiselect=1' . '&with_triggers=1", 1000, 700);', 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all'); $dependenciesDiv->setAttribute('id', 'dependencies_div'); $triggersFormList->addRow(array(_('Replace dependencies'), SPACE, new CVisibilityBox('visible[dependencies]', isset($this->data['visible']['dependencies']), 'dependencies_div', _('Original'))), $dependenciesDiv); } // append tabs to form $triggersTab = new CTabView(); $triggersTab->addTab('triggersTab', _('Mass update'), $triggersFormList); $triggersForm->addItem($triggersTab); // append buttons to form $triggersForm->addItem(makeFormFooter(new CSubmit('massupdate', _('Update')), new CButtonCancel(url_params(array('groupid', 'hostid', 'parent_discoveryid'))))); $triggersWidget->addItem($triggersForm); return $triggersWidget;
$urlTable->addRow($urlRow); $i++; } // append empty template row to url table $tplUrlLabel = new CTextBox('urls[#{id}][name]', '', 32); $tplUrlLabel->setAttribute('disabled', 'disabled'); $tplUrlLink = new CTextBox('urls[#{id}][url]', '', 32); $tplUrlLink->setAttribute('disabled', 'disabled'); $tplUrlEtype = new CCombobox('urls[#{id}][elementtype]'); $tplUrlEtype->setAttribute('disabled', 'disabled'); $tplUrlEtype->addItems(sysmap_element_types()); $tplRemoveButton = new CSpan(_('Remove'), 'link_menu'); $tplRemoveButton->addAction('onclick', '$("entry_#{id}").remove();'); $tplUrlRow = new CRow(array($tplUrlLabel, $tplUrlLink, $tplUrlEtype, $tplRemoveButton)); $tplUrlRow->addStyle('display: none'); $tplUrlRow->setAttribute('id', 'urlEntryTpl'); $urlTable->addRow($tplUrlRow); // append "add" button to url table $addButton = new CSpan(_('Add'), 'link_menu'); $addButton->addAction('onclick', 'cloneRow("urlEntryTpl", ' . $i . ')'); $addButtonColumn = new CCol($addButton); $addButtonColumn->setColSpan(4); $urlTable->addRow($addButtonColumn); // append url table to sysmap $sysmapList->addRow(_('URLs'), new CDiv($urlTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append sysmap to form $divTabs = new CTabView(array('remember' => 1)); if (!isset($_REQUEST['form_refresh'])) { $divTabs->setSelected(0); } $divTabs->addTab('sysmapTab', _('Map'), $sysmapList);