$slideForm->addVar('slideshowid', $this->data['slideshowid']);
}
// create slide form list
$slideFormList = new CFormList('slideFormList');
$slideFormList->addRow(_('Name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE));
$slideFormList->addRow(_('Default delay (in seconds)'), new CNumericBox('delay', $this->data['delay'], 5, 'no', false, false));
// append slide table
$slideTable = new CTableInfo(_('No slides defined.'), 'formElementTable');
$slideTable->setAttribute('style', 'min-width: 500px;');
$slideTable->setAttribute('id', 'slideTable');
$slideTable->setHeader(array(new CCol(SPACE, null, null, '15'), new CCol(SPACE, null, null, '15'), new CCol(_('Screen'), null, null, '140'), new CCol(_('Delay'), null, null, '70'), new CCol(_('Action'), null, null, '50')));
$i = 1;
foreach ($this->data['slides'] as $step => $slides) {
    $name = '';
    if (!empty($slides['screenid'])) {
        $screen = get_screen_by_screenid($slides['screenid']);
        if (!empty($screen['name'])) {
            $name = $screen['name'];
        }
    }
    $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false);
    $delay->setAttribute('placeholder', _('default'));
    $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu');
    $removeButton->setAttribute('remove_slide', $step);
    $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $step), $name, $delay, $removeButton), 'sortable', 'slides_' . $step);
    $slideTable->addRow($row);
}
$addButtonColumn = new CCol(empty($this->data['work_slide']) ? new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=screens&srcfld1=screenid&dstfrm=' . $slideForm->getName() . '&multiselect=1", 450, 450)', 'link_menu') : null, null, 5);
$addButtonColumn->setAttribute('style', 'vertical-align: middle;');
$slideTable->addRow(new CRow($addButtonColumn, null, 'screenListFooter'));
$slideFormList->addRow(_('Slides'), new CDiv($slideTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
コード例 #2
0
ファイル: blocks.inc.php プロジェクト: phedders/zabbix
function make_screen_submenu()
{
    $screenids = array();
    $fav_screens = get_favorites('web.favorite.screenids');
    foreach ($fav_screens as $key => $favorite) {
        $source = $favorite['source'];
        $sourceid = $favorite['value'];
        if ('slideshowid' == $source) {
            if (!($slide = get_slideshow_by_slideshowid($sourceid))) {
                continue;
            }
            $slide_added = true;
            $screenids[] = array('name' => $slide['name'], 'favobj' => 'slideshowid', 'favid' => $sourceid, 'action' => 'remove');
        } else {
            if (!($screen = get_screen_by_screenid($sourceid))) {
                continue;
            }
            $screen_added = true;
            $screenids[] = array('name' => $screen['name'], 'favobj' => 'screenid', 'favid' => $sourceid, 'action' => 'remove');
        }
    }
    if (isset($screen_added)) {
        $screenids[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_SCREENS, 'favobj' => 'screenid', 'favid' => 0, 'action' => 'remove');
    }
    if (isset($slide_added)) {
        $screenids[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_SLIDES, 'favobj' => 'slideshowid', 'favid' => 0, 'action' => 'remove');
    }
    return $screenids;
}
コード例 #3
0
ファイル: screens.php プロジェクト: phedders/zabbix
    $cmbElements->addItem($row['elementid'], get_node_name_by_elid($row['elementid']) . $row['name']);
    if (bccomp($elementid, $row['elementid']) == 0) {
        $element_correct = 1;
    }
    if (!isset($first_element)) {
        $first_element = $row['elementid'];
    }
}
if (!isset($element_correct) && isset($first_element)) {
    $elementid = $first_element;
}
if (isset($elementid)) {
    if (!screen_accessible($elementid, PERM_READ_ONLY)) {
        access_deny();
    }
    $element = get_screen_by_screenid($elementid);
    if ($element) {
        $text = $element['name'];
    }
}
if ($cmbElements->ItemsCount() > 0) {
    $form->addItem(array(SPACE . S_SCREENS . SPACE, $cmbElements));
}
if (2 != $_REQUEST['fullscreen'] && !empty($elementid) && check_dynamic_items($elementid, 0)) {
    if (!isset($_REQUEST['hostid'])) {
        $_REQUEST['groupid'] = $_REQUEST['hostid'] = 0;
    }
    $options = array('allow_all_hosts', 'monitored_hosts', 'with_items');
    if (!$ZBX_WITH_ALL_NODES) {
        array_push($options, 'only_current_node');
    }
コード例 #4
0
ファイル: screenedit.php プロジェクト: phedders/zabbix
require_once 'include/blocks.inc.php';
$page['title'] = "S_CONFIGURATION_OF_SCREENS";
$page['file'] = 'screenedit.php';
$page['hist_arg'] = array('screenid');
$page['scripts'] = array('scriptaculous.js?load=effects,dragdrop', 'cscreen.js');
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('screenid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'screenitemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))&&(!isset({x})||!isset({y}))'), 'resourcetype' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 14), 'isset({save})'), 'resourceid' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), 'width' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'colspan' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rowspan' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'elements' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 65535), null), 'valign' => array(T_ZBX_INT, O_OPT, null, BETWEEN(VALIGN_MIDDLE, VALIGN_BOTTOM), null), 'halign' => array(T_ZBX_INT, O_OPT, null, BETWEEN(HALIGN_CENTER, HALIGN_RIGHT), null), 'style' => array(T_ZBX_INT, O_OPT, null, BETWEEN(STYLE_HORISONTAL, STYLE_VERTICAL), 'isset({save})'), 'url' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'dynamic' => array(T_ZBX_INT, O_OPT, null, null, null), 'x' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})&&(isset({form})&&({form}!="update"))'), 'y' => array(T_ZBX_INT, O_OPT, null, BETWEEN(1, 100), 'isset({save})&&(isset({form})&&({form}!="update"))'), 'tr_groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'tr_hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), 'add_row' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'add_col' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rmv_row' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'rmv_col' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null), 'sw_pos' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 100), null));
check_fields($fields);
$_REQUEST['dynmic'] = get_request('dynamic', SCREEN_SIMPLE_ITEM);
show_table_header(S_CONFIGURATION_OF_SCREEN_BIG);
if (isset($_REQUEST['screenid'])) {
    if (!screen_accessible($_REQUEST['screenid'], PERM_READ_WRITE)) {
        access_deny();
    }
    $screen = get_screen_by_screenid($_REQUEST['screenid']);
    echo SBR;
    if (isset($_REQUEST['save'])) {
        if (!isset($_REQUEST['elements'])) {
            $_REQUEST['elements'] = 0;
        }
        DBstart();
        if (isset($_REQUEST['screenitemid'])) {
            $result = update_screen_item($_REQUEST['screenitemid'], $_REQUEST['resourcetype'], $_REQUEST['resourceid'], $_REQUEST['width'], $_REQUEST['height'], $_REQUEST['colspan'], $_REQUEST['rowspan'], $_REQUEST['elements'], $_REQUEST['valign'], $_REQUEST['halign'], $_REQUEST['style'], $_REQUEST['url'], $_REQUEST['dynmic']);
            show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM);
        } else {
            $result = add_screen_item($_REQUEST['resourcetype'], $_REQUEST['screenid'], $_REQUEST['x'], $_REQUEST['y'], $_REQUEST['resourceid'], $_REQUEST['width'], $_REQUEST['height'], $_REQUEST['colspan'], $_REQUEST['rowspan'], $_REQUEST['elements'], $_REQUEST['valign'], $_REQUEST['halign'], $_REQUEST['style'], $_REQUEST['url'], $_REQUEST['dynmic']);
            show_messages($result, S_ITEM_ADDED, S_CANNOT_ADD_ITEM);
        }
        $result = DBend($result);
        if ($result) {
コード例 #5
0
ファイル: forms.inc.php プロジェクト: rennhak/zabbix
function insert_slideshow_form()
{
    $form = new CFormTable(S_SLIDESHOW, null, 'post');
    $form->SetHelp('config_advanced.php');
    $form->addVar('config', 1);
    if (isset($_REQUEST['slideshowid'])) {
        $form->addVar('slideshowid', $_REQUEST['slideshowid']);
    }
    $name = get_request('name', '');
    $delay = get_request('delay', 5);
    $steps = get_request('steps', array());
    $new_step = get_request('new_step', null);
    if (isset($_REQUEST['slideshowid']) && !isset($_REQUEST['form_refresh'])) {
        $slideshow_data = DBfetch(DBselect('SELECT * FROM slideshows WHERE slideshowid=' . $_REQUEST['slideshowid']));
        $name = $slideshow_data['name'];
        $delay = $slideshow_data['delay'];
        $steps = array();
        $db_steps = DBselect('SELECT * FROM slides WHERE slideshowid=' . $_REQUEST['slideshowid'] . ' order by step');
        while ($step_data = DBfetch($db_steps)) {
            $steps[$step_data['step']] = array('screenid' => $step_data['screenid'], 'delay' => $step_data['delay']);
        }
    }
    $form->addRow(S_NAME, new CTextBox('name', $name, 40));
    $form->addRow(S_UPDATE_INTERVAL_IN_SEC, new CNumericBox("delay", $delay, 5));
    $tblSteps = new CTableInfo(S_NO_SLIDES_DEFINED);
    $tblSteps->SetHeader(array(S_SCREEN, S_DELAY, SPACE));
    if (count($steps) > 0) {
        ksort($steps);
        $first = min(array_keys($steps));
        $last = max(array_keys($steps));
    }
    foreach ($steps as $sid => $s) {
        if (!isset($s['screenid'])) {
            $s['screenid'] = 0;
        }
        if (isset($s['delay']) && $s['delay'] > 0) {
            $s['delay'] = bold($s['delay']);
        } else {
            $s['delay'] = $delay;
        }
        $up = null;
        if ($sid != $first) {
            $up = new CLink(S_UP, '#', 'action');
            $up->OnClick("return create_var('" . $form->GetName() . "','move_up'," . $sid . ", true);");
        }
        $down = null;
        if ($sid != $last) {
            $down = new CLink(S_DOWN, '#', 'action');
            $down->OnClick("return create_var('" . $form->GetName() . "','move_down'," . $sid . ", true);");
        }
        $screen_data = get_screen_by_screenid($s['screenid']);
        $name = new CLink($screen_data['name'], '#', 'action');
        $name->OnClick("return create_var('" . $form->GetName() . "','edit_step'," . $sid . ", true);");
        $tblSteps->addRow(array(array(new CCheckBox('sel_step[]', null, null, $sid), $name), $s['delay'], array($up, isset($up) && isset($down) ? SPACE : null, $down)));
    }
    $form->addVar('steps', $steps);
    $form->addRow(S_SLIDES, array($tblSteps, !isset($new_step) ? new CButton('add_step_bttn', S_ADD, "return create_var('" . $form->GetName() . "','add_step',1, true);") : null, count($steps) > 0 ? new CButton('del_sel_step', S_DELETE_SELECTED) : null));
    if (isset($new_step)) {
        if (!isset($new_step['screenid'])) {
            $new_step['screenid'] = 0;
        }
        if (!isset($new_step['delay'])) {
            $new_step['delay'] = 0;
        }
        if (isset($new_step['sid'])) {
            $form->addVar('new_step[sid]', $new_step['sid']);
        }
        $form->addVar('new_step[screenid]', $new_step['screenid']);
        $screen_data = get_screen_by_screenid($new_step['screenid']);
        $form->addRow(S_NEW_SLIDE, array(new CTextBox('screen_name', $screen_data['name'], 25, 'yes'), new CButton('select_screen', S_SELECT, 'return PopUp("popup.php?dstfrm=' . $form->GetName() . '&srctbl=screens' . '&dstfld1=screen_name&srcfld1=name' . '&dstfld2=new_step%5Bscreenid%5D&srcfld2=screenid");'), S_DELAY, new CNumericBox('new_step[delay]', $new_step['delay'], 5), BR(), new CButton('add_step', isset($new_step['sid']) ? S_SAVE : S_ADD), new CButton('cancel_step', S_CANCEL)), isset($new_step['sid']) ? 'edit' : 'new');
    }
    $form->addItemToBottomRow(new CButton("save", S_SAVE));
    if (isset($_REQUEST['slideshowid'])) {
        $form->addItemToBottomRow(SPACE);
        $form->addItemToBottomRow(new CButton('clone', S_CLONE));
        $form->addItemToBottomRow(SPACE);
        $form->addItemToBottomRow(new CButtonDelete(S_DELETE_SLIDESHOW_Q, url_param('form') . url_param('slideshowid') . url_param('config')));
    }
    $form->addItemToBottomRow(SPACE);
    $form->addItemToBottomRow(new CButtonCancel());
    $form->Show();
}
コード例 #6
0
ファイル: config.inc.php プロジェクト: rennhak/zabbix
function get_resource_name($permission, $id)
{
    $res = '-';
    if ($permission == 'Graph') {
        if (isset($id) && $id != 0) {
            if ($graph = get_graph_by_graphid($id)) {
                $res = $graph['name'];
            }
        } else {
            if (!isset($id) || $id == 0) {
                $res = 'All graphs';
            }
        }
    } else {
        if ($permission == 'Host') {
            if (isset($id) && $id != 0) {
                if ($host = get_host_by_hostid($id)) {
                    $res = $host['host'];
                }
            } else {
                if (!isset($id) || $id == 0) {
                    $res = 'All hosts';
                }
            }
        } else {
            if ($permission == 'Screen') {
                if (isset($id) && $id != 0) {
                    if ($screen = get_screen_by_screenid($id)) {
                        $res = $screen['name'];
                    }
                } else {
                    if (!isset($id) || $id == 0) {
                        $res = 'All screens';
                    }
                }
            } else {
                if ($permission == 'Item') {
                    if (isset($id) && $id != 0) {
                        if ($item = get_item_by_itemid($id)) {
                            if ($host = get_host_by_hostid($item['hostid'])) {
                                $res = $host['host'] . ':' . $item['description'];
                            }
                        }
                    } else {
                        if (!isset($id) || $id == 0) {
                            $res = 'All items';
                        }
                    }
                } else {
                    if ($permission == 'User') {
                        if (isset($id) && $id != 0) {
                            if ($user = get_user_by_userid($id)) {
                                $res = $user['alias'];
                            }
                        } else {
                            if (!isset($id) || $id == 0) {
                                $res = 'All users';
                            }
                        }
                    } else {
                        if ($permission == 'Network map') {
                            if (isset($id) && $id != 0) {
                                if ($user = get_sysmap_by_sysmapid($id)) {
                                    $res = $user['name'];
                                }
                            } else {
                                if (!isset($id) || $id == 0) {
                                    $res = 'All maps';
                                }
                            }
                        } else {
                            if ($permission == 'Application') {
                                if (isset($id) && $id > 0) {
                                    if ($app = get_application_by_applicationid($id)) {
                                        $res = $app['name'];
                                    }
                                } else {
                                    if (!isset($id) || $id == 0) {
                                        $res = 'All applications';
                                    }
                                }
                            } else {
                                if ($permission == 'Service') {
                                    if (isset($id) && $id > 0) {
                                        if ($service = get_service_by_serviceid($id)) {
                                            $res = $service['name'];
                                        }
                                    } else {
                                        if (!isset($id) || $id == 0) {
                                            $res = 'All services';
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($res == '-' && isset($id) && $id > 0) {
        $res = $id;
    }
    return $res;
}
コード例 #7
0
ファイル: screenconf.php プロジェクト: rennhak/zabbix
                }
                DBstart();
                add_screen($_REQUEST["name"], $_REQUEST["hsize"], $_REQUEST["vsize"]);
                $result = DBend();
                $audit_action = AUDIT_ACTION_ADD;
                show_messages($result, S_SCREEN_ADDED, S_CANNOT_ADD_SCREEN);
            }
            if ($result) {
                add_audit($audit_action, AUDIT_RESOURCE_SCREEN, " Name [" . $_REQUEST['name'] . "] ");
                unset($_REQUEST["form"]);
                unset($_REQUEST["screenid"]);
            }
        }
    }
    if (isset($_REQUEST["delete"]) && isset($_REQUEST["screenid"])) {
        if ($screen = get_screen_by_screenid($_REQUEST["screenid"])) {
            DBstart();
            delete_screen($_REQUEST["screenid"]);
            $result = DBend();
            show_messages($result, S_SCREEN_DELETED, S_CANNOT_DELETE_SCREEN);
            add_audit_if($result, AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, " Name [" . $screen['name'] . "] ");
        }
        unset($_REQUEST["screenid"]);
        unset($_REQUEST["form"]);
    }
} else {
    if (isset($_REQUEST['slideshowid'])) {
        if (!slideshow_accessible($_REQUEST['slideshowid'], PERM_READ_WRITE)) {
            access_deny();
        }
    }