Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
-------------------------------------
5.0-2 2015-08-12
-------------------------------------
Translation fixes

Fixed error when creating host-only networks

Fixed host-only network DHCP server settings

Fix USB device attaching / detaching from Settings menu of a
running VM.

-------------------------------------
5.0-1 2015-08-05
-------------------------------------
Expand Down
60 changes: 43 additions & 17 deletions endpoints/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Injects language translations into phpVirtualBox as a JavaScript object and
* provides interface translation logic
* Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
*
*
* $Id: language.php 595 2015-04-17 09:50:36Z imoore76 $
*/

Expand Down Expand Up @@ -40,52 +40,78 @@
// Failsafe wrapper
function trans(s,c,n,h) {

if(s && c && c.constructor === Array) {
o = c.shift();
n = c.shift();
h = c.shift();
c = o;
}
if(!c) c = 'VBoxGlobal';

var r = transreal(s,c,n,h);

if(typeof r != 'string') {

if(typeof r != 'string') {
// console.log('Could not translate ' + s + ' with ' + c);
return s;
}

return r;
}

function transreal(w,context,number,comment) {

try {

if(__vboxLangData['contexts'][context]['messages'][w]['translation']) {

if(__vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform']) {

var t = __vboxLangData['contexts'][context]['messages'][w]['translation']['numerusform'];

if(!number) number = 1;

if(number <= 1 && t[0]) return t[0];
if(number > 1 && t[1]) return t[1];
if(t[0]) return t[0];
return t[1];
}
/*
if (__vboxLangData['contexts'][context]['messages'][w] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w]['translation_attr']['type'] == 'obsolete') {
console.log(w + ' in ' + context + ' is obsolete');
}
*/
return __vboxLangData['contexts'][context]['messages'][w]['translation'];

} else if(__vboxLangData['contexts'][context]['messages'][w][0]) {

if(comment) {
for(var i in __vboxLangData['contexts'][context]['messages'][w]) {
if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
if(__vboxLangData['contexts'][context]['messages'][w][i]['comment'] == comment) {
/*
if (__vboxLangData['contexts'][context]['messages'][w][i]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][i]['translation_attr']['type'] == 'obsolete') {
console.log(w + ' ' + ' and ' + comment + ' is obsolete');
}
*/

return __vboxLangData['contexts'][context]['messages'][w][i]['translation'];
}
}
}
/*
if (__vboxLangData['contexts'][context]['messages'][w][0] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr'] && __vboxLangData['contexts'][context]['messages'][w][0]['translation_attr']['type'] == 'obsolete') {
console.log(w + ' in ' + context + ' is obsolete');
}
*/

return __vboxLangData['contexts'][context]['messages'][w][0]['translation'];

} else {
return w;
}

} catch(err) {
// alert(w + ' - ' + context + ': ' + err);
// console.log(w + ' - ' + context + ': ' + err);
return w;
}
}
}

2 changes: 1 addition & 1 deletion endpoints/lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/*
* This version of phpVirtualBox
*/
define('PHPVBOX_VER', '5.0-1');
define('PHPVBOX_VER', '5.0-2');

