'That rack no longer exists.']); exit; } $rack_name = escapeHtml($row['rack_name']); $rack_units = intval($row['rack_units']); $client_id = intval($row['rack_client_id']); enforceClientAccess(); // A new item. Clicking an empty U on the rack page passes where it was. $unit_id = 0; $unit_asset_id = 0; $unit_device = ''; $unit_type = 'Device'; $unit_start = min($rack_units, max(0, intval($_GET['u'] ?? 0))); $unit_height = 1; $unit_face = ($_GET['face'] ?? '') === 'rear' ? 'rear' : 'front'; $unit_full_depth = 1; $unit_power_watts = 0; $unit_notes = ''; // "Rack it" on the rack page passes the asset - start from what that kind of kit usually is $unit_asset_id = intval($_GET['asset_id'] ?? 0); if ($unit_asset_id) { $preset_asset_type = getFieldById('assets', $unit_asset_id, 'asset_type'); $unit_height = in_array($preset_asset_type, ['Server', 'NAS', 'UPS'], true) ? 2 : 1; $unit_full_depth = in_array($preset_asset_type, ['Access Point', 'Firewall/Router', 'Modem/ONT', 'PDU'], true) ? 0 : 1; } ob_start(); ?>