forked from phpvirtualbox/phpvirtualbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwizardNewHD.html
More file actions
284 lines (227 loc) · 10.8 KB
/
wizardNewHD.html
File metadata and controls
284 lines (227 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!--
Panes for new hard disk wizard. Logic in vboxWizard()
Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
$Id: wizardNewHD.html 595 2015-04-17 09:50:36Z imoore76 $
-->
<!-- Step 1 -->
<div id='wizardNewHDStep1' title='Hard disk file type' style='display: none'>
<p class='translate'>Please choose the type of file that you would like to use for the new virtual hard disk. If you do not need to use it with other virtualization software you can leave this setting unchanged.</p>
<div class='vboxOptions'>
<table class='vboxOptions'>
<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>
</div>
<!-- Step 2 -->
<div id='wizardNewHDStep2' title='Storage on physical hard disk' style='display: none'>
<p class='translate'>Please choose whether the new virtual hard disk file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</p>
<span class='translate vboxCreateDynamic'><p>A <b>dynamically allocated</b> hard disk file will only use space on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></span>
<span class='translate vboxCreateFixed'><p>A <b>fixed size</b> hard disk file may take longer to create on some systems but is often faster to use.</p></span>
<span class='translate vboxCreateSplit2G'><p>You can also choose to <b>split</b> the hard disk file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</span>
<div class='vboxOptions'>
<table class='vboxOptions'>
<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' /> <span class='translate'>Split into files of less than 2GB</span></label></td>
</tr>
</table>
</div>
</div>
<!-- Step 3 -->
<div id='wizardNewHDStep3' title='File location and size' style='display: none'>
<p class='translate'>Please type the name of the new virtual hard disk file into the box below or click on the folder icon to select a different folder to create the file in.</p>
<div class='vboxOptions'>
<table class='vboxOptions'>
<tr>
<td style='width: 100%; white-space: nowrap'>
<input type='text' class='vboxText' name='wizardNewHDLocation' style='width: 100%'/>
</td>
<td style='width: 1%;' id='wizardHDBrowseLocationButton'></td>
</tr>
</table>
</div>
<p class='translate'>Select the size of the virtual hard disk in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard disk.</p>
<div class='vboxOptions'>
<table>
<tr>
<td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
<div style='margin-top: 4px' id='wizardNewHDSize' class='slider'><div class='sliderScale'></div></div>
</td>
<td><input type='text' class='vboxText' name='wizardNewHDSizeValue' size='8' class='sliderValue' /></td>
</tr>
<tr style='vertical-align: top;'>
<td style='border: 0px; margin: 0px; padding: 0px;'>
<table style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
<tr style='vertical-align: top'>
<td style='text-align: left;'><span id='wizardNewHDMin'>1</span></td>
<td style='text-align: right;'><span id='wizardNewHDMax'>128</span></td>
</tr>
</table>
</td>
<td></td>
</tr>
</table>
</div>
</div>
<script type='text/javascript'>
//Fill HD type options
var vboxHDTypesTbl = $('#wizardNewHDStep1').find('table.vboxOptions').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' class='vboxRadio' name='newHardDiskFileType' 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);
/*
* Translations
*/
$('#wizardNewHDStep2').find('span.translatevar').html(function(i,h){return trans(h,'UIWizardNewVDPageVariant');});
/*
* Location button
*/
/* Choose location of new file button */
new vboxToolbarSingle({button: {
'name' : 'mselecthdbtn',
'label' : 'Choose a location for new virtual hard disk file...',
'language_context': 'UIWizardNewVD',
'icon' : 'select_file',
'click' : function () {
wizardHDBrowseLocation();
}
}}).renderTo('wizardHDBrowseLocationButton');
/* Browse for new VDI location */
function wizardHDBrowseLocation() {
// Get current location
var loc = $('<div />').html(document.forms['frmwizardNewHD'].elements.wizardNewHDLocation.value).text();
if(!loc) {
// no path set
loc = $('#vboxPane').data('vboxSystemProperties').homeFolder;
} else {
loc = vboxDirname(loc);
}
if(loc.indexOf($('#vboxPane').data('vboxConfig').DSEP) < 0 && $('#wizardNewHDStep1').data('wizSuggested')['path']) {
loc = $('#wizardNewHDStep1').data('wizSuggested')['path'];
}
vboxFileBrowser(loc,function(f){
if(!f) return;
// get file name
prefile = document.forms['frmwizardNewHD'].elements.wizardNewHDLocation.value;
var lastindex = -1;
if(prefile.lastIndexOf("\\") >= 0){ lastindex = prefile.lastIndexOf("\\"); }
if(prefile.lastIndexOf("/") >= 0) { lastindex = prefile.lastIndexOf("/"); }
filename = prefile.substring(lastindex+1,prefile.length);
var laststring = f.charAt(f.length-1);
if(laststring=="\\" || laststring=="/"){
// has slash at end so get rid off it...
f=f.substring(0,f.length-1);
}
var path = f+$('#vboxPane').data('vboxConfig').DSEP+filename;
document.forms['frmwizardNewHD'].elements.wizardNewHDLocation.value = path;
},true,trans('Location','UIWizardNewVD'));
}
/* Keep suggested options */
$('#wizardNewHDStep1').on('show',function(e,wiz){
$('#wizardNewHDStep1').data('wizSuggested', (wiz.suggested ? wiz.suggested : {}));
});
/* WHen showing step 2, show / hide split option */
$('#wizardNewHDStep2').on('show',function(e,wiz){
var caps = 0;
for(var i = 0; i < document.forms['frmwizardNewHD'].newHardDiskFileType.length; i++) {
if(document.forms['frmwizardNewHD'].newHardDiskFileType[i].checked) {
caps = $(document.forms['frmwizardNewHD'].newHardDiskFileType[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) {
$('#wizardNewHDStep2').find('.vbox'+capOpts[i]).hide();
} else {
$('#wizardNewHDStep2').find('.vbox'+capOpts[i]).show();
}
}
// Select first visible option
$('#wizardNewHDStep2').find('tr:visible').first().find('input').prop('checked',true);
if(!(wiz && wiz.suggested && wiz.suggested.name))
vboxWizardNewHDElectName(wiz);
});
/* When last list of options */
$('#wizardNewHDStep3').on('show',function(e,wiz){
var format = document.forms['frmwizardNewHD'].elements['newHardDiskFileType'];
var formatOpts = {};
for(var i = 0; i < format.length; i++) {
if(format[i].checked) {
formatOpts = $(format[i]).closest('tr').data('vboxFormat');
format=format[i].value;
break;
}
}
// uncheck vboxHDSplitOption if not supported
if(jQuery.inArray('CreateSplit2G',formatOpts.capabilities) < 0)
document.forms['frmwizardNewHD'].newHardDiskSplit.checked = false;
});
/*
*
* Elect a filename for use
*
*/
function vboxWizardNewHDElectName(wiz) {
// check for path and use it to elect name
var baseName = null;
var start = 1;
if(wiz && wiz.suggested && wiz.suggested.vmName) {
baseName = wiz.suggested.vmName;
start = 2;
}
document.forms['frmwizardNewHD'].elements.wizardNewHDLocation.value = vboxMedia.electHardDiskName(baseName,start);
}
/* Size slider */
var min = 1024;
var max = Math.max(parseInt($('#vboxPane').data('vboxSystemProperties').infoVDSize),2199022206980) / 1048576;
// Over 512GB and the slider becomes useless
max = Math.min(max,512*1024);
$('#wizardNewHDSize').data('form','frmwizardNewHD');
$('#wizardNewHDSize').data('display',vboxMbytesConvert);
$('#wizardNewHDSize').slider({'min':min,'max':max,'step':1024});
$('#wizardNewHDSize').slider('value',2048);
$('#wizardNewHDMin').html(vboxMbytesConvert(min));
$('#wizardNewHDMax').html(vboxMbytesConvert(max));
/* Suggested Data exists */
$('#wizardNewHDStep1').on('show',function(e,wiz){
// Already initialized?
if($('#wizardNewHDStep1').data('init') || !wiz || !wiz.suggested) return;
if(wiz.suggested.name) {
document.forms['frmwizardNewHD'].elements.wizardNewHDLocation.value = wiz.suggested.name;
}
if(wiz.suggested.size) {
$('#wizardNewHDSize').slider('value',wiz.suggested.size);
}
if(wiz.suggested.path && wiz.suggested.name){
if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true){
var nameIndex = wiz.suggested.path.lastIndexOf(wiz.suggested.name+$('#vboxPane').data('vboxConfig').DSEP);
var path = wiz.suggested.path.substr(0,nameIndex);
wiz.suggested.path = path + $('#vboxPane').data('vboxSession').user + "_" + wiz.suggested.name+$('#vboxPane').data('vboxConfig').DSEP;
}
$('#wizardNewHDStep3').data('suggestedpath',wiz.suggested.path);
}
$('#wizardNewHDStep1').data('init',true);
});
</script>