connessione con hardware in assets
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* AJAX endpoint providing the asset dropdown for the "Hardware host"
|
||||
* field of the UrBackup server form.
|
||||
*
|
||||
* Called through Ajax::updateItemOnSelectEvent when the host itemtype
|
||||
* selection changes. GET only, no state changes are performed.
|
||||
*/
|
||||
|
||||
use GlpiPlugin\Urbackup\Config;
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
define('GLPI_ROOT', dirname(__DIR__, 4));
|
||||
}
|
||||
|
||||
include_once GLPI_ROOT . '/inc/includes.php';
|
||||
|
||||
Html::header_nocache();
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'GET') {
|
||||
http_response_code(405);
|
||||
exit;
|
||||
}
|
||||
|
||||
$itemtype = (string) ($_GET['itemtype'] ?? '');
|
||||
|
||||
if ($itemtype === '' || !class_exists($itemtype) || !Config::isItemtypeEnabled($itemtype)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$value = (int) ($_GET['value'] ?? 0);
|
||||
|
||||
Dropdown::show($itemtype, [
|
||||
'name' => 'host_items_id',
|
||||
'value' => $value,
|
||||
'entity' => Session::getActiveEntities(),
|
||||
'display_emptychoice' => true,
|
||||
]);
|
||||
Reference in New Issue
Block a user