Source
xxxxxxxxxx
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* @var CView $this
* @var array $data
*/
$form = (new CForm('post'))
->addItem((new CVar(CSRF_TOKEN_NAME, CCsrfTokenHelper::get('proxy')))->removeId())
->setId('proxy-form')
->setName('proxy_form')
->addStyle('display: none;')
->addItem(getMessages());
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
// Proxy tab.
$local_address = (new CTable())
->setHeader([_('Address'), _('Port')])
->addRow([
(new CTextBox('local_address', $data['form']['local_address'], false,
DB::getFieldLength('proxy', 'local_address')
))->setWidth(336),
(new CTextBox('local_port', $data['form']['local_port'], false, DB::getFieldLength('proxy', 'local_port')))
->setWidth(ZBX_TEXTAREA_INTERFACE_PORT_WIDTH)
->setAriaRequired()
]);
$interface = (new CTable())
->setHeader([_('Address'), _('Port')])
->addRow([
(new CTextBox('address', $data['form']['address'], false, DB::getFieldLength('proxy', 'address')))
->setWidth(336),
(new CTextBox('port', $data['form']['port'], false, DB::getFieldLength('proxy', 'port')))
->setWidth(ZBX_TEXTAREA_INTERFACE_PORT_WIDTH)
->setAriaRequired()
]);
$proxy_tab = (new CFormGrid())
->addItem([
(new CLabel(_('Proxy name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], false, DB::getFieldLength('proxy', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])
->addItem([
new CLabel(_('Proxy group'), 'proxy_groupid_ms'),
new CFormField(
(new CMultiSelect([
'name' => 'proxy_groupid',
'object_name' => 'proxy_groups',
'multiple' => false,
'data' => $data['ms_proxy_group'],
'popup' => [
'parameters' => [
'srctbl' => 'proxy_groups',
'srcfld1' => 'proxy_groupid',
'srcfld2' => 'name',
'dstfrm' => $form->getName(),
'dstfld1' => 'proxy_groupid'
]
]
]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
)
])
->addItem([
(new CLabel(_('Address for active agents')))
->addClass('js-local-address')
->setAsteriskMark(),
(new CFormField(
(new CDiv($local_address))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)
))->addClass('js-local-address')
])