class phpVBoxConfigClass {

Expand Down
4 changes: 2 additions & 2 deletions endpoints/lib/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ function __construct() {
}


self::$langdata = unserialize(file_get_contents(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat'));
self::$langdata = unserialize(@file_get_contents(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat'));

$xmlObj = simplexml_load_string(file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
$xmlObj = simplexml_load_string(@file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml'));
$arrXml = $this->objectsIntoArray($xmlObj);

$lang = array();
Expand Down
18 changes: 1 addition & 17 deletions endpoints/lib/vboxconnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1463,8 +1463,6 @@ private function _machineSaveRunning($args, $state) {
$m->setExtraData('phpvb/icon', $args['customIcon']);
}

$m->setExtraData('GUI/SaveMountedAtRuntime', ($args['GUI']['SaveMountedAtRuntime'] == 'no' ? 'no' : 'yes'));

// VRDE settings
try {
if($m->VRDEServer && $this->vbox->systemProperties->defaultVRDEExtPack) {
Expand Down Expand Up @@ -1914,8 +1912,6 @@ public function remote_machineSave($args) {

$m->VRAMSize = $args['VRAMSize'];

$m->setExtraData('GUI/SaveMountedAtRuntime', ($args['GUI']['SaveMountedAtRuntime'] == 'no' ? 'no' : 'yes'));

// Video
$m->accelerate3DEnabled = $args['accelerate3DEnabled'];
$m->accelerate2DVideoEnabled = $args['accelerate2DVideoEnabled'];
Expand Down Expand Up @@ -2360,7 +2356,6 @@ public function remote_progressGet($args) {

// progress operation result
$response = array();
$success = 1;
$error = 0;

// Connect to vboxwebsrv
Expand All @@ -2382,7 +2377,6 @@ public function remote_progressGet($args) {
} catch (Exception $e) {
$this->errors[] = $e;
throw new Exception('Could not obtain progress operation: '.$args['progress']);
$success = 0;
}

$response['progress'] = $args['progress'];
Expand Down Expand Up @@ -2428,16 +2422,9 @@ public function remote_progressGet($args) {
}
} catch (Exception $null) {}

// Some progress operations seem to go away after completion
if(!($this->session->handle && (string)$this->session->state == 'Unlocked')) {
$this->errors[] = $e;
$success = 0;
}

}

if($error) {
$success = 0;
if(@$args['catcherrs']) $response['error'] = $error;
else $this->errors[] = new Exception($error['message']);

Expand Down Expand Up @@ -3832,7 +3819,6 @@ public function remote_machineCreate($args) {
$this->session->machine->setExtraData('VBoxAuthSimple/users/'.$_SESSION['user'].'', $_SESSION['uHash']);

// Always set
$this->session->machine->setExtraData('GUI/SaveMountedAtRuntime', 'yes');
$this->session->machine->setExtraData('GUI/FirstRun', 'yes');

try {
Expand Down Expand Up @@ -4261,8 +4247,7 @@ private function _machineGetDetails(&$m) {
'bootOrder' => $this->_machineGetBootOrder($m),
'chipsetType' => (string)$m->chipsetType,
'GUI' => array(
'SaveMountedAtRuntime' => $m->getExtraData('GUI/SaveMountedAtRuntime'),
'FirstRun' => $m->getExtraData('GUI/FirstRun')
'FirstRun' => $m->getExtraData('GUI/FirstRun'),
),
'customIcon' => (@$this->settings->enableCustomIcons ? $m->getExtraData('phpvb/icon') : ''),
'disableHostTimeSync' => intval($m->getExtraData("VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled")),
Expand Down Expand Up @@ -5358,7 +5343,6 @@ public function remote_mediumMount($args) {
/* @var $machine IMachine */
$machine = $this->vbox->findMachine($args['vm']);
$state = (string)$machine->sessionState;
$save = (strtolower($machine->getExtraData('GUI/SaveMountedAtRuntime')) == 'yes');

// create session
$this->session = $this->websessionManager->getSessionObject($this->vbox->handle);
Expand Down
12 changes: 9 additions & 3 deletions js/chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,26 @@ var vboxChooser = {

// Group menu
case 'group':
vboxChooser._vmGroupContextMenuObj = new vboxMenu(vboxChooser._anchorid+'vmgroups',null,menuitems);
vboxChooser._vmGroupContextMenuObj = new vboxMenu({'name': vboxChooser._anchorid+'vmgroups',
'menuItems': menuitems,
'language_context': 'UIActionPool'});
vboxChooser._vmGroupContextMenuObj.update();
break;

// VM Menu
case 'vm':
vboxChooser._vmContextMenuObj = new vboxMenu(vboxChooser._anchorid+'vms',null,menuitems);
vboxChooser._vmContextMenuObj = new vboxMenu({'name': vboxChooser._anchorid+'vms',
'menuItems': menuitems,
'language_context': 'UIActionPool'});
vboxChooser._vmContextMenuObj.update();
break;

// Main list menu
case 'anchor':

var vboxChooserPaneMenu = new vboxMenu(vboxChooser._anchorid+'Pane',null,menuitems);
var vboxChooserPaneMenu = new vboxMenu({'name': vboxChooser._anchorid+'Pane',
'menuItems': menuitems,
'language_context': 'UIActionPool'});
$('#'+vboxChooser._anchorid).parent().contextMenu({
menu: vboxChooserPaneMenu.menuId()
},
Expand Down
6 changes: 0 additions & 6 deletions js/datamediator.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,6 @@ $(document).ready(function(){

break;

// Save mounted media changes at runtime
case 'GUI/SaveMountedAtRuntime':
if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
vboxVMDataMediator.vmDetailsData[eventData.machineId].GUI.SaveMountedAtRuntime = eventData.value;
break;

// First time run
case 'GUI/FirstRun':
if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
Expand Down
18 changes: 9 additions & 9 deletions js/dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function vboxWizardImportApplianceDialog() {

/* Common settings */
this.name = 'wizardImportAppliance';
this.title = trans('Import Virtual Applicance','UIWizardImportApp');
this.title = trans('Import Virtual Appliance','UIWizardImportApp');
this.bg = 'images/vbox/vmw_ovf_import_bg.png';
this.icon = 'import';
this.steps = 2;
Expand Down Expand Up @@ -506,7 +506,7 @@ function vboxWizardNewVMDialog(vmgroup) {
$(this).empty().remove();
vboxNewVMFinish();
};
vboxConfirm(trans('You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.','UIMessageCenter'), buttons, trans('Go Back','UIMessageCenter'));
vboxConfirm(trans('You are about to create a new virtual machine without a hard disk. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.','UIMessageCenter'), buttons, trans('Go Back','UIMessageCenter'));
return;
}

Expand Down Expand Up @@ -611,7 +611,7 @@ function vboxWizardCloneVMDialog(args) {
}).fail(function(){
self.completed.reject();
});
},'progress_clone_90px.png',trans('Clone the selected virtual machine','UIActionPool'),
},'progress_clone_90px.png',trans('Clone selected virtual machine','UIActionPool'),
self.args.vm.name + ' > ' + name);
} else {
self.completed.reject();
Expand Down Expand Up @@ -735,13 +735,13 @@ function vboxVMMDialog(select,type,hideDiff,mPath) {
$('#vboxVMMDialog').trigger('close').empty().remove();
};
}
buttons[trans('Close','UIMediumManager')] = function() {
buttons[trans('Close','UIMessageCenter')] = function() {
$('#vboxVMMDialog').trigger('close').empty().remove();
results.reject();
};

$("#vboxVMMDialog").dialog({'closeOnEscape':true,'width':800,'height':500,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent vboxVMMDialog','title':'<img src="images/vbox/diskimage_16px.png" class="vboxDialogTitleIcon" /> '+trans('Virtual Media Manager','VBoxMediaManagerDlg')}).on("dialogbeforeclose",function(){
$(this).parent().find('span:contains("'+trans('Close','VBoxMediaManagerDlg')+'")').trigger('click');
$(this).parent().find('span:contains("'+trans('Close','UIMessageCenter')+'")').trigger('click');
});

vboxVMMInit(hideDiff,mPath);
Expand Down Expand Up @@ -789,7 +789,7 @@ function vboxWizardNewHDDialog(suggested) {

/* Common options */
this.name = 'wizardNewHD';
this.title = trans('Create Virtual Hard Drive','UIWizardNewVD');
this.title = trans('Create Virtual Hard Disk','UIWizardNewVD');
this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
this.icon = 'hd';
this.steps = 3;
Expand Down Expand Up @@ -899,7 +899,7 @@ function vboxWizardNewHDDialog(suggested) {
}
};
ml.run();
},'progress_media_create_90px.png',trans('Create a new virtual hard drive','VBoxMediaManagerDlg'),
},'progress_media_create_90px.png',trans('Create a virtual hard disk now','UIWizardNewVM'),
vboxBasename(file),true);
} else {
self.completed.reject();
Expand Down Expand Up @@ -929,7 +929,7 @@ function vboxWizardCopyHDDialog(suggested) {

/* Common options */
this.name = 'wizardCopyHD';
this.title = trans('Copy Virtual Hard Drive','UIWizardCloneVD');
this.title = trans('Copy Virtual Hard Disk','UIWizardCloneVD');
this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
this.icon = 'hd';
this.steps = 4;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ function vboxWizardCopyHDDialog(suggested) {
self.completed.resolve(mid);
};
ml.run();
},'progress_media_create_90px.png',trans('Copy Virtual Hard Drive','UIWizardCloneVD'),
},'progress_media_create_90px.png',trans('Copy Virtual Hard Disk','UIWizardCloneVD'),
vboxBasename(vboxMedia.getMediumById(src).location) + ' > ' + vboxBasename(loc));
} else {
self.completed.reject();
Expand Down
Loading