require_once dirname(__FILE__).'/include/config.inc.php';
require_once dirname(__FILE__).'/include/hosts.inc.php';
require_once dirname(__FILE__).'/include/items.inc.php';
require_once dirname(__FILE__).'/include/forms.inc.php';
$page['title'] = _('Configuration of items');
$page['file'] = 'items.php';
$page['scripts'] = ['multilineinput.js', 'items.js', 'class.tagfilteritem.js'];
require_once dirname(__FILE__).'/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
'hostid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID.NOT_ZERO, 'isset({form}) && !isset({itemid})'],
'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')],
'itemid' => [T_ZBX_INT, O_NO, P_SYS, DB_ID, 'isset({form}) && {form} == "update"'],
'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})',
'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'],
'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')],
'master_itemid' => [T_ZBX_STR, O_OPT, null, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && {type} == '.ITEM_TYPE_DEPENDENT,
'delay' => [T_ZBX_TU, O_OPT, P_ALLOW_USER_MACRO, null,
'(isset({add}) || isset({update})) && isset({type})'.
' && ({type} != '.ITEM_TYPE_TRAPPER.' && {type} != '.ITEM_TYPE_SNMPTRAP.
' && {type} != '.ITEM_TYPE_DEPENDENT.
' && !({type} == '.ITEM_TYPE_ZABBIX_ACTIVE.
' && isset({key}) && strncmp({key}, "mqtt.get", 8) === 0))',
'delay_flex' => [T_ZBX_STR, O_OPT, P_ONLY_TD_ARRAY, null, null],
'history_mode' => [T_ZBX_INT, O_OPT, null, IN([ITEM_STORAGE_OFF, ITEM_STORAGE_CUSTOM]), null],
'history' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update}))'.
' && isset({history_mode}) && {history_mode}=='.ITEM_STORAGE_CUSTOM,
_('History storage period')
'status' => [T_ZBX_INT, O_OPT, null, IN([ITEM_STATUS_DISABLED, ITEM_STATUS_ACTIVE]), null],
'type' => [T_ZBX_INT, O_OPT, null,
IN([-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE,
ITEM_TYPE_INTERNAL, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_EXTERNAL,
ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH,
ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED, ITEM_TYPE_SNMPTRAP,
ITEM_TYPE_DEPENDENT, ITEM_TYPE_HTTPAGENT, ITEM_TYPE_SNMP, ITEM_TYPE_SCRIPT
'isset({add}) || isset({update})'
'trends_mode' => [T_ZBX_INT, O_OPT, null, IN([ITEM_STORAGE_OFF, ITEM_STORAGE_CUSTOM]), null],
'trends' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update}))'.
' && isset({trends_mode}) && {trends_mode}=='.ITEM_STORAGE_CUSTOM.
' && isset({value_type})'.
' && '.IN(ITEM_VALUE_TYPE_FLOAT.','.ITEM_VALUE_TYPE_UINT64, 'value_type'),
_('Trend storage period')
'value_type' => [T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4'), 'isset({add}) || isset({update})'],
'valuemapid' => [T_ZBX_INT, O_OPT, null, DB_ID, null],
'authtype' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD.','.ITEM_AUTHTYPE_PUBLICKEY),
'(isset({add}) || isset({update})) && isset({type}) && {type} == '.ITEM_TYPE_SSH
'username' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY,
'(isset({add}) || isset({update})) && isset({type})'.
' && '.IN(ITEM_TYPE_SSH.','.ITEM_TYPE_TELNET, 'type'),
'password' => [T_ZBX_STR, O_OPT, null, null,