diff options
Diffstat (limited to 'panes/wizardCopyHDAdvanced.html')
-rw-r--r-- | panes/wizardCopyHDAdvanced.html | 434 |
1 files changed, 217 insertions, 217 deletions
diff --git a/panes/wizardCopyHDAdvanced.html b/panes/wizardCopyHDAdvanced.html index d2b2b7d..4310140 100644 --- a/panes/wizardCopyHDAdvanced.html +++ b/panes/wizardCopyHDAdvanced.html @@ -1,217 +1,217 @@ -<!--
-
- Advanced panes for copy hard disk wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardCopyHDAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardCopyHDStep1' style='display: none'>
-
- <span class='vboxTableLabel translate'>Hard disk to copy</span>
- <div class='vboxOptions'>
- <table class='vboxOptions'>
- <tr style='vertical-align: top;'>
- <td><select id="copyHDDiskSelectId" name="copyHDDiskSelect" onchange='wizardCopyHDUpdateName(this)'></select></td>
- <td style='width:1%' id='newVMDiskVMM'></td>
- </tr>
- </table>
- </div>
-
- <span class='vboxTableLabel translate'>New hard disk to create</span>
- <div class='vboxOptions'>
- <table class='vboxOptions'>
- <tr>
- <td style='width: 100%; white-space: nowrap'>
- <input type='text' class='vboxText' name='wizardCopyHDLocation' style='width: 100%'/>
- </td>
- <td style='width: 1%;' id='newVMDiskVMMDest'></td>
- </tr>
- </table>
- </div>
-
- <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px;'>
- <tr style='vertical-align: top'>
- <td>
- <span class='vboxTableLabel translate'>Hard disk file type</span>
- <div class='vboxOptions'>
- <table class='vboxOptions vboxNewHDWizardFileTypes'>
- <tr style='vertical-align: top;'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskFileType' value='vdi' /> <span class='translate'>VDI (VirtualBox Disk Image)</span></label></td>
- </tr>
- <tr style='vertical-align: top;'>
- <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vmdk' /> <span class='translate'>VMDK (Virtual Machine Disk)</span></label></td>
- </tr>
- <tr style='vertical-align: top;'>
- <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vhd' /> <span class='translate'>VHD (Virtual Hard Disk)</span></label></td>
- </tr>
- </table>
- </div>
- </td>
- <td>
- <span class='vboxTableLabel translate'>Storage on physical hard disk</span>
- <div class='vboxOptions'>
- <table class='vboxOptions vboxCopyHDWizHDOpts'>
- <tr style='vertical-align: top;' class='vboxCreateDynamic'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskType' value='dynamic' /> <span class='translate'>Dynamically allocated</span></label></td>
- </tr>
- <tr style='vertical-align: top;' class='vboxCreateFixed'>
- <td><label><input type='radio' class='vboxRadio' name='newHardDiskType' value='fixed' /> <span class='translate'>Fixed size</span></label></td>
- </tr>
- <tr style='vertical-align: top;' class='vboxCreateSplit2G'>
- <td><label><input type='checkbox' class='vboxCheckbox' name='newHardDiskSplit' disabled/> <span class='translate'>Split into files of less than 2GB</span></label></td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
-
-</div>
-
-<script type='text/javascript'>
-
-
-// Fill HD type options
-var vboxHDTypesTbl = $('#wizardCopyHDStep1').find('table.vboxNewHDWizardFileTypes').first();
-vboxHDTypesTbl.children().remove();
-var vboxHDTypes = $('#vboxPane').data('vboxSystemProperties').mediumFormats;
-for(var i = 0; i < vboxHDTypes.length; i++) {
- if(jQuery.inArray('CreateFixed',vboxHDTypes[i].capabilities) < 0 && jQuery.inArray('CreateDynamic',vboxHDTypes[i].capabilities) < 0) continue;
- if(jQuery.inArray('HardDisk',vboxHDTypes[i].deviceTypes) > -1) {
- 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>");
- vboxHDTypesTbl.find('tr').last().data('vboxFormat', vboxHDTypes[i]);
- }
-}
-// Select default HD format and place it at the top
-vboxHDTypesTbl.find('input[value='+$('#vboxPane').data('vboxSystemProperties').defaultHardDiskFormat+']').prop('checked',true).closest('tr').detach().prependTo(vboxHDTypesTbl);
-
-/* Choose virtual hard drive button */
-new vboxToolbarSingle({button: {
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a virtual hard drive file to copy...',
- 'language_context': 'UIWizardCloneVD',
- 'icon' : 'select_file',
- 'click' : function () {
- vboxMedia.actions.choose(null,'HardDisk',function(med){
- if(med) copyHDFillDisks(med.base);
- });
- }
-}}).renderTo('newVMDiskVMM');
-
-/* Choose location of new file button */
-new vboxToolbarSingle({button: {
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a location for new virtual hard drive file...',
- 'language_context': 'UIWizardNewVD',
- 'icon' : 'select_file',
- 'click' : function () {
- wizardCopyHDBrowseLocation();
- }
-}}).renderTo('newVMDiskVMMDest');
-
-
-/* Set up disk selection box */
-function copyHDFillDisks(sel) {
-
- document.forms['frmwizardCopyHD'].copyHDDiskSelect.options.length = 0;
- $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).children().remove();
-
- var s = vboxMedia.mediaForAttachmentType('HardDisk');
-
- // Sort media
- s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
-
- var mediumSelects = [];
- for(var i = 0; i < s.length; i++) {
- document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id);
- if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i]).addClass('vboxMediumReadOnly');
- mediumSelects[i] = {'attachedId':s[i].id,'id':s[i].id,'base':s[i].base,'label':vboxMedia.mediumPrint(s[i])};
- }
- if(sel) {
- $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val(sel);
- }
-
- $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
-
-}
-copyHDFillDisks();
-
-/* Browse for new disk location */
-function wizardCopyHDBrowseLocation() {
-
- // Get current location
- var loc = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value;
- if(loc.indexOf(':') > 0) {
- // windows
- loc = loc.replace(/.*\\/,'');
- } else if(loc.indexOf('/') != -1) {
- // *nix
- loc = loc.replace(/.*\//,'');
- } else {
- // no path set, use src location
- loc = vboxDirname(vboxMedia.getMediumById($(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val()).location);
- }
-
- vboxFileBrowser(loc,function(f){
- if(!f) return;
- // get file name
- file = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value;
- document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = f+$('#vboxPane').data('vboxConfig').DSEP+file;
- },true);
-
-}
-
-/* Update new HD name */
-function wizardCopyHDUpdateName(sel) {
- var n = $(sel).val();
- var m = vboxMedia.getMediumById(n);
- if(!m) return;
- document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = trans('%1_copy','UIWizardNewVD').replace('%1',m.name.replace(/\.[^\.]+?$/,''));
-}
-
- /* Suggested Data exists */
-$('#wizardCopyHDStep1').on('show',function(e,wiz){
-
- // Already initialized?
- if($('#wizardCopyHDStep1').data('init')) return;
-
- if(wiz && wiz.suggested && wiz.suggested.medium)
- $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'selectMedium':wiz.suggested.medium});
-
-
- $('#wizardCopyHDStep1').data('init',true);
-
-});
-
-/* Show / hide split option */
-function wizardCopyHDUpdateOptions() {
-
- var caps = new Array();
- for(var i = 0; i < document.forms['frmwizardCopyHD'].copyHDFileType.length; i++) {
- if(document.forms['frmwizardCopyHD'].copyHDFileType[i].checked) {
- caps = $(document.forms['frmwizardCopyHD'].copyHDFileType[i]).closest('tr').data('vboxFormat').capabilities;
- break;
- }
- }
-
- var capOpts = ['CreateFixed','CreateDynamic','CreateSplit2G'];
- for(var i = 0; i < capOpts.length; i++) {
- if(jQuery.inArray(capOpts[i],caps) < 0) {
- $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).addClass('disabled').find('input').prop({'disabled':true,'checked':false});
- } else {
- $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).removeClass('disabled').find('input').prop('disabled',false);
- }
- }
-
- // Make sure one is selected
- if(!$('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find(':checked')[0]) {
- $('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find('input:not(:disabled)').first().prop('checked', true);
- }
-
-}
-wizardCopyHDUpdateOptions();
-
-
-</script>
+<!-- + + Advanced panes for copy hard disk wizard. Logic in vboxWizard() + Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com) + + $Id: wizardCopyHDAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $ + + --> +<!-- Step 1 --> +<div id='wizardCopyHDStep1' style='display: none'> + + <span class='vboxTableLabel translate'>Hard disk to copy</span> + <div class='vboxOptions'> + <table class='vboxOptions'> + <tr style='vertical-align: top;'> + <td><select id="copyHDDiskSelectId" name="copyHDDiskSelect" onchange='wizardCopyHDUpdateName(this)'></select></td> + <td style='width:1%' id='newVMDiskVMM'></td> + </tr> + </table> + </div> + + <span class='vboxTableLabel translate'>New hard disk to create</span> + <div class='vboxOptions'> + <table class='vboxOptions'> + <tr> + <td style='width: 100%; white-space: nowrap'> + <input type='text' class='vboxText' name='wizardCopyHDLocation' style='width: 100%'/> + </td> + <td style='width: 1%;' id='newVMDiskVMMDest'></td> + </tr> + </table> + </div> + + <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px;'> + <tr style='vertical-align: top'> + <td> + <span class='vboxTableLabel translate'>Hard disk file type</span> + <div class='vboxOptions'> + <table class='vboxOptions vboxNewHDWizardFileTypes'> + <tr style='vertical-align: top;'> + <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskFileType' value='vdi' /> <span class='translate'>VDI (VirtualBox Disk Image)</span></label></td> + </tr> + <tr style='vertical-align: top;'> + <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vmdk' /> <span class='translate'>VMDK (Virtual Machine Disk)</span></label></td> + </tr> + <tr style='vertical-align: top;'> + <td><label><input type='radio' class='vboxRadio' name='newHardDiskFileType' value='vhd' /> <span class='translate'>VHD (Virtual Hard Disk)</span></label></td> + </tr> + </table> + </div> + </td> + <td> + <span class='vboxTableLabel translate'>Storage on physical hard disk</span> + <div class='vboxOptions'> + <table class='vboxOptions vboxCopyHDWizHDOpts'> + <tr style='vertical-align: top;' class='vboxCreateDynamic'> + <td><label><input type='radio' class='vboxRadio' checked='checked' name='newHardDiskType' value='dynamic' /> <span class='translate'>Dynamically allocated</span></label></td> + </tr> + <tr style='vertical-align: top;' class='vboxCreateFixed'> + <td><label><input type='radio' class='vboxRadio' name='newHardDiskType' value='fixed' /> <span class='translate'>Fixed size</span></label></td> + </tr> + <tr style='vertical-align: top;' class='vboxCreateSplit2G'> + <td><label><input type='checkbox' class='vboxCheckbox' name='newHardDiskSplit' disabled/> <span class='translate'>Split into files of less than 2GB</span></label></td> + </tr> + </table> + </div> + </td> + </tr> + </table> + +</div> + +<script type='text/javascript'> + + +// Fill HD type options +var vboxHDTypesTbl = $('#wizardCopyHDStep1').find('table.vboxNewHDWizardFileTypes').first(); +vboxHDTypesTbl.children().remove(); +var vboxHDTypes = $('#vboxPane').data('vboxSystemProperties').mediumFormats; +for(var i = 0; i < vboxHDTypes.length; i++) { + if(jQuery.inArray('CreateFixed',vboxHDTypes[i].capabilities) < 0 && jQuery.inArray('CreateDynamic',vboxHDTypes[i].capabilities) < 0) continue; + if(jQuery.inArray('HardDisk',vboxHDTypes[i].deviceTypes) > -1) { + 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>"); + vboxHDTypesTbl.find('tr').last().data('vboxFormat', vboxHDTypes[i]); + } +} +// Select default HD format and place it at the top +vboxHDTypesTbl.find('input[value='+$('#vboxPane').data('vboxSystemProperties').defaultHardDiskFormat+']').prop('checked',true).closest('tr').detach().prependTo(vboxHDTypesTbl); + +/* Choose virtual hard drive button */ +new vboxToolbarSingle({button: { + 'name' : 'mselecthdbtn', + 'label' : 'Choose a virtual hard drive file to copy...', + 'language_context': 'UIWizardCloneVD', + 'icon' : 'select_file', + 'click' : function () { + vboxMedia.actions.choose(null,'HardDisk',function(med){ + if(med) copyHDFillDisks(med.base); + }); + } +}}).renderTo('newVMDiskVMM'); + +/* Choose location of new file button */ +new vboxToolbarSingle({button: { + 'name' : 'mselecthdbtn', + 'label' : 'Choose a location for new virtual hard drive file...', + 'language_context': 'UIWizardNewVD', + 'icon' : 'select_file', + 'click' : function () { + wizardCopyHDBrowseLocation(); + } +}}).renderTo('newVMDiskVMMDest'); + + +/* Set up disk selection box */ +function copyHDFillDisks(sel) { + + document.forms['frmwizardCopyHD'].copyHDDiskSelect.options.length = 0; + $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).children().remove(); + + var s = vboxMedia.mediaForAttachmentType('HardDisk'); + + // Sort media + s.sort(function(a,b){return strnatcasecmp(a.name,b.name);}); + + var mediumSelects = []; + for(var i = 0; i < s.length; i++) { + document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id); + if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardCopyHD'].copyHDDiskSelect.options[i]).addClass('vboxMediumReadOnly'); + mediumSelects[i] = {'attachedId':s[i].id,'id':s[i].id,'base':s[i].base,'label':vboxMedia.mediumPrint(s[i])}; + } + if(sel) { + $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val(sel); + } + + $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects}); + +} +copyHDFillDisks(); + +/* Browse for new disk location */ +function wizardCopyHDBrowseLocation() { + + // Get current location + var loc = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value; + if(loc.indexOf(':') > 0) { + // windows + loc = loc.replace(/.*\\/,''); + } else if(loc.indexOf('/') != -1) { + // *nix + loc = loc.replace(/.*\//,''); + } else { + // no path set, use src location + loc = vboxDirname(vboxMedia.getMediumById($(document.forms['frmwizardCopyHD'].copyHDDiskSelect).val()).location); + } + + vboxFileBrowser(loc,function(f){ + if(!f) return; + // get file name + file = document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value; + document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = f+$('#vboxPane').data('vboxConfig').DSEP+file; + },true); + +} + +/* Update new HD name */ +function wizardCopyHDUpdateName(sel) { + var n = $(sel).val(); + var m = vboxMedia.getMediumById(n); + if(!m) return; + document.forms['frmwizardCopyHD'].elements.wizardCopyHDLocation.value = trans('%1_copy','UIWizardNewVD').replace('%1',m.name.replace(/\.[^\.]+?$/,'')); +} + + /* Suggested Data exists */ +$('#wizardCopyHDStep1').on('show',function(e,wiz){ + + // Already initialized? + if($('#wizardCopyHDStep1').data('init')) return; + + if(wiz && wiz.suggested && wiz.suggested.medium) + $(document.forms['frmwizardCopyHD'].copyHDDiskSelect).mediumselect({'selectMedium':wiz.suggested.medium}); + + + $('#wizardCopyHDStep1').data('init',true); + +}); + +/* Show / hide split option */ +function wizardCopyHDUpdateOptions() { + + var caps = new Array(); + for(var i = 0; i < document.forms['frmwizardCopyHD'].copyHDFileType.length; i++) { + if(document.forms['frmwizardCopyHD'].copyHDFileType[i].checked) { + caps = $(document.forms['frmwizardCopyHD'].copyHDFileType[i]).closest('tr').data('vboxFormat').capabilities; + break; + } + } + + var capOpts = ['CreateFixed','CreateDynamic','CreateSplit2G']; + for(var i = 0; i < capOpts.length; i++) { + if(jQuery.inArray(capOpts[i],caps) < 0) { + $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).addClass('disabled').find('input').prop({'disabled':true,'checked':false}); + } else { + $('#wizardCopyHDStep1').find('tr.vbox'+capOpts[i]).removeClass('disabled').find('input').prop('disabled',false); + } + } + + // Make sure one is selected + if(!$('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find(':checked')[0]) { + $('#wizardCopyHDStep1').find('.vboxCopyHDWizHDOpts').find('input:not(:disabled)').first().prop('checked', true); + } + +} +wizardCopyHDUpdateOptions(); + + +</script> |