Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

wizardCopyHDAdvanced.html 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!--
  2. Advanced panes for copy hard disk wizard. Logic in vboxWizard()
  3. Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
  4. $Id: wizardCopyHDAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
  5. -->
  6. <!-- Step 1 -->
  7. <div id='wizardCopyHDStep1' style='display: none'>
  8. <span class='vboxTableLabel translate'>Hard disk to copy</span>
  9. <div class='vboxOptions'>
  10. <table class='vboxOptions'>
  11. <tr style='vertical-align: top;'>
  12. <td><select id="copyHDDiskSelectId" name="copyHDDiskSelect" onchange='wizardCopyHDUpdateName(this)'></select></td>
  13. <td style='width:1%' id='newVMDiskVMM'></td>
  14. </tr>
  15. </table>
  16. </div>
  17. <span class='vboxTableLabel translate'>New hard disk to create</span>
  18. <div class='vboxOptions'>
  19. <table class='vboxOptions'>
  20. <tr>
  21. <td style='width: 100%; white-space: nowrap'>
  22. <input type='text' class='vboxText' name='wizardCopyHDLocation' style='width: 100%'/>
  23. </td>
  24. <td style='width: 1%;' id='newVMDiskVMMDest'></td>
  25. </tr>
  26. </table>
  27. </div>
  28. <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px;'>
  29. <tr style='vertical-align: top'>
  30. <td>
  31. <span class='vboxTableLabel translate'>Hard disk file type</span>
  32. <div class='vboxOptions'>
  33. <table class='vboxOptions vboxNewHDWizardFileTypes'>
  34. <tr style='vertical-align: top;'>
  35. <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskFileType' value='vdi' /> <span class='translate'>VDI (VirtualBox Disk Image)</span></label></td>
  36. </tr>
  37. <tr style='vertical-align: top;'>
  38. <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vmdk' /> <span class='translate'>VMDK (Virtual Machine Disk)</span></label></td>
  39. </tr>
  40. <tr style='vertical-align: top;'>
  41. <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vhd' /> <span class='translate'>VHD (Virtual Hard Disk)</span></label></td>
  42. </tr>
  43. </table>
  44. </div>
  45. </td>
  46. <td>
  47. <span class='vboxTableLabel translate'>Storage on physical hard disk</span>
  48. <div class='vboxOptions'>
  49. <table class='vboxOptions vboxCopyHDWizHDOpts'>
  50. <tr style='vertical-align: top;' class='vboxCreateDynamic'>
  51. <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskType' value='dynamic' /> <span class='translate'>Dynamically allocated</span></label></td>
  52. </tr>
  53. <tr style='vertical-align: top;' class='vboxCreateFixed'>
  54. <td><label><input type='radio' class='vboxRadio' name='newHardDiskType' value='fixed' /> <span class='translate'>Fixed size</span></label></td>
  55. </tr>
  56. <tr style='vertical-align: top;' class='vboxCreateSplit2G'>
  57. <td><label><input type='checkbox' class='vboxCheckbox' name='newHardDiskSplit' disabled/> <span class='translate'>Split into files of less than 2GB</span></label></td>
  58. </tr>
  59. </table>
  60. </div>
  61. </td>
  62. </tr>
  63. </table>
  64. </div>
  65. <script type='text/javascript'>
  66. // Fill HD type options
  67. var vboxHDTypesTbl = $('#wizardCopyHDStep1').find('table.vboxNewHDWizardFileTypes').first();
  68. vboxHDTypesTbl.children().remove();
  69. var vboxHDTypes = $('#vboxPane').data('vboxSystemProperties').mediumFormats;
  70. for(var i = 0; i < vboxHDTypes.length; i++) {
  71. if(jQuery.inArray('CreateFixed',vboxHDTypes[i].capabilities) < 0 && jQuery.inArray('CreateDynamic',vboxHDTypes[i].capabilities) < 0) continue;
  72. if(jQuery.inArray('HardDisk',vboxHDTypes[i].deviceTypes) > -1) {
  73. vboxHDTypesTbl.append("<tr style='vertical-align: top;'><td><label><input type='radio' onclick='wizardCopyHDUpdateOptions()' class='vboxRadio' name='copyHDFileType' value='"+vboxHDTypes[i].id+"' /> "+vboxMedia.getFormat({'format':vboxHDTypes[i].name})+"</label></td></tr>");
  74. vboxHDTypesTbl.find('tr').last().data('vboxFormat', vboxHDTypes[i]);
  75. }
  76. }
  77. // Select default HD format and place it at the top
  78. vboxHDTypesTbl.find('input[value='+$('#vboxPane').data('vboxSystemProperties').defaultHardDiskFormat+']').prop('checked',true).closest('tr').detach().prependTo(vboxHDTypesTbl);
  79. /* Choose virtual hard drive button */
  80. new vboxToolbarSingle({button: {
  81. 'name' : 'mselecthdbtn',
  82. 'label' : 'Choose a virtual hard drive file to copy...',
  83. 'language_context': 'UIWizardCloneVD',
  84. 'icon' : 'select_file',
  85. 'click' : function () {
  86. vboxMedia.actions.choose(null,'HardDisk',function(med){
  87. if(med) copyHDFillDisks(med.base);
  88. });
  89. }
  90. }}).renderTo('newVMDiskVMM');
  91. /* Choose location of new file button */
  92. new vboxToolbarSingle({button: {
  93. 'name' : 'mselecthdbtn',
  94. 'label' : 'Choose a location for new virtual hard drive file...',
  95. 'language_context': 'UIWizardNewVD',
  96. 'icon' : 'select_file',
  97. 'click' : function () {
  98. wizardCopyHDBrowseLocation();
  99. }
  100. }}).renderTo('newVMDiskVMMDest');
  101. /* Set up disk selection box */
  102. function copyHDFillDisks(sel) {
  103. document.forms['frmwizardCopyHD'].copyHDDiskSelect.options.length = 0;
  104. $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).children().remove();
  105. var s = vboxMedia.mediaForAttachmentType('HardDisk');
  106. // Sort media
  107. s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
  108. var mediumSelects = [];
  109. for(var i = 0; i < s.length; i++) {
  110. document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id);
  111. if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i]).addClass('vboxMediumReadOnly');
  112. mediumSelects[i] = {'attachedId':s[i].id,'id':s[i].id,'base':s[i].base,'label':vboxMedia.mediumPrint(s[i])};
  113. }
  114. if(sel) {
  115. $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val(sel);
  116. }
  117. $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
  118. }
  119. copyHDFillDisks();
  120. /* Browse for new disk location */
  121. function wizardCopyHDBrowseLocation() {
  122. // Get current location
  123. var loc = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value;
  124. if(loc.indexOf(':') > 0) {
  125. // windows
  126. loc = loc.replace(/.*\\/,'');
  127. } else if(loc.indexOf('/') != -1) {
  128. // *nix
  129. loc = loc.replace(/.*\//,'');
  130. } else {
  131. // no path set, use src location
  132. loc = vboxDirname(vboxMedia.getMediumById($(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val()).location);
  133. }
  134. vboxFileBrowser(loc,function(f){
  135. if(!f) return;
  136. // get file name
  137. file = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value;
  138. document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = f+$('#vboxPane').data('vboxConfig').DSEP+file;
  139. },true);
  140. }
  141. /* Update new HD name */
  142. function wizardCopyHDUpdateName(sel) {
  143. var n = $(sel).val();
  144. var m = vboxMedia.getMediumById(n);
  145. if(!m) return;
  146. document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = trans('%1_copy','UIWizardNewVD').replace('%1',m.name.replace(/\.[^\.]+?$/,''));
  147. }
  148. /* Suggested Data exists */
  149. $('#wizardCopyHDStep1').on('show',function(e,wiz){
  150. // Already initialized?
  151. if($('#wizardCopyHDStep1').data('init')) return;
  152. if(wiz && wiz.suggested && wiz.suggested.medium)
  153. $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'selectMedium':wiz.suggested.medium});
  154. $('#wizardCopyHDStep1').data('init',true);
  155. });
  156. /* Show / hide split option */
  157. function wizardCopyHDUpdateOptions() {
  158. var caps = new Array();
  159. for(var i = 0; i < document.forms['frmwizardCopyHD'].copyHDFileType.length; i++) {
  160. if(document.forms['frmwizardCopyHD'].copyHDFileType[i].checked) {
  161. caps = $(document.forms['frmwizardCopyHD'].copyHDFileType[i]).closest('tr').data('vboxFormat').capabilities;
  162. break;
  163. }
  164. }
  165. var capOpts = ['CreateFixed','CreateDynamic','CreateSplit2G'];
  166. for(var i = 0; i < capOpts.length; i++) {
  167. if(jQuery.inArray(capOpts[i],caps) < 0) {
  168. $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).addClass('disabled').find('input').prop({'disabled':true,'checked':false});
  169. } else {
  170. $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).removeClass('disabled').find('input').prop('disabled',false);
  171. }
  172. }
  173. // Make sure one is selected
  174. if(!$('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find(':checked')[0]) {
  175. $('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find('input:not(:disabled)').first().prop('checked', true);
  176. }
  177. }
  178. wizardCopyHDUpdateOptions();
  179. </script>