Fix shared folders in 6.1
This commit is contained in:
parent
3889ccb6d2
commit
407bc55e11
|
@ -377,7 +377,7 @@ div.vboxVMMDialog div.ui-dialog-buttonpane {
|
|||
#vboxVirtualMediaManager table.vboxVMMList span { display: inline-block; }
|
||||
#vboxVirtualMediaManager div.vboxVMMMediumInfo { font-size: 0.9em; }
|
||||
#vboxVirtualMediaManager .vboxVMMMediumInfo input { padding: 0px; margin: 0px; background: transparent; color: #000000; }
|
||||
#vboxVirtualMediaManager .vboxVMMMediumInfo table { padding;0px; border: 1px solid #000; border-spacing:0px; margin-top: 12px; width: 100%; background: #fafafa; }
|
||||
#vboxVirtualMediaManager .vboxVMMMediumInfo table { padding: 0px; border: 1px solid #000; border-spacing:0px; margin-top: 12px; width: 100%; background: #fafafa; }
|
||||
#vboxVirtualMediaManager .vboxVMMMediumInfo th { padding:2px; padding-left: 18px; text-align: right; width: auto; white-space: nowrap; }
|
||||
#vboxVirtualMediaManager .vboxVMMMediumInfo td { padding:0px; padding-left: 10px; text-align: left; width: 100%; }
|
||||
#vboxVirtualMediaManager .vboxVMMSortImgFaded img {
|
||||
|
|
|
@ -1682,10 +1682,10 @@ class vboxconnector {
|
|||
if($sf['type'] == 'machine' && $psf[$sf['name']]) {
|
||||
|
||||
/* Remove if it doesn't match */
|
||||
if($sf['hostPath'] != $psf[$sf['name']]->hostPath || (bool)$sf['autoMount'] != (bool)$psf[$sf['name']]->autoMount || (bool)$sf['writable'] != (bool)$psf[$sf['name']]->writable) {
|
||||
if($sf['hostPath'] != $psf[$sf['name']]->hostPath || (bool)$sf['autoMount'] != (bool)$psf[$sf['name']]->autoMount || (bool)$sf['writable'] != (bool)$psf[$sf['name']]->writable || $sf['autoMountPoint'] != $psf[$sf['name']]->autoMountPoint) {
|
||||
|
||||
$m->removeSharedFolder($sf['name']);
|
||||
$m->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount']);
|
||||
$m->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount'],$sf['autoMountPoint']);
|
||||
}
|
||||
|
||||
unset($psf[$sf['name']]);
|
||||
|
@ -1694,10 +1694,10 @@ class vboxconnector {
|
|||
} else if($sf['type'] != 'machine' && $tsf[$sf['name']]) {
|
||||
|
||||
/* Remove if it doesn't match */
|
||||
if($sf['hostPath'] != $tsf[$sf['name']]->hostPath || (bool)$sf['autoMount'] != (bool)$tsf[$sf['name']]->autoMount || (bool)$sf['writable'] != (bool)$tsf[$sf['name']]->writable) {
|
||||
if($sf['hostPath'] != $tsf[$sf['name']]->hostPath || (bool)$sf['autoMount'] != (bool)$tsf[$sf['name']]->autoMount || (bool)$sf['writable'] != (bool)$tsf[$sf['name']]->writable || $sf['autoMountPoint'] != $psf[$sf['name']]->autoMountPoint) {
|
||||
|
||||
$this->session->console->removeSharedFolder($sf['name']);
|
||||
$this->session->console->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount']);
|
||||
$this->session->console->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount'],$sf['autoMountPoint']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1706,8 +1706,8 @@ class vboxconnector {
|
|||
} else {
|
||||
|
||||
// Does not exist or was removed. Add it.
|
||||
if($sf['type'] != 'machine') $this->session->console->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount']);
|
||||
else $this->session->machine->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount']);
|
||||
if($sf['type'] != 'machine') $this->session->console->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount'],$sf['autoMountPoint']);
|
||||
else $this->session->machine->createSharedFolder($sf['name'],$sf['hostPath'],(bool)$sf['writable'],(bool)$sf['autoMount'],$sf['autoMountPoint']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2231,17 +2231,17 @@ class vboxconnector {
|
|||
$sharedEx = array();
|
||||
$sharedNew = array();
|
||||
foreach($this->_machineGetSharedFolders($m) as $s) {
|
||||
$sharedEx[$s['name']] = array('name'=>$s['name'],'hostPath'=>$s['hostPath'],'autoMount'=>(bool)$s['autoMount'],'writable'=>(bool)$s['writable']);
|
||||
$sharedEx[$s['name']] = array('name'=>$s['name'],'hostPath'=>$s['hostPath'],'autoMount'=>(bool)$s['autoMount'],'writable'=>(bool)$s['writable'],'autoMountPoint'=>$s['autoMountPoint']);
|
||||
}
|
||||
foreach($args['sharedFolders'] as $s) {
|
||||
$sharedNew[$s['name']] = array('name'=>$s['name'],'hostPath'=>$s['hostPath'],'autoMount'=>(bool)$s['autoMount'],'writable'=>(bool)$s['writable']);
|
||||
$sharedNew[$s['name']] = array('name'=>$s['name'],'hostPath'=>$s['hostPath'],'autoMount'=>(bool)$s['autoMount'],'writable'=>(bool)$s['writable'],'autoMountPoint'=>$s['autoMountPoint']);
|
||||
}
|
||||
// Compare
|
||||
if(count($sharedEx) != count($sharedNew) || (@serialize($sharedEx) != @serialize($sharedNew))) {
|
||||
foreach($sharedEx as $s) { $m->removeSharedFolder($s['name']);}
|
||||
try {
|
||||
foreach($sharedNew as $s) {
|
||||
$m->createSharedFolder($s['name'],$s['hostPath'],(bool)$s['writable'],(bool)$s['autoMount']);
|
||||
$m->createSharedFolder($s['name'],$s['hostPath'],(bool)$s['writable'],(bool)$s['autoMount'],$s['autoMountPoint']);
|
||||
}
|
||||
} catch (Exception $e) { $this->errors[] = $e; }
|
||||
}
|
||||
|
@ -4370,6 +4370,7 @@ class vboxconnector {
|
|||
'accessible' => $sf->accessible,
|
||||
'writable' => $sf->writable,
|
||||
'autoMount' => $sf->autoMount,
|
||||
'autoMountPoint' => $sf->autoMountPoint,
|
||||
'lastAccessError' => $sf->lastAccessError,
|
||||
'type' => 'machine'
|
||||
);
|
||||
|
@ -4452,6 +4453,7 @@ class vboxconnector {
|
|||
'accessible' => $sf->accessible,
|
||||
'writable' => $sf->writable,
|
||||
'autoMount' => $sf->autoMount,
|
||||
'autoMountPoint' => $sf->autoMountPoint,
|
||||
'lastAccessError' => $sf->lastAccessError,
|
||||
'type' => 'transient'
|
||||
);
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
<tr id='vboxSettingsSharedFoldersHeading'>
|
||||
<th><span class='translate'>Name</span></th>
|
||||
<th style='width: 100%; white-space: nowrap;'><span class='translate'>Path</span></th>
|
||||
<th><span class='translate'>Auto-Mount</span></th>
|
||||
<th><span class='translate'>Access</span></th>
|
||||
<th><span class='translate'>Auto Mount</span></th>
|
||||
<th><span class='translate'>At</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
@ -57,13 +58,14 @@ var sButtons = new Array(
|
|||
$('#vboxSettingsSFPath').val('');
|
||||
$('#vboxSettingsSFName').val('');
|
||||
$('#vboxSettingsSFAM').prop('checked',false);
|
||||
$('#vboxSettingsSFAMPoint').val('');
|
||||
$('#vboxSettingsSFRO').prop('checked',false);
|
||||
$('#vboxSettingsSFPerm').prop('checked',false);
|
||||
|
||||
var buttons = { };
|
||||
buttons[trans('OK','QIMessageBox')] = function() {
|
||||
if($('#vboxSettingsSFName').val() && $('#vboxSettingsSFPath').val()) {
|
||||
var f = {'name':$('#vboxSettingsSFName').val(),'hostPath':$('#vboxSettingsSFPath').val(),'autoMount':($('#vboxSettingsSFAM').prop('checked')),'writable':!($('#vboxSettingsSFRO').prop('checked'))};
|
||||
var f = {'name':$('#vboxSettingsSFName').val(),'hostPath':$('#vboxSettingsSFPath').val(),'autoMountPoint':$('#vboxSettingsSFAMPoint').val(),'autoMount':($('#vboxSettingsSFAM').prop('checked')),'writable':!($('#vboxSettingsSFRO').prop('checked'))};
|
||||
if($('#vboxSettingsSFPerm').length) {
|
||||
f['type'] = ($('#vboxSettingsSFPerm').prop('checked') ? 'machine' : '');
|
||||
} else {
|
||||
|
@ -93,6 +95,7 @@ var sButtons = new Array(
|
|||
$('#vboxSettingsSFPath').val(($(def).data('hostPath')||''));
|
||||
$('#vboxSettingsSFName').val(($(def).data('name')||''));
|
||||
$('#vboxSettingsSFAM').prop('checked',($(def).data('autoMount') ? true : false));
|
||||
$('#vboxSettingsSFAMPoint').val(($(def).data('autoMountPoint')||''));
|
||||
$('#vboxSettingsSFRO').prop('checked',($(def).data('writable') ? false : true));
|
||||
$('#vboxSettingsSFPerm').prop('checked',($(def).data('type') == 'machine' ? true : false));
|
||||
|
||||
|
@ -104,6 +107,7 @@ var sButtons = new Array(
|
|||
'hostPath' : $('#vboxSettingsSFPath').val(),
|
||||
'name' : $('#vboxSettingsSFName').val(),
|
||||
'autoMount' : ($('#vboxSettingsSFAM').prop('checked')),
|
||||
'autoMountPoint' : $('#vboxSettingsSFAMPoint').val(),
|
||||
'writable' : !($('#vboxSettingsSFRO').prop('checked')),
|
||||
'type' : ((!$('#vboxSettingsSFPerm').length || $('#vboxSettingsSFPerm').prop('checked')) ? 'machine' : '')
|
||||
}).trigger('refresh');
|
||||
|
@ -149,6 +153,7 @@ function vboxSettingsAddSharedFolder(f, noColor) {
|
|||
// bind refresh
|
||||
$(this).children('td.vboxSettingsSFNameCell').children('span').first().html($('<div/>').text($(this).data('name')).html());
|
||||
$(this).children('td.vboxSettingsSFPathCell').html($('<div/>').text($(this).data('hostPath')).html());
|
||||
$(this).children('td.vboxSettingsSFAMPointCell').html($('<div/>').text($(this).data('autoMountPoint')).html());
|
||||
$(this).children('td.vboxSettingsSFAMCell').html($(this).data('autoMount') ? trans('Yes','UIMachineSettingsSF') : '');
|
||||
$(this).children('td.vboxSettingsSFROCell').html($(this).data('writable') ? trans('Full','UIMachineSettingsSF') : trans('Read-only','UIMachineSettingsSF'));
|
||||
|
||||
|
@ -172,11 +177,14 @@ function vboxSettingsAddSharedFolder(f, noColor) {
|
|||
// Path
|
||||
$('<td />').attr({'class':'vboxSettingsSFPathCell vboxHoverMid'}).html($('<div/>').text(f.hostPath).html()).appendTo(tr);
|
||||
|
||||
// auto-mount?
|
||||
// Read only?
|
||||
$('<td />').attr({'class':'vboxSettingsSFROCell vboxHoverMid'}).html(f.writable ? trans('Full','UIMachineSettingsSF') : trans('Read-only','UIMachineSettingsSF')).appendTo(tr);
|
||||
|
||||
// auto-mount?
|
||||
$('<td />').attr({'class':'vboxSettingsSFAMCell vboxHoverMid'}).html(f.autoMount ? trans('Yes','UIMachineSettingsSF') : '').appendTo(tr);
|
||||
|
||||
// Read only?
|
||||
$('<td />').attr({'class':'vboxSettingsSFROCell vboxHoverLast'}).html(f.writable ? trans('Full','UIMachineSettingsSF') : trans('Read-only','UIMachineSettingsSF')).appendTo(tr);
|
||||
// Mount point
|
||||
$('<td />').attr({'class':'vboxSettingsSFAMPointCell vboxHoverLast'}).html($('<div/>').text(f.autoMountPoint).html()).appendTo(tr);
|
||||
|
||||
|
||||
$(tr).children().click(function(){
|
||||
|
@ -241,7 +249,7 @@ function vboxSettingsAddSharedFolder(f, noColor) {
|
|||
|
||||
}).appendTo(td);
|
||||
$(td).append($('<span />').html($('<div/>').text(trans(' Machine Folders','UIMachineSettingsSF')).html())).appendTo(tr);
|
||||
$(tb).append($(tr).append($('<td />').attr({'class':'vboxSettingsSFPathCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMCell'})).append($('<td />').attr({'class':'vboxSettingsSFROCell'}))).appendTo(sfh);
|
||||
$(tb).append($(tr).append($('<td />').attr({'class':'vboxSettingsSFPathCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMPointCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMCell'})).append($('<td />').attr({'class':'vboxSettingsSFROCell'}))).appendTo(sfh);
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -272,7 +280,7 @@ function vboxSettingsAddSharedFolder(f, noColor) {
|
|||
}
|
||||
})).append($('<span />').html($('<div/>').text(trans(' Transient Folders','UIMachineSettingsSF')).html())).appendTo(tr);
|
||||
|
||||
$(tr).append($('<td />').attr({'class':'vboxSettingsSFPathCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMCell'})).append($('<td />').attr({'class':'vboxSettingsSFROCell'}));
|
||||
$(tr).append($('<td />').attr({'class':'vboxSettingsSFPathCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMPointCell'})).append($('<td />').attr({'class':'vboxSettingsSFAMCell'})).append($('<td />').attr({'class':'vboxSettingsSFROCell'}));
|
||||
$(tb).append(tr).appendTo(sfh);
|
||||
|
||||
// add each transient folder
|
||||
|
@ -330,6 +338,9 @@ function vboxSettingsSFEditDialog() {
|
|||
|
||||
// Auto mount
|
||||
$('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFAM" /> ' + trans('Auto-mount','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
|
||||
|
||||
// Mount point
|
||||
$('<tr />').append($('<th />').html(trans('Mount point:','UIMachineSettingsSFDetails'))).append($('<td />').html('<input type="text" class="vboxText" id="vboxSettingsSFAMPoint" style="width: 100%" />')).appendTo(tbl);
|
||||
|
||||
// Add "Make Permanent"?
|
||||
if(vboxVMStates.isRunning($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isSaved($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isPaused($('#vboxSettingsDialog').data('vboxMachineData'))) {
|
||||
|
@ -353,7 +364,7 @@ $('#vboxSettingsDialog').on('save',function(){
|
|||
$('#vboxSettingsSharedFoldersList').find('tr').each(function(){
|
||||
// Skip headers and such
|
||||
if($(this).data('name')) {
|
||||
folders[folders.length] = {'name':$(this).data('name'),'hostPath':$(this).data('hostPath'),'autoMount':($(this).data('autoMount') ? true : false),'writable':($(this).data('writable') ? true : false),'type':$(this).data('type')};
|
||||
folders[folders.length] = {'name':$(this).data('name'),'hostPath':$(this).data('hostPath'),'autoMountPoint':$(this).data('autoMountPoint'),'autoMount':($(this).data('autoMount') ? true : false),'writable':($(this).data('writable') ? true : false),'type':$(this).data('type')};
|
||||
}
|
||||
});
|
||||
$('#vboxSettingsDialog').data('vboxMachineData').sharedFolders = folders;
|
||||
|
|
Loading…
Reference in New Issue