From d695b5317fd286ef4f58047a0ef34c790e2b58ea Mon Sep 17 00:00:00 2001 From: Anthony F McInerney Date: Mon, 12 Oct 2020 14:26:02 +0100 Subject: [PATCH] service templates - move to blade -wip --- .../forms/create-service-template.inc.php | 47 ------------------- .../html/forms/parse-service-template.inc.php | 37 --------------- includes/html/modal/delete_service.inc.php | 17 ++++--- .../views/services-templates/edit.blade.php | 2 +- 4 files changed, 9 insertions(+), 94 deletions(-) delete mode 100644 includes/html/forms/create-service-template.inc.php delete mode 100644 includes/html/forms/parse-service-template.inc.php diff --git a/includes/html/forms/create-service-template.inc.php b/includes/html/forms/create-service-template.inc.php deleted file mode 100644 index c6cf3c815f..0000000000 --- a/includes/html/forms/create-service-template.inc.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * 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 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (! Auth::user()->hasGlobalAdmin()) { - exit('ERROR: You need to be admin'); -} - -$service_template_id = $vars['service_template_id']; -$device_group_id = $vars['device_group_id']; -$type = $vars['stype']; -$desc = $vars['desc']; -$ip = $vars['ip']; -$param = $vars['param']; -$ignore = isset($vars['ignore']) ? 1 : 0; -$disabled = isset($vars['disabled']) ? 1 : 0; -$name = $vars['name']; - -if (is_numeric($service_template_id) && $service_template_id > 0) { - // Need to edit. - $update = ['device_group_id' => $device_group_id, 'service_template_type' => $type, 'service_template_desc' => $desc, 'service_template_ip' => $ip, 'service_template_param' => $param, 'service_template_ignore' => $ignore, 'service_template_disabled' => $disabled, 'service_template_name' => $name, 'service_template_changed' => ['UNIX_TIMESTAMP(NOW())']]; - if (is_numeric(edit_service_template($update, $service_template_id))) { - $status = ['status' =>0, 'message' => 'Modified Service Template: ' . $service_template_id . ': ' . $type . '']; - } else { - $status = ['status' =>1, 'message' => 'ERROR: Failed to modify Service Template: ' . $service_template_id . '']; - } -} else { - // Need to add. - $service_template_id = add_service_template($device_group_id, $type, $desc, $ip, $param, $ignore, $disabled, $name); - if ($service_template_id === null) { - $status = ['status' =>1, 'message' => 'ERROR: Failed to add Service Template: ' . $service_template_id . ': ' . $type . '']; - } else { - $status = ['status' =>0, 'message' => 'Added Service Template: ' . $service_template_id . ': ' . $type . '']; - } -} -header('Content-Type: application/json'); -echo _json_encode($status); diff --git a/includes/html/forms/parse-service-template.inc.php b/includes/html/forms/parse-service-template.inc.php deleted file mode 100644 index c37947498b..0000000000 --- a/includes/html/forms/parse-service-template.inc.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * 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 3 of the License, or (at your - * option) any later version. Please see LICENSE.txt at the top level of - * the source code distribution for details. - */ - -if (! Auth::user()->hasGlobalAdmin()) { - exit('ERROR: You need to be admin'); -} - -$service_template_id = $vars['service_template_id']; - -if (is_numeric($service_template_id) && $service_template_id > 0) { - $service_template = service_template_get($service_template_id); - - $output = [ - 'device_group_id' => $service_template[0]['device_group_id'], - 'stype' => $service_template[0]['service_template_type'], - 'desc' => $service_template[0]['service_template_desc'], - 'ip' => $service_template[0]['service_template_ip'], - 'param' => $service_template[0]['service_template_param'], - 'ignore' => $service_template[0]['service_template_ignore'], - 'disabled' => $service_template[0]['service_template_disabled'], - 'name' => $service_template[0]['service_template_name'], - ]; - - header('Content-Type: application/json'); - echo _json_encode($output); -} diff --git a/includes/html/modal/delete_service.inc.php b/includes/html/modal/delete_service.inc.php index 5a5d953738..d72457738d 100644 --- a/includes/html/modal/delete_service.inc.php +++ b/includes/html/modal/delete_service.inc.php @@ -19,19 +19,18 @@ if (Auth::user()->hasGlobalAdmin()) {