Merge pull request #1190 from SimonFair/Remove-boot-orders-if-usb-boot-selected-

Add Boot Order field clear if USB Boot selected.
This commit is contained in:
tom mortensen
2022-11-02 07:23:42 -07:00
committed by GitHub
3 changed files with 49 additions and 13 deletions

View File

@@ -452,7 +452,7 @@
?>
<span id="USBBoottext" class="advanced" <?=$usbboothidden?>>_(Enable USB boot)_:</span>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?>>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?> onchange="USBBootChange(this)">
<?
echo mk_option($arrConfig['domain']['usbboot'], 'No', 'No');
echo mk_option($arrConfig['domain']['usbboot'], 'Yes', 'Yes');
@@ -540,7 +540,7 @@
<?mk_dropdown_options($arrValidCdromBuses, $arrConfig['media']['cdrombus']);?>
</select>
_(Boot Order)_:
<input type="number" size="5" maxlength="5" id="cdboot" class="narrow" style="width: 50px;" name="media[cdromboot]" title="_(Boot order)_" value="<?=$arrConfig['media']['cdromboot']?>" >
<input type="number" size="5" maxlength="5" id="cdboot" class="narrow bootorder" style="width: 50px;" name="media[cdromboot]" title="_(Boot order)_" value="<?=$arrConfig['media']['cdromboot']?>" >
</td>
</td>
</tr>
@@ -690,7 +690,7 @@
<?mk_dropdown_options($arrValidDiskBuses, $arrDisk['bus']);?>
</select>
_(Boot Order)_:
<input type="number" size="5" maxlength="5" id="disk[<?=$i?>][boot]" class="narrow" style="width: 50px;" name="disk[<?=$i?>][boot]" title="_(Boot order)_" value="<?=$arrDisk['boot']?>" >
<input type="number" size="5" maxlength="5" id="disk[<?=$i?>][boot]" class="narrow bootorder" style="width: 50px;" name="disk[<?=$i?>][boot]" title="_(Boot order)_" value="<?=$arrDisk['boot']?>" >
</td>
</tr>
</table>
@@ -819,7 +819,7 @@
</select>
_(Boot Order)_:
<input type="number" size="5" maxlength="5" id="disk[{{INDEX}}][boot]" class="narrow" style="width: 50px;" name="disk[{{INDEX}}][boot]" title="_(Boot order)_" value="" >
<input type="number" size="5" maxlength="5" id="disk[{{INDEX}}][boot]" class="narrow bootorder" style="width: 50px;" name="disk[{{INDEX}}][boot]" title="_(Boot order)_" value="" >
</td>
</tr>
</table>
@@ -1247,7 +1247,7 @@
?>
<label for="usb<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="usb[]" id="usb<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if (count(array_filter($arrConfig['usb'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) echo 'checked="checked"';?>
/> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="checkbox" name="usbopt[<?=htmlspecialchars($arrDev['id'])?>]" id="usbopt<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if ($arrDev["startupPolicy"] =="optional") echo 'checked="checked"';?>/>&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<?=htmlspecialchars($arrDev['name'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1290,7 +1290,7 @@
$intAvailableOtherPCIDevices++;
?>
<label for="pci<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="pci[]" id="pci<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?=$extra?>/> &nbsp
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<?=htmlspecialchars($arrDev['name'])?> | <?=htmlspecialchars($arrDev['type'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1403,6 +1403,18 @@ function BIOSChange(bios) {
}
}
function USBBootChange(usbboot) {
// Remove all boot orders if changed to Yes
var value = usbboot.value ;
var elements = document.getElementsByClassName("bootorder");
for(var i = 0; i < elements.length; i++) {
if (value == "Yes") {
elements[i].value = "";
elements[i].setAttribute("disabled","disabled");
} else elements[i].removeAttribute("disabled");
}
}
function AutoportChange(autoport) {
if (autoport.value == "yes") {
document.getElementById("port").style.visibility="hidden";

View File

@@ -672,7 +672,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
?>
<span id="USBBoottext" class="advanced" <?=$usbboothidden?>>_(Enable USB boot)_:</span>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?>>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?> onchange="USBBootChange(this)">
<?
echo mk_option($arrConfig['domain']['usbboot'], 'No', 'No');
echo mk_option($arrConfig['domain']['usbboot'], 'Yes', 'Yes');
@@ -1014,7 +1014,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
?>
<label for="usb<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="usb[]" id="usb<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if (count(array_filter($arrConfig['usb'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) echo 'checked="checked"';?>
/> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="checkbox" name="usbopt[<?=htmlspecialchars($arrDev['id'])?>]]" id="usbopt<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if ($arrDev["startupPolicy"] =="optional") echo 'checked="checked"';?>/>&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<?=htmlspecialchars($arrDev['name'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1057,7 +1057,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
$intAvailableOtherPCIDevices++;
?>
<label for="pci<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="pci[]" id="pci<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?=$extra?>/> &nbsp
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<?=htmlspecialchars($arrDev['name'])?> | <?=htmlspecialchars($arrDev['type'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1136,7 +1136,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
<script src="<?autov('/plugins/dynamix.vm.manager/scripts/codemirror/mode/xml/xml.js')?>"></script>
<script type="text/javascript">
function BIOSChange(bios) {
function BIOSChange(bios) {
var value = bios.value;
if (value == "0") {
document.getElementById("USBBoottext").style.visibility="hidden";
@@ -1149,6 +1149,18 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
}
}
function USBBootChange(usbboot) {
// Remove all boot orders if changed to Yes
var value = usbboot.value ;
var elements = document.getElementsByClassName("bootorder");
for(var i = 0; i < elements.length; i++) {
if (value == "Yes") {
elements[i].value = "";
elements[i].setAttribute("disabled","disabled");
} else elements[i].removeAttribute("disabled");
}
}
function AutoportChange(autoport) {
if (autoport.value == "yes") {
document.getElementById("port").style.visibility="hidden";

View File

@@ -671,7 +671,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
?>
<span id="USBBoottext" class="advanced" <?=$usbboothidden?>>_(Enable USB boot)_:</span>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?>>
<select name="domain[usbboot]" id="domain_usbboot" class="narrow" title="_(define OS boot options" <?=$usbboothidden?> onchange="USBBootChange(this)">
<?
echo mk_option($arrConfig['domain']['usbboot'], 'No', 'No');
echo mk_option($arrConfig['domain']['usbboot'], 'Yes', 'Yes');
@@ -1008,7 +1008,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
?>
<label for="usb<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="usb[]" id="usb<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if (count(array_filter($arrConfig['usb'], function($arr) use ($arrDev) { return ($arr['id'] == $arrDev['id']); }))) echo 'checked="checked"';?>
/> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <input type="checkbox" name="usbopt[<?=htmlspecialchars($arrDev['id'])?>]]" id="usbopt<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?if ($arrDev["startupPolicy"] =="optional") echo 'checked="checked"';?>/>&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<input type="number" size="5" maxlength="5" id="usbboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="usbboot[<?=htmlspecialchars($arrDev['id'])?>]]" title="_(Boot order)_" value="<?=$arrDev['usbboot']?>" >
<?=htmlspecialchars($arrDev['name'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1051,7 +1051,7 @@ $hdrXML = "<?xml version='1.0' encoding='UTF-8'?>\n"; // XML encoding declaratio
$intAvailableOtherPCIDevices++;
?>
<label for="pci<?=$i?>">&nbsp&nbsp&nbsp&nbsp<input type="checkbox" name="pci[]" id="pci<?=$i?>" value="<?=htmlspecialchars($arrDev['id'])?>" <?=$extra?>/> &nbsp
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<input type="number" size="5" maxlength="5" id="pciboot<?=$i?>" class="narrow bootorder" <?=$bootdisable?> style="width: 50px;" name="pciboot[<?=htmlspecialchars($arrDev['id'])?>]" title="_(Boot order)_" value="<?=$pciboot?>" >
<?=htmlspecialchars($arrDev['name'])?> | <?=htmlspecialchars($arrDev['type'])?> (<?=htmlspecialchars($arrDev['id'])?>)</label><br/>
<?
}
@@ -1143,6 +1143,18 @@ function BIOSChange(bios) {
}
}
function USBBootChange(usbboot) {
// Remove all boot orders if changed to Yes
var value = usbboot.value ;
var elements = document.getElementsByClassName("bootorder");
for(var i = 0; i < elements.length; i++) {
if (value == "Yes") {
elements[i].value = "";
elements[i].setAttribute("disabled","disabled");
} else elements[i].removeAttribute("disabled");
}
}
function AutoportChange(autoport) {
if (autoport.value == "yes") {
document.getElementById("port").style.visibility="hidden";