** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of trigger displaying options');
$page['file'] = 'adm.triggerdisplayoptions.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
$fields = array('problem_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_unack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'ok_ack_color' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'problem_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'problem_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_unack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_ack_style' => array(T_ZBX_INT, O_OPT, null, IN('1'), null), 'ok_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'blink_period' => array(T_ZBX_INT, O_OPT, null, null, 'isset({save})'), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
if (isset($_REQUEST['save'])) {
    $configs = array('ok_period' => get_request('ok_period'), 'blink_period' => get_request('blink_period'), 'problem_unack_color' => get_request('problem_unack_color'), 'problem_ack_color' => get_request('problem_ack_color'), 'ok_unack_color' => get_request('ok_unack_color'), 'ok_ack_color' => get_request('ok_ack_color'), 'problem_unack_style' => get_request('problem_unack_style', 0), 'problem_ack_style' => get_request('problem_ack_style', 0), 'ok_unack_style' => get_request('ok_unack_style', 0), 'ok_ack_style' => get_request('ok_ack_style', 0));
    $result = update_config($configs);
    show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
$form = new CForm();
$form->cleanItems();
$cmbConf = new CComboBox('configDropDown', 'adm.triggerdisplayoptions.php', 'redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$form->addItem($cmbConf);
$cnf_wdgt = new CWidget();
$cnf_wdgt->addPageHeader(_('CONFIGURATION OF ZABBIX'), $form);
$data = array();
$data['form_refresh'] = get_request('form_refresh', 0);
// form has been submitted
if ($data['form_refresh']) {
    $data['ok_period'] = get_request('ok_period');
    $data['blink_period'] = get_request('blink_period');
    $data['problem_unack_color'] = get_request('problem_unack_color');
    $data['problem_ack_color'] = get_request('problem_ack_color');
    $data['ok_unack_color'] = get_request('ok_unack_color');
    $data['ok_ack_color'] = get_request('ok_ack_color');
** (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.
**/
$itemsWidget = new CWidget();
$discoveryRule = $this->data['discovery_rule'];
// create new item button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
$createForm->addItem(new CSubmit('form', _('Create host prototype')));
$itemsWidget->addPageHeader(_('CONFIGURATION OF HOST PROTOTYPES'), $createForm);
// header
$itemsWidget->addHeader(array(_('Host prototypes of') . SPACE, new CSpan($this->data['discovery_rule']['name'], 'parent-discovery')));
$itemsWidget->addHeaderRowNumber();
$itemsWidget->addItem(get_header_host_table('hosts', $discoveryRule['hostid'], $this->data['parent_discoveryid']));
// create form
$itemForm = new CForm();
$itemForm->setName('hosts');
$itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$hostTable = new CTableInfo(_('No host prototypes found.'));
$sortLink = new CUrl();
$sortLink->setArgument('parent_discoveryid', $this->data['parent_discoveryid']);
Пример #3
0
 $menu_table = new CTable(null, 'menu pointer');
 $menu_table->setCellSpacing(0);
 $menu_table->setCellPadding(5);
 $menu_table->addRow($main_menu);
 $node_form = null;
 if (ZBX_DISTRIBUTED && !defined('ZBX_HIDE_NODE_SELECTION')) {
     insert_js_function('check_all');
     $available_nodes = get_accessible_nodes_by_user(CWebUser::$data, PERM_READ, PERM_RES_DATA_ARRAY);
     $available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid');
     // remove parent nodes
     if (empty($available_nodes[0])) {
         unset($available_nodes[0]);
     }
     if (!empty($available_nodes)) {
         $node_form = new CForm('get');
         $node_form->cleanItems();
         $node_form->setAttribute('id', 'node_form');
         // create ComboBox with selected nodes
         $nodesComboBox = null;
         if (count($ZBX_VIEWED_NODES['nodes']) > 0) {
             $nodesComboBox = new CComboBox('switch_node', $ZBX_VIEWED_NODES['selected'], 'submit()');
             foreach ($ZBX_VIEWED_NODES['nodes'] as $nodeid => $nodedata) {
                 $nodesComboBox->addItem($nodeid, $nodedata['name']);
             }
         }
         $jscript = 'javascript: ' . " var pos = getPosition('button_show_tree');" . " showHide('div_node_tree', 'table');" . ' pos.top += 20;' . " \$('div_node_tree').setStyle({top: pos.top + 'px'});";
         $button_show_tree = new CButton('show_node_tree', _('Select Nodes'), $jscript);
         $button_show_tree->setAttribute('id', 'button_show_tree');
         // create node tree
         $node_tree = array();
         $node_tree[0] = array('id' => 0, 'caption' => _('All'), 'combo_select_node' => new CCheckbox('check_all_nodes', null, "javascript : check_all('node_form', this.checked);"), 'parentid' => 0);
        $dbHosts = API::Host()->get(array('hostids' => $hostId, 'selectGroups' => API_OUTPUT_EXTEND, 'selectParentTemplates' => array('templateid', 'name'), 'selectMacros' => API_OUTPUT_EXTEND, 'selectInventory' => true, 'selectDiscoveryRule' => array('name', 'itemid'), 'output' => API_OUTPUT_EXTEND));
        $dbHost = reset($dbHosts);
        $dbHost['interfaces'] = API::HostInterface()->get(array('hostids' => $hostId, 'output' => API_OUTPUT_EXTEND, 'selectItems' => array('type'), 'sortfield' => 'interfaceid', 'preservekeys' => true));
        $data['dbHost'] = $dbHost;
    }
    $hostForm = new CView('configuration.host.edit', $data);
    $hostsWidget->addItem($hostForm->render());
    $rootClass = 'host-edit';
    if (get_request('hostid') && $dbHost['flags'] == ZBX_FLAG_DISCOVERY_CREATED) {
        $rootClass .= ' host-edit-discovered';
    }
    $hostsWidget->setRootClass($rootClass);
} else {
    $displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0;
    $frmForm = new CForm();
    $frmForm->cleanItems();
    $frmForm->addItem(new CDiv(array(new CSubmit('form', _('Create host')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=host")'))));
    $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
    $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'), $frmForm);
    $frmGroup = new CForm('get');
    $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
    $hostsWidget->addHeader(_('Hosts'), $frmGroup);
    $hostsWidget->addHeaderRowNumber();
    $hostsWidget->setRootClass('host-list');
    // filter
    $filterTable = new CTable('', 'filter');
    $filterTable->addRow(array(array(array(bold(_('Name')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_host', $_REQUEST['filter_host'], 20)), array(array(bold(_('DNS')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_dns', $_REQUEST['filter_dns'], 20)), array(array(bold(_('IP')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_ip', $_REQUEST['filter_ip'], 20)), array(bold(_('Port') . NAME_DELIMITER), new CTextBox('filter_port', $_REQUEST['filter_port'], 20))));
    $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true); chkbxRange.clearSelectedOnFilterChange();");
    $filter->useJQueryStyle('main');
    $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
    $reset->useJQueryStyle();
Пример #5
0
    $result = API::IconMap()->delete($_REQUEST['iconmapid']);
    if ($result) {
        unset($_REQUEST['form']);
    }
    show_messages($result, _('Icon map deleted'), _('Cannot delete icon map'));
} elseif (isset($_REQUEST['clone'])) {
    unset($_REQUEST['iconmapid']);
    $_REQUEST['form'] = 'clone';
}
/*
 * Display
 */
$generalComboBox = new CComboBox('configDropDown', 'adm.iconmapping.php', 'redirect(this.options[this.selectedIndex].value);');
$generalComboBox->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$iconMapForm = new CForm();
$iconMapForm->cleanItems();
$iconMapForm->addItem($generalComboBox);
if (!isset($_REQUEST['form'])) {
    $iconMapForm->addItem(new CSubmit('form', _('Create icon map')));
}
$iconMapWidget = new CWidget();
$iconMapWidget->addPageHeader(_('CONFIGURATION OF ICON MAPPING'), $iconMapForm);
$data = array('form_refresh' => get_request('form_refresh', 0), 'iconmapid' => get_request('iconmapid'), 'iconList' => array(), 'inventoryList' => array(), 'displayNodes' => is_array(get_current_nodeid()));
$iconList = API::Image()->get(array('filter' => array('imagetype' => IMAGE_TYPE_ICON), 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true));
order_result($iconList, 'name');
foreach ($iconList as $icon) {
    $data['iconList'][$icon['imageid']] = $icon['name'];
}
$inventoryFields = getHostInventories();
foreach ($inventoryFields as $field) {
    $data['inventoryList'][$field['nr']] = $field['title'];
Пример #6
0
        show_messages(true, $msgOk);
        unset($_REQUEST['form']);
        DBend(true);
    }
} catch (Exception $e) {
    DBend(false);
    error($e->getMessage());
    show_messages(false, null, $msgFail);
}
/*
 * Display
 */
$generalComboBox = new CComboBox('configDropDown', 'adm.valuemapping.php', 'redirect(this.options[this.selectedIndex].value);');
$generalComboBox->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$valueMapForm = new CForm();
$valueMapForm->cleanItems();
$valueMapForm->addItem($generalComboBox);
if (!isset($_REQUEST['form'])) {
    $valueMapForm->addItem(new CSubmit('form', _('Create value map')));
}
$valueMapWidget = new CWidget();
$valueMapWidget->addPageHeader(_('CONFIGURATION OF VALUE MAPPING'), $valueMapForm);
if (isset($_REQUEST['form'])) {
    $data = array('form' => get_request('form', 1), 'form_refresh' => get_request('form_refresh', 0), 'valuemapid' => get_request('valuemapid'), 'mappings' => array(), 'mapname' => '', 'confirmMessage' => null, 'add_value' => get_request('add_value'), 'add_newvalue' => get_request('add_newvalue'));
    if (isset($data['valuemapid'])) {
        $data['mapname'] = $dbValueMap['name'];
        if (empty($data['form_refresh'])) {
            $data['mappings'] = DBfetchArray(DBselect('SELECT m.mappingid,m.value,m.newvalue FROM mappings m WHERE m.valuemapid=' . zbx_dbstr($data['valuemapid'])));
        } else {
            $data['mapname'] = get_request('mapname', '');
            $data['mappings'] = get_request('mappings', array());
Пример #7
0
                add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_REGEXP, 'Id [' . $regExpId . '] ' . _('Name') . ' [' . $regExp['name'] . ']');
            }
            unset($_REQUEST['form'], $_REQUEST['regexpid']);
        }
        $result = DBend($result);
        show_messages($result, _n('Regular expression deleted', 'Regular expressions deleted', $regExpCount), _n('Cannot delete regular expression', 'Cannot delete regular expressions', $regExpCount));
        clearCookies($result);
    }
}
/*
 * Display
 */
$generalComboBox = new CComboBox('configDropDown', 'adm.regexps.php', 'redirect(this.options[this.selectedIndex].value);');
$generalComboBox->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$regExpForm = new CForm();
$regExpForm->cleanItems();
$regExpForm->addItem($generalComboBox);
if (!isset($_REQUEST['form'])) {
    $regExpForm->addItem(new CSubmit('form', _('New regular expression')));
}
$regExpWidget = new CWidget();
$regExpWidget->addPageHeader(_('CONFIGURATION OF REGULAR EXPRESSIONS'), $regExpForm);
if (isset($_REQUEST['form'])) {
    $data = array('form_refresh' => get_request('form_refresh'), 'regexpid' => get_request('regexpid'));
    if (isset($_REQUEST['regexpid']) && !isset($_REQUEST['form_refresh'])) {
        $regExp = DBfetch(DBSelect('SELECT re.name,re.test_string' . ' FROM regexps re' . ' WHERE re.regexpid=' . zbx_dbstr($_REQUEST['regexpid']) . andDbNode('re.regexpid')));
        $data['name'] = $regExp['name'];
        $data['test_string'] = $regExp['test_string'];
        $dbExpressions = DBselect('SELECT e.expressionid,e.expression,e.expression_type,e.exp_delimiter,e.case_sensitive' . ' FROM expressions e' . ' WHERE e.regexpid=' . zbx_dbstr($_REQUEST['regexpid']) . andDbNode('e.expressionid') . ' ORDER BY e.expression_type');
        $data['expressions'] = DBfetchArray($dbExpressions);
    } else {