diff --git a/emhttp/plugins/dynamix.vm.manager/include/VMedit.php b/emhttp/plugins/dynamix.vm.manager/include/VMedit.php index 67b2dd6ef..059ba47d7 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/VMedit.php +++ b/emhttp/plugins/dynamix.vm.manager/include/VMedit.php @@ -93,8 +93,12 @@ if (isset($_GET['uuid'])) { } $arrLoad['form'] = $arrAllTemplates[$strSelectedTemplate]['form']; } +$usertemplate = 0; $strSelectedTemplateUT = $strSelectedTemplate; -if (strpos($strSelectedTemplate,"User-") !== false) $strSelectedTemplateUT = str_replace("User-","",$strSelectedTemplateUT); +if (strpos($strSelectedTemplate,"User-") !== false) { + $strSelectedTemplateUT = str_replace("User-","",$strSelectedTemplateUT); + $usertemplate = 1; +} ?> diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index 8d78bcd93..75935cdfa 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -941,7 +941,17 @@ private static $encoding = 'UTF-8'; $xml = $lv->domain_get_xml($res) ; $xmldoc = new SimpleXMLElement($xml); $xmlpath = $xmldoc->xpath('//devices/input[@type="evdev"] '); - return $xmlpath; + $evdevs = []; + foreach ($xmlpath as $i => $evDev) { + $evdevs[$i] = [ + 'dev' => $evDev->source->attributes()->dev, + 'grab' => $evDev->source->attributes()->grab, + 'repeat' => $evDev->source->attributes()->repeat, + 'grabToggle' => $evDev->source->attributes()->grabToggle + ]; + } + if (empty($evdevs)) $evdevs[0] = ['dev'=>"",'grab'=>"",'repeat'=>"",'grabToggle'=>""]; + return $evdevs; } $cacheValidUSBDevices = null; diff --git a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php index 12abb670b..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']); ?> @@ -1627,15 +1631,7 @@

- - "; - $evdevdoc = new SimpleXMLElement($evdevxml); - $arrConfig['evdev']= $evdevdoc->xpath('//input[@type="evdev"] '); - } - + if (!isset($arrConfig['evdev'])) $arrConfig['evdev'][0] = ['dev'=>"",'grab'=>"",'repeat'=>"",'grabToggle'=>""]; foreach ($arrConfig['evdev'] as $i => $arrEvdev) { $strLabel = ($i > 0) ? appendOrdinalSuffix($i + 1) : ''; ?> @@ -1645,8 +1641,8 @@ @@ -1655,8 +1651,8 @@ _(Grab)_: @@ -1665,8 +1661,8 @@ _(Repeat)_: @@ -1675,8 +1671,8 @@ _(Grab Toggle)_: @@ -2558,7 +2554,8 @@ $(function() { $('#vmform #domain_clock').val('localtime'); $("#vmform #domain_machine option").each(function(){ if ($(this).val().indexOf('i440fx') != -1) { - $('#vmform #domain_machine').val($(this).val()).change(); + var usertemplate = ; + if (usertemplate = 0) $('#vmform #domain_machine').val($(this).val()).change(); return false; } }); @@ -2567,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; } }); diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index c8304ed6a..15c536538 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -291,11 +291,11 @@ function my_mkdir($dirname,$permissions = 0777,$recursive = false,$own = "nobody case "zfs": $zfsdataset = trim(shell_exec("zfs list -H -o name $parent")) ; $zfsdataset .= str_replace($parent,"",$dirname); - if ($recursive) $rtncode=exec("zfs create -p $zfsdataset");else $rtncode=exec("zfs create $zfsdataset"); + if ($recursive) $rtncode=exec("zfs create -p \"$zfsdataset\"");else $rtncode=exec("zfs create \"$zfsdataset\""); if (!$rtncode) mkdir($dirname, $permissions, $recursive); else chmod($zfsdataset,$permissions); break; case "btrfs": - if ($recursive) $rtncode=exec("btrfs subvolume create --parents $dirname"); else $rtncode=exec("btrfs subvolume create $dirname"); + if ($recursive) $rtncode=exec("btrfs subvolume create --parents \"$dirname\""); else $rtncode=exec("btrfs subvolume create \"$dirname\""); if (!$rtncode) mkdir($dirname, $permissions, $recursive); else chmod($dirname,$permissions); break; default: