function BodyToString($destroy = true) { $table = new CTable(null, 'setup_wizard'); $table->setAlign('center'); $table->setHeader(array(new CCol(S_ZABBIX_VER, 'left'), SPACE), 'header'); $table->addRow(array(SPACE, new CCol($this->stage[$this->getStep()]['title'], 'right')), 'title'); $table->addRow(array(new CCol($this->getList(), 'left'), new CCol($this->getState(), 'right')), 'center'); $next = new CButton('next[' . $this->getStep() . ']', S_NEXT . ' >>'); if ($this->DISABLE_NEXT_BUTTON) { $next->setEnabled(false); } $table->setFooter(array(new CCol(new CButton('cancel', S_CANCEL), 'left'), new CCol(array(isset($this->stage[$this->getStep() - 1]) ? new CButton('back[' . $this->getStep() . ']', '<< ' . S_PREVIOUS) : null, isset($this->stage[$this->getStep() + 1]) ? $next : new CButton('finish', S_FINISH)), 'right')), 'footer'); return parent::BodyToString($destroy) . $table->ToString(); }
function import_map_form($rules) { global $USER_DETAILS; $form = new CFormTable(S_IMPORT, null, 'post', 'multipart/form-data'); $form->addRow(S_IMPORT_FILE, new CFile('import_file')); $table = new CTable(); $table->setHeader(array(S_ELEMENT, S_UPDATE . SPACE . S_EXISTING, S_ADD . SPACE . S_MISSING), 'bold'); $titles = array('maps' => S_MAP); if ($USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN) { $titles += array('icons' => S_ICON, 'background' => S_BACKGROUND); } foreach ($titles as $key => $title) { $cbExist = new CCheckBox('rules[' . $key . '][exist]', isset($rules[$key]['exist'])); if ($key != 'maps') { $cbExist->setAttribute('onclick', 'javascript: if(this.checked) return confirm(\'Images for all maps will be updated\')'); } $cbMissed = new CCheckBox('rules[' . $key . '][missed]', isset($rules[$key]['missed'])); $table->addRow(array($title, $cbExist, $cbMissed)); } $form->addRow(S_RULES, $table); $form->addItemToBottomRow(new CButton('import', S_IMPORT)); return $form; }
} //------------------------ </ACTIONS> -------------------------- //------------------------ <FORM> --------------------------- $frm_test = new CFormTable(_('Test'), 'tr_testexpr.php'); $frm_test->setHelp('web.testexpr.service.php'); $frm_test->setTableClass('formlongtable formtable'); $frm_test->addVar('form_refresh', get_request('form_refresh', 1)); $frm_test->addVar('expression', $expression); /* test data */ $frm_test->addRow(_('Test data'), $data_table); /* result */ $res_table = new CTable(null, 'tableinfo'); $res_table->setAttribute('id', 'result_list'); $res_table->setOddRowClass('even_row'); $res_table->setEvenRowClass('even_row'); $res_table->setHeader(array(_('Expression'), _('Result'))); ksort($rplcts, SORT_NUMERIC); foreach ($eHTMLTree as $e) { $result = '-'; if ($allowedTesting && $test && isset($e['expression'])) { $result = evalExpressionData($e['expression']['value'], $macrosData, $octet); } $style = 'text-align: center;'; if ($result != '-') { $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;'; } $col = new CCol($result); $col->setAttribute('style', $style); $res_table->addRow(new CRow(array($e['list'], $col))); } $result = '-';
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null) { // group $lists['group']['label'] = _('Host groups'); $lists['group']['read_write'] = new CListBox('groups_write', null, 15); $lists['group']['read_only'] = new CListBox('groups_read', null, 15); $lists['group']['deny'] = new CListBox('groups_deny', null, 15); $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY); foreach ($groups as $group) { switch ($group['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lists['group'][$list_name]->addItem($group['groupid'], $group['name']); } unset($groups); // host $lists['host']['label'] = _('Hosts'); $lists['host']['read_write'] = new CListBox('hosts_write', null, 15); $lists['host']['read_only'] = new CListBox('hosts_read', null, 15); $lists['host']['deny'] = new CListBox('hosts_deny', null, 15); $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY); foreach ($hosts as $host) { switch ($host['permission']) { case PERM_READ: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) { $host['host_name'] = $host['host']; } $lists['host'][$list_name]->addItem($host['hostid'], $host['host_name']); } unset($hosts); // display if (empty($rightsFormList)) { $rightsFormList = new CFormList('rightsFormList'); } $isHeaderDisplayed = false; foreach ($lists as $list) { $sLabel = ''; $row = new CRow(); foreach ($list as $class => $item) { if (is_string($item)) { $sLabel = $item; } else { $row->addItem(new CCol($item, $class)); } } $table = new CTable(_('No accessible resources'), 'right_table calculated'); if (!$isHeaderDisplayed) { $table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header'); $isHeaderDisplayed = true; } $table->addRow($row); $rightsFormList->addRow($sLabel, $table); } return $rightsFormList; }
} else { $multiplierCheckBox = new CCheckBox('multiplier', $this->data['multiplier'] == 1 ? 'yes' : 'no', 'var editbx = document.getElementById(\'formula\'); if (editbx) { editbx.disabled = !this.checked; }', 1); $multiplier[] = $multiplierCheckBox; $multiplier[] = SPACE; $formulaTextBox = new CTextBox('formula', $this->data['formula'], ZBX_TEXTBOX_SMALL_SIZE); $formulaTextBox->setAttribute('style', 'text-align: right;'); $multiplier[] = $formulaTextBox; } $itemFormList->addRow(_('Use custom multiplier'), $multiplier, false, 'row_multiplier'); } $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;
public function bodyToString() { $res = parent::bodyToString(); $tbl = new CTable(null, $this->tableclass); $tbl->setCellSpacing(0); $tbl->setCellPadding(1); $tbl->setAlign($this->align); // add first row if (!is_null($this->title)) { $col = new CCol(null, 'form_row_first'); $col->setColSpan(2); if (isset($this->help)) { $col->addItem($this->help); } if (isset($this->title)) { $col->addItem($this->title); } $tbl->setHeader($col); } // add last row $tbl->setFooter($this->bottom_items); // add center rows foreach ($this->center_items as $item) { $tbl->addRow($item); } return $res . $tbl->toString(); }
** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $rulesTable = new CTable(null, 'formElementTable'); $rulesTable->setHeader(array(SPACE, _('Update existing'), _('Add missing')), 'bold'); $titles = array('groups' => _('Groups'), 'hosts' => _('Hosts'), 'templates' => _('Templates'), 'templateScreens' => _('Template screens'), 'templateLinkage' => _('Template linkage'), 'items' => _('Items'), 'discoveryRules' => _('Discovery rules'), 'triggers' => _('Triggers'), 'graphs' => _('Graphs'), 'screens' => _('Screens'), 'maps' => _('Maps'), 'images' => _('Images')); $rules = $this->get('rules'); foreach ($titles as $key => $title) { $cbExist = $cbMissed = SPACE; if (isset($rules[$key]['updateExisting'])) { $cbExist = new CCheckBox('rules[' . $key . '][updateExisting]', $rules[$key]['updateExisting'], null, 1); if ($key == 'images') { if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) { continue; } $cbExist->setAttribute('onclick', 'if (this.checked) return confirm(\'' . _('Images for all maps will be updated!') . '\')'); } } if (isset($rules[$key]['createMissing'])) { $cbMissed = new CCheckBox('rules[' . $key . '][createMissing]', $rules[$key]['createMissing'], null, 1);
define('ZBX_PAGE_NO_MENU', 1); } $refresh_rate = 30; //seconds $fields = array('warning_msg' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL)); check_fields($fields, false); if (isset($_REQUEST['cancel'])) { zbx_unsetcookie('ZBX_CONFIG'); redirect('index.php'); } // clear_messages(); $USER_DETAILS['refresh'] = $refresh_rate; include_once 'include/page_header.php'; unset($USER_DETAILS); $table = new CTable(null, 'warning'); $table->setAlign('center'); $table->setAttribute('style', 'width: 480px; margin-top: 100px;'); $table->setHeader(array(new CCol(S_ZABBIX . SPACE . ZABBIX_VERSION, 'left')), 'header'); $table->addRow(SPACE); $warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!'; $img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img'); $img->setAttribute('style', 'border-width: 0px; vertical-align: bottom;'); $msg = new CSpan(bold(SPACE . $warning_msg)); $msg->setAttribute('style', 'line-height: 20px; vertical-align: top;'); $table->addRow(new CCol(array($img, $msg), 'center')); $table->addRow(SPACE); $table->setFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer'); $table->show(); zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');'); echo SBR; include_once 'include/page_footer.php';
if ($config == 1) { if (isset($_FILES['import_file'])) { include_once 'include/import.inc.php'; DBstart(); $importer = new CZabbixXMLImport(); $importer->setRules($rules['host'], $rules['template'], $rules['item'], $rules['trigger'], $rules['graph']); $result = $importer->Parse($_FILES['import_file']['tmp_name']); unset($importer); $result = DBend($result); show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL); } $form = new CFormTable($frm_title, null, 'post', 'multipart/form-data'); $form->addVar('config', $config); $form->addRow(S_IMPORT_FILE, new CFile('import_file')); $table = new CTable(); $table->setHeader(array(S_ELEMENT, S_EXISTING, S_MISSING), 'bold'); foreach (array('host' => S_HOST, 'template' => S_TEMPLATE, 'item' => S_ITEM, 'trigger' => S_TRIGGER, 'graph' => S_GRAPH) as $key => $title) { $cmbExist = new CComboBox('rules[' . $key . '][exist]', $rules[$key]['exist']); $cmbExist->addItem(0, S_UPDATE); $cmbExist->addItem(1, S_SKIP); $cmbMissed = new CComboBox('rules[' . $key . '][missed]', $rules[$key]['missed']); if ($key != 'template') { $cmbMissed->addItem(0, S_ADD); } $cmbMissed->addItem(1, S_SKIP); $table->addRow(array($title, $cmbExist, $cmbMissed)); } $form->addRow(S_RULES, $table); $form->addItemToBottomRow(new CButton('import', S_IMPORT)); $form->Show(); } else {
function insert_map_link_form() { $frmCnct = new CFormTable('New connector', 'sysmap.php'); $frmCnct->setHelp('web.sysmap.connector.php'); $frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']); if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) { $frmCnct->addVar('linkid', $_REQUEST['linkid']); $db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']); $db_link = DBfetch($db_links); $selementid1 = $db_link['selementid1']; $selementid2 = $db_link['selementid2']; $triggers = array(); $drawtype = $db_link['drawtype']; $color = $db_link['color']; $res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']); while ($rows = DBfetch($res)) { $triggers[] = $rows; } } else { if (isset($_REQUEST['linkid'])) { $frmCnct->addVar('linkid', $_REQUEST['linkid']); } $selementid1 = get_request('selementid1', 0); $selementid2 = get_request('selementid2', 0); $triggers = get_request('triggers', array()); $drawtype = get_request('drawtype', 0); $color = get_request('color', 0); } /* START comboboxes preparations */ $cmbElements1 = new CComboBox('selementid1', $selementid1); $cmbElements2 = new CComboBox('selementid2', $selementid2); $map_elements = array(); $sql = 'SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']; $db_elements = DBselect($sql); while ($db_element = DBfetch($db_elements)) { $map_elements[$db_element['selementid']] = $db_element; } order_result($map_elements, 'label'); foreach ($map_elements as $selementid => $db_selement) { $label = $db_selement['label']; if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) { $db_host = get_host_by_hostid($db_selement['elementid']); $label .= ':' . $db_host['host']; } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) { $db_map = get_sysmap_by_sysmapid($db_selement['elementid']); $label .= ':' . $db_map['name']; } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) { if ($db_selement['elementid'] > 0) { $label .= ':' . expand_trigger_description($db_selement['elementid']); } } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) { if ($db_selement['elementid'] > 0) { $db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid'])); $label .= ':' . $db_group['name']; } } } } } $cmbElements1->addItem($db_selement['selementid'], $label); $cmbElements2->addItem($db_selement['selementid'], $label); } $cmbType = new CComboBox('drawtype', $drawtype); foreach (map_link_drawtypes() as $i) { $value = map_link_drawtype2str($i); $cmbType->addItem($i, $value); } /* END preparation */ $frmCnct->addRow(S_ELEMENT_1, $cmbElements1); $frmCnct->addRow(S_ELEMENT_2, $cmbElements2); //trigger links foreach ($triggers as $id => $trigger) { if (isset($trigger['triggerid'])) { $triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']); } } $table = new CTable(); $table->SetClass('tableinfo'); $table->setOddRowClass('even_row'); $table->setEvenRowClass('even_row'); $table->attributes['cellpadding'] = 3; $table->attributes['cellspacing'] = 1; $table->headerClass = 'header'; $table->footerClass = 'footer'; $table->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $frmCnct->getName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR)); $table->setAttribute('id', 'link_triggers'); foreach ($triggers as $id => $trigger) { if (!isset($trigger['triggerid'])) { continue; } $colorbox = new CSpan(SPACE . SPACE . SPACE); $colorbox->setAttribute('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';'); $link_desc = new CSpan($trigger['description'], 'link'); $link_desc->setAttribute('onclick', "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"); $table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array($link_desc, new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color'])))); } $btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T'); $btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T'); $btnadd->SetType('button'); $frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove)); //---------- $frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType); $frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color)); $frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE)); if (isset($_REQUEST["linkid"])) { $frmCnct->addItemToBottomRow(SPACE); $frmCnct->addItemToBottomRow(new CButtonDelete("Delete link?", url_param("linkid") . url_param("sysmapid"))); } $frmCnct->addItemToBottomRow(SPACE); $frmCnct->addItemToBottomRow(new CButtonCancel(url_param("sysmapid"))); $frmCnct->show(); }
$frmService->AddVar('parentid', $parentid); $cb = new CButton('select_parent', S_CHANGE); $cb->SetType('button'); $cb->SetAction("javascript: openWinCentered('services_form.php?pservices=1" . url_param('serviceid') . "','ZBX_Services_List',740,420,'scrollbars=1, toolbar=0, menubar=0, resizable=1, dialog=0');"); $frmService->AddRow('Parent Service', array($ctb, $cb)); //---------- //child links $table = new CTable(); $table->setClass('tableinfo'); $table->setOddRowClass('even_row'); $table->setEvenRowClass('even_row'); $table->attributes['cellpadding'] = 3; $table->attributes['cellspacing'] = 1; $table->headerClass = 'header'; $table->footerClass = 'footer'; $table->setHeader(array(new CCheckBox('all_child_services', null, "check_childs('" . $frmService->GetName() . "','childs','all_child_services');"), S_SERVICES, S_SOFT, S_TRIGGER)); $table->setAttribute('id', 'service_childs'); foreach ($childs as $id => $child) { $prefix = null; $trigger = '-'; $description = new CLink($child['name'], 'services_form.php?sform=1&serviceid=' . $child['serviceid'], 'action'); if (isset($child['triggerid']) && !empty($child['triggerid'])) { $trigger = expand_trigger_description($child['triggerid']); } $table->AddRow(array(array(new CCheckBox('childs_to_del[' . $child['serviceid'] . '][serviceid]', null, null, $child['serviceid']), new CVar('childs[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), array($description, new CVar('childs[' . $child['serviceid'] . '][name]', $child['name'])), new CCheckBox('childs[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, isset($child['soft']) && !empty($child['soft']) ? 1 : 0), array($trigger, new CVar('childs[' . $child['serviceid'] . '][triggerid]', isset($child['triggerid']) ? $child['triggerid'] : '')))); } $cb = new CButton('add_child_service', S_ADD); $cb->SetType('button'); $cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1" . url_param('serviceid') . "','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"); $cb2 = new CButton('del_child_service', S_REMOVE); $cb2->SetType('button');
//------------------------ </ACTIONS> -------------------------- //------------------------ <FORM> --------------------------- $frm_test = new CFormTable(S_TEST, 'tr_testexpr.php'); $frm_test->setHelp('web.testexpr.service.php'); $frm_test->setTableClass('formlongtable formtable'); $frm_test->addVar('form_refresh', get_request('form_refresh', 1)); $frm_test->addVar('expression', urlencode($expression)); /* test data */ $frm_test->addRow(S_TEST_DATA, $data_table); /* result */ $res_table = new CTable(); $res_table->setClass('tableinfo'); $res_table->setAttribute('id', 'result_list'); $res_table->setOddRowClass('even_row'); $res_table->setEvenRowClass('even_row'); $res_table->setHeader(array(S_EXPRESSION, S_RESULT)); ksort($rplcts, SORT_NUMERIC); //$exprs = make_disp_tree($tree, $map); foreach ($eHTMLTree as $e) { //if(!isset($e['expression'])) //continue; $result = '-'; if ($allowedTesting && $test && isset($e['expression'])) { $result = evalExpressionData($e['expression']['value'], $macrosData, $octet); } $style = 'text-align: center;'; if ($result != '-') { $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;'; } $col = new CCol($result); $col->setAttribute('style', $style);
function getPermissionsFormList($rights = array(), $user_type = USER_TYPE_ZABBIX_USER, $rightsFormList = null) { // nodes if (ZBX_DISTRIBUTED) { $lists['node']['label'] = _('Nodes'); $lists['node']['read_write'] = new CListBox('nodes_write', null, 10); $lists['node']['read_only'] = new CListBox('nodes_read', null, 10); $lists['node']['deny'] = new CListBox('nodes_deny', null, 10); $lists['node']['read_write']->setAttribute('style', 'background: #EBEFF2;'); $lists['node']['read_only']->setAttribute('style', 'background: #EBEFF2;'); $lists['node']['deny']->setAttribute('style', 'background: #EBEFF2;'); $nodes = get_accessible_nodes_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY); foreach ($nodes as $node) { switch ($node['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lists['node'][$list_name]->addItem($node['nodeid'], $node['name']); } unset($nodes); } // group $lists['group']['label'] = _('Host groups'); $lists['group']['read_write'] = new CListBox('groups_write', null, 15); $lists['group']['read_only'] = new CListBox('groups_read', null, 15); $lists['group']['deny'] = new CListBox('groups_deny', null, 15); $lists['group']['read_write']->setAttribute('style', 'background: #EBEFF2;'); $lists['group']['read_only']->setAttribute('style', 'background: #EBEFF2;'); $lists['group']['deny']->setAttribute('style', 'background: #EBEFF2;'); $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true)); foreach ($groups as $group) { switch ($group['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } $lists['group'][$list_name]->addItem($group['groupid'], (empty($group['node_name']) ? '' : $group['node_name'] . ':') . $group['name']); } unset($groups); // host $lists['host']['label'] = _('Hosts'); $lists['host']['read_write'] = new CListBox('hosts_write', null, 15); $lists['host']['read_only'] = new CListBox('hosts_read', null, 15); $lists['host']['deny'] = new CListBox('hosts_deny', null, 15); $lists['host']['read_write']->setAttribute('style', 'background: #EBEFF2;'); $lists['host']['read_only']->setAttribute('style', 'background: #EBEFF2;'); $lists['host']['deny']->setAttribute('style', 'background: #EBEFF2;'); $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true)); foreach ($hosts as $host) { switch ($host['permission']) { case PERM_READ_ONLY: $list_name = 'read_only'; break; case PERM_READ_WRITE: $list_name = 'read_write'; break; default: $list_name = 'deny'; } if (HOST_STATUS_PROXY_ACTIVE == $host['status'] || HOST_STATUS_PROXY_PASSIVE == $host['status']) { $host['host_name'] = $host['host']; } $lists['host'][$list_name]->addItem($host['hostid'], (empty($host['node_name']) ? '' : $host['node_name'] . ':') . $host['host_name']); } unset($hosts); // display if (empty($rightsFormList)) { $rightsFormList = new CFormList('rightsFormList'); } $isHeaderDisplayed = false; foreach ($lists as $list) { $sLabel = ''; $row = new CRow(); foreach ($list as $class => $item) { if (is_string($item)) { $sLabel = $item; } else { $row->addItem(new CCol($item, $class)); } } $table = new CTable(_('No accessible resources'), 'right_table'); if (!$isHeaderDisplayed) { $table->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header'); $isHeaderDisplayed = true; } $table->addRow($row); $rightsFormList->addRow($sLabel, $table); } return $rightsFormList; }
** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ include dirname(__FILE__) . '/js/conf.import.js.php'; $rulesTable = new CTable(null, 'formElementTable'); $rulesTable->setHeader(array(SPACE, _('Update existing'), _('Create new'), _('Delete missing')), 'bold'); $titles = array('groups' => _('Groups'), 'hosts' => _('Hosts'), 'templates' => _('Templates'), 'templateScreens' => _('Template screens'), 'templateLinkage' => _('Template linkage'), 'applications' => _('Applications'), 'items' => _('Items'), 'discoveryRules' => _('Discovery rules'), 'triggers' => _('Triggers'), 'graphs' => _('Graphs'), 'screens' => _('Screens'), 'maps' => _('Maps'), 'images' => _('Images')); $rules = $this->get('rules'); foreach ($titles as $key => $title) { $cbExist = null; $cbMissed = null; $cbDeleted = null; if (isset($rules[$key]['updateExisting'])) { $cbExist = new CCheckBox('rules[' . $key . '][updateExisting]', $rules[$key]['updateExisting'], null, 1); if ($key == 'images') { if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) { continue; } $cbExist->setAttribute('onclick', 'if (this.checked) return confirm(\'' . _('Images for all maps will be updated!') . '\')'); } }
public function bodyToString() { parent::bodyToString(); $tbl = new CTable(NULL, $this->tableclass); $tbl->setOddRowClass('form_odd_row'); $tbl->setEvenRowClass('form_even_row'); $tbl->setCellSpacing(0); $tbl->setCellPadding(1); $tbl->setAlign($this->align); // add first row $col = new CCol(NULL, 'form_row_first'); $col->setColSpan(2); if (isset($this->help)) { $col->addItem($this->help); } if (isset($this->title)) { $col->addItem($this->title); } foreach ($this->top_items as $item) { $col->addItem($item); } $tbl->setHeader($col); // add last row $tbl->setFooter($this->bottom_items); // add center rows foreach ($this->center_items as $item) { $tbl->addRow($item); } return $tbl->toString(); }
function access_deny() { global $USER_DETAILS; include_once 'include/page_header.php'; if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) { show_error_message(S_NO_PERMISSIONS); } else { $req = new Curl($_SERVER['REQUEST_URI']); $req->setArgument('sid', null); $table = new CTable(null, 'warning'); $table->setAlign('center'); $table->setHeader(new CCol(S_CONFIG_ERROR_YOU_ARE_NOT_LOGGED_IN_HEAD, 'left'), 'header'); $table->addRow(new CCol(array(S_CONFIG_NOT_LOGGED_IN_ACCESS_DENIED, SPACE, bold(ZBX_GUEST_USER), '. ', S_CONFIG_ERROR_YOU_MUST_LOGIN, BR(), S_CONFIG_NOT_LOGGED_IN_NOTE), 'center')); $url = urlencode($req->toString()); $footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left'); $table->setFooter($footer, 'footer'); $table->show(); } include_once 'include/page_footer.php'; }
require_once dirname(__FILE__) . '/js/adm.regexprs.edit.js.php'; zbx_add_post_js('zabbixRegExp.addExpressions(' . CJs::encodeJson(array_values($this->get('expressions'))) . ');'); $form = new CForm(); $form->attr('id', 'zabbixRegExpForm'); $form->addVar('form', 1); $form->addVar('regexpid', $this->data['regexpid']); /* * Expressions tab */ $exprTab = new CFormList('exprTab'); $nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE, false, 128); $nameTextBox->attr('autofocus', 'autofocus'); $exprTab->addRow(_('Name'), $nameTextBox); $exprTable = new CTable(null, 'formElementTable formWideTable'); $exprTable->attr('id', 'exprTable'); $exprTable->setHeader(array(_('Expression'), new CCol(_('Expression type'), 'nowrap'), new CCol(_('Case sensitive'), 'nowrap'), SPACE)); $exprTable->setFooter(new CButton('add', _('Add'), null, 'link_menu exprAdd')); $exprTab->addRow(_('Expressions'), new CDiv($exprTable, 'inlineblock border_dotted objectgroup')); $exprForm = new CTable(null, 'formElementTable'); $exprForm->addRow(array(_('Expression'), new CTextBox('expressionNew', null, ZBX_TEXTBOX_STANDARD_SIZE))); $exprForm->addRow(array(_('Expression type'), new CComboBox('typeNew', null, null, expression_type2str()))); $exprForm->addRow(array(_('Delimiter'), new CComboBox('delimiterNew', null, null, expressionDelimiters())), null, 'delimiterNewRow'); $exprForm->addRow(array(_('Case sensitive'), new CCheckBox('case_sensitiveNew'))); $exprFormFooter = array(new CButton('saveExpression', _('Add'), null, 'link_menu'), SPACE, new CButton('cancelExpression', _('Cancel'), null, 'link_menu')); $exprTab->addRow(null, new CDiv(array($exprForm, $exprFormFooter), 'objectgroup inlineblock border_dotted'), true, 'exprForm'); /* * Test tab */ $testTab = new CFormList('testTab'); $testTab->addRow(_('Test string'), new CTextArea('test_string', $this->get('test_string'))); $preloaderDiv = new CDiv(null, 'preloader', 'testPreloader');
$locationComboBox->addItems(array(0 => _('Bottom'), 1 => _('Left'), 2 => _('Right'), 3 => _('Top'))); $sysmapList->addRow(_('Icon label location'), $locationComboBox); // append show unack to form list $showUnackComboBox = new CComboBox('show_unack', $this->data['sysmap']['show_unack']); $showUnackComboBox->addItems(array(EXTACK_OPTION_ALL => _('All'), EXTACK_OPTION_BOTH => _('Separated'), EXTACK_OPTION_UNACK => _('Unacknowledged only'))); $showUnackComboBox->setEnabled($this->data['config']['event_ack_enable']); if (!$this->data['config']['event_ack_enable']) { $showUnackComboBox->setAttribute('title', _('Acknowledging disabled')); } $sysmapList->addRow(_('Problem display'), $showUnackComboBox); // append severity min to form list $sysmapList->addRow(_('Minimum trigger severity'), new CSeverity(array('name' => 'severity_min', 'value' => $this->data['sysmap']['severity_min']))); // create url table $urlTable = new CTable(_('No URLs defined.'), 'formElementTable'); $urlTable->setAttribute('style', 'min-width: 500px;'); $urlTable->setHeader(array(_('Name'), _('URL'), _('Element'), SPACE)); if (empty($this->data['sysmap']['urls'])) { $this->data['sysmap']['urls'][] = array('name' => '', 'url' => '', 'elementtype' => 0); } $i = 0; foreach ($this->data['sysmap']['urls'] as $url) { $urlLabel = new CTextBox('urls[' . $i . '][name]', $url['name'], 32); $urlLink = new CTextBox('urls[' . $i . '][url]', $url['url'], 32); $urlEtype = new CComboBox('urls[' . $i . '][elementtype]', $url['elementtype']); $urlEtype->addItems(sysmap_element_types()); $removeButton = new CSpan(_('Remove'), 'link_menu'); $removeButton->addAction('onclick', '$("urlEntry_' . $i . '").remove();'); $urlRow = new CRow(array($urlLabel, $urlLink, $urlEtype, $removeButton)); $urlRow->setAttribute('id', 'urlEntry_' . $i); $urlTable->addRow($urlRow); $i++;
$jmxInterfacesTable->addClass('element-row-first'); $jmxInterfacesTable->setHeader(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); } foreach ($jmxInterfaceRows as $interface) { $jmxInterfacesTable->addRow($interface); } $overviewFormList->addRow(_('JMX interfaces'), new CDiv($jmxInterfacesTable)); } // IPMI interface if ($ipmiInterfaceRows) { $ipmiInterfacesTable = new CTable(null, 'formElementTable border_dotted objectgroup interfaces'); if ($interfaceTableHeaderSet) { $ipmiInterfacesTable->addClass('element-row'); } else { $ipmiInterfacesTable->addClass('element-row-first'); $ipmiInterfacesTable->setHeader(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $interfaceTableHeaderSet = true; } foreach ($ipmiInterfaceRows as $interface) { $ipmiInterfacesTable->addRow($interface); } $overviewFormList->addRow(_('IPMI interfaces'), new CDiv($ipmiInterfacesTable)); } // inventory (OS, Hardware, Software) if ($this->data['host']['inventory']) { if ($this->data['host']['inventory']['os']) { $overviewFormList->addRow($this->data['tableTitles']['os']['title'], new CSpan(zbx_str2links($this->data['host']['inventory']['os']), 'text-field')); } if ($this->data['host']['inventory']['hardware']) { $overviewFormList->addRow($this->data['tableTitles']['hardware']['title'], new CSpan(zbx_str2links($this->data['host']['inventory']['hardware']), 'text-field')); }
// select prototype button if (!empty($this->data['parent_discoveryid'])) { $yaxisMaxData[] = new CButton('yaxis_max_prototype', _('Select prototype'), 'javascript: ' . 'return PopUp("popup.php?dstfrm=' . $graphForm->getName() . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&dstfld1=ymax_itemid' . '&dstfld2=ymax_name' . '&srctbl=item_prototypes' . '&srcfld1=itemid' . '&srcfld2=name' . '&numeric=1", 0, 0, "zbx_popup_item");', 'formlist'); } } else { $graphForm->addVar('yaxismax', $this->data['yaxismax']); } $graphFormList->addRow(_('Y axis MAX value'), $yaxisMaxData); } else { $graphFormList->addRow(_('3D view'), new CCheckBox('show_3d', $this->data['show_3d'], null, 1)); } // append items to form list $itemsTable = new CTable(null, 'formElementTable'); $itemsTable->attr('style', 'min-width: 700px;'); $itemsTable->attr('id', 'itemsTable'); $itemsTable->setHeader(array(new CCol(SPACE, null, null, 15), new CCol(SPACE, null, null, 15), new CCol(_('Name'), null, null, $this->data['graphtype'] == GRAPH_TYPE_NORMAL ? 280 : 360), $this->data['graphtype'] == GRAPH_TYPE_PIE || $this->data['graphtype'] == GRAPH_TYPE_EXPLODED ? new CCol(_('Type'), null, null, 80) : null, new CCol(_('Function'), null, null, 80), $this->data['graphtype'] == GRAPH_TYPE_NORMAL ? new CCol(_('Draw style'), 'nowrap', null, 80) : null, $this->data['graphtype'] == GRAPH_TYPE_NORMAL || $this->data['graphtype'] == GRAPH_TYPE_STACKED ? new CCol(_('Y axis side'), 'nowrap', null, 80) : null, new CCol(_('Colour'), null, null, 100), new CCol(_('Action'), null, null, 50))); $addButton = new CButton('add_item', _('Add'), 'return PopUp("popup.php?writeonly=1&multiselect=1&dstfrm=' . $graphForm->getName() . ($this->data['normal_only'] ? '&normal_only=1' : '') . '&srctbl=items&srcfld1=itemid&srcfld2=name&numeric=1" + getOnlyHostParam(), 800, 600);', 'link_menu'); $addPrototypeButton = null; if ($this->data['parent_discoveryid']) { $addPrototypeButton = new CButton('add_protoitem', _('Add prototype'), 'return PopUp("popup.php?writeonly=1&multiselect=1&dstfrm=' . $graphForm->getName() . url_param($this->data['graphtype'], false, 'graphtype') . url_param('parent_discoveryid') . ($this->data['normal_only'] ? '&normal_only=1' : '') . '&srctbl=item_prototypes&srcfld1=itemid&srcfld2=name&numeric=1", 800, 600);', 'link_menu'); } $itemsTable->addRow(new CRow(new CCol(array($addButton, SPACE, SPACE, SPACE, $addPrototypeButton), null, 8), null, 'itemButtonsRow')); foreach ($this->data['items'] as $n => $item) { $name = $item['host'] . NAME_DELIMITER . $item['name_expanded']; if (zbx_empty($item['drawtype'])) { $item['drawtype'] = 0; } if (zbx_empty($item['yaxisside'])) { $item['yaxisside'] = 0; } insert_js('loadItem(' . $n . ', ' . CJs::encodeJson($item['gitemid']) . ', ' . $this->data['graphid'] . ', ' . $item['itemid'] . ', ' . CJs::encodeJson($name) . ', ' . $item['type'] . ', ' . $item['calc_fnc'] . ', ' . $item['drawtype'] . ', ' . $item['yaxisside'] . ', \'' . $item['color'] . '\', ' . $item['flags'] . ');', true);
$toDate = array('y' => $toYear, 'm' => $toMonth, 'd' => $toDay, 'h' => $toHours, 'i' => $toMinutes); $activeTill = $toYear . $toMonth . $toDay . $toHours . $toMinutes; } else { $toDate = zbxDateToTime($this->data['active_till']); $activeTill = $this->data['active_till']; } $maintenanceForm->addVar('active_till', $activeTill); $maintenanceFormList->addRow(_('Active since'), createDateSelector('active_since', $fromDate, 'active_till')); $maintenanceFormList->addRow(_('Active till'), createDateSelector('active_till', $toDate, 'active_since')); $maintenanceFormList->addRow(_('Description'), new CTextArea('description', $this->data['description'])); /* * Maintenance period tab */ $maintenancePeriodFormList = new CFormList('maintenancePeriodFormList'); $maintenancePeriodTable = new CTable(_('No maintenance periods defined.'), 'formElementTable'); $maintenancePeriodTable->setHeader(array(_('Period type'), _('Schedule'), _('Period'), _('Action'))); foreach ($this->data['timeperiods'] as $id => $timeperiod) { $maintenancePeriodTable->addRow(array(new CCol(timeperiod_type2str($timeperiod['timeperiod_type']), 'nowrap'), new CCol(shedule2str($timeperiod), 'wraptext'), new CCol(zbx_date2age(0, $timeperiod['period']), 'nowrap'), new CCol(array(new CSubmit('edit_timeperiodid[' . $id . ']', _('Edit'), null, 'link_menu'), SPACE . SPACE, new CSubmit('del_timeperiodid[' . $id . ']', _('Remove'), null, 'link_menu')), 'nowrap'))); if (isset($timeperiod['timeperiodid'])) { $maintenanceForm->addVar('timeperiods[' . $id . '][timeperiodid]', $timeperiod['timeperiodid']); } $maintenanceForm->addVar('timeperiods[' . $id . '][timeperiod_type]', $timeperiod['timeperiod_type']); $maintenanceForm->addVar('timeperiods[' . $id . '][every]', $timeperiod['every']); $maintenanceForm->addVar('timeperiods[' . $id . '][month]', $timeperiod['month']); $maintenanceForm->addVar('timeperiods[' . $id . '][dayofweek]', $timeperiod['dayofweek']); $maintenanceForm->addVar('timeperiods[' . $id . '][day]', $timeperiod['day']); $maintenanceForm->addVar('timeperiods[' . $id . '][start_time]', $timeperiod['start_time']); $maintenanceForm->addVar('timeperiods[' . $id . '][start_date]', $timeperiod['start_date']); $maintenanceForm->addVar('timeperiods[' . $id . '][period]', $timeperiod['period']); } $periodsDiv = new CDiv($maintenancePeriodTable, 'objectgroup inlineblock border_dotted');
} $overviewFormList->addRow(_('Host name'), (new CDiv($host_name))->setWidth(ZBX_TEXTAREA_BIG_WIDTH)); if ($data['host']['host'] !== $data['host']['name']) { $overviewFormList->addRow(_('Visible name'), (new CDiv($data['host']['name']))->setWidth(ZBX_TEXTAREA_BIG_WIDTH)); } $interfaces = [INTERFACE_TYPE_AGENT => [], INTERFACE_TYPE_SNMP => [], INTERFACE_TYPE_JMX => [], INTERFACE_TYPE_IPMI => []]; $interface_names = [INTERFACE_TYPE_AGENT => _('Agent interfaces'), INTERFACE_TYPE_SNMP => _('SNMP interfaces'), INTERFACE_TYPE_JMX => _('JMX interfaces'), INTERFACE_TYPE_IPMI => _('IPMI interfaces')]; foreach ($data['host']['interfaces'] as $interface) { $interfaces[$interface['type']][] = $interface; } $header_is_set = false; foreach ([INTERFACE_TYPE_AGENT, INTERFACE_TYPE_SNMP, INTERFACE_TYPE_JMX, INTERFACE_TYPE_IPMI] as $type) { if ($interfaces[$type]) { $ifTab = new CTable(); if (!$header_is_set) { $ifTab->setHeader([_('IP address'), _('DNS name'), _('Connect to'), _('Port')]); $header_is_set = true; } foreach ($interfaces[$type] as $interface) { $connect_to = $interface['useip'] == INTERFACE_USE_IP ? _('IP') : _('DNS'); $ifTab->addRow([(new CDiv($interface['main'] ? bold($interface['ip']) : $interface['ip']))->setWidth(ZBX_TEXTAREA_INTERFACE_IP_WIDTH), (new CDiv($interface['main'] ? bold($interface['dns']) : $interface['dns']))->setWidth(ZBX_TEXTAREA_INTERFACE_DNS_WIDTH), (new CDiv($interface['main'] ? bold($connect_to) : $connect_to))->setWidth(ZBX_TEXTAREA_INTERFACE_USEIP_WIDTH), (new CDiv($interface['main'] ? bold($interface['port']) : $interface['port']))->setWidth(ZBX_TEXTAREA_INTERFACE_PORT_WIDTH)]); } $overviewFormList->addRow($interface_names[$type], (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)); } } // inventory (OS, Hardware, Software) foreach (['os', 'hardware', 'software'] as $key) { if (array_key_exists($key, $data['host']['inventory'])) { if ($data['host']['inventory'][$key] !== '') { $overviewFormList->addRow($data['tableTitles'][$key]['title'], (new CDiv(zbx_str2links($data['host']['inventory'][$key])))->setWidth(ZBX_TEXTAREA_BIG_WIDTH)); }
$listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($prototypeList); $hostList->addRow(_('Host prototypes'), $listBox); } } $divTabs->addTab('hostTab', _('Host'), $hostList); // templates $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplates = API::Template()->get(array('templateids' => $templateIds, 'output' => array('templateid', 'name'))); CArrayHelper::sort($linkedTemplates, array('name')); // templates for normal hosts if (!$isDiscovered) { $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoredTemplates = array(); foreach ($linkedTemplates as $template) { $tmplList->addVar('templates[]', $template['templateid']); $linkedTemplateTable->addRow(array($template['name'], array(new CSubmit('unlink[' . $template['templateid'] . ']', _('Unlink'), null, 'link_menu'), SPACE, SPACE, isset($original_templates[$template['templateid']]) ? new CSubmit('unlink_and_clear[' . $template['templateid'] . ']', _('Unlink and clear'), null, 'link_menu') : SPACE)), null, 'conditions_' . $template['templateid']); $ignoredTemplates[$template['templateid']] = $template['name']; } $tmplList->addRow(_('Linked templates'), new CDiv($linkedTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // create new linked template table $newTemplateTable = new CTable(null, 'formElementTable'); $newTemplateTable->attr('id', 'newTemplateTable'); $newTemplateTable->attr('style', 'min-width: 400px;'); $newTemplateTable->addRow(array(new CMultiSelect(array('name' => 'add_templates[]', 'objectName' => 'templates', 'ignored' => $ignoredTemplates)))); $newTemplateTable->addRow(array(new CSubmit('add_template', _('Add'), null, 'link_menu'))); $tmplList->addRow(_('Link new templates'), new CDiv($newTemplateTable, 'objectgroup inlineblock border_dotted ui-corner-all')); } else {
foreach ($this->data['children'] as $child) { $childrenLink = new CLink($child['name'], 'services.php?form=1&serviceid=' . $child['serviceid']); $childrenLink->setAttribute('target', '_blank'); $row = new CRow(array(array($childrenLink, new CVar('children[' . $child['serviceid'] . '][name]', $child['name']), new CVar('children[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), new CCheckBox('children[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, 1), !empty($child['trigger']) ? $child['trigger'] : '-', new CButton('remove', _('Remove'), 'javascript: removeDependentChild(\'' . $child['serviceid'] . '\');', 'link_menu'))); $row->setAttribute('id', 'children_' . $child['serviceid']); $servicesChildTable->addRow($row); } $servicesDependenciesFormList = new CFormList('servicesDependensiesFormList'); $servicesDependenciesFormList->addRow(_('Depends on'), new CDiv(array($servicesChildTable, new CButton('add_child_service', _('Add'), "javascript: openWinCentered('services.php?cservices=1" . url_param('serviceid') . "', 'ZBX_Services_List', 640, 520, 'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'link_menu')), 'objectgroup inlineblock border_dotted ui-corner-all')); /* * Service times tab */ $servicesTimeFormList = new CFormList('servicesTimeFormList'); $servicesTimeTable = new CTable(_('No times defined. Work 24x7.'), 'formElementTable'); $servicesTimeTable->setAttribute('style', 'min-width: 500px;'); $servicesTimeTable->setHeader(array(_('Type'), _('Interval'), _('Note'), _('Action'))); $i = 0; foreach ($this->data['times'] as $serviceTime) { switch ($serviceTime['type']) { case SERVICE_TIME_TYPE_UPTIME: $type = new CSpan(_('Uptime'), 'enabled'); $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');
$userGroupFormList->addRow(_('Enabled'), new CCheckBox('users_status', $this->data['users_status'] ? isset($data['usrgrpid']) ? 0 : 1 : 1, null, 1)); // invert user status 0 - enable, 1 - disable } else { $userGroupForm->addVar('gui_access', $this->data['gui_access']); $userGroupForm->addVar('users_status', GROUP_STATUS_ENABLED); $userGroupFormList->addRow(_('Frontend access'), new CSpan(user_auth_type2str($this->data['gui_access']), 'text-field green')); $userGroupFormList->addRow(_('Enabled'), new CSpan(_('Enabled'), 'text-field green')); } $userGroupFormList->addRow(_('Debug mode'), new CCheckBox('debug_mode', $this->data['debug_mode'], null, 1)); /* * Permissions tab */ $permissionsFormList = new CFormList('permissionsFormList'); // append permissions table to form list $permissionsTable = new CTable(null, 'right_table'); $permissionsTable->setHeader(array(_('Read-write'), _('Read only'), _('Deny')), 'header'); $lstWrite = new CListBox('right_to_del[read_write][]', null, 20); $lstRead = new CListBox('right_to_del[read_only][]', null, 20); $lstDeny = new CListBox('right_to_del[deny][]', null, 20); foreach ($this->data['group_rights'] as $id => $rights) { if ($rights['permission'] == PERM_DENY) { $lstDeny->addItem($id, $rights['name']); } elseif ($rights['permission'] == PERM_READ) { $lstRead->addItem($id, $rights['name']); } elseif ($rights['permission'] == PERM_READ_WRITE) { $lstWrite->addItem($id, $rights['name']); } } $permissionsTable->addRow(array(new CCol($lstWrite, 'read_write'), new CCol($lstRead, 'read_only'), new CCol($lstDeny, 'deny'))); $permissionsTable->addRow(array(array(new CButton('add_read_write', _('Add'), "return PopUp('popup_right.php?dstfrm=" . $userGroupForm->getName() . '&permission=' . PERM_READ_WRITE . "', 450, 450);", 'formlist'), new CSubmit('del_read_write', _('Delete selected'), null, 'formlist')), array(new CButton('add_read_only', _('Add'), "return PopUp('popup_right.php?dstfrm=" . $userGroupForm->getName() . '&permission=' . PERM_READ . "', 450, 450);", 'formlist'), new CSubmit('del_read_only', _('Delete selected'), null, 'formlist')), array(new CButton('add_deny', _('Add'), "return PopUp('popup_right.php?dstfrm=" . $userGroupForm->getName() . '&permission=' . PERM_DENY . "', 450, 450);", 'formlist'), new CSubmit('del_deny', _('Delete selected'), null, 'formlist')))); $permissionsFormList->addRow(_('Composing permissions'), $permissionsTable);
$proxyComboBox = new CComboBox('proxy_hostid', $this->data['proxy_hostid']); $proxyComboBox->addItem(0, _('(no proxy)')); foreach ($this->data['proxies'] as $proxie) { $proxyComboBox->addItem($proxie['hostid'], $proxie['host']); } $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());
$caption = OPERATION_TYPE_TEMPLATE_ADD == $this->data['new_operation']['operationtype'] ? _('Link with templates') : _('Unlink from templates'); $newOperationsTable->addRow(array($caption, new CDiv($templateList, 'objectgroup inlineblock border_dotted ui-corner-all'))); break; } // append operation conditions to form list if ($this->data['eventsource'] == 0) { if (!isset($this->data['new_operation']['opconditions'])) { $this->data['new_operation']['opconditions'] = array(); } else { zbx_rksort($this->data['new_operation']['opconditions']); } $allowed_opconditions = get_opconditions_by_eventsource($this->data['eventsource']); $grouped_opconditions = array(); $operationConditionsTable = new CTable(_('No conditions defined.'), 'formElementTable'); $operationConditionsTable->attr('style', 'min-width: 310px;'); $operationConditionsTable->setHeader(array(_('Label'), _('Name'), _('Action'))); $i = 0; foreach ($this->data['new_operation']['opconditions'] as $opcondition) { if (!isset($opcondition['conditiontype'])) { $opcondition['conditiontype'] = 0; } if (!isset($opcondition['operator'])) { $opcondition['operator'] = 0; } if (!isset($opcondition['value'])) { $opcondition['value'] = 0; } if (!str_in_array($opcondition['conditiontype'], $allowed_opconditions)) { continue; } $label = num2letter($i);
$agentComboBox->addItemsInGroup(_('Others'), array('Mozilla/5.0 (X11; Linux 3.1.0-rc9+; en_US) KHTML/4.7.2 (like Gecko) Konqueror/4.7' => 'Konqueror 4.7', 'Mozilla/5.0 (compatible; Konqueror/4.6; Linux) KHTML/4.6.0 (like Gecko)' => 'Konqueror 4.6', 'Lynx/2.8.7rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8r' => 'Lynx 2.8.7rel.1', 'Lynx/2.8.4rel.1 libwww-FM/2.14' => 'Lynx 2.8.4rel.1', 'Links (2.3pre1; Linux 2.6.35.10 i686; 225x51)' => 'Links 2.3pre1', 'Links (2.2; Linux 2.6.37.6-0.7-desktop i686; 225x51)' => 'Links 2.2', 'Googlebot/2.1 (+http://www.google.com/bot.html)' => 'Googlebot')); $httpFormList->addRow(_('Agent'), $agentComboBox); // append HTTP proxy to form list $httpProxyTextBox = new CTextBox('http_proxy', $this->data['http_proxy'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 255); $httpProxyTextBox->setAttribute('placeholder', 'http://[username[:password]@]proxy.example.com[:port]'); $httpFormList->addRow(_('HTTP proxy'), $httpProxyTextBox); // append status to form list $httpFormList->addRow(_('Variables'), new CTextArea('variables', $this->data['variables'])); $httpFormList->addRow(_('Enabled'), new CCheckBox('status', !$this->data['status'])); /* * Step tab */ $httpStepFormList = new CFormList('httpFormList'); $stepsTable = new CTable(null, 'formElementTable'); $stepsTable->setAttributes(array('style' => 'min-width: 500px;', 'id' => 'httpStepTable')); $stepsTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Name'), null, null, '150'), new CCol(_('Timeout'), null, null, '50'), new CCol(_('URL'), null, null, '200'), new CCol(_('Required'), null, null, '50'), new CCol(_('Status codes'), 'nowrap', null, '90'), new CCol('', null, null, '50'))); $i = 1; foreach ($this->data['steps'] as $stepid => $step) { if (!isset($step['name'])) { $step['name'] = ''; } if (!isset($step['timeout'])) { $step['timeout'] = 15; } if (!isset($step['url'])) { $step['url'] = ''; } if (!isset($step['posts'])) { $step['posts'] = ''; } if (!isset($step['required'])) {
$triggersForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']); } foreach ($this->data['g_triggerid'] as $triggerid) { $triggersForm->addVar('g_triggerid[' . $triggerid . ']', $triggerid); } // create form list $triggersFormList = new CFormList('triggersFormList'); // append severity to form list $severityDiv = new CSeverity(array('id' => 'priority_div', 'name' => 'priority', 'value' => $this->data['priority'])); $triggersFormList->addRow(array(_('Severity'), SPACE, new CVisibilityBox('visible[priority]', isset($this->data['visible']['priority']), 'priority_div', _('Original'))), $severityDiv); // append dependencies to form list if (empty($this->data['parent_discoveryid'])) { $dependenciesTable = new CTable(_('No dependencies defined.'), 'formElementTable'); $dependenciesTable->setAttribute('style', 'min-width: 500px;'); $dependenciesTable->setAttribute('id', 'dependenciesTable'); $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')));
function access_deny() { global $USER_DETAILS; include_once 'include/page_header.php'; if ($USER_DETAILS['alias'] != ZBX_GUEST_USER) { show_error_message(S_NO_PERMISSIONS); } else { $req = new Curl($_SERVER['REQUEST_URI']); $req->setArgument('sid', null); $warning_msg = array('You cannot view this URL as a ', bold(ZBX_GUEST_USER), '. ', 'You must login to view this page.', BR(), 'If you think this message is wrong, ', ' please consult your administrators about getting the necessary permissions.'); $table = new CTable(null, 'warning'); $table->setAlign('center'); $table->setHeader(new CCol('You are not logged in', 'left'), 'header'); $table->addRow(new CCol($warning_msg)); $url = urlencode($req->toString()); $footer = new CCol(array(new CButton('login', S_LOGIN, "javascript: document.location = 'index.php?request={$url}';"), new CButton('back', S_CANCEL, 'javascript: window.history.back();')), 'left'); $table->setFooter($footer, 'footer'); $table->show(); } include_once 'include/page_footer.php'; }