Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/php/popup_bitem.php')
-rw-r--r--frontends/php/popup_bitem.php64
1 files changed, 37 insertions, 27 deletions
diff --git a/frontends/php/popup_bitem.php b/frontends/php/popup_bitem.php
index 2753f277c9a..634e1d650f3 100644
--- a/frontends/php/popup_bitem.php
+++ b/frontends/php/popup_bitem.php
@@ -23,7 +23,7 @@ require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/triggers.inc.php';
require_once dirname(__FILE__).'/include/js.inc.php';
-$dstfrm = get_request('dstfrm', 0);
+$dstfrm = getRequest('dstfrm', 0);
$page['title'] = _('Graph item');
$page['file'] = 'popup_bitem.php';
@@ -36,7 +36,7 @@ require_once dirname(__FILE__).'/include/page_header.php';
$fields = array(
'dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null),
'config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), null),
- 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), null),
+ 'gid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID.'({}!=0)', null),
'list_name' => array(T_ZBX_STR, O_OPT, P_SYS, NOT_EMPTY, 'isset({save})&&isset({gid})'),
'caption' => array(T_ZBX_STR, O_OPT, null, null, null),
'itemid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID.'({}!=0)', 'isset({save})', _('Parameter')),
@@ -48,20 +48,26 @@ $fields = array(
'save' => array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
// other
'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null),
- 'form_refresh' => array(T_ZBX_STR, O_OPT, null, null, null),
+ 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null),
'host' => array(T_ZBX_STR, O_OPT, null, null, null),
- 'name' => array(T_ZBX_STR, O_OPT, null, null, null)
+ 'name' => array(T_ZBX_STR, O_OPT, null, null, null),
+ 'name_expanded' => array(T_ZBX_STR, O_OPT, null, null, null)
);
check_fields($fields);
-$_REQUEST['caption'] = get_request('caption', '');
-$_REQUEST['axisside'] = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT);
+$caption = getRequest('caption', '');
+$autoCaption = '';
+$_REQUEST['axisside'] = getRequest('axisside', GRAPH_YAXIS_SIDE_LEFT);
-if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && $_REQUEST['itemid'] > 0) {
- $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid($_REQUEST['itemid'])));
+if (getRequest('itemid') > 0) {
+ $items = CMacrosResolverHelper::resolveItemNames(array(get_item_by_itemid(getRequest('itemid'))));
$item = reset($items);
- $_REQUEST['caption'] = $item['name_expanded'];
+ $autoCaption = $item['name_expanded'];
+
+ if (!hasRequest('caption') || getRequest('caption') === $item['name']) {
+ $caption = $item['name_expanded'];
+ }
}
insert_js_function('add_bitem');
@@ -70,7 +76,7 @@ insert_js_function('update_bitem');
if (isset($_REQUEST['save']) && !isset($_REQUEST['gid'])) {
insert_js("add_bitem(".
zbx_jsvalue($_REQUEST['dstfrm']).",".
- zbx_jsvalue($_REQUEST['caption']).",'".
+ zbx_jsvalue($caption).",'".
$_REQUEST['itemid']."','".
$_REQUEST['color']."',".
$_REQUEST['calc_fnc'].",".
@@ -83,7 +89,7 @@ if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) {
zbx_jsvalue($_REQUEST['dstfrm']).",".
zbx_jsvalue($_REQUEST['list_name']).",'".
$_REQUEST['gid']."',".
- zbx_jsvalue($_REQUEST['caption']).",'".
+ zbx_jsvalue($caption).",'".
$_REQUEST['itemid']."','".
$_REQUEST['color']."',".
$_REQUEST['calc_fnc'].",".
@@ -91,39 +97,43 @@ if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) {
);
}
else {
- echo SBR;
+ echo BR();
$frmGItem = new CFormTable(_('New item for the graph'));
$frmGItem->setName('graph_item');
- $frmGItem->setHelp('web.graph.item.php');
+ $frmGItem->addHelpIcon();
$frmGItem->addVar('dstfrm', $_REQUEST['dstfrm']);
- $config = get_request('config', 1);
- $gid = get_request('gid', null);
- $list_name = get_request('list_name', null);
- $caption = get_request('caption', '');
- $itemid = get_request('itemid', 0);
- $color = get_request('color', '009900');
- $calc_fnc = get_request('calc_fnc', 2);
- $axisside = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT);
+ $config = getRequest('config', 1);
+ $gid = getRequest('gid');
+ $list_name = getRequest('list_name');
+ $itemid = getRequest('itemid', 0);
+ $color = getRequest('color', '009900');
+ $calc_fnc = getRequest('calc_fnc', 2);
+ $axisside = getRequest('axisside', GRAPH_YAXIS_SIDE_LEFT);
$frmGItem->addVar('gid', $gid);
$frmGItem->addVar('config', $config);
$frmGItem->addVar('list_name', $list_name);
$frmGItem->addVar('itemid', $itemid);
-
- $frmGItem->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', _('Default')),
- _('Caption')), new CTextBox('caption', $caption, 50)
+ $frmGItem->addRow(
+ array(
+ new CVisibilityBox('caption_visible', hasRequest('caption') && $caption != $autoCaption, 'caption',
+ _('Default')
+ ),
+ _('Caption')
+ ),
+ new CTextBox('caption', $caption, 50)
);
- $host = get_request('host');
- $itemName = get_request('name');
+ $host = getRequest('host');
+ $itemName = getRequest('name_expanded');
if ($host && $itemName) {
$caption = $host['name'].NAME_DELIMITER.$itemName;
}
- $txtCondVal = new CTextBox('name', $caption, 50, 'yes');
+ $txtCondVal = new CTextBox('name', $caption, 50, true);
$btnSelect = new CSubmit('btn1', _('Select'),
'return PopUp("popup.php?'.