Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

settingsGeneral.html 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <!--
  2. General Machine Settings
  3. Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
  4. $Id: settingsGeneral.html 599 2015-07-27 10:40:37Z imoore76 $
  5. -->
  6. <ul>
  7. <li><a href="#vboxSettingsTabGeneralBasic"><span class='translate'>Basic</span></a></li>
  8. <li><a href="#vboxSettingsTabGeneralAdvanced"><span class='translate'>Advanced</span></a></li>
  9. <li><a href="#vboxSettingsTabGeneralDescription"><span class='translate'>Description</span></a></li>
  10. <li><a href="#vboxSettingsTabGeneralEncryption"><span class='translate'>Encryption</span></a></li>
  11. <li id='vboxSettingsTabGeneralInputTab'><a href="#vboxSettingsTabGeneralInput"><span class='translateinputtab'>Input</span></a></li>
  12. </ul>
  13. <!-- Basic Tab -->
  14. <div id='vboxSettingsTabGeneralBasic' title='Basic'>
  15. <table class='vboxVertical'>
  16. <tr>
  17. <th><span class='translateos'>Name:</span></th>
  18. <td colspan='2'><input type='text' class='vboxText' name='vboxSettingsGeneralName' /></td>
  19. </tr>
  20. <tr>
  21. <th><span class='translateos'>Type:</span></th>
  22. <td><select name='vboxSettingsGeneralOSFamily' id='vboxSettingsGeneralOSFamily' >
  23. <option value='Linux'>Linux</option>
  24. </select></td>
  25. <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
  26. </tr>
  27. <tr>
  28. <th><span class='translateos'>Version:</span></th>
  29. <td><select id='vboxSettingsGeneralOSType' name='vboxSettingsGeneralOSType'>
  30. <option value='Debian'>Debian</option>
  31. </select></td>
  32. </tr>
  33. <tr id='vboxSettingsRowVMIcon' class='vboxRunningEnabled' style='display:none'>
  34. <th><span class='translate'>Icon URL:</span></th>
  35. <td><input name='vboxSettingsGeneralIcon' type='text' class='vboxText' style='width:99%'/></td>
  36. <td style='text-align:center;'><img src='images/vbox/blank.gif' id='vboxSettingsGeneralIconImg' height='32' width='32' /></td>
  37. </tr>
  38. <tr class='vboxStartStopConfig vboxRunningEnabled'>
  39. <th><span class='translate'>Startup Mode:</span></th>
  40. <td colspan='2'>
  41. <select name='vboxStartStopConfigStartup'>
  42. <option value='auto'>Automatic</option>
  43. <option value='manual'>Manual</option>
  44. </select>
  45. </td>
  46. </tr>
  47. <!-- Autostart shutdown options -->
  48. <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigShutdown'>
  49. <th><span class='translate'>Shutdown mode:</span></th>
  50. <td colspan='2'>
  51. <select name='vboxAutostartConfigShutdownOptions'>
  52. <option value='Disabled'>Disabled</option>
  53. <option value='SaveState'>Save State</option>
  54. <option value='PowerOff'>Power Off</option>
  55. <option value='AcpiShutdown'>ACPI Shutdown</option>
  56. </select>
  57. </td>
  58. </tr>
  59. <!-- Autostart options -->
  60. <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigStartup'>
  61. <th><span class='translate'>Enable auto-start:</span></th>
  62. <td colspan='2'>
  63. <input type='checkbox' class='vboxCheckbox' name='autostartEnabled'/> <span class='translate'>after</span>
  64. <input type='text' class='vboxText' size='3' name='autostartDelay' style='width: 30px'/>
  65. <span class='translate'>second(s)</span>
  66. </td>
  67. </tr>
  68. </table>
  69. </div>
  70. <!-- Advanced Tab -->
  71. <div id='vboxSettingsTabGeneralAdvanced' title='Advanced'>
  72. <table class='vboxVertical'>
  73. <tr>
  74. <th><span class='translate'>Snapshot Folder:</span></th>
  75. <td class='vboxFileFolderInput'>
  76. <input type='text' class='vboxText' name='vboxSettingsGeneralSnapshotFolder' /><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
  77. onClick="vboxSnapshotBrowseFolder(this);" />
  78. </td>
  79. </tr>
  80. </table>
  81. </div>
  82. <!-- Description Tab -->
  83. <div id='vboxSettingsTabGeneralDescription' title='Description'>
  84. <textarea class='vboxRunningEnabled' rows='16' cols='20' name='vboxSettingsGeneralDescription'></textarea>
  85. </div>
  86. <!-- Encryption Tab -->
  87. <div id='vboxSettingsTabGeneralEncryption' title='Encryption'>
  88. <table class='vboxVertical'>
  89. <tr>
  90. <td colspan='2'>
  91. <label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsGeneralEncryptionEnable' />
  92. <span class='translate'>Enable Encryption</span>
  93. </label>
  94. </td>
  95. </tr>
  96. <tr>
  97. <th><span class='translate'>Encryption Cipher:</span></th>
  98. <td>
  99. <select name='vboxSettingsTabGeneralEncryptionCipher'>
  100. <option value=''>Leave Unchanged</option>
  101. <option value='AES-XTS256-PLAIN64'>AES-XTS256-PLAIN64</option>
  102. <option value='AES-XTS128-PLAIN64'>AES-XTS128-PLAIN64</option>
  103. </select>
  104. </td>
  105. </tr>
  106. <tr>
  107. <th><span class='translate'>Enter New Password:</span></th>
  108. <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword'/></td>
  109. </tr>
  110. <tr>
  111. <th><span class='translate'>Confirm New Password:</span></th>
  112. <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword2'/></td>
  113. </tr>
  114. </table>
  115. </div>
  116. <!-- Input Tab -->
  117. <div id='vboxSettingsTabGeneralInput' title='Input'>
  118. <table class='vboxVertical'>
  119. <tr>
  120. <th><span class='translateinput'>Keyboard</span><span> :</span></th>
  121. <td><select name='vboxSettingsTabGeneralInputKeyboard'>
  122. <option value='PS2Keyboard'>PS/2 Keyboard</option>
  123. <option value='USBKeyboard'>USB Keyboard</option>
  124. </select>
  125. </td>
  126. </tr>
  127. <tr>
  128. <th><span class='translateinput'>Mouse</span><span> :</span></th>
  129. <td><select name='vboxSettingsTabGeneralInputMouse'>
  130. <option value='PS2Mouse'>PS/2 Mouse</option>
  131. <option value='USBMouse'>USB Mouse</option>
  132. <option value='USBTablet'>USB Tablet</option>
  133. </select>
  134. </td>
  135. </tr>
  136. </table>
  137. </div>
  138. <script type='text/javascript'>
  139. /* Translations */
  140. $('#vboxSettingsTabGeneralInput').find(".translateinput").html(function(i,h){return trans(h,'UIActionPool');});
  141. $('#vboxSettingsTabGeneralInputTab').find(".translateinputtab").html(function(i,h){return trans(h,'UISettingsDialogGlobal');});
  142. $('#vboxSettingsTabGeneralBasic').find(".translateos").html(function(i,h){return trans(h,'UINameAndSystemEditor');});
  143. if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
  144. // Shutdown options select buttons
  145. $('#vboxAutostartConfigShutdown').find('option').each(function(i,opt){
  146. $(opt).text(i == 0 ? trans('Disabled','UIGDetails',null,'details (audio)') : trans($(opt).text(),'UIActionPool'));
  147. if($(opt).val() == $('#vboxSettingsDialog').data('vboxMachineData').autostopType)
  148. $(opt).prop('selected', true);
  149. });
  150. } else {
  151. $('#vboxSettingsTabGeneralBasic .vboxAutostartConfig').empty().remove();
  152. }
  153. $('#vboxSettingsTabGeneralEncryption').find('option').html(function(i,h){ return trans(h, 'UIMachineSettingsGeneral', 'cipher type')});
  154. $('#vboxSettingsTabGeneralInput').find('option').html(function(i,h){ return trans(h, 'VBoxGlobal')});
  155. /* Browse for snapshot folder */
  156. function vboxSnapshotBrowseFolder(btn) {
  157. vboxFileBrowser($(btn).siblings('input').first().val(),function(f){
  158. if(f) $(btn).siblings('input').first().val(f);
  159. },true,trans('Snapshot Folder:','UIMachineSettingsGeneral').replace(':',''));
  160. }
  161. /*
  162. * Hide start / stop config if not enabled
  163. */
  164. if(!$('#vboxPane').data('vboxConfig').startStopConfig) {
  165. $('#vboxSettingsTabGeneralBasic').find('tr.vboxStartStopConfig').hide();
  166. }
  167. /* Custom icons */
  168. if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
  169. $('#vboxSettingsRowVMIcon').css('display','');
  170. $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).blur(function(){
  171. $('#vboxSettingsGeneralIconImg').attr('src',(this.value ? this.value : 'images/vbox/blank.gif'));
  172. });
  173. }
  174. /*
  175. * Called when OS family type changes
  176. */
  177. function vboxSettingsUpdateOSList(osfam) {
  178. document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options.length = 0;
  179. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children().remove();
  180. for(var i = 0; i < vboxSettingsOSTypes[osfam].osTypes.length; i++) {
  181. document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options[i] = new Option(vboxSettingsOSTypes[osfam].osTypes[i].description, vboxSettingsOSTypes[osfam].osTypes[i].id);
  182. }
  183. // Update image
  184. document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id);
  185. }
  186. var vboxSettingsOSTypes = new Array();
  187. var vboxSettingsOSTypesObj = {};
  188. // shorthand
  189. var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
  190. // Default OS Type set to my fav :) Eventually will move to config.php
  191. var vboxDefaultOSTypeId = 'Debian';
  192. var myOSType = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
  193. var dosfam = null; // holds defaultostype family id
  194. for(var i in vboxOSTypes) {
  195. // Only ostypes supported by this install
  196. if(!vboxOSTypes[i].supported && myOSType != vboxOSTypes[i].id) continue;
  197. // create array of os family types
  198. if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
  199. vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
  200. }
  201. // We're on the default os type, record family id and index number
  202. // so that we can set it later on
  203. if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
  204. dosfam = vboxOSTypes[i].familyId;
  205. vboxDefaultOSTypeId = vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length;
  206. }
  207. vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
  208. vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
  209. // Preload icons
  210. vboxOSTypes[i].icon = new Image();
  211. vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
  212. }
  213. // clear all options
  214. document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length = 0;
  215. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children().remove();
  216. for(var i in vboxSettingsOSTypes) {
  217. // default os type family? record in dosfam
  218. if(i == dosfam) dosfam = document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length;
  219. document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options[document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length] = new Option(vboxSettingsOSTypes[i].description, vboxSettingsOSTypes[i].id);
  220. }
  221. // OnChange, update os type list and icon
  222. document.getElementById('vboxSettingsGeneralOSFamily').setAttribute('onChange','vboxSettingsUpdateOSList(this.value)');
  223. document.getElementById('vboxSettingsGeneralOSType').setAttribute('onChange','document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(this.value)');
  224. /* Update settings when data is loaded */
  225. $('#vboxSettingsDialog').on('dataLoaded', function(){
  226. /* Defaults from machine */
  227. document.forms['frmVboxSettings'].vboxSettingsGeneralName.value = $('#vboxSettingsDialog').data('vboxMachineData').name;
  228. document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.value = vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId;
  229. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).change();
  230. document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
  231. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).change();
  232. document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value = $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder;
  233. document.forms['frmVboxSettings'].vboxSettingsGeneralDescription.innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').description;
  234. /* Advanced config options */
  235. $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val($('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType);
  236. $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val($('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType);
  237. /* OS Type */
  238. // shorthand
  239. var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
  240. for(var i = 0; i < vboxOSTypes.length; i++) {
  241. if(vboxOSTypes[i].id == $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId) {
  242. // Set the family then os type
  243. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children('[value="'+vboxOSTypes[i].familyId+'"]').prop('selected',true);
  244. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).trigger('change');
  245. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children('[value="'+vboxOSTypes[i].id+'"]').prop('selected',true);
  246. $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).trigger('change');
  247. break;
  248. }
  249. }
  250. /* Custom icons */
  251. if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
  252. if($('#vboxSettingsDialog').data('vboxMachineData').customIcon) {
  253. $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val($('#vboxSettingsDialog').data('vboxMachineData').customIcon);
  254. $('#vboxSettingsGeneralIconImg').attr('src',$('#vboxSettingsDialog').data('vboxMachineData').customIcon);
  255. } else {
  256. $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val('');
  257. $('#vboxSettingsGeneralIconImg').attr('src','images/vbox/blank.gif');
  258. }
  259. }
  260. /* Autostart options */
  261. if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
  262. document.forms['frmVboxSettings'].autostartEnabled.checked = ($('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled);
  263. document.forms['frmVboxSettings'].autostartDelay.value = $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay;
  264. }
  265. /* Start / stop config */
  266. if($('#vboxPane').data('vboxConfig').startStopConfig) {
  267. document.forms['frmVboxSettings'].vboxStartStopConfigStartup.selectedIndex = ($('#vboxSettingsDialog').data('vboxMachineData').startupMode == 'auto' ? 0 : 1);
  268. }
  269. /* Settings that are disabled / enabled depending on if VM is mutable */
  270. var p = $('#vboxSettingsTabGeneralBasic').parent().children('div');
  271. if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
  272. $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
  273. $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
  274. $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_disabled_16px.png)');
  275. $(document.images["vboxOSTypeImg"]).addClass('vboxDisabled');
  276. } else {
  277. $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
  278. $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
  279. $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_16px.png)');
  280. $(document.images["vboxOSTypeImg"]).removeClass('vboxDisabled');
  281. }
  282. /*
  283. * This is a poor way to determine extpack installation status, but the web service can't access IExtPackManager :(
  284. */
  285. if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
  286. $('#vboxSettingsTabGeneralEncryption').parent().tabs('disable', 3);
  287. } else {
  288. $('#vboxSettingsTabGeneralEncryption').parent().tabs('enable', 3);
  289. // Encrypted media
  290. var encIds = vboxMedia.getEncryptedMediaIds(
  291. vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData'))
  292. );
  293. var lastCipher = null;
  294. var uniqueCiphers = true;
  295. for(var i = 0; i < encIds.length; i++) {
  296. if(lastCipher && (lastCipher != encIds[i].cipher)) {
  297. uniqueCiphers = false;
  298. break;
  299. }
  300. lastCipher = encIds[i].cipher;
  301. }
  302. $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length))
  303. .triggerHandler('click');
  304. if(uniqueCiphers) {
  305. $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher);
  306. }
  307. $('#vboxSettingsDialog').data('vboxEncSettings', {
  308. enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'),
  309. uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()
  310. });
  311. }
  312. /* Change general settings onSave() */
  313. }).on('save',function(){
  314. // Start / stop config
  315. if($('#vboxPane').data('vboxConfig').startStopConfig) {
  316. $('#vboxSettingsDialog').data('vboxMachineData').startupMode = document.forms['frmVboxSettings'].vboxStartStopConfigStartup.value;
  317. }
  318. // VirtualBox style start / stop config
  319. if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
  320. $('#vboxSettingsDialog').data('vboxMachineData').autostopType = document.forms['frmVboxSettings'].vboxAutostartConfigShutdownOptions.value;
  321. $('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled = document.forms['frmVboxSettings'].autostartEnabled.checked;
  322. if(isNaN(document.forms['frmVboxSettings'].autostartDelay.value))
  323. document.forms['frmVboxSettings'].autostartDelay.value = 0;
  324. $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay = parseInt(document.forms['frmVboxSettings'].autostartDelay.value);
  325. }
  326. if(jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value))
  327. $('#vboxSettingsDialog').data('vboxMachineData').name = jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value);
  328. $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId = document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value;
  329. $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder = document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value;
  330. $('#vboxSettingsDialog').data('vboxMachineData').description = $(document.forms['frmVboxSettings'].vboxSettingsGeneralDescription).val();
  331. $('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val();
  332. $('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val();
  333. if($('#vboxPane').data('vboxConfig').enableCustomIcons)
  334. $('#vboxSettingsDialog').data('vboxMachineData').customIcon = $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val();
  335. var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
  336. if(encSettings) {
  337. var encSettingsChanged = (encSettings.enabled != $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) ||
  338. (encSettings.uniqueCiphers != $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) ||
  339. $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val().length > 0;
  340. if(!encSettings.enabled && !$(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'))
  341. encSettingsChanged = false;
  342. $('#vboxSettingsDialog').data('vboxEncSettingsChanged', encSettingsChanged);
  343. $('#vboxSettingsDialog').data('vboxEncEnabled', $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'));
  344. $('#vboxSettingsDialog').data('vboxEncCipher', $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val());
  345. $('#vboxSettingsDialog').data('vboxEncPw', $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val());
  346. } else {
  347. $('#vboxSettingsDialog').data('vboxEncSettingsChanged', false);
  348. }
  349. });
  350. function vboxSettingsGeneralValidate() {
  351. var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
  352. // Going from disabled to enabled
  353. if(!encSettings.enabled && $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
  354. if(!$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) {
  355. vboxAlert(trans("Encryption cipher type not specified.", 'UIMachineSettingsGeneral'));
  356. return false;
  357. } else if(!$(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val()) {
  358. vboxAlert(trans("Encryption password empty.", 'UIMachineSettingsGeneral'));
  359. return false;
  360. } else if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
  361. vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
  362. return false;
  363. }
  364. // If enabled and poasswords don't match
  365. } else if($(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
  366. if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
  367. vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
  368. return false;
  369. }
  370. }
  371. return true;
  372. }
  373. </script>