From efd598c8f8dfc97c0656b2c6d773e212be820176 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sat, 25 May 2024 19:56:43 +0100 Subject: [PATCH] Fix templates broken by evdevs. --- .../include/libvirt_helpers.php | 12 ++++++++- .../templates/Custom.form.php | 26 +++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) 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..c8086651b 100644 --- a/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php +++ b/emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php @@ -1627,15 +1627,7 @@
- if ( $arrConfig['evdev'] == false) { - - $evdevxml = " -