|
19 | 19 | <table class='vboxVertical'> |
20 | 20 | <tr> |
21 | 21 | <th><span class='translateos'>Name:</span></th> |
22 | | - <td colspan='2'><input type='text' class='vboxText' name='vboxSettingsGeneralName' /></td> |
| 22 | + <td colspan='2'><input type='text' class='vboxText' id='vboxSettingsGeneralName' name='vboxSettingsGeneralName' /></td> |
23 | 23 | </tr> |
24 | 24 | <tr> |
25 | 25 | <th><span class='translateos'>Type:</span></th> |
26 | 26 | <td><select name='vboxSettingsGeneralOSFamily' id='vboxSettingsGeneralOSFamily' > |
27 | 27 | <option value='Linux'>Linux</option> |
28 | 28 | </select></td> |
29 | | - <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td> |
| 29 | + <td rowspan='3'><img id='vboxOSTypeImg' name='vboxOSTypeImg' height='32' width='32' /></td> |
| 30 | + </tr> |
| 31 | + <tr> |
| 32 | + <th><span id="vboxSettingsGeneralSubtypeLabel" class='translateos'>Subtype:</span></th> |
| 33 | + <td><select id='vboxSettingsGeneralSubtype' name='vboxSettingsGeneralSubtype'> |
| 34 | + <option value='Debian'>Debian</option> |
| 35 | + </select></td> |
30 | 36 | </tr> |
31 | 37 | <tr> |
32 | 38 | <th><span class='translateos'>Version:</span></th> |
33 | 39 | <td><select id='vboxSettingsGeneralOSType' name='vboxSettingsGeneralOSType'> |
34 | | - <option value='Debian'>Debian</option> |
| 40 | + <option value='Bookworm'>Bookworm</option> |
35 | 41 | </select></td> |
36 | 42 | </tr> |
37 | 43 | <tr id='vboxSettingsRowVMIcon' class='vboxRunningEnabled' style='display:none'> |
|
101 | 107 | </div> |
102 | 108 |
|
103 | 109 | <!-- Encryption Tab --> |
104 | | -<div id='vboxSettingsTabGeneralEncryption' title='Encryption'> |
| 110 | +<div id='vboxSettingsTabGeneralEncryption' title='Disk Encryption'> |
105 | 111 | <table class='vboxVertical'> |
106 | 112 | <tr> |
107 | 113 | <td colspan='2'> |
108 | 114 | <label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsGeneralEncryptionEnable' /> |
109 | | - <span class='translate'>Enable Encryption</span> |
| 115 | + <span class='translate'>Enable Disk Encryption</span> |
110 | 116 | </label> |
111 | 117 | </td> |
112 | 118 | </tr> |
113 | 119 | <tr> |
114 | | - <th><span class='translate'>Encryption Cipher:</span></th> |
| 120 | + <th><span class='translate'>Disk Encryption Cipher:</span></th> |
115 | 121 | <td> |
116 | 122 | <select name='vboxSettingsTabGeneralEncryptionCipher'> |
117 | 123 | <option value=''>Leave Unchanged</option> |
|
187 | 193 | * Hide start / stop config if not enabled |
188 | 194 | */ |
189 | 195 | if(!$('#vboxPane').data('vboxConfig').startStopConfig) { |
190 | | - |
191 | 196 | $('#vboxSettingsTabGeneralBasic').find('tr.vboxStartStopConfig').hide(); |
192 | | - |
193 | 197 | } |
194 | 198 |
|
195 | 199 | /* Custom icons */ |
196 | 200 | if($('#vboxPane').data('vboxConfig').enableCustomIcons) { |
197 | | - |
198 | 201 | $('#vboxSettingsRowVMIcon').css('display',''); |
199 | | - |
200 | 202 | $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).blur(function(){ |
201 | 203 | $('#vboxSettingsGeneralIconImg').attr('src',(this.value ? this.value : 'images/vbox/blank.gif')); |
202 | 204 | }); |
|
206 | 208 | * Called when OS family type changes |
207 | 209 | */ |
208 | 210 | function vboxSettingsUpdateOSList(osfam) { |
209 | | - document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options.length = 0; |
210 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children().remove(); |
211 | | - for(var i = 0; i < vboxSettingsOSTypes[osfam].osTypes.length; i++) { |
212 | | - document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options[i] = new Option(vboxSettingsOSTypes[osfam].osTypes[i].description, vboxSettingsOSTypes[osfam].osTypes[i].id); |
| 211 | + $("#vboxSettingsGeneralOSType").empty(); |
| 212 | + $("#vboxSettingsGeneralSubtype").empty(); |
| 213 | + |
| 214 | + const subTypes = {}; |
| 215 | + for(const osType of vboxSettingsOSTypes[osfam].osTypes) { |
| 216 | + $("#vboxSettingsGeneralOSType").append($('<option />', {text: osType.description, value:osType.id})); |
| 217 | + if(osType.subtype) { |
| 218 | + if(!subTypes[osType.subtype]) { |
| 219 | + subTypes[osType.subtype] = {}; |
| 220 | + $(vboxSettingsGeneralSubtype).append($('<option />', {text:osType.subtype, value:osType.subtype})); |
| 221 | + } |
| 222 | + } |
213 | 223 | } |
| 224 | + // Update subtypes |
| 225 | + $("#vboxSettingsGeneralSubtypeLabel").toggleClass('disabled', $("#vboxSettingsGeneralSubtype").children().length == 0); |
| 226 | + $("#vboxSettingsGeneralSubtype").prop('disabled', $("#vboxSettingsGeneralSubtype").children().length == 0); |
| 227 | + |
214 | 228 | // Update image |
215 | | - document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id); |
| 229 | + $("#vboxOSTypeImg").prop('src', "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id)); |
| 230 | + if(vboxSettingsOSTypes[osfam].osTypes[0].subtype) { |
| 231 | + $("#vboxSettingsGeneralSubtype").val(vboxSettingsOSTypes[osfam].osTypes[0].subtype).change(); |
| 232 | + } |
216 | 233 | } |
217 | 234 |
|
218 | 235 | var vboxSettingsOSTypes = new Array(); |
|
243 | 260 | vboxDefaultOSTypeId = vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length; |
244 | 261 | } |
245 | 262 |
|
246 | | - vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description }; |
| 263 | + vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.push({'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description,'subtype':vboxOSTypes[i].subtype}); |
247 | 264 |
|
248 | 265 | vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i]; |
249 | 266 |
|
|
253 | 270 |
|
254 | 271 | } |
255 | 272 | // clear all options |
256 | | -document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length = 0; |
257 | | -$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children().remove(); |
| 273 | +$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).empty(); |
258 | 274 | for(var i in vboxSettingsOSTypes) { |
259 | 275 | // default os type family? record in dosfam |
260 | 276 | if(i == dosfam) dosfam = document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length; |
261 | 277 | document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options[document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length] = new Option(vboxSettingsOSTypes[i].description, vboxSettingsOSTypes[i].id); |
262 | 278 | } |
263 | 279 | // OnChange, update os type list and icon |
264 | | -document.getElementById('vboxSettingsGeneralOSFamily').setAttribute('onChange','vboxSettingsUpdateOSList(this.value)'); |
265 | | -document.getElementById('vboxSettingsGeneralOSType').setAttribute('onChange','document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(this.value)'); |
266 | | - |
| 280 | +$('#vboxSettingsGeneralOSFamily').on('change',(e) => vboxSettingsUpdateOSList(e.target.value)); |
| 281 | +$('#vboxSettingsGeneralOSType').on('change',(e) => $("#vboxOSTypeImg").prop("src", "images/vbox/" + vboxGuestOSTypeIcon(e.target.value))); |
| 282 | +$('#vboxSettingsGeneralSubtype').on('change', (e) => { |
| 283 | + if(!e.target.value) return; |
| 284 | + $('#vboxSettingsGeneralOSType').empty(); |
| 285 | + for(const osType of vboxSettingsOSTypes[$('#vboxSettingsGeneralOSFamily').val()].osTypes) { |
| 286 | + if(osType.subtype != e.target.value) continue; |
| 287 | + $('#vboxSettingsGeneralOSType').append($('<option />', {value:osType.id, text:osType.description})); |
| 288 | + } |
| 289 | +}); |
267 | 290 |
|
268 | 291 |
|
269 | 292 |
|
270 | 293 | /* Update settings when data is loaded */ |
271 | 294 | $('#vboxSettingsDialog').on('dataLoaded', function(){ |
272 | 295 |
|
273 | | - /* Defaults from machine */ |
274 | | - document.forms['frmVboxSettings'].vboxSettingsGeneralName.value = $('#vboxSettingsDialog').data('vboxMachineData').name; |
275 | | - document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.value = vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId; |
276 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).change(); |
277 | | - document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId; |
278 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).change(); |
279 | 296 | document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value = $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder; |
280 | 297 | document.forms['frmVboxSettings'].vboxSettingsGeneralDescription.innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').description; |
281 | 298 |
|
|
284 | 301 | $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val($('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType); |
285 | 302 | $(document.forms['frmVboxSettings'].vboxSettingsClipboardMode).val($('#vboxSettingsDialog').data('vboxMachineData').ClipboardMode); |
286 | 303 |
|
287 | | - /* OS Type */ |
288 | 304 |
|
289 | | - // shorthand |
290 | | - var vboxOSTypes = $('#vboxPane').data('vboxOSTypes'); |
291 | | - for(var i = 0; i < vboxOSTypes.length; i++) { |
292 | | - if(vboxOSTypes[i].id == $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId) { |
293 | | - // Set the family then os type |
294 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children('[value="'+vboxOSTypes[i].familyId+'"]').prop('selected',true); |
295 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).trigger('change'); |
296 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children('[value="'+vboxOSTypes[i].id+'"]').prop('selected',true); |
297 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).trigger('change'); |
298 | | - break; |
299 | | - } |
300 | | - } |
301 | | - |
302 | 305 | /* Custom icons */ |
303 | 306 | if($('#vboxPane').data('vboxConfig').enableCustomIcons) { |
304 | 307 |
|
|
337 | 340 | $(document.images["vboxOSTypeImg"]).removeClass('vboxDisabled'); |
338 | 341 | } |
339 | 342 |
|
| 343 | + /* OS Type */ |
| 344 | + $("#vboxSettingsGeneralName").val($('#vboxSettingsDialog').data('vboxMachineData').name); |
| 345 | + $("#vboxSettingsGeneralOSFamily").val(vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId).change(); |
| 346 | + if(vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].subtype) { |
| 347 | + $("#vboxSettingsGeneralSubtype").val(vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].subtype).change(); |
| 348 | + } |
| 349 | + $("#vboxSettingsGeneralOSType").val($('#vboxSettingsDialog').data('vboxMachineData').OSTypeId).change(); |
| 350 | + |
| 351 | + |
| 352 | + /* Encrypted media */ |
340 | 353 | /* |
341 | 354 | * This is a poor way to determine extpack installation status, but the web service can't access IExtPackManager :( |
342 | 355 | */ |
343 | | - if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) { |
| 356 | + if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) { |
344 | 357 | $('#vboxSettingsTabGeneralEncryption').parent().tabs('disable', 3); |
345 | 358 | } else { |
346 | 359 | $('#vboxSettingsTabGeneralEncryption').parent().tabs('enable', 3); |
347 | 360 |
|
348 | | - // Encrypted media |
349 | | - var encIds = vboxMedia.getEncryptedMediaIds( |
350 | | - vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData')) |
351 | | - ); |
352 | | - |
353 | | - var lastCipher = null; |
354 | | - var uniqueCiphers = true; |
355 | | - for(var i = 0; i < encIds.length; i++) { |
356 | | - if(lastCipher && (lastCipher != encIds[i].cipher)) { |
357 | | - uniqueCiphers = false; |
358 | | - break; |
359 | | - } |
360 | | - lastCipher = encIds[i].cipher; |
361 | | - } |
362 | | - $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length)) |
363 | | - .triggerHandler('click'); |
364 | | - |
365 | | - if(uniqueCiphers) { |
366 | | - $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher); |
367 | | - } |
368 | | - |
369 | | - $('#vboxSettingsDialog').data('vboxEncSettings', { |
370 | | - enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'), |
371 | | - uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val() |
372 | | - }); |
373 | | - } |
| 361 | + var encIds = vboxMedia.getEncryptedMediaIds( |
| 362 | + vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData')) |
| 363 | + ); |
| 364 | + |
| 365 | + var lastCipher = null; |
| 366 | + var uniqueCiphers = true; |
| 367 | + for(var i = 0; i < encIds.length; i++) { |
| 368 | + if(lastCipher && (lastCipher != encIds[i].cipher)) { |
| 369 | + uniqueCiphers = false; |
| 370 | + break; |
| 371 | + } |
| 372 | + lastCipher = encIds[i].cipher; |
| 373 | + } |
| 374 | + $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length)) |
| 375 | + .triggerHandler('click'); |
| 376 | + |
| 377 | + if(uniqueCiphers) { |
| 378 | + $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher); |
| 379 | + } |
| 380 | + |
| 381 | + $('#vboxSettingsDialog').data('vboxEncSettings', { |
| 382 | + enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'), |
| 383 | + uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val() |
| 384 | + }); |
| 385 | + |
| 386 | + } |
374 | 387 |
|
375 | | - |
376 | 388 | /* Change general settings onSave() */ |
377 | 389 | }).on('save',function(){ |
378 | 390 |
|
|
0 commit comments