Source
xxxxxxxxxx
$(this).trimValues(['#name', '#command', '#commandipmi', '#description', 'input[name^="parameters"]',
<?php
/*
** 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
*/
?>
<script type="text/javascript">
$(document).ready(function() {
let $menu_path = $('#menu-path'),
$user_group = $('#user-group'),
$host_access = $('#host-access'),
$enable_confirmation = $('#enable-confirmation'),
$confirmation = $('#confirmation'),
$publickey = $('#publickey'),
$privatekey = $('#privatekey'),
$password = $('#password'),
$passphrase = $('#passphrase');
// Scope change.
$('#scope')
.change(function() {
let scope = $('input[name=scope]:checked').val();
if (scope == <?= ZBX_SCRIPT_SCOPE_ACTION ?>) {
$menu_path
.add($user_group)
.add($host_access)
.add($enable_confirmation)
.add($confirmation)
.closest('li')
.hide();
}
else {
$menu_path
.add($user_group)
.add($host_access)
.add($enable_confirmation)
.add($confirmation)
.closest('li')
.show();
}
})
.change();
// Type change.
$('#type')
.change(function() {
let type = $('input[name=type]:checked').val(),
$execute_on = $('#execute-on'),
$authtype = $('#authtype'),
$username = $('#username'),
$port = $('#port'),
$command_ipmi = $('#commandipmi'),
$command = $('#command'),
$parameters = $('#row-webhook-parameters'),
$script = $('#script'),
$timeout = $('#timeout');
switch (type) {
case '<?= ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT ?>':
if ($command_ipmi.val() !== '') {
$command.val($command_ipmi.val());
$command_ipmi.val('');
}
$command_ipmi
.add($parameters)
.add($script)
.add($timeout)
.add($authtype)
.add($username)