RMM Providers - one provider's window: Add (no id) or Edit. Which RMM it is is * picked when it is added and stays; each kind brings its own fields (rmmProviderKinds() in * functions/rmm.php) - addresses, a key, a secret. A key or secret is never put back into the * page, so left empty it stays. A kind that has alerts can have them open tickets, from the * level picked, in a category; one that has device actions can have them turned on, off until * they are. Save asks first (check_rmm_provider, admin/post/rmm.php): what * is wrong shows beside each field and the window stays open; once all is right it saves, and * tries the connection. */ require_once '../../includes/modal_header.php'; $provider_id = intval($_GET['id'] ?? 0); $row = $provider_id ? rmmProviderRow($provider_id) : null; if ($provider_id && !$row) { echo json_encode(['error' => 'That RMM provider no longer exists.']); exit; } if ($row && !rmmKind($row)) { echo json_encode(['error' => 'This ITFlow doesn\'t know that provider\'s kind of RMM.']); exit; } $kinds = rmmProviderKinds(); $kind_key = $row ? (string) $row['rmm_provider_kind'] : (string) array_key_first($kinds); $kind = $kinds[$kind_key]; // What the window's script needs of each kind - its name, to follow the kind picked, and whether it has alerts and device actions $kinds_js = array_map(function ($info) { return ['name' => $info['name'], 'alerts' => isset($info['alerts'], $info['alert']), 'alertsHelp' => (string) ($info['alerts_help'] ?? ''), 'actions' => !empty($info['actions']), 'actionsHelp' => (string) ($info['actions_help'] ?? '')]; }, $kinds); // Device actions - once the 3.6.9 database update is in $actions_offered = rmmActionsReady(); // Alerts open tickets - once the 3.6.8 database update is in, with ticketing on $alerts_offered = rmmAlertsReady() && !empty($config_module_enable_ticketing); $alert_level = (string) ($row['rmm_provider_alert_level'] ?? ''); $alert_category_id = intval($row['rmm_provider_alert_category_id'] ?? 0); // Where what is wrong with a field shows $error_for = function ($field) { return '
'; }; ob_start(); ?>