Source
<?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())
->setId('webscenario-step-form')
->setName('webscenario_step_form')
->addVar('edit', $data['is_edit'] ? '1' : null)
->addVar('templated', (int) $data['templated'])
->addVar('httpstepid', $data['httpstepid'])
->addVar('old_name', $data['form']['name'])
->addVar('names', $data['names'])
->addItem(getMessages());
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$form_grid = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], $data['templated'], DB::getFieldLength('httpstep', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])
->addItem([
(new CLabel(_('URL'), 'url'))->setAsteriskMark(),
new CFormField([
(new CTextBox('url', $data['form']['url'], false, DB::getFieldLength('httpstep', 'url')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired(),
(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN),
(new CSimpleButton(_('Parse')))
->addClass(ZBX_STYLE_BTN_GREY)
->addClass('js-parse-url')
])
])
->addItem([
new CLabel(_('Query fields')),
new CFormField(
(new CDiv([
(new CTable())
->setId('step-query-fields')
->setHeader([(new CColHeader())->setWidth(12), _('Name'), '', _('Value'), ''])
->setFooter(
(new CCol(
(new CButtonLink(_('Add')))->addClass('element-table-add')
))->setColSpan(5)
),
(new CTemplateTag('step-query-field-row-tmpl'))->addItem(
(new CRow([
(new CCol(
(new CDiv())->addClass(ZBX_STYLE_DRAG_ICON)
))->addClass(ZBX_STYLE_TD_DRAG_ICON),
(new CTextAreaFlexible('query_fields[#{rowNum}][name]', '#{name}', ['add_post_js' => false]))
->removeId()
->setWidth(ZBX_TEXTAREA_HTTP_PAIR_NAME_WIDTH)
->setAttribute('placeholder', _('name'))
->disableSpellcheck(),
RARR(),
(new CTextAreaFlexible('query_fields[#{rowNum}][value]', '#{value}', ['add_post_js' => false]))
->removeId()
->setWidth(ZBX_TEXTAREA_HTTP_PAIR_VALUE_WIDTH)
->setAttribute('placeholder', _('value'))
->disableSpellcheck(),
(new CCol(
(new CButtonLink(_('Remove')))->addClass('element-table-remove')
))->addClass(ZBX_STYLE_NOWRAP)
]))->addClass('form_row')
)
]))
->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)