コード例 #1
0
** 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.
**/
require_once dirname(__FILE__) . '/js/configuration.triggers.edit.js.php';
$triggersWidget = new CWidget();
// append host summary to widget header
if (!empty($this->data['hostid'])) {
    if (!empty($this->data['parent_discoveryid'])) {
        $triggersWidget->addItem(get_header_host_table('triggers', $this->data['hostid'], $this->data['parent_discoveryid']));
    } else {
        $triggersWidget->addItem(get_header_host_table('triggers', $this->data['hostid']));
    }
}
if (!empty($this->data['parent_discoveryid'])) {
    $triggersWidget->addPageHeader(_('CONFIGURATION OF TRIGGER PROTOTYPES'));
} else {
    $triggersWidget->addPageHeader(_('CONFIGURATION OF TRIGGERS'));
}
// create form
$triggersForm = new CForm();
$triggersForm->setName('triggersForm');
$triggersForm->addVar('hostid', $this->data['hostid']);
$triggersForm->addVar('action', $this->data['action']);
if ($this->data['parent_discoveryid']) {
    $triggersForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
コード例 #2
0
ファイル: items.php プロジェクト: songyuanjie/zabbix-stats
 if (isset($_REQUEST['filter_with_triggers']) && !zbx_empty($_REQUEST['filter_with_triggers']) && $_REQUEST['filter_with_triggers'] != -1) {
     $options['with_triggers'] = $_REQUEST['filter_with_triggers'];
 }
 if (isset($_REQUEST['filter_ipmi_sensor']) && !zbx_empty($_REQUEST['filter_ipmi_sensor'])) {
     $options['filter']['ipmi_sensor'] = $_REQUEST['filter_ipmi_sensor'];
 }
 $afterFilter = count($options, COUNT_RECURSIVE);
 //} Items Filter
 if ($preFilter == $afterFilter) {
     $items = array();
 } else {
     $items = CItem::get($options);
 }
 // Header Host
 if ($hostid > 0) {
     $tbl_header_host = get_header_host_table($hostid, array('triggers', 'applications', 'graphs'));
     $items_wdgt->addItem($tbl_header_host);
     $show_host = false;
 }
 $form = new CForm();
 $form->setName('items');
 $form->addVar('hostid', $hostid);
 $table = new CTableInfo();
 // Table Header //
 $table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), S_WIZARD, $show_host ? S_HOST : null, make_sorting_header(S_DESCRIPTION, 'description'), S_TRIGGERS, make_sorting_header(S_KEY, 'key_'), make_sorting_header(S_INTERVAL, 'delay'), make_sorting_header(S_HISTORY, 'history'), make_sorting_header(S_TRENDS, 'trends'), make_sorting_header(S_TYPE, 'type'), make_sorting_header(S_STATUS, 'status'), S_APPLICATIONS, S_ERROR));
 // SET VALUES FOR SUBFILTERS {
 // if any of subfilters = false then item shouldnt be shown
 foreach ($items as $num => $item) {
     $item['hostids'] = zbx_objectValues($item['hosts'], 'hostid');
     $item['subfilters'] = array();
     $item['subfilters']['subfilter_hosts'] = empty($_REQUEST['subfilter_hosts']) || (bool) array_intersect($_REQUEST['subfilter_hosts'], $item['hostids']);
コード例 #3
0
**
** 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.
**/
$itemWidget = new CWidget();
if (!empty($this->data['hostid'])) {
    if (!empty($this->data['parent_discoveryid'])) {
        $itemWidget->addItem(get_header_host_table(!empty($this->data['is_discovery_rule']) ? 'discoveries' : 'items', $this->data['hostid'], $this->data['parent_discoveryid']));
    } else {
        $itemWidget->addItem(get_header_host_table(!empty($this->data['is_discovery_rule']) ? 'discoveries' : 'items', $this->data['hostid']));
    }
}
$itemWidget->addPageHeader($this->data['page_header']);
// create form
$itemForm = new CForm();
$itemForm->setName('itemForm');
$itemForm->addVar('form', $this->data['form']);
$itemForm->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['parent_discoveryid'])) {
    $itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
if (!empty($this->data['itemid'])) {
    $itemForm->addVar('itemid', $this->data['itemid']);
}
// create form list
コード例 #4
0
**
** 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.
**/
$widget = (new CWidget())->setTitle(_('Item prototypes'))->setControls((new CForm('get'))->cleanItems()->addVar('parent_discoveryid', $this->data['parent_discoveryid'])->addItem((new CList())->addItem(new CSubmit('form', _('Create item prototype')))))->addItem(get_header_host_table('items', $this->data['hostid'], $this->data['parent_discoveryid']));
// create form
$itemForm = (new CForm())->setName('items')->addVar('hostid', $this->data['hostid'])->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$itemTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_items'))->onClick("checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('History'), 'history', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Trends'), 'trends', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), _('Applications'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder'])]);
foreach ($this->data['items'] as $item) {
    $description = [];
    if (!empty($item['templateid'])) {
        $template_host = get_realhost_by_itemid($item['templateid']);
        $templateDiscoveryRuleId = get_realrule_by_itemid_and_hostid($this->data['parent_discoveryid'], $template_host['hostid']);
        $description[] = (new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId))->addClass(ZBX_STYLE_LINK_ALT)->addClass(ZBX_STYLE_GREY);
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']);
    $status = (new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&action=' . ($item['status'] == ITEM_STATUS_DISABLED ? 'itemprototype.massenable' : 'itemprototype.massdisable')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(itemIndicatorStyle($item['status']))->addSID();
    if (!empty($item['applications'])) {
コード例 #5
0
** 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.
**/
$widget = (new CWidget())->setTitle(_('Web monitoring'));
// append host summary to widget header
if (!empty($this->data['hostid'])) {
    $widget->addItem(get_header_host_table('web', $this->data['hostid']));
}
// create form
$httpForm = (new CForm())->setName('httpForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid'])->addVar('steps', $this->data['steps'])->addVar('templated', $this->data['templated']);
if (!empty($this->data['httptestid'])) {
    $httpForm->addVar('httptestid', $this->data['httptestid']);
}
/*
 * Scenario tab
 */
$httpFormList = new CFormList('httpFormList');
// Parent http tests
if (!empty($this->data['templates'])) {
    $httpFormList->addRow(_('Parent web scenarios'), $this->data['templates']);
}
// Name
コード例 #6
0
} else {
    $createForm->addVar('hostid', $this->data['hostid']);
    if (!empty($this->data['hostid'])) {
        $createForm->addItem(new CSubmit('form', _('Create graph')));
    } else {
        $createGraphButton = new CSubmit('form', _('Create graph (select host first)'));
        $createGraphButton->setEnabled(false);
        $createForm->addItem($createGraphButton);
    }
    $graphWidget->addPageHeader(_('CONFIGURATION OF GRAPHS'), $createForm);
    $filterForm = new CForm('get');
    $filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
    $filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true)));
    $graphWidget->addHeader(_('Graphs'), $filterForm);
    if (!empty($this->data['hostid'])) {
        $graphWidget->addItem(get_header_host_table('graphs', $this->data['hostid']));
    }
}
$graphWidget->addHeaderRowNumber();
// create form
$graphForm = new CForm();
$graphForm->setName('graphForm');
$graphForm->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['parent_discoveryid'])) {
    $graphForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
// create table
$graphTable = new CTableInfo(!empty($this->data['parent_discoveryid']) ? _('No graph prototypes found.') : _('No graphs found.'));
$graphTable->setHeader(array(new CCheckBox('all_graphs', null, "checkAll('" . $graphForm->getName() . "', 'all_graphs', 'group_graphid');"), $this->data['displayNodes'] ? _('Node') : null, !empty($this->data['hostid']) ? null : _('Hosts'), make_sorting_header(_('Name'), 'name'), _('Width'), _('Height'), make_sorting_header(_('Graph type'), 'graphtype')));
foreach ($this->data['graphs'] as $graph) {
    $graphid = $graph['graphid'];
コード例 #7
0
** 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.
**/
$itemWidget = new CWidget();
if (!empty($this->data['hostid'])) {
    $itemWidget->addItem(get_header_host_table('discoveries', $this->data['hostid'], isset($this->data['parent_discoveryid']) ? $this->data['parent_discoveryid'] : null));
}
$itemWidget->addPageHeader($this->data['page_header']);
// create form
$itemForm = new CForm();
$itemForm->setName('itemForm');
$itemForm->addVar('form', $this->data['form']);
$itemForm->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['parent_discoveryid'])) {
    $itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
if (!empty($this->data['itemid'])) {
    $itemForm->addVar('itemid', $this->data['itemid']);
}
// create form list
$itemFormList = new CFormList('itemFormList');
コード例 #8
0
** 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.
**/
$discoveryRule = $data['discovery_rule'];
$hostPrototype = $data['host_prototype'];
$parentHost = $data['parent_host'];
require_once dirname(__FILE__) . '/js/configuration.host.edit.js.php';
require_once dirname(__FILE__) . '/js/configuration.host.prototype.edit.js.php';
$widget = new CWidget(null, 'hostprototype-edit');
$widget->addPageHeader(_('CONFIGURATION OF HOST PROTOTYPES'));
$widget->addItem(get_header_host_table('hosts', $discoveryRule['hostid'], $discoveryRule['itemid']));
$divTabs = new CTabView();
if (!isset($_REQUEST['form_refresh'])) {
    $divTabs->setSelected(0);
}
$frmHost = new CForm();
$frmHost->setName('hostPrototypeForm.');
$frmHost->addVar('form', get_request('form', 1));
$frmHost->addVar('parent_discoveryid', $discoveryRule['itemid']);
$hostList = new CFormList('hostlist');
if ($hostPrototype['templateid'] && $data['parents']) {
    $parents = array();
    foreach (array_reverse($data['parents']) as $parent) {
        $parents[] = new CLink($parent['parentHost']['name'], '?form=update&hostid=' . $parent['hostid'] . '&parent_discoveryid=' . $parent['discoveryRule']['itemid'], 'highlight underline weight_normal');
        $parents[] = SPACE . RARR . SPACE;
    }
コード例 #9
0
**
** 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.
**/
$widget = (new CWidget())->setTitle(_('Discovery rules'))->setControls((new CForm('get'))->cleanItems()->addVar('hostid', $this->data['hostid'])->addItem((new CList())->addItem(new CSubmit('form', _('Create discovery rule')))))->addItem(get_header_host_table('discoveries', $this->data['hostid']));
// create form
$discoveryForm = (new CForm())->setName('discovery')->addVar('hostid', $this->data['hostid']);
// create table
$discoveryTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_items'))->onClick("checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder']), $data['showInfoColumn'] ? _('Info') : null]);
foreach ($data['discoveries'] as $discovery) {
    // description
    $description = [];
    if ($discovery['templateid']) {
        $dbTemplate = get_realhost_by_itemid($discovery['templateid']);
        $description[] = (new CLink($dbTemplate['name'], '?hostid=' . $dbTemplate['hostid']))->addClass(ZBX_STYLE_LINK_ALT)->addClass(ZBX_STYLE_GREY);
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
    // status
    $status = (new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&action=' . ($discovery['status'] == ITEM_STATUS_DISABLED ? 'discoveryrule.massenable' : 'discoveryrule.massdisable')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(itemIndicatorStyle($discovery['status'], $discovery['state']))->addSID();
** 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.
**/
require_once dirname(__FILE__) . '/js/configuration.triggers.edit.js.php';
$triggersWidget = (new CWidget())->setTitle(_('Trigger prototypes'));
// append host summary to widget header
$triggersWidget->addItem(get_header_host_table('trigger_prototypes', $data['hostid'], $data['parent_discoveryid']));
$triggersForm = (new CForm())->setName('triggersForm')->addVar('action', $data['action'])->addVar('parent_discoveryid', $data['parent_discoveryid']);
foreach ($data['g_triggerid'] as $triggerid) {
    $triggersForm->addVar('g_triggerid[' . $triggerid . ']', $triggerid);
}
$triggersFormList = (new CFormList('triggersFormList'))->addRow([_('Severity'), SPACE, (new CVisibilityBox('visible[priority]', 'priority_div', _('Original')))->setChecked(isset($data['visible']['priority']))], (new CDiv(new CSeverity(['name' => 'priority', 'value' => $data['priority']])))->setId('priority_div'));
// append dependencies to form list
$dependenciesTable = (new CTable())->setAttribute('style', 'width: 100%;')->setHeader([_('Name'), _('Action')]);
foreach ($data['dependencies'] as $dependency) {
    $triggersForm->addVar('dependencies[]', $dependency['triggerid'], 'dependencies_' . $dependency['triggerid']);
    $depTriggerDescription = CHtml::encode(implode(', ', zbx_objectValues($dependency['hosts'], 'name')) . NAME_DELIMITER . $dependency['description']);
    if ($dependency['flags'] == ZBX_FLAG_DISCOVERY_PROTOTYPE) {
        $description = (new CLink($depTriggerDescription, 'trigger_prototypes.php?form=update' . url_param('parent_discoveryid') . '&triggerid=' . $dependency['triggerid']))->setAttribute('target', '_blank');
    } elseif ($dependency['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $description = (new CLink($depTriggerDescription, 'triggers.php?form=update&triggerid=' . $dependency['triggerid']))->setAttribute('target', '_blank');
    }
コード例 #11
0
** 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.
**/
$widget = (new CWidget())->setTitle(_('Screens'));
$controls = new CList();
if (!$data['templateid']) {
    $controls->addItem(new CComboBox('config', 'screens.php', 'redirect(this.options[this.selectedIndex].value);', ['screens.php' => _('Screens'), 'slides.php' => _('Slide shows')]));
}
$controls->addItem(new CSubmit('form', _('Create screen')));
$createForm = (new CForm('get'))->cleanItems();
if ($data['templateid']) {
    $createForm->addVar('templateid', $data['templateid']);
    $widget->addItem(get_header_host_table('screens', $data['templateid']));
} else {
    $controls->addItem((new CButton('form', _('Import')))->onClick('redirect("screen.import.php?rules_preset=screen")'));
}
$createForm->addItem($controls);
$widget->setControls($createForm);
// filter
if (!$data['templateid']) {
    $widget->addItem((new CFilter('web.screenconf.filter.state'))->addColumn((new CFormList())->addRow(_('Name like'), (new CTextBox('filter_name', $data['filter']['name']))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH))));
}
// create form
$screenForm = (new CForm())->setName('screenForm')->addVar('templateid', $data['templateid']);
// create table
$screenTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_screens'))->onClick("checkAll('" . $screenForm->getName() . "', 'all_screens', 'screens');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $data['sort'], $data['sortorder']), _('Dimension (cols x rows)'), _('Actions')]);
foreach ($data['screens'] as $screen) {
    $user_type = CWebUser::getType();
コード例 #12
0
**
** 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.
**/
if ($this->data['hostid'] == 0) {
    $create_button = (new CSubmit('form', _('Create application (select host first)')))->setEnabled(false);
} else {
    $create_button = new CSubmit('form', _('Create application'));
}
$widget = (new CWidget())->setTitle(_('Applications'))->setControls((new CForm('get'))->cleanItems()->addItem((new CList())->addItem([_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()])->addItem([_('Host'), SPACE, $this->data['pageFilter']->getHostsCB()])->addItem($create_button)))->addItem(get_header_host_table('applications', $this->data['hostid']));
// create form
$form = (new CForm())->setName('application_form');
// create table
$applicationTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_applications'))->onClick("checkAll('" . $form->getName() . "', 'all_applications', 'applications');")))->addClass(ZBX_STYLE_CELL_WIDTH), $this->data['hostid'] > 0 ? null : _('Host'), make_sorting_header(_('Application'), 'name', $this->data['sort'], $this->data['sortorder']), _('Items'), $data['showInfoColumn'] ? _('Info') : null]);
$current_time = time();
foreach ($this->data['applications'] as $application) {
    $info_icons = [];
    // inherited app, display the template list
    if ($application['templateids'] && !empty($application['sourceTemplates'])) {
        $name = [];
        CArrayHelper::sort($application['sourceTemplates'], ['name']);
        foreach ($application['sourceTemplates'] as $template) {
            $name[] = (new CLink($template['name'], 'applications.php?hostid=' . $template['hostid']))->addClass(ZBX_STYLE_LINK_ALT)->addClass(ZBX_STYLE_GREY);
            $name[] = ', ';
        }
コード例 #13
0
**
** 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.
**/
$discoveryRule = $data['discovery_rule'];
$hostPrototype = $data['host_prototype'];
$parentHost = $data['parent_host'];
require_once dirname(__FILE__) . '/js/configuration.host.edit.js.php';
require_once dirname(__FILE__) . '/js/configuration.host.prototype.edit.js.php';
$widget = (new CWidget())->setTitle(_('Host prototypes'))->addItem(get_header_host_table('hosts', $discoveryRule['hostid'], $discoveryRule['itemid']));
$divTabs = new CTabView();
if (!isset($_REQUEST['form_refresh'])) {
    $divTabs->setSelected(0);
}
$frmHost = (new CForm())->setName('hostPrototypeForm.')->addVar('form', getRequest('form', 1))->addVar('parent_discoveryid', $discoveryRule['itemid'])->addVar('tls_accept', $parentHost['tls_accept']);
$hostList = new CFormList('hostlist');
if ($hostPrototype['templateid'] && $data['parents']) {
    $parents = [];
    foreach (array_reverse($data['parents']) as $parent) {
        $parents[] = new CLink($parent['parentHost']['name'], '?form=update&hostid=' . $parent['hostid'] . '&parent_discoveryid=' . $parent['discoveryRule']['itemid']);
        $parents[] = SPACE . '⇒' . SPACE;
    }
    array_pop($parents);
    $hostList->addRow(_('Parent discovery rules'), $parents);
}
コード例 #14
0
ファイル: templates.php プロジェクト: TonywalkerCN/Zabbix
    $result = DBend($result);
    if ($result) {
        uncheckTableRows();
    }
    show_messages($result, _('Template deleted'), _('Cannot delete template'));
}
/*
 * Display
 */
$templateWidget = new CWidget();
$pageFilter = new CPageFilter(array('config' => array('individual' => 1), 'groups' => array('templated_hosts' => true, 'editable' => true), 'groupid' => getRequest('groupid')));
$_REQUEST['groupid'] = $pageFilter->groupid;
if (isset($_REQUEST['form'])) {
    $templateWidget->addPageHeader(_('CONFIGURATION OF TEMPLATES'));
    if ($templateId = getRequest('templateid', 0)) {
        $templateWidget->addItem(get_header_host_table('', $templateId));
    }
    $data = array();
    if ($templateId) {
        $dbTemplates = API::Template()->get(array('templateids' => $templateId, 'selectGroups' => API_OUTPUT_EXTEND, 'selectParentTemplates' => array('templateid', 'name'), 'selectMacros' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND));
        $data['dbTemplate'] = reset($dbTemplates);
        $data['original_templates'] = array();
        foreach ($data['dbTemplate']['parentTemplates'] as $parentTemplate) {
            $data['original_templates'][$parentTemplate['templateid']] = $parentTemplate['templateid'];
        }
    } else {
        $data['original_templates'] = array();
    }
    // description
    $data['description'] = $templateId && !hasRequest('form_refresh') ? $data['dbTemplate']['description'] : getRequest('description');
    $templateIds = getRequest('templates', hasRequest('form_refresh') ? array() : $data['original_templates']);
コード例 #15
0
** 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.
**/
require_once dirname(__FILE__) . '/js/configuration.host.edit.js.php';
$widget = (new CWidget())->setTitle(_('Hosts'))->addItem(get_header_host_table('', $data['hostid']));
$divTabs = new CTabView();
if (!hasRequest('form_refresh')) {
    $divTabs->setSelected(0);
}
$frmHost = (new CForm())->setName('hostsForm')->addVar('form', $data['form'])->addVar('clear_templates', $data['clear_templates'])->addVar('flags', $data['flags'])->addVar('tls_connect', $data['tls_connect'])->addVar('tls_accept', $data['tls_accept'])->setAttribute('id', 'hostForm');
if ($data['hostid'] != 0) {
    $frmHost->addVar('hostid', $data['hostid']);
}
if ($data['clone_hostid'] != 0) {
    $frmHost->addVar('clone_hostid', $data['clone_hostid']);
}
if ($data['groupid'] != 0) {
    $frmHost->addVar('groupid', $data['groupid']);
}
$hostList = new CFormList('hostlist');
コード例 #16
0
** 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.
**/
$applicationWidget = new CWidget();
$applicationWidget->addPageHeader(_('CONFIGURATION OF APPLICATIONS'));
// append host summary to widget header
$applicationWidget->addItem(get_header_host_table('applications', $this->data['hostid']));
// create form
$applicationForm = new CForm();
$applicationForm->setName('applicationForm');
$applicationForm->addVar('form', $this->data['form']);
$applicationForm->addVar('groupid', $this->data['groupid']);
$applicationForm->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['applicationid'])) {
    $applicationForm->addVar('applicationid', $this->data['applicationid']);
}
// create form list
$applicationFormList = new CFormList('applicationFormList');
$nameTextBox = new CTextBox('appname', $this->data['appname'], ZBX_TEXTBOX_STANDARD_SIZE);
$nameTextBox->attr('autofocus', 'autofocus');
$applicationFormList->addRow(_('Name'), $nameTextBox);
// append tabs to form
コード例 #17
0
ファイル: triggers.php プロジェクト: songyuanjie/zabbix-stats
 /* TABLE */
 // Triggers Header
 $r_form = new CForm(null, 'get');
 $r_form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB()));
 $r_form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB()));
 $numrows = new CDiv();
 $numrows->setAttribute('name', 'numrows');
 $tr_link = new CLink($showdisabled ? S_HIDE_DISABLED_TRIGGERS : S_SHOW_DISABLED_TRIGGERS, 'triggers.php?showdisabled=' . ($showdisabled ? 0 : 1));
 $triggers_wdgt->addHeader(S_TRIGGERS_BIG, $r_form);
 $triggers_wdgt->addHeader($numrows, array('[ ', $tr_link, ' ]'));
 // ----------------
 $form = new CForm('triggers.php', 'post');
 $table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
 // Header Host
 if ($_REQUEST['hostid'] > 0) {
     $tbl_header_host = get_header_host_table($_REQUEST['hostid'], array('items', 'applications', 'graphs'));
     $triggers_wdgt->addItem($tbl_header_host);
 }
 $form->setName('triggers');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table->setHeader(array(new CCheckBox('all_triggers', NULL, "checkAll('" . $form->getName() . "','all_triggers','g_triggerid');"), make_sorting_header(S_SEVERITY, 'priority'), make_sorting_header(S_STATUS, 'status'), $_REQUEST['hostid'] > 0 ? NULL : S_HOST, make_sorting_header(S_NAME, 'description'), S_EXPRESSION, S_ERROR));
 // get Triggers
 $triggers = array();
 $sortfield = getPageSortField('description');
 $sortorder = getPageSortOrder();
 if ($pageFilter->hostsSelected) {
     $options = array('editable' => 1, 'output' => API_OUTPUT_SHORTEN, 'filter' => array(), 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
     if ($showdisabled == 0) {
         $options['filter']['status'] = TRIGGER_STATUS_ENABLED;
     }
     if ($pageFilter->hostid > 0) {
コード例 #18
0
** (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.
**/
$triggersWidget = new CWidget();
// append host summary to widget header
if (!empty($this->data['hostid'])) {
    $hostTableElement = $this->data['elements_field'] == 'group_graphid' ? 'graphs' : 'trigger';
    $triggersWidget->addItem(get_header_host_table($hostTableElement, $this->data['hostid']));
}
if (!empty($this->data['title'])) {
    $triggersWidget->addPageHeader($this->data['title']);
}
// create form
$triggersForm = new CForm();
$triggersForm->setName('triggersForm');
$triggersForm->addVar($this->data['elements_field'], $this->data['elements']);
$triggersForm->addVar('hostid', $this->data['hostid']);
$triggersForm->addVar('go', 'copy_to');
// create form list
$triggersFormList = new CFormList('triggersFormList');
// append copy types to form list
$copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()');
$copyTypeComboBox->addItem(0, _('Hosts'));
コード例 #19
0
    $frmApp->addItemToBottomRow(new CButtonCancel(url_param("config") . url_param("hostid") . url_param('groupid')));
    $app_wdgt->addItem($frmApp);
} else {
    $form = new CForm(null, 'get');
    $form->addItem(array(S_GROUP . SPACE, $pageFilter->getGroupsCB()));
    $form->addItem(array(SPACE . S_HOST . SPACE, $pageFilter->getHostsCB()));
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $app_wdgt->addHeader(S_APPLICATIONS_BIG, $form);
    $app_wdgt->addHeader($numrows);
    $form = new CForm();
    $table = new CTableInfo('...');
    if ($pageFilter->hostsSelected) {
        // Header Host
        if ($_REQUEST['hostid'] > 0) {
            $tbl_header_host = get_header_host_table($_REQUEST['hostid'], array('items', 'triggers', 'graphs'));
            $app_wdgt->addItem($tbl_header_host);
        }
        $form->setName('applications');
        $form->addVar('groupid', $_REQUEST['groupid']);
        $form->addVar('hostid', $_REQUEST['hostid']);
        $table->setHeader(array(new CCheckBox('all_applications', NULL, "checkAll('" . $form->getName() . "','all_applications','applications');"), $_REQUEST['hostid'] > 0 ? null : S_HOST, make_sorting_header(S_APPLICATION, 'name'), S_SHOW));
        $sortfield = getPageSortField('name');
        $sortorder = getPageSortOrder();
        $options = array('output' => API_OUTPUT_SHORTEN, 'editable' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
        if ($pageFilter->hostid > 0) {
            $options['hostids'] = $pageFilter->hostid;
        } else {
            if ($pageFilter->groupid > 0) {
                $options['groupids'] = $pageFilter->groupid;
            }
コード例 #20
0
    }
    // get templates data
    $data['linkedTemplates'] = null;
    if (!empty($data['templates'])) {
        $getLinkedTemplates = API::Template()->get(array('templateids' => $data['templates'], 'output' => array('templateid', 'name')));
        foreach ($getLinkedTemplates as $getLinkedTemplate) {
            $data['linkedTemplates'][] = array('id' => $getLinkedTemplate['templateid'], 'name' => $getLinkedTemplate['name']);
        }
    }
    $hostForm = new CView('configuration.host.massupdate', $data);
    $hostsWidget->addItem($hostForm->render());
} elseif (isset($_REQUEST['form'])) {
    $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'));
    $data = array();
    if ($hostId = get_request('hostid', 0)) {
        $hostsWidget->addItem(get_header_host_table('', $_REQUEST['hostid']));
        $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();
コード例 #21
0
** (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.
**/
$widget = new CWidget();
if (!empty($this->data['parent_discoveryid'])) {
    $widget->setTitle(_('Graph prototypes'))->addItem(get_header_host_table('graphs', $this->data['hostid'], $this->data['parent_discoveryid']));
} else {
    $widget->setTitle(_('Graphs'))->addItem(get_header_host_table('graphs', $this->data['hostid']));
}
// create form
$graphForm = (new CForm())->setName('graphForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid'])->addVar('ymin_itemid', $this->data['ymin_itemid'])->addVar('ymax_itemid', $this->data['ymax_itemid']);
if (!empty($this->data['parent_discoveryid'])) {
    $graphForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
if (!empty($this->data['graphid'])) {
    $graphForm->addVar('graphid', $this->data['graphid']);
}
// create form list
$graphFormList = new CFormList('graphFormList');
$is_templated = (bool) $this->data['templates'];
if ($is_templated) {
    $graphFormList->addRow(_('Parent graphs'), $this->data['templates']);
}
コード例 #22
0
**
** 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.
**/
$widget = (new CWidget())->setTitle(_('Discovery rules'))->addItem(get_header_host_table('discoveries', $this->data['hostid'], isset($this->data['parent_discoveryid']) ? $this->data['parent_discoveryid'] : 0));
// create form
$itemForm = (new CForm())->setName('itemForm')->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['parent_discoveryid'])) {
    $itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
if (!empty($this->data['itemid'])) {
    $itemForm->addVar('itemid', $this->data['itemid']);
}
// create form list
$itemFormList = new CFormList('itemFormList');
if (!empty($this->data['templates'])) {
    $itemFormList->addRow(_('Parent discovery rules'), $this->data['templates']);
}
$itemFormList->addRow(_('Name'), (new CTextBox('name', $this->data['name'], $this->data['limited']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('autofocus', 'autofocus'));
// append type to form list
コード例 #23
0
**
** 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.
**/
$discoveryWidget = new CWidget();
// create new discovery rule button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addVar('hostid', $this->data['hostid']);
$createForm->addItem(new CSubmit('form', _('Create discovery rule')));
$discoveryWidget->addPageHeader(_('CONFIGURATION OF DISCOVERY RULES'), $createForm);
// header
$discoveryWidget->addHeader(_('Discovery rules'));
$discoveryWidget->addHeaderRowNumber();
$discoveryWidget->addItem(get_header_host_table('discoveries', $this->data['hostid']));
// create form
$discoveryForm = new CForm();
$discoveryForm->setName('discovery');
$discoveryForm->addVar('hostid', $this->data['hostid']);
// create table
$discoveryTable = new CTableInfo(_('No discovery rules found.'));
$sortLink = new CUrl();
$sortLink->setArgument('hostid', $this->data['hostid']);
$sortLink = $sortLink->getUrl();
$discoveryTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');"), make_sorting_header(_('Name'), 'name', $sortLink), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $sortLink), make_sorting_header(_('Interval'), 'delay', $sortLink), make_sorting_header(_('Type'), 'type', $sortLink), make_sorting_header(_('Status'), 'status', $sortLink), $data['showErrorColumn'] ? _('Error') : null));
foreach ($data['discoveries'] as $discovery) {
    $description = array();
    if ($discovery['templateid']) {
        $template_host = get_realhost_by_itemid($discovery['templateid']);
        $description[] = new CLink($template_host['name'], '?hostid=' . $template_host['hostid'], 'unknown');
コード例 #24
0
/*
** Zabbix
** Copyright (C) 2001-2014 Zabbix SIA
**
** 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.
**/
$screenWidget = new CWidget();
$screenWidget->addPageHeader(_('CONFIGURATION OF SCREENS'));
$screenWidget->addHeader($this->data['screen']['name']);
if (!empty($this->data['screen']['templateid'])) {
    $screenWidget->addItem(get_header_host_table('screens', $this->data['screen']['templateid']));
}
$screenWidget->addItem(BR());
$screenBuilder = new CScreenBuilder(array('isFlickerfree' => false, 'screen' => $this->data['screen'], 'mode' => SCREEN_MODE_EDIT, 'updateProfile' => false));
$screenWidget->addItem($screenBuilder->show());
$screenBuilder->insertInitScreenJs($this->data['screenid']);
$screenBuilder->insertProcessObjectsJs();
return $screenWidget;
コード例 #25
0
**
** 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.
**/
$widget = (new CWidget())->setTitle(_('Applications'))->addItem(get_header_host_table('applications', $this->data['hostid']));
// create form
$applicationForm = (new CForm())->addVar('form', $this->data['form'])->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['applicationid'])) {
    $applicationForm->addVar('applicationid', $this->data['applicationid']);
}
// append tabs to form
$applicationTab = (new CTabView())->addTab('applicationTab', _('Application'), (new CFormList())->addRow(_('Name'), (new CTextBox('appname', $this->data['appname']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('autofocus', 'autofocus')));
// append buttons to form
if (!empty($this->data['applicationid'])) {
    $applicationTab->setFooter(makeFormFooter(new CSubmit('update', _('Update')), [new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete application?'), url_params(['hostid', 'form', 'applicationid'])), new CButtonCancel(url_param('hostid'))]));
} else {
    $applicationTab->setFooter(makeFormFooter(new CSubmit('add', _('Add')), [new CButtonCancel(url_param('hostid'))]));
}
$applicationForm->addItem($applicationTab);
// append form to widget
コード例 #26
0
** 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.
**/
$itemWidget = new CWidget();
if (!empty($this->data['hostid'])) {
    $itemWidget->addItem(get_header_host_table('items', $this->data['hostid']));
}
$itemWidget->addPageHeader(_('CONFIGURATION OF ITEMS'));
// create form
$itemForm = new CForm();
$itemForm->setName('itemForm');
$itemForm->addVar('group_itemid', $this->data['group_itemid']);
$itemForm->addVar('hostid', $this->data['hostid']);
$itemForm->addVar('go', 'copy_to');
// create form list
$itemFormList = new CFormList('itemFormList');
// append type to form list
$copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()');
$copyTypeComboBox->addItem(0, _('Hosts'));
$copyTypeComboBox->addItem(1, _('Host groups'));
$itemFormList->addRow(_('Target type'), $copyTypeComboBox);
コード例 #27
0
        show_messages($go_result, _('Template deleted'), _('Cannot delete template'));
    }
}
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) {
    $url = new CUrl();
    $path = $url->getPath();
    insert_js('cookie.eraseArray("' . $path . '")');
}
$template_wdgt = new CWidget();
$options = array('config' => array('individual' => 1), 'groups' => array('templated_hosts' => 1, 'editable' => 1), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
if (isset($_REQUEST['form'])) {
    $template_wdgt->addPageHeader(_('CONFIGURATION OF TEMPLATES'));
    if ($templateid = get_request('templateid', 0)) {
        $template_wdgt->addItem(get_header_host_table('', $templateid));
    }
    $templateForm = new CView('configuration.template.edit');
    $template_wdgt->addItem($templateForm->render());
} else {
    $frmForm = new CForm();
    $frmForm->cleanItems();
    $buttons = new CDiv(array(new CSubmit('form', _('Create template')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=template")')));
    $frmForm->addItem($buttons);
    $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
    $template_wdgt->addPageHeader(_('CONFIGURATION OF TEMPLATES'), $frmForm);
    $frmGroup = new CForm('get');
    $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
    $template_wdgt->addHeader(_('Templates'), $frmGroup);
    $template_wdgt->addHeaderRowNumber();
    $form = new CForm();
コード例 #28
0
** 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']);
$sortLink = $sortLink->getUrl();
$hostTable->setHeader(array(new CCheckBox('all_hosts', null, "checkAll('" . $itemForm->getName() . "', 'all_hosts', 'group_hostid');"), make_sorting_header(_('Name'), 'name', $sortLink), _('Templates'), make_sorting_header(_('Status'), 'status', $sortLink)));
foreach ($this->data['hostPrototypes'] as $hostPrototype) {
    // name
    $name = array();
    if ($hostPrototype['templateid']) {
        $sourceTemplate = $hostPrototype['sourceTemplate'];
コード例 #29
0
** 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.
**/
require_once dirname(__FILE__) . '/js/configuration.triggers.edit.js.php';
$triggersWidget = (new CWidget())->setTitle(_('Trigger prototypes'))->addItem(get_header_host_table('triggers', $this->data['hostid'], $this->data['parent_discoveryid']));
// create form
$triggersForm = (new CForm())->setName('triggersForm')->addVar('form', $this->data['form'])->addVar('parent_discoveryid', $this->data['parent_discoveryid'])->addVar('input_method', $this->data['input_method'])->addVar('toggle_input_method', '')->addVar('remove_expression', '');
if ($this->data['triggerid'] !== null) {
    $triggersForm->addVar('triggerid', $this->data['triggerid']);
}
// create form list
$triggersFormList = new CFormList('triggersFormList');
if (!empty($this->data['templates'])) {
    $triggersFormList->addRow(_('Parent triggers'), $this->data['templates']);
}
$triggersFormList->addRow(_('Name'), (new CTextBox('description', $this->data['description'], $this->data['limited']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('autofocus', 'autofocus'));
// append expression to form list
$expressionTextBox = (new CTextArea($this->data['expression_field_name'], $this->data['expression_field_value'], ['readonly' => $this->data['expression_field_readonly']]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH);
if ($this->data['expression_field_readonly']) {
    $triggersForm->addVar('expression', $this->data['expression']);