From a6c03694449e91a0c341fe7a5af6db5e5cfb9c43 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sun, 26 May 2024 14:32:35 +0100 Subject: [PATCH] Fix overwrite of xml if user template name is not changed. --- emhttp/plugins/dynamix.vm.manager/include/VMedit.php | 4 ++-- .../dynamix.vm.manager/templates/Custom.form.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/emhttp/plugins/dynamix.vm.manager/include/VMedit.php b/emhttp/plugins/dynamix.vm.manager/include/VMedit.php index a03863995..059ba47d7 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/VMedit.php +++ b/emhttp/plugins/dynamix.vm.manager/include/VMedit.php @@ -93,11 +93,11 @@ if (isset($_GET['uuid'])) { } $arrLoad['form'] = $arrAllTemplates[$strSelectedTemplate]['form']; } -$usertemplate = false; +$usertemplate = 0; $strSelectedTemplateUT = $strSelectedTemplate; if (strpos($strSelectedTemplate,"User-") !== false) { $strSelectedTemplateUT = str_replace("User-","",$strSelectedTemplateUT); - $usertemplate = true; + $usertemplate = 1; } ?> diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 98aad9abf..663d145cd 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -302,7 +302,11 @@ } else $arrClocks = $arrDefaultClocks['other'] ; } - if (strpos($arrConfig['template']['name'],"User-") !== false) $arrConfig['template']['name'] = str_replace("User-","",$arrConfig['template']['name']); + if (strpos($arrConfig['template']['name'],"User-") !== false) { + $arrConfig['template']['name'] = str_replace("User-","",$arrConfig['template']['name']); + unset($arrConfig['domain']['uuid']); + } + if ($usertemplate == 1) unset($arrConfig['domain']['uuid']); ?> @@ -2550,7 +2554,8 @@ $(function() { $('#vmform #domain_clock').val('localtime'); $("#vmform #domain_machine option").each(function(){ if ($(this).val().indexOf('i440fx') != -1) { - if (!) $('#vmform #domain_machine').val($(this).val()).change(); + var usertemplate = ; + if (usertemplate = 0) $('#vmform #domain_machine').val($(this).val()).change(); return false; } }); @@ -2559,7 +2564,8 @@ $(function() { $('#vmform #clockoffset').val('utc'); $("#vmform #domain_machine option").each(function(){ if ($(this).val().indexOf('q35') != -1) { - $('#vmform #domain_machine').val($(this).val()).change(); + var usertemplate = ; + if (usertemplate = 0) $('#vmform #domain_machine').val($(this).val()).change(); return false; } });