457 lines
21 KiB
HTML
457 lines
21 KiB
HTML
<!--
|
|
|
|
General Machine Settings
|
|
Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
|
|
|
|
$Id: settingsGeneral.html 599 2015-07-27 10:40:37Z imoore76 $
|
|
|
|
-->
|
|
<ul>
|
|
<li><a href="#vboxSettingsTabGeneralBasic"><span class='translate'>Basic</span></a></li>
|
|
<li><a href="#vboxSettingsTabGeneralAdvanced"><span class='translate'>Advanced</span></a></li>
|
|
<li><a href="#vboxSettingsTabGeneralDescription"><span class='translate'>Description</span></a></li>
|
|
<li><a href="#vboxSettingsTabGeneralEncryption"><span class='translate'>Encryption</span></a></li>
|
|
<li id='vboxSettingsTabGeneralInputTab'><a href="#vboxSettingsTabGeneralInput"><span class='translate'>Input</span></a></li>
|
|
</ul>
|
|
|
|
<!-- Basic Tab -->
|
|
<div id='vboxSettingsTabGeneralBasic' title='Basic'>
|
|
<table class='vboxVertical'>
|
|
<tr>
|
|
<th><span class='translateos'>Name:</span></th>
|
|
<td colspan='2'><input type='text' class='vboxText' name='vboxSettingsGeneralName' /></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translateos'>Type:</span></th>
|
|
<td><select name='vboxSettingsGeneralOSFamily' id='vboxSettingsGeneralOSFamily' >
|
|
<option value='Linux'>Linux</option>
|
|
</select></td>
|
|
<td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translateos'>Version:</span></th>
|
|
<td><select id='vboxSettingsGeneralOSType' name='vboxSettingsGeneralOSType'>
|
|
<option value='Debian'>Debian</option>
|
|
</select></td>
|
|
</tr>
|
|
<tr id='vboxSettingsRowVMIcon' class='vboxRunningEnabled' style='display:none'>
|
|
<th><span class='translate'>Icon URL:</span></th>
|
|
<td><input name='vboxSettingsGeneralIcon' type='text' class='vboxText' style='width:99%'/></td>
|
|
<td style='text-align:center;'><img src='images/vbox/blank.gif' id='vboxSettingsGeneralIconImg' height='32' width='32' /></td>
|
|
</tr>
|
|
<tr class='vboxStartStopConfig vboxRunningEnabled'>
|
|
<th><span class='translate'>Startup Mode:</span></th>
|
|
<td colspan='2'>
|
|
<select name='vboxStartStopConfigStartup'>
|
|
<option value='auto'>Automatic</option>
|
|
<option value='manual'>Manual</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<!-- Autostart shutdown options -->
|
|
<tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigShutdown'>
|
|
<th><span class='translate'>Shutdown mode:</span></th>
|
|
<td colspan='2'>
|
|
<select name='vboxAutostartConfigShutdownOptions'>
|
|
<option value='Disabled'>Disabled</option>
|
|
<option value='SaveState'>Save State</option>
|
|
<option value='PowerOff'>Power Off</option>
|
|
<option value='AcpiShutdown'>ACPI Shutdown</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<!-- Autostart options -->
|
|
<tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigStartup'>
|
|
<th><span class='translate'>Enable auto-start:</span></th>
|
|
<td colspan='2'>
|
|
<input type='checkbox' class='vboxCheckbox' name='autostartEnabled'/> <span class='translate'>after</span>
|
|
<input type='text' class='vboxText' size='3' name='autostartDelay' style='width: 30px'/>
|
|
<span class='translate'>second(s)</span>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Advanced Tab -->
|
|
<div id='vboxSettingsTabGeneralAdvanced' title='Advanced'>
|
|
<table class='vboxVertical'>
|
|
<tr>
|
|
<th><span class='translate'>Snapshot Folder:</span></th>
|
|
<td class='vboxFileFolderInput'>
|
|
<input type='text' class='vboxText' name='vboxSettingsGeneralSnapshotFolder' /><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
|
|
onClick="vboxSnapshotBrowseFolder(this);" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Description Tab -->
|
|
<div id='vboxSettingsTabGeneralDescription' title='Description'>
|
|
<textarea class='vboxRunningEnabled' rows='16' cols='20' name='vboxSettingsGeneralDescription'></textarea>
|
|
</div>
|
|
|
|
<!-- Encryption Tab -->
|
|
<div id='vboxSettingsTabGeneralEncryption' title='Encryption'>
|
|
<table class='vboxVertical'>
|
|
<tr>
|
|
<td colspan='2'>
|
|
<label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsGeneralEncryptionEnable' />
|
|
<span class='translate'>Enable Encryption</span>
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translate'>Encryption Cipher:</span></th>
|
|
<td>
|
|
<select name='vboxSettingsTabGeneralEncryptionCipher'>
|
|
<option value=''>Leave Unchanged</option>
|
|
<option value='AES-XTS256-PLAIN64'>AES-XTS256-PLAIN64</option>
|
|
<option value='AES-XTS128-PLAIN64'>AES-XTS128-PLAIN64</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translate'>Enter New Password:</span></th>
|
|
<td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword'/></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translate'>Confirm New Password:</span></th>
|
|
<td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword2'/></td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Input Tab -->
|
|
<div id='vboxSettingsTabGeneralInput' title='Input'>
|
|
<table class='vboxVertical'>
|
|
<tr>
|
|
<th><span class='translate'>Keyboard:</span></th>
|
|
<td><select name='vboxSettingsTabGeneralInputKeyboard'>
|
|
<option value='PS2Keyboard'>PS/2 Keyboard</option>
|
|
<option value='USBKeyboard'>USB Keyboard</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class='translate'>Mouse:</span></th>
|
|
<td><select name='vboxSettingsTabGeneralInputMouse'>
|
|
<option value='PS2Mouse'>PS/2 Mouse</option>
|
|
<option value='USBMouse'>USB Mouse</option>
|
|
<option value='USBTablet'>USB Tablet</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<script type='text/javascript'>
|
|
|
|
/* Translations */
|
|
$('#vboxSettingsTabGeneralBasic').find(".translateos").html(function(i,h){return trans(h,'UINameAndSystemEditor');});
|
|
if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
|
|
|
|
// Shutdown options select buttons
|
|
$('#vboxAutostartConfigShutdown').find('option').each(function(i,opt){
|
|
$(opt).text(i == 0 ? trans('Disabled','UIGDetails',null,'details (audio)') : trans($(opt).text(),'UIActionPool'));
|
|
if($(opt).val() == $('#vboxSettingsDialog').data('vboxMachineData').autostopType)
|
|
$(opt).prop('selected', true);
|
|
});
|
|
|
|
} else {
|
|
$('#vboxSettingsTabGeneralBasic .vboxAutostartConfig').empty().remove();
|
|
}
|
|
|
|
$('#vboxSettingsTabGeneralEncryption').find('option').html(function(i,h){ return trans(h, 'UIMachineSettingsGeneral', 'cipher type')});
|
|
|
|
/* Browse for snapshot folder */
|
|
function vboxSnapshotBrowseFolder(btn) {
|
|
vboxFileBrowser($(btn).siblings('input').first().val(),function(f){
|
|
if(f) $(btn).siblings('input').first().val(f);
|
|
},true,trans('Snapshot Folder:','UIMachineSettingsGeneral').replace(':',''));
|
|
}
|
|
|
|
/*
|
|
* Hide start / stop config if not enabled
|
|
*/
|
|
if(!$('#vboxPane').data('vboxConfig').startStopConfig) {
|
|
|
|
$('#vboxSettingsTabGeneralBasic').find('tr.vboxStartStopConfig').hide();
|
|
|
|
}
|
|
|
|
/*
|
|
* Remove input if advancedconfig is not set
|
|
* else set default values
|
|
*/
|
|
if(!$('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
|
|
$('#vboxSettingsTabGeneralInputTab').remove();
|
|
$('#vboxSettingsTabGeneralInput').remove();
|
|
}
|
|
|
|
/* Custom icons */
|
|
if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
|
|
|
|
$('#vboxSettingsRowVMIcon').css('display','');
|
|
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).blur(function(){
|
|
$('#vboxSettingsGeneralIconImg').attr('src',(this.value ? this.value : 'images/vbox/blank.gif'));
|
|
});
|
|
}
|
|
|
|
/*
|
|
* Called when OS family type changes
|
|
*/
|
|
function vboxSettingsUpdateOSList(osfam) {
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options.length = 0;
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children().remove();
|
|
for(var i = 0; i < vboxSettingsOSTypes[osfam].osTypes.length; i++) {
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options[i] = new Option(vboxSettingsOSTypes[osfam].osTypes[i].description, vboxSettingsOSTypes[osfam].osTypes[i].id);
|
|
}
|
|
// Update image
|
|
document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id);
|
|
}
|
|
|
|
var vboxSettingsOSTypes = new Array();
|
|
var vboxSettingsOSTypesObj = {};
|
|
|
|
// shorthand
|
|
var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
|
|
|
|
// Default OS Type set to my fav :) Eventually will move to config.php
|
|
var vboxDefaultOSTypeId = 'Debian';
|
|
|
|
var myOSType = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
|
|
var dosfam = null; // holds defaultostype family id
|
|
for(var i in vboxOSTypes) {
|
|
|
|
// Only ostypes supported by this install
|
|
if(!vboxOSTypes[i].supported && myOSType != vboxOSTypes[i].id) continue;
|
|
|
|
// create array of os family types
|
|
if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
|
|
vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
|
|
}
|
|
|
|
// We're on the default os type, record family id and index number
|
|
// so that we can set it later on
|
|
if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
|
|
dosfam = vboxOSTypes[i].familyId;
|
|
vboxDefaultOSTypeId = vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length;
|
|
}
|
|
|
|
vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
|
|
|
|
vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
|
|
|
|
// Preload icons
|
|
vboxOSTypes[i].icon = new Image();
|
|
vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
|
|
|
|
}
|
|
// clear all options
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length = 0;
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children().remove();
|
|
for(var i in vboxSettingsOSTypes) {
|
|
// default os type family? record in dosfam
|
|
if(i == dosfam) dosfam = document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length;
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options[document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length] = new Option(vboxSettingsOSTypes[i].description, vboxSettingsOSTypes[i].id);
|
|
}
|
|
// OnChange, update os type list and icon
|
|
document.getElementById('vboxSettingsGeneralOSFamily').setAttribute('onChange','vboxSettingsUpdateOSList(this.value)');
|
|
document.getElementById('vboxSettingsGeneralOSType').setAttribute('onChange','document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(this.value)');
|
|
|
|
|
|
|
|
|
|
/* Update settings when data is loaded */
|
|
$('#vboxSettingsDialog').on('dataLoaded', function(){
|
|
|
|
/* Defaults from machine */
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralName.value = $('#vboxSettingsDialog').data('vboxMachineData').name;
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.value = vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId;
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).change();
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).change();
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value = $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder;
|
|
document.forms['frmVboxSettings'].vboxSettingsGeneralDescription.innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').description;
|
|
|
|
/* Advanced config options */
|
|
if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
|
|
$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val($('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType);
|
|
$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val($('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType);
|
|
}
|
|
|
|
/* OS Type */
|
|
|
|
// shorthand
|
|
var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
|
|
for(var i = 0; i < vboxOSTypes.length; i++) {
|
|
if(vboxOSTypes[i].id == $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId) {
|
|
// Set the family then os type
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children('[value="'+vboxOSTypes[i].familyId+'"]').prop('selected',true);
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).trigger('change');
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children('[value="'+vboxOSTypes[i].id+'"]').prop('selected',true);
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).trigger('change');
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* Custom icons */
|
|
if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
|
|
|
|
if($('#vboxSettingsDialog').data('vboxMachineData').customIcon) {
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val($('#vboxSettingsDialog').data('vboxMachineData').customIcon);
|
|
$('#vboxSettingsGeneralIconImg').attr('src',$('#vboxSettingsDialog').data('vboxMachineData').customIcon);
|
|
} else {
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val('');
|
|
$('#vboxSettingsGeneralIconImg').attr('src','images/vbox/blank.gif');
|
|
}
|
|
|
|
}
|
|
|
|
/* Autostart options */
|
|
if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
|
|
document.forms['frmVboxSettings'].autostartEnabled.checked = ($('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled);
|
|
document.forms['frmVboxSettings'].autostartDelay.value = $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay;
|
|
}
|
|
|
|
/* Start / stop config */
|
|
if($('#vboxPane').data('vboxConfig').startStopConfig) {
|
|
document.forms['frmVboxSettings'].vboxStartStopConfigStartup.selectedIndex = ($('#vboxSettingsDialog').data('vboxMachineData').startupMode == 'auto' ? 0 : 1);
|
|
}
|
|
|
|
/* Settings that are disabled / enabled depending on if VM is mutable */
|
|
var p = $('#vboxSettingsTabGeneralBasic').parent().children('div');
|
|
if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
|
|
$(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
|
|
$(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
|
|
$('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_disabled_16px.png)');
|
|
$(document.images["vboxOSTypeImg"]).addClass('vboxDisabled');
|
|
} else {
|
|
$(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
|
|
$(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
|
|
$('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_16px.png)');
|
|
$(document.images["vboxOSTypeImg"]).removeClass('vboxDisabled');
|
|
}
|
|
|
|
/*
|
|
* This is a poor way to determine extpack installation status, but the web service can't access IExtPackManager :(
|
|
*/
|
|
if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
|
|
$('#vboxSettingsTabGeneralEncryption').parent().tabs('disable', 3);
|
|
} else {
|
|
$('#vboxSettingsTabGeneralEncryption').parent().tabs('enable', 3);
|
|
|
|
// Encrypted media
|
|
var encIds = vboxMedia.getEncryptedMediaIds(
|
|
vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData'))
|
|
);
|
|
|
|
var lastCipher = null;
|
|
var uniqueCiphers = true;
|
|
for(var i = 0; i < encIds.length; i++) {
|
|
if(lastCipher && (lastCipher != encIds[i].cipher)) {
|
|
uniqueCiphers = false;
|
|
break;
|
|
}
|
|
lastCipher = encIds[i].cipher;
|
|
}
|
|
$(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length))
|
|
.triggerHandler('click');
|
|
|
|
if(uniqueCiphers) {
|
|
$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher);
|
|
}
|
|
|
|
$('#vboxSettingsDialog').data('vboxEncSettings', {
|
|
enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'),
|
|
uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()
|
|
});
|
|
}
|
|
|
|
|
|
/* Change general settings onSave() */
|
|
}).on('save',function(){
|
|
|
|
// Start / stop config
|
|
if($('#vboxPane').data('vboxConfig').startStopConfig) {
|
|
$('#vboxSettingsDialog').data('vboxMachineData').startupMode = document.forms['frmVboxSettings'].vboxStartStopConfigStartup.value;
|
|
}
|
|
|
|
// VirtualBox style start / stop config
|
|
if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
|
|
|
|
$('#vboxSettingsDialog').data('vboxMachineData').autostopType = document.forms['frmVboxSettings'].vboxAutostartConfigShutdownOptions.value;
|
|
$('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled = document.forms['frmVboxSettings'].autostartEnabled.checked;
|
|
if(isNaN(document.forms['frmVboxSettings'].autostartDelay.value))
|
|
document.forms['frmVboxSettings'].autostartDelay.value = 0;
|
|
$('#vboxSettingsDialog').data('vboxMachineData').autostartDelay = parseInt(document.forms['frmVboxSettings'].autostartDelay.value);
|
|
|
|
|
|
}
|
|
|
|
if(jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value))
|
|
$('#vboxSettingsDialog').data('vboxMachineData').name = jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value);
|
|
|
|
$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId = document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value;
|
|
$('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder = document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value;
|
|
$('#vboxSettingsDialog').data('vboxMachineData').description = $(document.forms['frmVboxSettings'].vboxSettingsGeneralDescription).val();
|
|
|
|
if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
|
|
$('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val();
|
|
$('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val();
|
|
}
|
|
|
|
if($('#vboxPane').data('vboxConfig').enableCustomIcons)
|
|
$('#vboxSettingsDialog').data('vboxMachineData').customIcon = $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val();
|
|
|
|
var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
|
|
if(encSettings) {
|
|
var encSettingsChanged = (encSettings.enabled != $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) ||
|
|
(encSettings.uniqueCiphers != $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) ||
|
|
$(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val().length > 0;
|
|
|
|
if(!encSettings.enabled && !$(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'))
|
|
encSettingsChanged = false;
|
|
|
|
$('#vboxSettingsDialog').data('vboxEncSettingsChanged', encSettingsChanged);
|
|
$('#vboxSettingsDialog').data('vboxEncEnabled', $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'));
|
|
$('#vboxSettingsDialog').data('vboxEncCipher', $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val());
|
|
$('#vboxSettingsDialog').data('vboxEncPw', $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val());
|
|
} else {
|
|
$('#vboxSettingsDialog').data('vboxEncSettingsChanged', false);
|
|
}
|
|
|
|
});
|
|
|
|
function vboxSettingsGeneralValidate() {
|
|
|
|
var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
|
|
|
|
// Going from disabled to enabled
|
|
if(!encSettings.enabled && $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
|
|
|
|
if(!$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) {
|
|
vboxAlert(trans("Encryption cipher type not specified.", 'UIMachineSettingsGeneral'));
|
|
return false;
|
|
} else if(!$(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val()) {
|
|
vboxAlert(trans("Encryption password empty.", 'UIMachineSettingsGeneral'));
|
|
return false;
|
|
} else if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
|
|
vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
|
|
return false;
|
|
}
|
|
|
|
// If enabled and poasswords don't match
|
|
} else if($(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
|
|
if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
|
|
vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
</script>
|
|
|