Source
->setAttribute('data-confirmation', _('Regenerate selected API token? Previously generated token will become invalid.'))
<?php declare(strict_types = 0);
/*
** Zabbix
** 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 General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* @var CView $this
* @var array $data
*/
$this->addJsFile('class.calendar.js');
$this->includeJsFile('administration.token.edit.js.php');
$widget = (new CWidget())
->setTitle(_('API tokens'))
->setTitleSubmenu(getAdministrationGeneralSubmenu());
$token_form = (new CForm())
->setId('token_form')
->setName('token')
->setAttribute('aria-labelledby', ZBX_STYLE_PAGE_TITLE)
->addVar('action_src', 'token.edit')
->addVar('action_dst', ($data['tokenid'] == 0) ? 'token.view' : 'token.list')
->addVar('action', ($data['tokenid'] == 0) ? 'token.create' : 'token.update')
->addVar('tokenid', $data['tokenid']);
// Enable form submitting on Enter.
$token_form->addItem((new CSubmitButton(null))->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$token_from_list = (new CFormList())
->addRow((new CLabel(_('Name'), 'name'))->setAsteriskMark(),
(new CTextBox('name', $data['name'], false, DB::getFieldLength('token', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAttribute('autofocus', 'autofocus')
->setAriaRequired()
)
->addRow((new CLabel(_('User'), 'userid_ms'))->setAsteriskMark(), [
(new CMultiSelect([
'readonly' => ($data['tokenid'] != 0),
'multiple' => false,
'name' => 'userid',
'object_name' => 'users',
'data' => $data['ms_user'],
'placeholder' => '',
'popup' => [
'parameters' => [