summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt2910
-rw-r--r--GPLv3.txt1240
-rw-r--r--LICENSE.txt32
-rw-r--r--css/jquery-ui.css2378
-rw-r--r--css/tipped.css86
-rw-r--r--endpoints/api.php774
-rw-r--r--endpoints/jqueryFileTree.php770
-rw-r--r--endpoints/language.php234
-rw-r--r--endpoints/lib/auth/ActiveDirectory.php406
-rw-r--r--endpoints/lib/auth/LDAP.php6
-rw-r--r--endpoints/lib/auth/OpenMediaVault.php230
-rw-r--r--endpoints/lib/authinterface.php212
-rw-r--r--endpoints/lib/config.php538
-rw-r--r--endpoints/lib/language.php302
-rw-r--r--endpoints/lib/utils.php188
-rw-r--r--endpoints/rdp.php64
-rw-r--r--index.html1024
-rw-r--r--js/canvasimages.js1296
-rw-r--r--js/chooser.js4900
-rw-r--r--js/datamediator.js928
-rw-r--r--js/dialogs.js3450
-rw-r--r--js/eventlistener.js500
-rw-r--r--js/jquery.jec-1.3.1.js1720
-rw-r--r--js/jquery.scrollTo-min.js20
-rw-r--r--js/utils.js2752
-rw-r--r--languages/cs.xml508
-rw-r--r--languages/de.xml510
-rw-r--r--languages/es.xml510
-rw-r--r--languages/fr.xml510
-rw-r--r--languages/it.xml510
-rw-r--r--languages/ja.xml510
-rw-r--r--languages/languages.txt380
-rw-r--r--languages/nl.xml510
-rw-r--r--languages/pl.xml510
-rw-r--r--languages/pt_br.xml508
-rw-r--r--languages/ro.xml510
-rw-r--r--languages/ru.xml508
-rw-r--r--languages/zh_cn.xml506
-rw-r--r--languages/zh_tw.xml6
-rw-r--r--panes/about.html36
-rw-r--r--panes/chooser.html192
-rw-r--r--panes/guestNetAdapters.html226
-rw-r--r--panes/login.html72
-rw-r--r--panes/settingsAudio.html232
-rw-r--r--panes/settingsDisplay.html392
-rw-r--r--panes/settingsGeneral.html892
-rw-r--r--panes/settingsGlobalGeneral.html194
-rw-r--r--panes/settingsGlobalLanguage.html144
-rw-r--r--panes/settingsGlobalNetwork.html1314
-rw-r--r--panes/settingsGlobalUsers.html516
-rw-r--r--panes/settingsNetwork.html1058
-rw-r--r--panes/settingsParallelPorts.html384
-rw-r--r--panes/settingsPortForwarding.html390
-rw-r--r--panes/settingsSerialPorts.html462
-rw-r--r--panes/settingsSharedFolders.html730
-rw-r--r--panes/settingsStorage.html3408
-rw-r--r--panes/settingsSystem.html932
-rw-r--r--panes/settingsUSB.html826
-rw-r--r--panes/tabVMConsole.html82
-rw-r--r--panes/tabVMConsoleRDP.html1008
-rw-r--r--panes/tabVMConsoleVNC.html376
-rw-r--r--panes/tabVMDetails.html1502
-rw-r--r--panes/tabVMSnapshots.html1836
-rw-r--r--panes/tabs.html354
-rw-r--r--panes/toolbar.html1112
-rw-r--r--panes/topmenu.html572
-rw-r--r--panes/userEdit.html128
-rw-r--r--panes/vmlogs.html210
-rw-r--r--panes/vmm.html2264
-rw-r--r--panes/vmmISCSI.html100
-rw-r--r--panes/vmmModify.html68
-rw-r--r--panes/wizardCloneVM.html256
-rw-r--r--panes/wizardCloneVMAdvanced.html200
-rw-r--r--panes/wizardCopyHD.html490
-rw-r--r--panes/wizardCopyHDAdvanced.html434
-rw-r--r--panes/wizardExportAppliance.html680
-rw-r--r--panes/wizardExportApplianceAdvanced.html640
-rw-r--r--panes/wizardFirstRun.html156
-rw-r--r--panes/wizardImportAppliance.html1104
-rw-r--r--panes/wizardImportApplianceAdvanced.html1072
-rw-r--r--panes/wizardNewVM.html686
-rw-r--r--panes/wizardNewVMAdvanced.html552
-rw-r--r--recovery.php-disabled140
83 files changed, 30944 insertions, 30934 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 23303f2..7eb734d 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,1450 +1,1460 @@
--------------------------------------
- 5.2-0
--------------------------------------
-Long overdue post 5.0 support (5.2 at this stage)
-PHP 7.1 support thanks to @mikedld
-New Czech localization thanks to @p-bo
-MySQL autho module thanks to @tioigor96
-Various bugfixes thanks to @tschoening and @ashway83
-
--------------------------------------
- 5.0-5 2016-01-08
--------------------------------------
-PHP 7 support
-
--------------------------------------
- 5.0-4 2015-12-07
--------------------------------------
-Fixed bug in file / folder browser when $browserRestrictFolders is
-set.
-https://sourceforge.net/p/phpvirtualbox/bugs/50/
-
-Fixed bug in host network interface sorting.
-https://sourceforge.net/p/phpvirtualbox/bugs/36/
-
-Fixed bug where phpVirtualBox installations on the same server may
-share session cookies in certain PHP configurations.
-
-Fixed bug where noPreview=true; was ignored in settings.
-https://sourceforge.net/p/phpvirtualbox/bugs/38/
-
--------------------------------------
- 5.0-3 2015-09-09
--------------------------------------
-Fixed file browser header content type causing blank file / folder
-contents
-https://sourceforge.net/p/phpvirtualbox/bugs/49/
-
-Fixed selection highlighting in file / folder browser
-
-Fixed all VMs in a group starting on the same RDP port
-https://sourceforge.net/p/phpvirtualbox/bugs/46/
-
-Fixed missing en.xml language file
-https://sourceforge.net/p/phpvirtualbox/bugs/45/
-
--------------------------------------
- 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
--------------------------------------
-Fix paths in recovery.php-disabled
-
-Fix Content-type header in api.php
-
-Fix add medium button context menu in VM settings
-
-Fix RDP link
-
-Fix bug when changing password
-
-Removed unused OnAdditionsStateChanged event
-
-Change in the way Windows drive list is obtained
-
-Fixed errors manipulating groups when $phpVboxGroups is set
-
--------------------------------------
- 5.0-0 2015-07-18
--------------------------------------
-VirtualBox 5.0 compatibility.
-
-Progress operations are now listed in order of creation from top
-top bottom.
-
--------------------------------------
- 4.3-3 2015-04-04
--------------------------------------
-Added 2d/3d video acceleration configuration options in VM
-settings
-
-Fixed guest OS icon for Linux 2.6 (32-bit)
-
-Added $eventListenerTimeout configuration option.
-
-Upgraded jQuery to 1.11.2 and jQuery-ui to 1.11.4
-
--------------------------------------
- 4.3-2 2014-12-16
--------------------------------------
-
-Updated documentation to remove all googlecode.com references.
-
-Changing the guest OS type now updates LongMode CPU Feature of VM.
-https://sourceforge.net/p/phpvirtualbox/bugs/31/
-
-Removed phptest.php and related check to see if PHP parsing works
-correctly. This gives a false negative result in some browsers
-/ web server configurations.
-https://sourceforge.net/p/phpvirtualbox/bugs/32/
-
-Copied missing image from VirtualBox src.
-
-Fixed bug that would incorrectly determine the name of some images
-causing 404s in web server logs and broken images.
-
-Fixed bug in global NAT network settings that would not save the
-'Active' checkbox setting.
-
--------------------------------------
- 4.3-1 2014-01-02
--------------------------------------
-
-Fixed bug that would not stop the Global Preferences dialog from
-being displayed when $noAuth was enabled or some other auth method
-was set in config.php
-https://sourceforge.net/p/phpvirtualbox/bugs/7/
-
-Fixed JavaScript error when $enforceVMOwnership is enabled
-https://sourceforge.net/p/phpvirtualbox/bugs/9/
-
-Updated the links to point to new Sourceforge home instead of
-googlecode
-http://sourceforge.net/p/phpvirtualbox/bugs/11/
-
-Updated guest OS type icons
-
-Allow SCSI and SAS controllers to have CD/DVD drives
-
--------------------------------------
- 4.3-0 2013-10-17
--------------------------------------
-VirtualBox 4.3.x support.
-
-Fixed behavior when a VM is inaccessible.
-
-Fixed Clone VM Wizard bug that would not keep MAC addresses even
-when 'Reinitialize MAC address...' was not set
-https://sourceforge.net/p/phpvirtualbox/bugs/3/
-
-Fixed bug that would not allow a VM to be powered off if it stuck
-https://sourceforge.net/p/phpvirtualbox/bugs/5/
-
--------------------------------------
- 4.2-8 2013-10-15
--------------------------------------
-Updated media menus to indicate which media is already mounted
-by the given virtual machine.
-
-Minor UI enhancements.
-
-Fixed bug when collapsing and expanding the Preview box in VM
-details sections that would leave an arrow image drawn over the
-preview image.
-
-Removed bug workarounds for old version of Opera.
-
-Minor translation bug fixes.
-
-Added VNC viewer for VirtualBox-OSE with VNC support
-(experimental).
-
-VRDE port in the Details pane is now a vnc:// link if VirtualBox
-with VNC support is detected and the VM is running.
-
--------------------------------------
- 4.2-7 2013-08-12
--------------------------------------
-Upgraded jQuery from 1.8.2 to 1.10.2. Updated code to reflect
-library changes.
-
-Upgraded jQuery-UI from 1.8.23 to 1.10.3. Updated code to reflect
-library changes.
-
-Consolidated some JavaScript, and CSS files where possible.
-
-Minor translation fixes.
-
-Some VM properties are now editable when a VM is in a Saved state.
-
-Fixed bug when selecting a medium by location where it would have
-to be selected twice.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=641
-
-Minor UI enhancements.
-
-EHCI is no longer enabled by default on USB controller when
-creating a new VM.
-
-Moved USB, Serial, and Parallel port settings back into their own
-sections.
-
-Progress operation text is now resizable.
-
-Fixed bug that would not update VM display when a VM's custom icon
-was changed.
-
-Fixed bug when refreshing VM data that would not cause redraws of
-certain sections.
-
-Fixed display of Acceleration properties in VM details view.
-
-Added ability to handle more than one instance of SATA, SAS, and
-SCSI controllers in VM settings.
-
-Changed new controller names when creating a new VM to align with
-VirtualBox naming conventions.
-
-Added support for setting VNC properties in the Remote Display tab
-of VM settings (beta). The console tab is still RDP specific.
-
-Added ability to change servers while operations are in progress.
-
-Better election of new hard drive names in Create Virtual Hard
-Drive wizards.
-
-Cloning operations are no longer modal.
-
-Snapshot operations are no longer modal.
-
--------------------------------------
- 4.2-6 2013-07-22
--------------------------------------
-Fixed bug where deleting or renaming a VM snapshot may not cause
-the chooser to refresh VM data.
-
-Minor translation bug fixes.
-
-Fixed "Restore Defaults" button in Appliance Export Wizard.
-
-VM settings dialog now prompts for reload if settings change while
-the dialog is open.
-
-VM settings dialog is now aware of VM state changes while the
-dialog is open and updates VM editability accordingly.
-
-Fixed XSS vulnerability.
-
-Fixed bug that would not subscribe to events of machines that were
-powered on while phpVirtualBox is open.
-
-Added icons from VirtualBox source for Windows 8.1 and 2012.
-
-Updated language files from latest VirtualBox release (4.2.16).
-
-Added running VM count to VM Group tool tips.
-
-Removing a copy of a VM in the chooser now removes it from the
-interface rather than unregistering it.
-
-Improved VM Group saving logic. Some items are no longer editable
-or draggable while VM group definitions are being saved to
-VirtualBox.
-
-Minor UI changes.
-
-Fixed bug that would not allow VMs to be dropped / copied into the
-root VM group.
-
--------------------------------------
- 4.2-5 2013-07-11
--------------------------------------
-More details pane redraw fixes when VM selection list changes
-while VM data is still loading
-
-Fixed multiple IE8 bugs that affected selecting and removing VMs
-
-Fixed bug that would incorrectly set the VRDE host to null if no
-consoleHost was configured in config.php
-http://code.google.com/p/phpvirtualbox/issues/detail?id=620
-
-Added workaround for VirtualBox bug that generates an error when
-taking or restoring snapshots.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=614
-
-Fixed bug that would not allow starting VMs if
-$vmMemoryStartLimitWarn was enabled in config.php
-http://code.google.com/p/phpvirtualbox/issues/detail?id=619
-
-VMs that are selected in the VM list are now selected by default
-in the Export Appliance Wizard
-http://code.google.com/p/phpvirtualbox/issues/detail?id=629
-
-Fixed bug in ActiveDirectory authentication module that would not
-correctly recognize the adminUser setting.
-https://code.google.com/p/phpvirtualbox/issues/detail?id=649
-
-Fixed bug that would not allow 'Stuck' VMs to be powered off.
-https://code.google.com/p/phpvirtualbox/issues/detail?id=651
-
-Fixed bug that would not allow "." to be entered in an IP address
-text box in some cases.
-https://code.google.com/p/phpvirtualbox/issues/detail?id=653
-
-Fixed bug in LDAP authentication module that would not allow users
-to log in.
-https://code.google.com/p/phpvirtualbox/issues/detail?id=687
-
-Canceling the 'First Run' wizard now resumes starting the VM.
-
--------------------------------------
- 4.2-4 2012-11-02
--------------------------------------
-Fixed details pane redraws when VM selection list changes while VM
-data is still loading
-
-Added VM group tooltips
-
-Fixed bug that would not display the first VM added to VirtualBox
-when there were no other VMs until the page was refreshed
-
-Fixed bug that would not allow attachment of USB devices from the
-Settings menu
-
-Cleaned up snapshot logic and snapshot list UI
-
-Taking a snapshot of a running VM now automatically pauses the VM
-to take the snapshot and resumes it once the snapshot has been
-taken
-
-Minor look and feel changes to more closely match the VirtualBox
-GUI
-
-Added First Run wizard
-
-Major rewrite of AJAX data <-> vboxwebsrv back-end interaction
-
-PHP session support is no longer required and AJAX requests should
-be a little more responsive
-
-Fixed bug that would not save DHCP server settings of host-only
-network interfaces
-
-Fixed bug in Clone Virtual Machine wizard that would not create a
-full clone when in 'Expert' (Hide Description) mode
-
-Reintroduced the Stop button in place of the Discard button in the
-main window toolbar
-
-Cleaned up wizards to perform expected actions when pressing Enter
-
-vboxinit now reads VBOX_BIN_PATH if set in /etc/default/virtualbox
-and adds it to the PATH environment variable
-http://code.google.com/p/phpvirtualbox/issues/detail?id=616
-
-If multiple servers are configured, progress operation rows now
-contain the server's name on which the operation was performed
-http://code.google.com/p/phpvirtualbox/issues/detail?id=617
-
-Fixed bug in IE8 that would prevent opening a detached console
-window for any VM that has a space in its name
-
--------------------------------------
- 4.2-3b 2012-10-21
--------------------------------------
-Fixed error when detaching a VM console window
-http://code.google.com/p/phpvirtualbox/issues/detail?id=613
-
--------------------------------------
- 4.2-3 2012-10-21
--------------------------------------
-Fixed line endings in vboxinit
-http://code.google.com/p/phpvirtualbox/issues/detail?id=606
-
-Fixed VM state change updates that did not update menus and
-toolbars
-
-Fixed bug that would hide the Remote Display tab in VM settings
-while a VM is running
-
-Fixed Preview section update bug that would not update the preview
-window at the selected interval
-
-Removed obsolete configuration items from config.php-example
-
-Fixed UI updating of UI components when a VM is added or removed
-from a selected group or its subgroups
-
-Added PHP version check
-
-Better error handling when the VirtualBox event listener fails
-
-Menu bug that would not always trigger an action when a menu item
-was clicked
-
-Added check for PHP LDAP extension in LDAP authentication module
-
-Added Active Directory authentication module
-
-Fixed bug in Virtual Media Manager that would fail to properly
-refresh media
-
-Fixed permission errors that would enforce VM ownership actions
-even when $enforceVMOwnership was not enabled in config.php
-
-Changing servers while an operation is in progress is no longer
-allowed as it causes progress operations to fail
-
-Preview screen is now a hardware accelerated HTML5 canvas if
-supported by the browser
-
-Improved support for older browsers (IE 8, FF 3.6, Opera 10)
-
-Added better visual indication in the Details section of when a
-VM's VRDE server fails to start - its port number is now red and
-has a line through it
-
-Improved redraw and menu update logic
-
--------------------------------------
- 4.2-2 2012-10-15
--------------------------------------
-Look-and-feel changes to more closely match the VirtualBox GUI
-
-Better UI handling of long group and VM names
-
-Fixed bug causing phpVirtualBox to not load in IE unless the
-JavaScript console was open
-
-Added config option to exclusively use phpVirtualBox's own groups
-configuration rather than VirtualBox groups - see
-config.php-example for more info
-
-Fixed bug that would leave group information (vm / group counts
-and icons) always visible after renaming a group
-
-Improved redraw logic for VM data in the Details section / tab
-
-Improved chooser grouping logic when grouping multiple items
-
-GUI state information is now saved in browser's localStorage
-instead of using cookies
-http://www.w3schools.com/html/html5_webstorage.asp
-
-Collapsed state of groups is now remembered if the browser
-supports localStorage
-
--------------------------------------
- 4.2-1 2012-10-09
--------------------------------------
-VirtualBox 4.2.x compatibility release
-
-Various regression bug fixes from beta versions
-
-Moved to using VirtualBox's passive event listener mechanism, and
-as a result:
-
-PHP session support is now required
-
-PHP minimum requirement is now at 5.2.0 (released in 2006)
-
--------------------------------------
- 4.2-0b 2012-09-27
--------------------------------------
-VirtualBox 4.2.x compatibility - beta release
-NOT ALL VirtualBox 4.2 FEATURES ARE IMPLEMENTED!!
-http://code.google.com/p/phpvirtualbox/issues/detail?id=585
-
-Various regression bug fixes.
-
-Fixed vboxinit script for users that have /bin/false or some other
-invalid shell.
-
-Updated languages.
-
-Added advanced mode ("Hide Description") to wizards.
-
--------------------------------------
- 4.2-0 2012-09-25
--------------------------------------
-VirtualBox 4.2.x compatibility - beta release
-NOT ALL VirtualBox 4.2 FEATURES ARE IMPLEMENTED!!
-http://code.google.com/p/phpvirtualbox/issues/detail?id=585
-
-Updated jquery to 1.8.2 and jquery-ui to 1.8.23
-
-Corrected IE9 support.
-
-Removed Firefox App Tab support.
-
--------------------------------------
- 4.1-8 2012-08-20
--------------------------------------
-Fixed bug that would error out when creating a VM without a boot
-disk.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=482
-
-Fixed bug that would cause the progress bar to hang when
-performing progress operations in some cases.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=495
-
-Fixed "Next" arrow wizard code bug visible when the number of
-wizard steps changes at run-time.
-
-Fixed bug that would fail to generate a correct RDP connection
-file when enforceVMOwnership is set.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=523
-
-Fixed bug when creating HDD on drive letters under Windows.
-
-Fixed Windows Bug when selecting folder from Hard Drive List
-
-Added better support for IE9.
-
-Added LDAP authentication module.
-
-Cosmetic changes in init script output.
-
--------------------------------------
- 4.1-7 2012-01-17
--------------------------------------
-Fixed bug that would not properly set the Use host I/O cache
-and Enable Page Fusion settings.
-
-Added Windows 8 OS icons.
-
-Cleaned up Wizard code.
-
-Removed unused images from source tree.
-
--------------------------------------
- 4.1-6.1 2012-01-03
--------------------------------------
-Fixed bug for IE 8 that would prevent the Global Preferences
-dialog from opening.
-
--------------------------------------
- 4.1-6 2012-01-02
--------------------------------------
-Added $startStopConfig to config.php-example
-
-Added Traditional Chinese (zh_tw) translation.
-
-Fixed bug that would not allow the mounting of media when its
-path or file name contains a quote.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=474
-
--------------------------------------
- 4.1-5 2011-11-15
--------------------------------------
-Fixed bug that would not set Acceleration options for a VM if the
-$enableAdvancedConfig option was not set in config.php
-http://code.google.com/p/phpvirtualbox/issues/detail?id=438
-
-Added OpenMediaVault authentication module.
-
-Added option to set VM startup mode and associated config option
-in config.php. Use vboxinit script in phpVirtualBox's root folder.
-
-Fixed a bug in IE 8 that would cause the "Loading ..." screen to
-stay in place after login.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=455
-
-Added $enableGuestAdditionsVersionDisplay setting and associated
-functionality to display guest additions version of a running
-VM on its Details tab.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=454
-
-Added Romanian translation.
-
--------------------------------------
- 4.1-4 2011-10-17
--------------------------------------
-$vmMemoryOffset if configured, is now displayed in yellow(-ish) in
-the host memory usage graph.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=414
-
-Fixed bug that would throw a VirtualBox error when cloning the
-"Current State" item of a virtual machine on the Snapshot tab.
-
-Fixed regression bug that would show all USB devices as being
-attached to the selected VM in the USB Devices section of the
-Settings toolbar menu.
-
-Fixed bug that would cause an error when "USB Devices" was clicked
-in the Settings toolbar menu.
-
-Minor UI changes.
-
-Fixed Export Appliance wizard so that it now displays the correct
-Export Appliance instructions rather than the Import Appliance
-wizard instructions.
-
-Added $enableHDFlushConfig configuration setting. For more info
-see "Responding to guest IDE/SATA flush requests" at:
-http://www.virtualbox.org/manual/ch12.html#idp12757424
-
-Added workaround for http://www.virtualbox.org/ticket/9255. Taking
-a snapshot of a running VM now prompts to pause the VM. This check
-was added in 4.1-3, now however it no longer verifies the
-VirtualBox version. 4.1-3 assumed this would be fixed in
-VirtualBox versions > 4.1.2.
-
-Added support for network adapter "Generic Properties" when the
-Generic Driver adapter type is selected.
-
-Added Doxygen style comments to PHP and JavaScript files.
-
-Added Chinese translation.
-
--------------------------------------
- 4.1-3 2011-9-20
--------------------------------------
-Added Polish translation.
-
-Fixed 4.1-0 regression bug that would not allow runtime attachment
-of USB devices from the Settings menu in the toolbar.
-
-Fixed 4.1-1 regression bug that would not allow one to edit
-existing USB filters for a running VM.
-
-Better handling of CD/DVD medium changes when 'Live CD/DVD' is not
-selected for a medium attachment.
-
-Less context menu levels for removable media attachments in the
-Settings toolbar button menu of a running VM when the VM only has 1
-removable media attachment of the a given type (CD/DVD and Floppy).
-
-Improved Guest Additions installation handling.
-
-Added test to check that PHP files are being parsed as PHP and
-associated error message if not.
-
-Added Parallels hard disk image format creation support. Available
-hard disk formats and their capabilities are now programmatically
-obtained through the VirtualBox API.
-
-Minor translation fixes.
-
-Advanced acceleration options are now correctly hidden when
-enableAdvancedConfig is not enabled in config.php.
-
-Login form on console tab is now hidden if remote console
-authentication is set to None. This should avoid some confusion.
-
-Improved PHP session handling. This should resolve some timeout
-issues and speed up response time in phpVirtualBox.
-
-Added context menus to the Virtual Media Manager.
-
-Added workaround for http://www.virtualbox.org/ticket/9255. Taking
-a snapshot of a running VM now prompts to pause the VM if
-VirtualBox <= 4.1.2 is detected.
-
-Fixed VM cloning bug.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=380
-
-Fixed some display issues for GTK based web browsers when a dark
-GTK theme is applied.
-
-Added check to see that get_magic_quotes_gpc() function exists
-before calling it. This fix problems for people running newer
-(unsupported) versions of PHP.
-
-Fixed bug where phpVirtualBox would try to pre-load images that do
-not exist - causing 404 errors in web server logs.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=396
-
-Added host memory usage information when the VirtualBox host is
-selected in the VM list. See associated hostMemInfoRefreshInterval
-option in config.php-example.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=402
-
-Added $vmListMinimal config option and associated code. See
-config.php-example.
-
-Added $vmMemoryStartLimitWarn and associated logic to emit a
-warning when starting a virtual machine would use more memory
-than the host has available.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=291
-
-Added context menu to VM list.
-
-A list of drives is now displayed when browsing for a file or
-folder when Windows is detected. This can be turned off if desired
-using the $noWindowsDriveList configuration option in config.php.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=388
-
-Fixed bug when creating or copying a new VMDK disk image where the
-disk would always be split into files < 2GB regardless of whether
-or not the "split" option was selected.
-
--------------------------------------
- 4.1-2 2011-8-21
--------------------------------------
-Added Stop options to VM list context menu.
-
-Fixed bug in Global Preferences that would not allow you to save
-settings if a Language was not selected in the Languages section.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=348
-
-Added context menus to VM Storage settings.
-
-Fixed bug that would cause network adapters to disconnect and
-reconnect when saving settings of a running VM.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=361
-
-Changing a VM name in the Appliance Import Wizard now
-automatically updates virtual disk image paths.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=362
-
-Minor translation fixes.
-
-Added Linked Clone support to match VirtualBox 4.1.2.
-
-Fixed bug when the bridged adapter of a VM was assigned to a host
-sub-interface. This would not allow for selection of the interface
-in VM settings.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=371
-
-Fixed bug in VM log viewer that would not display log file
-contents when non-utf-8 characers are present.
-
--------------------------------------
- 4.1-1b 2011-8-1
--------------------------------------
-Added snapshot thumbnail and full image link when viewing snapshot
-details of an online snapshot.
-
-Added context menus for snapshots.
-
-Minor UI changes.
-
-Fixed page fusion setting bug for people running VirtualBox in a
-32-bit OS with a 64-bit processor.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=347
-
--------------------------------------
- 4.1-1 2011-8-1
--------------------------------------
-Upgraded jquery-ui to 1.8.14
-
-Numerous translation bug fixes.
-
-VM settings are now available while VM is running. Some settings
-can be modified.
-
-Minor UI changes.
-
-Fixed bug that would activate all configured USB filters when
-saving a VM.
-
-Implemented overwriting of existing file in appliance export
-wizard.
-
-Fixed bug in IE that would not allow for the entry of internal
-network names in VM settings.
-
-Fixed Clone VM wizard bug that would force the selection of
-"Current machine and all child states."
-
-Removed "Current machine and all child states" option from Clone
-VM wizard as it is unsupported by VirtualBox at this time.
-
-Fixed display bug in VM log viewer when pressing the Refresh
-button.
-
-Snapshots tab now prompts to take a new snapshot when attempting to
-restore a snapshot while VM is in a (changed) Saved state.
-
-Added license agreement dialog when importing appliances that have
-a license.
-
-Added a check for phpVirtualBox <-> VirtualBox versions.
-
-Added "Restore Defaults" button and functionality to appliance
-import wizard.
-
-Added Page Fusion setting in VM Settings -> System -> Motherboard
-when $enableAdvancedConfig is set in config.php.
-
-Fixed bug that would not allow a disk to be set to Multi-attach.
-
-Fixed bug with PHP versions < 5.2 that would not enable network
-cards of VMs when saving VM settings.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=333
-
-Added $enableAppTabSupport configuration option and feature. See
-config.php-example for more information.
-
-Added "Split into files of less than 2GB" option when creating or
-copying VMDK disks.
-
-Fixed bug in New Virtual Disk Wizard that would create all hard
-disk images in VDI format regardless of which format was selected.
-
-WSDL files now contain VirtualBox version number in file names.
-This should fix any WSDL file caching issues after a VBox upgrade.
-
-Fixed bug for OS X hosts that would not allow the Settings dialog
-to be displayed.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=338
-
-VM Settings -> System -> Acceleration tab now always appears, but
-is disabled if host CPU does not support virtualization extensions.
-
-CPUs are limited to 1 if host CPU does not support virtualization
-extensions. Mimicking the VirtualBox GUI.
-
-Host CPU features are now displayed regardless of config.php
-$enableAdvancedConfig setting.
-
-Fixed bug in Storage settings that would always display the Port
-Count option. Even when a non-SATA controller was selected.
-
-Fixed bug that would not close the progress dialog after taking a
-snapshot.
-
--------------------------------------
- 4.1-0 2011-7-19
--------------------------------------
-VirtualBox 4.1.x compatibility.
-
-jquery upgrade to 1.6.2.
-
-Fixed issue where exported disks would be incorrectly named when
-exporting a virtual machine.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=307
-
-UI updates for wizards.
-
-Most translations are now taken from the VirtualBox source .qt
-files.
-
--------------------------------------
- 4.0-7 2011-6-8
--------------------------------------
-Removed $sessionSecurityLevel setting and associated logic as it
-really provided no extra session security.
-
-Fixed session bug where another client running the same browser
-from the same subnet could inherit another user's session.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=295
-
-Fixed bug that would not allow you to edit more than one host-only
-networking adapter.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=310
-
-Added $consoleKeyboardLayout setting.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=248
-
--------------------------------------
- 4.0-6 2011-5-24
--------------------------------------
-Pressing Esc key now closes most dialog boxes.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=237
-
-File / folder browser no longer shows "Access Denied" message
-when $restrictFolders is configured.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=238
-
-Hard disks that are already attached to a VM are not elected to
-be attached when adding a Hard Disk attachment in VM settings.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=239
-
-Pressing Enter key works on add user form.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=240
-
-Fixed bug in appliance import wizard where changed values would
-not be reflected in the interface after changing them.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=243
-
-Added simple authentication plugin framework.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=249
-
-Added disableHostTimeSync option when $enableAdvancedConfig is
-set.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=226
-
-When selecting media, the file / folder browser remembers the last
-media location.
-
-Added custom VM icons functionality and related $enableCustomIcons
-setting.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=225
-
-Added "Bind to IP" setting for NAT network adapters when
-$enableAdvancedConfig is set.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=232
-
-Fixed bug that would not correctly set the host network adapter of
-a running VM when changing the adapter to bridged mode.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=245
-
-Port forwarding protocol is now selectable in advanced NAT
-options.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=263
-
-Network adapters on the VirtualBox Host details page now shows
-which VMs (and their adapters) are attached.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=276
-
-Host / port setting is now exposed and editable on the console
-tab.
-
-Fixed bug when viewing snapshot details that would keep appending
-rows to the details pane rather than clearing then redrawing info.
-
-Fixed bug that would throw an exception when a DHCP server does not
-exist on a host-only interface.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=278
-
-Fixed bug that would cause IPv6 information to not be displayed
-for host interfaces when viewing VirtualBox host details.
-
--------------------------------------
- 4.0-5 2011-3-26
--------------------------------------
-Added Norwegian translation.
-
-Added Japanese translation.
-
-Fixed translation of 'Log in' in log in dialog.
-
-Fixed bug that would not allow editing of NAT port forwarding
-http://code.google.com/p/phpvirtualbox/issues/detail?id=215
-
-Virtual Media Manager now has scrolling media list and sortable
-columns.
-
-Fixed bug / error in RDP file generation script that occurs when
-the remote console port is configured for a range or list of
-ports.
-
-Storage controller pane now resizes as expected.
-
-Attached USB devices in VM settings is now obtained in real-time
-rather than only when the settings dialog is first opened.
-
-Fixed clone medium bug that would always clone a disk as
-dynamically expanding storage type no matter which option was
-selected.
-
-Fixed bug when removing a VM when using PHP < 5.2.0.
-
-Fixed bug when editing shared folders of a non-running VM.
-
-Log in form now submits when pressing enter.
-
-Import / Export Appliances now has scrolling lists.
-
-Fixed bug when PHP does not have session support enabled. This
-incorrectly displays the error 'Not logged in.' each time an
-action is attempted in phpVirtualBox.
-
-Fixed CRLF injection security hole in rdp.php.
-
--------------------------------------
- 4.0-4b 2011-3-1
--------------------------------------
-Fixed bug that would not display error messages when attempting
-to log in if there was an error connecting to vboxwebsrv.
-
--------------------------------------
- 4.0-4 2011-3-1
--------------------------------------
-Added Exclusive and VPID hardware acceleration options to
-Acceleration tab visible when $enableAdvancedConfig is set.
-
-Added "Automatic" SATA Port Count option to the SATA Port Count
-list when $enableAdvancedConfig is set. New VMs created through
-phpVirtualBox will automatically have this set to Auto.
-
-Fixed bug that would display the Input tab rather than the
-Description tab when clicking on the Description section link in
-the VM Details section if $enableAdvancedConfig is set.
-
-Fixed bug that would reload the list of VMs rather than refresh
-the list when resetting a VM.
-
-Fixed bug that would not change some settings when using
-PHP < 5.2.0. This was reported by CentOS users regarding the
-Cable Connected network setting in particular.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=192
-
-Fixed bug that would not allow you to add a VM through Machine ->
-Add when using PHP < 5.2.0.
-
-Circumvent unconfirmed VirtualBox bug when trying to obtain a
-screen shot for the Preview window returns "Could not take a
-screenshot (VERR_TRY_AGAIN)." screen.php now runs
-console->display->invalidateAndUpdate() on error.
-
-VM settings while running are now available via the Settings
-button on the toolbar. Moved Install Guest Additions function
-to this menu.
-
-Added more files to default $browserRestrictFiles setting.
-
-OS Type can now be changed when importing a VM.
-
-Added $previewAspectRatio config option.
-
-Fixed bug that would always set consoleHost to the server being
-connected to as specified by $location in config.php.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=199
-
-To ensure a more sane default setting, the remote display IP is
-now determined in the following order:
- - consoleHost setting if set in config.php
- - IP address if set in VM's vrdeaddress setting
- - IP address / host specified of server's $location setting
- in config.php
- - If setting is 127.0.0.1 or localhost, use phpVirtualBox's IP
- address / hostname in its URL as determined by the web
- browser.
-
-Fixed multi-server bug when initial server is unreachable.
-http://code.google.com/p/phpvirtualbox/issues/detail?id=200
-
-Added basic user authentication and associated options.
-
-Added icons to dialog titles.
-
-Added Spanish (Latin America) translation.
-
-Fixed preview window redraws in Safari and Chrome (webkit).
-
-jQuery upgrade to 1.5.1.
-
-jQuery UI upgrade to 1.8.9.
-
-Fixed Opera bug that would cause it to stop refreshing the list of
-VMs.
-
-Maximize use of browser caching when grabbing images for preview
-window utilizing ETag and If-Modified-Since HTTP headers.
-
-Added Parallel Port configuration and associated $enableLPTConfig
-configuration setting - EXPERIMENTAL - VirtualBox provides no
-documentation or official support for this. Nor can I. LPT support
-only works in Linux.
-
-Added CD/DVD and Floppy drives to host details.
-
-Host details now displays CPU features if $enableAdvancedConfig
-is enabled.
-
-OS Type selectors now properly display only OS types supported by
-the VirtualBox host based on its processors' features.
-
-Minor UI changes.
-
-Adding media through the Virtual Media Manager now updates the
-"recent media" list.
-
-Added advanced NAT settings for Network Adapters visible when
-$enableAdvancedConfig is set.
-
-Updated German translations.
-
-Added GPLv3.txt and updated verbiage in LICENSE.txt.
-
-Updated Storage VM Settings pane to mimic VirtualBox GUI resizable
-behavior.
-
-Added right-click functionality and tooltips to VMs in the VM
-list.
-
-Added more vmListSort options - including the option to manually
-sort VMs with drag-and-drop. See config.php-example.
-
--------------------------------------
- 4.0-3 2011-2-10
--------------------------------------
-UI fixes for some browsers when dragging the resize bar.
-
-SATA controllers can now have CD/DVD media attachments.
-
-Support for Chipset option on Motherboard tab in VM settings when
-VirtualBox >= 4.0.2 is detected.
-http://www.virtualbox.org/ticket/7885
-
-Snapshots with no children can be deleted while VM is running.
-
-Improved snapshot name generation.
-
-Snapshot ages are now periodically updated when viewing the
-Snapshots tab.
-
-Snapshot dates are now displayed instead of age for snapshots
-taken more than 30 days ago.
-
-File / folder browser now scrolls to selected file / folder.
-
-Added Russian translation.
-
-Added Portuguese (Brazil) translation.
-
-Added Italian translation.
-
-Updated French and German translations to the best of my ability
-using nls files from VirtualBox source and Google translate.
-Corrections are welcome.
-
-Improved multi-language support for PHP installations that do not
-have JSON enabled / installed.
-
-Language can now be changed in File -> Preferences -> Language.
-
-UI changes in an attempt to make things look and feel less "flat."
-
-JavaScript changes to speed things up in IE.
-
-Added VDE Network adapter support. Your underlying VirtualBox
-installation must support this, and it must be enabled in
-config.php.
-
-Fixed improper display of Remote Display Server port when
-accessing phpVirtualBox through http://ip:port/..
-
-To ensure proper configuration when accessing the remote display
-of a VM through NAT, remote display IP is now determined in the
-following order:
- - consoleHost setting if set in config.php
- - IP address if set in VM's vrdeaddress setting
- - phpVirtualBox's IP address / hostname in its URL as
- determined by the web browser
-
-Added Serial Port configuration.
-
-Added $disableSataPortCount config option to disable setting SATA
-controllers' port count to the max port number found when saving
-VM settings.
-
-New Hard Disk Wizard hard disk location defaults to VM's folder
-where appropriate.
-
-Fixed bug that would not allow the creation of Fixed size storage.
-
-Added $enableAdvancedConfig to configuration options in config.php.
-This allows you to change the following VM configuration options:
- - HPET (System section -> Motherboard tab)
- - Nested Paging (System section -> Acceleration tab)
- - Large Pages (System section -> Acceleration tab)
- - VT-x / AMD-V (System section -> Acceleration tab)
- - VRDE Net Address (Display section -> Remote Display tab)
- - SATA Port Count (Storage section -> select a SATA controller)
- - Mouse type (General section -> Input tab)
- - Keyboard type (General section -> Input tab)
- - Create new hard disk from Virtual Media Manager (New button)
- - Add new media from Virtual Media Manager (Add button)
- - Clone hard disk from Virtual Media Manager
- (Actions menu -> Clone)
- - Make hard disk immutable from Virtual Media Manager
- (Actions menu -> Immutable)
- - Make hard disk "normal" from Virtual Media Manager
- (Actions menu -> Normal)
- - Add iSCSI disk from Virtual Media Manager (Add iSCSI button)
- - All media selection menus have a Virtual Media Manager
- button
-
-Note that these items will not be translated. See the VirtualBox
-documentation for more information on what these settings will
-change / actions these will perform.
-
-Media selection now behaves the same as it does in the VirtualBox
-GUI.
-
-Some features of the Virtual Media Manager have been removed to
-mimic the one in the VirtualBox GUI.
-
-Changed versioning scheme.
-
-New configuration model where config.php-example is distributed
-instead of config.php. This should allow for persistent user
-configuration. All config logic is now in lib/config.php.
-
--------------------------------------
- 4-2 - 2011-1-14
--------------------------------------
-Viewing a VM's screenshot in a new window while running now
-prints a descriptive error rather than displaying a blank
-screen if the Oracle VM Extension Pack is not installed.
-
-Re-enabled console tab in IE. Disabling it in the first place
-was because of a HUGE oversight on my part :) Which leads to
-the next feature.
-
-Console tab now displays a message if the Adobe Flash plugin is
-not installed.
-
-Host network card and drive list is now properly refreshed when
-refreshing host info via the Machine -> Refresh menu item.
-
-Added MAC Address to Guest Network Adapters dialog.
-
-Default RDP port when creating a VM is now 3389-4000. Allowing
-for a range of ports.
-
-Fixed VM creation bug that created all VMs with an Unknown OS
-type and name set to the specified OS type.
-
-Fixed VM creation bug that would incorrectly display 'None' as
-the hard drive after creation until the newly created VM was
-refreshed.
-
-Tuned down PHP error reporting to keep Notices from being
-displayed when PHP's default error reporting is set too high
-in user's PHP config.
-
-Fixed bug that would not display a list of internal networks
-in VM network settings.
-
-Network settings are now (somewhat) changeable while a VM is
-running. This mimics the same functionality as the VirtualBox
-GUI.
-
-Shared folder settings are now changeable while a VM is
-running.
-
-Added VirtualBox guest additions installation feature.
-
-Added 'Add VM' feature.
-
-Fixed issue where VM disks were created in the VirtualBox
-folder rather than being created in the VM folder when using
-the New Virtual Machine Wizard.
-
-Fixed bug that would not import SCSI controllers and attached
-disk images when using the Import Appliance Wizard.
-
-Added progress operation images.
-
-Updated text when deleting / removing a VM to match VirtualBox
-GUI.
-
-USB devices can now be attached / detached to a running VM.
-
-Medium attachments for storage controllers on VM details tab
-are now properly sorted instead of printed in the arbitrary
-order that they are read from VirtualBox.
-
-VRDE Server (remote display) is now enabled by default when
-creating a new VM.
-
-Refreshing the VirualBox host in the machine list now refreshes
-system properties cache as well.
-
-Fixed preview window scrolling bug. In some browsers, the
-preview thumbnail would stay in place as the window was
-scrolled.
-
-Fixed browser quirks when switching VMs. This would cause the
-vm list pane to grow in width while a VM was loading in
-certain browsers.
-
--------------------------------------
- 4-1 - 2011-01-09
--------------------------------------
-Changed behavior of file browser to always use config setting
-for browserLocal regardless of browser's host. This should be
-OK now that IVFSExplorer bugs are fixed in VirtualBox 4.0.
-
-Fixed bug in Create HardDisk wizard functionality that would
-only allow a disk of size 1MB to be created.
-
-Fixed bug in display settings when the RDP extension pack is
-not installed.
-
-Fixed "Detach" console bug.
-
-Disable Console tab when IE is detected. The Flash RDP client
-from Oracle does not appear to work with IE. Even the demo
-distributed with the flash control does not work. It appears
-that RDPWebEventLoaded event is never triggered after the
-flash control loads. -- Invalid - 2011-1-10
-
-Max HD slider size in New HD wizard is now limited to 512GB.
-Anything over that and the slider loses so much precision that
-it becomes useless. You may still type a larger size in the
-size text box. E.g. "1 TB"
-
--------------------------------------
- 4-0 - 2011-01-07
--------------------------------------
-UI and back-end changes to match new version of VirtualBox.
-
-Updated jquery-ui to 1.8.2.
-
-Updated jquery to 1.4.4
-
-Fixed bug that would not allow console connections if accessing
-phpVirtualBox through a URL where a port is specified. E.g.
-http://myhost:8080/phpVirtualBox
-
-Added json_encode() for PHP compiled with --disable-json and
-PHP versions < 5.2.0.
-
-Fixed compatibility issues with PHP 5.1.x.
-
-"rdpHost" setting changed to "consoleHost"
-
-Added VirtualBox version to host in VM list and on the host
-details tab.
-
-Added multiple server functionality.
-
-Fixed case sensitivity for $browserRestrictFiles setting.
-
-Fixed bug when using OSE where the Shared Folders section would
-not be selected when "Shared Folders" is clicked on from the
-Details tab / section.
-
-Exporting a VM defaults to '.ova' file.
-
-Added language contexts.
-
-Changed cache temp dir location to try environment variables
-first.
-
-Fixed bug that would not send the 'Esc' key to the console when
-pressed.
-
-Changed back to GPL license.
-
-Added multiple server support.
-
-You can now power off a VM that is in a "Stuck" state.
-
-Versioning scheme is now
- (VirtualBox compatible version)-(phpVirtualBox version)
-
-Fixed bug that would not display error message on failure to
-connect to vboxwebsrv.
-
-Removed old imgpng requirement as VirtualBox can now export
-screenshots as PNG data.
-
-Fixed media mounting bug that would not allow anything other than
-host drives to be mounted.
-
--------------------------------------
- 0.5 - 2010-08-10
--------------------------------------
-Fixed some English translations.
-
-Added fr_fr and de_de languages.
-
-Fixed top toolbar and Virtual Media Manger translation bugs.
-
-Fixed OSE startup bug and removed console tab when OSE is
-detected.
-
-Fixed Host Details bug that would not display the VirtualBox
-host server's details when it is selected in the list of vms.
-
-Fixed bug in File -> Preferences that would not correctly
-reflect a change made to any preferences on the General tab.
-
-Workaround for Console tab resize bug that would disconnect from
-an existing console session when the window was resized. Now, it
-automatically reconnects after a window resize event.
-
-Applied UI enhancements patch supplied by compuwizard123
-http://code.google.com/u/compuwizard123/
-
-Host details now include VirtualBox version.
-
--------------------------------------
- 0.4 - 2010-07-24
--------------------------------------
-Fixed numerous translation bugs.
-
-Fixed bug that would not allow the addition of more than 4
-storage controller types in VM Settings.
-
-Changed WSDL cache to use memory only instead of both memory
-and disk. (PHP SoapClient WSDL_CACHE_MEMORY option).
-
-RDP host (for console tab and details tab RDP links) is now
-selected in the following order:
- 1) VM Configured host (would have to be set with VboxManage)
- 2) rdpHost setting in config.php
- 3) host in location setting of config.php
- *) if host is 'localhost' or '127.0.0.1' use web browser
- location's URL host as last resort
-
-Fixed bug in file / folder browser that would display the full
-path of files / folders rather than just their names. This only
-affected *nix web servers connecting to VirtualBox running on
-Windows hosts. I can't imagine this is a very common scenario:)
-
-Better error handling and meaningful error message when there
-is a PHP error, and phpVirtualBox fails to load.
-
-Fixed bug that would not allow you to enter your own internal
-network name in VM network configurations where Attached To: is
-set to Internal Network.
-
-Fixed bug that would break phpVirtualBox when
-allow_call_time_pass_reference is set to Off in php.ini.
-
-Removed ReflectionClass dependency. This also changes all
-config options in config.php to use 'var' instead of 'const.'
-
-License changed from GPL to MIT.
-
--------------------------------------
- 0.3 - 2010-07-05
--------------------------------------
-Fixed bug in file/folder browser that would incorrectly display
-files as folders and folders as files in some cases.
-
-Added Console tab.
-
-Added OSE support. This effectively removes the console tab,
-USB, and VRDP support when OSE is detected.
-
-Fixed bug in Host-networking interfaces pane that would cause
-tabs to disappear if editing a host interface more than once
-without refreshing.
-
-Made VM list and main tab content scrollable.
-
-Added Guest Network Adapter info. This queries guest additions
-for network adapter IP information of a running VM.
-
-Added Clone, Make Immutable, and Make Normal functionality to
-Virtual Media Manager.
-
-Fixed bug in Virtual Media Manager that would allow a user to
-try to release a medium that is attached to a snapshot. This
-attempt would always fail.
-
-Fixed bug that would cause saving USB filters to fail.
-
-Added Import / Export Appliance. NOTE: Some configurable
-import settings are ignored (e.g. network interface type).
-These are also ignored when importing from the VirtualBox
-GUI, and so appears to be a bug in VirtualBox itself.
-
-Added file type icons to file / folder browser.
-
-Fixed internal network dropdown list in Virtual Machine
-settings.
-
--------------------------------------
- 0.2 - 2010-06-14
--------------------------------------
-Initial Release
+-------------------------------------
+ 5.2-1 2018-07-13
+-------------------------------------
+New 5.2 icons thanks to @der-eismann
+Import/Export fix thanks to @tom077
+Snapshot pane fixes and faster dialogs thanks to @Adam5Wu
+Convert to unix file format to reduce size
+
+-------------------------------------
+ 5.2-0 2018-02-16
+-------------------------------------
+Long overdue post 5.0 support (5.2 at this stage)
+PHP 7.1 support thanks to @mikedld
+New Czech localization thanks to @p-bo
+MySQL autho module thanks to @tioigor96
+Various bugfixes thanks to @tschoening and @ashway83
+Huge support effort from @tom077!
+Thanks to everyone who's helped bring this project back up to speed!
+
+-------------------------------------
+ 5.0-5 2016-01-08
+-------------------------------------
+PHP 7 support
+
+-------------------------------------
+ 5.0-4 2015-12-07
+-------------------------------------
+Fixed bug in file / folder browser when $browserRestrictFolders is
+set.
+https://sourceforge.net/p/phpvirtualbox/bugs/50/
+
+Fixed bug in host network interface sorting.
+https://sourceforge.net/p/phpvirtualbox/bugs/36/
+
+Fixed bug where phpVirtualBox installations on the same server may
+share session cookies in certain PHP configurations.
+
+Fixed bug where noPreview=true; was ignored in settings.
+https://sourceforge.net/p/phpvirtualbox/bugs/38/
+
+-------------------------------------
+ 5.0-3 2015-09-09
+-------------------------------------
+Fixed file browser header content type causing blank file / folder
+contents
+https://sourceforge.net/p/phpvirtualbox/bugs/49/
+
+Fixed selection highlighting in file / folder browser
+
+Fixed all VMs in a group starting on the same RDP port
+https://sourceforge.net/p/phpvirtualbox/bugs/46/
+
+Fixed missing en.xml language file
+https://sourceforge.net/p/phpvirtualbox/bugs/45/
+
+-------------------------------------
+ 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
+-------------------------------------
+Fix paths in recovery.php-disabled
+
+Fix Content-type header in api.php
+
+Fix add medium button context menu in VM settings
+
+Fix RDP link
+
+Fix bug when changing password
+
+Removed unused OnAdditionsStateChanged event
+
+Change in the way Windows drive list is obtained
+
+Fixed errors manipulating groups when $phpVboxGroups is set
+
+-------------------------------------
+ 5.0-0 2015-07-18
+-------------------------------------
+VirtualBox 5.0 compatibility.
+
+Progress operations are now listed in order of creation from top
+top bottom.
+
+-------------------------------------
+ 4.3-3 2015-04-04
+-------------------------------------
+Added 2d/3d video acceleration configuration options in VM
+settings
+
+Fixed guest OS icon for Linux 2.6 (32-bit)
+
+Added $eventListenerTimeout configuration option.
+
+Upgraded jQuery to 1.11.2 and jQuery-ui to 1.11.4
+
+-------------------------------------
+ 4.3-2 2014-12-16
+-------------------------------------
+
+Updated documentation to remove all googlecode.com references.
+
+Changing the guest OS type now updates LongMode CPU Feature of VM.
+https://sourceforge.net/p/phpvirtualbox/bugs/31/
+
+Removed phptest.php and related check to see if PHP parsing works
+correctly. This gives a false negative result in some browsers
+/ web server configurations.
+https://sourceforge.net/p/phpvirtualbox/bugs/32/
+
+Copied missing image from VirtualBox src.
+
+Fixed bug that would incorrectly determine the name of some images
+causing 404s in web server logs and broken images.
+
+Fixed bug in global NAT network settings that would not save the
+'Active' checkbox setting.
+
+-------------------------------------
+ 4.3-1 2014-01-02
+-------------------------------------
+
+Fixed bug that would not stop the Global Preferences dialog from
+being displayed when $noAuth was enabled or some other auth method
+was set in config.php
+https://sourceforge.net/p/phpvirtualbox/bugs/7/
+
+Fixed JavaScript error when $enforceVMOwnership is enabled
+https://sourceforge.net/p/phpvirtualbox/bugs/9/
+
+Updated the links to point to new Sourceforge home instead of
+googlecode
+http://sourceforge.net/p/phpvirtualbox/bugs/11/
+
+Updated guest OS type icons
+
+Allow SCSI and SAS controllers to have CD/DVD drives
+
+-------------------------------------
+ 4.3-0 2013-10-17
+-------------------------------------
+VirtualBox 4.3.x support.
+
+Fixed behavior when a VM is inaccessible.
+
+Fixed Clone VM Wizard bug that would not keep MAC addresses even
+when 'Reinitialize MAC address...' was not set
+https://sourceforge.net/p/phpvirtualbox/bugs/3/
+
+Fixed bug that would not allow a VM to be powered off if it stuck
+https://sourceforge.net/p/phpvirtualbox/bugs/5/
+
+-------------------------------------
+ 4.2-8 2013-10-15
+-------------------------------------
+Updated media menus to indicate which media is already mounted
+by the given virtual machine.
+
+Minor UI enhancements.
+
+Fixed bug when collapsing and expanding the Preview box in VM
+details sections that would leave an arrow image drawn over the
+preview image.
+
+Removed bug workarounds for old version of Opera.
+
+Minor translation bug fixes.
+
+Added VNC viewer for VirtualBox-OSE with VNC support
+(experimental).
+
+VRDE port in the Details pane is now a vnc:// link if VirtualBox
+with VNC support is detected and the VM is running.
+
+-------------------------------------
+ 4.2-7 2013-08-12
+-------------------------------------
+Upgraded jQuery from 1.8.2 to 1.10.2. Updated code to reflect
+library changes.
+
+Upgraded jQuery-UI from 1.8.23 to 1.10.3. Updated code to reflect
+library changes.
+
+Consolidated some JavaScript, and CSS files where possible.
+
+Minor translation fixes.
+
+Some VM properties are now editable when a VM is in a Saved state.
+
+Fixed bug when selecting a medium by location where it would have
+to be selected twice.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=641
+
+Minor UI enhancements.
+
+EHCI is no longer enabled by default on USB controller when
+creating a new VM.
+
+Moved USB, Serial, and Parallel port settings back into their own
+sections.
+
+Progress operation text is now resizable.
+
+Fixed bug that would not update VM display when a VM's custom icon
+was changed.
+
+Fixed bug when refreshing VM data that would not cause redraws of
+certain sections.
+
+Fixed display of Acceleration properties in VM details view.
+
+Added ability to handle more than one instance of SATA, SAS, and
+SCSI controllers in VM settings.
+
+Changed new controller names when creating a new VM to align with
+VirtualBox naming conventions.
+
+Added support for setting VNC properties in the Remote Display tab
+of VM settings (beta). The console tab is still RDP specific.
+
+Added ability to change servers while operations are in progress.
+
+Better election of new hard drive names in Create Virtual Hard
+Drive wizards.
+
+Cloning operations are no longer modal.
+
+Snapshot operations are no longer modal.
+
+-------------------------------------
+ 4.2-6 2013-07-22
+-------------------------------------
+Fixed bug where deleting or renaming a VM snapshot may not cause
+the chooser to refresh VM data.
+
+Minor translation bug fixes.
+
+Fixed "Restore Defaults" button in Appliance Export Wizard.
+
+VM settings dialog now prompts for reload if settings change while
+the dialog is open.
+
+VM settings dialog is now aware of VM state changes while the
+dialog is open and updates VM editability accordingly.
+
+Fixed XSS vulnerability.
+
+Fixed bug that would not subscribe to events of machines that were
+powered on while phpVirtualBox is open.
+
+Added icons from VirtualBox source for Windows 8.1 and 2012.
+
+Updated language files from latest VirtualBox release (4.2.16).
+
+Added running VM count to VM Group tool tips.
+
+Removing a copy of a VM in the chooser now removes it from the
+interface rather than unregistering it.
+
+Improved VM Group saving logic. Some items are no longer editable
+or draggable while VM group definitions are being saved to
+VirtualBox.
+
+Minor UI changes.
+
+Fixed bug that would not allow VMs to be dropped / copied into the
+root VM group.
+
+-------------------------------------
+ 4.2-5 2013-07-11
+-------------------------------------
+More details pane redraw fixes when VM selection list changes
+while VM data is still loading
+
+Fixed multiple IE8 bugs that affected selecting and removing VMs
+
+Fixed bug that would incorrectly set the VRDE host to null if no
+consoleHost was configured in config.php
+http://code.google.com/p/phpvirtualbox/issues/detail?id=620
+
+Added workaround for VirtualBox bug that generates an error when
+taking or restoring snapshots.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=614
+
+Fixed bug that would not allow starting VMs if
+$vmMemoryStartLimitWarn was enabled in config.php
+http://code.google.com/p/phpvirtualbox/issues/detail?id=619
+
+VMs that are selected in the VM list are now selected by default
+in the Export Appliance Wizard
+http://code.google.com/p/phpvirtualbox/issues/detail?id=629
+
+Fixed bug in ActiveDirectory authentication module that would not
+correctly recognize the adminUser setting.
+https://code.google.com/p/phpvirtualbox/issues/detail?id=649
+
+Fixed bug that would not allow 'Stuck' VMs to be powered off.
+https://code.google.com/p/phpvirtualbox/issues/detail?id=651
+
+Fixed bug that would not allow "." to be entered in an IP address
+text box in some cases.
+https://code.google.com/p/phpvirtualbox/issues/detail?id=653
+
+Fixed bug in LDAP authentication module that would not allow users
+to log in.
+https://code.google.com/p/phpvirtualbox/issues/detail?id=687
+
+Canceling the 'First Run' wizard now resumes starting the VM.
+
+-------------------------------------
+ 4.2-4 2012-11-02
+-------------------------------------
+Fixed details pane redraws when VM selection list changes while VM
+data is still loading
+
+Added VM group tooltips
+
+Fixed bug that would not display the first VM added to VirtualBox
+when there were no other VMs until the page was refreshed
+
+Fixed bug that would not allow attachment of USB devices from the
+Settings menu
+
+Cleaned up snapshot logic and snapshot list UI
+
+Taking a snapshot of a running VM now automatically pauses the VM
+to take the snapshot and resumes it once the snapshot has been
+taken
+
+Minor look and feel changes to more closely match the VirtualBox
+GUI
+
+Added First Run wizard
+
+Major rewrite of AJAX data <-> vboxwebsrv back-end interaction
+
+PHP session support is no longer required and AJAX requests should
+be a little more responsive
+
+Fixed bug that would not save DHCP server settings of host-only
+network interfaces
+
+Fixed bug in Clone Virtual Machine wizard that would not create a
+full clone when in 'Expert' (Hide Description) mode
+
+Reintroduced the Stop button in place of the Discard button in the
+main window toolbar
+
+Cleaned up wizards to perform expected actions when pressing Enter
+
+vboxinit now reads VBOX_BIN_PATH if set in /etc/default/virtualbox
+and adds it to the PATH environment variable
+http://code.google.com/p/phpvirtualbox/issues/detail?id=616
+
+If multiple servers are configured, progress operation rows now
+contain the server's name on which the operation was performed
+http://code.google.com/p/phpvirtualbox/issues/detail?id=617
+
+Fixed bug in IE8 that would prevent opening a detached console
+window for any VM that has a space in its name
+
+-------------------------------------
+ 4.2-3b 2012-10-21
+-------------------------------------
+Fixed error when detaching a VM console window
+http://code.google.com/p/phpvirtualbox/issues/detail?id=613
+
+-------------------------------------
+ 4.2-3 2012-10-21
+-------------------------------------
+Fixed line endings in vboxinit
+http://code.google.com/p/phpvirtualbox/issues/detail?id=606
+
+Fixed VM state change updates that did not update menus and
+toolbars
+
+Fixed bug that would hide the Remote Display tab in VM settings
+while a VM is running
+
+Fixed Preview section update bug that would not update the preview
+window at the selected interval
+
+Removed obsolete configuration items from config.php-example
+
+Fixed UI updating of UI components when a VM is added or removed
+from a selected group or its subgroups
+
+Added PHP version check
+
+Better error handling when the VirtualBox event listener fails
+
+Menu bug that would not always trigger an action when a menu item
+was clicked
+
+Added check for PHP LDAP extension in LDAP authentication module
+
+Added Active Directory authentication module
+
+Fixed bug in Virtual Media Manager that would fail to properly
+refresh media
+
+Fixed permission errors that would enforce VM ownership actions
+even when $enforceVMOwnership was not enabled in config.php
+
+Changing servers while an operation is in progress is no longer
+allowed as it causes progress operations to fail
+
+Preview screen is now a hardware accelerated HTML5 canvas if
+supported by the browser
+
+Improved support for older browsers (IE 8, FF 3.6, Opera 10)
+
+Added better visual indication in the Details section of when a
+VM's VRDE server fails to start - its port number is now red and
+has a line through it
+
+Improved redraw and menu update logic
+
+-------------------------------------
+ 4.2-2 2012-10-15
+-------------------------------------
+Look-and-feel changes to more closely match the VirtualBox GUI
+
+Better UI handling of long group and VM names
+
+Fixed bug causing phpVirtualBox to not load in IE unless the
+JavaScript console was open
+
+Added config option to exclusively use phpVirtualBox's own groups
+configuration rather than VirtualBox groups - see
+config.php-example for more info
+
+Fixed bug that would leave group information (vm / group counts
+and icons) always visible after renaming a group
+
+Improved redraw logic for VM data in the Details section / tab
+
+Improved chooser grouping logic when grouping multiple items
+
+GUI state information is now saved in browser's localStorage
+instead of using cookies
+http://www.w3schools.com/html/html5_webstorage.asp
+
+Collapsed state of groups is now remembered if the browser
+supports localStorage
+
+-------------------------------------
+ 4.2-1 2012-10-09
+-------------------------------------
+VirtualBox 4.2.x compatibility release
+
+Various regression bug fixes from beta versions
+
+Moved to using VirtualBox's passive event listener mechanism, and
+as a result:
+
+PHP session support is now required
+
+PHP minimum requirement is now at 5.2.0 (released in 2006)
+
+-------------------------------------
+ 4.2-0b 2012-09-27
+-------------------------------------
+VirtualBox 4.2.x compatibility - beta release
+NOT ALL VirtualBox 4.2 FEATURES ARE IMPLEMENTED!!
+http://code.google.com/p/phpvirtualbox/issues/detail?id=585
+
+Various regression bug fixes.
+
+Fixed vboxinit script for users that have /bin/false or some other
+invalid shell.
+
+Updated languages.
+
+Added advanced mode ("Hide Description") to wizards.
+
+-------------------------------------
+ 4.2-0 2012-09-25
+-------------------------------------
+VirtualBox 4.2.x compatibility - beta release
+NOT ALL VirtualBox 4.2 FEATURES ARE IMPLEMENTED!!
+http://code.google.com/p/phpvirtualbox/issues/detail?id=585
+
+Updated jquery to 1.8.2 and jquery-ui to 1.8.23
+
+Corrected IE9 support.
+
+Removed Firefox App Tab support.
+
+-------------------------------------
+ 4.1-8 2012-08-20
+-------------------------------------
+Fixed bug that would error out when creating a VM without a boot
+disk.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=482
+
+Fixed bug that would cause the progress bar to hang when
+performing progress operations in some cases.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=495
+
+Fixed "Next" arrow wizard code bug visible when the number of
+wizard steps changes at run-time.
+
+Fixed bug that would fail to generate a correct RDP connection
+file when enforceVMOwnership is set.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=523
+
+Fixed bug when creating HDD on drive letters under Windows.
+
+Fixed Windows Bug when selecting folder from Hard Drive List
+
+Added better support for IE9.
+
+Added LDAP authentication module.
+
+Cosmetic changes in init script output.
+
+-------------------------------------
+ 4.1-7 2012-01-17
+-------------------------------------
+Fixed bug that would not properly set the Use host I/O cache
+and Enable Page Fusion settings.
+
+Added Windows 8 OS icons.
+
+Cleaned up Wizard code.
+
+Removed unused images from source tree.
+
+-------------------------------------
+ 4.1-6.1 2012-01-03
+-------------------------------------
+Fixed bug for IE 8 that would prevent the Global Preferences
+dialog from opening.
+
+-------------------------------------
+ 4.1-6 2012-01-02
+-------------------------------------
+Added $startStopConfig to config.php-example
+
+Added Traditional Chinese (zh_tw) translation.
+
+Fixed bug that would not allow the mounting of media when its
+path or file name contains a quote.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=474
+
+-------------------------------------
+ 4.1-5 2011-11-15
+-------------------------------------
+Fixed bug that would not set Acceleration options for a VM if the
+$enableAdvancedConfig option was not set in config.php
+http://code.google.com/p/phpvirtualbox/issues/detail?id=438
+
+Added OpenMediaVault authentication module.
+
+Added option to set VM startup mode and associated config option
+in config.php. Use vboxinit script in phpVirtualBox's root folder.
+
+Fixed a bug in IE 8 that would cause the "Loading ..." screen to
+stay in place after login.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=455
+
+Added $enableGuestAdditionsVersionDisplay setting and associated
+functionality to display guest additions version of a running
+VM on its Details tab.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=454
+
+Added Romanian translation.
+
+-------------------------------------
+ 4.1-4 2011-10-17
+-------------------------------------
+$vmMemoryOffset if configured, is now displayed in yellow(-ish) in
+the host memory usage graph.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=414
+
+Fixed bug that would throw a VirtualBox error when cloning the
+"Current State" item of a virtual machine on the Snapshot tab.
+
+Fixed regression bug that would show all USB devices as being
+attached to the selected VM in the USB Devices section of the
+Settings toolbar menu.
+
+Fixed bug that would cause an error when "USB Devices" was clicked
+in the Settings toolbar menu.
+
+Minor UI changes.
+
+Fixed Export Appliance wizard so that it now displays the correct
+Export Appliance instructions rather than the Import Appliance
+wizard instructions.
+
+Added $enableHDFlushConfig configuration setting. For more info
+see "Responding to guest IDE/SATA flush requests" at:
+http://www.virtualbox.org/manual/ch12.html#idp12757424
+
+Added workaround for http://www.virtualbox.org/ticket/9255. Taking
+a snapshot of a running VM now prompts to pause the VM. This check
+was added in 4.1-3, now however it no longer verifies the
+VirtualBox version. 4.1-3 assumed this would be fixed in
+VirtualBox versions > 4.1.2.
+
+Added support for network adapter "Generic Properties" when the
+Generic Driver adapter type is selected.
+
+Added Doxygen style comments to PHP and JavaScript files.
+
+Added Chinese translation.
+
+-------------------------------------
+ 4.1-3 2011-9-20
+-------------------------------------
+Added Polish translation.
+
+Fixed 4.1-0 regression bug that would not allow runtime attachment
+of USB devices from the Settings menu in the toolbar.
+
+Fixed 4.1-1 regression bug that would not allow one to edit
+existing USB filters for a running VM.
+
+Better handling of CD/DVD medium changes when 'Live CD/DVD' is not
+selected for a medium attachment.
+
+Less context menu levels for removable media attachments in the
+Settings toolbar button menu of a running VM when the VM only has 1
+removable media attachment of the a given type (CD/DVD and Floppy).
+
+Improved Guest Additions installation handling.
+
+Added test to check that PHP files are being parsed as PHP and
+associated error message if not.
+
+Added Parallels hard disk image format creation support. Available
+hard disk formats and their capabilities are now programmatically
+obtained through the VirtualBox API.
+
+Minor translation fixes.
+
+Advanced acceleration options are now correctly hidden when
+enableAdvancedConfig is not enabled in config.php.
+
+Login form on console tab is now hidden if remote console
+authentication is set to None. This should avoid some confusion.
+
+Improved PHP session handling. This should resolve some timeout
+issues and speed up response time in phpVirtualBox.
+
+Added context menus to the Virtual Media Manager.
+
+Added workaround for http://www.virtualbox.org/ticket/9255. Taking
+a snapshot of a running VM now prompts to pause the VM if
+VirtualBox <= 4.1.2 is detected.
+
+Fixed VM cloning bug.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=380
+
+Fixed some display issues for GTK based web browsers when a dark
+GTK theme is applied.
+
+Added check to see that get_magic_quotes_gpc() function exists
+before calling it. This fix problems for people running newer
+(unsupported) versions of PHP.
+
+Fixed bug where phpVirtualBox would try to pre-load images that do
+not exist - causing 404 errors in web server logs.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=396
+
+Added host memory usage information when the VirtualBox host is
+selected in the VM list. See associated hostMemInfoRefreshInterval
+option in config.php-example.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=402
+
+Added $vmListMinimal config option and associated code. See
+config.php-example.
+
+Added $vmMemoryStartLimitWarn and associated logic to emit a
+warning when starting a virtual machine would use more memory
+than the host has available.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=291
+
+Added context menu to VM list.
+
+A list of drives is now displayed when browsing for a file or
+folder when Windows is detected. This can be turned off if desired
+using the $noWindowsDriveList configuration option in config.php.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=388
+
+Fixed bug when creating or copying a new VMDK disk image where the
+disk would always be split into files < 2GB regardless of whether
+or not the "split" option was selected.
+
+-------------------------------------
+ 4.1-2 2011-8-21
+-------------------------------------
+Added Stop options to VM list context menu.
+
+Fixed bug in Global Preferences that would not allow you to save
+settings if a Language was not selected in the Languages section.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=348
+
+Added context menus to VM Storage settings.
+
+Fixed bug that would cause network adapters to disconnect and
+reconnect when saving settings of a running VM.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=361
+
+Changing a VM name in the Appliance Import Wizard now
+automatically updates virtual disk image paths.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=362
+
+Minor translation fixes.
+
+Added Linked Clone support to match VirtualBox 4.1.2.
+
+Fixed bug when the bridged adapter of a VM was assigned to a host
+sub-interface. This would not allow for selection of the interface
+in VM settings.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=371
+
+Fixed bug in VM log viewer that would not display log file
+contents when non-utf-8 characers are present.
+
+-------------------------------------
+ 4.1-1b 2011-8-1
+-------------------------------------
+Added snapshot thumbnail and full image link when viewing snapshot
+details of an online snapshot.
+
+Added context menus for snapshots.
+
+Minor UI changes.
+
+Fixed page fusion setting bug for people running VirtualBox in a
+32-bit OS with a 64-bit processor.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=347
+
+-------------------------------------
+ 4.1-1 2011-8-1
+-------------------------------------
+Upgraded jquery-ui to 1.8.14
+
+Numerous translation bug fixes.
+
+VM settings are now available while VM is running. Some settings
+can be modified.
+
+Minor UI changes.
+
+Fixed bug that would activate all configured USB filters when
+saving a VM.
+
+Implemented overwriting of existing file in appliance export
+wizard.
+
+Fixed bug in IE that would not allow for the entry of internal
+network names in VM settings.
+
+Fixed Clone VM wizard bug that would force the selection of
+"Current machine and all child states."
+
+Removed "Current machine and all child states" option from Clone
+VM wizard as it is unsupported by VirtualBox at this time.
+
+Fixed display bug in VM log viewer when pressing the Refresh
+button.
+
+Snapshots tab now prompts to take a new snapshot when attempting to
+restore a snapshot while VM is in a (changed) Saved state.
+
+Added license agreement dialog when importing appliances that have
+a license.
+
+Added a check for phpVirtualBox <-> VirtualBox versions.
+
+Added "Restore Defaults" button and functionality to appliance
+import wizard.
+
+Added Page Fusion setting in VM Settings -> System -> Motherboard
+when $enableAdvancedConfig is set in config.php.
+
+Fixed bug that would not allow a disk to be set to Multi-attach.
+
+Fixed bug with PHP versions < 5.2 that would not enable network
+cards of VMs when saving VM settings.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=333
+
+Added $enableAppTabSupport configuration option and feature. See
+config.php-example for more information.
+
+Added "Split into files of less than 2GB" option when creating or
+copying VMDK disks.
+
+Fixed bug in New Virtual Disk Wizard that would create all hard
+disk images in VDI format regardless of which format was selected.
+
+WSDL files now contain VirtualBox version number in file names.
+This should fix any WSDL file caching issues after a VBox upgrade.
+
+Fixed bug for OS X hosts that would not allow the Settings dialog
+to be displayed.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=338
+
+VM Settings -> System -> Acceleration tab now always appears, but
+is disabled if host CPU does not support virtualization extensions.
+
+CPUs are limited to 1 if host CPU does not support virtualization
+extensions. Mimicking the VirtualBox GUI.
+
+Host CPU features are now displayed regardless of config.php
+$enableAdvancedConfig setting.
+
+Fixed bug in Storage settings that would always display the Port
+Count option. Even when a non-SATA controller was selected.
+
+Fixed bug that would not close the progress dialog after taking a
+snapshot.
+
+-------------------------------------
+ 4.1-0 2011-7-19
+-------------------------------------
+VirtualBox 4.1.x compatibility.
+
+jquery upgrade to 1.6.2.
+
+Fixed issue where exported disks would be incorrectly named when
+exporting a virtual machine.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=307
+
+UI updates for wizards.
+
+Most translations are now taken from the VirtualBox source .qt
+files.
+
+-------------------------------------
+ 4.0-7 2011-6-8
+-------------------------------------
+Removed $sessionSecurityLevel setting and associated logic as it
+really provided no extra session security.
+
+Fixed session bug where another client running the same browser
+from the same subnet could inherit another user's session.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=295
+
+Fixed bug that would not allow you to edit more than one host-only
+networking adapter.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=310
+
+Added $consoleKeyboardLayout setting.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=248
+
+-------------------------------------
+ 4.0-6 2011-5-24
+-------------------------------------
+Pressing Esc key now closes most dialog boxes.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=237
+
+File / folder browser no longer shows "Access Denied" message
+when $restrictFolders is configured.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=238
+
+Hard disks that are already attached to a VM are not elected to
+be attached when adding a Hard Disk attachment in VM settings.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=239
+
+Pressing Enter key works on add user form.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=240
+
+Fixed bug in appliance import wizard where changed values would
+not be reflected in the interface after changing them.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=243
+
+Added simple authentication plugin framework.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=249
+
+Added disableHostTimeSync option when $enableAdvancedConfig is
+set.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=226
+
+When selecting media, the file / folder browser remembers the last
+media location.
+
+Added custom VM icons functionality and related $enableCustomIcons
+setting.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=225
+
+Added "Bind to IP" setting for NAT network adapters when
+$enableAdvancedConfig is set.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=232
+
+Fixed bug that would not correctly set the host network adapter of
+a running VM when changing the adapter to bridged mode.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=245
+
+Port forwarding protocol is now selectable in advanced NAT
+options.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=263
+
+Network adapters on the VirtualBox Host details page now shows
+which VMs (and their adapters) are attached.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=276
+
+Host / port setting is now exposed and editable on the console
+tab.
+
+Fixed bug when viewing snapshot details that would keep appending
+rows to the details pane rather than clearing then redrawing info.
+
+Fixed bug that would throw an exception when a DHCP server does not
+exist on a host-only interface.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=278
+
+Fixed bug that would cause IPv6 information to not be displayed
+for host interfaces when viewing VirtualBox host details.
+
+-------------------------------------
+ 4.0-5 2011-3-26
+-------------------------------------
+Added Norwegian translation.
+
+Added Japanese translation.
+
+Fixed translation of 'Log in' in log in dialog.
+
+Fixed bug that would not allow editing of NAT port forwarding
+http://code.google.com/p/phpvirtualbox/issues/detail?id=215
+
+Virtual Media Manager now has scrolling media list and sortable
+columns.
+
+Fixed bug / error in RDP file generation script that occurs when
+the remote console port is configured for a range or list of
+ports.
+
+Storage controller pane now resizes as expected.
+
+Attached USB devices in VM settings is now obtained in real-time
+rather than only when the settings dialog is first opened.
+
+Fixed clone medium bug that would always clone a disk as
+dynamically expanding storage type no matter which option was
+selected.
+
+Fixed bug when removing a VM when using PHP < 5.2.0.
+
+Fixed bug when editing shared folders of a non-running VM.
+
+Log in form now submits when pressing enter.
+
+Import / Export Appliances now has scrolling lists.
+
+Fixed bug when PHP does not have session support enabled. This
+incorrectly displays the error 'Not logged in.' each time an
+action is attempted in phpVirtualBox.
+
+Fixed CRLF injection security hole in rdp.php.
+
+-------------------------------------
+ 4.0-4b 2011-3-1
+-------------------------------------
+Fixed bug that would not display error messages when attempting
+to log in if there was an error connecting to vboxwebsrv.
+
+-------------------------------------
+ 4.0-4 2011-3-1
+-------------------------------------
+Added Exclusive and VPID hardware acceleration options to
+Acceleration tab visible when $enableAdvancedConfig is set.
+
+Added "Automatic" SATA Port Count option to the SATA Port Count
+list when $enableAdvancedConfig is set. New VMs created through
+phpVirtualBox will automatically have this set to Auto.
+
+Fixed bug that would display the Input tab rather than the
+Description tab when clicking on the Description section link in
+the VM Details section if $enableAdvancedConfig is set.
+
+Fixed bug that would reload the list of VMs rather than refresh
+the list when resetting a VM.
+
+Fixed bug that would not change some settings when using
+PHP < 5.2.0. This was reported by CentOS users regarding the
+Cable Connected network setting in particular.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=192
+
+Fixed bug that would not allow you to add a VM through Machine ->
+Add when using PHP < 5.2.0.
+
+Circumvent unconfirmed VirtualBox bug when trying to obtain a
+screen shot for the Preview window returns "Could not take a
+screenshot (VERR_TRY_AGAIN)." screen.php now runs
+console->display->invalidateAndUpdate() on error.
+
+VM settings while running are now available via the Settings
+button on the toolbar. Moved Install Guest Additions function
+to this menu.
+
+Added more files to default $browserRestrictFiles setting.
+
+OS Type can now be changed when importing a VM.
+
+Added $previewAspectRatio config option.
+
+Fixed bug that would always set consoleHost to the server being
+connected to as specified by $location in config.php.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=199
+
+To ensure a more sane default setting, the remote display IP is
+now determined in the following order:
+ - consoleHost setting if set in config.php
+ - IP address if set in VM's vrdeaddress setting
+ - IP address / host specified of server's $location setting
+ in config.php
+ - If setting is 127.0.0.1 or localhost, use phpVirtualBox's IP
+ address / hostname in its URL as determined by the web
+ browser.
+
+Fixed multi-server bug when initial server is unreachable.
+http://code.google.com/p/phpvirtualbox/issues/detail?id=200
+
+Added basic user authentication and associated options.
+
+Added icons to dialog titles.
+
+Added Spanish (Latin America) translation.
+
+Fixed preview window redraws in Safari and Chrome (webkit).
+
+jQuery upgrade to 1.5.1.
+
+jQuery UI upgrade to 1.8.9.
+
+Fixed Opera bug that would cause it to stop refreshing the list of
+VMs.
+
+Maximize use of browser caching when grabbing images for preview
+window utilizing ETag and If-Modified-Since HTTP headers.
+
+Added Parallel Port configuration and associated $enableLPTConfig
+configuration setting - EXPERIMENTAL - VirtualBox provides no
+documentation or official support for this. Nor can I. LPT support
+only works in Linux.
+
+Added CD/DVD and Floppy drives to host details.
+
+Host details now displays CPU features if $enableAdvancedConfig
+is enabled.
+
+OS Type selectors now properly display only OS types supported by
+the VirtualBox host based on its processors' features.
+
+Minor UI changes.
+
+Adding media through the Virtual Media Manager now updates the
+"recent media" list.
+
+Added advanced NAT settings for Network Adapters visible when
+$enableAdvancedConfig is set.
+
+Updated German translations.
+
+Added GPLv3.txt and updated verbiage in LICENSE.txt.
+
+Updated Storage VM Settings pane to mimic VirtualBox GUI resizable
+behavior.
+
+Added right-click functionality and tooltips to VMs in the VM
+list.
+
+Added more vmListSort options - including the option to manually
+sort VMs with drag-and-drop. See config.php-example.
+
+-------------------------------------
+ 4.0-3 2011-2-10
+-------------------------------------
+UI fixes for some browsers when dragging the resize bar.
+
+SATA controllers can now have CD/DVD media attachments.
+
+Support for Chipset option on Motherboard tab in VM settings when
+VirtualBox >= 4.0.2 is detected.
+http://www.virtualbox.org/ticket/7885
+
+Snapshots with no children can be deleted while VM is running.
+
+Improved snapshot name generation.
+
+Snapshot ages are now periodically updated when viewing the
+Snapshots tab.
+
+Snapshot dates are now displayed instead of age for snapshots
+taken more than 30 days ago.
+
+File / folder browser now scrolls to selected file / folder.
+
+Added Russian translation.
+
+Added Portuguese (Brazil) translation.
+
+Added Italian translation.
+
+Updated French and German translations to the best of my ability
+using nls files from VirtualBox source and Google translate.
+Corrections are welcome.
+
+Improved multi-language support for PHP installations that do not
+have JSON enabled / installed.
+
+Language can now be changed in File -> Preferences -> Language.
+
+UI changes in an attempt to make things look and feel less "flat."
+
+JavaScript changes to speed things up in IE.
+
+Added VDE Network adapter support. Your underlying VirtualBox
+installation must support this, and it must be enabled in
+config.php.
+
+Fixed improper display of Remote Display Server port when
+accessing phpVirtualBox through http://ip:port/..
+
+To ensure proper configuration when accessing the remote display
+of a VM through NAT, remote display IP is now determined in the
+following order:
+ - consoleHost setting if set in config.php
+ - IP address if set in VM's vrdeaddress setting
+ - phpVirtualBox's IP address / hostname in its URL as
+ determined by the web browser
+
+Added Serial Port configuration.
+
+Added $disableSataPortCount config option to disable setting SATA
+controllers' port count to the max port number found when saving
+VM settings.
+
+New Hard Disk Wizard hard disk location defaults to VM's folder
+where appropriate.
+
+Fixed bug that would not allow the creation of Fixed size storage.
+
+Added $enableAdvancedConfig to configuration options in config.php.
+This allows you to change the following VM configuration options:
+ - HPET (System section -> Motherboard tab)
+ - Nested Paging (System section -> Acceleration tab)
+ - Large Pages (System section -> Acceleration tab)
+ - VT-x / AMD-V (System section -> Acceleration tab)
+ - VRDE Net Address (Display section -> Remote Display tab)
+ - SATA Port Count (Storage section -> select a SATA controller)
+ - Mouse type (General section -> Input tab)
+ - Keyboard type (General section -> Input tab)
+ - Create new hard disk from Virtual Media Manager (New button)
+ - Add new media from Virtual Media Manager (Add button)
+ - Clone hard disk from Virtual Media Manager
+ (Actions menu -> Clone)
+ - Make hard disk immutable from Virtual Media Manager
+ (Actions menu -> Immutable)
+ - Make hard disk "normal" from Virtual Media Manager
+ (Actions menu -> Normal)
+ - Add iSCSI disk from Virtual Media Manager (Add iSCSI button)
+ - All media selection menus have a Virtual Media Manager
+ button
+
+Note that these items will not be translated. See the VirtualBox
+documentation for more information on what these settings will
+change / actions these will perform.
+
+Media selection now behaves the same as it does in the VirtualBox
+GUI.
+
+Some features of the Virtual Media Manager have been removed to
+mimic the one in the VirtualBox GUI.
+
+Changed versioning scheme.
+
+New configuration model where config.php-example is distributed
+instead of config.php. This should allow for persistent user
+configuration. All config logic is now in lib/config.php.
+
+-------------------------------------
+ 4-2 - 2011-1-14
+-------------------------------------
+Viewing a VM's screenshot in a new window while running now
+prints a descriptive error rather than displaying a blank
+screen if the Oracle VM Extension Pack is not installed.
+
+Re-enabled console tab in IE. Disabling it in the first place
+was because of a HUGE oversight on my part :) Which leads to
+the next feature.
+
+Console tab now displays a message if the Adobe Flash plugin is
+not installed.
+
+Host network card and drive list is now properly refreshed when
+refreshing host info via the Machine -> Refresh menu item.
+
+Added MAC Address to Guest Network Adapters dialog.
+
+Default RDP port when creating a VM is now 3389-4000. Allowing
+for a range of ports.
+
+Fixed VM creation bug that created all VMs with an Unknown OS
+type and name set to the specified OS type.
+
+Fixed VM creation bug that would incorrectly display 'None' as
+the hard drive after creation until the newly created VM was
+refreshed.
+
+Tuned down PHP error reporting to keep Notices from being
+displayed when PHP's default error reporting is set too high
+in user's PHP config.
+
+Fixed bug that would not display a list of internal networks
+in VM network settings.
+
+Network settings are now (somewhat) changeable while a VM is
+running. This mimics the same functionality as the VirtualBox
+GUI.
+
+Shared folder settings are now changeable while a VM is
+running.
+
+Added VirtualBox guest additions installation feature.
+
+Added 'Add VM' feature.
+
+Fixed issue where VM disks were created in the VirtualBox
+folder rather than being created in the VM folder when using
+the New Virtual Machine Wizard.
+
+Fixed bug that would not import SCSI controllers and attached
+disk images when using the Import Appliance Wizard.
+
+Added progress operation images.
+
+Updated text when deleting / removing a VM to match VirtualBox
+GUI.
+
+USB devices can now be attached / detached to a running VM.
+
+Medium attachments for storage controllers on VM details tab
+are now properly sorted instead of printed in the arbitrary
+order that they are read from VirtualBox.
+
+VRDE Server (remote display) is now enabled by default when
+creating a new VM.
+
+Refreshing the VirualBox host in the machine list now refreshes
+system properties cache as well.
+
+Fixed preview window scrolling bug. In some browsers, the
+preview thumbnail would stay in place as the window was
+scrolled.
+
+Fixed browser quirks when switching VMs. This would cause the
+vm list pane to grow in width while a VM was loading in
+certain browsers.
+
+-------------------------------------
+ 4-1 - 2011-01-09
+-------------------------------------
+Changed behavior of file browser to always use config setting
+for browserLocal regardless of browser's host. This should be
+OK now that IVFSExplorer bugs are fixed in VirtualBox 4.0.
+
+Fixed bug in Create HardDisk wizard functionality that would
+only allow a disk of size 1MB to be created.
+
+Fixed bug in display settings when the RDP extension pack is
+not installed.
+
+Fixed "Detach" console bug.
+
+Disable Console tab when IE is detected. The Flash RDP client
+from Oracle does not appear to work with IE. Even the demo
+distributed with the flash control does not work. It appears
+that RDPWebEventLoaded event is never triggered after the
+flash control loads. -- Invalid - 2011-1-10
+
+Max HD slider size in New HD wizard is now limited to 512GB.
+Anything over that and the slider loses so much precision that
+it becomes useless. You may still type a larger size in the
+size text box. E.g. "1 TB"
+
+-------------------------------------
+ 4-0 - 2011-01-07
+-------------------------------------
+UI and back-end changes to match new version of VirtualBox.
+
+Updated jquery-ui to 1.8.2.
+
+Updated jquery to 1.4.4
+
+Fixed bug that would not allow console connections if accessing
+phpVirtualBox through a URL where a port is specified. E.g.
+http://myhost:8080/phpVirtualBox
+
+Added json_encode() for PHP compiled with --disable-json and
+PHP versions < 5.2.0.
+
+Fixed compatibility issues with PHP 5.1.x.
+
+"rdpHost" setting changed to "consoleHost"
+
+Added VirtualBox version to host in VM list and on the host
+details tab.
+
+Added multiple server functionality.
+
+Fixed case sensitivity for $browserRestrictFiles setting.
+
+Fixed bug when using OSE where the Shared Folders section would
+not be selected when "Shared Folders" is clicked on from the
+Details tab / section.
+
+Exporting a VM defaults to '.ova' file.
+
+Added language contexts.
+
+Changed cache temp dir location to try environment variables
+first.
+
+Fixed bug that would not send the 'Esc' key to the console when
+pressed.
+
+Changed back to GPL license.
+
+Added multiple server support.
+
+You can now power off a VM that is in a "Stuck" state.
+
+Versioning scheme is now
+ (VirtualBox compatible version)-(phpVirtualBox version)
+
+Fixed bug that would not display error message on failure to
+connect to vboxwebsrv.
+
+Removed old imgpng requirement as VirtualBox can now export
+screenshots as PNG data.
+
+Fixed media mounting bug that would not allow anything other than
+host drives to be mounted.
+
+-------------------------------------
+ 0.5 - 2010-08-10
+-------------------------------------
+Fixed some English translations.
+
+Added fr_fr and de_de languages.
+
+Fixed top toolbar and Virtual Media Manger translation bugs.
+
+Fixed OSE startup bug and removed console tab when OSE is
+detected.
+
+Fixed Host Details bug that would not display the VirtualBox
+host server's details when it is selected in the list of vms.
+
+Fixed bug in File -> Preferences that would not correctly
+reflect a change made to any preferences on the General tab.
+
+Workaround for Console tab resize bug that would disconnect from
+an existing console session when the window was resized. Now, it
+automatically reconnects after a window resize event.
+
+Applied UI enhancements patch supplied by compuwizard123
+http://code.google.com/u/compuwizard123/
+
+Host details now include VirtualBox version.
+
+-------------------------------------
+ 0.4 - 2010-07-24
+-------------------------------------
+Fixed numerous translation bugs.
+
+Fixed bug that would not allow the addition of more than 4
+storage controller types in VM Settings.
+
+Changed WSDL cache to use memory only instead of both memory
+and disk. (PHP SoapClient WSDL_CACHE_MEMORY option).
+
+RDP host (for console tab and details tab RDP links) is now
+selected in the following order:
+ 1) VM Configured host (would have to be set with VboxManage)
+ 2) rdpHost setting in config.php
+ 3) host in location setting of config.php
+ *) if host is 'localhost' or '127.0.0.1' use web browser
+ location's URL host as last resort
+
+Fixed bug in file / folder browser that would display the full
+path of files / folders rather than just their names. This only
+affected *nix web servers connecting to VirtualBox running on
+Windows hosts. I can't imagine this is a very common scenario:)
+
+Better error handling and meaningful error message when there
+is a PHP error, and phpVirtualBox fails to load.
+
+Fixed bug that would not allow you to enter your own internal
+network name in VM network configurations where Attached To: is
+set to Internal Network.
+
+Fixed bug that would break phpVirtualBox when
+allow_call_time_pass_reference is set to Off in php.ini.
+
+Removed ReflectionClass dependency. This also changes all
+config options in config.php to use 'var' instead of 'const.'
+
+License changed from GPL to MIT.
+
+-------------------------------------
+ 0.3 - 2010-07-05
+-------------------------------------
+Fixed bug in file/folder browser that would incorrectly display
+files as folders and folders as files in some cases.
+
+Added Console tab.
+
+Added OSE support. This effectively removes the console tab,
+USB, and VRDP support when OSE is detected.
+
+Fixed bug in Host-networking interfaces pane that would cause
+tabs to disappear if editing a host interface more than once
+without refreshing.
+
+Made VM list and main tab content scrollable.
+
+Added Guest Network Adapter info. This queries guest additions
+for network adapter IP information of a running VM.
+
+Added Clone, Make Immutable, and Make Normal functionality to
+Virtual Media Manager.
+
+Fixed bug in Virtual Media Manager that would allow a user to
+try to release a medium that is attached to a snapshot. This
+attempt would always fail.
+
+Fixed bug that would cause saving USB filters to fail.
+
+Added Import / Export Appliance. NOTE: Some configurable
+import settings are ignored (e.g. network interface type).
+These are also ignored when importing from the VirtualBox
+GUI, and so appears to be a bug in VirtualBox itself.
+
+Added file type icons to file / folder browser.
+
+Fixed internal network dropdown list in Virtual Machine
+settings.
+
+-------------------------------------
+ 0.2 - 2010-06-14
+-------------------------------------
+Initial Release
diff --git a/GPLv3.txt b/GPLv3.txt
index f718b3e..e587591 100644
--- a/GPLv3.txt
+++ b/GPLv3.txt
@@ -1,621 +1,621 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index 5eab94c..504b330 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,16 +1,16 @@
-phpVirtualBox - A web-based front-end to VirtualBox.
-Copyright (C) 2011 Ian Moore
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-version 3 as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-(GPLv3.txt in this folder) along with this program; if not, write
-to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
-Floor, Boston, MA 02110-1301, USA.
+phpVirtualBox - A web-based front-end to VirtualBox.
+Copyright (C) 2011 Ian Moore
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+version 3 as published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+(GPLv3.txt in this folder) along with this program; if not, write
+to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+Floor, Boston, MA 02110-1301, USA.
diff --git a/css/jquery-ui.css b/css/jquery-ui.css
index 4340740..ee5777e 100644
--- a/css/jquery-ui.css
+++ b/css/jquery-ui.css
@@ -1,1189 +1,1189 @@
-/*! jQuery UI - v1.10.3 - 2013-05-03
-* http://jqueryui.com
-* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
-* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden {
- display: none;
-}
-.ui-helper-hidden-accessible {
- border: 0;
- clip: rect(0 0 0 0);
- height: 1px;
- margin: -1px;
- overflow: hidden;
- padding: 0;
- position: absolute;
- width: 1px;
-}
-.ui-helper-reset {
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- line-height: 1.3;
- text-decoration: none;
- font-size: 100%;
- list-style: none;
-}
-.ui-helper-clearfix:before,
-.ui-helper-clearfix:after {
- content: "";
- display: table;
- border-collapse: collapse;
-}
-.ui-helper-clearfix:after {
- clear: both;
-}
-.ui-helper-clearfix {
- min-height: 0; /* support: IE7 */
-}
-.ui-helper-zfix {
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- position: absolute;
- opacity: 0;
- filter:Alpha(Opacity=0);
-}
-
-.ui-front {
- z-index: 100;
-}
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled {
- cursor: default !important;
-}
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon {
- display: block;
- text-indent: -99999px;
- overflow: hidden;
- background-repeat: no-repeat;
-}
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
-}
-
-.ui-accordion .ui-accordion-header {
- display: block;
- cursor: pointer;
- position: relative;
- margin-top: 2px;
- padding: .5em .5em .5em .7em;
- min-height: 0; /* support: IE7 */
-}
-.ui-accordion .ui-accordion-icons {
- padding-left: 2.2em;
-}
-.ui-accordion .ui-accordion-noicons {
- padding-left: .7em;
-}
-.ui-accordion .ui-accordion-icons .ui-accordion-icons {
- padding-left: 2.2em;
-}
-.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
- position: absolute;
- left: .5em;
- top: 50%;
- margin-top: -8px;
-}
-.ui-accordion .ui-accordion-content {
- padding: 1em 2.2em;
- border-top: 0;
- overflow: auto;
-}
-
-.ui-autocomplete {
- position: absolute;
- top: 0;
- left: 0;
- cursor: default;
-}
-
-.ui-button {
- display: inline-block;
- position: relative;
- padding: 0;
- line-height: normal;
- margin-right: .1em;
- cursor: pointer;
- vertical-align: middle;
- text-align: center;
- overflow: visible; /* removes extra width in IE */
-}
-.ui-button,
-.ui-button:link,
-.ui-button:visited,
-.ui-button:hover,
-.ui-button:active {
- text-decoration: none;
-}
-/* to make room for the icon, a width needs to be set here */
-.ui-button-icon-only {
- width: 2.2em;
-}
-/* button elements seem to need a little more width */
-button.ui-button-icon-only {
- width: 2.4em;
-}
-.ui-button-icons-only {
- width: 3.4em;
-}
-button.ui-button-icons-only {
- width: 3.7em;
-}
-
-/* button text element */
-.ui-button .ui-button-text {
- display: block;
- line-height: normal;
-}
-.ui-button-text-only .ui-button-text {
- padding: .4em 1em;
-}
-.ui-button-icon-only .ui-button-text,
-.ui-button-icons-only .ui-button-text {
- padding: .4em;
- text-indent: -9999999px;
-}
-.ui-button-text-icon-primary .ui-button-text,
-.ui-button-text-icons .ui-button-text {
- padding: .4em 1em .4em 2.1em;
-}
-.ui-button-text-icon-secondary .ui-button-text,
-.ui-button-text-icons .ui-button-text {
- padding: .4em 2.1em .4em 1em;
-}
-.ui-button-text-icons .ui-button-text {
- padding-left: 2.1em;
- padding-right: 2.1em;
-}
-/* no icon support for input elements, provide padding by default */
-input.ui-button {
- padding: .4em 1em;
-}
-
-/* button icon element(s) */
-.ui-button-icon-only .ui-icon,
-.ui-button-text-icon-primary .ui-icon,
-.ui-button-text-icon-secondary .ui-icon,
-.ui-button-text-icons .ui-icon,
-.ui-button-icons-only .ui-icon {
- position: absolute;
- top: 50%;
- margin-top: -8px;
-}
-.ui-button-icon-only .ui-icon {
- left: 50%;
- margin-left: -8px;
-}
-.ui-button-text-icon-primary .ui-button-icon-primary,
-.ui-button-text-icons .ui-button-icon-primary,
-.ui-button-icons-only .ui-button-icon-primary {
- left: .5em;
-}
-.ui-button-text-icon-secondary .ui-button-icon-secondary,
-.ui-button-text-icons .ui-button-icon-secondary,
-.ui-button-icons-only .ui-button-icon-secondary {
- right: .5em;
-}
-
-/* button sets */
-.ui-buttonset {
- margin-right: 7px;
-}
-.ui-buttonset .ui-button {
- margin-left: 0;
- margin-right: -.3em;
-}
-
-/* workarounds */
-/* reset extra padding in Firefox, see h5bp.com/l */
-input.ui-button::-moz-focus-inner,
-button.ui-button::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-.ui-datepicker {
- width: 17em;
- padding: .2em .2em 0;
- display: none;
-}
-.ui-datepicker .ui-datepicker-header {
- position: relative;
- padding: .2em 0;
-}
-.ui-datepicker .ui-datepicker-prev,
-.ui-datepicker .ui-datepicker-next {
- position: absolute;
- top: 2px;
- width: 1.8em;
- height: 1.8em;
-}
-.ui-datepicker .ui-datepicker-prev-hover,
-.ui-datepicker .ui-datepicker-next-hover {
- top: 1px;
-}
-.ui-datepicker .ui-datepicker-prev {
- left: 2px;
-}
-.ui-datepicker .ui-datepicker-next {
- right: 2px;
-}
-.ui-datepicker .ui-datepicker-prev-hover {
- left: 1px;
-}
-.ui-datepicker .ui-datepicker-next-hover {
- right: 1px;
-}
-.ui-datepicker .ui-datepicker-prev span,
-.ui-datepicker .ui-datepicker-next span {
- display: block;
- position: absolute;
- left: 50%;
- margin-left: -8px;
- top: 50%;
- margin-top: -8px;
-}
-.ui-datepicker .ui-datepicker-title {
- margin: 0 2.3em;
- line-height: 1.8em;
- text-align: center;
-}
-.ui-datepicker .ui-datepicker-title select {
- font-size: 1em;
- margin: 1px 0;
-}
-.ui-datepicker select.ui-datepicker-month-year {
- width: 100%;
-}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year {
- width: 49%;
-}
-.ui-datepicker table {
- width: 100%;
- font-size: .9em;
- border-collapse: collapse;
- margin: 0 0 .4em;
-}
-.ui-datepicker th {
- padding: .7em .3em;
- text-align: center;
- font-weight: bold;
- border: 0;
-}
-.ui-datepicker td {
- border: 0;
- padding: 1px;
-}
-.ui-datepicker td span,
-.ui-datepicker td a {
- display: block;
- padding: .2em;
- text-align: right;
- text-decoration: none;
-}
-.ui-datepicker .ui-datepicker-buttonpane {
- background-image: none;
- margin: .7em 0 0 0;
- padding: 0 .2em;
- border-left: 0;
- border-right: 0;
- border-bottom: 0;
-}
-.ui-datepicker .ui-datepicker-buttonpane button {
- float: right;
- margin: .5em .2em .4em;
- cursor: pointer;
- padding: .2em .6em .3em .6em;
- width: auto;
- overflow: visible;
-}
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
- float: left;
-}
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi {
- width: auto;
-}
-.ui-datepicker-multi .ui-datepicker-group {
- float: left;
-}
-.ui-datepicker-multi .ui-datepicker-group table {
- width: 95%;
- margin: 0 auto .4em;
-}
-.ui-datepicker-multi-2 .ui-datepicker-group {
- width: 50%;
-}
-.ui-datepicker-multi-3 .ui-datepicker-group {
- width: 33.3%;
-}
-.ui-datepicker-multi-4 .ui-datepicker-group {
- width: 25%;
-}
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
- border-left-width: 0;
-}
-.ui-datepicker-multi .ui-datepicker-buttonpane {
- clear: left;
-}
-.ui-datepicker-row-break {
- clear: both;
- width: 100%;
- font-size: 0;
-}
-
-/* RTL support */
-.ui-datepicker-rtl {
- direction: rtl;
-}
-.ui-datepicker-rtl .ui-datepicker-prev {
- right: 2px;
- left: auto;
-}
-.ui-datepicker-rtl .ui-datepicker-next {
- left: 2px;
- right: auto;
-}
-.ui-datepicker-rtl .ui-datepicker-prev:hover {
- right: 1px;
- left: auto;
-}
-.ui-datepicker-rtl .ui-datepicker-next:hover {
- left: 1px;
- right: auto;
-}
-.ui-datepicker-rtl .ui-datepicker-buttonpane {
- clear: right;
-}
-.ui-datepicker-rtl .ui-datepicker-buttonpane button {
- float: left;
-}
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
-.ui-datepicker-rtl .ui-datepicker-group {
- float: right;
-}
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
- border-right-width: 0;
- border-left-width: 1px;
-}
-
-.ui-dialog {
- position: absolute;
- top: 0;
- left: 0;
- padding: .2em;
- outline: 0;
-}
-.ui-dialog .ui-dialog-titlebar {
- padding: .4em 1em;
- position: relative;
-}
-.ui-dialog .ui-dialog-title {
- float: left;
- margin: .1em 0;
- white-space: nowrap;
- width: 90%;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.ui-dialog .ui-dialog-titlebar-close {
- position: absolute;
- right: .3em;
- top: 50%;
- width: 21px;
- margin: -10px 0 0 0;
- padding: 1px;
- height: 20px;
-}
-.ui-dialog .ui-dialog-content {
- position: relative;
- border: 0;
- padding: .5em 1em;
- background: none;
- overflow: auto;
-}
-.ui-dialog .ui-dialog-buttonpane {
- text-align: left;
- border-width: 1px 0 0 0;
- background-image: none;
- margin-top: .5em;
- padding: .3em 1em .5em .4em;
-}
-.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
- float: right;
-}
-.ui-dialog .ui-dialog-buttonpane button {
- margin: .5em .4em .5em 0;
- cursor: pointer;
-}
-.ui-dialog .ui-resizable-se {
- width: 12px;
- height: 12px;
- right: -5px;
- bottom: -5px;
- background-position: 16px 16px;
-}
-.ui-draggable .ui-dialog-titlebar {
- cursor: move;
-}
-
-.ui-menu {
- list-style: none;
- padding: 2px;
- margin: 0;
- display: block;
- outline: none;
-}
-.ui-menu .ui-menu {
- margin-top: -3px;
- position: absolute;
-}
-.ui-menu .ui-menu-item {
- margin: 0;
- padding: 0;
- width: 100%;
- /* support: IE10, see #8844 */
- list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
-}
-.ui-menu .ui-menu-divider {
- margin: 5px -2px 5px -2px;
- height: 0;
- font-size: 0;
- line-height: 0;
- border-width: 1px 0 0 0;
-}
-.ui-menu .ui-menu-item a {
- text-decoration: none;
- display: block;
- padding: 2px .4em;
- line-height: 1.5;
- min-height: 0; /* support: IE7 */
- font-weight: normal;
-}
-.ui-menu .ui-menu-item a.ui-state-focus,
-.ui-menu .ui-menu-item a.ui-state-active {
- font-weight: normal;
- margin: -1px;
-}
-
-.ui-menu .ui-state-disabled {
- font-weight: normal;
- margin: .4em 0 .2em;
- line-height: 1.5;
-}
-.ui-menu .ui-state-disabled a {
- cursor: default;
-}
-
-/* icon support */
-.ui-menu-icons {
- position: relative;
-}
-.ui-menu-icons .ui-menu-item a {
- position: relative;
- padding-left: 2em;
-}
-
-/* left-aligned */
-.ui-menu .ui-icon {
- position: absolute;
- top: .2em;
- left: .2em;
-}
-
-/* right-aligned */
-.ui-menu .ui-menu-icon {
- position: static;
- float: right;
-}
-
-.ui-progressbar {
- height: 2em;
- text-align: left;
- overflow: hidden;
-}
-.ui-progressbar .ui-progressbar-value {
- margin: -1px;
- height: 100%;
-}
-.ui-progressbar .ui-progressbar-overlay {
- background: url("../images/jquery-ui/animated-overlay.gif");
- height: 100%;
- filter: alpha(opacity=25);
- opacity: 0.25;
-}
-.ui-progressbar-indeterminate .ui-progressbar-value {
- background-image: none;
-}
-
-.ui-resizable {
- position: relative;
-}
-.ui-resizable-handle {
- position: absolute;
- font-size: 0.1px;
- display: block;
-}
-.ui-resizable-disabled .ui-resizable-handle,
-.ui-resizable-autohide .ui-resizable-handle {
- display: none;
-}
-.ui-resizable-n {
- cursor: n-resize;
- height: 7px;
- width: 100%;
- top: -5px;
- left: 0;
-}
-.ui-resizable-s {
- cursor: s-resize;
- height: 7px;
- width: 100%;
- bottom: -5px;
- left: 0;
-}
-.ui-resizable-e {
- cursor: e-resize;
- width: 7px;
- right: -5px;
- top: 0;
- height: 100%;
-}
-.ui-resizable-w {
- cursor: w-resize;
- width: 7px;
- left: -5px;
- top: 0;
- height: 100%;
-}
-.ui-resizable-se {
- cursor: se-resize;
- width: 12px;
- height: 12px;
- right: 1px;
- bottom: 1px;
-}
-.ui-resizable-sw {
- cursor: sw-resize;
- width: 9px;
- height: 9px;
- left: -5px;
- bottom: -5px;
-}
-.ui-resizable-nw {
- cursor: nw-resize;
- width: 9px;
- height: 9px;
- left: -5px;
- top: -5px;
-}
-.ui-resizable-ne {
- cursor: ne-resize;
- width: 9px;
- height: 9px;
- right: -5px;
- top: -5px;
-}
-
-.ui-selectable-helper {
- position: absolute;
- z-index: 100;
- border: 1px dotted black;
-}
-
-.ui-slider {
- position: relative;
- text-align: left;
-}
-.ui-slider .ui-slider-handle {
- position: absolute;
- z-index: 2;
- width: 1.2em;
- height: 1.2em;
- cursor: default;
-}
-.ui-slider .ui-slider-range {
- position: absolute;
- z-index: 1;
- font-size: .7em;
- display: block;
- border: 0;
- background-position: 0 0;
-}
-
-/* For IE8 - See #6727 */
-.ui-slider.ui-state-disabled .ui-slider-handle,
-.ui-slider.ui-state-disabled .ui-slider-range {
- filter: inherit;
-}
-
-.ui-slider-horizontal {
- height: .8em;
-}
-.ui-slider-horizontal .ui-slider-handle {
- top: -.3em;
- margin-left: -.6em;
-}
-.ui-slider-horizontal .ui-slider-range {
- top: 0;
- height: 100%;
-}
-.ui-slider-horizontal .ui-slider-range-min {
- left: 0;
-}
-.ui-slider-horizontal .ui-slider-range-max {
- right: 0;
-}
-
-.ui-slider-vertical {
- width: .8em;
- height: 100px;
-}
-.ui-slider-vertical .ui-slider-handle {
- left: -.3em;
- margin-left: 0;
- margin-bottom: -.6em;
-}
-.ui-slider-vertical .ui-slider-range {
- left: 0;
- width: 100%;
-}
-.ui-slider-vertical .ui-slider-range-min {
- bottom: 0;
-}
-.ui-slider-vertical .ui-slider-range-max {
- top: 0;
-}
-
-.ui-spinner {
- position: relative;
- display: inline-block;
- overflow: hidden;
- padding: 0;
- vertical-align: middle;
-}
-.ui-spinner-input {
- border: none;
- background: none;
- color: inherit;
- padding: 0;
- margin: .2em 0;
- vertical-align: middle;
- margin-left: .4em;
- margin-right: 22px;
-}
-.ui-spinner-button {
- width: 16px;
- height: 50%;
- font-size: .5em;
- padding: 0;
- margin: 0;
- text-align: center;
- position: absolute;
- cursor: default;
- display: block;
- overflow: hidden;
- right: 0;
-}
-/* more specificity required here to overide default borders */
-.ui-spinner a.ui-spinner-button {
- border-top: none;
- border-bottom: none;
- border-right: none;
-}
-/* vertical centre icon */
-.ui-spinner .ui-icon {
- position: absolute;
- margin-top: -8px;
- top: 50%;
- left: 0;
-}
-.ui-spinner-up {
- top: 0;
-}
-.ui-spinner-down {
- bottom: 0;
-}
-
-/* TR overrides */
-.ui-spinner .ui-icon-triangle-1-s {
- /* need to fix icons sprite */
- background-position: -65px -16px;
-}
-
-.ui-tabs {
- position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
- padding: .2em;
-}
-.ui-tabs .ui-tabs-nav {
- margin: 0;
- padding: .2em .2em 0;
-}
-.ui-tabs .ui-tabs-nav li {
- list-style: none;
- float: left;
- position: relative;
- top: 0;
- margin: 1px .2em 0 0;
- border-bottom-width: 0;
- padding: 0;
- white-space: nowrap;
-}
-.ui-tabs .ui-tabs-nav li a {
- float: left;
- padding: .5em 1em;
- text-decoration: none;
-}
-.ui-tabs .ui-tabs-nav li.ui-tabs-active {
- margin-bottom: -1px;
- padding-bottom: 1px;
-}
-.ui-tabs .ui-tabs-nav li.ui-tabs-active a,
-.ui-tabs .ui-tabs-nav li.ui-state-disabled a,
-.ui-tabs .ui-tabs-nav li.ui-tabs-loading a {
- cursor: text;
-}
-.ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a {
- cursor: pointer;
-}
-.ui-tabs .ui-tabs-panel {
- display: block;
- border-width: 0;
- padding: 1em 1.4em;
- background: none;
-}
-
-.ui-tooltip {
- padding: 8px;
- position: absolute;
- z-index: 9999;
- max-width: 300px;
- -webkit-box-shadow: 0 0 5px #aaa;
- box-shadow: 0 0 5px #aaa;
-}
-body .ui-tooltip {
- border-width: 2px;
-}
-
-/* Component containers
-----------------------------------*/
-.ui-widget {
- font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
- font-size: 1.1em/*{fsDefault}*/;
-}
-.ui-widget .ui-widget {
- font-size: 1em;
-}
-.ui-widget input,
-.ui-widget select,
-.ui-widget textarea,
-.ui-widget button {
- font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
- font-size: 1em;
-}
-.ui-widget-content {
- border: 1px solid #aaaaaa/*{borderColorContent}*/;
- background: #ffffff/*{bgColorContent}*/ url(../images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/;
- color: #222222/*{fcContent}*/;
-}
-.ui-widget-content a {
- color: #222222/*{fcContent}*/;
-}
-.ui-widget-header {
- border: 1px solid #aaaaaa/*{borderColorHeader}*/;
- background: #cccccc/*{bgColorHeader}*/ url(../images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/;
- color: #222222/*{fcHeader}*/;
- font-weight: bold;
-}
-.ui-widget-header a {
- color: #222222/*{fcHeader}*/;
-}
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default,
-.ui-widget-content .ui-state-default,
-.ui-widget-header .ui-state-default {
- border: 1px solid #d3d3d3/*{borderColorDefault}*/;
- background: #e6e6e6/*{bgColorDefault}*/ url(../images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/;
- font-weight: normal/*{fwDefault}*/;
- color: #555555/*{fcDefault}*/;
-}
-.ui-state-default a,
-.ui-state-default a:link,
-.ui-state-default a:visited {
- color: #555555/*{fcDefault}*/;
- text-decoration: none;
-}
-.ui-state-hover,
-.ui-widget-content .ui-state-hover,
-.ui-widget-header .ui-state-hover,
-.ui-state-focus,
-.ui-widget-content .ui-state-focus,
-.ui-widget-header .ui-state-focus {
- border: 1px solid #999999/*{borderColorHover}*/;
- background: #dadada/*{bgColorHover}*/ url(../images/jquery-ui/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/;
- font-weight: normal/*{fwDefault}*/;
- color: #212121/*{fcHover}*/;
-}
-.ui-state-hover a,
-.ui-state-hover a:hover,
-.ui-state-hover a:link,
-.ui-state-hover a:visited {
- color: #212121/*{fcHover}*/;
- text-decoration: none;
-}
-.ui-state-active,
-.ui-widget-content .ui-state-active,
-.ui-widget-header .ui-state-active {
- border: 1px solid #aaaaaa/*{borderColorActive}*/;
- background: #ffffff/*{bgColorActive}*/ url(../images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/;
- font-weight: normal/*{fwDefault}*/;
- color: #212121/*{fcActive}*/;
-}
-.ui-state-active a,
-.ui-state-active a:link,
-.ui-state-active a:visited {
- color: #212121/*{fcActive}*/;
- text-decoration: none;
-}
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight,
-.ui-widget-content .ui-state-highlight,
-.ui-widget-header .ui-state-highlight {
- border: 1px solid #fcefa1/*{borderColorHighlight}*/;
- background: #fbf9ee/*{bgColorHighlight}*/ url(../images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/;
- color: #363636/*{fcHighlight}*/;
-}
-.ui-state-highlight a,
-.ui-widget-content .ui-state-highlight a,
-.ui-widget-header .ui-state-highlight a {
- color: #363636/*{fcHighlight}*/;
-}
-.ui-state-error,
-.ui-widget-content .ui-state-error,
-.ui-widget-header .ui-state-error {
- border: 1px solid #cd0a0a/*{borderColorError}*/;
- background: #fef1ec/*{bgColorError}*/ url(../images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/;
- color: #cd0a0a/*{fcError}*/;
-}
-.ui-state-error a,
-.ui-widget-content .ui-state-error a,
-.ui-widget-header .ui-state-error a {
- color: #cd0a0a/*{fcError}*/;
-}
-.ui-state-error-text,
-.ui-widget-content .ui-state-error-text,
-.ui-widget-header .ui-state-error-text {
- color: #cd0a0a/*{fcError}*/;
-}
-.ui-priority-primary,
-.ui-widget-content .ui-priority-primary,
-.ui-widget-header .ui-priority-primary {
- font-weight: bold;
-}
-.ui-priority-secondary,
-.ui-widget-content .ui-priority-secondary,
-.ui-widget-header .ui-priority-secondary {
- opacity: .7;
- filter:Alpha(Opacity=70);
- font-weight: normal;
-}
-.ui-state-disabled,
-.ui-widget-content .ui-state-disabled,
-.ui-widget-header .ui-state-disabled {
- opacity: .35;
- filter:Alpha(Opacity=35);
- background-image: none;
-}
-.ui-state-disabled .ui-icon {
- filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
-}
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon {
- width: 16px;
- height: 16px;
-}
-.ui-icon,
-.ui-widget-content .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_222222_256x240.png)/*{iconsContent}*/;
-}
-.ui-widget-header .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_222222_256x240.png)/*{iconsHeader}*/;
-}
-.ui-state-default .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_888888_256x240.png)/*{iconsDefault}*/;
-}
-.ui-state-hover .ui-icon,
-.ui-state-focus .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_454545_256x240.png)/*{iconsHover}*/;
-}
-.ui-state-active .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_454545_256x240.png)/*{iconsActive}*/;
-}
-.ui-state-highlight .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/;
-}
-.ui-state-error .ui-icon,
-.ui-state-error-text .ui-icon {
- background-image: url(../images/jquery-ui/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/;
-}
-
-/* positioning */
-.ui-icon-blank { background-position: 16px 16px; }
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-on { background-position: -96px -144px; }
-.ui-icon-radio-off { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-all,
-.ui-corner-top,
-.ui-corner-left,
-.ui-corner-tl {
- border-top-left-radius: 4px/*{cornerRadius}*/;
-}
-.ui-corner-all,
-.ui-corner-top,
-.ui-corner-right,
-.ui-corner-tr {
- border-top-right-radius: 4px/*{cornerRadius}*/;
-}
-.ui-corner-all,
-.ui-corner-bottom,
-.ui-corner-left,
-.ui-corner-bl {
- border-bottom-left-radius: 4px/*{cornerRadius}*/;
-}
-.ui-corner-all,
-.ui-corner-bottom,
-.ui-corner-right,
-.ui-corner-br {
- border-bottom-right-radius: 4px/*{cornerRadius}*/;
-}
-
-/* Overlays */
-.ui-widget-overlay {
- background: #aaaaaa/*{bgColorOverlay}*/ url(../images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
- opacity: .3/*{opacityOverlay}*/;
- filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/;
-}
-.ui-widget-shadow {
- margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
- padding: 8px/*{thicknessShadow}*/;
- background: #aaaaaa/*{bgColorShadow}*/ url(../images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
- opacity: .3/*{opacityShadow}*/;
- filter: Alpha(Opacity=30)/*{opacityFilterShadow}*/;
- border-radius: 8px/*{cornerRadiusShadow}*/;
-}
-
+/*! jQuery UI - v1.10.3 - 2013-05-03
+* http://jqueryui.com
+* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
+* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden {
+ display: none;
+}
+.ui-helper-hidden-accessible {
+ border: 0;
+ clip: rect(0 0 0 0);
+ height: 1px;
+ margin: -1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+ width: 1px;
+}
+.ui-helper-reset {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ line-height: 1.3;
+ text-decoration: none;
+ font-size: 100%;
+ list-style: none;
+}
+.ui-helper-clearfix:before,
+.ui-helper-clearfix:after {
+ content: "";
+ display: table;
+ border-collapse: collapse;
+}
+.ui-helper-clearfix:after {
+ clear: both;
+}
+.ui-helper-clearfix {
+ min-height: 0; /* support: IE7 */
+}
+.ui-helper-zfix {
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ position: absolute;
+ opacity: 0;
+ filter:Alpha(Opacity=0);
+}
+
+.ui-front {
+ z-index: 100;
+}
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled {
+ cursor: default !important;
+}
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ display: block;
+ text-indent: -99999px;
+ overflow: hidden;
+ background-repeat: no-repeat;
+}
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.ui-accordion .ui-accordion-header {
+ display: block;
+ cursor: pointer;
+ position: relative;
+ margin-top: 2px;
+ padding: .5em .5em .5em .7em;
+ min-height: 0; /* support: IE7 */
+}
+.ui-accordion .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-noicons {
+ padding-left: .7em;
+}
+.ui-accordion .ui-accordion-icons .ui-accordion-icons {
+ padding-left: 2.2em;
+}
+.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
+ position: absolute;
+ left: .5em;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-accordion .ui-accordion-content {
+ padding: 1em 2.2em;
+ border-top: 0;
+ overflow: auto;
+}
+
+.ui-autocomplete {
+ position: absolute;
+ top: 0;
+ left: 0;
+ cursor: default;
+}
+
+.ui-button {
+ display: inline-block;
+ position: relative;
+ padding: 0;
+ line-height: normal;
+ margin-right: .1em;
+ cursor: pointer;
+ vertical-align: middle;
+ text-align: center;
+ overflow: visible; /* removes extra width in IE */
+}
+.ui-button,
+.ui-button:link,
+.ui-button:visited,
+.ui-button:hover,
+.ui-button:active {
+ text-decoration: none;
+}
+/* to make room for the icon, a width needs to be set here */
+.ui-button-icon-only {
+ width: 2.2em;
+}
+/* button elements seem to need a little more width */
+button.ui-button-icon-only {
+ width: 2.4em;
+}
+.ui-button-icons-only {
+ width: 3.4em;
+}
+button.ui-button-icons-only {
+ width: 3.7em;
+}
+
+/* button text element */
+.ui-button .ui-button-text {
+ display: block;
+ line-height: normal;
+}
+.ui-button-text-only .ui-button-text {
+ padding: .4em 1em;
+}
+.ui-button-icon-only .ui-button-text,
+.ui-button-icons-only .ui-button-text {
+ padding: .4em;
+ text-indent: -9999999px;
+}
+.ui-button-text-icon-primary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 1em .4em 2.1em;
+}
+.ui-button-text-icon-secondary .ui-button-text,
+.ui-button-text-icons .ui-button-text {
+ padding: .4em 2.1em .4em 1em;
+}
+.ui-button-text-icons .ui-button-text {
+ padding-left: 2.1em;
+ padding-right: 2.1em;
+}
+/* no icon support for input elements, provide padding by default */
+input.ui-button {
+ padding: .4em 1em;
+}
+
+/* button icon element(s) */
+.ui-button-icon-only .ui-icon,
+.ui-button-text-icon-primary .ui-icon,
+.ui-button-text-icon-secondary .ui-icon,
+.ui-button-text-icons .ui-icon,
+.ui-button-icons-only .ui-icon {
+ position: absolute;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-button-icon-only .ui-icon {
+ left: 50%;
+ margin-left: -8px;
+}
+.ui-button-text-icon-primary .ui-button-icon-primary,
+.ui-button-text-icons .ui-button-icon-primary,
+.ui-button-icons-only .ui-button-icon-primary {
+ left: .5em;
+}
+.ui-button-text-icon-secondary .ui-button-icon-secondary,
+.ui-button-text-icons .ui-button-icon-secondary,
+.ui-button-icons-only .ui-button-icon-secondary {
+ right: .5em;
+}
+
+/* button sets */
+.ui-buttonset {
+ margin-right: 7px;
+}
+.ui-buttonset .ui-button {
+ margin-left: 0;
+ margin-right: -.3em;
+}
+
+/* workarounds */
+/* reset extra padding in Firefox, see h5bp.com/l */
+input.ui-button::-moz-focus-inner,
+button.ui-button::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+
+.ui-datepicker {
+ width: 17em;
+ padding: .2em .2em 0;
+ display: none;
+}
+.ui-datepicker .ui-datepicker-header {
+ position: relative;
+ padding: .2em 0;
+}
+.ui-datepicker .ui-datepicker-prev,
+.ui-datepicker .ui-datepicker-next {
+ position: absolute;
+ top: 2px;
+ width: 1.8em;
+ height: 1.8em;
+}
+.ui-datepicker .ui-datepicker-prev-hover,
+.ui-datepicker .ui-datepicker-next-hover {
+ top: 1px;
+}
+.ui-datepicker .ui-datepicker-prev {
+ left: 2px;
+}
+.ui-datepicker .ui-datepicker-next {
+ right: 2px;
+}
+.ui-datepicker .ui-datepicker-prev-hover {
+ left: 1px;
+}
+.ui-datepicker .ui-datepicker-next-hover {
+ right: 1px;
+}
+.ui-datepicker .ui-datepicker-prev span,
+.ui-datepicker .ui-datepicker-next span {
+ display: block;
+ position: absolute;
+ left: 50%;
+ margin-left: -8px;
+ top: 50%;
+ margin-top: -8px;
+}
+.ui-datepicker .ui-datepicker-title {
+ margin: 0 2.3em;
+ line-height: 1.8em;
+ text-align: center;
+}
+.ui-datepicker .ui-datepicker-title select {
+ font-size: 1em;
+ margin: 1px 0;
+}
+.ui-datepicker select.ui-datepicker-month-year {
+ width: 100%;
+}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year {
+ width: 49%;
+}
+.ui-datepicker table {
+ width: 100%;
+ font-size: .9em;
+ border-collapse: collapse;
+ margin: 0 0 .4em;
+}
+.ui-datepicker th {
+ padding: .7em .3em;
+ text-align: center;
+ font-weight: bold;
+ border: 0;
+}
+.ui-datepicker td {
+ border: 0;
+ padding: 1px;
+}
+.ui-datepicker td span,
+.ui-datepicker td a {
+ display: block;
+ padding: .2em;
+ text-align: right;
+ text-decoration: none;
+}
+.ui-datepicker .ui-datepicker-buttonpane {
+ background-image: none;
+ margin: .7em 0 0 0;
+ padding: 0 .2em;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 0;
+}
+.ui-datepicker .ui-datepicker-buttonpane button {
+ float: right;
+ margin: .5em .2em .4em;
+ cursor: pointer;
+ padding: .2em .6em .3em .6em;
+ width: auto;
+ overflow: visible;
+}
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
+ float: left;
+}
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi {
+ width: auto;
+}
+.ui-datepicker-multi .ui-datepicker-group {
+ float: left;
+}
+.ui-datepicker-multi .ui-datepicker-group table {
+ width: 95%;
+ margin: 0 auto .4em;
+}
+.ui-datepicker-multi-2 .ui-datepicker-group {
+ width: 50%;
+}
+.ui-datepicker-multi-3 .ui-datepicker-group {
+ width: 33.3%;
+}
+.ui-datepicker-multi-4 .ui-datepicker-group {
+ width: 25%;
+}
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
+ border-left-width: 0;
+}
+.ui-datepicker-multi .ui-datepicker-buttonpane {
+ clear: left;
+}
+.ui-datepicker-row-break {
+ clear: both;
+ width: 100%;
+ font-size: 0;
+}
+
+/* RTL support */
+.ui-datepicker-rtl {
+ direction: rtl;
+}
+.ui-datepicker-rtl .ui-datepicker-prev {
+ right: 2px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next {
+ left: 2px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-prev:hover {
+ right: 1px;
+ left: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-next:hover {
+ left: 1px;
+ right: auto;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane {
+ clear: right;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button {
+ float: left;
+}
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
+.ui-datepicker-rtl .ui-datepicker-group {
+ float: right;
+}
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
+ border-right-width: 0;
+ border-left-width: 1px;
+}
+
+.ui-dialog {
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: .2em;
+ outline: 0;
+}
+.ui-dialog .ui-dialog-titlebar {
+ padding: .4em 1em;
+ position: relative;
+}
+.ui-dialog .ui-dialog-title {
+ float: left;
+ margin: .1em 0;
+ white-space: nowrap;
+ width: 90%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.ui-dialog .ui-dialog-titlebar-close {
+ position: absolute;
+ right: .3em;
+ top: 50%;
+ width: 21px;
+ margin: -10px 0 0 0;
+ padding: 1px;
+ height: 20px;
+}
+.ui-dialog .ui-dialog-content {
+ position: relative;
+ border: 0;
+ padding: .5em 1em;
+ background: none;
+ overflow: auto;
+}
+.ui-dialog .ui-dialog-buttonpane {
+ text-align: left;
+ border-width: 1px 0 0 0;
+ background-image: none;
+ margin-top: .5em;
+ padding: .3em 1em .5em .4em;
+}
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
+ float: right;
+}
+.ui-dialog .ui-dialog-buttonpane button {
+ margin: .5em .4em .5em 0;
+ cursor: pointer;
+}
+.ui-dialog .ui-resizable-se {
+ width: 12px;
+ height: 12px;
+ right: -5px;
+ bottom: -5px;
+ background-position: 16px 16px;
+}
+.ui-draggable .ui-dialog-titlebar {
+ cursor: move;
+}
+
+.ui-menu {
+ list-style: none;
+ padding: 2px;
+ margin: 0;
+ display: block;
+ outline: none;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+ position: absolute;
+}
+.ui-menu .ui-menu-item {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+ /* support: IE10, see #8844 */
+ list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
+}
+.ui-menu .ui-menu-divider {
+ margin: 5px -2px 5px -2px;
+ height: 0;
+ font-size: 0;
+ line-height: 0;
+ border-width: 1px 0 0 0;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration: none;
+ display: block;
+ padding: 2px .4em;
+ line-height: 1.5;
+ min-height: 0; /* support: IE7 */
+ font-weight: normal;
+}
+.ui-menu .ui-menu-item a.ui-state-focus,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+
+.ui-menu .ui-state-disabled {
+ font-weight: normal;
+ margin: .4em 0 .2em;
+ line-height: 1.5;
+}
+.ui-menu .ui-state-disabled a {
+ cursor: default;
+}
+
+/* icon support */
+.ui-menu-icons {
+ position: relative;
+}
+.ui-menu-icons .ui-menu-item a {
+ position: relative;
+ padding-left: 2em;
+}
+
+/* left-aligned */
+.ui-menu .ui-icon {
+ position: absolute;
+ top: .2em;
+ left: .2em;
+}
+
+/* right-aligned */
+.ui-menu .ui-menu-icon {
+ position: static;
+ float: right;
+}
+
+.ui-progressbar {
+ height: 2em;
+ text-align: left;
+ overflow: hidden;
+}
+.ui-progressbar .ui-progressbar-value {
+ margin: -1px;
+ height: 100%;
+}
+.ui-progressbar .ui-progressbar-overlay {
+ background: url("../images/jquery-ui/animated-overlay.gif");
+ height: 100%;
+ filter: alpha(opacity=25);
+ opacity: 0.25;
+}
+.ui-progressbar-indeterminate .ui-progressbar-value {
+ background-image: none;
+}
+
+.ui-resizable {
+ position: relative;
+}
+.ui-resizable-handle {
+ position: absolute;
+ font-size: 0.1px;
+ display: block;
+}
+.ui-resizable-disabled .ui-resizable-handle,
+.ui-resizable-autohide .ui-resizable-handle {
+ display: none;
+}
+.ui-resizable-n {
+ cursor: n-resize;
+ height: 7px;
+ width: 100%;
+ top: -5px;
+ left: 0;
+}
+.ui-resizable-s {
+ cursor: s-resize;
+ height: 7px;
+ width: 100%;
+ bottom: -5px;
+ left: 0;
+}
+.ui-resizable-e {
+ cursor: e-resize;
+ width: 7px;
+ right: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-w {
+ cursor: w-resize;
+ width: 7px;
+ left: -5px;
+ top: 0;
+ height: 100%;
+}
+.ui-resizable-se {
+ cursor: se-resize;
+ width: 12px;
+ height: 12px;
+ right: 1px;
+ bottom: 1px;
+}
+.ui-resizable-sw {
+ cursor: sw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ bottom: -5px;
+}
+.ui-resizable-nw {
+ cursor: nw-resize;
+ width: 9px;
+ height: 9px;
+ left: -5px;
+ top: -5px;
+}
+.ui-resizable-ne {
+ cursor: ne-resize;
+ width: 9px;
+ height: 9px;
+ right: -5px;
+ top: -5px;
+}
+
+.ui-selectable-helper {
+ position: absolute;
+ z-index: 100;
+ border: 1px dotted black;
+}
+
+.ui-slider {
+ position: relative;
+ text-align: left;
+}
+.ui-slider .ui-slider-handle {
+ position: absolute;
+ z-index: 2;
+ width: 1.2em;
+ height: 1.2em;
+ cursor: default;
+}
+.ui-slider .ui-slider-range {
+ position: absolute;
+ z-index: 1;
+ font-size: .7em;
+ display: block;
+ border: 0;
+ background-position: 0 0;
+}
+
+/* For IE8 - See #6727 */
+.ui-slider.ui-state-disabled .ui-slider-handle,
+.ui-slider.ui-state-disabled .ui-slider-range {
+ filter: inherit;
+}
+
+.ui-slider-horizontal {
+ height: .8em;
+}
+.ui-slider-horizontal .ui-slider-handle {
+ top: -.3em;
+ margin-left: -.6em;
+}
+.ui-slider-horizontal .ui-slider-range {
+ top: 0;
+ height: 100%;
+}
+.ui-slider-horizontal .ui-slider-range-min {
+ left: 0;
+}
+.ui-slider-horizontal .ui-slider-range-max {
+ right: 0;
+}
+
+.ui-slider-vertical {
+ width: .8em;
+ height: 100px;
+}
+.ui-slider-vertical .ui-slider-handle {
+ left: -.3em;
+ margin-left: 0;
+ margin-bottom: -.6em;
+}
+.ui-slider-vertical .ui-slider-range {
+ left: 0;
+ width: 100%;
+}
+.ui-slider-vertical .ui-slider-range-min {
+ bottom: 0;
+}
+.ui-slider-vertical .ui-slider-range-max {
+ top: 0;
+}
+
+.ui-spinner {
+ position: relative;
+ display: inline-block;
+ overflow: hidden;
+ padding: 0;
+ vertical-align: middle;
+}
+.ui-spinner-input {
+ border: none;
+ background: none;
+ color: inherit;
+ padding: 0;
+ margin: .2em 0;
+ vertical-align: middle;
+ margin-left: .4em;
+ margin-right: 22px;
+}
+.ui-spinner-button {
+ width: 16px;
+ height: 50%;
+ font-size: .5em;
+ padding: 0;
+ margin: 0;
+ text-align: center;
+ position: absolute;
+ cursor: default;
+ display: block;
+ overflow: hidden;
+ right: 0;
+}
+/* more specificity required here to overide default borders */
+.ui-spinner a.ui-spinner-button {
+ border-top: none;
+ border-bottom: none;
+ border-right: none;
+}
+/* vertical centre icon */
+.ui-spinner .ui-icon {
+ position: absolute;
+ margin-top: -8px;
+ top: 50%;
+ left: 0;
+}
+.ui-spinner-up {
+ top: 0;
+}
+.ui-spinner-down {
+ bottom: 0;
+}
+
+/* TR overrides */
+.ui-spinner .ui-icon-triangle-1-s {
+ /* need to fix icons sprite */
+ background-position: -65px -16px;
+}
+
+.ui-tabs {
+ position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+ padding: .2em;
+}
+.ui-tabs .ui-tabs-nav {
+ margin: 0;
+ padding: .2em .2em 0;
+}
+.ui-tabs .ui-tabs-nav li {
+ list-style: none;
+ float: left;
+ position: relative;
+ top: 0;
+ margin: 1px .2em 0 0;
+ border-bottom-width: 0;
+ padding: 0;
+ white-space: nowrap;
+}
+.ui-tabs .ui-tabs-nav li a {
+ float: left;
+ padding: .5em 1em;
+ text-decoration: none;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active {
+ margin-bottom: -1px;
+ padding-bottom: 1px;
+}
+.ui-tabs .ui-tabs-nav li.ui-tabs-active a,
+.ui-tabs .ui-tabs-nav li.ui-state-disabled a,
+.ui-tabs .ui-tabs-nav li.ui-tabs-loading a {
+ cursor: text;
+}
+.ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a {
+ cursor: pointer;
+}
+.ui-tabs .ui-tabs-panel {
+ display: block;
+ border-width: 0;
+ padding: 1em 1.4em;
+ background: none;
+}
+
+.ui-tooltip {
+ padding: 8px;
+ position: absolute;
+ z-index: 9999;
+ max-width: 300px;
+ -webkit-box-shadow: 0 0 5px #aaa;
+ box-shadow: 0 0 5px #aaa;
+}
+body .ui-tooltip {
+ border-width: 2px;
+}
+
+/* Component containers
+----------------------------------*/
+.ui-widget {
+ font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
+ font-size: 1.1em/*{fsDefault}*/;
+}
+.ui-widget .ui-widget {
+ font-size: 1em;
+}
+.ui-widget input,
+.ui-widget select,
+.ui-widget textarea,
+.ui-widget button {
+ font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
+ font-size: 1em;
+}
+.ui-widget-content {
+ border: 1px solid #aaaaaa/*{borderColorContent}*/;
+ background: #ffffff/*{bgColorContent}*/ url(../images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/;
+ color: #222222/*{fcContent}*/;
+}
+.ui-widget-content a {
+ color: #222222/*{fcContent}*/;
+}
+.ui-widget-header {
+ border: 1px solid #aaaaaa/*{borderColorHeader}*/;
+ background: #cccccc/*{bgColorHeader}*/ url(../images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/;
+ color: #222222/*{fcHeader}*/;
+ font-weight: bold;
+}
+.ui-widget-header a {
+ color: #222222/*{fcHeader}*/;
+}
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default,
+.ui-widget-content .ui-state-default,
+.ui-widget-header .ui-state-default {
+ border: 1px solid #d3d3d3/*{borderColorDefault}*/;
+ background: #e6e6e6/*{bgColorDefault}*/ url(../images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/;
+ font-weight: normal/*{fwDefault}*/;
+ color: #555555/*{fcDefault}*/;
+}
+.ui-state-default a,
+.ui-state-default a:link,
+.ui-state-default a:visited {
+ color: #555555/*{fcDefault}*/;
+ text-decoration: none;
+}
+.ui-state-hover,
+.ui-widget-content .ui-state-hover,
+.ui-widget-header .ui-state-hover,
+.ui-state-focus,
+.ui-widget-content .ui-state-focus,
+.ui-widget-header .ui-state-focus {
+ border: 1px solid #999999/*{borderColorHover}*/;
+ background: #dadada/*{bgColorHover}*/ url(../images/jquery-ui/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/;
+ font-weight: normal/*{fwDefault}*/;
+ color: #212121/*{fcHover}*/;
+}
+.ui-state-hover a,
+.ui-state-hover a:hover,
+.ui-state-hover a:link,
+.ui-state-hover a:visited {
+ color: #212121/*{fcHover}*/;
+ text-decoration: none;
+}
+.ui-state-active,
+.ui-widget-content .ui-state-active,
+.ui-widget-header .ui-state-active {
+ border: 1px solid #aaaaaa/*{borderColorActive}*/;
+ background: #ffffff/*{bgColorActive}*/ url(../images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/;
+ font-weight: normal/*{fwDefault}*/;
+ color: #212121/*{fcActive}*/;
+}
+.ui-state-active a,
+.ui-state-active a:link,
+.ui-state-active a:visited {
+ color: #212121/*{fcActive}*/;
+ text-decoration: none;
+}
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight,
+.ui-widget-content .ui-state-highlight,
+.ui-widget-header .ui-state-highlight {
+ border: 1px solid #fcefa1/*{borderColorHighlight}*/;
+ background: #fbf9ee/*{bgColorHighlight}*/ url(../images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/;
+ color: #363636/*{fcHighlight}*/;
+}
+.ui-state-highlight a,
+.ui-widget-content .ui-state-highlight a,
+.ui-widget-header .ui-state-highlight a {
+ color: #363636/*{fcHighlight}*/;
+}
+.ui-state-error,
+.ui-widget-content .ui-state-error,
+.ui-widget-header .ui-state-error {
+ border: 1px solid #cd0a0a/*{borderColorError}*/;
+ background: #fef1ec/*{bgColorError}*/ url(../images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/;
+ color: #cd0a0a/*{fcError}*/;
+}
+.ui-state-error a,
+.ui-widget-content .ui-state-error a,
+.ui-widget-header .ui-state-error a {
+ color: #cd0a0a/*{fcError}*/;
+}
+.ui-state-error-text,
+.ui-widget-content .ui-state-error-text,
+.ui-widget-header .ui-state-error-text {
+ color: #cd0a0a/*{fcError}*/;
+}
+.ui-priority-primary,
+.ui-widget-content .ui-priority-primary,
+.ui-widget-header .ui-priority-primary {
+ font-weight: bold;
+}
+.ui-priority-secondary,
+.ui-widget-content .ui-priority-secondary,
+.ui-widget-header .ui-priority-secondary {
+ opacity: .7;
+ filter:Alpha(Opacity=70);
+ font-weight: normal;
+}
+.ui-state-disabled,
+.ui-widget-content .ui-state-disabled,
+.ui-widget-header .ui-state-disabled {
+ opacity: .35;
+ filter:Alpha(Opacity=35);
+ background-image: none;
+}
+.ui-state-disabled .ui-icon {
+ filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
+}
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon {
+ width: 16px;
+ height: 16px;
+}
+.ui-icon,
+.ui-widget-content .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_222222_256x240.png)/*{iconsContent}*/;
+}
+.ui-widget-header .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_222222_256x240.png)/*{iconsHeader}*/;
+}
+.ui-state-default .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_888888_256x240.png)/*{iconsDefault}*/;
+}
+.ui-state-hover .ui-icon,
+.ui-state-focus .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_454545_256x240.png)/*{iconsHover}*/;
+}
+.ui-state-active .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_454545_256x240.png)/*{iconsActive}*/;
+}
+.ui-state-highlight .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/;
+}
+.ui-state-error .ui-icon,
+.ui-state-error-text .ui-icon {
+ background-image: url(../images/jquery-ui/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/;
+}
+
+/* positioning */
+.ui-icon-blank { background-position: 16px 16px; }
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-on { background-position: -96px -144px; }
+.ui-icon-radio-off { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-left,
+.ui-corner-tl {
+ border-top-left-radius: 4px/*{cornerRadius}*/;
+}
+.ui-corner-all,
+.ui-corner-top,
+.ui-corner-right,
+.ui-corner-tr {
+ border-top-right-radius: 4px/*{cornerRadius}*/;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-left,
+.ui-corner-bl {
+ border-bottom-left-radius: 4px/*{cornerRadius}*/;
+}
+.ui-corner-all,
+.ui-corner-bottom,
+.ui-corner-right,
+.ui-corner-br {
+ border-bottom-right-radius: 4px/*{cornerRadius}*/;
+}
+
+/* Overlays */
+.ui-widget-overlay {
+ background: #aaaaaa/*{bgColorOverlay}*/ url(../images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
+ opacity: .3/*{opacityOverlay}*/;
+ filter: Alpha(Opacity=30)/*{opacityFilterOverlay}*/;
+}
+.ui-widget-shadow {
+ margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
+ padding: 8px/*{thicknessShadow}*/;
+ background: #aaaaaa/*{bgColorShadow}*/ url(../images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
+ opacity: .3/*{opacityShadow}*/;
+ filter: Alpha(Opacity=30)/*{opacityFilterShadow}*/;
+ border-radius: 8px/*{cornerRadiusShadow}*/;
+}
+
diff --git a/css/tipped.css b/css/tipped.css
index bbd8446..7f9332d 100644
--- a/css/tipped.css
+++ b/css/tipped.css
@@ -1,43 +1,43 @@
-#tipped {
- /* position & display are necessary */
- position:absolute;
- display:none;
-
- /* The rest are just to make it look good & can be changed as you want */
- border: 1px solid #404040;
- color: #404040;
-
- border-radius:5px;
- padding:3px;
- z-index: 99999;
- font-size: 0.9em;
- max-width: 50%;
-
- background: #f0f0f0;
- background: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e0e0e0)); /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Opera 11.10+ */
- background: -ms-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* IE10+ */
- background: linear-gradient(to bottom, #ffffff 0%,#e0e0e0 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e0e0e0',GradientType=0 ); /* IE6-9 */
-
- overflow: hidden;
-}
-
-/* The tip content gets inserted into this element */
-#tipped-content p, #tipped p { padding: 2px; margin: 0px; padding-bottom:0px; }
-
-/* This is the <div> that holds the close button/link. No styling is required, but you'll likely want some. */
-#tipped-closer-wrapper {
- display:none;
- text-align:center;
- margin: 0px;
-}
-
-/* The <span> that is the close button/link. No styling is required, but you'll likely want some. */
-#tipped-closer {
- display:none;
- border:2px outset #999;
- background-color:#CCC;
-}
+#tipped {
+ /* position & display are necessary */
+ position:absolute;
+ display:none;
+
+ /* The rest are just to make it look good & can be changed as you want */
+ border: 1px solid #404040;
+ color: #404040;
+
+ border-radius:5px;
+ padding:3px;
+ z-index: 99999;
+ font-size: 0.9em;
+ max-width: 50%;
+
+ background: #f0f0f0;
+ background: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e0e0e0)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #ffffff 0%,#e0e0e0 100%); /* IE10+ */
+ background: linear-gradient(to bottom, #ffffff 0%,#e0e0e0 100%); /* W3C */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e0e0e0',GradientType=0 ); /* IE6-9 */
+
+ overflow: hidden;
+}
+
+/* The tip content gets inserted into this element */
+#tipped-content p, #tipped p { padding: 2px; margin: 0px; padding-bottom:0px; }
+
+/* This is the <div> that holds the close button/link. No styling is required, but you'll likely want some. */
+#tipped-closer-wrapper {
+ display:none;
+ text-align:center;
+ margin: 0px;
+}
+
+/* The <span> that is the close button/link. No styling is required, but you'll likely want some. */
+#tipped-closer {
+ display:none;
+ border:2px outset #999;
+ background-color:#CCC;
+}
diff --git a/endpoints/api.php b/endpoints/api.php
index b6d768e..2dff915 100644
--- a/endpoints/api.php
+++ b/endpoints/api.php
@@ -1,387 +1,387 @@
-<?php
-/**
- * Main API interface between JavaScript ajax calls and PHP functions.
- * Accepts JSON, POST data or simple GET requests, and returns JSON data.
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: api.php 596 2015-04-19 11:50:53Z imoore76 $
- * @package phpVirtualBox
- * @see vboxconnector
- * @see vboxAjaxRequest
- *
- * @global array $GLOBALS['response'] resopnse data sent back via json
- * @name $response
-*/
-
-# Turn off PHP errors
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
-
-
-//Set no caching
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
-header("Pragma: no-cache");
-
-require_once(dirname(__FILE__).'/lib/config.php');
-require_once(dirname(__FILE__).'/lib/utils.php');
-require_once(dirname(__FILE__).'/lib/vboxconnector.php');
-
-// Init session
-global $_SESSION;
-
-/*
- * Clean request
- */
-$request = clean_request();
-
-
-global $response;
-$response = array('data'=>array('responseData'=>array()),'errors'=>array(),'persist'=>array(),'messages'=>array());
-
-/*
- * Built-in requests
- */
-$vbox = null; // May be set during request handling
-
-/**
- * Main try / catch. Logic dictated by incoming 'fn' request
- * parameter.
- */
-try {
-
- /* Check for password recovery file */
- if(file_exists(dirname(dirname(__FILE__)).'/recovery.php')) {
- throw new Exception('recovery.php exists in phpVirtualBox\'s folder. This is a security hazard. phpVirtualBox will not run until recovery.php has been renamed to a file name that does not end in .php such as <b>recovery.php-disabled</b>.',vboxconnector::PHPVB_ERRNO_FATAL);
- }
-
- /* Check for PHP version */
- if (!version_compare(PHP_VERSION, '5.2.0', '>=')) {
- throw new Exception('phpVirtualBox requires PHP >= 5.2.0, but this server is running version '. PHP_VERSION .'. Please upgrade PHP.');
- }
-
- # Only valid function chars
- $request['fn'] = preg_replace('[^a-zA-Z0-9_-]', '', $request['fn']);
-
- /* Check for function called */
- switch($request['fn']) {
-
- /*
- * No method called
- */
- case '':
- throw new Exception('No method called.');
- break;
-
- /*
- * Return phpVirtualBox's configuration data
- */
- case 'getConfig':
-
- $settings = new phpVBoxConfigClass();
- $response['data']['responseData'] = get_object_vars($settings);
- $response['data']['responseData']['host'] = parse_url($response['data']['responseData']['location']);
- $response['data']['responseData']['host'] = $response['data']['responseData']['host']['host'];
- $response['data']['responseData']['phpvboxver'] = @constant('PHPVBOX_VER');
-
- // Session
- session_init();
-
- // Hide credentials
- unset($response['data']['responseData']['username']);
- unset($response['data']['responseData']['password']);
- foreach($response['data']['responseData']['servers'] as $k => $v)
- $response['data']['responseData']['servers'][$k] = array('name'=>$v['name']);
-
- // Vbox version
- $vbox = new vboxconnector();
- $response['data']['responseData']['version'] = $vbox->getVersion();
- $response['data']['responseData']['hostOS'] = $vbox->vbox->host->operatingSystem;
- $response['data']['responseData']['DSEP'] = $vbox->getDsep();
- $response['data']['responseData']['groupDefinitionKey'] = ($settings->phpVboxGroups ? vboxconnector::phpVboxGroupKey : 'GUI/GroupDefinitions');
-
- $response['data']['success'] = true;
-
- break;
-
- /*
- *
- * USER FUNCTIONS FOLLOW
- *
- */
-
- /*
- * Pass login to authentication module.
- */
- case 'login':
-
-
- // NOTE: Do not break. Fall through to 'getSession
- if(!$request['params']['u'] || !$request['params']['p']) {
- break;
- }
-
- // Session
- session_init(true);
-
- $settings = new phpVBoxConfigClass();
-
- // Try / catch here to hide login credentials
- try {
- $settings->auth->login($request['params']['u'], $request['params']['p']);
- } catch(Exception $e) {
- throw new Exception($e->getMessage(), $e->getCode());
- }
-
- // We're done writing to session
- if(function_exists('session_write_close'))
- @session_write_close();
-
-
-
- /*
- * Return $_SESSION data
- */
- case 'getSession':
-
- $settings = new phpVBoxConfigClass();
- if(method_exists($settings->auth,'autoLoginHook'))
- {
- // Session
- session_init(true);
-
- $settings->auth->autoLoginHook();
-
- // We're done writing to session
- if(function_exists('session_write_close'))
- @session_write_close();
-
- } else {
-
- session_init();
-
- }
-
-
- $response['data']['responseData'] = $_SESSION;
- $response['data']['success'] = true;
- break;
-
- /*
- * Change phpVirtualBox password. Passed to auth module's
- * changePassword method.
- */
- case 'changePassword':
-
- // Session
- session_init(true);
-
- $settings = new phpVBoxConfigClass();
- $response['data']['success'] = $settings->auth->changePassword($request['params']['old'],
- $request['params']['new']);
-
- // We're done writing to session
- if(function_exists('session_write_close'))
- @session_write_close();
-
- break;
-
- /*
- * Get a list of phpVirtualBox users. Passed to auth module's
- * getUsers method.
- */
- case 'getUsers':
-
- // Session
- session_init();
-
- // Must be an admin
- if(!$_SESSION['admin']) break;
-
- $settings = new phpVBoxConfigClass();
- $response['data']['responseData'] = $settings->auth->listUsers();
- $response['date']['success'] = true;
-
- break;
-
- /*
- * Remove a phpVirtualBox user. Passed to auth module's
- * deleteUser method.
- */
- case 'delUser':
-
- // Session
- session_init();
-
- // Must be an admin
- if(!$_SESSION['admin']) break;
-
- $settings = new phpVBoxConfigClass();
- $settings->auth->deleteUser($request['params']['u']);
-
- $response['data']['success'] = true;
- break;
-
- /*
- * Edit a phpVirtualBox user. Passed to auth module's
- * updateUser method.
- */
- case 'editUser':
-
- $skipExistCheck = true;
- // Fall to addUser
-
- /*
- * Add a user to phpVirtualBox. Passed to auth module's
- * updateUser method.
- */
- case 'addUser':
-
- // Session
- session_init();
-
- // Must be an admin
- if(!$_SESSION['admin']) break;
-
- $settings = new phpVBoxConfigClass();
- $settings->auth->updateUser($request['params'], @$skipExistCheck);
-
- $response['data']['success'] = true;
- break;
-
- /*
- * Log out of phpVirtualBox. Passed to auth module's
- * logout method.
- */
- case 'logout':
-
- // Session
- session_init(true);
-
- $vbox = new vboxconnector();
- $vbox->skipSessionCheck = true;
-
- $settings = new phpVBoxConfigClass();
- $settings->auth->logout($response);
-
- session_destroy();
-
- $response['data']['success'] = true;
-
- break;
-
-
- /*
- * If the above cases did not match, assume it is a request
- * that should be passed to vboxconnector.
- */
- default:
-
- $vbox = new vboxconnector();
-
-
- /*
- * Every 1 minute we'll check that the account has not
- * been deleted since login, and update admin credentials.
- */
- if($_SESSION['user'] && ((intval($_SESSION['authCheckHeartbeat'])+60) < time())) {
-
- // init session and keep it open
- session_init(true);
- $vbox->settings->auth->heartbeat($vbox);
-
- // We're done writing to session
- if(function_exists('session_write_close'))
- @session_write_close();
-
- } else {
-
- // init session but close it
- session_init();
-
- }
-
- /*
- * Persistent request data
- */
- if(is_array($request['persist'])) {
- $vbox->persistentRequest = $request['persist'];
- }
-
-
- /*
- * Call to vboxconnector
- */
- $vbox->{$request['fn']}($request['params'],array(&$response));
-
-
- /*
- * Send back persistent request in response
- */
- if(is_array($vbox->persistentRequest) && count($vbox->persistentRequest)) {
- $response['data']['persist'] = $vbox->persistentRequest;
- }
- break;
-
- } // </switch()>
-
-/*
- * Catch all exceptions and populate errors in the
- * JSON response data.
- */
-} catch (Exception $e) {
-
- // Just append to $vbox->errors and let it get
- // taken care of below
- if(!$vbox || !$vbox->errors) {
- $vbox->errors = array();
- }
- $vbox->errors[] = $e;
-}
-
-
-// Add any messages
-if($vbox && count($vbox->messages)) {
- foreach($vbox->messages as $m)
- $response['messages'][] = 'vboxconnector('.$request['fn'] .'): ' . $m;
-}
-// Add other error info
-if($vbox && $vbox->errors) {
-
- foreach($vbox->errors as $e) { /* @var $e Exception */
-
- ob_start();
- print_r($e);
- $d = ob_get_contents();
- ob_end_clean();
-
- # Add connection details to connection errors
- if($e->getCode() == vboxconnector::PHPVB_ERRNO_CONNECT && isset($vbox->settings))
- $d .= "\n\nLocation:" . $vbox->settings->location;
-
- $response['messages'][] = htmlentities($e->getMessage()).' ' . htmlentities($details);
-
- $response['errors'][] = array(
- 'error'=> ($e->getCode() & vboxconnector::PHPVB_ERRNO_HTML ? $e->getMessage() : htmlentities($e->getMessage())),
- 'details'=>htmlentities($d),
- 'errno'=>$e->getCode(),
- // Fatal errors halt all processing
- 'fatal'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_FATAL),
- // Connection errors display alternate servers options
- 'connection'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_CONNECT)
- );
- }
-}
-
-/*
- * Return response as JSON encoded data or use PHP's
- * print_r to dump data to browser.
- */
-if(isset($request['printr'])) {
- print_r($response);
-} else {
- header('Content-type: application/json');
- echo(json_encode($response));
-}
-
+<?php
+/**
+ * Main API interface between JavaScript ajax calls and PHP functions.
+ * Accepts JSON, POST data or simple GET requests, and returns JSON data.
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: api.php 596 2015-04-19 11:50:53Z imoore76 $
+ * @package phpVirtualBox
+ * @see vboxconnector
+ * @see vboxAjaxRequest
+ *
+ * @global array $GLOBALS['response'] resopnse data sent back via json
+ * @name $response
+*/
+
+# Turn off PHP errors
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
+
+
+//Set no caching
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
+header("Pragma: no-cache");
+
+require_once(dirname(__FILE__).'/lib/config.php');
+require_once(dirname(__FILE__).'/lib/utils.php');
+require_once(dirname(__FILE__).'/lib/vboxconnector.php');
+
+// Init session
+global $_SESSION;
+
+/*
+ * Clean request
+ */
+$request = clean_request();
+
+
+global $response;
+$response = array('data'=>array('responseData'=>array()),'errors'=>array(),'persist'=>array(),'messages'=>array());
+
+/*
+ * Built-in requests
+ */
+$vbox = null; // May be set during request handling
+
+/**
+ * Main try / catch. Logic dictated by incoming 'fn' request
+ * parameter.
+ */
+try {
+
+ /* Check for password recovery file */
+ if(file_exists(dirname(dirname(__FILE__)).'/recovery.php')) {
+ throw new Exception('recovery.php exists in phpVirtualBox\'s folder. This is a security hazard. phpVirtualBox will not run until recovery.php has been renamed to a file name that does not end in .php such as <b>recovery.php-disabled</b>.',vboxconnector::PHPVB_ERRNO_FATAL);
+ }
+
+ /* Check for PHP version */
+ if (!version_compare(PHP_VERSION, '5.2.0', '>=')) {
+ throw new Exception('phpVirtualBox requires PHP >= 5.2.0, but this server is running version '. PHP_VERSION .'. Please upgrade PHP.');
+ }
+
+ # Only valid function chars
+ $request['fn'] = preg_replace('[^a-zA-Z0-9_-]', '', $request['fn']);
+
+ /* Check for function called */
+ switch($request['fn']) {
+
+ /*
+ * No method called
+ */
+ case '':
+ throw new Exception('No method called.');
+ break;
+
+ /*
+ * Return phpVirtualBox's configuration data
+ */
+ case 'getConfig':
+
+ $settings = new phpVBoxConfigClass();
+ $response['data']['responseData'] = get_object_vars($settings);
+ $response['data']['responseData']['host'] = parse_url($response['data']['responseData']['location']);
+ $response['data']['responseData']['host'] = $response['data']['responseData']['host']['host'];
+ $response['data']['responseData']['phpvboxver'] = @constant('PHPVBOX_VER');
+
+ // Session
+ session_init();
+
+ // Hide credentials
+ unset($response['data']['responseData']['username']);
+ unset($response['data']['responseData']['password']);
+ foreach($response['data']['responseData']['servers'] as $k => $v)
+ $response['data']['responseData']['servers'][$k] = array('name'=>$v['name']);
+
+ // Vbox version
+ $vbox = new vboxconnector();
+ $response['data']['responseData']['version'] = $vbox->getVersion();
+ $response['data']['responseData']['hostOS'] = $vbox->vbox->host->operatingSystem;
+ $response['data']['responseData']['DSEP'] = $vbox->getDsep();
+ $response['data']['responseData']['groupDefinitionKey'] = ($settings->phpVboxGroups ? vboxconnector::phpVboxGroupKey : 'GUI/GroupDefinitions');
+
+ $response['data']['success'] = true;
+
+ break;
+
+ /*
+ *
+ * USER FUNCTIONS FOLLOW
+ *
+ */
+
+ /*
+ * Pass login to authentication module.
+ */
+ case 'login':
+
+
+ // NOTE: Do not break. Fall through to 'getSession
+ if(!$request['params']['u'] || !$request['params']['p']) {
+ break;
+ }
+
+ // Session
+ session_init(true);
+
+ $settings = new phpVBoxConfigClass();
+
+ // Try / catch here to hide login credentials
+ try {
+ $settings->auth->login($request['params']['u'], $request['params']['p']);
+ } catch(Exception $e) {
+ throw new Exception($e->getMessage(), $e->getCode());
+ }
+
+ // We're done writing to session
+ if(function_exists('session_write_close'))
+ @session_write_close();
+
+
+
+ /*
+ * Return $_SESSION data
+ */
+ case 'getSession':
+
+ $settings = new phpVBoxConfigClass();
+ if(method_exists($settings->auth,'autoLoginHook'))
+ {
+ // Session
+ session_init(true);
+
+ $settings->auth->autoLoginHook();
+
+ // We're done writing to session
+ if(function_exists('session_write_close'))
+ @session_write_close();
+
+ } else {
+
+ session_init();
+
+ }
+
+
+ $response['data']['responseData'] = $_SESSION;
+ $response['data']['success'] = true;
+ break;
+
+ /*
+ * Change phpVirtualBox password. Passed to auth module's
+ * changePassword method.
+ */
+ case 'changePassword':
+
+ // Session
+ session_init(true);
+
+ $settings = new phpVBoxConfigClass();
+ $response['data']['success'] = $settings->auth->changePassword($request['params']['old'],
+ $request['params']['new']);
+
+ // We're done writing to session
+ if(function_exists('session_write_close'))
+ @session_write_close();
+
+ break;
+
+ /*
+ * Get a list of phpVirtualBox users. Passed to auth module's
+ * getUsers method.
+ */
+ case 'getUsers':
+
+ // Session
+ session_init();
+
+ // Must be an admin
+ if(!$_SESSION['admin']) break;
+
+ $settings = new phpVBoxConfigClass();
+ $response['data']['responseData'] = $settings->auth->listUsers();
+ $response['date']['success'] = true;
+
+ break;
+
+ /*
+ * Remove a phpVirtualBox user. Passed to auth module's
+ * deleteUser method.
+ */
+ case 'delUser':
+
+ // Session
+ session_init();
+
+ // Must be an admin
+ if(!$_SESSION['admin']) break;
+
+ $settings = new phpVBoxConfigClass();
+ $settings->auth->deleteUser($request['params']['u']);
+
+ $response['data']['success'] = true;
+ break;
+
+ /*
+ * Edit a phpVirtualBox user. Passed to auth module's
+ * updateUser method.
+ */
+ case 'editUser':
+
+ $skipExistCheck = true;
+ // Fall to addUser
+
+ /*
+ * Add a user to phpVirtualBox. Passed to auth module's
+ * updateUser method.
+ */
+ case 'addUser':
+
+ // Session
+ session_init();
+
+ // Must be an admin
+ if(!$_SESSION['admin']) break;
+
+ $settings = new phpVBoxConfigClass();
+ $settings->auth->updateUser($request['params'], @$skipExistCheck);
+
+ $response['data']['success'] = true;
+ break;
+
+ /*
+ * Log out of phpVirtualBox. Passed to auth module's
+ * logout method.
+ */
+ case 'logout':
+
+ // Session
+ session_init(true);
+
+ $vbox = new vboxconnector();
+ $vbox->skipSessionCheck = true;
+
+ $settings = new phpVBoxConfigClass();
+ $settings->auth->logout($response);
+
+ session_destroy();
+
+ $response['data']['success'] = true;
+
+ break;
+
+
+ /*
+ * If the above cases did not match, assume it is a request
+ * that should be passed to vboxconnector.
+ */
+ default:
+
+ $vbox = new vboxconnector();
+
+
+ /*
+ * Every 1 minute we'll check that the account has not
+ * been deleted since login, and update admin credentials.
+ */
+ if($_SESSION['user'] && ((intval($_SESSION['authCheckHeartbeat'])+60) < time())) {
+
+ // init session and keep it open
+ session_init(true);
+ $vbox->settings->auth->heartbeat($vbox);
+
+ // We're done writing to session
+ if(function_exists('session_write_close'))
+ @session_write_close();
+
+ } else {
+
+ // init session but close it
+ session_init();
+
+ }
+
+ /*
+ * Persistent request data
+ */
+ if(is_array($request['persist'])) {
+ $vbox->persistentRequest = $request['persist'];
+ }
+
+
+ /*
+ * Call to vboxconnector
+ */
+ $vbox->{$request['fn']}($request['params'],array(&$response));
+
+
+ /*
+ * Send back persistent request in response
+ */
+ if(is_array($vbox->persistentRequest) && count($vbox->persistentRequest)) {
+ $response['data']['persist'] = $vbox->persistentRequest;
+ }
+ break;
+
+ } // </switch()>
+
+/*
+ * Catch all exceptions and populate errors in the
+ * JSON response data.
+ */
+} catch (Exception $e) {
+
+ // Just append to $vbox->errors and let it get
+ // taken care of below
+ if(!$vbox || !$vbox->errors) {
+ $vbox->errors = array();
+ }
+ $vbox->errors[] = $e;
+}
+
+
+// Add any messages
+if($vbox && count($vbox->messages)) {
+ foreach($vbox->messages as $m)
+ $response['messages'][] = 'vboxconnector('.$request['fn'] .'): ' . $m;
+}
+// Add other error info
+if($vbox && $vbox->errors) {
+
+ foreach($vbox->errors as $e) { /* @var $e Exception */
+
+ ob_start();
+ print_r($e);
+ $d = ob_get_contents();
+ ob_end_clean();
+
+ # Add connection details to connection errors
+ if($e->getCode() == vboxconnector::PHPVB_ERRNO_CONNECT && isset($vbox->settings))
+ $d .= "\n\nLocation:" . $vbox->settings->location;
+
+ $response['messages'][] = htmlentities($e->getMessage()).' ' . htmlentities($details);
+
+ $response['errors'][] = array(
+ 'error'=> ($e->getCode() & vboxconnector::PHPVB_ERRNO_HTML ? $e->getMessage() : htmlentities($e->getMessage())),
+ 'details'=>htmlentities($d),
+ 'errno'=>$e->getCode(),
+ // Fatal errors halt all processing
+ 'fatal'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_FATAL),
+ // Connection errors display alternate servers options
+ 'connection'=>($e->getCode() & vboxconnector::PHPVB_ERRNO_CONNECT)
+ );
+ }
+}
+
+/*
+ * Return response as JSON encoded data or use PHP's
+ * print_r to dump data to browser.
+ */
+if(isset($request['printr'])) {
+ print_r($response);
+} else {
+ header('Content-type: application/json');
+ echo(json_encode($response));
+}
+
diff --git a/endpoints/jqueryFileTree.php b/endpoints/jqueryFileTree.php
index 7c88428..875d3db 100644
--- a/endpoints/jqueryFileTree.php
+++ b/endpoints/jqueryFileTree.php
@@ -1,385 +1,385 @@
-<?php
-//
-// jQuery File Tree PHP Connector
-//
-// Version 1.01
-//
-// Cory S.N. LaViska
-// A Beautiful Site (http://abeautifulsite.net/)
-// 24 March 2008
-//
-// History:
-//
-// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
-// 1.00 - released (24 March 2008)
-//
-// Output a list of files for jQuery File Tree
-//
-// ]--- Modified by Ian Moore for phpVirtualBox.
-//
-// $Id: jqueryFileTree.php 592 2015-04-12 19:53:44Z imoore76 $
-//
-//
-
-# Turn off PHP notices
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
-
-global $vbox, $localbrowser, $allowed;
-
-require_once(dirname(__FILE__).'/lib/config.php');
-require_once(dirname(__FILE__).'/lib/utils.php');
-require_once(dirname(__FILE__).'/lib/vboxconnector.php');
-
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
-
-session_init();
-if(!$_SESSION['valid']) return;
-
-/*
- * Get Settings
- */
-$settings = new phpVBoxConfigClass();
-
-
-$vbox = new vboxconnector();
-$vbox->connect();
-
-/*
- * Clean request
- */
-global $request;
-$request = clean_request();
-
-/*
- * Determine directory separator
- */
-$localbrowser = @$settings->browserLocal;
-if($localbrowser) {
- define('DSEP', DIRECTORY_SEPARATOR);
-} else {
- define('DSEP',$vbox->getDsep());
-}
-
-/*
- * Compose allowed file types list
- */
-$allowed_exts = $settings->browserRestrictFiles;
-if(is_array($allowed_exts) && count($allowed_exts) > 0) $allowed_exts = array_combine($allowed_exts,$allowed_exts);
-else $allowed_exts = array();
-
-/* Allowed folders list */
-$allowed_folders = @$settings->browserRestrictFolders;
-if(!is_array($allowed_folders))
- $allowed_folders = array();
-
-/*
- * Get a list of windows drives
- */
-function get_windows_drives() {
- $checklist = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $drives = array();
- for($i = 0; $i < strlen($d); $i++) {
- if(is_dir($checklist[$i].':\\')) {
- $drives[] = $checklist[$i].':\\';
- }
- }
- return $drives;
-}
-
-/*
- * Allowed folders in windows if none are set
- */
-if(stripos($vbox->vbox->host->operatingSystem,'win') === 0 && !count($allowed_folders)) {
-
- /*
- * Assumes web server and vbox host are the same physical machine
- */
- if($request['fullpath'] && !$settings->forceWindowsAllDriveList && !$settings->noWindowsDriveList && stripos(PHP_OS,'win') === 0) {
-
-
- $allowed_folders = get_windows_drives();
-
- /*
- * Just show all C-Z drive letters if vboxhost is windows and our web server is not...
- */
- } else if($request['fullpath'] && ($settings->forceWindowsAllDriveList || (!$settings->noWindowsDriveList && stripos(PHP_OS,'win') === false))) {
- $allowed_folders = array();
- for($i = 67; $i < 91; $i++) {
- $allowed_folders[] = chr($i) .':\\';
- }
- }
- $allowed_folders = array_combine($allowed_folders,$allowed_folders);
-
-}
-
-
-/* Deterine target DIR requested.
- * In some cases, "dir" passed is just a file name
- */
-if(strpos($request['dir'],DSEP)===false) {
- $request['dir'] = DSEP;
-}
-
-// Eliminate duplicate DSEPs
-$request['dir'] = str_replace(DSEP.DSEP,DSEP,$request['dir']);
-
-
-/*
- * Check that folder restriction validates if it exists
- */
-if($request['dir'] != DSEP && count($allowed_folders)) {
- $valid = false;
- foreach($allowed_folders as $f) {
- if(strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
- $valid = true;
- break;
- }
- }
- if(!$valid) {
- $request['dir'] = DSEP;
- }
-}
-
-/*
- * Populate $returnData with directory listing
- */
-$returnData = array();
-
-/* Folder Restriction with root '/' requested */
-if($request['dir'] == DSEP && count($allowed_folders)) {
-
- /* Just return restricted folders */
- foreach($allowed_folders as $f) {
- array_push($returnData, folder_entry($f, true));
-
- }
-
-} else {
-
-
- /* Full, expanded path to $dir */
- if($request['fullpath']) {
-
-
- /* Go through allowed folders if it is set */
- if(count($allowed_folders)) {
-
-
- foreach($allowed_folders as $f) {
-
- /* If this was not exactly the requested folder, but a parent,
- * list everything below it.
- */
- if((strtoupper($request['dir']) != strtoupper($f)) && strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
-
- // List entries in this folder
- $path = explode(DSEP, substr($request['dir'],strlen($f)));
-
- if($path[0] == '') {
- array_shift($path);
- }
-
- $folder_entry = folder_entry($f, true);
-
- $folder_entry['children'] = getdir($f, $request['dirsOnly'], $path);
- $folder_entry['expanded'] = true;
-
- array_push($returnData, $folder_entry);
-
- } else {
- array_push($returnData, folder_entry($f,true));
- }
-
- }
-
- /* Just get full path */
- } else {
-
- // List entries in this folder
- $path = explode(DSEP,$request['dir']);
- $root = array_shift($path).DSEP;
-
- // Folder entry
- $returnData = getdir($root, $request['dirsOnly'], $path);
-
- }
-
-
- } else {
-
- /* Default action. Return dir requested */
- $returnData = getdir($request['dir'], $request['dirsOnly']);
-
- }
-
-}
-
-header('Content-type: application/json');
-echo(json_encode($returnData));
-
-
-/*
- * Get directory entries
- */
-function getdir($dir, $dirsOnly=false, $recurse=array()) {
-
- if(!$dir) $dir = DSEP;
-
- $entries = getDirEntries($dir, $dirsOnly);
-
- if(!count($entries))
- return array();
-
- $dirents = array();
- foreach($entries as $path => $type) {
-
- if($type == 'folder' && count($recurse) && (strcasecmp($recurse[0],vbox_basename($path)) == 0)) {
-
- $entry = folder_entry($path, false, true);
-
- $entry['children'] = getdir($dir.DSEP.array_shift($recurse), $dirsOnly, $recurse);
-
- array_push($dirents, $entry);
-
- } else {
-
- // Push folder on to stack
- if($type == 'folder') {
-
- array_push($dirents, folder_entry($path));
-
- // Push file on to stack
- } else {
-
- $ext = strtolower(preg_replace('/^.*\./', '', $file));
-
- if(count($allowed) && !$allowed['.'.$ext]) continue;
-
- array_push($dirents, file_entry($path));
- }
- }
-
- }
-
- return $dirents;
-
-}
-
-function vbox_basename($b) { return substr($b,strrpos($b,DSEP)+1); }
-function file_entry($f) {
- $f = str_replace(DSEP.DSEP,DSEP,$f);
- $ext = strtolower(preg_replace('/^.*\./', '', $f));
- return array(
- 'ext' => $ext,
- 'name' => htmlentities(vbox_basename($f), ENT_QUOTES),
- 'path' => htmlentities($f, ENT_QUOTES),
- 'type' => 'file'
- );
-}
-function folder_entry($f,$full=false,$expanded=false) {
- $f = str_replace(DSEP.DSEP,DSEP,$f);
- $selected = (strnatcasecmp(rtrim($f,DSEP),rtrim($GLOBALS['request']['dir'],DSEP)) == 0) && $expanded;
- return array(
- 'expanded' => (bool)$expanded,
- 'selected' => (bool)$selected,
- 'path' => htmlentities($f,ENT_QUOTES),
- 'name' => htmlentities(($full ? $f : vbox_basename($f)),ENT_QUOTES),
- 'type' => 'folder',
- 'children' => array()
- );
-}
-
-
-
-/**
- * Rreturn a list of directory entries
- *
- * @param String $dir
- * @return Array of entries
- */
-
-function getDirEntries($dir, $foldersOnly=false) {
-
- global $localbrowser, $allowed_exts, $vbox;
-
- // Append trailing slash if it isn't here
- if(substr($dir,-1) != DSEP)
- $dir .= DSEP;
-
-
- /*
- * Use local file / folder browser (PHP)
- */
- if($localbrowser) {
-
- // If the dir doesn't exist or we can't scan it, just return
- if(!(file_exists($dir) && ($ents = @scandir($dir))))
- return array();
-
- $newtypes = array();
- $newents = array();
- for($i = 0; $i < count($ents); $i++) {
-
- // Skip . and ..
- if($ents[$i] == '.' || $ents[$i] == '..')
- continue;
-
- $fullpath = $dir.$ents[$i];
- $isdir = @is_dir($fullpath);
-
- if(!$isdir && $foldersOnly)
- continue;
-
- array_push($newtypes, $isdir ? 'folder' : 'file');
- array_push($newents, $fullpath);
- }
- return array_combine($newents, $newtypes);
-
- /*
- * Use remote file / folder browser (vbox)
- */
- } else {
-
- try {
-
-
- $appl = $vbox->vbox->createAppliance();
- $vfs = $appl->createVFSExplorer('file://'.str_replace(DSEP.DSEP,DSEP,$dir));
- $progress = $vfs->update();
- $progress->waitForCompletion(-1);
- $progress->releaseRemote();
- list($ents,$types) = $vfs->entryList();
- $vfs->releaseRemote();
- $appl->releaseRemote();
-
- } catch (Exception $e) {
-
- echo($e->getMessage());
-
- return array();
-
- }
-
- // Convert types to file / folder
- $newtypes = array();
- $newents = array();
- for($i = 0; $i < count($types); $i++) {
-
- // Skip . and ..
- if($ents[$i] == '.' || $ents[$i] == '..')
- continue;
-
- $isdir = $types[$i] == 4;
-
- if(!$isdir && $foldersOnly)
- continue;
-
- array_push($newtypes, $isdir ? 'folder' : 'file');
- array_push($newents, $dir.$ents[$i]);
- }
- return array_combine($newents,$newtypes);
-
- }
-
-
-}
+<?php
+//
+// jQuery File Tree PHP Connector
+//
+// Version 1.01
+//
+// Cory S.N. LaViska
+// A Beautiful Site (http://abeautifulsite.net/)
+// 24 March 2008
+//
+// History:
+//
+// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
+// 1.00 - released (24 March 2008)
+//
+// Output a list of files for jQuery File Tree
+//
+// ]--- Modified by Ian Moore for phpVirtualBox.
+//
+// $Id: jqueryFileTree.php 592 2015-04-12 19:53:44Z imoore76 $
+//
+//
+
+# Turn off PHP notices
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
+
+global $vbox, $localbrowser, $allowed;
+
+require_once(dirname(__FILE__).'/lib/config.php');
+require_once(dirname(__FILE__).'/lib/utils.php');
+require_once(dirname(__FILE__).'/lib/vboxconnector.php');
+
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
+
+session_init();
+if(!$_SESSION['valid']) return;
+
+/*
+ * Get Settings
+ */
+$settings = new phpVBoxConfigClass();
+
+
+$vbox = new vboxconnector();
+$vbox->connect();
+
+/*
+ * Clean request
+ */
+global $request;
+$request = clean_request();
+
+/*
+ * Determine directory separator
+ */
+$localbrowser = @$settings->browserLocal;
+if($localbrowser) {
+ define('DSEP', DIRECTORY_SEPARATOR);
+} else {
+ define('DSEP',$vbox->getDsep());
+}
+
+/*
+ * Compose allowed file types list
+ */
+$allowed_exts = $settings->browserRestrictFiles;
+if(is_array($allowed_exts) && count($allowed_exts) > 0) $allowed_exts = array_combine($allowed_exts,$allowed_exts);
+else $allowed_exts = array();
+
+/* Allowed folders list */
+$allowed_folders = @$settings->browserRestrictFolders;
+if(!is_array($allowed_folders))
+ $allowed_folders = array();
+
+/*
+ * Get a list of windows drives
+ */
+function get_windows_drives() {
+ $checklist = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ $drives = array();
+ for($i = 0; $i < strlen($d); $i++) {
+ if(is_dir($checklist[$i].':\\')) {
+ $drives[] = $checklist[$i].':\\';
+ }
+ }
+ return $drives;
+}
+
+/*
+ * Allowed folders in windows if none are set
+ */
+if(stripos($vbox->vbox->host->operatingSystem,'win') === 0 && !count($allowed_folders)) {
+
+ /*
+ * Assumes web server and vbox host are the same physical machine
+ */
+ if($request['fullpath'] && !$settings->forceWindowsAllDriveList && !$settings->noWindowsDriveList && stripos(PHP_OS,'win') === 0) {
+
+
+ $allowed_folders = get_windows_drives();
+
+ /*
+ * Just show all C-Z drive letters if vboxhost is windows and our web server is not...
+ */
+ } else if($request['fullpath'] && ($settings->forceWindowsAllDriveList || (!$settings->noWindowsDriveList && stripos(PHP_OS,'win') === false))) {
+ $allowed_folders = array();
+ for($i = 67; $i < 91; $i++) {
+ $allowed_folders[] = chr($i) .':\\';
+ }
+ }
+ $allowed_folders = array_combine($allowed_folders,$allowed_folders);
+
+}
+
+
+/* Deterine target DIR requested.
+ * In some cases, "dir" passed is just a file name
+ */
+if(strpos($request['dir'],DSEP)===false) {
+ $request['dir'] = DSEP;
+}
+
+// Eliminate duplicate DSEPs
+$request['dir'] = str_replace(DSEP.DSEP,DSEP,$request['dir']);
+
+
+/*
+ * Check that folder restriction validates if it exists
+ */
+if($request['dir'] != DSEP && count($allowed_folders)) {
+ $valid = false;
+ foreach($allowed_folders as $f) {
+ if(strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
+ $valid = true;
+ break;
+ }
+ }
+ if(!$valid) {
+ $request['dir'] = DSEP;
+ }
+}
+
+/*
+ * Populate $returnData with directory listing
+ */
+$returnData = array();
+
+/* Folder Restriction with root '/' requested */
+if($request['dir'] == DSEP && count($allowed_folders)) {
+
+ /* Just return restricted folders */
+ foreach($allowed_folders as $f) {
+ array_push($returnData, folder_entry($f, true));
+
+ }
+
+} else {
+
+
+ /* Full, expanded path to $dir */
+ if($request['fullpath']) {
+
+
+ /* Go through allowed folders if it is set */
+ if(count($allowed_folders)) {
+
+
+ foreach($allowed_folders as $f) {
+
+ /* If this was not exactly the requested folder, but a parent,
+ * list everything below it.
+ */
+ if((strtoupper($request['dir']) != strtoupper($f)) && strpos(strtoupper($request['dir']),strtoupper($f)) === 0) {
+
+ // List entries in this folder
+ $path = explode(DSEP, substr($request['dir'],strlen($f)));
+
+ if($path[0] == '') {
+ array_shift($path);
+ }
+
+ $folder_entry = folder_entry($f, true);
+
+ $folder_entry['children'] = getdir($f, $request['dirsOnly'], $path);
+ $folder_entry['expanded'] = true;
+
+ array_push($returnData, $folder_entry);
+
+ } else {
+ array_push($returnData, folder_entry($f,true));
+ }
+
+ }
+
+ /* Just get full path */
+ } else {
+
+ // List entries in this folder
+ $path = explode(DSEP,$request['dir']);
+ $root = array_shift($path).DSEP;
+
+ // Folder entry
+ $returnData = getdir($root, $request['dirsOnly'], $path);
+
+ }
+
+
+ } else {
+
+ /* Default action. Return dir requested */
+ $returnData = getdir($request['dir'], $request['dirsOnly']);
+
+ }
+
+}
+
+header('Content-type: application/json');
+echo(json_encode($returnData));
+
+
+/*
+ * Get directory entries
+ */
+function getdir($dir, $dirsOnly=false, $recurse=array()) {
+
+ if(!$dir) $dir = DSEP;
+
+ $entries = getDirEntries($dir, $dirsOnly);
+
+ if(!count($entries))
+ return array();
+
+ $dirents = array();
+ foreach($entries as $path => $type) {
+
+ if($type == 'folder' && count($recurse) && (strcasecmp($recurse[0],vbox_basename($path)) == 0)) {
+
+ $entry = folder_entry($path, false, true);
+
+ $entry['children'] = getdir($dir.DSEP.array_shift($recurse), $dirsOnly, $recurse);
+
+ array_push($dirents, $entry);
+
+ } else {
+
+ // Push folder on to stack
+ if($type == 'folder') {
+
+ array_push($dirents, folder_entry($path));
+
+ // Push file on to stack
+ } else {
+
+ $ext = strtolower(preg_replace('/^.*\./', '', $file));
+
+ if(count($allowed) && !$allowed['.'.$ext]) continue;
+
+ array_push($dirents, file_entry($path));
+ }
+ }
+
+ }
+
+ return $dirents;
+
+}
+
+function vbox_basename($b) { return substr($b,strrpos($b,DSEP)+1); }
+function file_entry($f) {
+ $f = str_replace(DSEP.DSEP,DSEP,$f);
+ $ext = strtolower(preg_replace('/^.*\./', '', $f));
+ return array(
+ 'ext' => $ext,
+ 'name' => htmlentities(vbox_basename($f), ENT_QUOTES),
+ 'path' => htmlentities($f, ENT_QUOTES),
+ 'type' => 'file'
+ );
+}
+function folder_entry($f,$full=false,$expanded=false) {
+ $f = str_replace(DSEP.DSEP,DSEP,$f);
+ $selected = (strnatcasecmp(rtrim($f,DSEP),rtrim($GLOBALS['request']['dir'],DSEP)) == 0) && $expanded;
+ return array(
+ 'expanded' => (bool)$expanded,
+ 'selected' => (bool)$selected,
+ 'path' => htmlentities($f,ENT_QUOTES),
+ 'name' => htmlentities(($full ? $f : vbox_basename($f)),ENT_QUOTES),
+ 'type' => 'folder',
+ 'children' => array()
+ );
+}
+
+
+
+/**
+ * Rreturn a list of directory entries
+ *
+ * @param String $dir
+ * @return Array of entries
+ */
+
+function getDirEntries($dir, $foldersOnly=false) {
+
+ global $localbrowser, $allowed_exts, $vbox;
+
+ // Append trailing slash if it isn't here
+ if(substr($dir,-1) != DSEP)
+ $dir .= DSEP;
+
+
+ /*
+ * Use local file / folder browser (PHP)
+ */
+ if($localbrowser) {
+
+ // If the dir doesn't exist or we can't scan it, just return
+ if(!(file_exists($dir) && ($ents = @scandir($dir))))
+ return array();
+
+ $newtypes = array();
+ $newents = array();
+ for($i = 0; $i < count($ents); $i++) {
+
+ // Skip . and ..
+ if($ents[$i] == '.' || $ents[$i] == '..')
+ continue;
+
+ $fullpath = $dir.$ents[$i];
+ $isdir = @is_dir($fullpath);
+
+ if(!$isdir && $foldersOnly)
+ continue;
+
+ array_push($newtypes, $isdir ? 'folder' : 'file');
+ array_push($newents, $fullpath);
+ }
+ return array_combine($newents, $newtypes);
+
+ /*
+ * Use remote file / folder browser (vbox)
+ */
+ } else {
+
+ try {
+
+
+ $appl = $vbox->vbox->createAppliance();
+ $vfs = $appl->createVFSExplorer('file://'.str_replace(DSEP.DSEP,DSEP,$dir));
+ $progress = $vfs->update();
+ $progress->waitForCompletion(-1);
+ $progress->releaseRemote();
+ list($ents,$types) = $vfs->entryList();
+ $vfs->releaseRemote();
+ $appl->releaseRemote();
+
+ } catch (Exception $e) {
+
+ echo($e->getMessage());
+
+ return array();
+
+ }
+
+ // Convert types to file / folder
+ $newtypes = array();
+ $newents = array();
+ for($i = 0; $i < count($types); $i++) {
+
+ // Skip . and ..
+ if($ents[$i] == '.' || $ents[$i] == '..')
+ continue;
+
+ $isdir = $types[$i] == 4;
+
+ if(!$isdir && $foldersOnly)
+ continue;
+
+ array_push($newtypes, $isdir ? 'folder' : 'file');
+ array_push($newents, $dir.$ents[$i]);
+ }
+ return array_combine($newents,$newtypes);
+
+ }
+
+
+}
diff --git a/endpoints/language.php b/endpoints/language.php
index e0769c6..645415a 100644
--- a/endpoints/language.php
+++ b/endpoints/language.php
@@ -1,117 +1,117 @@
-<?php
-/*
- * 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 $
- */
-
-
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
-
-require_once(dirname(__FILE__).'/lib/language.php');
-
-if(!is_object($_vbox_language)) $_vbox_language = new __vbox_language();
-
-
-header("Content-type: application/javascript; charset=utf-8", true);
-
-//Set no caching
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
-header("Pragma: no-cache");
-
-if(isset($_GET['debug']) && $_GET['debug']) {
- print_r(__vbox_language::$langdata);
- return;
-}
-
-/*
- * Dump in JavaScript
- */
-echo('var __vboxLangData = ' . json_encode(__vbox_language::$langdata) .";\n\nvar __vboxLangName = '".constant('VBOXLANG')."';\n\n");
-
-
-?>
-
-
-// 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') {
- // 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) {
- /*
- 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) {
- // console.log(w + ' - ' + context + ': ' + err);
- return w;
- }
-}
-
+<?php
+/*
+ * 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 $
+ */
+
+
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
+
+require_once(dirname(__FILE__).'/lib/language.php');
+
+if(!is_object($_vbox_language)) $_vbox_language = new __vbox_language();
+
+
+header("Content-type: application/javascript; charset=utf-8", true);
+
+//Set no caching
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
+header("Pragma: no-cache");
+
+if(isset($_GET['debug']) && $_GET['debug']) {
+ print_r(__vbox_language::$langdata);
+ return;
+}
+
+/*
+ * Dump in JavaScript
+ */
+echo('var __vboxLangData = ' . json_encode(__vbox_language::$langdata) .";\n\nvar __vboxLangName = '".constant('VBOXLANG')."';\n\n");
+
+
+?>
+
+
+// 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') {
+ // 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) {
+ /*
+ 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) {
+ // console.log(w + ' - ' + context + ': ' + err);
+ return w;
+ }
+}
+
diff --git a/endpoints/lib/auth/ActiveDirectory.php b/endpoints/lib/auth/ActiveDirectory.php
index ce8c4df..cc227dd 100644
--- a/endpoints/lib/auth/ActiveDirectory.php
+++ b/endpoints/lib/auth/ActiveDirectory.php
@@ -1,203 +1,203 @@
-<?php
-/*
- * $Id: ActiveDirectory.php 501 2013-07-11 17:44:37Z imooreyahoo@gmail.com $
-* Experimental!
-*/
-class phpvbAuthActiveDirectory implements phpvbAuth {
-
- var $capabilities = array(
- 'canChangePassword' => false,
- 'canLogout' => true
- );
-
- var $config = array(
- 'host' => '127.0.0.1',
- 'admin_group' => null,
- 'adminUser' => null,
- 'user_group' => null,
- 'container' => 'CN=Users',
- 'domain' => 'internal.local',
- 'filter' => '(&(objectclass=User)(objectCategory=Person))'
- );
-
- /**
- * Constructor
- * @param array $userConfig - user configuration for this module
- */
- function phpvbAuthActiveDirectory($userConfig = null) {
- // Merge user config
- if($userConfig) {
- $this->config = array_merge($this->config,$userConfig);
- }
- }
-
- /**
- * Test log in and set $_SESSION vars
- * @param string $username
- * @param string $password
- * @see phpvbAuth::login()
- */
- function login($username, $password)
- {
- global $_SESSION;
-
-
- /*
- * Check for LDAP functionality and provide some direction
- */
- if(!function_exists('ldap_connect')) {
-
- $ex = 'LDAP support is not enabled in your PHP configuration.';
-
- if(strtolower(substr(PHP_OS, 0, 3)) == 'win') {
-
- ob_start();
- phpinfo(INFO_GENERAL);
- $phpinfo = ob_get_contents();
- ob_end_clean();
- preg_match('/Loaded Configuration File <\/td><td.*?>(.*?)\s*</', $phpinfo, $phpinfo);
-
- $ex .= ' You probably just need to uncomment the line ;extension=php_ldap.dll in php.ini'.
- (count($phpinfo) > 1 ? ' (' .trim($phpinfo[1]).')' : '') . ' by removing the ";" and restart your web server.';
-
- } else if(strtolower(substr(PHP_OS, 0, 5)) == 'Linux') {
-
- $ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package and restart your web server.';
-
- }
- throw new Exception($ex);
- }
-
- $_SESSION['valid'] = false;
-
- // Connect to server
- if(!($auth = ldap_connect($this->config['host']))) {
- throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
- }
-
- // Set relevant LDAP options
- ldap_set_option($auth,LDAP_OPT_PROTOCOL_VERSION, 3);
-
-
- // Main login /bind
- if(!($bind = @ldap_bind($auth, $username . "@" .$this->config['domain'], $password))) {
- if(ldap_errno($auth) == 49) return false;
- throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
- }
-
-
- // Get user information from AD
- ////////////////////////////////////
-
-
- // Set filter and sanitize username before sending it to AD
- $filter = "(sAMAccountName=" .
- str_replace(array(',','=','+','<','>',';','\\','"','#','(',')','*',chr(0)), '', $username) . ")";
- if($this->config['filter'] && false) {
- $filter = '(&'. $this->config['filter'] .' ('. $filter .'))';
- }
-
- $result = @ldap_search($auth,
- $this->config['container'] . ',DC=' . join(',DC=', explode('.', $this->config['domain'])),
- $filter, array("memberof","useraccountcontrol"));
-
- if(!result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
- @list($entries) = @ldap_get_entries($auth, $result);
- @ldap_unbind($auth);
- if(!$entries) {
- throw new Exception("Permission denied");
- }
-
-
- // Check for disabled user
- if((intval($entries['useraccountcontrol'][0]) & 2)) {
- throw new Exception('This account is disabled in Active Directory.');
- }
-
- // check for valid admin group
- if($this->config['admin_group']) {
- foreach($entries['memberof'] as $group) {
- list($group) = explode(',', $group);
- if(strtolower($group) == strtolower('cn='.$this->config['admin_group'])) {
- $_SESSION['admin'] = $_SESSION['valid'] = true;
- break;
- }
- }
- }
-
- // Admin user explicitly set?
- if(!$_SESSION['admin'] && $this->config['adminUser']) {
- $_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
- // Admin is ok
- $_SESSION['valid'] = ($_SESSION['admin'] || $_SESSION['valid']);
- }
-
- // check for valid user group
- if($this->config['user_group'] && !$_SESSION['valid']) {
- foreach($entries['memberof'] as $group) {
- list($group) = explode(',', $group);
- if(strtolower($group) == strtolower('cn='.$this->config['user_group'])) {
- $_SESSION['valid'] = true;
- break;
- }
- }
- } else {
- $_SESSION['valid'] = true;
- }
-
- if(!$_SESSION['valid'])
- throw new Exception("Permission denied");
-
- // Admin user explicitly set?
- if(!$_SESSION['admin'] && $this->config['adminUser']) {
- $_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
- }
-
- // No admin information specified makes everyone an admin
- if(!$this->config['adminUser'] && !$this->config['admin_group'])
- $_SESSION['admin'] = true;
-
- // user has permission. establish session variables
- $_SESSION['user'] = $username;
- $_SESSION['authCheckHeartbeat'] = time();
-
-
- return true;
-
- }
-
- function heartbeat($vbox)
- {
- global $_SESSION;
-
- $_SESSION['valid'] = true;
- $_SESSION['authCheckHeartbeat'] = time();
- }
-
- function changePassword($old, $new)
- {
- }
-
- function logout(&$response)
- {
- global $_SESSION;
- if(function_exists('session_destroy')) session_destroy();
- else unset($_SESSION['valid']);
- $response['data']['result'] = 1;
- }
-
- function listUsers()
- {
-
- }
-
- function updateUser($vboxRequest, $skipExistCheck)
- {
-
- }
-
- function deleteUser($user)
- {
-
- }
-}
+<?php
+/*
+ * $Id: ActiveDirectory.php 501 2013-07-11 17:44:37Z imooreyahoo@gmail.com $
+* Experimental!
+*/
+class phpvbAuthActiveDirectory implements phpvbAuth {
+
+ var $capabilities = array(
+ 'canChangePassword' => false,
+ 'canLogout' => true
+ );
+
+ var $config = array(
+ 'host' => '127.0.0.1',
+ 'admin_group' => null,
+ 'adminUser' => null,
+ 'user_group' => null,
+ 'container' => 'CN=Users',
+ 'domain' => 'internal.local',
+ 'filter' => '(&(objectclass=User)(objectCategory=Person))'
+ );
+
+ /**
+ * Constructor
+ * @param array $userConfig - user configuration for this module
+ */
+ function phpvbAuthActiveDirectory($userConfig = null) {
+ // Merge user config
+ if($userConfig) {
+ $this->config = array_merge($this->config,$userConfig);
+ }
+ }
+
+ /**
+ * Test log in and set $_SESSION vars
+ * @param string $username
+ * @param string $password
+ * @see phpvbAuth::login()
+ */
+ function login($username, $password)
+ {
+ global $_SESSION;
+
+
+ /*
+ * Check for LDAP functionality and provide some direction
+ */
+ if(!function_exists('ldap_connect')) {
+
+ $ex = 'LDAP support is not enabled in your PHP configuration.';
+
+ if(strtolower(substr(PHP_OS, 0, 3)) == 'win') {
+
+ ob_start();
+ phpinfo(INFO_GENERAL);
+ $phpinfo = ob_get_contents();
+ ob_end_clean();
+ preg_match('/Loaded Configuration File <\/td><td.*?>(.*?)\s*</', $phpinfo, $phpinfo);
+
+ $ex .= ' You probably just need to uncomment the line ;extension=php_ldap.dll in php.ini'.
+ (count($phpinfo) > 1 ? ' (' .trim($phpinfo[1]).')' : '') . ' by removing the ";" and restart your web server.';
+
+ } else if(strtolower(substr(PHP_OS, 0, 5)) == 'Linux') {
+
+ $ex .= ' You probably need to install the php5-ldap (or similar depending on your distribution) package and restart your web server.';
+
+ }
+ throw new Exception($ex);
+ }
+
+ $_SESSION['valid'] = false;
+
+ // Connect to server
+ if(!($auth = ldap_connect($this->config['host']))) {
+ throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
+ }
+
+ // Set relevant LDAP options
+ ldap_set_option($auth,LDAP_OPT_PROTOCOL_VERSION, 3);
+
+
+ // Main login /bind
+ if(!($bind = @ldap_bind($auth, $username . "@" .$this->config['domain'], $password))) {
+ if(ldap_errno($auth) == 49) return false;
+ throw new Exception('Active Directory error ('.ldap_errno($auth).') ' . ldap_error($auth));
+ }
+
+
+ // Get user information from AD
+ ////////////////////////////////////
+
+
+ // Set filter and sanitize username before sending it to AD
+ $filter = "(sAMAccountName=" .
+ str_replace(array(',','=','+','<','>',';','\\','"','#','(',')','*',chr(0)), '', $username) . ")";
+ if($this->config['filter'] && false) {
+ $filter = '(&'. $this->config['filter'] .' ('. $filter .'))';
+ }
+
+ $result = @ldap_search($auth,
+ $this->config['container'] . ',DC=' . join(',DC=', explode('.', $this->config['domain'])),
+ $filter, array("memberof","useraccountcontrol"));
+
+ if(!result) throw new Exception ("Unable to search Active Directory server: " . ldap_error($auth));
+ @list($entries) = @ldap_get_entries($auth, $result);
+ @ldap_unbind($auth);
+ if(!$entries) {
+ throw new Exception("Permission denied");
+ }
+
+
+ // Check for disabled user
+ if((intval($entries['useraccountcontrol'][0]) & 2)) {
+ throw new Exception('This account is disabled in Active Directory.');
+ }
+
+ // check for valid admin group
+ if($this->config['admin_group']) {
+ foreach($entries['memberof'] as $group) {
+ list($group) = explode(',', $group);
+ if(strtolower($group) == strtolower('cn='.$this->config['admin_group'])) {
+ $_SESSION['admin'] = $_SESSION['valid'] = true;
+ break;
+ }
+ }
+ }
+
+ // Admin user explicitly set?
+ if(!$_SESSION['admin'] && $this->config['adminUser']) {
+ $_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
+ // Admin is ok
+ $_SESSION['valid'] = ($_SESSION['admin'] || $_SESSION['valid']);
+ }
+
+ // check for valid user group
+ if($this->config['user_group'] && !$_SESSION['valid']) {
+ foreach($entries['memberof'] as $group) {
+ list($group) = explode(',', $group);
+ if(strtolower($group) == strtolower('cn='.$this->config['user_group'])) {
+ $_SESSION['valid'] = true;
+ break;
+ }
+ }
+ } else {
+ $_SESSION['valid'] = true;
+ }
+
+ if(!$_SESSION['valid'])
+ throw new Exception("Permission denied");
+
+ // Admin user explicitly set?
+ if(!$_SESSION['admin'] && $this->config['adminUser']) {
+ $_SESSION['admin'] = (strtolower($this->config['adminUser']) == strtolower($username));
+ }
+
+ // No admin information specified makes everyone an admin
+ if(!$this->config['adminUser'] && !$this->config['admin_group'])
+ $_SESSION['admin'] = true;
+
+ // user has permission. establish session variables
+ $_SESSION['user'] = $username;
+ $_SESSION['authCheckHeartbeat'] = time();
+
+
+ return true;
+
+ }
+
+ function heartbeat($vbox)
+ {
+ global $_SESSION;
+
+ $_SESSION['valid'] = true;
+ $_SESSION['authCheckHeartbeat'] = time();
+ }
+
+ function changePassword($old, $new)
+ {
+ }
+
+ function logout(&$response)
+ {
+ global $_SESSION;
+ if(function_exists('session_destroy')) session_destroy();
+ else unset($_SESSION['valid']);
+ $response['data']['result'] = 1;
+ }
+
+ function listUsers()
+ {
+
+ }
+
+ function updateUser($vboxRequest, $skipExistCheck)
+ {
+
+ }
+
+ function deleteUser($user)
+ {
+
+ }
+}
diff --git a/endpoints/lib/auth/LDAP.php b/endpoints/lib/auth/LDAP.php
index f4b4672..7e7d49e 100644
--- a/endpoints/lib/auth/LDAP.php
+++ b/endpoints/lib/auth/LDAP.php
@@ -60,10 +60,10 @@ class phpvbAuthLDAP implements phpvbAuth {
return false;
- $_SESSION['valid'] = true;
+ $_SESSION['valid'] = true;
$_SESSION['user'] = $username;
- $_SESSION['admin'] = (!$this->config['adminUser']) || ($_SESSION['user'] == $this->config['adminUser']);
- $_SESSION['authCheckHeartbeat'] = time();
+ $_SESSION['admin'] = (!$this->config['adminUser']) || ($_SESSION['user'] == $this->config['adminUser']);
+ $_SESSION['authCheckHeartbeat'] = time();
}
diff --git a/endpoints/lib/auth/OpenMediaVault.php b/endpoints/lib/auth/OpenMediaVault.php
index 71b3d02..991ca3f 100644
--- a/endpoints/lib/auth/OpenMediaVault.php
+++ b/endpoints/lib/auth/OpenMediaVault.php
@@ -1,115 +1,115 @@
-<?php
-/*
- * $Id: OpenMediaVault.php 470 2012-10-24 21:43:25Z imooreyahoo@gmail.com $
-*/
-
-/*
- * OMV Specific
-*/
-try {
-
- // Must be made global or OMV breaks
- global $xmlConfig, $OMV_DEFAULT_FILE;
-
- require_once("openmediavault/globals.inc");
- require_once("openmediavault/session.inc");
- require_once("rpc/authentication.inc");
-
-} catch(Exception $e) {
-
- header("Content-Type: text/html");
- die("Error #".$e->getCode().":<br/>". str_replace("\n", "<br/>",$e->__toString()));
-}
-
-class phpvbAuthOpenMediaVault implements phpvbAuth {
-
- static $session = null;
-
- var $capabilities = array(
- 'canChangePassword' => false,
- 'sessionStart' => 'sessionStart',
- 'canLogout' => true
- );
-
- var $config = array(
- 'allowNonAdmin' => false
- );
-
- function __construct($userConfig = null) {
- if($userConfig) $this->config = array_merge($this->config,$userConfig);
- }
-
- function login($username, $password)
- {
- # Try / catch so that we don't expose
- # usernames / passwords
- require_once("rpc/authentication.inc");
- $a = new AuthenticationRpc();
- try {
-
- $auth = $a->login(array('username'=>$username,'password'=>$password));
-
- self::$session = &OMVSession::getInstance();
-
- if(@$auth["authenticated"] &&
- (self::$session->getRole() !== OMV_ROLE_USER || $this->config['allowNonAdmin'])) {
- $_SESSION['admin'] = (self::$session->getRole() !== OMV_ROLE_USER);
- $_SESSION['user'] = $_SESSION['username'];
- $_SESSION['valid'] = ($_SESSION['admin'] || $this->config['allowNonAdmin']);
- $_SESSION['authCheckHeartbeat'] = time();
-
- }
-
- if(!@$_SESSION['valid']) {
- return false;
- }
- return true;
-
- } catch (Exception $e) {
- return false;
- }
- return false;
- }
-
- function sessionStart($keepopen) {
-
- self::$session = &OMVSession::getInstance();
- self::$session->start();
-
-
- if (self::$session->isAuthenticated() && !self::$session->isTimeout()) {
-
- self::$session->validate();
- self::$session->updateLastAccess();
-
- $_SESSION['admin'] = (self::$session->getRole() !== OMV_ROLE_USER);
- $_SESSION['user'] = $_SESSION['username'];
- $_SESSION['valid'] = (self::$session->getRole() !== OMV_ROLE_USER || $this->config['allowNonAdmin']);
-
- } else {
-
- $_SESSION['admin'] = $_SESSION['user'] = $_SESSION['valid'] = null;
-
- }
-
- if(!$keepopen)
- session_write_close();
-
- }
-
-
- function logout(&$response)
- {
- require_once("rpc/authentication.inc");
- $a = new AuthenticationRpc();
- $a->logout();
- $response['data']['result'] = 1;
- }
-
- /* Defined for compatibility with implemented interface */
- function heartbeat($vbox){}
- function changePassword($old, $new){}
- function listUsers(){}
- function updateUser($vboxRequest, $skipExistCheck){}
- function deleteUser($user){}
-}
+<?php
+/*
+ * $Id: OpenMediaVault.php 470 2012-10-24 21:43:25Z imooreyahoo@gmail.com $
+*/
+
+/*
+ * OMV Specific
+*/
+try {
+
+ // Must be made global or OMV breaks
+ global $xmlConfig, $OMV_DEFAULT_FILE;
+
+ require_once("openmediavault/globals.inc");
+ require_once("openmediavault/session.inc");
+ require_once("rpc/authentication.inc");
+
+} catch(Exception $e) {
+
+ header("Content-Type: text/html");
+ die("Error #".$e->getCode().":<br/>". str_replace("\n", "<br/>",$e->__toString()));
+}
+
+class phpvbAuthOpenMediaVault implements phpvbAuth {
+
+ static $session = null;
+
+ var $capabilities = array(
+ 'canChangePassword' => false,
+ 'sessionStart' => 'sessionStart',
+ 'canLogout' => true
+ );
+
+ var $config = array(
+ 'allowNonAdmin' => false
+ );
+
+ function __construct($userConfig = null) {
+ if($userConfig) $this->config = array_merge($this->config,$userConfig);
+ }
+
+ function login($username, $password)
+ {
+ # Try / catch so that we don't expose
+ # usernames / passwords
+ require_once("rpc/authentication.inc");
+ $a = new AuthenticationRpc();
+ try {
+
+ $auth = $a->login(array('username'=>$username,'password'=>$password));
+
+ self::$session = &OMVSession::getInstance();
+
+ if(@$auth["authenticated"] &&
+ (self::$session->getRole() !== OMV_ROLE_USER || $this->config['allowNonAdmin'])) {
+ $_SESSION['admin'] = (self::$session->getRole() !== OMV_ROLE_USER);
+ $_SESSION['user'] = $_SESSION['username'];
+ $_SESSION['valid'] = ($_SESSION['admin'] || $this->config['allowNonAdmin']);
+ $_SESSION['authCheckHeartbeat'] = time();
+
+ }
+
+ if(!@$_SESSION['valid']) {
+ return false;
+ }
+ return true;
+
+ } catch (Exception $e) {
+ return false;
+ }
+ return false;
+ }
+
+ function sessionStart($keepopen) {
+
+ self::$session = &OMVSession::getInstance();
+ self::$session->start();
+
+
+ if (self::$session->isAuthenticated() && !self::$session->isTimeout()) {
+
+ self::$session->validate();
+ self::$session->updateLastAccess();
+
+ $_SESSION['admin'] = (self::$session->getRole() !== OMV_ROLE_USER);
+ $_SESSION['user'] = $_SESSION['username'];
+ $_SESSION['valid'] = (self::$session->getRole() !== OMV_ROLE_USER || $this->config['allowNonAdmin']);
+
+ } else {
+
+ $_SESSION['admin'] = $_SESSION['user'] = $_SESSION['valid'] = null;
+
+ }
+
+ if(!$keepopen)
+ session_write_close();
+
+ }
+
+
+ function logout(&$response)
+ {
+ require_once("rpc/authentication.inc");
+ $a = new AuthenticationRpc();
+ $a->logout();
+ $response['data']['result'] = 1;
+ }
+
+ /* Defined for compatibility with implemented interface */
+ function heartbeat($vbox){}
+ function changePassword($old, $new){}
+ function listUsers(){}
+ function updateUser($vboxRequest, $skipExistCheck){}
+ function deleteUser($user){}
+}
diff --git a/endpoints/lib/authinterface.php b/endpoints/lib/authinterface.php
index 2905a0e..2b42f9a 100644
--- a/endpoints/lib/authinterface.php
+++ b/endpoints/lib/authinterface.php
@@ -1,107 +1,107 @@
-<?php
-/**
- * Interface for phpVirtualBox authentication modules
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: authinterface.php 595 2015-04-17 09:50:36Z imoore76 $
- * @package phpVirtualBox
- *
- * A class wishing to implement this interface must also contain
- * a list of capabilities describing its capabilities in a public
- * object member array called capabilities.
- *
- * boolean canChangePassword - Users can change passwords
- * boolean canModifyUsers - Users can be modified
- * boolean canLogout - Users can log out
- *
- * E.g.
- * var $capabilities = array(
- * 'canChangePassword' => true,
- * 'canModifyUsers' => true,
- * 'canLogout' => true
- * );
- *
- * The implementing class may also define a public autoLoginHook
- * method that auto-populates $_SESSION. This would automatically
- * log the user in, bypassing the login() function.
- *
- * E.g.
- *
- * function autoLoginHook()
- * {
- * global $_SESSION;
- *
- * // HTTP Authentication passthrough
- * if ( isset($_SERVER['HTTP_X_WEBAUTH_USER']) )
- * {
- * $_SESSION['valid'] = true;
- * $_SESSION['user'] = $_SERVER['HTTP_X_WEBAUTH_USER']];
- * $_SESSION['admin'] = ($_SESSION['user'] === 'bob');
- * $_SESSION['authCheckHeartbeat'] = time();
- * }
- * }
- *
- * Implementing classes should be prefixed with phpvbAuth. E.g.
- * phpvbAuthMySiteAuth. authLib in config.php would then be set
- * to 'MySiteAuth'
- */
-interface phpvbAuth {
-
- /**
- *
- * Log in function. Populates $_SESSION
- * @param string $username user name
- * @param string $password password
- */
- function login($username, $password);
-
- /**
- *
- * Change password function.
- * @param string $old old password
- * @param string $new new password
- * @return boolean true on success
- */
- function changePassword($old, $new);
-
- /**
- *
- * Revalidate login info and set authCheckHeartbeat session variable.
- * @param vboxconnector $vbox vboxconnector object instance
- */
- function heartbeat($vbox);
-
- /**
- *
- * Log out user present in $_SESSION
- * @param array $response response passed byref by API and populated within function
- */
- function logout(&$response);
-
- /**
- *
- * Return a list of users
- * @return array list of users
- */
- function listUsers();
-
- /**
- *
- * Update user information such as password and admin status
- * @param array $vboxRequest request passed from API representing the ajax request. Contains user, password and administration level.
- * @param boolean $skipExistCheck Do not check that the user exists first. Essentially, if this is set and the user does not exist, it is added.
- */
- function updateUser($vboxRequest, $skipExistCheck);
-
-
- /**
- *
- * Remove the user $user
- * @param string $user Username to remove
- */
- function deleteUser($user);
-
-
-
+<?php
+/**
+ * Interface for phpVirtualBox authentication modules
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: authinterface.php 595 2015-04-17 09:50:36Z imoore76 $
+ * @package phpVirtualBox
+ *
+ * A class wishing to implement this interface must also contain
+ * a list of capabilities describing its capabilities in a public
+ * object member array called capabilities.
+ *
+ * boolean canChangePassword - Users can change passwords
+ * boolean canModifyUsers - Users can be modified
+ * boolean canLogout - Users can log out
+ *
+ * E.g.
+ * var $capabilities = array(
+ * 'canChangePassword' => true,
+ * 'canModifyUsers' => true,
+ * 'canLogout' => true
+ * );
+ *
+ * The implementing class may also define a public autoLoginHook
+ * method that auto-populates $_SESSION. This would automatically
+ * log the user in, bypassing the login() function.
+ *
+ * E.g.
+ *
+ * function autoLoginHook()
+ * {
+ * global $_SESSION;
+ *
+ * // HTTP Authentication passthrough
+ * if ( isset($_SERVER['HTTP_X_WEBAUTH_USER']) )
+ * {
+ * $_SESSION['valid'] = true;
+ * $_SESSION['user'] = $_SERVER['HTTP_X_WEBAUTH_USER']];
+ * $_SESSION['admin'] = ($_SESSION['user'] === 'bob');
+ * $_SESSION['authCheckHeartbeat'] = time();
+ * }
+ * }
+ *
+ * Implementing classes should be prefixed with phpvbAuth. E.g.
+ * phpvbAuthMySiteAuth. authLib in config.php would then be set
+ * to 'MySiteAuth'
+ */
+interface phpvbAuth {
+
+ /**
+ *
+ * Log in function. Populates $_SESSION
+ * @param string $username user name
+ * @param string $password password
+ */
+ function login($username, $password);
+
+ /**
+ *
+ * Change password function.
+ * @param string $old old password
+ * @param string $new new password
+ * @return boolean true on success
+ */
+ function changePassword($old, $new);
+
+ /**
+ *
+ * Revalidate login info and set authCheckHeartbeat session variable.
+ * @param vboxconnector $vbox vboxconnector object instance
+ */
+ function heartbeat($vbox);
+
+ /**
+ *
+ * Log out user present in $_SESSION
+ * @param array $response response passed byref by API and populated within function
+ */
+ function logout(&$response);
+
+ /**
+ *
+ * Return a list of users
+ * @return array list of users
+ */
+ function listUsers();
+
+ /**
+ *
+ * Update user information such as password and admin status
+ * @param array $vboxRequest request passed from API representing the ajax request. Contains user, password and administration level.
+ * @param boolean $skipExistCheck Do not check that the user exists first. Essentially, if this is set and the user does not exist, it is added.
+ */
+ function updateUser($vboxRequest, $skipExistCheck);
+
+
+ /**
+ *
+ * Remove the user $user
+ * @param string $user Username to remove
+ */
+ function deleteUser($user);
+
+
+
} \ No newline at end of file
diff --git a/endpoints/lib/config.php b/endpoints/lib/config.php
index 287bc89..5176416 100644
--- a/endpoints/lib/config.php
+++ b/endpoints/lib/config.php
@@ -1,269 +1,269 @@
-<?php
-/**
- * phpVirtualBox configuration class. Parses user configuration, applies
- * defaults, and sanitizes user values.
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: config.php 595 2015-04-17 09:50:36Z imoore76 $
- * @package phpVirtualBox
- * @see config.php-example
- *
-*/
-
-/*
- * This version of phpVirtualBox
- */
-define('PHPVBOX_VER', '5.2-0');
-
-class phpVBoxConfigClass {
-
- /* DEFAULTS */
-
- /**
- * Default language
- * @var string
- */
- var $language = 'en';
-
- /**
- * Exclusively use phpVirtualBox groups rather than
- * VirtualBox groups
- */
- var $phpVboxGroups = false;
-
- /**
- * Preview screen width
- * @var integer
- */
- var $previewWidth = 180;
-
- /**
- * Aspect ratio of preview screen
- * @var float
- */
- var $previewAspectRatio = 1.6;
-
- /**
- * Allow users to delete media when it is removed
- * @var boolean
- */
- var $deleteOnRemove = true;
-
- /**
- * Restrict file / folder browsers to files ending in extensions found in this array
- * @var array
- */
- var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
-
- /**
- * Force file / folder browser to use local PHP functions rather than VirtualBox's IVFSExplorer.
- * If this is set to true, the assumption is made that the web server is on the same host as VirtualBox.
- * @var boolean
- */
- var $browserLocal = false;
-
- /**
- * List of console resolutions available on console tab
- * @var array
- */
- var $consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900');
-
- /**
- * Maximum number of NICs displayed per VM
- * @var integer
- */
- var $nicMax = 4;
-
- /**
- * Max number of operations to keep in progress list
- * @var integer
- */
- var $maxProgressList = 5;
-
- /**
- * Enable custom icon per VM
- * @var boolean
- */
- var $enableCustomIcons = false;
-
- /**
- * true if there is no user supplied config.php found.
- * @var boolean
- */
- var $warnDefault = false;
-
- /**
- * Set the standard VRDE port number range to be used when
- * creating new VMs
- * @var string
- */
- var $vrdeports = '9000-9100';
-
- /**
- * Key used to uniquely identify the current server in this
- * instantiation of phpVBoxConfigClass.
- * Set in __construct()
- * @var string
- */
- var $key = null;
-
- /**
- * Auth library object instance. See lib/auth for classes.
- * Set in __construct() based on authLib config setting value.
- * @var phpvbAuth
- */
- var $auth = null;
-
- /**
- * Enable VirtualBox start / stop configuration.
- * Only available in Linux (I beleive)
- * @var boolean
- */
- var $vboxAutostartConfig = false;
-
- /**
- * Authentication capabilities provided by authentication module.
- * Set in __construct
- * @var phpvbAuthBuiltin::authCapabilities
- */
- var $authCapabilities = null;
-
- /**
- * Configuration passed to authentication module
- * @var array
- */
- var $authConfig = array();
-
- /**
- * Event listener timeout in seconds.
- * @var integer
- */
- var $eventListenerTimeout = 20;
-
- /**
- * Read user configuration, apply defaults, and do some sanity checking
- * @see vboxconnector
- */
- function __construct() {
-
- @include_once(dirname(dirname(dirname(__FILE__))).'/config.php');
-
- $ep = error_reporting(0);
-
- /* Apply object vars of configuration class to this class */
- if(class_exists('phpVBoxConfig')) {
- $c = new phpVBoxConfig();
- foreach(get_object_vars($c) as $k => $v) {
- // Safety checks
- if($k == 'browserRestrictFiles' && !is_array($v)) continue;
- if($k == 'consoleResolutions' && !is_array($v)) continue;
- if($k == 'browserRestrictFolders' && !is_array($v)) continue;
- $this->$k = $v;
- }
-
- /* User config.php does not exist. Send warning */
- } else {
- $this->warnDefault = true;
- }
-
- // Ignore any server settings if we have servers
- // in the servers array
- if(isset($this->servers) && is_array($this->servers) && count($this->servers) && is_array($this->servers[0])) {
- unset($this->location);
- unset($this->user);
- unset($this->pass);
- }
- // Set to selected server based on browser cookie
- if(isset($_COOKIE['vboxServer']) && isset($this->servers) && is_array($this->servers) && count($this->servers)) {
- foreach($this->servers as $s) {
- if($s['name'] == $_COOKIE['vboxServer']) {
- foreach($s as $k=>$v) $this->$k = $v;
- break;
- }
- }
- // If servers is not an array, set to empty array
- } elseif(!isset($this->servers) || !is_array($this->servers)) {
- $this->servers = array();
- }
- // We still have no server set, use the first one from
- // the servers array
- if(empty($this->location) && count($this->servers)) {
- foreach($this->servers[0] as $k=>$v) $this->$k = $v;
- }
- // Make sure name is set
- if(!isset($this->name) || !$this->name) {
- $this->name = parse_url($this->location);
- $this->name = $this->name['host'];
- }
-
- // Key used to uniquely identify this server in this
- // phpvirtualbox installation
- $this->setKey();
-
- // legacy rdpHost setting
- if(!empty($this->rdpHost) && empty($this->consoleHost))
- $this->consoleHost = $this->rdpHost;
-
- // Ensure authlib is set
- if(empty($this->authLib)) $this->authLib = 'Builtin';
- // include interface
- include_once(dirname(__FILE__).'/authinterface.php');
- include_once(dirname(__FILE__).'/auth/'.str_replace(array('.','/','\\'),'',$this->authLib).'.php');
-
- // Check for session functionality
- if(!function_exists('session_start')) $this->noAuth = true;
-
- $alib = "phpvbAuth{$this->authLib}";
- $this->auth = new $alib(@$this->authConfig);
- $this->authCapabilities = $this->auth->capabilities;
-
- /* Sanity checks */
- if(!@$this->nicMax)
- $this->nicMax = 4;
-
- $this->previewUpdateInterval = max(3, @$this->previewUpdateInterval);
-
- error_reporting($ep);
- }
-
- /**
- * Set VirtualBox server to use
- * @param string $server server from config.php $servers array
- */
- function setServer($server) {
- // do nothing if we are already using this server
- if($server == $this->name) return;
- foreach($this->servers as $s) {
- if($s['name'] == $server) {
- foreach($s as $k=>$v) $this->$k = $v;
- $this->setKey();
- break;
- }
- }
- }
-
- /**
- * Generate a key for current server settings and populate $this->key
- */
- function setKey() {
- $this->key = md5($this->location);
- }
-
- /**
- * Return the name of the server marked as the authentication master
- * @return string name of server marked as authMaster
- */
- function getServerAuthMaster() {
- foreach($this->servers as $s) {
- if($s['authMaster']) {
- return $s['name'];
- }
- }
- return @$this->servers[0]['name'];
- }
-
-}
-
-
-
+<?php
+/**
+ * phpVirtualBox configuration class. Parses user configuration, applies
+ * defaults, and sanitizes user values.
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: config.php 595 2015-04-17 09:50:36Z imoore76 $
+ * @package phpVirtualBox
+ * @see config.php-example
+ *
+*/
+
+/*
+ * This version of phpVirtualBox
+ */
+define('PHPVBOX_VER', '5.2-0');
+
+class phpVBoxConfigClass {
+
+ /* DEFAULTS */
+
+ /**
+ * Default language
+ * @var string
+ */
+ var $language = 'en';
+
+ /**
+ * Exclusively use phpVirtualBox groups rather than
+ * VirtualBox groups
+ */
+ var $phpVboxGroups = false;
+
+ /**
+ * Preview screen width
+ * @var integer
+ */
+ var $previewWidth = 180;
+
+ /**
+ * Aspect ratio of preview screen
+ * @var float
+ */
+ var $previewAspectRatio = 1.6;
+
+ /**
+ * Allow users to delete media when it is removed
+ * @var boolean
+ */
+ var $deleteOnRemove = true;
+
+ /**
+ * Restrict file / folder browsers to files ending in extensions found in this array
+ * @var array
+ */
+ var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
+
+ /**
+ * Force file / folder browser to use local PHP functions rather than VirtualBox's IVFSExplorer.
+ * If this is set to true, the assumption is made that the web server is on the same host as VirtualBox.
+ * @var boolean
+ */
+ var $browserLocal = false;
+
+ /**
+ * List of console resolutions available on console tab
+ * @var array
+ */
+ var $consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900');
+
+ /**
+ * Maximum number of NICs displayed per VM
+ * @var integer
+ */
+ var $nicMax = 4;
+
+ /**
+ * Max number of operations to keep in progress list
+ * @var integer
+ */
+ var $maxProgressList = 5;
+
+ /**
+ * Enable custom icon per VM
+ * @var boolean
+ */
+ var $enableCustomIcons = false;
+
+ /**
+ * true if there is no user supplied config.php found.
+ * @var boolean
+ */
+ var $warnDefault = false;
+
+ /**
+ * Set the standard VRDE port number range to be used when
+ * creating new VMs
+ * @var string
+ */
+ var $vrdeports = '9000-9100';
+
+ /**
+ * Key used to uniquely identify the current server in this
+ * instantiation of phpVBoxConfigClass.
+ * Set in __construct()
+ * @var string
+ */
+ var $key = null;
+
+ /**
+ * Auth library object instance. See lib/auth for classes.
+ * Set in __construct() based on authLib config setting value.
+ * @var phpvbAuth
+ */
+ var $auth = null;
+
+ /**
+ * Enable VirtualBox start / stop configuration.
+ * Only available in Linux (I beleive)
+ * @var boolean
+ */
+ var $vboxAutostartConfig = false;
+
+ /**
+ * Authentication capabilities provided by authentication module.
+ * Set in __construct
+ * @var phpvbAuthBuiltin::authCapabilities
+ */
+ var $authCapabilities = null;
+
+ /**
+ * Configuration passed to authentication module
+ * @var array
+ */
+ var $authConfig = array();
+
+ /**
+ * Event listener timeout in seconds.
+ * @var integer
+ */
+ var $eventListenerTimeout = 20;
+
+ /**
+ * Read user configuration, apply defaults, and do some sanity checking
+ * @see vboxconnector
+ */
+ function __construct() {
+
+ @include_once(dirname(dirname(dirname(__FILE__))).'/config.php');
+
+ $ep = error_reporting(0);
+
+ /* Apply object vars of configuration class to this class */
+ if(class_exists('phpVBoxConfig')) {
+ $c = new phpVBoxConfig();
+ foreach(get_object_vars($c) as $k => $v) {
+ // Safety checks
+ if($k == 'browserRestrictFiles' && !is_array($v)) continue;
+ if($k == 'consoleResolutions' && !is_array($v)) continue;
+ if($k == 'browserRestrictFolders' && !is_array($v)) continue;
+ $this->$k = $v;
+ }
+
+ /* User config.php does not exist. Send warning */
+ } else {
+ $this->warnDefault = true;
+ }
+
+ // Ignore any server settings if we have servers
+ // in the servers array
+ if(isset($this->servers) && is_array($this->servers) && count($this->servers) && is_array($this->servers[0])) {
+ unset($this->location);
+ unset($this->user);
+ unset($this->pass);
+ }
+ // Set to selected server based on browser cookie
+ if(isset($_COOKIE['vboxServer']) && isset($this->servers) && is_array($this->servers) && count($this->servers)) {
+ foreach($this->servers as $s) {
+ if($s['name'] == $_COOKIE['vboxServer']) {
+ foreach($s as $k=>$v) $this->$k = $v;
+ break;
+ }
+ }
+ // If servers is not an array, set to empty array
+ } elseif(!isset($this->servers) || !is_array($this->servers)) {
+ $this->servers = array();
+ }
+ // We still have no server set, use the first one from
+ // the servers array
+ if(empty($this->location) && count($this->servers)) {
+ foreach($this->servers[0] as $k=>$v) $this->$k = $v;
+ }
+ // Make sure name is set
+ if(!isset($this->name) || !$this->name) {
+ $this->name = parse_url($this->location);
+ $this->name = $this->name['host'];
+ }
+
+ // Key used to uniquely identify this server in this
+ // phpvirtualbox installation
+ $this->setKey();
+
+ // legacy rdpHost setting
+ if(!empty($this->rdpHost) && empty($this->consoleHost))
+ $this->consoleHost = $this->rdpHost;
+
+ // Ensure authlib is set
+ if(empty($this->authLib)) $this->authLib = 'Builtin';
+ // include interface
+ include_once(dirname(__FILE__).'/authinterface.php');
+ include_once(dirname(__FILE__).'/auth/'.str_replace(array('.','/','\\'),'',$this->authLib).'.php');
+
+ // Check for session functionality
+ if(!function_exists('session_start')) $this->noAuth = true;
+
+ $alib = "phpvbAuth{$this->authLib}";
+ $this->auth = new $alib(@$this->authConfig);
+ $this->authCapabilities = $this->auth->capabilities;
+
+ /* Sanity checks */
+ if(!@$this->nicMax)
+ $this->nicMax = 4;
+
+ $this->previewUpdateInterval = max(3, @$this->previewUpdateInterval);
+
+ error_reporting($ep);
+ }
+
+ /**
+ * Set VirtualBox server to use
+ * @param string $server server from config.php $servers array
+ */
+ function setServer($server) {
+ // do nothing if we are already using this server
+ if($server == $this->name) return;
+ foreach($this->servers as $s) {
+ if($s['name'] == $server) {
+ foreach($s as $k=>$v) $this->$k = $v;
+ $this->setKey();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Generate a key for current server settings and populate $this->key
+ */
+ function setKey() {
+ $this->key = md5($this->location);
+ }
+
+ /**
+ * Return the name of the server marked as the authentication master
+ * @return string name of server marked as authMaster
+ */
+ function getServerAuthMaster() {
+ foreach($this->servers as $s) {
+ if($s['authMaster']) {
+ return $s['name'];
+ }
+ }
+ return @$this->servers[0]['name'];
+ }
+
+}
+
+
+
diff --git a/endpoints/lib/language.php b/endpoints/lib/language.php
index da8241b..7bb46ee 100644
--- a/endpoints/lib/language.php
+++ b/endpoints/lib/language.php
@@ -1,151 +1,151 @@
-<?php
-/**
- * __vbox_language class and trans() function
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: language.php 591 2015-04-11 22:40:47Z imoore76 $
- * @see languages/languages.txt
- * @package phpVirtualBox
- *
- */
-
-global $_vbox_language;
-
-// Settings contains language
-require_once(dirname(__FILE__).'/config.php');
-require_once(dirname(__FILE__).'/utils.php');
-
-define('VBOX_BASE_LANG_DIR', dirname(dirname(dirname(__FILE__))) .'/languages');
-
-/**
- * Language class. Parses language file and stores translations in an array.
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: language.php 591 2015-04-11 22:40:47Z imoore76 $
- * @package phpVirtualBox
- *
- * @global __vbox_language $GLOBALS['_vbox_language'] global __vbox_language instance
- * @name $_vbox_language
-*/
-class __vbox_language {
-
- /**
- * Static language data used for translations
- * @var array
- */
- static $langdata = null;
-
- /**
- *
- * Constructor parses language file and stores translations.
- */
- function __construct() {
-
- # Already initialized?
- if(is_array(self::$langdata)) return;
-
- self::$langdata = array();
-
- $settings = new phpVBoxConfigClass();
- $lang = strtolower($settings->language);
-
- if(@$_COOKIE['vboxLanguage']) {
- $lang = str_replace(array('/','\\','.'),'',$_COOKIE['vboxLanguage']);
- }
-
- // File as specified
- if($lang && file_exists(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat')) {
- @define('VBOXLANG', $lang);
-
- // No lang file found
- } else {
- $lang = 'en';
- @define('VBOXLANG', $lang);
- self::$langdata['contexts'] = array();
- return;
- }
-
-
- 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'));
- $arrXml = $this->objectsIntoArray($xmlObj);
-
- $lang = array();
- if(!@$arrXml['context'][0]) $arrXml['context'] = array($arrXml['context']);
- foreach($arrXml['context'] as $c) {
-
- if(!is_array($c) || !@$c['name']) continue;
- if(!@$c['message'][0]) $c['message'] = array($c['message']);
-
- $lang['contexts'][$c['name']] = array();
- $lang['contexts'][$c['name']]['messages'] = array();
-
- foreach($c['message'] as $m) {
-
- if(!is_array($m)) continue;
-
- $s = $m['source'];
- unset($m['source']);
- $lang['contexts'][$c['name']]['messages'][$s] = $m;
- }
- }
- self::$langdata = array_merge_recursive(self::$langdata, $lang);
- }
-
- /**
- * Translate text.
- * @param string $item message to translate
- * @param string $context context in which the translation should be performed
- */
- function trans($item,$context='phpVirtualBox') {
- $t = @self::$langdata['contexts'][$context]['messages'][$item]['translation'];
- return ($t ? $t : $item);
- }
-
- /**
- *
- * Converts objects into array. Called from class constructor.
- * @param array|object $arrObjData object or array to convert to array
- * @param array $arrSkipIndices array of indices to skip
- * @return array
- */
- function objectsIntoArray($arrObjData, $arrSkipIndices = array())
- {
- $arrData = array();
-
- // if input is object, convert into array
- if (is_object($arrObjData)) {
- $arrObjData = get_object_vars($arrObjData);
- }
-
- if (is_array($arrObjData)) {
- foreach ($arrObjData as $index => $value) {
- if (is_object($value) || is_array($value)) {
- $value = $this->objectsIntoArray($value, $arrSkipIndices); // recursive call
- }
- if (in_array($index, $arrSkipIndices)) {
- continue;
- }
- $arrData[$index] = $value;
- }
- }
- return $arrData;
- }
-
-}
-
-/**
- * Translate text. If $GLOBALS['_vbox_language'] is not set, create a new
- * instance and pass params to its trans() method
- * @param string $msg message to translate
- * @param string $context context in which the translation should be performed
- * @uses $_vbox_language
- * @return string
- */
-function trans($msg,$context='phpVirtualBox') {
- if(!is_object($GLOBALS['_vbox_language'])) $GLOBALS['_vbox_language'] = new __vbox_language();
- return $GLOBALS['_vbox_language']->trans($msg,$context);
-}
+<?php
+/**
+ * __vbox_language class and trans() function
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: language.php 591 2015-04-11 22:40:47Z imoore76 $
+ * @see languages/languages.txt
+ * @package phpVirtualBox
+ *
+ */
+
+global $_vbox_language;
+
+// Settings contains language
+require_once(dirname(__FILE__).'/config.php');
+require_once(dirname(__FILE__).'/utils.php');
+
+define('VBOX_BASE_LANG_DIR', dirname(dirname(dirname(__FILE__))) .'/languages');
+
+/**
+ * Language class. Parses language file and stores translations in an array.
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: language.php 591 2015-04-11 22:40:47Z imoore76 $
+ * @package phpVirtualBox
+ *
+ * @global __vbox_language $GLOBALS['_vbox_language'] global __vbox_language instance
+ * @name $_vbox_language
+*/
+class __vbox_language {
+
+ /**
+ * Static language data used for translations
+ * @var array
+ */
+ static $langdata = null;
+
+ /**
+ *
+ * Constructor parses language file and stores translations.
+ */
+ function __construct() {
+
+ # Already initialized?
+ if(is_array(self::$langdata)) return;
+
+ self::$langdata = array();
+
+ $settings = new phpVBoxConfigClass();
+ $lang = strtolower($settings->language);
+
+ if(@$_COOKIE['vboxLanguage']) {
+ $lang = str_replace(array('/','\\','.'),'',$_COOKIE['vboxLanguage']);
+ }
+
+ // File as specified
+ if($lang && file_exists(VBOX_BASE_LANG_DIR.'/source/'.$lang.'.dat')) {
+ @define('VBOXLANG', $lang);
+
+ // No lang file found
+ } else {
+ $lang = 'en';
+ @define('VBOXLANG', $lang);
+ self::$langdata['contexts'] = array();
+ return;
+ }
+
+
+ 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'));
+ $arrXml = $this->objectsIntoArray($xmlObj);
+
+ $lang = array();
+ if(!@$arrXml['context'][0]) $arrXml['context'] = array($arrXml['context']);
+ foreach($arrXml['context'] as $c) {
+
+ if(!is_array($c) || !@$c['name']) continue;
+ if(!@$c['message'][0]) $c['message'] = array($c['message']);
+
+ $lang['contexts'][$c['name']] = array();
+ $lang['contexts'][$c['name']]['messages'] = array();
+
+ foreach($c['message'] as $m) {
+
+ if(!is_array($m)) continue;
+
+ $s = $m['source'];
+ unset($m['source']);
+ $lang['contexts'][$c['name']]['messages'][$s] = $m;
+ }
+ }
+ self::$langdata = array_merge_recursive(self::$langdata, $lang);
+ }
+
+ /**
+ * Translate text.
+ * @param string $item message to translate
+ * @param string $context context in which the translation should be performed
+ */
+ function trans($item,$context='phpVirtualBox') {
+ $t = @self::$langdata['contexts'][$context]['messages'][$item]['translation'];
+ return ($t ? $t : $item);
+ }
+
+ /**
+ *
+ * Converts objects into array. Called from class constructor.
+ * @param array|object $arrObjData object or array to convert to array
+ * @param array $arrSkipIndices array of indices to skip
+ * @return array
+ */
+ function objectsIntoArray($arrObjData, $arrSkipIndices = array())
+ {
+ $arrData = array();
+
+ // if input is object, convert into array
+ if (is_object($arrObjData)) {
+ $arrObjData = get_object_vars($arrObjData);
+ }
+
+ if (is_array($arrObjData)) {
+ foreach ($arrObjData as $index => $value) {
+ if (is_object($value) || is_array($value)) {
+ $value = $this->objectsIntoArray($value, $arrSkipIndices); // recursive call
+ }
+ if (in_array($index, $arrSkipIndices)) {
+ continue;
+ }
+ $arrData[$index] = $value;
+ }
+ }
+ return $arrData;
+ }
+
+}
+
+/**
+ * Translate text. If $GLOBALS['_vbox_language'] is not set, create a new
+ * instance and pass params to its trans() method
+ * @param string $msg message to translate
+ * @param string $context context in which the translation should be performed
+ * @uses $_vbox_language
+ * @return string
+ */
+function trans($msg,$context='phpVirtualBox') {
+ if(!is_object($GLOBALS['_vbox_language'])) $GLOBALS['_vbox_language'] = new __vbox_language();
+ return $GLOBALS['_vbox_language']->trans($msg,$context);
+}
diff --git a/endpoints/lib/utils.php b/endpoints/lib/utils.php
index 703bdb8..356971a 100644
--- a/endpoints/lib/utils.php
+++ b/endpoints/lib/utils.php
@@ -1,95 +1,95 @@
-<?php
-/**
- * Common PHP utilities.
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: utils.php 592 2015-04-12 19:53:44Z imoore76 $
- * @see phpVBoxConfigClass
- * @package phpVirtualBox
- *
-*/
-
-require_once(dirname(__FILE__).'/config.php');
-
-/**
- * Initialize session.
- * @param boolean $keepopen keep session open? The default is
- * to close the session after $_SESSION has been populated.
- * @uses $_SESSION
- */
-function session_init($keepopen = false) {
-
- $settings = new phpVBoxConfigClass();
-
- // Sessions provided by auth module?
- if(@$settings->auth->capabilities['sessionStart']) {
- call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
- return;
- }
-
- // No session support? No login...
- if(@$settings->noAuth || !function_exists('session_start')) {
- global $_SESSION;
- $_SESSION['valid'] = true;
- $_SESSION['authCheckHeartbeat'] = time();
- $_SESSION['admin'] = true;
- return;
- }
-
- // Session not is auto-started by PHP
- if(!ini_get('session.auto_start')) {
-
- ini_set('session.use_trans_sid', 0);
- ini_set('session.use_only_cookies', 1);
-
- // Session path
- if(isset($settings->sessionSavePath)) {
- session_save_path($settings->sessionSavePath);
- }
-
- if(isset($settings->session_name)) {
- $session_name = $settings->session_name;
- } else {
- $session_name = md5($_SERVER['DOCUMENT_ROOT'].$_SERVER['HTTP_USER_AGENT'].dirname(__FILE__));
- }
- session_name($session_name);
- session_start();
- }
-
- if(!$keepopen)
- session_write_close();
-
-}
-
-
-/**
- * Clean (strip slashes from if applicable) $_GET and $_POST and return
- * an array containing a merged array of both.
- * @return array
- */
-function clean_request() {
-
- if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
- $json = json_decode(file_get_contents('php://input'), true);
- if(!is_array($json))
- $json = array();
- } else {
- $json = array();
- }
- $req = array_merge_recursive($_GET, $_POST);
- return array_merge_recursive($req, $json);
-
-}
-
-if(!function_exists('hash')) {
-// Lower security, but better than nothing
-/**
- * Return a hash of the passed string. Mimmics PHP's hash() params
- * @param unused $type
- * @param string $str string to hash
- */
-function hash($type,$str='') {
- return sha1(json_encode($str));
-}
+<?php
+/**
+ * Common PHP utilities.
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: utils.php 592 2015-04-12 19:53:44Z imoore76 $
+ * @see phpVBoxConfigClass
+ * @package phpVirtualBox
+ *
+*/
+
+require_once(dirname(__FILE__).'/config.php');
+
+/**
+ * Initialize session.
+ * @param boolean $keepopen keep session open? The default is
+ * to close the session after $_SESSION has been populated.
+ * @uses $_SESSION
+ */
+function session_init($keepopen = false) {
+
+ $settings = new phpVBoxConfigClass();
+
+ // Sessions provided by auth module?
+ if(@$settings->auth->capabilities['sessionStart']) {
+ call_user_func(array($settings->auth, $settings->auth->capabilities['sessionStart']), $keepopen);
+ return;
+ }
+
+ // No session support? No login...
+ if(@$settings->noAuth || !function_exists('session_start')) {
+ global $_SESSION;
+ $_SESSION['valid'] = true;
+ $_SESSION['authCheckHeartbeat'] = time();
+ $_SESSION['admin'] = true;
+ return;
+ }
+
+ // Session not is auto-started by PHP
+ if(!ini_get('session.auto_start')) {
+
+ ini_set('session.use_trans_sid', 0);
+ ini_set('session.use_only_cookies', 1);
+
+ // Session path
+ if(isset($settings->sessionSavePath)) {
+ session_save_path($settings->sessionSavePath);
+ }
+
+ if(isset($settings->session_name)) {
+ $session_name = $settings->session_name;
+ } else {
+ $session_name = md5($_SERVER['DOCUMENT_ROOT'].$_SERVER['HTTP_USER_AGENT'].dirname(__FILE__));
+ }
+ session_name($session_name);
+ session_start();
+ }
+
+ if(!$keepopen)
+ session_write_close();
+
+}
+
+
+/**
+ * Clean (strip slashes from if applicable) $_GET and $_POST and return
+ * an array containing a merged array of both.
+ * @return array
+ */
+function clean_request() {
+
+ if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
+ $json = json_decode(file_get_contents('php://input'), true);
+ if(!is_array($json))
+ $json = array();
+ } else {
+ $json = array();
+ }
+ $req = array_merge_recursive($_GET, $_POST);
+ return array_merge_recursive($req, $json);
+
+}
+
+if(!function_exists('hash')) {
+// Lower security, but better than nothing
+/**
+ * Return a hash of the passed string. Mimmics PHP's hash() params
+ * @param unused $type
+ * @param string $str string to hash
+ */
+function hash($type,$str='') {
+ return sha1(json_encode($str));
+}
} \ No newline at end of file
diff --git a/endpoints/rdp.php b/endpoints/rdp.php
index 991ec8f..4da62fe 100644
--- a/endpoints/rdp.php
+++ b/endpoints/rdp.php
@@ -1,32 +1,32 @@
-<?php
-/**
- * Simple RDP connection file generator
- *
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: rdp.php 591 2015-04-11 22:40:47Z imoore76 $
- * @package phpVirtualBox
- *
- */
-
-# Turn off PHP notices
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
-
-require_once(dirname(__FILE__).'/lib/utils.php');
-$_GET = clean_request();
-
-foreach(array('port','host','vm') as $g) {
- @$_GET[$g] = str_replace(array("\n","\r","\0"),'',@$_GET[$g]);
-}
-
-
-header("Content-type: application/x-rdp",true);
-header("Content-disposition: attachment; filename=\"". str_replace(array('"','.'),'_',$_GET['vm']) .".rdp\"",true);
-
-
-echo('
-full address:s:'.@$_GET['host'].(@$_GET['port'] ? ':'.@$_GET['port'] : '').'
-compression:i:1
-displayconnectionbar:i:1
-protocol:i:4
-');
+<?php
+/**
+ * Simple RDP connection file generator
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: rdp.php 591 2015-04-11 22:40:47Z imoore76 $
+ * @package phpVirtualBox
+ *
+ */
+
+# Turn off PHP notices
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
+
+require_once(dirname(__FILE__).'/lib/utils.php');
+$_GET = clean_request();
+
+foreach(array('port','host','vm') as $g) {
+ @$_GET[$g] = str_replace(array("\n","\r","\0"),'',@$_GET[$g]);
+}
+
+
+header("Content-type: application/x-rdp",true);
+header("Content-disposition: attachment; filename=\"". str_replace(array('"','.'),'_',$_GET['vm']) .".rdp\"",true);
+
+
+echo('
+full address:s:'.@$_GET['host'].(@$_GET['port'] ? ':'.@$_GET['port'] : '').'
+compression:i:1
+displayconnectionbar:i:1
+protocol:i:4
+');
diff --git a/index.html b/index.html
index 893ce19..67c9b47 100644
--- a/index.html
+++ b/index.html
@@ -1,513 +1,513 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
-<html xmlns="http://www.w3.org/1999/xhtml">
-<!-- $Id: index.html 595 2015-04-17 09:50:36Z imoore76 $ -->
-<!-- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com) -->
-<head>
-
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
- <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
- <meta http-equiv="Expires" content="0"/>
- <meta http-equiv="Cache-Control" content ="no-cache"/>
- <meta http-equiv="Cache-Control" content ="no-store, must-revalidate, max-age=0"/>
- <meta http-equiv="Cache-Control" content ="post-check=0, pre-check=0"/>
- <meta http-equiv="Pragma" content="no-cache"/>
-
-
- <!-- Icon && title -->
- <link rel="shortcut icon" href="images/vbox/OSE/VirtualBox_win.ico"/>
- <link rel="icon" href="images/vbox/OSE/VirtualBox_win.ico"/>
- <title>phpVirtualBox - VirtualBox Web Console</title>
-
-
- <!-- Style sheets -->
- <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"/>
- <link rel="stylesheet" type="text/css" href="css/jquery.projectPlugins.css"/>
- <link rel="stylesheet" type="text/css" href="css/tipped.css" />
- <link rel="stylesheet" type="text/css" href="css/layout.css"/>
-
- <!-- External or jQuery related scripts -->
- <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
- <script type="text/javascript" src="js/jquery-ui-1.11.4.min.js"></script>
- <script type="text/javascript" src="js/jquery.tipped-2.1b.min.js"></script>
- <script type="text/javascript" src="js/jquery.scrollTo-min.js"></script>
- <script type="text/javascript" src="js/jquery.jec-1.3.1.js"></script>
-
- <!-- Oracle RDP Control -->
- <script type="text/javascript" src="rdpweb/webclient.js"></script>
- <script type="text/javascript" src="rdpweb/swfobject.js"></script>
-
- <!-- Internal / project related scripts -->
- <script type="text/javascript" src="endpoints/config.js"></script>
- <script type="text/javascript" src="js/jquery.projectPlugins.js"></script>
- <script type="text/javascript" src="js/phpvirtualbox.js"></script>
- <script type="text/javascript" src="js/utils.js"></script>
- <script type="text/javascript" src="js/eventlistener.js"></script>
- <script type="text/javascript" src="js/chooser.js"></script>
- <script type="text/javascript" src="js/datamediator.js"></script>
- <script type="text/javascript" src="js/dialogs.js"></script>
- <script type="text/javascript" src="js/canvasimages.js"></script>
-
-
- <!-- Main Setup -->
- <script type='text/javascript'>
-
- $(document).ready(function(){
-
- /* Synchronously load requirements */
- for(var i = 0; i < vboxEndpointConfig.require.length; i++) {
- $.ajax({
- type: "GET",
- url: vboxEndpointConfig.require[i],
- async: false,
- dataType: "script"
- });
- }
-
- /*
- * Parse cookies
- */
- vboxParseCookies();
-
- /*
- *
- * Begin sanity checks
- *
- */
-
-
- /**
- * Check that someone isn't accessing this from their local filesystem
- */
- try {
- if(window.location.toString().search('file:') == 0) {
- vboxAlert("You are accessing phpVirtualBox from your local filesystem.\
- phpVirtualBox must be accessed through your web browser. E.g. \
- http://localhost/phpVirtualBox (its actual URL may vary).");
- return;
- }
- } catch(err) {
- // noop
- }
-
-
- /*
- * If everything loaded correctly, trans() should be defined in
- * js/language.php and language data should be present.
- * If not, there is a PHP error somewhere.
- */
- if(typeof trans != "function" || typeof __vboxLangData == "undefined") {
- trans = function(s){return s;};
- vboxAlert("An unknown PHP error occurred. This is most likely a syntax error in\
- config.php in phpVirtualBox's folder. The most common errors are an unclosed\
- quote or a missing\
- semicolon in a configuration item that has been entered (e.g.\
- location, username, or password).<p>Depending on your PHP configuration,\
- navigating directly to <a href='config.php'>config.php</a> in your web\
- browser may display the PHP error message.</p>\
- <p>If find that this is not the case,\
- or have no idea what this error message means, please raise the issue\
- at <a href='http://sourceforge.net/p/phpvirtualbox/discussion/help/'\
- >http://sourceforge.net/p/phpvirtualbox/discussion/help/",{'width':'50%'});
- return;
- }
-
- // Sanity checks passed. Begin processing
-
- // Check for server setting (?server=xxxx in URL)
- if(location.search) {
- var query = location.search.substr(1).split('&');
- for(var kv in query) {
- kv = query[kv].split('=');
- if(kv[0] == 'server') {
- vboxSetCookie('vboxServer',unescape(kv[1]));
- location = location.href.substr(0,location.href.length-location.search.length);
- return;
- }
- }
- }
-
-
-
- /*
- * Resizable panes functionality
- */
- $('#vboxResizeBar').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
-
- $('#vboxResizeBarTmp').remove();
- var h = $('#vboxResizeBar').parent().height();
- return $('#vboxResizeBar').clone(false)
- .attr({'id':'vboxResizeBarTmp'}).unbind('mouseleave')
- .css({'background':'#ccc','height':h+'px'});
-
- },scroll:false,'start':function(e,ui){
-
- $('#vboxResizeOverlay').remove();
- $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
- $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
- $('#vboxResizeBar').data('vboxX',e.pageX);
-
- },'stop':function(e){
-
- $('#vboxResizeBarTmp').remove();
- $('#vboxResizeOverlay').remove();
- $('body').enableSelection().css({'cursor':'default'});
-
-
- var nx = $('#vboxChooserDiv').width() + (e.pageX - $('#vboxResizeBar').data('vboxX'));
- $('#vboxChooserDiv').css('width',(nx)+'px');
-
- vboxSetLocalDataItem("vboxPaneX",($('#vboxChooserDiv').width()));
-
- $('#vboxChooserPane').css('width',$('#vboxChooserDiv').css('width'));
-
- $(window).trigger('resize');
-
- }}).css('cursor',(jQuery.browser.opera ? 'e-resize' : 'col-resize')).parent().disableSelection();
-
-
-
- /*
- progress resize n / s
- */
- $('#vboxResizeBarProgress').draggable({cursor:(jQuery.browser.opera ? 'n-resize' : 'row-resize'),axis:'y',zIndex:99,helper:function(){
-
- $('#vboxResizeBarTmp').remove();
- return $('#vboxResizeBarProgress').clone(false)
- .attr({'id':'vboxResizeBarTmp'})
- .css({'background':'#ccc','position':'absolute','left':'0','right':'0','margin-left':'auto','margin-right':'auto'});
-
- },scroll:false,'start':function(e,ui){
-
- $('#vboxResizeOverlay').remove();
- $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'n-resize' : 'row-resize')});
- $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'n-resize' : 'row-resize')}));
- $('#vboxResizeBarProgress').data('vboxY',e.pageY);
-
- },'stop':function(e){
-
- $('#vboxResizeBarTmp').remove();
- $('#vboxResizeOverlay').remove();
- $('body').enableSelection().css({'cursor':'default'});
-
-
- var nx = $('#vboxProgressOps').height() + ($('#vboxResizeBarProgress').data('vboxY') - e.pageY);
- $('#vboxProgressOps').css({'height':(nx)+'px','overflow':'auto'}).parent().css({'height':(nx)+'px'});
-
- vboxSetLocalDataItem("vboxPaneY",($('#vboxProgressOps').height()));
-
- $('#vboxResizeBarProgressEW').css({'height':(vboxGetLocalDataItem("vboxPaneY")-4)+'px'});
-
- $(window).trigger('resize');
-
- }}).css('cursor',(jQuery.browser.opera ? 'n-resize' : 'row-resize')).parent().disableSelection();
-
- /*
- Progress resize E / W
- */
- var vboxOpsPaneEW = 400;
- if(vboxGetLocalDataItem('vboxOpsPaneEW')) {
- vboxOpsPaneEW = vboxGetLocalDataItem('vboxOpsPaneEW');
- } else {
- vboxSetLocalDataItem('vboxOpsPaneEW', vboxOpsPaneEW);
- }
- $('#vboxResizeBarProgressEW').css({'left':vboxOpsPaneEW+'px','top':'0'});
- // inject CSS
- $('head').append('<style type="text/css" id="vboxProgressOpsStyle">div.vboxProgressOpTitle { width: '+vboxOpsPaneEW+'px; }</style>');
-
- // Show draggablebar onmouseenter
- $('#vboxProgressOps').hover(function(){
- if($(this).children().length == 1) return;
- $('#vboxResizeBarProgressEW').css({'display':'inline-block','height':($(this)[0].scrollHeight-2)+'px'});
- },function(){
- $('#vboxResizeBarProgressEW').css({'display':'none'});
- });
-
- // Draggable bar
- $('#vboxResizeBarProgressEW').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
-
- $('#vboxResizeBarTmp').remove();
-
- return $('#vboxResizeBarProgressEW').clone(false)
- .attr({'id':'vboxResizeBarProgressEWTmp'}).css({'background':'#ccc'});
-
- },scroll:false,'start':function(e,ui){
-
- $('#vboxResizeOverlay').remove();
- $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
- $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
- $('#vboxResizeBarProgressEW').data('vboxX',e.pageX);
-
- },'stop':function(e){
-
- $('#vboxResizeBarTmp').remove();
- $('#vboxResizeOverlay').remove();
- $('body').enableSelection().css({'cursor':'default'});
-
- var nx = parseInt(vboxGetLocalDataItem('vboxOpsPaneEW')) + (e.pageX - $('#vboxResizeBarProgressEW').data('vboxX'));
- $('#vboxResizeBarProgressEW').css({'left':nx+'px'});
- vboxSetLocalDataItem('vboxOpsPaneEW',nx);
-
- // re-inject CSS
- $('#vboxProgressOpsStyle').empty().remove();
- $('head').append('<style type="text/css" id="vboxProgressOpsStyle">div.vboxProgressOpTitle { width: '+nx+'px; }</style>');
-
-
- }}).css('cursor',(jQuery.browser.opera ? 'e-resize' : 'col-resize'));
-
- /*
- * Resize panes when the window changes sizes
- */
- $(window).resize(function(){
-
- // Hide
- $('#vboxChooserResizePane').children().children().css({'display':'none'});
-
- var h = $('#vboxResize').innerHeight();
- $('#vboxChooserResizePane').children().children().css({'height':h+'px','overflow-y':'auto','overflow-x':'hidden','display':''});
-
- // special for resize bar
- $('#vboxResizeBar').css({'height':(h-10)+'px'});
-
-
- });
-
-
- /*
- * Refresh data when host changes
- */
- $('#vboxPane').on('hostChange',function(){
-
- var l = new vboxLoader();
- l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);$('#vboxPane').trigger('configLoaded');});
- l.add('vboxGetGuestOSTypes',function(d){$('#vboxPane').data('vboxOSTypes',d.responseData);});
- l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.add('hostGetDetails',function(d){$('#vboxPane').data('vboxHostDetails',d.responseData);});
- l.add('vboxRecentMediaGet',function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);});
- l.add('vboxRecentMediaPathsGet',function(d){$('#vboxPane').data('vboxRecentMediaPaths',d.responseData);});
- l.add('vboxGetEnumerationMap',function(d){$('#vboxPane').data('vboxMediumVariants',d.responseData);},{'class':'MediumVariant','ValueMap':1});
-
- l.onLoad = function(){
- $('#vboxPane').trigger('hostChanged');
- };
-
- l.run();
-
- });
-
-
- /*
- * Load panes all and data after valid login
- */
- $('#vboxPane').on('login', function() {
-
- var l = new vboxLoader();
-
- // Get data and store it using data()
- l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);$('#vboxPane').trigger('configLoaded');});
- l.add('vboxGetGuestOSTypes',function(d){$('#vboxPane').data('vboxOSTypes',d.responseData);});
- l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.add('hostGetDetails',function(d){$('#vboxPane').data('vboxHostDetails',d.responseData);});
- l.add('vboxRecentMediaGet',function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);});
- l.add('vboxRecentMediaPathsGet',function(d){$('#vboxPane').data('vboxRecentMediaPaths',d.responseData);});
- l.add('vboxGetEnumerationMap',function(d){$('#vboxPane').data('vboxMediumVariants',d.responseData);},{'class':'MediumVariant','ValueMap':1});
-
- // Load HTML panes and append them to their respective locations
- l.addFileToDOM('panes/chooser.html',$('#vboxChooserPane'));
- l.addFileToDOM('panes/topmenu.html');
- l.addFileToDOM('panes/toolbar.html');
- l.addFileToDOM('panes/tabs.html',$('#vboxPaneTabContent'));
-
- l.onLoad = function() {
-
-
- // Resize to last setting
- if(vboxGetLocalDataItem('vboxPaneX')) {
- $('#vboxChooserDiv').css('width',(vboxGetLocalDataItem('vboxPaneX'))+'px');
- } else {
- vboxSetLocalDataItem('vboxPaneX', $('#vboxChooserDiv').innerWidth());
- }
-
- if(vboxGetLocalDataItem('vboxPaneY')) {
- var nx = vboxGetLocalDataItem('vboxPaneY');
- $('#vboxProgressOps').css({'height':(nx)+'px'}).parent().css({'height':(nx)+'px'});
- } else {
- vboxSetLocalDataItem('vboxPaneY', $('#vboxProgressOps').height());
- }
- $('#vboxResizeBarProgressEW').css({'height':(vboxGetLocalDataItem("vboxPaneY")-4)+'px'});
-
- // Let everyone know that no vms are selected
- $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
-
- };
-
- // Trigger resize event to size panes
- l.onShow = function() { $(window).trigger('resize'); };
-
- l.hideRoot = true;
- l.run();
-
- });
-
- /**
- * Check for valid session and display login box if one does not exist
- * @params {Boolean} tried - true if login was attempted before this call
- */
- var vboxCheckSession = function(tried) {
-
- // check session info
- if($('#vboxPane').data('vboxSession') && $('#vboxPane').data('vboxSession').valid) {
-
- // Session is valid, trigger login
- $('#vboxPane').trigger('login');
- return;
- }
-
- // Was there an error? Assume it was displayed and just return from function
- if($('#vboxPane').data('vboxSession') && !$('#vboxPane').data('vboxSession').success) {
- return;
- }
-
-
- // No valid session. Show login pane
- $('#vboxLogin').find('input[name=password]').val('');
- $('#vboxLogin').dialog('open');
-
- if(!$('#vboxLogin').find('input[name=username]').val()) $('#vboxLogin').find('input[name=username]').focus();
- else $('#vboxLogin').find('input[name=password]').focus();
-
- // Display error if we tried to log in
- if(tried) {
- vboxAlert(trans('Invalid username or password.','UIUsers'),{'width':'400px'});
- }
-
- };
-
- /** Load login form */
- var login = new vboxLoader();
- login.add('getSession',function(d){$('#vboxPane').data('vboxSession',$.extend({'success':d.success},d.responseData));});
- login.addFileToDOM('panes/login.html');
- login.onLoad = function(loader) {
-
- var buttons = {};
- buttons[trans('Log in','UIUsers')] = function() {
-
- // Login button triggers login attempt
- var u = $('#vboxLogin').find('input[name=username]').val();
- var p = $('#vboxLogin').find('input[name=password]').val();
- if(!(u&&p)) return;
- $('#vboxLogin').dialog('close');
-
- // A valid login should create a valid session
- var trylogin = new vboxLoader();
- trylogin.add('login',function(d){$('#vboxPane').data('vboxSession',$.extend({'success':d.success},d.responseData));},{'u':u,'p':p});
- trylogin.onLoad = function() { vboxCheckSession(true);};
- trylogin.run();
- };
-
- // Create but do not open dialog
- if($.browser.webkit) heightadd = 5;
- else heightadd = 0;
- $('#vboxLogin').dialog({'closeOnEscape':false,'width':300,'height':'auto','buttons':buttons,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox :: ' + trans('Log in','UIUsers')});
- $('#vboxLogin').find('input[name=username]').first().focus();
-
- // Trick loader into not showing root pane again
- loader.hideRoot = false;
-
- // Login form is loaded, run check for valid session
- vboxCheckSession();
-
- };
- login.hideRoot = true;
- login.run();
-
- }); // </ document.ready event >
-
- </script>
-
-</head>
-<body>
-<div id='vboxPane' style='height: 100%; margin: 0px; padding: 0px;'>
-<table id='vboxTableMain' cellpadding=0 cellspacing=0 style="height: 100%; width: 100%; padding: 0px; margin: 0px; border: 0px; border-spacing: 0px;">
- <tr style='vertical-align: middle;'>
- <td style='height:20px;border:0px;padding:0px;margin:0px;border-spacing:0px;'>
- <div id='vboxMenu'>
- <!--
-
- Top menu bar
-
- -->
- </div>
- </td>
- </tr>
- <tr style='vertical-align: middle;'>
- <td id='vboxToolbarMain' style='height: 1%' class='vboxToolbarGrad'>
- <!--
-
- VM list toolbar
-
- -->
- <div id='vboxPaneToolbar'></div>
- <!--
-
- Tabs / buttons
-
- -->
- <div id='vboxTabsList'></div>
- </td>
- </tr>
- <tr style='vertical-align: top;'>
- <td style='border:0px;padding:0px;margin:0px;border-spacing:0px;' id='vboxResize'>
- <table style='width:100%;border:0px;padding:0px;border-spacing:0px;'>
- <tr id='vboxChooserResizePane' style='vertical-align: top;'>
- <td id="vboxChooserPane" style='padding:0px;border-spacing:0px;margin:0px;'>
- <!--
-
- VM List
-
- -->
- </td>
- <td id='vboxResizeTD' style='border: 0px; margin: 0px; padding: 0px; text-align: center;'>
- <div style='margin:0px;padding:0px;width:4px;height:100%;'>
- <div style='position: absolute; margin: 0px; padding:2px; width: 0px; height: 100%;' id='vboxResizeBar' ></div>
- </div>
- </td>
- <td id="vboxPaneTabContent" style='width:100%;border:0px;padding:0px;border-spacing:0px;margin:0px'>
- <!--
-
- Tab content
-
- -->
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <!--
- Progress operation list resize bar
- -->
- <tr style='padding: 0px; margin: 0px; vertical-align: middle;'>
- <td id='vboxResizeTDProgress' style='border: 0px; margin: 0px; padding: 0px; text-align: center; height: 5px; vertical-align: middle'>
- <div style='width:99%; margin:0 auto; padding:2px;' id='vboxResizeBarProgress' ></div>
- </td>
- </tr>
- <tr style='vertical-align: top; padding: 0px;'>
- <td style='border:0px;padding:0px;margin:0px;border-spacing:0px;height:1%'>
- <div id='vboxProgressOps' style='height:80px;overflow:auto;position:relative'>
- <!--
- Resize bar for E/ W
- -->
- <div style="position:absolute;z-index:1;margin:0px;border:0px;padding:1px;width: 0px;background:#aaa;display:none;" id='vboxResizeBarProgressEW' ></div>
- <!--
-
- Progress operation list
-
- -->
- </div>
- </td>
- </tr>
-</table>
-</div>
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- $Id: index.html 595 2015-04-17 09:50:36Z imoore76 $ -->
+<!-- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com) -->
+<head>
+
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
+ <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
+ <meta http-equiv="Expires" content="0"/>
+ <meta http-equiv="Cache-Control" content ="no-cache"/>
+ <meta http-equiv="Cache-Control" content ="no-store, must-revalidate, max-age=0"/>
+ <meta http-equiv="Cache-Control" content ="post-check=0, pre-check=0"/>
+ <meta http-equiv="Pragma" content="no-cache"/>
+
+
+ <!-- Icon && title -->
+ <link rel="shortcut icon" href="images/vbox/OSE/VirtualBox_win.ico"/>
+ <link rel="icon" href="images/vbox/OSE/VirtualBox_win.ico"/>
+ <title>phpVirtualBox - VirtualBox Web Console</title>
+
+
+ <!-- Style sheets -->
+ <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"/>
+ <link rel="stylesheet" type="text/css" href="css/jquery.projectPlugins.css"/>
+ <link rel="stylesheet" type="text/css" href="css/tipped.css" />
+ <link rel="stylesheet" type="text/css" href="css/layout.css"/>
+
+ <!-- External or jQuery related scripts -->
+ <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
+ <script type="text/javascript" src="js/jquery-ui-1.11.4.min.js"></script>
+ <script type="text/javascript" src="js/jquery.tipped-2.1b.min.js"></script>
+ <script type="text/javascript" src="js/jquery.scrollTo-min.js"></script>
+ <script type="text/javascript" src="js/jquery.jec-1.3.1.js"></script>
+
+ <!-- Oracle RDP Control -->
+ <script type="text/javascript" src="rdpweb/webclient.js"></script>
+ <script type="text/javascript" src="rdpweb/swfobject.js"></script>
+
+ <!-- Internal / project related scripts -->
+ <script type="text/javascript" src="endpoints/config.js"></script>
+ <script type="text/javascript" src="js/jquery.projectPlugins.js"></script>
+ <script type="text/javascript" src="js/phpvirtualbox.js"></script>
+ <script type="text/javascript" src="js/utils.js"></script>
+ <script type="text/javascript" src="js/eventlistener.js"></script>
+ <script type="text/javascript" src="js/chooser.js"></script>
+ <script type="text/javascript" src="js/datamediator.js"></script>
+ <script type="text/javascript" src="js/dialogs.js"></script>
+ <script type="text/javascript" src="js/canvasimages.js"></script>
+
+
+ <!-- Main Setup -->
+ <script type='text/javascript'>
+
+ $(document).ready(function(){
+
+ /* Synchronously load requirements */
+ for(var i = 0; i < vboxEndpointConfig.require.length; i++) {
+ $.ajax({
+ type: "GET",
+ url: vboxEndpointConfig.require[i],
+ async: false,
+ dataType: "script"
+ });
+ }
+
+ /*
+ * Parse cookies
+ */
+ vboxParseCookies();
+
+ /*
+ *
+ * Begin sanity checks
+ *
+ */
+
+
+ /**
+ * Check that someone isn't accessing this from their local filesystem
+ */
+ try {
+ if(window.location.toString().search('file:') == 0) {
+ vboxAlert("You are accessing phpVirtualBox from your local filesystem.\
+ phpVirtualBox must be accessed through your web browser. E.g. \
+ http://localhost/phpVirtualBox (its actual URL may vary).");
+ return;
+ }
+ } catch(err) {
+ // noop
+ }
+
+
+ /*
+ * If everything loaded correctly, trans() should be defined in
+ * js/language.php and language data should be present.
+ * If not, there is a PHP error somewhere.
+ */
+ if(typeof trans != "function" || typeof __vboxLangData == "undefined") {
+ trans = function(s){return s;};
+ vboxAlert("An unknown PHP error occurred. This is most likely a syntax error in\
+ config.php in phpVirtualBox's folder. The most common errors are an unclosed\
+ quote or a missing\
+ semicolon in a configuration item that has been entered (e.g.\
+ location, username, or password).<p>Depending on your PHP configuration,\
+ navigating directly to <a href='config.php'>config.php</a> in your web\
+ browser may display the PHP error message.</p>\
+ <p>If find that this is not the case,\
+ or have no idea what this error message means, please raise the issue\
+ at <a href='http://sourceforge.net/p/phpvirtualbox/discussion/help/'\
+ >http://sourceforge.net/p/phpvirtualbox/discussion/help/",{'width':'50%'});
+ return;
+ }
+
+ // Sanity checks passed. Begin processing
+
+ // Check for server setting (?server=xxxx in URL)
+ if(location.search) {
+ var query = location.search.substr(1).split('&');
+ for(var kv in query) {
+ kv = query[kv].split('=');
+ if(kv[0] == 'server') {
+ vboxSetCookie('vboxServer',unescape(kv[1]));
+ location = location.href.substr(0,location.href.length-location.search.length);
+ return;
+ }
+ }
+ }
+
+
+
+ /*
+ * Resizable panes functionality
+ */
+ $('#vboxResizeBar').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
+
+ $('#vboxResizeBarTmp').remove();
+ var h = $('#vboxResizeBar').parent().height();
+ return $('#vboxResizeBar').clone(false)
+ .attr({'id':'vboxResizeBarTmp'}).unbind('mouseleave')
+ .css({'background':'#ccc','height':h+'px'});
+
+ },scroll:false,'start':function(e,ui){
+
+ $('#vboxResizeOverlay').remove();
+ $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
+ $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
+ $('#vboxResizeBar').data('vboxX',e.pageX);
+
+ },'stop':function(e){
+
+ $('#vboxResizeBarTmp').remove();
+ $('#vboxResizeOverlay').remove();
+ $('body').enableSelection().css({'cursor':'default'});
+
+
+ var nx = $('#vboxChooserDiv').width() + (e.pageX - $('#vboxResizeBar').data('vboxX'));
+ $('#vboxChooserDiv').css('width',(nx)+'px');
+
+ vboxSetLocalDataItem("vboxPaneX",($('#vboxChooserDiv').width()));
+
+ $('#vboxChooserPane').css('width',$('#vboxChooserDiv').css('width'));
+
+ $(window).trigger('resize');
+
+ }}).css('cursor',(jQuery.browser.opera ? 'e-resize' : 'col-resize')).parent().disableSelection();
+
+
+
+ /*
+ progress resize n / s
+ */
+ $('#vboxResizeBarProgress').draggable({cursor:(jQuery.browser.opera ? 'n-resize' : 'row-resize'),axis:'y',zIndex:99,helper:function(){
+
+ $('#vboxResizeBarTmp').remove();
+ return $('#vboxResizeBarProgress').clone(false)
+ .attr({'id':'vboxResizeBarTmp'})
+ .css({'background':'#ccc','position':'absolute','left':'0','right':'0','margin-left':'auto','margin-right':'auto'});
+
+ },scroll:false,'start':function(e,ui){
+
+ $('#vboxResizeOverlay').remove();
+ $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'n-resize' : 'row-resize')});
+ $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'n-resize' : 'row-resize')}));
+ $('#vboxResizeBarProgress').data('vboxY',e.pageY);
+
+ },'stop':function(e){
+
+ $('#vboxResizeBarTmp').remove();
+ $('#vboxResizeOverlay').remove();
+ $('body').enableSelection().css({'cursor':'default'});
+
+
+ var nx = $('#vboxProgressOps').height() + ($('#vboxResizeBarProgress').data('vboxY') - e.pageY);
+ $('#vboxProgressOps').css({'height':(nx)+'px','overflow':'auto'}).parent().css({'height':(nx)+'px'});
+
+ vboxSetLocalDataItem("vboxPaneY",($('#vboxProgressOps').height()));
+
+ $('#vboxResizeBarProgressEW').css({'height':(vboxGetLocalDataItem("vboxPaneY")-4)+'px'});
+
+ $(window).trigger('resize');
+
+ }}).css('cursor',(jQuery.browser.opera ? 'n-resize' : 'row-resize')).parent().disableSelection();
+
+ /*
+ Progress resize E / W
+ */
+ var vboxOpsPaneEW = 400;
+ if(vboxGetLocalDataItem('vboxOpsPaneEW')) {
+ vboxOpsPaneEW = vboxGetLocalDataItem('vboxOpsPaneEW');
+ } else {
+ vboxSetLocalDataItem('vboxOpsPaneEW', vboxOpsPaneEW);
+ }
+ $('#vboxResizeBarProgressEW').css({'left':vboxOpsPaneEW+'px','top':'0'});
+ // inject CSS
+ $('head').append('<style type="text/css" id="vboxProgressOpsStyle">div.vboxProgressOpTitle { width: '+vboxOpsPaneEW+'px; }</style>');
+
+ // Show draggablebar onmouseenter
+ $('#vboxProgressOps').hover(function(){
+ if($(this).children().length == 1) return;
+ $('#vboxResizeBarProgressEW').css({'display':'inline-block','height':($(this)[0].scrollHeight-2)+'px'});
+ },function(){
+ $('#vboxResizeBarProgressEW').css({'display':'none'});
+ });
+
+ // Draggable bar
+ $('#vboxResizeBarProgressEW').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
+
+ $('#vboxResizeBarTmp').remove();
+
+ return $('#vboxResizeBarProgressEW').clone(false)
+ .attr({'id':'vboxResizeBarProgressEWTmp'}).css({'background':'#ccc'});
+
+ },scroll:false,'start':function(e,ui){
+
+ $('#vboxResizeOverlay').remove();
+ $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
+ $('#vboxPane').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:100%;height:100%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;z-index:10;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
+ $('#vboxResizeBarProgressEW').data('vboxX',e.pageX);
+
+ },'stop':function(e){
+
+ $('#vboxResizeBarTmp').remove();
+ $('#vboxResizeOverlay').remove();
+ $('body').enableSelection().css({'cursor':'default'});
+
+ var nx = parseInt(vboxGetLocalDataItem('vboxOpsPaneEW')) + (e.pageX - $('#vboxResizeBarProgressEW').data('vboxX'));
+ $('#vboxResizeBarProgressEW').css({'left':nx+'px'});
+ vboxSetLocalDataItem('vboxOpsPaneEW',nx);
+
+ // re-inject CSS
+ $('#vboxProgressOpsStyle').empty().remove();
+ $('head').append('<style type="text/css" id="vboxProgressOpsStyle">div.vboxProgressOpTitle { width: '+nx+'px; }</style>');
+
+
+ }}).css('cursor',(jQuery.browser.opera ? 'e-resize' : 'col-resize'));
+
+ /*
+ * Resize panes when the window changes sizes
+ */
+ $(window).resize(function(){
+
+ // Hide
+ $('#vboxChooserResizePane').children().children().css({'display':'none'});
+
+ var h = $('#vboxResize').innerHeight();
+ $('#vboxChooserResizePane').children().children().css({'height':h+'px','overflow-y':'auto','overflow-x':'hidden','display':''});
+
+ // special for resize bar
+ $('#vboxResizeBar').css({'height':(h-10)+'px'});
+
+
+ });
+
+
+ /*
+ * Refresh data when host changes
+ */
+ $('#vboxPane').on('hostChange',function(){
+
+ var l = new vboxLoader();
+ l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);$('#vboxPane').trigger('configLoaded');});
+ l.add('vboxGetGuestOSTypes',function(d){$('#vboxPane').data('vboxOSTypes',d.responseData);});
+ l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.add('hostGetDetails',function(d){$('#vboxPane').data('vboxHostDetails',d.responseData);});
+ l.add('vboxRecentMediaGet',function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);});
+ l.add('vboxRecentMediaPathsGet',function(d){$('#vboxPane').data('vboxRecentMediaPaths',d.responseData);});
+ l.add('vboxGetEnumerationMap',function(d){$('#vboxPane').data('vboxMediumVariants',d.responseData);},{'class':'MediumVariant','ValueMap':1});
+
+ l.onLoad = function(){
+ $('#vboxPane').trigger('hostChanged');
+ };
+
+ l.run();
+
+ });
+
+
+ /*
+ * Load panes all and data after valid login
+ */
+ $('#vboxPane').on('login', function() {
+
+ var l = new vboxLoader();
+
+ // Get data and store it using data()
+ l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);$('#vboxPane').trigger('configLoaded');});
+ l.add('vboxGetGuestOSTypes',function(d){$('#vboxPane').data('vboxOSTypes',d.responseData);});
+ l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.add('hostGetDetails',function(d){$('#vboxPane').data('vboxHostDetails',d.responseData);});
+ l.add('vboxRecentMediaGet',function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);});
+ l.add('vboxRecentMediaPathsGet',function(d){$('#vboxPane').data('vboxRecentMediaPaths',d.responseData);});
+ l.add('vboxGetEnumerationMap',function(d){$('#vboxPane').data('vboxMediumVariants',d.responseData);},{'class':'MediumVariant','ValueMap':1});
+
+ // Load HTML panes and append them to their respective locations
+ l.addFileToDOM('panes/chooser.html',$('#vboxChooserPane'));
+ l.addFileToDOM('panes/topmenu.html');
+ l.addFileToDOM('panes/toolbar.html');
+ l.addFileToDOM('panes/tabs.html',$('#vboxPaneTabContent'));
+
+ l.onLoad = function() {
+
+
+ // Resize to last setting
+ if(vboxGetLocalDataItem('vboxPaneX')) {
+ $('#vboxChooserDiv').css('width',(vboxGetLocalDataItem('vboxPaneX'))+'px');
+ } else {
+ vboxSetLocalDataItem('vboxPaneX', $('#vboxChooserDiv').innerWidth());
+ }
+
+ if(vboxGetLocalDataItem('vboxPaneY')) {
+ var nx = vboxGetLocalDataItem('vboxPaneY');
+ $('#vboxProgressOps').css({'height':(nx)+'px'}).parent().css({'height':(nx)+'px'});
+ } else {
+ vboxSetLocalDataItem('vboxPaneY', $('#vboxProgressOps').height());
+ }
+ $('#vboxResizeBarProgressEW').css({'height':(vboxGetLocalDataItem("vboxPaneY")-4)+'px'});
+
+ // Let everyone know that no vms are selected
+ $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
+
+ };
+
+ // Trigger resize event to size panes
+ l.onShow = function() { $(window).trigger('resize'); };
+
+ l.hideRoot = true;
+ l.run();
+
+ });
+
+ /**
+ * Check for valid session and display login box if one does not exist
+ * @params {Boolean} tried - true if login was attempted before this call
+ */
+ var vboxCheckSession = function(tried) {
+
+ // check session info
+ if($('#vboxPane').data('vboxSession') && $('#vboxPane').data('vboxSession').valid) {
+
+ // Session is valid, trigger login
+ $('#vboxPane').trigger('login');
+ return;
+ }
+
+ // Was there an error? Assume it was displayed and just return from function
+ if($('#vboxPane').data('vboxSession') && !$('#vboxPane').data('vboxSession').success) {
+ return;
+ }
+
+
+ // No valid session. Show login pane
+ $('#vboxLogin').find('input[name=password]').val('');
+ $('#vboxLogin').dialog('open');
+
+ if(!$('#vboxLogin').find('input[name=username]').val()) $('#vboxLogin').find('input[name=username]').focus();
+ else $('#vboxLogin').find('input[name=password]').focus();
+
+ // Display error if we tried to log in
+ if(tried) {
+ vboxAlert(trans('Invalid username or password.','UIUsers'),{'width':'400px'});
+ }
+
+ };
+
+ /** Load login form */
+ var login = new vboxLoader();
+ login.add('getSession',function(d){$('#vboxPane').data('vboxSession',$.extend({'success':d.success},d.responseData));});
+ login.addFileToDOM('panes/login.html');
+ login.onLoad = function(loader) {
+
+ var buttons = {};
+ buttons[trans('Log in','UIUsers')] = function() {
+
+ // Login button triggers login attempt
+ var u = $('#vboxLogin').find('input[name=username]').val();
+ var p = $('#vboxLogin').find('input[name=password]').val();
+ if(!(u&&p)) return;
+ $('#vboxLogin').dialog('close');
+
+ // A valid login should create a valid session
+ var trylogin = new vboxLoader();
+ trylogin.add('login',function(d){$('#vboxPane').data('vboxSession',$.extend({'success':d.success},d.responseData));},{'u':u,'p':p});
+ trylogin.onLoad = function() { vboxCheckSession(true);};
+ trylogin.run();
+ };
+
+ // Create but do not open dialog
+ if($.browser.webkit) heightadd = 5;
+ else heightadd = 0;
+ $('#vboxLogin').dialog({'closeOnEscape':false,'width':300,'height':'auto','buttons':buttons,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox :: ' + trans('Log in','UIUsers')});
+ $('#vboxLogin').find('input[name=username]').first().focus();
+
+ // Trick loader into not showing root pane again
+ loader.hideRoot = false;
+
+ // Login form is loaded, run check for valid session
+ vboxCheckSession();
+
+ };
+ login.hideRoot = true;
+ login.run();
+
+ }); // </ document.ready event >
+
+ </script>
+
+</head>
+<body>
+<div id='vboxPane' style='height: 100%; margin: 0px; padding: 0px;'>
+<table id='vboxTableMain' cellpadding=0 cellspacing=0 style="height: 100%; width: 100%; padding: 0px; margin: 0px; border: 0px; border-spacing: 0px;">
+ <tr style='vertical-align: middle;'>
+ <td style='height:20px;border:0px;padding:0px;margin:0px;border-spacing:0px;'>
+ <div id='vboxMenu'>
+ <!--
+
+ Top menu bar
+
+ -->
+ </div>
+ </td>
+ </tr>
+ <tr style='vertical-align: middle;'>
+ <td id='vboxToolbarMain' style='height: 1%' class='vboxToolbarGrad'>
+ <!--
+
+ VM list toolbar
+
+ -->
+ <div id='vboxPaneToolbar'></div>
+ <!--
+
+ Tabs / buttons
+
+ -->
+ <div id='vboxTabsList'></div>
+ </td>
+ </tr>
+ <tr style='vertical-align: top;'>
+ <td style='border:0px;padding:0px;margin:0px;border-spacing:0px;' id='vboxResize'>
+ <table style='width:100%;border:0px;padding:0px;border-spacing:0px;'>
+ <tr id='vboxChooserResizePane' style='vertical-align: top;'>
+ <td id="vboxChooserPane" style='padding:0px;border-spacing:0px;margin:0px;'>
+ <!--
+
+ VM List
+
+ -->
+ </td>
+ <td id='vboxResizeTD' style='border: 0px; margin: 0px; padding: 0px; text-align: center;'>
+ <div style='margin:0px;padding:0px;width:4px;height:100%;'>
+ <div style='position: absolute; margin: 0px; padding:2px; width: 0px; height: 100%;' id='vboxResizeBar' ></div>
+ </div>
+ </td>
+ <td id="vboxPaneTabContent" style='width:100%;border:0px;padding:0px;border-spacing:0px;margin:0px'>
+ <!--
+
+ Tab content
+
+ -->
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!--
+ Progress operation list resize bar
+ -->
+ <tr style='padding: 0px; margin: 0px; vertical-align: middle;'>
+ <td id='vboxResizeTDProgress' style='border: 0px; margin: 0px; padding: 0px; text-align: center; height: 5px; vertical-align: middle'>
+ <div style='width:99%; margin:0 auto; padding:2px;' id='vboxResizeBarProgress' ></div>
+ </td>
+ </tr>
+ <tr style='vertical-align: top; padding: 0px;'>
+ <td style='border:0px;padding:0px;margin:0px;border-spacing:0px;height:1%'>
+ <div id='vboxProgressOps' style='height:80px;overflow:auto;position:relative'>
+ <!--
+ Resize bar for E/ W
+ -->
+ <div style="position:absolute;z-index:1;margin:0px;border:0px;padding:1px;width: 0px;background:#aaa;display:none;" id='vboxResizeBarProgressEW' ></div>
+ <!--
+
+ Progress operation list
+
+ -->
+ </div>
+ </td>
+ </tr>
+</table>
+</div>
+</body>
</html> \ No newline at end of file
diff --git a/js/canvasimages.js b/js/canvasimages.js
index eba4279..5d80b6c 100644
--- a/js/canvasimages.js
+++ b/js/canvasimages.js
@@ -1,648 +1,648 @@
-/**
- * @fileOverview HTML5 canvas image functions
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: canvasimages.js 591 2015-04-11 22:40:47Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- */
-
-/**
- * Returns true if broswer supports canvas
- * @return {Boolean} true if broswer supports canvas
- */
-var __vboxIsCanvasSupported = null; // cached
-var isCanvasSupported = function(){
- if(__vboxIsCanvasSupported === null) {
- try {
- var elem = document.createElement('canvas');
- __vboxIsCanvasSupported = !!(elem && elem.getContext && elem.getContext('2d'));
- } catch (err) {
- __vboxIsCanvasSupported = false;
- }
- }
- return __vboxIsCanvasSupported;
-};
-
-var __vboxPreviewCanvasCache = [];
-function vboxDrawPreviewCanvas(can, imageObj, text, width, height) {
-
- var screenMargin = 7;
- var margin = 10;
-
- var resizeToImage = (imageObj && (imageObj.width == width));
-
- // Height / width comes from direct image values
- if(imageObj && resizeToImage) {
-
- height = imageObj.height;
- width = imageObj.width;
-
- // Set height while maintaining aspect ratio
- } else if (imageObj) {
-
- height = imageObj.height * (width/imageObj.width);
- }
-
- // Margins are added to width
- height += ((margin+screenMargin)*2);
- width += ((margin+screenMargin)*2);
-
- // Does canvas still exist?
- // VM selection can change while this function is running
- // in which case the canvas goes away
- if(!can) return;
-
- // Set canvas values
- can.height = height;
- can.width = width;
-
- var ctx = can.getContext('2d');
-
-
- // Clear the canvas
- ctx.clearRect(0,0,width,height);
-
- ctx.save();
-
- // Draw and cache monitor image if it is not present
- if(!__vboxPreviewCanvasCache[width+'x'+height]) {
-
- var cachedCanvas = document.createElement('canvas');
-
- cachedCanvas.width = width;
- cachedCanvas.height = height;
-
- var cachedCtx = cachedCanvas.getContext('2d');
-
- cachedCtx.beginPath();
- cachedCtx.strokeStyle = "#000000";
- cachedCtx.lineWidth = 0.3;
- cachedCtx.lineCap = 'butt';
-
- cachedCtx.moveTo(margin*2,margin);
-
- // top and top right
- cachedCtx.lineTo(width-(margin*2), margin);
- cachedCtx.arcTo(width-margin, margin, width-margin,margin*2, margin);
-
- // Side and bottom right
- cachedCtx.lineTo(width-margin, height-(margin*2));
- cachedCtx.arcTo(width-margin, height-margin, width-(margin*2), height-margin, margin);
-
- // bottom and bottom left
- cachedCtx.lineTo(margin*2, height-margin);
- cachedCtx.arcTo(margin, height-margin, margin, height-(margin*2), margin);
-
- // Left line and top left
- cachedCtx.lineTo(margin, margin*2);
- cachedCtx.arcTo(margin, margin, margin * 2, margin, margin);
-
- cachedCtx.closePath();
- cachedCtx.save();
- cachedCtx.shadowOffsetX = 5;
- cachedCtx.shadowOffsetY = 5;
- cachedCtx.shadowBlur = 4;
- cachedCtx.shadowColor = "rgba(30, 30, 30, 0.2)";
-
-
- var grad = cachedCtx.createLinearGradient(0, margin, 0, height);
- grad.addColorStop(0, "rgb(200,200,200)");
- grad.addColorStop(0.4, "rgb(100,100,100)");
- grad.addColorStop(0.5, "rgb(66,66,66)");
- grad.addColorStop(0.7, "rgb(100,100,100)");
- grad.addColorStop(1, "rgb(200,200,200)");
-
- cachedCtx.fillStyle = grad;
-
- cachedCtx.fill();
-
- // Redraw so that shadow is seen on all sides
- cachedCtx.shadowOffsetX = -5;
- cachedCtx.shadowOffsetY = -5;
- cachedCtx.fill();
- cachedCtx.restore();
- cachedCtx.fillRect(margin+screenMargin,margin+screenMargin,width-(margin*2)-(screenMargin*2),height-(margin*2)-(screenMargin*2));
- cachedCtx.stroke();
- cachedCtx.restore();
-
- var cvs = document.createElement('canvas');
-
- /* Gloss */
- var rectX = 0;
- var rectY = 0;
- var rectWidth = width-(margin+screenMargin)*2;
- var rectHeight = height-(margin+screenMargin)*2;
-
- cvs.width = rectWidth;
- cvs.height = rectHeight;
-
- var ctxBlur = cvs.getContext('2d');
- ctxBlur.beginPath();
- ctxBlur.lineWidth = 1;
- ctxBlur.strokeStyle = "#000000";
- ctxBlur.moveTo(rectX,rectY);
- ctxBlur.lineTo(rectWidth, rectY);
- ctxBlur.lineTo(rectWidth,rectHeight*1.0/3.0);
- ctxBlur.bezierCurveTo(rectX+rectWidth / 2.0, rectY + rectHeight * 1.0/3.0,
- rectX+rectWidth / 2.0, rectY + rectHeight * 2.0/3.0,
- rectX, rectY + rectHeight * 2.0/3.0);
- ctxBlur.closePath();
- ctxBlur.fillStyle="rgba(255,255,255,0.3)";
- ctxBlur.fill();
-
- stackBlurCanvasRGBA( cvs, 0, 0, rectWidth, rectHeight, 17 );
-
- ctx.drawImage(cvs, margin+screenMargin, margin+screenMargin, rectWidth, rectHeight);
-
- __vboxPreviewCanvasCache[width+'x'+height] = {
- 'monitor' : cachedCanvas,
- 'gloss' : cvs
- };
-
- }
-
- // Draw cached monitor canvas
- ctx.drawImage(__vboxPreviewCanvasCache[width+'x'+height]['monitor'], 0, 0, width, height);
-
- /* Screenshot */
- if(imageObj) {
-
- ctx.drawImage(imageObj, 0, 0, imageObj.width, imageObj.height, (margin+screenMargin), (margin+screenMargin), width-(margin*2)-(screenMargin*2),height-(margin*2)-(screenMargin*2));
- }
-
- // Draw cached gloss canvas
- ctx.drawImage(__vboxPreviewCanvasCache[width+'x'+height]['gloss'], 0, 0, width, height);
-
- /* Text */
- if(!imageObj) {
-
- txtCan = document.createElement('canvas');
- txtCan.width = width-(margin+screenMargin)*2;
- txtCan.height = height-(margin+screenMargin)*2;
-
- fitTextToCanvas(txtCan, text, 18);
-
- ctx.drawImage(txtCan, (margin+screenMargin), (margin+screenMargin));
-
- }
-
-
- return;
-}
-
-
-/* HELPERS */
-
-/**
- * Fit text to a canvas element
- *
- * @author Ian Moore
- */
-var fitTextToCanvas = function(can, text, fontSize) {
-
- var lineHeightOffset = 1.4;
- var lineHeight = fontSize * lineHeightOffset;
- var minFontSize = 10;
- var padding = 2;
-
- var words = text.split(" ");
-
- var maxWidth = can.width;
- var maxHeight = can.height;
- var context = can.getContext('2d');
- context.moveTo(0,0);
-
-
- var wrapTextLines = function() {
-
- context.font = "bold " + fontSize + "pt Arial";
-
- var line = '';
- var lines = [];
-
- for (var n = 0; n < words.length; n++) {
-
- var testLine = line + (line.length ? ' ' : '') + words[n];
-
- if((context.measureText(testLine).width + padding) > maxWidth) {
-
- // Only one word is too big
- if(testLine.indexOf(' ') == -1) {
-
- if(fontSize > minFontSize) {
- fontSize *= 0.9;
- return wrapTextLines();
- }
- line = testLine;
-
- } else {
- lines[lines.length] = line;
- line = words[n];
- }
-
- } else {
-
- line = testLine;
-
- }
-
- }
- if(line.length) {
- if((context.measureText(line).width + padding) > maxWidth && fontSize > minFontSize) {
- fontSize *= 0.9;
- return wrapTextLines();
- }
- lines[lines.length] = line;
- }
- return lines;
-
- };
-
- // Initial wrap
- lines = wrapTextLines();
-
- // Since text will be aligned to the bottom, we subtract
- // one lineheight addition because it will be off the
- // visible canvas and should not be included in calculations
- while(((lines.length * lineHeight)-(lineHeight-fontSize) > maxHeight) && fontSize > minFontSize) {
- fontSize *= 0.9;
- lines = wrapTextLines();
- lineHeight = fontSize * lineHeightOffset;
- }
-
- context.fillStyle = "#ffffff";
- context.textAlign = "center";
- context.textBaseline = 'alphabetic';
- context.strokeStyle = "#ff0000";
-
- var totalHeight = Math.round((lines.length * lineHeight)-(lineHeight-fontSize));
-
- for(var i = 0; i < lines.length; i++) {
- /*
- Uncomment to debug line heights
-
- context.moveTo(0, (maxHeight/2)-(totalHeight/2)+(lineHeight*i));
- context.lineTo(maxWidth, (maxHeight/2)-(totalHeight/2)+(lineHeight*i));
- context.stroke();
- context.moveTo(0, (maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight);
- context.lineTo(maxWidth, (maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight);
- context.stroke();
- */
- context.fillText(lines[i],(maxWidth/2),(maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight-(lineHeight-fontSize));
- }
- return can;
-
-};
-
-/*
-
-StackBlur - a fast almost Gaussian Blur For Canvas
-
-Version: 0.5
-Author: Mario Klingemann
-Contact: mario@quasimondo.com
-Website: http://www.quasimondo.com/StackBlurForCanvas
-Twitter: @quasimondo
-
-In case you find this class useful - especially in commercial projects -
-I am not totally unhappy for a small donation to my PayPal account
-mario@quasimondo.de
-
-Or support me on flattr:
-https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript
-
-Copyright (c) 2010 Mario Klingemann
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-var mul_table = [
- 512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,
- 454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,
- 482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,
- 437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,
- 497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,
- 320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,
- 446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,
- 329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,
- 505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,
- 399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,
- 324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,
- 268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,
- 451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,
- 385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,
- 332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,
- 289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];
-
-
-var shg_table = [
- 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ];
-
-var stackBlurCanvasRGBA = function( canvas, top_x, top_y, width, height, radius )
-{
- if ( isNaN(radius) || radius < 1 ) return;
- radius |= 0;
-
- //var canvas = document.getElementById( id );
- var context = canvas.getContext("2d");
- var imageData;
-
- try {
- try {
- imageData = context.getImageData( top_x, top_y, width, height );
- } catch(e) {
-
- // NOTE: this part is supposedly only needed if you want to work with local files
- // so it might be okay to remove the whole try/catch block and just use
- // imageData = context.getImageData( top_x, top_y, width, height );
- try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
- imageData = context.getImageData( top_x, top_y, width, height );
- } catch(e) {
- alert("Cannot access local image");
- throw new Error("unable to access local image data: " + e);
- return;
- }
- }
- } catch(e) {
- alert("Cannot access image");
- throw new Error("unable to access image data: " + e);
- }
-
- var pixels = imageData.data;
-
- var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum,
- r_out_sum, g_out_sum, b_out_sum, a_out_sum,
- r_in_sum, g_in_sum, b_in_sum, a_in_sum,
- pr, pg, pb, pa, rbs;
-
- var div = radius + radius + 1;
- var widthMinus1 = width - 1;
- var heightMinus1 = height - 1;
- var radiusPlus1 = radius + 1;
- var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
-
- var stackStart = new BlurStack();
- var stack = stackStart;
- for ( i = 1; i < div; i++ )
- {
- stack = stack.next = new BlurStack();
- if ( i == radiusPlus1 ) var stackEnd = stack;
- }
- stack.next = stackStart;
- var stackIn = null;
- var stackOut = null;
-
- yw = yi = 0;
-
- var mul_sum = mul_table[radius];
- var shg_sum = shg_table[radius];
-
- for ( y = 0; y < height; y++ )
- {
- r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;
-
- r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
- g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
- b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
- a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] );
-
- r_sum += sumFactor * pr;
- g_sum += sumFactor * pg;
- b_sum += sumFactor * pb;
- a_sum += sumFactor * pa;
-
- stack = stackStart;
-
- for( i = 0; i < radiusPlus1; i++ )
- {
- stack.r = pr;
- stack.g = pg;
- stack.b = pb;
- stack.a = pa;
- stack = stack.next;
- }
-
- for( i = 1; i < radiusPlus1; i++ )
- {
- p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
- r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
- g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
- b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
- a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs;
-
- r_in_sum += pr;
- g_in_sum += pg;
- b_in_sum += pb;
- a_in_sum += pa;
-
- stack = stack.next;
- }
-
-
- stackIn = stackStart;
- stackOut = stackEnd;
- for ( x = 0; x < width; x++ )
- {
- pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum;
- if ( pa != 0 )
- {
- pa = 255 / pa;
- pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa;
- pixels[yi+1] = ((g_sum * mul_sum) >> shg_sum) * pa;
- pixels[yi+2] = ((b_sum * mul_sum) >> shg_sum) * pa;
- } else {
- pixels[yi] = pixels[yi+1] = pixels[yi+2] = 0;
- }
-
- r_sum -= r_out_sum;
- g_sum -= g_out_sum;
- b_sum -= b_out_sum;
- a_sum -= a_out_sum;
-
- r_out_sum -= stackIn.r;
- g_out_sum -= stackIn.g;
- b_out_sum -= stackIn.b;
- a_out_sum -= stackIn.a;
-
- p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
-
- r_in_sum += ( stackIn.r = pixels[p]);
- g_in_sum += ( stackIn.g = pixels[p+1]);
- b_in_sum += ( stackIn.b = pixels[p+2]);
- a_in_sum += ( stackIn.a = pixels[p+3]);
-
- r_sum += r_in_sum;
- g_sum += g_in_sum;
- b_sum += b_in_sum;
- a_sum += a_in_sum;
-
- stackIn = stackIn.next;
-
- r_out_sum += ( pr = stackOut.r );
- g_out_sum += ( pg = stackOut.g );
- b_out_sum += ( pb = stackOut.b );
- a_out_sum += ( pa = stackOut.a );
-
- r_in_sum -= pr;
- g_in_sum -= pg;
- b_in_sum -= pb;
- a_in_sum -= pa;
-
- stackOut = stackOut.next;
-
- yi += 4;
- }
- yw += width;
- }
-
-
- for ( x = 0; x < width; x++ )
- {
- g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;
-
- yi = x << 2;
- r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
- g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
- b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
- a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]);
-
- r_sum += sumFactor * pr;
- g_sum += sumFactor * pg;
- b_sum += sumFactor * pb;
- a_sum += sumFactor * pa;
-
- stack = stackStart;
-
- for( i = 0; i < radiusPlus1; i++ )
- {
- stack.r = pr;
- stack.g = pg;
- stack.b = pb;
- stack.a = pa;
- stack = stack.next;
- }
-
- yp = width;
-
- for( i = 1; i <= radius; i++ )
- {
- yi = ( yp + x ) << 2;
-
- r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
- g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
- b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
- a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs;
-
- r_in_sum += pr;
- g_in_sum += pg;
- b_in_sum += pb;
- a_in_sum += pa;
-
- stack = stack.next;
-
- if( i < heightMinus1 )
- {
- yp += width;
- }
- }
-
- yi = x;
- stackIn = stackStart;
- stackOut = stackEnd;
- for ( y = 0; y < height; y++ )
- {
- p = yi << 2;
- pixels[p+3] = pa = (a_sum * mul_sum) >> shg_sum;
- if ( pa > 0 )
- {
- pa = 255 / pa;
- pixels[p] = ((r_sum * mul_sum) >> shg_sum ) * pa;
- pixels[p+1] = ((g_sum * mul_sum) >> shg_sum ) * pa;
- pixels[p+2] = ((b_sum * mul_sum) >> shg_sum ) * pa;
- } else {
- pixels[p] = pixels[p+1] = pixels[p+2] = 0;
- }
-
- r_sum -= r_out_sum;
- g_sum -= g_out_sum;
- b_sum -= b_out_sum;
- a_sum -= a_out_sum;
-
- r_out_sum -= stackIn.r;
- g_out_sum -= stackIn.g;
- b_out_sum -= stackIn.b;
- a_out_sum -= stackIn.a;
-
- p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
-
- r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
- g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
- b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
- a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3]));
-
- stackIn = stackIn.next;
-
- r_out_sum += ( pr = stackOut.r );
- g_out_sum += ( pg = stackOut.g );
- b_out_sum += ( pb = stackOut.b );
- a_out_sum += ( pa = stackOut.a );
-
- r_in_sum -= pr;
- g_in_sum -= pg;
- b_in_sum -= pb;
- a_in_sum -= pa;
-
- stackOut = stackOut.next;
-
- yi += width;
- }
- }
-
- context.putImageData( imageData, top_x, top_y );
-
-};
-
-
-
-var BlurStack = function()
-{
- this.r = 0;
- this.g = 0;
- this.b = 0;
- this.a = 0;
- this.next = null;
-};
+/**
+ * @fileOverview HTML5 canvas image functions
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: canvasimages.js 591 2015-04-11 22:40:47Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ */
+
+/**
+ * Returns true if broswer supports canvas
+ * @return {Boolean} true if broswer supports canvas
+ */
+var __vboxIsCanvasSupported = null; // cached
+var isCanvasSupported = function(){
+ if(__vboxIsCanvasSupported === null) {
+ try {
+ var elem = document.createElement('canvas');
+ __vboxIsCanvasSupported = !!(elem && elem.getContext && elem.getContext('2d'));
+ } catch (err) {
+ __vboxIsCanvasSupported = false;
+ }
+ }
+ return __vboxIsCanvasSupported;
+};
+
+var __vboxPreviewCanvasCache = [];
+function vboxDrawPreviewCanvas(can, imageObj, text, width, height) {
+
+ var screenMargin = 7;
+ var margin = 10;
+
+ var resizeToImage = (imageObj && (imageObj.width == width));
+
+ // Height / width comes from direct image values
+ if(imageObj && resizeToImage) {
+
+ height = imageObj.height;
+ width = imageObj.width;
+
+ // Set height while maintaining aspect ratio
+ } else if (imageObj) {
+
+ height = imageObj.height * (width/imageObj.width);
+ }
+
+ // Margins are added to width
+ height += ((margin+screenMargin)*2);
+ width += ((margin+screenMargin)*2);
+
+ // Does canvas still exist?
+ // VM selection can change while this function is running
+ // in which case the canvas goes away
+ if(!can) return;
+
+ // Set canvas values
+ can.height = height;
+ can.width = width;
+
+ var ctx = can.getContext('2d');
+
+
+ // Clear the canvas
+ ctx.clearRect(0,0,width,height);
+
+ ctx.save();
+
+ // Draw and cache monitor image if it is not present
+ if(!__vboxPreviewCanvasCache[width+'x'+height]) {
+
+ var cachedCanvas = document.createElement('canvas');
+
+ cachedCanvas.width = width;
+ cachedCanvas.height = height;
+
+ var cachedCtx = cachedCanvas.getContext('2d');
+
+ cachedCtx.beginPath();
+ cachedCtx.strokeStyle = "#000000";
+ cachedCtx.lineWidth = 0.3;
+ cachedCtx.lineCap = 'butt';
+
+ cachedCtx.moveTo(margin*2,margin);
+
+ // top and top right
+ cachedCtx.lineTo(width-(margin*2), margin);
+ cachedCtx.arcTo(width-margin, margin, width-margin,margin*2, margin);
+
+ // Side and bottom right
+ cachedCtx.lineTo(width-margin, height-(margin*2));
+ cachedCtx.arcTo(width-margin, height-margin, width-(margin*2), height-margin, margin);
+
+ // bottom and bottom left
+ cachedCtx.lineTo(margin*2, height-margin);
+ cachedCtx.arcTo(margin, height-margin, margin, height-(margin*2), margin);
+
+ // Left line and top left
+ cachedCtx.lineTo(margin, margin*2);
+ cachedCtx.arcTo(margin, margin, margin * 2, margin, margin);
+
+ cachedCtx.closePath();
+ cachedCtx.save();
+ cachedCtx.shadowOffsetX = 5;
+ cachedCtx.shadowOffsetY = 5;
+ cachedCtx.shadowBlur = 4;
+ cachedCtx.shadowColor = "rgba(30, 30, 30, 0.2)";
+
+
+ var grad = cachedCtx.createLinearGradient(0, margin, 0, height);
+ grad.addColorStop(0, "rgb(200,200,200)");
+ grad.addColorStop(0.4, "rgb(100,100,100)");
+ grad.addColorStop(0.5, "rgb(66,66,66)");
+ grad.addColorStop(0.7, "rgb(100,100,100)");
+ grad.addColorStop(1, "rgb(200,200,200)");
+
+ cachedCtx.fillStyle = grad;
+
+ cachedCtx.fill();
+
+ // Redraw so that shadow is seen on all sides
+ cachedCtx.shadowOffsetX = -5;
+ cachedCtx.shadowOffsetY = -5;
+ cachedCtx.fill();
+ cachedCtx.restore();
+ cachedCtx.fillRect(margin+screenMargin,margin+screenMargin,width-(margin*2)-(screenMargin*2),height-(margin*2)-(screenMargin*2));
+ cachedCtx.stroke();
+ cachedCtx.restore();
+
+ var cvs = document.createElement('canvas');
+
+ /* Gloss */
+ var rectX = 0;
+ var rectY = 0;
+ var rectWidth = width-(margin+screenMargin)*2;
+ var rectHeight = height-(margin+screenMargin)*2;
+
+ cvs.width = rectWidth;
+ cvs.height = rectHeight;
+
+ var ctxBlur = cvs.getContext('2d');
+ ctxBlur.beginPath();
+ ctxBlur.lineWidth = 1;
+ ctxBlur.strokeStyle = "#000000";
+ ctxBlur.moveTo(rectX,rectY);
+ ctxBlur.lineTo(rectWidth, rectY);
+ ctxBlur.lineTo(rectWidth,rectHeight*1.0/3.0);
+ ctxBlur.bezierCurveTo(rectX+rectWidth / 2.0, rectY + rectHeight * 1.0/3.0,
+ rectX+rectWidth / 2.0, rectY + rectHeight * 2.0/3.0,
+ rectX, rectY + rectHeight * 2.0/3.0);
+ ctxBlur.closePath();
+ ctxBlur.fillStyle="rgba(255,255,255,0.3)";
+ ctxBlur.fill();
+
+ stackBlurCanvasRGBA( cvs, 0, 0, rectWidth, rectHeight, 17 );
+
+ ctx.drawImage(cvs, margin+screenMargin, margin+screenMargin, rectWidth, rectHeight);
+
+ __vboxPreviewCanvasCache[width+'x'+height] = {
+ 'monitor' : cachedCanvas,
+ 'gloss' : cvs
+ };
+
+ }
+
+ // Draw cached monitor canvas
+ ctx.drawImage(__vboxPreviewCanvasCache[width+'x'+height]['monitor'], 0, 0, width, height);
+
+ /* Screenshot */
+ if(imageObj) {
+
+ ctx.drawImage(imageObj, 0, 0, imageObj.width, imageObj.height, (margin+screenMargin), (margin+screenMargin), width-(margin*2)-(screenMargin*2),height-(margin*2)-(screenMargin*2));
+ }
+
+ // Draw cached gloss canvas
+ ctx.drawImage(__vboxPreviewCanvasCache[width+'x'+height]['gloss'], 0, 0, width, height);
+
+ /* Text */
+ if(!imageObj) {
+
+ txtCan = document.createElement('canvas');
+ txtCan.width = width-(margin+screenMargin)*2;
+ txtCan.height = height-(margin+screenMargin)*2;
+
+ fitTextToCanvas(txtCan, text, 18);
+
+ ctx.drawImage(txtCan, (margin+screenMargin), (margin+screenMargin));
+
+ }
+
+
+ return;
+}
+
+
+/* HELPERS */
+
+/**
+ * Fit text to a canvas element
+ *
+ * @author Ian Moore
+ */
+var fitTextToCanvas = function(can, text, fontSize) {
+
+ var lineHeightOffset = 1.4;
+ var lineHeight = fontSize * lineHeightOffset;
+ var minFontSize = 10;
+ var padding = 2;
+
+ var words = text.split(" ");
+
+ var maxWidth = can.width;
+ var maxHeight = can.height;
+ var context = can.getContext('2d');
+ context.moveTo(0,0);
+
+
+ var wrapTextLines = function() {
+
+ context.font = "bold " + fontSize + "pt Arial";
+
+ var line = '';
+ var lines = [];
+
+ for (var n = 0; n < words.length; n++) {
+
+ var testLine = line + (line.length ? ' ' : '') + words[n];
+
+ if((context.measureText(testLine).width + padding) > maxWidth) {
+
+ // Only one word is too big
+ if(testLine.indexOf(' ') == -1) {
+
+ if(fontSize > minFontSize) {
+ fontSize *= 0.9;
+ return wrapTextLines();
+ }
+ line = testLine;
+
+ } else {
+ lines[lines.length] = line;
+ line = words[n];
+ }
+
+ } else {
+
+ line = testLine;
+
+ }
+
+ }
+ if(line.length) {
+ if((context.measureText(line).width + padding) > maxWidth && fontSize > minFontSize) {
+ fontSize *= 0.9;
+ return wrapTextLines();
+ }
+ lines[lines.length] = line;
+ }
+ return lines;
+
+ };
+
+ // Initial wrap
+ lines = wrapTextLines();
+
+ // Since text will be aligned to the bottom, we subtract
+ // one lineheight addition because it will be off the
+ // visible canvas and should not be included in calculations
+ while(((lines.length * lineHeight)-(lineHeight-fontSize) > maxHeight) && fontSize > minFontSize) {
+ fontSize *= 0.9;
+ lines = wrapTextLines();
+ lineHeight = fontSize * lineHeightOffset;
+ }
+
+ context.fillStyle = "#ffffff";
+ context.textAlign = "center";
+ context.textBaseline = 'alphabetic';
+ context.strokeStyle = "#ff0000";
+
+ var totalHeight = Math.round((lines.length * lineHeight)-(lineHeight-fontSize));
+
+ for(var i = 0; i < lines.length; i++) {
+ /*
+ Uncomment to debug line heights
+
+ context.moveTo(0, (maxHeight/2)-(totalHeight/2)+(lineHeight*i));
+ context.lineTo(maxWidth, (maxHeight/2)-(totalHeight/2)+(lineHeight*i));
+ context.stroke();
+ context.moveTo(0, (maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight);
+ context.lineTo(maxWidth, (maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight);
+ context.stroke();
+ */
+ context.fillText(lines[i],(maxWidth/2),(maxHeight/2)-(totalHeight/2)+(lineHeight*i)+lineHeight-(lineHeight-fontSize));
+ }
+ return can;
+
+};
+
+/*
+
+StackBlur - a fast almost Gaussian Blur For Canvas
+
+Version: 0.5
+Author: Mario Klingemann
+Contact: mario@quasimondo.com
+Website: http://www.quasimondo.com/StackBlurForCanvas
+Twitter: @quasimondo
+
+In case you find this class useful - especially in commercial projects -
+I am not totally unhappy for a small donation to my PayPal account
+mario@quasimondo.de
+
+Or support me on flattr:
+https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript
+
+Copyright (c) 2010 Mario Klingemann
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+var mul_table = [
+ 512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,
+ 454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,
+ 482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,
+ 437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,
+ 497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,
+ 320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,
+ 446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,
+ 329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,
+ 505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,
+ 399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,
+ 324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,
+ 268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,
+ 451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,
+ 385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,
+ 332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,
+ 289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];
+
+
+var shg_table = [
+ 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
+ 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 ];
+
+var stackBlurCanvasRGBA = function( canvas, top_x, top_y, width, height, radius )
+{
+ if ( isNaN(radius) || radius < 1 ) return;
+ radius |= 0;
+
+ //var canvas = document.getElementById( id );
+ var context = canvas.getContext("2d");
+ var imageData;
+
+ try {
+ try {
+ imageData = context.getImageData( top_x, top_y, width, height );
+ } catch(e) {
+
+ // NOTE: this part is supposedly only needed if you want to work with local files
+ // so it might be okay to remove the whole try/catch block and just use
+ // imageData = context.getImageData( top_x, top_y, width, height );
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
+ imageData = context.getImageData( top_x, top_y, width, height );
+ } catch(e) {
+ alert("Cannot access local image");
+ throw new Error("unable to access local image data: " + e);
+ return;
+ }
+ }
+ } catch(e) {
+ alert("Cannot access image");
+ throw new Error("unable to access image data: " + e);
+ }
+
+ var pixels = imageData.data;
+
+ var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum,
+ r_out_sum, g_out_sum, b_out_sum, a_out_sum,
+ r_in_sum, g_in_sum, b_in_sum, a_in_sum,
+ pr, pg, pb, pa, rbs;
+
+ var div = radius + radius + 1;
+ var widthMinus1 = width - 1;
+ var heightMinus1 = height - 1;
+ var radiusPlus1 = radius + 1;
+ var sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2;
+
+ var stackStart = new BlurStack();
+ var stack = stackStart;
+ for ( i = 1; i < div; i++ )
+ {
+ stack = stack.next = new BlurStack();
+ if ( i == radiusPlus1 ) var stackEnd = stack;
+ }
+ stack.next = stackStart;
+ var stackIn = null;
+ var stackOut = null;
+
+ yw = yi = 0;
+
+ var mul_sum = mul_table[radius];
+ var shg_sum = shg_table[radius];
+
+ for ( y = 0; y < height; y++ )
+ {
+ r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;
+
+ r_out_sum = radiusPlus1 * ( pr = pixels[yi] );
+ g_out_sum = radiusPlus1 * ( pg = pixels[yi+1] );
+ b_out_sum = radiusPlus1 * ( pb = pixels[yi+2] );
+ a_out_sum = radiusPlus1 * ( pa = pixels[yi+3] );
+
+ r_sum += sumFactor * pr;
+ g_sum += sumFactor * pg;
+ b_sum += sumFactor * pb;
+ a_sum += sumFactor * pa;
+
+ stack = stackStart;
+
+ for( i = 0; i < radiusPlus1; i++ )
+ {
+ stack.r = pr;
+ stack.g = pg;
+ stack.b = pb;
+ stack.a = pa;
+ stack = stack.next;
+ }
+
+ for( i = 1; i < radiusPlus1; i++ )
+ {
+ p = yi + (( widthMinus1 < i ? widthMinus1 : i ) << 2 );
+ r_sum += ( stack.r = ( pr = pixels[p])) * ( rbs = radiusPlus1 - i );
+ g_sum += ( stack.g = ( pg = pixels[p+1])) * rbs;
+ b_sum += ( stack.b = ( pb = pixels[p+2])) * rbs;
+ a_sum += ( stack.a = ( pa = pixels[p+3])) * rbs;
+
+ r_in_sum += pr;
+ g_in_sum += pg;
+ b_in_sum += pb;
+ a_in_sum += pa;
+
+ stack = stack.next;
+ }
+
+
+ stackIn = stackStart;
+ stackOut = stackEnd;
+ for ( x = 0; x < width; x++ )
+ {
+ pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum;
+ if ( pa != 0 )
+ {
+ pa = 255 / pa;
+ pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa;
+ pixels[yi+1] = ((g_sum * mul_sum) >> shg_sum) * pa;
+ pixels[yi+2] = ((b_sum * mul_sum) >> shg_sum) * pa;
+ } else {
+ pixels[yi] = pixels[yi+1] = pixels[yi+2] = 0;
+ }
+
+ r_sum -= r_out_sum;
+ g_sum -= g_out_sum;
+ b_sum -= b_out_sum;
+ a_sum -= a_out_sum;
+
+ r_out_sum -= stackIn.r;
+ g_out_sum -= stackIn.g;
+ b_out_sum -= stackIn.b;
+ a_out_sum -= stackIn.a;
+
+ p = ( yw + ( ( p = x + radius + 1 ) < widthMinus1 ? p : widthMinus1 ) ) << 2;
+
+ r_in_sum += ( stackIn.r = pixels[p]);
+ g_in_sum += ( stackIn.g = pixels[p+1]);
+ b_in_sum += ( stackIn.b = pixels[p+2]);
+ a_in_sum += ( stackIn.a = pixels[p+3]);
+
+ r_sum += r_in_sum;
+ g_sum += g_in_sum;
+ b_sum += b_in_sum;
+ a_sum += a_in_sum;
+
+ stackIn = stackIn.next;
+
+ r_out_sum += ( pr = stackOut.r );
+ g_out_sum += ( pg = stackOut.g );
+ b_out_sum += ( pb = stackOut.b );
+ a_out_sum += ( pa = stackOut.a );
+
+ r_in_sum -= pr;
+ g_in_sum -= pg;
+ b_in_sum -= pb;
+ a_in_sum -= pa;
+
+ stackOut = stackOut.next;
+
+ yi += 4;
+ }
+ yw += width;
+ }
+
+
+ for ( x = 0; x < width; x++ )
+ {
+ g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;
+
+ yi = x << 2;
+ r_out_sum = radiusPlus1 * ( pr = pixels[yi]);
+ g_out_sum = radiusPlus1 * ( pg = pixels[yi+1]);
+ b_out_sum = radiusPlus1 * ( pb = pixels[yi+2]);
+ a_out_sum = radiusPlus1 * ( pa = pixels[yi+3]);
+
+ r_sum += sumFactor * pr;
+ g_sum += sumFactor * pg;
+ b_sum += sumFactor * pb;
+ a_sum += sumFactor * pa;
+
+ stack = stackStart;
+
+ for( i = 0; i < radiusPlus1; i++ )
+ {
+ stack.r = pr;
+ stack.g = pg;
+ stack.b = pb;
+ stack.a = pa;
+ stack = stack.next;
+ }
+
+ yp = width;
+
+ for( i = 1; i <= radius; i++ )
+ {
+ yi = ( yp + x ) << 2;
+
+ r_sum += ( stack.r = ( pr = pixels[yi])) * ( rbs = radiusPlus1 - i );
+ g_sum += ( stack.g = ( pg = pixels[yi+1])) * rbs;
+ b_sum += ( stack.b = ( pb = pixels[yi+2])) * rbs;
+ a_sum += ( stack.a = ( pa = pixels[yi+3])) * rbs;
+
+ r_in_sum += pr;
+ g_in_sum += pg;
+ b_in_sum += pb;
+ a_in_sum += pa;
+
+ stack = stack.next;
+
+ if( i < heightMinus1 )
+ {
+ yp += width;
+ }
+ }
+
+ yi = x;
+ stackIn = stackStart;
+ stackOut = stackEnd;
+ for ( y = 0; y < height; y++ )
+ {
+ p = yi << 2;
+ pixels[p+3] = pa = (a_sum * mul_sum) >> shg_sum;
+ if ( pa > 0 )
+ {
+ pa = 255 / pa;
+ pixels[p] = ((r_sum * mul_sum) >> shg_sum ) * pa;
+ pixels[p+1] = ((g_sum * mul_sum) >> shg_sum ) * pa;
+ pixels[p+2] = ((b_sum * mul_sum) >> shg_sum ) * pa;
+ } else {
+ pixels[p] = pixels[p+1] = pixels[p+2] = 0;
+ }
+
+ r_sum -= r_out_sum;
+ g_sum -= g_out_sum;
+ b_sum -= b_out_sum;
+ a_sum -= a_out_sum;
+
+ r_out_sum -= stackIn.r;
+ g_out_sum -= stackIn.g;
+ b_out_sum -= stackIn.b;
+ a_out_sum -= stackIn.a;
+
+ p = ( x + (( ( p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1 ) * width )) << 2;
+
+ r_sum += ( r_in_sum += ( stackIn.r = pixels[p]));
+ g_sum += ( g_in_sum += ( stackIn.g = pixels[p+1]));
+ b_sum += ( b_in_sum += ( stackIn.b = pixels[p+2]));
+ a_sum += ( a_in_sum += ( stackIn.a = pixels[p+3]));
+
+ stackIn = stackIn.next;
+
+ r_out_sum += ( pr = stackOut.r );
+ g_out_sum += ( pg = stackOut.g );
+ b_out_sum += ( pb = stackOut.b );
+ a_out_sum += ( pa = stackOut.a );
+
+ r_in_sum -= pr;
+ g_in_sum -= pg;
+ b_in_sum -= pb;
+ a_in_sum -= pa;
+
+ stackOut = stackOut.next;
+
+ yi += width;
+ }
+ }
+
+ context.putImageData( imageData, top_x, top_y );
+
+};
+
+
+
+var BlurStack = function()
+{
+ this.r = 0;
+ this.g = 0;
+ this.b = 0;
+ this.a = 0;
+ this.next = null;
+};
diff --git a/js/chooser.js b/js/chooser.js
index 41f24bc..1bfa27b 100644
--- a/js/chooser.js
+++ b/js/chooser.js
@@ -1,2451 +1,2451 @@
-/**
- *
- * @fileOverview Chooser (vm list) singleton. Provides vboxChooser
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: chooser.js 591 2015-04-11 22:40:47Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- *
- */
-
-/**
- * Chooser selection mode constants
- */
-var vboxSelectionModeNone = 0;
-var vboxSelectionModeSingleVM = 1;
-var vboxSelectionModeMultiVM = 2;
-var vboxSelectionModeSingleGroup = 3;
-
-
-/**
- * @namespace vboxChooser
- *
- * Draws machine selection chooser and controls selection list
- * @see js/eventlistener.js
- */
-var vboxChooser = {
-
- // VM list
- vms : {},
-
- // VM tool tip
- _vmToolTip : '<nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr>',
-
- // Anchor element
- _anchorid : null,
- _anchor : null,
-
- /* Internal list of all unique selected items */
- _selectedList : [],
-
- /* List of unique selected VMs */
- selectedVMs : [],
-
- /* Holds group definitions */
- _groupDefs : [],
-
- /* selection mode can be
-
- var vboxSelectionModeNone = 0,
- var vboxSelectionModeSingleVM = 1,
- var vboxSelectionModeMultiVM = 2,
- var vboxSelectionModeSingleGroup = 3,
- */
- selectionMode : vboxSelectionModeNone,
-
- /* Check phpVirtualBox version and VirtualBox
- * version compatibility.
- */
- _versionChecked : false,
-
- /* Some items are not editable while vmGroup
- * definitions are being written
- */
- _editable : true,
-
- /* Context menus */
- _vmContextMenuObj : null,
- _vmGroupContextMenuObj : null,
-
- /* Holds history of showing only single groups */
- _showOnlyGroupHistory : [],
-
- /* Group definition extra value key */
- _groupDefinitionKey : '',
-
- /* Whether chooser is in compact mode or not */
- _compact : false,
-
- /**
- * Set anchor id to draw to
- */
- setAnchorId : function(aid) {
- vboxChooser._anchorid = aid;
- vboxChooser._anchor = $('#'+aid);
-
- vboxChooser._anchor.html("<div id='vboxChooserSpinner' style='text-align: center'><div><img src='images/spinner.gif' /></div></div>");
-
- vboxChooser._anchor.hover(function(){
- $(this).addClass('vboxChooserDropTargetHoverRoot');
- },function() {
- $(this).removeClass('vboxChooserDropTargetHoverRoot');
- });
-
- $(window).resize(function(){
-
- // Get anchor id and add / remove class
- var w = parseInt($(vboxChooser._anchor).innerWidth());
- if(w < 120) {
- $(vboxChooser._anchor).addClass('vboxChooserMini');
- vboxChooser._compact = true;
- } else {
- $(vboxChooser._anchor).removeClass('vboxChooserMini');
- vboxChooser._compact = false;
- }
-
- vboxChooser._resizeElements(true);
-
- });
- },
-
- /**
- * Set context menus
- *
- */
- setContextMenu : function(target, menuitems) {
-
- switch(target) {
-
- // Group menu
- case 'group':
- 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({'name': vboxChooser._anchorid+'vms',
- 'menuItems': menuitems,
- 'language_context': 'UIActionPool'});
- vboxChooser._vmContextMenuObj.update();
- break;
-
- // Main list menu
- case 'anchor':
-
- var vboxChooserPaneMenu = new vboxMenu({'name': vboxChooser._anchorid+'Pane',
- 'menuItems': menuitems,
- 'language_context': 'UIActionPool'});
- $('#'+vboxChooser._anchorid).parent().contextMenu({
- menu: vboxChooserPaneMenu.menuId()
- },
- vboxChooserPaneMenu.menuClickCallback
- );
-
- break;
-
- default:
- vboxAlert('vboxChooser::setContextMenu: unknown context menu type (' + target + ')');
- }
- },
-
- /*
- * Return true if a selected VM is in the given state
- */
- isSelectedInState : function(state) {
-
- for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
- if(vboxVMStates['is'+state](vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[i])))
- return true;
- }
- return false;
-
- },
-
- /**
- * Return true if the passed VM is selected
- */
- isVMSelected : function(vmid) {
- return (jQuery.inArray(vmid,vboxChooser.selectedVMs) > -1);
- },
-
- /**
- * Return selected VM data in array
- */
- getSelectedVMsData : function() {
-
- var vms = [];
- for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
- vms[vms.length] = vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[i]);
- }
- return vms;
- },
-
- /**
- * Triggered when selection list has changed
- */
- selectionListChanged : function(selectionList) {
-
- if(!selectionList) selectionList = [];
-
- selectionMode = vboxSelectionModeNone;
-
- // Hold unique selected VMs
- var vmListUnique = {};
- for(var i = 0; i < selectionList.length; i++) {
- if(selectionList[i].type == 'group') {
- vboxChooser.getGroupElement(selectionList[i].groupPath, true).find('table.vboxChooserVM:not(.ui-draggable-dragging)').each(function(idx,elm){
- if(elm) {
- var vmid = $(elm).data('vmid');
- if(vmid)
- vmListUnique[vmid] = vmid;
- }
- });
- switch(selectionMode) {
- case vboxSelectionModeSingleGroup:
- case vboxSelectionModeSingleVM:
- selectionMode = vboxSelectionModeMultiVM;
- break;
- case vboxSelectionModeNone:
- selectionMode = vboxSelectionModeSingleGroup;
- }
- } else {
- switch(selectionMode) {
- case vboxSelectionModeNone:
- selectionMode = vboxSelectionModeSingleVM;
- break;
- default:
- selectionMode = vboxSelectionModeMultiVM;
- }
-
- vmListUnique[selectionList[i].id] = selectionList[i].id;
- }
- }
-
- // Change selection list
- var selectedVMs = [];
- for(var i in vmListUnique) {
- selectedVMs[selectedVMs.length] = i;
- }
-
- vboxChooser.selectedVMs = selectedVMs;
-
- // If there is only one unique vm selected,
- // selection mode becomes single VM if the
- // current selection mode is not singleGroup
- if(vboxChooser.selectedVMs.length == 1 && selectionMode != vboxSelectionModeSingleGroup)
- selectionMode = vboxSelectionModeSingleVM;
-
- vboxChooser.selectionMode = selectionMode;
-
- vboxChooser._selectedList = selectionList;
-
- $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
-
-
- },
-
- /**
- * Return the single selected VM's id if
- * only one vm is selected. Else null.
- */
- getSingleSelectedId : function() {
- if(vboxChooser.selectedVMs.length == 1) {
- return vboxChooser.selectedVMs[0];
- }
- return null;
- },
-
- /*
- * Return a single vm if only one is selected.
- * Else null.
- */
- getSingleSelected : function() {
- if(vboxChooser.selectedVMs.length == 1) {
- return vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[0]);
- }
- return null;
- },
-
- /*
- * Update list of VMs from data received
- * from ajax query
- */
- updateList : function(vmlist) {
-
- // We were stopped before the request returned data
- if(!vboxChooser._running) return;
-
-
- // No list? Something is wrong
- if(!vmlist) {
-
- phpVirtualBoxFailure();
-
- vboxChooser.stop();
- vboxChooser._anchor.children().remove();
- return;
- }
-
- // Remove spinner
- vboxChooser._anchor.children().remove();
-
- // Render host
- vboxChooser._anchor.append(vboxChooser.vmHTML(
- {
- 'id':'host',
- 'state':'Hosting',
- 'owner':'',
- 'name':$('#vboxPane').data('vboxConfig').name,
- 'OSTypeId':'VirtualBox_Host'
- }
- ));
-
- // Render root group
- vboxChooser._anchor.append(vboxChooser.groupHTML("/"));
-
- // Enforce VM ownership
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin) {
- vmlist = jQuery.grep(vmlist,function(vm,i){
- return (vm.owner == $('#vboxPane').data('vboxSession').user);
- });
- }
-
- var groups = [];
- // Each item in list
- for(var i = 0; i < vmlist.length; i++) {
- // Update
- vboxChooser.updateVMElement(vmlist[i], true);
- groups = groups.concat(vmlist[i].groups);
- }
-
- // Sort groups
- var groupsSorted = {};
- for(var i = 0; i < groups.length; i++) {
- if(groupsSorted[groups[i]]) continue;
- groupsSorted[groups[i]] = true;
- var gElm = vboxChooser.getGroupElement(groups[i], true);
- if(gElm[0]) vboxChooser.sortGroup(gElm);
- }
-
- // compose group definitions
- vboxChooser.composeGroupDef();
-
- // Set initial resize
- vboxChooser._initialResize = true;
- vboxChooser._resizeElements(true);
-
- },
-
- /*
- * Save collapsed group list
- */
- _collapsedGroups : [],
- _saveCollapsedGroups : function(){
-
- // Write out collapsed group list
- var cGroupList = [];
- vboxChooser._anchor.find('div.vboxVMGroupCollapsed:not(.ui-draggable-dragging)').each(function(idx,elm) {
- cGroupList[cGroupList.length] = $(elm).data('vmGroupPath');
- });
-
- var groupListKey = $('#vboxPane').data('vboxConfig').key+'-collapsedGroups';
- vboxSetLocalDataItem(groupListKey, cGroupList.join(','), true);
-
- // Cache instead of using local storage
- vboxChooser._collapsedGroups = cGroupList;
- },
-
- /*
- * Return true if group is collapsed
- */
- _isGroupCollapsed : function(gpath) {
- return(jQuery.inArray(gpath,vboxChooser._collapsedGroups) > -1);
- },
-
- /*
- * Resize group and VM titles
- */
- _scrollbarWidth : 0,
- _scrollbarWasVisible: false,
- _initialResize: false,
- _resizeElements : function(forceResize) {
-
- // Haven't completed our initial resizing yet
- if(!vboxChooser._initialResize) {
- return;
- }
-
- var sbVisible = (vboxChooser._anchor.get(0).scrollHeight > vboxChooser._anchor.height());
-
- // Nothing changed since resize
- if(!forceResize && (sbVisible == vboxChooser._scrollbarWasVisible)) {
- return;
- }
-
- vboxChooser._scrollbarWasVisible = sbVisible;
-
- var groupTitleWidth = vboxChooser._anchor.width() - (vboxChooser._compact ? 22 : 32) - (sbVisible ? vboxChooser._scrollbarWidth : 0);
- var vmTitleWidth = groupTitleWidth - (vboxChooser._compact ? -12 : 18); // (2px padding on .vboxChooserGroupVMs +
- // 2px border on table + 4px margin on icon) * 2
- var groupLevelOffset = (vboxChooser._compact ? 8 : 8); // (2px margin + 2px border) * 2
-
-
- // Now that we have sizes, we can inject styles
- $('#vboxChooserStyle').empty().remove();
-
- var styleRules = [];
- var path = ['div.vboxChooserGroupRootLevel'];
-
- // Special case for root level VM list
- styleRules[styleRules.length] = 'div.vboxChooserGroupRootLevel > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxFitToContainer { width: ' + vmTitleWidth + 'px; }';
-
- // Special case for group header when only showing one group
- styleRules[styleRules.length] = 'div.vboxChooserGroupShowOnly.vboxChooserGroupRootLevel > div.vboxChooserGroupHeader span.vboxChooserGroupName { max-width: ' + (groupTitleWidth - 4) + 'px; }';
-
- // Bottom group resize bars
- styleRules[styleRules.length] = 'div.vboxChooserGroupRootLevel > div.vboxChooserDropTargetBottom { width: ' + (groupTitleWidth) + 30 + 'px; }';
-
- for(var i = 1; i < 11; i++) {
-
- // Group titles at this level
- styleRules[styleRules.length] = path.join(' > ') + ' > div.vboxChooserGroup > div.vboxChooserGroupHeader span.vboxChooserGroupName { max-width: ' + (groupTitleWidth - (i*groupLevelOffset)) + 'px; }';
-
- // VM titles at this level
- styleRules[styleRules.length] = path.join(' > ') + ' > div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxFitToContainer { width: ' + (vmTitleWidth - (i*(groupLevelOffset))) + 'px; }';
-
- // Bottom group resize bars
- styleRules[styleRules.length] = path.join(' > ') +' > div.vboxChooserGroup > div.vboxChooserDropTargetBottom { width: ' + (groupTitleWidth + 30 - (i*groupLevelOffset)) + 'px; }';
-
- path[path.length] = 'div.vboxChooserGroup';
- }
-
- // Style for minified vmlist
- if(vboxChooser._compact) {
- // Title moves left
- styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxVMName { position: relative; left: -20px; }';
- // Icon moves down
- styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM img.vboxVMIcon { position: relative; top: 8px; }';
- // State text goes away
- styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM span.vboxVMState { display: none; }';
- // Less padding
- styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM td { padding: 0px; }';
- // Some group header items and drop targets go away
- styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupHeader > .vboxChooserGroupNameArrowCollapse, #' +vboxChooser._anchorid + ' div.vboxChooserGroup .vboxChooserDropTarget { display: none; }';
- styleRules[styleRules.length] = 'div.vboxChooserGroup { overflow: hidden; }';
- // host
- styleRules[styleRules.length] = '#vboxChooserVMHost .vboxVMState { display: none; }';
- // group header
- styleRules[styleRules.length] = 'div.vboxChooserGroup div.vboxChooserGroupHeader { height: auto; padding: 2px; }';
-
- }
- $('head').append('<style type="text/css" id="vboxChooserStyle">#'+vboxChooser._anchorid + ' ' + styleRules.join("\n#"+vboxChooser._anchorid + " ") + '</style>');
-
- },
-
- /*
- * Get group element by path
- */
- getGroupElement : function(gpath, noCreate) {
-
- if(!gpath) gpath = '/';
- var gnames = gpath.split('/');
- var groot = vboxChooser._anchor.children('div.vboxChooserGroup:not(.ui-draggable-dragging)');
- for(var i = 1; i < gnames.length; i++) {
-
- if(!gnames[i]) continue;
-
- var group = groot.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+gnames[i]+'"]').parent();
-
- // If it does not exist, create it
- if(!group[0]) {
-
- if(noCreate) return null;
-
- var gpath = '/';
- for(var a = 1; a <= i; a++) {
- gpath = gpath + '/' + gnames[a];
- }
- gpath = gpath.replace('//','/');
-
- vboxChooser.groupHTML(gpath).insertBefore(groot.children('div.vboxChooserGroupVMs'));
-
- vboxChooser.sortGroup(groot);
-
- // Resize chooser elements
- vboxChooser._initialResize = true;
- vboxChooser._resizeElements();
-
- groot = groot.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+gnames[i]+'"]').parent();
-
- } else {
- groot = group;
- }
-
- }
- return groot;
- },
-
- /*
- *
- * Update VM elements
- *
- */
- updateVMElement : function(vmUpdate, newVM) {
-
- // Not running.. don't do anything
- if(!vboxChooser._running) return;
-
- // Stale event after vm was removed
- if(!vmUpdate) return;
-
- // New VM
- if(newVM) {
-
- // New VM.. add it to groups..
- if(!vmUpdate.groups || vmUpdate.groups.length == 0)
- vmUpdate.groups = ['/'];
-
- for(var i = 0; i < vmUpdate.groups.length; i++) {
- var gElm = $(vboxChooser.getGroupElement(vmUpdate.groups[i]));
- vboxChooser.vmHTML(vmUpdate).appendTo(
- gElm.children('div.vboxChooserGroupVMs')
- );
- }
-
- // Existing VM. Replace existing elements
- } else {
-
- $('#'+vboxChooser._anchorid).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmUpdate.id).each(function(i,elm){
-
- var newHTML = vboxChooser.vmHTML(vmUpdate);
- if($(elm).hasClass('vboxListItemSelected')) {
- $(newHTML).addClass('vboxListItemSelected').removeClass('vboxHover');
- }
- $(elm).children().replaceWith(newHTML.children());
- });
-
- }
-
- },
-
-
- /*
- * Returns true if there are VMs with ID vmid that are not selected
- */
- vmHasUnselectedCopy : function (vmid) {
- return ($(vboxChooser._anchor).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid+':not(.vboxListItemSelected)').length > 0);
- },
-
- /*
- * Remove selected VMs from the list and rewrite group definitions
- * this assumes that there are other copies of these VMs that are not
- * selected.
- */
- removeVMs : function(vmids) {
-
- for(var i = 0; i < vmids.length; i++) {
- $(vboxChooser._anchor).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmids[i]+'.vboxListItemSelected').remove();
- }
-
- // Update selection list
- vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
- return (v.type == 'group' || (jQuery.inArray(v.id, vmids) == -1));
- });
-
- // Tell interface that selection list has changed
- vboxChooser.selectionListChanged(vboxChooser._selectedList);
-
- // compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
-
- // Possible resize needed
- vboxChooser._resizeElements(true);
-
- },
-
- /*
- * Generate HTML from VM definition
- */
- vmHTML : function (vmn) {
-
- var tbl = $('<table />').attr({'class':'vboxChooserItem-'+vboxChooser._anchorid+'-'+vmn.id + " vboxChooserVM"})
- .on('mousedown',vboxChooser.selectItem)
- .hoverClass('vboxHover').data('vmid',vmn.id);
-
-
- // Drag-and-drop functionality
- /////////////////////////////////
- if(vmn.id != 'host' && $('#vboxPane').data('vboxSession').admin) {
-
- $(tbl).draggable({'cursorAt':{left: -10, top: -10},'helper':function(){
- return $(this).clone().css({'width':($(this).width()+2)+'px','display':'inline','background':'#fff','border-color':'#69f'}).removeClass('vboxHover');
-
- // drag start
- },'start':function(e) {
-
- if(!vboxChooser._editable) return false;
-
- $(vboxChooser._anchor).disableSelection();
- vboxChooser._dragging = vmn.id;
- $(vboxChooser._anchor).find('table.vboxHover').removeClass('vboxHover');
-
- // drag stop
- },'stop':function(e) {
- vboxChooser.vmDropped(e, $(this));
- }});
- }
-
- // Functionality to drop above / below VM
- /////////////////////////////////////////////
- var td = $('<td />').attr({'colspan':'2'}).addClass('vboxChooserDropTarget vboxDropTargetTop');
- if(vmn.id != 'host') {
- td.hover(function(){
- if(vboxChooser._dragging && vboxChooser._dragging != vmn.id)
- $(this).addClass('vboxChooserDropTargetHover');
- },function(){
- $(this).removeClass('vboxChooserDropTargetHover');
- }
- );
- }
- $('<tr />').append(td).appendTo(tbl);
-
-
-
- // VM OS type icon
- var tr = $('<tr />');
- if($('#vboxPane').data('vboxConfig').enableCustomIcons && vmn.customIcon) {
- $('<td />').attr({'rowspan':'2'}).html("<img src='" + vmn.customIcon + "' class='vboxVMIcon' />").appendTo(tr);
- } else {
- $('<td />').attr({'rowspan':'2'}).html("<img src='images/vbox/" + vboxGuestOSTypeIcon(vmn.OSTypeId) + "' class='vboxVMIcon" + (vmn.id == 'host' ? " vboxHostIcon" : "") + "' />").appendTo(tr);
- }
-
-
- // VM Name
- var td = $('<td />').attr({'class':'vboxVMTitle'});
-
- // Host will have HTML in name and unique id
- if(vmn.id == 'host') {
-
- $(tbl).attr('id', 'vboxChooserVMHost');
-
- // Check for multiple server config
- if($('#vboxPane').data('vboxConfig').servers.length) {
-
- // If there are multiple servers configured, setup menu
- if(!$('#vboxServerMenu')[0]) {
- var servers = $('#vboxPane').data('vboxConfig').servers;
- var ul = $('<ul />').attr({'id':'vboxServerMenu','style':'display: none','class':'contextMenu'});
- for(var i = 0; i < servers.length; i++) {
- $('<li />').html("<a href='#" + $('<div />').html(servers[i].name).text() + "' style='background-image: url(images/vbox/OSE/VirtualBox_16px.png);'>"+$('<div />').html(servers[i].name).text()+"</a>").appendTo(ul);
- }
- $('#vboxPane').append(ul);
- }
-
- var span = $('<span />').attr({'class':'vboxServerLink'}).text('('+$('#vboxPane').data('vboxConfig').name+')').contextMenu({
- menu: 'vboxServerMenu',
- button: 0,
- mode: 'menu'
- },
- function(a) {
-
- if(a == $('#vboxPane').data('vboxConfig').name) return;
-
- // Show loading screen
- var l = new vboxLoader();
- l.showLoading();
-
- // Empty selection list
- vboxChooser.selectionListChanged();
-
-
- // Unsubscribe from events
- $.when(vboxEventListener.stop()).done(function() {
-
- // Expire data mediator data
- vboxVMDataMediator.expireAll();
-
- // Trigger host change
- vboxSetCookie("vboxServer",a);
- $('#vboxPane').trigger('hostChange',[a]);
-
- }).always(function(){
-
- // remove loading screen
- l.removeLoading();
-
- });
-
-
- }
- );
- $(td).html('<span class="vboxVMName">VirtualBox</span> ').append(span);
- } else {
- $(td).html('<span class="vboxVMName">VirtualBox</span> ('+vmn.name+')');
- }
-
- // Not rendering host
- } else {
-
- $(td).append('<div class="vboxFitToContainer vboxVMName"><span class="vboxVMName">'+$('<span />').text(vmn.name).html()+'</span>'+ (vmn.currentSnapshotName ? '<span class="vboxVMChooserSnapshotName"> (' + $('<span />').text(vmn.currentSnapshotName).html() + ')</span>' : '')+'</div>');
-
-
- // Table gets tool tips
- tip = trans(vboxChooser._vmToolTip, 'UIVMListView').replace('%1',('<b>'+$('<span />')
- .text(vmn.name).html()+'</b>'+(vmn.currentSnapshotName ? ' (' + $('<span />')
- .text(vmn.currentSnapshotName).html() + ')' : '')))
- .replace('%2',trans(vboxVMStates.convert(vmn.state),'VBoxGlobal'))
- .replace('%3',vboxDateTimeString(vmn.lastStateChange))
- .replace('%4',trans(vmn.sessionState,'VBoxGlobal').toLowerCase());
-
- $(tbl).tipped({'source':tip,'position':'mouse','delay':1500});
- }
-
- $(tr).append(td).appendTo(tbl);
-
- // VM state row
- var tr = $('<tr />');
- var td = $('<td />').attr({'class':(vmn.id != 'host' && vmn.sessionState != 'Unlocked' ? 'vboxVMSessionOpen' : '')});
-
- // Add VirtualBox version if hosting
- if(vmn.id == 'host') {
-
- $(td).html("<div class='vboxFitToContainer vboxVMState'><img src='images/vbox/" + vboxMachineStateIcon(vmn.state) +"' /><span class='vboxVMState'>" + trans(vboxVMStates.convert(vmn.state),'VBoxGlobal') + ' - ' + $('#vboxPane').data('vboxConfig').version.string+'</span></div>');
-
- // Check for version mismatches?
- if(!vboxChooser._versionChecked) {
- vboxChooser._versionChecked = true;
- var vStr = $('#vboxPane').data('vboxConfig').phpvboxver.substring(0,$('#vboxPane').data('vboxConfig').phpvboxver.indexOf('-'));
- var vers = $('#vboxPane').data('vboxConfig').version.string.replace('_OSE','').split('.');
- if(vers[0]+'.'+vers[1] != vStr) {
- vboxAlert('This version of phpVirtualBox ('+$('#vboxPane').data('vboxConfig').phpvboxver+') is incompatible with VirtualBox ' + $('#vboxPane').data('vboxConfig').version.string + ". You probably need to <a href='http://sourceforge.net/projects/phpvirtualbox/files/' target=_blank>download the latest phpVirtualBox " + vers[0]+'.'+vers[1] + "-x</a>.<p>See the Versioning section below the file list in the link for more information</p>",{'width':'auto'});
- }
- }
- } else {
- $(td).html("<div class='vboxFitToContainer vboxVMState'><img src='images/vbox/" + vboxMachineStateIcon(vmn.state) +"' /><span class='vboxVMState'>" + trans(vboxVMStates.convert(vmn.state),'VBoxGlobal') + '</span></div>');
- }
-
- $(tr).append(td).appendTo(tbl);
-
- // Droppable targets
- var td = $('<td />').attr({'colspan':'2'}).addClass('vboxChooserDropTarget vboxDropTargetBottom');
- if(vmn.id != 'host') {
- td.hover(function(){
- if(vboxChooser._dragging && vboxChooser._dragging != vmn.id)
- $(this).addClass('vboxChooserDropTargetHover');
- },function(){
- $(this).removeClass('vboxChooserDropTargetHover');
- }
- );
- }
- $('<tr />').addClass('vboxChooserDropTarget').css({'height':'4px'}).append(td).appendTo(tbl);
-
-
- // Context menus?
- if(vboxChooser._vmContextMenuObj) {
-
- $(tbl).contextMenu({
- menu: vboxChooser._vmContextMenuObj.menuId(),
- menusetup : function(el) {
- if(!$(el).hasClass('vboxListItemSelected')) $(el).trigger('click');
- }
- },function(act,el,pos,d,e){
- vboxChooser._vmContextMenuObj.menuClickCallback(act);
- });
-
- // Open settings on dblclick
- $(tbl).dblclick(function(){
- if(vboxChooser._vmContextMenuObj.menuItems['settings'].enabled())
- vboxChooser._vmContextMenuObj.menuItems['settings'].click();
- });
- }
-
- return tbl;
-
- },
-
-
- /*
- * VM Group Dropped
- */
- vmGroupDropped : function(e, droppedGroup) {
-
-
- $(vboxChooser._anchor).enableSelection();
-
-
- var vmGroupPath = vboxChooser._draggingGroup;
- vboxChooser._draggingGroup = false;
- $(droppedGroup).removeClass('vboxHover');
-
- if(!vboxChooser._editable) return false;
-
- // Cannot drag a group that contains a VM without
- // an unlocked session state if it will modify VM
- // Groups
- var sessionLocked = false;
- if($(droppedGroup).find('td.vboxVMSessionOpen')[0])
- sessionLocked=true;
-
-
- // Check for above/below group first
- var dropTarget = vboxChooser._anchor.find('div.vboxChooserDropTargetHover').first();
- if(dropTarget[0]) {
-
- // Make sure that this wasn't dropped onto a sub-group or itself
- if(
- !dropTarget.closest('div.vboxChooserGroup')[0]
- ||
- vmGroupPath == dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath')
- ||
- dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath').indexOf(vmGroupPath + '/') == 0
- ) {
- return;
- }
-
-
- // If we are not still in the same group, check for name conflict
- var currParentGroupPath = $(droppedGroup).closest('div.vboxChooserGroup').parent().closest('div.vboxChooserGroup').data('vmGroupPath');
-
- if(dropTarget.closest('div.vboxChooserGroup').parent().closest('div.vboxChooserGroup').data('vmGroupPath') != currParentGroupPath) {
-
- // Do not allow to be dragged into another group
- // if there is a Vm with a locked session in this one
- if(sessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
-
- // Make sure there are no conflicts
- var groupName = $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr('title');
- var newGroupName = groupName;
-
-
- var i = 2;
- while(vboxChooser.groupNameConflicts(dropTarget.closest('div.vboxChooserGroup').parent(), newGroupName)) {
- newGroupName = groupName + ' (' + (i++) + ')';
- }
-
- $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
- .siblings('div.vboxChooserGroupHeader')
- .children('span.vboxChooserGroupName').text(newGroupName);
-
- }
-
- // Insert before or insert after?
- if(dropTarget.hasClass('vboxDropTargetTop')) {
- $(droppedGroup).detach().insertBefore(dropTarget.closest('div.vboxChooserGroup'));
- } else {
- $(droppedGroup).detach().insertAfter(dropTarget.closest('div.vboxChooserGroup'));
- }
-
-
- // Dropped onto a group or main VM list
- } else {
-
- // Will not do this if this group contains
- // a VM with a locked session
- if(sessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
-
- var dropTarget = vboxChooser._anchor.find('div.vboxHover').first();
-
-
- // Dropped onto a group
- if(dropTarget[0] && dropTarget.parent().hasClass('vboxChooserGroup')) {
-
- dropTarget = dropTarget.parent();
-
- // Make sure that this wasn't dropped onto a sub-group or itself
- if(
- vmGroupPath == dropTarget.data('vmGroupPath')
- ||
- dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath').indexOf(vmGroupPath + '/') == 0
- ) {
- return;
- }
-
- // Dropped onto main vm list
- } else if($(vboxChooser._anchor).find('div.vboxGroupHover').length == 0 && $(vboxChooser._anchor).hasClass('vboxChooserDropTargetHoverRoot')) {
-
- dropTarget = null;
-
- // Only showing one group?
- if(vboxChooser._showOnlyGroupHistory.length > 0) {
- dropTarget = $(vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length-1]);
- }
-
- if(!$(dropTarget)[0])
- dropTarget = vboxChooser._anchor.children('div.vboxChooserGroup');
-
- } else {
- return;
- }
-
- // Make sure there are no conflicts
- var newElm = $(droppedGroup).detach();
- var groupName = $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr('title');
- var newGroupName = groupName;
-
- var i = 2;
- while(vboxChooser.groupNameConflicts(dropTarget, newGroupName, $(newElm).data('vmGroupPath'))) {
- newGroupName = groupName + ' (' + (i++) + ')';
- }
-
- $(newElm)
- .children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
- .siblings('div.vboxChooserGroupHeader')
- .children('span.vboxChooserGroupName').text(newGroupName);
- $(newElm).insertBefore(dropTarget.children('div.vboxChooserGroupVMs'));
-
- }
-
- // vmGroup dropped - compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
- // Hide group info
- vboxChooser._anchor.find('div.vboxChooserGroupHeader').trigger('mouseout');
-
- // Resize chooser elements
- vboxChooser._resizeElements();
-
- vboxChooser.selectionListChanged(vboxChooser._selectedList);
-
- },
-
- /*
- * VM dropped
- */
- vmDropped : function (e, droppedVM){
-
-
- $(vboxChooser._anchor).enableSelection();
- vboxChooser._dragging = null;
-
- if(!vboxChooser._editable) return false;
-
- // Cannot drag if this VM's session is not open
- var thisSessionLocked = false;
- var vmData = vboxVMDataMediator.getVMData($(droppedVM).data('vmid'));
-
- if(vmData.sessionState != 'Unlocked')
- thisSessionLocked = true;
-
-
-
- // Where was this dropped?
- var dropTarget = $('#'+vboxChooser._anchorid).find('td.vboxChooserDropTargetHover');
-
- // Dropped above / below a VM
- if(dropTarget[0]) {
-
- // Dropped from another group into this one,
- // but this group already has this VM
- if((dropTarget.closest('table').closest('div.vboxChooserGroup').data('vmGroupPath') != $(droppedVM).closest('div.vboxChooserGroup').data('vmGroupPath'))
- && dropTarget.closest('table').siblings('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
- return true;
- }
-
- // If session of this VM is locked, don't allow it to be
- // dragged out of current group
- if(thisSessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups'] && ($(droppedVM).closest('div.vboxChooserGroup').data('vmGroupPath') != dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath'))) {
- return
- }
-
- // Get VM from target's parent table
- if(dropTarget.hasClass('vboxDropTargetTop')) {
- if(!e.ctrlKey && !e.metaKey) {
- $(droppedVM).detach().insertBefore($(dropTarget).closest('table'));
- } else {
- // Copy
- if($(dropTarget).closest('table').parent().children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmData.id)[0])
- return;
- vboxChooser.vmHTML(vmData).insertBefore($(dropTarget).closest('table'));
- }
- } else {
- if(!e.ctrlKey && !e.metaKey) {
- $(droppedVM).detach().insertAfter($(dropTarget).closest('table'));
- } else {
- // Copy - Don't allow if it already exists
- if($(dropTarget).closest('table').parent().children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmData.id)[0])
- return;
- vboxChooser.vmHTML(vmData).insertAfter($(dropTarget).closest('table'));
- }
- }
-
- // Not dropped above / below vm
- } else {
-
- // Don't allow this if sessoin is locked
- if(thisSessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
-
- // Dropped ON a vm?
- dropTarget = $('#'+vboxChooser._anchorid).find('table.vboxHover:not(.ui-draggable-dragging)').first();
- if($(dropTarget).data('vmid')) {
-
- // Create a group?
- dropTarget = $('#'+vboxChooser._anchorid).find('table.vboxHover').first();
-
- // Nothing to do. Not dropped on valid target
- if(!dropTarget[0] || ($(dropTarget).data('vmid') == $(droppedVM).data('vmid'))) return true;
-
- // Dont' allow this if target VM's session is locked
- if($(dropTarget).find('td.vboxVMSessionOpen')[0])
- return;
-
- // Where to drop vboxChooser..
- var p = dropTarget.closest('div.vboxChooserGroup').children('div.vboxChooserGroupVMs');
- // assume root?
- if(!p[0]) p = vboxChooser._anchor.children('div.vboxChooserGroupVMs');
-
- // Determine group name
- var gname = trans('New group','UIGChooserModel');
- var tgname = gname;
-
- var i = 2;
- while(vboxChooser.groupNameConflicts($(p).parent(), tgname)) {
- tgname = gname + ' ' + (i++);
- }
-
-
- // New position is below target
- var ghtml = vboxChooser.groupHTML(String(dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath')+'/'+tgname).replace('//','/'));
-
- if(!e.ctrlKey && !e.metaKey) {
- ghtml.children('div.vboxChooserGroupVMs').append($(droppedVM).detach());
- } else {
- ghtml.children('div.vboxChooserGroupVMs').append(vboxChooser.vmHTML(vmData));
- }
- ghtml.children('div.vboxChooserGroupVMs').append(dropTarget.detach());
-
- ghtml.insertBefore(p);
-
- // Dropped in the main VM list or group header?
- } else {
-
- dropTarget = $(vboxChooser._anchor).find('div.vboxHover').first();
- if(dropTarget[0] && dropTarget.hasClass('vboxChooserGroupHeader')) {
-
- // Group already has this dragging VM?
- if(dropTarget.siblings('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
- return;
- }
-
- if(!e.ctrlKey && !e.metaKey)
- $(droppedVM).detach().appendTo(dropTarget.siblings('div.vboxChooserGroupVMs').first());
- else
- vboxChooser.vmHTML(vmData).appendTo(dropTarget.siblings('div.vboxChooserGroupVMs').first());
-
- // Main VM list
- } else if($(vboxChooser._anchor).find('div.vboxGroupHover').length == 0 && $(vboxChooser._anchor).hasClass('vboxChooserDropTargetHoverRoot')) {
-
- dropTarget = null;
-
- // Only showing one group?
- if(vboxChooser._showOnlyGroupHistory.length > 0) {
- dropTarget = $(vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length-1]);
- }
-
- if(!$(dropTarget)[0])
- dropTarget = vboxChooser._anchor.children('div.vboxChooserGroup');
-
- // Already in this list?
- if(dropTarget.children('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
- return true;
- }
-
- if(!e.ctrlKey && !e.metaKey) {
- $(droppedVM).detach().appendTo(dropTarget.children('div.vboxChooserGroupVMs').first());
- } else {
- vboxChooser.vmHTML(vmData).appendTo(dropTarget.children('div.vboxChooserGroupVMs').first());
- }
-
- }
- }
-
- }
-
- // vm dropped - compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
- // Resize chooser elements
- vboxChooser._resizeElements();
-
- vboxChooser.selectionListChanged(vboxChooser._selectedList);
-
- },
-
- /*
- * Group selected items into a new group
- */
- groupSelectedItems : function() {
-
- // Get all group paths to determine new group target
- var groupPaths = {};
- vboxChooser._anchor.find('div.vboxVMGroupSelected').closest('div.vboxChooserGroup').each(function(idx,elm) {
- groupPaths[$(elm).data('vmGroupPath')] = 1;
- });
- vboxChooser._anchor.find('table.vboxListItemSelected').closest('div.vboxChooserGroup').each(function(idx,elm) {
- groupPaths[$(elm).data('vmGroupPath')] = 1;
- });
-
- // The group clsest to the root group will be the target
- var groupPathTarget = null;
- for(var i in groupPaths) {
-
- if(typeof(i) != 'string') continue;
-
- // Already at root group. Nothing to do
- if(groupPathTarget == '/') break;
-
- // No target set yet or equal targets, or this group is the root
- if(!groupPathTarget || groupPathTarget == i || i == '/') {
- groupPathTarget = i;
- continue;
- }
-
- var t1 = groupPathTarget.split("/");
- var t2 = i.split("/");
- for(var i = 0; i < Math.min(t1.length,t2.length); i++) {
- if(t1[i] != t2[i]) {
- groupPathTarget = '';
- for(var a = 0; a < i; a++) {
- groupPathTarget += "/" + t1[a];
- }
- groupPathTarget = groupPathTarget.replace('//','/');
- break;
- }
- }
-
-
- }
-
- var target = vboxChooser.getGroupElement(groupPathTarget, true);
-
- if(!$(target)[0]) return;
-
- // Determine group name
- var gname = trans('New group','UIGChooserModel');
- var tgname = gname;
-
- var i = 2;
- while(vboxChooser.groupNameConflicts($(target), tgname)) {
- tgname = gname + ' ' + (i++);
- }
-
- var gHTML = vboxChooser.groupHTML('/'+tgname);
-
- // Append group and vm elements
- vboxChooser._anchor.find('div.vboxVMGroupSelected').detach().insertAfter(gHTML.children('div.vboxChooserGroupHeader'));
- vboxChooser._anchor.find('table.vboxListItemSelected').detach().appendTo(gHTML.children('div.vboxChooserGroupVMs'));
-
- gHTML.insertBefore($(target).children('div.vboxChooserGroupVMs'));
-
- // group selected items,
- // Compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
- // Resize chooser elements
- vboxChooser._resizeElements();
-
-
-
- },
-
- /**
- * Compose group data from GUI and optionally save it
- *
- * @param save - save group definitions to vbox
- */
- composeGroupDef : function(save) {
-
- var allGroups = [];
- var groupsResolved = false;
-
- // Keep looping through group definitions until
- // there are no groups removed
- while(!groupsResolved) {
-
- allGroups = [];
- groupsResolved = true;
-
- vboxChooser._anchor.find('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx,elm) {
-
- // Group element was removed
- if(!$(elm)[0]) return;
-
- // Compose group path
- var myPath = $(elm).children('div.vboxChooserGroupIdentifier').attr('title');
- if(!myPath) myPath = '/';
- $(elm).parents('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx2,elm2){
- var pName = $(elm2).children('div.vboxChooserGroupIdentifier').attr('title');
- if(!pName) pName = '/';
- myPath = String(pName + '/' + myPath).replace('//','/');
- });
-
- // Groups
- var gList = [];
- $(elm).children('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx2,elm2){
-
- // If this group is selected, we'll have to update its path
- // in the selection list
- var selected = $(elm2).hasClass('vboxVMGroupSelected');
- var oldPath = $(elm2).data('vmGroupPath');
- var newPath = String(myPath + '/' + $(elm2).children('div.vboxChooserGroupIdentifier').attr('title')).replace('//','/');
-
- gList[gList.length] = $(elm2).children('div.vboxChooserGroupIdentifier').attr('title');
-
- // set / correct group path data
- $(elm2).data('vmGroupPath', newPath);
-
- // Group's path changed?
- if(selected && (oldPath != newPath)) {
- for(var i = 0; i < vboxChooser._selectedList.length; i++) {
- if(vboxChooser._selectedList[i].type == 'group' && vboxChooser._selectedList[i].groupPath == oldPath) {
- vboxChooser._selectedList[i].groupPath = String(myPath + '/' + $(elm2).children('div.vboxChooserGroupIdentifier').attr('title')).replace('//','/');
- break;
- }
- }
- }
-
- });
-
- // VMs
- var vmList = [];
- $(elm).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM:not(.ui-draggable-dragging)').each(function(idx3,elm3){
- vmList[vmList.length] = $(elm3).data('vmid');
- });
-
- // Skip and remove if there are no VMs or subgroups
- // And it is not the parent group
- if(gList.length + vmList.length == 0 && !$(elm).hasClass('vboxChooserGroupRoot')) {
-
- // remove from selected list?
- if(elm && $(elm).hasClass('vboxVMGroupSelected')) {
-
- var myPath = $(elm).data('vmGroupPath');
- // Deselect item
- vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
- return (v.type != 'group' || (v.groupPath != myPath));
- });
- }
- $(elm).empty().remove();
- groupsResolved = false;
- return false;
- }
-
- // append to all groups list
- gorder = [];
- if(gList.length) gorder[0] = 'go='+gList.join(',go=');
- if(vmList.length) gorder[gorder.length] = 'm='+vmList.join(',m=');
- allGroups[allGroups.length] = {
- path: $(elm).data('vmGroupPath'),
- order: gorder.join(',')
- };
-
- // Update counts span
- $(elm).children('div.vboxChooserGroupVMs').css({'display':(vmList.length || $(elm).data('vmGroupPath') == '/' ? '' : 'none')})
- .siblings('div.vboxChooserGroupHeader')
- .each(function(hidx,header) {
-
- var staticTip = '<strong>'+$(header).siblings('div.vboxChooserGroupIdentifier').attr('title')+'</strong>'+
- (gList.length ? ('<br />' + trans('%n group(s)','UIGChooserItemGroup',gList.length).replace('%n',gList.length)) : '') +
- (vmList.length ? ('<br />' + trans('%n machine(s)','UIGChooserItemGroup',vmList.length).replace('%n',vmList.length)) : '');
-
- $(header).tipped({'source':function() {
-
- // find number of running VMs
- var runningVMs = 0;
-
- if(vmList.length) {
- $(header).siblings('div.vboxChooserGroupVMs').find('td.vboxVMSessionOpen').each(function(idx,elm3) {
- if(vboxVMStates.isRunning(vboxVMDataMediator.getVMData($(elm3).closest('table').data('vmid'))))
- runningVMs++;
- });
- }
-
- return staticTip + (runningVMs > 0 ? ' ' + trans('(%n running)','UIGChooserItemGroup',runningVMs).replace('%n', runningVMs) : '');
- }
- ,'position':'mouse','delay':1500});
- })
- .children('span.vboxChooserGroupInfo')
- .children('span.vboxChooserGroupCounts').html(
- (gList.length ? ('<span style="background-image:url(images/vbox/group_abstract_16px.png);" />'+gList.length) : '') +
- (vmList.length ? ('<span style="background-image:url(images/vbox/machine_abstract_16px.png);" />'+vmList.length) : '')
- );
- });
-
- }
-
- // Save GUI group definition?
- if(!save) return;
-
-
- // Tell the interface we're about to save groups
- vboxChooser._editable = false;
- $('#vboxPane').trigger('vmGroupDefsSaving');
-
- vboxChooser._groupDefs = allGroups;
-
- // Save machine groups and trigger change
- var vms = [];
- var vmList = vboxVMDataMediator.getVMList();
- for(var i = 0; i < vmList.length; i++) {
-
- if(!vmList[i] || vmList[i].id == 'host') continue;
-
- /* If a VM's groups have changed, add it to the list */
- var eGroups = vmList[i].groups;
- var nGroups = vboxChooser.getGroupsForVM(vmList[i].id);
-
- if($(nGroups).not(eGroups).length || $(eGroups).not(nGroups).length) {
-
- vms[vms.length] = {
- 'id' : vmList[i].id,
- 'groups' : nGroups
- };
- }
- }
-
- // Save machines groups?
- if(vms.length) {
-
- // Reload VMs and group definitions
- var reloadAll = function() {
-
- var ml = new vboxLoader();
- ml.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- ml.add('vboxGroupDefinitionsGet',function(d){vboxChooser._groupDefs = d.responseData;});
-
- // Reload VM list and group definitions, something went wrong
- ml.onLoad = function() {
-
- // Stop vmlist from refreshing..
- vboxChooser.stop();
-
- // reset selections
- $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
-
- // ask for new one
- vboxChooser.start();
- };
- ml.run();
- };
-
- $.when(vboxAjaxRequest('machinesSaveGroups',{'vms':vms})).done(function(res){
-
- if(res.responseData.errored) {
- reloadAll();
- vboxChooser._editable = true;
- $('#vboxPane').trigger('vmGroupDefsSaved');
- } else {
- $.when(vboxAjaxRequest('vboxGroupDefinitionsSet',{'groupDefinitions':allGroups})).always(function(){
- vboxChooser._editable = true;
- $('#vboxPane').trigger('vmGroupDefsSaved');
- });
- }
-
- }).fail(reloadAll);
-
- } else {
- $.when(vboxAjaxRequest('vboxGroupDefinitionsSet',{'groupDefinitions':allGroups})).always(function(){
- vboxChooser._editable = true;
- $('#vboxPane').trigger('vmGroupDefsSaved');
- });
- }
-
-
- return allGroups;
-
- },
-
- /*
- * Return a list of groups that VM is a member of
- */
- getGroupsForVM : function(vmid) {
- var gPathList = [];
- vboxChooser._anchor.find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid+':not(.ui-draggable-dragging)').each(function(idx,elm){
- var gParent = $(elm).closest('div.vboxChooserGroup');
- if(!gParent.hasClass('ui-draggable-dragging'))
- gPathList[gPathList.length] = gParent.data('vmGroupPath');
- });
- return gPathList;
- },
-
- /*
- * Determine whether or not a group name conflicts
- * with another group in parent
- */
- groupNameConflicts : function(parentGroup, name, ignoreGroupAtPath) {
- var found = false;
- parentGroup.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+name+'"]').parent().each(function(i,elm){
-
- if(ignoreGroupAtPath && (ignoreGroupAtPath == $(elm).data('vmGroupPath')))
- return true;
-
- found=true;
- return false;
- });
- return found;
- },
-
- /*
- * Ungroup selected group
- */
- unGroupSelectedGroup : function() {
-
- var target = $(vboxChooser.getSelectedGroupElements()[0]).siblings('div.vboxChooserGroupVMs');
-
- // Groups
- // - ignore group at path we are currently ungrouping
- var ignoreGroup = $(vboxChooser.getSelectedGroupElements()[0]).data('vmGroupPath');
- $(vboxChooser.getSelectedGroupElements()[0]).children('div.vboxChooserGroup').each(function(i,elm) {
-
- // Make sure there are no conflicts
- var newElm = $(elm).detach();
- var groupName = $(elm).children('div.vboxChooserGroupIdentifier').attr('title');
- var newGroupName = groupName;
-
- var i = 2;
- while(vboxChooser.groupNameConflicts($(target).parent(), newGroupName, ignoreGroup)) {
- newGroupName = groupName + ' (' + (i++) + ')';
- }
-
- $(newElm).children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
- .siblings('div.vboxChooserGroupHeader')
- .children('span.vboxChooserGroupName').text(newGroupName);
-
- $(newElm).insertBefore(target);
-
- });
-
- // VMs
- $(vboxChooser.getSelectedGroupElements()[0]).children('div.vboxChooserGroupVMs').children().each(function(i,elm){
- $(elm).detach();
- if(!target.children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(elm).data('vmid'))[0])
- target.append(elm);
- });
-
-
- // ungroup selected items
- // compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
- // Resize chooser elements
- vboxChooser._resizeElements();
-
- vboxChooser.selectionListChanged();
-
-
- },
-
- /*
- * Sort group sub-elements based on VirtualBox
- * group definitions
- */
- sortGroup : function(gElm) {
-
- // Find group orders
- var gPath = $(gElm).data('vmGroupPath');
- var groupList = vboxChooser._groupDefs;
-
- if(!(gPath && groupList)) return;
-
- var machineOrder = [];
- var groupOrder = [];
-
- // Get correct order
- for(var i = 0; i < groupList.length; i++) {
- if(groupList[i].path == gPath) {
- order = groupList[i].order.split(',');
- for(var a = 0; a < order.length; a++) {
- kv = order[a].split('=',2);
- if(kv[0] == 'm') machineOrder[machineOrder.length] = kv[1];
- else groupOrder[groupOrder.length] = kv[1];
- }
- }
- }
-
- // sort groups
- var groups = $(gElm).children('div.vboxChooserGroup').get();
- var maxPos = groups.length;
- groups.sort(function(a,b){
-
- var Pos1 = jQuery.inArray($(a).children('div.vboxChooserGroupIdentifier').attr('title'), groupOrder);
- var Pos2 = jQuery.inArray($(b).children('div.vboxChooserGroupIdentifier').attr('title'), groupOrder);
-
- if(Pos1==-1) Pos1 = maxPos;
- if(Pos2==-1) Pos2 = maxPos;
-
- return (Pos1 > Pos2 || Pos1 == -1 ? -1 : (Pos2 == Pos1 ? 0 : 1));
-
- });
- $.each(groups, function(idx,itm) {
- $(itm).insertAfter($(gElm).children('div.vboxChooserGroupHeader'));
- });
-
- // sort VMs
- var vms = $(gElm).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM').get();
- var maxPos = vms.length;
- vms.sort(function(a,b) {
-
- var Pos1 = jQuery.inArray($(a).data('vmid'), machineOrder);
- var Pos2 = jQuery.inArray($(b).data('vmid'), machineOrder);
-
- if(Pos1==-1) Pos1 = maxPos;
- if(Pos2==-1) Pos2 = maxPos;
-
- return (Pos1 > Pos2 ? 1 : (Pos2 == Pos1 ? 0 : -1));
-
- });
- $.each(vms, function(idx,itm) {
- $(gElm).children('div.vboxChooserGroupVMs').append(itm);
- });
-
-
- },
-
- /*
- * Sort selected group by item names
- */
- sortSelectedGroup : function(rootElm) {
-
- var el = $(vboxChooser.getSelectedGroupElements()[0]);
-
- if(rootElm || !el) {
- el = vboxChooser._anchor.children('div.vboxChooserGroup');
- }
-
- // sort groups
- var groups = $(el).children('div.vboxChooserGroup').get();
- groups.sort(function(a,b){
- return $(b).children('div.vboxChooserGroupIdentifier').attr('title').localeCompare($(a).children('div.vboxChooserGroupIdentifier').attr('title'));
- });
- $.each(groups, function(idx,itm) {
- $(itm).insertAfter($(el).children('div.vboxChooserGroupHeader'));
- });
-
- // sort VMs
- var vms = $(el).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM').get();
- vms.sort(function(a,b) {
- return $(a).find('span.vboxVMName').text().localeCompare($(b).find('span.vboxVMName').text());
- });
- $.each(vms, function(idx,itm) {
- $(el).children('div.vboxChooserGroupVMs').append(itm);
- });
-
- // compose and save group definitions
- vboxChooser.composeGroupDef(true);
-
- },
-
- /*
- * Rename selected group
- */
- renameSelectedGroup : function() {
-
- var el = $(vboxChooser.getSelectedGroupElements()[0]);
-
- // Function to rename group
- var renameGroup = function(e, textbox) {
-
- if(!textbox) textbox = $(this);
-
- var newName = $(textbox).val().replace(/[\\\/:*?"<>,]/g,'_');
-
- if(newName && newName != $(textbox).closest('div.vboxChooserGroup').children('div.vboxChooserGroupIdentifier').attr('title')) {
-
- // Do not rename if it conflicts
- var noConflict = newName;
- var i = 2;
- while(vboxChooser.groupNameConflicts($(textbox).parent().parent().parent().parent(), noConflict)) {
- noConflict = newName + ' (' + (i++) + ')';
- }
- newName = noConflict;
-
- $(textbox).closest('div.vboxChooserGroup')
- .children('div.vboxChooserGroupIdentifier').attr({'title':newName})
- .siblings('div.vboxChooserGroupHeader')
- .children('span.vboxChooserGroupName').html(newName);
-
- // group renamed, compose and save groups
- vboxChooser.composeGroupDef(true);
-
- // Write out collapsed group list
- vboxChooser._saveCollapsedGroups();
-
- }
-
-
- $(textbox).parent().parent().children().css({'display':''});
- $(textbox).parent().empty().remove();
- };
-
- $(el).children('div.vboxChooserGroupHeader').children().css({'display':'none'});
- $(el).children('div.vboxChooserGroupHeader').append(
-
- $('<form />').append(
- $('<input />').attr({'type':'text','value':$(el).children('div.vboxChooserGroupIdentifier').attr('title')}).css({'width':'90%','padding':'0px','margin':'0px'}).on('keypress',function(e){
- if (e.which == 13) {
- $(this).off('blur', renameGroup);
- renameGroup(e,this);
- e.stopPropagation();
- e.preventDefault();
- $(this).trigger('blur');
- return false;
- }
- })
- )
-
- );
- $(el).children('div.vboxChooserGroupHeader').children('form').children('input').focus().select().blur(renameGroup);
-
- },
-
- /*
- * Select a single group
- */
- _selectGroup : function(gelm) {
- $(gelm).addClass('vboxVMGroupSelected');
- },
-
- /*
- * Deselect a single group
- */
- _deselectGroup : function(gelm) {
-
- $(gelm).removeClass('vboxVMGroupSelected');
- },
-
- /*
- * Select (or unselect) an item in our list. Called onmousedown or onCLick
- */
- selectItem : function(e) {
-
- // Right click selects item if it is not selected
- if(e.which != 1) {
-
- // Right click on group header and group is selected
- // just return and show context menu
- if($(this).hasClass('vboxChooserGroupHeader') && $(this).parent().hasClass('vboxVMGroupSelected')) {
- return true;
-
- // Right click on VM and VM is already selected
- // just return and show context menu
- } else if($(this).hasClass('vboxListItemSelected')) {
- return true;
- }
- }
-
- var selectedList = [];
- var item = $(this);
-
-
- // Group?
- if($(item).hasClass('vboxChooserGroupHeader')) {
-
-
- // No control key. Exclusive selection
- if(!e.ctrlKey && !e.metaKey) {
-
- // already selected
- if(vboxChooser._selectedList.length == 1 && vboxChooser._selectedList[0].type == 'group' &&
- vboxChooser._selectedList[0].groupPath == $(item).parent().data('vmGroupPath'))
- return true;
-
- vboxChooser._anchor.find('.vboxListItemSelected').removeClass('vboxListItemSelected');
- vboxChooser._anchor.find('div.vboxVMGroupSelected')
- .each(function(idx,gelm) {
- vboxChooser._deselectGroup(gelm);
- });
-
-
-
- // select current group
- vboxChooser._selectGroup($(item).parent());
-
- selectedList = [{
- type: 'group',
- groupPath: $(item).parent().data('vmGroupPath')
- }];
-
- // Already selected, and ctrl key
- } else if($(item).parent().hasClass('vboxVMGroupSelected')){
-
- // Deselect item
- selectedList = vboxChooser._selectedList.filter(function(v){
- return (v.type != 'group' || (v.groupPath != $(item).parent().data('vmGroupPath')));
- });
-
- vboxChooser._deselectGroup($(item).parent());
-
- // Not already selected, and ctrl key
- } else {
-
- vboxChooser._selectGroup($(item).parent());
-
- selectedList = vboxChooser._selectedList;
-
- selectedList[selectedList.length] = {
- type: 'group',
- groupPath: $(item).parent().data('vmGroupPath')
- };
-
- }
-
-
- // VM
- } else {
-
- // No ctrl key or selection is host. Exclusive selection
- if((!e.ctrlKey && !e.metaKey) || $(item).data('vmid') == 'host') {
-
- vboxChooser._anchor.find('.vboxListItemSelected').removeClass('vboxListItemSelected');
- vboxChooser._anchor.find('div.vboxVMGroupSelected').removeClass('vboxVMGroupSelected')
- .each(function(idx,gelm){
- vboxChooser._deselectGroup(gelm);
- });
-
- // Select current VM
- $(item).addClass('vboxListItemSelected').removeClass('vboxHover');
-
- // already selected
- if(vboxChooser._selectedList.length == 1 && vboxChooser._selectedList[0].type == 'vm' &&
- vboxChooser._selectedList[0].id == $(item).data('vmid'))
- return true;
-
- selectedList = [{
- type: 'vm',
- id: $(item).data('vmid'),
- groupPath: $(item).parent().data('vmGroupPath')
- }];
-
- // Already selected, and ctrl key
- } else if($(item).hasClass('vboxListItemSelected')) {
-
- // Deselect item
- selectedList = vboxChooser._selectedList.filter(function(v){
- return (v.type == 'group' || (v.id != $(item).data('vmid')));
- });
-
- $(item).removeClass('vboxListItemSelected');
-
- // ctrl key, but not already selected
- } else {
-
- $(item).addClass('vboxListItemSelected').removeClass('vboxHover');
-
- selectedList = vboxChooser._selectedList;
-
- selectedList[selectedList.length] = {
- type: 'vm',
- id: $(item).data('vmid'),
- groupPath: $(item).parent().data('vmGroupPath')
- };
-
- }
-
- }
-
- // Remove host?
- if(selectedList.length > 1) {
-
- // Deselect host
- selectedList = selectedList.filter(function(v){
- return (v.type == 'group' || (v.id != 'host'));
- });
-
- vboxChooser._anchor.children('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').removeClass('vboxListItemSelected');
-
- }
-
- vboxChooser.selectionListChanged(selectedList);
-
- return true;
-
-
- },
-
- /*
- * Show only single group element identified by gelm
- */
- showOnlyGroupElm : function(gelm) {
-
- // Going backwards affects animations
- var back = false;
-
- // gelm is null if we're going backwards
- if(!gelm) {
-
-
- if(vboxChooser._showOnlyGroupHistory.length > 1) {
- // this gets rid of current
- vboxChooser._showOnlyGroupHistory.pop();
- // selects previous
- gelm = vboxChooser._showOnlyGroupHistory.pop();
- back = true;
- } else {
- gelm = null;
- }
-
-
- } else {
-
- // Hold history
- vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length] = gelm;
- }
-
-
- // No scrolling
- vboxChooser._anchor.css({'overflow-y':'hidden'});
-
- if($(gelm)[0]) {
-
-
- // Slide over or back
- $.when(vboxChooser._anchor.hide('slide', {direction: (back ? 'right' : 'left'), distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200)).always(function() {
-
-
- /* hide host when showing only a group */
- $('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').hide();
-
-
- /* Undo anything previously performed by this */
- vboxChooser._anchor.find('div.vboxChooserGroupHide').removeClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer');
- vboxChooser._anchor.find('div.vboxChooserGroupShowOnly').removeClass('vboxChooserGroupShowOnly');
-
- $(gelm).parents('div.vboxChooserGroup').addClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer').siblings().addClass('vboxChooserGroupHide');
-
- vboxChooser._anchor.find('div.vboxChooserGroupRootLevel').removeClass('vboxChooserGroupRootLevel');
- $(gelm).addClass('vboxChooserGroupShowOnly vboxChooserGroupRootLevel').siblings().addClass('vboxChooserGroupHide');
-
- $.when(vboxChooser._anchor.show('slide', {direction: (back ? 'left' : 'right'), distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200))
- .done(function(){
-
- // Restore scrolling
- vboxChooser._anchor.css({'overflow-y':'auto'});
-
- // Hide group info
- $(gelm).find('div.vboxChooserGroupHeader').trigger('mouseout');
-
- // Reset title sizes
- vboxChooser._resizeElements();
-
- // force redraw of these
- $(gelm).find('.vboxFitToContainer').css({'display':'none'}).css({'width':'','display':''});
-
-
- });
-
- });
-
- } else {
-
- vboxChooser._showOnlyGroupHistory = [];
-
- // Slide back to anchor
- $.when(vboxChooser._anchor.hide('slide', {direction: 'right', distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200)).always(function() {
-
- /* show host when going back to main list */
- $('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').show();
-
- vboxChooser._anchor.find('div.vboxChooserGroupHide').removeClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer');
- vboxChooser._anchor.find('div.vboxChooserGroupShowOnly').removeClass('vboxChooserGroupShowOnly ');
-
- vboxChooser._anchor.find('div.vboxChooserGroupRootLevel').removeClass('vboxChooserGroupRootLevel');
- vboxChooser._anchor.children('div.vboxChooserGroupRoot').addClass('vboxChooserGroupRootLevel');
-
- $.when(vboxChooser._anchor.show('slide', {direction: 'left', distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200))
- .done(function(){
-
- // Restore scrolling
- vboxChooser._anchor.css({'overflow-y':'auto'});
-
- // Hide group info
- vboxChooser._anchor.find('div.vboxChooserGroupHeader').trigger('mouseout');
-
- // Reset title sizes
- vboxChooser._resizeElements();
-
- // force redraw of these
- vboxChooser._anchor.find('.vboxFitToContainer').css({'display':'none','width':''}).css({'display':''});
- });
- });
- }
-
- },
-
- /*
- * Return HTML for group
- */
- groupHTML : function(gpath) {
-
- if(!gpath) gpath = '/';
- var first = gpath == '/';
- var gname = gpath.substring(gpath.lastIndexOf('/')+1);
- var collapsed = vboxChooser._isGroupCollapsed(gpath);
-
- var gHTML = $('<div />').append(
- $('<div />').addClass('vboxChooserGroupIdentifier').css({'display':'none'}).attr({'title':gname})
- ).append(
- $('<div />').addClass('vboxChooserGroupHeader').css({'display':(first ? 'none' : '')})
- .attr({'title':gname})
- .dblclick(function() {
-
- // Already collapsed?
- var collapsed = $(this).closest('div.vboxChooserGroup').hasClass('vboxVMGroupCollapsed');
-
- // Button rotation function
- var rotateButton = function(){return true;};
-
- var vboxArrowImage = $(this).find('span.vboxChooserGroupNameArrowCollapse');
-
- if(!($.browser.msie && $.browser.version.substring(0,1) < 9)) {
-
- rotateButton = function() {
-
- return $('<div />').animate({left:90},{
- duration: 300,
- step: function(currentStep) {
- if(!collapsed) currentStep = (90 - currentStep);
- vboxArrowImage.css({
- 'transform':'rotate('+currentStep+'deg)',
- '-moz-transform': 'rotate('+currentStep+'deg)',
- '-webkit-transform': 'rotate('+currentStep+'deg)',
- '-o-transform': 'rotate('+currentStep+'deg)',
- '-ms-transform': 'rotate('+currentStep+'deg)'
- });
- },
- queue: true,
- complete: function() {
- vboxArrowImage.css({
- 'transform':'',
- '-moz-transform': '',
- '-webkit-transform': '',
- '-o-transform': '',
- '-ms-transform': ''
- });
- }
-
- });
- };
- }
-
-
- // Run button rotation and toggle class
- $.when(rotateButton(), $(this).closest('div.vboxChooserGroup').toggleClass('vboxVMGroupCollapsed', ($.browser.msie && $.browser.version.substring(0,1) < 9) ? undefined : 300)).always(function(){
-
- // Write out collapsed group list
- vboxChooser._saveCollapsedGroups();
-
- // Reset title sizes
- vboxChooser._resizeElements();
- });
-
-
- })
- .append(
- $('<div />').addClass('vboxChooserDropTarget')
- .addClass('vboxDropTargetTop').hover(function(){
- if(vboxChooser._draggingGroup)
- $(this).addClass('vboxChooserDropTargetHover' + (first ? 'ignore' : ''));
- }, function(){
- $(this).removeClass('vboxChooserDropTargetHover');
- })
- )
- .append(
- $('<span />').addClass('vboxChooserGroupNameArrowLeft vboxChooserGroupNameArrowCollapse vboxArrowImage')
- .mousedown(function(e){
- e.stopPropagation();
- e.preventDefault();
- return false;
- }).mouseup(function(){
- $(this).closest('div.vboxChooserGroupHeader').trigger('dblclick');
- })
-
- ).append(
-
- $('<span />').addClass('vboxChooserGroupNameArrowLeft vboxChooserGroupShowOnlyBack vboxArrowImage')
- .click(function(e) {
- e.stopPropagation();
- e.preventDefault();
- vboxChooser.showOnlyGroupElm();
- return false;
-
- })
-
- )
- .append($('<span />').addClass('vboxChooserGroupInfo').html(
- "<span class='vboxChooserGroupCounts' />"
- ).append(
- $('<span />').addClass('vboxChooserGroupShowOnly vboxArrowImage')
- .click(function(e){
- e.stopPropagation();
- e.preventDefault();
- vboxChooser.showOnlyGroupElm($(this).closest('div.vboxChooserGroup'));
- return false;
- })
-
- ))
- .append($('<span />').html(gname).addClass('vboxChooserGroupName vboxFitToContainer'))
- .append(
- $('<div />').addClass('vboxChooserDropTarget vboxChooserDropTargetBottom')
- .hover(function(){
- if(vboxChooser._draggingGroup)
- $(this).addClass('vboxChooserDropTargetHover' + (first ? 'ignore' : ''));
- }, function(){
- $(this).removeClass('vboxChooserDropTargetHover');
- })
-
- )
- .hover(function(){
-
- if(vboxChooser._compact) return;
-
- $(this).addClass('vboxHover');
-
- // Resize title and add hover class?
- if(!$(this).parent().hasClass('vboxChooserGroupRoot')) {
-
- // Set width of title to -group info span width
- var infoWidth = $(this).children('span.vboxChooserGroupInfo').width();
- var pWidth = $(this).width();
-
- $(this).children('span.vboxChooserGroupName').css({'max-width':(pWidth-infoWidth-20)+'px'});
-
- }
-
-
- },function(){
-
- // Resize title and remove hover class
- $(this).removeClass('vboxHover');
-
- if(!$(this).parent().hasClass('vboxChooserGroupRoot'))
- $(this).children('span.vboxChooserGroupName').css({'max-width':''});
-
- }).on('mousedown',vboxChooser.selectItem)
-
- ).addClass((first ? 'vboxChooserGroupRoot vboxChooserGroupRootLevel ' : (collapsed ? 'vboxVMGroupCollapsed ' : '')) + 'vboxChooserGroup')
- .data({'vmGroupPath':gpath})
- .draggable({'cursorAt':{left: -10, top: -10},'helper':function(){
-
- return $(this).clone().addClass('vboxVMGroupCollapsed vboxVMGroupSelected')
- .children('div.vboxChooserGroupHeader').removeClass('vboxHover').children('.vboxChooserGroupNameArrowCollapse')
- .hide().closest('div.vboxChooserGroup').css({'width':$(this).width()+'px'});
-
-
- },'start':function() {
-
- if(!$('#vboxPane').data('vboxSession').admin) return false;
-
- if(!vboxChooser._editable) return false;
-
- vboxChooser._draggingGroup = $(this).data('vmGroupPath');
- $(vboxChooser._anchor).disableSelection();
-
- },'stop':function(e) {
- vboxChooser.vmGroupDropped(e,$(this));
-
- }}).append($('<div />').addClass('vboxChooserGroupVMs'));
-
-
- // Bottom drop target
- if(!first) {
- gHTML.hover(function(){
- $(this).addClass('vboxGroupHover'); }, function() {
- $(this).removeClass('vboxGroupHover');
- }).append(
- $('<div />').addClass('vboxChooserDropTarget vboxChooserDropTargetBottom')
- .hover(function(){
- if(vboxChooser._draggingGroup)
- $(this).addClass('vboxChooserDropTargetHover');
- }, function(){
- $(this).removeClass('vboxChooserDropTargetHover');
- })
- );
- }
-
-
-
- // Group context menu
- $(gHTML).contextMenu({
- menu: vboxChooser._vmGroupContextMenuObj.menuId(),
- menusetup: function(el) {
- $(el).children('div.vboxChooserGroupHeader').trigger('click');
- }
- },function(act,el,pos,d,e){
- vboxChooser._vmGroupContextMenuObj.menuClickCallback(act, el);
- });
-
- return gHTML;
-
-
-
- },
-
- /*
- * Return selected VM elements
- */
- getSelectedVMElements : function() {
- return vboxChooser._anchor.find('table.vboxSelected');
- },
-
- /*
- * Return selected group elements
- */
- getSelectedGroupElements : function() {
- return vboxChooser._anchor.find('div.vboxVMGroupSelected');
- },
-
-
- /*
- * Start VM list update
- */
- start : function(anchorid) {
-
- // already running?
- if(vboxChooser._running) return;
- vboxChooser._running = true;
-
- // Where are we drawn?
- if(anchorid) {
- vboxChooser._anchorid = anchorid;
- vboxChooser._anchor = $('#'+anchorid);
- }
-
-
- // Set group definition key
- vboxChooser._groupDefinitionKey = $('#vboxPane').data('vboxConfig')['groupDefinitionKey'];
-
- // Get collapsed group list
- vboxChooser._collapsedGroups = vboxGetLocalDataItem($('#vboxPane').data('vboxConfig').key+'-collapsedGroups', true);
- if(!vboxChooser._collapsedGroups) vboxChooser._collapsedGroups = [];
- else vboxChooser._collapsedGroups = vboxChooser._collapsedGroups.split(',');
-
-
- // Get groups and machine list. datamediator will start listener
- $.when(vboxAjaxRequest('vboxGroupDefinitionsGet')).done(function(g) {
-
- vboxChooser._groupDefs = g.responseData;
-
- $.when(vboxVMDataMediator.getVMList()).done(function(d) {
- vboxChooser.updateList(d);
- });
- });
-
- },
-
- /*
- * Stop VM list updates and clear list
- */
- stop : function() {
-
- if(!vboxChooser._running) return;
- vboxChooser._running = false;
-
- vboxChooser._anchor.html("<div id='vboxChooserSpinner' style='text-align: center'><div><img src='images/spinner.gif' /></div></div>");
-
- // reset vars
- vboxChooser._versionChecked = false;
- vboxChooser._selectedList = [];
- vboxChooser.selectedVMs = [];
- vboxChooser.selectionMode = vboxSelectionModeNone;
-
- }
-
-
-
-};
-
-$(document).ready(function(){
-
- // Calculate scrollbar width
- vboxChooser._scrollbarWidth = getScrollbarWidth();
-
- // "Stop" chooser
- $('#vboxPane').on('hostChange',function(){
-
- vboxChooser.stop();
-
- }).on('hostChanged',function(){
-
-
- vboxChooser.start();
-
- // Refresh menus
- }).on('vmGroupDefsSaving vmGroupDefsSaved vmSelectionListChanged', function() {
-
- if(vboxChooser._vmGroupContextMenuObj)
- vboxChooser._vmGroupContextMenuObj.update(vboxChooser);
- if(vboxChooser._vmContextMenuObj)
- vboxChooser._vmContextMenuObj.update(vboxChooser);
-
-
- // Event list queue
- }).on('vboxEvents',function(e, eventList) {
-
- var redrawVMs = [];
- var sortGroups = [];
- var groupsChanged = false;
- var selectedChanged = false;
- var resizeElements = false;
-
- for(var i = 0; i < eventList.length; i++) {
-
- switch(eventList[i].eventType) {
-
- ////////////////////////////////
- //
- // Machine data changed
- //
- ////////////////////////////////
- case 'OnMachineDataChanged':
-
- // Shorthand
- var vmid = eventList[i].machineId;
- var data = vboxVMDataMediator.getVMData(vmid);
-
- // Update VM in list
- if(data) {
-
- // Enforce VM ownership
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && data.owner != $('#vboxPane').data('vboxSession').user) {
- break;
- }
-
- redrawVMs[redrawVMs.length] = vmid;
-
- // Make sure VM has root group at least
- if(data.groups.length == 0) data.groups = ['/'];
-
- // Remove from groups if they have changed
- var currGroups = vboxChooser.getGroupsForVM(vmid);
- var groupDiff = $(currGroups).not(data.groups);
- groupsChanged = groupDiff.length;
- for(var a = 0; a < groupDiff.length; a++) {
-
- var gElm = vboxChooser.getGroupElement(groupDiff[a], false);
- if(!$(gElm)[0]) return;
-
- selectedChanged = (selectedChanged || $(gElm).children('div.vboxChooserGroupVMs').closest('div.vboxVMGroupSelected').length);
-
- $(gElm).children('div.vboxChooserGroupVMs')
- .children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+data.id).empty().remove();
-
- }
-
- // Add to other groups
- var groupDiff = $(data.groups).not(currGroups);
- groupsChanged = (groupsChanged || groupDiff.length);
- for(var a = 0; a < groupDiff.length; a++) {
-
- var gElm = vboxChooser.getGroupElement(groupDiff[a]);
-
- // Skip it if it is already there
- if($(gElm).children('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+data.id)[0])
- continue;
-
- $(gElm).children('div.vboxChooserGroupVMs')
- .append(
- vboxChooser.vmHTML(data)
- );
-
- selectedChanged = (selectedChanged || $(gElm).children('div.vboxChooserGroupVMs').closest('div.vboxVMGroupSelected').length);
-
- // Sort the group this machine was added to
- sortGroups = sortGroups.concat(data.groups);
-
- }
-
- resizeElements = (resizeElements || groupsChanged);
-
-
- }
-
- break;
-
- /////////////////////////////////
- //
- // Snapshot taken / deleted / restored
- //
- /////////////////////////////////
- case 'OnSnapshotDeleted':
- case 'OnSnapshotTaken':
- case 'OnSnapshotRestored':
- case 'OnSnapshotChanged':
- redrawVMs[redrawVMs.length] = eventList[i].machineId;
- break;
-
- /////////////////////////////////////
- //
- // Machine registered or unregistered
- //
- //////////////////////////////////////
- case 'OnMachineRegistered':
-
- // Shorthand
- var vmid = eventList[i].machineId;
-
- // Unregistered
- if(!eventList[i].registered) {
-
- var wasSelected = vboxChooser.isVMSelected(vmid);
-
- $('#'+vboxChooser._anchorid +' table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid).remove();
-
- groupsChanged = true;
-
- // See if VM was selected
- if(wasSelected) {
-
- selectedChanged = true;
-
- vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
- return (v.type == 'group' || (v.id != vmid));
- });
-
-
- }
-
- resizeElements = true;
-
-
- break;
-
- }
-
- // Registered
-
- // Enforce VM ownership
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && eventList[i].enrichmentData.owner != $('#vboxPane').data('vboxSession').user) {
- break;
- }
-
- // Add to list
- vboxChooser.updateVMElement(eventList[i].enrichmentData, true);
-
- resizeElements = true;
- break;
-
-
- ///////////////////////////////////
- //
- // Extra data changed
- //
- ////////////////////////////////////
- case 'OnExtraDataChanged':
-
- if(!eventList[i].machineId && eventList[i].key.indexOf(vboxChooser._groupDefinitionKey) === 0) {
-
- var path = eventList[i].key.substring(vboxChooser._groupDefinitionKey.length);
- if(!path) path = "/";
- var name = path.substring(path.lastIndexOf('/')+1);
- var vboxVMGroups = vboxChooser._groupDefs;
- var found = false;
-
- // No current group definitions?
- if(!vboxVMGroups) break;
-
- // Step through each group, comparing
- for(var a = 0; a < vboxVMGroups.length; a++) {
- if(vboxVMGroups[a].path == path) {
- // Sort this group if it is different
- if(vboxVMGroups[a].order != eventList[i].value)
- sortGroups[sortGroups.length] = path;
- found = true;
- vboxVMGroups[a] = {'path':path,'name':name,'order':eventList[i].value};
- break;
- }
- }
-
- // Add to group if not found
- if(!found) {
- vboxVMGroups[vboxVMGroups.length] = {'path':path,'name':name,'order':eventList[i].value};
- sortGroups[sortGroups.length] = path; // sort when added
- resizeElements = true;
- }
-
- } else {
-
- switch(eventList[i].key) {
-
- // redraw when custom icon changes
- case 'phpvb/icon':
- redrawVMs[redrawVMs.length] = eventList[i].machineId;
- break;
- }
- }
- break;
-
- ////////////////////////////////////////
- //
- // Session or state change gets redrawn
- //
- ///////////////////////////////////////
- case 'OnSessionStateChanged':
- case 'OnMachineStateChanged':
- redrawVMs[redrawVMs.length] = eventList[i].machineId;
- break;
-
- } // </ switch eventType >>
-
-
- } // </ for each event >
-
- // Now redraw each VM
- ///////////////////////////
- var redrawn = {};
- var updateMenus = false;
- for(var i = 0; i < redrawVMs.length; i++) {
-
- if(redrawn[redrawVMs[i]]) continue;
- redrawn[redrawVMs[i]] = true;
-
- vboxChooser.updateVMElement(vboxVMDataMediator.getVMData(redrawVMs[i]));
-
- // Update menus if the VM is selected
- updateMenus = (updateMenus || vboxChooser.isVMSelected(redrawVMs[i]));
-
- }
-
- // Sort groups
- var groupsSorted = {};
- for(var i = 0; i < sortGroups.length; i++) {
- if(groupsSorted[sortGroups[i]]) continue;
- groupsSorted[sortGroups[i]] = true;
- var gElm = $(vboxChooser.getGroupElement(sortGroups[i]),false);
- if(gElm[0])
- vboxChooser.sortGroup(gElm);
-
- }
-
- // Groups changed
- if(groupsChanged || sortGroups.length) {
- vboxChooser.composeGroupDef();
- }
-
-
- // update selection list
- if(selectedChanged) {
-
- vboxChooser.selectionListChanged(vboxChooser._selectedList);
-
- } else if(updateMenus) {
-
- if(vboxChooser._vmGroupContextMenuObj)
- vboxChooser._vmGroupContextMenuObj.update(vboxChooser);
-
-
- if(vboxChooser._vmContextMenuObj)
- vboxChooser._vmContextMenuObj.update(vboxChooser);
-
- }
-
- if(resizeElements) vboxChooser._resizeElements(true);
-
-
-
- });
-
-
-
+/**
+ *
+ * @fileOverview Chooser (vm list) singleton. Provides vboxChooser
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: chooser.js 591 2015-04-11 22:40:47Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ *
+ */
+
+/**
+ * Chooser selection mode constants
+ */
+var vboxSelectionModeNone = 0;
+var vboxSelectionModeSingleVM = 1;
+var vboxSelectionModeMultiVM = 2;
+var vboxSelectionModeSingleGroup = 3;
+
+
+/**
+ * @namespace vboxChooser
+ *
+ * Draws machine selection chooser and controls selection list
+ * @see js/eventlistener.js
+ */
+var vboxChooser = {
+
+ // VM list
+ vms : {},
+
+ // VM tool tip
+ _vmToolTip : '<nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr>',
+
+ // Anchor element
+ _anchorid : null,
+ _anchor : null,
+
+ /* Internal list of all unique selected items */
+ _selectedList : [],
+
+ /* List of unique selected VMs */
+ selectedVMs : [],
+
+ /* Holds group definitions */
+ _groupDefs : [],
+
+ /* selection mode can be
+
+ var vboxSelectionModeNone = 0,
+ var vboxSelectionModeSingleVM = 1,
+ var vboxSelectionModeMultiVM = 2,
+ var vboxSelectionModeSingleGroup = 3,
+ */
+ selectionMode : vboxSelectionModeNone,
+
+ /* Check phpVirtualBox version and VirtualBox
+ * version compatibility.
+ */
+ _versionChecked : false,
+
+ /* Some items are not editable while vmGroup
+ * definitions are being written
+ */
+ _editable : true,
+
+ /* Context menus */
+ _vmContextMenuObj : null,
+ _vmGroupContextMenuObj : null,
+
+ /* Holds history of showing only single groups */
+ _showOnlyGroupHistory : [],
+
+ /* Group definition extra value key */
+ _groupDefinitionKey : '',
+
+ /* Whether chooser is in compact mode or not */
+ _compact : false,
+
+ /**
+ * Set anchor id to draw to
+ */
+ setAnchorId : function(aid) {
+ vboxChooser._anchorid = aid;
+ vboxChooser._anchor = $('#'+aid);
+
+ vboxChooser._anchor.html("<div id='vboxChooserSpinner' style='text-align: center'><div><img src='images/spinner.gif' /></div></div>");
+
+ vboxChooser._anchor.hover(function(){
+ $(this).addClass('vboxChooserDropTargetHoverRoot');
+ },function() {
+ $(this).removeClass('vboxChooserDropTargetHoverRoot');
+ });
+
+ $(window).resize(function(){
+
+ // Get anchor id and add / remove class
+ var w = parseInt($(vboxChooser._anchor).innerWidth());
+ if(w < 120) {
+ $(vboxChooser._anchor).addClass('vboxChooserMini');
+ vboxChooser._compact = true;
+ } else {
+ $(vboxChooser._anchor).removeClass('vboxChooserMini');
+ vboxChooser._compact = false;
+ }
+
+ vboxChooser._resizeElements(true);
+
+ });
+ },
+
+ /**
+ * Set context menus
+ *
+ */
+ setContextMenu : function(target, menuitems) {
+
+ switch(target) {
+
+ // Group menu
+ case 'group':
+ 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({'name': vboxChooser._anchorid+'vms',
+ 'menuItems': menuitems,
+ 'language_context': 'UIActionPool'});
+ vboxChooser._vmContextMenuObj.update();
+ break;
+
+ // Main list menu
+ case 'anchor':
+
+ var vboxChooserPaneMenu = new vboxMenu({'name': vboxChooser._anchorid+'Pane',
+ 'menuItems': menuitems,
+ 'language_context': 'UIActionPool'});
+ $('#'+vboxChooser._anchorid).parent().contextMenu({
+ menu: vboxChooserPaneMenu.menuId()
+ },
+ vboxChooserPaneMenu.menuClickCallback
+ );
+
+ break;
+
+ default:
+ vboxAlert('vboxChooser::setContextMenu: unknown context menu type (' + target + ')');
+ }
+ },
+
+ /*
+ * Return true if a selected VM is in the given state
+ */
+ isSelectedInState : function(state) {
+
+ for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
+ if(vboxVMStates['is'+state](vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[i])))
+ return true;
+ }
+ return false;
+
+ },
+
+ /**
+ * Return true if the passed VM is selected
+ */
+ isVMSelected : function(vmid) {
+ return (jQuery.inArray(vmid,vboxChooser.selectedVMs) > -1);
+ },
+
+ /**
+ * Return selected VM data in array
+ */
+ getSelectedVMsData : function() {
+
+ var vms = [];
+ for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
+ vms[vms.length] = vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[i]);
+ }
+ return vms;
+ },
+
+ /**
+ * Triggered when selection list has changed
+ */
+ selectionListChanged : function(selectionList) {
+
+ if(!selectionList) selectionList = [];
+
+ selectionMode = vboxSelectionModeNone;
+
+ // Hold unique selected VMs
+ var vmListUnique = {};
+ for(var i = 0; i < selectionList.length; i++) {
+ if(selectionList[i].type == 'group') {
+ vboxChooser.getGroupElement(selectionList[i].groupPath, true).find('table.vboxChooserVM:not(.ui-draggable-dragging)').each(function(idx,elm){
+ if(elm) {
+ var vmid = $(elm).data('vmid');
+ if(vmid)
+ vmListUnique[vmid] = vmid;
+ }
+ });
+ switch(selectionMode) {
+ case vboxSelectionModeSingleGroup:
+ case vboxSelectionModeSingleVM:
+ selectionMode = vboxSelectionModeMultiVM;
+ break;
+ case vboxSelectionModeNone:
+ selectionMode = vboxSelectionModeSingleGroup;
+ }
+ } else {
+ switch(selectionMode) {
+ case vboxSelectionModeNone:
+ selectionMode = vboxSelectionModeSingleVM;
+ break;
+ default:
+ selectionMode = vboxSelectionModeMultiVM;
+ }
+
+ vmListUnique[selectionList[i].id] = selectionList[i].id;
+ }
+ }
+
+ // Change selection list
+ var selectedVMs = [];
+ for(var i in vmListUnique) {
+ selectedVMs[selectedVMs.length] = i;
+ }
+
+ vboxChooser.selectedVMs = selectedVMs;
+
+ // If there is only one unique vm selected,
+ // selection mode becomes single VM if the
+ // current selection mode is not singleGroup
+ if(vboxChooser.selectedVMs.length == 1 && selectionMode != vboxSelectionModeSingleGroup)
+ selectionMode = vboxSelectionModeSingleVM;
+
+ vboxChooser.selectionMode = selectionMode;
+
+ vboxChooser._selectedList = selectionList;
+
+ $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
+
+
+ },
+
+ /**
+ * Return the single selected VM's id if
+ * only one vm is selected. Else null.
+ */
+ getSingleSelectedId : function() {
+ if(vboxChooser.selectedVMs.length == 1) {
+ return vboxChooser.selectedVMs[0];
+ }
+ return null;
+ },
+
+ /*
+ * Return a single vm if only one is selected.
+ * Else null.
+ */
+ getSingleSelected : function() {
+ if(vboxChooser.selectedVMs.length == 1) {
+ return vboxVMDataMediator.getVMData(vboxChooser.selectedVMs[0]);
+ }
+ return null;
+ },
+
+ /*
+ * Update list of VMs from data received
+ * from ajax query
+ */
+ updateList : function(vmlist) {
+
+ // We were stopped before the request returned data
+ if(!vboxChooser._running) return;
+
+
+ // No list? Something is wrong
+ if(!vmlist) {
+
+ phpVirtualBoxFailure();
+
+ vboxChooser.stop();
+ vboxChooser._anchor.children().remove();
+ return;
+ }
+
+ // Remove spinner
+ vboxChooser._anchor.children().remove();
+
+ // Render host
+ vboxChooser._anchor.append(vboxChooser.vmHTML(
+ {
+ 'id':'host',
+ 'state':'Hosting',
+ 'owner':'',
+ 'name':$('#vboxPane').data('vboxConfig').name,
+ 'OSTypeId':'VirtualBox_Host'
+ }
+ ));
+
+ // Render root group
+ vboxChooser._anchor.append(vboxChooser.groupHTML("/"));
+
+ // Enforce VM ownership
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin) {
+ vmlist = jQuery.grep(vmlist,function(vm,i){
+ return (vm.owner == $('#vboxPane').data('vboxSession').user);
+ });
+ }
+
+ var groups = [];
+ // Each item in list
+ for(var i = 0; i < vmlist.length; i++) {
+ // Update
+ vboxChooser.updateVMElement(vmlist[i], true);
+ groups = groups.concat(vmlist[i].groups);
+ }
+
+ // Sort groups
+ var groupsSorted = {};
+ for(var i = 0; i < groups.length; i++) {
+ if(groupsSorted[groups[i]]) continue;
+ groupsSorted[groups[i]] = true;
+ var gElm = vboxChooser.getGroupElement(groups[i], true);
+ if(gElm[0]) vboxChooser.sortGroup(gElm);
+ }
+
+ // compose group definitions
+ vboxChooser.composeGroupDef();
+
+ // Set initial resize
+ vboxChooser._initialResize = true;
+ vboxChooser._resizeElements(true);
+
+ },
+
+ /*
+ * Save collapsed group list
+ */
+ _collapsedGroups : [],
+ _saveCollapsedGroups : function(){
+
+ // Write out collapsed group list
+ var cGroupList = [];
+ vboxChooser._anchor.find('div.vboxVMGroupCollapsed:not(.ui-draggable-dragging)').each(function(idx,elm) {
+ cGroupList[cGroupList.length] = $(elm).data('vmGroupPath');
+ });
+
+ var groupListKey = $('#vboxPane').data('vboxConfig').key+'-collapsedGroups';
+ vboxSetLocalDataItem(groupListKey, cGroupList.join(','), true);
+
+ // Cache instead of using local storage
+ vboxChooser._collapsedGroups = cGroupList;
+ },
+
+ /*
+ * Return true if group is collapsed
+ */
+ _isGroupCollapsed : function(gpath) {
+ return(jQuery.inArray(gpath,vboxChooser._collapsedGroups) > -1);
+ },
+
+ /*
+ * Resize group and VM titles
+ */
+ _scrollbarWidth : 0,
+ _scrollbarWasVisible: false,
+ _initialResize: false,
+ _resizeElements : function(forceResize) {
+
+ // Haven't completed our initial resizing yet
+ if(!vboxChooser._initialResize) {
+ return;
+ }
+
+ var sbVisible = (vboxChooser._anchor.get(0).scrollHeight > vboxChooser._anchor.height());
+
+ // Nothing changed since resize
+ if(!forceResize && (sbVisible == vboxChooser._scrollbarWasVisible)) {
+ return;
+ }
+
+ vboxChooser._scrollbarWasVisible = sbVisible;
+
+ var groupTitleWidth = vboxChooser._anchor.width() - (vboxChooser._compact ? 22 : 32) - (sbVisible ? vboxChooser._scrollbarWidth : 0);
+ var vmTitleWidth = groupTitleWidth - (vboxChooser._compact ? -12 : 18); // (2px padding on .vboxChooserGroupVMs +
+ // 2px border on table + 4px margin on icon) * 2
+ var groupLevelOffset = (vboxChooser._compact ? 8 : 8); // (2px margin + 2px border) * 2
+
+
+ // Now that we have sizes, we can inject styles
+ $('#vboxChooserStyle').empty().remove();
+
+ var styleRules = [];
+ var path = ['div.vboxChooserGroupRootLevel'];
+
+ // Special case for root level VM list
+ styleRules[styleRules.length] = 'div.vboxChooserGroupRootLevel > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxFitToContainer { width: ' + vmTitleWidth + 'px; }';
+
+ // Special case for group header when only showing one group
+ styleRules[styleRules.length] = 'div.vboxChooserGroupShowOnly.vboxChooserGroupRootLevel > div.vboxChooserGroupHeader span.vboxChooserGroupName { max-width: ' + (groupTitleWidth - 4) + 'px; }';
+
+ // Bottom group resize bars
+ styleRules[styleRules.length] = 'div.vboxChooserGroupRootLevel > div.vboxChooserDropTargetBottom { width: ' + (groupTitleWidth) + 30 + 'px; }';
+
+ for(var i = 1; i < 11; i++) {
+
+ // Group titles at this level
+ styleRules[styleRules.length] = path.join(' > ') + ' > div.vboxChooserGroup > div.vboxChooserGroupHeader span.vboxChooserGroupName { max-width: ' + (groupTitleWidth - (i*groupLevelOffset)) + 'px; }';
+
+ // VM titles at this level
+ styleRules[styleRules.length] = path.join(' > ') + ' > div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxFitToContainer { width: ' + (vmTitleWidth - (i*(groupLevelOffset))) + 'px; }';
+
+ // Bottom group resize bars
+ styleRules[styleRules.length] = path.join(' > ') +' > div.vboxChooserGroup > div.vboxChooserDropTargetBottom { width: ' + (groupTitleWidth + 30 - (i*groupLevelOffset)) + 'px; }';
+
+ path[path.length] = 'div.vboxChooserGroup';
+ }
+
+ // Style for minified vmlist
+ if(vboxChooser._compact) {
+ // Title moves left
+ styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM div.vboxVMName { position: relative; left: -20px; }';
+ // Icon moves down
+ styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM img.vboxVMIcon { position: relative; top: 8px; }';
+ // State text goes away
+ styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM span.vboxVMState { display: none; }';
+ // Less padding
+ styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupVMs table.vboxChooserVM td { padding: 0px; }';
+ // Some group header items and drop targets go away
+ styleRules[styleRules.length] = 'div.vboxChooserGroup > div.vboxChooserGroupHeader > .vboxChooserGroupNameArrowCollapse, #' +vboxChooser._anchorid + ' div.vboxChooserGroup .vboxChooserDropTarget { display: none; }';
+ styleRules[styleRules.length] = 'div.vboxChooserGroup { overflow: hidden; }';
+ // host
+ styleRules[styleRules.length] = '#vboxChooserVMHost .vboxVMState { display: none; }';
+ // group header
+ styleRules[styleRules.length] = 'div.vboxChooserGroup div.vboxChooserGroupHeader { height: auto; padding: 2px; }';
+
+ }
+ $('head').append('<style type="text/css" id="vboxChooserStyle">#'+vboxChooser._anchorid + ' ' + styleRules.join("\n#"+vboxChooser._anchorid + " ") + '</style>');
+
+ },
+
+ /*
+ * Get group element by path
+ */
+ getGroupElement : function(gpath, noCreate) {
+
+ if(!gpath) gpath = '/';
+ var gnames = gpath.split('/');
+ var groot = vboxChooser._anchor.children('div.vboxChooserGroup:not(.ui-draggable-dragging)');
+ for(var i = 1; i < gnames.length; i++) {
+
+ if(!gnames[i]) continue;
+
+ var group = groot.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+gnames[i]+'"]').parent();
+
+ // If it does not exist, create it
+ if(!group[0]) {
+
+ if(noCreate) return null;
+
+ var gpath = '/';
+ for(var a = 1; a <= i; a++) {
+ gpath = gpath + '/' + gnames[a];
+ }
+ gpath = gpath.replace('//','/');
+
+ vboxChooser.groupHTML(gpath).insertBefore(groot.children('div.vboxChooserGroupVMs'));
+
+ vboxChooser.sortGroup(groot);
+
+ // Resize chooser elements
+ vboxChooser._initialResize = true;
+ vboxChooser._resizeElements();
+
+ groot = groot.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+gnames[i]+'"]').parent();
+
+ } else {
+ groot = group;
+ }
+
+ }
+ return groot;
+ },
+
+ /*
+ *
+ * Update VM elements
+ *
+ */
+ updateVMElement : function(vmUpdate, newVM) {
+
+ // Not running.. don't do anything
+ if(!vboxChooser._running) return;
+
+ // Stale event after vm was removed
+ if(!vmUpdate) return;
+
+ // New VM
+ if(newVM) {
+
+ // New VM.. add it to groups..
+ if(!vmUpdate.groups || vmUpdate.groups.length == 0)
+ vmUpdate.groups = ['/'];
+
+ for(var i = 0; i < vmUpdate.groups.length; i++) {
+ var gElm = $(vboxChooser.getGroupElement(vmUpdate.groups[i]));
+ vboxChooser.vmHTML(vmUpdate).appendTo(
+ gElm.children('div.vboxChooserGroupVMs')
+ );
+ }
+
+ // Existing VM. Replace existing elements
+ } else {
+
+ $('#'+vboxChooser._anchorid).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmUpdate.id).each(function(i,elm){
+
+ var newHTML = vboxChooser.vmHTML(vmUpdate);
+ if($(elm).hasClass('vboxListItemSelected')) {
+ $(newHTML).addClass('vboxListItemSelected').removeClass('vboxHover');
+ }
+ $(elm).children().replaceWith(newHTML.children());
+ });
+
+ }
+
+ },
+
+
+ /*
+ * Returns true if there are VMs with ID vmid that are not selected
+ */
+ vmHasUnselectedCopy : function (vmid) {
+ return ($(vboxChooser._anchor).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid+':not(.vboxListItemSelected)').length > 0);
+ },
+
+ /*
+ * Remove selected VMs from the list and rewrite group definitions
+ * this assumes that there are other copies of these VMs that are not
+ * selected.
+ */
+ removeVMs : function(vmids) {
+
+ for(var i = 0; i < vmids.length; i++) {
+ $(vboxChooser._anchor).find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmids[i]+'.vboxListItemSelected').remove();
+ }
+
+ // Update selection list
+ vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
+ return (v.type == 'group' || (jQuery.inArray(v.id, vmids) == -1));
+ });
+
+ // Tell interface that selection list has changed
+ vboxChooser.selectionListChanged(vboxChooser._selectedList);
+
+ // compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+
+ // Possible resize needed
+ vboxChooser._resizeElements(true);
+
+ },
+
+ /*
+ * Generate HTML from VM definition
+ */
+ vmHTML : function (vmn) {
+
+ var tbl = $('<table />').attr({'class':'vboxChooserItem-'+vboxChooser._anchorid+'-'+vmn.id + " vboxChooserVM"})
+ .on('mousedown',vboxChooser.selectItem)
+ .hoverClass('vboxHover').data('vmid',vmn.id);
+
+
+ // Drag-and-drop functionality
+ /////////////////////////////////
+ if(vmn.id != 'host' && $('#vboxPane').data('vboxSession').admin) {
+
+ $(tbl).draggable({'cursorAt':{left: -10, top: -10},'helper':function(){
+ return $(this).clone().css({'width':($(this).width()+2)+'px','display':'inline','background':'#fff','border-color':'#69f'}).removeClass('vboxHover');
+
+ // drag start
+ },'start':function(e) {
+
+ if(!vboxChooser._editable) return false;
+
+ $(vboxChooser._anchor).disableSelection();
+ vboxChooser._dragging = vmn.id;
+ $(vboxChooser._anchor).find('table.vboxHover').removeClass('vboxHover');
+
+ // drag stop
+ },'stop':function(e) {
+ vboxChooser.vmDropped(e, $(this));
+ }});
+ }
+
+ // Functionality to drop above / below VM
+ /////////////////////////////////////////////
+ var td = $('<td />').attr({'colspan':'2'}).addClass('vboxChooserDropTarget vboxDropTargetTop');
+ if(vmn.id != 'host') {
+ td.hover(function(){
+ if(vboxChooser._dragging && vboxChooser._dragging != vmn.id)
+ $(this).addClass('vboxChooserDropTargetHover');
+ },function(){
+ $(this).removeClass('vboxChooserDropTargetHover');
+ }
+ );
+ }
+ $('<tr />').append(td).appendTo(tbl);
+
+
+
+ // VM OS type icon
+ var tr = $('<tr />');
+ if($('#vboxPane').data('vboxConfig').enableCustomIcons && vmn.customIcon) {
+ $('<td />').attr({'rowspan':'2'}).html("<img src='" + vmn.customIcon + "' class='vboxVMIcon' />").appendTo(tr);
+ } else {
+ $('<td />').attr({'rowspan':'2'}).html("<img src='images/vbox/" + vboxGuestOSTypeIcon(vmn.OSTypeId) + "' class='vboxVMIcon" + (vmn.id == 'host' ? " vboxHostIcon" : "") + "' />").appendTo(tr);
+ }
+
+
+ // VM Name
+ var td = $('<td />').attr({'class':'vboxVMTitle'});
+
+ // Host will have HTML in name and unique id
+ if(vmn.id == 'host') {
+
+ $(tbl).attr('id', 'vboxChooserVMHost');
+
+ // Check for multiple server config
+ if($('#vboxPane').data('vboxConfig').servers.length) {
+
+ // If there are multiple servers configured, setup menu
+ if(!$('#vboxServerMenu')[0]) {
+ var servers = $('#vboxPane').data('vboxConfig').servers;
+ var ul = $('<ul />').attr({'id':'vboxServerMenu','style':'display: none','class':'contextMenu'});
+ for(var i = 0; i < servers.length; i++) {
+ $('<li />').html("<a href='#" + $('<div />').html(servers[i].name).text() + "' style='background-image: url(images/vbox/OSE/VirtualBox_16px.png);'>"+$('<div />').html(servers[i].name).text()+"</a>").appendTo(ul);
+ }
+ $('#vboxPane').append(ul);
+ }
+
+ var span = $('<span />').attr({'class':'vboxServerLink'}).text('('+$('#vboxPane').data('vboxConfig').name+')').contextMenu({
+ menu: 'vboxServerMenu',
+ button: 0,
+ mode: 'menu'
+ },
+ function(a) {
+
+ if(a == $('#vboxPane').data('vboxConfig').name) return;
+
+ // Show loading screen
+ var l = new vboxLoader();
+ l.showLoading();
+
+ // Empty selection list
+ vboxChooser.selectionListChanged();
+
+
+ // Unsubscribe from events
+ $.when(vboxEventListener.stop()).done(function() {
+
+ // Expire data mediator data
+ vboxVMDataMediator.expireAll();
+
+ // Trigger host change
+ vboxSetCookie("vboxServer",a);
+ $('#vboxPane').trigger('hostChange',[a]);
+
+ }).always(function(){
+
+ // remove loading screen
+ l.removeLoading();
+
+ });
+
+
+ }
+ );
+ $(td).html('<span class="vboxVMName">VirtualBox</span> ').append(span);
+ } else {
+ $(td).html('<span class="vboxVMName">VirtualBox</span> ('+vmn.name+')');
+ }
+
+ // Not rendering host
+ } else {
+
+ $(td).append('<div class="vboxFitToContainer vboxVMName"><span class="vboxVMName">'+$('<span />').text(vmn.name).html()+'</span>'+ (vmn.currentSnapshotName ? '<span class="vboxVMChooserSnapshotName"> (' + $('<span />').text(vmn.currentSnapshotName).html() + ')</span>' : '')+'</div>');
+
+
+ // Table gets tool tips
+ tip = trans(vboxChooser._vmToolTip, 'UIVMListView').replace('%1',('<b>'+$('<span />')
+ .text(vmn.name).html()+'</b>'+(vmn.currentSnapshotName ? ' (' + $('<span />')
+ .text(vmn.currentSnapshotName).html() + ')' : '')))
+ .replace('%2',trans(vboxVMStates.convert(vmn.state),'VBoxGlobal'))
+ .replace('%3',vboxDateTimeString(vmn.lastStateChange))
+ .replace('%4',trans(vmn.sessionState,'VBoxGlobal').toLowerCase());
+
+ $(tbl).tipped({'source':tip,'position':'mouse','delay':1500});
+ }
+
+ $(tr).append(td).appendTo(tbl);
+
+ // VM state row
+ var tr = $('<tr />');
+ var td = $('<td />').attr({'class':(vmn.id != 'host' && vmn.sessionState != 'Unlocked' ? 'vboxVMSessionOpen' : '')});
+
+ // Add VirtualBox version if hosting
+ if(vmn.id == 'host') {
+
+ $(td).html("<div class='vboxFitToContainer vboxVMState'><img src='images/vbox/" + vboxMachineStateIcon(vmn.state) +"' /><span class='vboxVMState'>" + trans(vboxVMStates.convert(vmn.state),'VBoxGlobal') + ' - ' + $('#vboxPane').data('vboxConfig').version.string+'</span></div>');
+
+ // Check for version mismatches?
+ if(!vboxChooser._versionChecked) {
+ vboxChooser._versionChecked = true;
+ var vStr = $('#vboxPane').data('vboxConfig').phpvboxver.substring(0,$('#vboxPane').data('vboxConfig').phpvboxver.indexOf('-'));
+ var vers = $('#vboxPane').data('vboxConfig').version.string.replace('_OSE','').split('.');
+ if(vers[0]+'.'+vers[1] != vStr) {
+ vboxAlert('This version of phpVirtualBox ('+$('#vboxPane').data('vboxConfig').phpvboxver+') is incompatible with VirtualBox ' + $('#vboxPane').data('vboxConfig').version.string + ". You probably need to <a href='http://sourceforge.net/projects/phpvirtualbox/files/' target=_blank>download the latest phpVirtualBox " + vers[0]+'.'+vers[1] + "-x</a>.<p>See the Versioning section below the file list in the link for more information</p>",{'width':'auto'});
+ }
+ }
+ } else {
+ $(td).html("<div class='vboxFitToContainer vboxVMState'><img src='images/vbox/" + vboxMachineStateIcon(vmn.state) +"' /><span class='vboxVMState'>" + trans(vboxVMStates.convert(vmn.state),'VBoxGlobal') + '</span></div>');
+ }
+
+ $(tr).append(td).appendTo(tbl);
+
+ // Droppable targets
+ var td = $('<td />').attr({'colspan':'2'}).addClass('vboxChooserDropTarget vboxDropTargetBottom');
+ if(vmn.id != 'host') {
+ td.hover(function(){
+ if(vboxChooser._dragging && vboxChooser._dragging != vmn.id)
+ $(this).addClass('vboxChooserDropTargetHover');
+ },function(){
+ $(this).removeClass('vboxChooserDropTargetHover');
+ }
+ );
+ }
+ $('<tr />').addClass('vboxChooserDropTarget').css({'height':'4px'}).append(td).appendTo(tbl);
+
+
+ // Context menus?
+ if(vboxChooser._vmContextMenuObj) {
+
+ $(tbl).contextMenu({
+ menu: vboxChooser._vmContextMenuObj.menuId(),
+ menusetup : function(el) {
+ if(!$(el).hasClass('vboxListItemSelected')) $(el).trigger('click');
+ }
+ },function(act,el,pos,d,e){
+ vboxChooser._vmContextMenuObj.menuClickCallback(act);
+ });
+
+ // Open settings on dblclick
+ $(tbl).dblclick(function(){
+ if(vboxChooser._vmContextMenuObj.menuItems['settings'].enabled())
+ vboxChooser._vmContextMenuObj.menuItems['settings'].click();
+ });
+ }
+
+ return tbl;
+
+ },
+
+
+ /*
+ * VM Group Dropped
+ */
+ vmGroupDropped : function(e, droppedGroup) {
+
+
+ $(vboxChooser._anchor).enableSelection();
+
+
+ var vmGroupPath = vboxChooser._draggingGroup;
+ vboxChooser._draggingGroup = false;
+ $(droppedGroup).removeClass('vboxHover');
+
+ if(!vboxChooser._editable) return false;
+
+ // Cannot drag a group that contains a VM without
+ // an unlocked session state if it will modify VM
+ // Groups
+ var sessionLocked = false;
+ if($(droppedGroup).find('td.vboxVMSessionOpen')[0])
+ sessionLocked=true;
+
+
+ // Check for above/below group first
+ var dropTarget = vboxChooser._anchor.find('div.vboxChooserDropTargetHover').first();
+ if(dropTarget[0]) {
+
+ // Make sure that this wasn't dropped onto a sub-group or itself
+ if(
+ !dropTarget.closest('div.vboxChooserGroup')[0]
+ ||
+ vmGroupPath == dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath')
+ ||
+ dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath').indexOf(vmGroupPath + '/') == 0
+ ) {
+ return;
+ }
+
+
+ // If we are not still in the same group, check for name conflict
+ var currParentGroupPath = $(droppedGroup).closest('div.vboxChooserGroup').parent().closest('div.vboxChooserGroup').data('vmGroupPath');
+
+ if(dropTarget.closest('div.vboxChooserGroup').parent().closest('div.vboxChooserGroup').data('vmGroupPath') != currParentGroupPath) {
+
+ // Do not allow to be dragged into another group
+ // if there is a Vm with a locked session in this one
+ if(sessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
+
+ // Make sure there are no conflicts
+ var groupName = $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr('title');
+ var newGroupName = groupName;
+
+
+ var i = 2;
+ while(vboxChooser.groupNameConflicts(dropTarget.closest('div.vboxChooserGroup').parent(), newGroupName)) {
+ newGroupName = groupName + ' (' + (i++) + ')';
+ }
+
+ $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
+ .siblings('div.vboxChooserGroupHeader')
+ .children('span.vboxChooserGroupName').text(newGroupName);
+
+ }
+
+ // Insert before or insert after?
+ if(dropTarget.hasClass('vboxDropTargetTop')) {
+ $(droppedGroup).detach().insertBefore(dropTarget.closest('div.vboxChooserGroup'));
+ } else {
+ $(droppedGroup).detach().insertAfter(dropTarget.closest('div.vboxChooserGroup'));
+ }
+
+
+ // Dropped onto a group or main VM list
+ } else {
+
+ // Will not do this if this group contains
+ // a VM with a locked session
+ if(sessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
+
+ var dropTarget = vboxChooser._anchor.find('div.vboxHover').first();
+
+
+ // Dropped onto a group
+ if(dropTarget[0] && dropTarget.parent().hasClass('vboxChooserGroup')) {
+
+ dropTarget = dropTarget.parent();
+
+ // Make sure that this wasn't dropped onto a sub-group or itself
+ if(
+ vmGroupPath == dropTarget.data('vmGroupPath')
+ ||
+ dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath').indexOf(vmGroupPath + '/') == 0
+ ) {
+ return;
+ }
+
+ // Dropped onto main vm list
+ } else if($(vboxChooser._anchor).find('div.vboxGroupHover').length == 0 && $(vboxChooser._anchor).hasClass('vboxChooserDropTargetHoverRoot')) {
+
+ dropTarget = null;
+
+ // Only showing one group?
+ if(vboxChooser._showOnlyGroupHistory.length > 0) {
+ dropTarget = $(vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length-1]);
+ }
+
+ if(!$(dropTarget)[0])
+ dropTarget = vboxChooser._anchor.children('div.vboxChooserGroup');
+
+ } else {
+ return;
+ }
+
+ // Make sure there are no conflicts
+ var newElm = $(droppedGroup).detach();
+ var groupName = $(droppedGroup).children('div.vboxChooserGroupIdentifier').attr('title');
+ var newGroupName = groupName;
+
+ var i = 2;
+ while(vboxChooser.groupNameConflicts(dropTarget, newGroupName, $(newElm).data('vmGroupPath'))) {
+ newGroupName = groupName + ' (' + (i++) + ')';
+ }
+
+ $(newElm)
+ .children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
+ .siblings('div.vboxChooserGroupHeader')
+ .children('span.vboxChooserGroupName').text(newGroupName);
+ $(newElm).insertBefore(dropTarget.children('div.vboxChooserGroupVMs'));
+
+ }
+
+ // vmGroup dropped - compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+ // Hide group info
+ vboxChooser._anchor.find('div.vboxChooserGroupHeader').trigger('mouseout');
+
+ // Resize chooser elements
+ vboxChooser._resizeElements();
+
+ vboxChooser.selectionListChanged(vboxChooser._selectedList);
+
+ },
+
+ /*
+ * VM dropped
+ */
+ vmDropped : function (e, droppedVM){
+
+
+ $(vboxChooser._anchor).enableSelection();
+ vboxChooser._dragging = null;
+
+ if(!vboxChooser._editable) return false;
+
+ // Cannot drag if this VM's session is not open
+ var thisSessionLocked = false;
+ var vmData = vboxVMDataMediator.getVMData($(droppedVM).data('vmid'));
+
+ if(vmData.sessionState != 'Unlocked')
+ thisSessionLocked = true;
+
+
+
+ // Where was this dropped?
+ var dropTarget = $('#'+vboxChooser._anchorid).find('td.vboxChooserDropTargetHover');
+
+ // Dropped above / below a VM
+ if(dropTarget[0]) {
+
+ // Dropped from another group into this one,
+ // but this group already has this VM
+ if((dropTarget.closest('table').closest('div.vboxChooserGroup').data('vmGroupPath') != $(droppedVM).closest('div.vboxChooserGroup').data('vmGroupPath'))
+ && dropTarget.closest('table').siblings('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
+ return true;
+ }
+
+ // If session of this VM is locked, don't allow it to be
+ // dragged out of current group
+ if(thisSessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups'] && ($(droppedVM).closest('div.vboxChooserGroup').data('vmGroupPath') != dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath'))) {
+ return
+ }
+
+ // Get VM from target's parent table
+ if(dropTarget.hasClass('vboxDropTargetTop')) {
+ if(!e.ctrlKey && !e.metaKey) {
+ $(droppedVM).detach().insertBefore($(dropTarget).closest('table'));
+ } else {
+ // Copy
+ if($(dropTarget).closest('table').parent().children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmData.id)[0])
+ return;
+ vboxChooser.vmHTML(vmData).insertBefore($(dropTarget).closest('table'));
+ }
+ } else {
+ if(!e.ctrlKey && !e.metaKey) {
+ $(droppedVM).detach().insertAfter($(dropTarget).closest('table'));
+ } else {
+ // Copy - Don't allow if it already exists
+ if($(dropTarget).closest('table').parent().children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmData.id)[0])
+ return;
+ vboxChooser.vmHTML(vmData).insertAfter($(dropTarget).closest('table'));
+ }
+ }
+
+ // Not dropped above / below vm
+ } else {
+
+ // Don't allow this if sessoin is locked
+ if(thisSessionLocked && !$('#vboxPane').data('vboxConfig')['phpVboxGroups']) return;
+
+ // Dropped ON a vm?
+ dropTarget = $('#'+vboxChooser._anchorid).find('table.vboxHover:not(.ui-draggable-dragging)').first();
+ if($(dropTarget).data('vmid')) {
+
+ // Create a group?
+ dropTarget = $('#'+vboxChooser._anchorid).find('table.vboxHover').first();
+
+ // Nothing to do. Not dropped on valid target
+ if(!dropTarget[0] || ($(dropTarget).data('vmid') == $(droppedVM).data('vmid'))) return true;
+
+ // Dont' allow this if target VM's session is locked
+ if($(dropTarget).find('td.vboxVMSessionOpen')[0])
+ return;
+
+ // Where to drop vboxChooser..
+ var p = dropTarget.closest('div.vboxChooserGroup').children('div.vboxChooserGroupVMs');
+ // assume root?
+ if(!p[0]) p = vboxChooser._anchor.children('div.vboxChooserGroupVMs');
+
+ // Determine group name
+ var gname = trans('New group','UIGChooserModel');
+ var tgname = gname;
+
+ var i = 2;
+ while(vboxChooser.groupNameConflicts($(p).parent(), tgname)) {
+ tgname = gname + ' ' + (i++);
+ }
+
+
+ // New position is below target
+ var ghtml = vboxChooser.groupHTML(String(dropTarget.closest('div.vboxChooserGroup').data('vmGroupPath')+'/'+tgname).replace('//','/'));
+
+ if(!e.ctrlKey && !e.metaKey) {
+ ghtml.children('div.vboxChooserGroupVMs').append($(droppedVM).detach());
+ } else {
+ ghtml.children('div.vboxChooserGroupVMs').append(vboxChooser.vmHTML(vmData));
+ }
+ ghtml.children('div.vboxChooserGroupVMs').append(dropTarget.detach());
+
+ ghtml.insertBefore(p);
+
+ // Dropped in the main VM list or group header?
+ } else {
+
+ dropTarget = $(vboxChooser._anchor).find('div.vboxHover').first();
+ if(dropTarget[0] && dropTarget.hasClass('vboxChooserGroupHeader')) {
+
+ // Group already has this dragging VM?
+ if(dropTarget.siblings('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
+ return;
+ }
+
+ if(!e.ctrlKey && !e.metaKey)
+ $(droppedVM).detach().appendTo(dropTarget.siblings('div.vboxChooserGroupVMs').first());
+ else
+ vboxChooser.vmHTML(vmData).appendTo(dropTarget.siblings('div.vboxChooserGroupVMs').first());
+
+ // Main VM list
+ } else if($(vboxChooser._anchor).find('div.vboxGroupHover').length == 0 && $(vboxChooser._anchor).hasClass('vboxChooserDropTargetHoverRoot')) {
+
+ dropTarget = null;
+
+ // Only showing one group?
+ if(vboxChooser._showOnlyGroupHistory.length > 0) {
+ dropTarget = $(vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length-1]);
+ }
+
+ if(!$(dropTarget)[0])
+ dropTarget = vboxChooser._anchor.children('div.vboxChooserGroup');
+
+ // Already in this list?
+ if(dropTarget.children('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(droppedVM).data('vmid'))[0]) {
+ return true;
+ }
+
+ if(!e.ctrlKey && !e.metaKey) {
+ $(droppedVM).detach().appendTo(dropTarget.children('div.vboxChooserGroupVMs').first());
+ } else {
+ vboxChooser.vmHTML(vmData).appendTo(dropTarget.children('div.vboxChooserGroupVMs').first());
+ }
+
+ }
+ }
+
+ }
+
+ // vm dropped - compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+ // Resize chooser elements
+ vboxChooser._resizeElements();
+
+ vboxChooser.selectionListChanged(vboxChooser._selectedList);
+
+ },
+
+ /*
+ * Group selected items into a new group
+ */
+ groupSelectedItems : function() {
+
+ // Get all group paths to determine new group target
+ var groupPaths = {};
+ vboxChooser._anchor.find('div.vboxVMGroupSelected').closest('div.vboxChooserGroup').each(function(idx,elm) {
+ groupPaths[$(elm).data('vmGroupPath')] = 1;
+ });
+ vboxChooser._anchor.find('table.vboxListItemSelected').closest('div.vboxChooserGroup').each(function(idx,elm) {
+ groupPaths[$(elm).data('vmGroupPath')] = 1;
+ });
+
+ // The group clsest to the root group will be the target
+ var groupPathTarget = null;
+ for(var i in groupPaths) {
+
+ if(typeof(i) != 'string') continue;
+
+ // Already at root group. Nothing to do
+ if(groupPathTarget == '/') break;
+
+ // No target set yet or equal targets, or this group is the root
+ if(!groupPathTarget || groupPathTarget == i || i == '/') {
+ groupPathTarget = i;
+ continue;
+ }
+
+ var t1 = groupPathTarget.split("/");
+ var t2 = i.split("/");
+ for(var i = 0; i < Math.min(t1.length,t2.length); i++) {
+ if(t1[i] != t2[i]) {
+ groupPathTarget = '';
+ for(var a = 0; a < i; a++) {
+ groupPathTarget += "/" + t1[a];
+ }
+ groupPathTarget = groupPathTarget.replace('//','/');
+ break;
+ }
+ }
+
+
+ }
+
+ var target = vboxChooser.getGroupElement(groupPathTarget, true);
+
+ if(!$(target)[0]) return;
+
+ // Determine group name
+ var gname = trans('New group','UIGChooserModel');
+ var tgname = gname;
+
+ var i = 2;
+ while(vboxChooser.groupNameConflicts($(target), tgname)) {
+ tgname = gname + ' ' + (i++);
+ }
+
+ var gHTML = vboxChooser.groupHTML('/'+tgname);
+
+ // Append group and vm elements
+ vboxChooser._anchor.find('div.vboxVMGroupSelected').detach().insertAfter(gHTML.children('div.vboxChooserGroupHeader'));
+ vboxChooser._anchor.find('table.vboxListItemSelected').detach().appendTo(gHTML.children('div.vboxChooserGroupVMs'));
+
+ gHTML.insertBefore($(target).children('div.vboxChooserGroupVMs'));
+
+ // group selected items,
+ // Compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+ // Resize chooser elements
+ vboxChooser._resizeElements();
+
+
+
+ },
+
+ /**
+ * Compose group data from GUI and optionally save it
+ *
+ * @param save - save group definitions to vbox
+ */
+ composeGroupDef : function(save) {
+
+ var allGroups = [];
+ var groupsResolved = false;
+
+ // Keep looping through group definitions until
+ // there are no groups removed
+ while(!groupsResolved) {
+
+ allGroups = [];
+ groupsResolved = true;
+
+ vboxChooser._anchor.find('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx,elm) {
+
+ // Group element was removed
+ if(!$(elm)[0]) return;
+
+ // Compose group path
+ var myPath = $(elm).children('div.vboxChooserGroupIdentifier').attr('title');
+ if(!myPath) myPath = '/';
+ $(elm).parents('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx2,elm2){
+ var pName = $(elm2).children('div.vboxChooserGroupIdentifier').attr('title');
+ if(!pName) pName = '/';
+ myPath = String(pName + '/' + myPath).replace('//','/');
+ });
+
+ // Groups
+ var gList = [];
+ $(elm).children('div.vboxChooserGroup:not(.ui-draggable-dragging)').each(function(idx2,elm2){
+
+ // If this group is selected, we'll have to update its path
+ // in the selection list
+ var selected = $(elm2).hasClass('vboxVMGroupSelected');
+ var oldPath = $(elm2).data('vmGroupPath');
+ var newPath = String(myPath + '/' + $(elm2).children('div.vboxChooserGroupIdentifier').attr('title')).replace('//','/');
+
+ gList[gList.length] = $(elm2).children('div.vboxChooserGroupIdentifier').attr('title');
+
+ // set / correct group path data
+ $(elm2).data('vmGroupPath', newPath);
+
+ // Group's path changed?
+ if(selected && (oldPath != newPath)) {
+ for(var i = 0; i < vboxChooser._selectedList.length; i++) {
+ if(vboxChooser._selectedList[i].type == 'group' && vboxChooser._selectedList[i].groupPath == oldPath) {
+ vboxChooser._selectedList[i].groupPath = String(myPath + '/' + $(elm2).children('div.vboxChooserGroupIdentifier').attr('title')).replace('//','/');
+ break;
+ }
+ }
+ }
+
+ });
+
+ // VMs
+ var vmList = [];
+ $(elm).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM:not(.ui-draggable-dragging)').each(function(idx3,elm3){
+ vmList[vmList.length] = $(elm3).data('vmid');
+ });
+
+ // Skip and remove if there are no VMs or subgroups
+ // And it is not the parent group
+ if(gList.length + vmList.length == 0 && !$(elm).hasClass('vboxChooserGroupRoot')) {
+
+ // remove from selected list?
+ if(elm && $(elm).hasClass('vboxVMGroupSelected')) {
+
+ var myPath = $(elm).data('vmGroupPath');
+ // Deselect item
+ vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
+ return (v.type != 'group' || (v.groupPath != myPath));
+ });
+ }
+ $(elm).empty().remove();
+ groupsResolved = false;
+ return false;
+ }
+
+ // append to all groups list
+ gorder = [];
+ if(gList.length) gorder[0] = 'go='+gList.join(',go=');
+ if(vmList.length) gorder[gorder.length] = 'm='+vmList.join(',m=');
+ allGroups[allGroups.length] = {
+ path: $(elm).data('vmGroupPath'),
+ order: gorder.join(',')
+ };
+
+ // Update counts span
+ $(elm).children('div.vboxChooserGroupVMs').css({'display':(vmList.length || $(elm).data('vmGroupPath') == '/' ? '' : 'none')})
+ .siblings('div.vboxChooserGroupHeader')
+ .each(function(hidx,header) {
+
+ var staticTip = '<strong>'+$(header).siblings('div.vboxChooserGroupIdentifier').attr('title')+'</strong>'+
+ (gList.length ? ('<br />' + trans('%n group(s)','UIGChooserItemGroup',gList.length).replace('%n',gList.length)) : '') +
+ (vmList.length ? ('<br />' + trans('%n machine(s)','UIGChooserItemGroup',vmList.length).replace('%n',vmList.length)) : '');
+
+ $(header).tipped({'source':function() {
+
+ // find number of running VMs
+ var runningVMs = 0;
+
+ if(vmList.length) {
+ $(header).siblings('div.vboxChooserGroupVMs').find('td.vboxVMSessionOpen').each(function(idx,elm3) {
+ if(vboxVMStates.isRunning(vboxVMDataMediator.getVMData($(elm3).closest('table').data('vmid'))))
+ runningVMs++;
+ });
+ }
+
+ return staticTip + (runningVMs > 0 ? ' ' + trans('(%n running)','UIGChooserItemGroup',runningVMs).replace('%n', runningVMs) : '');
+ }
+ ,'position':'mouse','delay':1500});
+ })
+ .children('span.vboxChooserGroupInfo')
+ .children('span.vboxChooserGroupCounts').html(
+ (gList.length ? ('<span style="background-image:url(images/vbox/group_abstract_16px.png);" />'+gList.length) : '') +
+ (vmList.length ? ('<span style="background-image:url(images/vbox/machine_abstract_16px.png);" />'+vmList.length) : '')
+ );
+ });
+
+ }
+
+ // Save GUI group definition?
+ if(!save) return;
+
+
+ // Tell the interface we're about to save groups
+ vboxChooser._editable = false;
+ $('#vboxPane').trigger('vmGroupDefsSaving');
+
+ vboxChooser._groupDefs = allGroups;
+
+ // Save machine groups and trigger change
+ var vms = [];
+ var vmList = vboxVMDataMediator.getVMList();
+ for(var i = 0; i < vmList.length; i++) {
+
+ if(!vmList[i] || vmList[i].id == 'host') continue;
+
+ /* If a VM's groups have changed, add it to the list */
+ var eGroups = vmList[i].groups;
+ var nGroups = vboxChooser.getGroupsForVM(vmList[i].id);
+
+ if($(nGroups).not(eGroups).length || $(eGroups).not(nGroups).length) {
+
+ vms[vms.length] = {
+ 'id' : vmList[i].id,
+ 'groups' : nGroups
+ };
+ }
+ }
+
+ // Save machines groups?
+ if(vms.length) {
+
+ // Reload VMs and group definitions
+ var reloadAll = function() {
+
+ var ml = new vboxLoader();
+ ml.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ ml.add('vboxGroupDefinitionsGet',function(d){vboxChooser._groupDefs = d.responseData;});
+
+ // Reload VM list and group definitions, something went wrong
+ ml.onLoad = function() {
+
+ // Stop vmlist from refreshing..
+ vboxChooser.stop();
+
+ // reset selections
+ $('#vboxPane').trigger('vmSelectionListChanged',[vboxChooser]);
+
+ // ask for new one
+ vboxChooser.start();
+ };
+ ml.run();
+ };
+
+ $.when(vboxAjaxRequest('machinesSaveGroups',{'vms':vms})).done(function(res){
+
+ if(res.responseData.errored) {
+ reloadAll();
+ vboxChooser._editable = true;
+ $('#vboxPane').trigger('vmGroupDefsSaved');
+ } else {
+ $.when(vboxAjaxRequest('vboxGroupDefinitionsSet',{'groupDefinitions':allGroups})).always(function(){
+ vboxChooser._editable = true;
+ $('#vboxPane').trigger('vmGroupDefsSaved');
+ });
+ }
+
+ }).fail(reloadAll);
+
+ } else {
+ $.when(vboxAjaxRequest('vboxGroupDefinitionsSet',{'groupDefinitions':allGroups})).always(function(){
+ vboxChooser._editable = true;
+ $('#vboxPane').trigger('vmGroupDefsSaved');
+ });
+ }
+
+
+ return allGroups;
+
+ },
+
+ /*
+ * Return a list of groups that VM is a member of
+ */
+ getGroupsForVM : function(vmid) {
+ var gPathList = [];
+ vboxChooser._anchor.find('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid+':not(.ui-draggable-dragging)').each(function(idx,elm){
+ var gParent = $(elm).closest('div.vboxChooserGroup');
+ if(!gParent.hasClass('ui-draggable-dragging'))
+ gPathList[gPathList.length] = gParent.data('vmGroupPath');
+ });
+ return gPathList;
+ },
+
+ /*
+ * Determine whether or not a group name conflicts
+ * with another group in parent
+ */
+ groupNameConflicts : function(parentGroup, name, ignoreGroupAtPath) {
+ var found = false;
+ parentGroup.children('div.vboxChooserGroup:not(.ui-draggable-dragging)').children('div.vboxChooserGroupIdentifier[title="'+name+'"]').parent().each(function(i,elm){
+
+ if(ignoreGroupAtPath && (ignoreGroupAtPath == $(elm).data('vmGroupPath')))
+ return true;
+
+ found=true;
+ return false;
+ });
+ return found;
+ },
+
+ /*
+ * Ungroup selected group
+ */
+ unGroupSelectedGroup : function() {
+
+ var target = $(vboxChooser.getSelectedGroupElements()[0]).siblings('div.vboxChooserGroupVMs');
+
+ // Groups
+ // - ignore group at path we are currently ungrouping
+ var ignoreGroup = $(vboxChooser.getSelectedGroupElements()[0]).data('vmGroupPath');
+ $(vboxChooser.getSelectedGroupElements()[0]).children('div.vboxChooserGroup').each(function(i,elm) {
+
+ // Make sure there are no conflicts
+ var newElm = $(elm).detach();
+ var groupName = $(elm).children('div.vboxChooserGroupIdentifier').attr('title');
+ var newGroupName = groupName;
+
+ var i = 2;
+ while(vboxChooser.groupNameConflicts($(target).parent(), newGroupName, ignoreGroup)) {
+ newGroupName = groupName + ' (' + (i++) + ')';
+ }
+
+ $(newElm).children('div.vboxChooserGroupIdentifier').attr({'title':newGroupName})
+ .siblings('div.vboxChooserGroupHeader')
+ .children('span.vboxChooserGroupName').text(newGroupName);
+
+ $(newElm).insertBefore(target);
+
+ });
+
+ // VMs
+ $(vboxChooser.getSelectedGroupElements()[0]).children('div.vboxChooserGroupVMs').children().each(function(i,elm){
+ $(elm).detach();
+ if(!target.children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+$(elm).data('vmid'))[0])
+ target.append(elm);
+ });
+
+
+ // ungroup selected items
+ // compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+ // Resize chooser elements
+ vboxChooser._resizeElements();
+
+ vboxChooser.selectionListChanged();
+
+
+ },
+
+ /*
+ * Sort group sub-elements based on VirtualBox
+ * group definitions
+ */
+ sortGroup : function(gElm) {
+
+ // Find group orders
+ var gPath = $(gElm).data('vmGroupPath');
+ var groupList = vboxChooser._groupDefs;
+
+ if(!(gPath && groupList)) return;
+
+ var machineOrder = [];
+ var groupOrder = [];
+
+ // Get correct order
+ for(var i = 0; i < groupList.length; i++) {
+ if(groupList[i].path == gPath) {
+ order = groupList[i].order.split(',');
+ for(var a = 0; a < order.length; a++) {
+ kv = order[a].split('=',2);
+ if(kv[0] == 'm') machineOrder[machineOrder.length] = kv[1];
+ else groupOrder[groupOrder.length] = kv[1];
+ }
+ }
+ }
+
+ // sort groups
+ var groups = $(gElm).children('div.vboxChooserGroup').get();
+ var maxPos = groups.length;
+ groups.sort(function(a,b){
+
+ var Pos1 = jQuery.inArray($(a).children('div.vboxChooserGroupIdentifier').attr('title'), groupOrder);
+ var Pos2 = jQuery.inArray($(b).children('div.vboxChooserGroupIdentifier').attr('title'), groupOrder);
+
+ if(Pos1==-1) Pos1 = maxPos;
+ if(Pos2==-1) Pos2 = maxPos;
+
+ return (Pos1 > Pos2 || Pos1 == -1 ? -1 : (Pos2 == Pos1 ? 0 : 1));
+
+ });
+ $.each(groups, function(idx,itm) {
+ $(itm).insertAfter($(gElm).children('div.vboxChooserGroupHeader'));
+ });
+
+ // sort VMs
+ var vms = $(gElm).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM').get();
+ var maxPos = vms.length;
+ vms.sort(function(a,b) {
+
+ var Pos1 = jQuery.inArray($(a).data('vmid'), machineOrder);
+ var Pos2 = jQuery.inArray($(b).data('vmid'), machineOrder);
+
+ if(Pos1==-1) Pos1 = maxPos;
+ if(Pos2==-1) Pos2 = maxPos;
+
+ return (Pos1 > Pos2 ? 1 : (Pos2 == Pos1 ? 0 : -1));
+
+ });
+ $.each(vms, function(idx,itm) {
+ $(gElm).children('div.vboxChooserGroupVMs').append(itm);
+ });
+
+
+ },
+
+ /*
+ * Sort selected group by item names
+ */
+ sortSelectedGroup : function(rootElm) {
+
+ var el = $(vboxChooser.getSelectedGroupElements()[0]);
+
+ if(rootElm || !el) {
+ el = vboxChooser._anchor.children('div.vboxChooserGroup');
+ }
+
+ // sort groups
+ var groups = $(el).children('div.vboxChooserGroup').get();
+ groups.sort(function(a,b){
+ return $(b).children('div.vboxChooserGroupIdentifier').attr('title').localeCompare($(a).children('div.vboxChooserGroupIdentifier').attr('title'));
+ });
+ $.each(groups, function(idx,itm) {
+ $(itm).insertAfter($(el).children('div.vboxChooserGroupHeader'));
+ });
+
+ // sort VMs
+ var vms = $(el).children('div.vboxChooserGroupVMs').children('table.vboxChooserVM').get();
+ vms.sort(function(a,b) {
+ return $(a).find('span.vboxVMName').text().localeCompare($(b).find('span.vboxVMName').text());
+ });
+ $.each(vms, function(idx,itm) {
+ $(el).children('div.vboxChooserGroupVMs').append(itm);
+ });
+
+ // compose and save group definitions
+ vboxChooser.composeGroupDef(true);
+
+ },
+
+ /*
+ * Rename selected group
+ */
+ renameSelectedGroup : function() {
+
+ var el = $(vboxChooser.getSelectedGroupElements()[0]);
+
+ // Function to rename group
+ var renameGroup = function(e, textbox) {
+
+ if(!textbox) textbox = $(this);
+
+ var newName = $(textbox).val().replace(/[\\\/:*?"<>,]/g,'_');
+
+ if(newName && newName != $(textbox).closest('div.vboxChooserGroup').children('div.vboxChooserGroupIdentifier').attr('title')) {
+
+ // Do not rename if it conflicts
+ var noConflict = newName;
+ var i = 2;
+ while(vboxChooser.groupNameConflicts($(textbox).parent().parent().parent().parent(), noConflict)) {
+ noConflict = newName + ' (' + (i++) + ')';
+ }
+ newName = noConflict;
+
+ $(textbox).closest('div.vboxChooserGroup')
+ .children('div.vboxChooserGroupIdentifier').attr({'title':newName})
+ .siblings('div.vboxChooserGroupHeader')
+ .children('span.vboxChooserGroupName').html(newName);
+
+ // group renamed, compose and save groups
+ vboxChooser.composeGroupDef(true);
+
+ // Write out collapsed group list
+ vboxChooser._saveCollapsedGroups();
+
+ }
+
+
+ $(textbox).parent().parent().children().css({'display':''});
+ $(textbox).parent().empty().remove();
+ };
+
+ $(el).children('div.vboxChooserGroupHeader').children().css({'display':'none'});
+ $(el).children('div.vboxChooserGroupHeader').append(
+
+ $('<form />').append(
+ $('<input />').attr({'type':'text','value':$(el).children('div.vboxChooserGroupIdentifier').attr('title')}).css({'width':'90%','padding':'0px','margin':'0px'}).on('keypress',function(e){
+ if (e.which == 13) {
+ $(this).off('blur', renameGroup);
+ renameGroup(e,this);
+ e.stopPropagation();
+ e.preventDefault();
+ $(this).trigger('blur');
+ return false;
+ }
+ })
+ )
+
+ );
+ $(el).children('div.vboxChooserGroupHeader').children('form').children('input').focus().select().blur(renameGroup);
+
+ },
+
+ /*
+ * Select a single group
+ */
+ _selectGroup : function(gelm) {
+ $(gelm).addClass('vboxVMGroupSelected');
+ },
+
+ /*
+ * Deselect a single group
+ */
+ _deselectGroup : function(gelm) {
+
+ $(gelm).removeClass('vboxVMGroupSelected');
+ },
+
+ /*
+ * Select (or unselect) an item in our list. Called onmousedown or onCLick
+ */
+ selectItem : function(e) {
+
+ // Right click selects item if it is not selected
+ if(e.which != 1) {
+
+ // Right click on group header and group is selected
+ // just return and show context menu
+ if($(this).hasClass('vboxChooserGroupHeader') && $(this).parent().hasClass('vboxVMGroupSelected')) {
+ return true;
+
+ // Right click on VM and VM is already selected
+ // just return and show context menu
+ } else if($(this).hasClass('vboxListItemSelected')) {
+ return true;
+ }
+ }
+
+ var selectedList = [];
+ var item = $(this);
+
+
+ // Group?
+ if($(item).hasClass('vboxChooserGroupHeader')) {
+
+
+ // No control key. Exclusive selection
+ if(!e.ctrlKey && !e.metaKey) {
+
+ // already selected
+ if(vboxChooser._selectedList.length == 1 && vboxChooser._selectedList[0].type == 'group' &&
+ vboxChooser._selectedList[0].groupPath == $(item).parent().data('vmGroupPath'))
+ return true;
+
+ vboxChooser._anchor.find('.vboxListItemSelected').removeClass('vboxListItemSelected');
+ vboxChooser._anchor.find('div.vboxVMGroupSelected')
+ .each(function(idx,gelm) {
+ vboxChooser._deselectGroup(gelm);
+ });
+
+
+
+ // select current group
+ vboxChooser._selectGroup($(item).parent());
+
+ selectedList = [{
+ type: 'group',
+ groupPath: $(item).parent().data('vmGroupPath')
+ }];
+
+ // Already selected, and ctrl key
+ } else if($(item).parent().hasClass('vboxVMGroupSelected')){
+
+ // Deselect item
+ selectedList = vboxChooser._selectedList.filter(function(v){
+ return (v.type != 'group' || (v.groupPath != $(item).parent().data('vmGroupPath')));
+ });
+
+ vboxChooser._deselectGroup($(item).parent());
+
+ // Not already selected, and ctrl key
+ } else {
+
+ vboxChooser._selectGroup($(item).parent());
+
+ selectedList = vboxChooser._selectedList;
+
+ selectedList[selectedList.length] = {
+ type: 'group',
+ groupPath: $(item).parent().data('vmGroupPath')
+ };
+
+ }
+
+
+ // VM
+ } else {
+
+ // No ctrl key or selection is host. Exclusive selection
+ if((!e.ctrlKey && !e.metaKey) || $(item).data('vmid') == 'host') {
+
+ vboxChooser._anchor.find('.vboxListItemSelected').removeClass('vboxListItemSelected');
+ vboxChooser._anchor.find('div.vboxVMGroupSelected').removeClass('vboxVMGroupSelected')
+ .each(function(idx,gelm){
+ vboxChooser._deselectGroup(gelm);
+ });
+
+ // Select current VM
+ $(item).addClass('vboxListItemSelected').removeClass('vboxHover');
+
+ // already selected
+ if(vboxChooser._selectedList.length == 1 && vboxChooser._selectedList[0].type == 'vm' &&
+ vboxChooser._selectedList[0].id == $(item).data('vmid'))
+ return true;
+
+ selectedList = [{
+ type: 'vm',
+ id: $(item).data('vmid'),
+ groupPath: $(item).parent().data('vmGroupPath')
+ }];
+
+ // Already selected, and ctrl key
+ } else if($(item).hasClass('vboxListItemSelected')) {
+
+ // Deselect item
+ selectedList = vboxChooser._selectedList.filter(function(v){
+ return (v.type == 'group' || (v.id != $(item).data('vmid')));
+ });
+
+ $(item).removeClass('vboxListItemSelected');
+
+ // ctrl key, but not already selected
+ } else {
+
+ $(item).addClass('vboxListItemSelected').removeClass('vboxHover');
+
+ selectedList = vboxChooser._selectedList;
+
+ selectedList[selectedList.length] = {
+ type: 'vm',
+ id: $(item).data('vmid'),
+ groupPath: $(item).parent().data('vmGroupPath')
+ };
+
+ }
+
+ }
+
+ // Remove host?
+ if(selectedList.length > 1) {
+
+ // Deselect host
+ selectedList = selectedList.filter(function(v){
+ return (v.type == 'group' || (v.id != 'host'));
+ });
+
+ vboxChooser._anchor.children('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').removeClass('vboxListItemSelected');
+
+ }
+
+ vboxChooser.selectionListChanged(selectedList);
+
+ return true;
+
+
+ },
+
+ /*
+ * Show only single group element identified by gelm
+ */
+ showOnlyGroupElm : function(gelm) {
+
+ // Going backwards affects animations
+ var back = false;
+
+ // gelm is null if we're going backwards
+ if(!gelm) {
+
+
+ if(vboxChooser._showOnlyGroupHistory.length > 1) {
+ // this gets rid of current
+ vboxChooser._showOnlyGroupHistory.pop();
+ // selects previous
+ gelm = vboxChooser._showOnlyGroupHistory.pop();
+ back = true;
+ } else {
+ gelm = null;
+ }
+
+
+ } else {
+
+ // Hold history
+ vboxChooser._showOnlyGroupHistory[vboxChooser._showOnlyGroupHistory.length] = gelm;
+ }
+
+
+ // No scrolling
+ vboxChooser._anchor.css({'overflow-y':'hidden'});
+
+ if($(gelm)[0]) {
+
+
+ // Slide over or back
+ $.when(vboxChooser._anchor.hide('slide', {direction: (back ? 'right' : 'left'), distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200)).always(function() {
+
+
+ /* hide host when showing only a group */
+ $('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').hide();
+
+
+ /* Undo anything previously performed by this */
+ vboxChooser._anchor.find('div.vboxChooserGroupHide').removeClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer');
+ vboxChooser._anchor.find('div.vboxChooserGroupShowOnly').removeClass('vboxChooserGroupShowOnly');
+
+ $(gelm).parents('div.vboxChooserGroup').addClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer').siblings().addClass('vboxChooserGroupHide');
+
+ vboxChooser._anchor.find('div.vboxChooserGroupRootLevel').removeClass('vboxChooserGroupRootLevel');
+ $(gelm).addClass('vboxChooserGroupShowOnly vboxChooserGroupRootLevel').siblings().addClass('vboxChooserGroupHide');
+
+ $.when(vboxChooser._anchor.show('slide', {direction: (back ? 'left' : 'right'), distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200))
+ .done(function(){
+
+ // Restore scrolling
+ vboxChooser._anchor.css({'overflow-y':'auto'});
+
+ // Hide group info
+ $(gelm).find('div.vboxChooserGroupHeader').trigger('mouseout');
+
+ // Reset title sizes
+ vboxChooser._resizeElements();
+
+ // force redraw of these
+ $(gelm).find('.vboxFitToContainer').css({'display':'none'}).css({'width':'','display':''});
+
+
+ });
+
+ });
+
+ } else {
+
+ vboxChooser._showOnlyGroupHistory = [];
+
+ // Slide back to anchor
+ $.when(vboxChooser._anchor.hide('slide', {direction: 'right', distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200)).always(function() {
+
+ /* show host when going back to main list */
+ $('table.vboxChooserItem-'+vboxChooser._anchorid+'-host').show();
+
+ vboxChooser._anchor.find('div.vboxChooserGroupHide').removeClass('vboxChooserGroupHide vboxChooserGroupHideShowContainer');
+ vboxChooser._anchor.find('div.vboxChooserGroupShowOnly').removeClass('vboxChooserGroupShowOnly ');
+
+ vboxChooser._anchor.find('div.vboxChooserGroupRootLevel').removeClass('vboxChooserGroupRootLevel');
+ vboxChooser._anchor.children('div.vboxChooserGroupRoot').addClass('vboxChooserGroupRootLevel');
+
+ $.when(vboxChooser._anchor.show('slide', {direction: 'left', distance: (vboxChooser._anchor.outerWidth()/1.5)}, 200))
+ .done(function(){
+
+ // Restore scrolling
+ vboxChooser._anchor.css({'overflow-y':'auto'});
+
+ // Hide group info
+ vboxChooser._anchor.find('div.vboxChooserGroupHeader').trigger('mouseout');
+
+ // Reset title sizes
+ vboxChooser._resizeElements();
+
+ // force redraw of these
+ vboxChooser._anchor.find('.vboxFitToContainer').css({'display':'none','width':''}).css({'display':''});
+ });
+ });
+ }
+
+ },
+
+ /*
+ * Return HTML for group
+ */
+ groupHTML : function(gpath) {
+
+ if(!gpath) gpath = '/';
+ var first = gpath == '/';
+ var gname = gpath.substring(gpath.lastIndexOf('/')+1);
+ var collapsed = vboxChooser._isGroupCollapsed(gpath);
+
+ var gHTML = $('<div />').append(
+ $('<div />').addClass('vboxChooserGroupIdentifier').css({'display':'none'}).attr({'title':gname})
+ ).append(
+ $('<div />').addClass('vboxChooserGroupHeader').css({'display':(first ? 'none' : '')})
+ .attr({'title':gname})
+ .dblclick(function() {
+
+ // Already collapsed?
+ var collapsed = $(this).closest('div.vboxChooserGroup').hasClass('vboxVMGroupCollapsed');
+
+ // Button rotation function
+ var rotateButton = function(){return true;};
+
+ var vboxArrowImage = $(this).find('span.vboxChooserGroupNameArrowCollapse');
+
+ if(!($.browser.msie && $.browser.version.substring(0,1) < 9)) {
+
+ rotateButton = function() {
+
+ return $('<div />').animate({left:90},{
+ duration: 300,
+ step: function(currentStep) {
+ if(!collapsed) currentStep = (90 - currentStep);
+ vboxArrowImage.css({
+ 'transform':'rotate('+currentStep+'deg)',
+ '-moz-transform': 'rotate('+currentStep+'deg)',
+ '-webkit-transform': 'rotate('+currentStep+'deg)',
+ '-o-transform': 'rotate('+currentStep+'deg)',
+ '-ms-transform': 'rotate('+currentStep+'deg)'
+ });
+ },
+ queue: true,
+ complete: function() {
+ vboxArrowImage.css({
+ 'transform':'',
+ '-moz-transform': '',
+ '-webkit-transform': '',
+ '-o-transform': '',
+ '-ms-transform': ''
+ });
+ }
+
+ });
+ };
+ }
+
+
+ // Run button rotation and toggle class
+ $.when(rotateButton(), $(this).closest('div.vboxChooserGroup').toggleClass('vboxVMGroupCollapsed', ($.browser.msie && $.browser.version.substring(0,1) < 9) ? undefined : 300)).always(function(){
+
+ // Write out collapsed group list
+ vboxChooser._saveCollapsedGroups();
+
+ // Reset title sizes
+ vboxChooser._resizeElements();
+ });
+
+
+ })
+ .append(
+ $('<div />').addClass('vboxChooserDropTarget')
+ .addClass('vboxDropTargetTop').hover(function(){
+ if(vboxChooser._draggingGroup)
+ $(this).addClass('vboxChooserDropTargetHover' + (first ? 'ignore' : ''));
+ }, function(){
+ $(this).removeClass('vboxChooserDropTargetHover');
+ })
+ )
+ .append(
+ $('<span />').addClass('vboxChooserGroupNameArrowLeft vboxChooserGroupNameArrowCollapse vboxArrowImage')
+ .mousedown(function(e){
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
+ }).mouseup(function(){
+ $(this).closest('div.vboxChooserGroupHeader').trigger('dblclick');
+ })
+
+ ).append(
+
+ $('<span />').addClass('vboxChooserGroupNameArrowLeft vboxChooserGroupShowOnlyBack vboxArrowImage')
+ .click(function(e) {
+ e.stopPropagation();
+ e.preventDefault();
+ vboxChooser.showOnlyGroupElm();
+ return false;
+
+ })
+
+ )
+ .append($('<span />').addClass('vboxChooserGroupInfo').html(
+ "<span class='vboxChooserGroupCounts' />"
+ ).append(
+ $('<span />').addClass('vboxChooserGroupShowOnly vboxArrowImage')
+ .click(function(e){
+ e.stopPropagation();
+ e.preventDefault();
+ vboxChooser.showOnlyGroupElm($(this).closest('div.vboxChooserGroup'));
+ return false;
+ })
+
+ ))
+ .append($('<span />').html(gname).addClass('vboxChooserGroupName vboxFitToContainer'))
+ .append(
+ $('<div />').addClass('vboxChooserDropTarget vboxChooserDropTargetBottom')
+ .hover(function(){
+ if(vboxChooser._draggingGroup)
+ $(this).addClass('vboxChooserDropTargetHover' + (first ? 'ignore' : ''));
+ }, function(){
+ $(this).removeClass('vboxChooserDropTargetHover');
+ })
+
+ )
+ .hover(function(){
+
+ if(vboxChooser._compact) return;
+
+ $(this).addClass('vboxHover');
+
+ // Resize title and add hover class?
+ if(!$(this).parent().hasClass('vboxChooserGroupRoot')) {
+
+ // Set width of title to -group info span width
+ var infoWidth = $(this).children('span.vboxChooserGroupInfo').width();
+ var pWidth = $(this).width();
+
+ $(this).children('span.vboxChooserGroupName').css({'max-width':(pWidth-infoWidth-20)+'px'});
+
+ }
+
+
+ },function(){
+
+ // Resize title and remove hover class
+ $(this).removeClass('vboxHover');
+
+ if(!$(this).parent().hasClass('vboxChooserGroupRoot'))
+ $(this).children('span.vboxChooserGroupName').css({'max-width':''});
+
+ }).on('mousedown',vboxChooser.selectItem)
+
+ ).addClass((first ? 'vboxChooserGroupRoot vboxChooserGroupRootLevel ' : (collapsed ? 'vboxVMGroupCollapsed ' : '')) + 'vboxChooserGroup')
+ .data({'vmGroupPath':gpath})
+ .draggable({'cursorAt':{left: -10, top: -10},'helper':function(){
+
+ return $(this).clone().addClass('vboxVMGroupCollapsed vboxVMGroupSelected')
+ .children('div.vboxChooserGroupHeader').removeClass('vboxHover').children('.vboxChooserGroupNameArrowCollapse')
+ .hide().closest('div.vboxChooserGroup').css({'width':$(this).width()+'px'});
+
+
+ },'start':function() {
+
+ if(!$('#vboxPane').data('vboxSession').admin) return false;
+
+ if(!vboxChooser._editable) return false;
+
+ vboxChooser._draggingGroup = $(this).data('vmGroupPath');
+ $(vboxChooser._anchor).disableSelection();
+
+ },'stop':function(e) {
+ vboxChooser.vmGroupDropped(e,$(this));
+
+ }}).append($('<div />').addClass('vboxChooserGroupVMs'));
+
+
+ // Bottom drop target
+ if(!first) {
+ gHTML.hover(function(){
+ $(this).addClass('vboxGroupHover'); }, function() {
+ $(this).removeClass('vboxGroupHover');
+ }).append(
+ $('<div />').addClass('vboxChooserDropTarget vboxChooserDropTargetBottom')
+ .hover(function(){
+ if(vboxChooser._draggingGroup)
+ $(this).addClass('vboxChooserDropTargetHover');
+ }, function(){
+ $(this).removeClass('vboxChooserDropTargetHover');
+ })
+ );
+ }
+
+
+
+ // Group context menu
+ $(gHTML).contextMenu({
+ menu: vboxChooser._vmGroupContextMenuObj.menuId(),
+ menusetup: function(el) {
+ $(el).children('div.vboxChooserGroupHeader').trigger('click');
+ }
+ },function(act,el,pos,d,e){
+ vboxChooser._vmGroupContextMenuObj.menuClickCallback(act, el);
+ });
+
+ return gHTML;
+
+
+
+ },
+
+ /*
+ * Return selected VM elements
+ */
+ getSelectedVMElements : function() {
+ return vboxChooser._anchor.find('table.vboxSelected');
+ },
+
+ /*
+ * Return selected group elements
+ */
+ getSelectedGroupElements : function() {
+ return vboxChooser._anchor.find('div.vboxVMGroupSelected');
+ },
+
+
+ /*
+ * Start VM list update
+ */
+ start : function(anchorid) {
+
+ // already running?
+ if(vboxChooser._running) return;
+ vboxChooser._running = true;
+
+ // Where are we drawn?
+ if(anchorid) {
+ vboxChooser._anchorid = anchorid;
+ vboxChooser._anchor = $('#'+anchorid);
+ }
+
+
+ // Set group definition key
+ vboxChooser._groupDefinitionKey = $('#vboxPane').data('vboxConfig')['groupDefinitionKey'];
+
+ // Get collapsed group list
+ vboxChooser._collapsedGroups = vboxGetLocalDataItem($('#vboxPane').data('vboxConfig').key+'-collapsedGroups', true);
+ if(!vboxChooser._collapsedGroups) vboxChooser._collapsedGroups = [];
+ else vboxChooser._collapsedGroups = vboxChooser._collapsedGroups.split(',');
+
+
+ // Get groups and machine list. datamediator will start listener
+ $.when(vboxAjaxRequest('vboxGroupDefinitionsGet')).done(function(g) {
+
+ vboxChooser._groupDefs = g.responseData;
+
+ $.when(vboxVMDataMediator.getVMList()).done(function(d) {
+ vboxChooser.updateList(d);
+ });
+ });
+
+ },
+
+ /*
+ * Stop VM list updates and clear list
+ */
+ stop : function() {
+
+ if(!vboxChooser._running) return;
+ vboxChooser._running = false;
+
+ vboxChooser._anchor.html("<div id='vboxChooserSpinner' style='text-align: center'><div><img src='images/spinner.gif' /></div></div>");
+
+ // reset vars
+ vboxChooser._versionChecked = false;
+ vboxChooser._selectedList = [];
+ vboxChooser.selectedVMs = [];
+ vboxChooser.selectionMode = vboxSelectionModeNone;
+
+ }
+
+
+
+};
+
+$(document).ready(function(){
+
+ // Calculate scrollbar width
+ vboxChooser._scrollbarWidth = getScrollbarWidth();
+
+ // "Stop" chooser
+ $('#vboxPane').on('hostChange',function(){
+
+ vboxChooser.stop();
+
+ }).on('hostChanged',function(){
+
+
+ vboxChooser.start();
+
+ // Refresh menus
+ }).on('vmGroupDefsSaving vmGroupDefsSaved vmSelectionListChanged', function() {
+
+ if(vboxChooser._vmGroupContextMenuObj)
+ vboxChooser._vmGroupContextMenuObj.update(vboxChooser);
+ if(vboxChooser._vmContextMenuObj)
+ vboxChooser._vmContextMenuObj.update(vboxChooser);
+
+
+ // Event list queue
+ }).on('vboxEvents',function(e, eventList) {
+
+ var redrawVMs = [];
+ var sortGroups = [];
+ var groupsChanged = false;
+ var selectedChanged = false;
+ var resizeElements = false;
+
+ for(var i = 0; i < eventList.length; i++) {
+
+ switch(eventList[i].eventType) {
+
+ ////////////////////////////////
+ //
+ // Machine data changed
+ //
+ ////////////////////////////////
+ case 'OnMachineDataChanged':
+
+ // Shorthand
+ var vmid = eventList[i].machineId;
+ var data = vboxVMDataMediator.getVMData(vmid);
+
+ // Update VM in list
+ if(data) {
+
+ // Enforce VM ownership
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && data.owner != $('#vboxPane').data('vboxSession').user) {
+ break;
+ }
+
+ redrawVMs[redrawVMs.length] = vmid;
+
+ // Make sure VM has root group at least
+ if(data.groups.length == 0) data.groups = ['/'];
+
+ // Remove from groups if they have changed
+ var currGroups = vboxChooser.getGroupsForVM(vmid);
+ var groupDiff = $(currGroups).not(data.groups);
+ groupsChanged = groupDiff.length;
+ for(var a = 0; a < groupDiff.length; a++) {
+
+ var gElm = vboxChooser.getGroupElement(groupDiff[a], false);
+ if(!$(gElm)[0]) return;
+
+ selectedChanged = (selectedChanged || $(gElm).children('div.vboxChooserGroupVMs').closest('div.vboxVMGroupSelected').length);
+
+ $(gElm).children('div.vboxChooserGroupVMs')
+ .children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+data.id).empty().remove();
+
+ }
+
+ // Add to other groups
+ var groupDiff = $(data.groups).not(currGroups);
+ groupsChanged = (groupsChanged || groupDiff.length);
+ for(var a = 0; a < groupDiff.length; a++) {
+
+ var gElm = vboxChooser.getGroupElement(groupDiff[a]);
+
+ // Skip it if it is already there
+ if($(gElm).children('div.vboxChooserGroupVMs').children('table.vboxChooserItem-'+vboxChooser._anchorid+'-'+data.id)[0])
+ continue;
+
+ $(gElm).children('div.vboxChooserGroupVMs')
+ .append(
+ vboxChooser.vmHTML(data)
+ );
+
+ selectedChanged = (selectedChanged || $(gElm).children('div.vboxChooserGroupVMs').closest('div.vboxVMGroupSelected').length);
+
+ // Sort the group this machine was added to
+ sortGroups = sortGroups.concat(data.groups);
+
+ }
+
+ resizeElements = (resizeElements || groupsChanged);
+
+
+ }
+
+ break;
+
+ /////////////////////////////////
+ //
+ // Snapshot taken / deleted / restored
+ //
+ /////////////////////////////////
+ case 'OnSnapshotDeleted':
+ case 'OnSnapshotTaken':
+ case 'OnSnapshotRestored':
+ case 'OnSnapshotChanged':
+ redrawVMs[redrawVMs.length] = eventList[i].machineId;
+ break;
+
+ /////////////////////////////////////
+ //
+ // Machine registered or unregistered
+ //
+ //////////////////////////////////////
+ case 'OnMachineRegistered':
+
+ // Shorthand
+ var vmid = eventList[i].machineId;
+
+ // Unregistered
+ if(!eventList[i].registered) {
+
+ var wasSelected = vboxChooser.isVMSelected(vmid);
+
+ $('#'+vboxChooser._anchorid +' table.vboxChooserItem-'+vboxChooser._anchorid+'-'+vmid).remove();
+
+ groupsChanged = true;
+
+ // See if VM was selected
+ if(wasSelected) {
+
+ selectedChanged = true;
+
+ vboxChooser._selectedList = vboxChooser._selectedList.filter(function(v){
+ return (v.type == 'group' || (v.id != vmid));
+ });
+
+
+ }
+
+ resizeElements = true;
+
+
+ break;
+
+ }
+
+ // Registered
+
+ // Enforce VM ownership
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && eventList[i].enrichmentData.owner != $('#vboxPane').data('vboxSession').user) {
+ break;
+ }
+
+ // Add to list
+ vboxChooser.updateVMElement(eventList[i].enrichmentData, true);
+
+ resizeElements = true;
+ break;
+
+
+ ///////////////////////////////////
+ //
+ // Extra data changed
+ //
+ ////////////////////////////////////
+ case 'OnExtraDataChanged':
+
+ if(!eventList[i].machineId && eventList[i].key.indexOf(vboxChooser._groupDefinitionKey) === 0) {
+
+ var path = eventList[i].key.substring(vboxChooser._groupDefinitionKey.length);
+ if(!path) path = "/";
+ var name = path.substring(path.lastIndexOf('/')+1);
+ var vboxVMGroups = vboxChooser._groupDefs;
+ var found = false;
+
+ // No current group definitions?
+ if(!vboxVMGroups) break;
+
+ // Step through each group, comparing
+ for(var a = 0; a < vboxVMGroups.length; a++) {
+ if(vboxVMGroups[a].path == path) {
+ // Sort this group if it is different
+ if(vboxVMGroups[a].order != eventList[i].value)
+ sortGroups[sortGroups.length] = path;
+ found = true;
+ vboxVMGroups[a] = {'path':path,'name':name,'order':eventList[i].value};
+ break;
+ }
+ }
+
+ // Add to group if not found
+ if(!found) {
+ vboxVMGroups[vboxVMGroups.length] = {'path':path,'name':name,'order':eventList[i].value};
+ sortGroups[sortGroups.length] = path; // sort when added
+ resizeElements = true;
+ }
+
+ } else {
+
+ switch(eventList[i].key) {
+
+ // redraw when custom icon changes
+ case 'phpvb/icon':
+ redrawVMs[redrawVMs.length] = eventList[i].machineId;
+ break;
+ }
+ }
+ break;
+
+ ////////////////////////////////////////
+ //
+ // Session or state change gets redrawn
+ //
+ ///////////////////////////////////////
+ case 'OnSessionStateChanged':
+ case 'OnMachineStateChanged':
+ redrawVMs[redrawVMs.length] = eventList[i].machineId;
+ break;
+
+ } // </ switch eventType >>
+
+
+ } // </ for each event >
+
+ // Now redraw each VM
+ ///////////////////////////
+ var redrawn = {};
+ var updateMenus = false;
+ for(var i = 0; i < redrawVMs.length; i++) {
+
+ if(redrawn[redrawVMs[i]]) continue;
+ redrawn[redrawVMs[i]] = true;
+
+ vboxChooser.updateVMElement(vboxVMDataMediator.getVMData(redrawVMs[i]));
+
+ // Update menus if the VM is selected
+ updateMenus = (updateMenus || vboxChooser.isVMSelected(redrawVMs[i]));
+
+ }
+
+ // Sort groups
+ var groupsSorted = {};
+ for(var i = 0; i < sortGroups.length; i++) {
+ if(groupsSorted[sortGroups[i]]) continue;
+ groupsSorted[sortGroups[i]] = true;
+ var gElm = $(vboxChooser.getGroupElement(sortGroups[i]),false);
+ if(gElm[0])
+ vboxChooser.sortGroup(gElm);
+
+ }
+
+ // Groups changed
+ if(groupsChanged || sortGroups.length) {
+ vboxChooser.composeGroupDef();
+ }
+
+
+ // update selection list
+ if(selectedChanged) {
+
+ vboxChooser.selectionListChanged(vboxChooser._selectedList);
+
+ } else if(updateMenus) {
+
+ if(vboxChooser._vmGroupContextMenuObj)
+ vboxChooser._vmGroupContextMenuObj.update(vboxChooser);
+
+
+ if(vboxChooser._vmContextMenuObj)
+ vboxChooser._vmContextMenuObj.update(vboxChooser);
+
+ }
+
+ if(resizeElements) vboxChooser._resizeElements(true);
+
+
+
+ });
+
+
+
}); \ No newline at end of file
diff --git a/js/datamediator.js b/js/datamediator.js
index c701958..2b05393 100644
--- a/js/datamediator.js
+++ b/js/datamediator.js
@@ -1,465 +1,465 @@
-/**
- * @fileOverview Deferred data loader / cacher singleton. Provides vboxDataMediator
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: datamediator.js 591 2015-04-11 22:40:47Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- */
-
-/**
- * vboxVMDataMediator
- *
- * @see jQuery.deferred
- * @namespace vboxVMDataMediator
- */
-var vboxVMDataMediator = {
-
- /* Promises for data */
- promises : {
- 'getVMDetails':{},
- 'getVMRuntimeData':{}
- },
-
- /* Holds Basic VM data */
- vmData : null,
-
- /* Holds VM details */
- vmDetailsData : {},
-
- /* Holds VM runtime data */
- vmRuntimeData : {},
-
- /* Expire cached promise / data */
- expireVMDetails: function(vmid) {
- vboxVMDataMediator.promises.getVMDetails[vmid] = null;
- vboxVMDataMediator.vmDetailsData[vmid] = null;
- },
- expireVMRuntimeData: function(vmid) {
- vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
- vboxVMDataMediator.vmRuntimeData[vmid] = null;
- },
- expireAll: function() {
- for(var i in vboxVMDataMediator.promises) {
- if(typeof(i) != 'string') continue;
- vboxVMDataMediator.promises[i] = {};
- }
- vboxVMDataMediator.vmData = null;
- vboxVMDataMediator.vmRuntimeData = {};
- vboxVMDataMediator.vmDetailsData = {};
- },
-
- /**
- * Get basic vm data
- *
- * @param vmid {String} ID of VM
- * @returns {Object} vm data
- */
- getVMData: function(vmid) {
-
- // VMList must exist
- if(!vboxVMDataMediator.vmData) {
- return;
- }
-
- return vboxVMDataMediator.vmData[vmid];
-
- },
-
- /**
- * Return list of machines, subscribe to running VM events
- * and start the event listener
- *
- * @returns {Object} promise
- */
- getVMList: function() {
-
- // Return array from existing data
- if(vboxVMDataMediator.vmData) {
- var list = [];
- for(var i in vboxVMDataMediator.vmData) {
- if(typeof i != 'string') continue;
- if(i == 'host') continue;
- list.push(vboxVMDataMediator.vmData[i]);
- }
- return list;
- }
-
-
- var mList = $.Deferred();
- $.when(vboxAjaxRequest('vboxGetMachines')).done(function(d) {
-
- var vmData = {};
- var subscribeList = [];
-
- for(var i = 0; i < d.responseData.length; i++) {
-
- // Enforce VM ownership
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && d.responseData[i].owner != $('#vboxPane').data('vboxSession').user) {
- continue;
- }
-
- vmData[d.responseData[i].id] = d.responseData[i];
-
- if(vboxVMStates.isRunning({'state':d.responseData[i].state}) || vboxVMStates.isPaused({'state':d.responseData[i].state}))
- subscribeList[subscribeList.length] = d.responseData[i].id;
-
- }
-
- // Start event listener
- $.when(vboxEventListener.start(subscribeList)).done(function(){
- vboxVMDataMediator.vmData = vmData;
- mList.resolve(d.responseData);
-
- }).fail(function() {
- mList.reject();
- });
-
-
- }).fail(function() {
- mList.reject();
- });
-
- return mList.promise();
- },
-
- /**
- * Get VM details data
- *
- * @param vmid {String} ID of VM to get data for
- * @param forceRefresh {Boolean} force refresh of VM data
- * @returns {Object} vm data or promise
- */
- getVMDetails: function(vmid, forceRefresh) {
-
- // Data exists
- if(vboxVMDataMediator.vmDetailsData[vmid] && !forceRefresh) {
- vboxVMDataMediator.promises.getVMDetails[vmid] = null;
- return vboxVMDataMediator.vmDetailsData[vmid];
- }
-
- // Promise does not yet exist?
- if(!vboxVMDataMediator.promises.getVMDetails[vmid]) {
-
- vboxVMDataMediator.promises.getVMDetails[vmid] = $.Deferred();
-
- $.when(vboxAjaxRequest('machineGetDetails',{vm:vmid})).done(function(d){
- vboxVMDataMediator.vmDetailsData[d.responseData.id] = d.responseData;
- vboxVMDataMediator.promises.getVMDetails[vmid].resolve(d.responseData);
- }).fail(function(){
- vboxVMDataMediator.promises.getVMDetails[vmid].reject();
- vboxVMDataMediator.promises.getVMDetails[vmid] = null;
- });
-
- }
- return vboxVMDataMediator.promises.getVMDetails[vmid];
- },
-
- /**
- * Get VM's runtime data
- *
- * @param vmid {String} ID of VM to get data for
- * @returns {Object} VM runtime data or promise
- */
- getVMRuntimeData: function(vmid) {
-
- // Data exists
- if(vboxVMDataMediator.vmRuntimeData[vmid]) {
- vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
- return vboxVMDataMediator.vmRuntimeData[vmid];
- }
-
- // Promise does not yet exist?
- if(!vboxVMDataMediator.promises.getVMRuntimeData[vmid]) {
-
- vboxVMDataMediator.promises.getVMRuntimeData[vmid] = $.Deferred();
-
- $.when(vboxAjaxRequest('machineGetRuntimeData',{vm:vmid})).done(function(d){
- vboxVMDataMediator.vmRuntimeData[d.responseData.id] = d.responseData;
- if(vboxVMDataMediator.promises.getVMRuntimeData[vmid])
- vboxVMDataMediator.promises.getVMRuntimeData[vmid].resolve(d.responseData);
- }).fail(function(){
- vboxVMDataMediator.promises.getVMRuntimeData[vmid].reject();
- vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
- });
-
- }
- return vboxVMDataMediator.promises.getVMRuntimeData[vmid];
- },
-
- /**
- * Return all data for a VM
- * @param vmid {String} ID of VM to get data for
- * @returns promise
- */
- getVMDataCombined : function(vmid) {
-
- // Special case for 'host'
- if(vmid == 'host') {
- var def = $.Deferred();
- $.when(vboxVMDataMediator.getVMDetails(vmid)).done(function(d){
- def.resolve(d);
- }).fail(function(){
- def.reject();
- });
- return def.promise();
- }
-
- if(!vboxVMDataMediator.vmData[vmid]) return;
-
- var runtime = function() { return {};};
- if(vboxVMStates.isRunning({'state':vboxVMDataMediator.vmData[vmid].state}) || vboxVMStates.isPaused({'state':vboxVMDataMediator.vmData[vmid].state})) {
- runtime = vboxVMDataMediator.getVMRuntimeData(vmid);
- }
-
- var def = $.Deferred();
- $.when(vboxVMDataMediator.getVMDetails(vmid), runtime, vboxVMDataMediator.getVMData(vmid)).done(function(d1,d2,d3){
- def.resolve($.extend(true,{},d1,d2,d3));
- }).fail(function(){
- def.reject();
- });
- return def.promise();
-
- },
-
- /**
- * Get new VM data
- * @param vmid {String} ID of VM to get data for
- * @returns {Object} promise
- */
- refreshVMData : function(vmid) {
-
- // Special case for host
- if(vmid == 'host') {
- $('#vboxPane').trigger('vboxOnMachineDataChanged', [{machineId:'host'}]);
- $('#vboxPane').trigger('vboxEvents', [[{eventType:'OnMachineDataChanged',machineId:'host'}]]);
- return;
- }
-
- if(!vboxVMDataMediator.vmData[vmid]) return;
-
- var def = $.Deferred();
- $.when(vboxAjaxRequest('vboxGetMachines',{'vm':vmid})).done(function(d) {
- vm = d.responseData[0];
- vboxVMDataMediator.vmData[vm.id] = vm;
- def.resolve();
- $('#vboxPane').trigger('vboxOnMachineDataChanged', [{machineId:vm.id,enrichmentData:vm}]);
- $('#vboxPane').trigger('vboxEvents', [[{eventType:'OnMachineDataChanged',machineId:vm.id,enrichmentData:vm}]]);
- }).fail(function(){
- def.reject();
- });
-
- return def.promise();
- }
-
-};
-
-/* Events to bind for vboxVMDataMediator when everything is loaded */
-$(document).ready(function(){
-
- /*
- *
- * VirtualBox events
- *
- */
-
- // Raw event to data handlers
- $('#vboxPane').on('vboxOnMachineDataChanged',function(e, eventData) {
-
- vboxVMDataMediator.expireVMDetails(eventData.machineId);
- vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
-
- if(vboxVMDataMediator.vmData[eventData.machineId] && eventData.enrichmentData) {
- $.extend(true, vboxVMDataMediator.vmData[eventData.machineId], eventData.enrichmentData);
- // $.extend doesn't seem to handle this for some reason
- vboxVMDataMediator.vmData[eventData.machineId].groups = eventData.enrichmentData.groups;
- }
-
- // Machine state change
- }).on('vboxOnMachineStateChanged', function(e, eventData) {
-
- // Only care about it if its in our list
- if(vboxVMDataMediator.vmData[eventData.machineId]) {
-
- vboxVMDataMediator.vmData[eventData.machineId].state = eventData.state;
- vboxVMDataMediator.vmData[eventData.machineId].lastStateChange = eventData.enrichmentData.lastStateChange;
- vboxVMDataMediator.vmData[eventData.machineId].currentStateModified = eventData.enrichmentData.currentStateModified;
-
- // If it's running, subscribe to its events
- if(vboxVMStates.isRunning({'state':eventData.state}) || vboxVMStates.isPaused({'state':eventData.state})) {
-
- // If we already have runtime data, assume we were already subscribed
- if(!vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
-
- // Tell event listener to subscribe to this machine's events
- vboxEventListener.subscribeVMEvents(eventData.machineId);
- }
-
- } else {
- vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
- }
- }
-
- // Session state change
- }).on('vboxOnSessionStateChanged', function(e, eventData) {
-
- if(vboxVMDataMediator.vmData[eventData.machineId])
- vboxVMDataMediator.vmData[eventData.machineId].sessionState = eventData.state;
-
-
- // Snapshot changed
- }).on('vboxOnSnapshotTaken vboxOnSnapshotDeleted vboxOnSnapshotChanged vboxOnSnapshotRestored',function(e,eventData) {
-
- if(vboxVMDataMediator.vmData[eventData.machineId]) {
-
- vboxVMDataMediator.vmData[eventData.machineId].currentSnapshotName = eventData.enrichmentData.currentSnapshotName;
- vboxVMDataMediator.vmData[eventData.machineId].currentStateModified = eventData.enrichmentData.currentStateModified;
-
- // Get media again
- $.when(vboxAjaxRequest('vboxGetMedia')).done(function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
-
- }
- if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
- vboxVMDataMediator.vmDetailsData[eventData.machineId].snapshotCount = eventData.enrichmentData.snapshotCount;
-
- // Expire all data for a VM when machine is unregistered
- }).on('vboxOnMachineRegistered', function(e, eventData) {
-
- if(!eventData.registered) {
- vboxVMDataMediator.expireVMDetails(eventData.machineId);
- vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
- vboxVMDataMediator.vmData[eventData.machineId] = null;
-
- } else if(eventData.enrichmentData) {
-
- // Enforce VM ownership
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && eventData.enrichmentData.owner != $('#vboxPane').data('vboxSession').user) {
- return;
- }
-
- vboxVMDataMediator.vmData[eventData.enrichmentData.id] = eventData.enrichmentData;
-
- }
-
- //}).on('vboxOnCPUChanged', function(e, vmid) {
-
- /*
- case 'OnCPUChanged':
- $data['cpu'] = $eventDataObject->cpu;
- $data['add'] = $eventDataObject->add;
- $data['dedupId'] .= '-' . $data['cpu'];
- break;
- */
-
- }).on('vboxOnNetworkAdapterChanged', function(e, eventData) {
-
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
- $.extend(vboxVMDataMediator.vmRuntimeData[eventData.machineId].networkAdapters[eventData.networkAdapterSlot], eventData.enrichmentData);
- }
-
-
- /* Storage controller of VM changed */
- //}).on('vboxOnStorageControllerChanged', function() {
- /*
- case 'OnStorageControllerChanged':
- $data['machineId'] = $eventDataObject->machineId;
- $data['dedupId'] .= '-'. $data['machineId'];
- break;
- */
-
- }).on('vboxOnMediumChanged', function(e, eventData) {
-
- /* Medium attachment changed */
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
- for(var a = 0; a < vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers.length; a++) {
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].name == eventData.controller) {
- for(var b = 0; b < vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments.length; b++) {
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].port == eventData.port &&
- vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].device == eventData.device) {
-
- vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].medium = (eventData.medium ? {id:eventData.medium} : null);
- break;
- }
- }
- break;
- }
- }
- }
-
- /* Shared folders changed */
- //}).on('vboxOnSharedFolderChanged', function() {
-
- // VRDE runtime info
- }).on('vboxOnVRDEServerChanged', function(e, eventData) {
-
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
- $.extend(true,vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServer, eventData.enrichmentData);
- }
-
-
- // This only fires when it is enabled
- }).on('vboxOnVRDEServerInfoChanged', function(e, eventData) {
-
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
- vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServerInfo.port = eventData.enrichmentData.port;
- vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServer.enabled = eventData.enrichmentData.enabled;
- }
-
-
- // Execution cap
- }).on('vboxOnCPUExecutionCapChanged', function(e, eventData) {
-
- if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
- vboxVMDataMediator.vmRuntimeData[eventData.machineId].CPUExecutionCap = eventData.executionCap;
- }
-
- // Special cases for where phpvirtualbox keeps its extra data
- }).on('vboxOnExtraDataChanged', function(e, eventData) {
-
- // No vm id is a global change
- if(!eventData.machineId || !vboxVMDataMediator.vmData[eventData.machineId]) return;
-
- switch(eventData.key) {
-
- // Startup mode
- case 'pvbx/startupMode':
- if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
- vboxVMDataMediator.vmDetailsData[eventData.machineId].startupMode = eventData.value;
- break;
-
- // Owner
- case 'phpvb/sso/owner':
- vboxVMDataMediator.vmData[eventData.machineId].owner = eventData.value;
- break;
-
- // Custom icon
- case 'phpvb/icon':
-
- vboxVMDataMediator.vmData[eventData.machineId].customIcon = eventData.value;
-
- if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
- vboxVMDataMediator.vmDetailsData[eventData.machineId].customIcon = eventData.value;
-
-
- break;
-
- // First time run
- case 'GUI/FirstRun':
- if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
- vboxVMDataMediator.vmDetailsData[eventData.machineId].GUI.FirstRun = eventData.value;
- break;
-
- }
-
-
- /*
- *
- * phpVirtualBox events
- *
- */
-
- // Expire everything when host changes
- }).on('hostChange',function(){
- vboxVMDataMediator.expireAll();
-
- });
-
+/**
+ * @fileOverview Deferred data loader / cacher singleton. Provides vboxDataMediator
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: datamediator.js 591 2015-04-11 22:40:47Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ */
+
+/**
+ * vboxVMDataMediator
+ *
+ * @see jQuery.deferred
+ * @namespace vboxVMDataMediator
+ */
+var vboxVMDataMediator = {
+
+ /* Promises for data */
+ promises : {
+ 'getVMDetails':{},
+ 'getVMRuntimeData':{}
+ },
+
+ /* Holds Basic VM data */
+ vmData : null,
+
+ /* Holds VM details */
+ vmDetailsData : {},
+
+ /* Holds VM runtime data */
+ vmRuntimeData : {},
+
+ /* Expire cached promise / data */
+ expireVMDetails: function(vmid) {
+ vboxVMDataMediator.promises.getVMDetails[vmid] = null;
+ vboxVMDataMediator.vmDetailsData[vmid] = null;
+ },
+ expireVMRuntimeData: function(vmid) {
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
+ vboxVMDataMediator.vmRuntimeData[vmid] = null;
+ },
+ expireAll: function() {
+ for(var i in vboxVMDataMediator.promises) {
+ if(typeof(i) != 'string') continue;
+ vboxVMDataMediator.promises[i] = {};
+ }
+ vboxVMDataMediator.vmData = null;
+ vboxVMDataMediator.vmRuntimeData = {};
+ vboxVMDataMediator.vmDetailsData = {};
+ },
+
+ /**
+ * Get basic vm data
+ *
+ * @param vmid {String} ID of VM
+ * @returns {Object} vm data
+ */
+ getVMData: function(vmid) {
+
+ // VMList must exist
+ if(!vboxVMDataMediator.vmData) {
+ return;
+ }
+
+ return vboxVMDataMediator.vmData[vmid];
+
+ },
+
+ /**
+ * Return list of machines, subscribe to running VM events
+ * and start the event listener
+ *
+ * @returns {Object} promise
+ */
+ getVMList: function() {
+
+ // Return array from existing data
+ if(vboxVMDataMediator.vmData) {
+ var list = [];
+ for(var i in vboxVMDataMediator.vmData) {
+ if(typeof i != 'string') continue;
+ if(i == 'host') continue;
+ list.push(vboxVMDataMediator.vmData[i]);
+ }
+ return list;
+ }
+
+
+ var mList = $.Deferred();
+ $.when(vboxAjaxRequest('vboxGetMachines')).done(function(d) {
+
+ var vmData = {};
+ var subscribeList = [];
+
+ for(var i = 0; i < d.responseData.length; i++) {
+
+ // Enforce VM ownership
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && d.responseData[i].owner != $('#vboxPane').data('vboxSession').user) {
+ continue;
+ }
+
+ vmData[d.responseData[i].id] = d.responseData[i];
+
+ if(vboxVMStates.isRunning({'state':d.responseData[i].state}) || vboxVMStates.isPaused({'state':d.responseData[i].state}))
+ subscribeList[subscribeList.length] = d.responseData[i].id;
+
+ }
+
+ // Start event listener
+ $.when(vboxEventListener.start(subscribeList)).done(function(){
+ vboxVMDataMediator.vmData = vmData;
+ mList.resolve(d.responseData);
+
+ }).fail(function() {
+ mList.reject();
+ });
+
+
+ }).fail(function() {
+ mList.reject();
+ });
+
+ return mList.promise();
+ },
+
+ /**
+ * Get VM details data
+ *
+ * @param vmid {String} ID of VM to get data for
+ * @param forceRefresh {Boolean} force refresh of VM data
+ * @returns {Object} vm data or promise
+ */
+ getVMDetails: function(vmid, forceRefresh) {
+
+ // Data exists
+ if(vboxVMDataMediator.vmDetailsData[vmid] && !forceRefresh) {
+ vboxVMDataMediator.promises.getVMDetails[vmid] = null;
+ return vboxVMDataMediator.vmDetailsData[vmid];
+ }
+
+ // Promise does not yet exist?
+ if(!vboxVMDataMediator.promises.getVMDetails[vmid]) {
+
+ vboxVMDataMediator.promises.getVMDetails[vmid] = $.Deferred();
+
+ $.when(vboxAjaxRequest('machineGetDetails',{vm:vmid})).done(function(d){
+ vboxVMDataMediator.vmDetailsData[d.responseData.id] = d.responseData;
+ vboxVMDataMediator.promises.getVMDetails[vmid].resolve(d.responseData);
+ }).fail(function(){
+ vboxVMDataMediator.promises.getVMDetails[vmid].reject();
+ vboxVMDataMediator.promises.getVMDetails[vmid] = null;
+ });
+
+ }
+ return vboxVMDataMediator.promises.getVMDetails[vmid];
+ },
+
+ /**
+ * Get VM's runtime data
+ *
+ * @param vmid {String} ID of VM to get data for
+ * @returns {Object} VM runtime data or promise
+ */
+ getVMRuntimeData: function(vmid) {
+
+ // Data exists
+ if(vboxVMDataMediator.vmRuntimeData[vmid]) {
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
+ return vboxVMDataMediator.vmRuntimeData[vmid];
+ }
+
+ // Promise does not yet exist?
+ if(!vboxVMDataMediator.promises.getVMRuntimeData[vmid]) {
+
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid] = $.Deferred();
+
+ $.when(vboxAjaxRequest('machineGetRuntimeData',{vm:vmid})).done(function(d){
+ vboxVMDataMediator.vmRuntimeData[d.responseData.id] = d.responseData;
+ if(vboxVMDataMediator.promises.getVMRuntimeData[vmid])
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid].resolve(d.responseData);
+ }).fail(function(){
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid].reject();
+ vboxVMDataMediator.promises.getVMRuntimeData[vmid] = null;
+ });
+
+ }
+ return vboxVMDataMediator.promises.getVMRuntimeData[vmid];
+ },
+
+ /**
+ * Return all data for a VM
+ * @param vmid {String} ID of VM to get data for
+ * @returns promise
+ */
+ getVMDataCombined : function(vmid) {
+
+ // Special case for 'host'
+ if(vmid == 'host') {
+ var def = $.Deferred();
+ $.when(vboxVMDataMediator.getVMDetails(vmid)).done(function(d){
+ def.resolve(d);
+ }).fail(function(){
+ def.reject();
+ });
+ return def.promise();
+ }
+
+ if(!vboxVMDataMediator.vmData[vmid]) return;
+
+ var runtime = function() { return {};};
+ if(vboxVMStates.isRunning({'state':vboxVMDataMediator.vmData[vmid].state}) || vboxVMStates.isPaused({'state':vboxVMDataMediator.vmData[vmid].state})) {
+ runtime = vboxVMDataMediator.getVMRuntimeData(vmid);
+ }
+
+ var def = $.Deferred();
+ $.when(vboxVMDataMediator.getVMDetails(vmid), runtime, vboxVMDataMediator.getVMData(vmid)).done(function(d1,d2,d3){
+ def.resolve($.extend(true,{},d1,d2,d3));
+ }).fail(function(){
+ def.reject();
+ });
+ return def.promise();
+
+ },
+
+ /**
+ * Get new VM data
+ * @param vmid {String} ID of VM to get data for
+ * @returns {Object} promise
+ */
+ refreshVMData : function(vmid) {
+
+ // Special case for host
+ if(vmid == 'host') {
+ $('#vboxPane').trigger('vboxOnMachineDataChanged', [{machineId:'host'}]);
+ $('#vboxPane').trigger('vboxEvents', [[{eventType:'OnMachineDataChanged',machineId:'host'}]]);
+ return;
+ }
+
+ if(!vboxVMDataMediator.vmData[vmid]) return;
+
+ var def = $.Deferred();
+ $.when(vboxAjaxRequest('vboxGetMachines',{'vm':vmid})).done(function(d) {
+ vm = d.responseData[0];
+ vboxVMDataMediator.vmData[vm.id] = vm;
+ def.resolve();
+ $('#vboxPane').trigger('vboxOnMachineDataChanged', [{machineId:vm.id,enrichmentData:vm}]);
+ $('#vboxPane').trigger('vboxEvents', [[{eventType:'OnMachineDataChanged',machineId:vm.id,enrichmentData:vm}]]);
+ }).fail(function(){
+ def.reject();
+ });
+
+ return def.promise();
+ }
+
+};
+
+/* Events to bind for vboxVMDataMediator when everything is loaded */
+$(document).ready(function(){
+
+ /*
+ *
+ * VirtualBox events
+ *
+ */
+
+ // Raw event to data handlers
+ $('#vboxPane').on('vboxOnMachineDataChanged',function(e, eventData) {
+
+ vboxVMDataMediator.expireVMDetails(eventData.machineId);
+ vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
+
+ if(vboxVMDataMediator.vmData[eventData.machineId] && eventData.enrichmentData) {
+ $.extend(true, vboxVMDataMediator.vmData[eventData.machineId], eventData.enrichmentData);
+ // $.extend doesn't seem to handle this for some reason
+ vboxVMDataMediator.vmData[eventData.machineId].groups = eventData.enrichmentData.groups;
+ }
+
+ // Machine state change
+ }).on('vboxOnMachineStateChanged', function(e, eventData) {
+
+ // Only care about it if its in our list
+ if(vboxVMDataMediator.vmData[eventData.machineId]) {
+
+ vboxVMDataMediator.vmData[eventData.machineId].state = eventData.state;
+ vboxVMDataMediator.vmData[eventData.machineId].lastStateChange = eventData.enrichmentData.lastStateChange;
+ vboxVMDataMediator.vmData[eventData.machineId].currentStateModified = eventData.enrichmentData.currentStateModified;
+
+ // If it's running, subscribe to its events
+ if(vboxVMStates.isRunning({'state':eventData.state}) || vboxVMStates.isPaused({'state':eventData.state})) {
+
+ // If we already have runtime data, assume we were already subscribed
+ if(!vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+
+ // Tell event listener to subscribe to this machine's events
+ vboxEventListener.subscribeVMEvents(eventData.machineId);
+ }
+
+ } else {
+ vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
+ }
+ }
+
+ // Session state change
+ }).on('vboxOnSessionStateChanged', function(e, eventData) {
+
+ if(vboxVMDataMediator.vmData[eventData.machineId])
+ vboxVMDataMediator.vmData[eventData.machineId].sessionState = eventData.state;
+
+
+ // Snapshot changed
+ }).on('vboxOnSnapshotTaken vboxOnSnapshotDeleted vboxOnSnapshotChanged vboxOnSnapshotRestored',function(e,eventData) {
+
+ if(vboxVMDataMediator.vmData[eventData.machineId]) {
+
+ vboxVMDataMediator.vmData[eventData.machineId].currentSnapshotName = eventData.enrichmentData.currentSnapshotName;
+ vboxVMDataMediator.vmData[eventData.machineId].currentStateModified = eventData.enrichmentData.currentStateModified;
+
+ // Get media again
+ $.when(vboxAjaxRequest('vboxGetMedia')).done(function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+
+ }
+ if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
+ vboxVMDataMediator.vmDetailsData[eventData.machineId].snapshotCount = eventData.enrichmentData.snapshotCount;
+
+ // Expire all data for a VM when machine is unregistered
+ }).on('vboxOnMachineRegistered', function(e, eventData) {
+
+ if(!eventData.registered) {
+ vboxVMDataMediator.expireVMDetails(eventData.machineId);
+ vboxVMDataMediator.expireVMRuntimeData(eventData.machineId);
+ vboxVMDataMediator.vmData[eventData.machineId] = null;
+
+ } else if(eventData.enrichmentData) {
+
+ // Enforce VM ownership
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership && !$('#vboxPane').data('vboxSession').admin && eventData.enrichmentData.owner != $('#vboxPane').data('vboxSession').user) {
+ return;
+ }
+
+ vboxVMDataMediator.vmData[eventData.enrichmentData.id] = eventData.enrichmentData;
+
+ }
+
+ //}).on('vboxOnCPUChanged', function(e, vmid) {
+
+ /*
+ case 'OnCPUChanged':
+ $data['cpu'] = $eventDataObject->cpu;
+ $data['add'] = $eventDataObject->add;
+ $data['dedupId'] .= '-' . $data['cpu'];
+ break;
+ */
+
+ }).on('vboxOnNetworkAdapterChanged', function(e, eventData) {
+
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+ $.extend(vboxVMDataMediator.vmRuntimeData[eventData.machineId].networkAdapters[eventData.networkAdapterSlot], eventData.enrichmentData);
+ }
+
+
+ /* Storage controller of VM changed */
+ //}).on('vboxOnStorageControllerChanged', function() {
+ /*
+ case 'OnStorageControllerChanged':
+ $data['machineId'] = $eventDataObject->machineId;
+ $data['dedupId'] .= '-'. $data['machineId'];
+ break;
+ */
+
+ }).on('vboxOnMediumChanged', function(e, eventData) {
+
+ /* Medium attachment changed */
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+ for(var a = 0; a < vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers.length; a++) {
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].name == eventData.controller) {
+ for(var b = 0; b < vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments.length; b++) {
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].port == eventData.port &&
+ vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].device == eventData.device) {
+
+ vboxVMDataMediator.vmRuntimeData[eventData.machineId].storageControllers[a].mediumAttachments[b].medium = (eventData.medium ? {id:eventData.medium} : null);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /* Shared folders changed */
+ //}).on('vboxOnSharedFolderChanged', function() {
+
+ // VRDE runtime info
+ }).on('vboxOnVRDEServerChanged', function(e, eventData) {
+
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+ $.extend(true,vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServer, eventData.enrichmentData);
+ }
+
+
+ // This only fires when it is enabled
+ }).on('vboxOnVRDEServerInfoChanged', function(e, eventData) {
+
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+ vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServerInfo.port = eventData.enrichmentData.port;
+ vboxVMDataMediator.vmRuntimeData[eventData.machineId].VRDEServer.enabled = eventData.enrichmentData.enabled;
+ }
+
+
+ // Execution cap
+ }).on('vboxOnCPUExecutionCapChanged', function(e, eventData) {
+
+ if(vboxVMDataMediator.vmRuntimeData[eventData.machineId]) {
+ vboxVMDataMediator.vmRuntimeData[eventData.machineId].CPUExecutionCap = eventData.executionCap;
+ }
+
+ // Special cases for where phpvirtualbox keeps its extra data
+ }).on('vboxOnExtraDataChanged', function(e, eventData) {
+
+ // No vm id is a global change
+ if(!eventData.machineId || !vboxVMDataMediator.vmData[eventData.machineId]) return;
+
+ switch(eventData.key) {
+
+ // Startup mode
+ case 'pvbx/startupMode':
+ if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
+ vboxVMDataMediator.vmDetailsData[eventData.machineId].startupMode = eventData.value;
+ break;
+
+ // Owner
+ case 'phpvb/sso/owner':
+ vboxVMDataMediator.vmData[eventData.machineId].owner = eventData.value;
+ break;
+
+ // Custom icon
+ case 'phpvb/icon':
+
+ vboxVMDataMediator.vmData[eventData.machineId].customIcon = eventData.value;
+
+ if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
+ vboxVMDataMediator.vmDetailsData[eventData.machineId].customIcon = eventData.value;
+
+
+ break;
+
+ // First time run
+ case 'GUI/FirstRun':
+ if(vboxVMDataMediator.vmDetailsData[eventData.machineId])
+ vboxVMDataMediator.vmDetailsData[eventData.machineId].GUI.FirstRun = eventData.value;
+ break;
+
+ }
+
+
+ /*
+ *
+ * phpVirtualBox events
+ *
+ */
+
+ // Expire everything when host changes
+ }).on('hostChange',function(){
+ vboxVMDataMediator.expireAll();
+
+ });
+
}); \ No newline at end of file
diff --git a/js/dialogs.js b/js/dialogs.js
index af72d51..402ab55 100644
--- a/js/dialogs.js
+++ b/js/dialogs.js
@@ -1,1725 +1,1725 @@
-/**
- * @fileOverview Dialog logic for various wizards and other dialogs
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: dialogs.js 599 2015-07-27 10:40:37Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- */
-
-/**
- * Run the import appliance wizard
- */
-function vboxWizardImportApplianceDialog() {
-
- // reference
- var self = this;
-
- // Extend vboxWizard
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common settings */
- this.name = 'wizardImportAppliance';
- this.title = trans('Import Virtual Appliance','UIWizardImportApp');
- this.bg = 'images/vbox/vmw_ovf_import_bg.png';
- this.icon = 'import';
- this.steps = 2;
- this.height = 500;
- this.finishText = trans('Import','UIWizardImportApp');
- this.context = 'UIWizardImportApp';
-
- /* Restore defaults is added to last step */
- this.stepButtons = [
- {
- 'name' : trans('Restore Defaults','UIWizardImportApp'),
- 'steps' : [-1],
- 'click' : function() {
- wizardImportApplianceParsed();
- }
- }
- ];
-
- /* Data to be loaded */
- this.data = [
- {'fn':'vboxGetEnumerationMap','args':{'class':'NetworkAdapterType'},'callback':function(d){$('#vboxPane').data('vboxNetworkAdapterTypes',d.responseData);}},
- {'fn':'vboxGetEnumerationMap','args':{'class':'AudioControllerType'},'callback':function(d){$('#vboxPane').data('vboxAudioControllerTypes',d.responseData);}},
- ];
-
- /* Perform action on finish */
- this.onFinish = function() {
-
- var file = $(self.form).find('[name=wizardImportApplianceLocation]').val();
- var descriptions = $('#vboxImportProps').data('descriptions');
- var reinitNetwork = $(self.form).find('[name=vboxImportReinitNetwork]').prop('checked');
-
- // Check for descriptions
- if(!descriptions) {
- return;
- }
-
-
- /** Call Appliance import AJAX function */
- var vboxImportApp = function() {
-
- $(self.dialog).empty().remove();
-
- var l = new vboxLoader();
- l.add('applianceImport',function(d){
- if(d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- // Imported media must be refreshed
- var ml = new vboxLoader();
- ml.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- ml.onLoad = function(){
- self.completed.resolve();
- };
- ml.run();
- },'progress_import_90px.png',trans('Import an appliance into VirtualBox','UIActionPool').replace(/\.+$/g,''),vboxBasename(file));
- } else {
- self.completed.reject();
- }
- },{'descriptions':descriptions,'file':file,'reinitNetwork':reinitNetwork});
- l.run();
- };
-
- // license agreements
- var licenses = [];
-
- // Step through each VM and obtain value
- for(var a = 0; a < descriptions.length; a++) {
- var children = $('#vboxImportProps').children('tr.vboxChildOf'+a);
- descriptions[a][5] = []; // enabled / disabled
- var lic = null;
- var vmname = null;
- for(var b = 0; b < children.length; b++) {
- descriptions[a][5][b] = !$(children[b]).data('propdisabled');
- descriptions[a][3][$(children[b]).data('descOrder')] = $(children[b]).children('td:eq(1)').data('descValue');
- // check for license
- if(descriptions[a][0][b] == 'License') {
- lic = descriptions[a][2][b];
- } else if(descriptions[a][0][b] == 'Name') {
- vmname = descriptions[a][2][b];
- }
- }
- if(lic) {
- if(!vmname) vmname = trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',a);
- licenses[licenses.length] = {'name':vmname,'license':lic};
- }
- }
-
-
- if(licenses.length) {
-
- var msg = trans('<b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.','UIImportLicenseViewer');
- var a = 0;
- var buttons = {};
- buttons[trans('Agree','UIImportLicenseViewer')] = function() {
-
- a++;
- if(a >= licenses.length) {
- $(this).remove();
- vboxImportApp();
- return;
- }
- $(this).dialog('close');
- $('#vboxImportWizLicTitle').html(msg.replace('%1',licenses[a]['name']));
- $('#vboxImportWizLicContent').val(licenses[a]['license']);
- $(this).dialog('open');
-
- };
- buttons[trans('Disagree','UIImportLicenseViewer')] = function() {
- $(this).empty().remove();
- };
-
- var dlg = $('<div />').dialog({'closeOnEscape':false,'width':600,'height':500,'buttons':buttons,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent vboxWizard','title':'<img src="images/vbox/os_type_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Software License Agreement','UIImportLicenseViewer')});
-
- $(dlg).html('<p id="vboxImportWizLicTitle" /><textarea rows="20" spellcheck="false" wrap="off" readonly="true"id="vboxImportWizLicContent" style="width:100%; margin:2px; padding:2px;"></textarea>');
- $('#vboxImportWizLicTitle').html(msg.replace('%1',licenses[a]['name']));
- $('#vboxImportWizLicContent').val(licenses[a]['license']);
- $(dlg).dialog('open');
-
- } else {
- vboxImportApp();
- }
-
-
- };
-
-}
-
-/**
- * Run the export appliance wizard
- */
-function vboxWizardExportApplianceDialog() {
-
- // reference
- var self = this;
-
- // Extend vboxWizard class
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common settings */
- this.name = 'wizardExportAppliance';
- this.title = trans('Export Virtual Appliance','UIWizardExportApp');
- this.bg = 'images/vbox/vmw_ovf_export_bg.png';
- this.icon = 'export';
- this.steps = 4;
- this.height = 500;
- this.context = 'UIWizardExportApp';
- this.finishText = trans('Export','UIWizardExportApp');
-
- /* Add restore defaults button to last step */
- this.stepButtons = [
- {
- 'name' : trans('Restore Defaults','UIWizardExportApp'),
- 'steps' : [-1],
- 'click' : function(e) {
- // Remove export VM properties
- $('#vboxExportProps').children().remove();
- // Re-trigger adding them
- if(self.mode == 'advanced')
- vboxWizardExportApplianceUpdateList();
- else
- $('#wizardExportApplianceStep4').trigger('show',e,self);
- }
- }
- ];
-
- /* Function run when wizard completes */
- this.onFinish = function() {
-
-
- // Actually export appliances
- function vboxExportApp(force) {
-
- // Each VM
- var vmid = null;
- var vms = {};
- var vmsAndProps = $('#vboxExportProps').children('tr');
- for(var a = 0; a < vmsAndProps.length; a++) {
- if($(vmsAndProps[a]).hasClass('vboxTableParent')) {
- vmid = $(vmsAndProps[a]).data('vm').id;
- vms[vmid] = {};
- vms[vmid]['id'] = vmid;
- continue;
- }
-
- var prop = $(vmsAndProps[a]).data('vmprop');
- vms[vmid][prop] = $(vmsAndProps[a]).children('td:eq(1)').children().first().text();
-
- }
-
- var file = $(self.form).find('[name=wizardExportApplianceLocation]').val();
- var format = $(self.form).find('[name=wizardExportApplianceFormat]').val();
- var manifest = $(self.form).find('[name=wizardExportApplianceManifest]').prop('checked');
- var overwrite = force;
-
- var l = new vboxLoader();
- l.add('applianceExport',function(d){
- if(d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- self.completed.resolve();
- },'progress_export_90px.png',
- trans('Export one or more VirtualBox virtual machines as an appliance','UIActionPool').replace(/\.+$/g,''),
- vboxBasename(file));
- } else {
- self.completed.reject();
- }
- },{'format':format,'file':file,'vms':vms,'manifest':manifest,'overwrite':overwrite});
- l.run();
-
- $(self.dialog).empty().remove();
-
-
- }
-
- /* Remove required classes */
- $(self.form).find('[name=wizardExportApplianceLocation]').removeClass('vboxRequired');
- $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
-
- /* Some vms must be selected */
- if($('#vboxExportProps').children('tr').length == 0) {
- $('#vboxExportAppVMListContainer').addClass('vboxRequired');
- return;
- }
-
- /* Check to see if file exists */
- var loc = $(self.form).find('[name=wizardExportApplianceLocation]').val();
- if(!loc) {
- $(self.form).find('[name=wizardExportApplianceLocation]').addClass('vboxRequired');
- return;
- }
-
- var fileExists = false;
- var fe = new vboxLoader();
- fe.add('fileExists',function(d){
- fileExists = d.responseData;
- },{'file':loc});
- fe.onLoad = function() {
- if(fileExists) {
- var buttons = {};
- buttons[trans('Yes','QIMessageBox')] = function() {
- vboxExportApp(1);
- $(this).empty().remove();
- };
- vboxConfirm(trans('A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.','UIMessageCenter').replace('%1',vboxBasename(loc)),buttons,trans('No','QIMessageBox'));
- return;
- }
- vboxExportApp(0);
-
- };
- fe.run();
-
- };
-
-}
-
-/**
- * Show the medium encryption dialog
- *
- * @param {String} context - used in dialog name
- * @param {Array} encIds - encryption ids
- *
- */
-function vboxMediumEncryptionPasswordsDialog(context, encIds, validIds) {
-
- if(!(encIds && encIds.length)) { return []; }
-
- var results = $.Deferred();
-
- var dialogTitle = trans("%1 - Disk Encryption").replace('%1', context);
-
- var l = new vboxLoader();
- l.addFileToDOM("panes/mediumEncryptionPasswords.html");
- l.onLoad = function() {
-
- for(var i = 0; i < encIds.length; i++) {
- vboxMediumEncryptionPasswordAdd(encIds[i].id, validIds && validIds.length && jQuery.inArray(encIds[i].id, validIds) > -1);
- }
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- // Get passwords
- var pws = vboxMediumEncryptionPasswordsGet();
- if(pws === false)
- return;
-
- $(this).trigger('close').empty().remove();
-
- results.resolve(pws);
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- results.reject();
- $(this).trigger('close').empty().remove();
- };
-
- $('#vboxMediumEncryptionPasswords').dialog({'closeOnEscape':true,'width':600,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + dialogTitle}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- });
-
- };
-
- l.run()
-
- return results.promise();
-}
-
-/**
- * Show the port forwarding configuration dialog
- * @param {Array} rules - list of port forwarding rules to process
- * @returns {Object} deferred promise
- */
-function vboxPortForwardConfigDialog(rules) {
-
- var results = $.Deferred();
-
- var l = new vboxLoader();
- l.addFileToDOM("panes/settingsPortForwarding.html");
- l.onLoad = function(){
-
- vboxSettingsPortForwardingInit(rules);
-
- var resizeTable = function() {
- var h = $('#vboxSettingsPortForwarding').children('table').hide().parent().innerHeight() - 16;
- $('#vboxSettingsPortForwarding').children('table').css({'height':h+'px'}).show();
- $('#vboxSettingsPortForwardingListDiv').css({'height':(h-6)+'px','overflow':'auto'});
-
-
- };
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- // Get rules
- var rules = $('#vboxSettingsPortForwardingList').children('tr');
- var rulesToPass = new Array();
- for(var i = 0; i < rules.length; i++) {
- if($(rules[i]).data('vboxRule')[3] == 0 || $(rules[i]).data('vboxRule')[5] == 0) {
- vboxAlert(trans("The current port forwarding rules are not valid. " +
- "None of the host or guest port values may be set to zero.",'UIMessageCenter'));
- return;
- }
- rulesToPass[i] = $(rules[i]).data('vboxRule');
- }
- $(this).trigger('close').empty().remove();
-
- results.resolve(rulesToPass);
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- results.reject();
- $(this).trigger('close').empty().remove();
- };
-
- $('#vboxSettingsPortForwarding').dialog({'closeOnEscape':true,'width':600,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Port Forwarding Rules','UIMachineSettingsPortForwardingDlg')}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- }).on('dialogresizestop',resizeTable);
-
- resizeTable();
- };
- l.run();
-
- return results.promise();
-}
-
-/**
- * Run the New Virtual Machine Wizard
- * @param {String} vmgroup - VM group to add machine to
- */
-function vboxWizardNewVMDialog(vmgroup) {
-
- // reference to self
- var self = this;
-
- // Extend vboxWizard class
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common settings */
- this.name = 'wizardNewVM';
- this.bg = 'images/vbox/vmw_new_welcome_bg.png';
- this.title = trans('Create Virtual Machine','UIWizardNewVM');
- this.icon = 'vm_new';
- this.steps = 3;
- this.vmgroup = vmgroup;
- this.context = 'UIWizardNewVM';
- this.finishText = trans('Create','UIWizardNewVM');
- this.data = [
- {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
- ];
-
- /* Function to run when wizard completes */
- this.onFinish = function() {
-
- // Callback to finish wizard
- var vboxNewVMFinish = function() {
-
- // Get parameters
- var disk = '';
- if($(self.form).find('[name=newVMDisk]:checked').val() == 'existing') {
- disk = $(self.form)[0].newVMDiskSelect.options[$(self.form)[0].newVMDiskSelect.selectedIndex].value;
- disk = vboxMedia.getMediumById(disk).location;
- }
- var name = jQuery.trim($(self.form).find('[name=newVMName]').val());
- var ostype = $(self.form).find('[name=newVMOSType]').val();
- var mem = parseInt($(self.form).find('[name=wizardNewVMSizeValue]').val());
-
- // Show loading screen
- var l = new vboxLoader('machineCreate');
- l.showLoading();
-
- $.when(vboxAjaxRequest('machineCreate',{'disk':disk,'ostype':ostype,'memory':mem,'name':name,'group':vmgroup}))
- .always(function() {
- l.removeLoading();
- }).done(function(res){
-
- if(res.responseData.exists) {
- vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(res.exists)).replace('%2',vboxDirname(res.exists)));
-
- } else if(res.success) {
- $(self.dialog).empty().remove();
- var lm = new vboxLoader('machineCreate');
- lm.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- lm.onLoad = function() {
- self.completed.resolve();
- };
- lm.run();
- } else {
- self.completed.reject();
- }
-
- });
-
- };
-
- // Name must exist
- if(!jQuery.trim($(self.form).find('[name=newVMName]').val())) {
- $(self.form).find('[name=newVMName]').addClass('vboxRequired');
- return;
- }
- $(self.form).find('[name=newVMName]').removeClass('vboxRequired');
-
- // Make sure file does not exist
- var fnl = new vboxLoader();
- fnl.add('vboxGetComposedMachineFilename',function(d){
-
- loc = vboxDirname(d.responseData);
- var fileExists = false;
-
- var fe = new vboxLoader('fileExists');
- fe.add('fileExists',function(d){
- fileExists = d.responseData;
- },{'file':loc});
- fe.onLoad = function() {
-
- if(fileExists) {
-
- vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(loc)).replace('%2',vboxDirname(loc)));
- // Go back
- self.displayStep(1);
-
- return;
- }
-
- // Start new harddisk wizard if create new is selected
- if($(self.form).find('[name=newVMDisk]:checked').val() == 'create') {
-
- // Recommended size
- var size = newVMOSTypesObj[$(self.form).find('[name=newVMOSType]').val()].recommendedHDD;
-
- $.when(new vboxWizardNewHDDialog({'name':jQuery.trim($(self.form).find('[name=newVMName]').val()),'size':size,'group':vmgroup}).run())
- .done(function(med){
-
- $(self.form).find('[name=newVMDisk]').eq(2).trigger('click').prop('checked',true);
-
- // Add newly created disk as option and select it
- vmNewFillExistingDisks(med);
-
- vboxNewVMFinish();
-
- });
-
- return;
-
- } else if($(self.form).find('[name=newVMDisk]:checked').val() == 'none') {
-
- buttons = {};
- buttons[trans('Continue','UIMessageCenter')] = function(){
- $(this).empty().remove();
- vboxNewVMFinish();
- };
- 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;
- }
-
- vboxNewVMFinish();
-
- };
- fe.run();
-
-
- },{'name':document.forms['frmwizardNewVM'].newVMName.value, 'group':vmgroup});
-
- fnl.run();
- };
-
-}
-
-/**
- * Run the Clone Virtual Machine Wizard
- * @param {Object} args - wizard data - args.vm and args.snapshot should be populated
- * @returns {Object} deferred promise
- * @see vboxWizard()
- */
-function vboxWizardCloneVMDialog(args) {
-
- // self reference
- var self = this;
-
- // Extend vboxWizard class
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common options */
- this.name = 'wizardCloneVM';
- this.title = trans('Clone Virtual Machine','UIWizardCloneVM');
- this.bg = 'images/vbox/vmw_clone_bg.png';
- this.icon = 'vm_clone';
- this.finishText = trans('Clone','UIWizardCloneVM');
- this.context = 'UIWizardCloneVM';
- this.widthAdvanced = 450;
- this.heightAdvanced = 350;
-
- /* Override run() because we need VM data */
- this.parentRun = this.run;
- this.run = function() {
-
- var l = new vboxLoader('vboxWizardCloneVMInit');
- l.showLoading();
- $.when(vboxVMDataMediator.getVMDetails(args.vm.id)).always(function() {
- // Always remove loading screen
- l.removeLoading();
- }).done(function(d){
- self.steps = (d.snapshotCount > 0 ? 3 : 2);
- self.args = $.extend(true,args,{'vm':d});
- self.parentRun();
- });
-
- return self.completed.promise();
-
- };
-
- /* Function to run when finished */
- this.onFinish = function() {
-
- // Get parameters
- var name = jQuery.trim($(self.form).find('[name=machineCloneName]').val());
- var src = self.args.vm.id;
- var snapshot = self.args.snapshot;
- var allNetcards = $(self.form).find('[name=vboxCloneReinitNetwork]').prop('checked');
-
- if(!name) {
- $(self.form).find('[name=machineCloneName]').addClass('vboxRequired');
- return;
- }
-
-
- // Only two steps? We can assume that state has no child states.
- // Force current state only
- var vmState = 'MachineState';
- if(self.steps > 2 || self.mode == 'advanced') {
- vmState = $(self.form).find('[name=vmState]:checked').val();
- }
-
- // Full / linked clone
- var cLink = $(self.form).find('[name=vboxCloneType]').eq(1).prop('checked');
-
- // wrap function
- var vbClone = function(sn) {
-
- $.when(vboxAjaxRequest('machineClone', {'name':name,'vmState':vmState,'src':src,'snapshot':sn,'reinitNetwork':allNetcards,'link':cLink}))
- .done(function(d){
- if(d.responseData.progress) {
- var registerVM = d.responseData.settingsFilePath;
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret) {
- $.when(vboxAjaxRequest('machineAdd',{'file':registerVM})).done(function(){
-
- $.when(vboxAjaxRequest('vboxGetMedia')).done(function(dat){
- $('#vboxPane').data('vboxMedia',dat.responseData);
- self.completed.resolve();
- }).fail(function(){
- self.completed.reject();
- });
- }).fail(function(){
- self.completed.reject();
- });
- },'progress_clone_90px.png',trans('Clone selected virtual machine','UIActionPool'),
- self.args.vm.name + ' > ' + name);
- } else {
- self.completed.reject();
- }
- }).fail(function(){
- self.completed.reject();
- });
- };
-
- // Check for linked clone, but not a snapshot
- if(cLink && !self.args.snapshot) {
-
- $.when(vboxAjaxRequest('snapshotTake',
- {'vm':src,'name':trans('Linked Base for %1 and %2','UIWizardCloneVM').replace('%1',self.args.vm.name).replace('%2',name),'description':''}))
- .done(function(d){
-
- if(d.responseData.progress) {
-
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- $.when(vboxVMDataMediator.getVMDetails(src, true)).done(function(md){
- vbClone(md.currentSnapshot);
- });
- },
- 'progress_snapshot_create_90px.png',
- trans('Take a snapshot of the current virtual machine state','UIActionPool'),
- self.args.vm.name);
-
- } else if(d && d.error) {
- self.completed.reject();
- vboxAlert(d.error);
- }
-
- }).fail(function(){
- self.completed.reject();
- });
-
- // Just clone
- } else {
- vbClone(snapshot);
- }
-
- $(self.dialog).empty().remove();
-
- };
-}
-
-/**
- * Run the VM Log Viewer dialog
- * @param {String} vm - uuid or name of virtual machine to obtain logs for
- */
-function vboxShowLogsDialogInit(vm) {
-
- $('#vboxPane').append($('<div />').attr({'id':'vboxVMLogsDialog'}));
-
- var l = new vboxLoader();
- l.add('machineGetLogFilesList',function(r){
- $('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
- },{'vm':vm.id});
- l.addFileToDOM('panes/vmlogs.html',$('#vboxVMLogsDialog'));
- l.onLoad = function(){
- var buttons = {};
- buttons[trans('Refresh','UIVMLogViewer')] = function() {
- l = new vboxLoader();
- l.add('machineGetLogFilesList',function(r){
- $('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
-
- },{'vm':vm.id});
- l.onLoad = function(){
- vboxShowLogsInit(vm);
- };
- l.run();
- };
- buttons[trans('Close','UIVMLogViewer')] = function(){$(this).trigger('close').empty().remove();};
- $('#vboxVMLogsDialog').dialog({'closeOnEscape':true,'width':800,'height':500,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/vm_show_logs_16px.png" class="vboxDialogTitleIcon" /> '+ trans('%1 - VirtualBox Log Viewer','UIVMLogViewer').replace('%1',vm.name)}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Close','UIVMLogViewer')+'")').trigger('click');
- });
- vboxShowLogsInit(vm);
- };
- l.run();
-
-}
-
-/**
- * Show the Virtual Media Manager Dialog
- * @param {Boolean} select - true to display "Select" button and resolve with selected medium
- * @param {String} type - optionally restrict media to media of this type
- * @param {Boolean} hideDiff - optionally hide differencing HardDisk media
- * @param {String} mPath - optional path to use when adding or creating media through the VMM dialog
- * @returns {Object} deferred promise
- */
-function vboxVMMDialog(select,type,hideDiff,mPath) {
-
- var results = $.Deferred();
-
- $('#vboxPane').append($('<div />').attr({'id':'vboxVMMDialog','class':'vboxVMMDialog'}));
-
- var l = new vboxLoader();
- l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);});
- l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.addFileToDOM('panes/vmm.html',$('#vboxVMMDialog'));
- l.onLoad = function() {
- var buttons = {};
- if(select) {
- buttons[trans('Select','UIMediumManager')] = function() {
- var sel = null;
- switch($("#vboxVMMTabs").tabs('option','active')) {
- case 0: /* HardDisks */
- sel = $('#vboxVMMHDList').find('tr.vboxListItemSelected').first();
- break;
- case 1: /* DVD */
- sel = $('#vboxVMMCDList').find('tr.vboxListItemSelected').first();
- break;
- default:
- sel = $('#vboxVMMFDList').find('tr.vboxListItemSelected').first();
- }
- if($(sel).length) {
- vboxMedia.updateRecent(vboxMedia.getMediumById($(sel).data('medium')));
- results.resolve($(sel).data('medium'));
- }
- $('#vboxVMMDialog').trigger('close').empty().remove();
- };
- }
- 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','UIMessageCenter')+'")').trigger('click');
- });
-
- vboxVMMInit(hideDiff,mPath);
-
- if(type) {
- switch(type) {
- case 'HardDisk':
- $("#vboxVMMTabs").tabs('option','active',0);
- $("#vboxVMMTabs").tabs('disable',1);
- $("#vboxVMMTabs").tabs('disable',2);
- break;
- case 'DVD':
- $("#vboxVMMTabs").tabs('option','active',1);
- $("#vboxVMMTabs").tabs('disable',0);
- $("#vboxVMMTabs").tabs('disable',2);
- break;
- case 'Floppy':
- $("#vboxVMMTabs").tabs('option','active',2);
- $("#vboxVMMTabs").tabs('disable',0);
- $("#vboxVMMTabs").tabs('disable',1);
- break;
- default:
- $("#vboxVMMTabs").tabs('option','active',0);
- break;
- }
- }
- };
- l.run();
-
- return results.promise();
-}
-
-/**
- * Run the New Virtual Disk wizard
- * @param {Object} suggested - sugggested defaults such as hard disk name and path
- */
-function vboxWizardNewHDDialog(suggested) {
-
- // reference
- var self = this;
-
- // Extend vboxWizard class
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common options */
- this.name = 'wizardNewHD';
- this.title = trans('Create Virtual Hard Disk','UIWizardNewVD');
- this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
- this.icon = 'hd';
- this.steps = 3;
- this.suggested = suggested;
- this.context = 'UIWizardNewVD';
- this.finishText = trans('Create','UIWizardNewVD');
- this.height = 450;
-
- this.data = [
- {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);}},
- {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
- ];
-
- // Compose folder if suggested name exists
- if(this.suggested && this.suggested.name) {
- if(!this.suggested['group']) this.suggested.group = '';
- this.data.push(
- {'fn':'vboxGetComposedMachineFilename','callback':function(d){
- self.suggested.path = vboxDirname(d.responseData)+$('#vboxPane').data('vboxConfig').DSEP;
- },'args':{'name':this.suggested.name, 'group':this.suggested.group}});
- }
-
- /* Function to run when wizard completes */
- this.onFinish = function() {
-
- // Fix size if we need to
- var mbytes = vboxConvertMbytes($(self.form).find('[name=wizardNewHDSizeValue]').val());
- $(self.form).find('[name=wizardNewHDSizeValue]').val(vboxMbytesConvert(mbytes));
- $('#wizardNewHDSizeLabel').html(vboxMbytesConvert(mbytes) + ' ('+mbytes+' '+trans('MB','VBoxGlobal')+')');
-
- // Determine file location
- var file = $(self.form).find('[name=wizardNewHDLocation]').val();
- if(file.search(/[\/|\\]/) < 0) {
- // just a name
- if(self.suggested.path) {
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true){
- file = self.suggested.path + $('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + file;
- } else {
- file = self.suggested.path + $('#vboxPane').data('vboxConfig').DSEP + file;
- }
- } else{
- if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true){
- file = $('#vboxPane').data('vboxSystemProperties').homeFolder + $('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + file;
- } else {
- file = $('#vboxPane').data('vboxSystemProperties').homeFolder + $('#vboxPane').data('vboxConfig').DSEP + file;
- }
- }
-
- // Enforce VM ownership
- } else if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true) {
- // has user ownership so use folderbased
- var nameIndex = file.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
- var path = file.substr(0,nameIndex);
- var name = file.substr(nameIndex+1,file.length);
- file = path +$('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + name;
- }
-
- var format = $(self.form)[0].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;
- }
- }
-
- // append filename ext?
- if(jQuery.inArray(file.substring(file.lastIndexOf('.')+1).toLowerCase(),formatOpts.extensions) < 0) {
- file += '.'+formatOpts.extensions[0];
- }
-
- // Normalize file
- file = file.replace($('#vboxPane').data('vboxConfig').DSEP+$('#vboxPane').data('vboxConfig').DSEP,$('#vboxPane').data('vboxConfig').DSEP);
-
- /* Check to see if file exists */
- var fileExists = false;
- var l = new vboxLoader('fileExists');
- l.add('fileExists',function(d){
- fileExists = d.responseData;
- },{'file':file});
- l.onLoad = function() {
- if(fileExists) {
- vboxAlert(trans("<p>The hard disk storage unit at location <b>%1</b> already " +
- "exists. You cannot create a new virtual hard disk that uses this " +
- "location because it can be already used by another virtual hard " +
- "disk.</p>" +
- "<p>Please specify a different location.</p>",'UIMessageCenter').replace('%1',file));
- return;
- }
- var fsplit = $(self.form).find('[name=newHardDiskSplit]').prop('checked');
- var size = vboxConvertMbytes($(self.form).find('[name=wizardNewHDSizeValue]').val());
- var type = ($(self.form).find('[name=newHardDiskType]').eq(1).prop('checked') ? 'fixed' : 'dynamic');
- var nl = new vboxLoader('mediumCreateBaseStorage');
- nl.add('mediumCreateBaseStorage',function(d){
- if(d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret) {
- var ml = new vboxLoader();
- ml.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
- ml.onLoad = function() {
- var med = vboxMedia.getMediumByLocation(file);
- if(med) {
- vboxMedia.updateRecent(med);
- self.completed.resolve(med.id);
- } else {
- self.completed.reject();
- }
- };
- ml.run();
- },'progress_media_create_90px.png',trans('Create a virtual hard disk now','UIWizardNewVM'),
- vboxBasename(file),true);
- } else {
- self.completed.reject();
- }
- },{'file':file,'type':type,'size':size,'format':format,'split':fsplit});
- nl.run();
-
- $(self.dialog).empty().remove();
- };
- l.run();
-
- };
-}
-
-/**
- * Run the Copy Virtual Disk wizard
- * @param {Object} suggested - sugggested defaults such as hard disk name and path
- */
-function vboxWizardCopyHDDialog(suggested) {
-
- // reference
- var self = this;
-
- /* Extend vboxWizard class */
- this.parentClass = vboxWizard;
- this.parentClass();
-
- /* Common options */
- this.name = 'wizardCopyHD';
- this.title = trans('Copy Virtual Hard Disk','UIWizardCloneVD');
- this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
- this.icon = 'hd';
- this.steps = 4;
- this.suggested = suggested;
- this.context = 'UIWizardCloneVD';
- this.finishText = trans('Copy','UIWizardCloneVD');
- this.height = 450;
-
- this.data = [
- {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);}},
- {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
- ];
-
-
- /* Function run when wizard completes */
- this.onFinish = function() {
-
- var format = $(self.form)[0].elements['copyHDFileType'];
- var formatOpts = {};
- for(var i = 0; i < format.length; i++) {
- if(format[i].checked) {
- formatOpts = $(format[i]).closest('tr').data('vboxFormat');
- break;
- }
- }
-
- var src = $(self.form).find('[name=copyHDDiskSelect]').val();
- var type = ($(self.form).find('[name=newHardDiskType]').eq(1).prop('checked') ? 'fixed' : 'dynamic');
- var format = $(self.form)[0].elements['copyHDFileType'];
- for(var i = 0; i < format.length; i++) {
- if(format[i].checked) {
- format=format[i].value;
- break;
- }
- }
-
- var fsplit = $(self.form).find('[name=newHardDiskSplit]').prop('checked') && vboxMedia.formatSupportsSplit(format);
-
- var loc = jQuery.trim($(self.form).find('[name=wizardCopyHDLocation]').val());
- if(!loc) {
- $(self.form).find('[name=wizardCopyHDLocation]').addClass('vboxRequired');
- return;
- }
- $(self.form).find('[name=wizardCopyHDLocation]').removeClass('vboxRequired');
- if(loc.search(/[\/|\\]/) < 0) {
- if($('#wizardCopyHDStep4').data('suggestedpath')) {
- loc = $('#wizardCopyHDStep4').data('suggestedpath') + loc;
- } else {
- loc = vboxDirname(vboxMedia.getMediumById(src).location) + $('#vboxPane').data('vboxConfig').DSEP + loc;
- }
- }
-
- // append ext?
- if(jQuery.inArray(loc.substring(loc.lastIndexOf('.')+1).toLowerCase(),formatOpts.extensions) < 0) {
- loc += '.'+formatOpts.extensions[0];
- }
-
-
- /* Check to see if file exists */
- var fileExists = false;
- var fe = new vboxLoader();
- fe.add('fileExists',function(d){
- fileExists = d.responseData;
- },{'file':loc});
- fe.onLoad = function() {
- if(fileExists) {
- vboxAlert(trans("<p>The hard disk storage unit at location <b>%1</b> already " +
- "exists. You cannot create a new virtual hard disk that uses this " +
- "location because it can be already used by another virtual hard " +
- "disk.</p>" +
- "<p>Please specify a different location.</p>",'UIMessageCenter').replace('%1',loc));
- return;
- }
- $(self.dialog).empty().remove();
-
- var l = new vboxLoader();
- l.add('mediumCloneTo',function(d){
- if(d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret,mid) {
- var ml = new vboxLoader();
- ml.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
- ml.onLoad = function() {
- med = vboxMedia.getMediumByLocation(loc);
- vboxMedia.updateRecent(med);
- self.completed.resolve(mid);
- };
- ml.run();
- },'progress_media_create_90px.png',trans('Copy Virtual Hard Disk','UIWizardCloneVD'),
- vboxBasename(vboxMedia.getMediumById(src).location) + ' > ' + vboxBasename(loc));
- } else {
- self.completed.reject();
- }
- },{'src':vboxMedia.getMediumById(src).location,'type':type,'format':format,'location':loc,'split':fsplit});
- l.run();
- };
- fe.run();
-
-
- };
-}
-
-/**
- * Display guest network adapters dialog
- * @param {String} vm - virtual machine uuid or name
- */
-function vboxGuestNetworkAdaptersDialogInit(vm) {
-
- /*
- * Dialog
- */
- $('#vboxPane').append($('<div />').attr({'id':'vboxGuestNetworkDialog','style':'display: none'}));
-
- /*
- * Loader
- */
- var l = new vboxLoader();
- l.addFileToDOM('panes/guestNetAdapters.html',$('#vboxGuestNetworkDialog'));
- l.onLoad = function(){
-
- var buttons = {};
- buttons[trans('Close','UIVMLogViewer')] = function() {$('#vboxGuestNetworkDialog').trigger('close').empty().remove();};
- $('#vboxGuestNetworkDialog').dialog({'closeOnEscape':true,'width':500,'height':250,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Guest Network Adapters','VBoxGlobal')}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Close','UIVMLogViewer')+'")').trigger('click');
- });
-
- // defined in pane
- vboxVMNetAdaptersInit(vm,nic);
- };
- l.run();
-
-}
-
-
-/**
- * Display Global Preferences dialog
- */
-
-function vboxGlobalPrefsDialog() {
-
- // Prefs
- var panes = new Array(
- {'name':'GlobalGeneral','label':'General','icon':'machine','context':'UIGlobalSettingsGeneral'},
- {'name':'GlobalLanguage','label':'Language','icon':'site','context':'UIGlobalSettingsLanguage'},
- {'name':'GlobalNetwork','label':'Network','icon':'nw','context':'UIGlobalSettingsNetwork','tabbed':true},
- {'name':'GlobalUsers','label':'Users','icon':'register','context':'UIUsers'}
- );
-
- var data = new Array(
- {'fn':'hostOnlyInterfacesGet','callback':function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);}},
- {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxSettingsDialog').data('vboxSystemProperties',d.responseData);}},
- {'fn':'vboxNATNetworksGet','callback':function(d){$('#vboxSettingsDialog').data('vboxNATNetworks',d.responseData);}},
- {'fn':'getUsers','callback':function(d){$('#vboxSettingsDialog').data('vboxUsers',d.responseData);}}
- );
-
- // Check for noAuth setting
- if($('#vboxPane').data('vboxConfig').noAuth || !$('#vboxPane').data('vboxSession').admin || !$('#vboxPane').data('vboxConfig').authCapabilities.canModifyUsers) {
- panes.pop();
- data.pop();
- }
-
- $.when(vboxSettingsDialog(trans('Preferences...','UIActionPool').replace(/\./g,''),
- panes,data,null,'global_settings','UISettingsDialogGlobal'))
- .done(function(){
-
- var l = new vboxLoader();
-
- // Language change?
- if($('#vboxSettingsDialog').data('language') && $('#vboxSettingsDialog').data('language') != __vboxLangName) {
- vboxSetCookie('vboxLanguage',$('#vboxSettingsDialog').data('language'));
- l.onLoad = function(){location.reload(true);};
-
- }
-
- l.add('vboxNATNetworksSave',function(){return;},{'networks':$('#vboxSettingsDialog').data('vboxNATNetworks')});
- l.add('hostOnlyInterfacesSave',function(){return;},{'networkInterfaces':$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces});
- l.add('vboxSystemPropertiesSave',function(){return;},{'SystemProperties':$('#vboxSettingsDialog').data('vboxSystemProperties')});
- l.run();
-
- // Update system properties
- $('#vboxPane').data('vboxSystemProperties',$('#vboxSettingsDialog').data('vboxSystemProperties'));
-
- });
-
-}
-
-
-
-/**
- * Display a virtual machine settings dialog
- * @param {String} vm - uuid or name of virtual machine
- * @param {String} pane - optionally automatically select pane when dialog is displayed
- * @returns {Object} deferred promise
- */
-function vboxVMsettingsDialog(vm,pane) {
-
- var results = $.Deferred();
-
- if(typeof(vm) == 'string')
- vm = vboxVMDataMediator.getVMData(vm);
-
- // Only show these dialogs once per change
- var reloadConfirmShowing = false;
-
- // Handler for when VM settings have changed
- /////////////////////////////////////////////
- var machineSettingsChanged = function(e, eventList) {
-
- for(var i = 0; i < eventList.length; i++) {
-
- ////////////////////////////////
- //
- // Machine data changed..
- //
- ////////////////////////////////
- switch(eventList[i].eventType) {
-
- case 'OnMachineStateChanged':
-
- if(!eventList[i].machineId || eventList[i].machineId != vm.id) break;
-
- // Display loading screen
- var l = new vboxLoader();
- l.showLoading();
-
- $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
- // data received from deferred object
- $('#vboxSettingsDialog').data('vboxMachineData',vmData);
- $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
- $('#vboxSettingsDialog').trigger('dataLoaded');
- l.removeLoading();
- if(vboxVMStates.isRunning(vmData)) {
- vboxAlert(trans('The virtual machine that you are changing has been started. Only certain settings can be changed while a machine is running. All other changes will be lost if you close this window now.','UIMessageCenter'));
- }
- });
-
- break;
-
- // Unregistered machine
- case 'OnMachineRegistered':
-
- if(!eventList[i].machineId || eventList[i].machineId != vm.id || eventList[i].registered) break;
-
- $('#vboxSettingsDialog').parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- break;
-
- case 'OnMachineDataChanged':
- case 'OnNetworkAdapterChanged':
- case 'OnVRDEServerInfoChanged':
- case 'OnCPUChanged':
- case 'OnStorageControllerChanged':
- case 'OnMediumChanged':
- case 'OnVRDEServerChanged':
- case 'OnUSBControllerChanged':
- case 'OnSharedFolderChanged':
- case 'OnCPUExecutionCapChanged':
- case 'OnStorageDeviceChanged':
- case 'OnNATRedirect':
-
- if(!eventList[i].machineId || eventList[i].machineId != vm.id) break;
-
- // already showing reload confirmation
- if(reloadConfirmShowing) break;
-
- var buttons = {};
- buttons[trans('Reload settings','UIMessageCenter')] = function() {
-
- // Display loading screen
- var l = new vboxLoader();
- l.showLoading();
-
- $(this).empty().remove();
-
- /*
- * Data to be reloaded
- */
- var reload = [
- vboxAjaxRequest('vboxGetMedia',{}).done(function(d){$('#vboxPane').data('vboxMedia',d.responseData);}),
-
- vboxAjaxRequest('getNetworking',{}).done(function(d){$('#vboxSettingsDialog').data('vboxNetworking',d.responseData);}),
-
- vboxAjaxRequest('vboxRecentMediaGet',{}).done(function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);}),
-
- vboxAjaxRequest('consoleGetSharedFolders',{'vm':vm.id}).done(function(d){$('#vboxSettingsDialog').data('vboxTransientSharedFolders',d.responseData);}),
-
- $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
-
- // data received from deferred object
- $('#vboxSettingsDialog').data('vboxMachineData',vmData);
- $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
-
- })
- ];
-
- // Only when all of these are done
- $.when.apply($, reload).done(function(){
-
- /* Change title and tell dialog that data is loaded */
- $('#vboxSettingsDialog').trigger('dataLoaded').dialog('option','title','<img src="images/vbox/vm_settings_16px.png" class="vboxDialogTitleIcon" /> ' +
- $('<div />').text($('#vboxSettingsDialog').data('vboxMachineData').name).text() + ' - ' + trans('Settings','UISettingsDialog'));
-
- l.removeLoading();
- reloadConfirmShowing = false;
- });
-
-
- };
-
- reloadConfirmShowing = true;
-
- vboxConfirm(trans("<p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p>",'UIMessageCenter'),
- buttons,
- trans('Keep changes', 'UIMessageCenter'), function(){
- reloadConfirmShowing = false;
- });
-
- return;
-
- }
- }
- };
-
- // Watch for changed VM settings
- $('#vboxPane').on('vboxEvents',machineSettingsChanged);
-
- $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
-
-
- /*
- * Settings dialog data
- */
- var dataList = new Array(
- {'fn':'vboxGetMedia','callback':function(d){
-
- $('#vboxPane').data('vboxMedia',d.responseData);
-
- // data received from deferred object
- $('#vboxSettingsDialog').data('vboxMachineData',vmData);
- $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
-
- }},
- {'fn':'getNetworking','callback':function(d){$('#vboxSettingsDialog').data('vboxNetworking',d.responseData);}},
- {'fn':'hostGetDetails','callback':function(d){$('#vboxSettingsDialog').data('vboxHostDetails',d.responseData);}},
- {'fn':'vboxGetEnumerationMap','callback':function(d){$('#vboxSettingsDialog').data('vboxNetworkAdapterTypes',d.responseData);},'args':{'class':'NetworkAdapterType'}},
- {'fn':'vboxGetEnumerationMap','callback':function(d){$('#vboxSettingsDialog').data('vboxAudioControllerTypes',d.responseData);},'args':{'class':'AudioControllerType'}},
- {'fn':'vboxRecentMediaGet','callback':function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);}},
- {'fn':'consoleGetSharedFolders','callback':function(d){$('#vboxSettingsDialog').data('vboxTransientSharedFolders',d.responseData);},'args':{'vm':vm.id}}
- );
-
- /*
- * Settings dialog panes
- */
- var panes = new Array(
-
- {name:'General',label:'General',icon:'machine',tabbed:true,context:'UIMachineSettingsGeneral'},
- {name:'System',label:'System',icon:'chipset',tabbed:true,context:'UIMachineSettingsSystem'},
- {name:'Display',label:'Display',icon:'vrdp',tabbed:true,context:'UIMachineSettingsDisplay'},
- {name:'Storage',label:'Storage',icon:'attachment',context:'UIMachineSettingsStorage'},
- {name:'Audio',label:'Audio',icon:'sound',context:'UIMachineSettingsAudio'},
- {name:'Network',label:'Network',icon:'nw',tabbed:true,context:'UIMachineSettingsNetwork'},
- {name:'SerialPorts',label:'Serial Ports',icon:'serial_port',tabbed:true,context:'UIMachineSettingsSerial'},
- {name:'ParallelPorts',label:'Parallel Ports',icon:'parallel_port',tabbed:true,disabled:(!$('#vboxPane').data('vboxConfig').enableLPTConfig),context:'UIMachineSettingsParallel'},
- {name:'USB',label:'USB',icon:'usb',context:'UIMachineSettingsUSB'},
- {name:'SharedFolders',label:'Shared Folders',icon:'sf',context:'UIMachineSettingsSF'}
-
- );
-
- /*
- * Check for encryption settings change
- */
- var presaveCallback = function() {
-
- if(!$('#vboxSettingsDialog').data('vboxEncSettingsChanged'))
- return true;
-
- var encMediaSettings = $.Deferred();
-
- // Validate
- if(!vboxSettingsGeneralValidate()) {
- $('#vboxSettingsMenuList').children('li:eq(0)').first().click();
- $('#vboxSettingsPane-General').tabs('option','active', 3);
- encMediaSettings.reject();
- return encMediaSettings;
- }
-
- var vm = $('#vboxSettingsDialog').data('vboxMachineData');
- var media = vboxStorage.getAttachedBaseMedia(vm);
- var encIds = vboxMedia.getEncryptedMediaIds(media);
- var encMedia = vboxMedia.getEncryptedMedia(media);
-
- var formCipher = $('#vboxSettingsDialog').data('vboxEncCipher');
- var formPassword = $('#vboxSettingsDialog').data('vboxEncPw');
- var formEncEnabled = $('#vboxSettingsDialog').data('vboxEncEnabled');
-
- // If encryption is not enabled, cipher needs to be blank
- if(!formEncEnabled) {
- formCipher = '';
- }
-
- // Get encryption password(s)
- $.when(vboxMediumEncryptionPasswordsDialog(vm.name, encIds))
-
- .done(function(pwdata) {
-
- var runs = []
-
- // Each medium attached
- for(var i = 0; i < media.length; i++) {
- // Only hard disks
- if(media[i].deviceType != 'HardDisk') continue;
-
- var id = vm.name;
- var oldpw = "";
- var cipher = null;
-
- // Check for existing encryption setting
- for(var a = 0; a < encMedia.length; a++) {
- if(encMedia[a].medium == media[i].id) {
- cipher = media[i].encryptionSettings.cipher;
- // Look in passwords for id
- for(var b = 0; b < pwdata.length; b++) {
- if(pwdata[b].id == id) {
- oldpw = pwdata[b].password;
- break;
- }
- }
- break;
- }
- }
-
- runs.push({
- medium: media[i].id,
- cipher: cipher,
- encId: id,
- password: oldpw
- });
-
- }
- // No encrypted media changes
- if(!runs.length) {
- encMediaSettings.resolve();
- return;
- }
-
- var l = new vboxLoader();
- l.showLoading();
-
- (function doruns(encMediaRuns){
-
- if(!encMediaRuns.length) {
- l.removeLoading();
- encMediaSettings.resolve();
- return;
- }
-
- var run = encMediaRuns.shift();
-
- // If encryption is enabled, and cypher is blank / "Leave Unchanged"
- // keep the original cipher
- var mcipher = formCipher;
- if(formEncEnabled && !mcipher) {
- mcipher = run.cipher;
- }
-
- var rdata = {
- medium: run.medium,
- id: run.encId,
- old_password: run.password,
- cipher: mcipher,
- password: formPassword
- };
-
- $.when(vboxAjaxRequest('mediumChangeEncryption',rdata)).done(function(d){
-
- if(d.responseData.progress) {
- var icon = 'progress_media_create_90px.png';
- var title = trans('Encryption');
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- // Loop
- doruns(encMediaRuns);
- },icon,title,vboxMedia.getMediumById(run.medium).name, true);
- } else {
- l.removeLoading();
- encMediaSettings.reject();
- return;
- }
-
- });
-
- })(runs);
-
- })
- .fail(function() {
- encMediaSettings.reject();
- });
-
- return encMediaSettings.promise();
-
- }
-
- $.when(vboxSettingsDialog(vmData.name + ' - ' + trans('Settings','UISettingsDialog'),panes,dataList,pane,'vm_settings','UISettingsDialogMachine', presaveCallback))
-
- // Always run this
- .always(function(){
-
- // No longer watch for changed VM settings
- $('#vboxPane').unbind('vboxEvents',machineSettingsChanged);
-
- })
-
- // Run this when "Save" is clicked
- .done(function() {
-
- var loader = new vboxLoader();
- var sdata = $.extend($('#vboxSettingsDialog').data('vboxMachineData'),{'clientConfig':$('#vboxPane').data('vboxConfig')});
- loader.add('machineSave',function(){return;},sdata);
- loader.onLoad = function() {
- // Refresh media
- var mload = new vboxLoader();
- mload.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- mload.onLoad = function() {
- results.resolve();
- };
- mload.run();
- };
- loader.run();
- });
-
- });
-
- return results.promise();
-}
-
-
-
-
-/**
- * Run the "First Run" wizard
- * @param {Object} vm - VM details object
- */
-function vboxWizardFirstRunDialog(vm) {
-
- // ref
- var self = this;
-
- this.parentClass = vboxWizard;
- this.parentClass();
-
- this.name = 'wizardFirstRun';
- this.title = $('<div />').text(vm.name).html();
- this.bg = 'images/vbox/vmw_first_run_bg.png';
- this.icon = vboxGuestOSTypeIcon(vm.OSTypeId);
- this.steps = 1;
- this.finishText = trans('Start','UIWizardFirstRun');
- this.context = 'UIWizardFirstRun';
- this.noAdvanced = true;
- this.args = vm;
-
- // This still resolves on cancel
- this.onCancel = function () {
- self.completed.resolve();
- };
-
- this.onFinish = function() {
-
- var med = vboxMedia.getMediumById($('#wizardFirstRunMedia').find(":selected").attr('value'));
-
- $(self.dialog).empty().remove();
-
- if(med) {
-
- var port = null;
- var device = null;
- var bus = null;
- var controller = null;
-
- for(var i = 0; i < self.args.storageControllers.length; i++) {
- for(var a = 0; a < self.args.storageControllers[i].mediumAttachments.length; a++) {
- if(self.args.storageControllers[i].mediumAttachments[a].type == "DVD" &&
- self.args.storageControllers[i].mediumAttachments[a].medium == null) {
-
- port = self.args.storageControllers[i].mediumAttachments[a].port;
- device = self.args.storageControllers[i].mediumAttachments[a].device;
- bus = self.args.storageControllers[i].bus;
- controller = self.args.storageControllers[i].name;
-
- break;
- }
- }
- }
-
-
- var args = {'vm':self.args.id,
- 'medium':med,
- 'port':port,
- 'device':device,
- 'bus':bus,
- 'controller':controller,
- 'noSave':true
- };
-
- // Ajax request to mount medium
- var mount = new vboxLoader();
- mount.add('mediumMount',function(ret){
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function(){
- self.completed.resolve();
- };
- l.run();
- },args);
- mount.run();
-
-
- } else {
- self.completed.resolve();
- }
-
- };
-}
-
-
-/**
- * Display a settings dialog (generic) called by dialog initializers
- * @param {String} title - title of dialog
- * @param {Array} panes - list of panes {Object} to load
- * @param {Object} data - list of data to load
- * @param {String} pane - optionally automatically select pane when dialog is shown
- * @param {String} icon - optional URL to icon for dialog
- * @param {String} langContext - language context to use for translations
- * @param {Function} presave - presave callback to run
- * @returns {Object} deferred promise
- * @see trans()
- */
-function vboxSettingsDialog(title,panes,data,pane,icon,langContext,presave) {
-
- var results = $.Deferred();
-
- var d = $('<div />').attr({'id':'vboxSettingsDialog','style':'display: none;'});
-
- var f = $('<form />').attr({'name':'frmVboxSettings','style':'height: 100%'});
-
- var t = $('<table />').attr({'style':'height: 100%;','class':'vboxSettingsTable'});
-
- var tr = $('<tr />');
-
- $($('<td />').attr({'id':'vboxSettingsMenu','style': (panes.length == 1 ? 'display:none;' : '')})).append($('<ul />').attr({'id':'vboxSettingsMenuList','class':'vboxHover'})).appendTo(tr);
-
- var td = $('<td />').attr({'id':'vboxSettingsPane'}).css({'height':'100%'});
-
- // Settings table contains title and visible settings pane
- var stbl = $('<table />').css({'height':'100%','width':'100%','padding':'0px','margin':'0px','border':'0px','border-spacing':'0px'});
-
- // Title
- var d1 = $('<div />').attr({'id':'vboxSettingsTitle'}).html('Padding').css({'display':(panes.length == 1 ? 'none' : '')});
- $(stbl).append($('<tr />').append($('<td />').css({'height':'1%','padding':'0px','margin':'0px','border':'0px'}).append(d1)));
-
-
- // Settings pane
- var d1 = $('<div />').attr({'id':'vboxSettingsList'}).css({'width':'100%'});
-
- $(stbl).append($('<tr />').append($('<td />').css({'padding':'0px','margin':'0px','border':'0px'}).append(d1)));
-
-
- $(td).append(stbl).appendTo(tr);
-
- $(d).append($(f).append($(t).append(tr))).appendTo('#vboxPane');
-
- /* Load panes and data */
- var loader = new vboxLoader();
-
- /* Load Data */
- for(var i = 0; i < data.length; i++) {
- loader.add(data[i].fn,data[i].callback,(data[i].args ? data[i].args : undefined));
- }
-
- /* Load settings panes */
- for(var i = 0; i < panes.length; i++) {
-
- if(panes[i].disabled) continue;
-
- // Menu item
- $('<li />').html('<div><img src="images/vbox/'+panes[i].icon+'_16px.png" /></div> <div>'+trans(panes[i].label,langContext)+'</div>').data(panes[i]).click(function(){
-
- $('#vboxSettingsTitle').html(trans($(this).data('label'),langContext));
-
- $(this).addClass('vboxListItemSelected').siblings().addClass('vboxListItem').removeClass('vboxListItemSelected');
-
- // jquery apply this css to everything with class .settingsPa..
- $('#vboxSettingsDialog .vboxSettingsPaneSection').css({'display':'none'});
-
- // Show selected pane
- $('#vboxSettingsPane-' + $(this).data('name')).css({'display':''}).children().first().trigger('show');
-
- }).on("mouseenter",function(){$(this).addClass('vboxHover');}).on("mouseleave",function(){$(this).removeClass('vboxHover');}).appendTo($('#vboxSettingsMenuList'));
-
-
- // Settings pane
- $('#vboxSettingsList').append($('<div />').attr({'id':'vboxSettingsPane-'+panes[i].name,'style':'display: none;','class':'vboxSettingsPaneSection ui-corner-all ' + (panes[i].tabbed ? 'vboxTabbed' : 'vboxNonTabbed')}));
-
- loader.addFileToDOM('panes/settings'+panes[i].name+'.html',$('#vboxSettingsPane-'+panes[i].name));
-
- }
-
- loader.onLoad = function(){
-
-
- /* Init UI Items */
- for(var i = 0; i < panes.length; i++) {
- vboxInitDisplay($('#vboxSettingsPane-'+panes[i].name),panes[i].context);
- if(panes[i].tabbed) $('#vboxSettingsPane-'+panes[i].name).tabs();
- }
-
- /* Tell dialog that data is loaded */
- $('#vboxSettingsDialog').trigger('dataLoaded');
-
- var buttons = { };
- buttons[trans('OK','QIMessageBox')] = function() {
-
- $(this).trigger('save');
-
- // Does some settings pane need to do some presave
- // work? (ask questions, run wizard, some other asynch task)
- var promise = true;
- if(presave) {
- promise = presave();
- }
- var dlg = this;
- $.when(promise).done(function() {
- results.resolve(true);
- $(dlg).trigger('close').empty().remove();
- $(document).trigger('click');
- });
- };
- buttons[trans('Cancel','QIMessageBox')] = function() {
- results.reject();
- $(this).trigger('close').empty().remove();
- $(document).trigger('click');
- };
-
- // Init with "nothing has changed yet"
- $('#vboxSettingsDialog').data('formDataChanged', false);
-
- // Show dialog
- $('#vboxSettingsDialog').dialog({'closeOnEscape':true,'width':(panes.length > 1 ? 900 : 600),'height':(panes.length > 1 ? 500 : 450),'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxSettingsDialog vboxDialogContent','title':(icon ? '<img src="images/vbox/'+icon+'_16px.png" class="vboxDialogTitleIcon" /> ' : '') + title}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- });
-
- // Resize pane
- $('#vboxSettingsList').height($('#vboxSettingsList').parent().innerHeight()-8).css({'overflow':'auto','padding':'0px','margin-top':'8px','border':'0px','border-spacing':'0px'});
-
- // Resizing dialog, resizes this too
- $('#vboxSettingsDialog').on('dialogresizestop',function(){
- var h = $('#vboxSettingsList').css({'display':'none'}).parent().innerHeight();
- $('#vboxSettingsList').height(h-8).css({'display':''});
- });
-
- /* Select first or passed menu item */
- var i = 0;
- var offset = 0;
- var tab = undefined;
- if(typeof pane == "string") {
- var section = pane.split(':');
- if(section[1]) tab = section[1];
- for(i = 0; i < panes.length; i++) {
- if(panes[i].disabled) offset++;
- if(panes[i].name == section[0]) break;
- }
- }
- i-=offset;
- if(i >= panes.length) i = 0;
- $('#vboxSettingsMenuList').children('li:eq('+i+')').first().click().each(function(){
- if(tab !== undefined) {
- // Check for out of scope tab
- tab = Math.min(($('#vboxSettingsPane-'+$(this).data('name')).children('ul').first().children().length-1), parseInt(tab));
- $('#vboxSettingsPane-'+$(this).data('name')).tabs('option','active', tab);
- }
-
- });
-
- /* Only 1 pane? */
- if(panes.length == 1) {
- $('#vboxSettingsDialog table.vboxSettingsTable').css('width','100%');
- $('#vboxSettingsDialog').dialog('option','title',(icon ? '<img src="images/vbox/'+icon+'_16px.png" class="vboxDialogTitleIcon" /> ' : '') + trans(panes[0].label,langContext));
- }
-
-
- };
-
- loader.run();
-
- return results.promise();
-
-}
+/**
+ * @fileOverview Dialog logic for various wizards and other dialogs
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: dialogs.js 599 2015-07-27 10:40:37Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ */
+
+/**
+ * Run the import appliance wizard
+ */
+function vboxWizardImportApplianceDialog() {
+
+ // reference
+ var self = this;
+
+ // Extend vboxWizard
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common settings */
+ this.name = 'wizardImportAppliance';
+ this.title = trans('Import Virtual Appliance','UIWizardImportApp');
+ this.bg = 'images/vbox/vmw_ovf_import_bg.png';
+ this.icon = 'import';
+ this.steps = 2;
+ this.height = 500;
+ this.finishText = trans('Import','UIWizardImportApp');
+ this.context = 'UIWizardImportApp';
+
+ /* Restore defaults is added to last step */
+ this.stepButtons = [
+ {
+ 'name' : trans('Restore Defaults','UIWizardImportApp'),
+ 'steps' : [-1],
+ 'click' : function() {
+ wizardImportApplianceParsed();
+ }
+ }
+ ];
+
+ /* Data to be loaded */
+ this.data = [
+ {'fn':'vboxGetEnumerationMap','args':{'class':'NetworkAdapterType'},'callback':function(d){$('#vboxPane').data('vboxNetworkAdapterTypes',d.responseData);}},
+ {'fn':'vboxGetEnumerationMap','args':{'class':'AudioControllerType'},'callback':function(d){$('#vboxPane').data('vboxAudioControllerTypes',d.responseData);}},
+ ];
+
+ /* Perform action on finish */
+ this.onFinish = function() {
+
+ var file = $(self.form).find('[name=wizardImportApplianceLocation]').val();
+ var descriptions = $('#vboxImportProps').data('descriptions');
+ var reinitNetwork = $(self.form).find('[name=vboxImportReinitNetwork]').prop('checked');
+
+ // Check for descriptions
+ if(!descriptions) {
+ return;
+ }
+
+
+ /** Call Appliance import AJAX function */
+ var vboxImportApp = function() {
+
+ $(self.dialog).empty().remove();
+
+ var l = new vboxLoader();
+ l.add('applianceImport',function(d){
+ if(d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ // Imported media must be refreshed
+ var ml = new vboxLoader();
+ ml.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ ml.onLoad = function(){
+ self.completed.resolve();
+ };
+ ml.run();
+ },'progress_import_90px.png',trans('Import an appliance into VirtualBox','UIActionPool').replace(/\.+$/g,''),vboxBasename(file));
+ } else {
+ self.completed.reject();
+ }
+ },{'descriptions':descriptions,'file':file,'reinitNetwork':reinitNetwork});
+ l.run();
+ };
+
+ // license agreements
+ var licenses = [];
+
+ // Step through each VM and obtain value
+ for(var a = 0; a < descriptions.length; a++) {
+ var children = $('#vboxImportProps').children('tr.vboxChildOf'+a);
+ descriptions[a][5] = []; // enabled / disabled
+ var lic = null;
+ var vmname = null;
+ for(var b = 0; b < children.length; b++) {
+ descriptions[a][5][b] = !$(children[b]).data('propdisabled');
+ descriptions[a][3][$(children[b]).data('descOrder')] = $(children[b]).children('td:eq(1)').data('descValue');
+ // check for license
+ if(descriptions[a][0][b] == 'License') {
+ lic = descriptions[a][2][b];
+ } else if(descriptions[a][0][b] == 'Name') {
+ vmname = descriptions[a][2][b];
+ }
+ }
+ if(lic) {
+ if(!vmname) vmname = trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',a);
+ licenses[licenses.length] = {'name':vmname,'license':lic};
+ }
+ }
+
+
+ if(licenses.length) {
+
+ var msg = trans('<b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.','UIImportLicenseViewer');
+ var a = 0;
+ var buttons = {};
+ buttons[trans('Agree','UIImportLicenseViewer')] = function() {
+
+ a++;
+ if(a >= licenses.length) {
+ $(this).remove();
+ vboxImportApp();
+ return;
+ }
+ $(this).dialog('close');
+ $('#vboxImportWizLicTitle').html(msg.replace('%1',licenses[a]['name']));
+ $('#vboxImportWizLicContent').val(licenses[a]['license']);
+ $(this).dialog('open');
+
+ };
+ buttons[trans('Disagree','UIImportLicenseViewer')] = function() {
+ $(this).empty().remove();
+ };
+
+ var dlg = $('<div />').dialog({'closeOnEscape':false,'width':600,'height':500,'buttons':buttons,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent vboxWizard','title':'<img src="images/vbox/os_type_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Software License Agreement','UIImportLicenseViewer')});
+
+ $(dlg).html('<p id="vboxImportWizLicTitle" /><textarea rows="20" spellcheck="false" wrap="off" readonly="true"id="vboxImportWizLicContent" style="width:100%; margin:2px; padding:2px;"></textarea>');
+ $('#vboxImportWizLicTitle').html(msg.replace('%1',licenses[a]['name']));
+ $('#vboxImportWizLicContent').val(licenses[a]['license']);
+ $(dlg).dialog('open');
+
+ } else {
+ vboxImportApp();
+ }
+
+
+ };
+
+}
+
+/**
+ * Run the export appliance wizard
+ */
+function vboxWizardExportApplianceDialog() {
+
+ // reference
+ var self = this;
+
+ // Extend vboxWizard class
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common settings */
+ this.name = 'wizardExportAppliance';
+ this.title = trans('Export Virtual Appliance','UIWizardExportApp');
+ this.bg = 'images/vbox/vmw_ovf_export_bg.png';
+ this.icon = 'export';
+ this.steps = 4;
+ this.height = 500;
+ this.context = 'UIWizardExportApp';
+ this.finishText = trans('Export','UIWizardExportApp');
+
+ /* Add restore defaults button to last step */
+ this.stepButtons = [
+ {
+ 'name' : trans('Restore Defaults','UIWizardExportApp'),
+ 'steps' : [-1],
+ 'click' : function(e) {
+ // Remove export VM properties
+ $('#vboxExportProps').children().remove();
+ // Re-trigger adding them
+ if(self.mode == 'advanced')
+ vboxWizardExportApplianceUpdateList();
+ else
+ $('#wizardExportApplianceStep4').trigger('show',e,self);
+ }
+ }
+ ];
+
+ /* Function run when wizard completes */
+ this.onFinish = function() {
+
+
+ // Actually export appliances
+ function vboxExportApp(force) {
+
+ // Each VM
+ var vmid = null;
+ var vms = {};
+ var vmsAndProps = $('#vboxExportProps').children('tr');
+ for(var a = 0; a < vmsAndProps.length; a++) {
+ if($(vmsAndProps[a]).hasClass('vboxTableParent')) {
+ vmid = $(vmsAndProps[a]).data('vm').id;
+ vms[vmid] = {};
+ vms[vmid]['id'] = vmid;
+ continue;
+ }
+
+ var prop = $(vmsAndProps[a]).data('vmprop');
+ vms[vmid][prop] = $(vmsAndProps[a]).children('td:eq(1)').children().first().text();
+
+ }
+
+ var file = $(self.form).find('[name=wizardExportApplianceLocation]').val();
+ var format = $(self.form).find('[name=wizardExportApplianceFormat]').val();
+ var manifest = $(self.form).find('[name=wizardExportApplianceManifest]').prop('checked');
+ var overwrite = force;
+
+ var l = new vboxLoader();
+ l.add('applianceExport',function(d){
+ if(d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ self.completed.resolve();
+ },'progress_export_90px.png',
+ trans('Export one or more VirtualBox virtual machines as an appliance','UIActionPool').replace(/\.+$/g,''),
+ vboxBasename(file));
+ } else {
+ self.completed.reject();
+ }
+ },{'format':format,'file':file,'vms':vms,'manifest':manifest,'overwrite':overwrite});
+ l.run();
+
+ $(self.dialog).empty().remove();
+
+
+ }
+
+ /* Remove required classes */
+ $(self.form).find('[name=wizardExportApplianceLocation]').removeClass('vboxRequired');
+ $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
+
+ /* Some vms must be selected */
+ if($('#vboxExportProps').children('tr').length == 0) {
+ $('#vboxExportAppVMListContainer').addClass('vboxRequired');
+ return;
+ }
+
+ /* Check to see if file exists */
+ var loc = $(self.form).find('[name=wizardExportApplianceLocation]').val();
+ if(!loc) {
+ $(self.form).find('[name=wizardExportApplianceLocation]').addClass('vboxRequired');
+ return;
+ }
+
+ var fileExists = false;
+ var fe = new vboxLoader();
+ fe.add('fileExists',function(d){
+ fileExists = d.responseData;
+ },{'file':loc});
+ fe.onLoad = function() {
+ if(fileExists) {
+ var buttons = {};
+ buttons[trans('Yes','QIMessageBox')] = function() {
+ vboxExportApp(1);
+ $(this).empty().remove();
+ };
+ vboxConfirm(trans('A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.','UIMessageCenter').replace('%1',vboxBasename(loc)),buttons,trans('No','QIMessageBox'));
+ return;
+ }
+ vboxExportApp(0);
+
+ };
+ fe.run();
+
+ };
+
+}
+
+/**
+ * Show the medium encryption dialog
+ *
+ * @param {String} context - used in dialog name
+ * @param {Array} encIds - encryption ids
+ *
+ */
+function vboxMediumEncryptionPasswordsDialog(context, encIds, validIds) {
+
+ if(!(encIds && encIds.length)) { return []; }
+
+ var results = $.Deferred();
+
+ var dialogTitle = trans("%1 - Disk Encryption").replace('%1', context);
+
+ var l = new vboxLoader();
+ l.addFileToDOM("panes/mediumEncryptionPasswords.html");
+ l.onLoad = function() {
+
+ for(var i = 0; i < encIds.length; i++) {
+ vboxMediumEncryptionPasswordAdd(encIds[i].id, validIds && validIds.length && jQuery.inArray(encIds[i].id, validIds) > -1);
+ }
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ // Get passwords
+ var pws = vboxMediumEncryptionPasswordsGet();
+ if(pws === false)
+ return;
+
+ $(this).trigger('close').empty().remove();
+
+ results.resolve(pws);
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ results.reject();
+ $(this).trigger('close').empty().remove();
+ };
+
+ $('#vboxMediumEncryptionPasswords').dialog({'closeOnEscape':true,'width':600,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + dialogTitle}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ });
+
+ };
+
+ l.run()
+
+ return results.promise();
+}
+
+/**
+ * Show the port forwarding configuration dialog
+ * @param {Array} rules - list of port forwarding rules to process
+ * @returns {Object} deferred promise
+ */
+function vboxPortForwardConfigDialog(rules) {
+
+ var results = $.Deferred();
+
+ var l = new vboxLoader();
+ l.addFileToDOM("panes/settingsPortForwarding.html");
+ l.onLoad = function(){
+
+ vboxSettingsPortForwardingInit(rules);
+
+ var resizeTable = function() {
+ var h = $('#vboxSettingsPortForwarding').children('table').hide().parent().innerHeight() - 16;
+ $('#vboxSettingsPortForwarding').children('table').css({'height':h+'px'}).show();
+ $('#vboxSettingsPortForwardingListDiv').css({'height':(h-6)+'px','overflow':'auto'});
+
+
+ };
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ // Get rules
+ var rules = $('#vboxSettingsPortForwardingList').children('tr');
+ var rulesToPass = new Array();
+ for(var i = 0; i < rules.length; i++) {
+ if($(rules[i]).data('vboxRule')[3] == 0 || $(rules[i]).data('vboxRule')[5] == 0) {
+ vboxAlert(trans("The current port forwarding rules are not valid. " +
+ "None of the host or guest port values may be set to zero.",'UIMessageCenter'));
+ return;
+ }
+ rulesToPass[i] = $(rules[i]).data('vboxRule');
+ }
+ $(this).trigger('close').empty().remove();
+
+ results.resolve(rulesToPass);
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ results.reject();
+ $(this).trigger('close').empty().remove();
+ };
+
+ $('#vboxSettingsPortForwarding').dialog({'closeOnEscape':true,'width':600,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Port Forwarding Rules','UIMachineSettingsPortForwardingDlg')}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ }).on('dialogresizestop',resizeTable);
+
+ resizeTable();
+ };
+ l.run();
+
+ return results.promise();
+}
+
+/**
+ * Run the New Virtual Machine Wizard
+ * @param {String} vmgroup - VM group to add machine to
+ */
+function vboxWizardNewVMDialog(vmgroup) {
+
+ // reference to self
+ var self = this;
+
+ // Extend vboxWizard class
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common settings */
+ this.name = 'wizardNewVM';
+ this.bg = 'images/vbox/vmw_new_welcome_bg.png';
+ this.title = trans('Create Virtual Machine','UIWizardNewVM');
+ this.icon = 'vm_new';
+ this.steps = 3;
+ this.vmgroup = vmgroup;
+ this.context = 'UIWizardNewVM';
+ this.finishText = trans('Create','UIWizardNewVM');
+ this.data = [
+ {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
+ ];
+
+ /* Function to run when wizard completes */
+ this.onFinish = function() {
+
+ // Callback to finish wizard
+ var vboxNewVMFinish = function() {
+
+ // Get parameters
+ var disk = '';
+ if($(self.form).find('[name=newVMDisk]:checked').val() == 'existing') {
+ disk = $(self.form)[0].newVMDiskSelect.options[$(self.form)[0].newVMDiskSelect.selectedIndex].value;
+ disk = vboxMedia.getMediumById(disk).location;
+ }
+ var name = jQuery.trim($(self.form).find('[name=newVMName]').val());
+ var ostype = $(self.form).find('[name=newVMOSType]').val();
+ var mem = parseInt($(self.form).find('[name=wizardNewVMSizeValue]').val());
+
+ // Show loading screen
+ var l = new vboxLoader('machineCreate');
+ l.showLoading();
+
+ $.when(vboxAjaxRequest('machineCreate',{'disk':disk,'ostype':ostype,'memory':mem,'name':name,'group':vmgroup}))
+ .always(function() {
+ l.removeLoading();
+ }).done(function(res){
+
+ if(res.responseData.exists) {
+ vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(res.exists)).replace('%2',vboxDirname(res.exists)));
+
+ } else if(res.success) {
+ $(self.dialog).empty().remove();
+ var lm = new vboxLoader('machineCreate');
+ lm.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ lm.onLoad = function() {
+ self.completed.resolve();
+ };
+ lm.run();
+ } else {
+ self.completed.reject();
+ }
+
+ });
+
+ };
+
+ // Name must exist
+ if(!jQuery.trim($(self.form).find('[name=newVMName]').val())) {
+ $(self.form).find('[name=newVMName]').addClass('vboxRequired');
+ return;
+ }
+ $(self.form).find('[name=newVMName]').removeClass('vboxRequired');
+
+ // Make sure file does not exist
+ var fnl = new vboxLoader();
+ fnl.add('vboxGetComposedMachineFilename',function(d){
+
+ loc = vboxDirname(d.responseData);
+ var fileExists = false;
+
+ var fe = new vboxLoader('fileExists');
+ fe.add('fileExists',function(d){
+ fileExists = d.responseData;
+ },{'file':loc});
+ fe.onLoad = function() {
+
+ if(fileExists) {
+
+ vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(loc)).replace('%2',vboxDirname(loc)));
+ // Go back
+ self.displayStep(1);
+
+ return;
+ }
+
+ // Start new harddisk wizard if create new is selected
+ if($(self.form).find('[name=newVMDisk]:checked').val() == 'create') {
+
+ // Recommended size
+ var size = newVMOSTypesObj[$(self.form).find('[name=newVMOSType]').val()].recommendedHDD;
+
+ $.when(new vboxWizardNewHDDialog({'name':jQuery.trim($(self.form).find('[name=newVMName]').val()),'size':size,'group':vmgroup}).run())
+ .done(function(med){
+
+ $(self.form).find('[name=newVMDisk]').eq(2).trigger('click').prop('checked',true);
+
+ // Add newly created disk as option and select it
+ vmNewFillExistingDisks(med);
+
+ vboxNewVMFinish();
+
+ });
+
+ return;
+
+ } else if($(self.form).find('[name=newVMDisk]:checked').val() == 'none') {
+
+ buttons = {};
+ buttons[trans('Continue','UIMessageCenter')] = function(){
+ $(this).empty().remove();
+ vboxNewVMFinish();
+ };
+ 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;
+ }
+
+ vboxNewVMFinish();
+
+ };
+ fe.run();
+
+
+ },{'name':document.forms['frmwizardNewVM'].newVMName.value, 'group':vmgroup});
+
+ fnl.run();
+ };
+
+}
+
+/**
+ * Run the Clone Virtual Machine Wizard
+ * @param {Object} args - wizard data - args.vm and args.snapshot should be populated
+ * @returns {Object} deferred promise
+ * @see vboxWizard()
+ */
+function vboxWizardCloneVMDialog(args) {
+
+ // self reference
+ var self = this;
+
+ // Extend vboxWizard class
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common options */
+ this.name = 'wizardCloneVM';
+ this.title = trans('Clone Virtual Machine','UIWizardCloneVM');
+ this.bg = 'images/vbox/vmw_clone_bg.png';
+ this.icon = 'vm_clone';
+ this.finishText = trans('Clone','UIWizardCloneVM');
+ this.context = 'UIWizardCloneVM';
+ this.widthAdvanced = 450;
+ this.heightAdvanced = 350;
+
+ /* Override run() because we need VM data */
+ this.parentRun = this.run;
+ this.run = function() {
+
+ var l = new vboxLoader('vboxWizardCloneVMInit');
+ l.showLoading();
+ $.when(vboxVMDataMediator.getVMDetails(args.vm.id)).always(function() {
+ // Always remove loading screen
+ l.removeLoading();
+ }).done(function(d){
+ self.steps = (d.snapshotCount > 0 ? 3 : 2);
+ self.args = $.extend(true,args,{'vm':d});
+ self.parentRun();
+ });
+
+ return self.completed.promise();
+
+ };
+
+ /* Function to run when finished */
+ this.onFinish = function() {
+
+ // Get parameters
+ var name = jQuery.trim($(self.form).find('[name=machineCloneName]').val());
+ var src = self.args.vm.id;
+ var snapshot = self.args.snapshot;
+ var allNetcards = $(self.form).find('[name=vboxCloneReinitNetwork]').prop('checked');
+
+ if(!name) {
+ $(self.form).find('[name=machineCloneName]').addClass('vboxRequired');
+ return;
+ }
+
+
+ // Only two steps? We can assume that state has no child states.
+ // Force current state only
+ var vmState = 'MachineState';
+ if(self.steps > 2 || self.mode == 'advanced') {
+ vmState = $(self.form).find('[name=vmState]:checked').val();
+ }
+
+ // Full / linked clone
+ var cLink = $(self.form).find('[name=vboxCloneType]').eq(1).prop('checked');
+
+ // wrap function
+ var vbClone = function(sn) {
+
+ $.when(vboxAjaxRequest('machineClone', {'name':name,'vmState':vmState,'src':src,'snapshot':sn,'reinitNetwork':allNetcards,'link':cLink}))
+ .done(function(d){
+ if(d.responseData.progress) {
+ var registerVM = d.responseData.settingsFilePath;
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret) {
+ $.when(vboxAjaxRequest('machineAdd',{'file':registerVM})).done(function(){
+
+ $.when(vboxAjaxRequest('vboxGetMedia')).done(function(dat){
+ $('#vboxPane').data('vboxMedia',dat.responseData);
+ self.completed.resolve();
+ }).fail(function(){
+ self.completed.reject();
+ });
+ }).fail(function(){
+ self.completed.reject();
+ });
+ },'progress_clone_90px.png',trans('Clone selected virtual machine','UIActionPool'),
+ self.args.vm.name + ' > ' + name);
+ } else {
+ self.completed.reject();
+ }
+ }).fail(function(){
+ self.completed.reject();
+ });
+ };
+
+ // Check for linked clone, but not a snapshot
+ if(cLink && !self.args.snapshot) {
+
+ $.when(vboxAjaxRequest('snapshotTake',
+ {'vm':src,'name':trans('Linked Base for %1 and %2','UIWizardCloneVM').replace('%1',self.args.vm.name).replace('%2',name),'description':''}))
+ .done(function(d){
+
+ if(d.responseData.progress) {
+
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ $.when(vboxVMDataMediator.getVMDetails(src, true)).done(function(md){
+ vbClone(md.currentSnapshot);
+ });
+ },
+ 'progress_snapshot_create_90px.png',
+ trans('Take a snapshot of the current virtual machine state','UIActionPool'),
+ self.args.vm.name);
+
+ } else if(d && d.error) {
+ self.completed.reject();
+ vboxAlert(d.error);
+ }
+
+ }).fail(function(){
+ self.completed.reject();
+ });
+
+ // Just clone
+ } else {
+ vbClone(snapshot);
+ }
+
+ $(self.dialog).empty().remove();
+
+ };
+}
+
+/**
+ * Run the VM Log Viewer dialog
+ * @param {String} vm - uuid or name of virtual machine to obtain logs for
+ */
+function vboxShowLogsDialogInit(vm) {
+
+ $('#vboxPane').append($('<div />').attr({'id':'vboxVMLogsDialog'}));
+
+ var l = new vboxLoader();
+ l.add('machineGetLogFilesList',function(r){
+ $('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
+ },{'vm':vm.id});
+ l.addFileToDOM('panes/vmlogs.html',$('#vboxVMLogsDialog'));
+ l.onLoad = function(){
+ var buttons = {};
+ buttons[trans('Refresh','UIVMLogViewer')] = function() {
+ l = new vboxLoader();
+ l.add('machineGetLogFilesList',function(r){
+ $('#vboxVMLogsDialog').data({'logs':r.responseData.logs,'logpath':r.responseData.path});
+
+ },{'vm':vm.id});
+ l.onLoad = function(){
+ vboxShowLogsInit(vm);
+ };
+ l.run();
+ };
+ buttons[trans('Close','UIVMLogViewer')] = function(){$(this).trigger('close').empty().remove();};
+ $('#vboxVMLogsDialog').dialog({'closeOnEscape':true,'width':800,'height':500,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/vm_show_logs_16px.png" class="vboxDialogTitleIcon" /> '+ trans('%1 - VirtualBox Log Viewer','UIVMLogViewer').replace('%1',vm.name)}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Close','UIVMLogViewer')+'")').trigger('click');
+ });
+ vboxShowLogsInit(vm);
+ };
+ l.run();
+
+}
+
+/**
+ * Show the Virtual Media Manager Dialog
+ * @param {Boolean} select - true to display "Select" button and resolve with selected medium
+ * @param {String} type - optionally restrict media to media of this type
+ * @param {Boolean} hideDiff - optionally hide differencing HardDisk media
+ * @param {String} mPath - optional path to use when adding or creating media through the VMM dialog
+ * @returns {Object} deferred promise
+ */
+function vboxVMMDialog(select,type,hideDiff,mPath) {
+
+ var results = $.Deferred();
+
+ $('#vboxPane').append($('<div />').attr({'id':'vboxVMMDialog','class':'vboxVMMDialog'}));
+
+ var l = new vboxLoader();
+ l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);});
+ l.add('vboxSystemPropertiesGet',function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);});
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.addFileToDOM('panes/vmm.html',$('#vboxVMMDialog'));
+ l.onLoad = function() {
+ var buttons = {};
+ if(select) {
+ buttons[trans('Select','UIMediumManager')] = function() {
+ var sel = null;
+ switch($("#vboxVMMTabs").tabs('option','active')) {
+ case 0: /* HardDisks */
+ sel = $('#vboxVMMHDList').find('tr.vboxListItemSelected').first();
+ break;
+ case 1: /* DVD */
+ sel = $('#vboxVMMCDList').find('tr.vboxListItemSelected').first();
+ break;
+ default:
+ sel = $('#vboxVMMFDList').find('tr.vboxListItemSelected').first();
+ }
+ if($(sel).length) {
+ vboxMedia.updateRecent(vboxMedia.getMediumById($(sel).data('medium')));
+ results.resolve($(sel).data('medium'));
+ }
+ $('#vboxVMMDialog').trigger('close').empty().remove();
+ };
+ }
+ 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','UIMessageCenter')+'")').trigger('click');
+ });
+
+ vboxVMMInit(hideDiff,mPath);
+
+ if(type) {
+ switch(type) {
+ case 'HardDisk':
+ $("#vboxVMMTabs").tabs('option','active',0);
+ $("#vboxVMMTabs").tabs('disable',1);
+ $("#vboxVMMTabs").tabs('disable',2);
+ break;
+ case 'DVD':
+ $("#vboxVMMTabs").tabs('option','active',1);
+ $("#vboxVMMTabs").tabs('disable',0);
+ $("#vboxVMMTabs").tabs('disable',2);
+ break;
+ case 'Floppy':
+ $("#vboxVMMTabs").tabs('option','active',2);
+ $("#vboxVMMTabs").tabs('disable',0);
+ $("#vboxVMMTabs").tabs('disable',1);
+ break;
+ default:
+ $("#vboxVMMTabs").tabs('option','active',0);
+ break;
+ }
+ }
+ };
+ l.run();
+
+ return results.promise();
+}
+
+/**
+ * Run the New Virtual Disk wizard
+ * @param {Object} suggested - sugggested defaults such as hard disk name and path
+ */
+function vboxWizardNewHDDialog(suggested) {
+
+ // reference
+ var self = this;
+
+ // Extend vboxWizard class
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common options */
+ this.name = 'wizardNewHD';
+ this.title = trans('Create Virtual Hard Disk','UIWizardNewVD');
+ this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
+ this.icon = 'hd';
+ this.steps = 3;
+ this.suggested = suggested;
+ this.context = 'UIWizardNewVD';
+ this.finishText = trans('Create','UIWizardNewVD');
+ this.height = 450;
+
+ this.data = [
+ {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);}},
+ {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
+ ];
+
+ // Compose folder if suggested name exists
+ if(this.suggested && this.suggested.name) {
+ if(!this.suggested['group']) this.suggested.group = '';
+ this.data.push(
+ {'fn':'vboxGetComposedMachineFilename','callback':function(d){
+ self.suggested.path = vboxDirname(d.responseData)+$('#vboxPane').data('vboxConfig').DSEP;
+ },'args':{'name':this.suggested.name, 'group':this.suggested.group}});
+ }
+
+ /* Function to run when wizard completes */
+ this.onFinish = function() {
+
+ // Fix size if we need to
+ var mbytes = vboxConvertMbytes($(self.form).find('[name=wizardNewHDSizeValue]').val());
+ $(self.form).find('[name=wizardNewHDSizeValue]').val(vboxMbytesConvert(mbytes));
+ $('#wizardNewHDSizeLabel').html(vboxMbytesConvert(mbytes) + ' ('+mbytes+' '+trans('MB','VBoxGlobal')+')');
+
+ // Determine file location
+ var file = $(self.form).find('[name=wizardNewHDLocation]').val();
+ if(file.search(/[\/|\\]/) < 0) {
+ // just a name
+ if(self.suggested.path) {
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true){
+ file = self.suggested.path + $('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + file;
+ } else {
+ file = self.suggested.path + $('#vboxPane').data('vboxConfig').DSEP + file;
+ }
+ } else{
+ if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true){
+ file = $('#vboxPane').data('vboxSystemProperties').homeFolder + $('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + file;
+ } else {
+ file = $('#vboxPane').data('vboxSystemProperties').homeFolder + $('#vboxPane').data('vboxConfig').DSEP + file;
+ }
+ }
+
+ // Enforce VM ownership
+ } else if($('#vboxPane').data('vboxConfig').enforceVMOwnership==true) {
+ // has user ownership so use folderbased
+ var nameIndex = file.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
+ var path = file.substr(0,nameIndex);
+ var name = file.substr(nameIndex+1,file.length);
+ file = path +$('#vboxPane').data('vboxConfig').DSEP + $('#vboxPane').data('vboxSession').user + "_" + name;
+ }
+
+ var format = $(self.form)[0].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;
+ }
+ }
+
+ // append filename ext?
+ if(jQuery.inArray(file.substring(file.lastIndexOf('.')+1).toLowerCase(),formatOpts.extensions) < 0) {
+ file += '.'+formatOpts.extensions[0];
+ }
+
+ // Normalize file
+ file = file.replace($('#vboxPane').data('vboxConfig').DSEP+$('#vboxPane').data('vboxConfig').DSEP,$('#vboxPane').data('vboxConfig').DSEP);
+
+ /* Check to see if file exists */
+ var fileExists = false;
+ var l = new vboxLoader('fileExists');
+ l.add('fileExists',function(d){
+ fileExists = d.responseData;
+ },{'file':file});
+ l.onLoad = function() {
+ if(fileExists) {
+ vboxAlert(trans("<p>The hard disk storage unit at location <b>%1</b> already " +
+ "exists. You cannot create a new virtual hard disk that uses this " +
+ "location because it can be already used by another virtual hard " +
+ "disk.</p>" +
+ "<p>Please specify a different location.</p>",'UIMessageCenter').replace('%1',file));
+ return;
+ }
+ var fsplit = $(self.form).find('[name=newHardDiskSplit]').prop('checked');
+ var size = vboxConvertMbytes($(self.form).find('[name=wizardNewHDSizeValue]').val());
+ var type = ($(self.form).find('[name=newHardDiskType]').eq(1).prop('checked') ? 'fixed' : 'dynamic');
+ var nl = new vboxLoader('mediumCreateBaseStorage');
+ nl.add('mediumCreateBaseStorage',function(d){
+ if(d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret) {
+ var ml = new vboxLoader();
+ ml.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
+ ml.onLoad = function() {
+ var med = vboxMedia.getMediumByLocation(file);
+ if(med) {
+ vboxMedia.updateRecent(med);
+ self.completed.resolve(med.id);
+ } else {
+ self.completed.reject();
+ }
+ };
+ ml.run();
+ },'progress_media_create_90px.png',trans('Create a virtual hard disk now','UIWizardNewVM'),
+ vboxBasename(file),true);
+ } else {
+ self.completed.reject();
+ }
+ },{'file':file,'type':type,'size':size,'format':format,'split':fsplit});
+ nl.run();
+
+ $(self.dialog).empty().remove();
+ };
+ l.run();
+
+ };
+}
+
+/**
+ * Run the Copy Virtual Disk wizard
+ * @param {Object} suggested - sugggested defaults such as hard disk name and path
+ */
+function vboxWizardCopyHDDialog(suggested) {
+
+ // reference
+ var self = this;
+
+ /* Extend vboxWizard class */
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ /* Common options */
+ this.name = 'wizardCopyHD';
+ this.title = trans('Copy Virtual Hard Disk','UIWizardCloneVD');
+ this.bg = 'images/vbox/vmw_new_harddisk_bg.png';
+ this.icon = 'hd';
+ this.steps = 4;
+ this.suggested = suggested;
+ this.context = 'UIWizardCloneVD';
+ this.finishText = trans('Copy','UIWizardCloneVD');
+ this.height = 450;
+
+ this.data = [
+ {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxPane').data('vboxSystemProperties',d.responseData);}},
+ {'fn':'vboxGetMedia','callback':function(d){$('#vboxPane').data('vboxMedia',d.responseData);}}
+ ];
+
+
+ /* Function run when wizard completes */
+ this.onFinish = function() {
+
+ var format = $(self.form)[0].elements['copyHDFileType'];
+ var formatOpts = {};
+ for(var i = 0; i < format.length; i++) {
+ if(format[i].checked) {
+ formatOpts = $(format[i]).closest('tr').data('vboxFormat');
+ break;
+ }
+ }
+
+ var src = $(self.form).find('[name=copyHDDiskSelect]').val();
+ var type = ($(self.form).find('[name=newHardDiskType]').eq(1).prop('checked') ? 'fixed' : 'dynamic');
+ var format = $(self.form)[0].elements['copyHDFileType'];
+ for(var i = 0; i < format.length; i++) {
+ if(format[i].checked) {
+ format=format[i].value;
+ break;
+ }
+ }
+
+ var fsplit = $(self.form).find('[name=newHardDiskSplit]').prop('checked') && vboxMedia.formatSupportsSplit(format);
+
+ var loc = jQuery.trim($(self.form).find('[name=wizardCopyHDLocation]').val());
+ if(!loc) {
+ $(self.form).find('[name=wizardCopyHDLocation]').addClass('vboxRequired');
+ return;
+ }
+ $(self.form).find('[name=wizardCopyHDLocation]').removeClass('vboxRequired');
+ if(loc.search(/[\/|\\]/) < 0) {
+ if($('#wizardCopyHDStep4').data('suggestedpath')) {
+ loc = $('#wizardCopyHDStep4').data('suggestedpath') + loc;
+ } else {
+ loc = vboxDirname(vboxMedia.getMediumById(src).location) + $('#vboxPane').data('vboxConfig').DSEP + loc;
+ }
+ }
+
+ // append ext?
+ if(jQuery.inArray(loc.substring(loc.lastIndexOf('.')+1).toLowerCase(),formatOpts.extensions) < 0) {
+ loc += '.'+formatOpts.extensions[0];
+ }
+
+
+ /* Check to see if file exists */
+ var fileExists = false;
+ var fe = new vboxLoader();
+ fe.add('fileExists',function(d){
+ fileExists = d.responseData;
+ },{'file':loc});
+ fe.onLoad = function() {
+ if(fileExists) {
+ vboxAlert(trans("<p>The hard disk storage unit at location <b>%1</b> already " +
+ "exists. You cannot create a new virtual hard disk that uses this " +
+ "location because it can be already used by another virtual hard " +
+ "disk.</p>" +
+ "<p>Please specify a different location.</p>",'UIMessageCenter').replace('%1',loc));
+ return;
+ }
+ $(self.dialog).empty().remove();
+
+ var l = new vboxLoader();
+ l.add('mediumCloneTo',function(d){
+ if(d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(ret,mid) {
+ var ml = new vboxLoader();
+ ml.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
+ ml.onLoad = function() {
+ med = vboxMedia.getMediumByLocation(loc);
+ vboxMedia.updateRecent(med);
+ self.completed.resolve(mid);
+ };
+ ml.run();
+ },'progress_media_create_90px.png',trans('Copy Virtual Hard Disk','UIWizardCloneVD'),
+ vboxBasename(vboxMedia.getMediumById(src).location) + ' > ' + vboxBasename(loc));
+ } else {
+ self.completed.reject();
+ }
+ },{'src':vboxMedia.getMediumById(src).location,'type':type,'format':format,'location':loc,'split':fsplit});
+ l.run();
+ };
+ fe.run();
+
+
+ };
+}
+
+/**
+ * Display guest network adapters dialog
+ * @param {String} vm - virtual machine uuid or name
+ */
+function vboxGuestNetworkAdaptersDialogInit(vm) {
+
+ /*
+ * Dialog
+ */
+ $('#vboxPane').append($('<div />').attr({'id':'vboxGuestNetworkDialog','style':'display: none'}));
+
+ /*
+ * Loader
+ */
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/guestNetAdapters.html',$('#vboxGuestNetworkDialog'));
+ l.onLoad = function(){
+
+ var buttons = {};
+ buttons[trans('Close','UIVMLogViewer')] = function() {$('#vboxGuestNetworkDialog').trigger('close').empty().remove();};
+ $('#vboxGuestNetworkDialog').dialog({'closeOnEscape':true,'width':500,'height':250,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Guest Network Adapters','VBoxGlobal')}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Close','UIVMLogViewer')+'")').trigger('click');
+ });
+
+ // defined in pane
+ vboxVMNetAdaptersInit(vm,nic);
+ };
+ l.run();
+
+}
+
+
+/**
+ * Display Global Preferences dialog
+ */
+
+function vboxGlobalPrefsDialog() {
+
+ // Prefs
+ var panes = new Array(
+ {'name':'GlobalGeneral','label':'General','icon':'machine','context':'UIGlobalSettingsGeneral'},
+ {'name':'GlobalLanguage','label':'Language','icon':'site','context':'UIGlobalSettingsLanguage'},
+ {'name':'GlobalNetwork','label':'Network','icon':'nw','context':'UIGlobalSettingsNetwork','tabbed':true},
+ {'name':'GlobalUsers','label':'Users','icon':'register','context':'UIUsers'}
+ );
+
+ var data = new Array(
+ {'fn':'hostOnlyInterfacesGet','callback':function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);}},
+ {'fn':'vboxSystemPropertiesGet','callback':function(d){$('#vboxSettingsDialog').data('vboxSystemProperties',d.responseData);}},
+ {'fn':'vboxNATNetworksGet','callback':function(d){$('#vboxSettingsDialog').data('vboxNATNetworks',d.responseData);}},
+ {'fn':'getUsers','callback':function(d){$('#vboxSettingsDialog').data('vboxUsers',d.responseData);}}
+ );
+
+ // Check for noAuth setting
+ if($('#vboxPane').data('vboxConfig').noAuth || !$('#vboxPane').data('vboxSession').admin || !$('#vboxPane').data('vboxConfig').authCapabilities.canModifyUsers) {
+ panes.pop();
+ data.pop();
+ }
+
+ $.when(vboxSettingsDialog(trans('Preferences...','UIActionPool').replace(/\./g,''),
+ panes,data,null,'global_settings','UISettingsDialogGlobal'))
+ .done(function(){
+
+ var l = new vboxLoader();
+
+ // Language change?
+ if($('#vboxSettingsDialog').data('language') && $('#vboxSettingsDialog').data('language') != __vboxLangName) {
+ vboxSetCookie('vboxLanguage',$('#vboxSettingsDialog').data('language'));
+ l.onLoad = function(){location.reload(true);};
+
+ }
+
+ l.add('vboxNATNetworksSave',function(){return;},{'networks':$('#vboxSettingsDialog').data('vboxNATNetworks')});
+ l.add('hostOnlyInterfacesSave',function(){return;},{'networkInterfaces':$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces});
+ l.add('vboxSystemPropertiesSave',function(){return;},{'SystemProperties':$('#vboxSettingsDialog').data('vboxSystemProperties')});
+ l.run();
+
+ // Update system properties
+ $('#vboxPane').data('vboxSystemProperties',$('#vboxSettingsDialog').data('vboxSystemProperties'));
+
+ });
+
+}
+
+
+
+/**
+ * Display a virtual machine settings dialog
+ * @param {String} vm - uuid or name of virtual machine
+ * @param {String} pane - optionally automatically select pane when dialog is displayed
+ * @returns {Object} deferred promise
+ */
+function vboxVMsettingsDialog(vm,pane) {
+
+ var results = $.Deferred();
+
+ if(typeof(vm) == 'string')
+ vm = vboxVMDataMediator.getVMData(vm);
+
+ // Only show these dialogs once per change
+ var reloadConfirmShowing = false;
+
+ // Handler for when VM settings have changed
+ /////////////////////////////////////////////
+ var machineSettingsChanged = function(e, eventList) {
+
+ for(var i = 0; i < eventList.length; i++) {
+
+ ////////////////////////////////
+ //
+ // Machine data changed..
+ //
+ ////////////////////////////////
+ switch(eventList[i].eventType) {
+
+ case 'OnMachineStateChanged':
+
+ if(!eventList[i].machineId || eventList[i].machineId != vm.id) break;
+
+ // Display loading screen
+ var l = new vboxLoader();
+ l.showLoading();
+
+ $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
+ // data received from deferred object
+ $('#vboxSettingsDialog').data('vboxMachineData',vmData);
+ $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
+ $('#vboxSettingsDialog').trigger('dataLoaded');
+ l.removeLoading();
+ if(vboxVMStates.isRunning(vmData)) {
+ vboxAlert(trans('The virtual machine that you are changing has been started. Only certain settings can be changed while a machine is running. All other changes will be lost if you close this window now.','UIMessageCenter'));
+ }
+ });
+
+ break;
+
+ // Unregistered machine
+ case 'OnMachineRegistered':
+
+ if(!eventList[i].machineId || eventList[i].machineId != vm.id || eventList[i].registered) break;
+
+ $('#vboxSettingsDialog').parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ break;
+
+ case 'OnMachineDataChanged':
+ case 'OnNetworkAdapterChanged':
+ case 'OnVRDEServerInfoChanged':
+ case 'OnCPUChanged':
+ case 'OnStorageControllerChanged':
+ case 'OnMediumChanged':
+ case 'OnVRDEServerChanged':
+ case 'OnUSBControllerChanged':
+ case 'OnSharedFolderChanged':
+ case 'OnCPUExecutionCapChanged':
+ case 'OnStorageDeviceChanged':
+ case 'OnNATRedirect':
+
+ if(!eventList[i].machineId || eventList[i].machineId != vm.id) break;
+
+ // already showing reload confirmation
+ if(reloadConfirmShowing) break;
+
+ var buttons = {};
+ buttons[trans('Reload settings','UIMessageCenter')] = function() {
+
+ // Display loading screen
+ var l = new vboxLoader();
+ l.showLoading();
+
+ $(this).empty().remove();
+
+ /*
+ * Data to be reloaded
+ */
+ var reload = [
+ vboxAjaxRequest('vboxGetMedia',{}).done(function(d){$('#vboxPane').data('vboxMedia',d.responseData);}),
+
+ vboxAjaxRequest('getNetworking',{}).done(function(d){$('#vboxSettingsDialog').data('vboxNetworking',d.responseData);}),
+
+ vboxAjaxRequest('vboxRecentMediaGet',{}).done(function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);}),
+
+ vboxAjaxRequest('consoleGetSharedFolders',{'vm':vm.id}).done(function(d){$('#vboxSettingsDialog').data('vboxTransientSharedFolders',d.responseData);}),
+
+ $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
+
+ // data received from deferred object
+ $('#vboxSettingsDialog').data('vboxMachineData',vmData);
+ $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
+
+ })
+ ];
+
+ // Only when all of these are done
+ $.when.apply($, reload).done(function(){
+
+ /* Change title and tell dialog that data is loaded */
+ $('#vboxSettingsDialog').trigger('dataLoaded').dialog('option','title','<img src="images/vbox/vm_settings_16px.png" class="vboxDialogTitleIcon" /> ' +
+ $('<div />').text($('#vboxSettingsDialog').data('vboxMachineData').name).text() + ' - ' + trans('Settings','UISettingsDialog'));
+
+ l.removeLoading();
+ reloadConfirmShowing = false;
+ });
+
+
+ };
+
+ reloadConfirmShowing = true;
+
+ vboxConfirm(trans("<p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p>",'UIMessageCenter'),
+ buttons,
+ trans('Keep changes', 'UIMessageCenter'), function(){
+ reloadConfirmShowing = false;
+ });
+
+ return;
+
+ }
+ }
+ };
+
+ // Watch for changed VM settings
+ $('#vboxPane').on('vboxEvents',machineSettingsChanged);
+
+ $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(vmData) {
+
+
+ /*
+ * Settings dialog data
+ */
+ var dataList = new Array(
+ {'fn':'vboxGetMedia','callback':function(d){
+
+ $('#vboxPane').data('vboxMedia',d.responseData);
+
+ // data received from deferred object
+ $('#vboxSettingsDialog').data('vboxMachineData',vmData);
+ $('#vboxSettingsDialog').data('vboxFullEdit', (vboxVMStates.isPoweredOff(vmData) && !vboxVMStates.isSaved(vmData)));
+
+ }},
+ {'fn':'getNetworking','callback':function(d){$('#vboxSettingsDialog').data('vboxNetworking',d.responseData);}},
+ {'fn':'hostGetDetails','callback':function(d){$('#vboxSettingsDialog').data('vboxHostDetails',d.responseData);}},
+ {'fn':'vboxGetEnumerationMap','callback':function(d){$('#vboxSettingsDialog').data('vboxNetworkAdapterTypes',d.responseData);},'args':{'class':'NetworkAdapterType'}},
+ {'fn':'vboxGetEnumerationMap','callback':function(d){$('#vboxSettingsDialog').data('vboxAudioControllerTypes',d.responseData);},'args':{'class':'AudioControllerType'}},
+ {'fn':'vboxRecentMediaGet','callback':function(d){$('#vboxPane').data('vboxRecentMedia',d.responseData);}},
+ {'fn':'consoleGetSharedFolders','callback':function(d){$('#vboxSettingsDialog').data('vboxTransientSharedFolders',d.responseData);},'args':{'vm':vm.id}}
+ );
+
+ /*
+ * Settings dialog panes
+ */
+ var panes = new Array(
+
+ {name:'General',label:'General',icon:'machine',tabbed:true,context:'UIMachineSettingsGeneral'},
+ {name:'System',label:'System',icon:'chipset',tabbed:true,context:'UIMachineSettingsSystem'},
+ {name:'Display',label:'Display',icon:'vrdp',tabbed:true,context:'UIMachineSettingsDisplay'},
+ {name:'Storage',label:'Storage',icon:'attachment',context:'UIMachineSettingsStorage'},
+ {name:'Audio',label:'Audio',icon:'sound',context:'UIMachineSettingsAudio'},
+ {name:'Network',label:'Network',icon:'nw',tabbed:true,context:'UIMachineSettingsNetwork'},
+ {name:'SerialPorts',label:'Serial Ports',icon:'serial_port',tabbed:true,context:'UIMachineSettingsSerial'},
+ {name:'ParallelPorts',label:'Parallel Ports',icon:'parallel_port',tabbed:true,disabled:(!$('#vboxPane').data('vboxConfig').enableLPTConfig),context:'UIMachineSettingsParallel'},
+ {name:'USB',label:'USB',icon:'usb',context:'UIMachineSettingsUSB'},
+ {name:'SharedFolders',label:'Shared Folders',icon:'sf',context:'UIMachineSettingsSF'}
+
+ );
+
+ /*
+ * Check for encryption settings change
+ */
+ var presaveCallback = function() {
+
+ if(!$('#vboxSettingsDialog').data('vboxEncSettingsChanged'))
+ return true;
+
+ var encMediaSettings = $.Deferred();
+
+ // Validate
+ if(!vboxSettingsGeneralValidate()) {
+ $('#vboxSettingsMenuList').children('li:eq(0)').first().click();
+ $('#vboxSettingsPane-General').tabs('option','active', 3);
+ encMediaSettings.reject();
+ return encMediaSettings;
+ }
+
+ var vm = $('#vboxSettingsDialog').data('vboxMachineData');
+ var media = vboxStorage.getAttachedBaseMedia(vm);
+ var encIds = vboxMedia.getEncryptedMediaIds(media);
+ var encMedia = vboxMedia.getEncryptedMedia(media);
+
+ var formCipher = $('#vboxSettingsDialog').data('vboxEncCipher');
+ var formPassword = $('#vboxSettingsDialog').data('vboxEncPw');
+ var formEncEnabled = $('#vboxSettingsDialog').data('vboxEncEnabled');
+
+ // If encryption is not enabled, cipher needs to be blank
+ if(!formEncEnabled) {
+ formCipher = '';
+ }
+
+ // Get encryption password(s)
+ $.when(vboxMediumEncryptionPasswordsDialog(vm.name, encIds))
+
+ .done(function(pwdata) {
+
+ var runs = []
+
+ // Each medium attached
+ for(var i = 0; i < media.length; i++) {
+ // Only hard disks
+ if(media[i].deviceType != 'HardDisk') continue;
+
+ var id = vm.name;
+ var oldpw = "";
+ var cipher = null;
+
+ // Check for existing encryption setting
+ for(var a = 0; a < encMedia.length; a++) {
+ if(encMedia[a].medium == media[i].id) {
+ cipher = media[i].encryptionSettings.cipher;
+ // Look in passwords for id
+ for(var b = 0; b < pwdata.length; b++) {
+ if(pwdata[b].id == id) {
+ oldpw = pwdata[b].password;
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ runs.push({
+ medium: media[i].id,
+ cipher: cipher,
+ encId: id,
+ password: oldpw
+ });
+
+ }
+ // No encrypted media changes
+ if(!runs.length) {
+ encMediaSettings.resolve();
+ return;
+ }
+
+ var l = new vboxLoader();
+ l.showLoading();
+
+ (function doruns(encMediaRuns){
+
+ if(!encMediaRuns.length) {
+ l.removeLoading();
+ encMediaSettings.resolve();
+ return;
+ }
+
+ var run = encMediaRuns.shift();
+
+ // If encryption is enabled, and cypher is blank / "Leave Unchanged"
+ // keep the original cipher
+ var mcipher = formCipher;
+ if(formEncEnabled && !mcipher) {
+ mcipher = run.cipher;
+ }
+
+ var rdata = {
+ medium: run.medium,
+ id: run.encId,
+ old_password: run.password,
+ cipher: mcipher,
+ password: formPassword
+ };
+
+ $.when(vboxAjaxRequest('mediumChangeEncryption',rdata)).done(function(d){
+
+ if(d.responseData.progress) {
+ var icon = 'progress_media_create_90px.png';
+ var title = trans('Encryption');
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ // Loop
+ doruns(encMediaRuns);
+ },icon,title,vboxMedia.getMediumById(run.medium).name, true);
+ } else {
+ l.removeLoading();
+ encMediaSettings.reject();
+ return;
+ }
+
+ });
+
+ })(runs);
+
+ })
+ .fail(function() {
+ encMediaSettings.reject();
+ });
+
+ return encMediaSettings.promise();
+
+ }
+
+ $.when(vboxSettingsDialog(vmData.name + ' - ' + trans('Settings','UISettingsDialog'),panes,dataList,pane,'vm_settings','UISettingsDialogMachine', presaveCallback))
+
+ // Always run this
+ .always(function(){
+
+ // No longer watch for changed VM settings
+ $('#vboxPane').unbind('vboxEvents',machineSettingsChanged);
+
+ })
+
+ // Run this when "Save" is clicked
+ .done(function() {
+
+ var loader = new vboxLoader();
+ var sdata = $.extend($('#vboxSettingsDialog').data('vboxMachineData'),{'clientConfig':$('#vboxPane').data('vboxConfig')});
+ loader.add('machineSave',function(){return;},sdata);
+ loader.onLoad = function() {
+ // Refresh media
+ var mload = new vboxLoader();
+ mload.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ mload.onLoad = function() {
+ results.resolve();
+ };
+ mload.run();
+ };
+ loader.run();
+ });
+
+ });
+
+ return results.promise();
+}
+
+
+
+
+/**
+ * Run the "First Run" wizard
+ * @param {Object} vm - VM details object
+ */
+function vboxWizardFirstRunDialog(vm) {
+
+ // ref
+ var self = this;
+
+ this.parentClass = vboxWizard;
+ this.parentClass();
+
+ this.name = 'wizardFirstRun';
+ this.title = $('<div />').text(vm.name).html();
+ this.bg = 'images/vbox/vmw_first_run_bg.png';
+ this.icon = vboxGuestOSTypeIcon(vm.OSTypeId);
+ this.steps = 1;
+ this.finishText = trans('Start','UIWizardFirstRun');
+ this.context = 'UIWizardFirstRun';
+ this.noAdvanced = true;
+ this.args = vm;
+
+ // This still resolves on cancel
+ this.onCancel = function () {
+ self.completed.resolve();
+ };
+
+ this.onFinish = function() {
+
+ var med = vboxMedia.getMediumById($('#wizardFirstRunMedia').find(":selected").attr('value'));
+
+ $(self.dialog).empty().remove();
+
+ if(med) {
+
+ var port = null;
+ var device = null;
+ var bus = null;
+ var controller = null;
+
+ for(var i = 0; i < self.args.storageControllers.length; i++) {
+ for(var a = 0; a < self.args.storageControllers[i].mediumAttachments.length; a++) {
+ if(self.args.storageControllers[i].mediumAttachments[a].type == "DVD" &&
+ self.args.storageControllers[i].mediumAttachments[a].medium == null) {
+
+ port = self.args.storageControllers[i].mediumAttachments[a].port;
+ device = self.args.storageControllers[i].mediumAttachments[a].device;
+ bus = self.args.storageControllers[i].bus;
+ controller = self.args.storageControllers[i].name;
+
+ break;
+ }
+ }
+ }
+
+
+ var args = {'vm':self.args.id,
+ 'medium':med,
+ 'port':port,
+ 'device':device,
+ 'bus':bus,
+ 'controller':controller,
+ 'noSave':true
+ };
+
+ // Ajax request to mount medium
+ var mount = new vboxLoader();
+ mount.add('mediumMount',function(ret){
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function(){
+ self.completed.resolve();
+ };
+ l.run();
+ },args);
+ mount.run();
+
+
+ } else {
+ self.completed.resolve();
+ }
+
+ };
+}
+
+
+/**
+ * Display a settings dialog (generic) called by dialog initializers
+ * @param {String} title - title of dialog
+ * @param {Array} panes - list of panes {Object} to load
+ * @param {Object} data - list of data to load
+ * @param {String} pane - optionally automatically select pane when dialog is shown
+ * @param {String} icon - optional URL to icon for dialog
+ * @param {String} langContext - language context to use for translations
+ * @param {Function} presave - presave callback to run
+ * @returns {Object} deferred promise
+ * @see trans()
+ */
+function vboxSettingsDialog(title,panes,data,pane,icon,langContext,presave) {
+
+ var results = $.Deferred();
+
+ var d = $('<div />').attr({'id':'vboxSettingsDialog','style':'display: none;'});
+
+ var f = $('<form />').attr({'name':'frmVboxSettings','style':'height: 100%'});
+
+ var t = $('<table />').attr({'style':'height: 100%;','class':'vboxSettingsTable'});
+
+ var tr = $('<tr />');
+
+ $($('<td />').attr({'id':'vboxSettingsMenu','style': (panes.length == 1 ? 'display:none;' : '')})).append($('<ul />').attr({'id':'vboxSettingsMenuList','class':'vboxHover'})).appendTo(tr);
+
+ var td = $('<td />').attr({'id':'vboxSettingsPane'}).css({'height':'100%'});
+
+ // Settings table contains title and visible settings pane
+ var stbl = $('<table />').css({'height':'100%','width':'100%','padding':'0px','margin':'0px','border':'0px','border-spacing':'0px'});
+
+ // Title
+ var d1 = $('<div />').attr({'id':'vboxSettingsTitle'}).html('Padding').css({'display':(panes.length == 1 ? 'none' : '')});
+ $(stbl).append($('<tr />').append($('<td />').css({'height':'1%','padding':'0px','margin':'0px','border':'0px'}).append(d1)));
+
+
+ // Settings pane
+ var d1 = $('<div />').attr({'id':'vboxSettingsList'}).css({'width':'100%'});
+
+ $(stbl).append($('<tr />').append($('<td />').css({'padding':'0px','margin':'0px','border':'0px'}).append(d1)));
+
+
+ $(td).append(stbl).appendTo(tr);
+
+ $(d).append($(f).append($(t).append(tr))).appendTo('#vboxPane');
+
+ /* Load panes and data */
+ var loader = new vboxLoader();
+
+ /* Load Data */
+ for(var i = 0; i < data.length; i++) {
+ loader.add(data[i].fn,data[i].callback,(data[i].args ? data[i].args : undefined));
+ }
+
+ /* Load settings panes */
+ for(var i = 0; i < panes.length; i++) {
+
+ if(panes[i].disabled) continue;
+
+ // Menu item
+ $('<li />').html('<div><img src="images/vbox/'+panes[i].icon+'_16px.png" /></div> <div>'+trans(panes[i].label,langContext)+'</div>').data(panes[i]).click(function(){
+
+ $('#vboxSettingsTitle').html(trans($(this).data('label'),langContext));
+
+ $(this).addClass('vboxListItemSelected').siblings().addClass('vboxListItem').removeClass('vboxListItemSelected');
+
+ // jquery apply this css to everything with class .settingsPa..
+ $('#vboxSettingsDialog .vboxSettingsPaneSection').css({'display':'none'});
+
+ // Show selected pane
+ $('#vboxSettingsPane-' + $(this).data('name')).css({'display':''}).children().first().trigger('show');
+
+ }).on("mouseenter",function(){$(this).addClass('vboxHover');}).on("mouseleave",function(){$(this).removeClass('vboxHover');}).appendTo($('#vboxSettingsMenuList'));
+
+
+ // Settings pane
+ $('#vboxSettingsList').append($('<div />').attr({'id':'vboxSettingsPane-'+panes[i].name,'style':'display: none;','class':'vboxSettingsPaneSection ui-corner-all ' + (panes[i].tabbed ? 'vboxTabbed' : 'vboxNonTabbed')}));
+
+ loader.addFileToDOM('panes/settings'+panes[i].name+'.html',$('#vboxSettingsPane-'+panes[i].name));
+
+ }
+
+ loader.onLoad = function(){
+
+
+ /* Init UI Items */
+ for(var i = 0; i < panes.length; i++) {
+ vboxInitDisplay($('#vboxSettingsPane-'+panes[i].name),panes[i].context);
+ if(panes[i].tabbed) $('#vboxSettingsPane-'+panes[i].name).tabs();
+ }
+
+ /* Tell dialog that data is loaded */
+ $('#vboxSettingsDialog').trigger('dataLoaded');
+
+ var buttons = { };
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ $(this).trigger('save');
+
+ // Does some settings pane need to do some presave
+ // work? (ask questions, run wizard, some other asynch task)
+ var promise = true;
+ if(presave) {
+ promise = presave();
+ }
+ var dlg = this;
+ $.when(promise).done(function() {
+ results.resolve(true);
+ $(dlg).trigger('close').empty().remove();
+ $(document).trigger('click');
+ });
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() {
+ results.reject();
+ $(this).trigger('close').empty().remove();
+ $(document).trigger('click');
+ };
+
+ // Init with "nothing has changed yet"
+ $('#vboxSettingsDialog').data('formDataChanged', false);
+
+ // Show dialog
+ $('#vboxSettingsDialog').dialog({'closeOnEscape':true,'width':(panes.length > 1 ? 900 : 600),'height':(panes.length > 1 ? 500 : 450),'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxSettingsDialog vboxDialogContent','title':(icon ? '<img src="images/vbox/'+icon+'_16px.png" class="vboxDialogTitleIcon" /> ' : '') + title}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ });
+
+ // Resize pane
+ $('#vboxSettingsList').height($('#vboxSettingsList').parent().innerHeight()-8).css({'overflow':'auto','padding':'0px','margin-top':'8px','border':'0px','border-spacing':'0px'});
+
+ // Resizing dialog, resizes this too
+ $('#vboxSettingsDialog').on('dialogresizestop',function(){
+ var h = $('#vboxSettingsList').css({'display':'none'}).parent().innerHeight();
+ $('#vboxSettingsList').height(h-8).css({'display':''});
+ });
+
+ /* Select first or passed menu item */
+ var i = 0;
+ var offset = 0;
+ var tab = undefined;
+ if(typeof pane == "string") {
+ var section = pane.split(':');
+ if(section[1]) tab = section[1];
+ for(i = 0; i < panes.length; i++) {
+ if(panes[i].disabled) offset++;
+ if(panes[i].name == section[0]) break;
+ }
+ }
+ i-=offset;
+ if(i >= panes.length) i = 0;
+ $('#vboxSettingsMenuList').children('li:eq('+i+')').first().click().each(function(){
+ if(tab !== undefined) {
+ // Check for out of scope tab
+ tab = Math.min(($('#vboxSettingsPane-'+$(this).data('name')).children('ul').first().children().length-1), parseInt(tab));
+ $('#vboxSettingsPane-'+$(this).data('name')).tabs('option','active', tab);
+ }
+
+ });
+
+ /* Only 1 pane? */
+ if(panes.length == 1) {
+ $('#vboxSettingsDialog table.vboxSettingsTable').css('width','100%');
+ $('#vboxSettingsDialog').dialog('option','title',(icon ? '<img src="images/vbox/'+icon+'_16px.png" class="vboxDialogTitleIcon" /> ' : '') + trans(panes[0].label,langContext));
+ }
+
+
+ };
+
+ loader.run();
+
+ return results.promise();
+
+}
diff --git a/js/eventlistener.js b/js/eventlistener.js
index 43de551..f98b908 100644
--- a/js/eventlistener.js
+++ b/js/eventlistener.js
@@ -1,250 +1,250 @@
-/**
- *
- * @fileOverview Event listener singleton. Provides vboxEventListener
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: eventlistener.js 596 2015-04-19 11:50:53Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- */
-
-/**
- * vboxEventListener
- *
- * Polls vboxwebsrv for pending events and triggers
- * events on $('#vboxPane')
- *
- * @namespace vboxEventListener
- */
-var vboxEventListener = {
-
- // Timeout
- timeout: 20,
-
- // Not initially running
- _running: false,
-
- // persistent request data
- _persist: {},
-
- // List of machines to subscribe to at runtime
- _subscribeList: [],
-
- // Watchdog to make sure vboxEventListener is still
- // running and attempting to get events
- _watchdog: {
- lastRun: 0,
- start: function() {
- window.setInterval(function() {
- if(vboxEventListener._running &&
- ((new Date().getTime()/1000) - vboxEventListener._watchdog.lastRun > vboxEventListener.timeout)) {
- phpVirtualBoxFailure(' (EventListener watchdog failure)');
- vboxEventListener.stop();
- window.clearInterval(vboxEventListener._watchdog.timer);
- }
- }, vboxEventListener.timeout)
- },
- stop: function() {
- window.clearInterval(vboxEventListener._watchdog.timer);
- }
- },
-
- // Since VirtualBox handles to event listener objects are persistent,
- // calls using the same handle should be synchronous
- _requestQueue: {
-
- requests: [],
- running: false,
-
- // run timer
- timer: window.setInterval(function(){
- vboxEventListener._requestQueue.run();
- }, 5000), // 5 seconds
-
- // Add a request to the queue
- addReq: function(q) {
-
- var d = $.Deferred();
-
- vboxEventListener._requestQueue.requests.push({'request':q,'deferred':d});
- vboxEventListener._requestQueue.run();
-
- return d.promise();
- },
-
- // Run through the queue
- run : function() {
-
- // Already running through queue
- if(vboxEventListener._requestQueue.running) return;
-
- vboxEventListener._requestQueue.running = true;
- vboxEventListener._requestQueue.runReq();
-
- },
-
- // Run a single request, removing it from the queue
- runReq: function() {
- var r = vboxEventListener._requestQueue.requests.shift();
- if(r) {
- $.when(r.request())
- .done(r.deferred.resolve)
- .fail(r.deferred.reject)
- .always(vboxEventListener._requestQueue.runReq);
- } else {
- vboxEventListener._requestQueue.running = false;
- }
- }
-
- },
-
- /**
- * Start event listener loop
- * @param {Array} vmlist - list of VM ids to subscribe to
- */
- start: function(vmlist) {
-
- // Already started?
- if(vboxEventListener._running) return;
-
- // Get timeout if exists
- if($('#vboxPane').data('vboxConfig').eventListenerTimeout)
- vboxEventListener.timeout = $('#vboxPane').data('vboxConfig').eventListenerTimeout;
-
- vboxEventListener._running = true;
-
- var started = $.Deferred();
-
- // Subscribe to events and start main loop
- $.when(vboxAjaxRequest('subscribeEvents',{vms:vmlist})).done(function(d) {
- vboxEventListener._persist = d.persist;
- $.when(vboxEventListener._getEvents()).done(function(){
- vboxEventListener._watchdog.start();
- started.resolve();
- });
- });
-
- return started.promise();
-
- },
-
- /**
- * Subscribe to a single machine's events. This should happen
- *
- * @param {String} vmid - ID of VM to subscribe to
- */
- subscribeVMEvents: function(vmid) {
-
- // Push into list
- vboxEventListener._subscribeList.push(vmid);
-
- // Add subscription request to queue
- return vboxEventListener._requestQueue.addReq(function(){
-
- if(!vboxEventListener._subscribeList.length) return;
-
- var vms = vboxEventListener._subscribeList.concat();
- vboxEventListener._subscribeList = [];
-
- var vmEvents = $.Deferred();
- $.when(vboxAjaxRequest('machineSubscribeEvents', {'vms':vms},{'persist':vboxEventListener._persist})).done(function(d){
- // Always set persistent request data
- vboxEventListener._persist = d.persist;
- }).always(function(){
- vmEvents.resolve();
- });
- return vmEvents.promise();
- });
-
- },
-
- /**
- * Stop event listener loop and unsubscribe from events
- */
- stop: function() {
-
- if(!vboxEventListener._running)
- return;
-
- window.clearTimeout(vboxEventListener._running);
- vboxEventListener._running = false;
-
- vboxEventListener._watchdog.stop();
-
- // Unsubscribe from events. Returns a deferred object
- return vboxEventListener._requestQueue.addReq(function(){
- return vboxAjaxRequest('unsubscribeEvents', {}, {'persist':vboxEventListener._persist});
- });
-
- },
-
- /**
- * Main loop - get pending events
- */
- _getEvents: function(){
-
- // Don't do anything if we aren't running anymore
- if(!vboxEventListener._running) return;
-
- // Add to queue
- return vboxEventListener._requestQueue.addReq(function(){
-
- return $.when(new Date().getTime(), vboxAjaxRequest('getEvents',{}, {'persist':vboxEventListener._persist})).done(function(lastTime,d) {
-
- // Don't do anything if this is not running
- if(!vboxEventListener._running) return;
-
- // Check for valid result
- if(!d || !d.success) {
- if(vboxEventListener._running)
- phpVirtualBoxFailure();
- return;
- }
-
-
- // Check key to make sure this isn't a stale
- // response from a previously selected server
- if(!d.key || (d.key != $('#vboxPane').data('vboxConfig').key)) return;
-
- // Tell the watch dog that we were run
- vboxEventListener._watchdog.lastRun = (new Date().getTime() / 1000);
-
- // Always set persistent request data
- vboxEventListener._persist = d.persist;
-
- // Loop through each event triggering changes
- if(d.responseData && d.responseData.length) {
-
- // Trigger each event individually
- for(var i = 0; i < d.responseData.length; i++) {
-
- // Trigger raw vbox events
- $('#vboxPane').trigger('vbox' + d.responseData[i].eventType, [d.responseData[i]]);
-
- }
-
- // Trigger event list queue
- $('#vboxPane').trigger('vboxEvents', [d.responseData]);
-
- }
-
- // Wait at most 3 seconds
- var wait = Math.min(3000,3000 - ((new Date().getTime()) - lastTime));
- if(wait <= 0) {
- vboxEventListener._running = true;
- vboxEventListener._getEvents();
- }
- else {
- vboxEventListener._running = window.setTimeout(vboxEventListener._getEvents, wait);
- }
-
- });
-
- });
- }
-};
-
-// Stop event listener on window unload
-$(document).ready(function() {
- $(window).on('unload',function() {
- vboxEventListener.stop();
- });
-});
+/**
+ *
+ * @fileOverview Event listener singleton. Provides vboxEventListener
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: eventlistener.js 596 2015-04-19 11:50:53Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ */
+
+/**
+ * vboxEventListener
+ *
+ * Polls vboxwebsrv for pending events and triggers
+ * events on $('#vboxPane')
+ *
+ * @namespace vboxEventListener
+ */
+var vboxEventListener = {
+
+ // Timeout
+ timeout: 20,
+
+ // Not initially running
+ _running: false,
+
+ // persistent request data
+ _persist: {},
+
+ // List of machines to subscribe to at runtime
+ _subscribeList: [],
+
+ // Watchdog to make sure vboxEventListener is still
+ // running and attempting to get events
+ _watchdog: {
+ lastRun: 0,
+ start: function() {
+ window.setInterval(function() {
+ if(vboxEventListener._running &&
+ ((new Date().getTime()/1000) - vboxEventListener._watchdog.lastRun > vboxEventListener.timeout)) {
+ phpVirtualBoxFailure(' (EventListener watchdog failure)');
+ vboxEventListener.stop();
+ window.clearInterval(vboxEventListener._watchdog.timer);
+ }
+ }, vboxEventListener.timeout)
+ },
+ stop: function() {
+ window.clearInterval(vboxEventListener._watchdog.timer);
+ }
+ },
+
+ // Since VirtualBox handles to event listener objects are persistent,
+ // calls using the same handle should be synchronous
+ _requestQueue: {
+
+ requests: [],
+ running: false,
+
+ // run timer
+ timer: window.setInterval(function(){
+ vboxEventListener._requestQueue.run();
+ }, 5000), // 5 seconds
+
+ // Add a request to the queue
+ addReq: function(q) {
+
+ var d = $.Deferred();
+
+ vboxEventListener._requestQueue.requests.push({'request':q,'deferred':d});
+ vboxEventListener._requestQueue.run();
+
+ return d.promise();
+ },
+
+ // Run through the queue
+ run : function() {
+
+ // Already running through queue
+ if(vboxEventListener._requestQueue.running) return;
+
+ vboxEventListener._requestQueue.running = true;
+ vboxEventListener._requestQueue.runReq();
+
+ },
+
+ // Run a single request, removing it from the queue
+ runReq: function() {
+ var r = vboxEventListener._requestQueue.requests.shift();
+ if(r) {
+ $.when(r.request())
+ .done(r.deferred.resolve)
+ .fail(r.deferred.reject)
+ .always(vboxEventListener._requestQueue.runReq);
+ } else {
+ vboxEventListener._requestQueue.running = false;
+ }
+ }
+
+ },
+
+ /**
+ * Start event listener loop
+ * @param {Array} vmlist - list of VM ids to subscribe to
+ */
+ start: function(vmlist) {
+
+ // Already started?
+ if(vboxEventListener._running) return;
+
+ // Get timeout if exists
+ if($('#vboxPane').data('vboxConfig').eventListenerTimeout)
+ vboxEventListener.timeout = $('#vboxPane').data('vboxConfig').eventListenerTimeout;
+
+ vboxEventListener._running = true;
+
+ var started = $.Deferred();
+
+ // Subscribe to events and start main loop
+ $.when(vboxAjaxRequest('subscribeEvents',{vms:vmlist})).done(function(d) {
+ vboxEventListener._persist = d.persist;
+ $.when(vboxEventListener._getEvents()).done(function(){
+ vboxEventListener._watchdog.start();
+ started.resolve();
+ });
+ });
+
+ return started.promise();
+
+ },
+
+ /**
+ * Subscribe to a single machine's events. This should happen
+ *
+ * @param {String} vmid - ID of VM to subscribe to
+ */
+ subscribeVMEvents: function(vmid) {
+
+ // Push into list
+ vboxEventListener._subscribeList.push(vmid);
+
+ // Add subscription request to queue
+ return vboxEventListener._requestQueue.addReq(function(){
+
+ if(!vboxEventListener._subscribeList.length) return;
+
+ var vms = vboxEventListener._subscribeList.concat();
+ vboxEventListener._subscribeList = [];
+
+ var vmEvents = $.Deferred();
+ $.when(vboxAjaxRequest('machineSubscribeEvents', {'vms':vms},{'persist':vboxEventListener._persist})).done(function(d){
+ // Always set persistent request data
+ vboxEventListener._persist = d.persist;
+ }).always(function(){
+ vmEvents.resolve();
+ });
+ return vmEvents.promise();
+ });
+
+ },
+
+ /**
+ * Stop event listener loop and unsubscribe from events
+ */
+ stop: function() {
+
+ if(!vboxEventListener._running)
+ return;
+
+ window.clearTimeout(vboxEventListener._running);
+ vboxEventListener._running = false;
+
+ vboxEventListener._watchdog.stop();
+
+ // Unsubscribe from events. Returns a deferred object
+ return vboxEventListener._requestQueue.addReq(function(){
+ return vboxAjaxRequest('unsubscribeEvents', {}, {'persist':vboxEventListener._persist});
+ });
+
+ },
+
+ /**
+ * Main loop - get pending events
+ */
+ _getEvents: function(){
+
+ // Don't do anything if we aren't running anymore
+ if(!vboxEventListener._running) return;
+
+ // Add to queue
+ return vboxEventListener._requestQueue.addReq(function(){
+
+ return $.when(new Date().getTime(), vboxAjaxRequest('getEvents',{}, {'persist':vboxEventListener._persist})).done(function(lastTime,d) {
+
+ // Don't do anything if this is not running
+ if(!vboxEventListener._running) return;
+
+ // Check for valid result
+ if(!d || !d.success) {
+ if(vboxEventListener._running)
+ phpVirtualBoxFailure();
+ return;
+ }
+
+
+ // Check key to make sure this isn't a stale
+ // response from a previously selected server
+ if(!d.key || (d.key != $('#vboxPane').data('vboxConfig').key)) return;
+
+ // Tell the watch dog that we were run
+ vboxEventListener._watchdog.lastRun = (new Date().getTime() / 1000);
+
+ // Always set persistent request data
+ vboxEventListener._persist = d.persist;
+
+ // Loop through each event triggering changes
+ if(d.responseData && d.responseData.length) {
+
+ // Trigger each event individually
+ for(var i = 0; i < d.responseData.length; i++) {
+
+ // Trigger raw vbox events
+ $('#vboxPane').trigger('vbox' + d.responseData[i].eventType, [d.responseData[i]]);
+
+ }
+
+ // Trigger event list queue
+ $('#vboxPane').trigger('vboxEvents', [d.responseData]);
+
+ }
+
+ // Wait at most 3 seconds
+ var wait = Math.min(3000,3000 - ((new Date().getTime()) - lastTime));
+ if(wait <= 0) {
+ vboxEventListener._running = true;
+ vboxEventListener._getEvents();
+ }
+ else {
+ vboxEventListener._running = window.setTimeout(vboxEventListener._getEvents, wait);
+ }
+
+ });
+
+ });
+ }
+};
+
+// Stop event listener on window unload
+$(document).ready(function() {
+ $(window).on('unload',function() {
+ vboxEventListener.stop();
+ });
+});
diff --git a/js/jquery.jec-1.3.1.js b/js/jquery.jec-1.3.1.js
index 33acd4b..3065fca 100644
--- a/js/jquery.jec-1.3.1.js
+++ b/js/jquery.jec-1.3.1.js
@@ -1,861 +1,861 @@
-/**
- * jQuery jEC (jQuery Editable Combobox) 1.3.1
- * http://code.google.com/p/jquery-jec
- *
- * Copyright (c) 2008-2009 Lukasz Rajchel (lukasz@rajchel.pl | http://rajchel.pl)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * Documentation : http://code.google.com/p/jquery-jec/wiki/Documentation
- * Changelog : http://code.google.com/p/jquery-jec/wiki/Changelog
- *
- * Contributors : Lukasz Rajchel, Artem Orlov
- */
-
-/*jslint white: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true,
-bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxerr: 50, indent: 4,
-maxlen: 100*/
-/*global Array, Math, String, clearInterval, document, jQuery, setInterval*/
-/*members ':', Handle, Remove, Set, acceptedKeys, addClass, all, append, appendTo, array, attr,
-before, bind, blinkingCursor, blinkingCursorInterval, blur, bool, browser, ceil, change, charCode,
-classes, clearCursor, click, css, cursorState, data, destroy, disable, each, editable, enable, eq,
-expr, extend, filter, find, floor, fn, focus, focusOnNewOption, fromCharCode, get, getId,
-handleCursor, ignoredKeys, ignoreOptGroups, inArray, init, initJS, integer, isArray, isPlainObject,
-jEC, jECTimer, jec, jecKill, jecOff, jecOn, jecPref, jecValue, keyCode, keyDown, keyPress,
-keyRange, keyUp, keys, length, max, maxLength, min, msie, object, openedState, optionClasses,
-optionStyles, parent, position, pref, push, random, remove, removeAttr, removeClass, removeData,
-safari, setEditableOption, styles, substring, text, trigger triggerChangeEvent, unbind, uneditable,
-useExistingOptions, val, value, valueIsEditable*/
-'use strict';
-(function ($) {
-
- $.jEC = (function () {
- var pluginClass = 'jecEditableOption', cursorClass = 'hasCursor', options = {},
- values = {}, lastKeyCode, defaults, Validators, EventHandlers, Combobox,
- activeCombobox;
-
- defaults = {
- position: 0,
- ignoreOptGroups: false,
- maxLength: 255,
- classes: [],
- styles: {},
- optionClasses: [],
- optionStyles: {},
- triggerChangeEvent: false,
- focusOnNewOption: false,
- useExistingOptions: false,
- blinkingCursor: false,
- blinkingCursorInterval: 1000,
- ignoredKeys: [],
- acceptedKeys: [[32, 126], [191, 382]]
- };
-
- Validators = (function () {
- return {
- integer: function (value) {
- return typeof value === 'number' && Math.ceil(value) === Math.floor(value);
- },
-
- keyRange: function (value) {
- var min, max;
- if (typeof value === 'object' && !$.isArray(value)) {
- min = value.min;
- max = value.max;
- } else if ($.isArray(value) && value.length === 2) {
- min = value[0];
- max = value[1];
- }
- return Validators.integer(min) && Validators.integer(max) && min <= max;
- }
- };
- }());
-
- EventHandlers = (function () {
- var getKeyCode;
-
- getKeyCode = function (event) {
- var charCode = event.charCode;
- if (charCode !== undefined && charCode !== 0) {
- return charCode;
- } else {
- return event.keyCode;
- }
- };
-
- return {
- // focus event handler
- // enables blinking cursor
- focus: function (event) {
- var opt = options[Combobox.getId($(this))];
- if (opt.blinkingCursor && $.jECTimer === undefined) {
- activeCombobox = $(this);
- $.jECTimer = setInterval($.jEC.handleCursor, opt.blinkingCursorInterval);
- }
- },
-
- // blur event handler
- // disables blinking cursor
- blur: function (event) {
- if ($.jECTimer !== undefined) {
- clearInterval($.jECTimer);
- $.jECTimer = undefined;
- activeCombobox = undefined;
- Combobox.clearCursor($(this));
- }
- Combobox.openedState($(this), false);
- },
-
- // keydown event handler
- // handles keys pressed on select (backspace and delete must be handled
- // in keydown event in order to work in IE)
- keyDown: function (event) {
- var keyCode = getKeyCode(event), option, value;
-
- lastKeyCode = keyCode;
-
- switch (keyCode) {
- case 8: // backspace
- case 46: // delete
- option = $(this).find('option.' + pluginClass);
- if (option.val().length >= 1) {
- value = option.text().substring(0, option.text().length - 1);
- option.val(value).text(value).prop('selected', true);
- }
- return (keyCode !== 8);
- default:
- break;
- }
- },
-
- // keypress event handler
- // handles the rest of the keys (keypress event gives more informations
- // about pressed keys)
- keyPress: function (event) {
- var keyCode = getKeyCode(event), opt = options[Combobox.getId($(this))],
- option, value, specialKeys, exit = false, text;
-
- Combobox.clearCursor($(this));
- if (keyCode !== 9 && keyCode !== 13 && keyCode !== 27) {
- // special keys codes
- specialKeys = [37, 38, 39, 40, 46];
- // handle special keys
- $.each(specialKeys, function (i, val) {
- if (keyCode === val && keyCode === lastKeyCode) {
- exit = true;
- }
- });
-
- // don't handle ignored keys
- if (!exit && $.inArray(keyCode, opt.ignoredKeys) === -1) {
-
- // remove selection from all options
- $(this).find('option:selected').prop('selected',false);
-
- if ($.inArray(keyCode, opt.acceptedKeys) !== -1) {
- option = $(this).find('option.' + pluginClass).first();
- text = option.text();
-
- if (text.length < opt.maxLength) {
- value = text + String.fromCharCode(keyCode);
- option.val(value).text(value).attr('label',value);
- }
-
- option.prop('selected', true);
- }
- }
-
- return false;
- }
- },
-
- keyUp: function (event) {
- var opt = options[Combobox.getId($(this))];
- if (opt.triggerChangeEvent) {
- $(this).trigger('change');
- }
- },
-
- // change event handler
- // handles editable option changing based on a pre-existing values
- change: function () {
- var opt = options[Combobox.getId($(this))];
- if (opt.useExistingOptions) {
- Combobox.setEditableOption($(this));
- }
- },
-
- click: function () {
- if (!$.browser.safari) {
- Combobox.openedState($(this), !Combobox.openedState($(this)));
- }
- }
- };
- }());
-
- // Combobox
- Combobox = (function () {
- var Parameters, EditableOption, generateId, setup;
-
- // validates and set combobox parameters
- Parameters = (function () {
- var Set, Remove, Handle;
-
- Set = (function () {
- var parseKeys, Handles;
-
- parseKeys = function (value) {
- var keys = [];
- if ($.isArray(value)) {
- $.each(value, function (i, val) {
- var j, min, max;
- if (Validators.keyRange(val)) {
- if ($.isArray(val)) {
- min = val[0];
- max = val[1];
- } else {
- min = val.min;
- max = val.max;
- }
- for (j = min; j <= max; j += 1) {
- keys.push(j);
- }
- } else if (typeof val === 'number' && Validators.integer(val)) {
- keys.push(val);
- }
- });
- }
- return keys;
- };
-
- Handles = (function () {
- return {
- integer: function (elem, name, value) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && Validators.integer(value)) {
- opt[name] = value;
- return true;
- }
- return false;
- },
- bool: function (elem, name, value) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && typeof value === 'boolean') {
- opt[name] = value;
- return true;
- }
- return false;
- },
- array: function (elem, name, value) {
- if (typeof value === 'string') {
- value = [value];
- }
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && $.isArray(value)) {
- opt[name] = value;
- return true;
- }
- return false;
- },
- object: function (elem, name, value) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && value !== null &&
- typeof value === 'object' && !$.isArray(value)) {
- opt[name] = value;
- }
- },
- keys: function (elem, name, value) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && $.isArray(value)) {
- opt[name] = parseKeys(value);
- }
- }
- };
- }());
-
- return {
- position: function (elem, value) {
- if (Handles.integer(elem, 'position', value)) {
- var id = Combobox.getId(elem), opt = options[id], optionsCount;
- optionsCount =
- elem.find('option:not(.' + pluginClass + ')').length;
- if (value > optionsCount) {
- opt.position = optionsCount;
- }
- }
- },
-
- ignoreOptGroups: function (elem, value) {
- Handles.bool(elem, 'ignoreOptGroups', value);
- },
-
- maxLength: function (elem, value) {
- if (Handles.integer(elem, 'maxLength', value)) {
- var id = Combobox.getId(elem), opt = options[id];
- if (value < 0 || value > 255) {
- opt.maxLength = 255;
- }
- }
- },
-
- classes: function (elem, value) {
- Handles.array(elem, 'classes', value);
- },
-
- optionClasses: function (elem, value) {
- Handles.array(elem, 'optionClasses', value);
- },
-
- styles: function (elem, value) {
- Handles.object(elem, 'styles', value);
- },
-
- optionStyles: function (elem, value) {
- Handles.object(elem, 'optionStyles', value);
- },
-
- triggerChangeEvent: function (elem, value) {
- Handles.bool(elem, 'triggerChangeEvent', value);
- },
-
- focusOnNewOption: function (elem, value) {
- Handles.bool(elem, 'focusOnNewOption', value);
- },
-
- useExistingOptions: function (elem, value) {
- Handles.bool(elem, 'useExistingOptions', value);
- },
-
- blinkingCursor: function (elem, value) {
- Handles.bool(elem, 'blinkingCursor', value);
- },
-
- blinkingCursorInterval: function (elem, value) {
- Handles.integer(elem, 'blinkingCursorInterval', value);
- },
-
- ignoredKeys: function (elem, value) {
- Handles.keys(elem, 'ignoredKeys', value);
- },
-
- acceptedKeys: function (elem, value) {
- Handles.keys(elem, 'acceptedKeys', value);
- }
- };
- }());
-
- Remove = (function () {
- var removeClasses, removeStyles;
-
- removeClasses = function (elem, classes) {
- $.each(classes, function (i, val) {
- elem.removeClass(val);
- });
- };
-
- removeStyles = function (elem, styles) {
- $.each(styles, function (key, val) {
- elem.css(key, '');
- });
- };
-
- return {
- classes: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- removeClasses(elem, opt.classes);
- }
- },
-
- optionClasses: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- removeClasses(elem.find('option.' + pluginClass),
- opt.optionClasses);
- }
- },
-
- styles: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- removeStyles(elem, opt.styles);
- }
- },
-
- optionStyles: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- removeStyles(elem.find('option.' + pluginClass),
- opt.optionStyles);
- }
- },
-
- all: function (elem) {
- Remove.classes(elem);
- Remove.optionClasses(elem);
- Remove.styles(elem);
- Remove.optionStyles(elem);
- }
- };
- }());
-
- Handle = (function () {
- var setClasses, setStyles;
-
- setClasses = function (elem, classes) {
- $.each(classes, function (i, val) {
- elem.addClass(val);
- });
- };
-
- setStyles = function (elem, styles) {
- $.each(styles, function (key, val) {
- elem.css(key, val);
- });
- };
-
- return {
- position: function (elem) {
- var opt = options[Combobox.getId(elem)], option, uneditableOptions,
- container;
- option = elem.find('option.' + pluginClass);
-
- uneditableOptions = elem.find('option:not(.' + pluginClass + ')');
- if (opt.position < uneditableOptions.length) {
- container = uneditableOptions.eq(opt.position);
-
- if (!opt.ignoreOptGroups &&
- container.parent('optgroup').length > 0) {
- uneditableOptions.eq(opt.position).parent().before(option);
- } else {
- uneditableOptions.eq(opt.position).before(option);
- }
- } else {
- elem.append(option);
- }
- },
-
- classes: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- setClasses(elem, opt.classes);
- }
- },
-
- optionClasses: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- setClasses(elem.find('option.' + pluginClass),
- opt.optionClasses);
- }
- },
-
- styles: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- setStyles(elem, opt.styles);
- }
- },
-
- optionStyles: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined) {
- setStyles(elem.find('option.' + pluginClass),
- opt.optionStyles);
- }
- },
-
- focusOnNewOption: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && opt.focusOnNewOption) {
- elem.find('option.' + pluginClass)
- .prop('selected', true);
- }
- },
-
- useExistingOptions: function (elem) {
- var id = Combobox.getId(elem), opt = options[id];
- if (opt !== undefined && opt.useExistingOptions) {
- Combobox.setEditableOption(elem);
- }
- },
-
- all: function (elem) {
- Handle.position(elem);
- Handle.classes(elem);
- Handle.optionClasses(elem);
- Handle.styles(elem);
- Handle.optionStyles(elem);
- Handle.focusOnNewOption(elem);
- Handle.useExistingOptions(elem);
- }
- };
- }());
-
- return {
- Set: Set,
- Remove: Remove,
- Handle: Handle
- };
- }());
-
- EditableOption = (function () {
- return {
- init: function (elem) {
- if (!elem.find('option.' + pluginClass).length) {
- var editableOption = $('<option>');
- editableOption.addClass(pluginClass);
- elem.append(editableOption);
- }
-
- elem.on('keydown', EventHandlers.keyDown);
- elem.on('keypress', EventHandlers.keyPress);
- elem.on('keyup', EventHandlers.keyUp);
- elem.on('change', EventHandlers.change);
- elem.on('focus', EventHandlers.focus);
- elem.on('blur', EventHandlers.blur);
- elem.on('click', EventHandlers.click);
- },
-
- destroy: function (elem) {
- elem.find('option.' + pluginClass).remove();
- elem.off('keydown', EventHandlers.keyDown);
- elem.off('keypress', EventHandlers.keyPress);
- elem.off('keyup', EventHandlers.keyUp);
- elem.off('change', EventHandlers.change);
- elem.off('focus', EventHandlers.focus);
- elem.off('blur', EventHandlers.blur);
- elem.off('click', EventHandlers.click);
- }
- };
- }());
-
- // generates unique identifier
- generateId = function () {
- while (true) {
- var random = Math.floor(Math.random() * 100000);
-
- if (options[random] === undefined) {
- return random;
- }
- }
- };
-
- // sets combobox
- setup = function (elem) {
- EditableOption.init(elem);
- Parameters.Handle.all(elem);
- };
-
- // Combobox public members
- return {
- // create editable combobox
- init: function (settings) {
- return $(this).filter(':uneditable').each(function () {
-
- var id = generateId(), elem = $(this);
-
- elem.data('jecId', id);
-
- // override passed default options
- options[id] = $.extend(true, {}, defaults);
-
- // parse keys
- Parameters.Set.ignoredKeys(elem, options[id].ignoredKeys);
- Parameters.Set.acceptedKeys(elem, options[id].acceptedKeys);
-
- if (typeof settings === 'object' && !$.isArray(settings)) {
- $.each(settings, function (key, val) {
- if (val !== undefined) {
- switch (key) {
- case 'position':
- Parameters.Set.position(elem, val);
- break;
- case 'ignoreOptGroups':
- Parameters.Set.ignoreOptGroups(elem, val);
- break;
- case 'maxLength':
- Parameters.Set.maxLength(elem, val);
- break;
- case 'classes':
- Parameters.Set.classes(elem, val);
- break;
- case 'optionClasses':
- Parameters.Set.optionClasses(elem, val);
- break;
- case 'styles':
- Parameters.Set.styles(elem, val);
- break;
- case 'optionStyles':
- Parameters.Set.optionStyles(elem, val);
- break;
- case 'triggerChangeEvent':
- Parameters.Set.triggerChangeEvent(elem, val);
- break;
- case 'focusOnNewOption':
- Parameters.Set.focusOnNewOption(elem, val);
- break;
- case 'useExistingOptions':
- Parameters.Set.useExistingOptions(elem, val);
- break;
- case 'blinkingCursor':
- Parameters.Set.blinkingCursor(elem, val);
- break;
- case 'blinkingCursorInterval':
- Parameters.Set.blinkingCursorInterval(elem, val);
- break;
- case 'ignoredKeys':
- Parameters.Set.ignoredKeys(elem, val);
- break;
- case 'acceptedKeys':
- Parameters.Set.acceptedKeys(elem, val);
- break;
- }
- }
- });
- }
-
- setup($(this));
- });
- },
-
- // creates editable combobox without using existing select elements
- initJS: function (options, settings) {
- var select, addOptions;
-
- select = $('<select>');
-
- addOptions = function (elem, options) {
- if ($.isArray(options)) {
- $.each(options, function (i, val) {
- if ($.isPlainObject(val)) {
- $.each(val, function (key, value) {
- if ($.isArray(value)) {
- var og = $('<optgroup>').attr('label', key);
- addOptions(og, value);
- og.appendTo(select);
- } else if (typeof value === 'number' ||
- typeof value === 'string') {
- $('<option>').text(value).prop('value', key)
- .appendTo(elem);
- }
- });
- } else if (typeof val === 'string' || typeof val === 'number') {
- $('<option>').text(val).prop('value', val).appendTo(elem);
- }
- });
- }
- };
-
- addOptions(select, options);
-
- return select.jec(settings);
- },
-
- // destroys editable combobox
- destroy: function () {
- return $(this).filter(':editable').each(function () {
- $(this).jecOff();
- $.removeData($(this).get(0), 'jecId');
- $.removeData($(this).get(0), 'jecCursorState');
- $.removeData($(this).get(0), 'jecOpenedState');
- });
- },
-
- // enable editablecombobox
- enable: function () {
- return $(this).filter(':editable').each(function () {
- var id = Combobox.getId($(this)), value = values[id];
-
- setup($(this));
-
- if (value !== undefined) {
- $(this).jecValue(value);
- }
- });
- },
-
- // disable editable combobox
- disable: function () {
- return $(this).filter(':editable').each(function () {
- var val = $(this).find('option.' + pluginClass).val();
- values[Combobox.getId($(this))] = val;
- Parameters.Remove.all($(this));
- EditableOption.destroy($(this));
- });
- },
-
- // gets or sets editable option's value
- value: function (value, setFocus) {
- if ($(this).filter(':editable').length > 0) {
- if (value === null || value === undefined) {
- // get value
- return $(this).find('option.' + pluginClass).val();
- } else if (typeof value === 'string' || typeof value === 'number') {
- // set value
- return $(this).filter(':editable').each(function () {
- var option = $(this).find('option.' + pluginClass);
- option.val(value).text(value);
- if (typeof setFocus !== 'boolean' || setFocus) {
- option.prop('selected', true);
- }
- });
- }
- }
- },
-
- // gets or sets editable option's preference
- pref: function (name, value) {
- if ($(this).filter(':editable').length > 0) {
- if (typeof name === 'string') {
- if (value === null || value === undefined) {
- // get preference
- return options[Combobox.getId($(this))][name];
- } else {
- // set preference
- return $(this).filter(':editable').each(function () {
- switch (name) {
- case 'position':
- Parameters.Set.position($(this), value);
- Parameters.Handle.position($(this));
- break;
- case 'classes':
- Parameters.Remove.classes($(this));
- Parameters.Set.classes($(this), value);
- Parameters.Handle.position($(this));
- break;
- case 'optionClasses':
- Parameters.Remove.optionClasses($(this));
- Parameters.Set.optionClasses($(this), value);
- Parameters.Set.optionClasses($(this));
- break;
- case 'styles':
- Parameters.Remove.styles($(this));
- Parameters.Set.styles($(this), value);
- Parameters.Set.styles($(this));
- break;
- case 'optionStyles':
- Parameters.Remove.optionStyles($(this));
- Parameters.Set.optionStyles($(this), value);
- Parameters.Handle.optionStyles($(this));
- break;
- case 'focusOnNewOption':
- Parameters.Set.focusOnNewOption($(this), value);
- Parameters.Handle.focusOnNewOption($(this));
- break;
- case 'useExistingOptions':
- Parameters.Set.useExistingOptions($(this), value);
- Parameters.Handle.useExistingOptions($(this));
- break;
- case 'blinkingCursor':
- Parameters.Set.blinkingCursor($(this), value);
- break;
- case 'blinkingCursorInterval':
- Parameters.Set.blinkingCursorInterval($(this), value);
- break;
- case 'ignoredKeys':
- Parameters.Set.ignoredKeys($(this), value);
- break;
- case 'acceptedKeys':
- Parameters.Set.acceptedKeys($(this), value);
- break;
- }
- });
- }
- }
- }
- },
-
- // sets editable option to the value of currently selected option
- setEditableOption: function (elem) {
- var value = elem.find('option:selected').text();
- elem.find('option.' + pluginClass).prop('value', elem.val())
- .text(value).prop('selected', true);
- },
-
- // get combobox id
- getId: function (elem) {
- return elem.data('jecId');
- },
-
- valueIsEditable: function (elem) {
- return elem.find('option.' + pluginClass).get(0) ===
- elem.find('option:selected').get(0);
- },
-
- clearCursor: function (elem) {
- $(elem).find('option.' + cursorClass).each(function () {
- var text = $(this).text();
- $(this).removeClass(cursorClass).text(text.substring(0, text.length - 1));
- });
- },
-
- cursorState: function (elem, state) {
- return elem.data('jecCursorState', state);
- },
-
- openedState: function (elem, state) {
- return elem.data('jecOpenedState', state);
- },
-
- //handles editable cursor
- handleCursor: function () {
- if (activeCombobox !== undefined && activeCombobox !== null) {
- if ($.browser.msie && Combobox.openedState(activeCombobox)) {
- return;
- }
-
- var state = Combobox.cursorState(activeCombobox), elem;
- if (state) {
- Combobox.clearCursor(activeCombobox);
- } else if (Combobox.valueIsEditable(activeCombobox)) {
- elem = activeCombobox.find('option:selected');
- elem.addClass(cursorClass).text(elem.text() + '|');
- }
- Combobox.cursorState(activeCombobox, !state);
- }
- }
- };
- }());
-
- // jEC public members
- return {
- init: Combobox.init,
- enable: Combobox.enable,
- disable: Combobox.disable,
- destroy: Combobox.destroy,
- value: Combobox.value,
- pref: Combobox.pref,
- initJS: Combobox.initJS,
- handleCursor: Combobox.handleCursor
- };
- }());
-
- // register functions
- $.fn.extend({
- jec: $.jEC.init,
- jecOn: $.jEC.enable,
- jecOff: $.jEC.disable,
- jecKill: $.jEC.destroy,
- jecValue: $.jEC.value,
- jecPref: $.jEC.pref
- });
-
- $.extend({
- jec: $.jEC.initJS
- });
-
- // register selectors
- $.extend($.expr[':'], {
- editable: function (a) {
- var data = $(a).data('jecId');
- return data !== null && data !== undefined;
- },
-
- uneditable: function (a) {
- var data = $(a).data('jecId');
- return data === null || data === undefined;
- }
- });
-
+/**
+ * jQuery jEC (jQuery Editable Combobox) 1.3.1
+ * http://code.google.com/p/jquery-jec
+ *
+ * Copyright (c) 2008-2009 Lukasz Rajchel (lukasz@rajchel.pl | http://rajchel.pl)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * Documentation : http://code.google.com/p/jquery-jec/wiki/Documentation
+ * Changelog : http://code.google.com/p/jquery-jec/wiki/Changelog
+ *
+ * Contributors : Lukasz Rajchel, Artem Orlov
+ */
+
+/*jslint white: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true,
+bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxerr: 50, indent: 4,
+maxlen: 100*/
+/*global Array, Math, String, clearInterval, document, jQuery, setInterval*/
+/*members ':', Handle, Remove, Set, acceptedKeys, addClass, all, append, appendTo, array, attr,
+before, bind, blinkingCursor, blinkingCursorInterval, blur, bool, browser, ceil, change, charCode,
+classes, clearCursor, click, css, cursorState, data, destroy, disable, each, editable, enable, eq,
+expr, extend, filter, find, floor, fn, focus, focusOnNewOption, fromCharCode, get, getId,
+handleCursor, ignoredKeys, ignoreOptGroups, inArray, init, initJS, integer, isArray, isPlainObject,
+jEC, jECTimer, jec, jecKill, jecOff, jecOn, jecPref, jecValue, keyCode, keyDown, keyPress,
+keyRange, keyUp, keys, length, max, maxLength, min, msie, object, openedState, optionClasses,
+optionStyles, parent, position, pref, push, random, remove, removeAttr, removeClass, removeData,
+safari, setEditableOption, styles, substring, text, trigger triggerChangeEvent, unbind, uneditable,
+useExistingOptions, val, value, valueIsEditable*/
+'use strict';
+(function ($) {
+
+ $.jEC = (function () {
+ var pluginClass = 'jecEditableOption', cursorClass = 'hasCursor', options = {},
+ values = {}, lastKeyCode, defaults, Validators, EventHandlers, Combobox,
+ activeCombobox;
+
+ defaults = {
+ position: 0,
+ ignoreOptGroups: false,
+ maxLength: 255,
+ classes: [],
+ styles: {},
+ optionClasses: [],
+ optionStyles: {},
+ triggerChangeEvent: false,
+ focusOnNewOption: false,
+ useExistingOptions: false,
+ blinkingCursor: false,
+ blinkingCursorInterval: 1000,
+ ignoredKeys: [],
+ acceptedKeys: [[32, 126], [191, 382]]
+ };
+
+ Validators = (function () {
+ return {
+ integer: function (value) {
+ return typeof value === 'number' && Math.ceil(value) === Math.floor(value);
+ },
+
+ keyRange: function (value) {
+ var min, max;
+ if (typeof value === 'object' && !$.isArray(value)) {
+ min = value.min;
+ max = value.max;
+ } else if ($.isArray(value) && value.length === 2) {
+ min = value[0];
+ max = value[1];
+ }
+ return Validators.integer(min) && Validators.integer(max) && min <= max;
+ }
+ };
+ }());
+
+ EventHandlers = (function () {
+ var getKeyCode;
+
+ getKeyCode = function (event) {
+ var charCode = event.charCode;
+ if (charCode !== undefined && charCode !== 0) {
+ return charCode;
+ } else {
+ return event.keyCode;
+ }
+ };
+
+ return {
+ // focus event handler
+ // enables blinking cursor
+ focus: function (event) {
+ var opt = options[Combobox.getId($(this))];
+ if (opt.blinkingCursor && $.jECTimer === undefined) {
+ activeCombobox = $(this);
+ $.jECTimer = setInterval($.jEC.handleCursor, opt.blinkingCursorInterval);
+ }
+ },
+
+ // blur event handler
+ // disables blinking cursor
+ blur: function (event) {
+ if ($.jECTimer !== undefined) {
+ clearInterval($.jECTimer);
+ $.jECTimer = undefined;
+ activeCombobox = undefined;
+ Combobox.clearCursor($(this));
+ }
+ Combobox.openedState($(this), false);
+ },
+
+ // keydown event handler
+ // handles keys pressed on select (backspace and delete must be handled
+ // in keydown event in order to work in IE)
+ keyDown: function (event) {
+ var keyCode = getKeyCode(event), option, value;
+
+ lastKeyCode = keyCode;
+
+ switch (keyCode) {
+ case 8: // backspace
+ case 46: // delete
+ option = $(this).find('option.' + pluginClass);
+ if (option.val().length >= 1) {
+ value = option.text().substring(0, option.text().length - 1);
+ option.val(value).text(value).prop('selected', true);
+ }
+ return (keyCode !== 8);
+ default:
+ break;
+ }
+ },
+
+ // keypress event handler
+ // handles the rest of the keys (keypress event gives more informations
+ // about pressed keys)
+ keyPress: function (event) {
+ var keyCode = getKeyCode(event), opt = options[Combobox.getId($(this))],
+ option, value, specialKeys, exit = false, text;
+
+ Combobox.clearCursor($(this));
+ if (keyCode !== 9 && keyCode !== 13 && keyCode !== 27) {
+ // special keys codes
+ specialKeys = [37, 38, 39, 40, 46];
+ // handle special keys
+ $.each(specialKeys, function (i, val) {
+ if (keyCode === val && keyCode === lastKeyCode) {
+ exit = true;
+ }
+ });
+
+ // don't handle ignored keys
+ if (!exit && $.inArray(keyCode, opt.ignoredKeys) === -1) {
+
+ // remove selection from all options
+ $(this).find('option:selected').prop('selected',false);
+
+ if ($.inArray(keyCode, opt.acceptedKeys) !== -1) {
+ option = $(this).find('option.' + pluginClass).first();
+ text = option.text();
+
+ if (text.length < opt.maxLength) {
+ value = text + String.fromCharCode(keyCode);
+ option.val(value).text(value).attr('label',value);
+ }
+
+ option.prop('selected', true);
+ }
+ }
+
+ return false;
+ }
+ },
+
+ keyUp: function (event) {
+ var opt = options[Combobox.getId($(this))];
+ if (opt.triggerChangeEvent) {
+ $(this).trigger('change');
+ }
+ },
+
+ // change event handler
+ // handles editable option changing based on a pre-existing values
+ change: function () {
+ var opt = options[Combobox.getId($(this))];
+ if (opt.useExistingOptions) {
+ Combobox.setEditableOption($(this));
+ }
+ },
+
+ click: function () {
+ if (!$.browser.safari) {
+ Combobox.openedState($(this), !Combobox.openedState($(this)));
+ }
+ }
+ };
+ }());
+
+ // Combobox
+ Combobox = (function () {
+ var Parameters, EditableOption, generateId, setup;
+
+ // validates and set combobox parameters
+ Parameters = (function () {
+ var Set, Remove, Handle;
+
+ Set = (function () {
+ var parseKeys, Handles;
+
+ parseKeys = function (value) {
+ var keys = [];
+ if ($.isArray(value)) {
+ $.each(value, function (i, val) {
+ var j, min, max;
+ if (Validators.keyRange(val)) {
+ if ($.isArray(val)) {
+ min = val[0];
+ max = val[1];
+ } else {
+ min = val.min;
+ max = val.max;
+ }
+ for (j = min; j <= max; j += 1) {
+ keys.push(j);
+ }
+ } else if (typeof val === 'number' && Validators.integer(val)) {
+ keys.push(val);
+ }
+ });
+ }
+ return keys;
+ };
+
+ Handles = (function () {
+ return {
+ integer: function (elem, name, value) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && Validators.integer(value)) {
+ opt[name] = value;
+ return true;
+ }
+ return false;
+ },
+ bool: function (elem, name, value) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && typeof value === 'boolean') {
+ opt[name] = value;
+ return true;
+ }
+ return false;
+ },
+ array: function (elem, name, value) {
+ if (typeof value === 'string') {
+ value = [value];
+ }
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && $.isArray(value)) {
+ opt[name] = value;
+ return true;
+ }
+ return false;
+ },
+ object: function (elem, name, value) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && value !== null &&
+ typeof value === 'object' && !$.isArray(value)) {
+ opt[name] = value;
+ }
+ },
+ keys: function (elem, name, value) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && $.isArray(value)) {
+ opt[name] = parseKeys(value);
+ }
+ }
+ };
+ }());
+
+ return {
+ position: function (elem, value) {
+ if (Handles.integer(elem, 'position', value)) {
+ var id = Combobox.getId(elem), opt = options[id], optionsCount;
+ optionsCount =
+ elem.find('option:not(.' + pluginClass + ')').length;
+ if (value > optionsCount) {
+ opt.position = optionsCount;
+ }
+ }
+ },
+
+ ignoreOptGroups: function (elem, value) {
+ Handles.bool(elem, 'ignoreOptGroups', value);
+ },
+
+ maxLength: function (elem, value) {
+ if (Handles.integer(elem, 'maxLength', value)) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (value < 0 || value > 255) {
+ opt.maxLength = 255;
+ }
+ }
+ },
+
+ classes: function (elem, value) {
+ Handles.array(elem, 'classes', value);
+ },
+
+ optionClasses: function (elem, value) {
+ Handles.array(elem, 'optionClasses', value);
+ },
+
+ styles: function (elem, value) {
+ Handles.object(elem, 'styles', value);
+ },
+
+ optionStyles: function (elem, value) {
+ Handles.object(elem, 'optionStyles', value);
+ },
+
+ triggerChangeEvent: function (elem, value) {
+ Handles.bool(elem, 'triggerChangeEvent', value);
+ },
+
+ focusOnNewOption: function (elem, value) {
+ Handles.bool(elem, 'focusOnNewOption', value);
+ },
+
+ useExistingOptions: function (elem, value) {
+ Handles.bool(elem, 'useExistingOptions', value);
+ },
+
+ blinkingCursor: function (elem, value) {
+ Handles.bool(elem, 'blinkingCursor', value);
+ },
+
+ blinkingCursorInterval: function (elem, value) {
+ Handles.integer(elem, 'blinkingCursorInterval', value);
+ },
+
+ ignoredKeys: function (elem, value) {
+ Handles.keys(elem, 'ignoredKeys', value);
+ },
+
+ acceptedKeys: function (elem, value) {
+ Handles.keys(elem, 'acceptedKeys', value);
+ }
+ };
+ }());
+
+ Remove = (function () {
+ var removeClasses, removeStyles;
+
+ removeClasses = function (elem, classes) {
+ $.each(classes, function (i, val) {
+ elem.removeClass(val);
+ });
+ };
+
+ removeStyles = function (elem, styles) {
+ $.each(styles, function (key, val) {
+ elem.css(key, '');
+ });
+ };
+
+ return {
+ classes: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ removeClasses(elem, opt.classes);
+ }
+ },
+
+ optionClasses: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ removeClasses(elem.find('option.' + pluginClass),
+ opt.optionClasses);
+ }
+ },
+
+ styles: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ removeStyles(elem, opt.styles);
+ }
+ },
+
+ optionStyles: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ removeStyles(elem.find('option.' + pluginClass),
+ opt.optionStyles);
+ }
+ },
+
+ all: function (elem) {
+ Remove.classes(elem);
+ Remove.optionClasses(elem);
+ Remove.styles(elem);
+ Remove.optionStyles(elem);
+ }
+ };
+ }());
+
+ Handle = (function () {
+ var setClasses, setStyles;
+
+ setClasses = function (elem, classes) {
+ $.each(classes, function (i, val) {
+ elem.addClass(val);
+ });
+ };
+
+ setStyles = function (elem, styles) {
+ $.each(styles, function (key, val) {
+ elem.css(key, val);
+ });
+ };
+
+ return {
+ position: function (elem) {
+ var opt = options[Combobox.getId(elem)], option, uneditableOptions,
+ container;
+ option = elem.find('option.' + pluginClass);
+
+ uneditableOptions = elem.find('option:not(.' + pluginClass + ')');
+ if (opt.position < uneditableOptions.length) {
+ container = uneditableOptions.eq(opt.position);
+
+ if (!opt.ignoreOptGroups &&
+ container.parent('optgroup').length > 0) {
+ uneditableOptions.eq(opt.position).parent().before(option);
+ } else {
+ uneditableOptions.eq(opt.position).before(option);
+ }
+ } else {
+ elem.append(option);
+ }
+ },
+
+ classes: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ setClasses(elem, opt.classes);
+ }
+ },
+
+ optionClasses: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ setClasses(elem.find('option.' + pluginClass),
+ opt.optionClasses);
+ }
+ },
+
+ styles: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ setStyles(elem, opt.styles);
+ }
+ },
+
+ optionStyles: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined) {
+ setStyles(elem.find('option.' + pluginClass),
+ opt.optionStyles);
+ }
+ },
+
+ focusOnNewOption: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && opt.focusOnNewOption) {
+ elem.find('option.' + pluginClass)
+ .prop('selected', true);
+ }
+ },
+
+ useExistingOptions: function (elem) {
+ var id = Combobox.getId(elem), opt = options[id];
+ if (opt !== undefined && opt.useExistingOptions) {
+ Combobox.setEditableOption(elem);
+ }
+ },
+
+ all: function (elem) {
+ Handle.position(elem);
+ Handle.classes(elem);
+ Handle.optionClasses(elem);
+ Handle.styles(elem);
+ Handle.optionStyles(elem);
+ Handle.focusOnNewOption(elem);
+ Handle.useExistingOptions(elem);
+ }
+ };
+ }());
+
+ return {
+ Set: Set,
+ Remove: Remove,
+ Handle: Handle
+ };
+ }());
+
+ EditableOption = (function () {
+ return {
+ init: function (elem) {
+ if (!elem.find('option.' + pluginClass).length) {
+ var editableOption = $('<option>');
+ editableOption.addClass(pluginClass);
+ elem.append(editableOption);
+ }
+
+ elem.on('keydown', EventHandlers.keyDown);
+ elem.on('keypress', EventHandlers.keyPress);
+ elem.on('keyup', EventHandlers.keyUp);
+ elem.on('change', EventHandlers.change);
+ elem.on('focus', EventHandlers.focus);
+ elem.on('blur', EventHandlers.blur);
+ elem.on('click', EventHandlers.click);
+ },
+
+ destroy: function (elem) {
+ elem.find('option.' + pluginClass).remove();
+ elem.off('keydown', EventHandlers.keyDown);
+ elem.off('keypress', EventHandlers.keyPress);
+ elem.off('keyup', EventHandlers.keyUp);
+ elem.off('change', EventHandlers.change);
+ elem.off('focus', EventHandlers.focus);
+ elem.off('blur', EventHandlers.blur);
+ elem.off('click', EventHandlers.click);
+ }
+ };
+ }());
+
+ // generates unique identifier
+ generateId = function () {
+ while (true) {
+ var random = Math.floor(Math.random() * 100000);
+
+ if (options[random] === undefined) {
+ return random;
+ }
+ }
+ };
+
+ // sets combobox
+ setup = function (elem) {
+ EditableOption.init(elem);
+ Parameters.Handle.all(elem);
+ };
+
+ // Combobox public members
+ return {
+ // create editable combobox
+ init: function (settings) {
+ return $(this).filter(':uneditable').each(function () {
+
+ var id = generateId(), elem = $(this);
+
+ elem.data('jecId', id);
+
+ // override passed default options
+ options[id] = $.extend(true, {}, defaults);
+
+ // parse keys
+ Parameters.Set.ignoredKeys(elem, options[id].ignoredKeys);
+ Parameters.Set.acceptedKeys(elem, options[id].acceptedKeys);
+
+ if (typeof settings === 'object' && !$.isArray(settings)) {
+ $.each(settings, function (key, val) {
+ if (val !== undefined) {
+ switch (key) {
+ case 'position':
+ Parameters.Set.position(elem, val);
+ break;
+ case 'ignoreOptGroups':
+ Parameters.Set.ignoreOptGroups(elem, val);
+ break;
+ case 'maxLength':
+ Parameters.Set.maxLength(elem, val);
+ break;
+ case 'classes':
+ Parameters.Set.classes(elem, val);
+ break;
+ case 'optionClasses':
+ Parameters.Set.optionClasses(elem, val);
+ break;
+ case 'styles':
+ Parameters.Set.styles(elem, val);
+ break;
+ case 'optionStyles':
+ Parameters.Set.optionStyles(elem, val);
+ break;
+ case 'triggerChangeEvent':
+ Parameters.Set.triggerChangeEvent(elem, val);
+ break;
+ case 'focusOnNewOption':
+ Parameters.Set.focusOnNewOption(elem, val);
+ break;
+ case 'useExistingOptions':
+ Parameters.Set.useExistingOptions(elem, val);
+ break;
+ case 'blinkingCursor':
+ Parameters.Set.blinkingCursor(elem, val);
+ break;
+ case 'blinkingCursorInterval':
+ Parameters.Set.blinkingCursorInterval(elem, val);
+ break;
+ case 'ignoredKeys':
+ Parameters.Set.ignoredKeys(elem, val);
+ break;
+ case 'acceptedKeys':
+ Parameters.Set.acceptedKeys(elem, val);
+ break;
+ }
+ }
+ });
+ }
+
+ setup($(this));
+ });
+ },
+
+ // creates editable combobox without using existing select elements
+ initJS: function (options, settings) {
+ var select, addOptions;
+
+ select = $('<select>');
+
+ addOptions = function (elem, options) {
+ if ($.isArray(options)) {
+ $.each(options, function (i, val) {
+ if ($.isPlainObject(val)) {
+ $.each(val, function (key, value) {
+ if ($.isArray(value)) {
+ var og = $('<optgroup>').attr('label', key);
+ addOptions(og, value);
+ og.appendTo(select);
+ } else if (typeof value === 'number' ||
+ typeof value === 'string') {
+ $('<option>').text(value).prop('value', key)
+ .appendTo(elem);
+ }
+ });
+ } else if (typeof val === 'string' || typeof val === 'number') {
+ $('<option>').text(val).prop('value', val).appendTo(elem);
+ }
+ });
+ }
+ };
+
+ addOptions(select, options);
+
+ return select.jec(settings);
+ },
+
+ // destroys editable combobox
+ destroy: function () {
+ return $(this).filter(':editable').each(function () {
+ $(this).jecOff();
+ $.removeData($(this).get(0), 'jecId');
+ $.removeData($(this).get(0), 'jecCursorState');
+ $.removeData($(this).get(0), 'jecOpenedState');
+ });
+ },
+
+ // enable editablecombobox
+ enable: function () {
+ return $(this).filter(':editable').each(function () {
+ var id = Combobox.getId($(this)), value = values[id];
+
+ setup($(this));
+
+ if (value !== undefined) {
+ $(this).jecValue(value);
+ }
+ });
+ },
+
+ // disable editable combobox
+ disable: function () {
+ return $(this).filter(':editable').each(function () {
+ var val = $(this).find('option.' + pluginClass).val();
+ values[Combobox.getId($(this))] = val;
+ Parameters.Remove.all($(this));
+ EditableOption.destroy($(this));
+ });
+ },
+
+ // gets or sets editable option's value
+ value: function (value, setFocus) {
+ if ($(this).filter(':editable').length > 0) {
+ if (value === null || value === undefined) {
+ // get value
+ return $(this).find('option.' + pluginClass).val();
+ } else if (typeof value === 'string' || typeof value === 'number') {
+ // set value
+ return $(this).filter(':editable').each(function () {
+ var option = $(this).find('option.' + pluginClass);
+ option.val(value).text(value);
+ if (typeof setFocus !== 'boolean' || setFocus) {
+ option.prop('selected', true);
+ }
+ });
+ }
+ }
+ },
+
+ // gets or sets editable option's preference
+ pref: function (name, value) {
+ if ($(this).filter(':editable').length > 0) {
+ if (typeof name === 'string') {
+ if (value === null || value === undefined) {
+ // get preference
+ return options[Combobox.getId($(this))][name];
+ } else {
+ // set preference
+ return $(this).filter(':editable').each(function () {
+ switch (name) {
+ case 'position':
+ Parameters.Set.position($(this), value);
+ Parameters.Handle.position($(this));
+ break;
+ case 'classes':
+ Parameters.Remove.classes($(this));
+ Parameters.Set.classes($(this), value);
+ Parameters.Handle.position($(this));
+ break;
+ case 'optionClasses':
+ Parameters.Remove.optionClasses($(this));
+ Parameters.Set.optionClasses($(this), value);
+ Parameters.Set.optionClasses($(this));
+ break;
+ case 'styles':
+ Parameters.Remove.styles($(this));
+ Parameters.Set.styles($(this), value);
+ Parameters.Set.styles($(this));
+ break;
+ case 'optionStyles':
+ Parameters.Remove.optionStyles($(this));
+ Parameters.Set.optionStyles($(this), value);
+ Parameters.Handle.optionStyles($(this));
+ break;
+ case 'focusOnNewOption':
+ Parameters.Set.focusOnNewOption($(this), value);
+ Parameters.Handle.focusOnNewOption($(this));
+ break;
+ case 'useExistingOptions':
+ Parameters.Set.useExistingOptions($(this), value);
+ Parameters.Handle.useExistingOptions($(this));
+ break;
+ case 'blinkingCursor':
+ Parameters.Set.blinkingCursor($(this), value);
+ break;
+ case 'blinkingCursorInterval':
+ Parameters.Set.blinkingCursorInterval($(this), value);
+ break;
+ case 'ignoredKeys':
+ Parameters.Set.ignoredKeys($(this), value);
+ break;
+ case 'acceptedKeys':
+ Parameters.Set.acceptedKeys($(this), value);
+ break;
+ }
+ });
+ }
+ }
+ }
+ },
+
+ // sets editable option to the value of currently selected option
+ setEditableOption: function (elem) {
+ var value = elem.find('option:selected').text();
+ elem.find('option.' + pluginClass).prop('value', elem.val())
+ .text(value).prop('selected', true);
+ },
+
+ // get combobox id
+ getId: function (elem) {
+ return elem.data('jecId');
+ },
+
+ valueIsEditable: function (elem) {
+ return elem.find('option.' + pluginClass).get(0) ===
+ elem.find('option:selected').get(0);
+ },
+
+ clearCursor: function (elem) {
+ $(elem).find('option.' + cursorClass).each(function () {
+ var text = $(this).text();
+ $(this).removeClass(cursorClass).text(text.substring(0, text.length - 1));
+ });
+ },
+
+ cursorState: function (elem, state) {
+ return elem.data('jecCursorState', state);
+ },
+
+ openedState: function (elem, state) {
+ return elem.data('jecOpenedState', state);
+ },
+
+ //handles editable cursor
+ handleCursor: function () {
+ if (activeCombobox !== undefined && activeCombobox !== null) {
+ if ($.browser.msie && Combobox.openedState(activeCombobox)) {
+ return;
+ }
+
+ var state = Combobox.cursorState(activeCombobox), elem;
+ if (state) {
+ Combobox.clearCursor(activeCombobox);
+ } else if (Combobox.valueIsEditable(activeCombobox)) {
+ elem = activeCombobox.find('option:selected');
+ elem.addClass(cursorClass).text(elem.text() + '|');
+ }
+ Combobox.cursorState(activeCombobox, !state);
+ }
+ }
+ };
+ }());
+
+ // jEC public members
+ return {
+ init: Combobox.init,
+ enable: Combobox.enable,
+ disable: Combobox.disable,
+ destroy: Combobox.destroy,
+ value: Combobox.value,
+ pref: Combobox.pref,
+ initJS: Combobox.initJS,
+ handleCursor: Combobox.handleCursor
+ };
+ }());
+
+ // register functions
+ $.fn.extend({
+ jec: $.jEC.init,
+ jecOn: $.jEC.enable,
+ jecOff: $.jEC.disable,
+ jecKill: $.jEC.destroy,
+ jecValue: $.jEC.value,
+ jecPref: $.jEC.pref
+ });
+
+ $.extend({
+ jec: $.jEC.initJS
+ });
+
+ // register selectors
+ $.extend($.expr[':'], {
+ editable: function (a) {
+ var data = $(a).data('jecId');
+ return data !== null && data !== undefined;
+ },
+
+ uneditable: function (a) {
+ var data = $(a).data('jecId');
+ return data === null || data === undefined;
+ }
+ });
+
}(jQuery)); \ No newline at end of file
diff --git a/js/jquery.scrollTo-min.js b/js/jquery.scrollTo-min.js
index 73a3341..5e78778 100644
--- a/js/jquery.scrollTo-min.js
+++ b/js/jquery.scrollTo-min.js
@@ -1,11 +1,11 @@
-/**
- * jQuery.ScrollTo - Easy element scrolling using jQuery.
- * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
- * Dual licensed under MIT and GPL.
- * Date: 5/25/2009
- * @author Ariel Flesler
- * @version 1.4.2
- *
- * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
- */
+/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Dual licensed under MIT and GPL.
+ * Date: 5/25/2009
+ * @author Ariel Flesler
+ * @version 1.4.2
+ *
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
+ */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); \ No newline at end of file
diff --git a/js/utils.js b/js/utils.js
index 3adfca7..ec49c3a 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -1,1376 +1,1376 @@
-/**
- * @fileOverview Common utilities
- * @author Ian Moore (imoore76 at yahoo dot com)
- * @version $Id: utils.js 599 2015-07-27 10:40:37Z imoore76 $
- * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
- * - unless otherwise noted in fuction
- */
-
-/**
- *
- * Prevent ESC key from stopping background AJAX requests
- *
- */
-$(document).ready(function(){
- $(window).keydown(function(i){if(i.keyCode&&i.keyCode===27){
- i.preventDefault();
- try {
- var flash = RDPWebClient.getFlashById("FlashRDP");
- flash.keyboardSendScancodes('01');
- } catch (e) {
- //alert(e.message);
- }
- }});
- $(document).keydown(function(i){if(i.keyCode&&i.keyCode===27){
- i.preventDefault();
- try {
- var flash = RDPWebClient.getFlashById("FlashRDP");
- flash.keyboardSendScancodes('01');
- } catch (e) {
- //alert(e.message);
- }
- }});
-});
-
-/**
- * Traverse a tree and return matching nodes.
- * @param {Object} tree - tree to traverse
- * @param {String} prop - node property to match
- * @param {Mixed} val - value that node property must match
- * @param {Boolean} all - return all results rather than stopping at first matching node (optional)
- * @param {String} children - search node children in property named by this argument (optional)
- * @return all matched nodes | first matched node | null
- */
-function vboxTraverse(tree,prop,val,all,children) {
- var leafs = new Array();
- for(var a in tree) {
- if(tree[a][prop] == val) {
- if(!all) return tree[a];
- leafs[leafs.length] = tree[a];
- }
- if(children && tree[a][children] && tree[a][children].length) {
- var c = vboxTraverse(tree[a][children],prop,val,all,children);
- if(!all && c) { return c; }
- else if(c && c.length) {
- leafs = leafs.concat(c);
- }
- }
- }
- return (all ? leafs : null);
-}
-
-/**
- * Performs AJAX request, alert()'s returned errors
- *
- * @param {String} fn - AJAX function to call
- * @param {Object} params - params to pass to AJAX call
- * @return {Object} deferred promise
- */
-function vboxAjaxRequest(fn,params,config) {
-
- // Promise for data
- var def = $.Deferred();
-
- // Fatal error previously occurred
- if($('#vboxPane').data('vboxFatalError'))
- return def.reject();
-
- var data = {
- 'fn': fn,
- 'params': params ? params : null,
- 'persist': config && config.persist ? config.persist : null
- };
-
- $.when($.post(vboxEndpointConfig.api, JSON.stringify(data), undefined,"json")
-
- // Run on error
- .fail(function(d,etext,xlr,d2) {
-
- // Fatal error previously occurred
- if($('#vboxPane').data('vboxFatalError')) return null;
-
- if(etext != 'error') {
-
- // Halt on parse errors
- if(etext.search(/parse/i) > -1) {
- $('#vboxPane').data('vboxFatalError',1);
- }
-
- if(window.console && window.console.log)
- window.console.log(etext + ': '+ d.responseText);
-
- vboxAlert({'error':'Ajax error: ' + etext,'details':d.responseText},{'width':'400px'});
-
- } else {
-
- // Check for error HTTP status
- if(d && d.status && (String(d.status).substring(0,1) == '4' || String(d.status).substring(0,1) == '5')) {
- var err = {error:'<div align="center">HTTP error: ' + d.status + ' ' + d.statusText+"</div>",details:''};
- for(var i in d) {
- if(typeof(d[i]) == 'function' || typeof(d[i]) == 'object') continue;
- err.details += i + ': "' + d[i] + '"' + "\n";
- }
- phpVirtualBoxFailure(err);
-
- } else {
- phpVirtualBoxFailure('<div align="center">(General communication failure)');
- }
- }
-
- return null;
-
- // Filter out data and display error messages
- }).pipe(function(d){
-
- // Fatal error previously occurred
- if($('#vboxPane').data('vboxFatalError')) {
- return null;
- }
-
- // Append debug output to console
- if(d && d.messages && window.console && window.console.log) {
- for(var i = 0; i < d.messages.length; i++) {
- window.console.log(d.messages[i]);
- }
- }
-
- if(d.errors.length > 0) {
-
-
- for(var i = 0; i < d.errors.length; i++) {
-
- // Handle fatal and connection errors
- if(d.errors[i].fatal || d.errors[i].connection) {
-
- // Multiple Servers check
- if(d.errors[i].connection && $('#vboxPane').data('vboxConfig') ) {
-
- $('#vboxPane').data('vboxFatalError',1);
- $('#vboxPane').css({'display':'none'});
-
- s='';
- if($('#vboxPane').data('vboxConfig').servers && $('#vboxPane').data('vboxConfig').servers.length) {
- var servers = $('#vboxPane').data('vboxConfig').servers;
- for(var a = 0; a < servers.length; a++) {
- servers[a] = "<a href='?server="+servers[a].name+"'>"+$('<div />').html(servers[a].name).text()+"</a>";
- }
- s = '<div style="display: block">'+trans('Server List','phpVirtualBox')+': '+servers.join(', ')+'</div>';
- }
- if(s) vboxAlert(s);
- vboxAlert(d.errors[i],{'width':'400px'});
- vboxAlert('<p>'+trans('An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.','phpVirtualBox')+'</p>'+s,{'width':'50%'});
-
-
-
- // Ignore connection errors until we have config data unless this was a login attempt
- } else if(!d.errors[i].connection || fn == 'login') {
-
- // If we have config data, and the error is fatal, halt processing
- if(d.errors[i].fatal && $('#vboxPane').data('vboxConfig')) {
- $('#vboxPane').data('vboxFatalError',1);
- $('#vboxPane').css({'display':'none'});
- }
-
- vboxAlert(d.errors[i],{'width':'400px'});
-
- }
-
- } else {
-
- // Error from normal request
- vboxAlert(d.errors[i],{'width':'400px'});
- }
-
- } // </ foreach error >
-
- } // </ if errors.length >
-
- return (d && d.data ? d.data : null);
-
- })
- ).done(function(d) {
- if(d) def.resolve(d);
- else def.reject();
- }).fail(function(){
- def.reject();
- });
-
- return def.promise();
-}
-
-/**
- * Return VRDE host address of VM
- * @param {Object} vm - virtual machine object
- * @return {String} VRDE host for VM
- */
-function vboxGetVRDEHost(vm) {
- var chost = ($('#vboxPane').data('vboxConfig').consoleHost ? $('#vboxPane').data('vboxConfig').consoleHost : (vm && vm.VRDEServer && vm.VRDEServer.netAddress ? vm.VRDEServer.netAddress : null));
- if(!chost) {
- // Set to host
- chost = $('#vboxPane').data('vboxConfig').host;
- // Check for localhost / 127.0.0.1
- if(!chost || chost == 'localhost' || chost == '127.0.0.1')
- chost = location.hostname;
- }
- return chost;
-}
-
-/**
- * Return the correct icon string relative to images/vbox/ for the guest OS type
- * @param {String} osTypeId - guest OS type id
- * @return {String} icon file name
- */
-function vboxGuestOSTypeIcon(osTypeId) {
-
- var strIcon = "os_other.png";
- switch (osTypeId)
- {
- case "Other": strIcon = "os_other.png"; break;
- case "DOS": strIcon = "os_dos.png"; break;
- case "Netware": strIcon = "os_netware.png"; break;
- case "L4": strIcon = "os_l4.png"; break;
- case "Windows31": strIcon = "os_win31.png"; break;
- case "Windows95": strIcon = "os_win95.png"; break;
- case "Windows98": strIcon = "os_win98.png"; break;
- case "WindowsMe": strIcon = "os_winme.png"; break;
- case "WindowsNT4": strIcon = "os_winnt4.png"; break;
- case "Windows2000": strIcon = "os_win2k.png"; break;
- case "WindowsXP": strIcon = "os_winxp.png"; break;
- case "WindowsXP_64": strIcon = "os_winxp_64.png"; break;
- case "Windows2003": strIcon = "os_win2k3.png"; break;
- case "Windows2003_64": strIcon = "os_win2k3_64.png"; break;
- case "WindowsVista": strIcon = "os_winvista.png"; break;
- case "WindowsVista_64": strIcon = "os_winvista_64.png"; break;
- case "Windows2008": strIcon = "os_win2k8.png"; break;
- case "Windows2008_64": strIcon = "os_win2k8_64.png"; break;
- case "Windows7": strIcon = "os_win7.png"; break;
- case "Windows7_64": strIcon = "os_win7_64.png"; break;
- case "Windows8": strIcon = "os_win8.png"; break;
- case "Windows8_64": strIcon = "os_win8_64.png"; break;
- case "Windows81": strIcon = "os_win81.png"; break;
- case "Windows81_64": strIcon = "os_win81_64.png"; break;
- case "Windows10": strIcon = "os_win10.png"; break
- case "Windows10_64": strIcon = "os_win10.png"; break
- case "WindowsNT": strIcon = "os_win_other.png"; break;
- case "WindowsNT_64": strIcon = "os_win_other_64.png"; break;
- case "Windows2012_64": strIcon = "os_win2k12_64.png"; break;
- case "Windows2016_64": strIcon = "os_win2k16_64.png"; break;
- case "OS2Warp3": strIcon = "os_os2warp3.png"; break;
- case "OS2Warp4": strIcon = "os_os2warp4.png"; break;
- case "OS2Warp45": strIcon = "os_os2warp45.png"; break;
- case "OS2eCS": strIcon = "os_os2ecs.png"; break;
- case "OS2": strIcon = "os_os2_other.png"; break;
- case "Linux_64": strIcon = "os_linux_64.png"; break;
- case "Linux": strIcon = "os_linux.png"; break;
- case "Linux22": strIcon = "os_linux22.png"; break;
- case "Linux24": strIcon = "os_linux24.png"; break;
- case "Linux24_64": strIcon = "os_linux24_64.png"; break;
- case "Linux26": strIcon = "os_linux26.png"; break;
- case "Linux26_64": strIcon = "os_linux26_64.png"; break;
- case "ArchLinux": strIcon = "os_archlinux.png"; break;
- case "ArchLinux_64": strIcon = "os_archlinux_64.png"; break;
- case "Debian": strIcon = "os_debian.png"; break;
- case "Debian_64": strIcon = "os_debian_64.png"; break;
- case "OpenSUSE": strIcon = "os_opensuse.png"; break;
- case "OpenSUSE_64": strIcon = "os_opensuse_64.png"; break;
- case "Fedora": strIcon = "os_fedora.png"; break;
- case "Fedora_64": strIcon = "os_fedora_64.png"; break;
- case "Gentoo": strIcon = "os_gentoo.png"; break;
- case "Gentoo_64": strIcon = "os_gentoo_64.png"; break;
- case "Mandriva": strIcon = "os_mandriva.png"; break;
- case "Mandriva_64": strIcon = "os_mandriva_64.png"; break;
- case "RedHat": strIcon = "os_redhat.png"; break;
- case "RedHat_64": strIcon = "os_redhat_64.png"; break;
- case "Turbolinux": strIcon = "os_turbolinux.png"; break;
- case "Turbolinux_64": strIcon = "os_turbolinux_64.png"; break;
- case "Ubuntu": strIcon = "os_ubuntu.png"; break;
- case "Ubuntu_64": strIcon = "os_ubuntu_64.png"; break;
- case "Xandros": strIcon = "os_xandros.png"; break;
- case "Xandros_64": strIcon = "os_xandros_64.png"; break;
- case "FreeBSD": strIcon = "os_freebsd.png"; break;
- case "FreeBSD_64": strIcon = "os_freebsd_64.png"; break;
- case "OpenBSD": strIcon = "os_openbsd.png"; break;
- case "OpenBSD_64": strIcon = "os_openbsd_64.png"; break;
- case "NetBSD": strIcon = "os_netbsd.png"; break;
- case "NetBSD_64": strIcon = "os_netbsd_64.png"; break;
- case "Solaris": strIcon = "os_solaris.png"; break;
- case "Solaris_64": strIcon = "os_solaris_64.png"; break;
- case "Solaris11_64": strIcon = "os_oraclesolaris_64.png"; break;
- case "OpenSolaris": strIcon = "os_oraclesolaris.png"; break;
- case "OpenSolaris_64": strIcon = "os_oraclesolaris_64.png"; break;
- case "QNX": strIcon = "os_qnx.png"; break;
- case "MacOS106": strIcon = "os_macosx.png"; break;
- case 'MacOS': strIcon = "os_macosx.png"; break;
- case "MacOS106_64": strIcon = "os_macosx_64.png"; break;
- case 'MacOS_64': strIcon = "os_macosx_64.png"; break;
- case 'Oracle': strIcon = "os_oracle.png"; break;
- case 'Oracle_64': strIcon = "os_oracle_64.png"; break;
- case 'JRockitVE': strIcon = 'os_jrockitve.png'; break;
- case "VirtualBox_Host": strIcon = "os_virtualbox.png"; break;
-
- default:
- break;
- }
- return strIcon;
-}
-
-/**
- * Return the correct icon relative to images/vbox/ for the VM state.
- * @param {String} state - virtual machine state
- * @return {String} icon file name
- */
-function vboxMachineStateIcon(state)
-{
- var strIcon = "state_powered_off_16px.png";
- var strNoIcon = "state_running_16px.png";
-
- switch (state)
- {
- case "PoweredOff": strIcon = "state_powered_off_16px.png"; break;
- case "Saved": strIcon = "state_saved_16px.png"; break;
- case "Saving": strIcon = "state_saving_16px.png"; break;
- case "Snapshotting": strIcon = "snapshot_offline_16px.png"; break;
- case "LiveSnapshotting": strIcon = "snapshot_online_16px.png"; break;
- case "Aborted": strIcon = "state_aborted_16px.png"; break;
- case "Running": strIcon = "state_running_16px.png"; break;
- case "Paused": strIcon = "state_paused_16px.png"; break;
- case "Stuck": strIcon = "state_stuck_16px.png"; break;
- case "Saving": strIcon = "state_discarding_16px.png"; break;
- case "Restoring": strIcon = "vm_settings_16px.png"; break;
- case "RestoringSnapshot": strIcon = "discard_cur_state_16px.png"; break;
- case "DeletingSnapshot": strIcon = "state_discarding_16px.png"; break;
- case "Hosting" : strIcon = "vm_settings_16px.png"; break;
- case "Inaccessible": strIcon = "state_aborted_16px.png"; break;
- default:
- strIcon = strNoIcon;
- }
-
- return strIcon;
-
-}
-
-/**
- * File or Folder browser dialog
- * @param {String} root - path to initial folder or file
- * @param {Function} fn - callback function to run when OK is clicked on dialog
- * @param {Boolean} foldersonly - only display / allow selection of folders (optional)
- * @param {String} title - title of dialog (optional)
- * @param {String} icon - URL to icon (optional)
- * @param {Boolean} strictFiles - only allow the OK button to be clicked when a file is selected (optional)
- */
-function vboxFileBrowser(root,fn,foldersonly,title,icon,strictFiles) {
-
- var buttons = { };
- buttons[trans('OK','QIMessageBox')] = function(f) {
-
- if(strictFiles && $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().parent().hasClass('directory')) {
- $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().trigger('dblclick');
- return;
- }
-
- if(typeof f != 'string') {
- f = $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().attr('name');
- }
- $('#vboxBrowseFolder').trigger('close').empty().remove();
- fn(f);
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { fn(null); $('#vboxBrowseFolder').trigger('close').empty().remove(); };
-
- var d1 = $('<div />').attr({'id':'vboxBrowseFolder','class':'vboxDialogContent','style':'display:none'});
-
- $('<div />').attr({'id':'vboxBrowseFolderList'}).fileTree({ 'root': (root ? root : '/'),'dirsOnly':foldersonly,'loadMessage':trans('Loading ...','UIVMDesktop'),'scrollTo':'#vboxBrowseFolder'},function(f){
- buttons[trans('OK','QIMessageBox')](f);
- }).appendTo(d1);
-
- $(d1).dialog({'closeOnEscape':true,'width':400,'height':600,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="'+(icon ? icon : 'images/jqueryFileTree/'+(foldersonly ? 'folder_open' : 'file')+'.png') + '" class="vboxDialogTitleIcon" /> ' + (title ? title : trans((foldersonly ? 'Select Folder' : 'Select File')))}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- });
-
-}
-/**
- * Convert megabytes to human readable string
- * @param {Integer} mb - megabytes
- * @return {String} human readable size representation (e.g. 2 GB, 500 MB, etc..)
- */
-function vboxMbytesConvert(mb) {return vboxBytesConvert(parseFloat(mb) * 1024 * 1024);}
-/**
- * Convert bytes to human readable string
- * @param {Integer} bytes - bytes
- * @return {String} human readable size representation (e.g. 2 GB, 500 MB, etc..)
- */
-function vboxBytesConvert(bytes) {
- var ext = new Array('B','KB','MB','GB','TB');
- var unitCount;
- for(unitCount=0; bytes >= 1024 && unitCount < ext.length; unitCount++) bytes = parseFloat(parseFloat(bytes)/1024);
-
- return Math.round(parseFloat(bytes)*Math.pow(10,2))/Math.pow(10,2) + " " + trans(ext[unitCount], 'VBoxGlobal');
-}
-/**
- * Parse str param into megabytes
- * @param {String} str - size string (2 TB, 500 MB, etc..) to parse
- * @return {Integer} megabytes
- */
-function vboxConvertMbytes(str) {
- str = str.replace(' ',' ');
- str = str.split(' ',2);
- if(!str[1]) str[1] = trans('MB','VBoxGlobal');
- var ext = new Array(trans('B','VBoxGlobal'),trans('KB','VBoxGlobal'),trans('MB','VBoxGlobal'),trans('GB','VBoxGlobal'),trans('TB','VBoxGlobal'));
- var index = jQuery.inArray(str[1],ext);
- if(index == -1) index = 2;
- switch(index) {
- case 0:
- return ((str[0] / 1024) / 1024);
- break;
- case 1:
- return (str[0] / 1024);
- break;
- case 3:
- return (str[0] * 1024);
- break;
- case 4:
- return (str[0] * 1024 * 1024);
- break;
- default:
- return (str[0]);
- }
-
-}
-
-
-/**
- * Display alert Dialog
- * @param {String|Object} e - message to display or object containing error message and details
- * @param {Object} xtraOpts - extra options to apply to alert jquery dialog (optional)
- * @see jQuery.dialog()
- */
-function vboxAlert(e,xtraOpts) {
-
- var acknowledged = $.Deferred();
-
- var msg = '';
-
- if(typeof e == 'object') msg = e.error;
- else msg = e;
-
- // Convert to <p>
- if(msg[0] != '<') msg = '<p>'+msg+'</p>';
-
- var div = $('<div />').attr({'class':'vboxDialogContent vboxAlert'}).html('<img src="images/50px-Warning_icon.svg.png" style="float: left; padding: 10px; height: 50px; width: 50px;" height="50" width="50" />'+msg);
-
-
- if(typeof e == 'object' && e.details) {
-
- // Details can contain HTML entities
- e.details = $('<div />').html(e.details).text();
-
- var p = $('<p />').attr({'style':'text-align: center'});
- $('<a />').attr({'href':'#'}).html(trans('Details','QIMessageBox')).click(function(){
- $(this).parent().parent().dialog('option',{'height':400,'position':'center'});
- $(this).parent().siblings(".vboxAlert").css({"display":""});
- $(this).parent().css({'padding':'0px','margin':'0px'});
- $(this).parent().siblings(".vboxAlert").siblings().empty().remove();
- return false;
- }).appendTo(p);
-
- $(div).append(p);
-
- var ddet = $('<div />').attr({'style':'display: none; height: 100%; width: auto;','class':'vboxAlert'});
- $('<textarea />').attr({'spellcheck':'false','wrap':'off','readonly':'true'}).val(e.details).appendTo($('<form />').appendTo(ddet));
- $(div).append(ddet);
- }
-
-
-
- var buttons = { };
- buttons[trans('OK','QIMessageBox')] = function(f) {
- $(this).trigger('close').empty().remove();
- acknowledged.resolve();
- };
-
- var dialogOpts = {'closeOnEscape':false,'width':600,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'};
-
- if(typeof xtraOpts == "object") {
- for(var i in xtraOpts) {
- dialogOpts[i] = xtraOpts[i];
- }
- }
-
- $(div).dialog(dialogOpts);
-
- return acknowledged;
-
-}
-/**
- * Confirmation dialog
- * @param {String} q - question to ask
- * @param {Object} buttons -buttons to display on confirmation dialog
- * @param {String} cancelText - string displayed on Cancel button. Defaults to 'Cancel'
- * @param {Function} onCancel - function to run onCancel
- * @return {HTMLNode}
- * @see jQuery.dialog()
- */
-function vboxConfirm(q,buttons,cancelText,onCancel) {
-
- var div = $('<div />').attr({'class':'vboxDialogContent','style':'display: none; width: 500px;'}).html('<img src="images/50px-Question_icon.svg.png" style="height: 50px; width: 50px; float: left; padding: 10px;" height="50" width="50" />'+q);
-
- if(!cancelText) cancelText = trans('Cancel','QIMessageBox');
-
- buttons[cancelText] = function() { $(this).remove(); if(onCancel) { onCancel(); }};
-
- $(div).dialog({'closeOnEscape':false,'width':500,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
-
- return $(div);
-}
-
-/**
- * Initialize common UI items
- * @param {String|HTMLNode} root - root HTML Node or node ID to initialize
- * @param {String} context - language context to use for translations
- * @see trans()
- */
-function vboxInitDisplay(root,context) {
-
- if(typeof root == 'string')
- root = $('#'+root);
-
- /*
- * Sliders
- */
-
- $(root).find('div.slider').each(function(){
-
- if($(this).hasClass('translateglob')) {
- $(this).closest('table').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'VBoxGlobal');}).removeClass('translate');
- }
- var frm = $(this).data('form');
- if($(this).data('display')) {
- var fn = $(this).data('display');
- $(this).slider('option','slide',function(event,ui){
- document.forms[frm].elements[event.target.id + 'Value'].value = fn(ui.value);
- }).slider('option','change',function(event,ui){
- document.forms[frm].elements[event.target.id + 'Value'].value = fn(ui.value);
- });
- } else {
- $(this).slider('option','slide',function(event,ui){
- document.forms[frm].elements[event.target.id + 'Value'].value = ui.value;
- }).slider('option','change',function(event,ui){
- document.forms[frm].elements[event.target.id + 'Value'].value = ui.value;
- });
- }
-
- // Slider scale (ticks)
- $(this).children("div.sliderScale").each(function(){
-
- var min = $(this).parent().slider('option','min');
- var max = $(this).parent().slider('option','max');
-
- var diff = Math.min((max - min),50);
- var tdw = Math.round(100 / diff);
-
- var tr = $('<tr />');
-
- for(var a = 0; a < diff; a++) {
- $(tr).append($('<td />').attr({'style':'width: '+ tdw + '%'}));
- }
- $('<table />').attr({'class':'sliderScale'}).append(tr).appendTo(this);
-
- });
-
- // save value
- $(this).slider('value',$(this).slider('value'));
-
- // Min / Max labels
- if(!$(this).data('noMinMaxLabels')) {
- var min = $(this).slider('option','min');
- var max = $(this).slider('option','max');
- $(this).closest('table').find('.vboxSliderMin').html(function(i,h){return ' ' + trans(h,context,min,$(this).attr('title')).replace('%1',min);});
- $(this).closest('table').find('.vboxSliderMax').html(function(i,h){return ' ' + trans(h,context,max,$(this).attr('title')).replace('%1',max);});
- }
- });
-
-
- /*
- * Translations
- */
- $(root).find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),context);}).removeClass('translate');
-
- /*
- * Setup Tabs
- */
- $(root).find(".vboxTabbed").tabs();
-
-
- /* Image buttons */
- if(!jQuery.browser.msie) {
-
- $(root).find('input.vboxImgButton').on('mousedown',function(){
-
- var xy = $(this).css('backgroundPosition').split(' ');
-
- if(!$(this).data('startX')) $(this).data('startX', parseInt(xy[0]));
- if(!$(this).data('startY')) $(this).data('startY', parseInt(xy[1]));
-
- $(this).css('backgroundPosition',(parseInt($(this).data('startX'))+1)+'px '+(parseInt($(this).data('startY'))+1)+'px');
-
- var btn = this;
- $(document).one('mouseup',function(){
- $(btn).css('backgroundPosition',$(btn).data('startX')+'px '+$(btn).data('startY')+'px');
- });
-
- });
-
- }
-
- /*
- *
- * Enable / disable sections (Remote Display, Audio, Network Adapters, usb)
- *
- */
-
- $(root).find('input.vboxEnablerCheckbox').on('click', function(e) {
-
- var roottbl = $(this).closest('table');
-
- $(roottbl).find('input:not(.vboxEnablerCheckbox)').prop('disabled',!this.checked);
- $(roottbl).find('select:not(.vboxEnablerIgnore)').prop('disabled',!this.checked);
- (this.checked ? $(roottbl).find('th').removeClass('vboxDisabled') : $(roottbl).find('th:not(.vboxEnablerIgnore)').addClass('vboxDisabled'));
- (this.checked ? $(roottbl).find('.vboxEnablerListen').removeClass('vboxDisabled') : $(roottbl).find('.vboxEnablerListen').addClass('vboxDisabled'));
-
- // Find any enabler / disabler listeners
- $(roottbl).find('.vboxEnablerTrigger').trigger(this.checked ? 'enable' : 'disable');
-
-
- });
-
-
- /*
- * Tooltips
- */
- $(root).find('.vboxToolbarSmallButton').tipped({'source':'title','mode':'hover'});
-
-
- /*
- * File / Folder browsers
- */
- if($('#vboxPane').data('vboxConfig').browserDisable) {
- $(root).find('table td.vboxFileFolderInput input.vboxImgButton').hide();
- }
-
-
-}
-
-/**
- * Color VISIBLE children rows of parent elm
- * @param {HTMLNode} elm - element who's children to color
- * @param {Boolean} startOdd - start on the 2nd child (optional)
- * @param {String} headerClass - if child node has headerClass class, consider it a header and skip coloring (optional)
- */
-function vboxColorRows(elm,startOdd,headerClass) {
- var odd = 0;
- if(startOdd) odd = 1;
- $(elm).children().each(function(i){
- if(headerClass && $(this).hasClass(headerClass)) {
- odd = (startOdd ? 1 : 0);
- return;
- }
- if($(this).css('display') == 'none' || $(this).hasClass('vboxListItemDisabled')) return;
- (odd++ % 2 ? $(this).addClass('vboxOddRow') : $(this).removeClass('vboxOddRow'));
- });
-}
-
-/**
- * Return an HTML div node sized to parent with overflow hidden
- * @param {HTMLNode} p - node to add div to
- * @return {HTMLNode}
- */
-function vboxDivOverflowHidden(p) {
- var w = $(p).innerWidth();
- w -= parseInt($(p).css('padding-right'));
- w -= parseInt($(p).css('padding-left'));
- return $('<div />').css({'width':(w-4)+'px','overflow':'hidden','padding':'0px','margin':'0px','border':'0px'});
-}
-
-
-/**
- * Show progress dialog and periodically poll the progress' status
- *
- * @param {String} prequest - request object passed to ajax
- * @param {Function} callback - function to run on progress completion
- * @param {String} icon - URL of image to display on progress operation dialog (optional)
- * @param {String} title - title of progress operation dialog (optional)
- * @param {String} target - contextual target of progress operation
- * @param {Boolean} blocking - true if progress operation should block other ops
- * @see vboxconnector::progressGet()
- */
-function vboxProgress(prequest,callback,icon,title,target,blocking) {
-
- // Fix title
- title = title.replace('\.+$','');
-
- // Sanitize target
- target = $('<div />').text(target).html();
-
- // Sanitize progress request data
- var persist = prequest.persist;
- prequest = {
- 'progress' : prequest.progress,
- 'catcherrs' : prequest.catcherrs
- };
-
- // Blocking creates a dialog
- if(!blocking) {
-
- vboxProgressCreateListElement(prequest,icon,title,target,callback);
-
- $.when(prequest, vboxAjaxRequest('progressGet',prequest,{'persist':persist})).done(vboxProgressUpdate);
-
- } else {
-
- vboxProgressCreateDialog(prequest,icon,title,target,callback);
-
- $.when(prequest, vboxAjaxRequest('progressGet',prequest,{'persist':persist})).done(vboxProgressUpdateModal);
- }
-
-
-
-}
-
-/**
- * Generate modal progress dialog
- *
- * @param {Object} prequest - progress operation request object
- * @param {String} icon - URL of image to display on progress operation dialog (optional)
- * @param {String} title - title of progress operation dialog (optional)
- * @param {String} target - contextual target of progress operation
- * @param {Function} callback - function to run on progress completion
- * @see vboxconnector::progressGet()
- */
-function vboxProgressCreateDialog(prequest,icon,title,target,callback) {
-
- // Shorthand
- var pid = prequest.progress;
-
- var div = $('<div />').attr({'id':'vboxProgress'+pid,'title':(title ? title : 'phpVirtualBox'),'style':'text-align: center'});
-
- var tbl = $('<table />').css({'width':'100%'});
- var tr = $('<tr />').css({'vertical-align':'middle'});
- var td = $('<td />').css({'padding':'0px','text-align':'left','width':'1px'});
- if(icon) {
- $('<img />').css({'margin':'4px'}).attr({'src':'images/vbox/'+icon,'height':'90','width':'90'}).appendTo(td);
- }
- $(tr).append(td);
-
- var td = $('<td />').css({'text-align':'center','padding':'4px'}).append($('<div />').attr({'id':'vboxProgressBar'+pid,'margin':'4px'}).progressbar({ value: 1 }));
-
- $('<div />').attr({'id':'vboxProgressText'+pid}).html('<img src="images/spinner.gif" />').appendTo(td);
-
- // Cancel button
- $('<div />').attr({'id':'vboxProgressCancel'+pid}).css({'display':'none','padding':'8px'}).append(
-
- $('<input />').attr('type','button').val(trans('Cancel','QIMessageBox')).data({'pid':pid}).click(function(){
- this.disabled = 'disabled';
- vboxAjaxRequest('progressCancel',prequest);
- })
- ).appendTo(td);
-
-
- $(tbl).append($(tr).append(td)).appendTo(div);
-
- // Append placeholder for list element
- $('#vboxProgressOps').prepend($('<div />').addClass('vboxProgressOpElement').css({'display':'none'}).attr({'id':'vboxProgressPlaceholder'+pid}));
-
- $(div).data({
- 'vboxCallback':callback,
- 'vboxIcon' : icon,
- 'vboxTitle' : title,
- 'vboxTarget' : target
- }).dialog({'width':400,'height':'auto','closeOnEscape':false,'modal':true,'resizable':false,'draggable':true,'closeOnEscape':false,'buttons':{}});
-
-
-}
-
-/**
- * Generate progress list element and append it
- *
- * @param {Object} prequest - progress operation request object
- * @param {String} icon - URL of image to display on progress operation dialog (optional)
- * @param {String} title - title of progress operation dialog (optional)
- * @param {String} target - contextual target of progress operation
- * @param {Function} callback - function to run on progress completion
- * @see vboxconnector::progressGet()
- */
-function vboxProgressCreateListElement(prequest,icon,title,target,callback) {
-
- // Shorthand
- var pid = prequest.progress;
-
- var div = $('<div />').attr({'id':'vboxProgress'+pid}).addClass('vboxProgressOpElement');
-
- var divOpTitle = $('<div />').addClass('vboxProgressOpTitle');
-
- if(icon) {
- $('<img />').attr({'src':'images/vbox/'+icon,'height':'16','width':'16'}).appendTo(divOpTitle);
- }
-
- // Title
- if($('#vboxPane').data('vboxConfig').servers.length) {
- title = $('#vboxPane').data('vboxConfig').name + ': ' + title;
- }
-
- $(divOpTitle).append(title + (target ? ' (' + target + ')' : '')).appendTo(div);
-
- // Progress bar
- $('<div />').addClass('vboxProgressBarContainer').append(
- $('<div />').attr({'id':'vboxProgressBar'+pid}).progressbar({ value: 1 })
- ).appendTo(div);
-
- // Progress text
- $('<div />').addClass('vboxProgressOpText').append(
- $('<span />').attr({'id':'vboxProgressText'+pid}).html('<img src="images/spinner.gif" height=12 width=12/>')
- ).appendTo(div);
-
- // Cancel button
- $('<div />').addClass('vboxProgressOpCancel').append(
- $('<input />').attr({'id':'vboxProgressCancel'+pid,'type':'button'}).val(trans('Cancel','UIProgressDialog')).data({'pid':pid})
- .click(function(){
- this.disabled = 'disabled';
- vboxAjaxRequest('progressCancel',prequest);
- })
- .css({'margin':'0px'})
- ).appendTo(div);
-
- $(div).data({'vboxCallback':callback})
-
- if($('#vboxProgressPlaceholder'+pid)[0]) {
- $('#vboxProgressPlaceholder'+pid).replaceWith(div);
- } else {
- $('#vboxProgressOps').prepend(div);
- }
-
-
-}
-
-/**
- * OnUnload warning shown when an operation is in progress
- * @return {String} warning message indicating operation is in progress
- */
-function vboxOpInProgressCheck() {
- if($('#vboxProgressOps').children('div.vboxProgressOpElement:not(.vboxProgressComplete)').addClass('vboxProgressRunning').length) {
- return trans('Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.','phpVirtualBox');
- }
-}
-
-/**
- * Update progress dialog box. Callback run from vboxAjaxRequest
- *
- * @param {Object} prequest - progress operation data passed to ajax call
- * @param {Object} data - data returned from progressGet AJAX call
- */
-function vboxProgressUpdateModal(prequest, data) {
- vboxProgressUpdate(prequest,data,true);
-}
-
-/**
- * Update progress dialog box or progress list row with % completed
- *
- * @param {Object} prequest - progress operation data passed to ajax call
- * @param {Object} d - data returned from progressGet AJAX call
- * @param {Boolean} modal - true if updating modal dialog
- * @see vboxconnector::progressGet()
- */
-function vboxProgressUpdate(prequest,d,modal) {
-
- // Shorthand
- var pid = prequest.progress;
-
- // check for completed progress
- if(!d || !d.responseData || !d.responseData['progress'] || !d.responseData['info'] || d.responseData['info']['completed'] || d.responseData['info']['canceled']) {
-
- if(d && d.responseData['info'] && d.responseData['info']['canceled'])
- vboxAlert(trans('Operation Canceled','phpVirtualBox'),{'width':'300px','height':'auto'});
-
- var callback = $("#vboxProgress"+pid).data('vboxCallback');
-
- $("#vboxProgressBar"+pid).progressbar({ value: 100 });
-
- if(modal) {
-
- var icon = $("#vboxProgress"+pid).data('vboxIcon');
- var title = $("#vboxProgress"+pid).data('vboxTitle');
- var target = $("#vboxProgress"+pid).data('vboxTarget');
-
- $("#vboxProgress"+pid).empty().remove();
-
- if(callback) callback(d);
-
- // Now append to list
- vboxProgressCreateListElement(prequest,icon,title,target);
- vboxProgressUpdate(prequest);
-
- } else {
-
- var sdate = new Date();
- $("#vboxProgressText"+pid).html(sdate.toLocaleString());
- $('#vboxProgressCancel'+pid).remove();
-
- if(callback) callback(d);
- }
-
- $("#vboxProgress"+pid).addClass('vboxProgressComplete').removeClass('vboxProgressRunning');
-
- // Remove data
- $("#vboxProgress"+pid).removeData([
- 'vboxCallback',
- 'vboxIcon',
- 'vboxTitle',
- 'vboxTarget'
- ]);
-
- // Check for max elements
- if($('#vboxPane').data('vboxConfig').maxProgressList) {
- var maxList = $('#vboxPane').data('vboxConfig').maxProgressList;
- try {
- maxList = Math.max(2,parseInt(maxList));
- } catch (e) {
- maxList = 5;
- }
- if(maxList > 0) $('#vboxProgressOps').children('div.vboxProgressComplete').slice(maxList).remove();
-
- }
-
- return;
- }
-
- // update percent
- $("#vboxProgressBar"+pid).progressbar({ value: d.responseData.info.percent });
- $("#vboxProgressText"+pid).html(d.responseData.info.percent+'%'+(modal ? '<br />' : ' ') + d.responseData.info.operationDescription);
-
- // Cancelable?
- if(d.responseData.info.cancelable) {
- $('#vboxProgressCancel'+pid).show();
- }
-
- // Get request
- var def = $.Deferred();
- def.done(function(){
-
- $.when(prequest, vboxAjaxRequest('progressGet', prequest, {'persist': d.persist}))
- .done((modal ? vboxProgressUpdateModal : vboxProgressUpdate));
-
- });
- window.setTimeout(def.resolve, 2000);
-
-}
-
-/**
- * Position element to mouse event
- * @param {HTMLNode} elm - HTML node to position
- * @param {Event} e - Event to position to
- */
-function vboxPositionEvent(elm,e) {
-
- var d = {};
-
- if( self.innerHeight ) {
- d.pageYOffset = self.pageYOffset;
- d.pageXOffset = self.pageXOffset;
- d.innerHeight = self.innerHeight;
- d.innerWidth = self.innerWidth;
- } else if( document.documentElement &&
- document.documentElement.clientHeight ) {
- d.pageYOffset = document.documentElement.scrollTop;
- d.pageXOffset = document.documentElement.scrollLeft;
- d.innerHeight = document.documentElement.clientHeight;
- d.innerWidth = document.documentElement.clientWidth;
- } else if( document.body ) {
- d.pageYOffset = document.body.scrollTop;
- d.pageXOffset = document.body.scrollLeft;
- d.innerHeight = document.body.clientHeight;
- d.innerWidth = document.body.clientWidth;
- }
-
- $(elm).css({'left':0,'top':0});
-
- (e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
- (e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
-
- //adjust to ensure element is inside viewable screen
- var right = x + $(elm).outerWidth();
- var bottom = y + $(elm).outerHeight();
-
- var windowWidth = $(window).width() + $(window).scrollLeft()-5;
- var windowHeight = $(window).height() + $(window).scrollTop()-5;
-
- x = (right > windowWidth) ? x - (right - windowWidth) : x;
- y = (bottom > windowHeight) ? y - (bottom - windowHeight) : y;
-
- $(elm).css({ top: y, left: x });
-}
-
-/**
- * Position element inside visible window
- * @param {HTMLNode} elm - element
- */
-function vboxPositionToWindow(elm) {
-
- var offset = $(elm).offset();
- var x = offset.left;
- var y = offset.top;
-
- //adjust to ensure menu is inside viewable screen
- var right = x + $(elm).outerWidth();
- var bottom = y + $(elm).outerHeight();
-
- var windowWidth = $(window).width() + $(window).scrollLeft();
- var windowHeight = $(window).height() + $(window).scrollTop();
-
- x = (right > windowWidth) ? x - (right - windowWidth) : x;
- y = (bottom > windowHeight) ? y - (bottom - windowHeight) : y;
-
- $(elm).css({'top':y,'left':x});
-
-}
-
-/*
- * keycode input validation functions
- */
-/**
- * Return true if k param is a number
- * @param {Integer} k - keycode
- * @return {Boolean}
- */
-function vboxValidateNum(k) {
- return ((k >= 96 && k <= 105)||(k >= 48 && k <= 57));
-}
-/**
- * Return true if k param is a number or '.'
- * @param {Integer} k - keycode
- * @return {Boolean}
- */
-function vboxValidateIP(k) {
- return (vboxValidateNum(k) || k == 190 || k == 110 || k == 59 || k==78);
-}
-/**
- * Return true if k param is a valid control code (shift, backspace, etc..)
- * @param {Integer} k - keycode
- * @return {Boolean}
- */
-function vboxValidateCtrl(k) {
- switch(k) {
- case 8: // backspace
- case 37: // left | right
- case 39:
- case 27: // esc
- case 16: // shift
- case 17: // ctrl
- case 35: // end
- case 36: // home
- case 46: // del
- case 144: // numlock
- case 20: // capslock
- case 18: // alt
- return true;
- }
- return false;
-}
-
-/** Parse Cookies and populate $('#vboxPane').data('vboxCookies') */
-function vboxParseCookies() {
- if($('#vboxPane').data('vboxCookiesParsed')) return;
- var cookies = {};
- var c = document.cookie.split('; ');
- for(var i = 0; i < c.length; i++) {
- var nv = c[i].split('=');
- cookies[nv[0]] = nv[1];
- }
- $('#vboxPane').data('vboxCookies', cookies);
- $('#vboxPane').data('vboxCookiesParsed',true);
-}
-
-/**
- * General application failure
- * @param {String|Object} msg - Optional extra message appended to error
- * or error object passed to vboxAlert
- */
-function phpVirtualBoxFailure(msg) {
- if($('#vboxPane').data('vboxFatalError')) return;
- $('#vboxPane').data('vboxFatalError', 1);
- $('#vboxPane').css({'display':'none'});
- $('#vboxPane').trigger('phpVirtualBoxFailure');
- if(typeof(msg) == 'string') {
- vboxAlert(trans('There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.<p>The list of virtual machines will not begin auto-refreshing again until this page is reloaded.</p>','phpVirtualBox')+(msg ? msg : ''));
- } else {
- msg.error = trans('There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.<p>The list of virtual machines will not begin auto-refreshing again until this page is reloaded.</p>','phpVirtualBox') + msg.error;
- vboxAlert(msg);
- }
-}
-
-/**
- * Set a cookie and update $('#vboxPane').data('vboxCookies')
- * @param {String} k - cookie key
- * @param {any} v - cookie value
- * @param {Date} expire - when cookie should expire
- */
-function vboxSetCookie(k,v,expire) {
- var exp = (v ? (expire ? expire : new Date(2020,12,24)) : new Date().setDate(new Date().getDate() - 1));
- document.cookie = k+"="+v+"; expires="+exp.toGMTString()+"; path=/";
- $('#vboxPane').data('vboxCookies')[k] = v;
-}
-
-/**
- * Set a local data item using the local storage mechanism
- * and upate $('#vboxPane').data('vboxCookies');
- * @param {String} k - data item key
- * @param {any} v - data item value
- * @param {Boolean} nocookies - do not fall back to cookies
- */
-function vboxSetLocalDataItem(k,v,nocookies) {
-
- // fall back to normal cookie
- if(typeof(Storage)==="undefined") {
- if(!nocookies) vboxSetCookie(k,v);
- return;
- }
- // Remove item?
- if(v) {
- localStorage.setItem(k,v.toString());
- } else {
- localStorage.removeItem(k);
- }
-}
-
-/**
- * Get a local data item using the local storage mechanism
- * @param {String} k - data item key
- * @return {mixed} data item value
- */
-function vboxGetLocalDataItem(k) {
-
- // fall back to normal cookie
- if(typeof(Storage)==="undefined") {
- return $('#vboxPane').data('vboxCookies')[k];
- }
- return localStorage.getItem(k);
-
-}
-/**
- * Strip file name from path
- * @param {String} p - path
- * @return {String} path minus file name
- */
-function vboxDirname(p) {
- var pos = p.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
- if(pos > -1) {
- return p.substring(0,pos);
- }
- return p;
-}
-/**
- * Strip dir name from path
- * @param {String} p - path
- * @return {String} file name portion of path
- */
-function vboxBasename(p) {
- var pos = p.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
- if(pos > -1) {
- return p.substring((pos+1));
- }
- return p;
-}
-
-/**
- * Return a time or date+time string depending on
- * how much time has elapsed
- * @param {Integer} t - seconds since 1/1/1970 0:0:0
- * @param {String} replaceTime - optional string to return replacing time
- * @param {String} replaceDateTime - optional string to return replace date_time
- * @return {String} time or date+time string
- */
-function vboxDateTimeString(t, replaceTime, replaceDateTime) {
-
- var sdate = new Date(t*1000);
- if((new Date().getTime() - sdate.getTime())/1000 > 86400
- || new Date().getDate() != sdate.getDate()) {
- return (replaceDateTime ? replaceDateTime.replace('%1',sdate.toLocaleString()) : sdate.toLocaleString());
- }
- return (replaceTime ? replaceTime.replace('%1',sdate.toLocaleTimeString()) : sdate.toLocaleTimeString());
-}
-
-/**
- * Calculate scrollbar width
- * @return {Integer} width of scrollbar
- *
- * http://www.alexandre-gomes.com/?p=115
- *
- */
-var getScrollbarWidth = function() {
-
- var inner = document.createElement('p');
- inner.style.width = "100%";
- inner.style.height = "200px";
-
- var outer = document.createElement('div');
- outer.style.position = "absolute";
- outer.style.top = "0px";
- outer.style.left = "0px";
- outer.style.visibility = "hidden";
- outer.style.width = "200px";
- outer.style.height = "150px";
- outer.style.overflow = "hidden";
- outer.appendChild (inner);
-
- document.body.appendChild (outer);
- var w1 = inner.offsetWidth;
- outer.style.overflow = 'scroll';
- var w2 = inner.offsetWidth;
- if (w1 == w2) w2 = outer.clientWidth;
-
- document.body.removeChild (outer);
-
- return (w1 - w2);
-
-};
-
-/**
- * Returns the result of case-insensitive string comparison using 'natural' algorithm comparing str1 to str2
- * @param {String} str1 - 1st string
- * @param {String} str2 - 2nd string
- * @return {Integer} integer for use in list sorting comparison
- */
-function strnatcasecmp(str1, str2) {
- // Returns the result of case-insensitive string comparison using 'natural' algorithm
- //
- // version: 1004.2314
- // discuss at: http://phpjs.org/functions/strnatcasecmp // + original by: Martin Pool
- // + reimplemented by: Pierre-Luc Paour
- // + reimplemented by: Kristof Coomans (SCK-CEN (Belgian Nucleair Research Centre))
- // + reimplemented by: Brett Zamir (http://brett-zamir.me)
- // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: strnatcasecmp(10, 1);
- // * returns 1: 1
- // * example 1: strnatcasecmp('1', '10');
- // * returns 1: -1
- var a = (str1+'').toLowerCase(); var b = (str2+'').toLowerCase();
-
- var isWhitespaceChar = function (a) {
- return a.charCodeAt(0) <= 32;
- };
- var isDigitChar = function (a) {
- var charCode = a.charCodeAt(0);
- return ( charCode >= 48 && charCode <= 57 );
- };
- var compareRight = function (a,b) {
- var bias = 0;
- var ia = 0;
- var ib = 0;
- var ca;
- var cb;
-
- // The longest run of digits wins. That aside, the greatest // value wins, but we can't know that it will until we've scanned
- // both numbers to know that they have the same magnitude, so we
- // remember it in BIAS.
- for (;; ia++, ib++) {
- ca = a.charAt(ia); cb = b.charAt(ib);
-
- if (!isDigitChar(ca) &&
- !isDigitChar(cb)) {
- return bias; } else if (!isDigitChar(ca)) {
- return -1;
- } else if (!isDigitChar(cb)) {
- return +1;
- } else if (ca < cb) { if (bias == 0) {
- bias = -1;
- }
- } else if (ca > cb) {
- if (bias == 0) { bias = +1;
- }
- } else if (ca == 0 && cb == 0) {
- return bias;
- } }
- };
-
- var ia = 0, ib = 0;
- var nza = 0, nzb = 0; var ca, cb;
- var result;
-
- while (true) {
- // only count the number of zeroes leading the last number compared nza = nzb = 0;
-
- ca = a.charAt(ia);
- cb = b.charAt(ib);
- // skip over leading spaces or zeros
- while (isWhitespaceChar( ca ) || ca =='0') {
- if (ca == '0') {
- nza++;
- } else { // only count consecutive zeroes
- nza = 0;
- }
-
- ca = a.charAt(++ia); }
-
- while (isWhitespaceChar( cb ) || cb == '0') {
- if (cb == '0') {
- nzb++; } else {
- // only count consecutive zeroes
- nzb = 0;
- }
- cb = b.charAt(++ib);
- }
-
- // process run of digits
- if (isDigitChar(ca) && isDigitChar(cb)) { if ((result = compareRight(a.substring(ia), b.substring(ib))) != 0) {
- return result;
- }
- }
- if (ca == 0 && cb == 0) {
- // The strings compare the same. Perhaps the caller
- // will want to call strcmp to break the tie.
- return nza - nzb;
- }
- if (ca < cb) {
- return -1;
- } else if (ca > cb) {
- return +1; }
-
- ++ia; ++ib;
- }
-}
-
-/** Filter prototype for older browsers
- * https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
- */
-if (!Array.prototype.filter)
-{
- Array.prototype.filter = function(fun /*, thisp */)
- {
- "use strict";
-
- if (this == null)
- throw new TypeError();
-
- var t = Object(this);
- var len = t.length >>> 0;
- if (typeof fun != "function")
- throw new TypeError();
-
- var res = [];
- var thisp = arguments[1];
- for (var i = 0; i < len; i++)
- {
- if (i in t)
- {
- var val = t[i]; // in case fun mutates this
- if (fun.call(thisp, val, i, t))
- res.push(val);
- }
- }
-
- return res;
- };
-}
-
-$(document).ready(function() {
-
- // Don't unload while progress operation is .. in progress
- window.onbeforeunload = vboxOpInProgressCheck;
-
-});
+/**
+ * @fileOverview Common utilities
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: utils.js 599 2015-07-27 10:40:37Z imoore76 $
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * - unless otherwise noted in fuction
+ */
+
+/**
+ *
+ * Prevent ESC key from stopping background AJAX requests
+ *
+ */
+$(document).ready(function(){
+ $(window).keydown(function(i){if(i.keyCode&&i.keyCode===27){
+ i.preventDefault();
+ try {
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ flash.keyboardSendScancodes('01');
+ } catch (e) {
+ //alert(e.message);
+ }
+ }});
+ $(document).keydown(function(i){if(i.keyCode&&i.keyCode===27){
+ i.preventDefault();
+ try {
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ flash.keyboardSendScancodes('01');
+ } catch (e) {
+ //alert(e.message);
+ }
+ }});
+});
+
+/**
+ * Traverse a tree and return matching nodes.
+ * @param {Object} tree - tree to traverse
+ * @param {String} prop - node property to match
+ * @param {Mixed} val - value that node property must match
+ * @param {Boolean} all - return all results rather than stopping at first matching node (optional)
+ * @param {String} children - search node children in property named by this argument (optional)
+ * @return all matched nodes | first matched node | null
+ */
+function vboxTraverse(tree,prop,val,all,children) {
+ var leafs = new Array();
+ for(var a in tree) {
+ if(tree[a][prop] == val) {
+ if(!all) return tree[a];
+ leafs[leafs.length] = tree[a];
+ }
+ if(children && tree[a][children] && tree[a][children].length) {
+ var c = vboxTraverse(tree[a][children],prop,val,all,children);
+ if(!all && c) { return c; }
+ else if(c && c.length) {
+ leafs = leafs.concat(c);
+ }
+ }
+ }
+ return (all ? leafs : null);
+}
+
+/**
+ * Performs AJAX request, alert()'s returned errors
+ *
+ * @param {String} fn - AJAX function to call
+ * @param {Object} params - params to pass to AJAX call
+ * @return {Object} deferred promise
+ */
+function vboxAjaxRequest(fn,params,config) {
+
+ // Promise for data
+ var def = $.Deferred();
+
+ // Fatal error previously occurred
+ if($('#vboxPane').data('vboxFatalError'))
+ return def.reject();
+
+ var data = {
+ 'fn': fn,
+ 'params': params ? params : null,
+ 'persist': config && config.persist ? config.persist : null
+ };
+
+ $.when($.post(vboxEndpointConfig.api, JSON.stringify(data), undefined,"json")
+
+ // Run on error
+ .fail(function(d,etext,xlr,d2) {
+
+ // Fatal error previously occurred
+ if($('#vboxPane').data('vboxFatalError')) return null;
+
+ if(etext != 'error') {
+
+ // Halt on parse errors
+ if(etext.search(/parse/i) > -1) {
+ $('#vboxPane').data('vboxFatalError',1);
+ }
+
+ if(window.console && window.console.log)
+ window.console.log(etext + ': '+ d.responseText);
+
+ vboxAlert({'error':'Ajax error: ' + etext,'details':d.responseText},{'width':'400px'});
+
+ } else {
+
+ // Check for error HTTP status
+ if(d && d.status && (String(d.status).substring(0,1) == '4' || String(d.status).substring(0,1) == '5')) {
+ var err = {error:'<div align="center">HTTP error: ' + d.status + ' ' + d.statusText+"</div>",details:''};
+ for(var i in d) {
+ if(typeof(d[i]) == 'function' || typeof(d[i]) == 'object') continue;
+ err.details += i + ': "' + d[i] + '"' + "\n";
+ }
+ phpVirtualBoxFailure(err);
+
+ } else {
+ phpVirtualBoxFailure('<div align="center">(General communication failure)');
+ }
+ }
+
+ return null;
+
+ // Filter out data and display error messages
+ }).pipe(function(d){
+
+ // Fatal error previously occurred
+ if($('#vboxPane').data('vboxFatalError')) {
+ return null;
+ }
+
+ // Append debug output to console
+ if(d && d.messages && window.console && window.console.log) {
+ for(var i = 0; i < d.messages.length; i++) {
+ window.console.log(d.messages[i]);
+ }
+ }
+
+ if(d.errors.length > 0) {
+
+
+ for(var i = 0; i < d.errors.length; i++) {
+
+ // Handle fatal and connection errors
+ if(d.errors[i].fatal || d.errors[i].connection) {
+
+ // Multiple Servers check
+ if(d.errors[i].connection && $('#vboxPane').data('vboxConfig') ) {
+
+ $('#vboxPane').data('vboxFatalError',1);
+ $('#vboxPane').css({'display':'none'});
+
+ s='';
+ if($('#vboxPane').data('vboxConfig').servers && $('#vboxPane').data('vboxConfig').servers.length) {
+ var servers = $('#vboxPane').data('vboxConfig').servers;
+ for(var a = 0; a < servers.length; a++) {
+ servers[a] = "<a href='?server="+servers[a].name+"'>"+$('<div />').html(servers[a].name).text()+"</a>";
+ }
+ s = '<div style="display: block">'+trans('Server List','phpVirtualBox')+': '+servers.join(', ')+'</div>';
+ }
+ if(s) vboxAlert(s);
+ vboxAlert(d.errors[i],{'width':'400px'});
+ vboxAlert('<p>'+trans('An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.','phpVirtualBox')+'</p>'+s,{'width':'50%'});
+
+
+
+ // Ignore connection errors until we have config data unless this was a login attempt
+ } else if(!d.errors[i].connection || fn == 'login') {
+
+ // If we have config data, and the error is fatal, halt processing
+ if(d.errors[i].fatal && $('#vboxPane').data('vboxConfig')) {
+ $('#vboxPane').data('vboxFatalError',1);
+ $('#vboxPane').css({'display':'none'});
+ }
+
+ vboxAlert(d.errors[i],{'width':'400px'});
+
+ }
+
+ } else {
+
+ // Error from normal request
+ vboxAlert(d.errors[i],{'width':'400px'});
+ }
+
+ } // </ foreach error >
+
+ } // </ if errors.length >
+
+ return (d && d.data ? d.data : null);
+
+ })
+ ).done(function(d) {
+ if(d) def.resolve(d);
+ else def.reject();
+ }).fail(function(){
+ def.reject();
+ });
+
+ return def.promise();
+}
+
+/**
+ * Return VRDE host address of VM
+ * @param {Object} vm - virtual machine object
+ * @return {String} VRDE host for VM
+ */
+function vboxGetVRDEHost(vm) {
+ var chost = ($('#vboxPane').data('vboxConfig').consoleHost ? $('#vboxPane').data('vboxConfig').consoleHost : (vm && vm.VRDEServer && vm.VRDEServer.netAddress ? vm.VRDEServer.netAddress : null));
+ if(!chost) {
+ // Set to host
+ chost = $('#vboxPane').data('vboxConfig').host;
+ // Check for localhost / 127.0.0.1
+ if(!chost || chost == 'localhost' || chost == '127.0.0.1')
+ chost = location.hostname;
+ }
+ return chost;
+}
+
+/**
+ * Return the correct icon string relative to images/vbox/ for the guest OS type
+ * @param {String} osTypeId - guest OS type id
+ * @return {String} icon file name
+ */
+function vboxGuestOSTypeIcon(osTypeId) {
+
+ var strIcon = "os_other.png";
+ switch (osTypeId)
+ {
+ case "Other": strIcon = "os_other.png"; break;
+ case "DOS": strIcon = "os_dos.png"; break;
+ case "Netware": strIcon = "os_netware.png"; break;
+ case "L4": strIcon = "os_l4.png"; break;
+ case "Windows31": strIcon = "os_win31.png"; break;
+ case "Windows95": strIcon = "os_win95.png"; break;
+ case "Windows98": strIcon = "os_win98.png"; break;
+ case "WindowsMe": strIcon = "os_winme.png"; break;
+ case "WindowsNT4": strIcon = "os_winnt4.png"; break;
+ case "Windows2000": strIcon = "os_win2k.png"; break;
+ case "WindowsXP": strIcon = "os_winxp.png"; break;
+ case "WindowsXP_64": strIcon = "os_winxp_64.png"; break;
+ case "Windows2003": strIcon = "os_win2k3.png"; break;
+ case "Windows2003_64": strIcon = "os_win2k3_64.png"; break;
+ case "WindowsVista": strIcon = "os_winvista.png"; break;
+ case "WindowsVista_64": strIcon = "os_winvista_64.png"; break;
+ case "Windows2008": strIcon = "os_win2k8.png"; break;
+ case "Windows2008_64": strIcon = "os_win2k8_64.png"; break;
+ case "Windows7": strIcon = "os_win7.png"; break;
+ case "Windows7_64": strIcon = "os_win7_64.png"; break;
+ case "Windows8": strIcon = "os_win8.png"; break;
+ case "Windows8_64": strIcon = "os_win8_64.png"; break;
+ case "Windows81": strIcon = "os_win81.png"; break;
+ case "Windows81_64": strIcon = "os_win81_64.png"; break;
+ case "Windows10": strIcon = "os_win10.png"; break
+ case "Windows10_64": strIcon = "os_win10.png"; break
+ case "WindowsNT": strIcon = "os_win_other.png"; break;
+ case "WindowsNT_64": strIcon = "os_win_other_64.png"; break;
+ case "Windows2012_64": strIcon = "os_win2k12_64.png"; break;
+ case "Windows2016_64": strIcon = "os_win2k16_64.png"; break;
+ case "OS2Warp3": strIcon = "os_os2warp3.png"; break;
+ case "OS2Warp4": strIcon = "os_os2warp4.png"; break;
+ case "OS2Warp45": strIcon = "os_os2warp45.png"; break;
+ case "OS2eCS": strIcon = "os_os2ecs.png"; break;
+ case "OS2": strIcon = "os_os2_other.png"; break;
+ case "Linux_64": strIcon = "os_linux_64.png"; break;
+ case "Linux": strIcon = "os_linux.png"; break;
+ case "Linux22": strIcon = "os_linux22.png"; break;
+ case "Linux24": strIcon = "os_linux24.png"; break;
+ case "Linux24_64": strIcon = "os_linux24_64.png"; break;
+ case "Linux26": strIcon = "os_linux26.png"; break;
+ case "Linux26_64": strIcon = "os_linux26_64.png"; break;
+ case "ArchLinux": strIcon = "os_archlinux.png"; break;
+ case "ArchLinux_64": strIcon = "os_archlinux_64.png"; break;
+ case "Debian": strIcon = "os_debian.png"; break;
+ case "Debian_64": strIcon = "os_debian_64.png"; break;
+ case "OpenSUSE": strIcon = "os_opensuse.png"; break;
+ case "OpenSUSE_64": strIcon = "os_opensuse_64.png"; break;
+ case "Fedora": strIcon = "os_fedora.png"; break;
+ case "Fedora_64": strIcon = "os_fedora_64.png"; break;
+ case "Gentoo": strIcon = "os_gentoo.png"; break;
+ case "Gentoo_64": strIcon = "os_gentoo_64.png"; break;
+ case "Mandriva": strIcon = "os_mandriva.png"; break;
+ case "Mandriva_64": strIcon = "os_mandriva_64.png"; break;
+ case "RedHat": strIcon = "os_redhat.png"; break;
+ case "RedHat_64": strIcon = "os_redhat_64.png"; break;
+ case "Turbolinux": strIcon = "os_turbolinux.png"; break;
+ case "Turbolinux_64": strIcon = "os_turbolinux_64.png"; break;
+ case "Ubuntu": strIcon = "os_ubuntu.png"; break;
+ case "Ubuntu_64": strIcon = "os_ubuntu_64.png"; break;
+ case "Xandros": strIcon = "os_xandros.png"; break;
+ case "Xandros_64": strIcon = "os_xandros_64.png"; break;
+ case "FreeBSD": strIcon = "os_freebsd.png"; break;
+ case "FreeBSD_64": strIcon = "os_freebsd_64.png"; break;
+ case "OpenBSD": strIcon = "os_openbsd.png"; break;
+ case "OpenBSD_64": strIcon = "os_openbsd_64.png"; break;
+ case "NetBSD": strIcon = "os_netbsd.png"; break;
+ case "NetBSD_64": strIcon = "os_netbsd_64.png"; break;
+ case "Solaris": strIcon = "os_solaris.png"; break;
+ case "Solaris_64": strIcon = "os_solaris_64.png"; break;
+ case "Solaris11_64": strIcon = "os_oraclesolaris_64.png"; break;
+ case "OpenSolaris": strIcon = "os_oraclesolaris.png"; break;
+ case "OpenSolaris_64": strIcon = "os_oraclesolaris_64.png"; break;
+ case "QNX": strIcon = "os_qnx.png"; break;
+ case "MacOS106": strIcon = "os_macosx.png"; break;
+ case 'MacOS': strIcon = "os_macosx.png"; break;
+ case "MacOS106_64": strIcon = "os_macosx_64.png"; break;
+ case 'MacOS_64': strIcon = "os_macosx_64.png"; break;
+ case 'Oracle': strIcon = "os_oracle.png"; break;
+ case 'Oracle_64': strIcon = "os_oracle_64.png"; break;
+ case 'JRockitVE': strIcon = 'os_jrockitve.png'; break;
+ case "VirtualBox_Host": strIcon = "os_virtualbox.png"; break;
+
+ default:
+ break;
+ }
+ return strIcon;
+}
+
+/**
+ * Return the correct icon relative to images/vbox/ for the VM state.
+ * @param {String} state - virtual machine state
+ * @return {String} icon file name
+ */
+function vboxMachineStateIcon(state)
+{
+ var strIcon = "state_powered_off_16px.png";
+ var strNoIcon = "state_running_16px.png";
+
+ switch (state)
+ {
+ case "PoweredOff": strIcon = "state_powered_off_16px.png"; break;
+ case "Saved": strIcon = "state_saved_16px.png"; break;
+ case "Saving": strIcon = "state_saving_16px.png"; break;
+ case "Snapshotting": strIcon = "snapshot_offline_16px.png"; break;
+ case "LiveSnapshotting": strIcon = "snapshot_online_16px.png"; break;
+ case "Aborted": strIcon = "state_aborted_16px.png"; break;
+ case "Running": strIcon = "state_running_16px.png"; break;
+ case "Paused": strIcon = "state_paused_16px.png"; break;
+ case "Stuck": strIcon = "state_stuck_16px.png"; break;
+ case "Saving": strIcon = "state_discarding_16px.png"; break;
+ case "Restoring": strIcon = "vm_settings_16px.png"; break;
+ case "RestoringSnapshot": strIcon = "discard_cur_state_16px.png"; break;
+ case "DeletingSnapshot": strIcon = "state_discarding_16px.png"; break;
+ case "Hosting" : strIcon = "vm_settings_16px.png"; break;
+ case "Inaccessible": strIcon = "state_aborted_16px.png"; break;
+ default:
+ strIcon = strNoIcon;
+ }
+
+ return strIcon;
+
+}
+
+/**
+ * File or Folder browser dialog
+ * @param {String} root - path to initial folder or file
+ * @param {Function} fn - callback function to run when OK is clicked on dialog
+ * @param {Boolean} foldersonly - only display / allow selection of folders (optional)
+ * @param {String} title - title of dialog (optional)
+ * @param {String} icon - URL to icon (optional)
+ * @param {Boolean} strictFiles - only allow the OK button to be clicked when a file is selected (optional)
+ */
+function vboxFileBrowser(root,fn,foldersonly,title,icon,strictFiles) {
+
+ var buttons = { };
+ buttons[trans('OK','QIMessageBox')] = function(f) {
+
+ if(strictFiles && $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().parent().hasClass('directory')) {
+ $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().trigger('dblclick');
+ return;
+ }
+
+ if(typeof f != 'string') {
+ f = $('#vboxBrowseFolderList').find('.vboxListItemSelected').first().attr('name');
+ }
+ $('#vboxBrowseFolder').trigger('close').empty().remove();
+ fn(f);
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { fn(null); $('#vboxBrowseFolder').trigger('close').empty().remove(); };
+
+ var d1 = $('<div />').attr({'id':'vboxBrowseFolder','class':'vboxDialogContent','style':'display:none'});
+
+ $('<div />').attr({'id':'vboxBrowseFolderList'}).fileTree({ 'root': (root ? root : '/'),'dirsOnly':foldersonly,'loadMessage':trans('Loading ...','UIVMDesktop'),'scrollTo':'#vboxBrowseFolder'},function(f){
+ buttons[trans('OK','QIMessageBox')](f);
+ }).appendTo(d1);
+
+ $(d1).dialog({'closeOnEscape':true,'width':400,'height':600,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="'+(icon ? icon : 'images/jqueryFileTree/'+(foldersonly ? 'folder_open' : 'file')+'.png') + '" class="vboxDialogTitleIcon" /> ' + (title ? title : trans((foldersonly ? 'Select Folder' : 'Select File')))}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ });
+
+}
+/**
+ * Convert megabytes to human readable string
+ * @param {Integer} mb - megabytes
+ * @return {String} human readable size representation (e.g. 2 GB, 500 MB, etc..)
+ */
+function vboxMbytesConvert(mb) {return vboxBytesConvert(parseFloat(mb) * 1024 * 1024);}
+/**
+ * Convert bytes to human readable string
+ * @param {Integer} bytes - bytes
+ * @return {String} human readable size representation (e.g. 2 GB, 500 MB, etc..)
+ */
+function vboxBytesConvert(bytes) {
+ var ext = new Array('B','KB','MB','GB','TB');
+ var unitCount;
+ for(unitCount=0; bytes >= 1024 && unitCount < ext.length; unitCount++) bytes = parseFloat(parseFloat(bytes)/1024);
+
+ return Math.round(parseFloat(bytes)*Math.pow(10,2))/Math.pow(10,2) + " " + trans(ext[unitCount], 'VBoxGlobal');
+}
+/**
+ * Parse str param into megabytes
+ * @param {String} str - size string (2 TB, 500 MB, etc..) to parse
+ * @return {Integer} megabytes
+ */
+function vboxConvertMbytes(str) {
+ str = str.replace(' ',' ');
+ str = str.split(' ',2);
+ if(!str[1]) str[1] = trans('MB','VBoxGlobal');
+ var ext = new Array(trans('B','VBoxGlobal'),trans('KB','VBoxGlobal'),trans('MB','VBoxGlobal'),trans('GB','VBoxGlobal'),trans('TB','VBoxGlobal'));
+ var index = jQuery.inArray(str[1],ext);
+ if(index == -1) index = 2;
+ switch(index) {
+ case 0:
+ return ((str[0] / 1024) / 1024);
+ break;
+ case 1:
+ return (str[0] / 1024);
+ break;
+ case 3:
+ return (str[0] * 1024);
+ break;
+ case 4:
+ return (str[0] * 1024 * 1024);
+ break;
+ default:
+ return (str[0]);
+ }
+
+}
+
+
+/**
+ * Display alert Dialog
+ * @param {String|Object} e - message to display or object containing error message and details
+ * @param {Object} xtraOpts - extra options to apply to alert jquery dialog (optional)
+ * @see jQuery.dialog()
+ */
+function vboxAlert(e,xtraOpts) {
+
+ var acknowledged = $.Deferred();
+
+ var msg = '';
+
+ if(typeof e == 'object') msg = e.error;
+ else msg = e;
+
+ // Convert to <p>
+ if(msg[0] != '<') msg = '<p>'+msg+'</p>';
+
+ var div = $('<div />').attr({'class':'vboxDialogContent vboxAlert'}).html('<img src="images/50px-Warning_icon.svg.png" style="float: left; padding: 10px; height: 50px; width: 50px;" height="50" width="50" />'+msg);
+
+
+ if(typeof e == 'object' && e.details) {
+
+ // Details can contain HTML entities
+ e.details = $('<div />').html(e.details).text();
+
+ var p = $('<p />').attr({'style':'text-align: center'});
+ $('<a />').attr({'href':'#'}).html(trans('Details','QIMessageBox')).click(function(){
+ $(this).parent().parent().dialog('option',{'height':400,'position':'center'});
+ $(this).parent().siblings(".vboxAlert").css({"display":""});
+ $(this).parent().css({'padding':'0px','margin':'0px'});
+ $(this).parent().siblings(".vboxAlert").siblings().empty().remove();
+ return false;
+ }).appendTo(p);
+
+ $(div).append(p);
+
+ var ddet = $('<div />').attr({'style':'display: none; height: 100%; width: auto;','class':'vboxAlert'});
+ $('<textarea />').attr({'spellcheck':'false','wrap':'off','readonly':'true'}).val(e.details).appendTo($('<form />').appendTo(ddet));
+ $(div).append(ddet);
+ }
+
+
+
+ var buttons = { };
+ buttons[trans('OK','QIMessageBox')] = function(f) {
+ $(this).trigger('close').empty().remove();
+ acknowledged.resolve();
+ };
+
+ var dialogOpts = {'closeOnEscape':false,'width':600,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'};
+
+ if(typeof xtraOpts == "object") {
+ for(var i in xtraOpts) {
+ dialogOpts[i] = xtraOpts[i];
+ }
+ }
+
+ $(div).dialog(dialogOpts);
+
+ return acknowledged;
+
+}
+/**
+ * Confirmation dialog
+ * @param {String} q - question to ask
+ * @param {Object} buttons -buttons to display on confirmation dialog
+ * @param {String} cancelText - string displayed on Cancel button. Defaults to 'Cancel'
+ * @param {Function} onCancel - function to run onCancel
+ * @return {HTMLNode}
+ * @see jQuery.dialog()
+ */
+function vboxConfirm(q,buttons,cancelText,onCancel) {
+
+ var div = $('<div />').attr({'class':'vboxDialogContent','style':'display: none; width: 500px;'}).html('<img src="images/50px-Question_icon.svg.png" style="height: 50px; width: 50px; float: left; padding: 10px;" height="50" width="50" />'+q);
+
+ if(!cancelText) cancelText = trans('Cancel','QIMessageBox');
+
+ buttons[cancelText] = function() { $(this).remove(); if(onCancel) { onCancel(); }};
+
+ $(div).dialog({'closeOnEscape':false,'width':500,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
+
+ return $(div);
+}
+
+/**
+ * Initialize common UI items
+ * @param {String|HTMLNode} root - root HTML Node or node ID to initialize
+ * @param {String} context - language context to use for translations
+ * @see trans()
+ */
+function vboxInitDisplay(root,context) {
+
+ if(typeof root == 'string')
+ root = $('#'+root);
+
+ /*
+ * Sliders
+ */
+
+ $(root).find('div.slider').each(function(){
+
+ if($(this).hasClass('translateglob')) {
+ $(this).closest('table').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'VBoxGlobal');}).removeClass('translate');
+ }
+ var frm = $(this).data('form');
+ if($(this).data('display')) {
+ var fn = $(this).data('display');
+ $(this).slider('option','slide',function(event,ui){
+ document.forms[frm].elements[event.target.id + 'Value'].value = fn(ui.value);
+ }).slider('option','change',function(event,ui){
+ document.forms[frm].elements[event.target.id + 'Value'].value = fn(ui.value);
+ });
+ } else {
+ $(this).slider('option','slide',function(event,ui){
+ document.forms[frm].elements[event.target.id + 'Value'].value = ui.value;
+ }).slider('option','change',function(event,ui){
+ document.forms[frm].elements[event.target.id + 'Value'].value = ui.value;
+ });
+ }
+
+ // Slider scale (ticks)
+ $(this).children("div.sliderScale").each(function(){
+
+ var min = $(this).parent().slider('option','min');
+ var max = $(this).parent().slider('option','max');
+
+ var diff = Math.min((max - min),50);
+ var tdw = Math.round(100 / diff);
+
+ var tr = $('<tr />');
+
+ for(var a = 0; a < diff; a++) {
+ $(tr).append($('<td />').attr({'style':'width: '+ tdw + '%'}));
+ }
+ $('<table />').attr({'class':'sliderScale'}).append(tr).appendTo(this);
+
+ });
+
+ // save value
+ $(this).slider('value',$(this).slider('value'));
+
+ // Min / Max labels
+ if(!$(this).data('noMinMaxLabels')) {
+ var min = $(this).slider('option','min');
+ var max = $(this).slider('option','max');
+ $(this).closest('table').find('.vboxSliderMin').html(function(i,h){return ' ' + trans(h,context,min,$(this).attr('title')).replace('%1',min);});
+ $(this).closest('table').find('.vboxSliderMax').html(function(i,h){return ' ' + trans(h,context,max,$(this).attr('title')).replace('%1',max);});
+ }
+ });
+
+
+ /*
+ * Translations
+ */
+ $(root).find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),context);}).removeClass('translate');
+
+ /*
+ * Setup Tabs
+ */
+ $(root).find(".vboxTabbed").tabs();
+
+
+ /* Image buttons */
+ if(!jQuery.browser.msie) {
+
+ $(root).find('input.vboxImgButton').on('mousedown',function(){
+
+ var xy = $(this).css('backgroundPosition').split(' ');
+
+ if(!$(this).data('startX')) $(this).data('startX', parseInt(xy[0]));
+ if(!$(this).data('startY')) $(this).data('startY', parseInt(xy[1]));
+
+ $(this).css('backgroundPosition',(parseInt($(this).data('startX'))+1)+'px '+(parseInt($(this).data('startY'))+1)+'px');
+
+ var btn = this;
+ $(document).one('mouseup',function(){
+ $(btn).css('backgroundPosition',$(btn).data('startX')+'px '+$(btn).data('startY')+'px');
+ });
+
+ });
+
+ }
+
+ /*
+ *
+ * Enable / disable sections (Remote Display, Audio, Network Adapters, usb)
+ *
+ */
+
+ $(root).find('input.vboxEnablerCheckbox').on('click', function(e) {
+
+ var roottbl = $(this).closest('table');
+
+ $(roottbl).find('input:not(.vboxEnablerCheckbox)').prop('disabled',!this.checked);
+ $(roottbl).find('select:not(.vboxEnablerIgnore)').prop('disabled',!this.checked);
+ (this.checked ? $(roottbl).find('th').removeClass('vboxDisabled') : $(roottbl).find('th:not(.vboxEnablerIgnore)').addClass('vboxDisabled'));
+ (this.checked ? $(roottbl).find('.vboxEnablerListen').removeClass('vboxDisabled') : $(roottbl).find('.vboxEnablerListen').addClass('vboxDisabled'));
+
+ // Find any enabler / disabler listeners
+ $(roottbl).find('.vboxEnablerTrigger').trigger(this.checked ? 'enable' : 'disable');
+
+
+ });
+
+
+ /*
+ * Tooltips
+ */
+ $(root).find('.vboxToolbarSmallButton').tipped({'source':'title','mode':'hover'});
+
+
+ /*
+ * File / Folder browsers
+ */
+ if($('#vboxPane').data('vboxConfig').browserDisable) {
+ $(root).find('table td.vboxFileFolderInput input.vboxImgButton').hide();
+ }
+
+
+}
+
+/**
+ * Color VISIBLE children rows of parent elm
+ * @param {HTMLNode} elm - element who's children to color
+ * @param {Boolean} startOdd - start on the 2nd child (optional)
+ * @param {String} headerClass - if child node has headerClass class, consider it a header and skip coloring (optional)
+ */
+function vboxColorRows(elm,startOdd,headerClass) {
+ var odd = 0;
+ if(startOdd) odd = 1;
+ $(elm).children().each(function(i){
+ if(headerClass && $(this).hasClass(headerClass)) {
+ odd = (startOdd ? 1 : 0);
+ return;
+ }
+ if($(this).css('display') == 'none' || $(this).hasClass('vboxListItemDisabled')) return;
+ (odd++ % 2 ? $(this).addClass('vboxOddRow') : $(this).removeClass('vboxOddRow'));
+ });
+}
+
+/**
+ * Return an HTML div node sized to parent with overflow hidden
+ * @param {HTMLNode} p - node to add div to
+ * @return {HTMLNode}
+ */
+function vboxDivOverflowHidden(p) {
+ var w = $(p).innerWidth();
+ w -= parseInt($(p).css('padding-right'));
+ w -= parseInt($(p).css('padding-left'));
+ return $('<div />').css({'width':(w-4)+'px','overflow':'hidden','padding':'0px','margin':'0px','border':'0px'});
+}
+
+
+/**
+ * Show progress dialog and periodically poll the progress' status
+ *
+ * @param {String} prequest - request object passed to ajax
+ * @param {Function} callback - function to run on progress completion
+ * @param {String} icon - URL of image to display on progress operation dialog (optional)
+ * @param {String} title - title of progress operation dialog (optional)
+ * @param {String} target - contextual target of progress operation
+ * @param {Boolean} blocking - true if progress operation should block other ops
+ * @see vboxconnector::progressGet()
+ */
+function vboxProgress(prequest,callback,icon,title,target,blocking) {
+
+ // Fix title
+ title = title.replace('\.+$','');
+
+ // Sanitize target
+ target = $('<div />').text(target).html();
+
+ // Sanitize progress request data
+ var persist = prequest.persist;
+ prequest = {
+ 'progress' : prequest.progress,
+ 'catcherrs' : prequest.catcherrs
+ };
+
+ // Blocking creates a dialog
+ if(!blocking) {
+
+ vboxProgressCreateListElement(prequest,icon,title,target,callback);
+
+ $.when(prequest, vboxAjaxRequest('progressGet',prequest,{'persist':persist})).done(vboxProgressUpdate);
+
+ } else {
+
+ vboxProgressCreateDialog(prequest,icon,title,target,callback);
+
+ $.when(prequest, vboxAjaxRequest('progressGet',prequest,{'persist':persist})).done(vboxProgressUpdateModal);
+ }
+
+
+
+}
+
+/**
+ * Generate modal progress dialog
+ *
+ * @param {Object} prequest - progress operation request object
+ * @param {String} icon - URL of image to display on progress operation dialog (optional)
+ * @param {String} title - title of progress operation dialog (optional)
+ * @param {String} target - contextual target of progress operation
+ * @param {Function} callback - function to run on progress completion
+ * @see vboxconnector::progressGet()
+ */
+function vboxProgressCreateDialog(prequest,icon,title,target,callback) {
+
+ // Shorthand
+ var pid = prequest.progress;
+
+ var div = $('<div />').attr({'id':'vboxProgress'+pid,'title':(title ? title : 'phpVirtualBox'),'style':'text-align: center'});
+
+ var tbl = $('<table />').css({'width':'100%'});
+ var tr = $('<tr />').css({'vertical-align':'middle'});
+ var td = $('<td />').css({'padding':'0px','text-align':'left','width':'1px'});
+ if(icon) {
+ $('<img />').css({'margin':'4px'}).attr({'src':'images/vbox/'+icon,'height':'90','width':'90'}).appendTo(td);
+ }
+ $(tr).append(td);
+
+ var td = $('<td />').css({'text-align':'center','padding':'4px'}).append($('<div />').attr({'id':'vboxProgressBar'+pid,'margin':'4px'}).progressbar({ value: 1 }));
+
+ $('<div />').attr({'id':'vboxProgressText'+pid}).html('<img src="images/spinner.gif" />').appendTo(td);
+
+ // Cancel button
+ $('<div />').attr({'id':'vboxProgressCancel'+pid}).css({'display':'none','padding':'8px'}).append(
+
+ $('<input />').attr('type','button').val(trans('Cancel','QIMessageBox')).data({'pid':pid}).click(function(){
+ this.disabled = 'disabled';
+ vboxAjaxRequest('progressCancel',prequest);
+ })
+ ).appendTo(td);
+
+
+ $(tbl).append($(tr).append(td)).appendTo(div);
+
+ // Append placeholder for list element
+ $('#vboxProgressOps').prepend($('<div />').addClass('vboxProgressOpElement').css({'display':'none'}).attr({'id':'vboxProgressPlaceholder'+pid}));
+
+ $(div).data({
+ 'vboxCallback':callback,
+ 'vboxIcon' : icon,
+ 'vboxTitle' : title,
+ 'vboxTarget' : target
+ }).dialog({'width':400,'height':'auto','closeOnEscape':false,'modal':true,'resizable':false,'draggable':true,'closeOnEscape':false,'buttons':{}});
+
+
+}
+
+/**
+ * Generate progress list element and append it
+ *
+ * @param {Object} prequest - progress operation request object
+ * @param {String} icon - URL of image to display on progress operation dialog (optional)
+ * @param {String} title - title of progress operation dialog (optional)
+ * @param {String} target - contextual target of progress operation
+ * @param {Function} callback - function to run on progress completion
+ * @see vboxconnector::progressGet()
+ */
+function vboxProgressCreateListElement(prequest,icon,title,target,callback) {
+
+ // Shorthand
+ var pid = prequest.progress;
+
+ var div = $('<div />').attr({'id':'vboxProgress'+pid}).addClass('vboxProgressOpElement');
+
+ var divOpTitle = $('<div />').addClass('vboxProgressOpTitle');
+
+ if(icon) {
+ $('<img />').attr({'src':'images/vbox/'+icon,'height':'16','width':'16'}).appendTo(divOpTitle);
+ }
+
+ // Title
+ if($('#vboxPane').data('vboxConfig').servers.length) {
+ title = $('#vboxPane').data('vboxConfig').name + ': ' + title;
+ }
+
+ $(divOpTitle).append(title + (target ? ' (' + target + ')' : '')).appendTo(div);
+
+ // Progress bar
+ $('<div />').addClass('vboxProgressBarContainer').append(
+ $('<div />').attr({'id':'vboxProgressBar'+pid}).progressbar({ value: 1 })
+ ).appendTo(div);
+
+ // Progress text
+ $('<div />').addClass('vboxProgressOpText').append(
+ $('<span />').attr({'id':'vboxProgressText'+pid}).html('<img src="images/spinner.gif" height=12 width=12/>')
+ ).appendTo(div);
+
+ // Cancel button
+ $('<div />').addClass('vboxProgressOpCancel').append(
+ $('<input />').attr({'id':'vboxProgressCancel'+pid,'type':'button'}).val(trans('Cancel','UIProgressDialog')).data({'pid':pid})
+ .click(function(){
+ this.disabled = 'disabled';
+ vboxAjaxRequest('progressCancel',prequest);
+ })
+ .css({'margin':'0px'})
+ ).appendTo(div);
+
+ $(div).data({'vboxCallback':callback})
+
+ if($('#vboxProgressPlaceholder'+pid)[0]) {
+ $('#vboxProgressPlaceholder'+pid).replaceWith(div);
+ } else {
+ $('#vboxProgressOps').prepend(div);
+ }
+
+
+}
+
+/**
+ * OnUnload warning shown when an operation is in progress
+ * @return {String} warning message indicating operation is in progress
+ */
+function vboxOpInProgressCheck() {
+ if($('#vboxProgressOps').children('div.vboxProgressOpElement:not(.vboxProgressComplete)').addClass('vboxProgressRunning').length) {
+ return trans('Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.','phpVirtualBox');
+ }
+}
+
+/**
+ * Update progress dialog box. Callback run from vboxAjaxRequest
+ *
+ * @param {Object} prequest - progress operation data passed to ajax call
+ * @param {Object} data - data returned from progressGet AJAX call
+ */
+function vboxProgressUpdateModal(prequest, data) {
+ vboxProgressUpdate(prequest,data,true);
+}
+
+/**
+ * Update progress dialog box or progress list row with % completed
+ *
+ * @param {Object} prequest - progress operation data passed to ajax call
+ * @param {Object} d - data returned from progressGet AJAX call
+ * @param {Boolean} modal - true if updating modal dialog
+ * @see vboxconnector::progressGet()
+ */
+function vboxProgressUpdate(prequest,d,modal) {
+
+ // Shorthand
+ var pid = prequest.progress;
+
+ // check for completed progress
+ if(!d || !d.responseData || !d.responseData['progress'] || !d.responseData['info'] || d.responseData['info']['completed'] || d.responseData['info']['canceled']) {
+
+ if(d && d.responseData['info'] && d.responseData['info']['canceled'])
+ vboxAlert(trans('Operation Canceled','phpVirtualBox'),{'width':'300px','height':'auto'});
+
+ var callback = $("#vboxProgress"+pid).data('vboxCallback');
+
+ $("#vboxProgressBar"+pid).progressbar({ value: 100 });
+
+ if(modal) {
+
+ var icon = $("#vboxProgress"+pid).data('vboxIcon');
+ var title = $("#vboxProgress"+pid).data('vboxTitle');
+ var target = $("#vboxProgress"+pid).data('vboxTarget');
+
+ $("#vboxProgress"+pid).empty().remove();
+
+ if(callback) callback(d);
+
+ // Now append to list
+ vboxProgressCreateListElement(prequest,icon,title,target);
+ vboxProgressUpdate(prequest);
+
+ } else {
+
+ var sdate = new Date();
+ $("#vboxProgressText"+pid).html(sdate.toLocaleString());
+ $('#vboxProgressCancel'+pid).remove();
+
+ if(callback) callback(d);
+ }
+
+ $("#vboxProgress"+pid).addClass('vboxProgressComplete').removeClass('vboxProgressRunning');
+
+ // Remove data
+ $("#vboxProgress"+pid).removeData([
+ 'vboxCallback',
+ 'vboxIcon',
+ 'vboxTitle',
+ 'vboxTarget'
+ ]);
+
+ // Check for max elements
+ if($('#vboxPane').data('vboxConfig').maxProgressList) {
+ var maxList = $('#vboxPane').data('vboxConfig').maxProgressList;
+ try {
+ maxList = Math.max(2,parseInt(maxList));
+ } catch (e) {
+ maxList = 5;
+ }
+ if(maxList > 0) $('#vboxProgressOps').children('div.vboxProgressComplete').slice(maxList).remove();
+
+ }
+
+ return;
+ }
+
+ // update percent
+ $("#vboxProgressBar"+pid).progressbar({ value: d.responseData.info.percent });
+ $("#vboxProgressText"+pid).html(d.responseData.info.percent+'%'+(modal ? '<br />' : ' ') + d.responseData.info.operationDescription);
+
+ // Cancelable?
+ if(d.responseData.info.cancelable) {
+ $('#vboxProgressCancel'+pid).show();
+ }
+
+ // Get request
+ var def = $.Deferred();
+ def.done(function(){
+
+ $.when(prequest, vboxAjaxRequest('progressGet', prequest, {'persist': d.persist}))
+ .done((modal ? vboxProgressUpdateModal : vboxProgressUpdate));
+
+ });
+ window.setTimeout(def.resolve, 2000);
+
+}
+
+/**
+ * Position element to mouse event
+ * @param {HTMLNode} elm - HTML node to position
+ * @param {Event} e - Event to position to
+ */
+function vboxPositionEvent(elm,e) {
+
+ var d = {};
+
+ if( self.innerHeight ) {
+ d.pageYOffset = self.pageYOffset;
+ d.pageXOffset = self.pageXOffset;
+ d.innerHeight = self.innerHeight;
+ d.innerWidth = self.innerWidth;
+ } else if( document.documentElement &&
+ document.documentElement.clientHeight ) {
+ d.pageYOffset = document.documentElement.scrollTop;
+ d.pageXOffset = document.documentElement.scrollLeft;
+ d.innerHeight = document.documentElement.clientHeight;
+ d.innerWidth = document.documentElement.clientWidth;
+ } else if( document.body ) {
+ d.pageYOffset = document.body.scrollTop;
+ d.pageXOffset = document.body.scrollLeft;
+ d.innerHeight = document.body.clientHeight;
+ d.innerWidth = document.body.clientWidth;
+ }
+
+ $(elm).css({'left':0,'top':0});
+
+ (e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
+ (e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
+
+ //adjust to ensure element is inside viewable screen
+ var right = x + $(elm).outerWidth();
+ var bottom = y + $(elm).outerHeight();
+
+ var windowWidth = $(window).width() + $(window).scrollLeft()-5;
+ var windowHeight = $(window).height() + $(window).scrollTop()-5;
+
+ x = (right > windowWidth) ? x - (right - windowWidth) : x;
+ y = (bottom > windowHeight) ? y - (bottom - windowHeight) : y;
+
+ $(elm).css({ top: y, left: x });
+}
+
+/**
+ * Position element inside visible window
+ * @param {HTMLNode} elm - element
+ */
+function vboxPositionToWindow(elm) {
+
+ var offset = $(elm).offset();
+ var x = offset.left;
+ var y = offset.top;
+
+ //adjust to ensure menu is inside viewable screen
+ var right = x + $(elm).outerWidth();
+ var bottom = y + $(elm).outerHeight();
+
+ var windowWidth = $(window).width() + $(window).scrollLeft();
+ var windowHeight = $(window).height() + $(window).scrollTop();
+
+ x = (right > windowWidth) ? x - (right - windowWidth) : x;
+ y = (bottom > windowHeight) ? y - (bottom - windowHeight) : y;
+
+ $(elm).css({'top':y,'left':x});
+
+}
+
+/*
+ * keycode input validation functions
+ */
+/**
+ * Return true if k param is a number
+ * @param {Integer} k - keycode
+ * @return {Boolean}
+ */
+function vboxValidateNum(k) {
+ return ((k >= 96 && k <= 105)||(k >= 48 && k <= 57));
+}
+/**
+ * Return true if k param is a number or '.'
+ * @param {Integer} k - keycode
+ * @return {Boolean}
+ */
+function vboxValidateIP(k) {
+ return (vboxValidateNum(k) || k == 190 || k == 110 || k == 59 || k==78);
+}
+/**
+ * Return true if k param is a valid control code (shift, backspace, etc..)
+ * @param {Integer} k - keycode
+ * @return {Boolean}
+ */
+function vboxValidateCtrl(k) {
+ switch(k) {
+ case 8: // backspace
+ case 37: // left | right
+ case 39:
+ case 27: // esc
+ case 16: // shift
+ case 17: // ctrl
+ case 35: // end
+ case 36: // home
+ case 46: // del
+ case 144: // numlock
+ case 20: // capslock
+ case 18: // alt
+ return true;
+ }
+ return false;
+}
+
+/** Parse Cookies and populate $('#vboxPane').data('vboxCookies') */
+function vboxParseCookies() {
+ if($('#vboxPane').data('vboxCookiesParsed')) return;
+ var cookies = {};
+ var c = document.cookie.split('; ');
+ for(var i = 0; i < c.length; i++) {
+ var nv = c[i].split('=');
+ cookies[nv[0]] = nv[1];
+ }
+ $('#vboxPane').data('vboxCookies', cookies);
+ $('#vboxPane').data('vboxCookiesParsed',true);
+}
+
+/**
+ * General application failure
+ * @param {String|Object} msg - Optional extra message appended to error
+ * or error object passed to vboxAlert
+ */
+function phpVirtualBoxFailure(msg) {
+ if($('#vboxPane').data('vboxFatalError')) return;
+ $('#vboxPane').data('vboxFatalError', 1);
+ $('#vboxPane').css({'display':'none'});
+ $('#vboxPane').trigger('phpVirtualBoxFailure');
+ if(typeof(msg) == 'string') {
+ vboxAlert(trans('There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.<p>The list of virtual machines will not begin auto-refreshing again until this page is reloaded.</p>','phpVirtualBox')+(msg ? msg : ''));
+ } else {
+ msg.error = trans('There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.<p>The list of virtual machines will not begin auto-refreshing again until this page is reloaded.</p>','phpVirtualBox') + msg.error;
+ vboxAlert(msg);
+ }
+}
+
+/**
+ * Set a cookie and update $('#vboxPane').data('vboxCookies')
+ * @param {String} k - cookie key
+ * @param {any} v - cookie value
+ * @param {Date} expire - when cookie should expire
+ */
+function vboxSetCookie(k,v,expire) {
+ var exp = (v ? (expire ? expire : new Date(2020,12,24)) : new Date().setDate(new Date().getDate() - 1));
+ document.cookie = k+"="+v+"; expires="+exp.toGMTString()+"; path=/";
+ $('#vboxPane').data('vboxCookies')[k] = v;
+}
+
+/**
+ * Set a local data item using the local storage mechanism
+ * and upate $('#vboxPane').data('vboxCookies');
+ * @param {String} k - data item key
+ * @param {any} v - data item value
+ * @param {Boolean} nocookies - do not fall back to cookies
+ */
+function vboxSetLocalDataItem(k,v,nocookies) {
+
+ // fall back to normal cookie
+ if(typeof(Storage)==="undefined") {
+ if(!nocookies) vboxSetCookie(k,v);
+ return;
+ }
+ // Remove item?
+ if(v) {
+ localStorage.setItem(k,v.toString());
+ } else {
+ localStorage.removeItem(k);
+ }
+}
+
+/**
+ * Get a local data item using the local storage mechanism
+ * @param {String} k - data item key
+ * @return {mixed} data item value
+ */
+function vboxGetLocalDataItem(k) {
+
+ // fall back to normal cookie
+ if(typeof(Storage)==="undefined") {
+ return $('#vboxPane').data('vboxCookies')[k];
+ }
+ return localStorage.getItem(k);
+
+}
+/**
+ * Strip file name from path
+ * @param {String} p - path
+ * @return {String} path minus file name
+ */
+function vboxDirname(p) {
+ var pos = p.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
+ if(pos > -1) {
+ return p.substring(0,pos);
+ }
+ return p;
+}
+/**
+ * Strip dir name from path
+ * @param {String} p - path
+ * @return {String} file name portion of path
+ */
+function vboxBasename(p) {
+ var pos = p.lastIndexOf($('#vboxPane').data('vboxConfig').DSEP);
+ if(pos > -1) {
+ return p.substring((pos+1));
+ }
+ return p;
+}
+
+/**
+ * Return a time or date+time string depending on
+ * how much time has elapsed
+ * @param {Integer} t - seconds since 1/1/1970 0:0:0
+ * @param {String} replaceTime - optional string to return replacing time
+ * @param {String} replaceDateTime - optional string to return replace date_time
+ * @return {String} time or date+time string
+ */
+function vboxDateTimeString(t, replaceTime, replaceDateTime) {
+
+ var sdate = new Date(t*1000);
+ if((new Date().getTime() - sdate.getTime())/1000 > 86400
+ || new Date().getDate() != sdate.getDate()) {
+ return (replaceDateTime ? replaceDateTime.replace('%1',sdate.toLocaleString()) : sdate.toLocaleString());
+ }
+ return (replaceTime ? replaceTime.replace('%1',sdate.toLocaleTimeString()) : sdate.toLocaleTimeString());
+}
+
+/**
+ * Calculate scrollbar width
+ * @return {Integer} width of scrollbar
+ *
+ * http://www.alexandre-gomes.com/?p=115
+ *
+ */
+var getScrollbarWidth = function() {
+
+ var inner = document.createElement('p');
+ inner.style.width = "100%";
+ inner.style.height = "200px";
+
+ var outer = document.createElement('div');
+ outer.style.position = "absolute";
+ outer.style.top = "0px";
+ outer.style.left = "0px";
+ outer.style.visibility = "hidden";
+ outer.style.width = "200px";
+ outer.style.height = "150px";
+ outer.style.overflow = "hidden";
+ outer.appendChild (inner);
+
+ document.body.appendChild (outer);
+ var w1 = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ var w2 = inner.offsetWidth;
+ if (w1 == w2) w2 = outer.clientWidth;
+
+ document.body.removeChild (outer);
+
+ return (w1 - w2);
+
+};
+
+/**
+ * Returns the result of case-insensitive string comparison using 'natural' algorithm comparing str1 to str2
+ * @param {String} str1 - 1st string
+ * @param {String} str2 - 2nd string
+ * @return {Integer} integer for use in list sorting comparison
+ */
+function strnatcasecmp(str1, str2) {
+ // Returns the result of case-insensitive string comparison using 'natural' algorithm
+ //
+ // version: 1004.2314
+ // discuss at: http://phpjs.org/functions/strnatcasecmp // + original by: Martin Pool
+ // + reimplemented by: Pierre-Luc Paour
+ // + reimplemented by: Kristof Coomans (SCK-CEN (Belgian Nucleair Research Centre))
+ // + reimplemented by: Brett Zamir (http://brett-zamir.me)
+ // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: strnatcasecmp(10, 1);
+ // * returns 1: 1
+ // * example 1: strnatcasecmp('1', '10');
+ // * returns 1: -1
+ var a = (str1+'').toLowerCase(); var b = (str2+'').toLowerCase();
+
+ var isWhitespaceChar = function (a) {
+ return a.charCodeAt(0) <= 32;
+ };
+ var isDigitChar = function (a) {
+ var charCode = a.charCodeAt(0);
+ return ( charCode >= 48 && charCode <= 57 );
+ };
+ var compareRight = function (a,b) {
+ var bias = 0;
+ var ia = 0;
+ var ib = 0;
+ var ca;
+ var cb;
+
+ // The longest run of digits wins. That aside, the greatest // value wins, but we can't know that it will until we've scanned
+ // both numbers to know that they have the same magnitude, so we
+ // remember it in BIAS.
+ for (;; ia++, ib++) {
+ ca = a.charAt(ia); cb = b.charAt(ib);
+
+ if (!isDigitChar(ca) &&
+ !isDigitChar(cb)) {
+ return bias; } else if (!isDigitChar(ca)) {
+ return -1;
+ } else if (!isDigitChar(cb)) {
+ return +1;
+ } else if (ca < cb) { if (bias == 0) {
+ bias = -1;
+ }
+ } else if (ca > cb) {
+ if (bias == 0) { bias = +1;
+ }
+ } else if (ca == 0 && cb == 0) {
+ return bias;
+ } }
+ };
+
+ var ia = 0, ib = 0;
+ var nza = 0, nzb = 0; var ca, cb;
+ var result;
+
+ while (true) {
+ // only count the number of zeroes leading the last number compared nza = nzb = 0;
+
+ ca = a.charAt(ia);
+ cb = b.charAt(ib);
+ // skip over leading spaces or zeros
+ while (isWhitespaceChar( ca ) || ca =='0') {
+ if (ca == '0') {
+ nza++;
+ } else { // only count consecutive zeroes
+ nza = 0;
+ }
+
+ ca = a.charAt(++ia); }
+
+ while (isWhitespaceChar( cb ) || cb == '0') {
+ if (cb == '0') {
+ nzb++; } else {
+ // only count consecutive zeroes
+ nzb = 0;
+ }
+ cb = b.charAt(++ib);
+ }
+
+ // process run of digits
+ if (isDigitChar(ca) && isDigitChar(cb)) { if ((result = compareRight(a.substring(ia), b.substring(ib))) != 0) {
+ return result;
+ }
+ }
+ if (ca == 0 && cb == 0) {
+ // The strings compare the same. Perhaps the caller
+ // will want to call strcmp to break the tie.
+ return nza - nzb;
+ }
+ if (ca < cb) {
+ return -1;
+ } else if (ca > cb) {
+ return +1; }
+
+ ++ia; ++ib;
+ }
+}
+
+/** Filter prototype for older browsers
+ * https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
+ */
+if (!Array.prototype.filter)
+{
+ Array.prototype.filter = function(fun /*, thisp */)
+ {
+ "use strict";
+
+ if (this == null)
+ throw new TypeError();
+
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun != "function")
+ throw new TypeError();
+
+ var res = [];
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++)
+ {
+ if (i in t)
+ {
+ var val = t[i]; // in case fun mutates this
+ if (fun.call(thisp, val, i, t))
+ res.push(val);
+ }
+ }
+
+ return res;
+ };
+}
+
+$(document).ready(function() {
+
+ // Don't unload while progress operation is .. in progress
+ window.onbeforeunload = vboxOpInProgressCheck;
+
+});
diff --git a/languages/cs.xml b/languages/cs.xml
index c2aa60d..5182428 100644
--- a/languages/cs.xml
+++ b/languages/cs.xml
@@ -1,254 +1,254 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Varování: Právě probíhá nějaká operace uvnitř virtualizační platformy VirtualBox. Nezavírejte toto okno, ani neopouštějte tuto stránku – mohlo by to vést k nežádoucím důsledkům. Raději vyčkejte dokončení zmíněné operace.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operace zrušena</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Při komunikaci s komponentou vboxwebsrv došlo k chybě. Podrobnosti ohledně této chyby by měly být zobrazeny v následném dialogovém okně. Příčinu této chyby je třeba napravit (a následně tuto stránku znovu načíst) – jen tak budete opět moci ovládat virtualizační platformu VirtualBox prostřednictvím nadstavby phpVirtualBox.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Nezdařilo se načíst vlastnosti virtuálního stroje. Ověřte, že je spuštěný a jsou v něm nainstalované doplňky pro virtualizační platformu VirtualBox.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Došlo k chybě při získávání seznamu virtuálních strojů z platformy VirtualBox. Ověřte, že je spuštěná komponenta vboxwebsrv a správnost nastavení v souboru config.php.&lt;p&gt;Po napravení příčiny problému tuto stránku znovu načtěte, aby se seznam virtuálních strojů opět automaticky obnovoval.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Seznam serveru</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Konzole</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Načítání…</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Změnit heslo</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Odhlásit – %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Jste přihlášení pod účtem %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Zastavit</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Příručka k virtualizační platformě VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>O aplikaci</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Uložit stav</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Vypnout</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Uživatelské jméno</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Heslo</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Připojování k %1…</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Připojeno k %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Požadovaná velikost (rozlišení) plochy</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Připojit</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Odpojit, ale neukončovat sezení</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Odpojit a ukončit sezení</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Poslat klávesovou zkratku Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Důvod odpojení</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Přesměrování od %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>Tento virtuální stroj není spuštěný nebo není nastaven tak, aby přijímal přístup protokolem RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hostování</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Síťová rozhraní virtuálních strojů</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Připojeno</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Odpojeno</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Každých %1 sekund</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Otevřít v novém okně</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Uživatelé</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Uživatelé</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Správce</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Může spravovat účty ostatních uživatelů</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Přidat uživatele</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Upravit uživatele</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Odebrat uživatele</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Toto uživatelské jméno není možné použít, protože je už přiřazeno jinému uživateli na tomto systému – vymyslete jiné.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Opravdu chcete odebrat uživatele &lt;b&gt;%1&lt;/b&gt;? Tuto akci nebude možné vzít zpět.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Uživatelské jméno</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Heslo</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Přihlásit</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Změnit heslo</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Původní heslo</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nové heslo</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Zadání hesla se neshodují – zkuste to znovu.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Heslo bylo úspěšně změněno.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Zadané heslo není platné.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Zopakování zadání (pro kontrolu)</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Neplatné uživatelské jméno nebo heslo.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Nejste přihlášení.</translation>
- </message>
- </context>
-</language>
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Varování: Právě probíhá nějaká operace uvnitř virtualizační platformy VirtualBox. Nezavírejte toto okno, ani neopouštějte tuto stránku – mohlo by to vést k nežádoucím důsledkům. Raději vyčkejte dokončení zmíněné operace.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operace zrušena</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Při komunikaci s komponentou vboxwebsrv došlo k chybě. Podrobnosti ohledně této chyby by měly být zobrazeny v následném dialogovém okně. Příčinu této chyby je třeba napravit (a následně tuto stránku znovu načíst) – jen tak budete opět moci ovládat virtualizační platformu VirtualBox prostřednictvím nadstavby phpVirtualBox.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Nezdařilo se načíst vlastnosti virtuálního stroje. Ověřte, že je spuštěný a jsou v něm nainstalované doplňky pro virtualizační platformu VirtualBox.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Došlo k chybě při získávání seznamu virtuálních strojů z platformy VirtualBox. Ověřte, že je spuštěná komponenta vboxwebsrv a správnost nastavení v souboru config.php.&lt;p&gt;Po napravení příčiny problému tuto stránku znovu načtěte, aby se seznam virtuálních strojů opět automaticky obnovoval.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Seznam serveru</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Konzole</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Načítání…</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Změnit heslo</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Odhlásit – %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Jste přihlášení pod účtem %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Zastavit</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Příručka k virtualizační platformě VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>O aplikaci</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Uložit stav</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Vypnout</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Uživatelské jméno</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Heslo</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Připojování k %1…</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Připojeno k %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Požadovaná velikost (rozlišení) plochy</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Připojit</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Odpojit, ale neukončovat sezení</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Odpojit a ukončit sezení</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Poslat klávesovou zkratku Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Důvod odpojení</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Přesměrování od %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>Tento virtuální stroj není spuštěný nebo není nastaven tak, aby přijímal přístup protokolem RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hostování</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Síťová rozhraní virtuálních strojů</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Připojeno</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Odpojeno</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Každých %1 sekund</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Otevřít v novém okně</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Uživatelé</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Uživatelé</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Správce</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Může spravovat účty ostatních uživatelů</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Přidat uživatele</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Upravit uživatele</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Odebrat uživatele</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Toto uživatelské jméno není možné použít, protože je už přiřazeno jinému uživateli na tomto systému – vymyslete jiné.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Opravdu chcete odebrat uživatele &lt;b&gt;%1&lt;/b&gt;? Tuto akci nebude možné vzít zpět.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Uživatelské jméno</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Heslo</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Přihlásit</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Změnit heslo</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Původní heslo</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nové heslo</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Zadání hesla se neshodují – zkuste to znovu.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Heslo bylo úspěšně změněno.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Zadané heslo není platné.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Zopakování zadání (pro kontrolu)</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Neplatné uživatelské jméno nebo heslo.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Nejste přihlášení.</translation>
+ </message>
+ </context>
+</language>
diff --git a/languages/de.xml b/languages/de.xml
index d0464e3..99ab4ff 100644
--- a/languages/de.xml
+++ b/languages/de.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Warnung: Interne Aktion läuft. Wenn Sie dieses Fenster schließen oder diese Seite verlassen, kann das zu unerwünschten oder unbeabsichtigten Effekten führen. Bitte warten Sie bis die Aktion abgeschlossen ist.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Aktion abgebrochen</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Bei der Kommunikation mit dem vboxwebsrv ist ein Fehler aufgetreten. Bevor dieser Fehler nicht behoben wird und diese Seite neu geladen wurde, werden von phpVirtualBox keine Anfragen mehr gesendet. Einzelheiten entnehmen Sie der folgenden Dialogbox.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Die Eigenschaften des Gastes können nicht ermittelt werden. Stellen Sie sicher, das die Maschine läuft und die Gasterweiterungen von VirtualBox installiert sind.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Beim Ermitteln der Liste virtueller Maschimen ist ein Fehler aufgetreten. Stellen Sie sicher, dass vboxwebsrv gestartet ist und die Einstellugen in der Datei config.php stimmen.&lt;p&gt;Die Liste der virtuellen Maschinen können Sie durch das erneute Laden dieser Seite aktualisieren.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Server-Liste</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Konsole</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Lädt ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Passwort ändern</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>ausloggen - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Stoppen</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>VirtualBox Benutzerhandbuch</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Über</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Zustand speichern</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Power Off</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Benutzername</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Passwort</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Verbinden mit %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Verbunden mit %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Angeforderte Bildschirmgöße</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Verbinden</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Trennen</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Trennen</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Send Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Grund für die Trennung</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirection by %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>Die virtuelle Maschine läuft nicht oder sie ist nicht für Zugriffe über RDP konfiguriert.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Netzwerkadapter des Gastes</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Nach Oben</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Nach Unten</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>alle %1 Sekunde(n)</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>In neuem Fenster öffnen</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Benutzer</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Benutzer</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Administrativer Benutzer</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Kann Benutzer verwalten</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Hinzufügen eines Benutzers</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Bearbeiten dieses Benutzers</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Entfernen Sie diesen Benutzer</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Ein Benutzer mit diesem Benutzernamen existiert bereits.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Sind Sie sicher, dass Sie den Benutzer &lt;b&gt;%1&lt;/b&gt; entfernen möchten? Diese Aktion kann nicht rückgängig gemacht werden.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Benutzername</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Passwort</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>einloggen</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Passwort ändern</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Aktuelles Passwort</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Neues Passwort</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Die Passwörter die Sie eingegeben haben stimmen nicht überein.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Kennwort geändert.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Das von Ihnen eingegebene Kennwort ist ungültig.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Retype</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Ungültiger Benutzername oder Kennwort.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Nicht eingeloggt.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Warnung: Interne Aktion läuft. Wenn Sie dieses Fenster schließen oder diese Seite verlassen, kann das zu unerwünschten oder unbeabsichtigten Effekten führen. Bitte warten Sie bis die Aktion abgeschlossen ist.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Aktion abgebrochen</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Bei der Kommunikation mit dem vboxwebsrv ist ein Fehler aufgetreten. Bevor dieser Fehler nicht behoben wird und diese Seite neu geladen wurde, werden von phpVirtualBox keine Anfragen mehr gesendet. Einzelheiten entnehmen Sie der folgenden Dialogbox.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Die Eigenschaften des Gastes können nicht ermittelt werden. Stellen Sie sicher, das die Maschine läuft und die Gasterweiterungen von VirtualBox installiert sind.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Beim Ermitteln der Liste virtueller Maschimen ist ein Fehler aufgetreten. Stellen Sie sicher, dass vboxwebsrv gestartet ist und die Einstellugen in der Datei config.php stimmen.&lt;p&gt;Die Liste der virtuellen Maschinen können Sie durch das erneute Laden dieser Seite aktualisieren.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Server-Liste</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Konsole</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Lädt ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Passwort ändern</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>ausloggen - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Stoppen</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>VirtualBox Benutzerhandbuch</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Über</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Zustand speichern</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Power Off</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Benutzername</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Passwort</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Verbinden mit %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Verbunden mit %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Angeforderte Bildschirmgöße</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Verbinden</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Trennen</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Trennen</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Send Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Grund für die Trennung</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirection by %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>Die virtuelle Maschine läuft nicht oder sie ist nicht für Zugriffe über RDP konfiguriert.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Netzwerkadapter des Gastes</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Nach Oben</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Nach Unten</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>alle %1 Sekunde(n)</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>In neuem Fenster öffnen</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Benutzer</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Benutzer</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Administrativer Benutzer</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Kann Benutzer verwalten</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Hinzufügen eines Benutzers</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Bearbeiten dieses Benutzers</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Entfernen Sie diesen Benutzer</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Ein Benutzer mit diesem Benutzernamen existiert bereits.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Sind Sie sicher, dass Sie den Benutzer &lt;b&gt;%1&lt;/b&gt; entfernen möchten? Diese Aktion kann nicht rückgängig gemacht werden.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Benutzername</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Passwort</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>einloggen</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Passwort ändern</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Aktuelles Passwort</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Neues Passwort</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Die Passwörter die Sie eingegeben haben stimmen nicht überein.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Kennwort geändert.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Das von Ihnen eingegebene Kennwort ist ungültig.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Retype</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Ungültiger Benutzername oder Kennwort.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Nicht eingeloggt.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/es.xml b/languages/es.xml
index cba49a1..89fbd82 100644
--- a/languages/es.xml
+++ b/languages/es.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Advertencia: Esta en proceso una operación interna de VirtualBox. El cerrar o cambiar a otra ventana puede tener consecuencias inesperadas y desagradables. Por favor espera a que la operación termine.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operación Cancelada</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>ha ocurrido un error al comunicarse con vboxwebsrv. phpVirtualbox no enviará mas consultas hasta que el error sea corregido y la página refrescada. Los detalles de este error de conección serán mostrados en la página siguiente.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>No es posible obtener las propiedades del huésped. Asegúrese de que la máquina virtual esta corriendo y que tiene las Adiciones al Huésped de VirtualBox instaladas.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Hubo un error en la obtención de la lista de máquinas registradas en VirtualBox. Asegúrese de que vboxwebsrv esta corriendo y de que las configuraciones en config.php son correctas.&lt;p&gt;La lista de máquinas virtuales no se refrescará automáticamente hasta que recargue la página.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Lista de servidores</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Consola</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Cargando ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Cambiar contraseña</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Salir - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Usario %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Detener</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Manual de uso de VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Acerca</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Guardar estado</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Apagar</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Nombre usuario</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Contraseña</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Conectando a %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Conectado a %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Tamaño solicitado del escritorio</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Conectar</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Separar</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Desconectar</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Enviar Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Razón de la desconección</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirigido por %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>La máquina virtual no está corriendo o no está configurada para aceptar conecciones RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Adaptadores de red huésped</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Conectado</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Desconectado</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Cada %1 segundos</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Abrir en una nueva ventana</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Usuario</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Usuario</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Usuario Administrativo</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Puede administrar usuarios</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Agregar usuario</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Modificar usuario</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Borrar usuario</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Ya existe un usuario con ese nombre.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Esta seguro que quiere borrar al usuario &lt;b&gt;%1&lt;/b&gt;? Esta acción no se puede deshacer.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Nombre usuario</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Contraseña</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Ingresar</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Cambiar contraseña</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Antigua contraseña</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nueva contraseña</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Las contraseñas que ha ingresado no coinciden.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Contraseña cambiada.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>La contraseña ingresada es inválida.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Ingrese de nuevo</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Usuario o contraseña inválida.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>No a ingresado.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Advertencia: Esta en proceso una operación interna de VirtualBox. El cerrar o cambiar a otra ventana puede tener consecuencias inesperadas y desagradables. Por favor espera a que la operación termine.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operación Cancelada</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>ha ocurrido un error al comunicarse con vboxwebsrv. phpVirtualbox no enviará mas consultas hasta que el error sea corregido y la página refrescada. Los detalles de este error de conección serán mostrados en la página siguiente.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>No es posible obtener las propiedades del huésped. Asegúrese de que la máquina virtual esta corriendo y que tiene las Adiciones al Huésped de VirtualBox instaladas.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Hubo un error en la obtención de la lista de máquinas registradas en VirtualBox. Asegúrese de que vboxwebsrv esta corriendo y de que las configuraciones en config.php son correctas.&lt;p&gt;La lista de máquinas virtuales no se refrescará automáticamente hasta que recargue la página.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Lista de servidores</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Consola</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Cargando ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Cambiar contraseña</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Salir - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Usario %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Detener</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Manual de uso de VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Acerca</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Guardar estado</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Apagar</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Nombre usuario</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Contraseña</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Conectando a %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Conectado a %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Tamaño solicitado del escritorio</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Conectar</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Separar</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Desconectar</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Enviar Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Razón de la desconección</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirigido por %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>La máquina virtual no está corriendo o no está configurada para aceptar conecciones RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Adaptadores de red huésped</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Conectado</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Desconectado</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Cada %1 segundos</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Abrir en una nueva ventana</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Usuario</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Usuario</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Usuario Administrativo</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Puede administrar usuarios</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Agregar usuario</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Modificar usuario</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Borrar usuario</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Ya existe un usuario con ese nombre.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Esta seguro que quiere borrar al usuario &lt;b&gt;%1&lt;/b&gt;? Esta acción no se puede deshacer.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nombre usuario</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Contraseña</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Ingresar</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Cambiar contraseña</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Antigua contraseña</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nueva contraseña</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Las contraseñas que ha ingresado no coinciden.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Contraseña cambiada.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>La contraseña ingresada es inválida.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Ingrese de nuevo</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Usuario o contraseña inválida.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>No a ingresado.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/fr.xml b/languages/fr.xml
index 1a128c3..022fde8 100644
--- a/languages/fr.xml
+++ b/languages/fr.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Attention: une opération interne VirtualBox est en cours. La fermeture de cette fenêtre ou le lancement de nouvelles opérations peut entraîner des résultats indésirables. Veuillez attendre la fin de l'opération.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Opération annulée</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Une erreur est survenue lors de la communication avec vboxwebsrv. Plus aucune requête ne sera envoyée par phpVirtualBox jusqu'à ce que l'erreur soit corrigée et que cette page soit actualisée. Les détails de cette erreur de connexion doivent être affiché dans une boîte de dialogue annexe.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Impossible de récupérer les propriétés de l'invité. Assurez-vous que la machine virtuelle est en marche et que les additions invités soit installées.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Une erreur est survenue lors de la récupération de la liste des machines virtuelles enregistrées à partir de VirtualBox. Assurez-vous que vboxwebsrv est lancé et que les paramètres du fichier config.php sont corrects.&lt;p&gt;La liste des machines virtuelles ne sera plus rafraichi automatiquement jusqu'à ce que cette page soit rechargée.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Liste des serveurs</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Console</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Chargement ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Changer mot de passe</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Déconnectez-vous - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Extinction</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Manuel utilisateur de VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>A propos</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Enregistrer l'état</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Extinction</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Utilisateur</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Mot de passe</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Connexion à %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Connecter à %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Taille du bureau</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Connecter</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Détacher</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Déconnecter</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Send Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Raison de la déconnexion</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirection by %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>La machine virtuelle n'est pas démarrée ou n'est pas configurée pour accepter les connexions RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hébergeur</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Carte réseau invité</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Haut</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Bas</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Toutes les %1s</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Ouvrir dans une nouvelle fenêtre</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Utilisateurs</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Utilisateurs</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Utilisateur administrateur</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Peut créer, modifier ou supprimer des utilisateurs</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Ajouter un utilisateur</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Modifier cet utilisateur</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Supprimer cet utilisateur</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Un utilisateur avec cet identifiant existe déjà.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Etes-vous sûr de vouloir supprimer l'utilisateur &lt;b&gt;%1&lt;/b&gt;? Cette action ne peut pas être annulée.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Nom d'utilisateur</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Mot de passe</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Connectez-vous</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Changer mot de passe</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Mot de passe actuel</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nouveau mot de passe</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Les mots de passe que vous avez saisis ne correspondent pas.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Mot de passe changé.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Le mot de passe que vous avez entré n'est pas valide.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Retaper</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Nom d'utilisateur ou mot de passe.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Non connecté.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Attention: une opération interne VirtualBox est en cours. La fermeture de cette fenêtre ou le lancement de nouvelles opérations peut entraîner des résultats indésirables. Veuillez attendre la fin de l'opération.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Opération annulée</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Une erreur est survenue lors de la communication avec vboxwebsrv. Plus aucune requête ne sera envoyée par phpVirtualBox jusqu'à ce que l'erreur soit corrigée et que cette page soit actualisée. Les détails de cette erreur de connexion doivent être affiché dans une boîte de dialogue annexe.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Impossible de récupérer les propriétés de l'invité. Assurez-vous que la machine virtuelle est en marche et que les additions invités soit installées.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Une erreur est survenue lors de la récupération de la liste des machines virtuelles enregistrées à partir de VirtualBox. Assurez-vous que vboxwebsrv est lancé et que les paramètres du fichier config.php sont corrects.&lt;p&gt;La liste des machines virtuelles ne sera plus rafraichi automatiquement jusqu'à ce que cette page soit rechargée.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Liste des serveurs</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Console</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Chargement ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Changer mot de passe</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Déconnectez-vous - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Extinction</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Manuel utilisateur de VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>A propos</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Enregistrer l'état</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Extinction</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Utilisateur</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Mot de passe</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Connexion à %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Connecter à %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Taille du bureau</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Connecter</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Détacher</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Déconnecter</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Send Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Raison de la déconnexion</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirection by %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>La machine virtuelle n'est pas démarrée ou n'est pas configurée pour accepter les connexions RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hébergeur</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Carte réseau invité</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Haut</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Bas</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Toutes les %1s</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Ouvrir dans une nouvelle fenêtre</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Utilisateurs</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Utilisateurs</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Utilisateur administrateur</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Peut créer, modifier ou supprimer des utilisateurs</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Ajouter un utilisateur</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Modifier cet utilisateur</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Supprimer cet utilisateur</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Un utilisateur avec cet identifiant existe déjà.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Etes-vous sûr de vouloir supprimer l'utilisateur &lt;b&gt;%1&lt;/b&gt;? Cette action ne peut pas être annulée.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nom d'utilisateur</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Mot de passe</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Connectez-vous</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Changer mot de passe</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Mot de passe actuel</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nouveau mot de passe</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Les mots de passe que vous avez saisis ne correspondent pas.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Mot de passe changé.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Le mot de passe que vous avez entré n'est pas valide.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Retaper</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Nom d'utilisateur ou mot de passe.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Non connecté.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/it.xml b/languages/it.xml
index 32468c2..9c7a32f 100644
--- a/languages/it.xml
+++ b/languages/it.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Attenzione: è in corso un'operazione interna di VirtualBox. Chiudendo la finestra, o uscendo da questa pagina web, possono verificarsi risultati inaspettati e non desiderati. Si prega di attendere il completamento dell'operazione.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operazione Annullata</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Si è verificato un errore di comuinicazione con il processo vboxwebsrv. phpVirtualBox non inoltrerà più alcuna richiesta fino a quando l'errore non sarà corretto e la pagina ricaricata. I dettagli dell'errore di connessione saranno visualizzati in una nuova finestra.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Impossibile recuperare le informazioni del sistema ospite. Assicurarsi che la macchina virtuale sia in esecuzione e che siano installati i VirtualBox Guest Additions.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Si è verificato un errore durante il recupero della lista delle macchine virtuali registrate. Assicurarsi che il processo vboxwebsrv sia in esecuzion e che le impostazioni nel file config.php siano corrette.&lt;p&gt;La lista delle macchine virtuali non sarà aggiornata automaticamente fino al ricaricamento della pagina.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Elenco server</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Console</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Caricamento ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Cambia Password</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Log out - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Fermare</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Manuale Utente VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Info</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Salva Stato</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Termina</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Nome utente</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Password</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Connessione a %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Collegato a %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Dimensione desktop richiesta</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Connetti</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Separa</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Disconnetti</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Send Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Motivo disconnessione</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirection by %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>La macchina virtuale non è in esecuzione o non è configurata per accettare connessioni RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Adattatori di Rete Ospite</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Su</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Giu</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Ogni %1 secondi</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Apri in una nuova finestra</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Utenti</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Utenti</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Utente Admin</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Può amministrare gli utenti</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Aggiungi utente</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Modifica Utente</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Elimina utente</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Esiste già un utente con questo nome.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Vuoi davvero rimuovere l'utente &lt;b&gt;%1&lt;/b&gt;? L'operazione non può essere annullata.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Nome Utente</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Password</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Log in</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Cambia Password</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Vecchia Password</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nuova Password</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Le password inserite non coincidono.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Password cambiata.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>La password inserita non è valida.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Digitare nuovamente</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Nome utente o password non validi.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Non autenticato.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Attenzione: è in corso un'operazione interna di VirtualBox. Chiudendo la finestra, o uscendo da questa pagina web, possono verificarsi risultati inaspettati e non desiderati. Si prega di attendere il completamento dell'operazione.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operazione Annullata</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Si è verificato un errore di comuinicazione con il processo vboxwebsrv. phpVirtualBox non inoltrerà più alcuna richiesta fino a quando l'errore non sarà corretto e la pagina ricaricata. I dettagli dell'errore di connessione saranno visualizzati in una nuova finestra.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Impossibile recuperare le informazioni del sistema ospite. Assicurarsi che la macchina virtuale sia in esecuzione e che siano installati i VirtualBox Guest Additions.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Si è verificato un errore durante il recupero della lista delle macchine virtuali registrate. Assicurarsi che il processo vboxwebsrv sia in esecuzion e che le impostazioni nel file config.php siano corrette.&lt;p&gt;La lista delle macchine virtuali non sarà aggiornata automaticamente fino al ricaricamento della pagina.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Elenco server</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Console</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Caricamento ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Cambia Password</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Log out - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Fermare</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Manuale Utente VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Info</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Salva Stato</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Termina</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Nome utente</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Password</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Connessione a %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Collegato a %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Dimensione desktop richiesta</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Connetti</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Separa</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Disconnetti</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Send Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Motivo disconnessione</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirection by %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>La macchina virtuale non è in esecuzione o non è configurata per accettare connessioni RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Adattatori di Rete Ospite</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Su</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Giu</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Ogni %1 secondi</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Apri in una nuova finestra</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Utenti</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Utenti</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Utente Admin</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Può amministrare gli utenti</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Aggiungi utente</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Modifica Utente</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Elimina utente</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Esiste già un utente con questo nome.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Vuoi davvero rimuovere l'utente &lt;b&gt;%1&lt;/b&gt;? L'operazione non può essere annullata.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nome Utente</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Password</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Log in</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Cambia Password</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Vecchia Password</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nuova Password</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Le password inserite non coincidono.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Password cambiata.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>La password inserita non è valida.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Digitare nuovamente</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Nome utente o password non validi.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Non autenticato.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/ja.xml b/languages/ja.xml
index d6fbb74..9d94173 100644
--- a/languages/ja.xml
+++ b/languages/ja.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>操作はキャンセルされました</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>サーバリスト</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>コンソール</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Loading ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>パスワードの変更</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>ログアウト - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>停止</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>VirtualBox ユーザーマニュアル</translation>
- </message>
- <message>
- <source>About</source>
- <translation>アプリケーションについて</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>状態を保存</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>電源オフ</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>ユーザー名</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>パスワード</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>接続中 %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>接続中 %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>デスクトップのサイズ</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>接続</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>切り離し</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>切断</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Ctrl-Alt-Del の送信</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>切断の説明</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>リダイレクト %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>仮想マシンは実行中でないかまたは、RDP 接続が有効に構成されていません。</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>ホスト</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>ゲストネットワークアダプタ</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Up</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Down</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation> %1 秒毎</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>新規ウィンドウで開く</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>ユーザ</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>ユーザ</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Admin ユーザ</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>管理者ユーザにする</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>ユーザの追加</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>ユーザの編集</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>ユーザの削除</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>そのユーザ名のユーザはすでに存在します。</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>ユーザ &lt;b&gt;%1&lt;/b&gt; を削除してよろしいですか? この操作は取り消すことができません。</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>ユーザー名</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>パスワード</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>ログイン</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>パスワードの変更</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>古いパスワード</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>新しいパスワード</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>入力したパスワードが一致しません。</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>パスワードは変更されました。</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>入力したパスワードが無効です。</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>再入力</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>ユーザ名またはパスワードが無効です。</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>ログインしていません。</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>操作はキャンセルされました</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>サーバリスト</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>コンソール</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Loading ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>パスワードの変更</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>ログアウト - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>停止</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>VirtualBox ユーザーマニュアル</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>アプリケーションについて</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>状態を保存</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>電源オフ</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>ユーザー名</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>パスワード</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>接続中 %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>接続中 %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>デスクトップのサイズ</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>接続</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>切り離し</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>切断</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Ctrl-Alt-Del の送信</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>切断の説明</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>リダイレクト %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>仮想マシンは実行中でないかまたは、RDP 接続が有効に構成されていません。</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>ホスト</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>ゲストネットワークアダプタ</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Up</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Down</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation> %1 秒毎</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>新規ウィンドウで開く</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>ユーザ</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>ユーザ</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Admin ユーザ</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>管理者ユーザにする</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>ユーザの追加</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>ユーザの編集</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>ユーザの削除</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>そのユーザ名のユーザはすでに存在します。</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>ユーザ &lt;b&gt;%1&lt;/b&gt; を削除してよろしいですか? この操作は取り消すことができません。</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>ユーザー名</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>パスワード</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>ログイン</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>パスワードの変更</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>古いパスワード</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>新しいパスワード</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>入力したパスワードが一致しません。</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>パスワードは変更されました。</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>入力したパスワードが無効です。</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>再入力</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>ユーザ名またはパスワードが無効です。</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>ログインしていません。</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/languages.txt b/languages/languages.txt
index af37756..d47aeca 100644
--- a/languages/languages.txt
+++ b/languages/languages.txt
@@ -1,190 +1,190 @@
-
-$Id: languages.txt 582 2014-12-11 17:47:28Z imoore76 $
-
-This outlines in-depth the process used by phpVirtualBox's translation mechanisms and describes
-how a developer may add new translations. If the reader, as an end-user simply wishes to translate
-phpVirtualBox into a new language, see:
-https://github.com/phpvirtualbox/phpvirtualbox/wiki#translating-phpvirtualbox
-
-.. I) phpVirtualBox translation mechanism
-....... a) Contexts
-....... b) Data structure
-....... c) Runtime translations in JavaScript
-....... d) Runtime translations in PHP
-
-.. II) Adding a new language
-....... a) Creating phpVirtualBox XML translation file
-....... b) Converting QT .qm files
-....... c) Updating language selection
-
-
-I. phpVirtualBox translation mechanism
-
-The translation mechanism in phpVirtualBox uses a combination of PHP serialized data along with
-runtime parsed XML files.
-
-VirtualBox's QT language files are pre-parsed (before runtime) and serialized into data consumable
-by PHP's unserialize function. These files contain all translations performed by VirtualBox's
-translators for the VirtualBox GUI frontend. Serialized translation files are placed in the
-languages/source folder.
-
-Some text that appears in phpVirtualBox is not in, or applicable to the VirtualBox GUI and therefore
-has no corresponding translation in VirtualBox's language files. This text is translated in XML files
-in the languages/ folder.
-
-lib/language.php contanis the __vbox_language class. Upon instantiation this class:
-
- 1) Determines which language to use by checking phpVirtualBox settings for the default language,
- and for the cookie vboxLanguage if passed by the web browser - the browser's cookie will
- overwrite the default language defined in config.php
-
- 2) Unserializes the language data from the appropriate file in the languages/source folder
-
- 3) Parses the XML data from the appropriate XML file in the languages folder
-
- 4) Merges language data into a single array structure allowing the XML translations to overwrite
- serialized data translations (if such a scenario exists)
-
-I.a Contexts
-
-Language contexts is a translational concept allowing one word (or phrase) to take on many meanings
-based on the context in which it is used. When text is being translated, the translation mechanism
-must also be passed a context. For instance the "Add" button to add a user may be translated
-differently than the "Add" button to add a VirtualMachine.
-
-I.b Data structure
-
-The data structure of parsed languages is a multidimensional associative array / hash / dict that
-contains a hierarchy of contexts -> messages -> translation(s). Using PHP's print_r, the output of
-this data structure is:
-
-Array
-(
- [contexts] => Array
- (
- .....
-
- [UINewHDWizardPageVariant] => Array
- (
- [messages] => Array
- (
- [Storage details] => Array
- (
- [translation] => Detalles de almacenamiento
- )
-
- )
- .....
-
- )
-.....
-
-("array" refers to an associative array / hash / dict. They are all the same thing in PHP.)
-
-The context UINewHDWizardPageVariant is a key within the contexts array. It has a number of messages.
-Storage Details is a key in the messages array. It has a single item called translation that contains
-the translation of Storage Details.
-
-I.c Runtime translations in JavaScript
-
-When phpVirtualBox is loaded, it loads js/language.php. This instantiates __vbox_language and dumps
-its language data as a JSON encoded object. It also contains the phpVirtualBox JavaScript trans()
-function which takes (at a minimum) a context and message, and returns the corresponding translation.
-
-I.d Runtime translations in PHP
-
-lib/language.php contains a trans() function defined in PHP which takes (at a minimum) a context and
-message, and returns the corresponding translation using an instance of __vbox_language. Since
-language loading is an expensive process (unserializing a large amount of data and parsing XML), the
-instantiation of the __vbox_language only occurs if trans() is called in PHP. Subsequent calls to
-trans() will of course use the existing instantiation. Translation inside PHP Is rare and restricted
-to error messages returned by phpVirtualBox.
-
-II. Adding a new language
-
-Adding a new language requires relatively little work. First, determine the 2 letter language code
-for the target language. See http://en.wikipedia.org/wiki/ISO_639-1
-
-II.a Creating phpVirtualBox XML translation file
-
-Copy an existing XML file in phpVirtualBox's languages folder using the 2 letter language code
-described above.
-
-Here is an example:
-
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this
- window or navigating away from this web page may cause unexpected and
- undesirable results. Please wait for the operation to complete.
- </source>
- <translation>Warnung: Interne Aktion läuft. Wenn Sie dieses Fenster schließen
- oder diese Seite verlassen, kann das zu unerwünschten oder
- unbeabsichtigten Effekten führen. Bitte warten Sie bis die Aktion
- abgeschlossen ist.
- </translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Aktion abgebrochen</translation>
- </message>
- ......
-
-You will see translation messages such as:
-
-<message>
- <source>Operation Canceled</source>
- <translation>Aktion abgebrochen</translation>
-</message>
-
-Text within the <source> tag is the text that is to be translated. The translated text goes in the
-<translation> tag. E.g.
-
-<message>
- <source>Operation Canceled</source>
- <translation>Your translation of "Operation Canceled" goes here...</translation>
-</message>
-
-WARNING: Do not change the text in the <source> tag. Even adding an extra line will break the
-translation.
-
-II.b Converting .ts files from official Virtualbox
-
-You will need a copy of VirtualBox installed and to navigate to your VirtualBox installation folder on your computer, then to the "nls" folder.
-Otherwise, you can navigate to the URL: "https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Frontends/VirtualBox/nls".
-You should see files which have the naming convention VirtualBox_xx.ts - where xx is the language code described above.
-If you can't find the needed language, you won't be able to add or update it in phpVirtualbox.
-
-Copy the "VirtualBox_xx.ts" file corresponding to the needed language.
-
-The script languages/source/parse_vbox_lang.php provided with phpVirtualbox can then be used to parse this ".ts" file into a ".dat" file consumable by phpVirtualBox.
-
-Navigate to you phpVirtualbox installation folder and then to languages/source. Put the previously copied "VirtualBox_xx.ts" file there, then run the following command (you will need a working php setup) :
-
-php parse_vbox_lang.php VirtualBox_xx.ts > xx.dat (replace xx with the language code)
-
-This will create a "xx.dat" file that should be readable by phpVirtualBox.
-
-II.c Updating language selection
-
-Once translation files have been added to languages/ and languages/source/ the interface must be
-updated so that the new language is available for selection. Edit panes/settingsGlobalLanguage.html
-and add the new language to the JavaScript vboxLanguages array.
-
-var vboxLanguages = [
- {'id':'en','name':'English'},
- {'id':'pt_br','name':'Portuguese (Brazil)','name_tr':'Português (Brasil)'},
- {'id':'ru','name':'Russian','name_tr':'Русский'},
- {'id':'it','name':'Italian','name_tr':'Italiano'},
- ....
-];
-
-This is an array of associative arrays of language definitions that must contain the following keys:
- id - must match the language file name in languages/ (minus the .xml extension)
- name - the name of the language in English
- name_tr - the name of the language in its native speech
-
-
+
+$Id: languages.txt 582 2014-12-11 17:47:28Z imoore76 $
+
+This outlines in-depth the process used by phpVirtualBox's translation mechanisms and describes
+how a developer may add new translations. If the reader, as an end-user simply wishes to translate
+phpVirtualBox into a new language, see:
+https://github.com/phpvirtualbox/phpvirtualbox/wiki#translating-phpvirtualbox
+
+.. I) phpVirtualBox translation mechanism
+....... a) Contexts
+....... b) Data structure
+....... c) Runtime translations in JavaScript
+....... d) Runtime translations in PHP
+
+.. II) Adding a new language
+....... a) Creating phpVirtualBox XML translation file
+....... b) Converting QT .qm files
+....... c) Updating language selection
+
+
+I. phpVirtualBox translation mechanism
+
+The translation mechanism in phpVirtualBox uses a combination of PHP serialized data along with
+runtime parsed XML files.
+
+VirtualBox's QT language files are pre-parsed (before runtime) and serialized into data consumable
+by PHP's unserialize function. These files contain all translations performed by VirtualBox's
+translators for the VirtualBox GUI frontend. Serialized translation files are placed in the
+languages/source folder.
+
+Some text that appears in phpVirtualBox is not in, or applicable to the VirtualBox GUI and therefore
+has no corresponding translation in VirtualBox's language files. This text is translated in XML files
+in the languages/ folder.
+
+lib/language.php contanis the __vbox_language class. Upon instantiation this class:
+
+ 1) Determines which language to use by checking phpVirtualBox settings for the default language,
+ and for the cookie vboxLanguage if passed by the web browser - the browser's cookie will
+ overwrite the default language defined in config.php
+
+ 2) Unserializes the language data from the appropriate file in the languages/source folder
+
+ 3) Parses the XML data from the appropriate XML file in the languages folder
+
+ 4) Merges language data into a single array structure allowing the XML translations to overwrite
+ serialized data translations (if such a scenario exists)
+
+I.a Contexts
+
+Language contexts is a translational concept allowing one word (or phrase) to take on many meanings
+based on the context in which it is used. When text is being translated, the translation mechanism
+must also be passed a context. For instance the "Add" button to add a user may be translated
+differently than the "Add" button to add a VirtualMachine.
+
+I.b Data structure
+
+The data structure of parsed languages is a multidimensional associative array / hash / dict that
+contains a hierarchy of contexts -> messages -> translation(s). Using PHP's print_r, the output of
+this data structure is:
+
+Array
+(
+ [contexts] => Array
+ (
+ .....
+
+ [UINewHDWizardPageVariant] => Array
+ (
+ [messages] => Array
+ (
+ [Storage details] => Array
+ (
+ [translation] => Detalles de almacenamiento
+ )
+
+ )
+ .....
+
+ )
+.....
+
+("array" refers to an associative array / hash / dict. They are all the same thing in PHP.)
+
+The context UINewHDWizardPageVariant is a key within the contexts array. It has a number of messages.
+Storage Details is a key in the messages array. It has a single item called translation that contains
+the translation of Storage Details.
+
+I.c Runtime translations in JavaScript
+
+When phpVirtualBox is loaded, it loads js/language.php. This instantiates __vbox_language and dumps
+its language data as a JSON encoded object. It also contains the phpVirtualBox JavaScript trans()
+function which takes (at a minimum) a context and message, and returns the corresponding translation.
+
+I.d Runtime translations in PHP
+
+lib/language.php contains a trans() function defined in PHP which takes (at a minimum) a context and
+message, and returns the corresponding translation using an instance of __vbox_language. Since
+language loading is an expensive process (unserializing a large amount of data and parsing XML), the
+instantiation of the __vbox_language only occurs if trans() is called in PHP. Subsequent calls to
+trans() will of course use the existing instantiation. Translation inside PHP Is rare and restricted
+to error messages returned by phpVirtualBox.
+
+II. Adding a new language
+
+Adding a new language requires relatively little work. First, determine the 2 letter language code
+for the target language. See http://en.wikipedia.org/wiki/ISO_639-1
+
+II.a Creating phpVirtualBox XML translation file
+
+Copy an existing XML file in phpVirtualBox's languages folder using the 2 letter language code
+described above.
+
+Here is an example:
+
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this
+ window or navigating away from this web page may cause unexpected and
+ undesirable results. Please wait for the operation to complete.
+ </source>
+ <translation>Warnung: Interne Aktion läuft. Wenn Sie dieses Fenster schließen
+ oder diese Seite verlassen, kann das zu unerwünschten oder
+ unbeabsichtigten Effekten führen. Bitte warten Sie bis die Aktion
+ abgeschlossen ist.
+ </translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Aktion abgebrochen</translation>
+ </message>
+ ......
+
+You will see translation messages such as:
+
+<message>
+ <source>Operation Canceled</source>
+ <translation>Aktion abgebrochen</translation>
+</message>
+
+Text within the <source> tag is the text that is to be translated. The translated text goes in the
+<translation> tag. E.g.
+
+<message>
+ <source>Operation Canceled</source>
+ <translation>Your translation of "Operation Canceled" goes here...</translation>
+</message>
+
+WARNING: Do not change the text in the <source> tag. Even adding an extra line will break the
+translation.
+
+II.b Converting .ts files from official Virtualbox
+
+You will need a copy of VirtualBox installed and to navigate to your VirtualBox installation folder on your computer, then to the "nls" folder.
+Otherwise, you can navigate to the URL: "https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Frontends/VirtualBox/nls".
+You should see files which have the naming convention VirtualBox_xx.ts - where xx is the language code described above.
+If you can't find the needed language, you won't be able to add or update it in phpVirtualbox.
+
+Copy the "VirtualBox_xx.ts" file corresponding to the needed language.
+
+The script languages/source/parse_vbox_lang.php provided with phpVirtualbox can then be used to parse this ".ts" file into a ".dat" file consumable by phpVirtualBox.
+
+Navigate to you phpVirtualbox installation folder and then to languages/source. Put the previously copied "VirtualBox_xx.ts" file there, then run the following command (you will need a working php setup) :
+
+php parse_vbox_lang.php VirtualBox_xx.ts > xx.dat (replace xx with the language code)
+
+This will create a "xx.dat" file that should be readable by phpVirtualBox.
+
+II.c Updating language selection
+
+Once translation files have been added to languages/ and languages/source/ the interface must be
+updated so that the new language is available for selection. Edit panes/settingsGlobalLanguage.html
+and add the new language to the JavaScript vboxLanguages array.
+
+var vboxLanguages = [
+ {'id':'en','name':'English'},
+ {'id':'pt_br','name':'Portuguese (Brazil)','name_tr':'Português (Brasil)'},
+ {'id':'ru','name':'Russian','name_tr':'Русский'},
+ {'id':'it','name':'Italian','name_tr':'Italiano'},
+ ....
+];
+
+This is an array of associative arrays of language definitions that must contain the following keys:
+ id - must match the language file name in languages/ (minus the .xml extension)
+ name - the name of the language in English
+ name_tr - the name of the language in its native speech
+
+
diff --git a/languages/nl.xml b/languages/nl.xml
index 665e67d..d28b67f 100644
--- a/languages/nl.xml
+++ b/languages/nl.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Waarschuwing: VirtualBox is intern bezig. Als u dit venster sluit of weggaat van deze pagina kunnen er onverwachte problemen optreden. Wacht alsjeblieft tot het proces is afgerond.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Actie geannuleerd</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Er is een fout opgetreden bij de communicatie met vboxwebsrv. VirtualBox zal geen verzoeken meer sturen totdat de fout is opgelost en deze pagina ververst. De details van deze verbindingsfout zouden in een volgend dialoogvenster moeten worden getoond.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Gasteigenschappen kunnen niet worden opgehaald. Controleer of de virtuele machine werkt en de gasttoevoegingen zijn geïnstalleerd.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Er is een fout opgetreden bij het ophalen van de lijst van aangemaakte virtuele machines in VirtualBox. Controleer of vboxwebsrv werkt en dat de instellingen van config.php kloppen.&lt;/p&gt;De lijst van virtuele machines wordt niet herladen totdat deze pagina wordt ververst.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Serverlijst</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Console</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Laden ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Wachtwoord veranderen</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Uitloggen - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Ingelogd als %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Stoppen</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>VirtualBox handleiding</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Over</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Toestand opslaan</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Stroom uit</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Gebruikersnaam</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Wachtwoord</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Verbinden met %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Verbonden met %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Gewenste bureaubladgrootte</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Verbinden</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Loskoppelen</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Ontkoppelen</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Stuur Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Reden van ontkoppeling</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Doorverwijzing door %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>De virtuele machine werkt niet of is niet ingesteld om RDP-verbindingen toe te laten.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Gastnetwerkadapters</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Aan</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Uit</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Iedere %1 seconde(n)</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>In nieuw venster openen</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Gebruikers</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Gebruikers</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Admingebruiker</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Kan gebruikers aanpassen</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Gebruiker toevoegen</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Gebruiker aanpassen</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Gebruiker verwijderen</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Er bestaat al een gebruiker met die naam.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Weet je zeker dat je de gebruiker &lt;b&gt;%1&lt;/b&gt; wilt verwijderen? Deze actie kan niet ongedaan gemaakt worden.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Gebruikersnaam</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Wachtwoord</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Inloggen</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Wachtwoord veranderen</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Huidig wachtwoord</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nieuw wachtwoord</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>De wachtwoorden die je hebt ingevoerd komen niet overeen.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Wachtwoord veranderd.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Het wachtwoord dat je hebt opgegeven is niet geldig.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Voer opnieuw in</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Ongeldige gebruikersnaam of wachtwoord.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Niet ingelogd.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Waarschuwing: VirtualBox is intern bezig. Als u dit venster sluit of weggaat van deze pagina kunnen er onverwachte problemen optreden. Wacht alsjeblieft tot het proces is afgerond.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Actie geannuleerd</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Er is een fout opgetreden bij de communicatie met vboxwebsrv. VirtualBox zal geen verzoeken meer sturen totdat de fout is opgelost en deze pagina ververst. De details van deze verbindingsfout zouden in een volgend dialoogvenster moeten worden getoond.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Gasteigenschappen kunnen niet worden opgehaald. Controleer of de virtuele machine werkt en de gasttoevoegingen zijn geïnstalleerd.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Er is een fout opgetreden bij het ophalen van de lijst van aangemaakte virtuele machines in VirtualBox. Controleer of vboxwebsrv werkt en dat de instellingen van config.php kloppen.&lt;/p&gt;De lijst van virtuele machines wordt niet herladen totdat deze pagina wordt ververst.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Serverlijst</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Console</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Laden ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Wachtwoord veranderen</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Uitloggen - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Ingelogd als %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Stoppen</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>VirtualBox handleiding</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Over</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Toestand opslaan</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Stroom uit</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Gebruikersnaam</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Wachtwoord</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Verbinden met %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Verbonden met %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Gewenste bureaubladgrootte</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Verbinden</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Loskoppelen</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Ontkoppelen</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Stuur Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Reden van ontkoppeling</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Doorverwijzing door %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>De virtuele machine werkt niet of is niet ingesteld om RDP-verbindingen toe te laten.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Gastnetwerkadapters</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Aan</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Uit</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Iedere %1 seconde(n)</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>In nieuw venster openen</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Gebruikers</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Gebruikers</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Admingebruiker</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Kan gebruikers aanpassen</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Gebruiker toevoegen</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Gebruiker aanpassen</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Gebruiker verwijderen</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Er bestaat al een gebruiker met die naam.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Weet je zeker dat je de gebruiker &lt;b&gt;%1&lt;/b&gt; wilt verwijderen? Deze actie kan niet ongedaan gemaakt worden.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Gebruikersnaam</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Wachtwoord</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Inloggen</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Wachtwoord veranderen</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Huidig wachtwoord</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nieuw wachtwoord</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>De wachtwoorden die je hebt ingevoerd komen niet overeen.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Wachtwoord veranderd.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Het wachtwoord dat je hebt opgegeven is niet geldig.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Voer opnieuw in</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Ongeldige gebruikersnaam of wachtwoord.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Niet ingelogd.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/pl.xml b/languages/pl.xml
index 754298b..3b23d9a 100644
--- a/languages/pl.xml
+++ b/languages/pl.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Ostrzeżenie: VirtualBox jest w trakcie operacji wewnętrznych. Zamknięciu tego okna, czy wyjście z tej strony może spowodować nieoczekiwane i niepożądane efekty. Proszę czekać na ukończenie operacji.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operacja anulowana</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Wystąpił błąd komunikacji z vboxwebsrv. Żadne żądania nie zostaną wysłane przez phpVirtualBox dopóki błędy nie zostaną poprawione i strona nie zostanie odświeżona. Szczegóły tego błędu połączenia powinny być wyświetlane w kolejnym oknie dialogowym.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Nie można pobrać właściwości maszyny. Upewnij się, że maszyna wirtualna jest uruchomiona i dodatek VirtualBox Guest jest zainstalowany.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Wystąpił błąd podczas uzyskiwania listy zarejestrowanych maszyn wirtualnych VirtualBox. Upewnij się że vboxwebsrv działa i że ustawienia w config.php są poprawne.&lt;p&gt;Lista maszyn wirtualnych nie będzie automatycznie odświeżana dopuki strona nie zostanie przeładowana.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Lista serwerów</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Konsola</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Ładowanie ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Zmień hasło</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Wyloguj - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Zatrzymaj</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Podręcznik VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Informacje</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Zapisz stan</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Wyłącz</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Nazwa użytkownika</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Hasło</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Podłączanie do %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Podłączono do %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Żądany rozmiar pulpitu</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Połącz</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Rozłącz</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Rozłącz</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Wyślij Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Powód rozłączenia</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Przekierowane przez %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>Maszyna wirtualna nie jest uruchomiona lub nie jest skonfigurowana do akceptowania połączeń RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Karty sieciowe maszyny</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Włącz</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Wyłącz</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>W %1 sekundzie</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Otwórz w nowym oknie</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Użytkownicy</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Użytkownicy</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Administrator</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Może zarządzać użytkownikami</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Dodaj użytkownika</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Edytuj użytkownika</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Usuń użytkownika</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Użytkownik o tej nazwie już istnieje.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Czy jesteś pewny że chcesz usunąć użytkownika &lt;b&gt;%1&lt;/b&gt;? Ta operacja nie może być cofnięta.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Nazwa użytkownika</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Hasło</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Zaloguj</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Zmień hasło</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Aktualne hasło</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nowe hasło</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Hasła które podałeś nie są takie same.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Hasło zmienione.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Hasło które wprowadziłeś jest nieprawidłowe.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Powtórz</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Zły login lub hasło.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Nie zalogowano.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Ostrzeżenie: VirtualBox jest w trakcie operacji wewnętrznych. Zamknięciu tego okna, czy wyjście z tej strony może spowodować nieoczekiwane i niepożądane efekty. Proszę czekać na ukończenie operacji.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operacja anulowana</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Wystąpił błąd komunikacji z vboxwebsrv. Żadne żądania nie zostaną wysłane przez phpVirtualBox dopóki błędy nie zostaną poprawione i strona nie zostanie odświeżona. Szczegóły tego błędu połączenia powinny być wyświetlane w kolejnym oknie dialogowym.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Nie można pobrać właściwości maszyny. Upewnij się, że maszyna wirtualna jest uruchomiona i dodatek VirtualBox Guest jest zainstalowany.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Wystąpił błąd podczas uzyskiwania listy zarejestrowanych maszyn wirtualnych VirtualBox. Upewnij się że vboxwebsrv działa i że ustawienia w config.php są poprawne.&lt;p&gt;Lista maszyn wirtualnych nie będzie automatycznie odświeżana dopuki strona nie zostanie przeładowana.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Lista serwerów</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Konsola</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Ładowanie ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Zmień hasło</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Wyloguj - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Zatrzymaj</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Podręcznik VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Informacje</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Zapisz stan</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Wyłącz</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Nazwa użytkownika</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Hasło</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Podłączanie do %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Podłączono do %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Żądany rozmiar pulpitu</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Połącz</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Rozłącz</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Rozłącz</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Wyślij Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Powód rozłączenia</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Przekierowane przez %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>Maszyna wirtualna nie jest uruchomiona lub nie jest skonfigurowana do akceptowania połączeń RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Karty sieciowe maszyny</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Włącz</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Wyłącz</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>W %1 sekundzie</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Otwórz w nowym oknie</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Użytkownicy</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Użytkownicy</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Administrator</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Może zarządzać użytkownikami</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Dodaj użytkownika</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Edytuj użytkownika</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Usuń użytkownika</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Użytkownik o tej nazwie już istnieje.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Czy jesteś pewny że chcesz usunąć użytkownika &lt;b&gt;%1&lt;/b&gt;? Ta operacja nie może być cofnięta.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nazwa użytkownika</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Hasło</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Zaloguj</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Zmień hasło</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Aktualne hasło</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nowe hasło</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Hasła które podałeś nie są takie same.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Hasło zmienione.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Hasło które wprowadziłeś jest nieprawidłowe.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Powtórz</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Zły login lub hasło.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Nie zalogowano.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/pt_br.xml b/languages/pt_br.xml
index 33fec6b..6aa341d 100644
--- a/languages/pt_br.xml
+++ b/languages/pt_br.xml
@@ -1,254 +1,254 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Aviso: Uma operação do VirtualBox está em execução. Fechar esta janela ou navegar fora desta página pode causar resultados inesperados e indesejáveis. Por favor espere até que a tarefa seja executada.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operação Cancelada</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Ocorreu um erro ao tentar comunicar-se com o serviço vboxwebsrv. Não serão enviadas novas requisições pelo phpVirtualBox até que este erro seja corrigido a esta página atualizada. Os detalhes deste erro de conexão serão apresentados em uma janela subsequente.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Não foi possível abrir as propriedades da máquina virtual. Certifique-se de que ela esteja ligada e possui o VirtualBox Guest Additions instalado.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Houve um erro ao obter a lista de máquinas virtuais registradas no VirtualBox. Certifique-se que o serviço vboxwebsrv esteja ativo e que as configurações no arquivo config.php estejam corretas.&lt;p&gt;A lista de máquinas virtuais não será atualizada automaticamente até que esta página seja recarregada.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Lista de Servidores</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Console</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Carregando ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Alterar Senha</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Sair - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Parar</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Manual de Usuário do VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Sobre</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Salvar Estado</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Desligar</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Usuário</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Senha</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Conectando-se %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Conectado a %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Tamanho da tela</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Conectar</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Abrir em janela separada</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Desconectar</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Send Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Razão da Desconexão</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirection by %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>A Máquina Virtual não está ligada ou não está configurada para aceitar conexões RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Versão</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Adaptadores de Rede do Convidado</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Conectado</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Não Conectado</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>A cada %s segundos</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Abrir em uma nova janelaく</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Usuários</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Usuários</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Usuário Admin</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Pode administrar usuários</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Adicionar Usuário</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Editar Usuário</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Remover Usuário</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Este nome de usuário já existe.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Tem certeza que deseja remover este usuário? Esta ação não poderá ser desfeita.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Usuário</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Senha</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Entrar</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Alterar Senha</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Senha Anterior</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Nova Senha</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>As senhas inseridas não conferem.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Senha Alterada.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>A senha inserida é inválida.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Digite novamente</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Usuário ou senha inválidos.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Não conectado.</translation>
- </message>
- </context>
-</language>
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Aviso: Uma operação do VirtualBox está em execução. Fechar esta janela ou navegar fora desta página pode causar resultados inesperados e indesejáveis. Por favor espere até que a tarefa seja executada.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operação Cancelada</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Ocorreu um erro ao tentar comunicar-se com o serviço vboxwebsrv. Não serão enviadas novas requisições pelo phpVirtualBox até que este erro seja corrigido a esta página atualizada. Os detalhes deste erro de conexão serão apresentados em uma janela subsequente.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Não foi possível abrir as propriedades da máquina virtual. Certifique-se de que ela esteja ligada e possui o VirtualBox Guest Additions instalado.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Houve um erro ao obter a lista de máquinas virtuais registradas no VirtualBox. Certifique-se que o serviço vboxwebsrv esteja ativo e que as configurações no arquivo config.php estejam corretas.&lt;p&gt;A lista de máquinas virtuais não será atualizada automaticamente até que esta página seja recarregada.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Lista de Servidores</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Console</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Carregando ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Alterar Senha</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Sair - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Parar</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Manual de Usuário do VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Sobre</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Salvar Estado</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Desligar</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Usuário</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Senha</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Conectando-se %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Conectado a %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Tamanho da tela</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Conectar</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Abrir em janela separada</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Desconectar</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Send Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Razão da Desconexão</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirection by %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>A Máquina Virtual não está ligada ou não está configurada para aceitar conexões RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Versão</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Adaptadores de Rede do Convidado</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Conectado</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Não Conectado</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>A cada %s segundos</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Abrir em uma nova janelaく</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Usuários</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Usuários</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Usuário Admin</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Pode administrar usuários</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Adicionar Usuário</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Editar Usuário</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Remover Usuário</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Este nome de usuário já existe.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Tem certeza que deseja remover este usuário? Esta ação não poderá ser desfeita.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Usuário</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Senha</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Entrar</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Alterar Senha</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Senha Anterior</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Nova Senha</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>As senhas inseridas não conferem.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Senha Alterada.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>A senha inserida é inválida.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Digite novamente</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Usuário ou senha inválidos.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Não conectado.</translation>
+ </message>
+ </context>
+</language>
diff --git a/languages/ro.xml b/languages/ro.xml
index d517e14..32e2e66 100644
--- a/languages/ro.xml
+++ b/languages/ro.xml
@@ -1,255 +1,255 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Atentie: Se proceseaza o operatiune interna in VirtualBox. Iesirea din aceasta fereastra poate avea consecinte nedorite si neasteptate. Va rugam sa asteptati terminarea operatiunii.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Operatiune anulata</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>A aparut o eroare in timpul comunicarii cu vboxwebsrv. phpVirtualbox nu va mai trimite petitii pana cand eroarea nu va fi corectata si pagina reincarcata. Detaliile acestei erori de conexiune vor fi afisate intr-o casuta de dialog ulterioara.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Nu se poate recupera si afisa proprietatile clientului. Asigurati-va ca masina virtuala este pornita si ca VirtualBox Guest Additions sunt instalate.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>A aparut o eroare in timpul obtinerii listei cu masini virtuale inregistrate in VirtualBox. Asigurati-va ca vboxwebsrv este in functiune si setarile din config.php sunt correcte.&lt;p&gt;Lista de masini virtuale nu se actualizeaza automat pana cand pagina nu este reincarcata.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Lista de servere</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Consola</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Incarcare ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Schimba parola</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Iesire - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Stop</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Manual de utilizare VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>Despre</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Salvare stare</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Oprire</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Nume utilizator</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Parola</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Conectare la %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Conectat la %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Dimensiune desktop</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Conectare</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>Separa</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Deconectare</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Trimiteti Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Motivul deconectarii</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirectionat de %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>Masina virtuala nu este in functiune sau nu este configurata pentru a acepta conexiuni RDP.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Hosting</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Adaptoarele de retea ale clientilor</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>Conectat</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>Neconectat</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>La fiecare %1 secunde</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>Deschide in fereastra noua</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Utilizatori</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Utilizator</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Administrator</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Poate administra utilizatorii</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Adauga utilizator</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Modificare utilizator</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Eliminare utilizator</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Deja exista un utilizator cu acelasi nume.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Sunteti sigur ca doriti sa eliminati acest utilizator &lt;b&gt;%1&lt;/b&gt;? Aceasta actiune este ireversibila.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Nume utilizator</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Parola</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Conectare</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Schimbati parola</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Parola anterioara</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Parola noua</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Parolele introduse nu coincid.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Parola schimbata.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Parola incorecta.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Introduceti din nou</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Nume de utilizator eronat sau parola incorecta.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Neconectat.</translation>
- </message>
- </context>
-</language>
-
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Atentie: Se proceseaza o operatiune interna in VirtualBox. Iesirea din aceasta fereastra poate avea consecinte nedorite si neasteptate. Va rugam sa asteptati terminarea operatiunii.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Operatiune anulata</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>A aparut o eroare in timpul comunicarii cu vboxwebsrv. phpVirtualbox nu va mai trimite petitii pana cand eroarea nu va fi corectata si pagina reincarcata. Detaliile acestei erori de conexiune vor fi afisate intr-o casuta de dialog ulterioara.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Nu se poate recupera si afisa proprietatile clientului. Asigurati-va ca masina virtuala este pornita si ca VirtualBox Guest Additions sunt instalate.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>A aparut o eroare in timpul obtinerii listei cu masini virtuale inregistrate in VirtualBox. Asigurati-va ca vboxwebsrv este in functiune si setarile din config.php sunt correcte.&lt;p&gt;Lista de masini virtuale nu se actualizeaza automat pana cand pagina nu este reincarcata.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Lista de servere</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Consola</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Incarcare ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Schimba parola</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Iesire - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Stop</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Manual de utilizare VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>Despre</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Salvare stare</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Oprire</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Nume utilizator</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Parola</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Conectare la %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Conectat la %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Dimensiune desktop</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Conectare</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>Separa</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Deconectare</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Trimiteti Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Motivul deconectarii</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirectionat de %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>Masina virtuala nu este in functiune sau nu este configurata pentru a acepta conexiuni RDP.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Hosting</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Adaptoarele de retea ale clientilor</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>Conectat</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>Neconectat</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>La fiecare %1 secunde</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>Deschide in fereastra noua</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Utilizatori</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Utilizator</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Administrator</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Poate administra utilizatorii</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Adauga utilizator</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Modificare utilizator</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Eliminare utilizator</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Deja exista un utilizator cu acelasi nume.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Sunteti sigur ca doriti sa eliminati acest utilizator &lt;b&gt;%1&lt;/b&gt;? Aceasta actiune este ireversibila.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Nume utilizator</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Parola</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Conectare</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Schimbati parola</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Parola anterioara</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Parola noua</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Parolele introduse nu coincid.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Parola schimbata.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Parola incorecta.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Introduceti din nou</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Nume de utilizator eronat sau parola incorecta.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Neconectat.</translation>
+ </message>
+ </context>
+</language>
+
diff --git a/languages/ru.xml b/languages/ru.xml
index c969092..a68f30a 100644
--- a/languages/ru.xml
+++ b/languages/ru.xml
@@ -1,254 +1,254 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>Внимание: VirtualBox занят. Если вы закроете это окно или уйдёте с этой веб-страницы, то это может привести к неизвестному результату. Пожалуйста, дождитесь окончания операции.</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>Действие отменено</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>Ошибка соединения с vboxwebsrv. phpVirtualBox не будет работать, пока ошибка не устранена или не обновлена страница. Подробности ошибки подключения в следующем диалоговом окне.</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>Невозможно получить свойства гостевой машины. Убедитесь, что машина запущена и установлены VirtualBox Guest Additions.</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>Ошибка получения списка виртуальных машин. Убедитесь, что vboxwebsrv запущен и параметры в config.php корректны.&lt;p&gt;Список виртуальных машин не будет автообновляться, пока вы не перезагрузите страницу.&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>Список серверов</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>Консоль</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>Загрузка...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>Изменить пароль</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>Выйти - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>Остановить</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>Справка VirtualBox</translation>
- </message>
- <message>
- <source>About</source>
- <translation>О программе</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>Сохранить состояние машины</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>Выключить машину</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>Имя пользователья</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Пароль</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>Подключаемся к %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>Подключено к %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>Разрешение экрана</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>Подключить</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>В отдельном окне</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>Отключить</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>Отправить Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>Причина отключения</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>Redirection by %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>Виртуальная машина не запущена или не настроен удалённый дисплей.</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>Хост</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>Гостевые сетевые адаптеры</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>включен</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>выключен</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>Каждые %1 секунд</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>В новом окне</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>Пользователи</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>Пользователи</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>Администратор</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>Может управлять пользователями</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>Добавить пользователя</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>Редактировать параметры пользователя</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>Удалить пользователя</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>Пользователь с такимименем уже существует.</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>Вы уверены, что хотите удалить пользователя &lt;b&gt;%1&lt;/b&gt;? Это действие не может быть отменено.</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>Имя пользователя</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>Пароль</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>Войти</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>Изменить пароль</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>Старый пароль</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>Новый пароль</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>Пароли не совпадают.</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>Пароль изменен.</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>Пароль, который выввели неверный.</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>Повторить пароль</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>Некорректное имя пользователя или пароль.</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>Вы не вошли в систему.</translation>
- </message>
- </context>
-</language>
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>Внимание: VirtualBox занят. Если вы закроете это окно или уйдёте с этой веб-страницы, то это может привести к неизвестному результату. Пожалуйста, дождитесь окончания операции.</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>Действие отменено</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>Ошибка соединения с vboxwebsrv. phpVirtualBox не будет работать, пока ошибка не устранена или не обновлена страница. Подробности ошибки подключения в следующем диалоговом окне.</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>Невозможно получить свойства гостевой машины. Убедитесь, что машина запущена и установлены VirtualBox Guest Additions.</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>Ошибка получения списка виртуальных машин. Убедитесь, что vboxwebsrv запущен и параметры в config.php корректны.&lt;p&gt;Список виртуальных машин не будет автообновляться, пока вы не перезагрузите страницу.&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>Список серверов</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>Консоль</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>Загрузка...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>Изменить пароль</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>Выйти - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>Остановить</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>Справка VirtualBox</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>О программе</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>Сохранить состояние машины</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>Выключить машину</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>Имя пользователья</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Пароль</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>Подключаемся к %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>Подключено к %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>Разрешение экрана</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>Подключить</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>В отдельном окне</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>Отключить</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>Отправить Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>Причина отключения</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>Redirection by %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>Виртуальная машина не запущена или не настроен удалённый дисплей.</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>Хост</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>Гостевые сетевые адаптеры</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>включен</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>выключен</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>Каждые %1 секунд</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>В новом окне</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>Пользователи</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>Пользователи</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>Администратор</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>Может управлять пользователями</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>Добавить пользователя</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>Редактировать параметры пользователя</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>Удалить пользователя</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>Пользователь с такимименем уже существует.</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>Вы уверены, что хотите удалить пользователя &lt;b&gt;%1&lt;/b&gt;? Это действие не может быть отменено.</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>Имя пользователя</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>Пароль</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>Войти</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>Изменить пароль</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>Старый пароль</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>Новый пароль</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>Пароли не совпадают.</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>Пароль изменен.</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>Пароль, который выввели неверный.</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>Повторить пароль</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>Некорректное имя пользователя или пароль.</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>Вы не вошли в систему.</translation>
+ </message>
+ </context>
+</language>
diff --git a/languages/zh_cn.xml b/languages/zh_cn.xml
index b318d37..0622b29 100644
--- a/languages/zh_cn.xml
+++ b/languages/zh_cn.xml
@@ -1,254 +1,254 @@
-<?xml version="1.0" encoding="utf-8"?>
-<language>
- <context>
- <name>phpVirtualBox</name>
- <message>
- <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
- <translation>警告:VirtualBox正在执行一个内部操作,关闭当前窗口可能会产生意想不到的错误,请等待当前操作完成。</translation>
- </message>
- <message>
- <source>Operation Canceled</source>
- <translation>操作已被取消</translation>
- </message>
- <message>
- <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
- <translation>与服务端通信失败,phpVirtualBox将不会响应您接下来的操作,请刷新当前页面。</translation>
- </message>
- <message>
- <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
- <translation>无法获得客户端信息,请确保客户端虚拟机正在运行。</translation>
- </message>
- <!-- Error vmlist 1 -->
- <message>
- <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
- <translation>在从VirtualBox中获取虚拟机列表时出现错误。请确保WEB服务端正在运行,并且config.php中的配置正确。&lt;p&gt;请重新装载该页,否则虚拟机列表中的信息将不会继续自动刷新&lt;/p&gt;</translation>
- </message>
- <message>
- <source>Server List</source>
- <translation>服务器列表</translation>
- </message>
- </context>
- <context>
- <name>UIVMDesktop</name>
- <message>
- <source>Console</source>
- <translation>终端</translation>
- </message>
- <message>
- <source>Loading ...</source>
- <translation>载入中 ...</translation>
- </message>
- </context>
- <context>
- <name>VBoxSelectorWnd</name>
- <message>
- <source>Change Password</source>
- <translation>更改密码</translation>
- </message>
- <message>
- <source>Log out - %1</source>
- <translation>登出 - %1</translation>
- </message>
- <message>
- <source>Logged in as %1</source>
- <translation>Logged in as %1</translation>
- </message>
- <message>
- <source>Stop</source>
- <translation>停止</translation>
- </message>
- <message>
- <source>VirtualBox User Manual</source>
- <translation>VirtualBox用户手册</translation>
- </message>
- <message>
- <source>About</source>
- <translation>关于</translation>
- </message>
- </context>
- <context>
- <name>UIActionsPool</name>
- <message>
- <source>Save State</source>
- <translation>保存状态</translation>
- </message>
- <message>
- <source>Power Off</source>
- <translation>关闭电源</translation>
- </message>
- </context>
- <context>
- <!-- Console Tab -->
- <name>VBoxConsoleWgt</name>
- <message>
- <source>User name</source>
- <translation>用户名</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>密码</translation>
- </message>
- <message>
- <source>Connecting to %1</source>
- <translation>连接到 a %1</translation>
- </message>
- <message>
- <source>Connected to %1</source>
- <translation>已连接至 %1</translation>
- </message>
- <message>
- <source>Requested desktop size</source>
- <translation>所请求的桌面大小</translation>
- </message>
- <message>
- <source>Connect</source>
- <translation>连接</translation>
- </message>
- <message>
- <source>Detach</source>
- <translation>分离</translation>
- </message>
- <message>
- <source>Disconnect</source>
- <translation>断开</translation>
- </message>
- <message>
- <source>Send Ctrl-Alt-Del</source>
- <translation>发送 Ctrl-Alt-Del</translation>
- </message>
- <message>
- <source>Disconnect reason</source>
- <translation>断开连接的原因</translation>
- </message>
- <message>
- <source>Redirection by %1</source>
- <translation>重定向至 %1</translation>
- </message>
- <message>
- <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
- <translation>虚拟机没有运行或者没有配置开启RDP连接。</translation>
- </message>
- </context>
- <context>
- <name>VBoxGlobal</name>
- <message>
- <source>Hosting</source>
- <translation>宿主机</translation>
- </message>
- <message>
- <source>Guest Network Adapters</source>
- <translation>客户机网络适配器</translation>
- </message>
- <message>
- <source>Up</source>
- <translation>上</translation>
- <comment>Host network adapter status</comment>
- </message>
- <message>
- <source>Down</source>
- <translation>下</translation>
- <comment>Host network adapter status</comment>
- </message>
- </context>
- <context>
- <name>UIVMPreviewWindow</name>
- <message>
- <source>Every %1 seconds</source>
- <translation>每 %1 秒</translation>
- </message>
- <message>
- <source>Open in new window</source>
- <translation>在新窗口中打开</translation>
- </message>
- </context>
- <context>
- <name>UISettingsDialogGlobal</name>
- <message>
- <source>Users</source>
- <translation>用户</translation>
- </message>
- </context>
- <context>
- <name>UIUsers</name>
- <message>
- <source>Users</source>
- <translation>用户</translation>
- </message>
- <message>
- <source>Admin User</source>
- <translation>管理员用户</translation>
- </message>
- <message>
- <source>Can administer users</source>
- <translation>可管理用户</translation>
- </message>
- <message>
- <source>Add User</source>
- <translation>添加用户</translation>
- </message>
- <message>
- <source>Edit User</source>
- <translation>编辑用户</translation>
- </message>
- <message>
- <source>Remove User</source>
- <translation>删除用户</translation>
- </message>
- <message>
- <source>A user with that username already exists.</source>
- <translation>用户名已经存在。</translation>
- </message>
- <message>
- <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
- <translation>你确定要删除用户 &lt;b&gt;%1&lt;/b&gt;?该操作不能被重置。</translation>
- </message>
- <message>
- <source>Username</source>
- <translation>用户名</translation>
- </message>
- <message>
- <source>Password</source>
- <translation>密码</translation>
- </message>
- <message>
- <source>Log in</source>
- <translation>登入</translation>
- </message>
- <message>
- <source>Change Password</source>
- <translation>更改密码</translation>
- </message>
- <message>
- <source>Old Password</source>
- <translation>原密码</translation>
- </message>
- <message>
- <source>New Password</source>
- <translation>新密码</translation>
- </message>
- <message>
- <source>The passwords you have entered do not match.</source>
- <translation>您输入的密码不相同。</translation>
- </message>
- <message>
- <source>Password changed.</source>
- <translation>密码已被更改。</translation>
- </message>
- <message>
- <source>The password you have entered is invalid.</source>
- <translation>密码错误。</translation>
- </message>
- <message>
- <source>Retype</source>
- <translation>重新输入</translation>
- </message>
- <message>
- <source>Invalid username or password.</source>
- <translation>错误的用户名或密码。</translation>
- </message>
- <message>
- <source>Not logged in.</source>
- <translation>还没有登入。</translation>
- </message>
- </context>
+<?xml version="1.0" encoding="utf-8"?>
+<language>
+ <context>
+ <name>phpVirtualBox</name>
+ <message>
+ <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source>
+ <translation>警告:VirtualBox正在执行一个内部操作,关闭当前窗口可能会产生意想不到的错误,请等待当前操作完成。</translation>
+ </message>
+ <message>
+ <source>Operation Canceled</source>
+ <translation>操作已被取消</translation>
+ </message>
+ <message>
+ <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source>
+ <translation>与服务端通信失败,phpVirtualBox将不会响应您接下来的操作,请刷新当前页面。</translation>
+ </message>
+ <message>
+ <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source>
+ <translation>无法获得客户端信息,请确保客户端虚拟机正在运行。</translation>
+ </message>
+ <!-- Error vmlist 1 -->
+ <message>
+ <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source>
+ <translation>在从VirtualBox中获取虚拟机列表时出现错误。请确保WEB服务端正在运行,并且config.php中的配置正确。&lt;p&gt;请重新装载该页,否则虚拟机列表中的信息将不会继续自动刷新&lt;/p&gt;</translation>
+ </message>
+ <message>
+ <source>Server List</source>
+ <translation>服务器列表</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIVMDesktop</name>
+ <message>
+ <source>Console</source>
+ <translation>终端</translation>
+ </message>
+ <message>
+ <source>Loading ...</source>
+ <translation>载入中 ...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxSelectorWnd</name>
+ <message>
+ <source>Change Password</source>
+ <translation>更改密码</translation>
+ </message>
+ <message>
+ <source>Log out - %1</source>
+ <translation>登出 - %1</translation>
+ </message>
+ <message>
+ <source>Logged in as %1</source>
+ <translation>Logged in as %1</translation>
+ </message>
+ <message>
+ <source>Stop</source>
+ <translation>停止</translation>
+ </message>
+ <message>
+ <source>VirtualBox User Manual</source>
+ <translation>VirtualBox用户手册</translation>
+ </message>
+ <message>
+ <source>About</source>
+ <translation>关于</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIActionsPool</name>
+ <message>
+ <source>Save State</source>
+ <translation>保存状态</translation>
+ </message>
+ <message>
+ <source>Power Off</source>
+ <translation>关闭电源</translation>
+ </message>
+ </context>
+ <context>
+ <!-- Console Tab -->
+ <name>VBoxConsoleWgt</name>
+ <message>
+ <source>User name</source>
+ <translation>用户名</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>密码</translation>
+ </message>
+ <message>
+ <source>Connecting to %1</source>
+ <translation>连接到 a %1</translation>
+ </message>
+ <message>
+ <source>Connected to %1</source>
+ <translation>已连接至 %1</translation>
+ </message>
+ <message>
+ <source>Requested desktop size</source>
+ <translation>所请求的桌面大小</translation>
+ </message>
+ <message>
+ <source>Connect</source>
+ <translation>连接</translation>
+ </message>
+ <message>
+ <source>Detach</source>
+ <translation>分离</translation>
+ </message>
+ <message>
+ <source>Disconnect</source>
+ <translation>断开</translation>
+ </message>
+ <message>
+ <source>Send Ctrl-Alt-Del</source>
+ <translation>发送 Ctrl-Alt-Del</translation>
+ </message>
+ <message>
+ <source>Disconnect reason</source>
+ <translation>断开连接的原因</translation>
+ </message>
+ <message>
+ <source>Redirection by %1</source>
+ <translation>重定向至 %1</translation>
+ </message>
+ <message>
+ <source>Virtual machine is not running or is not configured to accept RDP connections.</source>
+ <translation>虚拟机没有运行或者没有配置开启RDP连接。</translation>
+ </message>
+ </context>
+ <context>
+ <name>VBoxGlobal</name>
+ <message>
+ <source>Hosting</source>
+ <translation>宿主机</translation>
+ </message>
+ <message>
+ <source>Guest Network Adapters</source>
+ <translation>客户机网络适配器</translation>
+ </message>
+ <message>
+ <source>Up</source>
+ <translation>上</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ <message>
+ <source>Down</source>
+ <translation>下</translation>
+ <comment>Host network adapter status</comment>
+ </message>
+ </context>
+ <context>
+ <name>UIVMPreviewWindow</name>
+ <message>
+ <source>Every %1 seconds</source>
+ <translation>每 %1 秒</translation>
+ </message>
+ <message>
+ <source>Open in new window</source>
+ <translation>在新窗口中打开</translation>
+ </message>
+ </context>
+ <context>
+ <name>UISettingsDialogGlobal</name>
+ <message>
+ <source>Users</source>
+ <translation>用户</translation>
+ </message>
+ </context>
+ <context>
+ <name>UIUsers</name>
+ <message>
+ <source>Users</source>
+ <translation>用户</translation>
+ </message>
+ <message>
+ <source>Admin User</source>
+ <translation>管理员用户</translation>
+ </message>
+ <message>
+ <source>Can administer users</source>
+ <translation>可管理用户</translation>
+ </message>
+ <message>
+ <source>Add User</source>
+ <translation>添加用户</translation>
+ </message>
+ <message>
+ <source>Edit User</source>
+ <translation>编辑用户</translation>
+ </message>
+ <message>
+ <source>Remove User</source>
+ <translation>删除用户</translation>
+ </message>
+ <message>
+ <source>A user with that username already exists.</source>
+ <translation>用户名已经存在。</translation>
+ </message>
+ <message>
+ <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source>
+ <translation>你确定要删除用户 &lt;b&gt;%1&lt;/b&gt;?该操作不能被重置。</translation>
+ </message>
+ <message>
+ <source>Username</source>
+ <translation>用户名</translation>
+ </message>
+ <message>
+ <source>Password</source>
+ <translation>密码</translation>
+ </message>
+ <message>
+ <source>Log in</source>
+ <translation>登入</translation>
+ </message>
+ <message>
+ <source>Change Password</source>
+ <translation>更改密码</translation>
+ </message>
+ <message>
+ <source>Old Password</source>
+ <translation>原密码</translation>
+ </message>
+ <message>
+ <source>New Password</source>
+ <translation>新密码</translation>
+ </message>
+ <message>
+ <source>The passwords you have entered do not match.</source>
+ <translation>您输入的密码不相同。</translation>
+ </message>
+ <message>
+ <source>Password changed.</source>
+ <translation>密码已被更改。</translation>
+ </message>
+ <message>
+ <source>The password you have entered is invalid.</source>
+ <translation>密码错误。</translation>
+ </message>
+ <message>
+ <source>Retype</source>
+ <translation>重新输入</translation>
+ </message>
+ <message>
+ <source>Invalid username or password.</source>
+ <translation>错误的用户名或密码。</translation>
+ </message>
+ <message>
+ <source>Not logged in.</source>
+ <translation>还没有登入。</translation>
+ </message>
+ </context>
</language> \ No newline at end of file
diff --git a/languages/zh_tw.xml b/languages/zh_tw.xml
index 6781e2e..10ad752 100644
--- a/languages/zh_tw.xml
+++ b/languages/zh_tw.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?> <language>
- <context>
- <name>phpVirtualBox</name>
+<?xml version="1.0" encoding="utf-8"?> <language>
+ <context>
+ <name>phpVirtualBox</name>
<message> <source>Warning: A VirtualBox internal operation is in progress. Closing this window or navigating away from this web page may cause unexpected and undesirable results. Please wait for the operation to complete.</source> <translation>警告: VirtualBox 正在執行一個內部指令, 關閉本視窗可能會產生無法預期的錯誤, 請等待指令執行完成.</translation> </message> <message> <source>Operation Canceled</source> <translation>指令已被取消</translation> </message> <message> <source>An error occurred communicating with your vboxwebsrv. No more requests will be sent by phpVirtualBox until the error is corrected and this page is refreshed. The details of this connection error should be displayed in a subsequent dialog box.</source> <translation>與 vboxwebsrv 服務端通信失敗. 在錯誤修正與此頁面更新前, phpVirtualBox 將不會回應您接下來的操作. 詳細的錯誤資訊可以由後續的對話視窗中得知.</translation> </message> <message> <source>Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.</source> <translation>無法取得虛擬機器資料, 請確認該虛擬機器正在執行中且已安裝 VirtualBox Guest Additions 軟體.</translation> </message> <!-- Error vmlist 1 --> <message> <source>There was an error obtaining the list of registered virtual machines from VirtualBox. Make sure vboxwebsrv is running and that the settings in config.php are correct.&lt;p&gt;The list of virtual machines will not begin auto-refreshing again until this page is reloaded.&lt;/p&gt;</source> <translation>由 VirtualBox 讀取虛擬機器清單時出現錯誤. 請確認 vboxwebsrv 執行中, 並且在 config.php 中的設置正確. &lt;p&gt;錯誤發生後, 虛擬機器清單的資料將不會再自動更新. 修正錯誤後請重新載入本頁.&lt;/p&gt;</translation> </message> <message> <source>Server List</source> <translation>虛擬機器清單</translation> </message> </context> <context> <name>UIVMDesktop</name> <message> <source>Console</source> <translation>執行畫面</translation> </message> <message> <source>Loading ...</source> <translation>載入中 ...</translation> </message> </context> <context> <name>VBoxSelectorWnd</name> <message> <source>Change Password</source> <translation>變更密碼</translation> </message> <message> <source>Log out - %1</source> <translation>登出 - %1</translation> </message> <message> <source>Logged in as %1</source> <translation>Logged in as %1</translation> </message> <message> <source>Stop</source> <translation>停止</translation> </message> <message> <source>VirtualBox User Manual</source> <translation>VirtualBox 用戶手冊</translation> </message> <message> <source>About</source> <translation>關於</translation> </message> </context> <context> <name>UIActionsPool</name> <message> <source>Save State</source> <translation>儲存狀態</translation> </message> <message> <source>Power Off</source> <translation>關閉電源</translation> </message> </context> <context> <!-- Console Tab --> <name>VBoxConsoleWgt</name> <message> <source>User name</source> <translation>使用者名稱</translation> </message> <message> <source>Password</source> <translation>密碼</translation> </message> <message> <source>Connecting to %1</source> <translation>連線到 %1</translation> </message> <message> <source>Connected to %1</source> <translation>已連線到 %1</translation> </message> <message> <source>Requested desktop size</source> <translation>所請求的畫面大小</translation> </message> <message> <source>Connect</source> <translation>連線</translation> </message> <message> <source>Detach</source> <translation>分離</translation> </message> <message> <source>Disconnect</source> <translation>中斷連線</translation> </message> <message> <source>Send Ctrl-Alt-Del</source> <translation>送出 Ctrl-Alt-Del</translation> </message> <message> <source>Disconnect reason</source> <translation>連線中斷的原因</translation> </message> <message> <source>Redirection by %1</source> <translation>重新連到 %1</translation> </message> <message> <source>Virtual machine is not running or is not configured to accept RDP connections.</source> <translation>虛擬機器沒有執行或者沒有設置允許 RDP 連線.</translation> </message> </context> <context> <name>VBoxGlobal</name> <message> <source>Hosting</source> <translation>主機</translation> </message> <message> <source>Guest Network Adapters</source> <translation>虛擬機器網絡介面卡</translation> </message> <message> <source>Up</source> <translation>往上</translation> <comment>Host network adapter status</comment> </message> <message> <source>Down</source> <translation>往下</translation> <comment>Host network adapter status</comment> </message> </context> <context> <name>UIVMPreviewWindow</name> <message> <source>Every %1 seconds</source> <translation>每 %1 秒</translation> </message> <message> <source>Open in new window</source> <translation>在新視窗中打開</translation> </message> </context> <context> <name>UISettingsDialogGlobal</name> <message> <source>Users</source> <translation>使用者</translation> </message> </context> <context> <name>UIUsers</name> <message> <source>Users</source> <translation>使用者</translation> </message> <message> <source>Admin User</source> <translation>管理員</translation> </message> <message> <source>Can administer users</source> <translation>可管理使用者</translation> </message> <message> <source>Add User</source> <translation>添加使用者</translation> </message> <message> <source>Edit User</source> <translation>編輯使用者</translation> </message> <message> <source>Remove User</source> <translation>刪除使用者</translation> </message> <message> <source>A user with that username already exists.</source> <translation>這名稱的使用者已經存在.</translation> </message> <message> <source>Are you sure you want to remove the user &lt;b&gt;%1&lt;/b&gt;? This action cannot be undone.</source> <translation>你確定要刪除使用者 &lt;b&gt;%1&lt;/b&gt;? 這個動作無法被回復.</translation> </message> <message> <source>Username</source> <translation>使用者名稱</translation> </message> <message> <source>Password</source> <translation>密碼</translation> </message> <message> <source>Log in</source> <translation>登入</translation> </message> <message> <source>Change Password</source> <translation>變更密碼</translation> </message> <message> <source>Old Password</source> <translation>目前密碼</translation> </message> <message> <source>New Password</source> <translation>新密碼</translation> </message> <message> <source>The passwords you have entered do not match.</source> <translation>您輸入的密碼不相同.</translation> </message> <message> <source>Password changed.</source> <translation>密碼已被更改.</translation> </message> <message> <source>The password you have entered is invalid.</source> <translation>密碼錯誤.</translation> </message> <message> <source>Retype</source> <translation>重新輸入</translation> </message> <message> <source>Invalid username or password.</source> <translation>錯誤的使用者名稱或密碼.</translation> </message> <message> <source>Not logged in.</source> <translation>還沒有登入.</translation> </message> </context> </language> \ No newline at end of file
diff --git a/panes/about.html b/panes/about.html
index 1982e15..fb035ab 100644
--- a/panes/about.html
+++ b/panes/about.html
@@ -1,19 +1,19 @@
-<!-- $Id: about.html 595 2015-04-17 09:50:36Z imoore76 $ -->
-<div style='text-align: center'>
-<h3 align='center' id='vboxAboutHeader'>phpVirtualBox X -/- VirtualBox X compatible</h3>
-<p style='text-align: center'>Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com) - <a href='LICENSE.txt' target='_new'>LICENSE</a></p>
-<p style='text-align: center'><a target='_blank' href='http://sourceforge.net/projects/phpvirtualbox/'>http://sourceforge.net/projects/phpvirtualbox/</a></p>
-<p style='text-align: left'>
-I develop and support phpVirtualBox in my spare time - free of charge. I do not receive payments from VirtualBox (Oracle) nor am
-I affiliated with them in any way. If you find this program useful, I ask that you please donate.
-</p>
-<p align=center>
-<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UB2BVHBDUJ2D2' target=_blank><img src='images/donate.gif' style='border: 0px;'></a>
-</p>
-<div style='margin-top: 10px; border-top: 1px solid #000;' id='vboxAboutVbox'><p>VirtualBox</p>
- <script type='text/javascript'>
- $('#vboxAboutHeader').html('phpVirtualBox '+$('#vboxPane').data('vboxConfig').phpvboxver+' -/- VirtualBox '+$('#vboxPane').data('vboxConfig').phpvboxver.substring(0,$('#vboxPane').data('vboxConfig').phpvboxver.indexOf('-'))+'.x compatible');
- $('#vboxAboutVbox').html('Virtual Box '+$('#vboxPane').data('vboxConfig').version.string+' ('+$('#vboxPane').data('vboxConfig').version.revision+')<br />' + $('#vboxPane').data('vboxConfig').version.settingsFilePath);
- </script>
-</div>
+<!-- $Id: about.html 595 2015-04-17 09:50:36Z imoore76 $ -->
+<div style='text-align: center'>
+<h3 align='center' id='vboxAboutHeader'>phpVirtualBox X -/- VirtualBox X compatible</h3>
+<p style='text-align: center'>Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com) - <a href='LICENSE.txt' target='_new'>LICENSE</a></p>
+<p style='text-align: center'><a target='_blank' href='http://sourceforge.net/projects/phpvirtualbox/'>http://sourceforge.net/projects/phpvirtualbox/</a></p>
+<p style='text-align: left'>
+I develop and support phpVirtualBox in my spare time - free of charge. I do not receive payments from VirtualBox (Oracle) nor am
+I affiliated with them in any way. If you find this program useful, I ask that you please donate.
+</p>
+<p align=center>
+<a href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UB2BVHBDUJ2D2' target=_blank><img src='images/donate.gif' style='border: 0px;'></a>
+</p>
+<div style='margin-top: 10px; border-top: 1px solid #000;' id='vboxAboutVbox'><p>VirtualBox</p>
+ <script type='text/javascript'>
+ $('#vboxAboutHeader').html('phpVirtualBox '+$('#vboxPane').data('vboxConfig').phpvboxver+' -/- VirtualBox '+$('#vboxPane').data('vboxConfig').phpvboxver.substring(0,$('#vboxPane').data('vboxConfig').phpvboxver.indexOf('-'))+'.x compatible');
+ $('#vboxAboutVbox').html('Virtual Box '+$('#vboxPane').data('vboxConfig').version.string+' ('+$('#vboxPane').data('vboxConfig').version.revision+')<br />' + $('#vboxPane').data('vboxConfig').version.settingsFilePath);
+ </script>
+</div>
</div> \ No newline at end of file
diff --git a/panes/chooser.html b/panes/chooser.html
index 765d42d..dd33010 100644
--- a/panes/chooser.html
+++ b/panes/chooser.html
@@ -1,96 +1,96 @@
-<!--
-
- Virtual Machine List
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: chooser.html 595 2015-04-17 09:50:36Z imoore76 $
-
- @see js/chooser.js
-
- -->
-<div id='vboxChooserDiv'></div>
-<script type='text/javascript'>
-
-
-/*
- *
- *
- * Startup for VM List
- *
- */
-
-vboxChooser.setAnchorId('vboxChooserDiv');
-
-// Stop actions
-var sChildren = [];
-for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
- sChildren[sChildren.length] = $.extend(true,{},vboxVMActions[vboxVMActions.stop_actions[i]],{'iconStringDisabled':'_disabled'});
-}
-
-// VM List Group context menu
-vboxChooser.setContextMenu('group', [
- vboxVMGroupActions['newmachine'],
- vboxVMGroupActions['addmachine'],
- $.extend({}, vboxVMGroupActions['rename'], {separator: true}),
- vboxVMGroupActions['ungroup'],
- $.extend({}, vboxVMActions['start'], {'separator' : true}),
- vboxVMActions['pause'],
- vboxVMActions['reset'],
- $.extend({},vboxVMActions['stop'], {'children':sChildren}),
- $.extend({},vboxVMActions['discard'], {separator: true}),
- vboxVMActions['refresh'],
- $.extend({}, vboxVMGroupActions['sort'], {separator:true}),
-]);
-
-
-/*
- * VM Context menu setup (menu per VM in list)
- */
-
-vboxChooser.setContextMenu('vm',[
- vboxVMActions['settings'],
- vboxVMActions['clone'],
- vboxVMActions['remove'],
- vboxVMActions['group'],
- $.extend({},vboxVMActions['start'], {'separator' : true}),
- vboxVMActions['pause'],
- vboxVMActions['reset'],
- $.extend({},vboxVMActions['stop'], {'children': sChildren}),
- $.extend({},vboxVMActions['discard'], {'separator' : true}),
- vboxVMActions['logs'],
- vboxVMActions['refresh']
-]);
-
-// Don't need thse anymore
-sChildren = null;
-
-/*
- * VM list context menu setup
- */
-vboxChooser.setContextMenu('anchor', [
- vboxVMActions['new'],
- vboxVMActions['add'],
- {
- 'name':'fileImport',
- 'label':'Import Appliance...',
- 'icon':'import',
- 'click':function(){
- new vboxWizardImportApplianceDialog().run();
- },
- 'separator': true
- },
- {
- 'name':'fileExport',
- 'label':'Export Appliance...',
- 'icon':'export',
- 'click':function(){new vboxWizardExportApplianceDialog().run(); }
- },
- $.extend({},vboxVMGroupActions['sort'],{'separator':true,click:function(){
- vboxChooser.sortSelectedGroup(true);
- }})
-]);
-
-
-vboxChooser.start();
-
-</script>
+<!--
+
+ Virtual Machine List
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: chooser.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ @see js/chooser.js
+
+ -->
+<div id='vboxChooserDiv'></div>
+<script type='text/javascript'>
+
+
+/*
+ *
+ *
+ * Startup for VM List
+ *
+ */
+
+vboxChooser.setAnchorId('vboxChooserDiv');
+
+// Stop actions
+var sChildren = [];
+for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
+ sChildren[sChildren.length] = $.extend(true,{},vboxVMActions[vboxVMActions.stop_actions[i]],{'iconStringDisabled':'_disabled'});
+}
+
+// VM List Group context menu
+vboxChooser.setContextMenu('group', [
+ vboxVMGroupActions['newmachine'],
+ vboxVMGroupActions['addmachine'],
+ $.extend({}, vboxVMGroupActions['rename'], {separator: true}),
+ vboxVMGroupActions['ungroup'],
+ $.extend({}, vboxVMActions['start'], {'separator' : true}),
+ vboxVMActions['pause'],
+ vboxVMActions['reset'],
+ $.extend({},vboxVMActions['stop'], {'children':sChildren}),
+ $.extend({},vboxVMActions['discard'], {separator: true}),
+ vboxVMActions['refresh'],
+ $.extend({}, vboxVMGroupActions['sort'], {separator:true}),
+]);
+
+
+/*
+ * VM Context menu setup (menu per VM in list)
+ */
+
+vboxChooser.setContextMenu('vm',[
+ vboxVMActions['settings'],
+ vboxVMActions['clone'],
+ vboxVMActions['remove'],
+ vboxVMActions['group'],
+ $.extend({},vboxVMActions['start'], {'separator' : true}),
+ vboxVMActions['pause'],
+ vboxVMActions['reset'],
+ $.extend({},vboxVMActions['stop'], {'children': sChildren}),
+ $.extend({},vboxVMActions['discard'], {'separator' : true}),
+ vboxVMActions['logs'],
+ vboxVMActions['refresh']
+]);
+
+// Don't need thse anymore
+sChildren = null;
+
+/*
+ * VM list context menu setup
+ */
+vboxChooser.setContextMenu('anchor', [
+ vboxVMActions['new'],
+ vboxVMActions['add'],
+ {
+ 'name':'fileImport',
+ 'label':'Import Appliance...',
+ 'icon':'import',
+ 'click':function(){
+ new vboxWizardImportApplianceDialog().run();
+ },
+ 'separator': true
+ },
+ {
+ 'name':'fileExport',
+ 'label':'Export Appliance...',
+ 'icon':'export',
+ 'click':function(){new vboxWizardExportApplianceDialog().run(); }
+ },
+ $.extend({},vboxVMGroupActions['sort'],{'separator':true,click:function(){
+ vboxChooser.sortSelectedGroup(true);
+ }})
+]);
+
+
+vboxChooser.start();
+
+</script>
diff --git a/panes/guestNetAdapters.html b/panes/guestNetAdapters.html
index e13e048..bcf2be7 100644
--- a/panes/guestNetAdapters.html
+++ b/panes/guestNetAdapters.html
@@ -1,113 +1,113 @@
-<!--
-
- Shows guest networking adapters. This requires that Guest Additions be
- installed in the Guest VM
-
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: guestNetAdapters.html 595 2015-04-17 09:50:36Z imoore76 $
-
--->
-<div id='vboxGuestNetAdapters'>
-
-</div>
-<!-- Used as a Template -->
-<div id='vboxGuestNetAdapterTemplate' class='vboxDialogContent vboxTabContent' style='display: none'>
- <table class="vboxVertical">
- <tr>
- <th><span class='translate'>IPv4 Address</span>:</th>
- <td><span title='/V4/IP'></span></td>
- </tr>
- <tr>
- <th><span class='translate'>IPv4 Network Mask</span>:</th>
- <td><span title='/V4/Netmask'></span></td>
- </tr>
- <tr class='vboxIPv6' style='display: none'>
- <th><span class='translate'>IPv6 Address</span>:</th>
- <td><span title='/V6/Ip'></span></td>
- </tr>
- <tr class='vboxIPv6' style='display: none'>
- <th><span class='translate'>IPv6 Network Mask Length</span>:</th>
- <td><span title='/V6/Netmask'></span></td>
- </tr>
- <tr>
- <th><span class='vboxGuestMac'>MAC Address:</span></th>
- <td><span title='/MAC'></span></td>
- </tr>
- </table>
-</div>
-
-<script type='text/javascript'>
-
-/* Translate */
-// Mac is special
-$('#vboxGuestNetAdapterTemplate').find('span.vboxGuestMac').html(trans('Mac Address:','UIMachineSettingsNetwork'));
-
-$('#vboxGuestNetAdapterTemplate').find(".translate").html(function(i,h){return trans(h,'UIGlobalSettingsNetwork');}).removeClass('translate');
-
-/*
- * Get data and pass to init function
- */
-function vboxVMNetAdaptersInit(vm) {
-
- // Add spinner and remove tab list if it exists
- $('#vboxGuestNetAdapterList').remove();
- $('#vboxGuestNetAdapters').prepend("<div class='vboxTabLoading'><img src='images/spinner.gif'></div>");
-
- var pattern = '/VirtualBox/GuestInfo/Net/*';
- $.when(vboxAjaxRequest('machineEnumerateGuestProperties',{'vm':vm,'pattern':pattern})).done(function(d){
- vboxVMNetAdaptersDisplay(d.responseData);
- });
-}
-
-function vboxVMNetAdaptersDisplay(d) {
-
- // Create hash / assoc array / mapping
- var data = {};
- for(var a = 0; a < d[0].length; a++) {
- data[d[0][a].replace('/VirtualBox/GuestInfo/Net/','')] = d[1][a];
- }
-
- // Remove spinner
- $('#vboxGuestNetAdapters').children().first().remove();
-
- // Append tab list
- var adl = $('<div />').attr({'id':'vboxGuestNetAdapterList','class':'vboxTabbed'});
-
- // Check for data
- if(!data['Count'] || data['Count'] < 1) {
- $(adl).html(trans('Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.','phpVirtualBox'));
- $('#vboxGuestNetAdapters').prepend(adl);
- return;
- }
-
- // Create list
- var ul = $('<ul />');
-
- // Each net adapter
- for(var i = 0; i < data['Count']; i++) {
-
- // Tab link
- $(ul).append($('<li />').html('<a href="#vboxGuestNetAdapter' + (i + 1) +'"><span>' + trans('Adapter %1','VBoxGlobal').replace('%1',(i + 1)) + '</span></a>'));
-
- // Tab content
- var tmpl = $("#vboxGuestNetAdapterTemplate").clone(true);
- tmpl.find('span[title]').each(function(){
- $(this).html(data[i+$(this).attr('title')]);
- });
- $(tmpl).attr('id','vboxGuestNetAdapter'+(i+1)).css({'display':''}).appendTo(adl);
-
- }
-
- // Tab links UL
- $(adl).prepend(ul);
-
- // prepend tabs
- $("#vboxGuestNetAdapters").prepend(adl);
-
- // Init display
- vboxInitDisplay('vboxGuestNetAdapters');
-
-}
-
-</script>
+<!--
+
+ Shows guest networking adapters. This requires that Guest Additions be
+ installed in the Guest VM
+
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: guestNetAdapters.html 595 2015-04-17 09:50:36Z imoore76 $
+
+-->
+<div id='vboxGuestNetAdapters'>
+
+</div>
+<!-- Used as a Template -->
+<div id='vboxGuestNetAdapterTemplate' class='vboxDialogContent vboxTabContent' style='display: none'>
+ <table class="vboxVertical">
+ <tr>
+ <th><span class='translate'>IPv4 Address</span>:</th>
+ <td><span title='/V4/IP'></span></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>IPv4 Network Mask</span>:</th>
+ <td><span title='/V4/Netmask'></span></td>
+ </tr>
+ <tr class='vboxIPv6' style='display: none'>
+ <th><span class='translate'>IPv6 Address</span>:</th>
+ <td><span title='/V6/Ip'></span></td>
+ </tr>
+ <tr class='vboxIPv6' style='display: none'>
+ <th><span class='translate'>IPv6 Network Mask Length</span>:</th>
+ <td><span title='/V6/Netmask'></span></td>
+ </tr>
+ <tr>
+ <th><span class='vboxGuestMac'>MAC Address:</span></th>
+ <td><span title='/MAC'></span></td>
+ </tr>
+ </table>
+</div>
+
+<script type='text/javascript'>
+
+/* Translate */
+// Mac is special
+$('#vboxGuestNetAdapterTemplate').find('span.vboxGuestMac').html(trans('Mac Address:','UIMachineSettingsNetwork'));
+
+$('#vboxGuestNetAdapterTemplate').find(".translate").html(function(i,h){return trans(h,'UIGlobalSettingsNetwork');}).removeClass('translate');
+
+/*
+ * Get data and pass to init function
+ */
+function vboxVMNetAdaptersInit(vm) {
+
+ // Add spinner and remove tab list if it exists
+ $('#vboxGuestNetAdapterList').remove();
+ $('#vboxGuestNetAdapters').prepend("<div class='vboxTabLoading'><img src='images/spinner.gif'></div>");
+
+ var pattern = '/VirtualBox/GuestInfo/Net/*';
+ $.when(vboxAjaxRequest('machineEnumerateGuestProperties',{'vm':vm,'pattern':pattern})).done(function(d){
+ vboxVMNetAdaptersDisplay(d.responseData);
+ });
+}
+
+function vboxVMNetAdaptersDisplay(d) {
+
+ // Create hash / assoc array / mapping
+ var data = {};
+ for(var a = 0; a < d[0].length; a++) {
+ data[d[0][a].replace('/VirtualBox/GuestInfo/Net/','')] = d[1][a];
+ }
+
+ // Remove spinner
+ $('#vboxGuestNetAdapters').children().first().remove();
+
+ // Append tab list
+ var adl = $('<div />').attr({'id':'vboxGuestNetAdapterList','class':'vboxTabbed'});
+
+ // Check for data
+ if(!data['Count'] || data['Count'] < 1) {
+ $(adl).html(trans('Unable to retrieve guest properties. Make sure the virtual machine is running and has the VirtualBox Guest Additions installed.','phpVirtualBox'));
+ $('#vboxGuestNetAdapters').prepend(adl);
+ return;
+ }
+
+ // Create list
+ var ul = $('<ul />');
+
+ // Each net adapter
+ for(var i = 0; i < data['Count']; i++) {
+
+ // Tab link
+ $(ul).append($('<li />').html('<a href="#vboxGuestNetAdapter' + (i + 1) +'"><span>' + trans('Adapter %1','VBoxGlobal').replace('%1',(i + 1)) + '</span></a>'));
+
+ // Tab content
+ var tmpl = $("#vboxGuestNetAdapterTemplate").clone(true);
+ tmpl.find('span[title]').each(function(){
+ $(this).html(data[i+$(this).attr('title')]);
+ });
+ $(tmpl).attr('id','vboxGuestNetAdapter'+(i+1)).css({'display':''}).appendTo(adl);
+
+ }
+
+ // Tab links UL
+ $(adl).prepend(ul);
+
+ // prepend tabs
+ $("#vboxGuestNetAdapters").prepend(adl);
+
+ // Init display
+ vboxInitDisplay('vboxGuestNetAdapters');
+
+}
+
+</script>
diff --git a/panes/login.html b/panes/login.html
index 4c54ead..0888bc6 100644
--- a/panes/login.html
+++ b/panes/login.html
@@ -1,37 +1,37 @@
-<!--
- Login dialog
-
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: login.html 595 2015-04-17 09:50:36Z imoore76 $
--->
-<div id='vboxLogin'>
-<form>
-<table class='vboxVertical' style='margin:0px;'>
-<tr>
- <th><span class='translate'>Username</span>:</th>
- <td><input type='text' name='username' class='vboxText' /></td>
-</tr>
-<tr>
- <th><span class='translate'>Password</span>:</th>
- <td><input type='password' name='password' class='vboxText' /></td>
-</tr>
-<tr id='vboxLoginBtnRow' style='display:none;padding:0px;margin:0px;border:0px;'>
- <th style='padding:0px;margin:0px;border:0px'></th>
- <td style='padding:0px;margin:0px;border:0px'><input type='submit' value='' style='border:0px;margin:0px;display:inline;background:#fff;text:#fff;padding:0px;height:1px;' /></td>
-</tr>
-</table>
-</form>
-</div>
-<script type='text/javascript'>
-
-$('#vboxLogin').find(".translate").html(function(i,h){return trans(h,'UIUsers');}).removeClass('translate');
-
-if($.browser.msie || $.browser.webkit) $('#vboxLoginBtnRow').css({'display':''});
-$('#vboxLogin form').on('submit', function(e) {
- $('#vboxLogin').dialog( "option", "buttons" )[trans('Log in','UIUsers')]();
- e.stopPropagation();
- e.preventDefault();
- return false;
-});
+<!--
+ Login dialog
+
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: login.html 595 2015-04-17 09:50:36Z imoore76 $
+-->
+<div id='vboxLogin'>
+<form>
+<table class='vboxVertical' style='margin:0px;'>
+<tr>
+ <th><span class='translate'>Username</span>:</th>
+ <td><input type='text' name='username' class='vboxText' /></td>
+</tr>
+<tr>
+ <th><span class='translate'>Password</span>:</th>
+ <td><input type='password' name='password' class='vboxText' /></td>
+</tr>
+<tr id='vboxLoginBtnRow' style='display:none;padding:0px;margin:0px;border:0px;'>
+ <th style='padding:0px;margin:0px;border:0px'></th>
+ <td style='padding:0px;margin:0px;border:0px'><input type='submit' value='' style='border:0px;margin:0px;display:inline;background:#fff;text:#fff;padding:0px;height:1px;' /></td>
+</tr>
+</table>
+</form>
+</div>
+<script type='text/javascript'>
+
+$('#vboxLogin').find(".translate").html(function(i,h){return trans(h,'UIUsers');}).removeClass('translate');
+
+if($.browser.msie || $.browser.webkit) $('#vboxLoginBtnRow').css({'display':''});
+$('#vboxLogin form').on('submit', function(e) {
+ $('#vboxLogin').dialog( "option", "buttons" )[trans('Log in','UIUsers')]();
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
+});
</script> \ No newline at end of file
diff --git a/panes/settingsAudio.html b/panes/settingsAudio.html
index 64be7b3..1985778 100644
--- a/panes/settingsAudio.html
+++ b/panes/settingsAudio.html
@@ -1,117 +1,117 @@
-<!--
-
- Audio Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsAudio.html 597 2015-04-20 11:41:28Z imoore76 $
-
--->
-<table class='vboxVertical'>
- <tr>
- <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsAudioEnabled' /> <span class='translate'>Enable Audio</span></label></td>
- </tr>
- <tr>
- <th><span class='translate'>Host Audio Driver:</span></th>
- <td>
- <select name='vboxSettingsAudioDriver'>
- </select>
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Audio Controller:</span></th>
- <td>
- <select name='vboxSettingsAudioController'>
- </select>
- </td>
- </tr>
-</table>
-<script type='text/javascript'>
-
-/* Audio */
-
-/*
- *
- * Static Audio Drivers
- *
- */
-// Not sure if mac returns 'mac' or 'macintosh' or 'apple' for OS name
-// Not sure if solaris returns 'solaris' or 'sun' for OS name
-// Using just the first letter should take care of this
-var vboxSettingsAudioDrivers = {
- 'w' : ['Null','WinMM','DirectSound'], // windows
- 'l' : ['Null','OSS','ALSA','Pulse'], // linux
- 'd' : ['Null','CoreAudio'], // darwin
- 'm' : ['Null','CoreAudio'], // mac
- 'a' : ['Null','CoreAudio'], // apple
- 'o' : ['Null','CoreAudio'], // os x
- 's' : ['Null','SolAudio'] // solaris / sun
-};
-
-
-/* Disable non-editable items when VM is running */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /*
- * Load audio controller types
- */
-
- var ad = $('#vboxSettingsDialog').data('vboxAudioControllerTypes');
-
- // Failsafe
- if(!ad) ad = [];
- if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController, ad) < 0)
- ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController;
-
- // clear options first
- document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length = 0;
-
- for(var i = 0; i < ad.length; i++) {
- var opt = new Option(trans(vboxAudioController(ad[i]),'VBoxGlobal'),ad[i]);
- document.forms['frmVboxSettings'].vboxSettingsAudioController.options[document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length] = opt;
- }
-
-
- /*
- * Load audio driver types
- */
- var ad = vboxSettingsAudioDrivers[$('#vboxSettingsDialog').data('vboxHostDetails').operatingSystem.toLowerCase().substring(0,1)];
-
- // Failsafe
- if(!ad) {
- ad = [$('#vboxPane').data('vboxSystemProperties').defaultAudioDriver];
- }
- if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver, ad) < 0)
- ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver;
-
- for(var i = 0; i < ad.length; i++) {
- var opt = new Option(trans(vboxAudioDriver(ad[i]),'VBoxGlobal'),ad[i]);
- document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options[document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options.length] = opt;
- }
-
- $(document.forms['frmVboxSettings'].vboxSettingsAudioDriver).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver);
- $(document.forms['frmVboxSettings'].vboxSettingsAudioController).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController);
-
-
- var p = $(document.forms['frmVboxSettings'].vboxSettingsAudioController).closest('table');
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
- $(p).find('span').addClass('disabled');
- $(p).find('input,select,textarea').prop('disabled',true);
- } else {
- $(p).find('span').removeClass('disabled');
- $(p).find('input,select,textarea').prop('disabled',false);
- $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
- }
-});
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver = document.forms['frmVboxSettings'].vboxSettingsAudioDriver.value;
- $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController = document.forms['frmVboxSettings'].vboxSettingsAudioController.value;
- $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled = document.forms['frmVboxSettings'].vboxSettingsAudioEnabled.checked;
-
-});
-
-</script>
+<!--
+
+ Audio Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsAudio.html 597 2015-04-20 11:41:28Z imoore76 $
+
+-->
+<table class='vboxVertical'>
+ <tr>
+ <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsAudioEnabled' /> <span class='translate'>Enable Audio</span></label></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Host Audio Driver:</span></th>
+ <td>
+ <select name='vboxSettingsAudioDriver'>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Audio Controller:</span></th>
+ <td>
+ <select name='vboxSettingsAudioController'>
+ </select>
+ </td>
+ </tr>
+</table>
+<script type='text/javascript'>
+
+/* Audio */
+
+/*
+ *
+ * Static Audio Drivers
+ *
+ */
+// Not sure if mac returns 'mac' or 'macintosh' or 'apple' for OS name
+// Not sure if solaris returns 'solaris' or 'sun' for OS name
+// Using just the first letter should take care of this
+var vboxSettingsAudioDrivers = {
+ 'w' : ['Null','WinMM','DirectSound'], // windows
+ 'l' : ['Null','OSS','ALSA','Pulse'], // linux
+ 'd' : ['Null','CoreAudio'], // darwin
+ 'm' : ['Null','CoreAudio'], // mac
+ 'a' : ['Null','CoreAudio'], // apple
+ 'o' : ['Null','CoreAudio'], // os x
+ 's' : ['Null','SolAudio'] // solaris / sun
+};
+
+
+/* Disable non-editable items when VM is running */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /*
+ * Load audio controller types
+ */
+
+ var ad = $('#vboxSettingsDialog').data('vboxAudioControllerTypes');
+
+ // Failsafe
+ if(!ad) ad = [];
+ if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController, ad) < 0)
+ ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController;
+
+ // clear options first
+ document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length = 0;
+
+ for(var i = 0; i < ad.length; i++) {
+ var opt = new Option(trans(vboxAudioController(ad[i]),'VBoxGlobal'),ad[i]);
+ document.forms['frmVboxSettings'].vboxSettingsAudioController.options[document.forms['frmVboxSettings'].vboxSettingsAudioController.options.length] = opt;
+ }
+
+
+ /*
+ * Load audio driver types
+ */
+ var ad = vboxSettingsAudioDrivers[$('#vboxSettingsDialog').data('vboxHostDetails').operatingSystem.toLowerCase().substring(0,1)];
+
+ // Failsafe
+ if(!ad) {
+ ad = [$('#vboxPane').data('vboxSystemProperties').defaultAudioDriver];
+ }
+ if(jQuery.inArray($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver, ad) < 0)
+ ad[ad.length] = $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver;
+
+ for(var i = 0; i < ad.length; i++) {
+ var opt = new Option(trans(vboxAudioDriver(ad[i]),'VBoxGlobal'),ad[i]);
+ document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options[document.forms['frmVboxSettings'].vboxSettingsAudioDriver.options.length] = opt;
+ }
+
+ $(document.forms['frmVboxSettings'].vboxSettingsAudioDriver).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver);
+ $(document.forms['frmVboxSettings'].vboxSettingsAudioController).val($('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController);
+
+
+ var p = $(document.forms['frmVboxSettings'].vboxSettingsAudioController).closest('table');
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
+ $(p).find('span').addClass('disabled');
+ $(p).find('input,select,textarea').prop('disabled',true);
+ } else {
+ $(p).find('span').removeClass('disabled');
+ $(p).find('input,select,textarea').prop('disabled',false);
+ $(document.forms['frmVboxSettings'].vboxSettingsAudioEnabled).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled).triggerHandler('click');
+ }
+});
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioDriver = document.forms['frmVboxSettings'].vboxSettingsAudioDriver.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.audioController = document.forms['frmVboxSettings'].vboxSettingsAudioController.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').audioAdapter.enabled = document.forms['frmVboxSettings'].vboxSettingsAudioEnabled.checked;
+
+});
+
+</script>
\ No newline at end of file
diff --git a/panes/settingsDisplay.html b/panes/settingsDisplay.html
index 4b74214..b7996da 100644
--- a/panes/settingsDisplay.html
+++ b/panes/settingsDisplay.html
@@ -1,196 +1,196 @@
-<!--
-
- Display Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsDisplay.html 595 2015-04-17 09:50:36Z imoore76 $
-
--->
-<ul>
- <li><a href="#vboxSettingsTabDisplayVideo"><span class='translate'>Screen</span></a></li>
- <li><a href="#vboxSettingsTabDisplayRemote"><span class='translate'>Remote Display</span></a></li>
-</ul>
-
-<!-- Video Tab -->
-<div id='vboxSettingsTabDisplayVideo' title='Screen'>
-<table style='width: 100%'>
- <tr>
- <th><span class='translate'>Video Memory:</span></th>
- <td style='width: 100%; white-space: nowrap'>
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='vboxSettingsDisplayMemory' class='slider'><div class='sliderScale'></div></div>
- </td>
- <td><input type='text' class='vboxText sliderValue' name='vboxSettingsDisplayMemoryValue' size='2' /> <span class='translate'>MB</span></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 class='vboxSliderMin'>%1 MB</span></td>
- <td style='text-align: right;'><span class='vboxSliderMax'>%1 MB</span></td>
- </tr>
- </table>
- </td>
- <td> </td>
- </tr>
- </table>
-
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Extended Features:</span></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplay3d' /> <span class='translate'>Enable 3D Acceleration</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplay2d' /> <span class='translate'>Enable 2D Video Acceleration</span></label></td>
- </tr>
-</table>
-</div>
-
-<!-- Remote Display Tab -->
-<div id='vboxSettingsTabDisplayRemote' title='Remote Display'>
-<table class='vboxVertical'>
- <tr class='vboxRunningEnabled'>
- <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsDisplayVRDEEnabled' /> <span class='translate'>Enable Server</span></label></td>
- </tr>
- <tr class='vboxRunningEnabled'>
- <th><span class='translate'>Server Port:</span></th>
- <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEPort' /></td>
- </tr>
- <tr id='vboxSettingsDisplayVRDEAddrRow'>
- <th><span class='translate'>Net Address:</span></th>
- <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEAddr' /></td>
- </tr>
- <tr class='vboxRunningEnabled vboxSettingsDisplayRDP'>
- <th><span class='translate'>Authentication Method:</span></th>
- <td>
- <select name='vboxSettingsDisplayVRDEAuth' id='vboxSettingsDisplayVRDEAuthID' style='width: 100%'>
- <option value='' >None</option>
- <option value='External'>External</option>
- <option value='Guest'>Guest</option>
- </select>
- </td>
- </tr>
- <tr class='vboxRunningEnabled vboxSettingsDisplayRDP'>
- <th><span class='translate'>Authentication Timeout:</span></th>
- <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEAuthTimeout' /></td>
- </tr>
- <tr class='vboxSettingsDisplayRDP'>
- <th><span class='translate'>Extended Features:</span></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplayVRDEMulti' /> <span class='translate vboxEnablerListen'>Allow Multiple Connections</span></label></td>
- </tr>
- <tr class='vboxRunningEnabled vboxSettingsDisplayVNC'>
- <th><span class='translate'>VNC Password:</span></th>
- <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVNCPassword' /></td>
- </tr>
-
-</table>
-</div>
-<script type='text/javascript'>
-
-/* Display */
-
-/* auth method translations */
-$('#vboxSettingsDisplayVRDEAuthID').find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
-
-$('#vboxSettingsDisplayMemory').data('form','frmVboxSettings');
-$('#vboxSettingsDisplayMemory').slider({'min':parseInt($('#vboxPane').data('vboxSystemProperties').minGuestVRAM),'max':parseInt($('#vboxPane').data('vboxSystemProperties').maxGuestVRAM)});
-
-
-
-/* CHange values when data is loaded */
-$('#vboxSettingsDialog').on('dataLoaded', function(){
-
-
- $('#vboxSettingsDisplayMemory').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').VRAMSize));
-
- document.forms['frmVboxSettings'].vboxSettingsDisplay3d.checked = ($('#vboxSettingsDialog').data('vboxMachineData').accelerate3DEnabled);
- document.forms['frmVboxSettings'].vboxSettingsDisplay2d.checked = ($('#vboxSettingsDialog').data('vboxMachineData').accelerate2DVideoEnabled);
-
- var p = $('#vboxSettingsTabDisplayVideo').parent().children('div');
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').addClass('disabled').prop('disabled',true);
- $('#vboxSettingsDisplayMemory').slider('disable');
- } else {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').removeClass('disabled').prop('disabled',false);
- $('#vboxSettingsDisplayMemory').slider('enable');
-
- if(!$('#vboxSettingsDialog').data('vboxHostDetails').acceleration3DAvailable) {
- $(document.forms['frmVboxSettings'].vboxSettingsDisplay3d).addClass('disabled').prop('disabled', true)
- .parent().addClass('disabled');
- } else {
- $(document.forms['frmVboxSettings'].vboxSettingsDisplay3d).removeClass('disabled').prop('disabled', false)
- .parent().removeClass('disabled');
- }
- }
-
-
- /*
- * No VRDE?
- *
- */
- if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
-
- $('#vboxSettingsTabDisplayVideo').parent().tabs('disable',1);
-
-
- } else {
-
- $('#vboxSettingsTabDisplayVideo').parent().tabs('enable',1);
-
- // Show / hide VNC / RDP sections
- if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack.indexOf("VNC") > -1) {
- $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayRDP').css({'display':'none'});
- $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayVNC').css({'display':''});
- } else {
- $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayRDP').css({'display':''});
- $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayVNC').css({'display':'none'});
- }
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEPort.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports;
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuth.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType;
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuthTimeout.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout;
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAddr.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress;
- document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VNCPassword;
-
- $(document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEEnabled).attr('checked',(!$('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled)).trigger('click');
-
- if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection) {
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked = true;
- } else {
- document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked = false;
- }
-
- if(!$('#vboxPane').data('vboxConfig').enableAdvancedConfig)
- $('#vboxSettingsDisplayVRDEAddrRow').css('display','none');
- }
-
-
-});
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxMachineData').VRAMSize = $(document.forms['frmVboxSettings'].vboxSettingsDisplayMemoryValue).val();
-
- $('#vboxSettingsDialog').data('vboxMachineData').accelerate3DEnabled = document.forms['frmVboxSettings'].vboxSettingsDisplay3d.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').accelerate2DVideoEnabled = document.forms['frmVboxSettings'].vboxSettingsDisplay2d.checked;
-
- if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack) {
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEPort.value;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAddr.value;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuth.value;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuthTimeout.value;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEEnabled.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VNCPassword = document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value;
- }
-});
-
-</script>
-
-
+<!--
+
+ Display Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsDisplay.html 595 2015-04-17 09:50:36Z imoore76 $
+
+-->
+<ul>
+ <li><a href="#vboxSettingsTabDisplayVideo"><span class='translate'>Screen</span></a></li>
+ <li><a href="#vboxSettingsTabDisplayRemote"><span class='translate'>Remote Display</span></a></li>
+</ul>
+
+<!-- Video Tab -->
+<div id='vboxSettingsTabDisplayVideo' title='Screen'>
+<table style='width: 100%'>
+ <tr>
+ <th><span class='translate'>Video Memory:</span></th>
+ <td style='width: 100%; white-space: nowrap'>
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='vboxSettingsDisplayMemory' class='slider'><div class='sliderScale'></div></div>
+ </td>
+ <td><input type='text' class='vboxText sliderValue' name='vboxSettingsDisplayMemoryValue' size='2' /> <span class='translate'>MB</span></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 class='vboxSliderMin'>%1 MB</span></td>
+ <td style='text-align: right;'><span class='vboxSliderMax'>%1 MB</span></td>
+ </tr>
+ </table>
+ </td>
+ <td> </td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Extended Features:</span></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplay3d' /> <span class='translate'>Enable 3D Acceleration</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplay2d' /> <span class='translate'>Enable 2D Video Acceleration</span></label></td>
+ </tr>
+</table>
+</div>
+
+<!-- Remote Display Tab -->
+<div id='vboxSettingsTabDisplayRemote' title='Remote Display'>
+<table class='vboxVertical'>
+ <tr class='vboxRunningEnabled'>
+ <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsDisplayVRDEEnabled' /> <span class='translate'>Enable Server</span></label></td>
+ </tr>
+ <tr class='vboxRunningEnabled'>
+ <th><span class='translate'>Server Port:</span></th>
+ <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEPort' /></td>
+ </tr>
+ <tr id='vboxSettingsDisplayVRDEAddrRow'>
+ <th><span class='translate'>Net Address:</span></th>
+ <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEAddr' /></td>
+ </tr>
+ <tr class='vboxRunningEnabled vboxSettingsDisplayRDP'>
+ <th><span class='translate'>Authentication Method:</span></th>
+ <td>
+ <select name='vboxSettingsDisplayVRDEAuth' id='vboxSettingsDisplayVRDEAuthID' style='width: 100%'>
+ <option value='' >None</option>
+ <option value='External'>External</option>
+ <option value='Guest'>Guest</option>
+ </select>
+ </td>
+ </tr>
+ <tr class='vboxRunningEnabled vboxSettingsDisplayRDP'>
+ <th><span class='translate'>Authentication Timeout:</span></th>
+ <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVRDEAuthTimeout' /></td>
+ </tr>
+ <tr class='vboxSettingsDisplayRDP'>
+ <th><span class='translate'>Extended Features:</span></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplayVRDEMulti' /> <span class='translate vboxEnablerListen'>Allow Multiple Connections</span></label></td>
+ </tr>
+ <tr class='vboxRunningEnabled vboxSettingsDisplayVNC'>
+ <th><span class='translate'>VNC Password:</span></th>
+ <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayVNCPassword' /></td>
+ </tr>
+
+</table>
+</div>
+<script type='text/javascript'>
+
+/* Display */
+
+/* auth method translations */
+$('#vboxSettingsDisplayVRDEAuthID').find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
+
+$('#vboxSettingsDisplayMemory').data('form','frmVboxSettings');
+$('#vboxSettingsDisplayMemory').slider({'min':parseInt($('#vboxPane').data('vboxSystemProperties').minGuestVRAM),'max':parseInt($('#vboxPane').data('vboxSystemProperties').maxGuestVRAM)});
+
+
+
+/* CHange values when data is loaded */
+$('#vboxSettingsDialog').on('dataLoaded', function(){
+
+
+ $('#vboxSettingsDisplayMemory').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').VRAMSize));
+
+ document.forms['frmVboxSettings'].vboxSettingsDisplay3d.checked = ($('#vboxSettingsDialog').data('vboxMachineData').accelerate3DEnabled);
+ document.forms['frmVboxSettings'].vboxSettingsDisplay2d.checked = ($('#vboxSettingsDialog').data('vboxMachineData').accelerate2DVideoEnabled);
+
+ var p = $('#vboxSettingsTabDisplayVideo').parent().children('div');
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').addClass('disabled').prop('disabled',true);
+ $('#vboxSettingsDisplayMemory').slider('disable');
+ } else {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').removeClass('disabled').prop('disabled',false);
+ $('#vboxSettingsDisplayMemory').slider('enable');
+
+ if(!$('#vboxSettingsDialog').data('vboxHostDetails').acceleration3DAvailable) {
+ $(document.forms['frmVboxSettings'].vboxSettingsDisplay3d).addClass('disabled').prop('disabled', true)
+ .parent().addClass('disabled');
+ } else {
+ $(document.forms['frmVboxSettings'].vboxSettingsDisplay3d).removeClass('disabled').prop('disabled', false)
+ .parent().removeClass('disabled');
+ }
+ }
+
+
+ /*
+ * No VRDE?
+ *
+ */
+ if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
+
+ $('#vboxSettingsTabDisplayVideo').parent().tabs('disable',1);
+
+
+ } else {
+
+ $('#vboxSettingsTabDisplayVideo').parent().tabs('enable',1);
+
+ // Show / hide VNC / RDP sections
+ if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack.indexOf("VNC") > -1) {
+ $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayRDP').css({'display':'none'});
+ $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayVNC').css({'display':''});
+ } else {
+ $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayRDP').css({'display':''});
+ $('#vboxSettingsTabDisplayRemote').find('tr.vboxSettingsDisplayVNC').css({'display':'none'});
+ }
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEPort.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports;
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuth.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType;
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuthTimeout.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout;
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAddr.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress;
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VNCPassword;
+
+ $(document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEEnabled).attr('checked',(!$('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled)).trigger('click');
+
+ if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection) {
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked = true;
+ } else {
+ document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked = false;
+ }
+
+ if(!$('#vboxPane').data('vboxConfig').enableAdvancedConfig)
+ $('#vboxSettingsDisplayVRDEAddrRow').css('display','none');
+ }
+
+
+});
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxMachineData').VRAMSize = $(document.forms['frmVboxSettings'].vboxSettingsDisplayMemoryValue).val();
+
+ $('#vboxSettingsDialog').data('vboxMachineData').accelerate3DEnabled = document.forms['frmVboxSettings'].vboxSettingsDisplay3d.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').accelerate2DVideoEnabled = document.forms['frmVboxSettings'].vboxSettingsDisplay2d.checked;
+
+ if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack) {
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEPort.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAddr.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuth.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEAuthTimeout.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEEnabled.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection = document.forms['frmVboxSettings'].vboxSettingsDisplayVRDEMulti.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VNCPassword = document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value;
+ }
+});
+
+</script>
+
+
diff --git a/panes/settingsGeneral.html b/panes/settingsGeneral.html
index 610d029..e383545 100644
--- a/panes/settingsGeneral.html
+++ b/panes/settingsGeneral.html
@@ -1,446 +1,446 @@
-<!--
-
- General Machine Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsGeneral.html 599 2015-07-27 10:40:37Z imoore76 $
-
- -->
-<ul>
- <li><a href="#vboxSettingsTabGeneralBasic"><span class='translate'>Basic</span></a></li>
- <li><a href="#vboxSettingsTabGeneralAdvanced"><span class='translate'>Advanced</span></a></li>
- <li><a href="#vboxSettingsTabGeneralDescription"><span class='translate'>Description</span></a></li>
- <li><a href="#vboxSettingsTabGeneralEncryption"><span class='translate'>Encryption</span></a></li>
- <li id='vboxSettingsTabGeneralInputTab'><a href="#vboxSettingsTabGeneralInput"><span class='translateinputtab'>Input</span></a></li>
-</ul>
-
-<!-- Basic Tab -->
-<div id='vboxSettingsTabGeneralBasic' title='Basic'>
-<table class='vboxVertical'>
- <tr>
- <th><span class='translateos'>Name:</span></th>
- <td colspan='2'><input type='text' class='vboxText' name='vboxSettingsGeneralName' /></td>
- </tr>
- <tr>
- <th><span class='translateos'>Type:</span></th>
- <td><select name='vboxSettingsGeneralOSFamily' id='vboxSettingsGeneralOSFamily' >
- <option value='Linux'>Linux</option>
- </select></td>
- <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
- </tr>
- <tr>
- <th><span class='translateos'>Version:</span></th>
- <td><select id='vboxSettingsGeneralOSType' name='vboxSettingsGeneralOSType'>
- <option value='Debian'>Debian</option>
- </select></td>
- </tr>
- <tr id='vboxSettingsRowVMIcon' class='vboxRunningEnabled' style='display:none'>
- <th><span class='translate'>Icon URL:</span></th>
- <td><input name='vboxSettingsGeneralIcon' type='text' class='vboxText' style='width:99%'/></td>
- <td style='text-align:center;'><img src='images/vbox/blank.gif' id='vboxSettingsGeneralIconImg' height='32' width='32' /></td>
- </tr>
- <tr class='vboxStartStopConfig vboxRunningEnabled'>
- <th><span class='translate'>Startup Mode:</span></th>
- <td colspan='2'>
- <select name='vboxStartStopConfigStartup'>
- <option value='auto'>Automatic</option>
- <option value='manual'>Manual</option>
- </select>
- </td>
- </tr>
- <!-- Autostart shutdown options -->
- <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigShutdown'>
- <th><span class='translate'>Shutdown mode:</span></th>
- <td colspan='2'>
- <select name='vboxAutostartConfigShutdownOptions'>
- <option value='Disabled'>Disabled</option>
- <option value='SaveState'>Save State</option>
- <option value='PowerOff'>Power Off</option>
- <option value='AcpiShutdown'>ACPI Shutdown</option>
- </select>
- </td>
- </tr>
- <!-- Autostart options -->
- <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigStartup'>
- <th><span class='translate'>Enable auto-start:</span></th>
- <td colspan='2'>
- <input type='checkbox' class='vboxCheckbox' name='autostartEnabled'/> <span class='translate'>after</span>
- <input type='text' class='vboxText' size='3' name='autostartDelay' style='width: 30px'/>
- <span class='translate'>second(s)</span>
- </td>
- </tr>
-</table>
-</div>
-
-<!-- Advanced Tab -->
-<div id='vboxSettingsTabGeneralAdvanced' title='Advanced'>
-<table class='vboxVertical'>
- <tr>
- <th><span class='translate'>Snapshot Folder:</span></th>
- <td class='vboxFileFolderInput'>
- <input type='text' class='vboxText' name='vboxSettingsGeneralSnapshotFolder' /><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
- onClick="vboxSnapshotBrowseFolder(this);" />
- </td>
- </tr>
-</table>
-</div>
-
-<!-- Description Tab -->
-<div id='vboxSettingsTabGeneralDescription' title='Description'>
- <textarea class='vboxRunningEnabled' rows='16' cols='20' name='vboxSettingsGeneralDescription'></textarea>
-</div>
-
-<!-- Encryption Tab -->
-<div id='vboxSettingsTabGeneralEncryption' title='Encryption'>
-<table class='vboxVertical'>
- <tr>
- <td colspan='2'>
- <label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsGeneralEncryptionEnable' />
- <span class='translate'>Enable Encryption</span>
- </label>
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Encryption Cipher:</span></th>
- <td>
- <select name='vboxSettingsTabGeneralEncryptionCipher'>
- <option value=''>Leave Unchanged</option>
- <option value='AES-XTS256-PLAIN64'>AES-XTS256-PLAIN64</option>
- <option value='AES-XTS128-PLAIN64'>AES-XTS128-PLAIN64</option>
- </select>
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Enter New Password:</span></th>
- <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword'/></td>
- </tr>
- <tr>
- <th><span class='translate'>Confirm New Password:</span></th>
- <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword2'/></td>
- </tr>
-
-</table>
-</div>
-
-<!-- Input Tab -->
-<div id='vboxSettingsTabGeneralInput' title='Input'>
- <table class='vboxVertical'>
- <tr>
- <th><span class='translateinput'>Keyboard</span><span> :</span></th>
- <td><select name='vboxSettingsTabGeneralInputKeyboard'>
- <option value='PS2Keyboard'>PS/2 Keyboard</option>
- <option value='USBKeyboard'>USB Keyboard</option>
- </select>
- </td>
- </tr>
- <tr>
- <th><span class='translateinput'>Mouse</span><span> :</span></th>
- <td><select name='vboxSettingsTabGeneralInputMouse'>
- <option value='PS2Mouse'>PS/2 Mouse</option>
- <option value='USBMouse'>USB Mouse</option>
- <option value='USBTablet'>USB Tablet</option>
- </select>
- </td>
- </tr>
- </table>
-</div>
-<script type='text/javascript'>
-
-/* Translations */
-$('#vboxSettingsTabGeneralInput').find(".translateinput").html(function(i,h){return trans(h,'UIActionPool');});
-$('#vboxSettingsTabGeneralInputTab').find(".translateinputtab").html(function(i,h){return trans(h,'UISettingsDialogGlobal');});
-$('#vboxSettingsTabGeneralBasic').find(".translateos").html(function(i,h){return trans(h,'UINameAndSystemEditor');});
-if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
-
- // Shutdown options select buttons
- $('#vboxAutostartConfigShutdown').find('option').each(function(i,opt){
- $(opt).text(i == 0 ? trans('Disabled','UIGDetails',null,'details (audio)') : trans($(opt).text(),'UIActionPool'));
- if($(opt).val() == $('#vboxSettingsDialog').data('vboxMachineData').autostopType)
- $(opt).prop('selected', true);
- });
-
-} else {
- $('#vboxSettingsTabGeneralBasic .vboxAutostartConfig').empty().remove();
-}
-
-$('#vboxSettingsTabGeneralEncryption').find('option').html(function(i,h){ return trans(h, 'UIMachineSettingsGeneral', 'cipher type')});
-$('#vboxSettingsTabGeneralInput').find('option').html(function(i,h){ return trans(h, 'VBoxGlobal')});
-
-/* Browse for snapshot folder */
-function vboxSnapshotBrowseFolder(btn) {
- vboxFileBrowser($(btn).siblings('input').first().val(),function(f){
- if(f) $(btn).siblings('input').first().val(f);
- },true,trans('Snapshot Folder:','UIMachineSettingsGeneral').replace(':',''));
-}
-
-/*
- * Hide start / stop config if not enabled
- */
-if(!$('#vboxPane').data('vboxConfig').startStopConfig) {
-
- $('#vboxSettingsTabGeneralBasic').find('tr.vboxStartStopConfig').hide();
-
-}
-
-/* Custom icons */
-if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
-
- $('#vboxSettingsRowVMIcon').css('display','');
-
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).blur(function(){
- $('#vboxSettingsGeneralIconImg').attr('src',(this.value ? this.value : 'images/vbox/blank.gif'));
- });
-}
-
-/*
- * Called when OS family type changes
- */
-function vboxSettingsUpdateOSList(osfam) {
- document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options.length = 0;
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children().remove();
- for(var i = 0; i < vboxSettingsOSTypes[osfam].osTypes.length; i++) {
- document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options[i] = new Option(vboxSettingsOSTypes[osfam].osTypes[i].description, vboxSettingsOSTypes[osfam].osTypes[i].id);
- }
- // Update image
- document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id);
-}
-
-var vboxSettingsOSTypes = new Array();
-var vboxSettingsOSTypesObj = {};
-
-// shorthand
-var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
-
-// Default OS Type set to my fav :) Eventually will move to config.php
-var vboxDefaultOSTypeId = 'Debian';
-
-var myOSType = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
-var dosfam = null; // holds defaultostype family id
-for(var i in vboxOSTypes) {
-
- // Only ostypes supported by this install
- if(!vboxOSTypes[i].supported && myOSType != vboxOSTypes[i].id) continue;
-
- // create array of os family types
- if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
- vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
- }
-
- // We're on the default os type, record family id and index number
- // so that we can set it later on
- if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
- dosfam = vboxOSTypes[i].familyId;
- vboxDefaultOSTypeId = vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length;
- }
-
- vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
-
- vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
-
- // Preload icons
- vboxOSTypes[i].icon = new Image();
- vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
-
-}
-// clear all options
-document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length = 0;
-$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children().remove();
-for(var i in vboxSettingsOSTypes) {
- // default os type family? record in dosfam
- if(i == dosfam) dosfam = document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length;
- document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options[document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length] = new Option(vboxSettingsOSTypes[i].description, vboxSettingsOSTypes[i].id);
-}
-// OnChange, update os type list and icon
-document.getElementById('vboxSettingsGeneralOSFamily').setAttribute('onChange','vboxSettingsUpdateOSList(this.value)');
-document.getElementById('vboxSettingsGeneralOSType').setAttribute('onChange','document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(this.value)');
-
-
-
-
-/* Update settings when data is loaded */
-$('#vboxSettingsDialog').on('dataLoaded', function(){
-
- /* Defaults from machine */
- document.forms['frmVboxSettings'].vboxSettingsGeneralName.value = $('#vboxSettingsDialog').data('vboxMachineData').name;
- document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.value = vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId;
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).change();
- document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).change();
- document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value = $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder;
- document.forms['frmVboxSettings'].vboxSettingsGeneralDescription.innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').description;
-
- /* Advanced config options */
- $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val($('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType);
- $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val($('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType);
-
- /* OS Type */
-
- // shorthand
- var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
- for(var i = 0; i < vboxOSTypes.length; i++) {
- if(vboxOSTypes[i].id == $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId) {
- // Set the family then os type
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children('[value="'+vboxOSTypes[i].familyId+'"]').prop('selected',true);
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).trigger('change');
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children('[value="'+vboxOSTypes[i].id+'"]').prop('selected',true);
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).trigger('change');
- break;
- }
- }
-
- /* Custom icons */
- if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
-
- if($('#vboxSettingsDialog').data('vboxMachineData').customIcon) {
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val($('#vboxSettingsDialog').data('vboxMachineData').customIcon);
- $('#vboxSettingsGeneralIconImg').attr('src',$('#vboxSettingsDialog').data('vboxMachineData').customIcon);
- } else {
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val('');
- $('#vboxSettingsGeneralIconImg').attr('src','images/vbox/blank.gif');
- }
-
- }
-
- /* Autostart options */
- if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
- document.forms['frmVboxSettings'].autostartEnabled.checked = ($('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled);
- document.forms['frmVboxSettings'].autostartDelay.value = $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay;
- }
-
- /* Start / stop config */
- if($('#vboxPane').data('vboxConfig').startStopConfig) {
- document.forms['frmVboxSettings'].vboxStartStopConfigStartup.selectedIndex = ($('#vboxSettingsDialog').data('vboxMachineData').startupMode == 'auto' ? 0 : 1);
- }
-
- /* Settings that are disabled / enabled depending on if VM is mutable */
- var p = $('#vboxSettingsTabGeneralBasic').parent().children('div');
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
- $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_disabled_16px.png)');
- $(document.images["vboxOSTypeImg"]).addClass('vboxDisabled');
- } else {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
- $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_16px.png)');
- $(document.images["vboxOSTypeImg"]).removeClass('vboxDisabled');
- }
-
- /*
- * This is a poor way to determine extpack installation status, but the web service can't access IExtPackManager :(
- */
- if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
- $('#vboxSettingsTabGeneralEncryption').parent().tabs('disable', 3);
- } else {
- $('#vboxSettingsTabGeneralEncryption').parent().tabs('enable', 3);
-
- // Encrypted media
- var encIds = vboxMedia.getEncryptedMediaIds(
- vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData'))
- );
-
- var lastCipher = null;
- var uniqueCiphers = true;
- for(var i = 0; i < encIds.length; i++) {
- if(lastCipher && (lastCipher != encIds[i].cipher)) {
- uniqueCiphers = false;
- break;
- }
- lastCipher = encIds[i].cipher;
- }
- $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length))
- .triggerHandler('click');
-
- if(uniqueCiphers) {
- $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher);
- }
-
- $('#vboxSettingsDialog').data('vboxEncSettings', {
- enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'),
- uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()
- });
- }
-
-
-/* Change general settings onSave() */
-}).on('save',function(){
-
- // Start / stop config
- if($('#vboxPane').data('vboxConfig').startStopConfig) {
- $('#vboxSettingsDialog').data('vboxMachineData').startupMode = document.forms['frmVboxSettings'].vboxStartStopConfigStartup.value;
- }
-
- // VirtualBox style start / stop config
- if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
-
- $('#vboxSettingsDialog').data('vboxMachineData').autostopType = document.forms['frmVboxSettings'].vboxAutostartConfigShutdownOptions.value;
- $('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled = document.forms['frmVboxSettings'].autostartEnabled.checked;
- if(isNaN(document.forms['frmVboxSettings'].autostartDelay.value))
- document.forms['frmVboxSettings'].autostartDelay.value = 0;
- $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay = parseInt(document.forms['frmVboxSettings'].autostartDelay.value);
-
-
- }
-
- if(jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value))
- $('#vboxSettingsDialog').data('vboxMachineData').name = jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value);
-
- $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId = document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value;
- $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder = document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value;
- $('#vboxSettingsDialog').data('vboxMachineData').description = $(document.forms['frmVboxSettings'].vboxSettingsGeneralDescription).val();
-
- $('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val();
- $('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val();
-
- if($('#vboxPane').data('vboxConfig').enableCustomIcons)
- $('#vboxSettingsDialog').data('vboxMachineData').customIcon = $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val();
-
- var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
- if(encSettings) {
- var encSettingsChanged = (encSettings.enabled != $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) ||
- (encSettings.uniqueCiphers != $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) ||
- $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val().length > 0;
-
- if(!encSettings.enabled && !$(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'))
- encSettingsChanged = false;
-
- $('#vboxSettingsDialog').data('vboxEncSettingsChanged', encSettingsChanged);
- $('#vboxSettingsDialog').data('vboxEncEnabled', $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'));
- $('#vboxSettingsDialog').data('vboxEncCipher', $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val());
- $('#vboxSettingsDialog').data('vboxEncPw', $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val());
- } else {
- $('#vboxSettingsDialog').data('vboxEncSettingsChanged', false);
- }
-
-});
-
-function vboxSettingsGeneralValidate() {
-
- var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
-
- // Going from disabled to enabled
- if(!encSettings.enabled && $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
-
- if(!$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) {
- vboxAlert(trans("Encryption cipher type not specified.", 'UIMachineSettingsGeneral'));
- return false;
- } else if(!$(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val()) {
- vboxAlert(trans("Encryption password empty.", 'UIMachineSettingsGeneral'));
- return false;
- } else if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
- vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
- return false;
- }
-
- // If enabled and poasswords don't match
- } else if($(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
- if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
- vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
- return false;
- }
- }
- return true;
-}
-
-</script>
-
+<!--
+
+ General Machine Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsGeneral.html 599 2015-07-27 10:40:37Z imoore76 $
+
+ -->
+<ul>
+ <li><a href="#vboxSettingsTabGeneralBasic"><span class='translate'>Basic</span></a></li>
+ <li><a href="#vboxSettingsTabGeneralAdvanced"><span class='translate'>Advanced</span></a></li>
+ <li><a href="#vboxSettingsTabGeneralDescription"><span class='translate'>Description</span></a></li>
+ <li><a href="#vboxSettingsTabGeneralEncryption"><span class='translate'>Encryption</span></a></li>
+ <li id='vboxSettingsTabGeneralInputTab'><a href="#vboxSettingsTabGeneralInput"><span class='translateinputtab'>Input</span></a></li>
+</ul>
+
+<!-- Basic Tab -->
+<div id='vboxSettingsTabGeneralBasic' title='Basic'>
+<table class='vboxVertical'>
+ <tr>
+ <th><span class='translateos'>Name:</span></th>
+ <td colspan='2'><input type='text' class='vboxText' name='vboxSettingsGeneralName' /></td>
+ </tr>
+ <tr>
+ <th><span class='translateos'>Type:</span></th>
+ <td><select name='vboxSettingsGeneralOSFamily' id='vboxSettingsGeneralOSFamily' >
+ <option value='Linux'>Linux</option>
+ </select></td>
+ <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
+ </tr>
+ <tr>
+ <th><span class='translateos'>Version:</span></th>
+ <td><select id='vboxSettingsGeneralOSType' name='vboxSettingsGeneralOSType'>
+ <option value='Debian'>Debian</option>
+ </select></td>
+ </tr>
+ <tr id='vboxSettingsRowVMIcon' class='vboxRunningEnabled' style='display:none'>
+ <th><span class='translate'>Icon URL:</span></th>
+ <td><input name='vboxSettingsGeneralIcon' type='text' class='vboxText' style='width:99%'/></td>
+ <td style='text-align:center;'><img src='images/vbox/blank.gif' id='vboxSettingsGeneralIconImg' height='32' width='32' /></td>
+ </tr>
+ <tr class='vboxStartStopConfig vboxRunningEnabled'>
+ <th><span class='translate'>Startup Mode:</span></th>
+ <td colspan='2'>
+ <select name='vboxStartStopConfigStartup'>
+ <option value='auto'>Automatic</option>
+ <option value='manual'>Manual</option>
+ </select>
+ </td>
+ </tr>
+ <!-- Autostart shutdown options -->
+ <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigShutdown'>
+ <th><span class='translate'>Shutdown mode:</span></th>
+ <td colspan='2'>
+ <select name='vboxAutostartConfigShutdownOptions'>
+ <option value='Disabled'>Disabled</option>
+ <option value='SaveState'>Save State</option>
+ <option value='PowerOff'>Power Off</option>
+ <option value='AcpiShutdown'>ACPI Shutdown</option>
+ </select>
+ </td>
+ </tr>
+ <!-- Autostart options -->
+ <tr class='vboxAutostartConfig vboxRunningEnabled' id='vboxAutostartConfigStartup'>
+ <th><span class='translate'>Enable auto-start:</span></th>
+ <td colspan='2'>
+ <input type='checkbox' class='vboxCheckbox' name='autostartEnabled'/> <span class='translate'>after</span>
+ <input type='text' class='vboxText' size='3' name='autostartDelay' style='width: 30px'/>
+ <span class='translate'>second(s)</span>
+ </td>
+ </tr>
+</table>
+</div>
+
+<!-- Advanced Tab -->
+<div id='vboxSettingsTabGeneralAdvanced' title='Advanced'>
+<table class='vboxVertical'>
+ <tr>
+ <th><span class='translate'>Snapshot Folder:</span></th>
+ <td class='vboxFileFolderInput'>
+ <input type='text' class='vboxText' name='vboxSettingsGeneralSnapshotFolder' /><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
+ onClick="vboxSnapshotBrowseFolder(this);" />
+ </td>
+ </tr>
+</table>
+</div>
+
+<!-- Description Tab -->
+<div id='vboxSettingsTabGeneralDescription' title='Description'>
+ <textarea class='vboxRunningEnabled' rows='16' cols='20' name='vboxSettingsGeneralDescription'></textarea>
+</div>
+
+<!-- Encryption Tab -->
+<div id='vboxSettingsTabGeneralEncryption' title='Encryption'>
+<table class='vboxVertical'>
+ <tr>
+ <td colspan='2'>
+ <label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsGeneralEncryptionEnable' />
+ <span class='translate'>Enable Encryption</span>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Encryption Cipher:</span></th>
+ <td>
+ <select name='vboxSettingsTabGeneralEncryptionCipher'>
+ <option value=''>Leave Unchanged</option>
+ <option value='AES-XTS256-PLAIN64'>AES-XTS256-PLAIN64</option>
+ <option value='AES-XTS128-PLAIN64'>AES-XTS128-PLAIN64</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Enter New Password:</span></th>
+ <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Confirm New Password:</span></th>
+ <td><input type='password' class='vboxText' name='vboxGeneralEncryptionPassword2'/></td>
+ </tr>
+
+</table>
+</div>
+
+<!-- Input Tab -->
+<div id='vboxSettingsTabGeneralInput' title='Input'>
+ <table class='vboxVertical'>
+ <tr>
+ <th><span class='translateinput'>Keyboard</span><span> :</span></th>
+ <td><select name='vboxSettingsTabGeneralInputKeyboard'>
+ <option value='PS2Keyboard'>PS/2 Keyboard</option>
+ <option value='USBKeyboard'>USB Keyboard</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translateinput'>Mouse</span><span> :</span></th>
+ <td><select name='vboxSettingsTabGeneralInputMouse'>
+ <option value='PS2Mouse'>PS/2 Mouse</option>
+ <option value='USBMouse'>USB Mouse</option>
+ <option value='USBTablet'>USB Tablet</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+</div>
+<script type='text/javascript'>
+
+/* Translations */
+$('#vboxSettingsTabGeneralInput').find(".translateinput").html(function(i,h){return trans(h,'UIActionPool');});
+$('#vboxSettingsTabGeneralInputTab').find(".translateinputtab").html(function(i,h){return trans(h,'UISettingsDialogGlobal');});
+$('#vboxSettingsTabGeneralBasic').find(".translateos").html(function(i,h){return trans(h,'UINameAndSystemEditor');});
+if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
+
+ // Shutdown options select buttons
+ $('#vboxAutostartConfigShutdown').find('option').each(function(i,opt){
+ $(opt).text(i == 0 ? trans('Disabled','UIGDetails',null,'details (audio)') : trans($(opt).text(),'UIActionPool'));
+ if($(opt).val() == $('#vboxSettingsDialog').data('vboxMachineData').autostopType)
+ $(opt).prop('selected', true);
+ });
+
+} else {
+ $('#vboxSettingsTabGeneralBasic .vboxAutostartConfig').empty().remove();
+}
+
+$('#vboxSettingsTabGeneralEncryption').find('option').html(function(i,h){ return trans(h, 'UIMachineSettingsGeneral', 'cipher type')});
+$('#vboxSettingsTabGeneralInput').find('option').html(function(i,h){ return trans(h, 'VBoxGlobal')});
+
+/* Browse for snapshot folder */
+function vboxSnapshotBrowseFolder(btn) {
+ vboxFileBrowser($(btn).siblings('input').first().val(),function(f){
+ if(f) $(btn).siblings('input').first().val(f);
+ },true,trans('Snapshot Folder:','UIMachineSettingsGeneral').replace(':',''));
+}
+
+/*
+ * Hide start / stop config if not enabled
+ */
+if(!$('#vboxPane').data('vboxConfig').startStopConfig) {
+
+ $('#vboxSettingsTabGeneralBasic').find('tr.vboxStartStopConfig').hide();
+
+}
+
+/* Custom icons */
+if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
+
+ $('#vboxSettingsRowVMIcon').css('display','');
+
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).blur(function(){
+ $('#vboxSettingsGeneralIconImg').attr('src',(this.value ? this.value : 'images/vbox/blank.gif'));
+ });
+}
+
+/*
+ * Called when OS family type changes
+ */
+function vboxSettingsUpdateOSList(osfam) {
+ document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options.length = 0;
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children().remove();
+ for(var i = 0; i < vboxSettingsOSTypes[osfam].osTypes.length; i++) {
+ document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.options[i] = new Option(vboxSettingsOSTypes[osfam].osTypes[i].description, vboxSettingsOSTypes[osfam].osTypes[i].id);
+ }
+ // Update image
+ document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(vboxSettingsOSTypes[osfam].osTypes[0].id);
+}
+
+var vboxSettingsOSTypes = new Array();
+var vboxSettingsOSTypesObj = {};
+
+// shorthand
+var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+
+// Default OS Type set to my fav :) Eventually will move to config.php
+var vboxDefaultOSTypeId = 'Debian';
+
+var myOSType = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
+var dosfam = null; // holds defaultostype family id
+for(var i in vboxOSTypes) {
+
+ // Only ostypes supported by this install
+ if(!vboxOSTypes[i].supported && myOSType != vboxOSTypes[i].id) continue;
+
+ // create array of os family types
+ if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
+ }
+
+ // We're on the default os type, record family id and index number
+ // so that we can set it later on
+ if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
+ dosfam = vboxOSTypes[i].familyId;
+ vboxDefaultOSTypeId = vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length;
+ }
+
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
+
+ vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
+
+ // Preload icons
+ vboxOSTypes[i].icon = new Image();
+ vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
+
+}
+// clear all options
+document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length = 0;
+$(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children().remove();
+for(var i in vboxSettingsOSTypes) {
+ // default os type family? record in dosfam
+ if(i == dosfam) dosfam = document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length;
+ document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options[document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.options.length] = new Option(vboxSettingsOSTypes[i].description, vboxSettingsOSTypes[i].id);
+}
+// OnChange, update os type list and icon
+document.getElementById('vboxSettingsGeneralOSFamily').setAttribute('onChange','vboxSettingsUpdateOSList(this.value)');
+document.getElementById('vboxSettingsGeneralOSType').setAttribute('onChange','document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(this.value)');
+
+
+
+
+/* Update settings when data is loaded */
+$('#vboxSettingsDialog').on('dataLoaded', function(){
+
+ /* Defaults from machine */
+ document.forms['frmVboxSettings'].vboxSettingsGeneralName.value = $('#vboxSettingsDialog').data('vboxMachineData').name;
+ document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily.value = vboxSettingsOSTypesObj[$('#vboxSettingsDialog').data('vboxMachineData').OSTypeId].familyId;
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).change();
+ document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value = $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId;
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).change();
+ document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value = $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder;
+ document.forms['frmVboxSettings'].vboxSettingsGeneralDescription.innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').description;
+
+ /* Advanced config options */
+ $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val($('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType);
+ $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val($('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType);
+
+ /* OS Type */
+
+ // shorthand
+ var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+ for(var i = 0; i < vboxOSTypes.length; i++) {
+ if(vboxOSTypes[i].id == $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId) {
+ // Set the family then os type
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).children('[value="'+vboxOSTypes[i].familyId+'"]').prop('selected',true);
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSFamily).trigger('change');
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).children('[value="'+vboxOSTypes[i].id+'"]').prop('selected',true);
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralOSType).trigger('change');
+ break;
+ }
+ }
+
+ /* Custom icons */
+ if($('#vboxPane').data('vboxConfig').enableCustomIcons) {
+
+ if($('#vboxSettingsDialog').data('vboxMachineData').customIcon) {
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val($('#vboxSettingsDialog').data('vboxMachineData').customIcon);
+ $('#vboxSettingsGeneralIconImg').attr('src',$('#vboxSettingsDialog').data('vboxMachineData').customIcon);
+ } else {
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val('');
+ $('#vboxSettingsGeneralIconImg').attr('src','images/vbox/blank.gif');
+ }
+
+ }
+
+ /* Autostart options */
+ if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
+ document.forms['frmVboxSettings'].autostartEnabled.checked = ($('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled);
+ document.forms['frmVboxSettings'].autostartDelay.value = $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay;
+ }
+
+ /* Start / stop config */
+ if($('#vboxPane').data('vboxConfig').startStopConfig) {
+ document.forms['frmVboxSettings'].vboxStartStopConfigStartup.selectedIndex = ($('#vboxSettingsDialog').data('vboxMachineData').startupMode == 'auto' ? 0 : 1);
+ }
+
+ /* Settings that are disabled / enabled depending on if VM is mutable */
+ var p = $('#vboxSettingsTabGeneralBasic').parent().children('div');
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
+ $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_disabled_16px.png)');
+ $(document.images["vboxOSTypeImg"]).addClass('vboxDisabled');
+ } else {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
+ $('#vboxSettingsTabGeneralAdvanced').find('input.vboxImgButton').css('background-image','url(images/vbox/select_file_16px.png)');
+ $(document.images["vboxOSTypeImg"]).removeClass('vboxDisabled');
+ }
+
+ /*
+ * This is a poor way to determine extpack installation status, but the web service can't access IExtPackManager :(
+ */
+ if(!($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack)) {
+ $('#vboxSettingsTabGeneralEncryption').parent().tabs('disable', 3);
+ } else {
+ $('#vboxSettingsTabGeneralEncryption').parent().tabs('enable', 3);
+
+ // Encrypted media
+ var encIds = vboxMedia.getEncryptedMediaIds(
+ vboxStorage.getAttachedBaseMedia($('#vboxSettingsDialog').data('vboxMachineData'))
+ );
+
+ var lastCipher = null;
+ var uniqueCiphers = true;
+ for(var i = 0; i < encIds.length; i++) {
+ if(lastCipher && (lastCipher != encIds[i].cipher)) {
+ uniqueCiphers = false;
+ break;
+ }
+ lastCipher = encIds[i].cipher;
+ }
+ $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked', (encIds.length))
+ .triggerHandler('click');
+
+ if(uniqueCiphers) {
+ $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val(lastCipher);
+ }
+
+ $('#vboxSettingsDialog').data('vboxEncSettings', {
+ enabled: $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'),
+ uniqueCiphers: $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()
+ });
+ }
+
+
+/* Change general settings onSave() */
+}).on('save',function(){
+
+ // Start / stop config
+ if($('#vboxPane').data('vboxConfig').startStopConfig) {
+ $('#vboxSettingsDialog').data('vboxMachineData').startupMode = document.forms['frmVboxSettings'].vboxStartStopConfigStartup.value;
+ }
+
+ // VirtualBox style start / stop config
+ if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
+
+ $('#vboxSettingsDialog').data('vboxMachineData').autostopType = document.forms['frmVboxSettings'].vboxAutostartConfigShutdownOptions.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').autostartEnabled = document.forms['frmVboxSettings'].autostartEnabled.checked;
+ if(isNaN(document.forms['frmVboxSettings'].autostartDelay.value))
+ document.forms['frmVboxSettings'].autostartDelay.value = 0;
+ $('#vboxSettingsDialog').data('vboxMachineData').autostartDelay = parseInt(document.forms['frmVboxSettings'].autostartDelay.value);
+
+
+ }
+
+ if(jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value))
+ $('#vboxSettingsDialog').data('vboxMachineData').name = jQuery.trim(document.forms['frmVboxSettings'].vboxSettingsGeneralName.value);
+
+ $('#vboxSettingsDialog').data('vboxMachineData').OSTypeId = document.forms['frmVboxSettings'].vboxSettingsGeneralOSType.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').snapshotFolder = document.forms['frmVboxSettings'].vboxSettingsGeneralSnapshotFolder.value;
+ $('#vboxSettingsDialog').data('vboxMachineData').description = $(document.forms['frmVboxSettings'].vboxSettingsGeneralDescription).val();
+
+ $('#vboxSettingsDialog').data('vboxMachineData').keyboardHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputKeyboard).val();
+ $('#vboxSettingsDialog').data('vboxMachineData').pointingHIDType = $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralInputMouse).val();
+
+ if($('#vboxPane').data('vboxConfig').enableCustomIcons)
+ $('#vboxSettingsDialog').data('vboxMachineData').customIcon = $(document.forms['frmVboxSettings'].vboxSettingsGeneralIcon).val();
+
+ var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
+ if(encSettings) {
+ var encSettingsChanged = (encSettings.enabled != $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) ||
+ (encSettings.uniqueCiphers != $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) ||
+ $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val().length > 0;
+
+ if(!encSettings.enabled && !$(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'))
+ encSettingsChanged = false;
+
+ $('#vboxSettingsDialog').data('vboxEncSettingsChanged', encSettingsChanged);
+ $('#vboxSettingsDialog').data('vboxEncEnabled', $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked'));
+ $('#vboxSettingsDialog').data('vboxEncCipher', $(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val());
+ $('#vboxSettingsDialog').data('vboxEncPw', $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val());
+ } else {
+ $('#vboxSettingsDialog').data('vboxEncSettingsChanged', false);
+ }
+
+});
+
+function vboxSettingsGeneralValidate() {
+
+ var encSettings = $('#vboxSettingsDialog').data('vboxEncSettings');
+
+ // Going from disabled to enabled
+ if(!encSettings.enabled && $(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
+
+ if(!$(document.forms['frmVboxSettings'].vboxSettingsTabGeneralEncryptionCipher).val()) {
+ vboxAlert(trans("Encryption cipher type not specified.", 'UIMachineSettingsGeneral'));
+ return false;
+ } else if(!$(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val()) {
+ vboxAlert(trans("Encryption password empty.", 'UIMachineSettingsGeneral'));
+ return false;
+ } else if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
+ vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
+ return false;
+ }
+
+ // If enabled and poasswords don't match
+ } else if($(document.forms['frmVboxSettings'].vboxSettingsGeneralEncryptionEnable).prop('checked')) {
+ if($(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword).val() != $(document.forms['frmVboxSettings'].vboxGeneralEncryptionPassword2).val()) {
+ vboxAlert(trans("Encryption passwords do not match.", 'UIMachineSettingsGeneral'));
+ return false;
+ }
+ }
+ return true;
+}
+
+</script>
+
diff --git a/panes/settingsGlobalGeneral.html b/panes/settingsGlobalGeneral.html
index 7339e34..cc22e0b 100644
--- a/panes/settingsGlobalGeneral.html
+++ b/panes/settingsGlobalGeneral.html
@@ -1,98 +1,98 @@
-<!--
-
- General Global Settings / Preferences
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsGlobalGeneral.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<table style='width: 100%' class='vboxVertical'>
- <tr style='vertical-align: middle'>
- <th><span class='translate'>Default Machine Folder:</span></th>
- <td>
- <table class="vboxInvisible" style='width: 100%'>
- <tr style='vertical-align: top'>
- <td style="width: auto; white-space: nowrap;" class="vboxFileFolderInput">
- <input type='text' class='vboxText' name='vboxSettingsDefaultMachineFolder' />
- <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
- onClick="vboxSettingsBrowseMachineFolder(this)" />
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr><td colspan='2'><hr style='width: 100%' class='vboxSeparatorLine'/></td></tr>
-
- <tr style='vertical-align: middle'>
- <th><span class='translate'>VRDP Authentication Library:</span></th>
- <td>
- <table class="vboxInvisible" style='width: 100%'>
- <tr style='vertical-align: top'>
- <td style="width: auto; white-space: nowrap;" class="vboxFileFolderInput">
- <input type='text' class='vboxText' name='vboxSettingsVRDEAuthLibrary' />
- <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
- onClick="vboxSettingsBrowseVRDPAuthLibrary(this)" />
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr style='vertical-align: middle' id='vboxAutostartConfigPropsGeneral'>
- <th><span class='translate'>Auto-start DB Path:</span></th>
- <td>
- <input type='text' class='vboxText' name='vboxAutostartConfigDBPath' />
- </td>
- </tr>
-
-</table>
-<script type='text/javascript'>
-
-/* Set Defaults */
-
-document.frmVboxSettings.vboxSettingsDefaultMachineFolder.value = $('#vboxSettingsDialog').data('vboxSystemProperties').defaultMachineFolder;
-document.frmVboxSettings.vboxSettingsVRDEAuthLibrary.value = $('#vboxSettingsDialog').data('vboxSystemProperties').VRDEAuthLibrary;
-
-// Autostart config path
-if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
-
- document.frmVboxSettings.vboxAutostartConfigDBPath.value = $('#vboxSettingsDialog').data('vboxSystemProperties').autostartDatabasePath;
-
-} else {
-
- $('#vboxAutostartConfigPropsGeneral').hide();
-}
-
-/* Browsers */
-function vboxSettingsBrowseMachineFolder(btn) {
- var def = $(btn).siblings('input').first();
- vboxFileBrowser($(def).val(),function(f){
- if(f) $(def).val(f);
- },true,trans('Default Machine Folder:','UIGlobalSettingsGeneral').replace(':',''));
-}
-
-function vboxSettingsBrowseVRDPAuthLibrary(btn) {
- var def = $(btn).siblings('input').first();
- vboxFileBrowser($(def).val(),function(f){
- if(f) $(def).val(f);
- },false,trans('VRDP Authentication Library:','UIGlobalSettingsGeneral').replace(':',''));
-}
-
-/*
- *
- * Update Data onSave()
- *
- */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxSystemProperties').defaultMachineFolder = document.frmVboxSettings.vboxSettingsDefaultMachineFolder.value;
- $('#vboxSettingsDialog').data('vboxSystemProperties').VRDEAuthLibrary = document.frmVboxSettings.vboxSettingsVRDEAuthLibrary.value;
-
- // Autostart config path
- if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
- $('#vboxSettingsDialog').data('vboxSystemProperties').autostartDatabasePath = document.frmVboxSettings.vboxAutostartConfigDBPath.value;
- }
-
-});
+<!--
+
+ General Global Settings / Preferences
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsGlobalGeneral.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<table style='width: 100%' class='vboxVertical'>
+ <tr style='vertical-align: middle'>
+ <th><span class='translate'>Default Machine Folder:</span></th>
+ <td>
+ <table class="vboxInvisible" style='width: 100%'>
+ <tr style='vertical-align: top'>
+ <td style="width: auto; white-space: nowrap;" class="vboxFileFolderInput">
+ <input type='text' class='vboxText' name='vboxSettingsDefaultMachineFolder' />
+ <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
+ onClick="vboxSettingsBrowseMachineFolder(this)" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr><td colspan='2'><hr style='width: 100%' class='vboxSeparatorLine'/></td></tr>
+
+ <tr style='vertical-align: middle'>
+ <th><span class='translate'>VRDP Authentication Library:</span></th>
+ <td>
+ <table class="vboxInvisible" style='width: 100%'>
+ <tr style='vertical-align: top'>
+ <td style="width: auto; white-space: nowrap;" class="vboxFileFolderInput">
+ <input type='text' class='vboxText' name='vboxSettingsVRDEAuthLibrary' />
+ <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)"
+ onClick="vboxSettingsBrowseVRDPAuthLibrary(this)" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr style='vertical-align: middle' id='vboxAutostartConfigPropsGeneral'>
+ <th><span class='translate'>Auto-start DB Path:</span></th>
+ <td>
+ <input type='text' class='vboxText' name='vboxAutostartConfigDBPath' />
+ </td>
+ </tr>
+
+</table>
+<script type='text/javascript'>
+
+/* Set Defaults */
+
+document.frmVboxSettings.vboxSettingsDefaultMachineFolder.value = $('#vboxSettingsDialog').data('vboxSystemProperties').defaultMachineFolder;
+document.frmVboxSettings.vboxSettingsVRDEAuthLibrary.value = $('#vboxSettingsDialog').data('vboxSystemProperties').VRDEAuthLibrary;
+
+// Autostart config path
+if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
+
+ document.frmVboxSettings.vboxAutostartConfigDBPath.value = $('#vboxSettingsDialog').data('vboxSystemProperties').autostartDatabasePath;
+
+} else {
+
+ $('#vboxAutostartConfigPropsGeneral').hide();
+}
+
+/* Browsers */
+function vboxSettingsBrowseMachineFolder(btn) {
+ var def = $(btn).siblings('input').first();
+ vboxFileBrowser($(def).val(),function(f){
+ if(f) $(def).val(f);
+ },true,trans('Default Machine Folder:','UIGlobalSettingsGeneral').replace(':',''));
+}
+
+function vboxSettingsBrowseVRDPAuthLibrary(btn) {
+ var def = $(btn).siblings('input').first();
+ vboxFileBrowser($(def).val(),function(f){
+ if(f) $(def).val(f);
+ },false,trans('VRDP Authentication Library:','UIGlobalSettingsGeneral').replace(':',''));
+}
+
+/*
+ *
+ * Update Data onSave()
+ *
+ */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxSystemProperties').defaultMachineFolder = document.frmVboxSettings.vboxSettingsDefaultMachineFolder.value;
+ $('#vboxSettingsDialog').data('vboxSystemProperties').VRDEAuthLibrary = document.frmVboxSettings.vboxSettingsVRDEAuthLibrary.value;
+
+ // Autostart config path
+ if($('#vboxPane').data('vboxConfig').vboxAutostartConfig) {
+ $('#vboxSettingsDialog').data('vboxSystemProperties').autostartDatabasePath = document.frmVboxSettings.vboxAutostartConfigDBPath.value;
+ }
+
+});
</script> \ No newline at end of file
diff --git a/panes/settingsGlobalLanguage.html b/panes/settingsGlobalLanguage.html
index 2505f1a..fc2a78b 100644
--- a/panes/settingsGlobalLanguage.html
+++ b/panes/settingsGlobalLanguage.html
@@ -1,72 +1,72 @@
-<!--
-
- Language Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsGlobalLanguage.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<table style='width: auto; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
-<tr>
-<td style='text-align: left'><span class='translate'>Interface Language:</span></td>
-</tr>
-<tr>
-<td>
- <div style='width: 100%; height: 100%;'>
- <ul id='vboxLanguageList' class='vboxBordered vboxList vboxHover'>
- <li class='vboxListItem'>Default</li>
- </ul>
- <div id='vboxLanguageName' style='text-align: center; padding: 4px;'></div>
- </div>
-</td>
-</tr>
-</table>
-<script type='text/javascript'>
-
-/* Fill Languages */
-var vboxLanguages = [
- {'id':'en','name':'English'},
- {'id':'pt_br','name':'Portuguese (Brazil)','name_tr':'Português (Brasil)'},
- {'id':'ru','name':'Russian','name_tr':'Русский'},
- {'id':'it','name':'Italian','name_tr':'Italiano'},
- {'id':'fr','name':'French','name_tr':'Français'},
- {'id':'de','name':'German','name_tr':'Deutsch'},
- {'id':'es','name':'Spanish','name_tr':'Español'},
- {'id':'ja','name':'Japanese','name_tr':'日本語'},
- {'id':'pl','name':'Polish','name_tr':'Polski'},
- {'id':'zh_cn','name':'Chinese (China)','name_tr':'简体中文 (中国)'},
- {'id':'zh_tw','name':'Traditional Chinese','name_tr':'正體中文'},
- {'id':'ro','name':'Romanian','name_tr':'Română'},
- {'id':'nl','name':'Dutch','name_tr':'Nederlands (Nederland)'},
- {'id':'cs','name':'Czech','name_tr':'čeština'},
-];
-var lList = $('#vboxLanguageList');
-$(lList).children().remove();
-var defLang = __vboxLangName;
-if (!defLang) defLang = 'en';
-for(var i = 0; i < vboxLanguages.length; i++) {
-
- var li = $('<li />').data({'language':vboxLanguages[i]}).html((vboxLanguages[i].name_tr ? vboxLanguages[i].name_tr : vboxLanguages[i].name)).attr('class','vboxListItem').hoverClass("vboxHover");
-
- if(defLang == vboxLanguages[i].id) {
- $(li).addClass('vboxListItemSelected');
- $('#vboxLanguageName').html(vboxLanguages[i].name + (vboxLanguages[i].name_tr ? (' / ' + vboxLanguages[i].name_tr) : ''));
- }
- $(li).click(function(){
- $(this).addClass('vboxListItemSelected').siblings().removeClass('vboxListItemSelected');
- $('#vboxLanguageName').html($(this).data('language').name + ($(this).data('language').name_tr ? (' / ' + $(this).data('language').name_tr) : ''));
- });
- $(lList).append(li);
-}
-
-/*
- *
- * Update Data onSave()
- *
- */
-$('#vboxSettingsDialog').on('save',function(){
- var lang = $('#vboxLanguageList').children('li.vboxListItemSelected').first().data('language');
- if(!lang) return;
- $('#vboxSettingsDialog').data('language', lang.id);
-});
-</script>
+<!--
+
+ Language Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsGlobalLanguage.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<table style='width: auto; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
+<tr>
+<td style='text-align: left'><span class='translate'>Interface Language:</span></td>
+</tr>
+<tr>
+<td>
+ <div style='width: 100%; height: 100%;'>
+ <ul id='vboxLanguageList' class='vboxBordered vboxList vboxHover'>
+ <li class='vboxListItem'>Default</li>
+ </ul>
+ <div id='vboxLanguageName' style='text-align: center; padding: 4px;'></div>
+ </div>
+</td>
+</tr>
+</table>
+<script type='text/javascript'>
+
+/* Fill Languages */
+var vboxLanguages = [
+ {'id':'en','name':'English'},
+ {'id':'pt_br','name':'Portuguese (Brazil)','name_tr':'Português (Brasil)'},
+ {'id':'ru','name':'Russian','name_tr':'Русский'},
+ {'id':'it','name':'Italian','name_tr':'Italiano'},
+ {'id':'fr','name':'French','name_tr':'Français'},
+ {'id':'de','name':'German','name_tr':'Deutsch'},
+ {'id':'es','name':'Spanish','name_tr':'Español'},
+ {'id':'ja','name':'Japanese','name_tr':'日本語'},
+ {'id':'pl','name':'Polish','name_tr':'Polski'},
+ {'id':'zh_cn','name':'Chinese (China)','name_tr':'简体中文 (中国)'},
+ {'id':'zh_tw','name':'Traditional Chinese','name_tr':'正體中文'},
+ {'id':'ro','name':'Romanian','name_tr':'Română'},
+ {'id':'nl','name':'Dutch','name_tr':'Nederlands (Nederland)'},
+ {'id':'cs','name':'Czech','name_tr':'čeština'},
+];
+var lList = $('#vboxLanguageList');
+$(lList).children().remove();
+var defLang = __vboxLangName;
+if (!defLang) defLang = 'en';
+for(var i = 0; i < vboxLanguages.length; i++) {
+
+ var li = $('<li />').data({'language':vboxLanguages[i]}).html((vboxLanguages[i].name_tr ? vboxLanguages[i].name_tr : vboxLanguages[i].name)).attr('class','vboxListItem').hoverClass("vboxHover");
+
+ if(defLang == vboxLanguages[i].id) {
+ $(li).addClass('vboxListItemSelected');
+ $('#vboxLanguageName').html(vboxLanguages[i].name + (vboxLanguages[i].name_tr ? (' / ' + vboxLanguages[i].name_tr) : ''));
+ }
+ $(li).click(function(){
+ $(this).addClass('vboxListItemSelected').siblings().removeClass('vboxListItemSelected');
+ $('#vboxLanguageName').html($(this).data('language').name + ($(this).data('language').name_tr ? (' / ' + $(this).data('language').name_tr) : ''));
+ });
+ $(lList).append(li);
+}
+
+/*
+ *
+ * Update Data onSave()
+ *
+ */
+$('#vboxSettingsDialog').on('save',function(){
+ var lang = $('#vboxLanguageList').children('li.vboxListItemSelected').first().data('language');
+ if(!lang) return;
+ $('#vboxSettingsDialog').data('language', lang.id);
+});
+</script>
diff --git a/panes/settingsGlobalNetwork.html b/panes/settingsGlobalNetwork.html
index 0fe0b56..557b36e 100644
--- a/panes/settingsGlobalNetwork.html
+++ b/panes/settingsGlobalNetwork.html
@@ -1,658 +1,658 @@
-<!--
-
- General Network Preferences
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsGlobalNetwork.html 597 2015-04-20 11:41:28Z imoore76 $
-
- -->
-<ul>
- <li><a href="#vboxGlobalNATNetworks"><span class='translate'>NAT Networks</span></a>
- <li><a href="#vboxGlobalHostNetworking"><span class='translate'>Host-only Networks</span></a>
-</ul>
-<div id='vboxGlobalNATNetworks'>
- <table style='width: 100%; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
- <tr style='vertical-align:top'>
- <td>
- <div class='vboxBordered' style='height: 280px'>
- <table style='width:100%; border-spacing: 0px;' class='vboxList vboxHover'>
- <thead>
- <tr>
- <th style='width: 140px; padding-left: 4px;text-align:left' class='translate'>Active</th>
- <th style='text-align:left' class='translate'>Name</th>
- </tr>
- </thead>
- <tbody id='vboxSettingsGlobalNATNetList'>
- <tr><td>asdf</td><td>asdf</td></tr>
- </tbody>
- </table>
- </div>
- </td>
- <td style='width: 1%; padding: 4px;' id='vboxSettingsGlobalNATNetToolbar'></td>
- </tr>
- </table>
-</div>
-<div id='vboxGlobalHostNetworking'>
- <table style='width: 100%; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
- <tr style='vertical-align:top'>
- <td >
- <ul id='vboxSettingsGlobalNetList' class='vboxBordered vboxList vboxHover' style='width: 100%; margin-top: 0px;'>
- <li>interface</li>
- </ul>
- </td>
- <td style='width: 1%; padding: 4px;' id='vboxSettingsGlobalNetToolbar'></td>
- </tr>
- </table>
-</div>
-
-<!-- Edit Host Networking Properties Dialog -->
-<div id='vboxSettingsGlobalNetEditDialog' style='display: none'>
-
- <div id='vboxSettingsGlobalNetEdit' class='vboxTabbed'>
- <ul>
- <li><a href="#vboxSettingsGlobalNetEditAdapter"><span class='translate'>Adapter</span></a></li>
- <li><a href="#vboxSettingsGlobalNetEditDHCP"><span class='translate'>DHCP Server</span></a></li>
- </ul>
- <div id="vboxSettingsGlobalNetEditAdapter" class="vboxDialogContent vboxTabContent">
- <table class="vboxSettingsTable">
- <tr>
- <th><span class='translate'>IPv4 Address:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv4' /></td>
- </tr>
- <tr>
- <th><span class='translate'>IPv4 Network Mask:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv4Mask' /></td>
- </tr>
- <tr>
- <th><span class='translate'>IPv6 Address:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv6' /></td>
- </tr>
- <tr>
- <th><span class='translate'>IPv6 Network Mask Length:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv6Mask' /></td>
- </tr>
- </table>
- </div>
- <div id="vboxSettingsGlobalNetEditDHCP" class='vboxDialogContent vboxTabContent'>
- <table class="vboxSettingsTable">
- <tr>
- <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' id='vboxSettingsGlobalNetDHCPEnabled' /> <span class='translate'>Enable Server</span></label></td>
- </tr>
- <tr>
- <th><span class='translate'>Server Address:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetServerAddress' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Server Mask:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetServerMask' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Lower Address Bound:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetLower' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Upper Address Bound:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetUpper' /></td>
- </tr>
- </table>
- </div>
- </div>
-</div>
-
-
-<!-- Edit NAT NET Networking Properties Dialog -->
-<div id='vboxSettingsGlobalNATNetworkEditDialog' style='display: none'>
-
-
- <div class='vboxDialogContent'>
- <table class="vboxSettingsTable">
- <tr>
- <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' id='vboxSettingsGlobalNATNetEnabled' /> <span class='translate'>Enable Network</span></label></td>
- </tr>
- <tr>
- <th><span class='translate'>Network Name:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNATNetName' style='width:200px' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Network CIDR:</span></th>
- <td><input type='text' class='vboxText' id='vboxSettingsGlobalNATNetNetwork' style='width:200px' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Network Options:</span></th>
- <td><label><input type='checkbox' class='vboxCheckbox' id='vboxSettingsGlobalNATNetDHCP' /> <span class='translate vboxEnablerListen'>Supports DHCP</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox vboxEnablerTrigger' id='vboxSettingsGlobalNATNetIPv6' /> <span class='translate vboxEnablerListen'>Supports IPv6</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' id='vboxSettingsGlobalNATNetIPv6Route' /> <span class='translate vboxEnablerListen'>Advertise Default IPv6 Route</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><input type='button' class='vboxButton' id='vboxSettingsGlobalNATNetRules' value='Port Forwarding' /></td>
- </tr>
- </table>
- </div>
-</div>
-
-
-
-
-<script type='text/javascript'>
-
-/* Build Host interface Toolbar */
-
-var sButtons = new Array(
-
- {
- 'name' : 'addNet',
- 'label' : 'Add host-only network',
- 'icon' : 'add_host_iface',
- 'enabled' : function () { return true; },
- 'click' : function () {
-
- var refreshInterfaces = function(){
- var l = new vboxLoader();
- l.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
- l.onLoad = function(){
- vboxSettingsGlobalNetworkAddAdpaters();
- vboxVMDataMediator.refreshVMData('host');
- };
- l.run();
- };
-
- var l = new vboxLoader();
- l.add('hostOnlyInterfaceCreate',function(d){
-
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- $('#vboxSettingsGlobalNetList').html('<li><img src="images/spinner.gif" /></li>');
- setTimeout(refreshInterfaces,2000);
- },null,trans('Add host-only network','UIGlobalSettingsNetwork'),'',true);
- }
-
- });
-
- l.run();
-
- }
- },
-
- {
- 'name' : 'delNet',
- 'label' : 'Remove host-only network',
- 'icon' : 'remove_host_iface',
- 'enabled' : function (item) { return ($(item).data('interface')); },
- 'click' : function () {
-
- var item = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first();
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- var dialog = this;
- var item = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first();
-
- var l = new vboxLoader();
- l.add('hostOnlyInterfaceRemove',function(d){
-
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
- var l2 = new vboxLoader();
- l2.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
- l2.onLoad = function(){
- vboxSettingsGlobalNetworkAddAdpaters();
- vboxVMDataMediator.refreshVMData('host');
- };
- l2.run();
- },null,trans('Remove host-only network','UIGlobalSettingsNetwork'),'',true);
- }
-
- },{'id':$(item).data('interface').id});
-
- l.onLoad = function(){$(dialog).empty().remove();};
- l.run();
- };
- vboxConfirm(trans("<p>Deleting this host-only network will remove " +
- "the host-only interface this network is based on. Do you want to " +
- "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" +
- "<p><b>Note:</b> this interface may be in use by one or more " +
- "virtual network adapters belonging to one of your VMs. " +
- "After it is removed, these adapters will no longer be usable until " +
- "you correct their settings by either choosing a different interface " +
- "name or a different adapter attachment type.</p>",'UIMessageCenter').replace('%1',$(item).data('interface').name),buttons);
- }
- },
- {
- 'name' : 'editNet',
- 'label' : 'Edit host-only network',
- 'icon' : 'guesttools',
- 'enabled' : function (item) { return ($(item).data('interface')); },
- 'click' : function () {
- vboxSettingsGlobalNetEditDialog();
- }
- },{
- name : 'refreshNet',
- 'label' : 'Refresh',
- 'language_context': 'UIVMLogViewer',
- 'icon' : 'refresh',
- click: function() {
- var l = new vboxLoader();
- l.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
- l.onLoad = function(){
- vboxSettingsGlobalNetworkAddAdpaters();
- };
- l.run();
- }
- }
-);
-
-var netToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIGlobalSettingsNetwork'});
-netToolbar.renderTo('vboxSettingsGlobalNetToolbar');
-
-$('#vboxSettingsGlobalNetList').on('select',function(e,i){
- netToolbar.update(i);
-});
-
-
-/* Build nat network Toolbar */
-
-var sButtons = new Array(
-
- {
- 'name' : 'addNet',
- 'label' : 'Add NAT network',
- 'icon' : 'add_host_iface',
- 'click' : function () {
-
- // Elect name...
- var netNameTpl = 'NatNetwork';
- var number = 1;
- var netName = netNameTpl + number++;
-
- while($('#vboxSettingsGlobalNATNetList').find('td:contains("'+netName+'")').length) {
- netName = netNameTpl + number++;
- }
- vboxSettingsGlobalNATNetworksAddNet({'enabled':false,'networkName':netName,'portForwardRules4':[],'portForwardRules6':[]});
-
-
- }
- },
-
- {
- 'name' : 'delNet',
- 'label' : 'Remove NAT network',
- 'icon' : 'remove_host_iface',
- 'enabled' : function (item) { return (item); },
- 'click' : function () {
-
- var item = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first();
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- $(item).remove();
- $('#vboxSettingsGlobalNATNetList').trigger('select', null);
- $(this).empty().remove();
- };
- vboxConfirm(trans("<p>Deleting this host-only network will remove " +
- "the host-only interface this network is based on. Do you want to " +
- "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" +
- "<p><b>Note:</b> this interface may be in use by one or more " +
- "virtual network adapters belonging to one of your VMs. " +
- "After it is removed, these adapters will no longer be usable until " +
- "you correct their settings by either choosing a different interface " +
- "name or a different adapter attachment type.</p>",'UIMessageCenter').replace('%1',$(item).data('NATNetwork').networkName),buttons);
- }
- },
- {
- 'name' : 'editNet',
- 'label' : 'Edit NAT network',
- 'icon' : 'guesttools',
- 'enabled' : function (item) { return (item); },
- 'click' : function () {
- vboxSettingsGlobalNATNetworkEditDialog();
- }
- },{
- name : 'refreshNet',
- 'label' : 'Refresh',
- 'language_context': 'UIVMLogViewer',
- 'icon' : 'refresh',
- click: function() {
- var l = new vboxLoader();
- l.add('vboxNATNetworksGet',function(d){$('#vboxSettingsDialog').data('vboxNATNetworks',d.responseData);});
- l.onLoad = function(){
- vboxSettingsGlobalNATNetworksAdd();
- };
- l.run();
- }
- }
-);
-
-var natNetToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIGlobalSettingsNetwork'});
-natNetToolbar.renderTo('vboxSettingsGlobalNATNetToolbar');
-
-$('#vboxSettingsGlobalNATNetList').on('select',function(e,i){
- natNetToolbar.update(i);
-});
-
-/*
- *
- * Function to fill network adapters
- *
- */
-function vboxSettingsGlobalNetworkAddAdpater(n) {
-
- // If the adapter exists, don't add it
- var exists = false;
- $('#vboxSettingsGlobalNetList').children('li').each(function(){
- if($(this).data('interface').id == n.id) {
- exists = true;
- return false;
- }
- });
-
- if(exists) return;
-
- $('<li />').attr({'class':'vboxListItem'}).html($('<div />').text(n.name).html()).hoverClass('vboxHover').data('interface',n).click(function(){
- $(this).parent().children('li.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(this).addClass('vboxListItemSelected').removeClass('vboxListItem');
- $('#vboxSettingsGlobalNetList').trigger('select',this);
- }).appendTo($('#vboxSettingsGlobalNetList'));
-
-}
-
-/*
- *
- * Fill network adapters
- *
- */
-function vboxSettingsGlobalNetworkAddAdpaters() {
- $('#vboxSettingsGlobalNetList').children().remove();
- var nics = $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces;
- for(var i = 0; i < nics.length; i++) {
- vboxSettingsGlobalNetworkAddAdpater(nics[i]);
- }
- $('#vboxSettingsGlobalNetList').trigger('select',null);
-}
-vboxSettingsGlobalNetworkAddAdpaters();
-
-/*
- *
- * FIll nat networks
- */
-function vboxSettingsGlobalNATNetworksAdd() {
- var nets = $('#vboxSettingsDialog').data('vboxNATNetworks');
- $('#vboxSettingsGlobalNATNetList').empty();
- for(var i = 0; i < nets.length; i++) {
- nets[i].orig_networkName = nets[i].networkName;
- vboxSettingsGlobalNATNetworksAddNet(nets[i]);
- }
- $('#vboxSettingsGlobalNATNetList').trigger('select',null);
-}
-
-function vboxSettingsGlobalNATNetworksAddNet(net) {
-
- $('<tr />').data({'NATNetwork':net}).hoverClass('vboxHover').addClass('vboxListItem').append(
- $('<td />').append(
- $('<input />').attr({'type':'checkbox'}).click(function(){
- $(this).closest('tr').data('NATNetwork').enabled = this.checked;
- $(this).closest('tr').data('NATNetwork')._modified = true;
- }).prop('checked', net.enabled)
-
- ).click(function(){
- $(this).parent().parent().children('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(this).parent().addClass('vboxListItemSelected').removeClass('vboxListItem');
- $('#vboxSettingsGlobalNATNetList').trigger('select',this);
- })
- ).append(
- $('<td />').html($('<div />').html(net.networkName).text()).click(function(){
- $(this).parent().parent().children('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(this).parent().addClass('vboxListItemSelected').removeClass('vboxListItem');
- $('#vboxSettingsGlobalNATNetList').trigger('select',this);
- })
- ).appendTo($('#vboxSettingsGlobalNATNetList'));
-
-}
-
-vboxSettingsGlobalNATNetworksAdd();
-
-/*
- *
- * Edit Network Interface Dialog
- *
- */
-vboxInitDisplay('vboxSettingsGlobalNetEditDialog','UIGlobalSettingsNetworkDetails');
-
-var buttons = {};
-buttons[trans('OK','QIMessageBox')] = function(){
-
- var nic = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface');
-
- nic.IPAddress = $('#vboxSettingsGlobalNetIPv4').val();
- nic.networkMask = $('#vboxSettingsGlobalNetIPv4Mask').val();
- nic.IPV6Address = $('#vboxSettingsGlobalNetIPv6').val();
- nic.IPV6NetworkMaskPrefixLength = $('#vboxSettingsGlobalNetIPv6Mask').val();
- nic.dhcpServer = {};
- nic.dhcpServer.networkName = nic.networkName;
- nic.dhcpServer.enabled = $('#vboxSettingsGlobalNetDHCPEnabled').prop('checked');
- nic.dhcpServer.IPAddress = $('#vboxSettingsGlobalNetServerAddress').val();
- nic.dhcpServer.networkMask = $('#vboxSettingsGlobalNetServerMask').val();
- nic.dhcpServer.lowerIP = $('#vboxSettingsGlobalNetLower').val();
- nic.dhcpServer.upperIP = $('#vboxSettingsGlobalNetUpper').val();
-
- $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface',nic);
-
- $(this).dialog("close");
-};
-buttons[trans('Cancel','QIMessageBox')] = function(){$(this).dialog("close");};
-$('#vboxSettingsGlobalNetEditDialog').dialog({'buttons':buttons,'width':500,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' +trans('Host-only Network Details','UIGlobalSettingsNetworkDetails')});
-
-
-function vboxSettingsGlobalNetEditDialog() {
-
- var nic = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface');
-
- // Set Form Values
- $('#vboxSettingsGlobalNetIPv4').val(nic.IPAddress);
- $('#vboxSettingsGlobalNetIPv4Mask').val(nic.networkMask);
-
- if(nic.IPV6Supported) {
- $('#vboxSettingsGlobalNetIPv6').prop('disabled',false).val(nic.IPV6Address).closest('tr').find('span').removeClass('vboxDisabled');
- $('#vboxSettingsGlobalNetIPv6Mask').prop('disabled',false).val(nic.IPV6NetworkMaskPrefixLength).closest('tr').find('span').removeClass('vboxDisabled');
- } else {
- $('#vboxSettingsGlobalNetIPv6').prop('disabled',true).val('').closest('tr').find('span').addClass('vboxDisabled');
- $('#vboxSettingsGlobalNetIPv6Mask').prop('disabled',true).val('').closest('tr').find('span').addClass('vboxDisabled');
- }
-
- if(nic.dhcpServer && nic.dhcpServer.networkName) {
- $('#vboxSettingsGlobalNetServerAddress').val(nic.dhcpServer.IPAddress);
- $('#vboxSettingsGlobalNetServerMask').val(nic.dhcpServer.networkMask);
- $('#vboxSettingsGlobalNetLower').val(nic.dhcpServer.lowerIP);
- $('#vboxSettingsGlobalNetUpper').val(nic.dhcpServer.upperIP);
- } else {
- $('#vboxSettingsGlobalNetServerAddress').val('');
- $('#vboxSettingsGlobalNetServerMask').val('');
- $('#vboxSettingsGlobalNetLower').val('');
- $('#vboxSettingsGlobalNetUpper').val('');
- }
-
-
- $('#vboxSettingsGlobalNetEdit').tabs('option','active',0);
- $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
-
- if(nic.dhcpServer && nic.dhcpServer.enabled && !$('#vboxSettingsGlobalNetDHCPEnabled').prop('checked')) {
- $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
- } else if(nic.dhcpServer && !nic.dhcpServer.enabled && $('#vboxSettingsGlobalNetDHCPEnabled').prop('checked')) {
- $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
- }
-
- $('#vboxSettingsGlobalNetEditDialog').dialog('open');
-
-}
-
-/*
-*
-* Edit NAT Network Interface Dialog
-*
-*/
-vboxInitDisplay('vboxSettingsGlobalNATNetworkEditDialog', 'UIGlobalSettingsNetworkDetailsNAT');
-
-var buttons = {};
-buttons[trans('OK','QIMessageBox')] = function(){
-
- var net = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork');
-
- // Get Form Values
- net.enabled = $('#vboxSettingsGlobalNATNetEnabled').prop('checked');
- net.networkName = $('#vboxSettingsGlobalNATNetName').val();
- net.network = $('#vboxSettingsGlobalNATNetNetwork').val();
- net.needDhcpServer = $('#vboxSettingsGlobalNATNetDHCP').prop('checked');
- net.IPv6Enabled = $('#vboxSettingsGlobalNATNetIPv6').prop('checked');
- net.advertiseDefaultIPv6RouteEnabled = $('#vboxSettingsGlobalNATNetIPv6Route').prop('checked');
- net._modified = true;
-
- $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork',net).find('input').prop('checked', net.enabled);
-
- $(this).dialog("close");
-};
-buttons[trans('Cancel','QIMessageBox')] = function(){$(this).dialog("close");};
-$('#vboxSettingsGlobalNATNetworkEditDialog').dialog({'buttons':buttons,'width':500,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' +trans('Host-only Network Details','UIGlobalSettingsNetworkDetails')});
-$('#vboxSettingsGlobalNATNetIPv6').on('enable',function() {
- if(this.checked) {
- $('#vboxSettingsGlobalNATNetIPv6Route').prop('disabled', false).siblings().removeClass('vboxDisabled');
- } else {
- $('#vboxSettingsGlobalNATNetIPv6Route').prop('disabled', true).siblings().addClass('vboxDisabled');
- }
-}).on('click',function(){
- $(this).trigger('enable');
-});
-
-function vboxSettingsGlobalNATNetworkEditDialog() {
-
- var net = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork');
-
- // Set Form Values
- $('#vboxSettingsGlobalNATNetEnabled').prop('checked', net.enabled);
- $('#vboxSettingsGlobalNATNetName').val(net.networkName);
- $('#vboxSettingsGlobalNATNetNetwork').val(net.network);
- $('#vboxSettingsGlobalNATNetDHCP').prop('checked', net.needDhcpServer)
- $('#vboxSettingsGlobalNATNetIPv6').prop('checked', net.IPv6Enabled)
- $('#vboxSettingsGlobalNATNetIPv6Route').prop('checked', net.advertiseDefaultIPv6RouteEnabled)
-
- $('#vboxSettingsGlobalNATNetEnabled').triggerHandler('click');
- $('#vboxSettingsGlobalNATNetIPv6').triggerHandler('click');
-
- $('#vboxSettingsGlobalNATNetRules').val(trans('Port Forwarding', 'UIGlobalSettingsNetworkDetailsNAT')).off('click').on('click',function(){
- vboxSettingsGlobalNetworkNatPortForwardingDialog(net, $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first());
- });
-
- $('#vboxSettingsGlobalNATNetworkEditDialog').dialog('open');
-
-}
-
-
-function vboxSettingsGlobalNetworkNatPortForwardingDialog(net, row) {
-
- if($('#vboxSettingsGlobalNetworkNatPortForwardingDialog')[0])
- $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').empty().remove();
-
- var l = new vboxLoader();
- l.addFileToDOM("panes/settingsGlobalNetworkNATPortForwarding.html");
- l.onLoad = function(){
-
- vboxSettingsGlobalNetworkNatPortForwardingInit(net.portForwardRules4, false);
- vboxSettingsGlobalNetworkNatPortForwardingInit(net.portForwardRules6, true);
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
-
- // wrap ips in []
- var wrapIp = function(ip) {
- ip = ip.trim();
- if(!ip) return '[]';
- if(ip[0] != '[') $ip = '[' + ip;
- if(ip[ip.length-1] != ']') ip += ']';
- return ip;
- }
-
- // Get rules
- var none=0;
- do {
- var ruleNum = 4 + (none*2);
- var rules = $('#vboxSettingsGlobalNetworkNatPortForwardingListIPv'+ruleNum).children('tr');
- var rulesToPass = new Array();
- for(var i = 0; i < rules.length; i++) {
- if($(rules[i]).data('vboxRule')[3] == 0 || $(rules[i]).data('vboxRule')[5] == 0) {
- vboxAlert(trans("The current port forwarding rules are not valid. " +
- "None of the host or guest port values may be set to zero.",'UIMessageCenter'));
- return;
- }
-
- rulesToPass[i] = $(rules[i]).data('vboxRule');
-
- rulesToPass[i][0] = rulesToPass[i][0].replace(':','');
- rulesToPass[i][2] = wrapIp(rulesToPass[i][2]);
- rulesToPass[i][4] = wrapIp(rulesToPass[i][4]);
-
- rulesToPass[i] = rulesToPass[i].join(':');
- }
- $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork')['portForwardRules'+ruleNum] = rulesToPass;
-
- } while(none++ < 1)
-
- $(this).trigger('close').empty().remove();
-
-
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).trigger('close').empty().remove();
- };
-
- vboxInitDisplay($('#vboxSettingsGlobalNetworkNatPortForwardingDialog'), 'UIPortForwardingModel');
-
- $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').tabs();
-
- $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').dialog({'closeOnEscape':true,'width':840,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Port Forwarding Rules','UIMachineSettingsPortForwardingDlg')}).on("dialogbeforeclose",function(){
- $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
- });
-
-
- };
- l.run();
-
-}
-
-/*
- *
- * Update Data onSave()
- *
- */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces = new Array();
-
- $('#vboxSettingsGlobalNetList').children('li').each(function(){
- $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces.push($(this).data('interface'));
- });
-
- var nets = [];
-
- $('#vboxSettingsGlobalNATNetList').children('tr').each(function(){
- nets.push($(this).data('NATNetwork'));
- });
- $('#vboxSettingsDialog').data('vboxNATNetworks',nets);
-
-});
-
-/*
- * Remove dialogs on close
- */
-$('#vboxSettingsDialog').on('close',function(){
- $('#vboxSettingsGlobalNetEditDialog').remove();
- $('#vboxSettingsGlobalNATNetworkEditDialog').remove();
-});
-
+<!--
+
+ General Network Preferences
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsGlobalNetwork.html 597 2015-04-20 11:41:28Z imoore76 $
+
+ -->
+<ul>
+ <li><a href="#vboxGlobalNATNetworks"><span class='translate'>NAT Networks</span></a>
+ <li><a href="#vboxGlobalHostNetworking"><span class='translate'>Host-only Networks</span></a>
+</ul>
+<div id='vboxGlobalNATNetworks'>
+ <table style='width: 100%; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
+ <tr style='vertical-align:top'>
+ <td>
+ <div class='vboxBordered' style='height: 280px'>
+ <table style='width:100%; border-spacing: 0px;' class='vboxList vboxHover'>
+ <thead>
+ <tr>
+ <th style='width: 140px; padding-left: 4px;text-align:left' class='translate'>Active</th>
+ <th style='text-align:left' class='translate'>Name</th>
+ </tr>
+ </thead>
+ <tbody id='vboxSettingsGlobalNATNetList'>
+ <tr><td>asdf</td><td>asdf</td></tr>
+ </tbody>
+ </table>
+ </div>
+ </td>
+ <td style='width: 1%; padding: 4px;' id='vboxSettingsGlobalNATNetToolbar'></td>
+ </tr>
+ </table>
+</div>
+<div id='vboxGlobalHostNetworking'>
+ <table style='width: 100%; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
+ <tr style='vertical-align:top'>
+ <td >
+ <ul id='vboxSettingsGlobalNetList' class='vboxBordered vboxList vboxHover' style='width: 100%; margin-top: 0px;'>
+ <li>interface</li>
+ </ul>
+ </td>
+ <td style='width: 1%; padding: 4px;' id='vboxSettingsGlobalNetToolbar'></td>
+ </tr>
+ </table>
+</div>
+
+<!-- Edit Host Networking Properties Dialog -->
+<div id='vboxSettingsGlobalNetEditDialog' style='display: none'>
+
+ <div id='vboxSettingsGlobalNetEdit' class='vboxTabbed'>
+ <ul>
+ <li><a href="#vboxSettingsGlobalNetEditAdapter"><span class='translate'>Adapter</span></a></li>
+ <li><a href="#vboxSettingsGlobalNetEditDHCP"><span class='translate'>DHCP Server</span></a></li>
+ </ul>
+ <div id="vboxSettingsGlobalNetEditAdapter" class="vboxDialogContent vboxTabContent">
+ <table class="vboxSettingsTable">
+ <tr>
+ <th><span class='translate'>IPv4 Address:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv4' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>IPv4 Network Mask:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv4Mask' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>IPv6 Address:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv6' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>IPv6 Network Mask Length:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetIPv6Mask' /></td>
+ </tr>
+ </table>
+ </div>
+ <div id="vboxSettingsGlobalNetEditDHCP" class='vboxDialogContent vboxTabContent'>
+ <table class="vboxSettingsTable">
+ <tr>
+ <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' id='vboxSettingsGlobalNetDHCPEnabled' /> <span class='translate'>Enable Server</span></label></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Server Address:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetServerAddress' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Server Mask:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetServerMask' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Lower Address Bound:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetLower' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Upper Address Bound:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNetUpper' /></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+</div>
+
+
+<!-- Edit NAT NET Networking Properties Dialog -->
+<div id='vboxSettingsGlobalNATNetworkEditDialog' style='display: none'>
+
+
+ <div class='vboxDialogContent'>
+ <table class="vboxSettingsTable">
+ <tr>
+ <td colspan='2'><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' id='vboxSettingsGlobalNATNetEnabled' /> <span class='translate'>Enable Network</span></label></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Network Name:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNATNetName' style='width:200px' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Network CIDR:</span></th>
+ <td><input type='text' class='vboxText' id='vboxSettingsGlobalNATNetNetwork' style='width:200px' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Network Options:</span></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' id='vboxSettingsGlobalNATNetDHCP' /> <span class='translate vboxEnablerListen'>Supports DHCP</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox vboxEnablerTrigger' id='vboxSettingsGlobalNATNetIPv6' /> <span class='translate vboxEnablerListen'>Supports IPv6</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' id='vboxSettingsGlobalNATNetIPv6Route' /> <span class='translate vboxEnablerListen'>Advertise Default IPv6 Route</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><input type='button' class='vboxButton' id='vboxSettingsGlobalNATNetRules' value='Port Forwarding' /></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+
+
+
+<script type='text/javascript'>
+
+/* Build Host interface Toolbar */
+
+var sButtons = new Array(
+
+ {
+ 'name' : 'addNet',
+ 'label' : 'Add host-only network',
+ 'icon' : 'add_host_iface',
+ 'enabled' : function () { return true; },
+ 'click' : function () {
+
+ var refreshInterfaces = function(){
+ var l = new vboxLoader();
+ l.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
+ l.onLoad = function(){
+ vboxSettingsGlobalNetworkAddAdpaters();
+ vboxVMDataMediator.refreshVMData('host');
+ };
+ l.run();
+ };
+
+ var l = new vboxLoader();
+ l.add('hostOnlyInterfaceCreate',function(d){
+
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ $('#vboxSettingsGlobalNetList').html('<li><img src="images/spinner.gif" /></li>');
+ setTimeout(refreshInterfaces,2000);
+ },null,trans('Add host-only network','UIGlobalSettingsNetwork'),'',true);
+ }
+
+ });
+
+ l.run();
+
+ }
+ },
+
+ {
+ 'name' : 'delNet',
+ 'label' : 'Remove host-only network',
+ 'icon' : 'remove_host_iface',
+ 'enabled' : function (item) { return ($(item).data('interface')); },
+ 'click' : function () {
+
+ var item = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first();
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ var dialog = this;
+ var item = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first();
+
+ var l = new vboxLoader();
+ l.add('hostOnlyInterfaceRemove',function(d){
+
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+ var l2 = new vboxLoader();
+ l2.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
+ l2.onLoad = function(){
+ vboxSettingsGlobalNetworkAddAdpaters();
+ vboxVMDataMediator.refreshVMData('host');
+ };
+ l2.run();
+ },null,trans('Remove host-only network','UIGlobalSettingsNetwork'),'',true);
+ }
+
+ },{'id':$(item).data('interface').id});
+
+ l.onLoad = function(){$(dialog).empty().remove();};
+ l.run();
+ };
+ vboxConfirm(trans("<p>Deleting this host-only network will remove " +
+ "the host-only interface this network is based on. Do you want to " +
+ "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" +
+ "<p><b>Note:</b> this interface may be in use by one or more " +
+ "virtual network adapters belonging to one of your VMs. " +
+ "After it is removed, these adapters will no longer be usable until " +
+ "you correct their settings by either choosing a different interface " +
+ "name or a different adapter attachment type.</p>",'UIMessageCenter').replace('%1',$(item).data('interface').name),buttons);
+ }
+ },
+ {
+ 'name' : 'editNet',
+ 'label' : 'Edit host-only network',
+ 'icon' : 'guesttools',
+ 'enabled' : function (item) { return ($(item).data('interface')); },
+ 'click' : function () {
+ vboxSettingsGlobalNetEditDialog();
+ }
+ },{
+ name : 'refreshNet',
+ 'label' : 'Refresh',
+ 'language_context': 'UIVMLogViewer',
+ 'icon' : 'refresh',
+ click: function() {
+ var l = new vboxLoader();
+ l.add('hostOnlyInterfacesGet',function(d){$('#vboxSettingsDialog').data('vboxHostOnlyInterfaces',d.responseData);});
+ l.onLoad = function(){
+ vboxSettingsGlobalNetworkAddAdpaters();
+ };
+ l.run();
+ }
+ }
+);
+
+var netToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIGlobalSettingsNetwork'});
+netToolbar.renderTo('vboxSettingsGlobalNetToolbar');
+
+$('#vboxSettingsGlobalNetList').on('select',function(e,i){
+ netToolbar.update(i);
+});
+
+
+/* Build nat network Toolbar */
+
+var sButtons = new Array(
+
+ {
+ 'name' : 'addNet',
+ 'label' : 'Add NAT network',
+ 'icon' : 'add_host_iface',
+ 'click' : function () {
+
+ // Elect name...
+ var netNameTpl = 'NatNetwork';
+ var number = 1;
+ var netName = netNameTpl + number++;
+
+ while($('#vboxSettingsGlobalNATNetList').find('td:contains("'+netName+'")').length) {
+ netName = netNameTpl + number++;
+ }
+ vboxSettingsGlobalNATNetworksAddNet({'enabled':false,'networkName':netName,'portForwardRules4':[],'portForwardRules6':[]});
+
+
+ }
+ },
+
+ {
+ 'name' : 'delNet',
+ 'label' : 'Remove NAT network',
+ 'icon' : 'remove_host_iface',
+ 'enabled' : function (item) { return (item); },
+ 'click' : function () {
+
+ var item = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first();
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ $(item).remove();
+ $('#vboxSettingsGlobalNATNetList').trigger('select', null);
+ $(this).empty().remove();
+ };
+ vboxConfirm(trans("<p>Deleting this host-only network will remove " +
+ "the host-only interface this network is based on. Do you want to " +
+ "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" +
+ "<p><b>Note:</b> this interface may be in use by one or more " +
+ "virtual network adapters belonging to one of your VMs. " +
+ "After it is removed, these adapters will no longer be usable until " +
+ "you correct their settings by either choosing a different interface " +
+ "name or a different adapter attachment type.</p>",'UIMessageCenter').replace('%1',$(item).data('NATNetwork').networkName),buttons);
+ }
+ },
+ {
+ 'name' : 'editNet',
+ 'label' : 'Edit NAT network',
+ 'icon' : 'guesttools',
+ 'enabled' : function (item) { return (item); },
+ 'click' : function () {
+ vboxSettingsGlobalNATNetworkEditDialog();
+ }
+ },{
+ name : 'refreshNet',
+ 'label' : 'Refresh',
+ 'language_context': 'UIVMLogViewer',
+ 'icon' : 'refresh',
+ click: function() {
+ var l = new vboxLoader();
+ l.add('vboxNATNetworksGet',function(d){$('#vboxSettingsDialog').data('vboxNATNetworks',d.responseData);});
+ l.onLoad = function(){
+ vboxSettingsGlobalNATNetworksAdd();
+ };
+ l.run();
+ }
+ }
+);
+
+var natNetToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIGlobalSettingsNetwork'});
+natNetToolbar.renderTo('vboxSettingsGlobalNATNetToolbar');
+
+$('#vboxSettingsGlobalNATNetList').on('select',function(e,i){
+ natNetToolbar.update(i);
+});
+
+/*
+ *
+ * Function to fill network adapters
+ *
+ */
+function vboxSettingsGlobalNetworkAddAdpater(n) {
+
+ // If the adapter exists, don't add it
+ var exists = false;
+ $('#vboxSettingsGlobalNetList').children('li').each(function(){
+ if($(this).data('interface').id == n.id) {
+ exists = true;
+ return false;
+ }
+ });
+
+ if(exists) return;
+
+ $('<li />').attr({'class':'vboxListItem'}).html($('<div />').text(n.name).html()).hoverClass('vboxHover').data('interface',n).click(function(){
+ $(this).parent().children('li.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(this).addClass('vboxListItemSelected').removeClass('vboxListItem');
+ $('#vboxSettingsGlobalNetList').trigger('select',this);
+ }).appendTo($('#vboxSettingsGlobalNetList'));
+
+}
+
+/*
+ *
+ * Fill network adapters
+ *
+ */
+function vboxSettingsGlobalNetworkAddAdpaters() {
+ $('#vboxSettingsGlobalNetList').children().remove();
+ var nics = $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces;
+ for(var i = 0; i < nics.length; i++) {
+ vboxSettingsGlobalNetworkAddAdpater(nics[i]);
+ }
+ $('#vboxSettingsGlobalNetList').trigger('select',null);
+}
+vboxSettingsGlobalNetworkAddAdpaters();
+
+/*
+ *
+ * FIll nat networks
+ */
+function vboxSettingsGlobalNATNetworksAdd() {
+ var nets = $('#vboxSettingsDialog').data('vboxNATNetworks');
+ $('#vboxSettingsGlobalNATNetList').empty();
+ for(var i = 0; i < nets.length; i++) {
+ nets[i].orig_networkName = nets[i].networkName;
+ vboxSettingsGlobalNATNetworksAddNet(nets[i]);
+ }
+ $('#vboxSettingsGlobalNATNetList').trigger('select',null);
+}
+
+function vboxSettingsGlobalNATNetworksAddNet(net) {
+
+ $('<tr />').data({'NATNetwork':net}).hoverClass('vboxHover').addClass('vboxListItem').append(
+ $('<td />').append(
+ $('<input />').attr({'type':'checkbox'}).click(function(){
+ $(this).closest('tr').data('NATNetwork').enabled = this.checked;
+ $(this).closest('tr').data('NATNetwork')._modified = true;
+ }).prop('checked', net.enabled)
+
+ ).click(function(){
+ $(this).parent().parent().children('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(this).parent().addClass('vboxListItemSelected').removeClass('vboxListItem');
+ $('#vboxSettingsGlobalNATNetList').trigger('select',this);
+ })
+ ).append(
+ $('<td />').html($('<div />').html(net.networkName).text()).click(function(){
+ $(this).parent().parent().children('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(this).parent().addClass('vboxListItemSelected').removeClass('vboxListItem');
+ $('#vboxSettingsGlobalNATNetList').trigger('select',this);
+ })
+ ).appendTo($('#vboxSettingsGlobalNATNetList'));
+
+}
+
+vboxSettingsGlobalNATNetworksAdd();
+
+/*
+ *
+ * Edit Network Interface Dialog
+ *
+ */
+vboxInitDisplay('vboxSettingsGlobalNetEditDialog','UIGlobalSettingsNetworkDetails');
+
+var buttons = {};
+buttons[trans('OK','QIMessageBox')] = function(){
+
+ var nic = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface');
+
+ nic.IPAddress = $('#vboxSettingsGlobalNetIPv4').val();
+ nic.networkMask = $('#vboxSettingsGlobalNetIPv4Mask').val();
+ nic.IPV6Address = $('#vboxSettingsGlobalNetIPv6').val();
+ nic.IPV6NetworkMaskPrefixLength = $('#vboxSettingsGlobalNetIPv6Mask').val();
+ nic.dhcpServer = {};
+ nic.dhcpServer.networkName = nic.networkName;
+ nic.dhcpServer.enabled = $('#vboxSettingsGlobalNetDHCPEnabled').prop('checked');
+ nic.dhcpServer.IPAddress = $('#vboxSettingsGlobalNetServerAddress').val();
+ nic.dhcpServer.networkMask = $('#vboxSettingsGlobalNetServerMask').val();
+ nic.dhcpServer.lowerIP = $('#vboxSettingsGlobalNetLower').val();
+ nic.dhcpServer.upperIP = $('#vboxSettingsGlobalNetUpper').val();
+
+ $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface',nic);
+
+ $(this).dialog("close");
+};
+buttons[trans('Cancel','QIMessageBox')] = function(){$(this).dialog("close");};
+$('#vboxSettingsGlobalNetEditDialog').dialog({'buttons':buttons,'width':500,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' +trans('Host-only Network Details','UIGlobalSettingsNetworkDetails')});
+
+
+function vboxSettingsGlobalNetEditDialog() {
+
+ var nic = $('#vboxSettingsGlobalNetList').children('li.vboxListItemSelected').first().data('interface');
+
+ // Set Form Values
+ $('#vboxSettingsGlobalNetIPv4').val(nic.IPAddress);
+ $('#vboxSettingsGlobalNetIPv4Mask').val(nic.networkMask);
+
+ if(nic.IPV6Supported) {
+ $('#vboxSettingsGlobalNetIPv6').prop('disabled',false).val(nic.IPV6Address).closest('tr').find('span').removeClass('vboxDisabled');
+ $('#vboxSettingsGlobalNetIPv6Mask').prop('disabled',false).val(nic.IPV6NetworkMaskPrefixLength).closest('tr').find('span').removeClass('vboxDisabled');
+ } else {
+ $('#vboxSettingsGlobalNetIPv6').prop('disabled',true).val('').closest('tr').find('span').addClass('vboxDisabled');
+ $('#vboxSettingsGlobalNetIPv6Mask').prop('disabled',true).val('').closest('tr').find('span').addClass('vboxDisabled');
+ }
+
+ if(nic.dhcpServer && nic.dhcpServer.networkName) {
+ $('#vboxSettingsGlobalNetServerAddress').val(nic.dhcpServer.IPAddress);
+ $('#vboxSettingsGlobalNetServerMask').val(nic.dhcpServer.networkMask);
+ $('#vboxSettingsGlobalNetLower').val(nic.dhcpServer.lowerIP);
+ $('#vboxSettingsGlobalNetUpper').val(nic.dhcpServer.upperIP);
+ } else {
+ $('#vboxSettingsGlobalNetServerAddress').val('');
+ $('#vboxSettingsGlobalNetServerMask').val('');
+ $('#vboxSettingsGlobalNetLower').val('');
+ $('#vboxSettingsGlobalNetUpper').val('');
+ }
+
+
+ $('#vboxSettingsGlobalNetEdit').tabs('option','active',0);
+ $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
+
+ if(nic.dhcpServer && nic.dhcpServer.enabled && !$('#vboxSettingsGlobalNetDHCPEnabled').prop('checked')) {
+ $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
+ } else if(nic.dhcpServer && !nic.dhcpServer.enabled && $('#vboxSettingsGlobalNetDHCPEnabled').prop('checked')) {
+ $('#vboxSettingsGlobalNetDHCPEnabled').trigger('click');
+ }
+
+ $('#vboxSettingsGlobalNetEditDialog').dialog('open');
+
+}
+
+/*
+*
+* Edit NAT Network Interface Dialog
+*
+*/
+vboxInitDisplay('vboxSettingsGlobalNATNetworkEditDialog', 'UIGlobalSettingsNetworkDetailsNAT');
+
+var buttons = {};
+buttons[trans('OK','QIMessageBox')] = function(){
+
+ var net = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork');
+
+ // Get Form Values
+ net.enabled = $('#vboxSettingsGlobalNATNetEnabled').prop('checked');
+ net.networkName = $('#vboxSettingsGlobalNATNetName').val();
+ net.network = $('#vboxSettingsGlobalNATNetNetwork').val();
+ net.needDhcpServer = $('#vboxSettingsGlobalNATNetDHCP').prop('checked');
+ net.IPv6Enabled = $('#vboxSettingsGlobalNATNetIPv6').prop('checked');
+ net.advertiseDefaultIPv6RouteEnabled = $('#vboxSettingsGlobalNATNetIPv6Route').prop('checked');
+ net._modified = true;
+
+ $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork',net).find('input').prop('checked', net.enabled);
+
+ $(this).dialog("close");
+};
+buttons[trans('Cancel','QIMessageBox')] = function(){$(this).dialog("close");};
+$('#vboxSettingsGlobalNATNetworkEditDialog').dialog({'buttons':buttons,'width':500,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' +trans('Host-only Network Details','UIGlobalSettingsNetworkDetails')});
+$('#vboxSettingsGlobalNATNetIPv6').on('enable',function() {
+ if(this.checked) {
+ $('#vboxSettingsGlobalNATNetIPv6Route').prop('disabled', false).siblings().removeClass('vboxDisabled');
+ } else {
+ $('#vboxSettingsGlobalNATNetIPv6Route').prop('disabled', true).siblings().addClass('vboxDisabled');
+ }
+}).on('click',function(){
+ $(this).trigger('enable');
+});
+
+function vboxSettingsGlobalNATNetworkEditDialog() {
+
+ var net = $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork');
+
+ // Set Form Values
+ $('#vboxSettingsGlobalNATNetEnabled').prop('checked', net.enabled);
+ $('#vboxSettingsGlobalNATNetName').val(net.networkName);
+ $('#vboxSettingsGlobalNATNetNetwork').val(net.network);
+ $('#vboxSettingsGlobalNATNetDHCP').prop('checked', net.needDhcpServer)
+ $('#vboxSettingsGlobalNATNetIPv6').prop('checked', net.IPv6Enabled)
+ $('#vboxSettingsGlobalNATNetIPv6Route').prop('checked', net.advertiseDefaultIPv6RouteEnabled)
+
+ $('#vboxSettingsGlobalNATNetEnabled').triggerHandler('click');
+ $('#vboxSettingsGlobalNATNetIPv6').triggerHandler('click');
+
+ $('#vboxSettingsGlobalNATNetRules').val(trans('Port Forwarding', 'UIGlobalSettingsNetworkDetailsNAT')).off('click').on('click',function(){
+ vboxSettingsGlobalNetworkNatPortForwardingDialog(net, $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first());
+ });
+
+ $('#vboxSettingsGlobalNATNetworkEditDialog').dialog('open');
+
+}
+
+
+function vboxSettingsGlobalNetworkNatPortForwardingDialog(net, row) {
+
+ if($('#vboxSettingsGlobalNetworkNatPortForwardingDialog')[0])
+ $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').empty().remove();
+
+ var l = new vboxLoader();
+ l.addFileToDOM("panes/settingsGlobalNetworkNATPortForwarding.html");
+ l.onLoad = function(){
+
+ vboxSettingsGlobalNetworkNatPortForwardingInit(net.portForwardRules4, false);
+ vboxSettingsGlobalNetworkNatPortForwardingInit(net.portForwardRules6, true);
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+
+ // wrap ips in []
+ var wrapIp = function(ip) {
+ ip = ip.trim();
+ if(!ip) return '[]';
+ if(ip[0] != '[') $ip = '[' + ip;
+ if(ip[ip.length-1] != ']') ip += ']';
+ return ip;
+ }
+
+ // Get rules
+ var none=0;
+ do {
+ var ruleNum = 4 + (none*2);
+ var rules = $('#vboxSettingsGlobalNetworkNatPortForwardingListIPv'+ruleNum).children('tr');
+ var rulesToPass = new Array();
+ for(var i = 0; i < rules.length; i++) {
+ if($(rules[i]).data('vboxRule')[3] == 0 || $(rules[i]).data('vboxRule')[5] == 0) {
+ vboxAlert(trans("The current port forwarding rules are not valid. " +
+ "None of the host or guest port values may be set to zero.",'UIMessageCenter'));
+ return;
+ }
+
+ rulesToPass[i] = $(rules[i]).data('vboxRule');
+
+ rulesToPass[i][0] = rulesToPass[i][0].replace(':','');
+ rulesToPass[i][2] = wrapIp(rulesToPass[i][2]);
+ rulesToPass[i][4] = wrapIp(rulesToPass[i][4]);
+
+ rulesToPass[i] = rulesToPass[i].join(':');
+ }
+ $('#vboxSettingsGlobalNATNetList').children('tr.vboxListItemSelected').first().data('NATNetwork')['portForwardRules'+ruleNum] = rulesToPass;
+
+ } while(none++ < 1)
+
+ $(this).trigger('close').empty().remove();
+
+
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).trigger('close').empty().remove();
+ };
+
+ vboxInitDisplay($('#vboxSettingsGlobalNetworkNatPortForwardingDialog'), 'UIPortForwardingModel');
+
+ $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').tabs();
+
+ $('#vboxSettingsGlobalNetworkNatPortForwardingDialog').dialog({'closeOnEscape':true,'width':840,'height':400,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/nw_16px.png" class="vboxDialogTitleIcon" /> ' + trans('Port Forwarding Rules','UIMachineSettingsPortForwardingDlg')}).on("dialogbeforeclose",function(){
+ $(this).parent().find('span:contains("'+trans('Cancel','QIMessageBox')+'")').trigger('click');
+ });
+
+
+ };
+ l.run();
+
+}
+
+/*
+ *
+ * Update Data onSave()
+ *
+ */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces = new Array();
+
+ $('#vboxSettingsGlobalNetList').children('li').each(function(){
+ $('#vboxSettingsDialog').data('vboxHostOnlyInterfaces').networkInterfaces.push($(this).data('interface'));
+ });
+
+ var nets = [];
+
+ $('#vboxSettingsGlobalNATNetList').children('tr').each(function(){
+ nets.push($(this).data('NATNetwork'));
+ });
+ $('#vboxSettingsDialog').data('vboxNATNetworks',nets);
+
+});
+
+/*
+ * Remove dialogs on close
+ */
+$('#vboxSettingsDialog').on('close',function(){
+ $('#vboxSettingsGlobalNetEditDialog').remove();
+ $('#vboxSettingsGlobalNATNetworkEditDialog').remove();
+});
+
</script> \ No newline at end of file
diff --git a/panes/settingsGlobalUsers.html b/panes/settingsGlobalUsers.html
index 70fad74..65c7b58 100644
--- a/panes/settingsGlobalUsers.html
+++ b/panes/settingsGlobalUsers.html
@@ -1,259 +1,259 @@
-<!--
-
- User list
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsGlobalUsers.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div>
-<table style='width: auto; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
- <tr>
- <td colspan='2'><span class='translate'>Users</span>:</td>
- </tr>
- <tr style='vertical-align:top'>
- <td style='width: 400px'>
- <ul id='vboxSettingsUserList' class='vboxBordered vboxList vboxHover' style='width: 400px; margin-top: 0px;'>
- <li>user</li>
- </ul>
- </td>
- <td style='width: 10px' id='vboxSettingsGlobalUsersToolbar'></td>
- </tr>
-</table>
-
-
-<!-- Main Div -->
-</div>
-
-
-<script type='text/javascript'>
-
-/* Build Toolbar */
-
-/*
- * Init Users buttons and toolbar
- */
-
-var sButtons = new Array(
-
- {
- 'name' : 'addUser',
- 'label' : 'Add User',
- 'icon' : 'vm_new',
- 'click' : function () {
-
- var l = new vboxLoader();
- l.addFileToDOM('panes/userEdit.html');
- l.onLoad = function(){
-
- // Set mode
- $('#vboxUserEdit').trigger('setMode','addUser');
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
- var u = $('#vboxUserEdit').find('input[name=username]').first().val();
- var p1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
- var p2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
- var a = $('#vboxUserEdit').find('input[name=admin]').first().prop('checked');
- if(u.length == 0) {
- $(this).remove();
- return;
- }
- if(p1.length == 0 || (p1 != p2)) {
- vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
- return;
- }
- var dialog = this;
- var chp = new vboxLoader();
- chp.add('addUser',function(d){
- if(d) {
- if(d.success) {
- vboxSettingsGlobalAddUserList({'username':u,'admin':a});
- $(dialog).remove();
- } else {
- vboxAlert(trans('A user with that username already exists.','UIUsers'),{'width':'auto'});
- }
- } else {
- // unknown error
- $(dialog).remove();
- }
- },{'u':u,'p':p1,'a':a});
- chp.run();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).remove();
- };
- $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':500,'height':220,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/vm_new_16px.png" class="vboxDialogTitleIcon" /> '+trans('Add User','UIUsers')});
-
- };
- l.run();
- }
- },
-
- {
- 'name' : 'delUser',
- 'label' : 'Remove User',
- 'icon' : 'vm_delete',
- 'noDisabledIcon' : true,
- 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') != $('#vboxPane').data('vboxSession').user); },
- 'click' : function () {
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
- var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
- var l = new vboxLoader();
- l.add('delUser',function(d){
- if(d && d.success) {
- $('#vboxSettingsUserList').children('li.vboxListItemSelected').remove();
- $('#vboxSettingsUserList').trigger('select',null);
- }
- },{'u':user.username});
- l.run();
- $(this).remove();
- };
- var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
- vboxConfirm(trans('Are you sure you want to remove the user <b>%s</b>? This action cannot be undone.','UIUsers').replace('%s',user.username),buttons);
- }
- },
- {
- 'name' : 'chpwUser',
- 'label' : 'Change Password',
- 'icon' : 'register',
- 'noDisabledIcon' : true,
- 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') == $('#vboxPane').data('vboxSession').user); },
- 'click' : function () {
- var l = new vboxLoader();
- l.addFileToDOM('panes/userEdit.html');
- l.onLoad = function(){
-
- // Set mode
- $('#vboxUserEdit').trigger('setMode','changePassword');
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
- var o = $('#vboxUserEdit').find('input[name=opass]').first().val();
- var n1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
- var n2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
- if(o.length == 0) {
- vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
- return;
- }
- if(n1.length == 0 || (n1 != n2)) {
- vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
- return;
- }
- var dialog = this;
- var chp = new vboxLoader();
- chp.add('changePassword',function(d){
- if(d) {
- if(d.success) {
- vboxAlert(trans('Password changed.','UIUsers'),{'width':'auto'});
- $(dialog).remove();
- } else {
- vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
- }
- } else {
- // unknown error
- $(dialog).remove();
- }
- },{'old':o,'new':n1});
- chp.run();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).remove();
- };
- $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':400,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Change Password','UIUsers')});
- };
- l.run();
-
- }
- },
- {
- 'name' : 'editUser',
- 'label' : 'Edit User',
- 'icon' : 'register',
- 'noDisabledIcon' : true,
- 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') != $('#vboxPane').data('vboxSession').user); },
- 'click' : function () {
-
- var l = new vboxLoader();
- l.addFileToDOM('panes/userEdit.html');
- l.onLoad = function(){
-
- // Set mode
- $('#vboxUserEdit').trigger('setMode','editUser');
-
- // Set values
- var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
- $('#vboxEditUserUsername').html(user.username);
- $('#vboxUserEdit').find('input[name=admin]').first().prop('checked', (user.admin ? true : false));
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- var p1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
- var p2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
- var a = $('#vboxUserEdit').find('input[name=admin]').first().prop('checked');
-
- if(p1.length > 0 && (p1 != p2)) {
- vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
- return;
- }
- var dialog = this;
- var chp = new vboxLoader();
- chp.add('editUser',function(d){
- if(d && d.success) {
- $('#vboxSettingsUserList').children('li.vboxListItemSelected').data({'admin':a}).html(user.username + (a ? ' ('+trans('Admin User','UIUsers')+')' : ''));
- $(dialog).remove();
- } else {
- // unknown error
- $(dialog).remove();
- }
- },{'u':user.username,'p':p1,'a':a});
- chp.run();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).remove();
- };
- $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':500,'height':230,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Edit User','UIUsers')});
-
- };
- l.run();
-
- }
- }
-);
-
-var userToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIUsers'});
-userToolbar.disabledString = 'dis';
-userToolbar.renderTo('vboxSettingsGlobalUsersToolbar');
-$('#vboxSettingsUserList').on('select', function(e,el){userToolbar.update(el);});
-
-/*
- *
- * Function to fill users
- *
- */
-function vboxSettingsGlobalAddUserList(n) {
-
- $('<li />').attr({'class':'vboxListItem'}).html($('<div />').html(n.username + (n.admin ? ' ('+trans('Admin User','UIUsers')+')' : ''))).hoverClass('vboxHover').data(n).click(function(){
- $(this).parent().children('li.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(this).addClass('vboxListItemSelected').removeClass('vboxListItem');
- $('#vboxSettingsUserList').trigger('select',this);
- }).appendTo($('#vboxSettingsUserList'));
-
-}
-
-/*
- *
- * Fill network adapters
- *
- */
-$('#vboxSettingsUserList').children().remove();
-var users = $('#vboxSettingsDialog').data('vboxUsers');
-for(var i in users) {
- vboxSettingsGlobalAddUserList(users[i]);
-}
-$('#vboxSettingsUserList').trigger('select',null);
-
-
+<!--
+
+ User list
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsGlobalUsers.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div>
+<table style='width: auto; margin-left:auto; margin-right:auto;' class='vboxInvisible'>
+ <tr>
+ <td colspan='2'><span class='translate'>Users</span>:</td>
+ </tr>
+ <tr style='vertical-align:top'>
+ <td style='width: 400px'>
+ <ul id='vboxSettingsUserList' class='vboxBordered vboxList vboxHover' style='width: 400px; margin-top: 0px;'>
+ <li>user</li>
+ </ul>
+ </td>
+ <td style='width: 10px' id='vboxSettingsGlobalUsersToolbar'></td>
+ </tr>
+</table>
+
+
+<!-- Main Div -->
+</div>
+
+
+<script type='text/javascript'>
+
+/* Build Toolbar */
+
+/*
+ * Init Users buttons and toolbar
+ */
+
+var sButtons = new Array(
+
+ {
+ 'name' : 'addUser',
+ 'label' : 'Add User',
+ 'icon' : 'vm_new',
+ 'click' : function () {
+
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/userEdit.html');
+ l.onLoad = function(){
+
+ // Set mode
+ $('#vboxUserEdit').trigger('setMode','addUser');
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+ var u = $('#vboxUserEdit').find('input[name=username]').first().val();
+ var p1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
+ var p2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
+ var a = $('#vboxUserEdit').find('input[name=admin]').first().prop('checked');
+ if(u.length == 0) {
+ $(this).remove();
+ return;
+ }
+ if(p1.length == 0 || (p1 != p2)) {
+ vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ var dialog = this;
+ var chp = new vboxLoader();
+ chp.add('addUser',function(d){
+ if(d) {
+ if(d.success) {
+ vboxSettingsGlobalAddUserList({'username':u,'admin':a});
+ $(dialog).remove();
+ } else {
+ vboxAlert(trans('A user with that username already exists.','UIUsers'),{'width':'auto'});
+ }
+ } else {
+ // unknown error
+ $(dialog).remove();
+ }
+ },{'u':u,'p':p1,'a':a});
+ chp.run();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).remove();
+ };
+ $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':500,'height':220,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/vm_new_16px.png" class="vboxDialogTitleIcon" /> '+trans('Add User','UIUsers')});
+
+ };
+ l.run();
+ }
+ },
+
+ {
+ 'name' : 'delUser',
+ 'label' : 'Remove User',
+ 'icon' : 'vm_delete',
+ 'noDisabledIcon' : true,
+ 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') != $('#vboxPane').data('vboxSession').user); },
+ 'click' : function () {
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+ var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
+ var l = new vboxLoader();
+ l.add('delUser',function(d){
+ if(d && d.success) {
+ $('#vboxSettingsUserList').children('li.vboxListItemSelected').remove();
+ $('#vboxSettingsUserList').trigger('select',null);
+ }
+ },{'u':user.username});
+ l.run();
+ $(this).remove();
+ };
+ var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
+ vboxConfirm(trans('Are you sure you want to remove the user <b>%s</b>? This action cannot be undone.','UIUsers').replace('%s',user.username),buttons);
+ }
+ },
+ {
+ 'name' : 'chpwUser',
+ 'label' : 'Change Password',
+ 'icon' : 'register',
+ 'noDisabledIcon' : true,
+ 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') == $('#vboxPane').data('vboxSession').user); },
+ 'click' : function () {
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/userEdit.html');
+ l.onLoad = function(){
+
+ // Set mode
+ $('#vboxUserEdit').trigger('setMode','changePassword');
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+ var o = $('#vboxUserEdit').find('input[name=opass]').first().val();
+ var n1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
+ var n2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
+ if(o.length == 0) {
+ vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ if(n1.length == 0 || (n1 != n2)) {
+ vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ var dialog = this;
+ var chp = new vboxLoader();
+ chp.add('changePassword',function(d){
+ if(d) {
+ if(d.success) {
+ vboxAlert(trans('Password changed.','UIUsers'),{'width':'auto'});
+ $(dialog).remove();
+ } else {
+ vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
+ }
+ } else {
+ // unknown error
+ $(dialog).remove();
+ }
+ },{'old':o,'new':n1});
+ chp.run();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).remove();
+ };
+ $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':400,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Change Password','UIUsers')});
+ };
+ l.run();
+
+ }
+ },
+ {
+ 'name' : 'editUser',
+ 'label' : 'Edit User',
+ 'icon' : 'register',
+ 'noDisabledIcon' : true,
+ 'enabled' : function (item) { return (item && $(item).data('username') && $(item).data('username') != $('#vboxPane').data('vboxSession').user); },
+ 'click' : function () {
+
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/userEdit.html');
+ l.onLoad = function(){
+
+ // Set mode
+ $('#vboxUserEdit').trigger('setMode','editUser');
+
+ // Set values
+ var user = $('#vboxSettingsUserList').children('li.vboxListItemSelected').data();
+ $('#vboxEditUserUsername').html(user.username);
+ $('#vboxUserEdit').find('input[name=admin]').first().prop('checked', (user.admin ? true : false));
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ var p1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
+ var p2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
+ var a = $('#vboxUserEdit').find('input[name=admin]').first().prop('checked');
+
+ if(p1.length > 0 && (p1 != p2)) {
+ vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ var dialog = this;
+ var chp = new vboxLoader();
+ chp.add('editUser',function(d){
+ if(d && d.success) {
+ $('#vboxSettingsUserList').children('li.vboxListItemSelected').data({'admin':a}).html(user.username + (a ? ' ('+trans('Admin User','UIUsers')+')' : ''));
+ $(dialog).remove();
+ } else {
+ // unknown error
+ $(dialog).remove();
+ }
+ },{'u':user.username,'p':p1,'a':a});
+ chp.run();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).remove();
+ };
+ $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':500,'height':230,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Edit User','UIUsers')});
+
+ };
+ l.run();
+
+ }
+ }
+);
+
+var userToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIUsers'});
+userToolbar.disabledString = 'dis';
+userToolbar.renderTo('vboxSettingsGlobalUsersToolbar');
+$('#vboxSettingsUserList').on('select', function(e,el){userToolbar.update(el);});
+
+/*
+ *
+ * Function to fill users
+ *
+ */
+function vboxSettingsGlobalAddUserList(n) {
+
+ $('<li />').attr({'class':'vboxListItem'}).html($('<div />').html(n.username + (n.admin ? ' ('+trans('Admin User','UIUsers')+')' : ''))).hoverClass('vboxHover').data(n).click(function(){
+ $(this).parent().children('li.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(this).addClass('vboxListItemSelected').removeClass('vboxListItem');
+ $('#vboxSettingsUserList').trigger('select',this);
+ }).appendTo($('#vboxSettingsUserList'));
+
+}
+
+/*
+ *
+ * Fill network adapters
+ *
+ */
+$('#vboxSettingsUserList').children().remove();
+var users = $('#vboxSettingsDialog').data('vboxUsers');
+for(var i in users) {
+ vboxSettingsGlobalAddUserList(users[i]);
+}
+$('#vboxSettingsUserList').trigger('select',null);
+
+
</script> \ No newline at end of file
diff --git a/panes/settingsNetwork.html b/panes/settingsNetwork.html
index 526d4f3..a95a6b2 100644
--- a/panes/settingsNetwork.html
+++ b/panes/settingsNetwork.html
@@ -1,529 +1,529 @@
-<!--
-
- VM Network Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsNetwork.html 597 2015-04-20 11:41:28Z imoore76 $
-
--->
-<div id='vboxSettingsTabNetAdapter' title='Adapter' style='display: none'>
-<table class='vboxVertical'>
- <tr>
- <td colspan='2'><label><input name='vboxSettingsNetEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Network Adapter</span></label></td>
- </tr>
- <tr>
- <th style='min-width: 120px'><span class='translate'>Attached to:</span></th>
- <td style='width: 100%' class='vboxEnablerTrigger'>
- <select name='vboxSettingsNetAttachedTo' onchange='vboxSettingsUpdateNetworkOptions(this);' style='width: 100%'>
- <option value='Null' class='translate'>Not attached</option>
- <option value='NAT' class='translate'>NAT</option>
- <option value='NATNetwork' class='translate'>NAT Network</option>
- <option value='Bridged' class='translate'>Bridged Adapter</option>
- <option value='Internal' class='translate'>Internal Network</option>
- <option value='HostOnly' class='translate'>Host-only Adapter</option>
- <option value='Generic' class='translate'>Generic Driver</option>
- <option value='VDE' class='translate'>VDE Adapter</option>
- </select>
- </td>
- </tr>
- <tr>
- <th class='vboxSettingsNetAdapterNamedLabel'><span class='translate'>Name:</span></th>
- <td>
- <select name='vboxSettingsNetName' class='vboxSettingsNetAdapterNamed' style='width: 100%'>
- <option value=''></option>
-
- </select>
- </td>
- </tr>
-
- <!-- Advanced NAT Settings -->
- <tr class='vboxSettingsAdvancedNat' style='display: none'>
- <th><span class='translate'>NAT Alias Mode:</span></th>
- <td>
- <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetAliasModeProxyOnly' /> <span class='translate vboxEnablerListen'>Proxy Only</span></label><br />
- <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetAliasModeSamePorts' /> <span class='translate vboxEnablerListen'>Same Ports</span></label><br />
- </td>
- </tr>
- <tr class='vboxSettingsAdvancedNat' style='display: none'>
- <th><span class='translate'>Advanced NAT Options</span> :</th>
- <td>
- <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetPassDNSDomain' /> <span class='translate vboxEnablerListen'>Pass DNS Domain</span></label><br />
- <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetDNSProxy' /> <span class='translate vboxEnablerListen'>DNS Proxy</span></label><br />
- <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetUseHostResolver' /> <span class='translate vboxEnablerListen'>Use Host Resolver</span></label><br />
- <span class='translate vboxEnablerListen'>Bind to IP</span> <input type='text' class='vboxTextbox' class='vboxEnablerListen' name='vboxSettingsNetBindIp' size='16'/>
- </td>
- </tr>
-
- <tr>
- <th>
- <input class="netImgAdvanced vboxImgButton" style='background: url(images/rightArrow.png) 3px 2px no-repeat; width: 14px; height: 14px;' type="button" value="" />
- <span class='translate'>Advanced</span></th>
- <td></td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
- <th><span class='translate'>Adapter Type:</span></th>
- <td>
- <select name='vboxSettingsNetAdapter' style='width: 100%'>
- </select>
- </td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
- <th><span class='translate'>MAC Address:</span></th>
- <td style='white-space: nowrap'><input type='text' class='vboxText' style='width: 200px' name='vboxSettingsNetMAC' size='40' />
- <input class="vboxSettingsNetMacGen vboxImgButton" style='background: url(images/vbox/refresh_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
- </td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetPromiscuousMode' style='display: none'>
- <th class='vboxSettingsNetPromiscuousMode'><span class='translate'>Promiscuous Mode:</span></th>
- <td>
- <select class='vboxSettingsNetPromiscuousMode' name='vboxSettingsNetAdapterPromiscuousMode' style='width: 100%'>
- <option value='Deny'>Deny</option>
- <option value='AllowNetwork'>Allow VMs</option>
- <option value='AllowAll'>Allow All</option>
- </select>
- </td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetGenPropsRow' style='display: none'>
- <th><span class='translate vboxRunningEnabled'>Generic Properties:</span></th>
- <td style='white-space: nowrap'>
- <textarea class='vboxRunningEnabled' rows='3' cols='20' name='vboxSettingsNetGenericProps'></textarea>
- </td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetConnected' /> <span class='translate vboxEnablerListen'>Cable Connected</span></label></td>
- </tr>
- <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetPFButton' style='display: none'>
- <th></th>
- <td><input type='button' class='vboxButton' class='vboxEnablerListen' name='vboxSettingsNetPF' value='Port Forwarding' /></td>
- </tr>
-
-</table>
-</div>
-<script type='text/javascript'>
-
-/* Translations */
-$(document.forms['frmVboxSettings'].vboxSettingsNetAttachedTo).find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
-$(document.forms['frmVboxSettings'].vboxSettingsNetAdapterPromiscuousMode).find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
-$('#vboxSettingsTabNetAdapter').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsNetwork');}).removeClass('translate');
-
-/*
- *
- * Setup data for networking options.
- *
- */
-var vboxSettingsNetAdaptersBridged = new Array();
-var vboxSettingsNetAdaptersHostOnly = new Array();
-var vboxSettingsNetNetworks = new Array();
-
-/*
- * Fill Adapter Types
- */
-var nics = $('#vboxSettingsDialog').data('vboxNetworkAdapterTypes');
-for(var i = 1; i < nics.length; i++) { // index 0 is 'Null' and not used
- var opt = new Option(trans(vboxNetworkAdapterType(nics[i]),'VBoxGlobal'),nics[i]);
- document.forms['frmVboxSettings'].vboxSettingsNetAdapter.options[document.forms['frmVboxSettings'].vboxSettingsNetAdapter.options.length] = opt;
-}
-
-
-// Shorthand
-var vboxNetworking = $('#vboxSettingsDialog').data('vboxNetworking');
-vboxNetworking.networkInterfaces = $('#vboxSettingsDialog').data('vboxHostDetails').networkInterfaces;
-
-for(var i = 0; i < vboxNetworking.networkInterfaces.length; i++) {
- if(vboxNetworking.networkInterfaces[i].interfaceType == 'Bridged') {
- vboxSettingsNetAdaptersBridged[vboxSettingsNetAdaptersBridged.length] = vboxNetworking.networkInterfaces[i].name;
- } else if(vboxNetworking.networkInterfaces[i].interfaceType == 'HostOnly') {
- vboxSettingsNetAdaptersHostOnly[vboxSettingsNetAdaptersHostOnly.length] = vboxNetworking.networkInterfaces[i].name;
- } else {
- vboxAlert('Unknown interface type :' + vboxNetworking.networkInterfaces[i].interfaceType);
- }
-}
-
-// Check for sub / virtual interfaces. These will not be reported by VirtualBox
-var vboxGuestNet = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters;
-for(var i = 0; i < vboxGuestNet.length; i++) {
- if(!vboxGuestNet[i].bridgedInterface || vboxGuestNet[i].bridgedInterface == '') continue;
- if(jQuery.inArray(vboxGuestNet[i].bridgedInterface,vboxSettingsNetAdaptersBridged) < 0) {
- vboxSettingsNetAdaptersBridged[vboxSettingsNetAdaptersBridged.length] = vboxGuestNet[i].bridgedInterface;
- }
-}
-
-
-var vboxSettingsNetTemplate = document.getElementById('vboxSettingsTabNetAdapter');
-var vboxSettingsNetContainer = $(vboxSettingsNetTemplate).parent();
-
-
-/* Network advanced show / hide */
-$('#vboxSettingsTabNetAdapter').find('input.netImgAdvanced').click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
- $(this).data('vboxAdvancedEnabled',true);
- $(this).closest('table').find('.vboxSettingsNetToggleAdvanced:not(.vboxForceHide)').css('display','');
- $(this).css('background-image','url(images/downArrow.png)');
-
- } else {
-
- $(this).data('toggleClicked', false);
- $(this).data('vboxAdvancedEnabled',false);
- $(this).closest('table').find('.vboxSettingsNetToggleAdvanced').css('display','none');
- $(this).css('background-image','url(images/rightArrow.png)');
-
- }
-});
-
-/* Mac address generator */
-$('#vboxSettingsTabNetAdapter').find('input.vboxSettingsNetMacGen').click(function(){
-
- var t = $(this).siblings('input').first();
- var oval = $(t).val();
- $(t).val('...').prop('disabled',true);
-
- var l = new vboxLoader();
- l.add('vboxGenerateMacAddress',function(d){
- if(d && d.success) $(t).val(d.responseData);
- else $(t).val(oval);
- $(t).prop('disabled',false);
- });
- l.noLoadingScreen = true;
- l.run();
-});
-
-
-/* Network adapter tab links */
-var ul = $('<ul />');
-$(vboxSettingsNetContainer).append(ul);
-
-for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
-
-
- /* tab */
- $(ul).append($('<li />').html('<a href="#' + vboxSettingsNetTemplate.id + (i + 1) +'"><span>' + trans('Adapter %1','VBoxGlobal').replace('%1',(i + 1)) + '</span></a>'));
-
- /* tab content */
- var newTab = $("#vboxSettingsTabNetAdapter").clone(true);
- newTab.attr({'id':vboxSettingsNetTemplate.id + (i + 1)}).css({'display':'block'}).find('.vboxEnablerTrigger').on('enable',function(){
- $(this).children('select').first().trigger('change');
- });
- newTab.appendTo(vboxSettingsNetContainer);
-
- /* Form elements must be unique */
- $("#vboxSettingsTabNetAdapter" + (i + 1)).find('[name]').each(function() {
- $(this).attr('name',$(this).attr('name') + (i + 1));
- });
-
-}
-
-
-/* Remove Template */
-$("#vboxSettingsTabNetAdapter").empty().remove();
-
-
-/* preload network 'advanced' down arrow image */
-var netDnAdvImg = new Image();
-netDnAdvImg.src = 'images/downArrow.png';
-
-/*
- * Called when network adpater 'attached to' changes
- */
-function vboxSettingsUpdateNetworkOptions(sel) {
-
- var ptable = $(sel).closest('table');
- var th = $(ptable).find('th.vboxSettingsNetAdapterNamedLabel').first();
- var nsel = $(ptable).find('.vboxSettingsNetAdapterNamed').first();
-
- var advEnabled = ptable.find('input.netImgAdvanced').first().data('vboxAdvancedEnabled');
-
- // Promiscuous mode selection
- if(sel.value == 'NAT' || sel.value == 'Null' || sel.value == 'Generic') {
- $(ptable).find('tr.vboxSettingsNetPromiscuousMode').addClass('vboxForceHide').hide();
- } else {
- $(ptable).find('tr.vboxSettingsNetPromiscuousMode').removeClass('vboxForceHide');
- if(advEnabled) $(ptable).find('tr.vboxSettingsNetPromiscuousMode').show();
- }
-
- // Generic properties
- if(sel.value == 'Generic') {
- $(ptable).find('tr.vboxSettingsNetGenPropsRow').removeClass('vboxForceHide');
- if(advEnabled) $(ptable).find('tr.vboxSettingsNetGenPropsRow').show();
- } else {
- $(ptable).find('tr.vboxSettingsNetGenPropsRow').hide().addClass('vboxForceHide');
- }
-
- // Port forward button
- if(sel.value == 'NAT') {
- $(ptable).find('tr.vboxSettingsNetPFButton').removeClass('vboxForceHide');
- if(advEnabled) $(ptable).find('tr.vboxSettingsNetPFButton').show();
- } else {
- $(ptable).find('tr.vboxSettingsNetPFButton').addClass('vboxForceHide').hide();
- }
-
- // Name box
- if(sel.value == 'Null' || sel.value == 'NAT') {
-
- $(th).addClass('vboxDisabled');
-
- $(nsel).children().remove();
- $(nsel).prop('disabled',true);
-
- if(sel.value == 'NAT' && $('#vboxPane').data('vboxConfig').enableAdvancedConfig) ptable.find('tr.vboxSettingsAdvancedNat').css('display','');
- else ptable.find('tr.vboxSettingsAdvancedNat').css('display','none');
-
-
- } else {
-
- ptable.find('tr.vboxSettingsAdvancedNat').css('display','none');
-
- $(th).removeClass('vboxDisabled');
-
- $(nsel).children().remove();
- $(nsel).prop('disabled',false);
-
- // Special case for certian network selects
- if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value=='Generic' || sel.value=='Bridged' || sel.value=='NATNetwork') {
- var isel = $(nsel).clone(false);
- $(nsel).replaceWith(isel);
- nsel = isel;
- }
-
- var defaultSel = $(sel).data('vboxDefault');
-
- switch(sel.value) {
- case 'Bridged':
- src = vboxSettingsNetAdaptersBridged;
- break;
- case 'HostOnly':
- src = vboxSettingsNetAdaptersHostOnly;
- break;
- case 'Internal':
- src = $('#vboxSettingsDialog').data('vboxNetworking').networks;
- break;
- case 'Generic':
- src = $('#vboxSettingsDialog').data('vboxNetworking').genericDrivers;
- break;
- case 'NATNetwork':
- src = $('#vboxSettingsDialog').data('vboxNetworking').natNetworks;
- break;
- case 'VDE':
- src = $('#vboxSettingsDialog').data('vboxNetworking').vdenetworks;
- break;
- default:
- vboxAlert('Unknown network binding type: ' + sel.value);
- }
-
- for(var i = 0; i < src.length; i++) {
- var hSrc = $('<div />').text(src[i]).html();
- $(nsel).append('<option ' + (src[i] == defaultSel ? ' selected ' : '') + ' value="' + hSrc + '">' + hSrc + '</option>');
- }
- }
-
- // Special case for Internal, Generic, and VDE network selects
- if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value == 'Generic' || sel.value == 'Bridged') {
- $(nsel).jec();
- }
-
-}
-
-/* Change settings onShow() when VM is running */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
-
- /* Net values */
- var vboxVDEFound = false; // check for VDE attachments
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
-
- var a = (i + 1);
-
- // attached to
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType).trigger('change');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].selectedIndex]).attr('selected','selected');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).change();
-
- // Device or network name, depending on what 'attached to' is
- var netName = '';
- switch($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType) {
- case 'Bridged':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].bridgedInterface;
- break;
- case 'HostOnly':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].hostOnlyInterface;
- break;
- case 'Internal':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].internalNetwork;
- break;
- case 'Generic':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].genericDriver;
- break;
- case 'NATNetwork':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATNetwork;
- break;
- case 'VDE':
- netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].VDENetwork;
- vboxVDEFound = true;
- break;
- }
-
- // hold default value
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).data('vboxDefault', netName);
-
- document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value = netName;
-
- document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].value = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].adapterType;
- document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].value = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].MACAddress;
- document.forms['frmVboxSettings'].elements['vboxSettingsNetConnected'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].cableConnected ? true : false);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapterPromiscuousMode'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].promiscModePolicy);
-
- document.forms['frmVboxSettings'].elements['vboxSettingsNetGenericProps'+a].innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].properties;
-
- // Enabled adapter
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].enabled).triggerHandler('click');;
-
-
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetPF'+a]).unbind('click');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetPF'+a]).click(function(){
-
- var nicIndex = (parseInt($(this).attr('name').substr(17))-1);
-
- $.when(vboxPortForwardConfigDialog($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[nicIndex].redirects))
- .done(function(rules){
- for(var i = 0; i < rules.length; i++) {
- rules[i] = rules[i].join(',');
- }
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[nicIndex].redirects = rules;
- });
-
- }).val(trans('Port Forwarding','UIMachineSettingsNetwork'));
-
- // Set Nat values
- if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeProxyOnly'+a].checked = (($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 2) ? true : false);
- document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeSamePorts'+a].checked = (($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 4) ? true : false);
- document.forms['frmVboxSettings'].elements['vboxSettingsNetPassDNSDomain'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSPassDomain ? true : false);
- document.forms['frmVboxSettings'].elements['vboxSettingsNetDNSProxy'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSProxy ? true : false);
- document.forms['frmVboxSettings'].elements['vboxSettingsNetUseHostResolver'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSUseHostResolver ? true : false);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetBindIp'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.hostIP);
- }
-
-
- }
- /* Disable VDE selection? */
- if(!vboxVDEFound && !$('#vboxPane').data('vboxConfig').enableVDE) {
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+(i+1)]).children("[value='VDE']").remove();
- }
- }
-
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
-
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
-
- var a = (i + 1);
-
- /* Disable these inputs */
- document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].disabled ='disabled';
- document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].disabled ='disabled';
- document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].disabled ='disabled';
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).siblings('input').css('display','none');
-
- /* Disable these labels */
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).closest('tr').children().addClass('vboxDisabled');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a]).closest('tr').children().addClass('vboxDisabled');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).closest('tr').children().addClass('vboxDisabled');
-
- }
- // Expand all advanced settings
- $('#vboxSettingsDialog').find('input.netImgAdvanced').each(function(){
- if(!$(this).data('vboxAdvancedEnabled')) $(this).trigger('click');
- });
-
- // Disable mac address generation
- $('#vboxSettingsDialog').find('input.vboxSettingsNetMacGen').prop('disabled',true);
-
- } else {
-
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
-
- var a = (i + 1);
-
- /* Enable these inputs */
- document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].disabled ='';
- document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].disabled ='';
- document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].disabled ='';
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).siblings('input').css('display','');
-
- /* Enable these labels */
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).closest('tr').children().removeClass('vboxDisabled');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a]).closest('tr').children().removeClass('vboxDisabled');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).closest('tr').children().removeClass('vboxDisabled');
-
- }
-
- // Enable mac address generation
- $('#vboxSettingsDialog').find('input.vboxSettingsNetMacGen').prop('disabled',false);
-
- }
-
-/* Change settings onSave() */
-}).on('save',function(){
-
- /* Net */
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
-
- var a = (i + 1);
-
- // attached to
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType = document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].value;
-
- // Device or network name, depending on what 'attached to' is
- switch($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType) {
- case 'Bridged':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].bridgedInterface = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;;
- case 'HostOnly':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].hostOnlyInterface = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;;
- break;
- case 'Generic':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].genericDriver = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
- break;
- case 'Internal':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].internalNetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
- break;
- case 'NATNetwork':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATNetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
- break;
- case 'VDE':
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].VDENetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
- break;
- }
-
- // Set Nat values
- if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- var aliasMode = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 1;
- if(document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeProxyOnly'+a].checked) {
- aliasMode |= 2;
- }
- if(document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeSamePorts'+a].checked) {
- aliasMode |= 4;
- }
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode = aliasMode;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSPassDomain = document.forms['frmVboxSettings'].elements['vboxSettingsNetPassDNSDomain'+a].checked;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSProxy = document.forms['frmVboxSettings'].elements['vboxSettingsNetDNSProxy'+a].checked;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSUseHostResolver = document.forms['frmVboxSettings'].elements['vboxSettingsNetUseHostResolver'+a].checked;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.hostIP = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetBindIp'+a]).val();
- }
-
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].properties = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetGenericProps'+a]).val();
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].promiscModePolicy = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapterPromiscuousMode'+a]).val();
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].adapterType = document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].value;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].MACAddress = document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].value;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].cableConnected = document.forms['frmVboxSettings'].elements['vboxSettingsNetConnected'+a].checked;
- $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].checked;
-
- }
-
-});
-
-</script>
-
-
+<!--
+
+ VM Network Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsNetwork.html 597 2015-04-20 11:41:28Z imoore76 $
+
+-->
+<div id='vboxSettingsTabNetAdapter' title='Adapter' style='display: none'>
+<table class='vboxVertical'>
+ <tr>
+ <td colspan='2'><label><input name='vboxSettingsNetEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Network Adapter</span></label></td>
+ </tr>
+ <tr>
+ <th style='min-width: 120px'><span class='translate'>Attached to:</span></th>
+ <td style='width: 100%' class='vboxEnablerTrigger'>
+ <select name='vboxSettingsNetAttachedTo' onchange='vboxSettingsUpdateNetworkOptions(this);' style='width: 100%'>
+ <option value='Null' class='translate'>Not attached</option>
+ <option value='NAT' class='translate'>NAT</option>
+ <option value='NATNetwork' class='translate'>NAT Network</option>
+ <option value='Bridged' class='translate'>Bridged Adapter</option>
+ <option value='Internal' class='translate'>Internal Network</option>
+ <option value='HostOnly' class='translate'>Host-only Adapter</option>
+ <option value='Generic' class='translate'>Generic Driver</option>
+ <option value='VDE' class='translate'>VDE Adapter</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th class='vboxSettingsNetAdapterNamedLabel'><span class='translate'>Name:</span></th>
+ <td>
+ <select name='vboxSettingsNetName' class='vboxSettingsNetAdapterNamed' style='width: 100%'>
+ <option value=''></option>
+
+ </select>
+ </td>
+ </tr>
+
+ <!-- Advanced NAT Settings -->
+ <tr class='vboxSettingsAdvancedNat' style='display: none'>
+ <th><span class='translate'>NAT Alias Mode:</span></th>
+ <td>
+ <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetAliasModeProxyOnly' /> <span class='translate vboxEnablerListen'>Proxy Only</span></label><br />
+ <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetAliasModeSamePorts' /> <span class='translate vboxEnablerListen'>Same Ports</span></label><br />
+ </td>
+ </tr>
+ <tr class='vboxSettingsAdvancedNat' style='display: none'>
+ <th><span class='translate'>Advanced NAT Options</span> :</th>
+ <td>
+ <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetPassDNSDomain' /> <span class='translate vboxEnablerListen'>Pass DNS Domain</span></label><br />
+ <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetDNSProxy' /> <span class='translate vboxEnablerListen'>DNS Proxy</span></label><br />
+ <label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetUseHostResolver' /> <span class='translate vboxEnablerListen'>Use Host Resolver</span></label><br />
+ <span class='translate vboxEnablerListen'>Bind to IP</span> <input type='text' class='vboxTextbox' class='vboxEnablerListen' name='vboxSettingsNetBindIp' size='16'/>
+ </td>
+ </tr>
+
+ <tr>
+ <th>
+ <input class="netImgAdvanced vboxImgButton" style='background: url(images/rightArrow.png) 3px 2px no-repeat; width: 14px; height: 14px;' type="button" value="" />
+ <span class='translate'>Advanced</span></th>
+ <td></td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
+ <th><span class='translate'>Adapter Type:</span></th>
+ <td>
+ <select name='vboxSettingsNetAdapter' style='width: 100%'>
+ </select>
+ </td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
+ <th><span class='translate'>MAC Address:</span></th>
+ <td style='white-space: nowrap'><input type='text' class='vboxText' style='width: 200px' name='vboxSettingsNetMAC' size='40' />
+ <input class="vboxSettingsNetMacGen vboxImgButton" style='background: url(images/vbox/refresh_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
+ </td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetPromiscuousMode' style='display: none'>
+ <th class='vboxSettingsNetPromiscuousMode'><span class='translate'>Promiscuous Mode:</span></th>
+ <td>
+ <select class='vboxSettingsNetPromiscuousMode' name='vboxSettingsNetAdapterPromiscuousMode' style='width: 100%'>
+ <option value='Deny'>Deny</option>
+ <option value='AllowNetwork'>Allow VMs</option>
+ <option value='AllowAll'>Allow All</option>
+ </select>
+ </td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetGenPropsRow' style='display: none'>
+ <th><span class='translate vboxRunningEnabled'>Generic Properties:</span></th>
+ <td style='white-space: nowrap'>
+ <textarea class='vboxRunningEnabled' rows='3' cols='20' name='vboxSettingsNetGenericProps'></textarea>
+ </td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced' style='display: none'>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' class='vboxEnablerListen' name='vboxSettingsNetConnected' /> <span class='translate vboxEnablerListen'>Cable Connected</span></label></td>
+ </tr>
+ <tr class='vboxSettingsNetToggleAdvanced vboxSettingsNetPFButton' style='display: none'>
+ <th></th>
+ <td><input type='button' class='vboxButton' class='vboxEnablerListen' name='vboxSettingsNetPF' value='Port Forwarding' /></td>
+ </tr>
+
+</table>
+</div>
+<script type='text/javascript'>
+
+/* Translations */
+$(document.forms['frmVboxSettings'].vboxSettingsNetAttachedTo).find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
+$(document.forms['frmVboxSettings'].vboxSettingsNetAdapterPromiscuousMode).find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
+$('#vboxSettingsTabNetAdapter').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsNetwork');}).removeClass('translate');
+
+/*
+ *
+ * Setup data for networking options.
+ *
+ */
+var vboxSettingsNetAdaptersBridged = new Array();
+var vboxSettingsNetAdaptersHostOnly = new Array();
+var vboxSettingsNetNetworks = new Array();
+
+/*
+ * Fill Adapter Types
+ */
+var nics = $('#vboxSettingsDialog').data('vboxNetworkAdapterTypes');
+for(var i = 1; i < nics.length; i++) { // index 0 is 'Null' and not used
+ var opt = new Option(trans(vboxNetworkAdapterType(nics[i]),'VBoxGlobal'),nics[i]);
+ document.forms['frmVboxSettings'].vboxSettingsNetAdapter.options[document.forms['frmVboxSettings'].vboxSettingsNetAdapter.options.length] = opt;
+}
+
+
+// Shorthand
+var vboxNetworking = $('#vboxSettingsDialog').data('vboxNetworking');
+vboxNetworking.networkInterfaces = $('#vboxSettingsDialog').data('vboxHostDetails').networkInterfaces;
+
+for(var i = 0; i < vboxNetworking.networkInterfaces.length; i++) {
+ if(vboxNetworking.networkInterfaces[i].interfaceType == 'Bridged') {
+ vboxSettingsNetAdaptersBridged[vboxSettingsNetAdaptersBridged.length] = vboxNetworking.networkInterfaces[i].name;
+ } else if(vboxNetworking.networkInterfaces[i].interfaceType == 'HostOnly') {
+ vboxSettingsNetAdaptersHostOnly[vboxSettingsNetAdaptersHostOnly.length] = vboxNetworking.networkInterfaces[i].name;
+ } else {
+ vboxAlert('Unknown interface type :' + vboxNetworking.networkInterfaces[i].interfaceType);
+ }
+}
+
+// Check for sub / virtual interfaces. These will not be reported by VirtualBox
+var vboxGuestNet = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters;
+for(var i = 0; i < vboxGuestNet.length; i++) {
+ if(!vboxGuestNet[i].bridgedInterface || vboxGuestNet[i].bridgedInterface == '') continue;
+ if(jQuery.inArray(vboxGuestNet[i].bridgedInterface,vboxSettingsNetAdaptersBridged) < 0) {
+ vboxSettingsNetAdaptersBridged[vboxSettingsNetAdaptersBridged.length] = vboxGuestNet[i].bridgedInterface;
+ }
+}
+
+
+var vboxSettingsNetTemplate = document.getElementById('vboxSettingsTabNetAdapter');
+var vboxSettingsNetContainer = $(vboxSettingsNetTemplate).parent();
+
+
+/* Network advanced show / hide */
+$('#vboxSettingsTabNetAdapter').find('input.netImgAdvanced').click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+ $(this).data('vboxAdvancedEnabled',true);
+ $(this).closest('table').find('.vboxSettingsNetToggleAdvanced:not(.vboxForceHide)').css('display','');
+ $(this).css('background-image','url(images/downArrow.png)');
+
+ } else {
+
+ $(this).data('toggleClicked', false);
+ $(this).data('vboxAdvancedEnabled',false);
+ $(this).closest('table').find('.vboxSettingsNetToggleAdvanced').css('display','none');
+ $(this).css('background-image','url(images/rightArrow.png)');
+
+ }
+});
+
+/* Mac address generator */
+$('#vboxSettingsTabNetAdapter').find('input.vboxSettingsNetMacGen').click(function(){
+
+ var t = $(this).siblings('input').first();
+ var oval = $(t).val();
+ $(t).val('...').prop('disabled',true);
+
+ var l = new vboxLoader();
+ l.add('vboxGenerateMacAddress',function(d){
+ if(d && d.success) $(t).val(d.responseData);
+ else $(t).val(oval);
+ $(t).prop('disabled',false);
+ });
+ l.noLoadingScreen = true;
+ l.run();
+});
+
+
+/* Network adapter tab links */
+var ul = $('<ul />');
+$(vboxSettingsNetContainer).append(ul);
+
+for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+
+
+ /* tab */
+ $(ul).append($('<li />').html('<a href="#' + vboxSettingsNetTemplate.id + (i + 1) +'"><span>' + trans('Adapter %1','VBoxGlobal').replace('%1',(i + 1)) + '</span></a>'));
+
+ /* tab content */
+ var newTab = $("#vboxSettingsTabNetAdapter").clone(true);
+ newTab.attr({'id':vboxSettingsNetTemplate.id + (i + 1)}).css({'display':'block'}).find('.vboxEnablerTrigger').on('enable',function(){
+ $(this).children('select').first().trigger('change');
+ });
+ newTab.appendTo(vboxSettingsNetContainer);
+
+ /* Form elements must be unique */
+ $("#vboxSettingsTabNetAdapter" + (i + 1)).find('[name]').each(function() {
+ $(this).attr('name',$(this).attr('name') + (i + 1));
+ });
+
+}
+
+
+/* Remove Template */
+$("#vboxSettingsTabNetAdapter").empty().remove();
+
+
+/* preload network 'advanced' down arrow image */
+var netDnAdvImg = new Image();
+netDnAdvImg.src = 'images/downArrow.png';
+
+/*
+ * Called when network adpater 'attached to' changes
+ */
+function vboxSettingsUpdateNetworkOptions(sel) {
+
+ var ptable = $(sel).closest('table');
+ var th = $(ptable).find('th.vboxSettingsNetAdapterNamedLabel').first();
+ var nsel = $(ptable).find('.vboxSettingsNetAdapterNamed').first();
+
+ var advEnabled = ptable.find('input.netImgAdvanced').first().data('vboxAdvancedEnabled');
+
+ // Promiscuous mode selection
+ if(sel.value == 'NAT' || sel.value == 'Null' || sel.value == 'Generic') {
+ $(ptable).find('tr.vboxSettingsNetPromiscuousMode').addClass('vboxForceHide').hide();
+ } else {
+ $(ptable).find('tr.vboxSettingsNetPromiscuousMode').removeClass('vboxForceHide');
+ if(advEnabled) $(ptable).find('tr.vboxSettingsNetPromiscuousMode').show();
+ }
+
+ // Generic properties
+ if(sel.value == 'Generic') {
+ $(ptable).find('tr.vboxSettingsNetGenPropsRow').removeClass('vboxForceHide');
+ if(advEnabled) $(ptable).find('tr.vboxSettingsNetGenPropsRow').show();
+ } else {
+ $(ptable).find('tr.vboxSettingsNetGenPropsRow').hide().addClass('vboxForceHide');
+ }
+
+ // Port forward button
+ if(sel.value == 'NAT') {
+ $(ptable).find('tr.vboxSettingsNetPFButton').removeClass('vboxForceHide');
+ if(advEnabled) $(ptable).find('tr.vboxSettingsNetPFButton').show();
+ } else {
+ $(ptable).find('tr.vboxSettingsNetPFButton').addClass('vboxForceHide').hide();
+ }
+
+ // Name box
+ if(sel.value == 'Null' || sel.value == 'NAT') {
+
+ $(th).addClass('vboxDisabled');
+
+ $(nsel).children().remove();
+ $(nsel).prop('disabled',true);
+
+ if(sel.value == 'NAT' && $('#vboxPane').data('vboxConfig').enableAdvancedConfig) ptable.find('tr.vboxSettingsAdvancedNat').css('display','');
+ else ptable.find('tr.vboxSettingsAdvancedNat').css('display','none');
+
+
+ } else {
+
+ ptable.find('tr.vboxSettingsAdvancedNat').css('display','none');
+
+ $(th).removeClass('vboxDisabled');
+
+ $(nsel).children().remove();
+ $(nsel).prop('disabled',false);
+
+ // Special case for certian network selects
+ if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value=='Generic' || sel.value=='Bridged' || sel.value=='NATNetwork') {
+ var isel = $(nsel).clone(false);
+ $(nsel).replaceWith(isel);
+ nsel = isel;
+ }
+
+ var defaultSel = $(sel).data('vboxDefault');
+
+ switch(sel.value) {
+ case 'Bridged':
+ src = vboxSettingsNetAdaptersBridged;
+ break;
+ case 'HostOnly':
+ src = vboxSettingsNetAdaptersHostOnly;
+ break;
+ case 'Internal':
+ src = $('#vboxSettingsDialog').data('vboxNetworking').networks;
+ break;
+ case 'Generic':
+ src = $('#vboxSettingsDialog').data('vboxNetworking').genericDrivers;
+ break;
+ case 'NATNetwork':
+ src = $('#vboxSettingsDialog').data('vboxNetworking').natNetworks;
+ break;
+ case 'VDE':
+ src = $('#vboxSettingsDialog').data('vboxNetworking').vdenetworks;
+ break;
+ default:
+ vboxAlert('Unknown network binding type: ' + sel.value);
+ }
+
+ for(var i = 0; i < src.length; i++) {
+ var hSrc = $('<div />').text(src[i]).html();
+ $(nsel).append('<option ' + (src[i] == defaultSel ? ' selected ' : '') + ' value="' + hSrc + '">' + hSrc + '</option>');
+ }
+ }
+
+ // Special case for Internal, Generic, and VDE network selects
+ if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value == 'Generic' || sel.value == 'Bridged') {
+ $(nsel).jec();
+ }
+
+}
+
+/* Change settings onShow() when VM is running */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+
+ /* Net values */
+ var vboxVDEFound = false; // check for VDE attachments
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+
+ var a = (i + 1);
+
+ // attached to
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType).trigger('change');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].selectedIndex]).attr('selected','selected');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).change();
+
+ // Device or network name, depending on what 'attached to' is
+ var netName = '';
+ switch($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType) {
+ case 'Bridged':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].bridgedInterface;
+ break;
+ case 'HostOnly':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].hostOnlyInterface;
+ break;
+ case 'Internal':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].internalNetwork;
+ break;
+ case 'Generic':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].genericDriver;
+ break;
+ case 'NATNetwork':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATNetwork;
+ break;
+ case 'VDE':
+ netName = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].VDENetwork;
+ vboxVDEFound = true;
+ break;
+ }
+
+ // hold default value
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a]).data('vboxDefault', netName);
+
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value = netName;
+
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].value = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].adapterType;
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].value = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].MACAddress;
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetConnected'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].cableConnected ? true : false);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapterPromiscuousMode'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].promiscModePolicy);
+
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetGenericProps'+a].innerHTML = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].properties;
+
+ // Enabled adapter
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].enabled).triggerHandler('click');;
+
+
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetPF'+a]).unbind('click');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetPF'+a]).click(function(){
+
+ var nicIndex = (parseInt($(this).attr('name').substr(17))-1);
+
+ $.when(vboxPortForwardConfigDialog($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[nicIndex].redirects))
+ .done(function(rules){
+ for(var i = 0; i < rules.length; i++) {
+ rules[i] = rules[i].join(',');
+ }
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[nicIndex].redirects = rules;
+ });
+
+ }).val(trans('Port Forwarding','UIMachineSettingsNetwork'));
+
+ // Set Nat values
+ if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeProxyOnly'+a].checked = (($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 2) ? true : false);
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeSamePorts'+a].checked = (($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 4) ? true : false);
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetPassDNSDomain'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSPassDomain ? true : false);
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetDNSProxy'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSProxy ? true : false);
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetUseHostResolver'+a].checked = ($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSUseHostResolver ? true : false);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetBindIp'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.hostIP);
+ }
+
+
+ }
+ /* Disable VDE selection? */
+ if(!vboxVDEFound && !$('#vboxPane').data('vboxConfig').enableVDE) {
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+(i+1)]).children("[value='VDE']").remove();
+ }
+ }
+
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+
+ var a = (i + 1);
+
+ /* Disable these inputs */
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].disabled ='disabled';
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].disabled ='disabled';
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].disabled ='disabled';
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).siblings('input').css('display','none');
+
+ /* Disable these labels */
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).closest('tr').children().addClass('vboxDisabled');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a]).closest('tr').children().addClass('vboxDisabled');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).closest('tr').children().addClass('vboxDisabled');
+
+ }
+ // Expand all advanced settings
+ $('#vboxSettingsDialog').find('input.netImgAdvanced').each(function(){
+ if(!$(this).data('vboxAdvancedEnabled')) $(this).trigger('click');
+ });
+
+ // Disable mac address generation
+ $('#vboxSettingsDialog').find('input.vboxSettingsNetMacGen').prop('disabled',true);
+
+ } else {
+
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+
+ var a = (i + 1);
+
+ /* Enable these inputs */
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].disabled ='';
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].disabled ='';
+ document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].disabled ='';
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).siblings('input').css('display','');
+
+ /* Enable these labels */
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a]).closest('tr').children().removeClass('vboxDisabled');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a]).closest('tr').children().removeClass('vboxDisabled');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a]).closest('tr').children().removeClass('vboxDisabled');
+
+ }
+
+ // Enable mac address generation
+ $('#vboxSettingsDialog').find('input.vboxSettingsNetMacGen').prop('disabled',false);
+
+ }
+
+/* Change settings onSave() */
+}).on('save',function(){
+
+ /* Net */
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxConfig').nicMax); i++) {
+
+ var a = (i + 1);
+
+ // attached to
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType = document.forms['frmVboxSettings'].elements['vboxSettingsNetAttachedTo'+a].value;
+
+ // Device or network name, depending on what 'attached to' is
+ switch($('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].attachmentType) {
+ case 'Bridged':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].bridgedInterface = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;;
+ case 'HostOnly':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].hostOnlyInterface = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;;
+ break;
+ case 'Generic':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].genericDriver = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
+ break;
+ case 'Internal':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].internalNetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
+ break;
+ case 'NATNetwork':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATNetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
+ break;
+ case 'VDE':
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].VDENetwork = document.forms['frmVboxSettings'].elements['vboxSettingsNetName'+a].value;
+ break;
+ }
+
+ // Set Nat values
+ if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ var aliasMode = $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode & 1;
+ if(document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeProxyOnly'+a].checked) {
+ aliasMode |= 2;
+ }
+ if(document.forms['frmVboxSettings'].elements['vboxSettingsNetAliasModeSamePorts'+a].checked) {
+ aliasMode |= 4;
+ }
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.aliasMode = aliasMode;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSPassDomain = document.forms['frmVboxSettings'].elements['vboxSettingsNetPassDNSDomain'+a].checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSProxy = document.forms['frmVboxSettings'].elements['vboxSettingsNetDNSProxy'+a].checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.DNSUseHostResolver = document.forms['frmVboxSettings'].elements['vboxSettingsNetUseHostResolver'+a].checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].NATEngine.hostIP = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetBindIp'+a]).val();
+ }
+
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].properties = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetGenericProps'+a]).val();
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].promiscModePolicy = $(document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapterPromiscuousMode'+a]).val();
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].adapterType = document.forms['frmVboxSettings'].elements['vboxSettingsNetAdapter'+a].value;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].MACAddress = document.forms['frmVboxSettings'].elements['vboxSettingsNetMAC'+a].value;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].cableConnected = document.forms['frmVboxSettings'].elements['vboxSettingsNetConnected'+a].checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').networkAdapters[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsNetEnabled'+a].checked;
+
+ }
+
+});
+
+</script>
+
+
diff --git a/panes/settingsParallelPorts.html b/panes/settingsParallelPorts.html
index 9a132ca..01a41db 100644
--- a/panes/settingsParallelPorts.html
+++ b/panes/settingsParallelPorts.html
@@ -1,192 +1,192 @@
-<!--
- Parallel port settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsParallelPorts.html 597 2015-04-20 11:41:28Z imoore76 $
--->
-<div id='vboxSettingsTabParallelPort'>
- <table class='vboxVertical'>
- <tr>
- <td colspan='2'><label><input name='vboxSettingsPPortEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Parallel Port</span></label></td>
- </tr>
- <tr>
- <th style='min-width: 120px'><span class='translate'>Port Number:</span></th>
- <td class='vboxEnablerTrigger'>
- <select style='width: auto' name='vboxSettingsPPortNumber' onchange='vboxSettingsUpdatePPortOptions(this);'>
- <option value='LPT1'>LPT1</option>
- <option value='LPT2'>LPT2</option>
- <option value='LPT3'>LPT3</option>
- <option value='User-defined' class='translate'>User-defined</option>
- </select>
- <span class='vboxEnablerListen translate'>IRQ:</span> <input type='text' name='vboxSettingsPPortIRQ' size='2' />
- <span class='vboxEnablerListen translate'>I/O Port:</span> <input type='text' name='vboxSettingsPPortIO' size='5' />
- </td>
- </tr>
- <tr>
- <th class='vboxPPortPathLabel'><span class='translate'>Port Path:</span></th>
- <td>
- <input type='text' class='vboxText vboxPPortPathBox' style='width: 100%' name='vboxSettingsPPortPath'/>
- </td>
- </tr>
- </table>
-</div>
-
-<script type='text/javascript'>
-
-/*
- *
- * Setup data for parallel port options
- *
- */
-if($('#vboxPane').data('vboxConfig').enableLPTConfig) {
-
- var vboxSettingsPPortTemplate = document.getElementById('vboxSettingsTabParallelPort');
- var vboxSettingsPPortContainer = $(vboxSettingsPPortTemplate).parent();
-
- /* translated select values */
- for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options.length; i++) {
- if($(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i]).hasClass('translate'))
- $(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i]).text(trans(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i].text,'VBoxGlobal')).removeClass('translate');
- }
-
- //Translations
- $('#vboxSettingsTabParallelPort').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsParallel');}).removeClass('translate');
-
-
-
- /* Parallel Port tab links */
- var ul = $('<ul />');
- $(vboxSettingsPPortContainer).append(ul);
-
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').parallelPortCount); i++) {
-
-
- /* tab */
- ul.append($('<li />').html('<a href="#' + vboxSettingsPPortTemplate.id + (i + 1) +'"><span>' + trans('Port %1','UIMachineSettingsParallel').replace('%1',i + 1) + '</span></a>'));
-
- /* tab content */
- var newTab = $("#vboxSettingsTabParallelPort").clone(true);
- newTab.attr('id',vboxSettingsPPortTemplate.id + (i + 1));
- newTab.css('display','block');
-
- // Enable / disable trigger
- newTab.find('.vboxEnablerTrigger').on('enable',function(){
- $(this).children('select').trigger('change');
- });
-
- newTab.appendTo(vboxSettingsPPortContainer);
-
- /* Form elements must be unique */
- $("#vboxSettingsTabParallelPort" + (i + 1)).find('[name]').each(function() {
- $(this).attr('name',$(this).attr('name') + (i + 1));
- });
-
- }
-
-
- /* Remove Template */
- $("#vboxSettingsTabParallelPort").empty().remove();
-
-
- //Tell jQuery to set up tabs
- $(vboxSettingsPPortContainer).tabs();
-
-
-
-
-}
-
-/*
- * Called when parallel port options change
- */
-function vboxSettingsUpdatePPortOptions(sel) {
-
- // IRQ and IO text boxes
- if(sel.value == 'User-defined') {
- $(sel).siblings('input').prop('disabled',false);
- $(sel).siblings('span').removeClass('vboxDisabled');
- } else {
- $(sel).siblings('input').prop('disabled',true);
- $(sel).siblings('span').addClass('vboxDisabled');
- for(var i = 0; i < vboxParallelPorts.ports.length; i++) {
- if(vboxParallelPorts.ports[i].name == sel.value) {
- $(sel).siblings('input').first().val(vboxParallelPorts.ports[i].irq);
- $(sel).siblings('input').last().val(vboxParallelPorts.ports[i].port);
- return;
- }
- }
- }
-}
-
-/*
- *
- * Parallel port logic
- *
- */
-if($('#vboxPane').data('vboxConfig').enableLPTConfig) {
-
- $('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /* Port values */
- for(var i = 0; i < parseInt($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts.length); i++) {
-
- var a = (i + 1);
-
- if(a > $('#vboxPane').data('vboxSystemProperties').parallelPortCount) continue;
-
- // Port Number
- var pNum = vboxParallelPorts.getPortName($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ,$('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a]).val(pNum);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a].selectedIndex]).attr('selected','selected');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a]).change();
-
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIRQ'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIO'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase);
-
- // Path
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortPath'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].path);
-
- // Enabled port
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortEnabled'+a]).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].enabled).triggerHandler('click');
-
- }
-
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- vboxSettingsPPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
- vboxSettingsPPortContainer.children(':not(ul)').find('span').addClass('disabled');
- vboxSettingsPPortContainer.find('input,select,textarea').prop('disabled',true);
- } else {
- vboxSettingsPPortContainer.find('span').removeClass('disabled');
- vboxSettingsPPortContainer.find('input,select,textarea').prop('disabled',false);
- vboxSettingsPPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
- }
- });
-}
-
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- if(!$('#vboxPane').data('vboxConfig').enableLPTConfig) return;
-
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').parallelPortCount); i++) {
-
- var a = (i + 1);
-
- // Port IRQ and IO
- $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIRQ'+a]).val();
- $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIO'+a]).val();
-
- // Path
- $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].path = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortPath'+a]).val();
-
- // Enabled port
- $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsPPortEnabled'+a].checked;
-
-
- }
-
-});
-
-
-</script>
+<!--
+ Parallel port settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsParallelPorts.html 597 2015-04-20 11:41:28Z imoore76 $
+-->
+<div id='vboxSettingsTabParallelPort'>
+ <table class='vboxVertical'>
+ <tr>
+ <td colspan='2'><label><input name='vboxSettingsPPortEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Parallel Port</span></label></td>
+ </tr>
+ <tr>
+ <th style='min-width: 120px'><span class='translate'>Port Number:</span></th>
+ <td class='vboxEnablerTrigger'>
+ <select style='width: auto' name='vboxSettingsPPortNumber' onchange='vboxSettingsUpdatePPortOptions(this);'>
+ <option value='LPT1'>LPT1</option>
+ <option value='LPT2'>LPT2</option>
+ <option value='LPT3'>LPT3</option>
+ <option value='User-defined' class='translate'>User-defined</option>
+ </select>
+ <span class='vboxEnablerListen translate'>IRQ:</span> <input type='text' name='vboxSettingsPPortIRQ' size='2' />
+ <span class='vboxEnablerListen translate'>I/O Port:</span> <input type='text' name='vboxSettingsPPortIO' size='5' />
+ </td>
+ </tr>
+ <tr>
+ <th class='vboxPPortPathLabel'><span class='translate'>Port Path:</span></th>
+ <td>
+ <input type='text' class='vboxText vboxPPortPathBox' style='width: 100%' name='vboxSettingsPPortPath'/>
+ </td>
+ </tr>
+ </table>
+</div>
+
+<script type='text/javascript'>
+
+/*
+ *
+ * Setup data for parallel port options
+ *
+ */
+if($('#vboxPane').data('vboxConfig').enableLPTConfig) {
+
+ var vboxSettingsPPortTemplate = document.getElementById('vboxSettingsTabParallelPort');
+ var vboxSettingsPPortContainer = $(vboxSettingsPPortTemplate).parent();
+
+ /* translated select values */
+ for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options.length; i++) {
+ if($(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i]).hasClass('translate'))
+ $(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i]).text(trans(document.forms['frmVboxSettings'].vboxSettingsPPortNumber.options[i].text,'VBoxGlobal')).removeClass('translate');
+ }
+
+ //Translations
+ $('#vboxSettingsTabParallelPort').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsParallel');}).removeClass('translate');
+
+
+
+ /* Parallel Port tab links */
+ var ul = $('<ul />');
+ $(vboxSettingsPPortContainer).append(ul);
+
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').parallelPortCount); i++) {
+
+
+ /* tab */
+ ul.append($('<li />').html('<a href="#' + vboxSettingsPPortTemplate.id + (i + 1) +'"><span>' + trans('Port %1','UIMachineSettingsParallel').replace('%1',i + 1) + '</span></a>'));
+
+ /* tab content */
+ var newTab = $("#vboxSettingsTabParallelPort").clone(true);
+ newTab.attr('id',vboxSettingsPPortTemplate.id + (i + 1));
+ newTab.css('display','block');
+
+ // Enable / disable trigger
+ newTab.find('.vboxEnablerTrigger').on('enable',function(){
+ $(this).children('select').trigger('change');
+ });
+
+ newTab.appendTo(vboxSettingsPPortContainer);
+
+ /* Form elements must be unique */
+ $("#vboxSettingsTabParallelPort" + (i + 1)).find('[name]').each(function() {
+ $(this).attr('name',$(this).attr('name') + (i + 1));
+ });
+
+ }
+
+
+ /* Remove Template */
+ $("#vboxSettingsTabParallelPort").empty().remove();
+
+
+ //Tell jQuery to set up tabs
+ $(vboxSettingsPPortContainer).tabs();
+
+
+
+
+}
+
+/*
+ * Called when parallel port options change
+ */
+function vboxSettingsUpdatePPortOptions(sel) {
+
+ // IRQ and IO text boxes
+ if(sel.value == 'User-defined') {
+ $(sel).siblings('input').prop('disabled',false);
+ $(sel).siblings('span').removeClass('vboxDisabled');
+ } else {
+ $(sel).siblings('input').prop('disabled',true);
+ $(sel).siblings('span').addClass('vboxDisabled');
+ for(var i = 0; i < vboxParallelPorts.ports.length; i++) {
+ if(vboxParallelPorts.ports[i].name == sel.value) {
+ $(sel).siblings('input').first().val(vboxParallelPorts.ports[i].irq);
+ $(sel).siblings('input').last().val(vboxParallelPorts.ports[i].port);
+ return;
+ }
+ }
+ }
+}
+
+/*
+ *
+ * Parallel port logic
+ *
+ */
+if($('#vboxPane').data('vboxConfig').enableLPTConfig) {
+
+ $('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /* Port values */
+ for(var i = 0; i < parseInt($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts.length); i++) {
+
+ var a = (i + 1);
+
+ if(a > $('#vboxPane').data('vboxSystemProperties').parallelPortCount) continue;
+
+ // Port Number
+ var pNum = vboxParallelPorts.getPortName($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ,$('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a]).val(pNum);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a].selectedIndex]).attr('selected','selected');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortNumber'+a]).change();
+
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIRQ'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIO'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase);
+
+ // Path
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortPath'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].path);
+
+ // Enabled port
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortEnabled'+a]).prop('checked',$('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].enabled).triggerHandler('click');
+
+ }
+
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ vboxSettingsPPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
+ vboxSettingsPPortContainer.children(':not(ul)').find('span').addClass('disabled');
+ vboxSettingsPPortContainer.find('input,select,textarea').prop('disabled',true);
+ } else {
+ vboxSettingsPPortContainer.find('span').removeClass('disabled');
+ vboxSettingsPPortContainer.find('input,select,textarea').prop('disabled',false);
+ vboxSettingsPPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
+ }
+ });
+}
+
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ if(!$('#vboxPane').data('vboxConfig').enableLPTConfig) return;
+
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').parallelPortCount); i++) {
+
+ var a = (i + 1);
+
+ // Port IRQ and IO
+ $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IRQ = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIRQ'+a]).val();
+ $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].IOBase = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortIO'+a]).val();
+
+ // Path
+ $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].path = $(document.forms['frmVboxSettings'].elements['vboxSettingsPPortPath'+a]).val();
+
+ // Enabled port
+ $('#vboxSettingsDialog').data('vboxMachineData').parallelPorts[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsPPortEnabled'+a].checked;
+
+
+ }
+
+});
+
+
+</script>
diff --git a/panes/settingsPortForwarding.html b/panes/settingsPortForwarding.html
index 98b79d7..761d9fa 100644
--- a/panes/settingsPortForwarding.html
+++ b/panes/settingsPortForwarding.html
@@ -1,195 +1,195 @@
-<!--
- Port Forwarding Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsPortForwarding.html 595 2015-04-17 09:50:36Z imoore76 $
- -->
-<div id='vboxSettingsPortForwarding' style='height: 100%'>
-<table class='vboxInvisible'>
-<tr style='vertical-align: top'>
-<td style='width: 100%; height: 100%'>
- <div id='vboxSettingsPortForwardingListDiv' class='vboxBordered' style='overflow: auto;'>
- <table class='vboxHorizontal'>
- <thead>
- <tr>
- <th class='translate'>Name</th>
- <th class='translate'>Protocol</th>
- <th class='translate'>Host IP</th>
- <th class='translate'>Host Port</th>
- <th class='translate'>Guest IP</th>
- <th class='translate'>Guest Port</th>
- </tr>
- </thead>
- <tbody id='vboxSettingsPortForwardingList' class='vboxHover'></tbody>
- </table>
- </div>
-</td><td id='vboxSettingsPortForwardingToolbar'></td>
-</tr>
-</table>
-<script type='text/javascript'>
-
-/*
- * Translate
- */
-$('#vboxSettingsPortForwarding').find('.translate').html(function(i,h){return trans(h,'UIPortForwardingModel');}).removeClass('translate');
-
-/*
- * Init port forwarding buttons and toolbar
- */
-
-var sButtons = new Array(
- {
- 'name' : 'insportfwd',
- 'label' : 'Insert new rule',
- 'icon' : 'controller_add',
- 'click' : function () {
- var rname = null;
- var rules = $('#vboxSettingsPortForwardingList').children('tr');
- for(var n = 1; n < 100; n++) {
- rname = trans('Rule %1').replace('%1',n);
- for(var i = 0; i < rules.length; i++) {
- if($(rules[i]).data('vboxRule')[0] == rname) {
- rname = null;
- break;
- }
- }
- if(rname) break;
- }
- vboxSettingsPortForwardingAdd(rname+',1,,,,');
- }
- },
- {
- 'name' : 'delportfwd',
- 'label' : 'Delete selected rule',
- 'icon' : 'controller_remove',
- 'click' : function () {
- $('#vboxSettingsPortForwardingList').children('tr.vboxListItemSelected').first().remove();
- $('#vboxSettingsPortForwardingList').trigger('select');
- },
- 'enabled' : function(item) {return ((item && $(item).data('vboxRule')) ? true : false);}
- }
-);
-var pfToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIMachineSettingsPortForwardingDlg'});
-pfToolbar.renderTo('vboxSettingsPortForwardingToolbar');
-
-
-$('#vboxSettingsPortForwardingList').on('select',function(e,el){pfToolbar.update(el);});
-$('#vboxSettingsPortForwardingList').trigger('select');
-
-/* Edit rule element */
-function vboxSettingsPortForwardingEdit(td,type) {
- if($(td).children('input').length) return;
- var ex = $(td).parent().data('vboxRule')[$(td).data('vboxPane')];
- var w = $(td).width();
- $(td).html('');
- $('<input />').data('vboxPane',$(td).data('vboxPane')).attr({'class':'vboxText'}).val(ex).blur(function(){
- switch($(this).data('vboxPane')) {
- /* name */
- case 0:
- $(this).val(jQuery.trim($(this).val().replace(',','')));
- if(!$(this).val())
- $(this).val($(this).parent().parent().data('vboxRule')[0]);
- break;
- /* IPs */
- case 2:
- case 4:
- $(this).val($(this).val().replace(/[^0-9\.]/,''));
- break;
- /* ports */
- case 3:
- case 5:
- $(this).val($(this).val().replace(/[^0-9]/,''));
- if(!$(this).val() || $(this).val() < 0) $(this).val('0');
- else if($(this).val() > 65535) $(this).val('65535');
- break;
- }
- $(this).parent().parent().data('vboxRule')[$(this).data('vboxPane')] = $(this).val();
- var ex = $(this).val();
- $(this).replaceWith($('<div />').html(ex).text());
- }).css({'width':(w-8)+'px','padding':'0px','margin':'0px'}).keydown(function(event){
- if(event.keyCode == 13) {
- $(this).trigger('blur');
- return;
- }
- switch($(this).data('vboxPane')) {
- /* name */
- case 0:
- if(event.keyCode == 188) return false; // no commas
- break;
- /* IPs */
- case 2:
- case 4:
- return true;
- break;
- /* ports */
- case 3:
- case 5:
- return (vboxValidateCtrl(event.keyCode) || vboxValidateNum(event.keyCode));
- break;
- }
-
- }).appendTo(td).focus();
-}
-
-/* Edit protocol */
-function vboxSettingsPortForwardingEditProto(td) {
- var ex = $(td).parent().data('vboxRule')[1];
-
- if(ex == 0) val = 1;
- else val = 0;
-
- $(td).parent().data('vboxRule')[1] = val;
-
- $(td).html(val == '1' ? trans('TCP','VBoxGlobal') : trans('UDP','VBoxGlobal'));
-
-}
-/* Add forwarding rule */
-function vboxSettingsPortForwardingAdd(r) {
-
- var rule = r.split(',');
- var tr = $('<tr />').attr({'class':'vboxListItem'});
-
- $('<td />').data('vboxPane',0).html($('<div />').html(rule[0]).text()).click(function(){
- if($(this).parent().hasClass('vboxListItemSelected')) {
- vboxSettingsPortForwardingEdit(this,'name');
- return;
- }
- $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
- $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
- }).addClass('vboxHoverFirst').appendTo(tr);
-
- $('<td />').click(function(){
- if($(this).parent().hasClass('vboxListItemSelected')) {
- vboxSettingsPortForwardingEditProto(this);
- return;
- }
- $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
- $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
- }).addClass('vboxProto vboxHoverMid').html(trans(rule[1] == 1 ? 'TCP' : 'UDP','VBoxGlobal')).appendTo(tr);
-
- for(var i = 2; i < rule.length; i++) {
- $('<td />').data('vboxPane',i).click(function(){
- if($(this).parent().hasClass('vboxListItemSelected')) {
- vboxSettingsPortForwardingEdit(this,'port');
- return;
- }
- $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
- $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
- }).addClass('vboxHover' + (i == (rule.length-1) ? 'Last' : 'Mid'))
- .html($('<div />').html(rule[i]).text()).addClass((i%2 ? 'vboxPort' : 'vboxIP')).appendTo(tr);
- }
- $(tr).data({'vboxRule':rule}).hover(function(){
- if(!$(this).hasClass('vboxListItemSelected'))
- $(this).addClass('vboxHover');
- },function(){
- $(this).removeClass('vboxHover');
- }).appendTo($('#vboxSettingsPortForwardingList'));
-
-}
-function vboxSettingsPortForwardingInit(rules) {
- for(var r = 0; r < rules.length; r++) {
- vboxSettingsPortForwardingAdd(rules[r]);
- }
-}
-</script>
-</div>
+<!--
+ Port Forwarding Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsPortForwarding.html 595 2015-04-17 09:50:36Z imoore76 $
+ -->
+<div id='vboxSettingsPortForwarding' style='height: 100%'>
+<table class='vboxInvisible'>
+<tr style='vertical-align: top'>
+<td style='width: 100%; height: 100%'>
+ <div id='vboxSettingsPortForwardingListDiv' class='vboxBordered' style='overflow: auto;'>
+ <table class='vboxHorizontal'>
+ <thead>
+ <tr>
+ <th class='translate'>Name</th>
+ <th class='translate'>Protocol</th>
+ <th class='translate'>Host IP</th>
+ <th class='translate'>Host Port</th>
+ <th class='translate'>Guest IP</th>
+ <th class='translate'>Guest Port</th>
+ </tr>
+ </thead>
+ <tbody id='vboxSettingsPortForwardingList' class='vboxHover'></tbody>
+ </table>
+ </div>
+</td><td id='vboxSettingsPortForwardingToolbar'></td>
+</tr>
+</table>
+<script type='text/javascript'>
+
+/*
+ * Translate
+ */
+$('#vboxSettingsPortForwarding').find('.translate').html(function(i,h){return trans(h,'UIPortForwardingModel');}).removeClass('translate');
+
+/*
+ * Init port forwarding buttons and toolbar
+ */
+
+var sButtons = new Array(
+ {
+ 'name' : 'insportfwd',
+ 'label' : 'Insert new rule',
+ 'icon' : 'controller_add',
+ 'click' : function () {
+ var rname = null;
+ var rules = $('#vboxSettingsPortForwardingList').children('tr');
+ for(var n = 1; n < 100; n++) {
+ rname = trans('Rule %1').replace('%1',n);
+ for(var i = 0; i < rules.length; i++) {
+ if($(rules[i]).data('vboxRule')[0] == rname) {
+ rname = null;
+ break;
+ }
+ }
+ if(rname) break;
+ }
+ vboxSettingsPortForwardingAdd(rname+',1,,,,');
+ }
+ },
+ {
+ 'name' : 'delportfwd',
+ 'label' : 'Delete selected rule',
+ 'icon' : 'controller_remove',
+ 'click' : function () {
+ $('#vboxSettingsPortForwardingList').children('tr.vboxListItemSelected').first().remove();
+ $('#vboxSettingsPortForwardingList').trigger('select');
+ },
+ 'enabled' : function(item) {return ((item && $(item).data('vboxRule')) ? true : false);}
+ }
+);
+var pfToolbar = new vboxToolbarSmall({buttons: sButtons, language_context: 'UIMachineSettingsPortForwardingDlg'});
+pfToolbar.renderTo('vboxSettingsPortForwardingToolbar');
+
+
+$('#vboxSettingsPortForwardingList').on('select',function(e,el){pfToolbar.update(el);});
+$('#vboxSettingsPortForwardingList').trigger('select');
+
+/* Edit rule element */
+function vboxSettingsPortForwardingEdit(td,type) {
+ if($(td).children('input').length) return;
+ var ex = $(td).parent().data('vboxRule')[$(td).data('vboxPane')];
+ var w = $(td).width();
+ $(td).html('');
+ $('<input />').data('vboxPane',$(td).data('vboxPane')).attr({'class':'vboxText'}).val(ex).blur(function(){
+ switch($(this).data('vboxPane')) {
+ /* name */
+ case 0:
+ $(this).val(jQuery.trim($(this).val().replace(',','')));
+ if(!$(this).val())
+ $(this).val($(this).parent().parent().data('vboxRule')[0]);
+ break;
+ /* IPs */
+ case 2:
+ case 4:
+ $(this).val($(this).val().replace(/[^0-9\.]/,''));
+ break;
+ /* ports */
+ case 3:
+ case 5:
+ $(this).val($(this).val().replace(/[^0-9]/,''));
+ if(!$(this).val() || $(this).val() < 0) $(this).val('0');
+ else if($(this).val() > 65535) $(this).val('65535');
+ break;
+ }
+ $(this).parent().parent().data('vboxRule')[$(this).data('vboxPane')] = $(this).val();
+ var ex = $(this).val();
+ $(this).replaceWith($('<div />').html(ex).text());
+ }).css({'width':(w-8)+'px','padding':'0px','margin':'0px'}).keydown(function(event){
+ if(event.keyCode == 13) {
+ $(this).trigger('blur');
+ return;
+ }
+ switch($(this).data('vboxPane')) {
+ /* name */
+ case 0:
+ if(event.keyCode == 188) return false; // no commas
+ break;
+ /* IPs */
+ case 2:
+ case 4:
+ return true;
+ break;
+ /* ports */
+ case 3:
+ case 5:
+ return (vboxValidateCtrl(event.keyCode) || vboxValidateNum(event.keyCode));
+ break;
+ }
+
+ }).appendTo(td).focus();
+}
+
+/* Edit protocol */
+function vboxSettingsPortForwardingEditProto(td) {
+ var ex = $(td).parent().data('vboxRule')[1];
+
+ if(ex == 0) val = 1;
+ else val = 0;
+
+ $(td).parent().data('vboxRule')[1] = val;
+
+ $(td).html(val == '1' ? trans('TCP','VBoxGlobal') : trans('UDP','VBoxGlobal'));
+
+}
+/* Add forwarding rule */
+function vboxSettingsPortForwardingAdd(r) {
+
+ var rule = r.split(',');
+ var tr = $('<tr />').attr({'class':'vboxListItem'});
+
+ $('<td />').data('vboxPane',0).html($('<div />').html(rule[0]).text()).click(function(){
+ if($(this).parent().hasClass('vboxListItemSelected')) {
+ vboxSettingsPortForwardingEdit(this,'name');
+ return;
+ }
+ $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
+ $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
+ }).addClass('vboxHoverFirst').appendTo(tr);
+
+ $('<td />').click(function(){
+ if($(this).parent().hasClass('vboxListItemSelected')) {
+ vboxSettingsPortForwardingEditProto(this);
+ return;
+ }
+ $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
+ $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
+ }).addClass('vboxProto vboxHoverMid').html(trans(rule[1] == 1 ? 'TCP' : 'UDP','VBoxGlobal')).appendTo(tr);
+
+ for(var i = 2; i < rule.length; i++) {
+ $('<td />').data('vboxPane',i).click(function(){
+ if($(this).parent().hasClass('vboxListItemSelected')) {
+ vboxSettingsPortForwardingEdit(this,'port');
+ return;
+ }
+ $(this).parent().addClass('vboxListItemSelected').removeClass('vboxHover').siblings().removeClass('vboxListItemSelected');
+ $('#vboxSettingsPortForwardingList').trigger('select',$(this).parent());
+ }).addClass('vboxHover' + (i == (rule.length-1) ? 'Last' : 'Mid'))
+ .html($('<div />').html(rule[i]).text()).addClass((i%2 ? 'vboxPort' : 'vboxIP')).appendTo(tr);
+ }
+ $(tr).data({'vboxRule':rule}).hover(function(){
+ if(!$(this).hasClass('vboxListItemSelected'))
+ $(this).addClass('vboxHover');
+ },function(){
+ $(this).removeClass('vboxHover');
+ }).appendTo($('#vboxSettingsPortForwardingList'));
+
+}
+function vboxSettingsPortForwardingInit(rules) {
+ for(var r = 0; r < rules.length; r++) {
+ vboxSettingsPortForwardingAdd(rules[r]);
+ }
+}
+</script>
+</div>
diff --git a/panes/settingsSerialPorts.html b/panes/settingsSerialPorts.html
index b47dab8..e74fbc2 100644
--- a/panes/settingsSerialPorts.html
+++ b/panes/settingsSerialPorts.html
@@ -1,232 +1,232 @@
-<!--
- Serial port settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsSerialPorts.html 597 2015-04-20 11:41:28Z imoore76 $
- -->
-<div id='vboxSettingsTabSerialPort' style='display: none'>
-<table class='vboxVertical'>
- <tr>
- <td colspan='2'><label><input name='vboxSettingsSPortEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Serial Port</span></label></td>
- </tr>
- <tr>
- <th style='min-width: 120px'><span class='translate'>Port Number:</span></th>
- <td class='vboxEnablerTrigger'>
- <select style='width: auto' name='vboxSettingsPortNumber' onchange='vboxSettingsUpdateSPortOptions(this);'>
- <option value='COM1'>COM1</option>
- <option value='COM2'>COM2</option>
- <option value='COM3'>COM3</option>
- <option value='COM4'>COM4</option>
- <option value='User-defined' class='translate'>User-defined</option>
- </select>
- <span class='vboxEnablerListen'><span class='translate'>IRQ:</span></span> <input type='text' name='vboxSettingsSPortIRQ' size='2' />
- <span class='vboxEnablerListen'><span class='translate'>I/O Port:</span></span> <input type='text' name='vboxSettingsSPortIO' size='5' />
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Port Mode:</span></th>
- <td class='vboxEnablerTrigger'>
- <select style='width: auto' name='vboxSettingsPortMode' onchange='vboxSettingsUpdateSPortMode(this);'>
- <option value='Disconnected' >Disconnected</option>
- <option value='HostPipe' >HostPipe</option>
- <option value='HostDevice' >HostDevice</option>
- <option value='RawFile' >RawFile</option>
- </select>
- </td>
- </tr>
- <tr>
- <th></th>
- <td>
- <label><input type='checkbox' class='vboxCheckbox vboxSettingsSPortCreatePipe' name='vboxSettingsSPortCreatePipe' />
- <span class='translate vboxEnablerListen'>Create Pipe</span></label>
- </td>
- </tr>
- <tr>
- <th class='vboxSPortPathLabel'><span class='translate'>Port/File Path:</span></th>
- <td>
- <input type='text' class='vboxText vboxSPortPathBox' style='width: 100%' name='vboxSettingsSPortPath'/>
- </td>
- </tr>
-</table>
-</div>
-
-<script type='text/javascript'>
-
-
-/*
- *
- * Setup data for serial port options
- *
- */
-
-var vboxSettingsSPortTemplate = document.getElementById('vboxSettingsTabSerialPort');
-var vboxSettingsSPortContainer = $(vboxSettingsSPortTemplate).parent();
-
-/* translated select values */
-for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPortNumber.options.length; i++) {
- if($(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i]).hasClass('translate'))
- $(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i]).text(trans(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i].text,'VBoxGlobal')).removeClass('translate');
-}
-for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPortMode.options.length; i++) {
- document.forms['frmVboxSettings'].vboxSettingsPortMode.options[i].text = trans(vboxSerialMode(document.forms['frmVboxSettings'].vboxSettingsPortMode.options[i].text),'VBoxGlobal');
-}
-
-// Translations
-$('#vboxSettingsTabSerialPort').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsSerial');}).removeClass('translate');
-
-/* Serial Port tab links */
-var ul = $('<ul />');
-$(vboxSettingsSPortContainer).append(ul);
-
-for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').serialPortCount); i++) {
-
-
- /* tab */
- ul.append($('<li />').html('<a href="#' + vboxSettingsSPortTemplate.id + (i + 1) +'"><span>' + trans('Port %1','UIMachineSettingsSerial').replace('%1',i + 1) + '</span></a>'));
-
- /* tab content */
- var newTab = $("#vboxSettingsTabSerialPort").clone(true);
- newTab.attr({'id':vboxSettingsSPortTemplate.id + (i + 1)}).css({'display':'block'}).find('.vboxEnablerTrigger').on('enable',function(){
- $(this).find('select').trigger('change');
- });
-
- newTab.appendTo(vboxSettingsSPortContainer);
-
- /* Form elements must be unique */
- $("#vboxSettingsTabSerialPort" + (i + 1)).find('[name]').each(function() {
- $(this).attr('name',$(this).attr('name') + (i + 1));
- });
-
-}
-
-
-/* Remove Template */
-$("#vboxSettingsTabSerialPort").empty().remove();
-
-
-// Tell jQuery to set up tabs
-$(vboxSettingsSPortContainer).tabs();
-
-/*
- * Called when serial port options change
- */
-function vboxSettingsUpdateSPortOptions(sel) {
-
- // IRQ and IO text boxes
- if(sel.value == 'User-defined') {
- $(sel).siblings('input').prop('disabled',false);
- $(sel).siblings('span').removeClass('vboxDisabled');
- } else {
- $(sel).siblings('input').prop('disabled',true);
- $(sel).siblings('span').addClass('vboxDisabled');
- for(var i = 0; i < vboxSerialPorts.ports.length; i++) {
- if(vboxSerialPorts.ports[i].name == sel.value) {
- $(sel).siblings('input').first().val(vboxSerialPorts.ports[i].irq);
- $(sel).siblings('input').last().val(vboxSerialPorts.ports[i].port);
- return;
- }
- }
- }
-}
-
-/*
- * When serial port mode changes
- */
-function vboxSettingsUpdateSPortMode(sel) {
- var ptable = $(sel).closest('table');
- if(sel.value == 'HostPipe') {
- ptable.find('input.vboxSettingsSPortCreatePipe').prop({'disabled':false}).siblings().removeClass('vboxDisabled');
- } else {
- ptable.find('input.vboxSettingsSPortCreatePipe').prop({'disabled':true}).siblings().addClass('vboxDisabled');
- }
- if(sel.value == 'Disconnected') {
- ptable.find('.vboxSPortPathLabel').addClass('vboxDisabled');
- ptable.find('.vboxSPortPathBox').prop('disabled',true);
- } else {
- ptable.find('.vboxSPortPathLabel').removeClass('vboxDisabled');
- ptable.find('.vboxSPortPathBox').prop('disabled',false);
- }
-}
-
-
-/* When data is loaded */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /*
- * Serial ports
- *
- */
- for(var i = 0; i < parseInt($('#vboxSettingsDialog').data('vboxMachineData').serialPorts.length); i++) {
-
- var a = (i + 1);
-
- if(a > $('#vboxPane').data('vboxSystemProperties').serialPortCount) continue;
-
- // Port Number
- var pNum = vboxSerialPorts.getPortName($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ,$('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a]).val(pNum);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a].selectedIndex]).attr('selected','selected');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a]).change();
-
- $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIRQ'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIO'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase);
-
- // Port Mode
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].hostMode);
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a].selectedIndex]).attr('selected','selected');
- $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).change();
-
- // Create pipe
- $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortCreatePipe'+a]).prop('checked',($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].server ? true : false)).triggerHandler('click');
-
- // Path
- $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortPath'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].path);
-
- // Enabled
- $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortEnabled'+a]).prop('checked',($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].enabled));
-
- }
-
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- vboxSettingsSPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
- vboxSettingsSPortContainer.children(':not(ul)').find('span').addClass('disabled');
- vboxSettingsSPortContainer.find('input,select,textarea').prop('disabled',true);
- } else {
- vboxSettingsSPortContainer.find('span').removeClass('disabled');
- vboxSettingsSPortContainer.find('input,select,textarea').prop('disabled',false);
- vboxSettingsSPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
- }
-
-});
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- /* Net */
- for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').serialPortCount); i++) {
-
- var a = (i + 1);
-
- // Port IRQ and IO
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIRQ'+a]).val();
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIO'+a]).val();
-
- // Port Mode
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].hostMode = $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).val();
-
- // Create pipe
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].server = document.forms['frmVboxSettings'].elements['vboxSettingsSPortCreatePipe'+a].checked;
-
- // Path
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].path = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortPath'+a]).val();
-
- // Enabled port
- $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsSPortEnabled'+a].checked;
-
-
- }
-
-});
-
-
+<!--
+ Serial port settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsSerialPorts.html 597 2015-04-20 11:41:28Z imoore76 $
+ -->
+<div id='vboxSettingsTabSerialPort' style='display: none'>
+<table class='vboxVertical'>
+ <tr>
+ <td colspan='2'><label><input name='vboxSettingsSPortEnabled' class='vboxCheckbox vboxEnablerCheckbox' type='checkbox' /> <span class='translate'>Enable Serial Port</span></label></td>
+ </tr>
+ <tr>
+ <th style='min-width: 120px'><span class='translate'>Port Number:</span></th>
+ <td class='vboxEnablerTrigger'>
+ <select style='width: auto' name='vboxSettingsPortNumber' onchange='vboxSettingsUpdateSPortOptions(this);'>
+ <option value='COM1'>COM1</option>
+ <option value='COM2'>COM2</option>
+ <option value='COM3'>COM3</option>
+ <option value='COM4'>COM4</option>
+ <option value='User-defined' class='translate'>User-defined</option>
+ </select>
+ <span class='vboxEnablerListen'><span class='translate'>IRQ:</span></span> <input type='text' name='vboxSettingsSPortIRQ' size='2' />
+ <span class='vboxEnablerListen'><span class='translate'>I/O Port:</span></span> <input type='text' name='vboxSettingsSPortIO' size='5' />
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Port Mode:</span></th>
+ <td class='vboxEnablerTrigger'>
+ <select style='width: auto' name='vboxSettingsPortMode' onchange='vboxSettingsUpdateSPortMode(this);'>
+ <option value='Disconnected' >Disconnected</option>
+ <option value='HostPipe' >HostPipe</option>
+ <option value='HostDevice' >HostDevice</option>
+ <option value='RawFile' >RawFile</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th></th>
+ <td>
+ <label><input type='checkbox' class='vboxCheckbox vboxSettingsSPortCreatePipe' name='vboxSettingsSPortCreatePipe' />
+ <span class='translate vboxEnablerListen'>Create Pipe</span></label>
+ </td>
+ </tr>
+ <tr>
+ <th class='vboxSPortPathLabel'><span class='translate'>Port/File Path:</span></th>
+ <td>
+ <input type='text' class='vboxText vboxSPortPathBox' style='width: 100%' name='vboxSettingsSPortPath'/>
+ </td>
+ </tr>
+</table>
+</div>
+
+<script type='text/javascript'>
+
+
+/*
+ *
+ * Setup data for serial port options
+ *
+ */
+
+var vboxSettingsSPortTemplate = document.getElementById('vboxSettingsTabSerialPort');
+var vboxSettingsSPortContainer = $(vboxSettingsSPortTemplate).parent();
+
+/* translated select values */
+for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPortNumber.options.length; i++) {
+ if($(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i]).hasClass('translate'))
+ $(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i]).text(trans(document.forms['frmVboxSettings'].vboxSettingsPortNumber.options[i].text,'VBoxGlobal')).removeClass('translate');
+}
+for(var i = 0; i < document.forms['frmVboxSettings'].vboxSettingsPortMode.options.length; i++) {
+ document.forms['frmVboxSettings'].vboxSettingsPortMode.options[i].text = trans(vboxSerialMode(document.forms['frmVboxSettings'].vboxSettingsPortMode.options[i].text),'VBoxGlobal');
+}
+
+// Translations
+$('#vboxSettingsTabSerialPort').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsSerial');}).removeClass('translate');
+
+/* Serial Port tab links */
+var ul = $('<ul />');
+$(vboxSettingsSPortContainer).append(ul);
+
+for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').serialPortCount); i++) {
+
+
+ /* tab */
+ ul.append($('<li />').html('<a href="#' + vboxSettingsSPortTemplate.id + (i + 1) +'"><span>' + trans('Port %1','UIMachineSettingsSerial').replace('%1',i + 1) + '</span></a>'));
+
+ /* tab content */
+ var newTab = $("#vboxSettingsTabSerialPort").clone(true);
+ newTab.attr({'id':vboxSettingsSPortTemplate.id + (i + 1)}).css({'display':'block'}).find('.vboxEnablerTrigger').on('enable',function(){
+ $(this).find('select').trigger('change');
+ });
+
+ newTab.appendTo(vboxSettingsSPortContainer);
+
+ /* Form elements must be unique */
+ $("#vboxSettingsTabSerialPort" + (i + 1)).find('[name]').each(function() {
+ $(this).attr('name',$(this).attr('name') + (i + 1));
+ });
+
+}
+
+
+/* Remove Template */
+$("#vboxSettingsTabSerialPort").empty().remove();
+
+
+// Tell jQuery to set up tabs
+$(vboxSettingsSPortContainer).tabs();
+
+/*
+ * Called when serial port options change
+ */
+function vboxSettingsUpdateSPortOptions(sel) {
+
+ // IRQ and IO text boxes
+ if(sel.value == 'User-defined') {
+ $(sel).siblings('input').prop('disabled',false);
+ $(sel).siblings('span').removeClass('vboxDisabled');
+ } else {
+ $(sel).siblings('input').prop('disabled',true);
+ $(sel).siblings('span').addClass('vboxDisabled');
+ for(var i = 0; i < vboxSerialPorts.ports.length; i++) {
+ if(vboxSerialPorts.ports[i].name == sel.value) {
+ $(sel).siblings('input').first().val(vboxSerialPorts.ports[i].irq);
+ $(sel).siblings('input').last().val(vboxSerialPorts.ports[i].port);
+ return;
+ }
+ }
+ }
+}
+
+/*
+ * When serial port mode changes
+ */
+function vboxSettingsUpdateSPortMode(sel) {
+ var ptable = $(sel).closest('table');
+ if(sel.value == 'HostPipe') {
+ ptable.find('input.vboxSettingsSPortCreatePipe').prop({'disabled':false}).siblings().removeClass('vboxDisabled');
+ } else {
+ ptable.find('input.vboxSettingsSPortCreatePipe').prop({'disabled':true}).siblings().addClass('vboxDisabled');
+ }
+ if(sel.value == 'Disconnected') {
+ ptable.find('.vboxSPortPathLabel').addClass('vboxDisabled');
+ ptable.find('.vboxSPortPathBox').prop('disabled',true);
+ } else {
+ ptable.find('.vboxSPortPathLabel').removeClass('vboxDisabled');
+ ptable.find('.vboxSPortPathBox').prop('disabled',false);
+ }
+}
+
+
+/* When data is loaded */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /*
+ * Serial ports
+ *
+ */
+ for(var i = 0; i < parseInt($('#vboxSettingsDialog').data('vboxMachineData').serialPorts.length); i++) {
+
+ var a = (i + 1);
+
+ if(a > $('#vboxPane').data('vboxSystemProperties').serialPortCount) continue;
+
+ // Port Number
+ var pNum = vboxSerialPorts.getPortName($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ,$('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a]).val(pNum);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a].selectedIndex]).attr('selected','selected');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortNumber'+a]).change();
+
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIRQ'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIO'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase);
+
+ // Port Mode
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].hostMode);
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a].options[document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a].selectedIndex]).attr('selected','selected');
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).change();
+
+ // Create pipe
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortCreatePipe'+a]).prop('checked',($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].server ? true : false)).triggerHandler('click');
+
+ // Path
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortPath'+a]).val($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].path);
+
+ // Enabled
+ $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortEnabled'+a]).prop('checked',($('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].enabled));
+
+ }
+
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ vboxSettingsSPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
+ vboxSettingsSPortContainer.children(':not(ul)').find('span').addClass('disabled');
+ vboxSettingsSPortContainer.find('input,select,textarea').prop('disabled',true);
+ } else {
+ vboxSettingsSPortContainer.find('span').removeClass('disabled');
+ vboxSettingsSPortContainer.find('input,select,textarea').prop('disabled',false);
+ vboxSettingsSPortContainer.find('input.vboxEnablerCheckbox').triggerHandler('click');
+ }
+
+});
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ /* Net */
+ for(var i = 0; i < parseInt($('#vboxPane').data('vboxSystemProperties').serialPortCount); i++) {
+
+ var a = (i + 1);
+
+ // Port IRQ and IO
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IRQ = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIRQ'+a]).val();
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].IOBase = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortIO'+a]).val();
+
+ // Port Mode
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].hostMode = $(document.forms['frmVboxSettings'].elements['vboxSettingsPortMode'+a]).val();
+
+ // Create pipe
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].server = document.forms['frmVboxSettings'].elements['vboxSettingsSPortCreatePipe'+a].checked;
+
+ // Path
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].path = $(document.forms['frmVboxSettings'].elements['vboxSettingsSPortPath'+a]).val();
+
+ // Enabled port
+ $('#vboxSettingsDialog').data('vboxMachineData').serialPorts[i].enabled = document.forms['frmVboxSettings'].elements['vboxSettingsSPortEnabled'+a].checked;
+
+
+ }
+
+});
+
+
</script> \ No newline at end of file
diff --git a/panes/settingsSharedFolders.html b/panes/settingsSharedFolders.html
index b94be01..f1b2362 100644
--- a/panes/settingsSharedFolders.html
+++ b/panes/settingsSharedFolders.html
@@ -1,365 +1,365 @@
-<!--
-
- Shared Folders
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsSharedFolders.html 595 2015-04-17 09:50:36Z imoore76 $
-
--->
-<table style='width: 100%' id='vboxSettingsSharedFoldersTable'>
- <tr style='vertical-align: middle'>
- <td style='width: 100%'>
- <table class='vboxSettingsHeadingLine' style='width:100%;border-spacing:0;border:0px;margin:0px;padding:0px;'><tr style='vertical-align:middle'><td style='white-space: nowrap; width: auto;'><span class='translate'>Folders List</span></td><td style='width: 100%'><hr style='width: 100%;' class='vboxSeparatorLine'/></td></tr></table>
- </td>
- </tr>
- <tr>
- <td style='width: 100%'>
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%'>
- <div style='overflow: auto;' class='vboxBordered' id='vboxSettingsSharedFolders'>
- <table class='vboxHorizontal' id='vboxSettingsSharedFoldersList'>
- <thead>
- <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>
- </tr>
- </thead>
- </table>
- </div>
- </td>
- <td id='vboxSettingsSFButtons'></td>
- </tr>
- </table>
- </td>
- </tr>
-
-</table>
-<script type='text/javascript'>
-
-/*
- * Init Shared Folder buttons and toolbar
- */
-
-var sButtons = new Array(
-
- {
- 'name': 'addshared',
- 'label': 'Add Shared Folder',
- 'icon': 'sf_add',
- 'enabled': function (item) { return true; },
- 'click': function () {
-
- var dialog = vboxSettingsSFEditDialog();
-
- $('#vboxSettingsSFPath').val('');
- $('#vboxSettingsSFName').val('');
- $('#vboxSettingsSFAM').prop('checked',false);
- $('#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'))};
- if($('#vboxSettingsSFPerm').length) {
- f['type'] = ($('#vboxSettingsSFPerm').prop('checked') ? 'machine' : '');
- } else {
- f['type'] = 'machine';
- }
- var row = vboxSettingsAddSharedFolder(f);
- $(row).children('td').last().trigger('click');
- }
- $(dialog).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { $(dialog).empty().remove(); };
- $(dialog).dialog({'buttons':buttons,'title':'<img src="images/vbox/sf_16px.png" class="vboxDialogTitleIcon" /> '+trans('Add Share','UIMachineSettingsSFDetails')}).dialog('open');
-
- }
- },
-
- {
- 'name': 'editshared',
- 'label': 'Edit Shared Folder',
- 'icon': 'sf_edit',
- 'enabled': function (item) { return $(item).hasClass('vboxListItemSelected'); },
- 'click': function () {
-
- var dialog = vboxSettingsSFEditDialog();
-
- var def = $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first();
- $('#vboxSettingsSFPath').val(($(def).data('hostPath')||''));
- $('#vboxSettingsSFName').val(($(def).data('name')||''));
- $('#vboxSettingsSFAM').prop('checked',($(def).data('autoMount') ? true : false));
- $('#vboxSettingsSFRO').prop('checked',($(def).data('writable') ? false : true));
- $('#vboxSettingsSFPerm').prop('checked',($(def).data('type') == 'machine' ? true : false));
-
- var buttons = { };
- buttons[trans('OK','QIMessageBox')] = function() {
- if($('#vboxSettingsSFName').val() && $('#vboxSettingsSFPath').val()) {
- var item = $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first();
- $(item).data({
- 'hostPath' : $('#vboxSettingsSFPath').val(),
- 'name' : $('#vboxSettingsSFName').val(),
- 'autoMount' : ($('#vboxSettingsSFAM').prop('checked')),
- 'writable' : !($('#vboxSettingsSFRO').prop('checked')),
- 'type' : ((!$('#vboxSettingsSFPerm').length || $('#vboxSettingsSFPerm').prop('checked')) ? 'machine' : '')
- }).trigger('refresh');
- }
- $(dialog).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { $(dialog).empty().remove(); };
- $(dialog).dialog({'buttons':buttons}).dialog('open');
-
- }
- },
-
- {
- 'name' : 'removeshared',
- 'label' : 'Remove Shared Folder',
- 'icon' : 'sf_remove',
- 'enabled' : function (item) { return $(item).hasClass('vboxListItemSelected'); },
- 'click' : function () {
- var item = $('#vboxSettingsSharedFoldersList').find('.vboxListItemSelected').first();
- var target = $(item).next();
- if(!$(target).hasClass('vboxListItemSelected')) target = $(item).prev();
- if(!$(target).hasClass('vboxListItemSelected')) target = $('#vboxSettingsSharedFoldersList').find('.vboxListItem').first();
- $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first().remove();
- if(!$(target).children().first().trigger('click').hasClass('vboxListItemSelected')) {
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
- }
- }
- }
-
- );
-
-var sfToolbar = new vboxToolbarSmall({buttons: sButtons,
- language_context: 'UIMachineSettingsSF', renderTo: 'vboxSettingsSFButtons'});
-
-$('#vboxSettingsSharedFoldersList').on('select',function(e,el){sfToolbar.update(el);});
-
-/* Add Shared Folder to list */
-
-function vboxSettingsAddSharedFolder(f, noColor) {
-
- var tr = $('<tr />').attr({'class':'vboxListItem'}).addClass(f.type == 'machine' ? 'vboxSFMachine' : 'vboxSFTransient').on('refresh',function(){
-
- // 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.vboxSettingsSFAMCell').html($(this).data('autoMount') ? trans('Yes','UIMachineSettingsSF') : '');
- $(this).children('td.vboxSettingsSFROCell').html($(this).data('writable') ? trans('Full','UIMachineSettingsSF') : trans('Read-only','UIMachineSettingsSF'));
-
- // Move from one type to another
- if($(this).data('type') == 'machine' && $(this).hasClass('vboxSFTransient')) {
- $(this).removeClass('vboxSFTransient').addClass('vboxSFMachine').detach().appendTo('#vboxSFMachineBody');
- vboxColorRows($('#vboxSFMachineBody'));
- vboxColorRows($('#vboxSFTransientBody'));
- } else if($(this).data('type') != 'machine' && $(this).hasClass('vboxSFMachine')) {
- $(this).removeClass('vboxSFMachine').addClass('vboxSFTransient').detach().appendTo('#vboxSFTransientBody');
- vboxColorRows($('#vboxSFMachineBody'));
- vboxColorRows($('#vboxSFTransientBody'));
- }
-
-
- }).hoverClass('vboxHover').disableSelection().data(f);
-
- // Name
- $('<td />').attr({'class':'vboxSettingsSFNameCell vboxHoverFirst'}).append($('<img />').attr({'src':'images/vbox/blank.gif','style':'height: 10px; width: 30px;'})).append($('<span />').html($('<div/>').text(f.name).html())).appendTo(tr);
-
- // Path
- $('<td />').attr({'class':'vboxSettingsSFPathCell vboxHoverMid'}).html($('<div/>').text(f.hostPath).html()).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);
-
-
- $(tr).children().click(function(){
- $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(this).parent().removeClass('vboxListItem').addClass('vboxListItemSelected');
- $('#vboxSettingsSharedFoldersList').trigger('select',$(this).parent());
-
- }).dblclick(function(e){
- sfToolbar.click('editshared');
- e.preventDefault();
-
- });
-
- if(f.type == 'machine') {
- $('#vboxSFMachineBody').append(tr);
- if(!noColor) vboxColorRows($('#vboxSFMachineBody'));
- } else {
- $('#vboxSFTransientBody').append(tr);
- if(!noColor) vboxColorRows($('#vboxSFTransientBody'));
- }
-
- return tr;
-}
-
-/*
- *
- *
- * Load SF data
- *
- */
-
- $('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /* Shared Folders */
- var sfh = $('#vboxSettingsSharedFoldersList');
- sfh.children('tbody').empty().remove();
-
- /*
- *
- Add 'Machine Folder's
- *
- */
- var tb = $('<tbody />').attr({'id':'vboxSFMachineBody'}).addClass('vboxHover');
- var tr = $('<tr />').attr({'class':'vboxListItemDisabled'}).disableSelection();
- var td = $('<td />').attr({'class':'vboxSettingsSFNameCell'});
- $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/vbox/arrow_down_10px.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
- $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
- $('#vboxSFMachineBody').children('tr.vboxSFMachine').css({'display':'none'}).removeClass('vboxListItemSelected').addClass('vboxListItem');
-
- } else {
-
- $(this).data('toggleClicked', false);
- $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
- $('#vboxSFMachineBody').children('tr.vboxSFMachine').css({'display':''});
- }
-
- }).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);
-
- /*
- *
- * Add 'Transient Folders' if machine is running
- *
- */
- if(vboxVMStates.isRunning($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isSaved($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isPaused($('#vboxSettingsDialog').data('vboxMachineData'))) {
-
- var tb = $('<tbody />').attr({'id':'vboxSFTransientBody'}).addClass('vboxHover');
- var tr = $('<tr />').attr({'class':'vboxListItemDisabled'}).disableSelection();
-
- $('<td />').attr({'class':'vboxSettingsSFNameCell'}).append(
- $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/vbox/arrow_down_10px.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
-
- $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
- $('#vboxSFTransientBody').children('tr.vboxSFTransient').css({'display':'none'}).removeClass('vboxListItemSelected').addClass('vboxListItem');
-
- } else {
- $(this).data('toggleClicked', false);
- $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
- $('#vboxSFTransientBody').children('tr.vboxSFTransient').css('display','');
- }
- })).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'}));
- $(tb).append(tr).appendTo(sfh);
-
- // add each transient folder
- for(var i = 0; i < $('#vboxSettingsDialog').data('vboxTransientSharedFolders').length; i++) {
- vboxSettingsAddSharedFolder($('#vboxSettingsDialog').data('vboxTransientSharedFolders')[i]);
- }
-
-
- }
-
- // add each machine folder
- for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders.length; i++) {
- vboxSettingsAddSharedFolder($('#vboxSettingsDialog').data('vboxMachineData').sharedFolders[i]);
- }
-
- $('#vboxSettingsSharedFoldersList').trigger('select',null);
-
-});
-
-/* Update Shared Folder path and name. Callback for folder browser */
-function vboxSFBrowseFolder(btn) {
- vboxFileBrowser($('#vboxSettingsSFPath').val(),function(f) {
- if(!f) return;
- $('#vboxSettingsSFPath').val(f);
- if(!$('#vboxSettingsSFName').val()) {
- f = f.replace(/.*\//,'');
- f = f.replace(/.*\\/,'');
- if(f) $('#vboxSettingsSFName').val(f);
- }
- },true,trans('Folder Path:','UIMachineSettingsSFDetails').replace(':',''));
-}
-/*
- *
- *
- * Shared Folder Properties Screen
- *
- *
- */
-function vboxSettingsSFEditDialog() {
-
- var d = $('<div />').attr({'id':'vboxSettingsSFEdit','class':'vboxNonTabbed vboxDialogContent','style':'display: none;'});
-
- var tbl = $('<table />').attr({'style':'width: 100%','class':'vboxSettingsTable'});
-
- // Path
- $('<tr />').attr({'style':'vertical-align: middle'}).append($('<th />').attr({'style':'white-space: nowrap'}).html(trans('Folder Path:','UIMachineSettingsSFDetails'))).append(
- $('<td />').attr({'style':'white-space: nowrap'}).html('<table style="width: 100%"><tr><td style="width: 100%"><input type="text" class="vboxText" id="vboxSettingsSFPath" style="width: 100%"/></td><td style="width: auto" class="vboxFileFolderInput"><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="vboxSFBrowseFolder(this)" /></td></tr></table>')
- ).appendTo(tbl);
-
- // Name
- $('<tr />').append($('<th />').html(trans('Folder Name:','UIMachineSettingsSFDetails'))).append($('<td />').html('<input type="text" class="vboxText" id="vboxSettingsSFName" style="width: 100%" />')).appendTo(tbl);
-
- // Read only
- $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFRO" /> ' + trans('Read-only','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
-
- // Auto mount
- $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFAM" /> ' + trans('Auto-mount','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
-
- // Add "Make Permanent"?
- if(vboxVMStates.isRunning($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isSaved($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isPaused($('#vboxSettingsDialog').data('vboxMachineData'))) {
-
- $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFPerm" /> ' + trans('Make Permanent','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
- }
-
- $(d).append(tbl).dialog({'width':800,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent vboxNonTabbed','title':'<img src="images/vbox/sf_16px.png" class="vboxDialogTitleIcon" /> '+trans('Edit Share','UIMachineSettingsSFDetails')});
-
- return $('#vboxSettingsSFEdit');
-}
-
-
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders = new Array();
-
- var folders = new Array();
- $('#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')};
- }
- });
- $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders = folders;
-
-});
-
-
-</script>
-
+<!--
+
+ Shared Folders
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsSharedFolders.html 595 2015-04-17 09:50:36Z imoore76 $
+
+-->
+<table style='width: 100%' id='vboxSettingsSharedFoldersTable'>
+ <tr style='vertical-align: middle'>
+ <td style='width: 100%'>
+ <table class='vboxSettingsHeadingLine' style='width:100%;border-spacing:0;border:0px;margin:0px;padding:0px;'><tr style='vertical-align:middle'><td style='white-space: nowrap; width: auto;'><span class='translate'>Folders List</span></td><td style='width: 100%'><hr style='width: 100%;' class='vboxSeparatorLine'/></td></tr></table>
+ </td>
+ </tr>
+ <tr>
+ <td style='width: 100%'>
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%'>
+ <div style='overflow: auto;' class='vboxBordered' id='vboxSettingsSharedFolders'>
+ <table class='vboxHorizontal' id='vboxSettingsSharedFoldersList'>
+ <thead>
+ <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>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ </td>
+ <td id='vboxSettingsSFButtons'></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+</table>
+<script type='text/javascript'>
+
+/*
+ * Init Shared Folder buttons and toolbar
+ */
+
+var sButtons = new Array(
+
+ {
+ 'name': 'addshared',
+ 'label': 'Add Shared Folder',
+ 'icon': 'sf_add',
+ 'enabled': function (item) { return true; },
+ 'click': function () {
+
+ var dialog = vboxSettingsSFEditDialog();
+
+ $('#vboxSettingsSFPath').val('');
+ $('#vboxSettingsSFName').val('');
+ $('#vboxSettingsSFAM').prop('checked',false);
+ $('#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'))};
+ if($('#vboxSettingsSFPerm').length) {
+ f['type'] = ($('#vboxSettingsSFPerm').prop('checked') ? 'machine' : '');
+ } else {
+ f['type'] = 'machine';
+ }
+ var row = vboxSettingsAddSharedFolder(f);
+ $(row).children('td').last().trigger('click');
+ }
+ $(dialog).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { $(dialog).empty().remove(); };
+ $(dialog).dialog({'buttons':buttons,'title':'<img src="images/vbox/sf_16px.png" class="vboxDialogTitleIcon" /> '+trans('Add Share','UIMachineSettingsSFDetails')}).dialog('open');
+
+ }
+ },
+
+ {
+ 'name': 'editshared',
+ 'label': 'Edit Shared Folder',
+ 'icon': 'sf_edit',
+ 'enabled': function (item) { return $(item).hasClass('vboxListItemSelected'); },
+ 'click': function () {
+
+ var dialog = vboxSettingsSFEditDialog();
+
+ var def = $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first();
+ $('#vboxSettingsSFPath').val(($(def).data('hostPath')||''));
+ $('#vboxSettingsSFName').val(($(def).data('name')||''));
+ $('#vboxSettingsSFAM').prop('checked',($(def).data('autoMount') ? true : false));
+ $('#vboxSettingsSFRO').prop('checked',($(def).data('writable') ? false : true));
+ $('#vboxSettingsSFPerm').prop('checked',($(def).data('type') == 'machine' ? true : false));
+
+ var buttons = { };
+ buttons[trans('OK','QIMessageBox')] = function() {
+ if($('#vboxSettingsSFName').val() && $('#vboxSettingsSFPath').val()) {
+ var item = $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first();
+ $(item).data({
+ 'hostPath' : $('#vboxSettingsSFPath').val(),
+ 'name' : $('#vboxSettingsSFName').val(),
+ 'autoMount' : ($('#vboxSettingsSFAM').prop('checked')),
+ 'writable' : !($('#vboxSettingsSFRO').prop('checked')),
+ 'type' : ((!$('#vboxSettingsSFPerm').length || $('#vboxSettingsSFPerm').prop('checked')) ? 'machine' : '')
+ }).trigger('refresh');
+ }
+ $(dialog).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { $(dialog).empty().remove(); };
+ $(dialog).dialog({'buttons':buttons}).dialog('open');
+
+ }
+ },
+
+ {
+ 'name' : 'removeshared',
+ 'label' : 'Remove Shared Folder',
+ 'icon' : 'sf_remove',
+ 'enabled' : function (item) { return $(item).hasClass('vboxListItemSelected'); },
+ 'click' : function () {
+ var item = $('#vboxSettingsSharedFoldersList').find('.vboxListItemSelected').first();
+ var target = $(item).next();
+ if(!$(target).hasClass('vboxListItemSelected')) target = $(item).prev();
+ if(!$(target).hasClass('vboxListItemSelected')) target = $('#vboxSettingsSharedFoldersList').find('.vboxListItem').first();
+ $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').first().remove();
+ if(!$(target).children().first().trigger('click').hasClass('vboxListItemSelected')) {
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+ }
+ }
+ }
+
+ );
+
+var sfToolbar = new vboxToolbarSmall({buttons: sButtons,
+ language_context: 'UIMachineSettingsSF', renderTo: 'vboxSettingsSFButtons'});
+
+$('#vboxSettingsSharedFoldersList').on('select',function(e,el){sfToolbar.update(el);});
+
+/* Add Shared Folder to list */
+
+function vboxSettingsAddSharedFolder(f, noColor) {
+
+ var tr = $('<tr />').attr({'class':'vboxListItem'}).addClass(f.type == 'machine' ? 'vboxSFMachine' : 'vboxSFTransient').on('refresh',function(){
+
+ // 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.vboxSettingsSFAMCell').html($(this).data('autoMount') ? trans('Yes','UIMachineSettingsSF') : '');
+ $(this).children('td.vboxSettingsSFROCell').html($(this).data('writable') ? trans('Full','UIMachineSettingsSF') : trans('Read-only','UIMachineSettingsSF'));
+
+ // Move from one type to another
+ if($(this).data('type') == 'machine' && $(this).hasClass('vboxSFTransient')) {
+ $(this).removeClass('vboxSFTransient').addClass('vboxSFMachine').detach().appendTo('#vboxSFMachineBody');
+ vboxColorRows($('#vboxSFMachineBody'));
+ vboxColorRows($('#vboxSFTransientBody'));
+ } else if($(this).data('type') != 'machine' && $(this).hasClass('vboxSFMachine')) {
+ $(this).removeClass('vboxSFMachine').addClass('vboxSFTransient').detach().appendTo('#vboxSFTransientBody');
+ vboxColorRows($('#vboxSFMachineBody'));
+ vboxColorRows($('#vboxSFTransientBody'));
+ }
+
+
+ }).hoverClass('vboxHover').disableSelection().data(f);
+
+ // Name
+ $('<td />').attr({'class':'vboxSettingsSFNameCell vboxHoverFirst'}).append($('<img />').attr({'src':'images/vbox/blank.gif','style':'height: 10px; width: 30px;'})).append($('<span />').html($('<div/>').text(f.name).html())).appendTo(tr);
+
+ // Path
+ $('<td />').attr({'class':'vboxSettingsSFPathCell vboxHoverMid'}).html($('<div/>').text(f.hostPath).html()).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);
+
+
+ $(tr).children().click(function(){
+ $('#vboxSettingsSharedFoldersList').find('tr.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(this).parent().removeClass('vboxListItem').addClass('vboxListItemSelected');
+ $('#vboxSettingsSharedFoldersList').trigger('select',$(this).parent());
+
+ }).dblclick(function(e){
+ sfToolbar.click('editshared');
+ e.preventDefault();
+
+ });
+
+ if(f.type == 'machine') {
+ $('#vboxSFMachineBody').append(tr);
+ if(!noColor) vboxColorRows($('#vboxSFMachineBody'));
+ } else {
+ $('#vboxSFTransientBody').append(tr);
+ if(!noColor) vboxColorRows($('#vboxSFTransientBody'));
+ }
+
+ return tr;
+}
+
+/*
+ *
+ *
+ * Load SF data
+ *
+ */
+
+ $('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /* Shared Folders */
+ var sfh = $('#vboxSettingsSharedFoldersList');
+ sfh.children('tbody').empty().remove();
+
+ /*
+ *
+ Add 'Machine Folder's
+ *
+ */
+ var tb = $('<tbody />').attr({'id':'vboxSFMachineBody'}).addClass('vboxHover');
+ var tr = $('<tr />').attr({'class':'vboxListItemDisabled'}).disableSelection();
+ var td = $('<td />').attr({'class':'vboxSettingsSFNameCell'});
+ $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/vbox/arrow_down_10px.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+ $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+ $('#vboxSFMachineBody').children('tr.vboxSFMachine').css({'display':'none'}).removeClass('vboxListItemSelected').addClass('vboxListItem');
+
+ } else {
+
+ $(this).data('toggleClicked', false);
+ $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+ $('#vboxSFMachineBody').children('tr.vboxSFMachine').css({'display':''});
+ }
+
+ }).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);
+
+ /*
+ *
+ * Add 'Transient Folders' if machine is running
+ *
+ */
+ if(vboxVMStates.isRunning($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isSaved($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isPaused($('#vboxSettingsDialog').data('vboxMachineData'))) {
+
+ var tb = $('<tbody />').attr({'id':'vboxSFTransientBody'}).addClass('vboxHover');
+ var tr = $('<tr />').attr({'class':'vboxListItemDisabled'}).disableSelection();
+
+ $('<td />').attr({'class':'vboxSettingsSFNameCell'}).append(
+ $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/vbox/arrow_down_10px.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+
+ $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+ $('#vboxSFTransientBody').children('tr.vboxSFTransient').css({'display':'none'}).removeClass('vboxListItemSelected').addClass('vboxListItem');
+
+ } else {
+ $(this).data('toggleClicked', false);
+ $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+ $('#vboxSFTransientBody').children('tr.vboxSFTransient').css('display','');
+ }
+ })).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'}));
+ $(tb).append(tr).appendTo(sfh);
+
+ // add each transient folder
+ for(var i = 0; i < $('#vboxSettingsDialog').data('vboxTransientSharedFolders').length; i++) {
+ vboxSettingsAddSharedFolder($('#vboxSettingsDialog').data('vboxTransientSharedFolders')[i]);
+ }
+
+
+ }
+
+ // add each machine folder
+ for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders.length; i++) {
+ vboxSettingsAddSharedFolder($('#vboxSettingsDialog').data('vboxMachineData').sharedFolders[i]);
+ }
+
+ $('#vboxSettingsSharedFoldersList').trigger('select',null);
+
+});
+
+/* Update Shared Folder path and name. Callback for folder browser */
+function vboxSFBrowseFolder(btn) {
+ vboxFileBrowser($('#vboxSettingsSFPath').val(),function(f) {
+ if(!f) return;
+ $('#vboxSettingsSFPath').val(f);
+ if(!$('#vboxSettingsSFName').val()) {
+ f = f.replace(/.*\//,'');
+ f = f.replace(/.*\\/,'');
+ if(f) $('#vboxSettingsSFName').val(f);
+ }
+ },true,trans('Folder Path:','UIMachineSettingsSFDetails').replace(':',''));
+}
+/*
+ *
+ *
+ * Shared Folder Properties Screen
+ *
+ *
+ */
+function vboxSettingsSFEditDialog() {
+
+ var d = $('<div />').attr({'id':'vboxSettingsSFEdit','class':'vboxNonTabbed vboxDialogContent','style':'display: none;'});
+
+ var tbl = $('<table />').attr({'style':'width: 100%','class':'vboxSettingsTable'});
+
+ // Path
+ $('<tr />').attr({'style':'vertical-align: middle'}).append($('<th />').attr({'style':'white-space: nowrap'}).html(trans('Folder Path:','UIMachineSettingsSFDetails'))).append(
+ $('<td />').attr({'style':'white-space: nowrap'}).html('<table style="width: 100%"><tr><td style="width: 100%"><input type="text" class="vboxText" id="vboxSettingsSFPath" style="width: 100%"/></td><td style="width: auto" class="vboxFileFolderInput"><input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="vboxSFBrowseFolder(this)" /></td></tr></table>')
+ ).appendTo(tbl);
+
+ // Name
+ $('<tr />').append($('<th />').html(trans('Folder Name:','UIMachineSettingsSFDetails'))).append($('<td />').html('<input type="text" class="vboxText" id="vboxSettingsSFName" style="width: 100%" />')).appendTo(tbl);
+
+ // Read only
+ $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFRO" /> ' + trans('Read-only','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
+
+ // Auto mount
+ $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFAM" /> ' + trans('Auto-mount','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
+
+ // Add "Make Permanent"?
+ if(vboxVMStates.isRunning($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isSaved($('#vboxSettingsDialog').data('vboxMachineData')) || vboxVMStates.isPaused($('#vboxSettingsDialog').data('vboxMachineData'))) {
+
+ $('<tr />').append($('<th />')).append($('<td />').html('<label><input type="checkbox" class="vboxCheckbox" id="vboxSettingsSFPerm" /> ' + trans('Make Permanent','UIMachineSettingsSFDetails')+'</label>')).appendTo(tbl);
+ }
+
+ $(d).append(tbl).dialog({'width':800,'modal':true,'autoOpen':false,'dialogClass':'vboxDialogContent vboxNonTabbed','title':'<img src="images/vbox/sf_16px.png" class="vboxDialogTitleIcon" /> '+trans('Edit Share','UIMachineSettingsSFDetails')});
+
+ return $('#vboxSettingsSFEdit');
+}
+
+
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders = new Array();
+
+ var folders = new Array();
+ $('#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')};
+ }
+ });
+ $('#vboxSettingsDialog').data('vboxMachineData').sharedFolders = folders;
+
+});
+
+
+</script>
+
diff --git a/panes/settingsStorage.html b/panes/settingsStorage.html
index 5056343..5e1ce54 100644
--- a/panes/settingsStorage.html
+++ b/panes/settingsStorage.html
@@ -1,1705 +1,1705 @@
-<!--
-
- VM Storage Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsStorage.html 599 2015-07-27 10:40:37Z imoore76 $
-
--->
-<table style='width: 100%;' id='vboxSettingsStorageTableWrapper'>
- <tr style='height: 100%'>
- <td width='50%' style='padding: 6px;'>
- <div id='vboxStoragePaneLeft'>
- <table class='vboxSettingsHeadingLine'
- style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
- <tr style='vertical-align: middle'>
- <td style='white-space: nowrap; width: auto;'><span
- class='translate vboxRunningEnabled'>Storage Tree</span></td>
- <td style='width: 100%'>
- <hr style='width: 100%;' class='vboxSeparatorLine'/>
- </td>
- </tr>
- </table>
-
-
- <!-- Storage Controllers -->
- <div id='vboxSettingsStorageTree' style='height: 290px; outline: none;' class='vboxBordered' tabindex='0'>
- <ul class='vboxHover vboxHoverBorderless'>
- <li>Storage Thingy</li>
- <li>
- <ul>
- <li>Attachment Thingy</li>
- </ul>
- </li>
- </ul>
- </div>
-
- <!-- Controller Toolbar -->
- <div id='vboxSettingsControllersButtons' style='text-align: right'></div>
-
-
- </div>
- </td>
-
- <!-- Resize Bar -->
- <td style='height: 100%; width:3px; padding:0px; margin:0px;'>
- <div style='margin:0px; margin-top: 2px; padding:0px; width: 3px; height: 99%; background:#aaa;' id='vboxStorageResizeBar' ></div>
- </td>
-
- <td width='50%' style='padding: 6px;'>
- <div id='vboxStoragePaneRight'>
- <table class='vboxSettingsHeadingLine'
- style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
- <tr style='vertical-align: middle'>
- <td style='white-space: nowrap; width: auto;'><span
- class='translate vboxRunningEnabled'>Attributes</span></td>
- <td style='width: 100%; white-space: nowrap;'><hr style='width: 100%;' class='vboxSeparatorLine'/></td>
- </tr>
- </table>
-
-
- <!-- Controller Settings -->
- <div id='vboxSettingsController' style='width: 100%; display: none;'>
- <table style='width: 100%' class='vboxVertical'>
- <tr>
- <th><span class='translate'>Name:</span></th>
- <td style='width: 100%'><input type='text' class='vboxText'
- name='vboxSettingsStorageItemName' style='width: 99%' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Type:</span></th>
- <td><select name='vboxSettingsStorageControllerType'
- style='width: 100%'>
- <option value='ICH6'>ICH6</option>
- </select></td>
- </tr>
- <tr id='vboxSettingsControllerPortCountRow' style='display: none'>
- <th><span class='translate'>Port Count:</span></th>
- <td>
- <select name='vboxSettingsControllerPortCount'>
- </select>
- </td>
- </tr>
- <tr>
- <th></th>
- <td style='width: 100%'>
- <label><input type='checkbox' class='vboxCheckbox'
- name='vboxSettingsStorageHostCache'/> <span class='translate'>Use Host I/O Cache</span></label></td>
- </tr>
- </table>
- </div>
-
- <!-- Attachment Settings -->
- <div id='vboxSettingsStorageAttachment' style='display: none'>
- <table class='vboxVertical'>
- <tr style='vertical-align: middle;'>
- <th><span class='translate vboxRunningEnabled' id='vboxSettingsControllerSlotLabel'>HardDisk</span></th>
- <td style='width: 100%'>
- <table class='vboxInvisible' style='width: 100%'>
- <tr style='vertical-align: middle'>
- <td style='width: 100%'>
- <select name='vboxSettingsControllerSlot' style='width: 100%'></select>
- </td>
- <td>
- <div id='vboxSettingsAddAttachmentsMenuHDDiv' style='display: none'></div>
- <div id='vboxSettingsAddAttachmentsMenuFDDiv' style='display: none'></div>
- <div id='vboxSettingsAddAttachmentsMenuCDDiv' style='display: none'></div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
-
- <!-- Selected Media Info -->
- <div id='vboxSettingsMediaInfo' style='display: none'>
- <table class='vboxSettingsHeadingLine'
- style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
- <tr style='vertical-align: middle'>
- <td style='white-space: nowrap; width: auto;'><span
- class='translate vboxRunningEnabled'>Information</span></td>
- <td style='width: 100%'>
- <hr style='width: 100%; ' class='vboxSeparatorLine'/>
- </td>
- </tr>
- </table>
-
-
- <!-- HardDisk Media -->
- <div id='vboxSettingsHDInfo'>
- <table class='vboxVertical'>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Type (Format):</span></th>
- <td><span id='vboxSettingsHDtype' class='vboxRunningEnabled'>Image</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Virtual Size:</span></th>
- <td><span id='vboxSettingsHDvsize' class='vboxRunningEnabled'>30 GB</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Actual Size:</span></th>
- <td><span id='vboxSettingsHDasize' class='vboxRunningEnabled'>30 GB</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Details:</span></th>
- <td><span id='vboxSettingsHDDetails' class='vboxRunningEnabled'>Dynamic</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Location:</span></th>
- <td><span id='vboxSettingsHDlocation' class='vboxRunningEnabled'>/usr/local/blah/etc..</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Attached to:</span></th>
- <td><span id='vboxSettingsHDattached' class='vboxRunningEnabled'>Some Virtual
- Machine Name</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Encrypted with key:</span></th>
- <td><span id='vboxSettingsHDEncrypted' class='vboxRunningEnabled'>--</span></td>
- </tr>
- </table>
- </div>
-
- <!-- DVD/CD Media and Floppy -->
- <div id='vboxSettingsImageInfo'>
- <table class='vboxVertical'>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Type:</span></th>
- <td><span id='vboxSettingsImageType' class='vboxRunningEnabled'>Image</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Size:</span></th>
- <td><span id='vboxSettingsImageSize' class='vboxRunningEnabled'>30 GB</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Location:</span></th>
- <td><span id='vboxSettingsImageLocation' class='vboxRunningEnabled'>/usr/local/blah/etc..</span></td>
- </tr>
- <tr>
- <th><span class='translate vboxRunningEnabled'>Attached to:</span></th>
- <td><span id='vboxSettingsImageAttached' class='vboxRunningEnabled'>Some Virtual
- Machine Name</span></td>
- </tr>
- </table>
- </div>
-
- </div>
- </div>
- </td>
- </tr>
-</table>
-<script type='text/javascript'>
-
- /*
- *
- * Storage controller helper object
- *
- *
- */
- var vboxSettingsStorageObj = function() {
-
- this.busTypes = vboxStorage.getBusTypes();
-
- this.attachedDirectMedia = {};
- this.attachedIndirectMedia = {};
-
- /* Return slots available on controller, including incl (device currently on slot) */
- this.availableSlots = function(conElm,incl) {
-
- var bus = $(conElm).children('table').first().data('controller').bus;
- var slots = vboxStorage[bus].slots();
-
- var atts = $(conElm).find('table.vboxSettingsStorageAttachment');
-
- for(var i = 0; i < atts.length; i++) {
- slot = $(atts[i]).data('attachment').port+'-'+$(atts[i]).data('attachment').device;
- if(incl && (incl == slot)) continue;
- delete slots[slot];
- }
- return slots;
- };
-
- this.addAttached = function(m) {
- if(!m || !m.id) return;
- var medium = vboxMedia.getMediumById(m.id);
-
- // SafeGuard
- if(!medium) {
- alert('A medium listed as attached to this machine was not found in the media registry. phpVirtualBox will now reload.');
- location.reload(true);
- }
-
- this.attachedDirectMedia[medium.id] = medium;
- if(medium.base) {
- this.attachedIndirectMedia[medium.base] = medium;
- }
- };
-
- this.isAttached = function(m,directOnly) {
- if(!m || !m.id) return false;
- if(this.attachedDirectMedia[m.id]) return this.attachedDirectMedia[m.id];
- if(!directOnly) {
- return (m.base ? this.attachedIndirectMedia[m.base] : null);
- }
- return false;
- };
-
- this.isAttachedDirect = function(m) { return this.attachedDirectMedia[m.id]; };
- this.isAttachedIndirect = function(m) { return (m.base ? this.attachedIndirectMedia[m.base] : null); };
- };
-
- /*
- *
- *
- * Initialization logic
- *
- *
- */
-
- /* Storage Obj */
- var vboxSettingsStorageBusses = new vboxSettingsStorageObj(); // defined below
-
- /* Setup SATA port count */
- var sel = document.forms['frmVboxSettings'].vboxSettingsControllerPortCount;
- for(var i = 1; i <= vboxStorage.SATA.maxPortCount; i++) {
- sel.options[sel.options.length] = new Option(i,i);
- }
- $(sel).change(function(){
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').portCount = $(this).val();
- });
-
-
-
- /* Pre-load storage images */
-var imgs = new Array();
-for(var i=0;i<vboxSettingsStorageBusses.busTypes.length;i++){
- var imgName = vboxStorage.getBusIconName(vboxSettingsStorageBusses.busTypes[i]);
- imgs[i] = new Array();
- imgs[i][0] = new Image();
- imgs[i][0].src = 'images/vbox/'+imgName+'_expand_16px.png';
- imgs[i][1] = new Image();
- imgs[i][1].src = 'images/vbox/'+imgName+'_collapse_16px.png';
- imgs[i][2] = new Image();
- imgs[i][2].src = 'images/vbox/'+imgName+'_add_16px.png';
- imgs[i][3] = new Image();
- imgs[i][3].src = 'images/vbox/'+imgName+'_add_disabled_16px.png';
-}
-
-var imgs2 = new Array();
-var imgsToLoad = ['fd','hd','cd'];
-for(var i=0;i<imgsToLoad.length;i++){
- imgs2[i] = new Image();
- imgs2[i].src = 'images/vbox/'+imgsToLoad[i]+'_16px.png';
-}
-
-/*
- *
- * Init Storage Controller menus and toolbar
- *
- */
-
- /* Menu for adding controllers */
- var vboxSettingsCMenu = new vboxMenu({id: 'vboxSettingsAddControllerMenu',
- language_context: 'UIMachineSettingsStorage'});
- var vboxSettingsCMenuItems = [];
- var bustypes = vboxStorage.getBusTypes();
- for(var i = 0; i < bustypes.length; i++) {
- var bt = bustypes[i];
- var icon = vboxStorage.getBusIconName(bt);
- vboxSettingsCMenuItems[vboxSettingsCMenuItems.length] = {'name':'add'+bt,'icon':icon+"_add",'label':'Add '+bt+' Controller'};
- }
- vboxSettingsCMenu.addMenu(vboxSettingsCMenuItems);
-
-
- /* Storage tree context menu to add controllers */
- $('#vboxSettingsStorageTree').contextMenu({
- menu: vboxSettingsCMenu.menuId()
- },
- function(action, el, pos) {
-
- var bus = action.substring(3);
- var c = {'bus':bus,'mediumAttachments':[],'controllerType':vboxStorage[bus].types[0],'useHostIOCache':1,
- 'maxPortCount':vboxStorage[bus]['maxPortCount'],'maxDevicesPerPortCount':vboxStorage[bus]['maxDevicesPerPortCount']};
-
-
- vboxSettingsAddController(c, $('#vboxSettingsStorageTree').children('ul').first());
-
- $('#vboxSettingsStorageTree').trigger('itemselect',$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first());
- }
- );
-
- /* Storage tree tool bar */
- var vboxSettingsStorageButtons = new Array(
- {
- /* Add Attachment Button */
- 'name' : 'addattach',
- 'label' : 'Add Attachment',
- 'icon' : 'attachment_add',
- 'enabled' : function (item) {
-
- if(!$(item).data('controller')) return false;
-
- // Determine how max and how many are used
- if(!($(item).data('controller').maxPortCount && ($(item).parent().find('ul').children('li').length < ($(item).data('controller').maxPortCount * $(item).data('controller').maxDevicesPerPortCount))))
- return false;
-
- // Enable / Disable CD/DVD menu
- var c = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
- if(jQuery.inArray('dvd', vboxStorage[$(c).data('controller').bus].driveTypes) > -1) {
- scToolbar.getButtonElement("addattach").data('busType',$(c).data('controller').bus);
- scToolbar.getButtonElement("addattach").enableContextMenu();
- } else {
- scToolbar.getButtonElement("addattach").disableContextMenu();
- }
- return true;
-
- },
- 'click' : function (item) {
- // Let context menu handle IDE and Sata
- var c = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
- if(vboxStorage[$(c).data('controller').bus].driveTypes.length > 1) {
- return;
- }
- vboxSettingsStorageAddMedium($(c).parent(),($(c).data('controller').bus == 'Floppy' ? 'Floppy' : 'HardDisk'));
- }
- },
-
- {
- /* Remove Attachment Button */
- 'name' : 'removeattach',
- 'label' : 'Remove Attachment',
- 'icon' : 'attachment_remove',
- 'enabled' : function (item) { return (item && $(item).data('attachment')); },
- 'click' : function () {
-
- // Set previous item to last?
- var cur = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent();
-
- if($(cur).hasClass('last')) {
- $(cur).prev().addClass('last');
- }
-
- var next = $(cur).next().find('table.vboxListItem').first();
- if(!$(next).html()) {
- var con = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller');
- if(con) next = $('#vboxSettingsController'+con.bus).find('table.vboxListItem').first();
- }
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().remove();
- if(!$(next).trigger('click').html()) $('#vboxSettingsStorageTree').trigger('itemselect',null);
- }
- },
-
- {
- /* Add Controller Button */
- 'name' : 'addcontroller',
- 'label' : 'Add Controller',
- 'icon' : 'controller_add',
- 'enabled' : function (item) {
-
- // Draw menu items
- var cons = $('#vboxSettingsStorageTree').find('table.vboxSettingsController');
- var avail = vboxStorage.getBusTypes();
- var used = {};
- for(var i = 0; i < avail.length; i++) {
- used[avail[i]] = false;
- }
-
- for(var i = 0; i < cons.length; i++) {
- used[$(cons[i]).data('controller').bus] = true;
- }
-
- var oneEnabled = false;
- for(var i in used) {
-
- if(used[i]) { // && vboxStorage[i].limitOneInstance) {
- vboxSettingsCMenu.disableItem('add'+i);
- } else {
- vboxSettingsCMenu.enableItem('add'+i);
- oneEnabled = true;
- }
- }
-
- // If at least one item is enabled
- return oneEnabled;
-
-
- },
- 'click' : function (item) { return true; }
- },
-
- {
- /* Remove Controller Button */
- 'name' : 'removecontroller',
- 'label' : 'Remove Controller',
- 'icon' : 'controller_remove',
- 'enabled' : function (item) { if(item && $(item).data('controller')) return true; },
- 'click' : function () {
- var next = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().next().find('table.vboxListItem').first();
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().remove();
- if(!$(next).html()) {next = $('#vboxSettingsStorageTree').find('table.vboxListItem').first();}
- if(!$(next).trigger('click').html()) $('#vboxSettingsStorageTree').trigger('itemselect',null);
- }
- }
-
-
-
- );
-var scToolbar = new vboxToolbarSmall({buttons: vboxSettingsStorageButtons,
- language_context: 'UIMachineSettingsStorage', renderTo: 'vboxSettingsControllersButtons'});
-
-
-/* Add controller button menu initialization */
-scToolbar.getButtonElement("addcontroller").contextMenu({
- menu: vboxSettingsCMenu.menuId(),
- mode:'menu',
- button: 0
- },
- function(action, el, pos) {
-
- var bus = action.substring(3);
- var c = {'bus':bus,'mediumAttachments':[],'controllerType':vboxStorage[bus].types[0],'useHostIOCache':1,
- 'maxPortCount':vboxStorage[bus]['maxPortCount'],'maxDevicesPerPortCount':vboxStorage[bus]['maxDevicesPerPortCount']};
-
- vboxSettingsAddController(c, $('#vboxSettingsStorageTree').children('ul').first());
-
- $('#vboxSettingsStorageTree').trigger('itemselect',$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first());
- }
- );
-
-/* Menu for adding attachment */
-var mAttachMenu = new vboxMenu({id: 'vboxSettingsAddAttachmentsMenu',
- language_context: 'UIMachineSettingsStorage',
- menuItems: [{name: 'addCD', icon: 'cd_add', label: 'Add Optical Drive'},
- {name: 'addHD', icon: 'hd_add', label: 'Add Hard Disk'}]});
-
-
- /* Add attachment button menu initialization */
-scToolbar.getButtonElement("addattach").contextMenu({
- menu: mAttachMenu.menuId(),
- mode:'menu',
- button: 0
- },
- function(action, el, pos) {
- vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),(action == 'addCD' ? 'DVD' : 'HardDisk'));
- }
- );
-
-
-
-$('#vboxSettingsStorageTree').on('itemselect',function(e,el) {scToolbar.update(el); });
-
-
-/* Medium attachment context menu */
-var vboxSettingsMAMenu = new vboxMenu({'name':'vboxSettingsMAMenuL',
- 'menuItems': [vboxSettingsStorageButtons[1]],
- 'language_context': 'UIMachineSettingsStorage'});
-
-/*
- * Medium menu buttons
- */
-var mAttachToolbarHD = new vboxButtonMediaMenu('HardDisk',vboxSettingsControllerAttach);
-mAttachToolbarHD.renderTo('vboxSettingsAddAttachmentsMenuHDDiv');
-
-var mAttachToolbarCD = new vboxButtonMediaMenu('DVD',vboxSettingsControllerAttach);
-mAttachToolbarCD.renderTo('vboxSettingsAddAttachmentsMenuCDDiv');
-
-var mAttachToolbarFD = new vboxButtonMediaMenu('Floppy',vboxSettingsControllerAttach);
-mAttachToolbarFD.renderTo('vboxSettingsAddAttachmentsMenuFDDiv');
-
-/*
- * Controller actions and menus for each bus type
- */
-var vboxStorageBusTypes = vboxStorage.getBusTypes();
-var vboxStorageAttachmentMenus = new Array();
-for(var i = 0; i < vboxStorageBusTypes.length; i++) {
- var btype = vboxStorageBusTypes[i];
- var menuItems = [];
- for(var a = 0; a < vboxStorage[btype].driveTypes.length; a++) {
- switch(vboxStorage[btype].driveTypes[a]) {
- case 'dvd':
- b = {
- 'name' : btype+'addcd',
- 'label' : 'Add Optical Drive',
- 'icon' : 'cd_add',
- 'click' : function () {
- vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),'DVD');
- }
- };
- break;
- case 'disk':
- b = {
- 'name' : btype+'adddrive',
- 'label' : 'Add Hard Disk',
- 'icon' : 'hd_add',
- 'click' : function (item) {
- vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent());
- }
- };
- break;
- case 'floppy':
- b = {
- 'name' : btype + 'addfloppy',
- 'label':trans('Add Floppy Drive','UIMachineSettingsStorage'),
- 'icon' : 'fd_add',
- 'click' : function (item) {
- vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),'Floppy'); }
- };
- break;
- }
- b['enabled'] = function(a) {
- return ($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().find('li').length < (vboxStorage[a].maxPortCount * vboxStorage[a].maxDevicesPerPortCount));
- };
- menuItems[menuItems.length] = b;
- }
-
- // Add seperator and "remove controller"
- menuItems[menuItems.length] = $.extend(true, {}, vboxSettingsStorageButtons[3]); // "Remove"
- menuItems[(menuItems.length-1)].separator = true;
- menuItems[(menuItems.length-1)].enabled = null; // always enabled
-
- vboxStorageAttachmentMenus[btype] = new vboxMenu({name: 'vboxSettingsController'+btype+'AttachmentsMenu',
- language_context: 'UIMachineSettingsStorage',
- 'menuItems': menuItems});
-
-}
-
-$('#vboxSettingsStorageTree').on('itemselect',function(e,item){
- for(var i = 0; i < vboxStorageBusTypes.length; i++)
- vboxStorageAttachmentMenus[vboxStorageBusTypes[i]].update(vboxStorageBusTypes[i]);
-});
-/*
- *
- * Form helper functions that listen for form change events
- *
- *
- */
-
-/*
- * Changing the slot changes the object
- */
-document.forms['frmVboxSettings'].vboxSettingsControllerSlot.onchange = function(){
-
- // change port / device
- var pd = this.value.split('-');
- var attachment = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
- $(attachment).data('attachment').port = pd[0];
- $(attachment).data('attachment').device = pd[1];
-
-};
-
-
-
-/*
- *
- * Controller form elements
- *
- */
-
-/* onChange of controller type */
-$(document.forms['frmVboxSettings'].vboxSettingsStorageControllerType).change(function(){
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').controllerType = $(this).val();
-});
-
-/* change storage controller label on keydown in text box */
-$(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).keyup(function(){
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('span.vboxSettingsControllerTitle').first().text(this.value);
-});
-
-/* Set storage controller name on blur of textbox */
-$(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).on('blur',function(e){
-
- var bus = $('#vboxSettingsStorageTree').find('.vboxListItemSelected').first();
-
- if(!$(bus).data('controller')) return;
-
- var newName = $(this).val();
-
- // no change?
- if(newName == $(bus).data('controller').name) return true;
-
- if(jQuery.trim($(this).val().toString()).length < 1) {
- $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val($(bus).data('controller').name);
-
- } else {
-
- $('#vboxSettingsStorageTree').find('table.vboxSettingsController').each(function(idx,elm) {
- if($(elm).data('controller').name == newName) {
- $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val($(bus).data('controller').name);
- conflictFound = true;
- return false;
- }
- });
- }
-
- $(bus).data('controller').name = $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val();
- $(bus).find('span.vboxSettingsControllerTitle').first().text($(bus).data('controller').name);
-
-}).keyup(function(){
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('span.vboxSettingsControllerTitle').text(this.value);
-});
-
-/* Change host cache value onClick of checkbox */
-$(document.forms['frmVboxSettings'].vboxSettingsStorageHostCache).click(function(){
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').useHostIOCache = this.checked;
-});
-
-
-
-
-/*
- * Update menu items on select and display
- */
-$('#vboxSettingsStorageTree').on('itemselect',function(e,item){
-
- $('#vboxSettingsAddAttachmentsMenuCDDiv').hide();
- $('#vboxSettingsAddAttachmentsMenuHDDiv').hide();
- $('#vboxSettingsAddAttachmentsMenuFDDiv').hide();
-
- // Null selection hides everything
- if(!item) {
- $('#vboxSettingsController').css('display','none');
- $('#vboxSettingsMediaInfo').css('display','none');
- $('#vboxSettingsStorageAttachment').css('display','none');
- // Update label widths
- vboxStorageResizeTreeItemLabels();
- return;
- }
-
- if(!$(item).data('attachment')) {
- // Update label widths
- vboxStorageResizeTreeItemLabels();
- return;
- }
-
- switch($(item).data('attachment').type) {
- case 'HardDisk':
- $('#vboxSettingsAddAttachmentsMenuHDDiv').show();
- break;
- case 'Floppy':
- // Update media menu...
- mAttachToolbarFD.menuUpdateMedia($(item).data('attachment').medium);
- $('#vboxSettingsAddAttachmentsMenuFDDiv').show();
- break;
- default:
- // Update media menu...
- mAttachToolbarCD.menuUpdateMedia($(item).data('attachment').medium);
- $('#vboxSettingsAddAttachmentsMenuCDDiv').show();
- }
-
- // Update label widths
- vboxStorageResizeTreeItemLabels();
-
-
-
-});
-
-
-
-
-/*
- *
- * OnSave and OnShow for dialog
- *
- *
- */
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
-
- $('#vboxSettingsDialog').data('vboxMachineData').storageControllers = new Array();
-
- var storageList = $('#vboxSettingsStorageTree').children('ul').first();
-
- $(storageList).find('table.vboxSettingsController').each(function(i,con){
-
-
- var attachments = new Array();
-
- $(con).parent().find('table.vboxSettingsStorageAttachment').each(function(i,elm) {
-
- var attch = $(elm).data('attachment');
-
- if(attch.medium && attch.medium.id) {
- var med = vboxMedia.getMediumById(attch.medium.id);
- attch.medium = {'id':med.id,'hostDrive':med.hostDrive,'location':med.location};
- }
-
- attachments[attachments.length] = attch;
-
- });
-
- var curCon = $('#vboxSettingsDialog').data('vboxMachineData').storageControllers.length;
-
- $('#vboxSettingsDialog').data('vboxMachineData').storageControllers[curCon] = $(this).data('controller');
- $('#vboxSettingsDialog').data('vboxMachineData').storageControllers[curCon]['mediumAttachments'] = attachments;
-
- });
-
-
-});
-
-/* WHen data is loaded */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /*
- *
- * Fill form and storage list items
- *
- */
-
- /* Fill List by calling helper functions for each controller */
- var storageList = $('#vboxSettingsStorageTree').children('ul').first();
- $(storageList).children().remove();
-
- var cons = $('#vboxSettingsDialog').data('vboxMachineData').storageControllers;
- for(var a = 0; a < cons.length; a++) {
-
- var attch = cons[a].mediumAttachments;
-
- var conElm = vboxSettingsAddController(cons[a], $(storageList));
-
- for(var b = 0; b < cons[a].mediumAttachments.length; b++) {
- vboxSettingsStorageBusses.addAttached(cons[a].mediumAttachments[b].medium);
- vboxSettingsAddAttachment(cons[a].mediumAttachments[b], conElm);
- }
- }
-
- //Select first item in storage tree list
- $('#vboxSettingsStorageTree').find('table.vboxListItem').first().trigger('click').html();
-
- /* Disable non-editable items when VM is running */
- var p = $('#vboxSettingsStorageTableWrapper');
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
-
- scToolbar.disable();
- $('#vboxSettingsStorageTree').disableContextMenu()
-
- p.find('span:not(.vboxRunningEnabled)').addClass('disabled');
- p.find('input:not(.vboxRunningEnabled),select,textarea').prop('disabled',true);
-
- // Storage tree toolbars
- $('#vboxSettingsStorageTree').find('.vboxControllerAttachmentButton').trigger('disable');
-
- // Hard Disk Media menu button
- $('#vboxSettingsAddAttachmentsMenuHDDiv').trigger('disable');
-
- } else {
-
- $('#vboxSettingsStorageTree').enableContextMenu();
-
- p.find('span:not(.vboxRunningEnabled)').removeClass('disabled');
- p.find('input:not(.vboxRunningEnabled),select,textarea').prop('disabled',false);
-
- // Storage tree toolbars
- $('#vboxSettingsStorageTree').find('.vboxControllerAttachmentButton').trigger('enable');
-
- // Hard Disk Media menu button
- $('#vboxSettingsAddAttachmentsMenuHDDiv').trigger('enable');
-
- // initial toolbar update
- scToolbar.enable();
- scToolbar.update();
-
- }
-
-});
-
-
-/* Respond to UP / Down arrow events */
-$('#vboxSettingsStorageTree').click(function(){$(this).focus();}).keydown(function(e){
-
- var keynum = 0;
-
- if(e.keyCode)
- keynum = e.keyCode;
- else if(e.which)
- keynum = e.which;
-
- switch(keynum) {
-
- // up
- case 38:
-
- var cur = $(this).find('table.vboxListItemSelected').parent();
-
- // Try previous med attachment
- if($(cur).prev('li.vboxSettingsMediumAttachment').children('table.vboxListItem').trigger('click')[0]) {
- return;
- }
-
- // If we're a medium, click our parent controller
- if($(cur).hasClass('vboxSettingsMediumAttachment')) {
- $(cur).parent().parent('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
- return;
- }
-
- // Must be a controller, try previous controller's last medium attachment
- if($(cur).prev().children('ul:not([class~="vboxHidden"])').find('table.vboxListItem:last').trigger('click')[0])
- return;
-
- // No med attachment, try previous controller
- $(cur).prev('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
- break;
-
- // right / expand
- case 39:
- var tbl = $(this).find('table.vboxListItemSelected');
- var con = $(tbl).data('controller');
- if(!con) return;
- $(tbl).find('td.vboxSettingsController' + con.bus).click();
- break;
-
- // left / contract
- case 37:
- var tbl = $(this).find('table.vboxListItemSelected');
- var con = $(tbl).data('controller');
- if(!con) return;
- $(tbl).find('td.vboxSettingsController' + con.bus + 'Expanded').click();
- break;
-
- // down
- case 40:
-
- var cur = $(this).find('table.vboxListItemSelected').parent();
-
- // Try next med attachment
- if($(cur).next('li.vboxSettingsMediumAttachment').children('table.vboxListItem').trigger('click')[0]) {
- return;
- }
-
- // Select first medium of current controller?
- if($(cur).children('ul:not([class~="vboxHidden"])').find('table.vboxListItem:first').trigger('click')[0])
- return;
-
- // Try next controller
- $(cur).closest('li.vboxSettingsController').next('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
-
- break;
- }
-
-}).css('outline','none');;
-
-/*
- *
- * Change media attachment helper function
- *
- */
-function vboxSettingsControllerAttach(m) {
-
- var tbl = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected');
- $(tbl).data('attachment').medium = m;
- $(tbl).parent().tipped({'source':vboxSettingsMediumTip(m),'position':'mouse','delay':1000});
-
- // Re-select attachment to update display info
- vboxSettingsSelectAttachment(tbl);
-
-
-}
-
-
-/*
- *
- * Called when controller is selected helper function
- *
- */
-function vboxSettingsSelectController(tbl) {
-
- // Null selection?
- if(!tbl) {
- $('#vboxSettingsController').css('display','none');
- $('#vboxSettingsMediaInfo').css('display','none');
- $('#vboxSettingsStorageAttachment').css('display','none');
- return;
- }
-
- $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
-
- /* set classes for selected / unselected */
- $('#vboxSettingsStorageTree').find('table[class]').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(tbl).removeClass('vboxListItem').addClass('vboxListItemSelected');
-
- /* set name text box value */
- document.forms['frmVboxSettings'].vboxSettingsStorageItemName.value = $(tbl).data('controller').name;
-
- /* Set host cache checkbox */
- document.forms['frmVboxSettings'].vboxSettingsStorageHostCache.checked = $(tbl).data('controller').useHostIOCache ? 'checked' : '';
-
- var busType = $(tbl).data('controller').bus;
-
- /* controller type */
- document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.options.length = 0;
- $(document.forms['frmVboxSettings'].vboxSettingsStorageControllerType).children().remove();
- for(var i = 0; i < vboxStorage[busType].types.length; i++) {
- document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.options[i] = new Option(trans(vboxStorageControllerType(vboxStorage[busType].types[i]),'VBoxGlobal'),vboxStorage[busType].types[i]);
- }
-
- /* Set default type */
- document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.value = $(tbl).data('controller').controllerType;
-
- $('#vboxSettingsController').css('display','block');
- $('#vboxSettingsStorageAttachment').css('display','none');
- $('#vboxSettingsMediaInfo').css('display','none');
- $('#vboxSettingsHDInfo').css('display','none');
-
- // Show SATA port count
- if(busType == 'SATA') {
- $(document.forms['frmVboxSettings'].vboxSettingsControllerPortCount).val($(tbl).data('controller').portCount);
- $('#vboxSettingsControllerPortCountRow').css('display','');
- } else {
- $('#vboxSettingsControllerPortCountRow').css('display','none');
- }
-
- /* Enable / disable buttons */
- if($(tbl).parent().find('ul').children('li').length < ($(tbl).data('controller').maxPortCount * $(tbl).data('controller').maxDevicesPerPortCount)) {
-
- if($('#vboxSettingsDialog').data('vboxFullEdit')) {
- $(tbl).find('.vboxToolbarSmall').trigger('enable', [true]);
- }
-
- } else {
- $(tbl).find('.vboxToolbarSmall').trigger('disable');
- }
-
- /* Trigger Event */
- $('#vboxSettingsStorageTree').trigger('itemselect',tbl);
-
-}
-
-
-/*
- * Generate tooltip for medium helper function
- */
-function vboxSettingsMediumTip(m) {
-
- if(!m || !m.id) return trans('Empty','VBoxGlobal');
- if(m.hostDrive) return vboxMedia.getName(m);
-
- // DVD / Floppy images
- if(m.deviceType != 'HardDisk') {
- return '<b>'+m.location+'</b><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(m)+'</p>';
- }
-
- var mbase = m;
- if(m.base != m.id) {
- mbase = vboxMedia.getMediumById(m.base);
- }
- var tip = '<b>'+mbase.location+'</b><p>'+trans('Type (Format):','UIMachineSettingsStorage')+' '+vboxMedia.getType(mbase)+' ('+mbase.format+')</p><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(mbase)+'</p>';
-
- // Is this a medium that is attached indirectly
- if(vboxSettingsStorageBusses.isAttachedIndirect(m) && m.base != m.id) {
- var p = vboxSettingsStorageBusses.isAttached(m);
- tip += '<hr />'+trans('This base hard disk is indirectly attached using the following differencing hard disk:','VBoxGlobal')+'<br /><b>'+p.location+'</b></p><p>'+trans('Type (Format):','UIMachineSettingsStorage')+' '+vboxMedia.getType(p) + ' (' + p.format + ')'+'</p><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(p)+'</p>';
- } else if(m.readOnly) {
- tip += '<hr />'+trans('Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.','VBoxGlobal');
- }
-
- return tip;
-
-}
-
-/*
- *
- * Add disk medium to bus helper function
- *
- */
-function vboxSettingsStorageAddMedium(conElm, type) {
-
- // get controller name
- var controller = $(conElm).find('span.vboxSettingsControllerTitle').first().text();
-
- if(!type) type = 'HardDisk';
-
- // Find first target slot (vboxSettingsStorageBusses created above)
- var slots = vboxSettingsStorageBusses.availableSlots(conElm);
- var slot = null;
- for(var i in slots) {
- if(typeof i == 'function') continue;
- slot = i;
- break;
- }
- if(slot === null) return;
- slot = slot.split('-');
- var port = slot[0];
- var device = slot[1];
-
- // Add new attachment dialog
- ////////////////////////////
- var buttons = {};
-
- var msg = '';
-
- // Hard Disk buttons
- if (type == 'HardDisk') {
-
- buttons[trans('Create new disk','UIMessageCenter')] = function() {
-
- $.when(new vboxWizardNewHDDialog({'path':vboxDirname($('#vboxSettingsDialog').data('vboxMachineData').settingsFilePath)+$('#vboxPane').data('vboxConfig').DSEP,vmName:$('#vboxSettingsDialog').data('vboxMachineData').name}).run())
- .done(function(id){
- if(!id) return;
- mAttachToolbarHD.mediaMenu.menuUpdateRecent();
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':vboxMedia.getMediumById(id),'ignoreFlush':1}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- });
-
- $(this).remove();
-
- };
- buttons[trans('Choose existing disk','UIMessageCenter')] = function() {
- var dlg = $(this);
- vboxMedia.actions.choose(null,'HardDisk',function(med){
- if(med) {
- mAttachToolbarHD.mediaMenu.menuUpdateRecent();
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med,'ignoreFlush':1}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- }
- $(dlg).remove();
- });
- };
-
- msg = trans('<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>','UIMessageCenter').replace('%1',controller);
-
- // Floppy buttons
- } else if(type == 'Floppy') {
-
- buttons[trans('Choose disk','UIMessageCenter')] = function() {
- var dlg = $(this);
- vboxMedia.actions.choose(null,'Floppy',function(med){
- if(med) {
- mAttachToolbarFD.mediaMenu.menuUpdateRecent();
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- }
- $(dlg).remove();
- });
-
- };
-
- buttons[trans('Leave empty','UIMessageCenter')] = function() {
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':null}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- $(this).remove();
- };
-
- msg = trans('<p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p>','UIMessageCenter').replace('%1',controller);
-
- // CD/DVD buttons
- } else {
-
- buttons[trans('Choose disk','UIMessageCenter')] = function() {
- var dlg = $(this);
- vboxMedia.actions.choose(null,'DVD',function(med){
- if(med) {
- mAttachToolbarCD.mediaMenu.menuUpdateRecent();
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- }
- $(dlg).remove();
- });
-
- };
-
- buttons[trans('Leave empty','UIMessageCenter')] = function() {
- vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':null}, conElm);
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
- $(this).remove();
- };
-
- msg = trans('<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p>','UIMessageCenter').replace('%1',controller);
-
- }
-
- buttons[trans('Cancel','QIMessageBox')] = function() {
- $(this).remove();
- };
- $('<div />').attr({'id':'vboxSettingsStorageUnavailable','style':'display: none'}).html(
- '<div><img src="images/50px-Question_icon.svg.png" style="float: left; padding: 10px; " />'+msg+'</div>'
- ).dialog({'closeOnEscape':false,'width':600,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
-
-
-}
-
-/*
- *
- * Add controller to list helper function
- *
- */
-
-function vboxSettingsAddController(con,list) {
-
- // Elect name if none exists
- if(!con.name) {
- var count = $(list).children('li.vboxSettingsController'+con.bus).length + 1;
- var name = trans(con.bus,'UIMachineSettingsStorage');
- if(count == 1) {
- con.name = name;
- } else {
-
- var electedName = name + ' ' + count;
- var conflictFound = false;
- do {
- conflictFound = false;
- $(list).children('li.vboxSettingsController'+con.bus).each(function(idx,elm) {
- if($(elm).children('table').first().data('controller').name == electedName) {
- conflictFound = true;
- electedName = name + ' ' + (++count);
- return false;
- }
- });
- con.name = electedName;
-
- } while(conflictFound);
- }
-
- }
- var li = $('<li />').attr({'title':con.name,'class':'vboxSettingsController vboxSettingsController' + con.bus});
-
- var tbl = $('<table />').attr({'class':'vboxListItem vboxSettingsController'}).on('click',function(){
- vboxSettingsSelectController(this);
- });
-
- // filter out any dummy medium attachments
- var mas = new Array();
- for(var i = 0; i < con.mediumAttachments.length; i++) {
- if(con.mediumAttachments[i].controller)
- mas[mas.length] = con.mediumAttachments[i];
- }
- con.mediumAttachments = mas;
-
- // Assign data
- $(tbl).data('controller',con);
-
- var tr = $('<tr />');
-
- var iconName = vboxStorage.getBusIconName(con.bus);
- $('<td />').attr({'class':'vboxSettingsStorageTypeIcon vboxSettingsController' + con.bus + 'Expanded'})
- .css({
- 'background-image':'url(images/vbox/'+iconName+'_collapse_16px.png)'
- }).html('<div style="width:22px" />').click(function(){
-
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
-
- var n = $(this).closest('li');
- $(n).children('ul').addClass('vboxHidden').css('display','none');
- $(this).removeClass('vboxSettingsController'+con.bus+'Expanded').addClass('vboxSettingsController'+con.bus)
- .css({'background-image':'url(images/vbox/'+iconName+'_expand_16px.png)'});
-
- } else {
-
- $(this).data('toggleClicked', false);
- var n = $(this).closest('li');
- $(n).children('ul').removeClass('vboxHidden').css('display','');
- $(this).removeClass('vboxSettingsController'+con.bus).addClass('vboxSettingsController'+con.bus+'Expanded')
- .css({'background-image':'url(images/vbox/'+iconName+'_collapse_16px.png)'})
-
- }
-
- return false;
-
- }).appendTo(tr);
-
- // Controller name
- $(tr).append($('<td />').css({'width':'100%'}).html('<div class="vboxFitToContainer">'+trans('Controller: %1','UIMachineSettingsStorage').replace('%1','<span class="vboxSettingsControllerTitle vboxRunningEnabled">'+$('<div/>').text(con.name).html())+"</span>"+"</div>"));
-
- // Buttons
- $(tr).append($('<td />').attr({'style':'width: 22px;','class':'vboxControllerAttachmentButton'}));
-
- $(tbl).append(tr).appendTo(li);
-
-
- /* Attachments list holder */
- $(li).append($('<ul />').attr({'class':'vboxSettingsControllerAttachments'})).dblclick(function(e){
- $(this).children('table.vboxSettingsController').find('td.vboxSettingsStorageTypeIcon').trigger('click',e);
- }).disableSelection().appendTo(list);
-
- /* Generate Toolbars */
- var dtypes = vboxStorage[con.bus].driveTypes;
- for(var i = 0; i < dtypes.length; i++) {
- var b = null;
- if(dtypes[i] == 'dvd') {
- b = {
- 'name' : con.bus+'addcd',
- 'label' : trans('Add Optical Drive','UIMachineSettingsStorage'),
- 'icon' : 'cd_add',
- 'click' : function () { vboxSettingsStorageAddMedium(li,'DVD'); }
- };
- } else if(dtypes[i] == 'disk') {
- b = {
- 'name' : con.bus+'adddrive',
- 'label' : trans('Add Hard Disk','UIMachineSettingsStorage'),
- 'icon' : 'hd_add',
- 'click' : function (item) { vboxSettingsStorageAddMedium(li); }
- };
-
- } else if(dtypes[i] == 'floppy') {
- b = {'label':trans('Add Floppy Drive','UIMachineSettingsStorage'),
- 'icon' : 'fd_add',
- 'click' : function (item) { vboxSettingsStorageAddMedium(li,'Floppy'); }
- };
- }
- b['enabled'] = function() {
-
- return (li.find('li').length < (vboxStorage[con.bus].maxPortCount * vboxStorage[con.bus].maxDevicesPerPortCount));
- };
-
- var tb = new vboxToolbarSmall({buttons: [b],
- buttonStyle: 'margin:0px;padding:0px;border:0px;background-repeat:no-repeat;background-position:0px 0px;',
- noHover: true,
- renderTo: li.find('td.vboxControllerAttachmentButton')});
- tb.disable();
-
- }
-
- // Only if machine is not running
- if($('#vboxSettingsDialog').data('vboxFullEdit')) {
-
- $(li).contextMenu({menu: vboxStorageAttachmentMenus[con.bus].menuId(),
- menusetup: function() {$(li).children('table').first().trigger('click')}},
- vboxStorageAttachmentMenus[con.bus].menuClickCallback
- );
-
- }
-
- // Return controller element list item
- return li;
-
-}
-
-
-
-
-
-/*
- *
- * Add a medium attachment to a controller helper function
- *
- */
-function vboxSettingsAddAttachment(d,conElm) {
-
-
- var con = (conElm ? conElm : $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent());
-
- // Save bus
- d.bus = $(con).find('table.vboxSettingsController').data('controller').bus;
-
- // remove any 'last' classes
- $(con).children('ul').children().removeClass('last');
-
- var li = $('<li />').attr({'class':'last vboxSettingsMediumAttachment'});
-
-
- var tbl = $('<table />').attr({'class':'vboxListItem vboxSettingsStorageAttachment'})
- .data({'attachment':d}).on('click',function(){
- vboxSettingsSelectAttachment(this);
- });
-
- var m = vboxMedia.getMediumById(((d.medium && d.medium.id) ? d.medium.id : null));
-
- var tr = $('<tr />');
-
- // Storage type icon
- $(tr).append($('<td />').attr({'class':'vboxSettingsStorageTypeIcon vboxSettingsMediaType' + d.type,'style':'width:22px'}).html('<img src="images/vbox/blank.gif" style="width:22px" />'));
-
- // Medium name
- $(tr).append($('<td />').css({'width':'100%'}).append($('<div />').attr({'class':'vboxSettingsStorageMediumName vboxFitToContainer'}).html(vboxMedia.getName(vboxMedia.getMediumById((m && m.base ? m.base : (m && m.id ? m.id : null)))))));
-
-
- $(tbl).append(tr).appendTo(li);
-
- // Only if not running
- if($('#vboxSettingsDialog').data('vboxFullEdit')) {
-
- $(li).contextMenu({
- menu: vboxSettingsMAMenu.menuId(),
- menusetup : function(el) {
- vboxSettingsSelectAttachment($(el).find('table.vboxSettingsStorageAttachment'));
- }
- },
- function(action, el, pos) {
- vboxSettingsStorageButtons[1].click();
- }
- );
- }
-
- $(li).tipped({'source':vboxSettingsMediumTip(m),'position':'mouse','delay':1000}).appendTo(con.children('ul'));
-
-
-}
-
-/*
- *
- * Called when selecting a medium attachment
- *
- */
-function vboxSettingsSelectAttachment(tbl) {
-
- // Null selection?
- if(!tbl) {
- $('#vboxSettingsController').css('display','none');
- $('#vboxSettingsMediaInfo').css('display','none');
- $('#vboxSettingsStorageAttachment').css('display','none');
- return;
- }
-
- $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
-
- /* Display Changes */
- if(!$(tbl).hasClass('vboxListItemSelected')) {
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
- $(tbl).removeClass('vboxListItem').addClass('vboxListItemSelected');
- }
-
- $('#vboxSettingsController').css('display','none');
- $('#vboxSettingsMediaInfo').css('display','block');
- $('#vboxSettingsStorageAttachment').css('display','block');
-
-
- var ma = $(tbl).data('attachment');
-
- /* Get / Set Medium */
- if(ma.medium && ma.medium.id)
- ma.medium = vboxMedia.getMediumById(ma.medium.id);
-
- (function(){
-
- var sc = $(tbl).closest('li.vboxSettingsController').children('table').first().data('controller');
-
- var tblSA = $('#vboxSettingsStorageAttachment').find('table').first();
- $(tblSA).find('tr.vboxSettingsControllerDeviceOptionRow').empty().remove();
-
- switch(ma.type) {
-
- case 'HardDisk':
- label = 'Hard Disk:';
- break;
- case 'DVD':
- label = 'CD/DVD Drive:';
- break;
- case 'Floppy':
- label = 'Floppy Drive:';
- break;
- }
- var maOptions = vboxStorage.getMAOptions(ma)
- .concat(vboxStorage.getMAOptionsForSC(sc));
- for(var i = 0; i < maOptions.length; i++) {
-
- var opt = maOptions[i];
-
- var cbox = $('<input />').attr('type','checkbox').prop('checked', ma[opt.attrib] ? true : false)
- .on('click', {attrib: opt.attrib}, function(event){
-
- var attachment = $(tbl).data('attachment');
- attachment[event.data.attrib] = this.checked ? true : false;
- $(tbl).data('attachment', attachment);
-
- }).addClass('vboxCheckbox');
-
- $('<tr />').addClass('vboxSettingsControllerDeviceOptionRow')
- .append($('<th />'))
- .append(
- $('<td />')
- .append($('<label />')
- .append(cbox)
- .append($('<span />').css({'margin-left':'4px'}).text(opt.label))
- )
- ).appendTo($(tblSA));
-
-
- }
- })();
- $('#vboxSettingsControllerSlotLabel').html(trans(label,'UIMachineSettingsStorage'));
-
-
- /* Show / Hide HD/Media Info */
- $('#vboxSettingsImageInfo').css('display',(ma.type == 'HardDisk' ? 'none' : 'block'));
- $('#vboxSettingsHDInfo').css('display',(ma.type == 'HardDisk' ? 'block' : 'none'));
-
-
-
- /* Populate slot select box */
- document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options.length = 0;
- $(document.forms['frmVboxSettings'].vboxSettingsControllerSlot).children().remove();
- slots = vboxSettingsStorageBusses.availableSlots($(tbl).parent().parent().parent(), ma.port+'-'+ma.device);
-
- for(var s in slots) {
- var opt = new Option(slots[s], s);
- document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options[document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options.length] = opt;
- }
- document.forms['frmVboxSettings'].vboxSettingsControllerSlot.value = ma.port+'-'+ma.device;
-
- /* Trigger Event */
- $('#vboxSettingsStorageTree').trigger('itemselect',tbl);
-
- var m = ma.medium;
- var name = vboxMedia.getName(m);
-
- // Read-only medium selected
- if(ma.medium && ma.medium.readOnly) {
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('td').first().addClass('vboxMediumReadOnly');
- } else {
- $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('td').first().removeClass('vboxMediumReadOnly');
- }
-
- // Show medium info
- if(m && m.deviceType == 'HardDisk') {
-
- var disp = vboxMedia.getMediumById(m.base);
- name = vboxMedia.getName(disp);
-
- var encSettings = vboxMedia.getEncryptionSettings(disp);
-
- $('#vboxSettingsHDvsize').html(vboxMbytesConvert(disp.logicalSize));
- $('#vboxSettingsHDasize').html(vboxBytesConvert(disp.size));
- $('#vboxSettingsHDDetails').html(vboxMedia.getHardDiskVariant(disp));
- $('#vboxSettingsHDlocation').html(disp.location);
- $('#vboxSettingsHDtype').html(trans(disp.type,'VBoxGlobal') + ' (' + disp.format + ')');
- $('#vboxSettingsHDattached').html(vboxMedia.attachedTo(disp));
- $('#vboxSettingsHDEncrypted').html(encSettings && encSettings.id ? encSettings.id : '--');
-
-
- } else {
-
- $('#vboxSettingsImageType').html(m ? trans((m.hostDrive ? 'Host Drive' : 'Image'),'UIMachineSettingsStorage'): '--');
- $('#vboxSettingsImageSize').html((m && !m.hostDrive ? vboxBytesConvert(m.size):'--'));
- $('#vboxSettingsImageLocation').html((m && !m.hostDrive ? m.location:'--'));
- $('#vboxSettingsImageAttached').html((m && !m.hostDrive ? vboxMedia.attachedTo(m) :'--'));
-
- }
-
- $(tbl).data('attachment').medium = m;
- $(tbl).find('div.vboxSettingsStorageMediumName').first().html($('<div />').text(name).html());
-
-
-}
-
-
-/*
- * Focus storage controller list when showing this pane
- */
-$('#vboxSettingsStorageTableWrapper').on('show',function(){
- $('#vboxSettingsStorageTree').focus();
-});
-
-/*
- *
- *
- * Storage pane resize and draggable resize bar logic
- *
- *
- */
-/*
- * Resize storage pane
- */
-function vboxSettingsStorageResize() {
-
- // Hide storage tree
- $('#vboxSettingsStorageTree').css({'display':'none'});
-
- // Get and set size
- $('#vboxStoragePaneLeft').css({'display':'none'});
- $('#vboxStoragePaneRight').css({'display':'none'});
-
- // Main table height
- $('#vboxSettingsStorageTableWrapper').css({'display':'none'});
- var h = $('#vboxSettingsStorageTableWrapper').css({'display':'none'}).parent().parent().innerHeight()-4;
-
- // IE needs to account for bordering
- if($.browser.msie) h-= 4;
-
- // Set height
- $('#vboxSettingsStorageTableWrapper').css({'display':''}).height(h);
-
- // Pane width
- var bothWidth = ($('#vboxStoragePaneLeft').parent().innerWidth() + $('#vboxStoragePaneRight').parent().innerWidth() - 24) / 2;
- $('#vboxStoragePaneLeft').css({'width':bothWidth+'px','display':''}).parent().css({'width':'auto','padding':'6px'});
- $('#vboxStoragePaneRight').css({'width':bothWidth+'px','display':''}).parent().css({'width':'auto','padding':'6px'});
-
- // Unsnap.. sorry..
- $('#vboxStorageResizeBar').data('vboxSnapped',0);
-
- // Get inner height of storage tree parent - padding
- var h = $('#vboxStoragePaneLeft').parent().innerHeight() - 24;
- // subtract sibling heights
- $('#vboxSettingsStorageTree').siblings().each(function(){
- h -= $(this).outerHeight(true);
- });
-
- $('#vboxSettingsStorageTree').height(h).css({'display':''});
-
- vboxStorageResizeTreeItemLabels();
-
-}
-
-/*
- * Resize controller labels
- */
-function vboxStorageResizeTreeItemLabels() {
-
- $('#vboxSettingsStorageTree div.vboxFitToContainer').each(function(){
- $(this).css({'display':'none'});
- var w = $(this).parent().innerWidth() - 2;
- $(this).css({'width':w+'px','display':''});
- });
-
-
-};
-
-/*
- * Set pane sizes and resize bar
- */
-$('#vboxSettingsStorageTableWrapper').one('show',function(){
-
-
- // Resize everything on dialog resize
- $('#vboxSettingsDialog').on('dialogresizestop',function(){
- vboxSettingsStorageResize();
- });
- $('#vboxSettingsStorageTableWrapper').on('show',function(){
- vboxSettingsStorageResize();
- });
-
- // Hide children to get true size
- $('#vboxStoragePaneLeft').children().css({'display':'none'});
- $('#vboxStoragePaneRight').children().css({'display':'none'});
-
- var h = $('#vboxSettingsStorageTableWrapper').parent().css({'padding':'0px','margin':'0px'}).parent().innerHeight();
-
- // IE needs to account for bordering
- if($.browser.msie) h-= 4;
-
- $('#vboxSettingsStorageTableWrapper').height(h-4);
-
- // Get and set size
- var bothWidth = ($('#vboxStoragePaneLeft').parent().innerWidth() + $('#vboxStoragePaneRight').parent().innerWidth() - 24) / 2;
- $('#vboxStoragePaneLeft').css({'width':bothWidth+'px','overflow':'hidden'}).parent().css({'width':'auto'});
- $('#vboxStoragePaneRight').css({'width':bothWidth+'px','overflow':'hidden'}).parent().css({'width':'auto'});
-
- // Show children again
- $('#vboxStoragePaneLeft').children().css({'display':''});
- $('#vboxStoragePaneRight').children().css({'display':''});
-
- // Re-trigger list selection to show correct info
- if(!$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click().hasClass('vboxListItemSelected'))
- $('#vboxSettingsStorageTree').trigger('itemselect',null);
-
- // Don't allow selection of text in storage tree. This looks funny when dragging the resize bar
- $('#vboxSettingsStorageTree').disableSelection();
-
- // Resize
- vboxSettingsStorageResize();
-
- // Draggable resize bar
- $('#vboxStorageResizeBar').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
-
- return $('<span />'); // dummy element
-
- },scroll:false,'start':function(e,ui){
-
- $('#vboxStorageResizeBar').data('vboxX',e.pageX);
-
- $('#vboxResizeOverlay').remove();
- $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
- $('#vboxSettingsDialog').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:99%;height:99%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
-
-
- },'drag':function(e){
-
- var sStart = $('#vboxStorageResizeBar').data('vboxX');
- var sStop = e.pageX;
- var sWidth = Math.abs(sStop - sStart);
- if(sWidth == 0) return;
-
- var lWidth = parseInt($('#vboxStoragePaneLeft').css('width'));
- var rWidth = parseInt($('#vboxStoragePaneRight').css('width'));
-
- var snapped = $('#vboxStorageResizeBar').data('vboxSnapped');
-
- // Left to right
- if(sStop > sStart) {
-
- // Check for snapping
- if(snapped) {
- if(snapped > sStop || (rWidth - sWidth < 150)) { return; }
- else if(snapped && snapped <= sStop) {
-
- // Unsnap left pane
- $('#vboxStoragePaneRight').parent().css({'width':'auto'});
- $('#vboxStoragePaneLeft').css({'display':''}).parent().css({'padding':'6px'});
- $('#vboxStorageResizeBar').data('vboxSnapped',0);
- lWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthL');
- rWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthR');
- sWidth = Math.abs(sStop - snapped);
- }
- }
-
- if(rWidth - sWidth < 150) {
-
- $('#vboxStoragePaneLeft').css({'width':'100%'}).parent().css({'width':'100%'});
- $('#vboxStoragePaneRight').css({'display':'none','width':'10px'}).parent().css({'padding':'0px'});
- $('#vboxStorageResizeBar').data('vboxSnapped',e.pageX);
- $('#vboxStorageResizeBar').data('vboxSnappedWidthL', (lWidth + sWidth));
- $('#vboxStorageResizeBar').data('vboxSnappedWidthR', (rWidth - sWidth));
-
- } else {
- $('#vboxStoragePaneLeft').css({'width':(lWidth + sWidth)+'px','display':''});
- $('#vboxStoragePaneRight').css({'width':(rWidth - sWidth)+'px','display':''});
- }
-
-
- // Right to left
- } else {
-
- // Check for snapping
- if(snapped) {
- if(snapped < sStop || (lWidth - sWidth < 150)) { return; }
- else if(snapped && snapped >= sStop) {
-
- // Unsnap right pane
- $('#vboxStoragePaneLeft').parent().css({'width':'auto'});
- $('#vboxStoragePaneRight').css({'display':''}).parent().css({'width':'100%','padding':'6px'}); // 100% to fix webkit
- $('#vboxStorageResizeBar').data('vboxSnapped',0);
- lWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthL');
- rWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthR');
- sWidth = Math.abs(sStop-snapped);
-
- }
- }
-
- if(lWidth - sWidth < 150) {
-
- $('#vboxStoragePaneRight').css({'width':'100%'}).parent().css({'width':'100%'});
- $('#vboxStoragePaneLeft').css({'display':'none','width':'10px'}).parent().css({'padding':'0px'});
- $('#vboxStorageResizeBar').data('vboxSnapped',e.pageX);
- $('#vboxStorageResizeBar').data('vboxSnappedWidthL', (lWidth - sWidth));
- $('#vboxStorageResizeBar').data('vboxSnappedWidthR', (rWidth + sWidth));
-
- } else {
- $('#vboxStoragePaneLeft').css({'width':(lWidth - sWidth)+'px'});
- $('#vboxStoragePaneRight').css({'width':(rWidth + sWidth)+'px'});
- }
- }
-
- $('#vboxStorageResizeBar').data('vboxX',e.pageX);
-
- // resize labels
- vboxStorageResizeTreeItemLabels();
-
-
- },'stop':function(e) {
-
- // resize labels
- vboxStorageResizeTreeItemLabels();
-
- $('body').enableSelection().css({'cursor':'default'});
- $('#vboxResizeOverlay').remove();
- }}).css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize'),'height':'98%'});
-
-
-});
-
+<!--
+
+ VM Storage Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsStorage.html 599 2015-07-27 10:40:37Z imoore76 $
+
+-->
+<table style='width: 100%;' id='vboxSettingsStorageTableWrapper'>
+ <tr style='height: 100%'>
+ <td width='50%' style='padding: 6px;'>
+ <div id='vboxStoragePaneLeft'>
+ <table class='vboxSettingsHeadingLine'
+ style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
+ <tr style='vertical-align: middle'>
+ <td style='white-space: nowrap; width: auto;'><span
+ class='translate vboxRunningEnabled'>Storage Tree</span></td>
+ <td style='width: 100%'>
+ <hr style='width: 100%;' class='vboxSeparatorLine'/>
+ </td>
+ </tr>
+ </table>
+
+
+ <!-- Storage Controllers -->
+ <div id='vboxSettingsStorageTree' style='height: 290px; outline: none;' class='vboxBordered' tabindex='0'>
+ <ul class='vboxHover vboxHoverBorderless'>
+ <li>Storage Thingy</li>
+ <li>
+ <ul>
+ <li>Attachment Thingy</li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+
+ <!-- Controller Toolbar -->
+ <div id='vboxSettingsControllersButtons' style='text-align: right'></div>
+
+
+ </div>
+ </td>
+
+ <!-- Resize Bar -->
+ <td style='height: 100%; width:3px; padding:0px; margin:0px;'>
+ <div style='margin:0px; margin-top: 2px; padding:0px; width: 3px; height: 99%; background:#aaa;' id='vboxStorageResizeBar' ></div>
+ </td>
+
+ <td width='50%' style='padding: 6px;'>
+ <div id='vboxStoragePaneRight'>
+ <table class='vboxSettingsHeadingLine'
+ style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
+ <tr style='vertical-align: middle'>
+ <td style='white-space: nowrap; width: auto;'><span
+ class='translate vboxRunningEnabled'>Attributes</span></td>
+ <td style='width: 100%; white-space: nowrap;'><hr style='width: 100%;' class='vboxSeparatorLine'/></td>
+ </tr>
+ </table>
+
+
+ <!-- Controller Settings -->
+ <div id='vboxSettingsController' style='width: 100%; display: none;'>
+ <table style='width: 100%' class='vboxVertical'>
+ <tr>
+ <th><span class='translate'>Name:</span></th>
+ <td style='width: 100%'><input type='text' class='vboxText'
+ name='vboxSettingsStorageItemName' style='width: 99%' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Type:</span></th>
+ <td><select name='vboxSettingsStorageControllerType'
+ style='width: 100%'>
+ <option value='ICH6'>ICH6</option>
+ </select></td>
+ </tr>
+ <tr id='vboxSettingsControllerPortCountRow' style='display: none'>
+ <th><span class='translate'>Port Count:</span></th>
+ <td>
+ <select name='vboxSettingsControllerPortCount'>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th></th>
+ <td style='width: 100%'>
+ <label><input type='checkbox' class='vboxCheckbox'
+ name='vboxSettingsStorageHostCache'/> <span class='translate'>Use Host I/O Cache</span></label></td>
+ </tr>
+ </table>
+ </div>
+
+ <!-- Attachment Settings -->
+ <div id='vboxSettingsStorageAttachment' style='display: none'>
+ <table class='vboxVertical'>
+ <tr style='vertical-align: middle;'>
+ <th><span class='translate vboxRunningEnabled' id='vboxSettingsControllerSlotLabel'>HardDisk</span></th>
+ <td style='width: 100%'>
+ <table class='vboxInvisible' style='width: 100%'>
+ <tr style='vertical-align: middle'>
+ <td style='width: 100%'>
+ <select name='vboxSettingsControllerSlot' style='width: 100%'></select>
+ </td>
+ <td>
+ <div id='vboxSettingsAddAttachmentsMenuHDDiv' style='display: none'></div>
+ <div id='vboxSettingsAddAttachmentsMenuFDDiv' style='display: none'></div>
+ <div id='vboxSettingsAddAttachmentsMenuCDDiv' style='display: none'></div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <!-- Selected Media Info -->
+ <div id='vboxSettingsMediaInfo' style='display: none'>
+ <table class='vboxSettingsHeadingLine'
+ style='width: 100%; border-spacing: 0; border: 0px; margin: 0px; padding: 0px;'>
+ <tr style='vertical-align: middle'>
+ <td style='white-space: nowrap; width: auto;'><span
+ class='translate vboxRunningEnabled'>Information</span></td>
+ <td style='width: 100%'>
+ <hr style='width: 100%; ' class='vboxSeparatorLine'/>
+ </td>
+ </tr>
+ </table>
+
+
+ <!-- HardDisk Media -->
+ <div id='vboxSettingsHDInfo'>
+ <table class='vboxVertical'>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Type (Format):</span></th>
+ <td><span id='vboxSettingsHDtype' class='vboxRunningEnabled'>Image</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Virtual Size:</span></th>
+ <td><span id='vboxSettingsHDvsize' class='vboxRunningEnabled'>30 GB</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Actual Size:</span></th>
+ <td><span id='vboxSettingsHDasize' class='vboxRunningEnabled'>30 GB</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Details:</span></th>
+ <td><span id='vboxSettingsHDDetails' class='vboxRunningEnabled'>Dynamic</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Location:</span></th>
+ <td><span id='vboxSettingsHDlocation' class='vboxRunningEnabled'>/usr/local/blah/etc..</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Attached to:</span></th>
+ <td><span id='vboxSettingsHDattached' class='vboxRunningEnabled'>Some Virtual
+ Machine Name</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Encrypted with key:</span></th>
+ <td><span id='vboxSettingsHDEncrypted' class='vboxRunningEnabled'>--</span></td>
+ </tr>
+ </table>
+ </div>
+
+ <!-- DVD/CD Media and Floppy -->
+ <div id='vboxSettingsImageInfo'>
+ <table class='vboxVertical'>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Type:</span></th>
+ <td><span id='vboxSettingsImageType' class='vboxRunningEnabled'>Image</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Size:</span></th>
+ <td><span id='vboxSettingsImageSize' class='vboxRunningEnabled'>30 GB</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Location:</span></th>
+ <td><span id='vboxSettingsImageLocation' class='vboxRunningEnabled'>/usr/local/blah/etc..</span></td>
+ </tr>
+ <tr>
+ <th><span class='translate vboxRunningEnabled'>Attached to:</span></th>
+ <td><span id='vboxSettingsImageAttached' class='vboxRunningEnabled'>Some Virtual
+ Machine Name</span></td>
+ </tr>
+ </table>
+ </div>
+
+ </div>
+ </div>
+ </td>
+ </tr>
+</table>
+<script type='text/javascript'>
+
+ /*
+ *
+ * Storage controller helper object
+ *
+ *
+ */
+ var vboxSettingsStorageObj = function() {
+
+ this.busTypes = vboxStorage.getBusTypes();
+
+ this.attachedDirectMedia = {};
+ this.attachedIndirectMedia = {};
+
+ /* Return slots available on controller, including incl (device currently on slot) */
+ this.availableSlots = function(conElm,incl) {
+
+ var bus = $(conElm).children('table').first().data('controller').bus;
+ var slots = vboxStorage[bus].slots();
+
+ var atts = $(conElm).find('table.vboxSettingsStorageAttachment');
+
+ for(var i = 0; i < atts.length; i++) {
+ slot = $(atts[i]).data('attachment').port+'-'+$(atts[i]).data('attachment').device;
+ if(incl && (incl == slot)) continue;
+ delete slots[slot];
+ }
+ return slots;
+ };
+
+ this.addAttached = function(m) {
+ if(!m || !m.id) return;
+ var medium = vboxMedia.getMediumById(m.id);
+
+ // SafeGuard
+ if(!medium) {
+ alert('A medium listed as attached to this machine was not found in the media registry. phpVirtualBox will now reload.');
+ location.reload(true);
+ }
+
+ this.attachedDirectMedia[medium.id] = medium;
+ if(medium.base) {
+ this.attachedIndirectMedia[medium.base] = medium;
+ }
+ };
+
+ this.isAttached = function(m,directOnly) {
+ if(!m || !m.id) return false;
+ if(this.attachedDirectMedia[m.id]) return this.attachedDirectMedia[m.id];
+ if(!directOnly) {
+ return (m.base ? this.attachedIndirectMedia[m.base] : null);
+ }
+ return false;
+ };
+
+ this.isAttachedDirect = function(m) { return this.attachedDirectMedia[m.id]; };
+ this.isAttachedIndirect = function(m) { return (m.base ? this.attachedIndirectMedia[m.base] : null); };
+ };
+
+ /*
+ *
+ *
+ * Initialization logic
+ *
+ *
+ */
+
+ /* Storage Obj */
+ var vboxSettingsStorageBusses = new vboxSettingsStorageObj(); // defined below
+
+ /* Setup SATA port count */
+ var sel = document.forms['frmVboxSettings'].vboxSettingsControllerPortCount;
+ for(var i = 1; i <= vboxStorage.SATA.maxPortCount; i++) {
+ sel.options[sel.options.length] = new Option(i,i);
+ }
+ $(sel).change(function(){
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').portCount = $(this).val();
+ });
+
+
+
+ /* Pre-load storage images */
+var imgs = new Array();
+for(var i=0;i<vboxSettingsStorageBusses.busTypes.length;i++){
+ var imgName = vboxStorage.getBusIconName(vboxSettingsStorageBusses.busTypes[i]);
+ imgs[i] = new Array();
+ imgs[i][0] = new Image();
+ imgs[i][0].src = 'images/vbox/'+imgName+'_expand_16px.png';
+ imgs[i][1] = new Image();
+ imgs[i][1].src = 'images/vbox/'+imgName+'_collapse_16px.png';
+ imgs[i][2] = new Image();
+ imgs[i][2].src = 'images/vbox/'+imgName+'_add_16px.png';
+ imgs[i][3] = new Image();
+ imgs[i][3].src = 'images/vbox/'+imgName+'_add_disabled_16px.png';
+}
+
+var imgs2 = new Array();
+var imgsToLoad = ['fd','hd','cd'];
+for(var i=0;i<imgsToLoad.length;i++){
+ imgs2[i] = new Image();
+ imgs2[i].src = 'images/vbox/'+imgsToLoad[i]+'_16px.png';
+}
+
+/*
+ *
+ * Init Storage Controller menus and toolbar
+ *
+ */
+
+ /* Menu for adding controllers */
+ var vboxSettingsCMenu = new vboxMenu({id: 'vboxSettingsAddControllerMenu',
+ language_context: 'UIMachineSettingsStorage'});
+ var vboxSettingsCMenuItems = [];
+ var bustypes = vboxStorage.getBusTypes();
+ for(var i = 0; i < bustypes.length; i++) {
+ var bt = bustypes[i];
+ var icon = vboxStorage.getBusIconName(bt);
+ vboxSettingsCMenuItems[vboxSettingsCMenuItems.length] = {'name':'add'+bt,'icon':icon+"_add",'label':'Add '+bt+' Controller'};
+ }
+ vboxSettingsCMenu.addMenu(vboxSettingsCMenuItems);
+
+
+ /* Storage tree context menu to add controllers */
+ $('#vboxSettingsStorageTree').contextMenu({
+ menu: vboxSettingsCMenu.menuId()
+ },
+ function(action, el, pos) {
+
+ var bus = action.substring(3);
+ var c = {'bus':bus,'mediumAttachments':[],'controllerType':vboxStorage[bus].types[0],'useHostIOCache':1,
+ 'maxPortCount':vboxStorage[bus]['maxPortCount'],'maxDevicesPerPortCount':vboxStorage[bus]['maxDevicesPerPortCount']};
+
+
+ vboxSettingsAddController(c, $('#vboxSettingsStorageTree').children('ul').first());
+
+ $('#vboxSettingsStorageTree').trigger('itemselect',$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first());
+ }
+ );
+
+ /* Storage tree tool bar */
+ var vboxSettingsStorageButtons = new Array(
+ {
+ /* Add Attachment Button */
+ 'name' : 'addattach',
+ 'label' : 'Add Attachment',
+ 'icon' : 'attachment_add',
+ 'enabled' : function (item) {
+
+ if(!$(item).data('controller')) return false;
+
+ // Determine how max and how many are used
+ if(!($(item).data('controller').maxPortCount && ($(item).parent().find('ul').children('li').length < ($(item).data('controller').maxPortCount * $(item).data('controller').maxDevicesPerPortCount))))
+ return false;
+
+ // Enable / Disable CD/DVD menu
+ var c = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
+ if(jQuery.inArray('dvd', vboxStorage[$(c).data('controller').bus].driveTypes) > -1) {
+ scToolbar.getButtonElement("addattach").data('busType',$(c).data('controller').bus);
+ scToolbar.getButtonElement("addattach").enableContextMenu();
+ } else {
+ scToolbar.getButtonElement("addattach").disableContextMenu();
+ }
+ return true;
+
+ },
+ 'click' : function (item) {
+ // Let context menu handle IDE and Sata
+ var c = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
+ if(vboxStorage[$(c).data('controller').bus].driveTypes.length > 1) {
+ return;
+ }
+ vboxSettingsStorageAddMedium($(c).parent(),($(c).data('controller').bus == 'Floppy' ? 'Floppy' : 'HardDisk'));
+ }
+ },
+
+ {
+ /* Remove Attachment Button */
+ 'name' : 'removeattach',
+ 'label' : 'Remove Attachment',
+ 'icon' : 'attachment_remove',
+ 'enabled' : function (item) { return (item && $(item).data('attachment')); },
+ 'click' : function () {
+
+ // Set previous item to last?
+ var cur = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent();
+
+ if($(cur).hasClass('last')) {
+ $(cur).prev().addClass('last');
+ }
+
+ var next = $(cur).next().find('table.vboxListItem').first();
+ if(!$(next).html()) {
+ var con = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller');
+ if(con) next = $('#vboxSettingsController'+con.bus).find('table.vboxListItem').first();
+ }
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().remove();
+ if(!$(next).trigger('click').html()) $('#vboxSettingsStorageTree').trigger('itemselect',null);
+ }
+ },
+
+ {
+ /* Add Controller Button */
+ 'name' : 'addcontroller',
+ 'label' : 'Add Controller',
+ 'icon' : 'controller_add',
+ 'enabled' : function (item) {
+
+ // Draw menu items
+ var cons = $('#vboxSettingsStorageTree').find('table.vboxSettingsController');
+ var avail = vboxStorage.getBusTypes();
+ var used = {};
+ for(var i = 0; i < avail.length; i++) {
+ used[avail[i]] = false;
+ }
+
+ for(var i = 0; i < cons.length; i++) {
+ used[$(cons[i]).data('controller').bus] = true;
+ }
+
+ var oneEnabled = false;
+ for(var i in used) {
+
+ if(used[i]) { // && vboxStorage[i].limitOneInstance) {
+ vboxSettingsCMenu.disableItem('add'+i);
+ } else {
+ vboxSettingsCMenu.enableItem('add'+i);
+ oneEnabled = true;
+ }
+ }
+
+ // If at least one item is enabled
+ return oneEnabled;
+
+
+ },
+ 'click' : function (item) { return true; }
+ },
+
+ {
+ /* Remove Controller Button */
+ 'name' : 'removecontroller',
+ 'label' : 'Remove Controller',
+ 'icon' : 'controller_remove',
+ 'enabled' : function (item) { if(item && $(item).data('controller')) return true; },
+ 'click' : function () {
+ var next = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().next().find('table.vboxListItem').first();
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().remove();
+ if(!$(next).html()) {next = $('#vboxSettingsStorageTree').find('table.vboxListItem').first();}
+ if(!$(next).trigger('click').html()) $('#vboxSettingsStorageTree').trigger('itemselect',null);
+ }
+ }
+
+
+
+ );
+var scToolbar = new vboxToolbarSmall({buttons: vboxSettingsStorageButtons,
+ language_context: 'UIMachineSettingsStorage', renderTo: 'vboxSettingsControllersButtons'});
+
+
+/* Add controller button menu initialization */
+scToolbar.getButtonElement("addcontroller").contextMenu({
+ menu: vboxSettingsCMenu.menuId(),
+ mode:'menu',
+ button: 0
+ },
+ function(action, el, pos) {
+
+ var bus = action.substring(3);
+ var c = {'bus':bus,'mediumAttachments':[],'controllerType':vboxStorage[bus].types[0],'useHostIOCache':1,
+ 'maxPortCount':vboxStorage[bus]['maxPortCount'],'maxDevicesPerPortCount':vboxStorage[bus]['maxDevicesPerPortCount']};
+
+ vboxSettingsAddController(c, $('#vboxSettingsStorageTree').children('ul').first());
+
+ $('#vboxSettingsStorageTree').trigger('itemselect',$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first());
+ }
+ );
+
+/* Menu for adding attachment */
+var mAttachMenu = new vboxMenu({id: 'vboxSettingsAddAttachmentsMenu',
+ language_context: 'UIMachineSettingsStorage',
+ menuItems: [{name: 'addCD', icon: 'cd_add', label: 'Add Optical Drive'},
+ {name: 'addHD', icon: 'hd_add', label: 'Add Hard Disk'}]});
+
+
+ /* Add attachment button menu initialization */
+scToolbar.getButtonElement("addattach").contextMenu({
+ menu: mAttachMenu.menuId(),
+ mode:'menu',
+ button: 0
+ },
+ function(action, el, pos) {
+ vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),(action == 'addCD' ? 'DVD' : 'HardDisk'));
+ }
+ );
+
+
+
+$('#vboxSettingsStorageTree').on('itemselect',function(e,el) {scToolbar.update(el); });
+
+
+/* Medium attachment context menu */
+var vboxSettingsMAMenu = new vboxMenu({'name':'vboxSettingsMAMenuL',
+ 'menuItems': [vboxSettingsStorageButtons[1]],
+ 'language_context': 'UIMachineSettingsStorage'});
+
+/*
+ * Medium menu buttons
+ */
+var mAttachToolbarHD = new vboxButtonMediaMenu('HardDisk',vboxSettingsControllerAttach);
+mAttachToolbarHD.renderTo('vboxSettingsAddAttachmentsMenuHDDiv');
+
+var mAttachToolbarCD = new vboxButtonMediaMenu('DVD',vboxSettingsControllerAttach);
+mAttachToolbarCD.renderTo('vboxSettingsAddAttachmentsMenuCDDiv');
+
+var mAttachToolbarFD = new vboxButtonMediaMenu('Floppy',vboxSettingsControllerAttach);
+mAttachToolbarFD.renderTo('vboxSettingsAddAttachmentsMenuFDDiv');
+
+/*
+ * Controller actions and menus for each bus type
+ */
+var vboxStorageBusTypes = vboxStorage.getBusTypes();
+var vboxStorageAttachmentMenus = new Array();
+for(var i = 0; i < vboxStorageBusTypes.length; i++) {
+ var btype = vboxStorageBusTypes[i];
+ var menuItems = [];
+ for(var a = 0; a < vboxStorage[btype].driveTypes.length; a++) {
+ switch(vboxStorage[btype].driveTypes[a]) {
+ case 'dvd':
+ b = {
+ 'name' : btype+'addcd',
+ 'label' : 'Add Optical Drive',
+ 'icon' : 'cd_add',
+ 'click' : function () {
+ vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),'DVD');
+ }
+ };
+ break;
+ case 'disk':
+ b = {
+ 'name' : btype+'adddrive',
+ 'label' : 'Add Hard Disk',
+ 'icon' : 'hd_add',
+ 'click' : function (item) {
+ vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent());
+ }
+ };
+ break;
+ case 'floppy':
+ b = {
+ 'name' : btype + 'addfloppy',
+ 'label':trans('Add Floppy Drive','UIMachineSettingsStorage'),
+ 'icon' : 'fd_add',
+ 'click' : function (item) {
+ vboxSettingsStorageAddMedium($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent(),'Floppy'); }
+ };
+ break;
+ }
+ b['enabled'] = function(a) {
+ return ($('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent().find('li').length < (vboxStorage[a].maxPortCount * vboxStorage[a].maxDevicesPerPortCount));
+ };
+ menuItems[menuItems.length] = b;
+ }
+
+ // Add seperator and "remove controller"
+ menuItems[menuItems.length] = $.extend(true, {}, vboxSettingsStorageButtons[3]); // "Remove"
+ menuItems[(menuItems.length-1)].separator = true;
+ menuItems[(menuItems.length-1)].enabled = null; // always enabled
+
+ vboxStorageAttachmentMenus[btype] = new vboxMenu({name: 'vboxSettingsController'+btype+'AttachmentsMenu',
+ language_context: 'UIMachineSettingsStorage',
+ 'menuItems': menuItems});
+
+}
+
+$('#vboxSettingsStorageTree').on('itemselect',function(e,item){
+ for(var i = 0; i < vboxStorageBusTypes.length; i++)
+ vboxStorageAttachmentMenus[vboxStorageBusTypes[i]].update(vboxStorageBusTypes[i]);
+});
+/*
+ *
+ * Form helper functions that listen for form change events
+ *
+ *
+ */
+
+/*
+ * Changing the slot changes the object
+ */
+document.forms['frmVboxSettings'].vboxSettingsControllerSlot.onchange = function(){
+
+ // change port / device
+ var pd = this.value.split('-');
+ var attachment = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first();
+ $(attachment).data('attachment').port = pd[0];
+ $(attachment).data('attachment').device = pd[1];
+
+};
+
+
+
+/*
+ *
+ * Controller form elements
+ *
+ */
+
+/* onChange of controller type */
+$(document.forms['frmVboxSettings'].vboxSettingsStorageControllerType).change(function(){
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').controllerType = $(this).val();
+});
+
+/* change storage controller label on keydown in text box */
+$(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).keyup(function(){
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('span.vboxSettingsControllerTitle').first().text(this.value);
+});
+
+/* Set storage controller name on blur of textbox */
+$(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).on('blur',function(e){
+
+ var bus = $('#vboxSettingsStorageTree').find('.vboxListItemSelected').first();
+
+ if(!$(bus).data('controller')) return;
+
+ var newName = $(this).val();
+
+ // no change?
+ if(newName == $(bus).data('controller').name) return true;
+
+ if(jQuery.trim($(this).val().toString()).length < 1) {
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val($(bus).data('controller').name);
+
+ } else {
+
+ $('#vboxSettingsStorageTree').find('table.vboxSettingsController').each(function(idx,elm) {
+ if($(elm).data('controller').name == newName) {
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val($(bus).data('controller').name);
+ conflictFound = true;
+ return false;
+ }
+ });
+ }
+
+ $(bus).data('controller').name = $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).val();
+ $(bus).find('span.vboxSettingsControllerTitle').first().text($(bus).data('controller').name);
+
+}).keyup(function(){
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('span.vboxSettingsControllerTitle').text(this.value);
+});
+
+/* Change host cache value onClick of checkbox */
+$(document.forms['frmVboxSettings'].vboxSettingsStorageHostCache).click(function(){
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().data('controller').useHostIOCache = this.checked;
+});
+
+
+
+
+/*
+ * Update menu items on select and display
+ */
+$('#vboxSettingsStorageTree').on('itemselect',function(e,item){
+
+ $('#vboxSettingsAddAttachmentsMenuCDDiv').hide();
+ $('#vboxSettingsAddAttachmentsMenuHDDiv').hide();
+ $('#vboxSettingsAddAttachmentsMenuFDDiv').hide();
+
+ // Null selection hides everything
+ if(!item) {
+ $('#vboxSettingsController').css('display','none');
+ $('#vboxSettingsMediaInfo').css('display','none');
+ $('#vboxSettingsStorageAttachment').css('display','none');
+ // Update label widths
+ vboxStorageResizeTreeItemLabels();
+ return;
+ }
+
+ if(!$(item).data('attachment')) {
+ // Update label widths
+ vboxStorageResizeTreeItemLabels();
+ return;
+ }
+
+ switch($(item).data('attachment').type) {
+ case 'HardDisk':
+ $('#vboxSettingsAddAttachmentsMenuHDDiv').show();
+ break;
+ case 'Floppy':
+ // Update media menu...
+ mAttachToolbarFD.menuUpdateMedia($(item).data('attachment').medium);
+ $('#vboxSettingsAddAttachmentsMenuFDDiv').show();
+ break;
+ default:
+ // Update media menu...
+ mAttachToolbarCD.menuUpdateMedia($(item).data('attachment').medium);
+ $('#vboxSettingsAddAttachmentsMenuCDDiv').show();
+ }
+
+ // Update label widths
+ vboxStorageResizeTreeItemLabels();
+
+
+
+});
+
+
+
+
+/*
+ *
+ * OnSave and OnShow for dialog
+ *
+ *
+ */
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
+
+ $('#vboxSettingsDialog').data('vboxMachineData').storageControllers = new Array();
+
+ var storageList = $('#vboxSettingsStorageTree').children('ul').first();
+
+ $(storageList).find('table.vboxSettingsController').each(function(i,con){
+
+
+ var attachments = new Array();
+
+ $(con).parent().find('table.vboxSettingsStorageAttachment').each(function(i,elm) {
+
+ var attch = $(elm).data('attachment');
+
+ if(attch.medium && attch.medium.id) {
+ var med = vboxMedia.getMediumById(attch.medium.id);
+ attch.medium = {'id':med.id,'hostDrive':med.hostDrive,'location':med.location};
+ }
+
+ attachments[attachments.length] = attch;
+
+ });
+
+ var curCon = $('#vboxSettingsDialog').data('vboxMachineData').storageControllers.length;
+
+ $('#vboxSettingsDialog').data('vboxMachineData').storageControllers[curCon] = $(this).data('controller');
+ $('#vboxSettingsDialog').data('vboxMachineData').storageControllers[curCon]['mediumAttachments'] = attachments;
+
+ });
+
+
+});
+
+/* WHen data is loaded */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /*
+ *
+ * Fill form and storage list items
+ *
+ */
+
+ /* Fill List by calling helper functions for each controller */
+ var storageList = $('#vboxSettingsStorageTree').children('ul').first();
+ $(storageList).children().remove();
+
+ var cons = $('#vboxSettingsDialog').data('vboxMachineData').storageControllers;
+ for(var a = 0; a < cons.length; a++) {
+
+ var attch = cons[a].mediumAttachments;
+
+ var conElm = vboxSettingsAddController(cons[a], $(storageList));
+
+ for(var b = 0; b < cons[a].mediumAttachments.length; b++) {
+ vboxSettingsStorageBusses.addAttached(cons[a].mediumAttachments[b].medium);
+ vboxSettingsAddAttachment(cons[a].mediumAttachments[b], conElm);
+ }
+ }
+
+ //Select first item in storage tree list
+ $('#vboxSettingsStorageTree').find('table.vboxListItem').first().trigger('click').html();
+
+ /* Disable non-editable items when VM is running */
+ var p = $('#vboxSettingsStorageTableWrapper');
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+
+ scToolbar.disable();
+ $('#vboxSettingsStorageTree').disableContextMenu()
+
+ p.find('span:not(.vboxRunningEnabled)').addClass('disabled');
+ p.find('input:not(.vboxRunningEnabled),select,textarea').prop('disabled',true);
+
+ // Storage tree toolbars
+ $('#vboxSettingsStorageTree').find('.vboxControllerAttachmentButton').trigger('disable');
+
+ // Hard Disk Media menu button
+ $('#vboxSettingsAddAttachmentsMenuHDDiv').trigger('disable');
+
+ } else {
+
+ $('#vboxSettingsStorageTree').enableContextMenu();
+
+ p.find('span:not(.vboxRunningEnabled)').removeClass('disabled');
+ p.find('input:not(.vboxRunningEnabled),select,textarea').prop('disabled',false);
+
+ // Storage tree toolbars
+ $('#vboxSettingsStorageTree').find('.vboxControllerAttachmentButton').trigger('enable');
+
+ // Hard Disk Media menu button
+ $('#vboxSettingsAddAttachmentsMenuHDDiv').trigger('enable');
+
+ // initial toolbar update
+ scToolbar.enable();
+ scToolbar.update();
+
+ }
+
+});
+
+
+/* Respond to UP / Down arrow events */
+$('#vboxSettingsStorageTree').click(function(){$(this).focus();}).keydown(function(e){
+
+ var keynum = 0;
+
+ if(e.keyCode)
+ keynum = e.keyCode;
+ else if(e.which)
+ keynum = e.which;
+
+ switch(keynum) {
+
+ // up
+ case 38:
+
+ var cur = $(this).find('table.vboxListItemSelected').parent();
+
+ // Try previous med attachment
+ if($(cur).prev('li.vboxSettingsMediumAttachment').children('table.vboxListItem').trigger('click')[0]) {
+ return;
+ }
+
+ // If we're a medium, click our parent controller
+ if($(cur).hasClass('vboxSettingsMediumAttachment')) {
+ $(cur).parent().parent('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
+ return;
+ }
+
+ // Must be a controller, try previous controller's last medium attachment
+ if($(cur).prev().children('ul:not([class~="vboxHidden"])').find('table.vboxListItem:last').trigger('click')[0])
+ return;
+
+ // No med attachment, try previous controller
+ $(cur).prev('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
+ break;
+
+ // right / expand
+ case 39:
+ var tbl = $(this).find('table.vboxListItemSelected');
+ var con = $(tbl).data('controller');
+ if(!con) return;
+ $(tbl).find('td.vboxSettingsController' + con.bus).click();
+ break;
+
+ // left / contract
+ case 37:
+ var tbl = $(this).find('table.vboxListItemSelected');
+ var con = $(tbl).data('controller');
+ if(!con) return;
+ $(tbl).find('td.vboxSettingsController' + con.bus + 'Expanded').click();
+ break;
+
+ // down
+ case 40:
+
+ var cur = $(this).find('table.vboxListItemSelected').parent();
+
+ // Try next med attachment
+ if($(cur).next('li.vboxSettingsMediumAttachment').children('table.vboxListItem').trigger('click')[0]) {
+ return;
+ }
+
+ // Select first medium of current controller?
+ if($(cur).children('ul:not([class~="vboxHidden"])').find('table.vboxListItem:first').trigger('click')[0])
+ return;
+
+ // Try next controller
+ $(cur).closest('li.vboxSettingsController').next('li.vboxSettingsController').children('table.vboxListItem').trigger('click');
+
+ break;
+ }
+
+}).css('outline','none');;
+
+/*
+ *
+ * Change media attachment helper function
+ *
+ */
+function vboxSettingsControllerAttach(m) {
+
+ var tbl = $('#vboxSettingsStorageTree').find('table.vboxListItemSelected');
+ $(tbl).data('attachment').medium = m;
+ $(tbl).parent().tipped({'source':vboxSettingsMediumTip(m),'position':'mouse','delay':1000});
+
+ // Re-select attachment to update display info
+ vboxSettingsSelectAttachment(tbl);
+
+
+}
+
+
+/*
+ *
+ * Called when controller is selected helper function
+ *
+ */
+function vboxSettingsSelectController(tbl) {
+
+ // Null selection?
+ if(!tbl) {
+ $('#vboxSettingsController').css('display','none');
+ $('#vboxSettingsMediaInfo').css('display','none');
+ $('#vboxSettingsStorageAttachment').css('display','none');
+ return;
+ }
+
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
+
+ /* set classes for selected / unselected */
+ $('#vboxSettingsStorageTree').find('table[class]').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(tbl).removeClass('vboxListItem').addClass('vboxListItemSelected');
+
+ /* set name text box value */
+ document.forms['frmVboxSettings'].vboxSettingsStorageItemName.value = $(tbl).data('controller').name;
+
+ /* Set host cache checkbox */
+ document.forms['frmVboxSettings'].vboxSettingsStorageHostCache.checked = $(tbl).data('controller').useHostIOCache ? 'checked' : '';
+
+ var busType = $(tbl).data('controller').bus;
+
+ /* controller type */
+ document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.options.length = 0;
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageControllerType).children().remove();
+ for(var i = 0; i < vboxStorage[busType].types.length; i++) {
+ document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.options[i] = new Option(trans(vboxStorageControllerType(vboxStorage[busType].types[i]),'VBoxGlobal'),vboxStorage[busType].types[i]);
+ }
+
+ /* Set default type */
+ document.forms['frmVboxSettings'].vboxSettingsStorageControllerType.value = $(tbl).data('controller').controllerType;
+
+ $('#vboxSettingsController').css('display','block');
+ $('#vboxSettingsStorageAttachment').css('display','none');
+ $('#vboxSettingsMediaInfo').css('display','none');
+ $('#vboxSettingsHDInfo').css('display','none');
+
+ // Show SATA port count
+ if(busType == 'SATA') {
+ $(document.forms['frmVboxSettings'].vboxSettingsControllerPortCount).val($(tbl).data('controller').portCount);
+ $('#vboxSettingsControllerPortCountRow').css('display','');
+ } else {
+ $('#vboxSettingsControllerPortCountRow').css('display','none');
+ }
+
+ /* Enable / disable buttons */
+ if($(tbl).parent().find('ul').children('li').length < ($(tbl).data('controller').maxPortCount * $(tbl).data('controller').maxDevicesPerPortCount)) {
+
+ if($('#vboxSettingsDialog').data('vboxFullEdit')) {
+ $(tbl).find('.vboxToolbarSmall').trigger('enable', [true]);
+ }
+
+ } else {
+ $(tbl).find('.vboxToolbarSmall').trigger('disable');
+ }
+
+ /* Trigger Event */
+ $('#vboxSettingsStorageTree').trigger('itemselect',tbl);
+
+}
+
+
+/*
+ * Generate tooltip for medium helper function
+ */
+function vboxSettingsMediumTip(m) {
+
+ if(!m || !m.id) return trans('Empty','VBoxGlobal');
+ if(m.hostDrive) return vboxMedia.getName(m);
+
+ // DVD / Floppy images
+ if(m.deviceType != 'HardDisk') {
+ return '<b>'+m.location+'</b><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(m)+'</p>';
+ }
+
+ var mbase = m;
+ if(m.base != m.id) {
+ mbase = vboxMedia.getMediumById(m.base);
+ }
+ var tip = '<b>'+mbase.location+'</b><p>'+trans('Type (Format):','UIMachineSettingsStorage')+' '+vboxMedia.getType(mbase)+' ('+mbase.format+')</p><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(mbase)+'</p>';
+
+ // Is this a medium that is attached indirectly
+ if(vboxSettingsStorageBusses.isAttachedIndirect(m) && m.base != m.id) {
+ var p = vboxSettingsStorageBusses.isAttached(m);
+ tip += '<hr />'+trans('This base hard disk is indirectly attached using the following differencing hard disk:','VBoxGlobal')+'<br /><b>'+p.location+'</b></p><p>'+trans('Type (Format):','UIMachineSettingsStorage')+' '+vboxMedia.getType(p) + ' (' + p.format + ')'+'</p><p>'+trans('Attached to:','UIMachineSettingsStorage')+' '+vboxMedia.attachedTo(p)+'</p>';
+ } else if(m.readOnly) {
+ tip += '<hr />'+trans('Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.','VBoxGlobal');
+ }
+
+ return tip;
+
+}
+
+/*
+ *
+ * Add disk medium to bus helper function
+ *
+ */
+function vboxSettingsStorageAddMedium(conElm, type) {
+
+ // get controller name
+ var controller = $(conElm).find('span.vboxSettingsControllerTitle').first().text();
+
+ if(!type) type = 'HardDisk';
+
+ // Find first target slot (vboxSettingsStorageBusses created above)
+ var slots = vboxSettingsStorageBusses.availableSlots(conElm);
+ var slot = null;
+ for(var i in slots) {
+ if(typeof i == 'function') continue;
+ slot = i;
+ break;
+ }
+ if(slot === null) return;
+ slot = slot.split('-');
+ var port = slot[0];
+ var device = slot[1];
+
+ // Add new attachment dialog
+ ////////////////////////////
+ var buttons = {};
+
+ var msg = '';
+
+ // Hard Disk buttons
+ if (type == 'HardDisk') {
+
+ buttons[trans('Create new disk','UIMessageCenter')] = function() {
+
+ $.when(new vboxWizardNewHDDialog({'path':vboxDirname($('#vboxSettingsDialog').data('vboxMachineData').settingsFilePath)+$('#vboxPane').data('vboxConfig').DSEP,vmName:$('#vboxSettingsDialog').data('vboxMachineData').name}).run())
+ .done(function(id){
+ if(!id) return;
+ mAttachToolbarHD.mediaMenu.menuUpdateRecent();
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':vboxMedia.getMediumById(id),'ignoreFlush':1}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ });
+
+ $(this).remove();
+
+ };
+ buttons[trans('Choose existing disk','UIMessageCenter')] = function() {
+ var dlg = $(this);
+ vboxMedia.actions.choose(null,'HardDisk',function(med){
+ if(med) {
+ mAttachToolbarHD.mediaMenu.menuUpdateRecent();
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med,'ignoreFlush':1}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ }
+ $(dlg).remove();
+ });
+ };
+
+ msg = trans('<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>','UIMessageCenter').replace('%1',controller);
+
+ // Floppy buttons
+ } else if(type == 'Floppy') {
+
+ buttons[trans('Choose disk','UIMessageCenter')] = function() {
+ var dlg = $(this);
+ vboxMedia.actions.choose(null,'Floppy',function(med){
+ if(med) {
+ mAttachToolbarFD.mediaMenu.menuUpdateRecent();
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ }
+ $(dlg).remove();
+ });
+
+ };
+
+ buttons[trans('Leave empty','UIMessageCenter')] = function() {
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':null}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ $(this).remove();
+ };
+
+ msg = trans('<p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p>','UIMessageCenter').replace('%1',controller);
+
+ // CD/DVD buttons
+ } else {
+
+ buttons[trans('Choose disk','UIMessageCenter')] = function() {
+ var dlg = $(this);
+ vboxMedia.actions.choose(null,'DVD',function(med){
+ if(med) {
+ mAttachToolbarCD.mediaMenu.menuUpdateRecent();
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':med}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ }
+ $(dlg).remove();
+ });
+
+ };
+
+ buttons[trans('Leave empty','UIMessageCenter')] = function() {
+ vboxSettingsAddAttachment({'controller':controller,'port':port,'device':device,'type':type,'medium':null}, conElm);
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click();
+ $(this).remove();
+ };
+
+ msg = trans('<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p>','UIMessageCenter').replace('%1',controller);
+
+ }
+
+ buttons[trans('Cancel','QIMessageBox')] = function() {
+ $(this).remove();
+ };
+ $('<div />').attr({'id':'vboxSettingsStorageUnavailable','style':'display: none'}).html(
+ '<div><img src="images/50px-Question_icon.svg.png" style="float: left; padding: 10px; " />'+msg+'</div>'
+ ).dialog({'closeOnEscape':false,'width':600,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/OSE/about_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
+
+
+}
+
+/*
+ *
+ * Add controller to list helper function
+ *
+ */
+
+function vboxSettingsAddController(con,list) {
+
+ // Elect name if none exists
+ if(!con.name) {
+ var count = $(list).children('li.vboxSettingsController'+con.bus).length + 1;
+ var name = trans(con.bus,'UIMachineSettingsStorage');
+ if(count == 1) {
+ con.name = name;
+ } else {
+
+ var electedName = name + ' ' + count;
+ var conflictFound = false;
+ do {
+ conflictFound = false;
+ $(list).children('li.vboxSettingsController'+con.bus).each(function(idx,elm) {
+ if($(elm).children('table').first().data('controller').name == electedName) {
+ conflictFound = true;
+ electedName = name + ' ' + (++count);
+ return false;
+ }
+ });
+ con.name = electedName;
+
+ } while(conflictFound);
+ }
+
+ }
+ var li = $('<li />').attr({'title':con.name,'class':'vboxSettingsController vboxSettingsController' + con.bus});
+
+ var tbl = $('<table />').attr({'class':'vboxListItem vboxSettingsController'}).on('click',function(){
+ vboxSettingsSelectController(this);
+ });
+
+ // filter out any dummy medium attachments
+ var mas = new Array();
+ for(var i = 0; i < con.mediumAttachments.length; i++) {
+ if(con.mediumAttachments[i].controller)
+ mas[mas.length] = con.mediumAttachments[i];
+ }
+ con.mediumAttachments = mas;
+
+ // Assign data
+ $(tbl).data('controller',con);
+
+ var tr = $('<tr />');
+
+ var iconName = vboxStorage.getBusIconName(con.bus);
+ $('<td />').attr({'class':'vboxSettingsStorageTypeIcon vboxSettingsController' + con.bus + 'Expanded'})
+ .css({
+ 'background-image':'url(images/vbox/'+iconName+'_collapse_16px.png)'
+ }).html('<div style="width:22px" />').click(function(){
+
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+
+ var n = $(this).closest('li');
+ $(n).children('ul').addClass('vboxHidden').css('display','none');
+ $(this).removeClass('vboxSettingsController'+con.bus+'Expanded').addClass('vboxSettingsController'+con.bus)
+ .css({'background-image':'url(images/vbox/'+iconName+'_expand_16px.png)'});
+
+ } else {
+
+ $(this).data('toggleClicked', false);
+ var n = $(this).closest('li');
+ $(n).children('ul').removeClass('vboxHidden').css('display','');
+ $(this).removeClass('vboxSettingsController'+con.bus).addClass('vboxSettingsController'+con.bus+'Expanded')
+ .css({'background-image':'url(images/vbox/'+iconName+'_collapse_16px.png)'})
+
+ }
+
+ return false;
+
+ }).appendTo(tr);
+
+ // Controller name
+ $(tr).append($('<td />').css({'width':'100%'}).html('<div class="vboxFitToContainer">'+trans('Controller: %1','UIMachineSettingsStorage').replace('%1','<span class="vboxSettingsControllerTitle vboxRunningEnabled">'+$('<div/>').text(con.name).html())+"</span>"+"</div>"));
+
+ // Buttons
+ $(tr).append($('<td />').attr({'style':'width: 22px;','class':'vboxControllerAttachmentButton'}));
+
+ $(tbl).append(tr).appendTo(li);
+
+
+ /* Attachments list holder */
+ $(li).append($('<ul />').attr({'class':'vboxSettingsControllerAttachments'})).dblclick(function(e){
+ $(this).children('table.vboxSettingsController').find('td.vboxSettingsStorageTypeIcon').trigger('click',e);
+ }).disableSelection().appendTo(list);
+
+ /* Generate Toolbars */
+ var dtypes = vboxStorage[con.bus].driveTypes;
+ for(var i = 0; i < dtypes.length; i++) {
+ var b = null;
+ if(dtypes[i] == 'dvd') {
+ b = {
+ 'name' : con.bus+'addcd',
+ 'label' : trans('Add Optical Drive','UIMachineSettingsStorage'),
+ 'icon' : 'cd_add',
+ 'click' : function () { vboxSettingsStorageAddMedium(li,'DVD'); }
+ };
+ } else if(dtypes[i] == 'disk') {
+ b = {
+ 'name' : con.bus+'adddrive',
+ 'label' : trans('Add Hard Disk','UIMachineSettingsStorage'),
+ 'icon' : 'hd_add',
+ 'click' : function (item) { vboxSettingsStorageAddMedium(li); }
+ };
+
+ } else if(dtypes[i] == 'floppy') {
+ b = {'label':trans('Add Floppy Drive','UIMachineSettingsStorage'),
+ 'icon' : 'fd_add',
+ 'click' : function (item) { vboxSettingsStorageAddMedium(li,'Floppy'); }
+ };
+ }
+ b['enabled'] = function() {
+
+ return (li.find('li').length < (vboxStorage[con.bus].maxPortCount * vboxStorage[con.bus].maxDevicesPerPortCount));
+ };
+
+ var tb = new vboxToolbarSmall({buttons: [b],
+ buttonStyle: 'margin:0px;padding:0px;border:0px;background-repeat:no-repeat;background-position:0px 0px;',
+ noHover: true,
+ renderTo: li.find('td.vboxControllerAttachmentButton')});
+ tb.disable();
+
+ }
+
+ // Only if machine is not running
+ if($('#vboxSettingsDialog').data('vboxFullEdit')) {
+
+ $(li).contextMenu({menu: vboxStorageAttachmentMenus[con.bus].menuId(),
+ menusetup: function() {$(li).children('table').first().trigger('click')}},
+ vboxStorageAttachmentMenus[con.bus].menuClickCallback
+ );
+
+ }
+
+ // Return controller element list item
+ return li;
+
+}
+
+
+
+
+
+/*
+ *
+ * Add a medium attachment to a controller helper function
+ *
+ */
+function vboxSettingsAddAttachment(d,conElm) {
+
+
+ var con = (conElm ? conElm : $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().parent());
+
+ // Save bus
+ d.bus = $(con).find('table.vboxSettingsController').data('controller').bus;
+
+ // remove any 'last' classes
+ $(con).children('ul').children().removeClass('last');
+
+ var li = $('<li />').attr({'class':'last vboxSettingsMediumAttachment'});
+
+
+ var tbl = $('<table />').attr({'class':'vboxListItem vboxSettingsStorageAttachment'})
+ .data({'attachment':d}).on('click',function(){
+ vboxSettingsSelectAttachment(this);
+ });
+
+ var m = vboxMedia.getMediumById(((d.medium && d.medium.id) ? d.medium.id : null));
+
+ var tr = $('<tr />');
+
+ // Storage type icon
+ $(tr).append($('<td />').attr({'class':'vboxSettingsStorageTypeIcon vboxSettingsMediaType' + d.type,'style':'width:22px'}).html('<img src="images/vbox/blank.gif" style="width:22px" />'));
+
+ // Medium name
+ $(tr).append($('<td />').css({'width':'100%'}).append($('<div />').attr({'class':'vboxSettingsStorageMediumName vboxFitToContainer'}).html(vboxMedia.getName(vboxMedia.getMediumById((m && m.base ? m.base : (m && m.id ? m.id : null)))))));
+
+
+ $(tbl).append(tr).appendTo(li);
+
+ // Only if not running
+ if($('#vboxSettingsDialog').data('vboxFullEdit')) {
+
+ $(li).contextMenu({
+ menu: vboxSettingsMAMenu.menuId(),
+ menusetup : function(el) {
+ vboxSettingsSelectAttachment($(el).find('table.vboxSettingsStorageAttachment'));
+ }
+ },
+ function(action, el, pos) {
+ vboxSettingsStorageButtons[1].click();
+ }
+ );
+ }
+
+ $(li).tipped({'source':vboxSettingsMediumTip(m),'position':'mouse','delay':1000}).appendTo(con.children('ul'));
+
+
+}
+
+/*
+ *
+ * Called when selecting a medium attachment
+ *
+ */
+function vboxSettingsSelectAttachment(tbl) {
+
+ // Null selection?
+ if(!tbl) {
+ $('#vboxSettingsController').css('display','none');
+ $('#vboxSettingsMediaInfo').css('display','none');
+ $('#vboxSettingsStorageAttachment').css('display','none');
+ return;
+ }
+
+ $(document.forms['frmVboxSettings'].vboxSettingsStorageItemName).trigger('blur');
+
+ /* Display Changes */
+ if(!$(tbl).hasClass('vboxListItemSelected')) {
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $(tbl).removeClass('vboxListItem').addClass('vboxListItemSelected');
+ }
+
+ $('#vboxSettingsController').css('display','none');
+ $('#vboxSettingsMediaInfo').css('display','block');
+ $('#vboxSettingsStorageAttachment').css('display','block');
+
+
+ var ma = $(tbl).data('attachment');
+
+ /* Get / Set Medium */
+ if(ma.medium && ma.medium.id)
+ ma.medium = vboxMedia.getMediumById(ma.medium.id);
+
+ (function(){
+
+ var sc = $(tbl).closest('li.vboxSettingsController').children('table').first().data('controller');
+
+ var tblSA = $('#vboxSettingsStorageAttachment').find('table').first();
+ $(tblSA).find('tr.vboxSettingsControllerDeviceOptionRow').empty().remove();
+
+ switch(ma.type) {
+
+ case 'HardDisk':
+ label = 'Hard Disk:';
+ break;
+ case 'DVD':
+ label = 'CD/DVD Drive:';
+ break;
+ case 'Floppy':
+ label = 'Floppy Drive:';
+ break;
+ }
+ var maOptions = vboxStorage.getMAOptions(ma)
+ .concat(vboxStorage.getMAOptionsForSC(sc));
+ for(var i = 0; i < maOptions.length; i++) {
+
+ var opt = maOptions[i];
+
+ var cbox = $('<input />').attr('type','checkbox').prop('checked', ma[opt.attrib] ? true : false)
+ .on('click', {attrib: opt.attrib}, function(event){
+
+ var attachment = $(tbl).data('attachment');
+ attachment[event.data.attrib] = this.checked ? true : false;
+ $(tbl).data('attachment', attachment);
+
+ }).addClass('vboxCheckbox');
+
+ $('<tr />').addClass('vboxSettingsControllerDeviceOptionRow')
+ .append($('<th />'))
+ .append(
+ $('<td />')
+ .append($('<label />')
+ .append(cbox)
+ .append($('<span />').css({'margin-left':'4px'}).text(opt.label))
+ )
+ ).appendTo($(tblSA));
+
+
+ }
+ })();
+ $('#vboxSettingsControllerSlotLabel').html(trans(label,'UIMachineSettingsStorage'));
+
+
+ /* Show / Hide HD/Media Info */
+ $('#vboxSettingsImageInfo').css('display',(ma.type == 'HardDisk' ? 'none' : 'block'));
+ $('#vboxSettingsHDInfo').css('display',(ma.type == 'HardDisk' ? 'block' : 'none'));
+
+
+
+ /* Populate slot select box */
+ document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options.length = 0;
+ $(document.forms['frmVboxSettings'].vboxSettingsControllerSlot).children().remove();
+ slots = vboxSettingsStorageBusses.availableSlots($(tbl).parent().parent().parent(), ma.port+'-'+ma.device);
+
+ for(var s in slots) {
+ var opt = new Option(slots[s], s);
+ document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options[document.forms['frmVboxSettings'].vboxSettingsControllerSlot.options.length] = opt;
+ }
+ document.forms['frmVboxSettings'].vboxSettingsControllerSlot.value = ma.port+'-'+ma.device;
+
+ /* Trigger Event */
+ $('#vboxSettingsStorageTree').trigger('itemselect',tbl);
+
+ var m = ma.medium;
+ var name = vboxMedia.getName(m);
+
+ // Read-only medium selected
+ if(ma.medium && ma.medium.readOnly) {
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('td').first().addClass('vboxMediumReadOnly');
+ } else {
+ $('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().find('td').first().removeClass('vboxMediumReadOnly');
+ }
+
+ // Show medium info
+ if(m && m.deviceType == 'HardDisk') {
+
+ var disp = vboxMedia.getMediumById(m.base);
+ name = vboxMedia.getName(disp);
+
+ var encSettings = vboxMedia.getEncryptionSettings(disp);
+
+ $('#vboxSettingsHDvsize').html(vboxMbytesConvert(disp.logicalSize));
+ $('#vboxSettingsHDasize').html(vboxBytesConvert(disp.size));
+ $('#vboxSettingsHDDetails').html(vboxMedia.getHardDiskVariant(disp));
+ $('#vboxSettingsHDlocation').html(disp.location);
+ $('#vboxSettingsHDtype').html(trans(disp.type,'VBoxGlobal') + ' (' + disp.format + ')');
+ $('#vboxSettingsHDattached').html(vboxMedia.attachedTo(disp));
+ $('#vboxSettingsHDEncrypted').html(encSettings && encSettings.id ? encSettings.id : '--');
+
+
+ } else {
+
+ $('#vboxSettingsImageType').html(m ? trans((m.hostDrive ? 'Host Drive' : 'Image'),'UIMachineSettingsStorage'): '--');
+ $('#vboxSettingsImageSize').html((m && !m.hostDrive ? vboxBytesConvert(m.size):'--'));
+ $('#vboxSettingsImageLocation').html((m && !m.hostDrive ? m.location:'--'));
+ $('#vboxSettingsImageAttached').html((m && !m.hostDrive ? vboxMedia.attachedTo(m) :'--'));
+
+ }
+
+ $(tbl).data('attachment').medium = m;
+ $(tbl).find('div.vboxSettingsStorageMediumName').first().html($('<div />').text(name).html());
+
+
+}
+
+
+/*
+ * Focus storage controller list when showing this pane
+ */
+$('#vboxSettingsStorageTableWrapper').on('show',function(){
+ $('#vboxSettingsStorageTree').focus();
+});
+
+/*
+ *
+ *
+ * Storage pane resize and draggable resize bar logic
+ *
+ *
+ */
+/*
+ * Resize storage pane
+ */
+function vboxSettingsStorageResize() {
+
+ // Hide storage tree
+ $('#vboxSettingsStorageTree').css({'display':'none'});
+
+ // Get and set size
+ $('#vboxStoragePaneLeft').css({'display':'none'});
+ $('#vboxStoragePaneRight').css({'display':'none'});
+
+ // Main table height
+ $('#vboxSettingsStorageTableWrapper').css({'display':'none'});
+ var h = $('#vboxSettingsStorageTableWrapper').css({'display':'none'}).parent().parent().innerHeight()-4;
+
+ // IE needs to account for bordering
+ if($.browser.msie) h-= 4;
+
+ // Set height
+ $('#vboxSettingsStorageTableWrapper').css({'display':''}).height(h);
+
+ // Pane width
+ var bothWidth = ($('#vboxStoragePaneLeft').parent().innerWidth() + $('#vboxStoragePaneRight').parent().innerWidth() - 24) / 2;
+ $('#vboxStoragePaneLeft').css({'width':bothWidth+'px','display':''}).parent().css({'width':'auto','padding':'6px'});
+ $('#vboxStoragePaneRight').css({'width':bothWidth+'px','display':''}).parent().css({'width':'auto','padding':'6px'});
+
+ // Unsnap.. sorry..
+ $('#vboxStorageResizeBar').data('vboxSnapped',0);
+
+ // Get inner height of storage tree parent - padding
+ var h = $('#vboxStoragePaneLeft').parent().innerHeight() - 24;
+ // subtract sibling heights
+ $('#vboxSettingsStorageTree').siblings().each(function(){
+ h -= $(this).outerHeight(true);
+ });
+
+ $('#vboxSettingsStorageTree').height(h).css({'display':''});
+
+ vboxStorageResizeTreeItemLabels();
+
+}
+
+/*
+ * Resize controller labels
+ */
+function vboxStorageResizeTreeItemLabels() {
+
+ $('#vboxSettingsStorageTree div.vboxFitToContainer').each(function(){
+ $(this).css({'display':'none'});
+ var w = $(this).parent().innerWidth() - 2;
+ $(this).css({'width':w+'px','display':''});
+ });
+
+
+};
+
+/*
+ * Set pane sizes and resize bar
+ */
+$('#vboxSettingsStorageTableWrapper').one('show',function(){
+
+
+ // Resize everything on dialog resize
+ $('#vboxSettingsDialog').on('dialogresizestop',function(){
+ vboxSettingsStorageResize();
+ });
+ $('#vboxSettingsStorageTableWrapper').on('show',function(){
+ vboxSettingsStorageResize();
+ });
+
+ // Hide children to get true size
+ $('#vboxStoragePaneLeft').children().css({'display':'none'});
+ $('#vboxStoragePaneRight').children().css({'display':'none'});
+
+ var h = $('#vboxSettingsStorageTableWrapper').parent().css({'padding':'0px','margin':'0px'}).parent().innerHeight();
+
+ // IE needs to account for bordering
+ if($.browser.msie) h-= 4;
+
+ $('#vboxSettingsStorageTableWrapper').height(h-4);
+
+ // Get and set size
+ var bothWidth = ($('#vboxStoragePaneLeft').parent().innerWidth() + $('#vboxStoragePaneRight').parent().innerWidth() - 24) / 2;
+ $('#vboxStoragePaneLeft').css({'width':bothWidth+'px','overflow':'hidden'}).parent().css({'width':'auto'});
+ $('#vboxStoragePaneRight').css({'width':bothWidth+'px','overflow':'hidden'}).parent().css({'width':'auto'});
+
+ // Show children again
+ $('#vboxStoragePaneLeft').children().css({'display':''});
+ $('#vboxStoragePaneRight').children().css({'display':''});
+
+ // Re-trigger list selection to show correct info
+ if(!$('#vboxSettingsStorageTree').find('table.vboxListItemSelected').first().click().hasClass('vboxListItemSelected'))
+ $('#vboxSettingsStorageTree').trigger('itemselect',null);
+
+ // Don't allow selection of text in storage tree. This looks funny when dragging the resize bar
+ $('#vboxSettingsStorageTree').disableSelection();
+
+ // Resize
+ vboxSettingsStorageResize();
+
+ // Draggable resize bar
+ $('#vboxStorageResizeBar').draggable({cursor:(jQuery.browser.opera ? 'e-resize' : 'col-resize'),axis:'x',zIndex:99,helper:function(){
+
+ return $('<span />'); // dummy element
+
+ },scroll:false,'start':function(e,ui){
+
+ $('#vboxStorageResizeBar').data('vboxX',e.pageX);
+
+ $('#vboxResizeOverlay').remove();
+ $('body').disableSelection().css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize')});
+ $('#vboxSettingsDialog').append($('<div />').attr({'id':'vboxResizeOverlay','style':'width:99%;height:99%;border:0px;margin:0px;padding:0px;position:absolute;top:0px;left:0px;cursor:'+(jQuery.browser.opera ? 'e-resize' : 'col-resize')}));
+
+
+ },'drag':function(e){
+
+ var sStart = $('#vboxStorageResizeBar').data('vboxX');
+ var sStop = e.pageX;
+ var sWidth = Math.abs(sStop - sStart);
+ if(sWidth == 0) return;
+
+ var lWidth = parseInt($('#vboxStoragePaneLeft').css('width'));
+ var rWidth = parseInt($('#vboxStoragePaneRight').css('width'));
+
+ var snapped = $('#vboxStorageResizeBar').data('vboxSnapped');
+
+ // Left to right
+ if(sStop > sStart) {
+
+ // Check for snapping
+ if(snapped) {
+ if(snapped > sStop || (rWidth - sWidth < 150)) { return; }
+ else if(snapped && snapped <= sStop) {
+
+ // Unsnap left pane
+ $('#vboxStoragePaneRight').parent().css({'width':'auto'});
+ $('#vboxStoragePaneLeft').css({'display':''}).parent().css({'padding':'6px'});
+ $('#vboxStorageResizeBar').data('vboxSnapped',0);
+ lWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthL');
+ rWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthR');
+ sWidth = Math.abs(sStop - snapped);
+ }
+ }
+
+ if(rWidth - sWidth < 150) {
+
+ $('#vboxStoragePaneLeft').css({'width':'100%'}).parent().css({'width':'100%'});
+ $('#vboxStoragePaneRight').css({'display':'none','width':'10px'}).parent().css({'padding':'0px'});
+ $('#vboxStorageResizeBar').data('vboxSnapped',e.pageX);
+ $('#vboxStorageResizeBar').data('vboxSnappedWidthL', (lWidth + sWidth));
+ $('#vboxStorageResizeBar').data('vboxSnappedWidthR', (rWidth - sWidth));
+
+ } else {
+ $('#vboxStoragePaneLeft').css({'width':(lWidth + sWidth)+'px','display':''});
+ $('#vboxStoragePaneRight').css({'width':(rWidth - sWidth)+'px','display':''});
+ }
+
+
+ // Right to left
+ } else {
+
+ // Check for snapping
+ if(snapped) {
+ if(snapped < sStop || (lWidth - sWidth < 150)) { return; }
+ else if(snapped && snapped >= sStop) {
+
+ // Unsnap right pane
+ $('#vboxStoragePaneLeft').parent().css({'width':'auto'});
+ $('#vboxStoragePaneRight').css({'display':''}).parent().css({'width':'100%','padding':'6px'}); // 100% to fix webkit
+ $('#vboxStorageResizeBar').data('vboxSnapped',0);
+ lWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthL');
+ rWidth = $('#vboxStorageResizeBar').data('vboxSnappedWidthR');
+ sWidth = Math.abs(sStop-snapped);
+
+ }
+ }
+
+ if(lWidth - sWidth < 150) {
+
+ $('#vboxStoragePaneRight').css({'width':'100%'}).parent().css({'width':'100%'});
+ $('#vboxStoragePaneLeft').css({'display':'none','width':'10px'}).parent().css({'padding':'0px'});
+ $('#vboxStorageResizeBar').data('vboxSnapped',e.pageX);
+ $('#vboxStorageResizeBar').data('vboxSnappedWidthL', (lWidth - sWidth));
+ $('#vboxStorageResizeBar').data('vboxSnappedWidthR', (rWidth + sWidth));
+
+ } else {
+ $('#vboxStoragePaneLeft').css({'width':(lWidth - sWidth)+'px'});
+ $('#vboxStoragePaneRight').css({'width':(rWidth + sWidth)+'px'});
+ }
+ }
+
+ $('#vboxStorageResizeBar').data('vboxX',e.pageX);
+
+ // resize labels
+ vboxStorageResizeTreeItemLabels();
+
+
+ },'stop':function(e) {
+
+ // resize labels
+ vboxStorageResizeTreeItemLabels();
+
+ $('body').enableSelection().css({'cursor':'default'});
+ $('#vboxResizeOverlay').remove();
+ }}).css({'cursor':(jQuery.browser.opera ? 'e-resize' : 'col-resize'),'height':'98%'});
+
+
+});
+
</script> \ No newline at end of file
diff --git a/panes/settingsSystem.html b/panes/settingsSystem.html
index 68f8669..cc53863 100644
--- a/panes/settingsSystem.html
+++ b/panes/settingsSystem.html
@@ -1,466 +1,466 @@
-<!--
-
- VM System Settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsSystem.html 597 2015-04-20 11:41:28Z imoore76 $
-
--->
-
-<ul>
- <li><a href="#vboxSettingsTabSystemMotherboard"><span class='translate'>Motherboard</span></a></li>
- <li><a href="#vboxSettingsTabSystemProcessor"><span class='translate'>Processor</span></a></li>
- <li><a href="#vboxSettingsTabSystemAcceleration"><span class='translate'>Acceleration</span></a></li>
-</ul>
-
-<!-- Motherboard Tab -->
-<div id='vboxSettingsTabSystemMotherboard' title='Motherboard'>
-<table style='width: 100%'>
- <tr>
- <th style='text-align:right'><span class='translate'>Base Memory:</span></th>
- <td style='width: 100%; white-space: nowrap'>
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='vboxSettingsSystemMemory' class='slider'><div class='sliderScale'></div></div>
- </td>
- <td><input type='text' class='vboxText sliderValue' name='vboxSettingsSystemMemoryValue' size='5' /> <span class='translate'>MB</span></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 class='vboxSliderMin'>%1 MB</span></td>
- <td style='text-align: right;'><span class='vboxSliderMax'>%1 MB</span></td>
- </tr>
- </table>
- </td>
- <td></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemPageFusion' /> <span class='translate'>Enable Page Fusion</span></label></td>
- </tr>
- <tr style='vertical-align: top'>
- <th style='text-align:right'><span class='translate'>Boot Order:</span></th>
- <td>
- <table id='vboxVMBootOrder'>
- <tr style='vertical-align: top'>
- <td style='width: auto'>
- <ul class='vboxList vboxHover vboxBordered' id='vboxVMBootOrderList' style='margin: 0px; padding: 2px; white-space: nowrap; width: 200px'>
- <li id='HardDisk'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootHardDisk' /> <img src="images/vbox/hd_16px.png" /> <span class='vboxBootOrderDevice'>HardDisk</span></li>
- <li id='DVD'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootDVD' /> <img src="images/vbox/cd_16px.png" /> <span class='vboxBootOrderDevice'>DVD</span></li>
- <li id='Floppy'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootFloppy' /> <img src="images/vbox/fd_16px.png" /> <span class='vboxBootOrderDevice'>Floppy</span></li>
- <li id='Network'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootNetwork' /> <img src="images/vbox/nw_16px.png" /> <span class='vboxBootOrderDevice'>Network</span></li>
- </ul>
- </td>
- <td style='text-align: left; width: 100%'>
- <input disabled='disabled' class="imgMvUp vboxImgButton" style='background: url(images/vbox/list_moveup_disabled_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
- <br />
- <input disabled='disabled' class="imgMvDn vboxImgButton" style='background: url(images/vbox/list_movedown_disabled_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr id='vboxSettingsSystemChipsetRow'>
- <th style='text-align:right'><span class='translate'>Chipset:</span></th>
- <td><select name='vboxSettingsSystemChipset'>
- <option value='PIIX3'>PIIX3</option>
- <option value='ICH9'>ICH9</option>
- </select>
- </td>
- </tr>
- <tr>
- <th style='text-align:right'><span class='translate'>Extended Features:</span></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemIOAPIC' /> <span class='translate'>Enable I/O APIC</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemEFI' /> <span class='translate'>Enable EFI (special OSes only)</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemRTCUseUTC' /> <span class='translate'>Hardware Clock in UTC Time</span></label></td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemDisableHostTimeSync' /> <span class='translate'>Disable host time sync</span></label></td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemHPET' /> <span class='translate'>HPET (high precision event timer)</span></label></td>
- </tr>
-
-</table>
-</div>
-
-<!-- Processor Tab -->
-<div id='vboxSettingsTabSystemProcessor' title='Processors'>
-<table style='width: 100%'>
- <tr>
- <th style='text-align:right'><span class='translate'>Processor(s):</span></th>
- <td style='width: 100%; white-space: nowrap'>
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='vboxSettingsSystemProcessor' class='slider'><div class='sliderScale'></div></div>
- </td>
- <td><input type='text' class='vboxText' name='vboxSettingsSystemProcessorValue' size='2' 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 class='vboxSliderMin'>%1 CPU</span></td>
- <td style='text-align: right;'><span class='vboxSliderMax'>%1 CPUs</span></td>
- </tr>
- </table>
- </td>
- <td></td>
- </tr>
- </table>
-
- </td>
- </tr>
- <tr class='vboxRunningEnabled'>
- <th style='text-align:right'><span class='translate'>Execution Cap:</span></th>
- <td style='width: 100%; white-space: nowrap'>
- <table style='width: 100%'>
- <tr class='vboxRunningEnabled'>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='vboxSettingsSystemProcessorCap' class='slider'><div class='sliderScale'></div></div>
- </td>
- <td><input type='text' class='vboxText vboxRunningEnabled' name='vboxSettingsSystemProcessorCapValue' size='3' class='sliderValue' /></td>
- </tr>
- <tr style='vertical-align: top;' class='vboxRunningEnabled'>
- <td style='border: 0px; margin: 0px; padding: 0px;'>
- <table style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <tr style='vertical-align: top' class='vboxRunningEnabled'>
- <td style='text-align: left;'><span class='vboxSliderMin' title='Min CPU execution cap in %'>%1%</span></td>
- <td style='text-align: right;'><span class='vboxSliderMax' title='Max CPU execution cap in %'>%1%</span></td>
- </tr>
- </table>
- </td>
- <td></td>
- </tr>
- </table>
-
- </td>
- </tr>
-
- <tr id='vboxSettingsSystemPAERow'>
- <th><span class='translate'>Extended Features:</span></th>
- <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemPAE' /> <span class='translate'>Enable PAE/NX</span></label></td>
- </tr>
-</table>
-</div>
-
-<!-- Acceleration Tab -->
-<div id='vboxSettingsTabSystemAcceleration' title='Acceleration'>
-<table>
- <tr>
- <th class='vboxEnablerIgnore'><span class='translate'>Paravirtualization Interface:</span></th>
- <td><select name='vboxSettingsParavirtInterface' class='vboxEnablerIgnore'>
- <option value='None'>None</option>
- <option value='Default'>Default</option>
- <option value='Legacy'>Legacy</option>
- <option value='Minimal'>Minimal</option>
- <option value='HyperV'>HyperV</option>
- <option value='KVM'>KVM</option>
- </select></td>
- <tr>
- <th style='text-align:right' class='vboxEnablerIgnore vboxSettingsAccelRequired'><span class='translate'>Hardware Virtualization:</span></th>
- <td style='width:100%'><label><input type='checkbox' name='settingsSystemVT' class='vboxEnablerCheckbox vboxSettingsAccelRequired'/>
- <span class='translate vboxSettingsAccelRequired'>Enable VT-x/AMD-V</span></label></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' name='settingsSystemPaging' class='vboxEnablerListen' /> <span class='translate vboxEnablerListen'>Enable Nested Paging</span></label></td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' name='settingsSystemLargePages' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable Large Pages</span></label></td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' name='settingsSystemUnrestrictedExecution' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable VT-x unrestricted execution</span></label></td>
- </tr>
- <tr class='vboxSettingsSystemAdvancedOnly'>
- <th></th>
- <td><label><input type='checkbox' name='settingsSystemVPID' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable VT-x VPID (Intel only)</span></label></td>
- </tr>
-</table>
-</div>
-
-
-<script type='text/javascript'>
-
-/* Boot order devices */
-$('#vboxVMBootOrder').find("span.vboxBootOrderDevice").html(function(i,h){return trans(vboxDevice(h),'VBoxGlobal');});
-
-/* Chipsets */
-$('#vboxSettingsSystemChipsetRow').find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
-
-/* Paravirtualization providers */
-$(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).find('option').html(function(i,h){return trans(h,'VBoxGlobal', 'ParavirtProvider');});
-
-$('#vboxSettingsSystemMemory').data('form','frmVboxSettings');
-$('#vboxSettingsSystemProcessor').data('form','frmVboxSettings');
-$('#vboxSettingsSystemProcessorCap').data('form','frmVboxSettings');
-$('#vboxSettingsSystemMemory').slider({'min':parseInt($('#vboxPane').data('vboxSystemProperties').minGuestRAM),'max':parseInt($('#vboxSettingsDialog').data('vboxHostDetails').memorySize)});
-$('#vboxSettingsSystemProcessor').slider({'min':1,'max':$('#vboxSettingsDialog').data('vboxHostDetails').cpus.length});
-$('#vboxSettingsSystemProcessorCap').slider({'min':1,'max':100});
-
-
-/* Disable PAE if it is unsupported */
-if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.PAE) {
- $('#vboxSettingsSystemPAERow span').addClass('disabled');
- document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked = false;
- document.forms['frmVboxSettings'].vboxSettingsSystemPAE.disabled = true;
-}
-
-/* Set CPUs to 1 and disable if host cpu does not support HWVirtEx */
-if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx) {
- var pt = $('#vboxSettingsSystemProcessor').slider('value',1).slider('disable').closest('table');
- pt.find('span').addClass('disabled');
- pt.find('input').prop('disabled',true);
-}
-
-/** @def VBOX_WITH_PAGE_SHARING
- * Enables the page sharing code.
- * @remarks This must match GMMR0Init; currently we only support page fusion on
- * all 64-bit hosts except Mac OS X */
-if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures['Long Mode (64-bit)'] || $('#vboxSettingsDialog').data('vboxHostDetails').operatingSystem.toLowerCase().search("darwin") >-1) {
- $(document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion).prop({'checked':false,'disabled':true}).siblings().addClass('disabled');
-}
-
-
-/*
- *
- * Ordered lists (Boot order)
- *
- */
-
-$("#vboxVMBootOrder").find("input.imgMvUp").click(function() {
-
- var list = $('#vboxVMBootOrderList').children('li');
-
- for(var i = 0; i < list.length; i++ ) {
- if(list[i].className == 'vboxListItemSelected') {
- if(i == 0) return;
- var mv = $(list[i]).detach();
- $(list[(i-1)]).before(mv);
- i = list.length;
- mv.click();
- }
- }
-
-});
-
-$("#vboxVMBootOrder").find("input.imgMvDn").click(function() {
-
- var list = $('#vboxVMBootOrderList').children('li');
-
- for(var i = 0; i < list.length; i++ ) {
-
- if(list[i].className == 'vboxListItemSelected') {
- if(i == (list.length - 1)) return;
- var mv = $(list[i]).detach();
- $(list[(i+1)]).after(mv);
- i = list.length;
- mv.click();
- }
- }
-
-});
-
-// Preload up / down images
-var a = new Image();
-a.src = "images/vbox/list_movedown_16px.png";
-var b = new Image();
-b.src = "images/vbox/list_moveup_16px.png";
-
-
-/* Update values when data is loaded */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
- /* System Default values from VM*/
- $('#vboxSettingsSystemMemory').slider('value', parseInt($('#vboxSettingsDialog').data('vboxMachineData').memorySize));
- document.forms['frmVboxSettings'].vboxSettingsSystemIOAPIC.checked = $('#vboxSettingsDialog').data('vboxMachineData').BIOSSettings.IOAPICEnabled;
- document.forms['frmVboxSettings'].vboxSettingsSystemEFI.checked = ($('#vboxSettingsDialog').data('vboxMachineData').firmwareType == 'EFI');
- document.forms['frmVboxSettings'].vboxSettingsSystemRTCUseUTC.checked = ($('#vboxSettingsDialog').data('vboxMachineData').RTCUseUTC);
- $('#vboxSettingsSystemProcessor').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').CPUCount));
- $('#vboxSettingsSystemProcessorCap').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').CPUExecutionCap));
- document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked = ($('#vboxSettingsDialog').data('vboxMachineData').CpuProperties.PAE);
- document.forms['frmVboxSettings'].settingsSystemVT.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled);
- document.forms['frmVboxSettings'].settingsSystemPaging.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.NestedPaging);
-
- $(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).val($('#vboxSettingsDialog').data('vboxMachineData').paravirtProvider);
-
- $(document.forms['frmVboxSettings'].settingsSystemVT).triggerHandler('click');
-
-
- /* Only if acceleration config is enabled */
- if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
-
- document.forms['frmVboxSettings'].vboxSettingsSystemHPET.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HPETEnabled);
- document.forms['frmVboxSettings'].vboxSettingsSystemDisableHostTimeSync.checked = ($('#vboxSettingsDialog').data('vboxMachineData').disableHostTimeSync);
- document.forms['frmVboxSettings'].settingsSystemLargePages.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.LargePages);
- document.forms['frmVboxSettings'].settingsSystemUnrestrictedExecution.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.UnrestrictedExecution);
- document.forms['frmVboxSettings'].settingsSystemVPID.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.VPID);
- document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion.checked = ($('#vboxSettingsDialog').data('vboxMachineData').pageFusionEnabled);
-
- $('#vboxSettingsTabSystemMotherboard').find('tr.vboxSettingsSystemAdvancedOnly').css('display','');
- $('#vboxSettingsTabSystemAcceleration').find('tr.vboxSettingsSystemAdvancedOnly').css('display','');
-
-
- /* Else, remove advanced settings */
- } else {
- $('#vboxSettingsTabSystemMotherboard').find('tr.vboxSettingsSystemAdvancedOnly').css('display','none');
- $('#vboxSettingsTabSystemAcceleration').find('tr.vboxSettingsSystemAdvancedOnly').css('display','none');
- }
-
- /* Boot Order */
- var bootItems = {};
- var bootList = $('#vboxVMBootOrderList');
- $(bootList).children('li').each(function(){
- bootItems[$(this).attr('id')] = $(this).detach();
- });
- for(var i in $('#vboxSettingsDialog').data('vboxMachineData').bootOrder) {
- if(!isNaN(i)) {
- $(bootList).append(bootItems[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]]);
- document.forms['frmVboxSettings'].elements['vboxSettingsBoot' + $('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]].checked = true;
- }
- delete bootItems[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]];
- }
- for(var i in bootItems) {
- if(typeof i == 'function') continue;
- $(bootList).append(bootItems[i]);
- delete bootItems[i];
- }
- $(bootList).children().hoverClass('vboxHover');
-
-
-
- /* Hide Chipset selection if we didn't get one, or VirtualBox version is 4.0.0 A safeguard */
- if(!$('#vboxSettingsDialog').data('vboxMachineData').chipsetType) {
- $('#vboxSettingsSystemChipsetRow').css('display','none');
- } else {
- $('#vboxSettingsSystemChipsetRow').css('display','');
- $(document.forms['frmVboxSettings'].vboxSettingsSystemChipset).val($('#vboxSettingsDialog').data('vboxMachineData').chipsetType);
- }
-
-
- // Full editing not enabled
- var p = $('#vboxSettingsTabSystemMotherboard').parent().children('div');
- var t = $('#vboxVMBootOrder');
-
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
-
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
- $('#vboxSettingsSystemMemory').slider('disable');
- $('#vboxSettingsSystemProcessor').slider('disable');
-
- t.find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup_disabled_16px.png)');
- t.find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown_disabled_16px.png)');
- t.find('img').each(function(){
- $(this).prop('src',$(this).prop('src').replace('_16','_disabled_16'));
- });
-
- $("#vboxVMBootOrderList").children("li").unbind('click');
-
- } else {
-
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
- $('#vboxSettingsSystemMemory').slider('enable');
- $('#vboxSettingsSystemProcessor').slider('enable');
-
- t.find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup_16px.png)');
- t.find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown_16px.png)');
- t.find('img').each(function(){
- $(this).prop('src',$(this).prop('src').replace('_disabled_16','_16'));
- });
-
- $("#vboxVMBootOrderList").children("li").click(function() {
-
- // Update class
- $(this).siblings().prop('className','vboxListItem');
- $(this).prop('className','vboxListItemSelected');
-
- var isFirst = ($(this).parent().children().first().attr('id') == $(this).attr('id'));
- var isLast = ($(this).parent().children().last().attr('id') == $(this).attr('id'));
-
- // update buttons
- $(this).closest("table").find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup' + (isFirst ? '_disabled' : '') + '_16px.png)').prop('disabled', isFirst);
- $(this).closest("table").find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown' + (isLast ? '_disabled' : '') + '_16px.png)').prop('disabled', isLast);
-
- }).first().trigger('click');
-
- }
-
-});
-
-/* Disable non-editable items when VM is running */
-$('#vboxSettingsDialog').one('show',function(){
-
- // Are virtualExtensions supported by the cpu?
- if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx && !$('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled) {
-
- $('#vboxSettingsTabSystemAcceleration').find('input.vboxSettingsAccelRequired').prop('disabled', true);
- $('#vboxSettingsTabSystemAcceleration').find('.vboxSettingsAccelRequired').addClass('vboxDisabled');
- }
-
-
-});
-
-
-/* Change general settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- $('#vboxSettingsDialog').data('vboxMachineData').memorySize = parseInt(document.forms['frmVboxSettings'].vboxSettingsSystemMemoryValue.value);
- $('#vboxSettingsDialog').data('vboxMachineData').BIOSSettings.IOAPICEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemIOAPIC.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').firmwareType = (document.forms['frmVboxSettings'].vboxSettingsSystemEFI.checked ? 'EFI' : 'BIOS');
- $('#vboxSettingsDialog').data('vboxMachineData').CPUCount = parseInt($('#vboxSettingsSystemProcessor').slider('value'));
- $('#vboxSettingsDialog').data('vboxMachineData').CPUExecutionCap = parseInt($('#vboxSettingsSystemProcessorCap').slider('value'));
- $('#vboxSettingsDialog').data('vboxMachineData').CpuProperties.PAE = document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').RTCUseUTC = document.forms['frmVboxSettings'].vboxSettingsSystemRTCUseUTC.checked;
-
- /* Only if we had a chipset */
- if($('#vboxSettingsDialog').data('vboxMachineData').chipsetType)
- $('#vboxSettingsDialog').data('vboxMachineData').chipsetType = $(document.forms['frmVboxSettings'].vboxSettingsSystemChipset).val();
-
- if($('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx || $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled || $('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled = document.forms['frmVboxSettings'].settingsSystemVT.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.NestedPaging = $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemPaging.checked;
- }
-
- $('#vboxSettingsDialog').data('vboxMachineData').paravirtProvider = $(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).val();
-
- /* Only if advanced config is enabled */
- if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- $('#vboxSettingsDialog').data('vboxMachineData').pageFusionEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').HPETEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemHPET.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').disableHostTimeSync = document.forms['frmVboxSettings'].vboxSettingsSystemDisableHostTimeSync.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.LargePages = document.forms['frmVboxSettings'].settingsSystemLargePages.checked;
- $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.UnrestrictedExecution = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemUnrestrictedExecution.checked ? true : false);
- $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.VPID = $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemVPID.checked;
- }
-
- // Boot order
- $('#vboxSettingsDialog').data('vboxMachineData').bootOrder = new Array();
- $('#vboxVMBootOrderList').find('input').each(function(){
- if(!$(this).prop('checked')) return;
- $('#vboxSettingsDialog').data('vboxMachineData').bootOrder[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder.length] = $(this).attr('name').substring(16);
- });
-
-});
-
-
-
-</script>
+<!--
+
+ VM System Settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsSystem.html 597 2015-04-20 11:41:28Z imoore76 $
+
+-->
+
+<ul>
+ <li><a href="#vboxSettingsTabSystemMotherboard"><span class='translate'>Motherboard</span></a></li>
+ <li><a href="#vboxSettingsTabSystemProcessor"><span class='translate'>Processor</span></a></li>
+ <li><a href="#vboxSettingsTabSystemAcceleration"><span class='translate'>Acceleration</span></a></li>
+</ul>
+
+<!-- Motherboard Tab -->
+<div id='vboxSettingsTabSystemMotherboard' title='Motherboard'>
+<table style='width: 100%'>
+ <tr>
+ <th style='text-align:right'><span class='translate'>Base Memory:</span></th>
+ <td style='width: 100%; white-space: nowrap'>
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='vboxSettingsSystemMemory' class='slider'><div class='sliderScale'></div></div>
+ </td>
+ <td><input type='text' class='vboxText sliderValue' name='vboxSettingsSystemMemoryValue' size='5' /> <span class='translate'>MB</span></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 class='vboxSliderMin'>%1 MB</span></td>
+ <td style='text-align: right;'><span class='vboxSliderMax'>%1 MB</span></td>
+ </tr>
+ </table>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemPageFusion' /> <span class='translate'>Enable Page Fusion</span></label></td>
+ </tr>
+ <tr style='vertical-align: top'>
+ <th style='text-align:right'><span class='translate'>Boot Order:</span></th>
+ <td>
+ <table id='vboxVMBootOrder'>
+ <tr style='vertical-align: top'>
+ <td style='width: auto'>
+ <ul class='vboxList vboxHover vboxBordered' id='vboxVMBootOrderList' style='margin: 0px; padding: 2px; white-space: nowrap; width: 200px'>
+ <li id='HardDisk'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootHardDisk' /> <img src="images/vbox/hd_16px.png" /> <span class='vboxBootOrderDevice'>HardDisk</span></li>
+ <li id='DVD'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootDVD' /> <img src="images/vbox/cd_16px.png" /> <span class='vboxBootOrderDevice'>DVD</span></li>
+ <li id='Floppy'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootFloppy' /> <img src="images/vbox/fd_16px.png" /> <span class='vboxBootOrderDevice'>Floppy</span></li>
+ <li id='Network'><input type='checkbox' class='vboxCheckbox' name='vboxSettingsBootNetwork' /> <img src="images/vbox/nw_16px.png" /> <span class='vboxBootOrderDevice'>Network</span></li>
+ </ul>
+ </td>
+ <td style='text-align: left; width: 100%'>
+ <input disabled='disabled' class="imgMvUp vboxImgButton" style='background: url(images/vbox/list_moveup_disabled_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
+ <br />
+ <input disabled='disabled' class="imgMvDn vboxImgButton" style='background: url(images/vbox/list_movedown_disabled_16px.png) 1px 1px no-repeat; width: 18px; height: 18px; vertical-align:bottom' type="button" value="" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr id='vboxSettingsSystemChipsetRow'>
+ <th style='text-align:right'><span class='translate'>Chipset:</span></th>
+ <td><select name='vboxSettingsSystemChipset'>
+ <option value='PIIX3'>PIIX3</option>
+ <option value='ICH9'>ICH9</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th style='text-align:right'><span class='translate'>Extended Features:</span></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemIOAPIC' /> <span class='translate'>Enable I/O APIC</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemEFI' /> <span class='translate'>Enable EFI (special OSes only)</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemRTCUseUTC' /> <span class='translate'>Hardware Clock in UTC Time</span></label></td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemDisableHostTimeSync' /> <span class='translate'>Disable host time sync</span></label></td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemHPET' /> <span class='translate'>HPET (high precision event timer)</span></label></td>
+ </tr>
+
+</table>
+</div>
+
+<!-- Processor Tab -->
+<div id='vboxSettingsTabSystemProcessor' title='Processors'>
+<table style='width: 100%'>
+ <tr>
+ <th style='text-align:right'><span class='translate'>Processor(s):</span></th>
+ <td style='width: 100%; white-space: nowrap'>
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='vboxSettingsSystemProcessor' class='slider'><div class='sliderScale'></div></div>
+ </td>
+ <td><input type='text' class='vboxText' name='vboxSettingsSystemProcessorValue' size='2' 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 class='vboxSliderMin'>%1 CPU</span></td>
+ <td style='text-align: right;'><span class='vboxSliderMax'>%1 CPUs</span></td>
+ </tr>
+ </table>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+ <tr class='vboxRunningEnabled'>
+ <th style='text-align:right'><span class='translate'>Execution Cap:</span></th>
+ <td style='width: 100%; white-space: nowrap'>
+ <table style='width: 100%'>
+ <tr class='vboxRunningEnabled'>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='vboxSettingsSystemProcessorCap' class='slider'><div class='sliderScale'></div></div>
+ </td>
+ <td><input type='text' class='vboxText vboxRunningEnabled' name='vboxSettingsSystemProcessorCapValue' size='3' class='sliderValue' /></td>
+ </tr>
+ <tr style='vertical-align: top;' class='vboxRunningEnabled'>
+ <td style='border: 0px; margin: 0px; padding: 0px;'>
+ <table style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <tr style='vertical-align: top' class='vboxRunningEnabled'>
+ <td style='text-align: left;'><span class='vboxSliderMin' title='Min CPU execution cap in %'>%1%</span></td>
+ <td style='text-align: right;'><span class='vboxSliderMax' title='Max CPU execution cap in %'>%1%</span></td>
+ </tr>
+ </table>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+
+ <tr id='vboxSettingsSystemPAERow'>
+ <th><span class='translate'>Extended Features:</span></th>
+ <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsSystemPAE' /> <span class='translate'>Enable PAE/NX</span></label></td>
+ </tr>
+</table>
+</div>
+
+<!-- Acceleration Tab -->
+<div id='vboxSettingsTabSystemAcceleration' title='Acceleration'>
+<table>
+ <tr>
+ <th class='vboxEnablerIgnore'><span class='translate'>Paravirtualization Interface:</span></th>
+ <td><select name='vboxSettingsParavirtInterface' class='vboxEnablerIgnore'>
+ <option value='None'>None</option>
+ <option value='Default'>Default</option>
+ <option value='Legacy'>Legacy</option>
+ <option value='Minimal'>Minimal</option>
+ <option value='HyperV'>HyperV</option>
+ <option value='KVM'>KVM</option>
+ </select></td>
+ <tr>
+ <th style='text-align:right' class='vboxEnablerIgnore vboxSettingsAccelRequired'><span class='translate'>Hardware Virtualization:</span></th>
+ <td style='width:100%'><label><input type='checkbox' name='settingsSystemVT' class='vboxEnablerCheckbox vboxSettingsAccelRequired'/>
+ <span class='translate vboxSettingsAccelRequired'>Enable VT-x/AMD-V</span></label></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' name='settingsSystemPaging' class='vboxEnablerListen' /> <span class='translate vboxEnablerListen'>Enable Nested Paging</span></label></td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' name='settingsSystemLargePages' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable Large Pages</span></label></td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' name='settingsSystemUnrestrictedExecution' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable VT-x unrestricted execution</span></label></td>
+ </tr>
+ <tr class='vboxSettingsSystemAdvancedOnly'>
+ <th></th>
+ <td><label><input type='checkbox' name='settingsSystemVPID' class='vboxEnablerListen'/> <span class='translate vboxEnablerListen'>Enable VT-x VPID (Intel only)</span></label></td>
+ </tr>
+</table>
+</div>
+
+
+<script type='text/javascript'>
+
+/* Boot order devices */
+$('#vboxVMBootOrder').find("span.vboxBootOrderDevice").html(function(i,h){return trans(vboxDevice(h),'VBoxGlobal');});
+
+/* Chipsets */
+$('#vboxSettingsSystemChipsetRow').find('option').html(function(i,h){return trans(h,'VBoxGlobal');});
+
+/* Paravirtualization providers */
+$(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).find('option').html(function(i,h){return trans(h,'VBoxGlobal', 'ParavirtProvider');});
+
+$('#vboxSettingsSystemMemory').data('form','frmVboxSettings');
+$('#vboxSettingsSystemProcessor').data('form','frmVboxSettings');
+$('#vboxSettingsSystemProcessorCap').data('form','frmVboxSettings');
+$('#vboxSettingsSystemMemory').slider({'min':parseInt($('#vboxPane').data('vboxSystemProperties').minGuestRAM),'max':parseInt($('#vboxSettingsDialog').data('vboxHostDetails').memorySize)});
+$('#vboxSettingsSystemProcessor').slider({'min':1,'max':$('#vboxSettingsDialog').data('vboxHostDetails').cpus.length});
+$('#vboxSettingsSystemProcessorCap').slider({'min':1,'max':100});
+
+
+/* Disable PAE if it is unsupported */
+if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.PAE) {
+ $('#vboxSettingsSystemPAERow span').addClass('disabled');
+ document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked = false;
+ document.forms['frmVboxSettings'].vboxSettingsSystemPAE.disabled = true;
+}
+
+/* Set CPUs to 1 and disable if host cpu does not support HWVirtEx */
+if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx) {
+ var pt = $('#vboxSettingsSystemProcessor').slider('value',1).slider('disable').closest('table');
+ pt.find('span').addClass('disabled');
+ pt.find('input').prop('disabled',true);
+}
+
+/** @def VBOX_WITH_PAGE_SHARING
+ * Enables the page sharing code.
+ * @remarks This must match GMMR0Init; currently we only support page fusion on
+ * all 64-bit hosts except Mac OS X */
+if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures['Long Mode (64-bit)'] || $('#vboxSettingsDialog').data('vboxHostDetails').operatingSystem.toLowerCase().search("darwin") >-1) {
+ $(document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion).prop({'checked':false,'disabled':true}).siblings().addClass('disabled');
+}
+
+
+/*
+ *
+ * Ordered lists (Boot order)
+ *
+ */
+
+$("#vboxVMBootOrder").find("input.imgMvUp").click(function() {
+
+ var list = $('#vboxVMBootOrderList').children('li');
+
+ for(var i = 0; i < list.length; i++ ) {
+ if(list[i].className == 'vboxListItemSelected') {
+ if(i == 0) return;
+ var mv = $(list[i]).detach();
+ $(list[(i-1)]).before(mv);
+ i = list.length;
+ mv.click();
+ }
+ }
+
+});
+
+$("#vboxVMBootOrder").find("input.imgMvDn").click(function() {
+
+ var list = $('#vboxVMBootOrderList').children('li');
+
+ for(var i = 0; i < list.length; i++ ) {
+
+ if(list[i].className == 'vboxListItemSelected') {
+ if(i == (list.length - 1)) return;
+ var mv = $(list[i]).detach();
+ $(list[(i+1)]).after(mv);
+ i = list.length;
+ mv.click();
+ }
+ }
+
+});
+
+// Preload up / down images
+var a = new Image();
+a.src = "images/vbox/list_movedown_16px.png";
+var b = new Image();
+b.src = "images/vbox/list_moveup_16px.png";
+
+
+/* Update values when data is loaded */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ /* System Default values from VM*/
+ $('#vboxSettingsSystemMemory').slider('value', parseInt($('#vboxSettingsDialog').data('vboxMachineData').memorySize));
+ document.forms['frmVboxSettings'].vboxSettingsSystemIOAPIC.checked = $('#vboxSettingsDialog').data('vboxMachineData').BIOSSettings.IOAPICEnabled;
+ document.forms['frmVboxSettings'].vboxSettingsSystemEFI.checked = ($('#vboxSettingsDialog').data('vboxMachineData').firmwareType == 'EFI');
+ document.forms['frmVboxSettings'].vboxSettingsSystemRTCUseUTC.checked = ($('#vboxSettingsDialog').data('vboxMachineData').RTCUseUTC);
+ $('#vboxSettingsSystemProcessor').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').CPUCount));
+ $('#vboxSettingsSystemProcessorCap').slider('value',parseInt($('#vboxSettingsDialog').data('vboxMachineData').CPUExecutionCap));
+ document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked = ($('#vboxSettingsDialog').data('vboxMachineData').CpuProperties.PAE);
+ document.forms['frmVboxSettings'].settingsSystemVT.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled);
+ document.forms['frmVboxSettings'].settingsSystemPaging.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.NestedPaging);
+
+ $(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).val($('#vboxSettingsDialog').data('vboxMachineData').paravirtProvider);
+
+ $(document.forms['frmVboxSettings'].settingsSystemVT).triggerHandler('click');
+
+
+ /* Only if acceleration config is enabled */
+ if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+
+ document.forms['frmVboxSettings'].vboxSettingsSystemHPET.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HPETEnabled);
+ document.forms['frmVboxSettings'].vboxSettingsSystemDisableHostTimeSync.checked = ($('#vboxSettingsDialog').data('vboxMachineData').disableHostTimeSync);
+ document.forms['frmVboxSettings'].settingsSystemLargePages.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.LargePages);
+ document.forms['frmVboxSettings'].settingsSystemUnrestrictedExecution.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.UnrestrictedExecution);
+ document.forms['frmVboxSettings'].settingsSystemVPID.checked = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.VPID);
+ document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion.checked = ($('#vboxSettingsDialog').data('vboxMachineData').pageFusionEnabled);
+
+ $('#vboxSettingsTabSystemMotherboard').find('tr.vboxSettingsSystemAdvancedOnly').css('display','');
+ $('#vboxSettingsTabSystemAcceleration').find('tr.vboxSettingsSystemAdvancedOnly').css('display','');
+
+
+ /* Else, remove advanced settings */
+ } else {
+ $('#vboxSettingsTabSystemMotherboard').find('tr.vboxSettingsSystemAdvancedOnly').css('display','none');
+ $('#vboxSettingsTabSystemAcceleration').find('tr.vboxSettingsSystemAdvancedOnly').css('display','none');
+ }
+
+ /* Boot Order */
+ var bootItems = {};
+ var bootList = $('#vboxVMBootOrderList');
+ $(bootList).children('li').each(function(){
+ bootItems[$(this).attr('id')] = $(this).detach();
+ });
+ for(var i in $('#vboxSettingsDialog').data('vboxMachineData').bootOrder) {
+ if(!isNaN(i)) {
+ $(bootList).append(bootItems[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]]);
+ document.forms['frmVboxSettings'].elements['vboxSettingsBoot' + $('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]].checked = true;
+ }
+ delete bootItems[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder[i]];
+ }
+ for(var i in bootItems) {
+ if(typeof i == 'function') continue;
+ $(bootList).append(bootItems[i]);
+ delete bootItems[i];
+ }
+ $(bootList).children().hoverClass('vboxHover');
+
+
+
+ /* Hide Chipset selection if we didn't get one, or VirtualBox version is 4.0.0 A safeguard */
+ if(!$('#vboxSettingsDialog').data('vboxMachineData').chipsetType) {
+ $('#vboxSettingsSystemChipsetRow').css('display','none');
+ } else {
+ $('#vboxSettingsSystemChipsetRow').css('display','');
+ $(document.forms['frmVboxSettings'].vboxSettingsSystemChipset).val($('#vboxSettingsDialog').data('vboxMachineData').chipsetType);
+ }
+
+
+ // Full editing not enabled
+ var p = $('#vboxSettingsTabSystemMotherboard').parent().children('div');
+ var t = $('#vboxVMBootOrder');
+
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
+ $('#vboxSettingsSystemMemory').slider('disable');
+ $('#vboxSettingsSystemProcessor').slider('disable');
+
+ t.find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup_disabled_16px.png)');
+ t.find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown_disabled_16px.png)');
+ t.find('img').each(function(){
+ $(this).prop('src',$(this).prop('src').replace('_16','_disabled_16'));
+ });
+
+ $("#vboxVMBootOrderList").children("li").unbind('click');
+
+ } else {
+
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
+ $('#vboxSettingsSystemMemory').slider('enable');
+ $('#vboxSettingsSystemProcessor').slider('enable');
+
+ t.find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup_16px.png)');
+ t.find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown_16px.png)');
+ t.find('img').each(function(){
+ $(this).prop('src',$(this).prop('src').replace('_disabled_16','_16'));
+ });
+
+ $("#vboxVMBootOrderList").children("li").click(function() {
+
+ // Update class
+ $(this).siblings().prop('className','vboxListItem');
+ $(this).prop('className','vboxListItemSelected');
+
+ var isFirst = ($(this).parent().children().first().attr('id') == $(this).attr('id'));
+ var isLast = ($(this).parent().children().last().attr('id') == $(this).attr('id'));
+
+ // update buttons
+ $(this).closest("table").find('input.imgMvUp').css('background-image', 'url(images/vbox/list_moveup' + (isFirst ? '_disabled' : '') + '_16px.png)').prop('disabled', isFirst);
+ $(this).closest("table").find('input.imgMvDn').css('background-image', 'url(images/vbox/list_movedown' + (isLast ? '_disabled' : '') + '_16px.png)').prop('disabled', isLast);
+
+ }).first().trigger('click');
+
+ }
+
+});
+
+/* Disable non-editable items when VM is running */
+$('#vboxSettingsDialog').one('show',function(){
+
+ // Are virtualExtensions supported by the cpu?
+ if(!$('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx && !$('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled) {
+
+ $('#vboxSettingsTabSystemAcceleration').find('input.vboxSettingsAccelRequired').prop('disabled', true);
+ $('#vboxSettingsTabSystemAcceleration').find('.vboxSettingsAccelRequired').addClass('vboxDisabled');
+ }
+
+
+});
+
+
+/* Change general settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ $('#vboxSettingsDialog').data('vboxMachineData').memorySize = parseInt(document.forms['frmVboxSettings'].vboxSettingsSystemMemoryValue.value);
+ $('#vboxSettingsDialog').data('vboxMachineData').BIOSSettings.IOAPICEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemIOAPIC.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').firmwareType = (document.forms['frmVboxSettings'].vboxSettingsSystemEFI.checked ? 'EFI' : 'BIOS');
+ $('#vboxSettingsDialog').data('vboxMachineData').CPUCount = parseInt($('#vboxSettingsSystemProcessor').slider('value'));
+ $('#vboxSettingsDialog').data('vboxMachineData').CPUExecutionCap = parseInt($('#vboxSettingsSystemProcessorCap').slider('value'));
+ $('#vboxSettingsDialog').data('vboxMachineData').CpuProperties.PAE = document.forms['frmVboxSettings'].vboxSettingsSystemPAE.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').RTCUseUTC = document.forms['frmVboxSettings'].vboxSettingsSystemRTCUseUTC.checked;
+
+ /* Only if we had a chipset */
+ if($('#vboxSettingsDialog').data('vboxMachineData').chipsetType)
+ $('#vboxSettingsDialog').data('vboxMachineData').chipsetType = $(document.forms['frmVboxSettings'].vboxSettingsSystemChipset).val();
+
+ if($('#vboxSettingsDialog').data('vboxHostDetails').cpuFeatures.HWVirtEx || $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled || $('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled = document.forms['frmVboxSettings'].settingsSystemVT.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.NestedPaging = $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemPaging.checked;
+ }
+
+ $('#vboxSettingsDialog').data('vboxMachineData').paravirtProvider = $(document.forms['frmVboxSettings'].vboxSettingsParavirtInterface).val();
+
+ /* Only if advanced config is enabled */
+ if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ $('#vboxSettingsDialog').data('vboxMachineData').pageFusionEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemPageFusion.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').HPETEnabled = document.forms['frmVboxSettings'].vboxSettingsSystemHPET.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').disableHostTimeSync = document.forms['frmVboxSettings'].vboxSettingsSystemDisableHostTimeSync.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.LargePages = document.forms['frmVboxSettings'].settingsSystemLargePages.checked;
+ $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.UnrestrictedExecution = ($('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemUnrestrictedExecution.checked ? true : false);
+ $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.VPID = $('#vboxSettingsDialog').data('vboxMachineData').HWVirtExProperties.Enabled && document.forms['frmVboxSettings'].settingsSystemVPID.checked;
+ }
+
+ // Boot order
+ $('#vboxSettingsDialog').data('vboxMachineData').bootOrder = new Array();
+ $('#vboxVMBootOrderList').find('input').each(function(){
+ if(!$(this).prop('checked')) return;
+ $('#vboxSettingsDialog').data('vboxMachineData').bootOrder[$('#vboxSettingsDialog').data('vboxMachineData').bootOrder.length] = $(this).attr('name').substring(16);
+ });
+
+});
+
+
+
+</script>
diff --git a/panes/settingsUSB.html b/panes/settingsUSB.html
index a00c495..330d461 100644
--- a/panes/settingsUSB.html
+++ b/panes/settingsUSB.html
@@ -1,414 +1,414 @@
-<!--
-
- USB port settings
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: settingsUSB.html 597 2015-04-20 11:41:28Z imoore76 $
-
- -->
-<table id='vboxSettingsUSBTable' style='width: 100%'>
- <tr>
- <td><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsUSBEnabled' /> <span class='translate'>Enable USB Controller</span></label></td>
- </tr>
- <tr>
- <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='OHCI'/> <span class='translate vboxEnablerListen'>USB 1.1 (OHCI) Controller</span></label></td>
- </tr>
- <tr>
- <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='EHCI'/> <span class='translate vboxEnablerListen'>USB 2.0 (EHCI) Controller</span></label></td>
- </tr>
- <tr>
- <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='XHCI'/> <span class='translate vboxEnablerListen'>USB 3.0 (xHCI) Controller</span></label></td>
- </tr>
- <tr style='vertical-align: middle' class='vboxRunningEnabled'>
- <td style='width: 100%; padding-left: 20px;'>
- <table class='vboxSettingsHeadingLine' style='width:100%;border-spacing:0;border:0px;margin:0px;padding:0px;'><tr style='vertical-align:middle' class='vboxRunningEnabled'><td style='white-space: nowrap; width: auto'><span class='translate vboxEnablerListen'>USB Device Filters</span></td><td style='width: 100%'><hr style='width: 100%;' class='vboxSeparatorLine'/></td></tr></table>
- </td>
- </tr>
- <tr class='vboxRunningEnabled'>
- <td style='width: 100%; padding-left: 20px;'>
- <table style='width: 100%'>
- <tr class='vboxRunningEnabled'>
- <td id='vboxSettingsUSBFilters' style='width: 100%;' class='vboxBordered vboxEnablerListen'>
- <!-- Hidden div for context menu -->
- <div id='vboxSettingsUSBAddDeviceClick' style='display: none' />
- <ul id='vboxSettingsUSBFilterList' class='vboxList vboxHover' style='width: 100%'>
- <li class='vboxListItem'><input type='checkbox' class='vboxCheckbox' />a</li>
- </ul>
- </td>
- <td id='vboxSettingsUSBButtons' class='vboxEnablerListen'></td>
- </tr>
- </table>
- </td>
- </tr>
-
-</table>
-<script type='text/javascript'>
-
-/*
- * USB Buttons and Toolbar
- */
-
-//Translations
- $('#vboxSettingsTabPortsUSB').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsUSB');}).removeClass('translate');
-
-
- var sButtons = new Array(
-
- {
- 'name' : 'usbnew',
- 'label' : 'Add Empty Filter',
- 'icon' : 'usb_new',
- 'click' : function () {
- var list = $('#vboxSettingsUSBFilterList');
- var currUsbName = 1;
- for(; currUsbName < 99; currUsbName++) {
- if(!$(list).find('span.vboxSettingsUSBFilterTitle').filter(function(){
- return ($(this).text() == trans('New Filter %1','UIMachineSettingsUSB').replace('%1',currUsbName));
- }).length) break;
- }
-
- vboxSettingsAddUSBFilter({'active':1,'name':trans('New Filter %1','UIMachineSettingsUSB').replace('%1',currUsbName)});
-
- if(!$('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click').html()) {
- $('#vboxSettingsUSBFilterList').trigger('select',null); }
- }
- },
-
- {
- 'name' : 'usbnewdevice',
- 'label' : 'Add Filter From Device',
- 'icon' : 'usb_add',
- 'click' : function (e) {
-
- // Update menu
- var menu = $("#vboxSettingsUSBAddDevice");
-
- menu.children().remove();
- menu.append($('<li />').html('<span><img src="images/jqueryFileTree/spinner.gif" /></span>').css({'width':'100px','text-align':'center'}));
-
- var l = new vboxLoader();
- l.add('hostGetUSBDevices',function(res){
-
- var hostUSB = res.responseData;
-
- $(menu).children().remove();
- for(var i = 0; i < hostUSB.length; i++) {
-
- var dname = '';
- if(!hostUSB[i].product)
- dname = trans('Unknown device %1:%2','VBoxGlobal').replace('%1',hostUSB[i].vendorId).replace('%2',hostUSB[i].productId);
- else
- dname = hostUSB[i].manufacturer + ' ' + hostUSB[i].product;
- dname += ' [' + hostUSB[i].revision + ']';
-
- $(menu).append($('<li />').append($('<a />').attr({'href':'#usbDev'+i}).html(dname).data({'device':hostUSB[i]})));
- }
-
- // No devices?
- if(hostUSB.length == 0) {
- $(menu).append($('<li />').append($('<a />').attr({'href':'#usbNoop'}).html($('<div />').text(trans('<no devices available>','VBoxUSBMenu')).html()).data({'device':hostUSB[i]})));
- }
- $(menu).trigger('menuLoaded');
-
- vboxPositionToWindow(menu);
-
- },{});
- l.noLoadingScreen = true;
- l.run();
-
- // Trigger mouse up / down on hidden element
-
- var md = jQuery.Event("mousedown");
- var mu = jQuery.Event("mouseup");
- for(var i in e) { (md[i] ? null : md[i] = mu[i] = e[i]); }
- // Fix mouse button for MSIE
- if(jQuery.browser.msie && e.button == 0) md.button = mu.button = 1;
-
-
- $("#vboxSettingsUSBAddDeviceClick").trigger(md).trigger(mu);
- }
- },
-
- {
- 'name' : 'usbedit',
- 'label' : 'Edit Filter',
- 'icon' : 'usb_filter_edit',
- 'enabled' : function (item) { return (item && $(item).data('filter') && $(item).data('filter').name); },
- 'click' : function () {
-
- var d = $('<div />').attr({'id':'vboxSettingsUSBFilterEdit','style':'display: none','class':'vboxNonTabbed vboxDialogContent'});
-
- var tbl = $('<table />').attr({'style':'width: 100%','class':'vboxSettingsTable'});
-
- var vboxSettingsUSBFilterProps = [
- ['Name','name'],['Vendor ID','vendorId'],['Product ID','productId'],
- ['Revision','revision'],['Manufacturer','manufacturer'],['Product','product'],
- ['Serial No.','serialNumber'],['Port','port']];
-
- /* Get Defaults */
- var filter = $('#vboxSettingsUSBFilterList').find('li.vboxListItemSelected').first().data('filter');
-
- for(var i = 0; i < vboxSettingsUSBFilterProps.length; i++) {
-
- var val = (filter[vboxSettingsUSBFilterProps[i][1]]||'');
- $('<tr />').append($('<th />').attr({'style':'white-space: nowrap; width: auto; text-align: right;'}).html(trans(vboxSettingsUSBFilterProps[i][0]+':','UIMachineSettingsUSBFilterDetails'))).append($('<td />').attr({'style':'width: 100%'}).html('<input type="text" class="vboxText" style="width: 100%" id="vboxSettingsUSBF'+vboxSettingsUSBFilterProps[i][1]+'" value="'+$('<div />').text((filter[vboxSettingsUSBFilterProps[i][1]]||'')).html()+'"/>')).appendTo(tbl);
- }
-
- // Generate select box
- var sel = $('<select />').attr({'id':'vboxSettingsUSBFRemote'});
- var opts = [['',trans('Any','UIMachineSettingsUSBFilterDetails')],['yes',trans('Yes','UIMachineSettingsUSBFilterDetails')],['no',trans('No','UIMachineSettingsUSBFilterDetails')]];
- for(var i = 0; i < opts.length; i++) {
- var o = new Option(opts[i][1],opts[i][0],((filter['remote']||'')==opts[i][0]));
- $(sel).prop('options').add(o);
- }
-
- $('<tr />').append($('<th />').attr({'style':'white-space: nowrap; width: auto; text-align: right;'}).html(trans('Remote:','UIMachineSettingsUSBFilterDetails'))).append($('<td />').attr({'style':'width: 100%'}).append(sel)).appendTo(tbl);
-
- $(d).append(tbl).appendTo($('#vboxPane'));
-
- var buttons = { };
- buttons[trans('OK','QIMessageBox')] = function() {
-
- var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
-
- for(var i = 0; i < vboxSettingsUSBFilterProps.length; i++) {
- $(item).data('filter')[vboxSettingsUSBFilterProps[i][1]] = $('#vboxSettingsUSBF'+(vboxSettingsUSBFilterProps[i][1])).val();
- }
- $(item).data('filter').remote = ($('#vboxSettingsUSBFRemote').val()||'');
- // Change display name
- $(item).find('span.vboxSettingsUSBFilterTitle').first().text($(item).data('filter').name);
- $('#vboxSettingsUSBFilterEdit').remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { $('#vboxSettingsUSBFilterEdit').remove(); };
-
-
- $('#vboxSettingsUSBFilterEdit').dialog({'buttons':buttons,'closeOnEscape':false,'width':400,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent vboxNonTabbed','title':'<img src="images/vbox/usb_16px.png" class="vboxDialogTitleIcon" /> '+trans('USB Filter Details','UIMachineSettingsUSBFilterDetails')});
-
- }
- },
-
- {
- 'name' : 'usbremove',
- 'label' : 'Remove Filter',
- 'icon' : 'usb_remove',
- 'enabled' : function (item) { return (item && $(item).data('filter') && $(item).data('filter').name); },
- 'click' : function () {
- var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
- // determine next target
- var target = $(item).next();
- if(!$(target).length) target = $(item).prev();
- if(!$(target).length) target = null;
- $(item).empty().remove();
-
- if(!$(target).trigger('click').length) {
- $('#vboxSettingsUSBFilterList').trigger('select',null);
- }
- vboxColorRows($('#vboxSettingsUSBFilterList'));
- }
- },
-
- {
- 'name' : 'usbup',
- 'label' : 'Move Filter Up',
- 'icon' : 'usb_moveup',
- 'enabled' : function (item) {
- return (item && $(item).data('filter') && $(item).data('filter').name && $(item).attr('id') != $('#vboxSettingsUSBFilterList').children().first().attr('id'));
- },
- 'click' : function () {
-
- var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
-
- var prev = $(item).prev();
- if(!$(prev).length) return;
- var mv = $(item).detach();
- $(prev).before(mv);
-
- vboxColorRows($('#vboxSettingsUSBFilterList'));
- $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click');
-
- }
- },
-
- {
- 'name' : 'usbdown',
- 'label' : 'Move Filter Down',
- 'icon' : 'usb_movedown',
- 'enabled' : function (item) {
- return (item && $(item).data('filter') && $(item).data('filter').name && $(item).attr('id') != $('#vboxSettingsUSBFilterList').children().last().attr('id'));
- },
- 'click' : function () {
-
- var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
-
- var next = $(item).next();
- if(!$(next).length) return;
- var mv = $(item).detach();
- $(next).after(mv);
-
- vboxColorRows($('#vboxSettingsUSBFilterList'));
- $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click');
- }
- }
-
-
- );
-
-var usbToolbar = new vboxToolbarSmall({buttons: sButtons,
- language_context: 'UIMachineSettingsUSB', renderTo: 'vboxSettingsUSBButtons'});
-
-$('#vboxSettingsUSBFilterList').on('select',function(e,el){usbToolbar.update(el);});
-
-
-
-/* Adds a USB filter to list */
-function vboxSettingsAddUSBFilter(f,noColor) {
-
- var li = $('<li />').data({'filter':f}).attr({'id':'vboxSettingsUSBFilterNumber' + (Math.floor(Math.random()*1000)),'class':'vboxListItem'});
-
- if(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled.checked) {
-
- li.click(function(){
- $(this).parent().children().removeClass('vboxListItemSelected');
- $(this).addClass('vboxListItemSelected');
- $('#vboxSettingsUSBFilterList').trigger('select',this);
- }).dblclick(function(e){
- e.preventDefault();
- usbToolbar.click('usbedit');
- }).hoverClass('vboxHover').disableSelection();
- }
-
- $('<input />').attr({'type':'checkbox'}).prop('checked',(f.active ? true : false)).appendTo(li);
-
- $(li).append(' <span class="vboxSettingsUSBFilterTitle">'+$('<div/>').text(f.name).html()+'</span>').appendTo($('#vboxSettingsUSBFilterList'));
-
-
- if(!noColor) vboxColorRows($('#vboxSettingsUSBFilterList'));
-}
-
-
-/* Menu for adding existing USB device */
-
-var exUsb = new vboxMenu({id: 'vboxSettingsUSBAddDevice', menuItems: []});
-
-/* Add attachment button menu initialization */
-$("#vboxSettingsUSBAddDeviceClick").contextMenu({
- menu: 'vboxSettingsUSBAddDevice',
- button: 0
- },
- function(action, el, pos, menuItem) {
-
- if(action == 'usbNoop') return;
-
- // usb data kept in elm
- var usb = $(menuItem).data('device');
- delete usb.port, usb.version, usb.portVersion;
- usb.name = $(menuItem).html();
- usb.active = 1;
-
- vboxSettingsAddUSBFilter(usb);
-
- $('#vboxSettingsUSBFilterList').trigger('select',$('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first());
-
- }
-);
-
-
-/*
- * USB data
- */
-$('#vboxSettingsDialog').on('dataLoaded',function(){
-
- // set checkboxes for USB and EHCI
- if($('#vboxSettingsDialog').data('vboxMachineData').USBControllers.length) {
-
- var usbType = 'OHCI';
- var enabled = false;
-
- for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').USBControllers.length; i++) {
- var listUSBType = $('#vboxSettingsDialog').data('vboxMachineData').USBControllers[i].type;
- if(listUSBType == 'OHCI') {
- enabled = true;
- }
- switch(listUSBType) {
- case 'OHCI':
- if(usbType == 'EHCI')
- break;
- case 'EHCI':
- if(usbType == 'XHCI')
- break;
- default:
- usbType = listUSBType;
- }
- }
- $(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled).prop('checked',enabled).triggerHandler('click');
-
- $(document.forms['frmVboxSettings']).find('input[value="'+usbType+'"]').prop('checked',true);
-
- } else {
- $(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled).prop('checked',false).triggerHandler('click');
- $(document.forms['frmVboxSettings']).find('input[value="OHCI"]').prop('checked',true);
- }
-
- // clear list
- var list = $('#vboxSettingsUSBFilterList');
- $(list).empty().children().remove();
-
- // add filters
- for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters.length; i++) {
- vboxSettingsAddUSBFilter($('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters[i],true);
- }
- vboxColorRows($('#vboxSettingsUSBFilterList'));
-
-
- if(!$('#vboxSettingsUSBFilterList').find('li.vboxListItem').first().trigger('click')) {
- $('#vboxSettingsUSBFilterList').trigger('select',null);
- }
-
- var p = $('#vboxSettingsUSBTable');
- if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
- } else {
- $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
- $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
- }
-});
-
-
-/* Change settings onSave() */
-$('#vboxSettingsDialog').on('save',function(){
-
- // get checkboxes for USB and EHCI
- var frmEnabled = document.forms['frmVboxSettings'].vboxSettingsUSBEnabled.checked;
-
- var frmType = $(document.forms['frmVboxSettings']).find('input[name="vboxSettingsUSBControllerType"]:checked').val();
-
- $('#vboxSettingsDialog').data('vboxMachineData').USBControllers = new Array();
-
- if(frmEnabled) {
- $('#vboxSettingsDialog').data('vboxMachineData').USBControllers = [{
- 'name': 'OHCI',
- 'type': 'OHCI'
- }];
- }
-
- if(frmType != 'OHCI') {
- $('#vboxSettingsDialog').data('vboxMachineData').USBControllers.push({
- 'name': frmType,
- 'type': frmType
- });
- }
-
- $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters = new Array();
-
- $('#vboxSettingsUSBFilterList').children('li').each(function(){
- $(this).data('filter').active = $(this).children('input:checkbox').first().prop('checked');
- $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters[$('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters.length] = $(this).data('filter');
- });
-
-});
-
-
-</script>
-
+<!--
+
+ USB port settings
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: settingsUSB.html 597 2015-04-20 11:41:28Z imoore76 $
+
+ -->
+<table id='vboxSettingsUSBTable' style='width: 100%'>
+ <tr>
+ <td><label><input type='checkbox' class='vboxCheckbox vboxEnablerCheckbox' name='vboxSettingsUSBEnabled' /> <span class='translate'>Enable USB Controller</span></label></td>
+ </tr>
+ <tr>
+ <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='OHCI'/> <span class='translate vboxEnablerListen'>USB 1.1 (OHCI) Controller</span></label></td>
+ </tr>
+ <tr>
+ <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='EHCI'/> <span class='translate vboxEnablerListen'>USB 2.0 (EHCI) Controller</span></label></td>
+ </tr>
+ <tr>
+ <td style='width: 100%; padding-left: 20px;'><label><input type='radio' class='vboxCheckbox' name='vboxSettingsUSBControllerType' value='XHCI'/> <span class='translate vboxEnablerListen'>USB 3.0 (xHCI) Controller</span></label></td>
+ </tr>
+ <tr style='vertical-align: middle' class='vboxRunningEnabled'>
+ <td style='width: 100%; padding-left: 20px;'>
+ <table class='vboxSettingsHeadingLine' style='width:100%;border-spacing:0;border:0px;margin:0px;padding:0px;'><tr style='vertical-align:middle' class='vboxRunningEnabled'><td style='white-space: nowrap; width: auto'><span class='translate vboxEnablerListen'>USB Device Filters</span></td><td style='width: 100%'><hr style='width: 100%;' class='vboxSeparatorLine'/></td></tr></table>
+ </td>
+ </tr>
+ <tr class='vboxRunningEnabled'>
+ <td style='width: 100%; padding-left: 20px;'>
+ <table style='width: 100%'>
+ <tr class='vboxRunningEnabled'>
+ <td id='vboxSettingsUSBFilters' style='width: 100%;' class='vboxBordered vboxEnablerListen'>
+ <!-- Hidden div for context menu -->
+ <div id='vboxSettingsUSBAddDeviceClick' style='display: none' />
+ <ul id='vboxSettingsUSBFilterList' class='vboxList vboxHover' style='width: 100%'>
+ <li class='vboxListItem'><input type='checkbox' class='vboxCheckbox' />a</li>
+ </ul>
+ </td>
+ <td id='vboxSettingsUSBButtons' class='vboxEnablerListen'></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+</table>
+<script type='text/javascript'>
+
+/*
+ * USB Buttons and Toolbar
+ */
+
+//Translations
+ $('#vboxSettingsTabPortsUSB').find(".translate").html(function(i,h){return trans($('<div />').html(h).text(),'UIMachineSettingsUSB');}).removeClass('translate');
+
+
+ var sButtons = new Array(
+
+ {
+ 'name' : 'usbnew',
+ 'label' : 'Add Empty Filter',
+ 'icon' : 'usb_new',
+ 'click' : function () {
+ var list = $('#vboxSettingsUSBFilterList');
+ var currUsbName = 1;
+ for(; currUsbName < 99; currUsbName++) {
+ if(!$(list).find('span.vboxSettingsUSBFilterTitle').filter(function(){
+ return ($(this).text() == trans('New Filter %1','UIMachineSettingsUSB').replace('%1',currUsbName));
+ }).length) break;
+ }
+
+ vboxSettingsAddUSBFilter({'active':1,'name':trans('New Filter %1','UIMachineSettingsUSB').replace('%1',currUsbName)});
+
+ if(!$('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click').html()) {
+ $('#vboxSettingsUSBFilterList').trigger('select',null); }
+ }
+ },
+
+ {
+ 'name' : 'usbnewdevice',
+ 'label' : 'Add Filter From Device',
+ 'icon' : 'usb_add',
+ 'click' : function (e) {
+
+ // Update menu
+ var menu = $("#vboxSettingsUSBAddDevice");
+
+ menu.children().remove();
+ menu.append($('<li />').html('<span><img src="images/jqueryFileTree/spinner.gif" /></span>').css({'width':'100px','text-align':'center'}));
+
+ var l = new vboxLoader();
+ l.add('hostGetUSBDevices',function(res){
+
+ var hostUSB = res.responseData;
+
+ $(menu).children().remove();
+ for(var i = 0; i < hostUSB.length; i++) {
+
+ var dname = '';
+ if(!hostUSB[i].product)
+ dname = trans('Unknown device %1:%2','VBoxGlobal').replace('%1',hostUSB[i].vendorId).replace('%2',hostUSB[i].productId);
+ else
+ dname = hostUSB[i].manufacturer + ' ' + hostUSB[i].product;
+ dname += ' [' + hostUSB[i].revision + ']';
+
+ $(menu).append($('<li />').append($('<a />').attr({'href':'#usbDev'+i}).html(dname).data({'device':hostUSB[i]})));
+ }
+
+ // No devices?
+ if(hostUSB.length == 0) {
+ $(menu).append($('<li />').append($('<a />').attr({'href':'#usbNoop'}).html($('<div />').text(trans('<no devices available>','VBoxUSBMenu')).html()).data({'device':hostUSB[i]})));
+ }
+ $(menu).trigger('menuLoaded');
+
+ vboxPositionToWindow(menu);
+
+ },{});
+ l.noLoadingScreen = true;
+ l.run();
+
+ // Trigger mouse up / down on hidden element
+
+ var md = jQuery.Event("mousedown");
+ var mu = jQuery.Event("mouseup");
+ for(var i in e) { (md[i] ? null : md[i] = mu[i] = e[i]); }
+ // Fix mouse button for MSIE
+ if(jQuery.browser.msie && e.button == 0) md.button = mu.button = 1;
+
+
+ $("#vboxSettingsUSBAddDeviceClick").trigger(md).trigger(mu);
+ }
+ },
+
+ {
+ 'name' : 'usbedit',
+ 'label' : 'Edit Filter',
+ 'icon' : 'usb_filter_edit',
+ 'enabled' : function (item) { return (item && $(item).data('filter') && $(item).data('filter').name); },
+ 'click' : function () {
+
+ var d = $('<div />').attr({'id':'vboxSettingsUSBFilterEdit','style':'display: none','class':'vboxNonTabbed vboxDialogContent'});
+
+ var tbl = $('<table />').attr({'style':'width: 100%','class':'vboxSettingsTable'});
+
+ var vboxSettingsUSBFilterProps = [
+ ['Name','name'],['Vendor ID','vendorId'],['Product ID','productId'],
+ ['Revision','revision'],['Manufacturer','manufacturer'],['Product','product'],
+ ['Serial No.','serialNumber'],['Port','port']];
+
+ /* Get Defaults */
+ var filter = $('#vboxSettingsUSBFilterList').find('li.vboxListItemSelected').first().data('filter');
+
+ for(var i = 0; i < vboxSettingsUSBFilterProps.length; i++) {
+
+ var val = (filter[vboxSettingsUSBFilterProps[i][1]]||'');
+ $('<tr />').append($('<th />').attr({'style':'white-space: nowrap; width: auto; text-align: right;'}).html(trans(vboxSettingsUSBFilterProps[i][0]+':','UIMachineSettingsUSBFilterDetails'))).append($('<td />').attr({'style':'width: 100%'}).html('<input type="text" class="vboxText" style="width: 100%" id="vboxSettingsUSBF'+vboxSettingsUSBFilterProps[i][1]+'" value="'+$('<div />').text((filter[vboxSettingsUSBFilterProps[i][1]]||'')).html()+'"/>')).appendTo(tbl);
+ }
+
+ // Generate select box
+ var sel = $('<select />').attr({'id':'vboxSettingsUSBFRemote'});
+ var opts = [['',trans('Any','UIMachineSettingsUSBFilterDetails')],['yes',trans('Yes','UIMachineSettingsUSBFilterDetails')],['no',trans('No','UIMachineSettingsUSBFilterDetails')]];
+ for(var i = 0; i < opts.length; i++) {
+ var o = new Option(opts[i][1],opts[i][0],((filter['remote']||'')==opts[i][0]));
+ $(sel).prop('options').add(o);
+ }
+
+ $('<tr />').append($('<th />').attr({'style':'white-space: nowrap; width: auto; text-align: right;'}).html(trans('Remote:','UIMachineSettingsUSBFilterDetails'))).append($('<td />').attr({'style':'width: 100%'}).append(sel)).appendTo(tbl);
+
+ $(d).append(tbl).appendTo($('#vboxPane'));
+
+ var buttons = { };
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
+
+ for(var i = 0; i < vboxSettingsUSBFilterProps.length; i++) {
+ $(item).data('filter')[vboxSettingsUSBFilterProps[i][1]] = $('#vboxSettingsUSBF'+(vboxSettingsUSBFilterProps[i][1])).val();
+ }
+ $(item).data('filter').remote = ($('#vboxSettingsUSBFRemote').val()||'');
+ // Change display name
+ $(item).find('span.vboxSettingsUSBFilterTitle').first().text($(item).data('filter').name);
+ $('#vboxSettingsUSBFilterEdit').remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { $('#vboxSettingsUSBFilterEdit').remove(); };
+
+
+ $('#vboxSettingsUSBFilterEdit').dialog({'buttons':buttons,'closeOnEscape':false,'width':400,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent vboxNonTabbed','title':'<img src="images/vbox/usb_16px.png" class="vboxDialogTitleIcon" /> '+trans('USB Filter Details','UIMachineSettingsUSBFilterDetails')});
+
+ }
+ },
+
+ {
+ 'name' : 'usbremove',
+ 'label' : 'Remove Filter',
+ 'icon' : 'usb_remove',
+ 'enabled' : function (item) { return (item && $(item).data('filter') && $(item).data('filter').name); },
+ 'click' : function () {
+ var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
+ // determine next target
+ var target = $(item).next();
+ if(!$(target).length) target = $(item).prev();
+ if(!$(target).length) target = null;
+ $(item).empty().remove();
+
+ if(!$(target).trigger('click').length) {
+ $('#vboxSettingsUSBFilterList').trigger('select',null);
+ }
+ vboxColorRows($('#vboxSettingsUSBFilterList'));
+ }
+ },
+
+ {
+ 'name' : 'usbup',
+ 'label' : 'Move Filter Up',
+ 'icon' : 'usb_moveup',
+ 'enabled' : function (item) {
+ return (item && $(item).data('filter') && $(item).data('filter').name && $(item).attr('id') != $('#vboxSettingsUSBFilterList').children().first().attr('id'));
+ },
+ 'click' : function () {
+
+ var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
+
+ var prev = $(item).prev();
+ if(!$(prev).length) return;
+ var mv = $(item).detach();
+ $(prev).before(mv);
+
+ vboxColorRows($('#vboxSettingsUSBFilterList'));
+ $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click');
+
+ }
+ },
+
+ {
+ 'name' : 'usbdown',
+ 'label' : 'Move Filter Down',
+ 'icon' : 'usb_movedown',
+ 'enabled' : function (item) {
+ return (item && $(item).data('filter') && $(item).data('filter').name && $(item).attr('id') != $('#vboxSettingsUSBFilterList').children().last().attr('id'));
+ },
+ 'click' : function () {
+
+ var item = $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first();
+
+ var next = $(item).next();
+ if(!$(next).length) return;
+ var mv = $(item).detach();
+ $(next).after(mv);
+
+ vboxColorRows($('#vboxSettingsUSBFilterList'));
+ $('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first().trigger('click');
+ }
+ }
+
+
+ );
+
+var usbToolbar = new vboxToolbarSmall({buttons: sButtons,
+ language_context: 'UIMachineSettingsUSB', renderTo: 'vboxSettingsUSBButtons'});
+
+$('#vboxSettingsUSBFilterList').on('select',function(e,el){usbToolbar.update(el);});
+
+
+
+/* Adds a USB filter to list */
+function vboxSettingsAddUSBFilter(f,noColor) {
+
+ var li = $('<li />').data({'filter':f}).attr({'id':'vboxSettingsUSBFilterNumber' + (Math.floor(Math.random()*1000)),'class':'vboxListItem'});
+
+ if(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled.checked) {
+
+ li.click(function(){
+ $(this).parent().children().removeClass('vboxListItemSelected');
+ $(this).addClass('vboxListItemSelected');
+ $('#vboxSettingsUSBFilterList').trigger('select',this);
+ }).dblclick(function(e){
+ e.preventDefault();
+ usbToolbar.click('usbedit');
+ }).hoverClass('vboxHover').disableSelection();
+ }
+
+ $('<input />').attr({'type':'checkbox'}).prop('checked',(f.active ? true : false)).appendTo(li);
+
+ $(li).append(' <span class="vboxSettingsUSBFilterTitle">'+$('<div/>').text(f.name).html()+'</span>').appendTo($('#vboxSettingsUSBFilterList'));
+
+
+ if(!noColor) vboxColorRows($('#vboxSettingsUSBFilterList'));
+}
+
+
+/* Menu for adding existing USB device */
+
+var exUsb = new vboxMenu({id: 'vboxSettingsUSBAddDevice', menuItems: []});
+
+/* Add attachment button menu initialization */
+$("#vboxSettingsUSBAddDeviceClick").contextMenu({
+ menu: 'vboxSettingsUSBAddDevice',
+ button: 0
+ },
+ function(action, el, pos, menuItem) {
+
+ if(action == 'usbNoop') return;
+
+ // usb data kept in elm
+ var usb = $(menuItem).data('device');
+ delete usb.port, usb.version, usb.portVersion;
+ usb.name = $(menuItem).html();
+ usb.active = 1;
+
+ vboxSettingsAddUSBFilter(usb);
+
+ $('#vboxSettingsUSBFilterList').trigger('select',$('#vboxSettingsUSBFilterList').find('.vboxListItemSelected').first());
+
+ }
+);
+
+
+/*
+ * USB data
+ */
+$('#vboxSettingsDialog').on('dataLoaded',function(){
+
+ // set checkboxes for USB and EHCI
+ if($('#vboxSettingsDialog').data('vboxMachineData').USBControllers.length) {
+
+ var usbType = 'OHCI';
+ var enabled = false;
+
+ for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').USBControllers.length; i++) {
+ var listUSBType = $('#vboxSettingsDialog').data('vboxMachineData').USBControllers[i].type;
+ if(listUSBType == 'OHCI') {
+ enabled = true;
+ }
+ switch(listUSBType) {
+ case 'OHCI':
+ if(usbType == 'EHCI')
+ break;
+ case 'EHCI':
+ if(usbType == 'XHCI')
+ break;
+ default:
+ usbType = listUSBType;
+ }
+ }
+ $(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled).prop('checked',enabled).triggerHandler('click');
+
+ $(document.forms['frmVboxSettings']).find('input[value="'+usbType+'"]').prop('checked',true);
+
+ } else {
+ $(document.forms['frmVboxSettings'].vboxSettingsUSBEnabled).prop('checked',false).triggerHandler('click');
+ $(document.forms['frmVboxSettings']).find('input[value="OHCI"]').prop('checked',true);
+ }
+
+ // clear list
+ var list = $('#vboxSettingsUSBFilterList');
+ $(list).empty().children().remove();
+
+ // add filters
+ for(var i = 0; i < $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters.length; i++) {
+ vboxSettingsAddUSBFilter($('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters[i],true);
+ }
+ vboxColorRows($('#vboxSettingsUSBFilterList'));
+
+
+ if(!$('#vboxSettingsUSBFilterList').find('li.vboxListItem').first().trigger('click')) {
+ $('#vboxSettingsUSBFilterList').trigger('select',null);
+ }
+
+ var p = $('#vboxSettingsUSBTable');
+ if(!$('#vboxSettingsDialog').data('vboxFullEdit')) {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').addClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',true);
+ } else {
+ $(p).find('tr:not(.vboxRunningEnabled)').find('span').removeClass('disabled');
+ $(p).find('tr:not(.vboxRunningEnabled)').find('input,select,textarea').prop('disabled',false);
+ }
+});
+
+
+/* Change settings onSave() */
+$('#vboxSettingsDialog').on('save',function(){
+
+ // get checkboxes for USB and EHCI
+ var frmEnabled = document.forms['frmVboxSettings'].vboxSettingsUSBEnabled.checked;
+
+ var frmType = $(document.forms['frmVboxSettings']).find('input[name="vboxSettingsUSBControllerType"]:checked').val();
+
+ $('#vboxSettingsDialog').data('vboxMachineData').USBControllers = new Array();
+
+ if(frmEnabled) {
+ $('#vboxSettingsDialog').data('vboxMachineData').USBControllers = [{
+ 'name': 'OHCI',
+ 'type': 'OHCI'
+ }];
+ }
+
+ if(frmType != 'OHCI') {
+ $('#vboxSettingsDialog').data('vboxMachineData').USBControllers.push({
+ 'name': frmType,
+ 'type': frmType
+ });
+ }
+
+ $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters = new Array();
+
+ $('#vboxSettingsUSBFilterList').children('li').each(function(){
+ $(this).data('filter').active = $(this).children('input:checkbox').first().prop('checked');
+ $('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters[$('#vboxSettingsDialog').data('vboxMachineData').USBDeviceFilters.length] = $(this).data('filter');
+ });
+
+});
+
+
+</script>
+
\ No newline at end of file
diff --git a/panes/tabVMConsole.html b/panes/tabVMConsole.html
index e00cdc3..91788a2 100644
--- a/panes/tabVMConsole.html
+++ b/panes/tabVMConsole.html
@@ -1,41 +1,41 @@
-<!--
-
- VM Console tab
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabVMConsole.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div id='vboxTabVMConsole' class='vboxTabContent' style='display:none;'>
-</div>
-<script type="text/javascript">
-
-// Load default VRDE tab
-if($('#vboxPane').data('vboxSystemProperties') && $('#vboxPane').data('vboxSystemProperties').defaultVRDEExtPack.indexOf('VNC') > -1) {
- // VNC
- $('#vboxTabVMConsole').load('panes/tabVMConsoleVNC.html');
-} else {
- // RDP
- $('#vboxTabVMConsole').load('panes/tabVMConsoleRDP.html');
-}
-
-// Load new on host change
-$('#vboxPane').on('hostChanged', function() {
-
- $('#vboxTabVMConsole').empty();
-
- // Load default VRDE tab
- if($('#vboxPane').data('vboxSystemProperties') && $('#vboxPane').data('vboxSystemProperties').defaultVRDEExtPack.indexOf('VNC') > -1) {
- // VNC
- $('#vboxTabVMConsole').load('panes/tabVMConsoleVNC.html');
- } else {
- // RDP
- $('#vboxTabVMConsole').load('panes/tabVMConsoleRDP.html');
- }
-
-});
-
-
-</script>
-
-
+<!--
+
+ VM Console tab
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabVMConsole.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div id='vboxTabVMConsole' class='vboxTabContent' style='display:none;'>
+</div>
+<script type="text/javascript">
+
+// Load default VRDE tab
+if($('#vboxPane').data('vboxSystemProperties') && $('#vboxPane').data('vboxSystemProperties').defaultVRDEExtPack.indexOf('VNC') > -1) {
+ // VNC
+ $('#vboxTabVMConsole').load('panes/tabVMConsoleVNC.html');
+} else {
+ // RDP
+ $('#vboxTabVMConsole').load('panes/tabVMConsoleRDP.html');
+}
+
+// Load new on host change
+$('#vboxPane').on('hostChanged', function() {
+
+ $('#vboxTabVMConsole').empty();
+
+ // Load default VRDE tab
+ if($('#vboxPane').data('vboxSystemProperties') && $('#vboxPane').data('vboxSystemProperties').defaultVRDEExtPack.indexOf('VNC') > -1) {
+ // VNC
+ $('#vboxTabVMConsole').load('panes/tabVMConsoleVNC.html');
+ } else {
+ // RDP
+ $('#vboxTabVMConsole').load('panes/tabVMConsoleRDP.html');
+ }
+
+});
+
+
+</script>
+
+
diff --git a/panes/tabVMConsoleRDP.html b/panes/tabVMConsoleRDP.html
index c38e66d..ac62f7b 100644
--- a/panes/tabVMConsoleRDP.html
+++ b/panes/tabVMConsoleRDP.html
@@ -1,504 +1,504 @@
-<!--
-
- VM Console tab
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabVMConsoleRDP.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
- <div id='vboxTabVMUnavailable' style='display: none' class='translate'>Virtual machine is not running or is not configured to accept RDP connections.</div>
- <div id='vboxRDPFormContainer' style='padding-top: 8px; display: none'>
- <form name="vboxRDPForm" id="vboxRDPForm">
- <div class='vboxInvisible' id='vboxRDPConnParams'>
-
- <span id='vboxConsoleLoginInfo'>
- <span class='translate'>User name</span>: <input class='vboxRDPSet' type=text size=20 name=logonUsername value="">
- <span class='translate'>Password</span>: <input class='vboxRDPSet' type=password size=20 name=logonPassword value="">
- </span>
-
- <span class='translate'>Requested desktop size</span>:
- <select id='vboxRDPSize' name='vboxRDPSizeSelect'>
- <option value='800x600'>800x600</option>
- <option value='1024x768'>1024x768</option>
- <option value='1280x1024'>1280x1024</option>
- </select>
-
- </div>
- <p>
- <input name=connectionButton type=button value="Connect" onclick="vboxRDPConnect();" />
- <input type='text' id='vboxConsoleAddr' name='serverAddress' class='vboxRDPSet' value='' />
- <!-- and hardcore web dev guys across the world frown ... //-->
- &nbsp; &nbsp; &nbsp;
- <input name=cadButton id='vboxConsoleCADButton' style='display: none' type=button value="Ctrl-Alt-Del" onClick="vboxRDPsendCAD()" />
- <input id='vboxVRDPDetachBtn' style='display: none' name='detach' type='button' value='Detach' onClick="vboxRDPDetach();" />
- <span id='vboxRDPStatus'></span>
- </p>
- </form>
- </div>
-
- <div id="FlashRDPContainer" style='width: 100%;'>
- <div id="FlashRDP" style='width: 100%;'></div>
- </div>
-
-
-<script type="text/javascript">
-
-var vboxRDPFlashLoaded = false;
-var vboxConsoleDetached = (vboxConsoleDetached || false);
-var vboxRDPFlashListenersAdded = false;
-
-$('#vboxRDPForm').on('submit',function(e){
- e.stopPropagation();
- e.preventDefault();
- return false;
-});
-
-// Custom resolutions
-if($("#vboxPane").data('vboxConfig').consoleResolutions) {
- var res = $("#vboxPane").data('vboxConfig').consoleResolutions;
- // first one must be valid
- if(res[0].split('x').length == 2) {
- document.vboxRDPForm.vboxRDPSizeSelect.options.length = 0;
- $(document.vboxRDPForm.vboxRDPSizeSelect).children().remove();
- for(var i = 0; i < res.length; i++) {
- document.vboxRDPForm.vboxRDPSizeSelect.options[i] = new Option(res[i],res[i]);
- }
- }
-}
-// Translations
-$('#vboxTabVMConsole').find(".translate").html(function(i,h){return trans(h,'VBoxConsoleWgt');}).removeClass('translate');
-$(document.vboxRDPForm.connectionButton).val(trans('Connect','VBoxConsoleWgt'));
-$(document.vboxRDPForm.cadButton).val(trans("Send Ctrl-Alt-Del",'VBoxConsoleWgt'));
-$(document.vboxRDPForm.vboxVRDPDetachBtn).val(trans("Detach",'VBoxConsoleWgt'));
-$("#vboxRDPStatus").html(trans("Loading ...",'UIVMDesktop'));
-if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
-
-// Disable / enable tab on selection list changes
-$('#vboxPane').on('vmSelectionListChanged', function(){
-
- var vm = vboxChooser.getSingleSelected();
-
- // Initially disable tab
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
-
- if(!vm || !vboxVMStates.isRunning(vm)) {
- $('#vboxRDPFormContainer').css({'display':'none'});
- $('#FlashRDPContainer').css({'visibility':'hidden'});
- $('#vboxTabVMUnavailable').css({'display':'none'});
-
- } else {
-
- // VM is running, get runtime data
- $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(info) {
-
- if(info.VRDEServerInfo && info.VRDEServerInfo.port > 0 && info.VRDEServer.VRDEExtPack.indexOf("VNC") == -1) {
-
- $('#vboxRDPFormContainer').css({'display':''});
- $('#FlashRDPContainer').css({'visibility':'visible'});
- $('#vboxTabVMUnavailable').css({'display':'none'});
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
- }
-
- });
-
- }
-
-
-// Update on console info change
-}).on('vboxOnVRDEServerInfoChanged',function(e,eventData) {
-
- // Shorthand
- var vmid = eventData.machineId;
- var VRDEServerInfo = eventData.enrichmentData;
-
- var selVM = vboxChooser.getSingleSelected();
- var enabled = (selVM && selVM.id == vmid && vboxVMStates.isRunning(selVM) && VRDEServerInfo && VRDEServerInfo.port > 0);
-
- if(enabled) {
-
- $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(info) {
-
- enabled = (info.VRDEServerInfo && info.VRDEServerInfo.port > 0 && info.VRDEServer.VRDEExtPack.indexOf("VNC") == -1);
-
- if(enabled) {
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
-
- $('#vboxRDPFormContainer').css({'display':''});
- $('#FlashRDPContainer').css({'visibility':'visible'});
- $('#vboxTabVMUnavailable').css({'display':'none'});
-
-
- var chost = vboxGetVRDEHost(selVM);
- chost+=':'+VRDEServerInfo.port;
-
- if($(document.vboxRDPForm.serverAddress).val() != chost) {
-
- // console host changed
- vboxRDPDisconnect();
-
- }
- $(document.vboxRDPForm.serverAddress).val(chost);
- } else {
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
- }
-
- });
-
- } else {
-
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
- }
-
-// Update tab on machine state change
-}).on('vboxOnMachineStateChanged', function(e, eventData){
-
- var selVMId = vboxChooser.getSingleSelectedId();
- var enabled = (selVMId == eventData.machineId && vboxVMStates.isRunning({'state':eventData.state}));
-
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
-
- if(enabled) {
-
- // VM is running, get runtime data
- $.when(vboxVMDataMediator.getVMRuntimeData(eventData.machineId)).done(function(vm) {
-
- if(vm.VRDEServerInfo && vm.VRDEServerInfo.port > 0) {
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
-
- $('#vboxRDPFormContainer').css({'display':''});
- $('#FlashRDPContainer').css({'visibility':'visible'});
- $('#vboxTabVMUnavailable').css({'display':'none'});
-
- }
-
- });
-
- }
-
-// Clean up local data storage when a machine is unregistered
-}).on('vboxMachineRegistered', function(e, eventData) {
-
- if(!eventData.registered) {
- vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleSize','',true);
- vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleConnected','',true);
- }
-});
-
-/*
- * Populate console info values when this tab is shown
- */
-
-$('#vboxTabVMConsole').on('show',function(){
-
- var vm = vboxChooser.getSingleSelected();
-
- if(!vm || !vboxVMStates.isRunning(vm)) {
- $('#vboxRDPFormContainer').css({'display':'none'});
- $('#FlashRDPContainer').css({'visibility':'hidden'});
- $('#vboxTabVMUnavailable').css({'display':''});
- return;
- }
-
- $('#vboxConsoleLoginInfo').hide();
-
- /* Load runtime data. This will tell us if the VRDE server is actually active */
- /* And details. This will give us info about the VRDEServer configuration */
- $.when(vboxVMDataMediator.getVMRuntimeData(vm.id),vboxVMDataMediator.getVMDetails(vm.id))
- .done(function(runtimeData, detailsData) {
-
- /* Not active */
- if(!(runtimeData.VRDEServerInfo && runtimeData.VRDEServerInfo.port > 0)) {
- $('#vboxTabVMUnavailable').css({'display':''});
- $('#vboxTabVMConsole').parent().trigger('disableTab',['vboxTabVMConsole']);
- return;
- }
-
- // Hide login form if authtype is not set
- if(detailsData.VRDEServer.authType != 'Null') {
- $('#vboxConsoleLoginInfo').show();
- }
- $('#vboxConsoleLoginInfo').data('vboxVRDPauthType',detailsData.VRDEServer.authType);
-
- /* Active */
- $('#vboxRDPFormContainer').css({'display':''});
- $('#FlashRDPContainer').css({'visibility':'visible'});
- $('#vboxTabVMUnavailable').css({'display':'none'});
-
- vboxRDPDisconnect();
- $("#vboxRDPStatus").html('');
- if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
-
- var chost = vboxGetVRDEHost(detailsData);
- chost+=':'+runtimeData.VRDEServerInfo.port;
- $(document.vboxRDPForm.serverAddress).val(chost);
-
- // Set default console size for this VM?
- var cs = vboxGetLocalDataItem('vbox'+detailsData.id+'ConsoleSize');
- if(cs) {
- $(document.vboxRDPForm.vboxRDPSizeSelect).children('[value='+cs+']').first().prop('selected',true);
- }
-
- $('#vboxRDPFormContainer').css({'display':''});
-
- vboxRDPLoad();
- });
-
-});
-
-function vboxRDPLoad() {
-
- var flashvars = {};
- var params = {};
- params.wmode="opaque";
- params.menu="false";
- params.bgcolor="#e9e9e9";
- params.quality="low";
- params.allowScriptAccess="always";
- params.flashId="FlashRDP";
-
- var attributes = {};
- swfobject.embedSWF("rdpweb/RDPClientUI.swf", "FlashRDP", "100", "100", "9.0.0","", flashvars, params, attributes);
-
- var ua = swfobject.ua;
-
- // No flash installed
- if(!ua || ua.pv[0] == '0') {
- $('#vboxRDPFormContainer').css('display','none');
- $("#FlashRDP").css('width','100%').html("The Adobe Flash plugin is not installed.");
- }
-}
-
-function vboxRDPgetFlashProperty(name) {
- var flash = RDPWebClient.getFlashById("FlashRDP");
- try {
- return flash.getProperty(name);
- } catch (e) {
- return '';
- }
-}
-
-/*
- * RDP client event handlers.
- * They will be called when the flash movie is ready and some event occurs.
- * Note: the function name must be the "flash_id" + "event name".
- */
-function RDPWebEventLoaded(flashid) {
-
- vboxRDPFlashLoaded = true;
- $("#vboxRDPStatus").html(trans("Version",'UIVMDesktop') + ": " + vboxRDPgetFlashProperty("version"));
- if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
-
- var flash = RDPWebClient.getFlashById("FlashRDP");
-
- // Apply keyboard layout
- flash.setProperty("keyboardLayout", ($('#vboxPane').data('vboxConfig').consoleKeyboardLayout == 'DE' ? 'de' : 'en'));
-
- // Only do this once
- if(!vboxRDPFlashListenersAdded) {
-
- if (window.addEventListener) {
- window.addEventListener("contextmenu", function(event) { return RDPWebClient._MozillaContextMenu(event); }, true);
- window.addEventListener("mousedown", function(event) { return RDPWebClient._MozillaMouse(event, true); }, true);
- window.addEventListener("mouseup", function(event) { return RDPWebClient._MozillaMouse(event, false); }, true);
- flash.addEventListener("mouseout", function(event) { return RDPWebClient._MozillaMouseOut(event); }, true);
- } else {
- document.oncontextmenu = function() { return RDPWebClient._IEContextMenu(); };
- flash.parentNode.onmousedown = function() { return RDPWebClient._IEMouse(true); };
- flash.parentNode.onmouseup = function() { return RDPWebClient._IEMouse(false); };
- flash.onmouseout=function() {return RDPWebClient._IEMouseOut(); };
- }
-
- vboxRDPFlashListenersAdded = true;
-
- }
-
- // Connect if "detached"
- if(vboxConsoleDetached) {
- $('#vboxTabVMUnavailable').css({'display':'none'});
- $('#vboxRDPFormContainer').css({'display':'none'});
- $('#vboxRDPSize').val($(window.opener.document.getElementById('vboxRDPSize')).val());
- $('#vboxRDPFormContainer').find(".vboxRDPSet").each(function(){
- $(this).val(window.opener.document.forms['vboxRDPForm'][$(this).attr('name')].value);
- });
- $(window).on('resize',function(){
- var flash = RDPWebClient.getFlashById("FlashRDP");
- var wh = [ $(window).width()-2, $(window).height()-2 ];
- $(flash).css({'height':wh[1]+'px','width':wh[0]+'px'});
- $('#FlashRDP').css({'height':wh[1]+'px','width':wh[0]+'px'});
- flash.setProperty("displayWidth", wh[0]);
- flash.setProperty("displayHeight", wh[1]);
- $(flash).css({'display':'none'});
- $(flash).css({'display':'block'});
- });
- vboxRDPConnect();
- } else {
-
- $('#vboxRDPConnParams').show();
- $('#vboxRDPFormContainer').css('display','');
-
- // Did not explicitly disconnect from this VM and has no auth settings so reconnect
- if(vboxGetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected') == 'true' && $('#vboxConsoleLoginInfo').data('vboxVRDPauthType') == 'Null') {
- document.vboxRDPForm.connectionButton.click();
- }
- }
-}
-
-function RDPWebEventConnected(flashId) {
- $("#vboxRDPStatus").data('vmConnected',true);
- $("#vboxRDPStatus").html(trans("Connected to %1",'VBoxConsoleWgt').replace('%1',$(document.vboxRDPForm.serverAddress).val()));
- if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
- $('#vboxConsoleCADButton').show();
- $('#vboxVRDPDetachBtn').show();
-}
-
-function RDPWebEventServerRedirect(flashId) {
- $("#vboxRDPStatus").html(trans("Redirection by %1",'VBoxConsoleWgt').replace('%1',vboxRDPgetFlashProperty("serverAddress")));
- if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
-}
-
-function RDPWebEventDisconnected(flashId) {
-
- $("#vboxRDPStatus").data('vmConnected',false);
-
- $('#vboxRDPConnParams').show();
- $('#vboxVRDPDetachBtn').hide();
-
- /* RDP connection has been lost */
- $("#vboxRDPStatus").html(trans("Disconnect reason",'VBoxConsoleWgt')+":\n" + vboxRDPgetFlashProperty("lastError"));
- if(vboxConsoleDetached) {
- alert($("#vboxRDPStatus").text());
- window.close();
- }
- document.vboxRDPForm.connectionButton.value = trans("Connect",'VBoxConsoleWgt');
- document.vboxRDPForm.connectionButton.onclick=function() {
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(),true);
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected','true',true);
- return vboxRDPConnect();
- };
- $('#vboxConsoleAddr').css('display','');
- $('#vboxConsoleCADButton').hide();
-
- $('#vboxRDPFormContainer').css({'display':''});
-}
-
-
-function vboxRDPConnect() {
-
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(), true);
-
- if (!vboxRDPFlashLoaded) return false;
-
- var flash = RDPWebClient.getFlashById("FlashRDP");
- if (!flash) return;
-
- $('#vboxRDPConnParams').hide();
-
- document.vboxRDPForm.connectionButton.value = trans("Disconnect",'VBoxConsoleWgt');
- document.vboxRDPForm.connectionButton.onclick=function(){
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected');
- return vboxRDPDisconnect();
- };
-
- $('#vboxConsoleAddr').css('display','none');
- $('#FlashRDPContainer').css({'visibility':'visible'});
-
-
- var flash = RDPWebClient.getFlashById("FlashRDP");
-
- var wh = null;
- if(vboxConsoleDetached) {
- wh = [ $(document).width()-2, $(document).height()-2 ];
- } else {
- wh = $('#vboxRDPSize').val().split('x');
- }
- $(flash).css({'height':wh[1]+'px','width':wh[0]+'px'});
- flash.setProperty("displayWidth", wh[0]);
- flash.setProperty("displayHeight", wh[1]);
-
- /* Setup the client parameters. */
- $('#vboxRDPFormContainer').find(".vboxRDPSet").each(function(){
- flash.setProperty($(this).attr('name'),$(this).val());
- });
-
- $("#vboxRDPStatus").html(trans("Connecting to %1",'VBoxConsoleWgt').replace('%1',$(document.vboxRDPForm.serverAddress).val()) + "...");
- if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").html();
-
- /* Establish the connection. */
- flash.connect();
-
-}
-
-function vboxRDPDisconnect() {
- var flash = RDPWebClient.getFlashById("FlashRDP");
- if (flash) try { flash.disconnect(); } catch (err) {};
- /* Restore the "Connect" form. And resize flash*/
- document.vboxRDPForm.connectionButton.value = trans("Connect",'VBoxConsoleWgt');
- document.vboxRDPForm.connectionButton.onclick=function() {
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected','true',true);
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(),true);
- vboxRDPConnect();this.blur();
- };
- $('#vboxConsoleCADButton').hide();
- $(flash).css({'height':'100px','width':'100px'});
- $('#vboxConsoleAddr').css('display','');
-
-}
-
-function vboxRDPsendCAD() {
- var flash = RDPWebClient.getFlashById("FlashRDP");
- if (flash) flash.keyboardSendCAD();
-}
-
-function vboxRDPDetach() {
-
- vboxRDPDisconnect();
-
- var vmname = vboxChooser.getSingleSelected().name;
- var wh = $('#vboxRDPSize').val().split('x');
- var newwin = window.open('about:blank','vboxConsoleDetachedWin'+vmname.replace(/[^a-zA-Z0-9]/g,'_'),'toolbar=0,menubar=0,location=0,directories=0,status=true,resize=true,width='+(parseInt(wh[0])+20)+',height='+(parseInt(wh[1])+20)+'');
-
- newwin.document.open();
- newwin.document.write('<html><head><title>'+vmname + ' - ' + trans('Console','UIVMDesktop')+'</title></head><body style="margin: 0px; border: 0px; padding: 0px; overflow: hidden;"><div style="margin: 0px; border: 0px; padding: 0px" id="vboxPane"><img src="images/spinner.gif" /></div></body></html>');
- newwin.document.close();
- newwin.trans = function(t) { return t; };
- var newHead = newwin.document.getElementsByTagName('HEAD')[0];
-
- var headTags = document.getElementsByTagName('HEAD')[0].getElementsByTagName('SCRIPT');
- for(var i = 0; i < headTags.length; i++) {
-
- // Ignore runtime scripts
- if(!$(headTags[i]).attr('src')) continue;
-
- var script = newwin.document.createElement('script');
- script.setAttribute('type','text/javascript');
- script.setAttribute('src',$(headTags[i]).attr('src'));
- newHead.appendChild(script);
- }
- // Load self
- var script = newwin.document.createElement('script');
- script.setAttribute('type','text/javascript');
- script.text = "var vboxConsoleDetached = true;\
- function vboxConsoleCheckLoad() {\
- if(vboxLoader && jQuery) vboxConsoleDetachedOnload();\
- else setTimeout(\"vboxConsoleCheckLoad()\",1000);\
- }\
- function vboxConsoleDetachedOnload(){\
- l = new vboxLoader();\
- l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);});\
- l.addFile('panes/tabVMConsoleRDP.html',function(d){$('#vboxPane').children().remove();$('#vboxPane').append(d);$('#vboxTabVMConsole').css('display','');vboxRDPLoad();});\
- l.run();};\
- setTimeout(\"vboxConsoleCheckLoad()\",1000);";
- newHead.appendChild(script);
-
-}
-
-</script>
-
-
-<iframe style="height:0px;width:0px;visibility:hidden" src="about:blank">
- this frame prevents back forward cache in Safari
-</iframe>
-
+<!--
+
+ VM Console tab
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabVMConsoleRDP.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+ <div id='vboxTabVMUnavailable' style='display: none' class='translate'>Virtual machine is not running or is not configured to accept RDP connections.</div>
+ <div id='vboxRDPFormContainer' style='padding-top: 8px; display: none'>
+ <form name="vboxRDPForm" id="vboxRDPForm">
+ <div class='vboxInvisible' id='vboxRDPConnParams'>
+
+ <span id='vboxConsoleLoginInfo'>
+ <span class='translate'>User name</span>: <input class='vboxRDPSet' type=text size=20 name=logonUsername value="">
+ <span class='translate'>Password</span>: <input class='vboxRDPSet' type=password size=20 name=logonPassword value="">
+ </span>
+
+ <span class='translate'>Requested desktop size</span>:
+ <select id='vboxRDPSize' name='vboxRDPSizeSelect'>
+ <option value='800x600'>800x600</option>
+ <option value='1024x768'>1024x768</option>
+ <option value='1280x1024'>1280x1024</option>
+ </select>
+
+ </div>
+ <p>
+ <input name=connectionButton type=button value="Connect" onclick="vboxRDPConnect();" />
+ <input type='text' id='vboxConsoleAddr' name='serverAddress' class='vboxRDPSet' value='' />
+ <!-- and hardcore web dev guys across the world frown ... //-->
+ &nbsp; &nbsp; &nbsp;
+ <input name=cadButton id='vboxConsoleCADButton' style='display: none' type=button value="Ctrl-Alt-Del" onClick="vboxRDPsendCAD()" />
+ <input id='vboxVRDPDetachBtn' style='display: none' name='detach' type='button' value='Detach' onClick="vboxRDPDetach();" />
+ <span id='vboxRDPStatus'></span>
+ </p>
+ </form>
+ </div>
+
+ <div id="FlashRDPContainer" style='width: 100%;'>
+ <div id="FlashRDP" style='width: 100%;'></div>
+ </div>
+
+
+<script type="text/javascript">
+
+var vboxRDPFlashLoaded = false;
+var vboxConsoleDetached = (vboxConsoleDetached || false);
+var vboxRDPFlashListenersAdded = false;
+
+$('#vboxRDPForm').on('submit',function(e){
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
+});
+
+// Custom resolutions
+if($("#vboxPane").data('vboxConfig').consoleResolutions) {
+ var res = $("#vboxPane").data('vboxConfig').consoleResolutions;
+ // first one must be valid
+ if(res[0].split('x').length == 2) {
+ document.vboxRDPForm.vboxRDPSizeSelect.options.length = 0;
+ $(document.vboxRDPForm.vboxRDPSizeSelect).children().remove();
+ for(var i = 0; i < res.length; i++) {
+ document.vboxRDPForm.vboxRDPSizeSelect.options[i] = new Option(res[i],res[i]);
+ }
+ }
+}
+// Translations
+$('#vboxTabVMConsole').find(".translate").html(function(i,h){return trans(h,'VBoxConsoleWgt');}).removeClass('translate');
+$(document.vboxRDPForm.connectionButton).val(trans('Connect','VBoxConsoleWgt'));
+$(document.vboxRDPForm.cadButton).val(trans("Send Ctrl-Alt-Del",'VBoxConsoleWgt'));
+$(document.vboxRDPForm.vboxVRDPDetachBtn).val(trans("Detach",'VBoxConsoleWgt'));
+$("#vboxRDPStatus").html(trans("Loading ...",'UIVMDesktop'));
+if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
+
+// Disable / enable tab on selection list changes
+$('#vboxPane').on('vmSelectionListChanged', function(){
+
+ var vm = vboxChooser.getSingleSelected();
+
+ // Initially disable tab
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+
+ if(!vm || !vboxVMStates.isRunning(vm)) {
+ $('#vboxRDPFormContainer').css({'display':'none'});
+ $('#FlashRDPContainer').css({'visibility':'hidden'});
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+
+ } else {
+
+ // VM is running, get runtime data
+ $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(info) {
+
+ if(info.VRDEServerInfo && info.VRDEServerInfo.port > 0 && info.VRDEServer.VRDEExtPack.indexOf("VNC") == -1) {
+
+ $('#vboxRDPFormContainer').css({'display':''});
+ $('#FlashRDPContainer').css({'visibility':'visible'});
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+ }
+
+ });
+
+ }
+
+
+// Update on console info change
+}).on('vboxOnVRDEServerInfoChanged',function(e,eventData) {
+
+ // Shorthand
+ var vmid = eventData.machineId;
+ var VRDEServerInfo = eventData.enrichmentData;
+
+ var selVM = vboxChooser.getSingleSelected();
+ var enabled = (selVM && selVM.id == vmid && vboxVMStates.isRunning(selVM) && VRDEServerInfo && VRDEServerInfo.port > 0);
+
+ if(enabled) {
+
+ $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(info) {
+
+ enabled = (info.VRDEServerInfo && info.VRDEServerInfo.port > 0 && info.VRDEServer.VRDEExtPack.indexOf("VNC") == -1);
+
+ if(enabled) {
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+
+ $('#vboxRDPFormContainer').css({'display':''});
+ $('#FlashRDPContainer').css({'visibility':'visible'});
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+
+
+ var chost = vboxGetVRDEHost(selVM);
+ chost+=':'+VRDEServerInfo.port;
+
+ if($(document.vboxRDPForm.serverAddress).val() != chost) {
+
+ // console host changed
+ vboxRDPDisconnect();
+
+ }
+ $(document.vboxRDPForm.serverAddress).val(chost);
+ } else {
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+ }
+
+ });
+
+ } else {
+
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+ }
+
+// Update tab on machine state change
+}).on('vboxOnMachineStateChanged', function(e, eventData){
+
+ var selVMId = vboxChooser.getSingleSelectedId();
+ var enabled = (selVMId == eventData.machineId && vboxVMStates.isRunning({'state':eventData.state}));
+
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+
+ if(enabled) {
+
+ // VM is running, get runtime data
+ $.when(vboxVMDataMediator.getVMRuntimeData(eventData.machineId)).done(function(vm) {
+
+ if(vm.VRDEServerInfo && vm.VRDEServerInfo.port > 0) {
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+
+ $('#vboxRDPFormContainer').css({'display':''});
+ $('#FlashRDPContainer').css({'visibility':'visible'});
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+
+ }
+
+ });
+
+ }
+
+// Clean up local data storage when a machine is unregistered
+}).on('vboxMachineRegistered', function(e, eventData) {
+
+ if(!eventData.registered) {
+ vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleSize','',true);
+ vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleConnected','',true);
+ }
+});
+
+/*
+ * Populate console info values when this tab is shown
+ */
+
+$('#vboxTabVMConsole').on('show',function(){
+
+ var vm = vboxChooser.getSingleSelected();
+
+ if(!vm || !vboxVMStates.isRunning(vm)) {
+ $('#vboxRDPFormContainer').css({'display':'none'});
+ $('#FlashRDPContainer').css({'visibility':'hidden'});
+ $('#vboxTabVMUnavailable').css({'display':''});
+ return;
+ }
+
+ $('#vboxConsoleLoginInfo').hide();
+
+ /* Load runtime data. This will tell us if the VRDE server is actually active */
+ /* And details. This will give us info about the VRDEServer configuration */
+ $.when(vboxVMDataMediator.getVMRuntimeData(vm.id),vboxVMDataMediator.getVMDetails(vm.id))
+ .done(function(runtimeData, detailsData) {
+
+ /* Not active */
+ if(!(runtimeData.VRDEServerInfo && runtimeData.VRDEServerInfo.port > 0)) {
+ $('#vboxTabVMUnavailable').css({'display':''});
+ $('#vboxTabVMConsole').parent().trigger('disableTab',['vboxTabVMConsole']);
+ return;
+ }
+
+ // Hide login form if authtype is not set
+ if(detailsData.VRDEServer.authType != 'Null') {
+ $('#vboxConsoleLoginInfo').show();
+ }
+ $('#vboxConsoleLoginInfo').data('vboxVRDPauthType',detailsData.VRDEServer.authType);
+
+ /* Active */
+ $('#vboxRDPFormContainer').css({'display':''});
+ $('#FlashRDPContainer').css({'visibility':'visible'});
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+
+ vboxRDPDisconnect();
+ $("#vboxRDPStatus").html('');
+ if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
+
+ var chost = vboxGetVRDEHost(detailsData);
+ chost+=':'+runtimeData.VRDEServerInfo.port;
+ $(document.vboxRDPForm.serverAddress).val(chost);
+
+ // Set default console size for this VM?
+ var cs = vboxGetLocalDataItem('vbox'+detailsData.id+'ConsoleSize');
+ if(cs) {
+ $(document.vboxRDPForm.vboxRDPSizeSelect).children('[value='+cs+']').first().prop('selected',true);
+ }
+
+ $('#vboxRDPFormContainer').css({'display':''});
+
+ vboxRDPLoad();
+ });
+
+});
+
+function vboxRDPLoad() {
+
+ var flashvars = {};
+ var params = {};
+ params.wmode="opaque";
+ params.menu="false";
+ params.bgcolor="#e9e9e9";
+ params.quality="low";
+ params.allowScriptAccess="always";
+ params.flashId="FlashRDP";
+
+ var attributes = {};
+ swfobject.embedSWF("rdpweb/RDPClientUI.swf", "FlashRDP", "100", "100", "9.0.0","", flashvars, params, attributes);
+
+ var ua = swfobject.ua;
+
+ // No flash installed
+ if(!ua || ua.pv[0] == '0') {
+ $('#vboxRDPFormContainer').css('display','none');
+ $("#FlashRDP").css('width','100%').html("The Adobe Flash plugin is not installed.");
+ }
+}
+
+function vboxRDPgetFlashProperty(name) {
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ try {
+ return flash.getProperty(name);
+ } catch (e) {
+ return '';
+ }
+}
+
+/*
+ * RDP client event handlers.
+ * They will be called when the flash movie is ready and some event occurs.
+ * Note: the function name must be the "flash_id" + "event name".
+ */
+function RDPWebEventLoaded(flashid) {
+
+ vboxRDPFlashLoaded = true;
+ $("#vboxRDPStatus").html(trans("Version",'UIVMDesktop') + ": " + vboxRDPgetFlashProperty("version"));
+ if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
+
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+
+ // Apply keyboard layout
+ flash.setProperty("keyboardLayout", ($('#vboxPane').data('vboxConfig').consoleKeyboardLayout == 'DE' ? 'de' : 'en'));
+
+ // Only do this once
+ if(!vboxRDPFlashListenersAdded) {
+
+ if (window.addEventListener) {
+ window.addEventListener("contextmenu", function(event) { return RDPWebClient._MozillaContextMenu(event); }, true);
+ window.addEventListener("mousedown", function(event) { return RDPWebClient._MozillaMouse(event, true); }, true);
+ window.addEventListener("mouseup", function(event) { return RDPWebClient._MozillaMouse(event, false); }, true);
+ flash.addEventListener("mouseout", function(event) { return RDPWebClient._MozillaMouseOut(event); }, true);
+ } else {
+ document.oncontextmenu = function() { return RDPWebClient._IEContextMenu(); };
+ flash.parentNode.onmousedown = function() { return RDPWebClient._IEMouse(true); };
+ flash.parentNode.onmouseup = function() { return RDPWebClient._IEMouse(false); };
+ flash.onmouseout=function() {return RDPWebClient._IEMouseOut(); };
+ }
+
+ vboxRDPFlashListenersAdded = true;
+
+ }
+
+ // Connect if "detached"
+ if(vboxConsoleDetached) {
+ $('#vboxTabVMUnavailable').css({'display':'none'});
+ $('#vboxRDPFormContainer').css({'display':'none'});
+ $('#vboxRDPSize').val($(window.opener.document.getElementById('vboxRDPSize')).val());
+ $('#vboxRDPFormContainer').find(".vboxRDPSet").each(function(){
+ $(this).val(window.opener.document.forms['vboxRDPForm'][$(this).attr('name')].value);
+ });
+ $(window).on('resize',function(){
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ var wh = [ $(window).width()-2, $(window).height()-2 ];
+ $(flash).css({'height':wh[1]+'px','width':wh[0]+'px'});
+ $('#FlashRDP').css({'height':wh[1]+'px','width':wh[0]+'px'});
+ flash.setProperty("displayWidth", wh[0]);
+ flash.setProperty("displayHeight", wh[1]);
+ $(flash).css({'display':'none'});
+ $(flash).css({'display':'block'});
+ });
+ vboxRDPConnect();
+ } else {
+
+ $('#vboxRDPConnParams').show();
+ $('#vboxRDPFormContainer').css('display','');
+
+ // Did not explicitly disconnect from this VM and has no auth settings so reconnect
+ if(vboxGetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected') == 'true' && $('#vboxConsoleLoginInfo').data('vboxVRDPauthType') == 'Null') {
+ document.vboxRDPForm.connectionButton.click();
+ }
+ }
+}
+
+function RDPWebEventConnected(flashId) {
+ $("#vboxRDPStatus").data('vmConnected',true);
+ $("#vboxRDPStatus").html(trans("Connected to %1",'VBoxConsoleWgt').replace('%1',$(document.vboxRDPForm.serverAddress).val()));
+ if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
+ $('#vboxConsoleCADButton').show();
+ $('#vboxVRDPDetachBtn').show();
+}
+
+function RDPWebEventServerRedirect(flashId) {
+ $("#vboxRDPStatus").html(trans("Redirection by %1",'VBoxConsoleWgt').replace('%1',vboxRDPgetFlashProperty("serverAddress")));
+ if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").text();
+}
+
+function RDPWebEventDisconnected(flashId) {
+
+ $("#vboxRDPStatus").data('vmConnected',false);
+
+ $('#vboxRDPConnParams').show();
+ $('#vboxVRDPDetachBtn').hide();
+
+ /* RDP connection has been lost */
+ $("#vboxRDPStatus").html(trans("Disconnect reason",'VBoxConsoleWgt')+":\n" + vboxRDPgetFlashProperty("lastError"));
+ if(vboxConsoleDetached) {
+ alert($("#vboxRDPStatus").text());
+ window.close();
+ }
+ document.vboxRDPForm.connectionButton.value = trans("Connect",'VBoxConsoleWgt');
+ document.vboxRDPForm.connectionButton.onclick=function() {
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(),true);
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected','true',true);
+ return vboxRDPConnect();
+ };
+ $('#vboxConsoleAddr').css('display','');
+ $('#vboxConsoleCADButton').hide();
+
+ $('#vboxRDPFormContainer').css({'display':''});
+}
+
+
+function vboxRDPConnect() {
+
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(), true);
+
+ if (!vboxRDPFlashLoaded) return false;
+
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ if (!flash) return;
+
+ $('#vboxRDPConnParams').hide();
+
+ document.vboxRDPForm.connectionButton.value = trans("Disconnect",'VBoxConsoleWgt');
+ document.vboxRDPForm.connectionButton.onclick=function(){
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected');
+ return vboxRDPDisconnect();
+ };
+
+ $('#vboxConsoleAddr').css('display','none');
+ $('#FlashRDPContainer').css({'visibility':'visible'});
+
+
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+
+ var wh = null;
+ if(vboxConsoleDetached) {
+ wh = [ $(document).width()-2, $(document).height()-2 ];
+ } else {
+ wh = $('#vboxRDPSize').val().split('x');
+ }
+ $(flash).css({'height':wh[1]+'px','width':wh[0]+'px'});
+ flash.setProperty("displayWidth", wh[0]);
+ flash.setProperty("displayHeight", wh[1]);
+
+ /* Setup the client parameters. */
+ $('#vboxRDPFormContainer').find(".vboxRDPSet").each(function(){
+ flash.setProperty($(this).attr('name'),$(this).val());
+ });
+
+ $("#vboxRDPStatus").html(trans("Connecting to %1",'VBoxConsoleWgt').replace('%1',$(document.vboxRDPForm.serverAddress).val()) + "...");
+ if(vboxConsoleDetached) window.status = $("#vboxRDPStatus").html();
+
+ /* Establish the connection. */
+ flash.connect();
+
+}
+
+function vboxRDPDisconnect() {
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ if (flash) try { flash.disconnect(); } catch (err) {};
+ /* Restore the "Connect" form. And resize flash*/
+ document.vboxRDPForm.connectionButton.value = trans("Connect",'VBoxConsoleWgt');
+ document.vboxRDPForm.connectionButton.onclick=function() {
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleConnected','true',true);
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$('#vboxRDPSize').val(),true);
+ vboxRDPConnect();this.blur();
+ };
+ $('#vboxConsoleCADButton').hide();
+ $(flash).css({'height':'100px','width':'100px'});
+ $('#vboxConsoleAddr').css('display','');
+
+}
+
+function vboxRDPsendCAD() {
+ var flash = RDPWebClient.getFlashById("FlashRDP");
+ if (flash) flash.keyboardSendCAD();
+}
+
+function vboxRDPDetach() {
+
+ vboxRDPDisconnect();
+
+ var vmname = vboxChooser.getSingleSelected().name;
+ var wh = $('#vboxRDPSize').val().split('x');
+ var newwin = window.open('about:blank','vboxConsoleDetachedWin'+vmname.replace(/[^a-zA-Z0-9]/g,'_'),'toolbar=0,menubar=0,location=0,directories=0,status=true,resize=true,width='+(parseInt(wh[0])+20)+',height='+(parseInt(wh[1])+20)+'');
+
+ newwin.document.open();
+ newwin.document.write('<html><head><title>'+vmname + ' - ' + trans('Console','UIVMDesktop')+'</title></head><body style="margin: 0px; border: 0px; padding: 0px; overflow: hidden;"><div style="margin: 0px; border: 0px; padding: 0px" id="vboxPane"><img src="images/spinner.gif" /></div></body></html>');
+ newwin.document.close();
+ newwin.trans = function(t) { return t; };
+ var newHead = newwin.document.getElementsByTagName('HEAD')[0];
+
+ var headTags = document.getElementsByTagName('HEAD')[0].getElementsByTagName('SCRIPT');
+ for(var i = 0; i < headTags.length; i++) {
+
+ // Ignore runtime scripts
+ if(!$(headTags[i]).attr('src')) continue;
+
+ var script = newwin.document.createElement('script');
+ script.setAttribute('type','text/javascript');
+ script.setAttribute('src',$(headTags[i]).attr('src'));
+ newHead.appendChild(script);
+ }
+ // Load self
+ var script = newwin.document.createElement('script');
+ script.setAttribute('type','text/javascript');
+ script.text = "var vboxConsoleDetached = true;\
+ function vboxConsoleCheckLoad() {\
+ if(vboxLoader && jQuery) vboxConsoleDetachedOnload();\
+ else setTimeout(\"vboxConsoleCheckLoad()\",1000);\
+ }\
+ function vboxConsoleDetachedOnload(){\
+ l = new vboxLoader();\
+ l.add('getConfig',function(d){$('#vboxPane').data('vboxConfig',d.responseData);});\
+ l.addFile('panes/tabVMConsoleRDP.html',function(d){$('#vboxPane').children().remove();$('#vboxPane').append(d);$('#vboxTabVMConsole').css('display','');vboxRDPLoad();});\
+ l.run();};\
+ setTimeout(\"vboxConsoleCheckLoad()\",1000);";
+ newHead.appendChild(script);
+
+}
+
+</script>
+
+
+<iframe style="height:0px;width:0px;visibility:hidden" src="about:blank">
+ this frame prevents back forward cache in Safari
+</iframe>
+
diff --git a/panes/tabVMConsoleVNC.html b/panes/tabVMConsoleVNC.html
index f1c416f..e792c17 100644
--- a/panes/tabVMConsoleVNC.html
+++ b/panes/tabVMConsoleVNC.html
@@ -1,189 +1,189 @@
-<!--
-
- VM Console tab
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabVMConsoleVNC.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<form name="vboxVNCForm" id="vboxVNCForm">
- <span class='translate'>Requested desktop size</span>:
- <select id='vboxVNCSize' name='vboxVNCSizeSelect'>
- <option value='800x600'>800x600</option>
- <option value='1024x768'>1024x768</option>
- <option value='1280x1024'>1280x1024</option>
- </select>
- <input id='vboxVNCDetachBtn' name='detach' type='button' value='Detach' onClick="vboxVNCDetach();" />
-</form>
-<div id='vboxVNCAppletContainer'>
-</div>
-<script type='text/javascript'>
-
-//Custom resolutions
-if($("#vboxPane").data('vboxConfig').consoleResolutions) {
- var res = $("#vboxPane").data('vboxConfig').consoleResolutions;
- // first one must be valid
- if(res[0].split('x').length == 2) {
- document.vboxVNCForm.vboxVNCSizeSelect.options.length = 0;
- $(document.vboxVNCForm.vboxVNCSizeSelect).children().remove();
- for(var i = 0; i < res.length; i++) {
- document.vboxVNCForm.vboxVNCSizeSelect.options[i] = new Option(res[i],res[i]);
- }
- }
- $(document.vboxVNCForm.vboxVNCSizeSelect).on('change',function(){
- var wh = $(this).val().split('x');
- var width = wh[0];
- var height = wh[1];
-
- $('#vboxVNCAppletContainer').children().first().attr({'height':height,'width':width});
-
- vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$(this).val(),true);
- });
-}
-
-// Translate
-$(document.vboxVNCForm.vboxVNCDetachBtn).val(trans("Detach",'VBoxConsoleWgt'));
-
-//Disable / enable tab on selection list changes
-$('#vboxPane').on('vmSelectionListChanged', function(){
-
- var vm = vboxChooser.getSingleSelected();
-
- // Initially disable tab
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
-
- if(vm && vboxVMStates.isRunning(vm)) {
-
- // VM is running, get runtime data
- $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(info) {
-
- if(info.VRDEServerInfo && info.VRDEServerInfo.port > 0) {
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
-
- }
-
- });
-
- }
-
-
-// Update on console info change
-}).on('vboxOnVRDEServerInfoChanged',function(e,eventData) {
-
- // Shorthand
- var vmid = eventData.machineId;
- var VRDEServerInfo = eventData.enrichmentData;
-
- var selVM = vboxChooser.getSingleSelected();
- var enabled = (selVM && selVM.id == vmid && vboxVMStates.isRunning(selVM) && VRDEServerInfo && VRDEServerInfo.port > 0);
-
- if(enabled) {
-
- $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(info) {
-
- enabled = (info.VRDEServerInfo && info.VRDEServerInfo.port > 0);
-
- if(enabled) {
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
-
- var chost = vboxGetVRDEHost(selVM);
- chost+=':'+VRDEServerInfo.port;
-
- } else {
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
- }
-
- });
-
- } else {
-
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
- }
-
-// Update tab on machine state change
-}).on('vboxOnMachineStateChanged', function(e, eventData){
-
- var selVMId = vboxChooser.getSingleSelectedId();
- var enabled = (selVMId == eventData.machineId && vboxVMStates.isRunning({'state':eventData.state}));
-
- $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
-
- if(enabled) {
-
- // VM is running, get runtime data
- $.when(vboxVMDataMediator.getVMRuntimeData(eventData.machineId)).done(function(vm) {
-
- if(vm.VRDEServerInfo && vm.VRDEServerInfo.port > 0) {
-
- $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
-
- }
-
- });
-
- }
-
-// Clean up local data storage when a machine is unregistered
-}).on('vboxMachineRegistered', function(e, eventData) {
-
- if(!eventData.registered) {
- vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleSize','',true);
- vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleConnected','',true);
- }
-});
-
-/*
- * Populate console info values when this tab is shown
- */
-
-$('#vboxTabVMConsole').on('show',function(){
-
- var vm = vboxChooser.getSingleSelected();
-
- /* Load runtime data. This will tell us if the VRDE server is actually active */
- /* And details. This will give us info about the VRDEServer configuration */
- $.when(vboxVMDataMediator.getVMRuntimeData(vm.id),vboxVMDataMediator.getVMDetails(vm.id))
- .done(function(runtimeData, detailsData) {
-
- /* Not active */
- if(!(runtimeData.VRDEServerInfo && runtimeData.VRDEServerInfo.port > 0)) {
- $('#vboxTabVMConsole').parent().trigger('disableTab',['vboxTabVMConsole']);
- return;
- }
-
- // Set default console size for this VM?
- var cs = vboxGetLocalDataItem('vbox'+detailsData.id+'ConsoleSize');
- if(cs) {
- $(document.vboxVNCForm.vboxVNCSizeSelect).children('[value='+cs+']').first().prop('selected',true);
- }
-
- var wh = $(document.vboxVNCForm.vboxVNCSizeSelect).val().split('x');
- var width = wh[0];
- var height = wh[1];
-
- var chost = vboxGetVRDEHost(runtimeData);
-
- $('#vboxVNCAppletContainer').empty().html('<APPLET CODE="VncViewer.class" ARCHIVE="tightvnc/VncViewer.jar" width="'+width+'" height="'+height+'"><PARAM NAME="PORT" VALUE="'+runtimeData.VRDEServerInfo.port+'"><PARAM NAME="HOST" VALUE="'+chost+'"></APPLET>');
-
- });
-
-});
-
-function vboxVNCDetach() {
-
- var vmname = vboxChooser.getSingleSelected().name;
-
- var wh = $('#vboxVNCSize').val().split('x');
- var newwin = window.open('about:blank','vboxConsoleDetachedWin'+vmname.replace(/[^a-zA-Z0-9]/g,'_'),'toolbar=0,menubar=0,location=0,directories=0,status=true,resize=true,width='+(parseInt(wh[0])+20)+',height='+(parseInt(wh[1])+20)+'');
-
- newwin.document.open();
- newwin.document.write('<html><head><title>'+vmname + ' - ' + trans('Console','UIVMDesktop')+'</title></head><body style="margin: 0px; border: 0px; padding: 0px; overflow: hidden;"><div style="margin: 0px; border: 0px; padding: 0px" id="vboxPane">'+$('#vboxVNCAppletContainer').html()+'</div></body></html>');
- newwin.document.close();
- newwin.trans = function(t) { return t; };
-
-}
-
-
+<!--
+
+ VM Console tab
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabVMConsoleVNC.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<form name="vboxVNCForm" id="vboxVNCForm">
+ <span class='translate'>Requested desktop size</span>:
+ <select id='vboxVNCSize' name='vboxVNCSizeSelect'>
+ <option value='800x600'>800x600</option>
+ <option value='1024x768'>1024x768</option>
+ <option value='1280x1024'>1280x1024</option>
+ </select>
+ <input id='vboxVNCDetachBtn' name='detach' type='button' value='Detach' onClick="vboxVNCDetach();" />
+</form>
+<div id='vboxVNCAppletContainer'>
+</div>
+<script type='text/javascript'>
+
+//Custom resolutions
+if($("#vboxPane").data('vboxConfig').consoleResolutions) {
+ var res = $("#vboxPane").data('vboxConfig').consoleResolutions;
+ // first one must be valid
+ if(res[0].split('x').length == 2) {
+ document.vboxVNCForm.vboxVNCSizeSelect.options.length = 0;
+ $(document.vboxVNCForm.vboxVNCSizeSelect).children().remove();
+ for(var i = 0; i < res.length; i++) {
+ document.vboxVNCForm.vboxVNCSizeSelect.options[i] = new Option(res[i],res[i]);
+ }
+ }
+ $(document.vboxVNCForm.vboxVNCSizeSelect).on('change',function(){
+ var wh = $(this).val().split('x');
+ var width = wh[0];
+ var height = wh[1];
+
+ $('#vboxVNCAppletContainer').children().first().attr({'height':height,'width':width});
+
+ vboxSetLocalDataItem('vbox'+vboxChooser.getSingleSelectedId()+'ConsoleSize',$(this).val(),true);
+ });
+}
+
+// Translate
+$(document.vboxVNCForm.vboxVNCDetachBtn).val(trans("Detach",'VBoxConsoleWgt'));
+
+//Disable / enable tab on selection list changes
+$('#vboxPane').on('vmSelectionListChanged', function(){
+
+ var vm = vboxChooser.getSingleSelected();
+
+ // Initially disable tab
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+
+ if(vm && vboxVMStates.isRunning(vm)) {
+
+ // VM is running, get runtime data
+ $.when(vboxVMDataMediator.getVMDataCombined(vm.id)).done(function(info) {
+
+ if(info.VRDEServerInfo && info.VRDEServerInfo.port > 0) {
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+
+ }
+
+ });
+
+ }
+
+
+// Update on console info change
+}).on('vboxOnVRDEServerInfoChanged',function(e,eventData) {
+
+ // Shorthand
+ var vmid = eventData.machineId;
+ var VRDEServerInfo = eventData.enrichmentData;
+
+ var selVM = vboxChooser.getSingleSelected();
+ var enabled = (selVM && selVM.id == vmid && vboxVMStates.isRunning(selVM) && VRDEServerInfo && VRDEServerInfo.port > 0);
+
+ if(enabled) {
+
+ $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(info) {
+
+ enabled = (info.VRDEServerInfo && info.VRDEServerInfo.port > 0);
+
+ if(enabled) {
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+
+ var chost = vboxGetVRDEHost(selVM);
+ chost+=':'+VRDEServerInfo.port;
+
+ } else {
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+ }
+
+ });
+
+ } else {
+
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+ }
+
+// Update tab on machine state change
+}).on('vboxOnMachineStateChanged', function(e, eventData){
+
+ var selVMId = vboxChooser.getSingleSelectedId();
+ var enabled = (selVMId == eventData.machineId && vboxVMStates.isRunning({'state':eventData.state}));
+
+ $('#vboxTabVMConsole').parent().trigger('disableTab', ['vboxTabVMConsole']);
+
+ if(enabled) {
+
+ // VM is running, get runtime data
+ $.when(vboxVMDataMediator.getVMRuntimeData(eventData.machineId)).done(function(vm) {
+
+ if(vm.VRDEServerInfo && vm.VRDEServerInfo.port > 0) {
+
+ $('#vboxTabVMConsole').parent().trigger('enableTab', ['vboxTabVMConsole']);
+
+ }
+
+ });
+
+ }
+
+// Clean up local data storage when a machine is unregistered
+}).on('vboxMachineRegistered', function(e, eventData) {
+
+ if(!eventData.registered) {
+ vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleSize','',true);
+ vboxSetLocalDataItem('vbox'+eventData.machineId+'ConsoleConnected','',true);
+ }
+});
+
+/*
+ * Populate console info values when this tab is shown
+ */
+
+$('#vboxTabVMConsole').on('show',function(){
+
+ var vm = vboxChooser.getSingleSelected();
+
+ /* Load runtime data. This will tell us if the VRDE server is actually active */
+ /* And details. This will give us info about the VRDEServer configuration */
+ $.when(vboxVMDataMediator.getVMRuntimeData(vm.id),vboxVMDataMediator.getVMDetails(vm.id))
+ .done(function(runtimeData, detailsData) {
+
+ /* Not active */
+ if(!(runtimeData.VRDEServerInfo && runtimeData.VRDEServerInfo.port > 0)) {
+ $('#vboxTabVMConsole').parent().trigger('disableTab',['vboxTabVMConsole']);
+ return;
+ }
+
+ // Set default console size for this VM?
+ var cs = vboxGetLocalDataItem('vbox'+detailsData.id+'ConsoleSize');
+ if(cs) {
+ $(document.vboxVNCForm.vboxVNCSizeSelect).children('[value='+cs+']').first().prop('selected',true);
+ }
+
+ var wh = $(document.vboxVNCForm.vboxVNCSizeSelect).val().split('x');
+ var width = wh[0];
+ var height = wh[1];
+
+ var chost = vboxGetVRDEHost(runtimeData);
+
+ $('#vboxVNCAppletContainer').empty().html('<APPLET CODE="VncViewer.class" ARCHIVE="tightvnc/VncViewer.jar" width="'+width+'" height="'+height+'"><PARAM NAME="PORT" VALUE="'+runtimeData.VRDEServerInfo.port+'"><PARAM NAME="HOST" VALUE="'+chost+'"></APPLET>');
+
+ });
+
+});
+
+function vboxVNCDetach() {
+
+ var vmname = vboxChooser.getSingleSelected().name;
+
+ var wh = $('#vboxVNCSize').val().split('x');
+ var newwin = window.open('about:blank','vboxConsoleDetachedWin'+vmname.replace(/[^a-zA-Z0-9]/g,'_'),'toolbar=0,menubar=0,location=0,directories=0,status=true,resize=true,width='+(parseInt(wh[0])+20)+',height='+(parseInt(wh[1])+20)+'');
+
+ newwin.document.open();
+ newwin.document.write('<html><head><title>'+vmname + ' - ' + trans('Console','UIVMDesktop')+'</title></head><body style="margin: 0px; border: 0px; padding: 0px; overflow: hidden;"><div style="margin: 0px; border: 0px; padding: 0px" id="vboxPane">'+$('#vboxVNCAppletContainer').html()+'</div></body></html>');
+ newwin.document.close();
+ newwin.trans = function(t) { return t; };
+
+}
+
+
</script> \ No newline at end of file
diff --git a/panes/tabVMDetails.html b/panes/tabVMDetails.html
index 23df5c6..bc3de84 100644
--- a/panes/tabVMDetails.html
+++ b/panes/tabVMDetails.html
@@ -1,752 +1,752 @@
-<!--
-
- VM Details Pane
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabVMDetails.html 596 2015-04-19 11:50:53Z imoore76 $
-
- -->
-<div id='vboxTabVMDetails' style='height: 100%; width: 100%; display: none;' class='vboxInvisible'>
-
- <!-- VM Details -->
- <div id='vboxVMDetails' style='height: 100%; width: 100%; display: table; min-height:100px;' class='vboxInvisible'></div>
-
- <!-- Loading... -->
- <div id='vboxDetailsLoading' class='vboxInvisible' style='#position:absolute;#top:50%;display:none;vertical-align:middle;width:100%;height:100%;padding:0px;margin:0px'>
- <div style='#position:relative;#top:-50%;padding:4px;text-align:center;width:100%'>
- <span class='ui-corner-all translate' style='padding:8px;background:#fff;border:2px solid #ddd'>Loading ...</span>
- </div>
- </div>
-
- <!-- Welcome -->
- <div id='vboxDetailsWelcome' style='#position:absolute;#top:50%;display:table-cell;vertical-align:middle;width:50%;height:50%;text-align:center'>
- <div style='#position:relative;#top:-50%;padding:0px;text-align:center;width:100%'>
- <img src='images/vbox/welcome.png' />
- </div>
- </div>
-
-<script type='text/javascript'>
-
-// Translate loading div
-$('#vboxDetailsLoading').find('span.translate').html(trans('Loading ...','UIVMDesktop')).removeClass('translate');
-
-// Last selection list was none
-$('#vboxTabVMDetails').data('vboxLastSelectionList',[]);
-
-// Listen for events
-/////////////////////////////
-$('#vboxPane').on('vmSelectionListChanged',function(){
-
- // No VMs?
- if(!vboxChooser || vboxChooser.selectionMode == vboxSelectionModeNone) {
-
- // Hide all tab children first
- $('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
-
- // Display Welcome div
- $('#vboxDetailsWelcome').show().css('display','table-cell');
-
- $('#vboxTabVMDetails').data('showingWelcome', true);
-
- $('#vboxTabVMDetails').data('vboxLastSelectionList',[]);
-
- return;
-
- // Were we showing the welcome screen before?
- } else if($('#vboxTabVMDetails').data('showingWelcome')) {
-
- $('#vboxTabVMDetails').css({'display':''})
- .data({'showingWelcome':false}).children().hide();
- $('#vboxVMDetails').html('').css({'display':''});
-
- }
-
- // We have VMs to load
- if(vboxChooser.selectionMode != vboxSelectionModeNone) {
-
- var targetDiv = $('#vboxVMDetails');
-
- // Loading scren
- if(vboxChooser.selectedVMs.length == 1 && $('#vboxTabVMDetails').css('display') != 'none') {
-
- // Hide all tab children first
- $('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
-
- // Display loading div
- $('#vboxDetailsLoading').show().css('display','table-cell');
- }
-
- if(vboxChooser.getSingleSelectedId() == 'host') {
-
- $('#vboxTabVMDetails').data('vboxLastSelectionList',['host']);
-
- targetDiv.children().empty().remove();
-
- $.when(vboxVMDataMediator.getVMDetails('host')).done(function(d) {
-
- // Hide loading screen
- targetDiv.siblings().hide();
- targetDiv.show();
-
-
- __vboxDisplayHostDetailsData(d, targetDiv);
-
- });
-
- return;
- }
-
- // Remove anything that is not a details table
- targetDiv.children(':not(table)').remove();
-
- // Last list of selected vms
- var lastSelectionList = $('#vboxTabVMDetails').data('vboxLastSelectionList');
- $('#vboxTabVMDetails').data('vboxLastSelectionList', vboxChooser.selectedVMs);
-
- // Remove any that aren't in list
- $(lastSelectionList).not(vboxChooser.selectedVMs).each(function(idx,vmid){
- $('#vboxVMDetails .vboxVMDetailsBox-vm-'+vmid).empty().remove();
- });
-
- // Placeholders so vms are listed in order
- for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
-
- if(jQuery.inArray(vboxChooser.selectedVMs[i], lastSelectionList) > -1) {
- $('#vboxDetailsGeneralTable-'+vboxChooser.selectedVMs[i]).detach().appendTo(targetDiv);
- } else {
- $('<table />').attr({'id':'vboxDetailsGeneralTable-'+vboxChooser.selectedVMs[i],'class':'vboxInvisible vboxVMDetailsBox-vm-'+vboxChooser.selectedVMs[i],'style':'display:none'})
- .appendTo(targetDiv);
- }
-
-
- }
-
- var oneLoaded = false;
- var skipTable = false; // skip drawing multi-section details table
- for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
-
- // Already drawn and we are showing more than one vm
- if(jQuery.inArray(vboxChooser.selectedVMs[i], lastSelectionList) > -1) {
-
- if(vboxChooser.selectedVMs.length > 1) {
- oneLoaded = true;
- targetDiv.siblings().hide();
- targetDiv.show();
- continue;
- }
- skipTable = true;
- }
-
- $.when(vboxChooser.selectedVMs[i], vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[i])).done(function(vmid, d) {
-
- // Remove placeholder and don't draw
- // if this vm is no longer selected
- if(!d || !vboxChooser.isVMSelected(vmid)) {
- $('#vboxDetailsGeneralTable-'+vmid).empty().remove();
- return;
- }
-
- // Clear target div if we only have one vm
- if(!oneLoaded) {
- oneLoaded = true;
- targetDiv.siblings().hide();
- targetDiv.show();
- }
-
-
- __vboxDisplayDetailsData(d, (vboxChooser.selectedVMs.length > 1), targetDiv, skipTable);
-
- });
- }
-
-
- }
-
-
-/////////////////////////////////
-//
-// Redraw section logic
-//
-//////////////////////////////////
-}).on('vboxEvents', function(e, eventList) {
-
- // Multiple vms selected
- var multiSelect = (vboxChooser.selectedVMs.length > 1);
-
- // Keep track of details to redraw
- var vmRedrawDetails = {};
- var vmRedrawSections = {};
- var vmTriggerEventSection = {};
-
- // Each event in list
- for(var i = 0; i < eventList.length; i++) {
-
- // Nothing to do if VM is not selected
- if(!eventList[i].machineId || !vboxChooser.isVMSelected(eventList[i].machineId))
- continue;
-
-
-
- switch(eventList[i].eventType) {
-
- // These trigger complete redraws
- case 'OnMachineDataChanged':
- vmRedrawDetails[eventList[i].machineId] = true;
- break;
-
- default:
-
- // already redrawing all vm details
- if(vmRedrawDetails[eventList[i].machineId])
- break;
-
- // Check for specific section redraws or events
- for(var s in vboxVMDetailsSections) {
-
- if(typeof(s) != 'string') continue;
- if(multiSelect && !vboxVMDetailsSections[s].multiSelectDetailsTable) continue;
-
- // Redraw this section?
- if(vboxVMDetailsSections[s].redrawMachineEvents && jQuery.inArray(eventList[i].eventType, vboxVMDetailsSections[s].redrawMachineEvents) > -1) {
-
- if(!vmRedrawSections[eventList[i].machineId])
- vmRedrawSections[eventList[i].machineId] = {};
-
- vmRedrawSections[eventList[i].machineId][s] = true;
-
- // Specific event handler
- } else if(vboxVMDetailsSections[s]['vboxEvent'+eventList[i].eventType]) {
-
- if(!vmTriggerEventSection[eventList[i].machineId])
- vmTriggerEventSection[eventList[i].machineId] = {};
- if(!vmTriggerEventSection[eventList[i].machineId][s])
- vmTriggerEventSection[eventList[i].machineId][s] = [];
-
- vmTriggerEventSection[eventList[i].machineId][s][vmTriggerEventSection[eventList[i].machineId][s].length] = eventList[i];
- }
- }
-
- } // </ switch eventType >
-
-
- } // </ foreach event >
-
-
- // Target for actions
- var targetDiv = $('#vboxVMDetails');
-
-
- // Redraw each details table
- /////////////////////////////////
- for(var vmid in vmRedrawDetails) {
-
- if(typeof(vmid) != 'string') continue;
-
- // Get and show details and runtime data again
- $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(d) {
-
- // Do nothing if VM is no longer selected
- if(!vboxChooser.isVMSelected(d.id)) return;
-
- // if there's only one, we'll have to remove existing data
- if(vboxChooser.selectedVMs.length == 1) {
- targetDiv.children().empty().remove();
- }
- // Special case for host
- if(d.id == 'host') __vboxDisplayHostDetailsData(d, targetDiv);
- else __vboxDisplayDetailsData(d, (vboxChooser.selectedVMs.length > 1), targetDiv);
- });
-
- };
-
- // Redraw each section
- ////////////////////////////
- for(var vmid in vmRedrawSections) {
-
- if(typeof(vmid) != 'string') continue;
- if(vmRedrawDetails[vmid]) continue; // already redrew entire details
-
- // Get and show details and runtime data again
- $.when(vboxVMDataMediator.getVMDataCombined(vmid),vmRedrawSections[vmid]).done(function(d,sections) {
-
- // Do nothing if VM is no longer selected
- if(!vboxChooser.isVMSelected(d.id)) return;
-
- // Redraw each section in list
- for(var s in sections) {
-
- if(typeof(s) != 'string') continue;
-
- $('#vboxDetailsSectionId-'+s+'-'+d.id).replaceWith(
- __vboxCreateDetailsSection(d, s)
- );
-
- if(vboxVMDetailsSections[s].onRender)
- vboxVMDetailsSections[s].onRender(d);
-
- }
- });
-
- }
-
- // Specific event handlers for each section
- for(var vmid in vmTriggerEventSection) {
-
- if(typeof(vmid) != 'string') continue;
- if(vmRedrawDetails[vmid]) continue; // already redrew entire details
-
- // Do nothing if VM is no longer selected
- if(!vboxChooser.isVMSelected(vmid)) return;
-
- for(var s in vmTriggerEventSection[vmid]) {
-
- if(typeof(s) != 'string') continue;
- if(vmRedrawSections[vmid] && vmRedrawSections[vmid][s]) continue; // already redrew this section
-
- // Call each event handler
- for(var i = 0; i < vmTriggerEventSection[vmid][s].length; i++) {
- var event = vmTriggerEventSection[vmid][s][i];
- vboxVMDetailsSections[s]['vboxEvent'+event.eventType](event);
- }
-
-
- }
-
- }
-
-});
-
-// Hide context menus when hiding tab
-$('#vboxTabVMDetails').on('hide',function(){
- $('ul.contextMenu').hide();
-});
-
-
-
-//Base function that returns a table row of machine detail data
-//Called from other functions
-function __vboxDetailRow(name, value, cssClass, html) {
-
- // convert to strings
- if(typeof(value) == 'undefined') value = '';
- name = ''+name;
- value = ''+value;
-
-
- var tr = $('<tr />').attr({'class':'vboxDetailRow'});
- $('<th />').html(name + (value && value.length && name.length ? ':' : ''))
- .attr({'class':'vboxDetailContent ' + cssClass})
- .appendTo(tr);
-
- $('<td />').attr({'class':'vboxDetailsValue'}).html(value).appendTo(tr);
-
- return tr;
-}
-
-//Draw rows to table
-function __vboxDetailAddRows(data, rows, table) {
-
- // Is rows a function?
- if(typeof(rows) == 'function') rows = rows(data);
-
- for(var i = 0; i < rows.length; i++) {
-
- // Check if row has condition
- if(rows[i].condition && !rows[i].condition(data)) continue;
-
- // hold row data
- var rowData = '';
-
- // Check for row attribute
- if(rows[i].attrib) {
- if(!data[rows[i].attrib]) continue;
- rowData = data[rows[i].attrib];
-
- // Check for row callback
- } else if(rows[i].callback) {
- rowData = rows[i].callback(data);
-
- // Static data
- } else {
- rowData = rows[i].data;
- }
-
- if(rows[i].rawRow) {
- $(table).append(rowData);
- } else {
- var title = trans(rows[i].title, rows[i].language_context);
- $(table).append(__vboxDetailRow(
- title,
- rowData,
- 'vboxDetailName ' + (rows[i].indented ? ' vboxDetailNameIndent' : '') + ' ' + (rows[i].cssClass ? rows[i].cssClass : ''),
- rows[i].html));
- }
-
- }
-
-}
-
-// Details section
-////////////////////////////
-function __vboxCreateDetailsSection(data, sectionName, section) {
-
- if(!section)
- section = vboxVMDetailsSections[sectionName];
-
- var links = true;
-
- // No link if VM is not in valid state
- if(!((vboxVMStates.isRunning(data) || vboxVMStates.isPaused(data) || vboxVMStates.isEditable(data)) && !vboxVMStates.isSaved(data))) {
- links = false;
- }
-
- var title = trans(section.title, section.language_context);
- var vboxDetailsTable = $('<table />')
- .attr({'class':'vboxDetailsTable vboxDetailsTableBox'})
- .append($('<thead />')
- .append($('<tr />').attr({'class':'vboxDetailsHead'})
- .append($('<th />').attr({'class':'vboxDetailsSection','colspan':'2'})
- .append($('<div />')
- .append(
- $('<img />').attr({'style':'float:left;margin-right:3px','src':'images/vbox/'+section.icon,'class':'vboxDetailsSectionIcon'})
- ).append(
- $('<span />').css({'float':'left'}).addClass((links ? 'vboxDetailsSectionLink' : '')).click(function(){
- if($(this).hasClass('vboxDetailsSectionLink'))
- vboxVMsettingsDialog(data,section.settingsLink);
- }).html(title)
- ).append(
- $('<span />').addClass('vboxArrowImage')
- .click(function(){ $(this).parent().trigger("dblclick"); })
- )
- )
- ).disableSelection()
- )
- );
-
-
- var tbody = $('<tbody />');
-
- __vboxDetailAddRows(data, section.rows, tbody);
-
-
- // Class added to last row to aid in rounded corners
- if(section.noFooter) {
- tbody.children().last().addClass('vboxTableLastRow');
- } else {
- tbody.append($('<tr />').addClass('vboxTableLastRow').append($('</td >')).append('<td />'));
- }
-
- vboxDetailsTable.append(tbody);
-
- var vboxDetailsSection = $('<div />')
- .attr({'class':'vboxDetailsBorder vboxVMDetailsBox'+sectionName+ ' vboxVMDetailsBox-vm-'+data.id,'id':'vboxDetailsSectionId-'+sectionName+'-'+data.id})
- .dblclick(__vboxDetailsSectionCollapse)
- .hoverClass('vboxHover').disableSelection().data({'sectionName':sectionName});
-
- if(vboxGetLocalDataItem("vboxSectionCollapse"+sectionName)) {
- vboxDetailsSection.addClass('vboxDetailsSectionCollapsed');
- }
-
- if(!vboxGetLocalDataItem("vboxSectionHide"+sectionName)) {
- $(vboxDetailsSection).show();
- } else {
- $(vboxDetailsSection).hide();
- }
-
- /* Context menu for section ? */
- if(section.contextMenu) {
-
- var menu = section.contextMenu();
-
- $(vboxDetailsSection).mouseup({'vmid':data.id},function(e) {
-
- $('ul.contextMenu').hide();
-
- if(e.button == 2) {
-
- $(menu).trigger('beforeshow', e.data.vmid);
-
- vboxPositionEvent(menu, e);
- $(menu).show();
-
- e.preventDefault();
- e.stopPropagation();
-
- return false;
- }
-
- });
-
- $(vboxDetailsSection)
- .on('contextmenu', function() { return false; })
- .on('click',function(e){return e.button!=2;});
-
- }
- return vboxDetailsSection.append(vboxDetailsTable);
-
-}
-
-//Display details data table for VM
-//////////////////////////////////
-function __vboxDisplayDetailsData(data, multiSelect, targetDiv, skipTable) {
-
- // No data? Should never happen
- if(typeof data == 'undefined') return;
-
-
- // Accessibility check
- if(data.state == 'Inaccessible') {
-
-
- var reasonDiv = $('<div />')
- .attr({'class':'vboxVMDetailsBox-vm-'+data.id})
- .html('<div style="width: 50%">'+trans('The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:','UIDetailsPagePrivate')+'</div>');
-
- // Details Table
- $('<table />').attr({'style':'width: 50%','class':'vboxDetailsTable vboxDetailsTableError vboxVMDetailsBox-vm-'+data.id}).append(__vboxDetailRow(trans("VirtualBox - Error",'UIMessageCenter'), data.accessError['text'])).append(__vboxDetailRow(trans('Result Code: ','UIMessageCenter'), data.accessError['resultCode'])).append(__vboxDetailRow(trans("Component: ",'UIMessageCenter'), data.accessError['component'])).appendTo(targetDiv);
-
- var d = $('<div />').attr({'style':'width: 50%; padding: 4px;'});
-
- $('<input />').attr({'type':'button',
- 'value':trans('Refresh','UIVMLogViewer'),
- 'style':'background: url(images/vbox/refresh_16px.png) 2px 2px no-repeat; padding: 2px 2px 2px 18px; border: 1px solid #000; background-color: #eee;'
- }).click({vmid:data.id},function(e){
-
-
- var l = new vboxLoader();
- l.showLoading();
- $.when(vboxVMDataMediator.refreshVMData(e.data.vmid)).always(function(){
- l.removeLoading();
- });
-
-
- }).appendTo(d);
-
- $(reasonDiv).append(d).appendTo(targetDiv);
-
- return;
- }
-
- // Multi-select details table sections
- ////////////////////////////////////////
- if(!skipTable) {
-
- var tbl = $('<table />').attr({'id':'vboxDetailsGeneralTable-'+data.id,'class':'vboxInvisible vboxVMDetailsBox-vm-'+data.id,'style':'width: 100%;'}).append(
-
- $('<tr />').attr({'style':'vertical-align: top'})
-
- .append(
-
- $('<td />').css({'width':'100%'})
- .append(__vboxCreateDetailsSection(data,'general'))
- .append(__vboxCreateDetailsSection(data,'system'))
-
- ).append(
-
- vboxVMDetailsSections['preview'].condition() ?
- $('<td />')
- .append(__vboxCreateDetailsSection(data,'preview')) :
- null
- )
-
- ).data({'vmid':data.id});
-
- // If already exists, replace the table, else append to div
- if($('#vboxDetailsGeneralTable-'+data.id)[0]) {
- $('#vboxDetailsGeneralTable-'+data.id).replaceWith(tbl);
- } else {
- tbl.appendTo(targetDiv);
- }
-
- for(var s in {'general':1,'system':1,'preview':1}) {
- if(vboxVMDetailsSections[s].onRender)
- vboxVMDetailsSections[s].onRender(data);
- }
-
- }
-
- // Other sections
- ///////////////////////////
-
- // Not shown if multiple vms are selected
- if(multiSelect) return;
-
- for(var s in vboxVMDetailsSections) {
-
- if(vboxVMDetailsSections[s].multiSelectDetailsTable) continue;
-
- if(vboxVMDetailsSections[s].condition && !vboxVMDetailsSections[s].condition(data))
- continue;
-
- $(targetDiv).append(__vboxCreateDetailsSection(data, s));
-
- if(vboxVMDetailsSections[s].onRender)
- vboxVMDetailsSections[s].onRender(data);
-
-
- }
-
-}
-
-//Display details data for VirtualBox Host
-/////////////////////////////////////////////
-function __vboxDisplayHostDetailsData(data, targetDiv) {
-
- for(var s in vboxHostDetailsSections) {
-
- if(vboxHostDetailsSections[s].condition && !vboxHostDetailsSections[s].condition(data))
- continue;
-
- $(targetDiv).append(__vboxCreateDetailsSection(data, s, vboxHostDetailsSections[s]));
-
- if(vboxHostDetailsSections[s].onRender)
- vboxHostDetailsSections[s].onRender(data);
-
- }
-
-}
-
-
-//Collapse section used on dblclick of sections
-function __vboxDetailsSectionCollapse(e) {
-
- // Save section name
- var sectionName = $(this).data('sectionName');
-
- vboxSetLocalDataItem('vboxSectionCollapse'+sectionName,
- ($(this).hasClass('vboxDetailsSectionCollapsed') ? '' : '1')
- );
-
- var collapsed = $(this).hasClass('vboxDetailsSectionCollapsed');
-
-
- // IE8 doesn't display this animation
- if(!($.browser.msie && $.browser.version.substring(0,1) < 9)) {
-
- // Get image span of current section only
- var vboxArrowImage = $(this).find('span.vboxArrowImage');
-
- // Only animate the span that is part of this section header
- // All others just get switched
- $.when($('<div />').animate({left:90},
- {
- duration: 300,
- step: function(currentStep) {
-
- if(collapsed) {
- currentStep = (180 - currentStep);
- } else {
- currentStep = currentStep+90;
- }
- vboxArrowImage.css({
- 'transform':'rotate('+currentStep+'deg)',
- '-moz-transform': 'rotate('+currentStep+'deg)',
- '-webkit-transform': 'rotate('+currentStep+'deg)',
- '-o-transform': 'rotate('+currentStep+'deg)',
- '-ms-transform': 'rotate('+currentStep+'deg)'
- });
- },
- queue: true
- })).done(function(){
-
- vboxArrowImage.css({
- 'transform':'',
- '-moz-transform': '',
- '-webkit-transform': '',
- '-o-transform': '',
- '-ms-transform': ''
- });
-
- });
-
- }
-
- $('#vboxVMDetails').find('div.vboxVMDetailsBox'+sectionName)
- .toggleClass('vboxDetailsSectionCollapsed', (($.browser.msie && $.browser.version.substring(0,1) < 9) ? undefined : 300));
-
-
-
- return false;
-
-}
-
-/*
- *
- * Show / Hide boxes menu
- *
- */
-var ul = $('<ul />')
- .attr({'class':'contextMenu contextMenuNoBG','style':'display: none','id':'vboxDetailsShowMenu'})
- .on('contextmenu', function() { return false; });
-
-for(var i in vboxVMDetailsSections) {
-
- if(typeof(i) != 'string') continue;
-
- // Skip if we shouldn't display
- if(vboxVMDetailsSections[i].condition && !vboxVMDetailsSections[i].condition())
- continue;
-
- $('<li />').attr('id','vboxDetailsShowMenuItem'+i).append(
-
- $('<label />').append(
-
- $('<input />')
- .attr({'type':'checkbox','class':'vboxCheckbox','name':i})
- .prop('checked',!vboxGetLocalDataItem("vboxSectionHide"+i))
- .on('click',{'sectionName':i},function(e){
-
- vboxSetLocalDataItem("vboxSectionHide"+$(this).attr('name'),(this.checked ? '' : '1'));
- $('#vboxTabVMDetails .vboxVMDetailsBox'+$(this).attr('name')).css('display',(this.checked ? '' : 'none'));
-
- var sectionName = e.data.sectionName;
-
- // Run section's onShow function
- if(this.checked && vboxVMDetailsSections[sectionName].onShow) {
- vboxVMDetailsSections[sectionName].onShow();
- } else if(!this.checked && vboxVMDetailsSections[sectionName].onHide) {
- vboxVMDetailsSections[sectionName].onHide();
- }
-
- })
-
- ).append(
- $('<span />').html(trans(vboxVMDetailsSections[i].title, vboxVMDetailsSections[i].language_context))
-
- ).disableSelection()
-
- ).appendTo(ul);
-
-
-}
-$('#vboxTabVMDetails').append(ul);
-
-
-/* Menu functionality */
-$("#vboxVMDetails").mouseup( function(e) {
-
- $('ul.contextMenu').hide();
-
- if(e.button == 2 && vboxChooser.getSingleSelectedId() != 'host') {
-
- var menu = $('#vboxDetailsShowMenu');
- vboxPositionEvent(menu, e);
- $(menu).show();
-
- e.preventDefault();
- e.stopPropagation();
-
- return false;
- }
-
-
-}).on('contextmenu', function() { return false; })
- .on('click',function(e){return e.button!=2;});
-
-//Display Welcome div
-$('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
-$('#vboxDetailsWelcome').show().css('display','table-cell');
-$('#vboxTabVMDetails').data('showingWelcome', true);
-
-</script>
+<!--
+
+ VM Details Pane
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabVMDetails.html 596 2015-04-19 11:50:53Z imoore76 $
+
+ -->
+<div id='vboxTabVMDetails' style='height: 100%; width: 100%; display: none;' class='vboxInvisible'>
+
+ <!-- VM Details -->
+ <div id='vboxVMDetails' style='height: 100%; width: 100%; display: table; min-height:100px;' class='vboxInvisible'></div>
+
+ <!-- Loading... -->
+ <div id='vboxDetailsLoading' class='vboxInvisible' style='#position:absolute;#top:50%;display:none;vertical-align:middle;width:100%;height:100%;padding:0px;margin:0px'>
+ <div style='#position:relative;#top:-50%;padding:4px;text-align:center;width:100%'>
+ <span class='ui-corner-all translate' style='padding:8px;background:#fff;border:2px solid #ddd'>Loading ...</span>
+ </div>
+ </div>
+
+ <!-- Welcome -->
+ <div id='vboxDetailsWelcome' style='#position:absolute;#top:50%;display:table-cell;vertical-align:middle;width:50%;height:50%;text-align:center'>
+ <div style='#position:relative;#top:-50%;padding:0px;text-align:center;width:100%'>
+ <img src='images/vbox/welcome.png' />
+ </div>
+ </div>
+
+<script type='text/javascript'>
+
+// Translate loading div
+$('#vboxDetailsLoading').find('span.translate').html(trans('Loading ...','UIVMDesktop')).removeClass('translate');
+
+// Last selection list was none
+$('#vboxTabVMDetails').data('vboxLastSelectionList',[]);
+
+// Listen for events
+/////////////////////////////
+$('#vboxPane').on('vmSelectionListChanged',function(){
+
+ // No VMs?
+ if(!vboxChooser || vboxChooser.selectionMode == vboxSelectionModeNone) {
+
+ // Hide all tab children first
+ $('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
+
+ // Display Welcome div
+ $('#vboxDetailsWelcome').show().css('display','table-cell');
+
+ $('#vboxTabVMDetails').data('showingWelcome', true);
+
+ $('#vboxTabVMDetails').data('vboxLastSelectionList',[]);
+
+ return;
+
+ // Were we showing the welcome screen before?
+ } else if($('#vboxTabVMDetails').data('showingWelcome')) {
+
+ $('#vboxTabVMDetails').css({'display':''})
+ .data({'showingWelcome':false}).children().hide();
+ $('#vboxVMDetails').html('').css({'display':''});
+
+ }
+
+ // We have VMs to load
+ if(vboxChooser.selectionMode != vboxSelectionModeNone) {
+
+ var targetDiv = $('#vboxVMDetails');
+
+ // Loading scren
+ if(vboxChooser.selectedVMs.length == 1 && $('#vboxTabVMDetails').css('display') != 'none') {
+
+ // Hide all tab children first
+ $('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
+
+ // Display loading div
+ $('#vboxDetailsLoading').show().css('display','table-cell');
+ }
+
+ if(vboxChooser.getSingleSelectedId() == 'host') {
+
+ $('#vboxTabVMDetails').data('vboxLastSelectionList',['host']);
+
+ targetDiv.children().empty().remove();
+
+ $.when(vboxVMDataMediator.getVMDetails('host')).done(function(d) {
+
+ // Hide loading screen
+ targetDiv.siblings().hide();
+ targetDiv.show();
+
+
+ __vboxDisplayHostDetailsData(d, targetDiv);
+
+ });
+
+ return;
+ }
+
+ // Remove anything that is not a details table
+ targetDiv.children(':not(table)').remove();
+
+ // Last list of selected vms
+ var lastSelectionList = $('#vboxTabVMDetails').data('vboxLastSelectionList');
+ $('#vboxTabVMDetails').data('vboxLastSelectionList', vboxChooser.selectedVMs);
+
+ // Remove any that aren't in list
+ $(lastSelectionList).not(vboxChooser.selectedVMs).each(function(idx,vmid){
+ $('#vboxVMDetails .vboxVMDetailsBox-vm-'+vmid).empty().remove();
+ });
+
+ // Placeholders so vms are listed in order
+ for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
+
+ if(jQuery.inArray(vboxChooser.selectedVMs[i], lastSelectionList) > -1) {
+ $('#vboxDetailsGeneralTable-'+vboxChooser.selectedVMs[i]).detach().appendTo(targetDiv);
+ } else {
+ $('<table />').attr({'id':'vboxDetailsGeneralTable-'+vboxChooser.selectedVMs[i],'class':'vboxInvisible vboxVMDetailsBox-vm-'+vboxChooser.selectedVMs[i],'style':'display:none'})
+ .appendTo(targetDiv);
+ }
+
+
+ }
+
+ var oneLoaded = false;
+ var skipTable = false; // skip drawing multi-section details table
+ for(var i = 0; i < vboxChooser.selectedVMs.length; i++) {
+
+ // Already drawn and we are showing more than one vm
+ if(jQuery.inArray(vboxChooser.selectedVMs[i], lastSelectionList) > -1) {
+
+ if(vboxChooser.selectedVMs.length > 1) {
+ oneLoaded = true;
+ targetDiv.siblings().hide();
+ targetDiv.show();
+ continue;
+ }
+ skipTable = true;
+ }
+
+ $.when(vboxChooser.selectedVMs[i], vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[i])).done(function(vmid, d) {
+
+ // Remove placeholder and don't draw
+ // if this vm is no longer selected
+ if(!d || !vboxChooser.isVMSelected(vmid)) {
+ $('#vboxDetailsGeneralTable-'+vmid).empty().remove();
+ return;
+ }
+
+ // Clear target div if we only have one vm
+ if(!oneLoaded) {
+ oneLoaded = true;
+ targetDiv.siblings().hide();
+ targetDiv.show();
+ }
+
+
+ __vboxDisplayDetailsData(d, (vboxChooser.selectedVMs.length > 1), targetDiv, skipTable);
+
+ });
+ }
+
+
+ }
+
+
+/////////////////////////////////
+//
+// Redraw section logic
+//
+//////////////////////////////////
+}).on('vboxEvents', function(e, eventList) {
+
+ // Multiple vms selected
+ var multiSelect = (vboxChooser.selectedVMs.length > 1);
+
+ // Keep track of details to redraw
+ var vmRedrawDetails = {};
+ var vmRedrawSections = {};
+ var vmTriggerEventSection = {};
+
+ // Each event in list
+ for(var i = 0; i < eventList.length; i++) {
+
+ // Nothing to do if VM is not selected
+ if(!eventList[i].machineId || !vboxChooser.isVMSelected(eventList[i].machineId))
+ continue;
+
+
+
+ switch(eventList[i].eventType) {
+
+ // These trigger complete redraws
+ case 'OnMachineDataChanged':
+ vmRedrawDetails[eventList[i].machineId] = true;
+ break;
+
+ default:
+
+ // already redrawing all vm details
+ if(vmRedrawDetails[eventList[i].machineId])
+ break;
+
+ // Check for specific section redraws or events
+ for(var s in vboxVMDetailsSections) {
+
+ if(typeof(s) != 'string') continue;
+ if(multiSelect && !vboxVMDetailsSections[s].multiSelectDetailsTable) continue;
+
+ // Redraw this section?
+ if(vboxVMDetailsSections[s].redrawMachineEvents && jQuery.inArray(eventList[i].eventType, vboxVMDetailsSections[s].redrawMachineEvents) > -1) {
+
+ if(!vmRedrawSections[eventList[i].machineId])
+ vmRedrawSections[eventList[i].machineId] = {};
+
+ vmRedrawSections[eventList[i].machineId][s] = true;
+
+ // Specific event handler
+ } else if(vboxVMDetailsSections[s]['vboxEvent'+eventList[i].eventType]) {
+
+ if(!vmTriggerEventSection[eventList[i].machineId])
+ vmTriggerEventSection[eventList[i].machineId] = {};
+ if(!vmTriggerEventSection[eventList[i].machineId][s])
+ vmTriggerEventSection[eventList[i].machineId][s] = [];
+
+ vmTriggerEventSection[eventList[i].machineId][s][vmTriggerEventSection[eventList[i].machineId][s].length] = eventList[i];
+ }
+ }
+
+ } // </ switch eventType >
+
+
+ } // </ foreach event >
+
+
+ // Target for actions
+ var targetDiv = $('#vboxVMDetails');
+
+
+ // Redraw each details table
+ /////////////////////////////////
+ for(var vmid in vmRedrawDetails) {
+
+ if(typeof(vmid) != 'string') continue;
+
+ // Get and show details and runtime data again
+ $.when(vboxVMDataMediator.getVMDataCombined(vmid)).done(function(d) {
+
+ // Do nothing if VM is no longer selected
+ if(!vboxChooser.isVMSelected(d.id)) return;
+
+ // if there's only one, we'll have to remove existing data
+ if(vboxChooser.selectedVMs.length == 1) {
+ targetDiv.children().empty().remove();
+ }
+ // Special case for host
+ if(d.id == 'host') __vboxDisplayHostDetailsData(d, targetDiv);
+ else __vboxDisplayDetailsData(d, (vboxChooser.selectedVMs.length > 1), targetDiv);
+ });
+
+ };
+
+ // Redraw each section
+ ////////////////////////////
+ for(var vmid in vmRedrawSections) {
+
+ if(typeof(vmid) != 'string') continue;
+ if(vmRedrawDetails[vmid]) continue; // already redrew entire details
+
+ // Get and show details and runtime data again
+ $.when(vboxVMDataMediator.getVMDataCombined(vmid),vmRedrawSections[vmid]).done(function(d,sections) {
+
+ // Do nothing if VM is no longer selected
+ if(!vboxChooser.isVMSelected(d.id)) return;
+
+ // Redraw each section in list
+ for(var s in sections) {
+
+ if(typeof(s) != 'string') continue;
+
+ $('#vboxDetailsSectionId-'+s+'-'+d.id).replaceWith(
+ __vboxCreateDetailsSection(d, s)
+ );
+
+ if(vboxVMDetailsSections[s].onRender)
+ vboxVMDetailsSections[s].onRender(d);
+
+ }
+ });
+
+ }
+
+ // Specific event handlers for each section
+ for(var vmid in vmTriggerEventSection) {
+
+ if(typeof(vmid) != 'string') continue;
+ if(vmRedrawDetails[vmid]) continue; // already redrew entire details
+
+ // Do nothing if VM is no longer selected
+ if(!vboxChooser.isVMSelected(vmid)) return;
+
+ for(var s in vmTriggerEventSection[vmid]) {
+
+ if(typeof(s) != 'string') continue;
+ if(vmRedrawSections[vmid] && vmRedrawSections[vmid][s]) continue; // already redrew this section
+
+ // Call each event handler
+ for(var i = 0; i < vmTriggerEventSection[vmid][s].length; i++) {
+ var event = vmTriggerEventSection[vmid][s][i];
+ vboxVMDetailsSections[s]['vboxEvent'+event.eventType](event);
+ }
+
+
+ }
+
+ }
+
+});
+
+// Hide context menus when hiding tab
+$('#vboxTabVMDetails').on('hide',function(){
+ $('ul.contextMenu').hide();
+});
+
+
+
+//Base function that returns a table row of machine detail data
+//Called from other functions
+function __vboxDetailRow(name, value, cssClass, html) {
+
+ // convert to strings
+ if(typeof(value) == 'undefined') value = '';
+ name = ''+name;
+ value = ''+value;
+
+
+ var tr = $('<tr />').attr({'class':'vboxDetailRow'});
+ $('<th />').html(name + (value && value.length && name.length ? ':' : ''))
+ .attr({'class':'vboxDetailContent ' + cssClass})
+ .appendTo(tr);
+
+ $('<td />').attr({'class':'vboxDetailsValue'}).html(value).appendTo(tr);
+
+ return tr;
+}
+
+//Draw rows to table
+function __vboxDetailAddRows(data, rows, table) {
+
+ // Is rows a function?
+ if(typeof(rows) == 'function') rows = rows(data);
+
+ for(var i = 0; i < rows.length; i++) {
+
+ // Check if row has condition
+ if(rows[i].condition && !rows[i].condition(data)) continue;
+
+ // hold row data
+ var rowData = '';
+
+ // Check for row attribute
+ if(rows[i].attrib) {
+ if(!data[rows[i].attrib]) continue;
+ rowData = data[rows[i].attrib];
+
+ // Check for row callback
+ } else if(rows[i].callback) {
+ rowData = rows[i].callback(data);
+
+ // Static data
+ } else {
+ rowData = rows[i].data;
+ }
+
+ if(rows[i].rawRow) {
+ $(table).append(rowData);
+ } else {
+ var title = trans(rows[i].title, rows[i].language_context);
+ $(table).append(__vboxDetailRow(
+ title,
+ rowData,
+ 'vboxDetailName ' + (rows[i].indented ? ' vboxDetailNameIndent' : '') + ' ' + (rows[i].cssClass ? rows[i].cssClass : ''),
+ rows[i].html));
+ }
+
+ }
+
+}
+
+// Details section
+////////////////////////////
+function __vboxCreateDetailsSection(data, sectionName, section) {
+
+ if(!section)
+ section = vboxVMDetailsSections[sectionName];
+
+ var links = true;
+
+ // No link if VM is not in valid state
+ if(!((vboxVMStates.isRunning(data) || vboxVMStates.isPaused(data) || vboxVMStates.isEditable(data)) && !vboxVMStates.isSaved(data))) {
+ links = false;
+ }
+
+ var title = trans(section.title, section.language_context);
+ var vboxDetailsTable = $('<table />')
+ .attr({'class':'vboxDetailsTable vboxDetailsTableBox'})
+ .append($('<thead />')
+ .append($('<tr />').attr({'class':'vboxDetailsHead'})
+ .append($('<th />').attr({'class':'vboxDetailsSection','colspan':'2'})
+ .append($('<div />')
+ .append(
+ $('<img />').attr({'style':'float:left;margin-right:3px','src':'images/vbox/'+section.icon,'class':'vboxDetailsSectionIcon'})
+ ).append(
+ $('<span />').css({'float':'left'}).addClass((links ? 'vboxDetailsSectionLink' : '')).click(function(){
+ if($(this).hasClass('vboxDetailsSectionLink'))
+ vboxVMsettingsDialog(data,section.settingsLink);
+ }).html(title)
+ ).append(
+ $('<span />').addClass('vboxArrowImage')
+ .click(function(){ $(this).parent().trigger("dblclick"); })
+ )
+ )
+ ).disableSelection()
+ )
+ );
+
+
+ var tbody = $('<tbody />');
+
+ __vboxDetailAddRows(data, section.rows, tbody);
+
+
+ // Class added to last row to aid in rounded corners
+ if(section.noFooter) {
+ tbody.children().last().addClass('vboxTableLastRow');
+ } else {
+ tbody.append($('<tr />').addClass('vboxTableLastRow').append($('</td >')).append('<td />'));
+ }
+
+ vboxDetailsTable.append(tbody);
+
+ var vboxDetailsSection = $('<div />')
+ .attr({'class':'vboxDetailsBorder vboxVMDetailsBox'+sectionName+ ' vboxVMDetailsBox-vm-'+data.id,'id':'vboxDetailsSectionId-'+sectionName+'-'+data.id})
+ .dblclick(__vboxDetailsSectionCollapse)
+ .hoverClass('vboxHover').disableSelection().data({'sectionName':sectionName});
+
+ if(vboxGetLocalDataItem("vboxSectionCollapse"+sectionName)) {
+ vboxDetailsSection.addClass('vboxDetailsSectionCollapsed');
+ }
+
+ if(!vboxGetLocalDataItem("vboxSectionHide"+sectionName)) {
+ $(vboxDetailsSection).show();
+ } else {
+ $(vboxDetailsSection).hide();
+ }
+
+ /* Context menu for section ? */
+ if(section.contextMenu) {
+
+ var menu = section.contextMenu();
+
+ $(vboxDetailsSection).mouseup({'vmid':data.id},function(e) {
+
+ $('ul.contextMenu').hide();
+
+ if(e.button == 2) {
+
+ $(menu).trigger('beforeshow', e.data.vmid);
+
+ vboxPositionEvent(menu, e);
+ $(menu).show();
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ return false;
+ }
+
+ });
+
+ $(vboxDetailsSection)
+ .on('contextmenu', function() { return false; })
+ .on('click',function(e){return e.button!=2;});
+
+ }
+ return vboxDetailsSection.append(vboxDetailsTable);
+
+}
+
+//Display details data table for VM
+//////////////////////////////////
+function __vboxDisplayDetailsData(data, multiSelect, targetDiv, skipTable) {
+
+ // No data? Should never happen
+ if(typeof data == 'undefined') return;
+
+
+ // Accessibility check
+ if(data.state == 'Inaccessible') {
+
+
+ var reasonDiv = $('<div />')
+ .attr({'class':'vboxVMDetailsBox-vm-'+data.id})
+ .html('<div style="width: 50%">'+trans('The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:','UIDetailsPagePrivate')+'</div>');
+
+ // Details Table
+ $('<table />').attr({'style':'width: 50%','class':'vboxDetailsTable vboxDetailsTableError vboxVMDetailsBox-vm-'+data.id}).append(__vboxDetailRow(trans("VirtualBox - Error",'UIMessageCenter'), data.accessError['text'])).append(__vboxDetailRow(trans('Result Code: ','UIMessageCenter'), data.accessError['resultCode'])).append(__vboxDetailRow(trans("Component: ",'UIMessageCenter'), data.accessError['component'])).appendTo(targetDiv);
+
+ var d = $('<div />').attr({'style':'width: 50%; padding: 4px;'});
+
+ $('<input />').attr({'type':'button',
+ 'value':trans('Refresh','UIVMLogViewer'),
+ 'style':'background: url(images/vbox/refresh_16px.png) 2px 2px no-repeat; padding: 2px 2px 2px 18px; border: 1px solid #000; background-color: #eee;'
+ }).click({vmid:data.id},function(e){
+
+
+ var l = new vboxLoader();
+ l.showLoading();
+ $.when(vboxVMDataMediator.refreshVMData(e.data.vmid)).always(function(){
+ l.removeLoading();
+ });
+
+
+ }).appendTo(d);
+
+ $(reasonDiv).append(d).appendTo(targetDiv);
+
+ return;
+ }
+
+ // Multi-select details table sections
+ ////////////////////////////////////////
+ if(!skipTable) {
+
+ var tbl = $('<table />').attr({'id':'vboxDetailsGeneralTable-'+data.id,'class':'vboxInvisible vboxVMDetailsBox-vm-'+data.id,'style':'width: 100%;'}).append(
+
+ $('<tr />').attr({'style':'vertical-align: top'})
+
+ .append(
+
+ $('<td />').css({'width':'100%'})
+ .append(__vboxCreateDetailsSection(data,'general'))
+ .append(__vboxCreateDetailsSection(data,'system'))
+
+ ).append(
+
+ vboxVMDetailsSections['preview'].condition() ?
+ $('<td />')
+ .append(__vboxCreateDetailsSection(data,'preview')) :
+ null
+ )
+
+ ).data({'vmid':data.id});
+
+ // If already exists, replace the table, else append to div
+ if($('#vboxDetailsGeneralTable-'+data.id)[0]) {
+ $('#vboxDetailsGeneralTable-'+data.id).replaceWith(tbl);
+ } else {
+ tbl.appendTo(targetDiv);
+ }
+
+ for(var s in {'general':1,'system':1,'preview':1}) {
+ if(vboxVMDetailsSections[s].onRender)
+ vboxVMDetailsSections[s].onRender(data);
+ }
+
+ }
+
+ // Other sections
+ ///////////////////////////
+
+ // Not shown if multiple vms are selected
+ if(multiSelect) return;
+
+ for(var s in vboxVMDetailsSections) {
+
+ if(vboxVMDetailsSections[s].multiSelectDetailsTable) continue;
+
+ if(vboxVMDetailsSections[s].condition && !vboxVMDetailsSections[s].condition(data))
+ continue;
+
+ $(targetDiv).append(__vboxCreateDetailsSection(data, s));
+
+ if(vboxVMDetailsSections[s].onRender)
+ vboxVMDetailsSections[s].onRender(data);
+
+
+ }
+
+}
+
+//Display details data for VirtualBox Host
+/////////////////////////////////////////////
+function __vboxDisplayHostDetailsData(data, targetDiv) {
+
+ for(var s in vboxHostDetailsSections) {
+
+ if(vboxHostDetailsSections[s].condition && !vboxHostDetailsSections[s].condition(data))
+ continue;
+
+ $(targetDiv).append(__vboxCreateDetailsSection(data, s, vboxHostDetailsSections[s]));
+
+ if(vboxHostDetailsSections[s].onRender)
+ vboxHostDetailsSections[s].onRender(data);
+
+ }
+
+}
+
+
+//Collapse section used on dblclick of sections
+function __vboxDetailsSectionCollapse(e) {
+
+ // Save section name
+ var sectionName = $(this).data('sectionName');
+
+ vboxSetLocalDataItem('vboxSectionCollapse'+sectionName,
+ ($(this).hasClass('vboxDetailsSectionCollapsed') ? '' : '1')
+ );
+
+ var collapsed = $(this).hasClass('vboxDetailsSectionCollapsed');
+
+
+ // IE8 doesn't display this animation
+ if(!($.browser.msie && $.browser.version.substring(0,1) < 9)) {
+
+ // Get image span of current section only
+ var vboxArrowImage = $(this).find('span.vboxArrowImage');
+
+ // Only animate the span that is part of this section header
+ // All others just get switched
+ $.when($('<div />').animate({left:90},
+ {
+ duration: 300,
+ step: function(currentStep) {
+
+ if(collapsed) {
+ currentStep = (180 - currentStep);
+ } else {
+ currentStep = currentStep+90;
+ }
+ vboxArrowImage.css({
+ 'transform':'rotate('+currentStep+'deg)',
+ '-moz-transform': 'rotate('+currentStep+'deg)',
+ '-webkit-transform': 'rotate('+currentStep+'deg)',
+ '-o-transform': 'rotate('+currentStep+'deg)',
+ '-ms-transform': 'rotate('+currentStep+'deg)'
+ });
+ },
+ queue: true
+ })).done(function(){
+
+ vboxArrowImage.css({
+ 'transform':'',
+ '-moz-transform': '',
+ '-webkit-transform': '',
+ '-o-transform': '',
+ '-ms-transform': ''
+ });
+
+ });
+
+ }
+
+ $('#vboxVMDetails').find('div.vboxVMDetailsBox'+sectionName)
+ .toggleClass('vboxDetailsSectionCollapsed', (($.browser.msie && $.browser.version.substring(0,1) < 9) ? undefined : 300));
+
+
+
+ return false;
+
+}
+
+/*
+ *
+ * Show / Hide boxes menu
+ *
+ */
+var ul = $('<ul />')
+ .attr({'class':'contextMenu contextMenuNoBG','style':'display: none','id':'vboxDetailsShowMenu'})
+ .on('contextmenu', function() { return false; });
+
+for(var i in vboxVMDetailsSections) {
+
+ if(typeof(i) != 'string') continue;
+
+ // Skip if we shouldn't display
+ if(vboxVMDetailsSections[i].condition && !vboxVMDetailsSections[i].condition())
+ continue;
+
+ $('<li />').attr('id','vboxDetailsShowMenuItem'+i).append(
+
+ $('<label />').append(
+
+ $('<input />')
+ .attr({'type':'checkbox','class':'vboxCheckbox','name':i})
+ .prop('checked',!vboxGetLocalDataItem("vboxSectionHide"+i))
+ .on('click',{'sectionName':i},function(e){
+
+ vboxSetLocalDataItem("vboxSectionHide"+$(this).attr('name'),(this.checked ? '' : '1'));
+ $('#vboxTabVMDetails .vboxVMDetailsBox'+$(this).attr('name')).css('display',(this.checked ? '' : 'none'));
+
+ var sectionName = e.data.sectionName;
+
+ // Run section's onShow function
+ if(this.checked && vboxVMDetailsSections[sectionName].onShow) {
+ vboxVMDetailsSections[sectionName].onShow();
+ } else if(!this.checked && vboxVMDetailsSections[sectionName].onHide) {
+ vboxVMDetailsSections[sectionName].onHide();
+ }
+
+ })
+
+ ).append(
+ $('<span />').html(trans(vboxVMDetailsSections[i].title, vboxVMDetailsSections[i].language_context))
+
+ ).disableSelection()
+
+ ).appendTo(ul);
+
+
+}
+$('#vboxTabVMDetails').append(ul);
+
+
+/* Menu functionality */
+$("#vboxVMDetails").mouseup( function(e) {
+
+ $('ul.contextMenu').hide();
+
+ if(e.button == 2 && vboxChooser.getSingleSelectedId() != 'host') {
+
+ var menu = $('#vboxDetailsShowMenu');
+ vboxPositionEvent(menu, e);
+ $(menu).show();
+
+ e.preventDefault();
+ e.stopPropagation();
+
+ return false;
+ }
+
+
+}).on('contextmenu', function() { return false; })
+ .on('click',function(e){return e.button!=2;});
+
+//Display Welcome div
+$('#vboxTabVMDetails').css({'display':'table','width':'100%'}).children().hide();
+$('#vboxDetailsWelcome').show().css('display','table-cell');
+$('#vboxTabVMDetails').data('showingWelcome', true);
+
+</script>
</div> \ No newline at end of file
diff --git a/panes/tabVMSnapshots.html b/panes/tabVMSnapshots.html
index 9f7405a..0bfa6bc 100644
--- a/panes/tabVMSnapshots.html
+++ b/panes/tabVMSnapshots.html
@@ -1,919 +1,919 @@
-<!--
-
- VM Snapshots Pane
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabVMSnapshots.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div id='vboxTabVMSnapshots' class='vboxInvisible' style='display: none; width:100%;'>
-
- <table class='vboxInvisible' style='height: 99%; width: 99%'>
- <tr style='vertical-align: top; height: 1%'>
- <td><div id='vboxSnapshotToolbar'></div></td>
- </tr>
- <tr style='vertical-align: top;'>
- <td><ul style='min-height: 400px' class='vboxBordered vboxTreeView' id='vboxSnapshotList'></ul></td>
- </tr>
- </table>
-<!--
-
- New Snapshot Dialog
-
- -->
- <div id='vboxSnapshotNew' class='vboxDialogContent' style='display: none;'>
- <table class='vboxVertical'>
- <tr style='vertical-align: top'>
- <th>
- <img id='vboxSnapshotNewImg' src='images/vbox/os_other.png' height='32' width='32' />
- </th>
- <td>
- <div style='height: 100%'>
- <div class='translate'>Snapshot Name</div>
- <input id='vboxSnapshotNewName' style='width: 100%'/>
- <div class='translate'>Snapshot Description</div>
- <textarea rows='10' id='vboxSnapshotNewDesc' style='width: 100%;'></textarea>
- </div>
- </td>
- </tr>
- </table>
- </div>
-
-
-<!--
-
- Snapshot Details Dialog
-
- -->
- <div id='vboxSnapshotDetails' class='vboxDialogContent' style='display: none;'>
- <table class='vboxVertical'>
- <tr>
- <th><span class='translate'>Name:</span></th>
- <td style='width:100%'>
- <input id='vboxSnapshotDetailsName' style='width: 100%'/>
- </td>
- <td rowspan='2' id='vboxSnapshotSS' style='width:1%'></td>
- </tr>
- <tr>
- <th><span class='translate'>Taken:</span></th>
- <td style='width:100%'>
- <span id='vboxSnapshotDetailsTaken'></span>
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Description:</span></th>
- <td colspan='2'>
- <textarea rows='12' id='vboxSnapshotDetailsDesc' name='vboxSnapshotDetailsDescElm'></textarea>
- </td>
- </tr>
- <tr>
- <th><span class='translate'>Details:</span></th>
- <td class='vboxSnapshotDetailsMachine' colspan='2'>
- <div id='vboxSnapshotDetailsVM' style='overflow: auto; height: 100%'></div>
- </td>
- </tr>
- </table>
- </div>
-
-
-
-<script type='text/javascript'>
-
-vboxInitDisplay('vboxSnapshotNew','VBoxTakeSnapshotDlg');
-vboxInitDisplay('vboxSnapshotDetails','VBoxSnapshotDetailsDlg');
-
-var vboxSnapshotButtons = [
-
- {
- 'name' : 'take_snapshot',
- 'label' : 'Take Snapshot...',
- 'language_context': 'UIActionPool',
- 'icon' : 'snapshot_take',
- 'enabled' : function(item) {
-
- if(typeof item == 'string') state = item;
- else if(item && $(item).data('vboxSnapshot')) state = $(item).data('vboxSnapshot').state;
- else return false;
-
- var vm = vboxChooser.getSingleSelected();
- return (item && state == 'current' && jQuery.inArray(vm.state, ['RestoringSnapshot','LiveSnapshotting','DeletingSnapshot']) == -1);
- },
- 'click' : function (callback) {
-
- var vm = vboxChooser.getSingleSelected();
-
- $('#vboxSnapshotNewImg').attr('src',"images/vbox/" + vboxGuestOSTypeIcon(vm.OSTypeId));
-
- var snRegEx = new RegExp('^' + trans('Snapshot %1','VBoxSnapshotsWgt').replace('%1','([0-9]+)') + '$');
-
- // Get max snapshot name
- var snMax = 0;
- var snList = $('#vboxSnapshotList').find('li');
- for(var i = 0; i < snList.length; i++) {
- var snNum = snRegEx.exec($(snList[i]).data('vboxSnapshot').name);
- if(snNum) snMax = Math.max(parseInt(snNum[1]), snMax);
- }
-
- $('#vboxSnapshotNewName').val(trans('Snapshot %1','VBoxSnapshotsWgt').replace('%1',(snMax+1)));
- $('#vboxSnapshotNewName').select();
- $('#vboxSnapshotNewDesc').val('');
-
-
- var buttons = {};
- var OKBtn = buttons[trans('OK','QIMessageBox')] = function() {
-
- // Get fresh VM state when this is clicked
- var vm = vboxChooser.getSingleSelected();
- if(!vm) return;
-
- // Deferred object that will trigger
- // taking a snapshot on success
- var isPausedOrNotRunning = $.Deferred();
-
- // Take snapshot function when machine is in
- // a valid paused or not running state
- $.when(isPausedOrNotRunning).done(function(paused) {
-
- var l = new vboxLoader('snapshotTake');
- l.add('snapshotTake',function(d){
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(pres){
-
- // Unpause machine if it was paused
- if(paused) {
- vboxAjaxRequest('machineSetState',{'vm':vm.id,'state':'resume'});
- }
-
- // If progress operation errored, refresh snapshot list
- if(pres && !pres.success)
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
-
- // callback passed to click()? else Refresh vm list
- if(typeof callback == 'function') { callback(pres); }
-
- },'progress_snapshot_create_90px.png', trans('Take a snapshot of the current virtual machine state','VBoxSnapshotsWgt'),
- vm.name);
-
- } else {
-
- // Unpause machine if it was paused
- if(paused) {
- vboxAjaxRequest('machineSetState',{'vm':vm.id,'state':'resume'});
- }
-
- if(d && d.error) vboxAlert(d.error);
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
- }
- },{'vm':vm.id,'name':$('#vboxSnapshotNewName').val(),'description':$('#vboxSnapshotNewDesc').val()});
- l.run();
-
- }).fail(function(){
-
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
-
- });
-
- // Set to paused state if VM is running
- if(vboxVMStates.isRunning(vm)) {
- var pl = new vboxLoader('machineSetStatePaused');
- pl.add('machineSetState', function(d) {
- if(d && d.success) isPausedOrNotRunning.resolve(true);
- else isPausedOrNotRunning.reject();
- },{'vm':vm.id,'state':'pause'});
- pl.run();
- } else {
- isPausedOrNotRunning.resolve();
- }
-
-
- $(this).dialog('close');
-
-
- };
- buttons[trans('Cancel','QIMessageBox')] = function() {
- $(this).dialog('close');
- if(typeof callback == 'function') { callback({success:false,uicancel:true}); }
- };
-
- $('#vboxSnapshotNewName').off('keypress').on('keypress',function(e) { if (e.keyCode == 13) OKBtn.apply($('#vboxSnapshotNew')); });
-
- $('#vboxSnapshotNew').dialog({'closeOnEscape':false,'width':'400px','height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/snapshot_take_16px.png" class="vboxDialogTitleIcon" height="16" width="16" /> ' + trans('Take Snapshot of Virtual Machine','VBoxTakeSnapshotDlg')});
-
- }
- },
- {
- 'name' : 'discard_cur_state',
- 'label' : 'Restore Snapshot',
- 'icon' : 'snapshot_restore',
- 'enabled' : function(item) {
- var vm = vboxChooser.getSingleSelected();
- return ( item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current');
- },
- 'click' : function () {
-
- var vm = vboxChooser.getSingleSelected();
-
- var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
-
- var buttons = {};
- var q = '';
-
- // Check if the current state is modified
- if(vm.currentStateModified) {
-
- q = trans("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>" +
- "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; " +
- "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>",'UIMessageCenter');
- q += '<p><label><input type="checkbox" id="vboxRestoreSnapshotCreate" checked /> ' + trans('Create a snapshot of the current machine state','UIMessageCenter') + '</label></br>';
- q += '<label><input type="checkbox" id="vboxRestoreSnapshotAutoStart" '+ (vboxVMStates.isRunning(vm)? 'checked' : '') + ' /> ' + trans('Automatically start the machine after restore','UIMessageCenter') + '</label></p>';
-
- buttons[trans('Restore','UIMessageCenter')] = function() {
-
- var self = this;
- var snautostart = function() {
- var l = new vboxLoader();
- l.add('machineSetState',function(d){
- if(!(d && d.success) && errorMsg) {
- vboxAlert(errorMsg.replace('%1', vm.name));
- return;
- }
- // check for progress operation
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
- // Do Nothing
- },'progress_state_restore_90px.png',trans('Power on virtual machine','VBoxSnapshotsWgt'), vm.name);
- return;
- }
- },{'vm':vm.id,'state':'powerUp'});
-
- l.run();
- };
-
- var snrestore = function(autoStart,takeSnapshot){
-
- // Don't do anything if taking a snapshot failed
- if(takeSnapshot && !takeSnapshot.success) {
- if (takeSnapshot.uicancel)
- vboxSnapshotButtons[1].click();
- return;
- }
-
- // Power off VM if needed
- if(vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) {
- var l = new vboxLoader();
- l.add('machineSetState',function(d){
- if(!(d && d.success) && errorMsg) {
- vboxAlert(errorMsg.replace('%1', vm.name));
- return;
- }
- // check for progress operation
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
- if (d && d.responseData && d.responseData.info) {
- // when poweroff completed
- if (d.responseData.info.completed) {
- // schedule snapshot restore immediate after
- setTimeout(snrestore.bind(self,autoStart,takeSnapshot),0);
- }
- }
- },'progress_poweroff_90px.png',trans('Power off virtual machine','VBoxSnapshotsWgt'), vm.name);
- }
- },{'vm':vm.id,'state':'powerDown'});
-
- l.run();
- return;
- }
-
- var l = new vboxLoader();
- l.add('snapshotRestore',function(d){
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
- if (d && d.responseData && d.responseData.info) {
- // when restore completed and auto start is requested
- if (d.responseData.info.completed && autoStart) {
- // schedule start immediately
- setTimeout(snautostart.bind(self), 0);
- }
- }
- },'progress_snapshot_restore_90px.png',trans('Restore Snapshot','VBoxSnapshotsWgt'),
- vm.name);
- } else if(d && d.error) {
- vboxAlert(d.error);
- }
- },{'vm':vm.id,'snapshot':snapshot.id});
-
- l.run();
-
- };
-
- var vmRestoreAutoStart = $('#vboxRestoreSnapshotAutoStart').prop('checked');
- if($('#vboxRestoreSnapshotCreate').prop('checked')) {
- vboxSnapshotButtons[0].click(snrestore.bind(self,vmRestoreAutoStart));
- } else {
- snrestore(vmRestoreAutoStart);
- }
- $(this).empty().remove();
- };
-
- } else {
-
- q = trans('<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>','UIMessageCenter');
-
- buttons[trans('Restore','UIMessageCenter')] = function() {
- var l = new vboxLoader();
- l.add('snapshotRestore',function(d){
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
-
- // Let events get picked up. Nothing to do here
-
- },'progress_snapshot_restore_90px.png',trans('Restore Snapshot','VBoxSnapshotsWgt'),
- vm.name);
- } else if(d && d.error) {
- vboxAlert(d.error);
- }
- },{'vm':vm.id,'snapshot':snapshot.id});
- $(this).empty().remove();
-
- l.run();
-
- };
- }
-
- vboxConfirm(q.replace('%1',$('<div />').text(snapshot.name).html()),buttons);
- },
- 'separator' : true
- },
- {
- 'name' : 'delete_snapshot',
- 'label' : 'Delete Snapshot',
- 'icon' : 'snapshot_delete',
- 'enabled' : function(item) {
- return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current' && $(item).data('vboxSnapshot').children.length <= 1);
- },
- 'click' : function () {
- var vm = vboxChooser.getSingleSelected();
- var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
- var buttons = {};
- buttons[trans('Delete','UIMessageCenter')] = function() {
- var l = new vboxLoader();
- l.add('snapshotDelete',function(d){
- if(d && d.responseData && d.responseData.progress) {
- vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
-
- // Let events get picked up. Nothing to do here
-
- },'progress_snapshot_discard_90px.png',trans('Delete Snapshot','VBoxSnapshotsWgt'),
- vm.name + ' - ' + snapshot.name);
- }
- },{'vm':vm.id,'snapshot':snapshot.id});
- $(this).empty().remove();
-
- l.run();
- };
- vboxConfirm(trans('<p>Deleting the snapshot will cause the state information saved in it to be lost, and '+
- 'storage data spread over several image files that VirtualBox has created together with the snapshot '+
- 'will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot '+
- 'be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>','UIMessageCenter').replace('%1',$('<div />').text(snapshot.name).html()),buttons);
- }
- },
- {
- 'name' : 'show_snapshot_details',
- 'label' : 'Show Details',
- 'icon' : 'snapshot_show_details',
- 'enabled' : function(item) {
- return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current');
- },
- 'click' : function () {
-
- // Current snapshot
- var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
-
- var vm = vboxChooser.getSingleSelected();
-
- var l = new vboxLoader();
- l.add('snapshotGetDetails',function(d){
-
- $('#vboxSnapshotDetailsName').val(d.responseData.name);
- $('#vboxSnapshotDetailsTaken').html(vboxDateTimeString(d.responseData.timeStamp));
- $('#vboxSnapshotDetailsDesc').val(d.responseData.description);
-
- if(d.responseData.online) {
- $('#vboxSnapshotSS').html('<a href="'+ vboxEndpointConfig.screen +'?vm='+vm.id+
- '&snapshot='+d.responseData.id+'&full=1" target="_blank"><img src="'+vboxEndpointConfig.screen+'?vm='+
- vm.id+'&snapshot='+d.responseData.id+'" /></a>').show();
- } else {
- $('#vboxSnapshotSS').empty().hide();
- }
-
- // Display details
- $('#vboxSnapshotDetailsVM').empty();
-
- // Enclosing details Table
- var vboxDetailsTable = $('<table />').attr({'class':'vboxDetailsTable'});
-
- // Set to isSnapshot
- d.responseData.machine._isSnapshot = true;
-
- for(var i in vboxVMDetailsSections) {
-
- section = vboxVMDetailsSections[i];
-
- if(section.noSnapshot) continue;
-
- $('<tr />').attr({'class':'vboxDetailsHead'}).append(
- $('<th />').attr({'class':'vboxDetailsSection','colspan':'2'}).disableSelection()
- .html("<img style='float:left; margin-right: 3px; ' src='images/vbox/" + section.icon + "' height='16' width='16' /> ")
- .append(
- $('<span />').css({'float':'left'}).append(document.createTextNode(trans(section.title, section.language_context) +' '))
- )
- ).appendTo(vboxDetailsTable);
-
- __vboxDetailAddRows(d.responseData.machine, section.rows, vboxDetailsTable);
-
- }
-
- $('#vboxSnapshotDetailsVM').append(vboxDetailsTable);
-
-
- },{'vm':vm.id,'snapshot':snapshot.id});
- l.onLoad = function(){
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- // Current snapshot
- var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
-
- var l = new vboxLoader();
- l.add('snapshotSave',function(d){
-
- // Let events get picked up. Nothing to do here
-
- },{'vm':vm.id,'snapshot':snapshot.id,'name':$('#vboxSnapshotDetailsName').val(),'description':$('#vboxSnapshotDetailsDesc').val()});
- $(this).dialog('close');
- l.run();
-
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).dialog('close');
- };
- $('#vboxSnapshotDetails').dialog({'closeOnEscape':false,'width':'600px','height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/snapshot_show_details_16px.png" class="vboxDialogTitleIcon" /> '+trans('Details of %1 (%2)','VBoxSnapshotDetailsDlg').replace('%1',$('<div />').text(snapshot.name).html()).replace('%2',vm.name)});
- };
- l.run();
- }
- },
- {
- 'name' : 'clone',
- 'label' : 'Clone...',
- 'language_context': 'UIActionPool',
- 'icon' : 'vm_clone',
- 'separator' : true,
- 'enabled' : function(item) {
- var vm = vboxChooser.getSingleSelected();
- return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && !vboxVMStates.isPaused(vm) && !vboxVMStates.isRunning(vm));
- },
- 'click' : function () {
-
- var vm = vboxChooser.getSingleSelected();
-
- // Current snapshot
- var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
-
- new vboxWizardCloneVMDialog({'vm':vm,'snapshot':(snapshot.state == 'current' ? undefined : snapshot)}).run();
-
- }
- },
-
-
-
-];
-
-
-/* Append Top Toolbar */
-var vboxSnapshotToolbar = new vboxToolbarSmall({buttons: vboxSnapshotButtons, size: 22, language_context: 'VBoxSnapshotsWgt'});
-// special case for 'clone' button because it is 16px rather than 22px
-vboxSnapshotToolbar.addButtonCSS('clone', {'background-position':'6px 4px'});
-vboxSnapshotToolbar.renderTo('vboxSnapshotToolbar');
-
-vboxInitDisplay('vboxSnapshotToolbar','VBoxSnapshotsWgt');
-
-// Context menu for snapshots
-var vboxSnapshotContextMenu = new vboxMenu({name:'vboxSnapshotContextMenu', language_context: 'VBoxSnapshotsWgt'});
-vboxSnapshotContextMenu.addMenu(vboxSnapshotButtons.slice(-(vboxSnapshotButtons.length-1)));
-
-//Context menu for current state
-var vboxSnapshotContextMenuCurrent = new vboxMenu({name: 'vboxSnapshotContextMenuCurrent', language_context: 'VBoxSnapshotsWgt'});
-vboxSnapshotContextMenuCurrent.addMenu([vboxSnapshotButtons[0],vboxSnapshotButtons[(vboxSnapshotButtons.length-2)]]);
-
-
-/* Toolbar and menu updates*/
-$('#vboxSnapshotList').on('select',function(e,item) {
-
- // Update toolbar
- vboxSnapshotToolbar.update(item);
-
- vboxSnapshotContextMenu.update(item);
- vboxSnapshotContextMenuCurrent.update(item);
-
-});
-
-// Hold timer and date vars
-vboxSnapshotToolbar._timer = null;
-vboxSnapshotToolbar._timeSpans = new Array();
-vboxSnapshotToolbar._timeSpans['days'] = 86400;
-vboxSnapshotToolbar._timeSpans['hours'] = 3600,
-vboxSnapshotToolbar._timeSpans['minutes'] = 60,
-vboxSnapshotToolbar._timeSpans['seconds'] = 1;
-vboxSnapshotToolbar._timeSpans.sort(function(a,b){return (a > b ? -1 : 1);});
-
-
-
-/* Selected VM changed */
-$('#vboxPane').on('vmSelectionListChanged',function(){
-
- $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop'));
-
- var vm = vboxChooser.getSingleSelected();
-
- $('#vboxSnapshotList').trigger('select',null);
-
- // Got vm and it's not host
- if(vm && vm.id != 'host') {
-
- // Enable tab
- $('#vboxTabVMSnapshots').parent().trigger('enableTab', ['vboxTabVMSnapshots']);
-
- $.when(vboxVMDataMediator.getVMDetails(vm.id)).done(function(vm) {
- $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop') + (vm && vm.snapshotCount ? trans(' (%1)','VBoxSnapshotsWgt').replace('%1',vm.snapshotCount):''));
- });
-
- // Unset last vm
- $('#vboxTabVMSnapshots').data('lastVM',0);
-
- // Remove children
- $('#vboxSnapshotList').children().empty().remove();
-
- // Fill snapshots if this tab is being shown
- if($('#vboxTabVMSnapshots').data('vboxShowing')) {
-
- // Keep track of last VM shown
- $('#vboxTabVMSnapshots').data('lastVM',vm.id);
-
- // append spinner
- $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
-
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
-
- }
-
- // No single selected VM or it is host
- } else {
- // disable tab
- $('#vboxTabVMSnapshots').parent().trigger('disableTab', ['vboxTabVMSnapshots']);
- $('#vboxTabVMSnapshots').data('lastVM',0);
- }
-
-/**
- *
- * VBOX event list triggered
- *
- */
-}).on('vboxEvents',function(e,eventList) {
-
- var redrawCurrent = false;
-
- for(var i = 0; i < eventList.length; i++) {
-
- switch(eventList[i].eventType) {
-
- //////////////////////////
- //
- // Snapshot events
- //
- /////////////////////////
- case 'OnSnapshotTaken':
- case 'OnSnapshotDeleted':
- case 'OnSnapshotRestored':
- case 'OnSnapshotChanged':
-
- // Is this vm selected
- if(vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
-
- // Update title
- $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop') +
- (eventList[i].enrichmentData && eventList[i].enrichmentData.snapshotCount ? trans(' (%1)','VBoxSnapshotsWgt').replace('%1',eventList[i].enrichmentData.snapshotCount):''));
-
- // Redraw snapshots if this is shown
- if($('#vboxTabVMSnapshots').data('lastVM') == eventList[i].machineId) {
-
- $('#vboxSnapshotList').children().empty().remove();
-
- // Append spinner
- $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
-
-
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':eventList[i].machineId})).done(__vboxTabSnapshotsFill);
-
- return;
-
- }
- }
- break;
-
- /////////////////////////
- //
- // Session or state change
- //
- ////////////////////////
- case 'OnSessionStateChanged':
- case 'OnMachineStateChanged':
- if($('#vboxTabVMSnapshots').data('lastVM') == eventList[i].machineId && vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
- redrawCurrent = true;
- }
- break;
-
- }
-
- }
-
- // Redraw current snapshot
- if(redrawCurrent) {
-
- var vmid = vboxChooser.getSingleSelectedId();
-
- // Get current state and details data
- $.when(vboxVMDataMediator.getVMData(vmid), vboxVMDataMediator.getVMDetails(vmid)).done(function(vm, vmd) {
-
- if($('#vboxTabVMSnapshots').data('lastVM') != vm.id) return;
-
- var selected = $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').children('div.vboxListItemSelected').length;
- $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').replaceWith(__vboxTabSnapshotCurrent($.extend(true,{},vm,vmd)));
- if(selected) {
- $('#vboxSnapshotList').trigger('select',
- $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').children('div.vboxListItem').addClass('vboxListItemSelected').parent());
- }
- });
- }
-
-
-});
-
-// Load snapshots on show
-$('#vboxTabVMSnapshots').on('show',function(e){
-
- $('#vboxTabVMSnapshots').data('vboxShowing', 1);
-
- var vm = vboxChooser.getSingleSelected();
-
- if(vm && vm.id) {
- if($('#vboxTabVMSnapshots').data('lastVM') == vm.id) return;
- $('#vboxTabVMSnapshots').data('lastVM', vm.id);
- } else {
- $('#vboxSnapshotList').children().remove();
- $('#vboxTabVMSnapshots').data('lastVM',0);
- vboxSnapshotToolbar.disable();
- return;
- }
-
-
- // Get snapshots
- // Append spinner
- $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
- $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
-
-
-}).on('hide',function(e) {
- $('#vboxTabVMSnapshots').data('vboxShowing', 0);
-});
-
-/*
- * Fill Snapshots
-*/
-function __vboxTabSnapshotsFill(response) {
-
- var snapshotData = response.responseData;
-
- if(vboxSnapshotToolbar._timer) {
- window.clearTimeout(vboxSnapshotToolbar._timer);
- vboxSnapshotToolbar._timer = null;
- }
-
- if(!snapshotData) return;
-
- // Get current state and details data
- $.when(vboxVMDataMediator.getVMData(response.responseData.vm), vboxVMDataMediator.getVMDetails(response.responseData.vm)).done(function(vm, vmd) {
-
- if($('#vboxTabVMSnapshots').data('lastVM') != vm.id) return;
-
- var list = $('#vboxSnapshotList');
- $(list).children().remove();
-
- var vmc = $.extend(true, {}, vm, vmd);
-
- // Snapshots exist
- if(snapshotData.snapshot && snapshotData.snapshot.name) {
-
- // Traverse snapshots
- $(list).append(__vboxTabSnapshot(snapshotData.snapshot, snapshotData.currentSnapshotId));
-
- // Append current state to last snapshot
- if(snapshotData.currentSnapshotId) {
-
- // Has children
- if($('#'+snapshotData.currentSnapshotId).children('ul').first()[0]) {
- $('#'+snapshotData.currentSnapshotId).children('ul').last().append(__vboxTabSnapshotCurrent(vmc));
- } else {
- $('#'+snapshotData.currentSnapshotId).append($('<ul />').append(__vboxTabSnapshotCurrent(vmc)));
- };
- };
-
- // No snapshots. Append current state to list
- } else {
- $(list).append(__vboxTabSnapshotCurrent(vmc));
- }
-
- // Init vbox tree list
- $('#vboxSnapshotList').vbtree();
-
- vboxSnapshotToolbar.enable();
-
- var lastListItem = $(list).find('li.vboxSnapshotCurrentState').last();
- lastListItem.children().addClass('vboxListItemSelected');
- $('#vboxSnapshotList').trigger('select',lastListItem);
-
- __vboxTabSnapshotTimestamps();
-
- });
-
-}
-
-/* Snapshot list item */
-function __vboxTabSnapshot(s, currentId) {
-
- var li = $('<li />').attr({'id':s.id});
- $(li).data('vboxSnapshot',s);
-
- // Use timestamp
- var t = '';
- if(s.timeStampSplit['seconds'] == 0)
- s.timeStampSplit['seconds'] = 1;
-
- var ago = 0;
- var ts = 'seconds';
- for(var i in s.timeStampSplit) {
- var l = Math.floor(t / s.timeStampSplit[i]);
- if(l > 0) {
- ago = l;
- ts = i;
- break;
- }
- }
-
- switch(ts) {
- case 'days':
- ts = trans('%n day(s)','VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'hours':
- ts = trans('%n hour(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'minutes':
- ts = trans('%n minute(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'seconds':
- ts = trans('%n second(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- }
- ts = trans(' (%1 ago)','VBoxSnapshotsWgt').replace('%1', ts);
-
- $(li).append(' ').append(
-
- $('<div />').attr({'class':'vboxListItem'})
- .html('<img src="images/vbox/snapshot_'+(s.online ? 'online' : 'offline')+'_16px.png" height="16" width="16" /> ' +
- $('<div />').text(s.name).html())
- .append($('<span />').attr({'class':'timestamp'}).data({'vboxTimestamp':s.timeStamp}).text(ts))
-
- // Context menu
- .contextMenu({
- menu: vboxSnapshotContextMenu.menuId(),
- clickthrough: true
- },vboxSnapshotContextMenu.menuClickCallback)
-
- // show details on dblclick
- .dblclick(vboxSnapshotButtons[4].click).disableSelection()
-
- // tool tip
- .tipped({'position':'mouse','delay':1500,'source':'<p><strong>'+$('<div />').text(s.name).html()+'</strong> ('+trans((s.online ? 'online)' : 'offline)'),'VBoxSnapshotsWgt')+'</p>'+
- '<p>'+ vboxDateTimeString(s.timeStamp, trans('Taken at %1','VBoxSnapshotsWgt'), trans('Taken on %1','VBoxSnapshotsWgt'))+'</p>' +
- (s.description ? '<hr />' + $('<div />').text(s.description).html() : '')})
-
- ).addClass(currentId == s.id ? 'vboxSnapshotCurrent' : '').children('div.vboxListItem').first().click(function(){
- $('#vboxSnapshotList').find('div.vboxListItemSelected').first().removeClass('vboxListItemSelected');
- $(this).addClass('vboxListItemSelected');
- $('#vboxSnapshotList').trigger('select',$(this).parent());
- });
-
-
- if(s.children.length) {
- var ul = $('<ul />');
- for(var i = 0; i < s.children.length; i++) {
- $(ul).append(__vboxTabSnapshot(s.children[i], currentId));
- }
- $(li).append(ul);
- }
-
-
-
- return li;
-}
-
-/* Current state list item */
-function __vboxTabSnapshotCurrent(vm) {
-
- return $('<li />').data('vboxSnapshot',{'state':'current','name':trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt')}).html(' ')
- .addClass('last vboxSnapshotCurrent vboxSnapshotCurrentState')
- .append(
- $('<div />').attr({'class':'vboxListItem'}).html('<img src="images/vbox/'+vboxMachineStateIcon(vm.state)+'" height="16" width="16" /> ' + $('<div />').text(trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt')).html())
- .contextMenu({
- menu: vboxSnapshotContextMenuCurrent.menuId(),
- clickthrough : true
- },vboxSnapshotContextMenuCurrent.menuClickCallback)
- .click(function(){
- $('#vboxSnapshotList').find('div.vboxListItemSelected').first().removeClass('vboxListItemSelected');
- $(this).addClass('vboxListItemSelected');
- $('#vboxSnapshotList').trigger('select',$(this).parent());
- })
- .tipped({'position':'mouse','delay':1500,'source':'<strong>'+
- trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt') + '</strong><br />'+
- trans('%1 since %2','VBoxSnapshotsWgt').replace('%1',trans(vboxVMStates.convert(vm.state),'VBoxGlobal'))
- .replace('%2',vboxDateTimeString(vm.lastStateChange))
- + (vm.snapshotCount > 0 ? '<hr />' + (vm.currentStateModified ?
- trans('The current state differs from the state stored in the current snapshot','VBoxSnapshotsWgt')
- : trans('The current state is identical to the state stored in the current snapshot','VBoxSnapshotsWgt'))
- : '')
- })
- );
-
-}
-
-
-/* Update snapshot timestamps */
-function __vboxTabSnapshotTimestamps() {
-
- // Shorthand
- var timeSpans = vboxSnapshotToolbar._timeSpans;
-
- // Keep minimum timestamp
- var minTs = 60;
-
- var currentTime = new Date();
- currentTime = Math.floor(currentTime.getTime() / 1000);
-
- $('#vboxTabVMSnapshots').find('span.timestamp').each(function(){
-
- var sts = parseInt($(this).data('vboxTimestamp'));
- var t = Math.max(currentTime - sts, 1);
-
- minTs = Math.min(minTs,t);
-
- // Check for max age.
- if(Math.floor(t / 86400) > 30) {
- var sdate = new Date(sts * 1000);
- $(this).html(trans(' (%1)','VBoxSnapshotsWgt').replace('%1',sdate.toLocaleString()));
- return;
- }
-
- var ago = 0;
- var ts = 'seconds';
- for(var i in timeSpans) {
- var l = Math.floor(t / timeSpans[i]);
- if(l > 0) {
- ago = l;
- ts = i;
- break;
- }
- }
- switch(ts) {
- case 'days':
- ts = trans('%n day(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'hours':
- ts = trans('%n hour(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'minutes':
- ts = trans('%n minute(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- case 'seconds':
- ts = trans('%n second(s)', 'VBoxGlobal', ago).replace('%n', ago);
- break;
- }
- $(this).html(ts = trans(' (%1 ago)','VBoxSnapshotsWgt').replace('%1', ts));
- });
-
- var timerSet = (minTs >= 60 ? 60 : 10);
- vboxSnapshotToolbar._timer = window.setTimeout(__vboxTabSnapshotTimestamps,(timerSet * 1000));
-}
-
-
-</script>
+<!--
+
+ VM Snapshots Pane
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabVMSnapshots.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div id='vboxTabVMSnapshots' class='vboxInvisible' style='display: none; width:100%;'>
+
+ <table class='vboxInvisible' style='height: 99%; width: 99%'>
+ <tr style='vertical-align: top; height: 1%'>
+ <td><div id='vboxSnapshotToolbar'></div></td>
+ </tr>
+ <tr style='vertical-align: top;'>
+ <td><ul style='min-height: 400px' class='vboxBordered vboxTreeView' id='vboxSnapshotList'></ul></td>
+ </tr>
+ </table>
+<!--
+
+ New Snapshot Dialog
+
+ -->
+ <div id='vboxSnapshotNew' class='vboxDialogContent' style='display: none;'>
+ <table class='vboxVertical'>
+ <tr style='vertical-align: top'>
+ <th>
+ <img id='vboxSnapshotNewImg' src='images/vbox/os_other.png' height='32' width='32' />
+ </th>
+ <td>
+ <div style='height: 100%'>
+ <div class='translate'>Snapshot Name</div>
+ <input id='vboxSnapshotNewName' style='width: 100%'/>
+ <div class='translate'>Snapshot Description</div>
+ <textarea rows='10' id='vboxSnapshotNewDesc' style='width: 100%;'></textarea>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+
+<!--
+
+ Snapshot Details Dialog
+
+ -->
+ <div id='vboxSnapshotDetails' class='vboxDialogContent' style='display: none;'>
+ <table class='vboxVertical'>
+ <tr>
+ <th><span class='translate'>Name:</span></th>
+ <td style='width:100%'>
+ <input id='vboxSnapshotDetailsName' style='width: 100%'/>
+ </td>
+ <td rowspan='2' id='vboxSnapshotSS' style='width:1%'></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Taken:</span></th>
+ <td style='width:100%'>
+ <span id='vboxSnapshotDetailsTaken'></span>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Description:</span></th>
+ <td colspan='2'>
+ <textarea rows='12' id='vboxSnapshotDetailsDesc' name='vboxSnapshotDetailsDescElm'></textarea>
+ </td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Details:</span></th>
+ <td class='vboxSnapshotDetailsMachine' colspan='2'>
+ <div id='vboxSnapshotDetailsVM' style='overflow: auto; height: 100%'></div>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+
+
+<script type='text/javascript'>
+
+vboxInitDisplay('vboxSnapshotNew','VBoxTakeSnapshotDlg');
+vboxInitDisplay('vboxSnapshotDetails','VBoxSnapshotDetailsDlg');
+
+var vboxSnapshotButtons = [
+
+ {
+ 'name' : 'take_snapshot',
+ 'label' : 'Take Snapshot...',
+ 'language_context': 'UIActionPool',
+ 'icon' : 'snapshot_take',
+ 'enabled' : function(item) {
+
+ if(typeof item == 'string') state = item;
+ else if(item && $(item).data('vboxSnapshot')) state = $(item).data('vboxSnapshot').state;
+ else return false;
+
+ var vm = vboxChooser.getSingleSelected();
+ return (item && state == 'current' && jQuery.inArray(vm.state, ['RestoringSnapshot','LiveSnapshotting','DeletingSnapshot']) == -1);
+ },
+ 'click' : function (callback) {
+
+ var vm = vboxChooser.getSingleSelected();
+
+ $('#vboxSnapshotNewImg').attr('src',"images/vbox/" + vboxGuestOSTypeIcon(vm.OSTypeId));
+
+ var snRegEx = new RegExp('^' + trans('Snapshot %1','VBoxSnapshotsWgt').replace('%1','([0-9]+)') + '$');
+
+ // Get max snapshot name
+ var snMax = 0;
+ var snList = $('#vboxSnapshotList').find('li');
+ for(var i = 0; i < snList.length; i++) {
+ var snNum = snRegEx.exec($(snList[i]).data('vboxSnapshot').name);
+ if(snNum) snMax = Math.max(parseInt(snNum[1]), snMax);
+ }
+
+ $('#vboxSnapshotNewName').val(trans('Snapshot %1','VBoxSnapshotsWgt').replace('%1',(snMax+1)));
+ $('#vboxSnapshotNewName').select();
+ $('#vboxSnapshotNewDesc').val('');
+
+
+ var buttons = {};
+ var OKBtn = buttons[trans('OK','QIMessageBox')] = function() {
+
+ // Get fresh VM state when this is clicked
+ var vm = vboxChooser.getSingleSelected();
+ if(!vm) return;
+
+ // Deferred object that will trigger
+ // taking a snapshot on success
+ var isPausedOrNotRunning = $.Deferred();
+
+ // Take snapshot function when machine is in
+ // a valid paused or not running state
+ $.when(isPausedOrNotRunning).done(function(paused) {
+
+ var l = new vboxLoader('snapshotTake');
+ l.add('snapshotTake',function(d){
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(pres){
+
+ // Unpause machine if it was paused
+ if(paused) {
+ vboxAjaxRequest('machineSetState',{'vm':vm.id,'state':'resume'});
+ }
+
+ // If progress operation errored, refresh snapshot list
+ if(pres && !pres.success)
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
+
+ // callback passed to click()? else Refresh vm list
+ if(typeof callback == 'function') { callback(pres); }
+
+ },'progress_snapshot_create_90px.png', trans('Take a snapshot of the current virtual machine state','VBoxSnapshotsWgt'),
+ vm.name);
+
+ } else {
+
+ // Unpause machine if it was paused
+ if(paused) {
+ vboxAjaxRequest('machineSetState',{'vm':vm.id,'state':'resume'});
+ }
+
+ if(d && d.error) vboxAlert(d.error);
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
+ }
+ },{'vm':vm.id,'name':$('#vboxSnapshotNewName').val(),'description':$('#vboxSnapshotNewDesc').val()});
+ l.run();
+
+ }).fail(function(){
+
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
+
+ });
+
+ // Set to paused state if VM is running
+ if(vboxVMStates.isRunning(vm)) {
+ var pl = new vboxLoader('machineSetStatePaused');
+ pl.add('machineSetState', function(d) {
+ if(d && d.success) isPausedOrNotRunning.resolve(true);
+ else isPausedOrNotRunning.reject();
+ },{'vm':vm.id,'state':'pause'});
+ pl.run();
+ } else {
+ isPausedOrNotRunning.resolve();
+ }
+
+
+ $(this).dialog('close');
+
+
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() {
+ $(this).dialog('close');
+ if(typeof callback == 'function') { callback({success:false,uicancel:true}); }
+ };
+
+ $('#vboxSnapshotNewName').off('keypress').on('keypress',function(e) { if (e.keyCode == 13) OKBtn.apply($('#vboxSnapshotNew')); });
+
+ $('#vboxSnapshotNew').dialog({'closeOnEscape':false,'width':'400px','height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/snapshot_take_16px.png" class="vboxDialogTitleIcon" height="16" width="16" /> ' + trans('Take Snapshot of Virtual Machine','VBoxTakeSnapshotDlg')});
+
+ }
+ },
+ {
+ 'name' : 'discard_cur_state',
+ 'label' : 'Restore Snapshot',
+ 'icon' : 'snapshot_restore',
+ 'enabled' : function(item) {
+ var vm = vboxChooser.getSingleSelected();
+ return ( item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current');
+ },
+ 'click' : function () {
+
+ var vm = vboxChooser.getSingleSelected();
+
+ var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
+
+ var buttons = {};
+ var q = '';
+
+ // Check if the current state is modified
+ if(vm.currentStateModified) {
+
+ q = trans("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>" +
+ "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; " +
+ "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>",'UIMessageCenter');
+ q += '<p><label><input type="checkbox" id="vboxRestoreSnapshotCreate" checked /> ' + trans('Create a snapshot of the current machine state','UIMessageCenter') + '</label></br>';
+ q += '<label><input type="checkbox" id="vboxRestoreSnapshotAutoStart" '+ (vboxVMStates.isRunning(vm)? 'checked' : '') + ' /> ' + trans('Automatically start the machine after restore','UIMessageCenter') + '</label></p>';
+
+ buttons[trans('Restore','UIMessageCenter')] = function() {
+
+ var self = this;
+ var snautostart = function() {
+ var l = new vboxLoader();
+ l.add('machineSetState',function(d){
+ if(!(d && d.success) && errorMsg) {
+ vboxAlert(errorMsg.replace('%1', vm.name));
+ return;
+ }
+ // check for progress operation
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
+ // Do Nothing
+ },'progress_state_restore_90px.png',trans('Power on virtual machine','VBoxSnapshotsWgt'), vm.name);
+ return;
+ }
+ },{'vm':vm.id,'state':'powerUp'});
+
+ l.run();
+ };
+
+ var snrestore = function(autoStart,takeSnapshot){
+
+ // Don't do anything if taking a snapshot failed
+ if(takeSnapshot && !takeSnapshot.success) {
+ if (takeSnapshot.uicancel)
+ vboxSnapshotButtons[1].click();
+ return;
+ }
+
+ // Power off VM if needed
+ if(vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) {
+ var l = new vboxLoader();
+ l.add('machineSetState',function(d){
+ if(!(d && d.success) && errorMsg) {
+ vboxAlert(errorMsg.replace('%1', vm.name));
+ return;
+ }
+ // check for progress operation
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
+ if (d && d.responseData && d.responseData.info) {
+ // when poweroff completed
+ if (d.responseData.info.completed) {
+ // schedule snapshot restore immediate after
+ setTimeout(snrestore.bind(self,autoStart,takeSnapshot),0);
+ }
+ }
+ },'progress_poweroff_90px.png',trans('Power off virtual machine','VBoxSnapshotsWgt'), vm.name);
+ }
+ },{'vm':vm.id,'state':'powerDown'});
+
+ l.run();
+ return;
+ }
+
+ var l = new vboxLoader();
+ l.add('snapshotRestore',function(d){
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(d){
+ if (d && d.responseData && d.responseData.info) {
+ // when restore completed and auto start is requested
+ if (d.responseData.info.completed && autoStart) {
+ // schedule start immediately
+ setTimeout(snautostart.bind(self), 0);
+ }
+ }
+ },'progress_snapshot_restore_90px.png',trans('Restore Snapshot','VBoxSnapshotsWgt'),
+ vm.name);
+ } else if(d && d.error) {
+ vboxAlert(d.error);
+ }
+ },{'vm':vm.id,'snapshot':snapshot.id});
+
+ l.run();
+
+ };
+
+ var vmRestoreAutoStart = $('#vboxRestoreSnapshotAutoStart').prop('checked');
+ if($('#vboxRestoreSnapshotCreate').prop('checked')) {
+ vboxSnapshotButtons[0].click(snrestore.bind(self,vmRestoreAutoStart));
+ } else {
+ snrestore(vmRestoreAutoStart);
+ }
+ $(this).empty().remove();
+ };
+
+ } else {
+
+ q = trans('<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>','UIMessageCenter');
+
+ buttons[trans('Restore','UIMessageCenter')] = function() {
+ var l = new vboxLoader();
+ l.add('snapshotRestore',function(d){
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+
+ // Let events get picked up. Nothing to do here
+
+ },'progress_snapshot_restore_90px.png',trans('Restore Snapshot','VBoxSnapshotsWgt'),
+ vm.name);
+ } else if(d && d.error) {
+ vboxAlert(d.error);
+ }
+ },{'vm':vm.id,'snapshot':snapshot.id});
+ $(this).empty().remove();
+
+ l.run();
+
+ };
+ }
+
+ vboxConfirm(q.replace('%1',$('<div />').text(snapshot.name).html()),buttons);
+ },
+ 'separator' : true
+ },
+ {
+ 'name' : 'delete_snapshot',
+ 'label' : 'Delete Snapshot',
+ 'icon' : 'snapshot_delete',
+ 'enabled' : function(item) {
+ return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current' && $(item).data('vboxSnapshot').children.length <= 1);
+ },
+ 'click' : function () {
+ var vm = vboxChooser.getSingleSelected();
+ var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
+ var buttons = {};
+ buttons[trans('Delete','UIMessageCenter')] = function() {
+ var l = new vboxLoader();
+ l.add('snapshotDelete',function(d){
+ if(d && d.responseData && d.responseData.progress) {
+ vboxProgress({'progress':d.responseData.progress,'persist':d.persist},function(){
+
+ // Let events get picked up. Nothing to do here
+
+ },'progress_snapshot_discard_90px.png',trans('Delete Snapshot','VBoxSnapshotsWgt'),
+ vm.name + ' - ' + snapshot.name);
+ }
+ },{'vm':vm.id,'snapshot':snapshot.id});
+ $(this).empty().remove();
+
+ l.run();
+ };
+ vboxConfirm(trans('<p>Deleting the snapshot will cause the state information saved in it to be lost, and '+
+ 'storage data spread over several image files that VirtualBox has created together with the snapshot '+
+ 'will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot '+
+ 'be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>','UIMessageCenter').replace('%1',$('<div />').text(snapshot.name).html()),buttons);
+ }
+ },
+ {
+ 'name' : 'show_snapshot_details',
+ 'label' : 'Show Details',
+ 'icon' : 'snapshot_show_details',
+ 'enabled' : function(item) {
+ return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && $(item).data('vboxSnapshot').state != 'current');
+ },
+ 'click' : function () {
+
+ // Current snapshot
+ var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
+
+ var vm = vboxChooser.getSingleSelected();
+
+ var l = new vboxLoader();
+ l.add('snapshotGetDetails',function(d){
+
+ $('#vboxSnapshotDetailsName').val(d.responseData.name);
+ $('#vboxSnapshotDetailsTaken').html(vboxDateTimeString(d.responseData.timeStamp));
+ $('#vboxSnapshotDetailsDesc').val(d.responseData.description);
+
+ if(d.responseData.online) {
+ $('#vboxSnapshotSS').html('<a href="'+ vboxEndpointConfig.screen +'?vm='+vm.id+
+ '&snapshot='+d.responseData.id+'&full=1" target="_blank"><img src="'+vboxEndpointConfig.screen+'?vm='+
+ vm.id+'&snapshot='+d.responseData.id+'" /></a>').show();
+ } else {
+ $('#vboxSnapshotSS').empty().hide();
+ }
+
+ // Display details
+ $('#vboxSnapshotDetailsVM').empty();
+
+ // Enclosing details Table
+ var vboxDetailsTable = $('<table />').attr({'class':'vboxDetailsTable'});
+
+ // Set to isSnapshot
+ d.responseData.machine._isSnapshot = true;
+
+ for(var i in vboxVMDetailsSections) {
+
+ section = vboxVMDetailsSections[i];
+
+ if(section.noSnapshot) continue;
+
+ $('<tr />').attr({'class':'vboxDetailsHead'}).append(
+ $('<th />').attr({'class':'vboxDetailsSection','colspan':'2'}).disableSelection()
+ .html("<img style='float:left; margin-right: 3px; ' src='images/vbox/" + section.icon + "' height='16' width='16' /> ")
+ .append(
+ $('<span />').css({'float':'left'}).append(document.createTextNode(trans(section.title, section.language_context) +' '))
+ )
+ ).appendTo(vboxDetailsTable);
+
+ __vboxDetailAddRows(d.responseData.machine, section.rows, vboxDetailsTable);
+
+ }
+
+ $('#vboxSnapshotDetailsVM').append(vboxDetailsTable);
+
+
+ },{'vm':vm.id,'snapshot':snapshot.id});
+ l.onLoad = function(){
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ // Current snapshot
+ var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
+
+ var l = new vboxLoader();
+ l.add('snapshotSave',function(d){
+
+ // Let events get picked up. Nothing to do here
+
+ },{'vm':vm.id,'snapshot':snapshot.id,'name':$('#vboxSnapshotDetailsName').val(),'description':$('#vboxSnapshotDetailsDesc').val()});
+ $(this).dialog('close');
+ l.run();
+
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).dialog('close');
+ };
+ $('#vboxSnapshotDetails').dialog({'closeOnEscape':false,'width':'600px','height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/snapshot_show_details_16px.png" class="vboxDialogTitleIcon" /> '+trans('Details of %1 (%2)','VBoxSnapshotDetailsDlg').replace('%1',$('<div />').text(snapshot.name).html()).replace('%2',vm.name)});
+ };
+ l.run();
+ }
+ },
+ {
+ 'name' : 'clone',
+ 'label' : 'Clone...',
+ 'language_context': 'UIActionPool',
+ 'icon' : 'vm_clone',
+ 'separator' : true,
+ 'enabled' : function(item) {
+ var vm = vboxChooser.getSingleSelected();
+ return (item && $(item).data('vboxSnapshot') && $(item).data('vboxSnapshot').name && !vboxVMStates.isPaused(vm) && !vboxVMStates.isRunning(vm));
+ },
+ 'click' : function () {
+
+ var vm = vboxChooser.getSingleSelected();
+
+ // Current snapshot
+ var snapshot = $('#vboxSnapshotList').find('div.vboxListItemSelected').first().parent().data('vboxSnapshot');
+
+ new vboxWizardCloneVMDialog({'vm':vm,'snapshot':(snapshot.state == 'current' ? undefined : snapshot)}).run();
+
+ }
+ },
+
+
+
+];
+
+
+/* Append Top Toolbar */
+var vboxSnapshotToolbar = new vboxToolbarSmall({buttons: vboxSnapshotButtons, size: 22, language_context: 'VBoxSnapshotsWgt'});
+// special case for 'clone' button because it is 16px rather than 22px
+vboxSnapshotToolbar.addButtonCSS('clone', {'background-position':'6px 4px'});
+vboxSnapshotToolbar.renderTo('vboxSnapshotToolbar');
+
+vboxInitDisplay('vboxSnapshotToolbar','VBoxSnapshotsWgt');
+
+// Context menu for snapshots
+var vboxSnapshotContextMenu = new vboxMenu({name:'vboxSnapshotContextMenu', language_context: 'VBoxSnapshotsWgt'});
+vboxSnapshotContextMenu.addMenu(vboxSnapshotButtons.slice(-(vboxSnapshotButtons.length-1)));
+
+//Context menu for current state
+var vboxSnapshotContextMenuCurrent = new vboxMenu({name: 'vboxSnapshotContextMenuCurrent', language_context: 'VBoxSnapshotsWgt'});
+vboxSnapshotContextMenuCurrent.addMenu([vboxSnapshotButtons[0],vboxSnapshotButtons[(vboxSnapshotButtons.length-2)]]);
+
+
+/* Toolbar and menu updates*/
+$('#vboxSnapshotList').on('select',function(e,item) {
+
+ // Update toolbar
+ vboxSnapshotToolbar.update(item);
+
+ vboxSnapshotContextMenu.update(item);
+ vboxSnapshotContextMenuCurrent.update(item);
+
+});
+
+// Hold timer and date vars
+vboxSnapshotToolbar._timer = null;
+vboxSnapshotToolbar._timeSpans = new Array();
+vboxSnapshotToolbar._timeSpans['days'] = 86400;
+vboxSnapshotToolbar._timeSpans['hours'] = 3600,
+vboxSnapshotToolbar._timeSpans['minutes'] = 60,
+vboxSnapshotToolbar._timeSpans['seconds'] = 1;
+vboxSnapshotToolbar._timeSpans.sort(function(a,b){return (a > b ? -1 : 1);});
+
+
+
+/* Selected VM changed */
+$('#vboxPane').on('vmSelectionListChanged',function(){
+
+ $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop'));
+
+ var vm = vboxChooser.getSingleSelected();
+
+ $('#vboxSnapshotList').trigger('select',null);
+
+ // Got vm and it's not host
+ if(vm && vm.id != 'host') {
+
+ // Enable tab
+ $('#vboxTabVMSnapshots').parent().trigger('enableTab', ['vboxTabVMSnapshots']);
+
+ $.when(vboxVMDataMediator.getVMDetails(vm.id)).done(function(vm) {
+ $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop') + (vm && vm.snapshotCount ? trans(' (%1)','VBoxSnapshotsWgt').replace('%1',vm.snapshotCount):''));
+ });
+
+ // Unset last vm
+ $('#vboxTabVMSnapshots').data('lastVM',0);
+
+ // Remove children
+ $('#vboxSnapshotList').children().empty().remove();
+
+ // Fill snapshots if this tab is being shown
+ if($('#vboxTabVMSnapshots').data('vboxShowing')) {
+
+ // Keep track of last VM shown
+ $('#vboxTabVMSnapshots').data('lastVM',vm.id);
+
+ // append spinner
+ $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
+
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
+
+ }
+
+ // No single selected VM or it is host
+ } else {
+ // disable tab
+ $('#vboxTabVMSnapshots').parent().trigger('disableTab', ['vboxTabVMSnapshots']);
+ $('#vboxTabVMSnapshots').data('lastVM',0);
+ }
+
+/**
+ *
+ * VBOX event list triggered
+ *
+ */
+}).on('vboxEvents',function(e,eventList) {
+
+ var redrawCurrent = false;
+
+ for(var i = 0; i < eventList.length; i++) {
+
+ switch(eventList[i].eventType) {
+
+ //////////////////////////
+ //
+ // Snapshot events
+ //
+ /////////////////////////
+ case 'OnSnapshotTaken':
+ case 'OnSnapshotDeleted':
+ case 'OnSnapshotRestored':
+ case 'OnSnapshotChanged':
+
+ // Is this vm selected
+ if(vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
+
+ // Update title
+ $('#vboxTabVMSnapshotsTitle').html(trans('Snapshots','UIVMDesktop') +
+ (eventList[i].enrichmentData && eventList[i].enrichmentData.snapshotCount ? trans(' (%1)','VBoxSnapshotsWgt').replace('%1',eventList[i].enrichmentData.snapshotCount):''));
+
+ // Redraw snapshots if this is shown
+ if($('#vboxTabVMSnapshots').data('lastVM') == eventList[i].machineId) {
+
+ $('#vboxSnapshotList').children().empty().remove();
+
+ // Append spinner
+ $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
+
+
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':eventList[i].machineId})).done(__vboxTabSnapshotsFill);
+
+ return;
+
+ }
+ }
+ break;
+
+ /////////////////////////
+ //
+ // Session or state change
+ //
+ ////////////////////////
+ case 'OnSessionStateChanged':
+ case 'OnMachineStateChanged':
+ if($('#vboxTabVMSnapshots').data('lastVM') == eventList[i].machineId && vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
+ redrawCurrent = true;
+ }
+ break;
+
+ }
+
+ }
+
+ // Redraw current snapshot
+ if(redrawCurrent) {
+
+ var vmid = vboxChooser.getSingleSelectedId();
+
+ // Get current state and details data
+ $.when(vboxVMDataMediator.getVMData(vmid), vboxVMDataMediator.getVMDetails(vmid)).done(function(vm, vmd) {
+
+ if($('#vboxTabVMSnapshots').data('lastVM') != vm.id) return;
+
+ var selected = $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').children('div.vboxListItemSelected').length;
+ $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').replaceWith(__vboxTabSnapshotCurrent($.extend(true,{},vm,vmd)));
+ if(selected) {
+ $('#vboxSnapshotList').trigger('select',
+ $('#vboxTabVMSnapshots').find('li.vboxSnapshotCurrentState').children('div.vboxListItem').addClass('vboxListItemSelected').parent());
+ }
+ });
+ }
+
+
+});
+
+// Load snapshots on show
+$('#vboxTabVMSnapshots').on('show',function(e){
+
+ $('#vboxTabVMSnapshots').data('vboxShowing', 1);
+
+ var vm = vboxChooser.getSingleSelected();
+
+ if(vm && vm.id) {
+ if($('#vboxTabVMSnapshots').data('lastVM') == vm.id) return;
+ $('#vboxTabVMSnapshots').data('lastVM', vm.id);
+ } else {
+ $('#vboxSnapshotList').children().remove();
+ $('#vboxTabVMSnapshots').data('lastVM',0);
+ vboxSnapshotToolbar.disable();
+ return;
+ }
+
+
+ // Get snapshots
+ // Append spinner
+ $('#vboxSnapshotList').append($('<li />').attr({'class':'last'}).html("<div><img src='images/spinner.gif'></div>"));
+ $.when(vboxAjaxRequest('machineGetSnapshots',{'vm':vm.id})).done(__vboxTabSnapshotsFill);
+
+
+}).on('hide',function(e) {
+ $('#vboxTabVMSnapshots').data('vboxShowing', 0);
+});
+
+/*
+ * Fill Snapshots
+*/
+function __vboxTabSnapshotsFill(response) {
+
+ var snapshotData = response.responseData;
+
+ if(vboxSnapshotToolbar._timer) {
+ window.clearTimeout(vboxSnapshotToolbar._timer);
+ vboxSnapshotToolbar._timer = null;
+ }
+
+ if(!snapshotData) return;
+
+ // Get current state and details data
+ $.when(vboxVMDataMediator.getVMData(response.responseData.vm), vboxVMDataMediator.getVMDetails(response.responseData.vm)).done(function(vm, vmd) {
+
+ if($('#vboxTabVMSnapshots').data('lastVM') != vm.id) return;
+
+ var list = $('#vboxSnapshotList');
+ $(list).children().remove();
+
+ var vmc = $.extend(true, {}, vm, vmd);
+
+ // Snapshots exist
+ if(snapshotData.snapshot && snapshotData.snapshot.name) {
+
+ // Traverse snapshots
+ $(list).append(__vboxTabSnapshot(snapshotData.snapshot, snapshotData.currentSnapshotId));
+
+ // Append current state to last snapshot
+ if(snapshotData.currentSnapshotId) {
+
+ // Has children
+ if($('#'+snapshotData.currentSnapshotId).children('ul').first()[0]) {
+ $('#'+snapshotData.currentSnapshotId).children('ul').last().append(__vboxTabSnapshotCurrent(vmc));
+ } else {
+ $('#'+snapshotData.currentSnapshotId).append($('<ul />').append(__vboxTabSnapshotCurrent(vmc)));
+ };
+ };
+
+ // No snapshots. Append current state to list
+ } else {
+ $(list).append(__vboxTabSnapshotCurrent(vmc));
+ }
+
+ // Init vbox tree list
+ $('#vboxSnapshotList').vbtree();
+
+ vboxSnapshotToolbar.enable();
+
+ var lastListItem = $(list).find('li.vboxSnapshotCurrentState').last();
+ lastListItem.children().addClass('vboxListItemSelected');
+ $('#vboxSnapshotList').trigger('select',lastListItem);
+
+ __vboxTabSnapshotTimestamps();
+
+ });
+
+}
+
+/* Snapshot list item */
+function __vboxTabSnapshot(s, currentId) {
+
+ var li = $('<li />').attr({'id':s.id});
+ $(li).data('vboxSnapshot',s);
+
+ // Use timestamp
+ var t = '';
+ if(s.timeStampSplit['seconds'] == 0)
+ s.timeStampSplit['seconds'] = 1;
+
+ var ago = 0;
+ var ts = 'seconds';
+ for(var i in s.timeStampSplit) {
+ var l = Math.floor(t / s.timeStampSplit[i]);
+ if(l > 0) {
+ ago = l;
+ ts = i;
+ break;
+ }
+ }
+
+ switch(ts) {
+ case 'days':
+ ts = trans('%n day(s)','VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'hours':
+ ts = trans('%n hour(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'minutes':
+ ts = trans('%n minute(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'seconds':
+ ts = trans('%n second(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ }
+ ts = trans(' (%1 ago)','VBoxSnapshotsWgt').replace('%1', ts);
+
+ $(li).append(' ').append(
+
+ $('<div />').attr({'class':'vboxListItem'})
+ .html('<img src="images/vbox/snapshot_'+(s.online ? 'online' : 'offline')+'_16px.png" height="16" width="16" /> ' +
+ $('<div />').text(s.name).html())
+ .append($('<span />').attr({'class':'timestamp'}).data({'vboxTimestamp':s.timeStamp}).text(ts))
+
+ // Context menu
+ .contextMenu({
+ menu: vboxSnapshotContextMenu.menuId(),
+ clickthrough: true
+ },vboxSnapshotContextMenu.menuClickCallback)
+
+ // show details on dblclick
+ .dblclick(vboxSnapshotButtons[4].click).disableSelection()
+
+ // tool tip
+ .tipped({'position':'mouse','delay':1500,'source':'<p><strong>'+$('<div />').text(s.name).html()+'</strong> ('+trans((s.online ? 'online)' : 'offline)'),'VBoxSnapshotsWgt')+'</p>'+
+ '<p>'+ vboxDateTimeString(s.timeStamp, trans('Taken at %1','VBoxSnapshotsWgt'), trans('Taken on %1','VBoxSnapshotsWgt'))+'</p>' +
+ (s.description ? '<hr />' + $('<div />').text(s.description).html() : '')})
+
+ ).addClass(currentId == s.id ? 'vboxSnapshotCurrent' : '').children('div.vboxListItem').first().click(function(){
+ $('#vboxSnapshotList').find('div.vboxListItemSelected').first().removeClass('vboxListItemSelected');
+ $(this).addClass('vboxListItemSelected');
+ $('#vboxSnapshotList').trigger('select',$(this).parent());
+ });
+
+
+ if(s.children.length) {
+ var ul = $('<ul />');
+ for(var i = 0; i < s.children.length; i++) {
+ $(ul).append(__vboxTabSnapshot(s.children[i], currentId));
+ }
+ $(li).append(ul);
+ }
+
+
+
+ return li;
+}
+
+/* Current state list item */
+function __vboxTabSnapshotCurrent(vm) {
+
+ return $('<li />').data('vboxSnapshot',{'state':'current','name':trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt')}).html(' ')
+ .addClass('last vboxSnapshotCurrent vboxSnapshotCurrentState')
+ .append(
+ $('<div />').attr({'class':'vboxListItem'}).html('<img src="images/vbox/'+vboxMachineStateIcon(vm.state)+'" height="16" width="16" /> ' + $('<div />').text(trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt')).html())
+ .contextMenu({
+ menu: vboxSnapshotContextMenuCurrent.menuId(),
+ clickthrough : true
+ },vboxSnapshotContextMenuCurrent.menuClickCallback)
+ .click(function(){
+ $('#vboxSnapshotList').find('div.vboxListItemSelected').first().removeClass('vboxListItemSelected');
+ $(this).addClass('vboxListItemSelected');
+ $('#vboxSnapshotList').trigger('select',$(this).parent());
+ })
+ .tipped({'position':'mouse','delay':1500,'source':'<strong>'+
+ trans((vm.currentStateModified ? 'Current State (changed)' : 'Current State'),'VBoxSnapshotsWgt') + '</strong><br />'+
+ trans('%1 since %2','VBoxSnapshotsWgt').replace('%1',trans(vboxVMStates.convert(vm.state),'VBoxGlobal'))
+ .replace('%2',vboxDateTimeString(vm.lastStateChange))
+ + (vm.snapshotCount > 0 ? '<hr />' + (vm.currentStateModified ?
+ trans('The current state differs from the state stored in the current snapshot','VBoxSnapshotsWgt')
+ : trans('The current state is identical to the state stored in the current snapshot','VBoxSnapshotsWgt'))
+ : '')
+ })
+ );
+
+}
+
+
+/* Update snapshot timestamps */
+function __vboxTabSnapshotTimestamps() {
+
+ // Shorthand
+ var timeSpans = vboxSnapshotToolbar._timeSpans;
+
+ // Keep minimum timestamp
+ var minTs = 60;
+
+ var currentTime = new Date();
+ currentTime = Math.floor(currentTime.getTime() / 1000);
+
+ $('#vboxTabVMSnapshots').find('span.timestamp').each(function(){
+
+ var sts = parseInt($(this).data('vboxTimestamp'));
+ var t = Math.max(currentTime - sts, 1);
+
+ minTs = Math.min(minTs,t);
+
+ // Check for max age.
+ if(Math.floor(t / 86400) > 30) {
+ var sdate = new Date(sts * 1000);
+ $(this).html(trans(' (%1)','VBoxSnapshotsWgt').replace('%1',sdate.toLocaleString()));
+ return;
+ }
+
+ var ago = 0;
+ var ts = 'seconds';
+ for(var i in timeSpans) {
+ var l = Math.floor(t / timeSpans[i]);
+ if(l > 0) {
+ ago = l;
+ ts = i;
+ break;
+ }
+ }
+ switch(ts) {
+ case 'days':
+ ts = trans('%n day(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'hours':
+ ts = trans('%n hour(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'minutes':
+ ts = trans('%n minute(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ case 'seconds':
+ ts = trans('%n second(s)', 'VBoxGlobal', ago).replace('%n', ago);
+ break;
+ }
+ $(this).html(ts = trans(' (%1 ago)','VBoxSnapshotsWgt').replace('%1', ts));
+ });
+
+ var timerSet = (minTs >= 60 ? 60 : 10);
+ vboxSnapshotToolbar._timer = window.setTimeout(__vboxTabSnapshotTimestamps,(timerSet * 1000));
+}
+
+
+</script>
</div>
diff --git a/panes/tabs.html b/panes/tabs.html
index 1b72f8a..b1b2142 100644
--- a/panes/tabs.html
+++ b/panes/tabs.html
@@ -1,177 +1,177 @@
-<!--
-
- Main Tabs
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: tabs.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div id='tabMainContent' class='vboxInvisible' style='overflow: auto;'></div>
-<script type='text/javascript'>
-
-// Create UL
-$('#vboxTabsList').append($('<ul />').attr({'id':'tablistMain'}));
-
-
-var tabs = [
- // Details
- {
- name:'vboxTabVMDetails',
- content:'tabVMDetails',
- label:'Details',
- icon:'vm_settings'
-
- // Snapshots
- },{
- name:'vboxTabVMSnapshots',
- content:'tabVMSnapshots',
- label:'Snapshots',
- icon:'snapshot_take',
- default_disabled: true
-
- // Console
- },{
- name:'vboxTabVMConsole',
- content:'tabVMConsole',
- label:'Console',
- icon:'vrdp',
- default_disabled: true
- }
-];
-
-
-// Tab object. Defined in this file
-var tabsMain = new vboxTabs('tabMainContent');
-
-// Loader that will load our tab panes
-var tabLoader = new vboxLoader();
-
-// Load each tab and create tab link
-for(var i = 0; i < tabs.length; i++) {
-
- // Tab disabled?
- if($('#vboxPane').data('vboxConfig')['disable' + tabs[i].name.substring(4)])
- continue;
-
- // Tab link
- $('<li />').attr({'class':'ui-corner-all','id':'tabsMain-'+tabs[i].name}).html('<a href="#'+tabs[i].name+'"><span><img src="images/vbox/'+tabs[i].icon+'_16px.png" border="0" /> <span id="'+tabs[i].name+'Title">'+trans(tabs[i].label, 'UIVMDesktop')+'</span></span></a>').appendTo('#tablistMain');
-
- tabLoader.addFileToDOM('panes/'+tabs[i].content+'.html',$('#tabMainContent'));
-
-}
-
-// Once tabs are loaded run this..
-tabLoader.onLoad = function(){
-
- for(var i = 0; i < tabs.length; i++) {
-
- // Tab disabled?
- if($('#vboxPane').data('vboxConfig')['disable' + tabs[i].name.substring(4)])
- continue;
-
- tabsMain.addTab(tabs[i]);
-
- }
-
- // Add "click" functionality to each tab
- $('#tablistMain').children().click(function(){
- if(!$(this).hasClass('vboxDisabled'))
- tabsMain.showTab($(this).children().first().attr('href'));
- return false;
-
- // Mouseover
- }).hover(function(){
- if($(this).hasClass('vboxDisabled')) return false;
- $(this).addClass('vboxHover');
- },function(){
- $(this).removeClass('vboxHover');
- });
-
- // Watch for tabs asking to be enabled / disabled
- $('#tabMainContent').on('enableTab',function(e,tabName) {
- tabsMain.enableTab(tabsMain.getTabByName(tabName));
- }).on('disableTab',function(e,tabName) {
- tabsMain.disableTab(tabsMain.getTabByName(tabName));
- });
-
-
-};
-tabLoader.run();
-
-/*
- * Tabs pane JavaScript code for main tabs. This
- * class listens for a vmlist selection change and tells
- * the tabs to update themselves with new data
- *
- */
-
-function vboxTabs(id) {
-
- var self = this;
- this.ref = null;
- this.vm = null;
- this.tabs = new Array();
- this.tabSelected = null;
- this.id = id;
-
- // Add a tab to list
- this.addTab = function (tab) {
-
- if(!this.tabSelected) {
- this.tabSelected = '#'+tab.name;
- $('#tablistMain').find('a[href=#'+tab.name+']').parent().addClass('selected');
- }
- this.tabs[this.tabs.length] = tab;
-
- // Initially Disable tab
- if(tab.default_disabled) {
- self.disableTab(tab);
- }
- };
-
- // Get a tab by name
- this.getTabByName = function(name) {
- for(var i = 0; i < self.tabs.length; i++) {
- if(self.tabs[i].name == name) return self.tabs[i];
- }
- };
-
- // Show a tab
- this.showTab = function (tab) {
-
- // Do nothing if it is already shown
- if(self.tabSelected == tab) return;
-
- // Hide each tab
- for(var i = 0; i < self.tabs.length; i++) {
- $('#'+self.tabs[i].name).css({'display':'none'}).trigger('hide');
- }
-
- // Show tab
- $(''+tab).css('display','').trigger('show');
- self.tabSelected = tab;
- $('#tablistMain').children().removeClass('selected');
- $('#tablistMain').find('a[href='+tab+']').parent().addClass('selected');
-
-
- };
-
- // Disable a tab
- this.disableTab = function(tab) {
-
- // Was this tab selected?
- if(self.tabSelected == '#'+tab.name)
- self.showTab('#'+self.tabs[0].name);
-
- $('#tabsMain-'+tab.name).addClass('vboxDisabled').find('img').attr('src','images/vbox/'+(tab.disabled_icon ? tab.disabled_icon : tab.icon+'_disabled')+'_16px.png');
- };
-
- // Enable a tab
- this.enableTab = function(tab) {
- $('#tabsMain-'+tab.name).removeClass('vboxDisabled').find('img').attr('src','images/vbox/'+tab.icon+'_16px.png');
- };
-
-}
-
-</script>
-
+<!--
+
+ Main Tabs
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: tabs.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div id='tabMainContent' class='vboxInvisible' style='overflow: auto;'></div>
+<script type='text/javascript'>
+
+// Create UL
+$('#vboxTabsList').append($('<ul />').attr({'id':'tablistMain'}));
+
+
+var tabs = [
+ // Details
+ {
+ name:'vboxTabVMDetails',
+ content:'tabVMDetails',
+ label:'Details',
+ icon:'vm_settings'
+
+ // Snapshots
+ },{
+ name:'vboxTabVMSnapshots',
+ content:'tabVMSnapshots',
+ label:'Snapshots',
+ icon:'snapshot_take',
+ default_disabled: true
+
+ // Console
+ },{
+ name:'vboxTabVMConsole',
+ content:'tabVMConsole',
+ label:'Console',
+ icon:'vrdp',
+ default_disabled: true
+ }
+];
+
+
+// Tab object. Defined in this file
+var tabsMain = new vboxTabs('tabMainContent');
+
+// Loader that will load our tab panes
+var tabLoader = new vboxLoader();
+
+// Load each tab and create tab link
+for(var i = 0; i < tabs.length; i++) {
+
+ // Tab disabled?
+ if($('#vboxPane').data('vboxConfig')['disable' + tabs[i].name.substring(4)])
+ continue;
+
+ // Tab link
+ $('<li />').attr({'class':'ui-corner-all','id':'tabsMain-'+tabs[i].name}).html('<a href="#'+tabs[i].name+'"><span><img src="images/vbox/'+tabs[i].icon+'_16px.png" border="0" /> <span id="'+tabs[i].name+'Title">'+trans(tabs[i].label, 'UIVMDesktop')+'</span></span></a>').appendTo('#tablistMain');
+
+ tabLoader.addFileToDOM('panes/'+tabs[i].content+'.html',$('#tabMainContent'));
+
+}
+
+// Once tabs are loaded run this..
+tabLoader.onLoad = function(){
+
+ for(var i = 0; i < tabs.length; i++) {
+
+ // Tab disabled?
+ if($('#vboxPane').data('vboxConfig')['disable' + tabs[i].name.substring(4)])
+ continue;
+
+ tabsMain.addTab(tabs[i]);
+
+ }
+
+ // Add "click" functionality to each tab
+ $('#tablistMain').children().click(function(){
+ if(!$(this).hasClass('vboxDisabled'))
+ tabsMain.showTab($(this).children().first().attr('href'));
+ return false;
+
+ // Mouseover
+ }).hover(function(){
+ if($(this).hasClass('vboxDisabled')) return false;
+ $(this).addClass('vboxHover');
+ },function(){
+ $(this).removeClass('vboxHover');
+ });
+
+ // Watch for tabs asking to be enabled / disabled
+ $('#tabMainContent').on('enableTab',function(e,tabName) {
+ tabsMain.enableTab(tabsMain.getTabByName(tabName));
+ }).on('disableTab',function(e,tabName) {
+ tabsMain.disableTab(tabsMain.getTabByName(tabName));
+ });
+
+
+};
+tabLoader.run();
+
+/*
+ * Tabs pane JavaScript code for main tabs. This
+ * class listens for a vmlist selection change and tells
+ * the tabs to update themselves with new data
+ *
+ */
+
+function vboxTabs(id) {
+
+ var self = this;
+ this.ref = null;
+ this.vm = null;
+ this.tabs = new Array();
+ this.tabSelected = null;
+ this.id = id;
+
+ // Add a tab to list
+ this.addTab = function (tab) {
+
+ if(!this.tabSelected) {
+ this.tabSelected = '#'+tab.name;
+ $('#tablistMain').find('a[href=#'+tab.name+']').parent().addClass('selected');
+ }
+ this.tabs[this.tabs.length] = tab;
+
+ // Initially Disable tab
+ if(tab.default_disabled) {
+ self.disableTab(tab);
+ }
+ };
+
+ // Get a tab by name
+ this.getTabByName = function(name) {
+ for(var i = 0; i < self.tabs.length; i++) {
+ if(self.tabs[i].name == name) return self.tabs[i];
+ }
+ };
+
+ // Show a tab
+ this.showTab = function (tab) {
+
+ // Do nothing if it is already shown
+ if(self.tabSelected == tab) return;
+
+ // Hide each tab
+ for(var i = 0; i < self.tabs.length; i++) {
+ $('#'+self.tabs[i].name).css({'display':'none'}).trigger('hide');
+ }
+
+ // Show tab
+ $(''+tab).css('display','').trigger('show');
+ self.tabSelected = tab;
+ $('#tablistMain').children().removeClass('selected');
+ $('#tablistMain').find('a[href='+tab+']').parent().addClass('selected');
+
+
+ };
+
+ // Disable a tab
+ this.disableTab = function(tab) {
+
+ // Was this tab selected?
+ if(self.tabSelected == '#'+tab.name)
+ self.showTab('#'+self.tabs[0].name);
+
+ $('#tabsMain-'+tab.name).addClass('vboxDisabled').find('img').attr('src','images/vbox/'+(tab.disabled_icon ? tab.disabled_icon : tab.icon+'_disabled')+'_16px.png');
+ };
+
+ // Enable a tab
+ this.enableTab = function(tab) {
+ $('#tabsMain-'+tab.name).removeClass('vboxDisabled').find('img').attr('src','images/vbox/'+tab.icon+'_16px.png');
+ };
+
+}
+
+</script>
+
diff --git a/panes/toolbar.html b/panes/toolbar.html
index b637c60..c76b347 100644
--- a/panes/toolbar.html
+++ b/panes/toolbar.html
@@ -1,556 +1,556 @@
-<!--
-
- Top (main) phpVirtualBox tool bar
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: toolbar.html 599 2015-07-27 10:40:37Z imoore76 $
-
--->
-<script type='text/javascript'>
-
-/*
- * JS objects for actions that can be performed on a VM
- * from this toolbar
- */
-var tButtons = [
-
- vboxVMActions['new'],
- $.extend({},vboxVMActions['settings'],{click: function(){
- var vm = vboxChooser.getSingleSelected();
- if(!vm || vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) return;
- vboxVMActions['settings'].click();
-
- }}),
- vboxVMActions['start'],
- {
- name: 'stop',
- icon: 'vm_poweroff',
- label: 'Stop',
- language_context: 'VBoxSelectorWnd',
- enabled: vboxVMActions['stop'].enabled,
- click : function() {return;}
- }
-];
-
-/* Append Top Toolbar */
-var vboxChooserToolbarTop = new vboxToolbar({buttons: tButtons, size: 32,
- language_context: 'UIActionPool', renderTo: 'vboxPaneToolbar'});
-
-/* Stop button menu and actions */
-var stopMenuItems = [
- vboxVMActions['pause'],
- vboxVMActions['reset'],
-];
-for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
- var n = $.extend({}, vboxVMActions[vboxVMActions.stop_actions[i]]);
- if(i==0) n.separator = true;
- stopMenuItems[stopMenuItems.length] = n;
-}
-stopMenu = new vboxMenu({name: 'stopContextMenu', menuItems: stopMenuItems, language_context: 'UIActionPool'});
-
-vboxChooserToolbarTop.getButtonElement('stop').contextMenu({
- menu: stopMenu.menuId(),
- button: 0,
- mode: 'menu'
- },function(a, el, pos) {
- for(var i in vboxVMActions) {
- if(typeof i == 'string' && vboxVMActions[i].name == a) {
- vboxVMActions[i].click();
- return;
- }
- }
- }
-);
-
-/* 'Settings' menu items / actions */
-var vboxChooserSettingsMenu = {
-
- 'settings' : {
- 'label' : vboxVMActions['settings'].label,
- 'icon' : vboxVMActions['settings'].icon
- },
- 'storage' : {
- 'icon' : 'hd'
- },
- 'USB' : {
- 'label' : 'USB',
- 'icon' : 'usb'
- },
- 'Network' : {
- 'label' : 'Network',
- 'icon' : 'nw'
- },
- 'SharedFolders' : {
- 'label' : 'Shared Folders',
- 'icon' : 'sf'
- },
- 'RemoteDisplay' : {
- 'label' : 'Remote Display',
- 'icon' : 'vrdp',
- 'separator' : true
- },
- 'GuestAdditions' : {
- 'label' : vboxVMActions['guestAdditionsInstall'].label,
- 'icon' : vboxVMActions['guestAdditionsInstall'].icon,
- 'separator' : true
- }
-
-};
-
-
-/* 'Settings' menu */
-var ul = $('<ul />').attr({'class':'contextMenu','style':'display: none','id':'vboxVMSettingsMenu'});
-
-for(var i in vboxChooserSettingsMenu) {
-
- // add name
- vboxChooserSettingsMenu[i].name = i;
- var label = trans(vboxChooserSettingsMenu[i].label, 'UIActionPool');
- var li = $('<li />').html("<span class='vboxMenuItemChecked' /><a href='#" + vboxChooserSettingsMenu[i].name + "' style='background-image: url(images/vbox/" + vboxChooserSettingsMenu[i].icon +"_16px.png);' >"+(label ? label : ' ')+"</a>");
- if(i == 'storage') { $(li).attr({'style':'display:none','id':'vboxVMSettingsToolbarStorageHolder'}); }
- if(i == 'USB') {
- /* 'USB' menu */
- $('<ul />').attr({'class':'vboxSettingsUSBAttachmentsMenu contextMenuNoBG','style':'display: none','id':'vboxVMSettingsUSBMenu'}).data({'callback':'vboxChooserToolbarUSBUpdate'}).appendTo(li);
- }
- if(vboxChooserSettingsMenu[i].separator) $(li).addClass('separator');
- $(ul).append(li);
-
-}
-
-/* Append 'Settings' button Menu */
-$('#vboxPane').append(ul);
-
-
-
-/* 'Settings' button menu initialization */
-vboxChooserToolbarTop.getButtonElement('settings').contextMenu({
- menu: 'vboxVMSettingsMenu',
- button: 0,
- mode: 'menu'
- },
- function(a, el, pos, srcEl) {
-
- var vm = vboxChooser.getSingleSelected();
-
- if(!vm) return;
-
- switch(a) {
-
- case 'Network':
- case 'SharedFolders':
- vboxVMsettingsDialog(vm, a);
- break;
-
- case 'GuestAdditions':
-
- vboxVMActions['guestAdditionsInstall'].click();
- break;
-
- // Don't do anything for dvd, fd, or USB devices main menu item click
- case 'dvdDevices':
- case 'fdDevices':
- case 'USB':
- break;
-
- case 'RemoteDisplay':
- var en = vboxVMDataMediator.getVMRuntimeData(vm.id).VRDEServer.enabled;
- vboxAjaxRequest('consoleVRDEServerSave',{'vm':vm.id,'enabled':(en ? 0 : 1)});
- break;
-
- case 'settings':
- vboxVMActions['settings'].click();
- break;
-
- default:
-
- // Assume it was a storage action
- if(vboxToolbarMediaLast) {
- if(vboxToolbarMediaLast.type == 'DVD') {
- vboxToolbarMediaMenuDVD.menuCallback(a,el,pos);
- } else {
- vboxToolbarMediaMenuFD.menuCallback(a,el,pos);
- }
- }
-
- } // </ switch / case >
-
- }
-);
-
-/*
- * Storage mount menu
- */
-var vboxToolbarMediaLast = null; // Used when context menu item is clicked to determine
- // which medium attachment to act upon.
-function vboxChooserToolbarMediumMount(medium) {
-
- var vmid = vboxChooser.getSingleSelectedId();
-
- var args = {'vm':vmid,'medium':medium,'port':vboxToolbarMediaLast.port,'device':vboxToolbarMediaLast.device,'bus':vboxToolbarMediaLast.bus,'controller':vboxToolbarMediaLast.controller};
-
- // Ajax request to mount medium
- var mount = new vboxLoader('mediumMount');
- mount.add('mediumMount',function(d){
- var l = new vboxLoader('getMedia');
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.run();
- },args);
- mount.run();
-}
-var vboxToolbarMediaMenuDVD = new vboxMediaMenu('DVD',vboxChooserToolbarMediumMount,'');
-var vboxToolbarMediaMenuFD = new vboxMediaMenu('Floppy',vboxChooserToolbarMediumMount,'');
-
-function vboxChooserToolbarStorageUpdate(menu) {
-
- vboxToolbarMediaLast = $(menu).data('storage');
- var medium = null;
- if(vboxToolbarMediaLast && vboxToolbarMediaLast.medium && vboxToolbarMediaLast.medium.id)
- medium = vboxMedia.getMediumById(vboxToolbarMediaLast.medium.id);
-
- if(vboxToolbarMediaLast.type == 'DVD') {
- vboxToolbarMediaMenuDVD.menuUpdateMedia(medium);
- return vboxToolbarMediaMenuDVD.menuElement();
- }
-
- vboxToolbarMediaMenuFD.menuUpdateMedia(medium);
- return vboxToolbarMediaMenuFD.menuElement();
-}
-
-// Update host drives and recent media on host change.
-// Just recreate the menus
-$('#vboxPane').on('hostChanged',function(){
- vboxToolbarMediaMenuDVD = new vboxMediaMenu('DVD',vboxChooserToolbarMediumMount,'');
- vboxToolbarMediaMenuFD = new vboxMediaMenu('Floppy',vboxChooserToolbarMediumMount,'');
-});
-/*
- * Update USB device list
- */
-function vboxChooserToolbarUSBUpdate(menu) {
-
- $(menu).append($('<li />').html('<span><img src="images/jqueryFileTree/spinner.gif" /></span>').css({'width':'100px','text-align':'center'}));
-
- var vm = vboxChooser.getSingleSelected();
-
- var l = new vboxLoader();
-
- l.add('hostGetUSBDevices',function(d){
- $('#vboxPaneToolbar').data('hostUSB',d.responseData);
- },{});
-
- l.add('consoleGetUSBDevices',function(d){
- $('#vboxPaneToolbar').data('guestUSB',d.responseData);
- },{'vm':vm.id});
-
- l.noLoadingScreen = true;
- l.onLoad = function() {
-
- var hostUSB = $('#vboxPaneToolbar').data('hostUSB');
- var guestUSB = $('#vboxPaneToolbar').data('guestUSB');
- $(menu).children().remove();
-
- for(var i = 0; i < hostUSB.length; i++) {
-
- var dname = '';
- if(!hostUSB[i].product) {
- dname = trans('Unknown device %1:%2','UIActionPool').replace('%1',hostUSB[i].vendorId).replace('%2',hostUSB[i].productId);
- } else {
- dname = hostUSB[i].manufacturer + ' ' + hostUSB[i].product;
- }
- dname += ' [' + hostUSB[i].revision + ']';
- var capt = (hostUSB[i].state == 'Captured' && guestUSB[hostUSB[i].id]);
- var avail = (capt || (hostUSB[i].state != 'NotSupported' && hostUSB[i].state != 'Unavailable' && hostUSB[i].state != 'Captured'));
- var cbox = $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop({'checked':(capt ? true : false),'disabled':(avail ? false : true)}).on('click',function(e){
- e.stopPropagation();
- if($(this).prop('disabled')) return;
-
- var cbox = $(this);
- // Detach
- if($(this).data('capt')) {
- $.when(vboxAjaxRequest('consoleUSBDeviceDetach',{'vm':vm.id,'id':$(this).data('usbDevice')})).done(function(d){
- if(d.success) {
- cbox.prop('checked',false);
- cbox.data('capt',false);
- } else {
- cbox.prop('checked',true);
- }
- });
- // Attach
- } else {
- $.when(vboxAjaxRequest('consoleUSBDeviceAttach',{'vm':vm.id,'id':$(this).data('usbDevice')})).done(function(d){
- if(d.success) {
- cbox.prop('checked',true);
- cbox.data('capt',true);
- } else {
- cbox.prop('checked',false);
- }
- });
- }
- }).data({'usbDevice':hostUSB[i].id,'capt':capt});
-
- $(menu).append($('<li />').append(
- $('<span />').addClass('vboxMenuAcceptClick')
- .click(function(){if(!$(this).parent().hasClass('disabled')){$(this).children('input').click();}return false;})
- .append(cbox).append(' '+dname)).attr({'class':(avail ? '' : 'disabled')}));
- }
-
- // No devices?
- if(hostUSB.length == 0) {
- $(menu).append($('<li />').html('<span>'+$('<div />').text(trans('<no devices available>','VBoxUSBMenu')).html()+'</span>'));
- }
- $(menu).trigger('menuLoaded');
- };
- l.run();
-}
-
-/*
- *
- * Update vboxSettingsMenu items. Called when
- * vboxChooser selection changes $('#vboxPane').onvmSelectionListChanged
- *
- */
-function vboxUpdateSettingsMenu(vm) {
-
- if(vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) {
- vboxChooserToolbarTop.getButtonElement("settings").enableContextMenu();
- } else {
- vboxChooserToolbarTop.getButtonElement("settings").disableContextMenu();
- return;
- }
- // enable or disable USB
- var usbEnabled = false;
- if(vm['USBControllers'].length) {
- for(var i = 0; i < vm['USBControllers'].length; i++) {
- if(vm['USBControllers'][i].type == 'OHCI') {
- usbEnabled = true;
- break;
- }
- }
- }
- if(usbEnabled) {
- $('ul.vboxSettingsUSBAttachmentsMenu').children().remove();
- $('#vboxVMSettingsMenu').find('a[href=#USB]').closest('li').css('display','');
- } else {
- $('#vboxVMSettingsMenu').find('a[href=#USB]').closest('li').css('display','none');
- }
-
- // Enable or disable network
- var enabledS = false;
- if(vm && vm.networkAdapters && vm.networkAdapters.length) {
- for(var a = 0; a < vm.networkAdapters.length; a++) {
- if(vm.networkAdapters[a].enabled) {
- enabledS = true;
- break;
- }
- }
- }
- if(enabledS) {
- $('#vboxVMSettingsMenu').find('a[href=#Network]').closest('li').css('display','');
- } else {
- $('#vboxVMSettingsMenu').find('a[href=#Network]').closest('li').css('display','none');
- }
-
- // vboxVMSettingsToolbarStorageHolder
- var smenu = $('#vboxVMSettingsToolbarStorageHolder');
- smenu.siblings('li.vboxVMSettingsStorage').remove();
- $('ul.vboxVMSettingsStorage').remove();
- var enabledS = false;
- if(vm && vm.storageControllers && vm.storageControllers.length) {
- var dvdDevices = new Array();
- var fdDevices = new Array();
-
- for(var a = 0; a < vm.storageControllers.length; a++) {
-
- // See if this bus type supports removable media
- if(jQuery.inArray('dvd',vboxStorage[vm['storageControllers'][a].bus].driveTypes) == -1 &&
- jQuery.inArray('floppy',vboxStorage[vm['storageControllers'][a].bus].driveTypes) == -1)
- continue;
-
- var icon = vboxStorage.getBusIconName(vm['storageControllers'][a].bus);
-
- for(var b = 0; b < vm['storageControllers'][a]['mediumAttachments'].length; b++) {
-
- if(vm['storageControllers'][a]['mediumAttachments'][b].type == 'HardDisk') continue;
-
- vm['storageControllers'][a]['mediumAttachments'][b]['controller'] = vm['storageControllers'][a]['name'];
-
- var portName = vboxStorage[vm['storageControllers'][a].bus].slotName(vm['storageControllers'][a]['mediumAttachments'][b].port, vm['storageControllers'][a]['mediumAttachments'][b].device);
- var m = vm['storageControllers'][a]['mediumAttachments'][b].medium;
- m = vboxMedia.getMediumById((m && m.id ? m.id : null));
-
- var mName = vboxMedia.getName(m);
- mName = $('<div />').text(mName).html();
-
-
- var smid = vm.id+'-vboxVMSettingsStorage-'+a+'-'+b;
- $('#'+vm.id+'-vboxVMSettingsStorage-'+a+'-'+b).remove();
-
- var li = $('<li />').attr({'title':mName}).html("<a title='"+mName+"' href='#mount-"+vm['storageControllers'][a].bus+"-"+vm['storageControllers'][a]['mediumAttachments'][b].port+"-"+vm['storageControllers'][a]['mediumAttachments'][b].device+"' style='background-image:url(images/vbox/"+icon+"_16px.png);'>"+vm['storageControllers'][a]['name'] + ' ('+portName + ")</a>").addClass('vboxVMSettingsStorage');
- $(li).append($('<ul />').attr({'id':smid,'style':'display:none'}).data({'callback':'vboxChooserToolbarStorageUpdate','storage':vm['storageControllers'][a]['mediumAttachments'][b]}));
- if(vm['storageControllers'][a]['mediumAttachments'][b].type == 'DVD') {
- dvdDevices[dvdDevices.length] = li;
- } else {
- fdDevices[fdDevices.length] = li;
- }
- enabledS = true;
- }
- }
- if(dvdDevices.length) {
- var ul = null;
- var li = $('<li />').html("<a href='#dvdDevices' style='background-image:url(images/vbox/cd_16px.png);'>"+trans('Optical Drives','UIActionPool')+'</a>').addClass('vboxVMSettingsStorage');
- if(dvdDevices.length == 1) {
- ul = dvdDevices[0].children('ul').first();
- } else {
- ul = $('<ul />').attr({'style':'display:none'}).addClass('vboxVMSettingsStorage');
- for(var i = 0; i < dvdDevices.length; i++) {
- $(ul).append(dvdDevices[i]);
- }
- }
- $(li).append(ul).insertBefore(smenu);
- }
-
- if(fdDevices.length) {
- var ul = null;
- var li = $('<li />').html("<a href='#fdDevices' style='background-image:url(images/vbox/fd_16px.png);'>"+trans('Floppy Devices','UIActionPool')+'</a>').addClass('vboxVMSettingsStorage');
- if(fdDevices.length == 1) {
- ul = fdDevices[0].children('ul').first();
- } else {
- ul = $('<ul />').attr({'style':'display:none'}).addClass('vboxVMSettingsStorage');
- for(var i = 0; i < fdDevices.length; i++) {
- $(ul).append(fdDevices[i]);
- }
- }
- $(li).append(ul).insertBefore(smenu);
- }
-
- }
- if(enabledS) {
- $('#vboxVMSettingsMenu').find('a[href=#Network]').parent().addClass('separator');
- } else {
- $('#vboxVMSettingsMenu').find('a[href=#Network]').parent().removeClass('separator');
- }
-
- // Enable remote display?
- if(vm && vm.VRDEServer) {
- $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp' + (vm.VRDEServer.enabled ? '_on' : '') + '_16px.png)'}).parent().removeClass('disabled')
- .addClass((vm.VRDEServer.enabled ? 'vboxMenuItemChecked' : '')).removeClass((vm.VRDEServer.enabled ? '' : 'vboxMenuItemChecked'));
- } else {
- $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_disabled_16px.png)'}).parent().addClass('disabled');
- }
-
-
-}
-
-
-/*
- Bind events...
- */
-
-// Selection list changed
-$('#vboxPane').on('vmSelectionListChanged',function(e) {
-
- vboxChooserToolbarTop.update(vboxChooser);
- vboxUpdateSettingsMenu();
-
- // Check for a single selected VM and
- // update settings menu based on its runtime data
- if(vboxChooser.selectedVMs.length == 1 && (vboxChooser.isSelectedInState('Running') || vboxChooser.isSelectedInState('Paused'))) {
-
- // Get data
- $.when(vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[0]))
- .done(function(d) {
-
- vboxUpdateSettingsMenu(d);
-
- });
-
- }
-
-// Update menus on these events
-}).on('vboxEvents', function(e, eventList) {
-
- var updateToolbar = false;
- var updateSettingsMenu = false;
- var updateVRDE = false;
-
- for(var i = 0; i < eventList.length && !(updateToolbar && updateSettingsMenu); i++) {
-
- switch(eventList[i].eventType) {
-
- // Machine or session state change
- case 'OnMachineStateChanged':
- case 'OnSessionStateChanged':
- if(vboxChooser.isVMSelected(eventList[i].machineId)) {
- updateToolbar = true;
- }
- if(vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
- updateSettingsMenu = true;
- }
- break;
-
- // Machine or medium data change
- case 'OnMachineDataChanged':
- case 'OnMediumChanged':
- if(vboxChooser.isVMSelected(eventList[i].machineId)) {
- updateToolbar = true;
- updateSettingsMenu = true;
- }
- break;
-
- // VRDE Server
- case 'OnVRDEServerChanged':
- case 'OnVRDEServerInfoChanged':
- if(!updateSettingsMenu && !updateVRDE && vboxChooser.isVMSelected(eventList[i].machineId)) {
- if(eventList[i].enrichmentData && eventList[i].enrichmentData.enabled) {
- updateVRDE = function(){
- $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_on_16px.png)'}).parent().removeClass('disabled')
- .addClass('vboxMenuItemChecked');
- };
- } else {
- updateVRDE = function(){
- $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_16px.png)'}).parent().removeClass('disabled')
- .removeClass('vboxMenuItemChecked');
-
- };
- }
- }
- break;
-
-
- } // </ switch event type >
-
- } // </ for each event >
-
- // Toolbar
- if(updateToolbar) {
- vboxChooserToolbarTop.update(vboxChooser);
- }
-
- // Entire settings menu or just VRDE
- if(updateSettingsMenu) {
-
- // Check for a single selected VM and
- // update settings menu based on its runtime data
- if(vboxChooser.selectedVMs.length == 1 && (vboxChooser.isSelectedInState('Running') || vboxChooser.isSelectedInState('Paused'))) {
-
- // Get data
- $.when(vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[0]))
- .done(function(d) {
- vboxUpdateSettingsMenu(d);
- });
-
- } else {
- vboxUpdateSettingsMenu();
- }
-
- } else if(updateVRDE) {
-
- updateVRDE();
-
- }
-
-});
-
-$('#vboxVMSettingsMenu').disableContextMenu();
-
-
-</script>
+<!--
+
+ Top (main) phpVirtualBox tool bar
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: toolbar.html 599 2015-07-27 10:40:37Z imoore76 $
+
+-->
+<script type='text/javascript'>
+
+/*
+ * JS objects for actions that can be performed on a VM
+ * from this toolbar
+ */
+var tButtons = [
+
+ vboxVMActions['new'],
+ $.extend({},vboxVMActions['settings'],{click: function(){
+ var vm = vboxChooser.getSingleSelected();
+ if(!vm || vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) return;
+ vboxVMActions['settings'].click();
+
+ }}),
+ vboxVMActions['start'],
+ {
+ name: 'stop',
+ icon: 'vm_poweroff',
+ label: 'Stop',
+ language_context: 'VBoxSelectorWnd',
+ enabled: vboxVMActions['stop'].enabled,
+ click : function() {return;}
+ }
+];
+
+/* Append Top Toolbar */
+var vboxChooserToolbarTop = new vboxToolbar({buttons: tButtons, size: 32,
+ language_context: 'UIActionPool', renderTo: 'vboxPaneToolbar'});
+
+/* Stop button menu and actions */
+var stopMenuItems = [
+ vboxVMActions['pause'],
+ vboxVMActions['reset'],
+];
+for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
+ var n = $.extend({}, vboxVMActions[vboxVMActions.stop_actions[i]]);
+ if(i==0) n.separator = true;
+ stopMenuItems[stopMenuItems.length] = n;
+}
+stopMenu = new vboxMenu({name: 'stopContextMenu', menuItems: stopMenuItems, language_context: 'UIActionPool'});
+
+vboxChooserToolbarTop.getButtonElement('stop').contextMenu({
+ menu: stopMenu.menuId(),
+ button: 0,
+ mode: 'menu'
+ },function(a, el, pos) {
+ for(var i in vboxVMActions) {
+ if(typeof i == 'string' && vboxVMActions[i].name == a) {
+ vboxVMActions[i].click();
+ return;
+ }
+ }
+ }
+);
+
+/* 'Settings' menu items / actions */
+var vboxChooserSettingsMenu = {
+
+ 'settings' : {
+ 'label' : vboxVMActions['settings'].label,
+ 'icon' : vboxVMActions['settings'].icon
+ },
+ 'storage' : {
+ 'icon' : 'hd'
+ },
+ 'USB' : {
+ 'label' : 'USB',
+ 'icon' : 'usb'
+ },
+ 'Network' : {
+ 'label' : 'Network',
+ 'icon' : 'nw'
+ },
+ 'SharedFolders' : {
+ 'label' : 'Shared Folders',
+ 'icon' : 'sf'
+ },
+ 'RemoteDisplay' : {
+ 'label' : 'Remote Display',
+ 'icon' : 'vrdp',
+ 'separator' : true
+ },
+ 'GuestAdditions' : {
+ 'label' : vboxVMActions['guestAdditionsInstall'].label,
+ 'icon' : vboxVMActions['guestAdditionsInstall'].icon,
+ 'separator' : true
+ }
+
+};
+
+
+/* 'Settings' menu */
+var ul = $('<ul />').attr({'class':'contextMenu','style':'display: none','id':'vboxVMSettingsMenu'});
+
+for(var i in vboxChooserSettingsMenu) {
+
+ // add name
+ vboxChooserSettingsMenu[i].name = i;
+ var label = trans(vboxChooserSettingsMenu[i].label, 'UIActionPool');
+ var li = $('<li />').html("<span class='vboxMenuItemChecked' /><a href='#" + vboxChooserSettingsMenu[i].name + "' style='background-image: url(images/vbox/" + vboxChooserSettingsMenu[i].icon +"_16px.png);' >"+(label ? label : ' ')+"</a>");
+ if(i == 'storage') { $(li).attr({'style':'display:none','id':'vboxVMSettingsToolbarStorageHolder'}); }
+ if(i == 'USB') {
+ /* 'USB' menu */
+ $('<ul />').attr({'class':'vboxSettingsUSBAttachmentsMenu contextMenuNoBG','style':'display: none','id':'vboxVMSettingsUSBMenu'}).data({'callback':'vboxChooserToolbarUSBUpdate'}).appendTo(li);
+ }
+ if(vboxChooserSettingsMenu[i].separator) $(li).addClass('separator');
+ $(ul).append(li);
+
+}
+
+/* Append 'Settings' button Menu */
+$('#vboxPane').append(ul);
+
+
+
+/* 'Settings' button menu initialization */
+vboxChooserToolbarTop.getButtonElement('settings').contextMenu({
+ menu: 'vboxVMSettingsMenu',
+ button: 0,
+ mode: 'menu'
+ },
+ function(a, el, pos, srcEl) {
+
+ var vm = vboxChooser.getSingleSelected();
+
+ if(!vm) return;
+
+ switch(a) {
+
+ case 'Network':
+ case 'SharedFolders':
+ vboxVMsettingsDialog(vm, a);
+ break;
+
+ case 'GuestAdditions':
+
+ vboxVMActions['guestAdditionsInstall'].click();
+ break;
+
+ // Don't do anything for dvd, fd, or USB devices main menu item click
+ case 'dvdDevices':
+ case 'fdDevices':
+ case 'USB':
+ break;
+
+ case 'RemoteDisplay':
+ var en = vboxVMDataMediator.getVMRuntimeData(vm.id).VRDEServer.enabled;
+ vboxAjaxRequest('consoleVRDEServerSave',{'vm':vm.id,'enabled':(en ? 0 : 1)});
+ break;
+
+ case 'settings':
+ vboxVMActions['settings'].click();
+ break;
+
+ default:
+
+ // Assume it was a storage action
+ if(vboxToolbarMediaLast) {
+ if(vboxToolbarMediaLast.type == 'DVD') {
+ vboxToolbarMediaMenuDVD.menuCallback(a,el,pos);
+ } else {
+ vboxToolbarMediaMenuFD.menuCallback(a,el,pos);
+ }
+ }
+
+ } // </ switch / case >
+
+ }
+);
+
+/*
+ * Storage mount menu
+ */
+var vboxToolbarMediaLast = null; // Used when context menu item is clicked to determine
+ // which medium attachment to act upon.
+function vboxChooserToolbarMediumMount(medium) {
+
+ var vmid = vboxChooser.getSingleSelectedId();
+
+ var args = {'vm':vmid,'medium':medium,'port':vboxToolbarMediaLast.port,'device':vboxToolbarMediaLast.device,'bus':vboxToolbarMediaLast.bus,'controller':vboxToolbarMediaLast.controller};
+
+ // Ajax request to mount medium
+ var mount = new vboxLoader('mediumMount');
+ mount.add('mediumMount',function(d){
+ var l = new vboxLoader('getMedia');
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.run();
+ },args);
+ mount.run();
+}
+var vboxToolbarMediaMenuDVD = new vboxMediaMenu('DVD',vboxChooserToolbarMediumMount,'');
+var vboxToolbarMediaMenuFD = new vboxMediaMenu('Floppy',vboxChooserToolbarMediumMount,'');
+
+function vboxChooserToolbarStorageUpdate(menu) {
+
+ vboxToolbarMediaLast = $(menu).data('storage');
+ var medium = null;
+ if(vboxToolbarMediaLast && vboxToolbarMediaLast.medium && vboxToolbarMediaLast.medium.id)
+ medium = vboxMedia.getMediumById(vboxToolbarMediaLast.medium.id);
+
+ if(vboxToolbarMediaLast.type == 'DVD') {
+ vboxToolbarMediaMenuDVD.menuUpdateMedia(medium);
+ return vboxToolbarMediaMenuDVD.menuElement();
+ }
+
+ vboxToolbarMediaMenuFD.menuUpdateMedia(medium);
+ return vboxToolbarMediaMenuFD.menuElement();
+}
+
+// Update host drives and recent media on host change.
+// Just recreate the menus
+$('#vboxPane').on('hostChanged',function(){
+ vboxToolbarMediaMenuDVD = new vboxMediaMenu('DVD',vboxChooserToolbarMediumMount,'');
+ vboxToolbarMediaMenuFD = new vboxMediaMenu('Floppy',vboxChooserToolbarMediumMount,'');
+});
+/*
+ * Update USB device list
+ */
+function vboxChooserToolbarUSBUpdate(menu) {
+
+ $(menu).append($('<li />').html('<span><img src="images/jqueryFileTree/spinner.gif" /></span>').css({'width':'100px','text-align':'center'}));
+
+ var vm = vboxChooser.getSingleSelected();
+
+ var l = new vboxLoader();
+
+ l.add('hostGetUSBDevices',function(d){
+ $('#vboxPaneToolbar').data('hostUSB',d.responseData);
+ },{});
+
+ l.add('consoleGetUSBDevices',function(d){
+ $('#vboxPaneToolbar').data('guestUSB',d.responseData);
+ },{'vm':vm.id});
+
+ l.noLoadingScreen = true;
+ l.onLoad = function() {
+
+ var hostUSB = $('#vboxPaneToolbar').data('hostUSB');
+ var guestUSB = $('#vboxPaneToolbar').data('guestUSB');
+ $(menu).children().remove();
+
+ for(var i = 0; i < hostUSB.length; i++) {
+
+ var dname = '';
+ if(!hostUSB[i].product) {
+ dname = trans('Unknown device %1:%2','UIActionPool').replace('%1',hostUSB[i].vendorId).replace('%2',hostUSB[i].productId);
+ } else {
+ dname = hostUSB[i].manufacturer + ' ' + hostUSB[i].product;
+ }
+ dname += ' [' + hostUSB[i].revision + ']';
+ var capt = (hostUSB[i].state == 'Captured' && guestUSB[hostUSB[i].id]);
+ var avail = (capt || (hostUSB[i].state != 'NotSupported' && hostUSB[i].state != 'Unavailable' && hostUSB[i].state != 'Captured'));
+ var cbox = $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop({'checked':(capt ? true : false),'disabled':(avail ? false : true)}).on('click',function(e){
+ e.stopPropagation();
+ if($(this).prop('disabled')) return;
+
+ var cbox = $(this);
+ // Detach
+ if($(this).data('capt')) {
+ $.when(vboxAjaxRequest('consoleUSBDeviceDetach',{'vm':vm.id,'id':$(this).data('usbDevice')})).done(function(d){
+ if(d.success) {
+ cbox.prop('checked',false);
+ cbox.data('capt',false);
+ } else {
+ cbox.prop('checked',true);
+ }
+ });
+ // Attach
+ } else {
+ $.when(vboxAjaxRequest('consoleUSBDeviceAttach',{'vm':vm.id,'id':$(this).data('usbDevice')})).done(function(d){
+ if(d.success) {
+ cbox.prop('checked',true);
+ cbox.data('capt',true);
+ } else {
+ cbox.prop('checked',false);
+ }
+ });
+ }
+ }).data({'usbDevice':hostUSB[i].id,'capt':capt});
+
+ $(menu).append($('<li />').append(
+ $('<span />').addClass('vboxMenuAcceptClick')
+ .click(function(){if(!$(this).parent().hasClass('disabled')){$(this).children('input').click();}return false;})
+ .append(cbox).append(' '+dname)).attr({'class':(avail ? '' : 'disabled')}));
+ }
+
+ // No devices?
+ if(hostUSB.length == 0) {
+ $(menu).append($('<li />').html('<span>'+$('<div />').text(trans('<no devices available>','VBoxUSBMenu')).html()+'</span>'));
+ }
+ $(menu).trigger('menuLoaded');
+ };
+ l.run();
+}
+
+/*
+ *
+ * Update vboxSettingsMenu items. Called when
+ * vboxChooser selection changes $('#vboxPane').onvmSelectionListChanged
+ *
+ */
+function vboxUpdateSettingsMenu(vm) {
+
+ if(vboxVMStates.isRunning(vm) || vboxVMStates.isPaused(vm)) {
+ vboxChooserToolbarTop.getButtonElement("settings").enableContextMenu();
+ } else {
+ vboxChooserToolbarTop.getButtonElement("settings").disableContextMenu();
+ return;
+ }
+ // enable or disable USB
+ var usbEnabled = false;
+ if(vm['USBControllers'].length) {
+ for(var i = 0; i < vm['USBControllers'].length; i++) {
+ if(vm['USBControllers'][i].type == 'OHCI') {
+ usbEnabled = true;
+ break;
+ }
+ }
+ }
+ if(usbEnabled) {
+ $('ul.vboxSettingsUSBAttachmentsMenu').children().remove();
+ $('#vboxVMSettingsMenu').find('a[href=#USB]').closest('li').css('display','');
+ } else {
+ $('#vboxVMSettingsMenu').find('a[href=#USB]').closest('li').css('display','none');
+ }
+
+ // Enable or disable network
+ var enabledS = false;
+ if(vm && vm.networkAdapters && vm.networkAdapters.length) {
+ for(var a = 0; a < vm.networkAdapters.length; a++) {
+ if(vm.networkAdapters[a].enabled) {
+ enabledS = true;
+ break;
+ }
+ }
+ }
+ if(enabledS) {
+ $('#vboxVMSettingsMenu').find('a[href=#Network]').closest('li').css('display','');
+ } else {
+ $('#vboxVMSettingsMenu').find('a[href=#Network]').closest('li').css('display','none');
+ }
+
+ // vboxVMSettingsToolbarStorageHolder
+ var smenu = $('#vboxVMSettingsToolbarStorageHolder');
+ smenu.siblings('li.vboxVMSettingsStorage').remove();
+ $('ul.vboxVMSettingsStorage').remove();
+ var enabledS = false;
+ if(vm && vm.storageControllers && vm.storageControllers.length) {
+ var dvdDevices = new Array();
+ var fdDevices = new Array();
+
+ for(var a = 0; a < vm.storageControllers.length; a++) {
+
+ // See if this bus type supports removable media
+ if(jQuery.inArray('dvd',vboxStorage[vm['storageControllers'][a].bus].driveTypes) == -1 &&
+ jQuery.inArray('floppy',vboxStorage[vm['storageControllers'][a].bus].driveTypes) == -1)
+ continue;
+
+ var icon = vboxStorage.getBusIconName(vm['storageControllers'][a].bus);
+
+ for(var b = 0; b < vm['storageControllers'][a]['mediumAttachments'].length; b++) {
+
+ if(vm['storageControllers'][a]['mediumAttachments'][b].type == 'HardDisk') continue;
+
+ vm['storageControllers'][a]['mediumAttachments'][b]['controller'] = vm['storageControllers'][a]['name'];
+
+ var portName = vboxStorage[vm['storageControllers'][a].bus].slotName(vm['storageControllers'][a]['mediumAttachments'][b].port, vm['storageControllers'][a]['mediumAttachments'][b].device);
+ var m = vm['storageControllers'][a]['mediumAttachments'][b].medium;
+ m = vboxMedia.getMediumById((m && m.id ? m.id : null));
+
+ var mName = vboxMedia.getName(m);
+ mName = $('<div />').text(mName).html();
+
+
+ var smid = vm.id+'-vboxVMSettingsStorage-'+a+'-'+b;
+ $('#'+vm.id+'-vboxVMSettingsStorage-'+a+'-'+b).remove();
+
+ var li = $('<li />').attr({'title':mName}).html("<a title='"+mName+"' href='#mount-"+vm['storageControllers'][a].bus+"-"+vm['storageControllers'][a]['mediumAttachments'][b].port+"-"+vm['storageControllers'][a]['mediumAttachments'][b].device+"' style='background-image:url(images/vbox/"+icon+"_16px.png);'>"+vm['storageControllers'][a]['name'] + ' ('+portName + ")</a>").addClass('vboxVMSettingsStorage');
+ $(li).append($('<ul />').attr({'id':smid,'style':'display:none'}).data({'callback':'vboxChooserToolbarStorageUpdate','storage':vm['storageControllers'][a]['mediumAttachments'][b]}));
+ if(vm['storageControllers'][a]['mediumAttachments'][b].type == 'DVD') {
+ dvdDevices[dvdDevices.length] = li;
+ } else {
+ fdDevices[fdDevices.length] = li;
+ }
+ enabledS = true;
+ }
+ }
+ if(dvdDevices.length) {
+ var ul = null;
+ var li = $('<li />').html("<a href='#dvdDevices' style='background-image:url(images/vbox/cd_16px.png);'>"+trans('Optical Drives','UIActionPool')+'</a>').addClass('vboxVMSettingsStorage');
+ if(dvdDevices.length == 1) {
+ ul = dvdDevices[0].children('ul').first();
+ } else {
+ ul = $('<ul />').attr({'style':'display:none'}).addClass('vboxVMSettingsStorage');
+ for(var i = 0; i < dvdDevices.length; i++) {
+ $(ul).append(dvdDevices[i]);
+ }
+ }
+ $(li).append(ul).insertBefore(smenu);
+ }
+
+ if(fdDevices.length) {
+ var ul = null;
+ var li = $('<li />').html("<a href='#fdDevices' style='background-image:url(images/vbox/fd_16px.png);'>"+trans('Floppy Devices','UIActionPool')+'</a>').addClass('vboxVMSettingsStorage');
+ if(fdDevices.length == 1) {
+ ul = fdDevices[0].children('ul').first();
+ } else {
+ ul = $('<ul />').attr({'style':'display:none'}).addClass('vboxVMSettingsStorage');
+ for(var i = 0; i < fdDevices.length; i++) {
+ $(ul).append(fdDevices[i]);
+ }
+ }
+ $(li).append(ul).insertBefore(smenu);
+ }
+
+ }
+ if(enabledS) {
+ $('#vboxVMSettingsMenu').find('a[href=#Network]').parent().addClass('separator');
+ } else {
+ $('#vboxVMSettingsMenu').find('a[href=#Network]').parent().removeClass('separator');
+ }
+
+ // Enable remote display?
+ if(vm && vm.VRDEServer) {
+ $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp' + (vm.VRDEServer.enabled ? '_on' : '') + '_16px.png)'}).parent().removeClass('disabled')
+ .addClass((vm.VRDEServer.enabled ? 'vboxMenuItemChecked' : '')).removeClass((vm.VRDEServer.enabled ? '' : 'vboxMenuItemChecked'));
+ } else {
+ $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_disabled_16px.png)'}).parent().addClass('disabled');
+ }
+
+
+}
+
+
+/*
+ Bind events...
+ */
+
+// Selection list changed
+$('#vboxPane').on('vmSelectionListChanged',function(e) {
+
+ vboxChooserToolbarTop.update(vboxChooser);
+ vboxUpdateSettingsMenu();
+
+ // Check for a single selected VM and
+ // update settings menu based on its runtime data
+ if(vboxChooser.selectedVMs.length == 1 && (vboxChooser.isSelectedInState('Running') || vboxChooser.isSelectedInState('Paused'))) {
+
+ // Get data
+ $.when(vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[0]))
+ .done(function(d) {
+
+ vboxUpdateSettingsMenu(d);
+
+ });
+
+ }
+
+// Update menus on these events
+}).on('vboxEvents', function(e, eventList) {
+
+ var updateToolbar = false;
+ var updateSettingsMenu = false;
+ var updateVRDE = false;
+
+ for(var i = 0; i < eventList.length && !(updateToolbar && updateSettingsMenu); i++) {
+
+ switch(eventList[i].eventType) {
+
+ // Machine or session state change
+ case 'OnMachineStateChanged':
+ case 'OnSessionStateChanged':
+ if(vboxChooser.isVMSelected(eventList[i].machineId)) {
+ updateToolbar = true;
+ }
+ if(vboxChooser.getSingleSelectedId() == eventList[i].machineId) {
+ updateSettingsMenu = true;
+ }
+ break;
+
+ // Machine or medium data change
+ case 'OnMachineDataChanged':
+ case 'OnMediumChanged':
+ if(vboxChooser.isVMSelected(eventList[i].machineId)) {
+ updateToolbar = true;
+ updateSettingsMenu = true;
+ }
+ break;
+
+ // VRDE Server
+ case 'OnVRDEServerChanged':
+ case 'OnVRDEServerInfoChanged':
+ if(!updateSettingsMenu && !updateVRDE && vboxChooser.isVMSelected(eventList[i].machineId)) {
+ if(eventList[i].enrichmentData && eventList[i].enrichmentData.enabled) {
+ updateVRDE = function(){
+ $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_on_16px.png)'}).parent().removeClass('disabled')
+ .addClass('vboxMenuItemChecked');
+ };
+ } else {
+ updateVRDE = function(){
+ $('#vboxVMSettingsMenu').find('a[href=#RemoteDisplay]').css({'background-image':'url(images/vbox/vrdp_16px.png)'}).parent().removeClass('disabled')
+ .removeClass('vboxMenuItemChecked');
+
+ };
+ }
+ }
+ break;
+
+
+ } // </ switch event type >
+
+ } // </ for each event >
+
+ // Toolbar
+ if(updateToolbar) {
+ vboxChooserToolbarTop.update(vboxChooser);
+ }
+
+ // Entire settings menu or just VRDE
+ if(updateSettingsMenu) {
+
+ // Check for a single selected VM and
+ // update settings menu based on its runtime data
+ if(vboxChooser.selectedVMs.length == 1 && (vboxChooser.isSelectedInState('Running') || vboxChooser.isSelectedInState('Paused'))) {
+
+ // Get data
+ $.when(vboxVMDataMediator.getVMDataCombined(vboxChooser.selectedVMs[0]))
+ .done(function(d) {
+ vboxUpdateSettingsMenu(d);
+ });
+
+ } else {
+ vboxUpdateSettingsMenu();
+ }
+
+ } else if(updateVRDE) {
+
+ updateVRDE();
+
+ }
+
+});
+
+$('#vboxVMSettingsMenu').disableContextMenu();
+
+
+</script>
diff --git a/panes/topmenu.html b/panes/topmenu.html
index 7042455..98563ce 100644
--- a/panes/topmenu.html
+++ b/panes/topmenu.html
@@ -1,287 +1,287 @@
-<!--
-
- Main / Top menu
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: topmenu.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<span></span>
-<script type='text/javascript'>
-/*
- *
- * Main menu at top of interface
- *
- *
- */
-
-// Top menu
-var vboxTopMenuBar = new vboxMenuBar({name: 'vboxTop', language_context: 'UIActionPool'});
-
-var menu = {
- 'name':'vboxTopFile',
- 'label': 'File',
- 'menu':[
- {
- 'name':'fileVMM',
- 'label':'Virtual Media Manager...',
- 'icon':'diskimage',
- 'click':function(){vboxVMMDialog();}
- },
- {
- 'name':'fileImport',
- 'label':'Import Appliance...',
- 'icon':'import',
- 'click':function(){
-
- new vboxWizardImportApplianceDialog().run();
- },
- 'separator': true
- },
- {
- 'name':'fileExport',
- 'label':'Export Appliance...',
- 'icon':'export',
- 'click':function(){new vboxWizardExportApplianceDialog().run();}
- },
- {
- 'name':'filePrefs',
- 'label':'Preferences...',
- 'icon':'global_settings',
- 'click':function(){vboxGlobalPrefsDialog();},
- 'separator':true
- }
- ]
-};
-
-if($('#vboxPane').data('vboxSession').user) {
- if ( $('#vboxPane').data('vboxConfig').authCapabilities.canChangePassword )
- menu['menu'][menu['menu'].length] = {
- 'name' : 'fileChangePW',
- 'label' : 'Change Password',
- 'language_context': 'UIUsers',
- 'icon' : 'register',
- 'click': function() {
- var l = new vboxLoader();
- l.addFileToDOM('panes/userEdit.html');
- l.onLoad = function(){
-
- // Set mode
- $('#vboxUserEdit').trigger('setMode','changePassword');
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
- var o = $('#vboxUserEdit').find('input[name=opass]').first().val();
- var n1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
- var n2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
- if(o.length == 0) {
- vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
- return;
- }
- if(n1.length == 0 || (n1 != n2)) {
- vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
- return;
- }
- var dialog = this;
- var chp = new vboxLoader();
- chp.add('changePassword',function(d){
- if(d) {
- if(d.success) {
- vboxAlert(trans('Password changed.','UIUsers'),{'width':'auto'});
- $(dialog).remove();
- } else {
- vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
- }
- } else {
- // unknown error
- $(dialog).remove();
- }
- },{'old':o,'new':n1});
- chp.run();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).remove();
- };
- $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':400,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Change Password','UIUsers')});
- };
- l.run();
- },
- 'separator':true
- };
-
- if ( $('#vboxPane').data('vboxConfig').authCapabilities.canLogout )
- {
- menu['menu'][menu['menu'].length] = {
- 'name' : 'fileLogout',
- // Pre-translated title to append username
- 'label' : trans('Log out - %1','VBoxSelectorWnd').replace('%1',$('#vboxPane').data('vboxSession').user),
- 'icon' : 'exit',
- 'click': function() {
-
- // Show loading screen
- var lm = new vboxLoader();
- lm.showLoading();
-
- // Expire data mediator data
- vboxVMDataMediator.expireAll();
-
- // Unsubscribe from events
- $.when(vboxEventListener.stop()).done(function() {
-
- // remove loading screen
- lm.removeLoading();
-
- var l = new vboxLoader();
- l.noLoadingScreen = true;
- l.add('logout',function(r){
- if ( typeof(r.responseData.url) == 'string' )
- {
- window.location = r.responseData.url;
- }
- else
- {
- location.reload(true);
- }
- });
- l.onLoad = function(loader){
- loader.hideRoot = false;
- };
- l.hideRoot = true;
- l.run();
- });
- }
- };
- }
- else
- {
- menu['menu'][menu['menu'].length] = {
- 'name' : 'fileLogout',
- 'label' : trans('Logged in as %1','VBoxSelectorWnd').replace('%1',$('#vboxPane').data('vboxSession').user),
- 'icon' : 'exit',
- 'click': function() {
- return false;
- }
- };
- }
-
-}
-
-vboxTopMenuBar.addMenu(menu);
-
-//VM List Context menu for each VM
-var sChildren = [];
-for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
- sChildren[sChildren.length] = vboxVMActions[vboxVMActions.stop_actions[i]];
-}
-
-
-vboxTopMenuBar.addMenu({
- 'name': 'vboxTopMachine',
- 'label': 'Machine',
- 'enabled' : function(chooser) {
- return (!chooser || (chooser.selectionMode != vboxSelectionModeSingleGroup));
- },
- 'menu':[
- vboxVMActions['new'],
- vboxVMActions['add'],
- vboxVMActions['settings'],
- vboxVMActions['clone'],
- vboxVMActions['remove'],
- vboxVMActions['group'],
- $.extend({},vboxVMActions['start'],{'separator':true}),
- vboxVMActions['pause'],
- vboxVMActions['reset'],
- $.extend({},vboxVMActions['stop'],{'children':sChildren}),
- $.extend({},vboxVMActions['discard'],{'separator':true}),
- vboxVMActions['logs'],
- vboxVMActions['refresh'],
- ]
-});
-
-
-vboxTopMenuBar.addMenu({
- 'name':'vboxTopGroup',
- 'label':'Group',
- 'enabled' : function(chooser) {
- return (chooser && (chooser.selectionMode == vboxSelectionModeSingleGroup));
- },
- 'menu':[
- vboxVMGroupActions['newmachine'],
- vboxVMGroupActions['addmachine'],
- $.extend({}, vboxVMGroupActions['rename'], {separator:true}),
- vboxVMGroupActions['ungroup'],
- $.extend({},vboxVMActions['start'],{'name':'start','separator' : true}),
- vboxVMActions['pause'],
- vboxVMActions['reset'],
- $.extend({},vboxVMActions['stop'],{'children':sChildren}),
- $.extend({},vboxVMActions['discard'],{'separator' : true}),
- vboxVMActions['refresh'],
- $.extend({}, vboxVMGroupActions['sort'], {separator:true})
- ]
-});
-
-vboxTopMenuBar.addMenu({
- 'name':'vboxTopHelp',
- 'label': 'Help',
- 'language_context': 'UIHelpButton',
- 'menu':[
- {
- 'name':'helpvbox',
- 'label':'VirtualBox User Manual',
- 'icon':'site',
- 'click':function(){
- window.open('http://www.virtualbox.org/manual/','manual');
- }
- },
-
- {
- 'name':'helpAbout',
- 'label':'About',
- 'icon':'help',
- 'click':function(){
-
- $('#vboxPane').append($('<div />').attr({'id':'vboxAbout','class':'vboxDialogContent','style':'display: none; width: 500px;'}));
-
- var l = new vboxLoader();
- l.addFileToDOM('panes/about.html',$('#vboxAbout'));
- l.onLoad = function() {
- var buttons = {};
- buttons[trans('Close','UIVMLogViewer')] = function() { $(this).empty().remove(); };
-
- $('#vboxAbout').dialog({'closeOnEscape':false,'width':500,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/help_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
- };
- l.run();
- }
- }
-
- ]
-});
-
-vboxTopMenuBar.renderTo('vboxMenu');
-
-$('#vboxPane').on('vmSelectionListChanged vmGroupDefsSaving vmGroupDefsSaved',function(e){
- vboxTopMenuBar.update(vboxChooser);
-
-}).on('vboxEvents', function(e, eventList) {
-
- var updateMenuBar = false;
- for(var i = 0; i < eventList.length && !updateMenuBar; i++) {
-
- switch(eventList[i].eventType) {
- case 'OnMachineStateChanged':
- case 'OnSessionStateChanged':
- if(vboxChooser.isVMSelected(eventList[i].machineId)) {
- updateMenuBar = true;
- }
- break;
- }
- }
-
- if(updateMenuBar) {
- vboxTopMenuBar.update(vboxChooser);
- }
-
-});
-
-
+<!--
+
+ Main / Top menu
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: topmenu.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<span></span>
+<script type='text/javascript'>
+/*
+ *
+ * Main menu at top of interface
+ *
+ *
+ */
+
+// Top menu
+var vboxTopMenuBar = new vboxMenuBar({name: 'vboxTop', language_context: 'UIActionPool'});
+
+var menu = {
+ 'name':'vboxTopFile',
+ 'label': 'File',
+ 'menu':[
+ {
+ 'name':'fileVMM',
+ 'label':'Virtual Media Manager...',
+ 'icon':'diskimage',
+ 'click':function(){vboxVMMDialog();}
+ },
+ {
+ 'name':'fileImport',
+ 'label':'Import Appliance...',
+ 'icon':'import',
+ 'click':function(){
+
+ new vboxWizardImportApplianceDialog().run();
+ },
+ 'separator': true
+ },
+ {
+ 'name':'fileExport',
+ 'label':'Export Appliance...',
+ 'icon':'export',
+ 'click':function(){new vboxWizardExportApplianceDialog().run();}
+ },
+ {
+ 'name':'filePrefs',
+ 'label':'Preferences...',
+ 'icon':'global_settings',
+ 'click':function(){vboxGlobalPrefsDialog();},
+ 'separator':true
+ }
+ ]
+};
+
+if($('#vboxPane').data('vboxSession').user) {
+ if ( $('#vboxPane').data('vboxConfig').authCapabilities.canChangePassword )
+ menu['menu'][menu['menu'].length] = {
+ 'name' : 'fileChangePW',
+ 'label' : 'Change Password',
+ 'language_context': 'UIUsers',
+ 'icon' : 'register',
+ 'click': function() {
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/userEdit.html');
+ l.onLoad = function(){
+
+ // Set mode
+ $('#vboxUserEdit').trigger('setMode','changePassword');
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+ var o = $('#vboxUserEdit').find('input[name=opass]').first().val();
+ var n1 = $('#vboxUserEdit').find('input[name=npass1]').first().val();
+ var n2 = $('#vboxUserEdit').find('input[name=npass2]').first().val();
+ if(o.length == 0) {
+ vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ if(n1.length == 0 || (n1 != n2)) {
+ vboxAlert(trans('The passwords you have entered do not match.','UIUsers'),{'width':'auto'});
+ return;
+ }
+ var dialog = this;
+ var chp = new vboxLoader();
+ chp.add('changePassword',function(d){
+ if(d) {
+ if(d.success) {
+ vboxAlert(trans('Password changed.','UIUsers'),{'width':'auto'});
+ $(dialog).remove();
+ } else {
+ vboxAlert(trans('The password you have entered is invalid.','UIUsers'),{'width':'auto'});
+ }
+ } else {
+ // unknown error
+ $(dialog).remove();
+ }
+ },{'old':o,'new':n1});
+ chp.run();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).remove();
+ };
+ $('#vboxUserEdit').dialog({'closeOnEscape':false,'width':400,'height':200,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/register_16px.png" class="vboxDialogTitleIcon" /> '+trans('Change Password','UIUsers')});
+ };
+ l.run();
+ },
+ 'separator':true
+ };
+
+ if ( $('#vboxPane').data('vboxConfig').authCapabilities.canLogout )
+ {
+ menu['menu'][menu['menu'].length] = {
+ 'name' : 'fileLogout',
+ // Pre-translated title to append username
+ 'label' : trans('Log out - %1','VBoxSelectorWnd').replace('%1',$('#vboxPane').data('vboxSession').user),
+ 'icon' : 'exit',
+ 'click': function() {
+
+ // Show loading screen
+ var lm = new vboxLoader();
+ lm.showLoading();
+
+ // Expire data mediator data
+ vboxVMDataMediator.expireAll();
+
+ // Unsubscribe from events
+ $.when(vboxEventListener.stop()).done(function() {
+
+ // remove loading screen
+ lm.removeLoading();
+
+ var l = new vboxLoader();
+ l.noLoadingScreen = true;
+ l.add('logout',function(r){
+ if ( typeof(r.responseData.url) == 'string' )
+ {
+ window.location = r.responseData.url;
+ }
+ else
+ {
+ location.reload(true);
+ }
+ });
+ l.onLoad = function(loader){
+ loader.hideRoot = false;
+ };
+ l.hideRoot = true;
+ l.run();
+ });
+ }
+ };
+ }
+ else
+ {
+ menu['menu'][menu['menu'].length] = {
+ 'name' : 'fileLogout',
+ 'label' : trans('Logged in as %1','VBoxSelectorWnd').replace('%1',$('#vboxPane').data('vboxSession').user),
+ 'icon' : 'exit',
+ 'click': function() {
+ return false;
+ }
+ };
+ }
+
+}
+
+vboxTopMenuBar.addMenu(menu);
+
+//VM List Context menu for each VM
+var sChildren = [];
+for(var i = 0; i < vboxVMActions.stop_actions.length; i++) {
+ sChildren[sChildren.length] = vboxVMActions[vboxVMActions.stop_actions[i]];
+}
+
+
+vboxTopMenuBar.addMenu({
+ 'name': 'vboxTopMachine',
+ 'label': 'Machine',
+ 'enabled' : function(chooser) {
+ return (!chooser || (chooser.selectionMode != vboxSelectionModeSingleGroup));
+ },
+ 'menu':[
+ vboxVMActions['new'],
+ vboxVMActions['add'],
+ vboxVMActions['settings'],
+ vboxVMActions['clone'],
+ vboxVMActions['remove'],
+ vboxVMActions['group'],
+ $.extend({},vboxVMActions['start'],{'separator':true}),
+ vboxVMActions['pause'],
+ vboxVMActions['reset'],
+ $.extend({},vboxVMActions['stop'],{'children':sChildren}),
+ $.extend({},vboxVMActions['discard'],{'separator':true}),
+ vboxVMActions['logs'],
+ vboxVMActions['refresh'],
+ ]
+});
+
+
+vboxTopMenuBar.addMenu({
+ 'name':'vboxTopGroup',
+ 'label':'Group',
+ 'enabled' : function(chooser) {
+ return (chooser && (chooser.selectionMode == vboxSelectionModeSingleGroup));
+ },
+ 'menu':[
+ vboxVMGroupActions['newmachine'],
+ vboxVMGroupActions['addmachine'],
+ $.extend({}, vboxVMGroupActions['rename'], {separator:true}),
+ vboxVMGroupActions['ungroup'],
+ $.extend({},vboxVMActions['start'],{'name':'start','separator' : true}),
+ vboxVMActions['pause'],
+ vboxVMActions['reset'],
+ $.extend({},vboxVMActions['stop'],{'children':sChildren}),
+ $.extend({},vboxVMActions['discard'],{'separator' : true}),
+ vboxVMActions['refresh'],
+ $.extend({}, vboxVMGroupActions['sort'], {separator:true})
+ ]
+});
+
+vboxTopMenuBar.addMenu({
+ 'name':'vboxTopHelp',
+ 'label': 'Help',
+ 'language_context': 'UIHelpButton',
+ 'menu':[
+ {
+ 'name':'helpvbox',
+ 'label':'VirtualBox User Manual',
+ 'icon':'site',
+ 'click':function(){
+ window.open('http://www.virtualbox.org/manual/','manual');
+ }
+ },
+
+ {
+ 'name':'helpAbout',
+ 'label':'About',
+ 'icon':'help',
+ 'click':function(){
+
+ $('#vboxPane').append($('<div />').attr({'id':'vboxAbout','class':'vboxDialogContent','style':'display: none; width: 500px;'}));
+
+ var l = new vboxLoader();
+ l.addFileToDOM('panes/about.html',$('#vboxAbout'));
+ l.onLoad = function() {
+ var buttons = {};
+ buttons[trans('Close','UIVMLogViewer')] = function() { $(this).empty().remove(); };
+
+ $('#vboxAbout').dialog({'closeOnEscape':false,'width':500,'height':'auto','buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/help_16px.png" class="vboxDialogTitleIcon" /> phpVirtualBox'});
+ };
+ l.run();
+ }
+ }
+
+ ]
+});
+
+vboxTopMenuBar.renderTo('vboxMenu');
+
+$('#vboxPane').on('vmSelectionListChanged vmGroupDefsSaving vmGroupDefsSaved',function(e){
+ vboxTopMenuBar.update(vboxChooser);
+
+}).on('vboxEvents', function(e, eventList) {
+
+ var updateMenuBar = false;
+ for(var i = 0; i < eventList.length && !updateMenuBar; i++) {
+
+ switch(eventList[i].eventType) {
+ case 'OnMachineStateChanged':
+ case 'OnSessionStateChanged':
+ if(vboxChooser.isVMSelected(eventList[i].machineId)) {
+ updateMenuBar = true;
+ }
+ break;
+ }
+ }
+
+ if(updateMenuBar) {
+ vboxTopMenuBar.update(vboxChooser);
+ }
+
+});
+
+
</script> \ No newline at end of file
diff --git a/panes/userEdit.html b/panes/userEdit.html
index da8af45..bab3ea8 100644
--- a/panes/userEdit.html
+++ b/panes/userEdit.html
@@ -1,64 +1,64 @@
-<!--
-
- User edit dialog
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: userEdit.html 595 2015-04-17 09:50:36Z imoore76 $
--->
-<div id='vboxUserEdit'>
-<form>
-<table class='vboxVertical'>
-<tr class='addUser'>
- <th><span class='translate'>Username</span>:</th>
- <td><input type='text' name='username' class='vboxText' /></td>
-</tr>
-<tr class='editUser'>
- <th><span class='translate'>Username</span>:</th>
- <td><span id='vboxEditUserUsername'></span></td>
-</tr>
-
-<tr class='addUser editUser'>
- <th><span class='translate'>Admin User</span>:</th>
- <td><label><input type='checkbox' name='admin' class='vboxCheckbox' /> <span class='translate'>Can administer users</span></label></td>
-</tr>
-<tr class='changePassword'>
- <th><span class='translate'>Old Password</span>:</th>
- <td><input type='password' name='opass' class='vboxText' /></td>
-</tr>
-<tr class='editUser'>
- <td colspan='2' style='text-align: center; border-top: 1px solid #000'><span style='font-weight: bold' class='translate'>Change Password</span></td>
-</tr>
-<tr class='changePassword addUser editUser'>
- <th><span class='translate'>New Password</span>:</th>
- <td><input type='password' name='npass1' class='vboxText' /></td>
-</tr>
-<tr class='changePassword addUser editUser'>
- <th><span class='translate'>Retype</span>:</th>
- <td><input type='password' name='npass2' class='vboxText' /></td>
-</tr>
-<tr id='vboxUserBtnRow' style='display:none;padding:0px;margin:0px;border:0px'>
- <th style='padding:0px;margin:0px;border:0px'></th>
- <td style='padding:0px;margin:0px;border:0px'><input type='submit' value='' style='border:0px;margin:0px;display:inline;background:#fff;text:#fff;padding:0px;height:1px;' /></td>
-</tr>
-
-</table>
-</form>
-</div>
-<script type='text/javascript'>
-
-$('#vboxUserEdit').find(".translate").html(function(i,h){return trans(h,'UIUsers');}).removeClass('translate');
-
-$('#vboxUserEdit').on('setMode',function(e,mode) {
- $('#vboxUserEdit').find('table').first().find('tr:not(.'+mode+')').css('display','none');
-});
-
-if($.browser.msie || $.browser.webkit) $('#vboxUserBtnRow').css({'display':''});
-
-$('#vboxUserEdit form').on("submit",function(e) {
- $('#vboxUserEdit').parent().find('span:contains("'+trans('OK','QIMessageBox')+'")').trigger('click');
- e.stopPropagation();
- e.preventDefault();
- return false;
-});
-
-</script>
+<!--
+
+ User edit dialog
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: userEdit.html 595 2015-04-17 09:50:36Z imoore76 $
+-->
+<div id='vboxUserEdit'>
+<form>
+<table class='vboxVertical'>
+<tr class='addUser'>
+ <th><span class='translate'>Username</span>:</th>
+ <td><input type='text' name='username' class='vboxText' /></td>
+</tr>
+<tr class='editUser'>
+ <th><span class='translate'>Username</span>:</th>
+ <td><span id='vboxEditUserUsername'></span></td>
+</tr>
+
+<tr class='addUser editUser'>
+ <th><span class='translate'>Admin User</span>:</th>
+ <td><label><input type='checkbox' name='admin' class='vboxCheckbox' /> <span class='translate'>Can administer users</span></label></td>
+</tr>
+<tr class='changePassword'>
+ <th><span class='translate'>Old Password</span>:</th>
+ <td><input type='password' name='opass' class='vboxText' /></td>
+</tr>
+<tr class='editUser'>
+ <td colspan='2' style='text-align: center; border-top: 1px solid #000'><span style='font-weight: bold' class='translate'>Change Password</span></td>
+</tr>
+<tr class='changePassword addUser editUser'>
+ <th><span class='translate'>New Password</span>:</th>
+ <td><input type='password' name='npass1' class='vboxText' /></td>
+</tr>
+<tr class='changePassword addUser editUser'>
+ <th><span class='translate'>Retype</span>:</th>
+ <td><input type='password' name='npass2' class='vboxText' /></td>
+</tr>
+<tr id='vboxUserBtnRow' style='display:none;padding:0px;margin:0px;border:0px'>
+ <th style='padding:0px;margin:0px;border:0px'></th>
+ <td style='padding:0px;margin:0px;border:0px'><input type='submit' value='' style='border:0px;margin:0px;display:inline;background:#fff;text:#fff;padding:0px;height:1px;' /></td>
+</tr>
+
+</table>
+</form>
+</div>
+<script type='text/javascript'>
+
+$('#vboxUserEdit').find(".translate").html(function(i,h){return trans(h,'UIUsers');}).removeClass('translate');
+
+$('#vboxUserEdit').on('setMode',function(e,mode) {
+ $('#vboxUserEdit').find('table').first().find('tr:not(.'+mode+')').css('display','none');
+});
+
+if($.browser.msie || $.browser.webkit) $('#vboxUserBtnRow').css({'display':''});
+
+$('#vboxUserEdit form').on("submit",function(e) {
+ $('#vboxUserEdit').parent().find('span:contains("'+trans('OK','QIMessageBox')+'")').trigger('click');
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
+});
+
+</script>
diff --git a/panes/vmlogs.html b/panes/vmlogs.html
index e4c7f7b..d575717 100644
--- a/panes/vmlogs.html
+++ b/panes/vmlogs.html
@@ -1,105 +1,105 @@
-<!--
-
- VM Log dialog
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: vmlogs.html 595 2015-04-17 09:50:36Z imoore76 $
--->
-<table id='vboxVMLogContainer' class='vboxInvisible' style='width:100%;height:100%'>
- <tr style='vertical-align:bottom'>
- <td style='height: 1%;' id='vboxVMLogsTabsList'></td>
- </tr>
- <tr id='vboxVMLogsTabsRow' style='vertical-align:top'>
- <td id='vboxVMLogTabsContainer'></td>
- </tr>
-</table>
-<script type='text/javascript'>
-
-function vboxShowLogsInit(vm) {
-
- $('#vboxVMLogsTabsList').empty();
- $('#vboxVMLogTabsContainer').empty();
-
- $('<div />').attr({'id':'vboxVMLogTabs','style':'margin: 0px; padding: 0px;'}).appendTo($('#vboxVMLogTabsContainer'));
-
- var logs = $('#vboxVMLogsDialog').data('logs');
-
- if(!logs || !logs.length) {
- $('#vboxVMLogTabs').html(trans('<p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p>','UIVMLogViewer').replace('%1',$('#vboxVMLogsDialog').data('logpath')));
- return;
- }
-
- // Pattern for regexp replacement
- var preg = new RegExp('.*'+$('#vboxPane').data('vboxConfig').DSEP.replace('\\','\\\\'));
-
- var ul = $('<ul />').attr({'id':'vboxVMLogsUL'});
- for(var i = 0; i < logs.length; i++) {
-
- // Replace path with just file name
- logs[i] = logs[i].replace(preg,'');
-
- // Tab link
- $('<li />').html('<a href="#vboxVMLog'+i+'"><span>'+logs[i]+'</span></a>').appendTo(ul);
-
- // Tab content
- $('<div />').css({'padding':'4px','margin':'0px'}).attr({'id':'vboxVMLog'+i,'class':'vboxVMLog vboxDialogContent'}).data('logIndex',i).one('show',function(){
-
- $(this).html('<img src="images/spinner.gif" />');
-
- $.when({'logIndex':$(this).data('logIndex')}, vboxAjaxRequest('machineGetLogFile',{'vm':vm.id,'log':$(this).data('logIndex')})).done(function(x,d){
-
- // -8 for padding set above + parent's padding
- var pHeight = $('#vboxVMLogTabs').innerHeight() - 10;
-
- var frm = $('<form />');
- $(frm).height(pHeight);
- $('<textarea />').attr({'id':'vboxLogText'+x.logIndex,'spellcheck':'false','wrap':'off','readonly':'true'}).height(pHeight).val(d.responseData).appendTo(frm);
- $('#vboxVMLog'+x.logIndex).html('').append(frm);
- $('#vboxLogText'+x.logIndex).attr('scrollTop',$('#vboxLogText'+x.logIndex).attr('scrollHeight'));
-
- });
-
-
-
- }).appendTo($('#vboxVMLogTabs'));
-
-
- }
- $('#vboxVMLogTabs').prepend(ul);
-
- $('#vboxVMLogTabs').tabs({'activate':function(e,i){
- $('#vboxVMLogTabs').children('div:eq('+$('#vboxVMLogTabs').tabs('option','active')+')').trigger('show');
- }});
-
- // Move tabs to table
- $('#vboxVMLogsUL').css({'border-bottom':'0px','margin-bottom':'0px','padding-bottom':'0px'}).detach().appendTo($('#vboxVMLogsTabsList').addClass($('#vboxVMLogTabs').css({'border-top':'0px','margin-top':'0px','padding-top':'0px'}).removeClass('ui-corner-all').attr('class')));
-
- // Set height
- $('#vboxVMLogTabs').css({'display':'none'});
-
- // -6 to account for padding and leave a small buffer
- $('#vboxVMLogTabs').css({'padding':'0px 2px 2px 2px','margin':'0px','display':''}).height($('#vboxVMLogTabsContainer').css({'padding':'0px','margin':'0px'}).innerHeight()-6);
-
- // Resize dialog resizes these elemtns
- $('#vboxVMLogContainer').parent().on("dialogresizestop",function(e){
-
- // Set height
- $('#vboxVMLogTabs').css({'display':'none'});
-
- var pHeight = $('#vboxVMLogTabsContainer').innerHeight();
-
- // -4 to account for padding
- // -12 to account for vboxVMLogTabs 2px padding and pane's 4px padding (8 + 4)
- $('#vboxVMLogTabs').css({'display':''}).height(pHeight-4).find('form').height(pHeight-12).find('textarea').height(pHeight-12);
-
-
-
- });
-
- $('#vboxVMLogTabs').children('div:eq(0)').trigger('show');
-
-
-
-
-}
-</script>
+<!--
+
+ VM Log dialog
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: vmlogs.html 595 2015-04-17 09:50:36Z imoore76 $
+-->
+<table id='vboxVMLogContainer' class='vboxInvisible' style='width:100%;height:100%'>
+ <tr style='vertical-align:bottom'>
+ <td style='height: 1%;' id='vboxVMLogsTabsList'></td>
+ </tr>
+ <tr id='vboxVMLogsTabsRow' style='vertical-align:top'>
+ <td id='vboxVMLogTabsContainer'></td>
+ </tr>
+</table>
+<script type='text/javascript'>
+
+function vboxShowLogsInit(vm) {
+
+ $('#vboxVMLogsTabsList').empty();
+ $('#vboxVMLogTabsContainer').empty();
+
+ $('<div />').attr({'id':'vboxVMLogTabs','style':'margin: 0px; padding: 0px;'}).appendTo($('#vboxVMLogTabsContainer'));
+
+ var logs = $('#vboxVMLogsDialog').data('logs');
+
+ if(!logs || !logs.length) {
+ $('#vboxVMLogTabs').html(trans('<p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p>','UIVMLogViewer').replace('%1',$('#vboxVMLogsDialog').data('logpath')));
+ return;
+ }
+
+ // Pattern for regexp replacement
+ var preg = new RegExp('.*'+$('#vboxPane').data('vboxConfig').DSEP.replace('\\','\\\\'));
+
+ var ul = $('<ul />').attr({'id':'vboxVMLogsUL'});
+ for(var i = 0; i < logs.length; i++) {
+
+ // Replace path with just file name
+ logs[i] = logs[i].replace(preg,'');
+
+ // Tab link
+ $('<li />').html('<a href="#vboxVMLog'+i+'"><span>'+logs[i]+'</span></a>').appendTo(ul);
+
+ // Tab content
+ $('<div />').css({'padding':'4px','margin':'0px'}).attr({'id':'vboxVMLog'+i,'class':'vboxVMLog vboxDialogContent'}).data('logIndex',i).one('show',function(){
+
+ $(this).html('<img src="images/spinner.gif" />');
+
+ $.when({'logIndex':$(this).data('logIndex')}, vboxAjaxRequest('machineGetLogFile',{'vm':vm.id,'log':$(this).data('logIndex')})).done(function(x,d){
+
+ // -8 for padding set above + parent's padding
+ var pHeight = $('#vboxVMLogTabs').innerHeight() - 10;
+
+ var frm = $('<form />');
+ $(frm).height(pHeight);
+ $('<textarea />').attr({'id':'vboxLogText'+x.logIndex,'spellcheck':'false','wrap':'off','readonly':'true'}).height(pHeight).val(d.responseData).appendTo(frm);
+ $('#vboxVMLog'+x.logIndex).html('').append(frm);
+ $('#vboxLogText'+x.logIndex).attr('scrollTop',$('#vboxLogText'+x.logIndex).attr('scrollHeight'));
+
+ });
+
+
+
+ }).appendTo($('#vboxVMLogTabs'));
+
+
+ }
+ $('#vboxVMLogTabs').prepend(ul);
+
+ $('#vboxVMLogTabs').tabs({'activate':function(e,i){
+ $('#vboxVMLogTabs').children('div:eq('+$('#vboxVMLogTabs').tabs('option','active')+')').trigger('show');
+ }});
+
+ // Move tabs to table
+ $('#vboxVMLogsUL').css({'border-bottom':'0px','margin-bottom':'0px','padding-bottom':'0px'}).detach().appendTo($('#vboxVMLogsTabsList').addClass($('#vboxVMLogTabs').css({'border-top':'0px','margin-top':'0px','padding-top':'0px'}).removeClass('ui-corner-all').attr('class')));
+
+ // Set height
+ $('#vboxVMLogTabs').css({'display':'none'});
+
+ // -6 to account for padding and leave a small buffer
+ $('#vboxVMLogTabs').css({'padding':'0px 2px 2px 2px','margin':'0px','display':''}).height($('#vboxVMLogTabsContainer').css({'padding':'0px','margin':'0px'}).innerHeight()-6);
+
+ // Resize dialog resizes these elemtns
+ $('#vboxVMLogContainer').parent().on("dialogresizestop",function(e){
+
+ // Set height
+ $('#vboxVMLogTabs').css({'display':'none'});
+
+ var pHeight = $('#vboxVMLogTabsContainer').innerHeight();
+
+ // -4 to account for padding
+ // -12 to account for vboxVMLogTabs 2px padding and pane's 4px padding (8 + 4)
+ $('#vboxVMLogTabs').css({'display':''}).height(pHeight-4).find('form').height(pHeight-12).find('textarea').height(pHeight-12);
+
+
+
+ });
+
+ $('#vboxVMLogTabs').children('div:eq(0)').trigger('show');
+
+
+
+
+}
+</script>
diff --git a/panes/vmm.html b/panes/vmm.html
index f3c2043..0c7f135 100644
--- a/panes/vmm.html
+++ b/panes/vmm.html
@@ -1,1132 +1,1132 @@
-<!--
-
- Virtual Media Manager
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: vmm.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<table id='vboxVirtualMediaManager' style='height: 100%; border:0px;margin:0px;padding:0px;width:100%;border-spacing:0px;border-width:0px;'>
-
- <!-- Top menu -->
- <tr><td style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxMMMenu' style='margin:0px;'></div></td></tr>
-
- <!-- Toolbar Created by JavaScript below -->
- <tr><td style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxMMToolbar' style='padding:0px; margin:0px;' class='vboxToolbarGrad'></div></td></tr>
-
- <!-- Tab Placeholder -->
- <tr style='vertical-align: top;'><td id='vboxVMMContainerTopCell' style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxVMMContainerTop' style='border:0px;margin-bottom:0px;padding-bottom:0px;'></div></td></tr>
-
- <!-- Tabs for Media -->
- <tr style='vertical-align: top;'>
- <td style='padding:0px;margin:0px;border:0px;' id='vboxVMMContainer'>
-
- <div id='vboxVMMTabs'>
-
- <ul id='vboxVMMTabList'>
- <li><a href="#vmmDisks"><span><img id='vmmDisksIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/hd_16px.png" border="0" /> <span class='translate'>Hard disks</span></span></a></li>
- <li><a href="#vmmCDs"><span><img id='vmmCDsIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/cd_16px.png" border="0" /> <span class='translate'>Optical disks</span></span></a></li>
- <li><a href="#vmmFloppys"><span><img id='vmmFloppysIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/fd_16px.png" border="0" /> <span class='translate'>Floppy disks</span></span></a></li>
- </ul>
-
- <!--
-
- HARD DISKS
-
- -->
- <div id='vmmDisks'>
- <div class='vboxBordered vboxVMMList'>
- <div class='vmmTableHead'>
- <table style='border-spacing: 0px; border: 0px; width:100%;' class='vboxHorizontal vboxListTable vboxVMMList'>
- <thead>
- <tr>
- <th style='width: 100%;'><span class='translate'>Name</span></th>
- <th style='width: auto'><span class='translate'>Virtual Size</span></th>
- <th style='width: auto'><span class='translate'>Actual Size</span></th>
- <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
- </tr>
- </thead>
- </table>
- </div>
- <div class='vmmTableBody'>
- <table class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
- <tbody id='vboxVMMHDList' class='vboxHover'>
- <tr>
- <td>Item 1</td>
- <td>Item 2</td>
- <td>Item 3</td>
- </tr>
- <tr>
- <td>Item 1</td>
- <td>Item 2</td>
- <td>Item 3</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class='vboxVMMMediumInfo'>
- <table>
- <tr>
- <th><span class='translate'>Type:</span></th>
- <td><input id='vmmMediumType' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Location:</span></th>
- <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Format:</span></th>
- <td><input class='vmmMediumFormat' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>Storage details:</span></th>
- <td><input class='vmmMediumHDDetails' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>Attached to:</span></th>
- <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>UUID:</span></th>
- <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr class='vmmAccessErr'>
- <td colspan='2'></td>
- </tr>
- </table>
- </div>
- </div>
-
-
-
- <!--
-
- CD / DVD IMAGES
-
- -->
- <div id='vmmCDs'>
- <div class='vboxVMMList vboxBordered'>
- <div class='vmmTableHead'>
- <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList'>
- <thead>
- <tr>
- <th style='width: 100%'><span class='translate'>Name</span></th>
- <th style='width: auto'><span class='translate'>Size</span></th>
- <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
- </tr>
- </thead>
- </table>
- </div>
- <div class='vmmTableBody'>
- <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
- <tbody id='vboxVMMCDList' class='vboxHover'>
- <tr>
- <td>Item 1</td>
- <td>Item 3</td>
- </tr>
- <tr>
- <td>Item 1</td>
- <td>Item 3</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class='vboxVMMMediumInfo'>
- <table>
- <tr>
- <th><span class='translate'>Location:</span></th>
- <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Attached to:</span></th>
- <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>UUID:</span></th>
- <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr class='vmmAccessErr'>
- <td colspan='2'></td>
- </tr>
- </table>
- </div>
- </div>
-
-
-
-
- <!--
-
- FLOPPY IMAGES
-
- -->
- <div id='vmmFloppys'>
- <div class='vboxVMMList vboxBordered'>
- <div class='vmmTableHead'>
- <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList'>
- <thead>
- <tr>
- <th style='width: 100%'><span class='translate'>Name</span></th>
- <th style='width: auto'><span class='translate'>Size</span></th>
- <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
- </tr>
- </thead>
- </table>
- </div>
- <div class='vmmTableBody'>
- <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
- <tbody id='vboxVMMFDList' class='vboxHover'>
- <tr>
- <td>Item 1</td>
- <td>Item 2</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class='vboxVMMMediumInfo'>
- <table>
- <tr>
- <th><span class='translate'>Location:</span></th>
- <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>Attached to:</span></th>
- <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr>
- <th><span class='translate'>UUID:</span></th>
- <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
- </tr>
- <tr class='vmmAccessErr'>
- <td colspan='2'></td>
- </tr>
- </table>
- </div>
- </div>
- </div></td>
- </tr>
-</table>
-<script type='text/javascript'>
-
-/*
- * Translate
- */
-
-// These are translated under a different context for some reason
-$('#vboxVMMTabList').find(".translate").html(function(i,h){return trans(h,'UIMediumManager');}).removeClass('translate');
-
-$("#vboxVMMTabs").find(".translate").html(function(i,h){return trans(h,'VBoxMediaManagerDlg');}).removeClass('translate');
-
-/*
- * Keypress events
- */
-$('div.vmmTableBody table').click(function(){$(this).focus();}).keydown(function(e){
-
- var keynum = 0;
-
- if(e.keyCode)
- keynum = e.keyCode;
- else if(e.which)
- keynum = e.which;
-
- switch(keynum) {
-
- // up
- case 38:
- $(this).find('tr.vboxListItemSelected').prevAll('tr:not([class~="vboxHidden"]):first').children().first().click();
- break;
-
- // right / expand
- case 39:
- $(this).find('tr.vboxListItemSelected.collapsed').find('input').click();
- break;
-
- // left / contract
- case 37:
- $(this).find('tr.vboxListItemSelected:not(.collapsed)').find('input').click();
- break;
-
- // down
- case 40:
- $(this).find('tr.vboxListItemSelected').nextAll('tr:not([class~="vboxHidden"]):first').children().first().click();
- break;
-
- }
-
- return false;
-
-}).css('outline','none');
-
-/*
- * Setup Tabs
- */
-$("#vboxVMMTabs").tabs().on("tabsactivate",function(ev,ui){
-
- // Resize table
- vboxVMMSizeTable(ui.newPanel);
-
- // Medium selection
- if(!$(ui.newPanel).find('tbody').children('tr.vboxListItemSelected').first().children().first().click().length) {
- $('#vboxVirtualMediaManager').trigger('mediumselect',[null]);
- }
-});
-
-/*
- * Toolbar Buttons
- */
-var vmmButtons = new Array(
-
- {
- /*
- * Create new HardDisk
- */
- 'name' : 'vmmnew',
- 'label' : 'New',
- 'icon' : 'hd_new',
- 'enabled' : function (item) { return(!$("#vboxVMMTabs").tabs('option','active')); },
- 'click' : function () {
- $.when(new vboxWizardNewHDDialog({'path':$('#vboxVirtualMediaManager').data('vmPath')}).run()).done(function(id){
- vboxVMMFillMedia(id);
- });
- }
- },
-
- {
- /*
- * Add existing medium to virtualbox
- */
- 'name' : 'vmmadd',
- 'label' : 'Add',
- 'icon' : 'hd_add',
- 'click' : function () {
- var type = '';
- switch($("#vboxVMMTabs").tabs('option','active')) {
- case 1: type = 'DVD'; break;
- case 2: type = 'Floppy'; break;
- default: type = 'HardDisk'; break;
- }
-
- vboxMedia.actions.choose(null,type,function(ret){
- vboxVMMFillMedia((ret && ret.id ? ret.id : null));
- });
-
- }
- },
- {
- /*
- * Add iSCSI medium to virtualbox
- */
- 'name' : 'vmmaddiscsi',
- 'label' : 'Add iSCSI',
- 'icon' : 'hd_add',
- 'enabled' : function (item) { return(!$("#vboxVMMTabs").tabs('option','active')); },
- 'click' : function () {
-
-
- var d = $('<div />').attr({'id':'vboxVMMAddMediumImageDialog'});
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- var frm = document.forms.vboxISCSIForm;
- var server = $(frm.vboxISCSIServer).val();
- var port = $(frm.vboxISCSIPort).val();
- var intnet = frm.vboxISCSIIntnet.checked;
- var target = $(frm.vboxISCSITarget).val();
- var lun = $(frm.vboxISCSILun).val();
- var enclun = frm.vboxISCSILunEnc.checked;
- var user = $(frm.vboxISCSIUser).val();
- var pass = $(frm.vboxISCSIPass).val();
-
- if(server && target) {
- if(!lun) lun = '0';
- var l = new vboxLoader('addiscsi');
- l.add('mediumAddISCSI',function(ret){
- if(ret && ret.responseData && ret.responseData.id) {
- var nl = new vboxLoader('getMedia');
- nl.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
- nl.onLoad = function() {
- vboxVMMFillMedia(ret.responseData.id);
- };
- nl.run();
- }
- },{'server':server,'port':port,'intnet':intnet,'target':target,'lun':lun,'enclun':enclun,'targetUser':user,'targetPass':pass});
- l.run();
- }
-
- $(this).empty().remove();
-
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { $(this).empty().remove(); };
-
- var l = new vboxLoader();
- l.addFileToDOM("panes/vmmISCSI.html",$(d));
- l.onLoad = function() {
- $(d).dialog({'width':400,'height':350,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':trans('Add iSCSI')});
- };
- l.run();
-
-
- }
- },
- {
- /*
- * Copy Medium
- */
- 'name' : 'vmmcopy',
- 'label' : 'Copy...',
- 'icon' : 'vdm_add',
- 'separator' : $('#vboxPane').data('vboxConfig').enableAdvancedConfig,
- 'enabled' : function (item) {
- if(!item) return false;
- if($("#vboxVMMTabs").tabs('option','active')) return false;
- if(!$(item).data('medium')) return false;
- var m = vboxMedia.getMediumById($(item).data('medium'));
- return (!m || !m.parent);
-
- },
- 'click' : function () {
- var elm = null;
- switch($("#vboxVMMTabs").tabs('option','active')) {
- case 1:
- elm = $('#vboxVMMCDList');
- break;
- case 2:
- elm = $('#vboxVMMFDList');
- break;
- default:
- elm = $('#vboxVMMHDList');
- break;
- }
- $.when(new vboxWizardCopyHDDialog({'medium':$(elm).find('tr.vboxListItemSelected').first().data('medium')}).run()).done(function(id){
- vboxVMMFillMedia(id);
- });
- }
- },
- {
- /*
- * Modify Medium
- */
- 'name' : 'vmmmodify',
- 'label' : 'Modify...',
- 'icon' : 'vdm_new',
- 'enabled' : function (item) {
- if(!item) return false;
- if($("#vboxVMMTabs").tabs('option','active')) return false;
- var m = vboxMedia.getMediumById($(item).data('medium'));
- return (m && !m.parent);
-
- },
- 'click' : function () {
-
- var d = $('<div />').attr({'id':'vboxVMMModifyDialog'});
-
- var med = $('#vboxVMMHDList').find('tr.vboxListItemSelected').first();
- med = vboxMedia.getMediumById(med.data('medium'));
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function() {
-
- var mtype = document.forms.vboxVMMModifyForm.vmmMType;
- for(var i = 0; i < mtype.length; i++) {
- if(mtype[i].checked) {
- mtype = mtype[i].value;
- break;
- }
- }
-
- $.when(vboxAjaxRequest('mediumSetType',{'medium':med.location,'type':mtype})).done(function(ret){
-
- if(ret && ret.success) {
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(data){$('#vboxPane').data('vboxMedia',data.responseData);});
- l.onLoad = function() {
- if($('#vboxVirtualMediaManager').data('hideDiff')) {
- var d = vboxMedia.getMediumById(med.id);
- if(d.readOnly) $('#vboxVMMMediaTitle-'+d.id).addClass('vboxMediumReadOnly');
- else $('#vboxVMMMediaTitle-'+d.id).removeClass('vboxMediumReadOnly');
- }
- $('#vmmMediumType').val(trans(mtype,'VBoxGlobal'));
- };
- l.run();
- $('#vboxVMMModifyDialog').empty().remove();
- }
- });
-
- };
- buttons[trans('Cancel','QIMessageBox')] = function() { $(this).empty().remove(); };
-
- var l = new vboxLoader();
- l.addFileToDOM("panes/vmmModify.html",$(d));
- l.onLoad = function() {
-
- var msg = trans('<p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p>','UIMediumTypeChangeDialog');
- var title = trans('Modify medium attributes','UIMediumTypeChangeDialog');
-
- msg = msg.replace('%1',med.location).replace('%2',trans('OK','QIMessageBox')).replace('%3',trans('Cancel','QIMessageBox'));
-
- $(d).dialog({'width':400,'height':370,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/diskimage_16px.png" /> '+title});
-
- // Translations
- $('#vboxVMMModifyInstructions').html(msg);
-
- $('#vboxVMMModify').find(".translate").html(function(i,h){return trans(h,'UIMediumTypeChangeDialog');}).removeClass('translate');
-
- $('#vboxVMMModify').find('table.vboxOptions').find('span').html(function(i,h){return trans(h,'VBoxGlobal', 'MediumType');});
-
- // Set correct option
- $('#vboxVMMModify').find('input').prop('checked',false);
- $('#vboxVMMModify').find('input[value='+med.type+']').prop('checked',true);
-
-
- };
- l.run();
-
- }
- },
-
- {
- /*
- * Remove a medium
- */
- 'name' : 'vmmremove',
- 'label' : 'Remove',
- 'icon' : 'hd_remove',
- 'enabled' : function (item) {
- if(!item || item.target) return false;
- var m = vboxMedia.getMediumById($(item).data('medium'));
- return (m && m.attachedTo.length == 0 && m.children.length == 0);
- },
- 'click' : function () {
- var mtype = null;
- var elm = null;
- switch($("#vboxVMMTabs").tabs('option','active')) {
- case 1:
- elm = $('#vboxVMMCDList');
- mtype = 'CD/DVD image';
- break;
- case 2:
- elm = $('#vboxVMMFDList');
- mtype = 'floppy image';
- break;
- default:
- elm = $('#vboxVMMHDList');
- mtype = 'hard disk';
- break;
- }
- var m = vboxMedia.getMediumById($(elm).find('tr.vboxListItemSelected').first().data('medium'));
-
- var buttons = {};
- var q = '';
-
- // If we are removing a hard disk and configured to allow deletions
- if(m.deviceType == 'HardDisk' && $('#vboxPane').data('vboxConfig').deleteOnRemove && m.format != 'iSCSI') {
-
-
- q = trans('<p>Do you want to delete the storage unit of the virtual hard disk <nobr><b>%1</b></nobr>?'+
- '</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. '+
- 'This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will '+
- 'be only removed from the list of known hard disks, but the storage unit will be left untouched '+
- 'which makes it possible to add this hard disk to the list later again.</p>','UIMessageCenter').replace('%1',m.location);
-
- buttons[trans('Delete','UIMessageCenter')] = function(){
- $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType,'delete':1})).done(function(ret){
- if(ret && ret.responseData && ret.responseData.progress) {
- vboxProgress(ret.responseData,function(){
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function() {vboxVMMFillMedia(); };
- l.run();
- },'progress_media_delete_90px.png',trans('Delete','UIMessageCenter'),
- vboxBasename(m.location));
- }
- });
- $(this).empty().remove();
- };
-
- buttons[trans('Keep','UIMessageCenter')] = function(){
- $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType})).done(function(ret){
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function() {vboxVMMFillMedia(); };
- l.run();
- });
- $(this).empty().remove();
- };
-
- } else {
-
- q = trans('<p>Are you sure you want to remove the %1 <nobr><b>%2</b></nobr> from the list of known media?</p>','UIMessageCenter').replace('%1',trans(mtype,'UIMessageCenter')).replace('%2',m.location);
- q+= trans('<p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p>','UIMessageCenter');
-
- buttons[trans('Remove','UIMessageCenter')] = function(){
- var b = this;
- $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType})).done(function(ret){
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function() {vboxVMMFillMedia(); };
- $(b).empty().remove();
- l.run();
- });
- };
-
- }
- vboxConfirm(q,buttons);
- }
- },
-
- {
- /*
- * Release a medium from all attachments
- */
- 'name' : 'vmmrelease',
- 'label' : 'Release',
- 'icon' : 'hd_release',
- 'enabled' : function (item) {
- if(!item || item.target) return false;
- var m = vboxMedia.getMediumById($(item).data('medium'));
- return (m && m.attachedTo.length > 0 && m.children.length == 0 && m.hasSnapshots == 0);
- },
- 'click' : function () {
- var elm = null;
- var mtype = null;
- switch($("#vboxVMMTabs").tabs('option','active')) {
- case 1:
- elm = $('#vboxVMMCDList');
- mtype = 'CD/DVD image';
- break;
- case 2:
- elm = $('#vboxVMMFDList');
- mtype = 'floppy image';
- break;
- default:
- elm = $('#vboxVMMHDList');
- mtype = 'hard disk';
- break;
- }
-
-
- var m = vboxMedia.getMediumById($(elm).find('tr.vboxListItemSelected').first().data('medium'));
- var q = trans('<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>','UIMessageCenter');
- q = q.replace('%1',m.location);
-
- var buttons = {};
- buttons[trans('Release','UIMessageCenter')] = function(){
- var b = this;
- $.when(vboxAjaxRequest('mediumRelease',{'medium':m.location,'type':m.deviceType})).done(function(ret){
-
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function(){
- vboxVMMFillMedia(m.id);
- };
- $(b).empty().remove();
- l.run();
- });
- };
-
- if(m.attachedTo.length) {
- var machines = new Array();
- for(var i = 0; i < m.attachedTo.length; i++) {
- machines[machines.length] = m.attachedTo[i].machine;
- }
- q = q.replace('%2','<b>'+machines.join('</b>, <b>') + '</b>');
- };
-
-
- vboxConfirm(q,buttons);
- }
- },
-
- {
- 'name' : 'vmmrefresh',
- 'label' : 'Refresh',
- 'icon' : 'refresh',
- 'click' : function () {
-
- // Force a refresh of media
- var l = new vboxLoader();
- l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
- l.onLoad = function() {vboxVMMFillMedia(); };
- l.run();
-
- }
- }
-
-
-);
-
-// Check for advanced config
-if(!$('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- vmmButtons.shift();
- vmmButtons.shift();
- vmmButtons.shift();
-}
-
-/* Toolbar */
-var vmmToolbar = new vboxToolbar({buttons: vmmButtons,
- language_context: 'VBoxMediaManagerDlg',
- renderTo: 'vboxMMToolbar'});
-
-/* Actions Menu */
-var vmmMenu = new vboxMenuBar({name: 'vboxMMMenu', language_context: 'VBoxMediaManagerDlg'});
-vmmMenu.addMenu({
- 'name':'vboxMMactions',
- 'label':'Actions',
- 'menu': vmmButtons
-});
-vmmMenu.renderTo('vboxMMMenu');
-
-/* Context menu for media */
-var vmmCMButtons;
-
-// Check for advanced config. We don't want these in our context menu
-if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
- vmmCMButtons = vmmButtons.slice(3,-1);
-} else {
- vmmCMButtons = vmmButtons.slice(0,-1);
-}
-var vmmCMenu = new vboxMenu({name: 'vboxVMMMediaContextMenu', menuItems: vmmCMButtons,
- language_context: 'VBoxMediaManagerDlg'});
-
-
-/**
- * Displays medium info
- * @param {HTMLElement} med selected medium row
- */
-function vboxVMMMediaInfo(med) {
-
- var m = (med ? vboxMedia.getMediumById($(med).data('medium')) : null);
-
- $('#vboxVirtualMediaManager').find('.vmmMediumLocation').val((m && m.location ? m.location : '--'));
- $('#vboxVirtualMediaManager').find('.vmmMediumFormat').val(m ? m.format.toUpperCase() : '--');
- $('#vboxVirtualMediaManager').find('.vmmMediumHDDetails').val(m ? vboxMedia.getHardDiskVariant(m) : '--');
- $('#vmmMediumType').val(m ? trans(m.type,'VBoxGlobal') : '--');
-
- if(m && m.parent) {
- $('#vmmMediumType').val(trans('Differencing','VBoxGlobal'));
- }
-
- // Attached To val
- var attch = null;
- var attchElm = $('#vboxVirtualMediaManager').find('.vmmMediumAttachedTo');
- attchElm.css({'font-style':''});
- if(m) {
- attch = vboxMedia.attachedTo(m,true);
- if(!attch) {
- attch = trans('Not Attached','UIGDetails','details (storage)');
- attchElm.css({'font-style':'italic'});
- }
- attchElm.val(attch);
- } else {
- attchElm.val('--');
- }
-
- // UUID
- $('#vboxVirtualMediaManager').find('.vmmMediumUUID').val(m ? m.id : '--');
-
- if(m && m.state == 'Inaccessible' && m.lastAccessError) {
- $('#vboxVirtualMediaManager').find('tr.vmmAccessErr').css({'display':''}).children().html(m.lastAccessError);
- } else {
- $('#vboxVirtualMediaManager').find('tr.vmmAccessErr').css({'display':'none'}).children().html('');
- }
-}
-
-// Update items on mediumselect
-$('#vboxVirtualMediaManager').on('mediumselect',function(e,m){
- vmmToolbar.update(m);
- vboxVMMMediaInfo(m);
- vmmMenu.update(m);
- vmmCMenu.update(m);
-});
-
-/*
- * Add medium to a table
- */
-function vboxVMMAddMedium(d,depth,hideDiff,topLevelParent) {
-
- var tr = $('<tr />').data({'medium':d.id,'mediumname':d.name,'mediumsize':d.size,'mediumlogicalSize':d.logicalSize})
- .attr({'id':'vboxVMMMedium'+(d.id),'class':'vboxListItem collapsed','title':d.id})
- .hover(function(){
- if(!$(this).hasClass('vboxListItemSelected'))
- $(this).addClass('vboxHover');
- },function(){
- $(this).removeClass('vboxHover');
- }
- )
- .addClass('vboxVMMTopLevel'+(topLevelParent ? topLevelParent : '0')+' vboxVMMChildOf'+(d.parent ? d.parent : '0') +' vboxVMMChildDepth'+depth)
- .contextMenu({
- menu: vmmCMenu.menuId(),
- menusetup : function(el) {
- if(!$(el).hasClass('vboxListItemSelected')) $(el).children().first().trigger('click');
- }
- },vmmCMenu.menuClickCallback);
-
-
- if(d.children && d.children.length && !hideDiff) $(tr).addClass('vboxVMMParent');
- if(d.parent) $(tr).addClass('vboxHidden').attr('style','display: none');
-
- /* Expand / collapse button and/or spacers */
- var td = $('<td />').addClass('vboxHoverFirst');
-
- // Add spacer image to pad for depth
- if(depth) {
- for(var i = 0; i < depth; i++) {
- $('<img />').attr({'class':'vboxVMMSpacer','src':'images/vbox/blank.gif'}).appendTo(td);
- }
- }
-
- // Show / hide children button
- if(d.children && d.children.length && !hideDiff) {
-
- $('<input />').attr({'type':'button','class':'vboxImgButton vboxVMMMediaExpand','style':'background-image: url(images/vbox/arrow_right_10px.png)'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
- $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
- $(this).closest('tr').toggleClass('collapsed').trigger('showChildren',true);
-
- } else {
- $(this).data('toggleClicked', false);
- $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
- $(this).closest('tr').toggleClass('collapsed').trigger('hideChildren',true);
- }
-
- return false;
-
- }).appendTo(td);
-
- } else if(depth) {
- $('<img />').attr({'class':'vboxVMMSpacer','src':'images/vbox/blank.gif'}).appendTo(td);
- }
-
- // Title div
- var span = $('<span />').attr({'id':'vboxVMMMediaTitle-'+d.id}).html($('<div />').html(d.name).text());
-
- // Add read-only or inaccessible class?
- if(d.state == 'Inaccessible') {
- $(span).addClass('vboxMediumInaccessible');
- } else if(hideDiff !== undefined && d.readOnly) {
- $(span).addClass('vboxMediumReadOnly');
- }
-
- $(td).append(span).appendTo(tr);
-
- // Set target list
- //////////////////////
- var target = '';
- switch(d.deviceType) {
- case 'HardDisk':
- // Logical size column
- $('<td />').addClass('vboxHoverMid').append($('<span />').html(vboxMbytesConvert(d.logicalSize))).appendTo(tr);
- target = '#vboxVMMHDList';
- break;
- case 'DVD':
- target = '#vboxVMMCDList';
- break;
- case 'Floppy':
- target = '#vboxVMMFDList';
- break;
- }
-
- // Size column
- $('<td />').addClass('vboxHoverLast').append($('<div />').html(vboxBytesConvert(d.size))).appendTo(tr);
-
- /* Show / hide children of this medium */
- $(tr).on('showChildren',function(e,first){
-
- var thisid = $(this).data('medium');
- var trTarget = this;
-
- if($(this).hasClass('collapsed') || !$(this).hasClass('vboxVMMParent')) return;
-
- $(trTarget).siblings('tr.vboxVMMChildOf'+thisid).show().removeClass('vboxHidden').trigger('showChildren',false);
-
- // Only set by original button click
- if(first) { vboxColorRows($('#vboxVMMHDList')); vboxVMMTableHeaderSetup($('#vmmDisks')); }
-
- }).on('hideChildren',function(e,first){
-
- if(!$(this).hasClass('vboxVMMParent')) return;
-
- $(this).siblings('tr.vboxVMMChildOf'+$(this).data('medium')).hide().addClass('vboxHidden').trigger('hideChildren',false);
-
- // Only set by original button click
- if(first) { vboxColorRows($('#vboxVMMHDList')); vboxVMMTableHeaderSetup($('#vmmDisks'));}
-
-
- }).children().click(function(){
- $(this).parent().removeClass('vboxListItem vboxHover').addClass('vboxListItemSelected')
- .siblings().removeClass('vboxListItemSelected').addClass('vboxListItem');
- $('#vboxVirtualMediaManager').trigger('mediumselect',[$(this).parent()]);
- });
-
- $(target).append(tr);
-
- if(d.children && d.children.length) {
- if(depth) depth++;
- else depth = 1;
- for(var i = 0; i < d.children.length; i++) {
- vboxVMMAddMedium(d.children[i],depth,hideDiff,(topLevelParent ? topLevelParent : d.id));
- }
- }
-}
-
-/* Fill medium tables and info with Medium info */
-function vboxVMMFillMedia(sel) {
-
- // Remove stub items
- $('#vboxVMMHDList').children().remove();
- $('#vboxVMMCDList').children().remove();
- $('#vboxVMMFDList').children().remove();
-
- // Set icons
- $('#vmmDisksIcon').attr('src','images/vbox/hd_16px.png');
- $('#vmmCDsIcon').attr('src','images/vbox/cd_16px.png');
- $('#vmmFloppysIcon').attr('src','images/vbox/fd_16px.png');
-
- var media = $('#vboxPane').data('vboxMedia').sort(function(a,b) {
- return strnatcasecmp(a.name,b.name);
- });
-
- var hideDiff = $('#vboxVirtualMediaManager').data('hideDiff');
-
- for(var i in media) {
- vboxVMMAddMedium(media[i],0,hideDiff,media[i].parent);
- if(media[i].state == 'Inaccessible') {
- var elm = null;
- switch(media[i].deviceType) {
- case 'HardDisk':
- elm = $('#vmmDisksIcon');
- break;
- case 'DVD':
- elm = $('#vmmCDsIcon');
- break;
- default:
- elm = $('#vmmFloppysIcon');
- }
- elm.attr('src','images/vbox/state_aborted_16px.png');
- }
-
- }
-
- vboxVMMTableHeaderSetup($('#vmmDisks'));
- vboxVMMTableHeaderSetup($('#vmmCDs'));
- vboxVMMTableHeaderSetup($('#vmmFloppys'));
-
- // Select medium?
- if(sel) {
-
- $('#vboxVMMMedium'+sel).children().first().click();
-
- } else {
- $('#vboxVirtualMediaManager').trigger('mediumselect',null);
- }
- vboxVMMTableSort($('#vboxVMMHDList'));
- vboxVMMTableSort($('#vboxVMMFDList'));
- vboxVMMTableSort($('#vboxVMMCDList'));
-
-
-}
-
-/*
- *
- * Sort table according to selected items
- *
- */
-function vboxVMMTableSort(t) {
-
- // Get Selected Heading and sort order
- ////////////////////////////////////////
- var ths = $(t).closest('div').siblings('div.vmmTableHead').find('thead').find('th');
- var cthIndex = 0;
- var sortOrder = null;
- for(var i = 0; i < ths.length; i++) {
- if($(ths[i]).data('sorted')) {
- cthIndex = i;
- sortOrder = $(ths[i]).data('sorted');
- break;
- }
- }
- ths =null;
-
- // Sort table
- ///////////////////////
- $(t).each(function(){
-
- // Sort function (vboxVMMChildOf0 are top-level)
- var rows = $(this).find('tr.vboxVMMChildOf0').get();
- switch(cthIndex) {
- // Name
- case 0:
- rows.sort(function(a,b){
- return strnatcasecmp($(a).data('mediumname'),$(b).data('mediumname'));
- });
- break;
- // size or logical size
- default:
-
- // HD has an extra column for logical size
-
- // size
- var sortOpt = ($("#vboxVMMTabs").tabs('option','active') ? '' : 'HD');
- if(sortOpt == 'HD' && cthIndex == 2 || (sortOpt != 'HD')) {
- rows.sort(function(a,b){
- if($(a).data('mediumsize') == $(b).data('mediumsize')) return 0;
- return (parseInt($(a).data('mediumsize')) > parseInt($(b).data('mediumsize')) ? 1 : -1);
- });
- // logical size
- } else {
- rows.sort(function(a,b){
- if($(a).data('mediumlogicalSize') == $(b).data('mediumlogicalSize')) return 0;
- return (parseInt($(a).data('mediumlogicalSize')) > parseInt($(b).data('mediumlogicalSize')) ? 1 : -1);
- });
- }
- break;
- }
- // reverse?
- if(sortOrder == 'asc') rows.reverse();
-
- // Append rows and children
- var target = $(this);
- $(rows).each(function(){
- // top-level (parent) medium
- $(this).detach().appendTo($(target));
- // Children
- $(target).find('tr.vboxVMMTopLevel'+($(this).data('medium'))).detach().appendTo($(target));
- });
- vboxColorRows(target);
- });
-
-}
-/*
- *
- * Resizing and setup
- *
- */
-
-function vboxVMMSizeTable(elm) {
-
- // Hide table body
- var TB = $(elm).find('div.vmmTableBody');
-
- TB.css({'display':'none'});
-
- // Get height
- var cH = $(elm).parent().innerHeight() - $(elm).outerHeight(true);
-
- // Apply to difference in height to table body
- TB.height(cH-4).css({'display':'','overflow':'auto'});
-
- // Set table head width
- vboxVMMTableHeaderSetup(elm);
-
-}
-/* Setup tables */
-function vboxVMMTableHeaderSetup(elm) {
-
- // Set column width
-
- // Get each column width
- var hCols = $(elm).find('div.vmmTableHead').find('tr:eq(0)').children();
- var tCols = $(elm).find('div.vmmTableBody').find('tbody tr:eq(0)').children();
- for(var i = 0; i < tCols.length; i++) {
- $(hCols[i]).width($(tCols[i]).width());
- }
-
-}
-
-
-/* Init virtual media manager */
-function vboxVMMInit(hideDiff,vmPath) {
-
- // SEVERE hack-fooery ensues..
- /////////////////////////////////
- $('#vboxVirtualMediaManager').parent().on( "dialogresizestart",function(e){
-
- $('#vboxVMMTabs').css({'height':'auto'});
- $('#vboxVMMContainer').css({'height':'auto'});
-
- }).on("dialogresizestop",function(e){
-
- $('#vmmDisks .vmmTableBody').css({'display':'none'});
- $('#vmmCDs .vmmTableBody').css({'display':'none'});
- $('#vmmFloppys .vmmTableBody').css({'display':'none'});
-
- $('#vboxVMMContainer').height($('#vboxVMMContainer').height());
- $('#vboxVMMTabs').height($('#vboxVMMContainer').innerHeight());
-
- vboxVMMSizeTable($('#vmmDisks'));
- vboxVMMSizeTable($('#vmmCDs'));
- vboxVMMSizeTable($('#vmmFloppys'));
- });
-
- $('#vboxVMMTabList').css({'border-bottom':'0px','margin-bottom':'0px','padding-bottom':'0px'}).detach().appendTo($('#vboxVMMContainerTop').attr({'class':$('#vboxVMMTabs').css({'border-top':'0px','margin-top':'0px','padding-top':'0px'}).removeClass('ui-corner-all').attr('class')}));
-
- $('#vboxVMMContainer').height($('#vboxVMMContainer').height()).css({'padding':'0px','margin':'0px'});
- $('#vboxVMMTabs').height($('#vboxVMMContainer').innerHeight()).css({'padding-top':'0px','padding-bottom':'0px','margin-top':'0px','margin-bottom':'0px'});
-
- // Resize disks table body
- vboxVMMSizeTable($('#vmmDisks'));
-
- // Save options for later
- $('#vboxVirtualMediaManager').data('hideDiff', hideDiff);
- $('#vboxVirtualMediaManager').data('vmPath', vmPath);
-
- // Column sorting
- ////////////////////////////
- $("#vboxVirtualMediaManager div.vmmTableHead thead th").each(function(thIndex){
-
- // Skip last column header. It is just kept for spacing
- if($(this).children('img').length) return true;
-
- $(this).hover(function(){
- $(this).children('img').css({'visibility':'visible'});
- },function(){
- if($(this).data('sorted')) return;
- $(this).children('img').css({'visibility':'hidden'});
-
- }).addClass('vboxVMMSortImgFaded').append(' ').append($('<img />').attr({'src':'images/upArrow.png','style':'visibility:hidden;cursor:pointer'}).click(function(e,sortDefault){
-
- var p = $(this).parent();
-
- // Get current sort order and set accordingly
- //////////////////////////////////////////////
- switch(p.data('sorted')) {
- case 'asc':
- $(this).attr({'src':'images/upArrow.png'}).css({'visibility':'visible'});
- p.data('sorted','desc');
- break;
- case 'desc':
- $(this).attr({'src':'images/downArrow.png'}).css({'visibility':'visible'});
- p.data('sorted','asc');
- break;
- default:
- p.data({'sorted':'desc'}).removeClass('vboxVMMSortImgFaded').siblings().data({'sorted':null}).addClass('vboxVMMSortImgFaded').children('img').attr({'src':'images/upArrow.png'}).css({'visibility':'hidden'});
- break;
- }
-
- vboxVMMTableSort($(p).closest('div').siblings('div.vmmTableBody').find('tbody').first());
-
- }));
-
- // Default is sort by name
- if($(this).index() == 0) {
- $(this).data({'sorted':'desc'}).removeClass('vboxVMMSortImgFaded').children('img').css({'visibility':'visible'});
- }
-
-
- });
-
- vboxVMMFillMedia();
-
-}
-
-
-</script>
-
-
+<!--
+
+ Virtual Media Manager
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: vmm.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<table id='vboxVirtualMediaManager' style='height: 100%; border:0px;margin:0px;padding:0px;width:100%;border-spacing:0px;border-width:0px;'>
+
+ <!-- Top menu -->
+ <tr><td style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxMMMenu' style='margin:0px;'></div></td></tr>
+
+ <!-- Toolbar Created by JavaScript below -->
+ <tr><td style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxMMToolbar' style='padding:0px; margin:0px;' class='vboxToolbarGrad'></div></td></tr>
+
+ <!-- Tab Placeholder -->
+ <tr style='vertical-align: top;'><td id='vboxVMMContainerTopCell' style='height:1%;padding:0px;margin:0px;border:0px;'><div id='vboxVMMContainerTop' style='border:0px;margin-bottom:0px;padding-bottom:0px;'></div></td></tr>
+
+ <!-- Tabs for Media -->
+ <tr style='vertical-align: top;'>
+ <td style='padding:0px;margin:0px;border:0px;' id='vboxVMMContainer'>
+
+ <div id='vboxVMMTabs'>
+
+ <ul id='vboxVMMTabList'>
+ <li><a href="#vmmDisks"><span><img id='vmmDisksIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/hd_16px.png" border="0" /> <span class='translate'>Hard disks</span></span></a></li>
+ <li><a href="#vmmCDs"><span><img id='vmmCDsIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/cd_16px.png" border="0" /> <span class='translate'>Optical disks</span></span></a></li>
+ <li><a href="#vmmFloppys"><span><img id='vmmFloppysIcon' style="height:16px;width:16px;vertical-align: middle" src="images/vbox/fd_16px.png" border="0" /> <span class='translate'>Floppy disks</span></span></a></li>
+ </ul>
+
+ <!--
+
+ HARD DISKS
+
+ -->
+ <div id='vmmDisks'>
+ <div class='vboxBordered vboxVMMList'>
+ <div class='vmmTableHead'>
+ <table style='border-spacing: 0px; border: 0px; width:100%;' class='vboxHorizontal vboxListTable vboxVMMList'>
+ <thead>
+ <tr>
+ <th style='width: 100%;'><span class='translate'>Name</span></th>
+ <th style='width: auto'><span class='translate'>Virtual Size</span></th>
+ <th style='width: auto'><span class='translate'>Actual Size</span></th>
+ <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ <div class='vmmTableBody'>
+ <table class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
+ <tbody id='vboxVMMHDList' class='vboxHover'>
+ <tr>
+ <td>Item 1</td>
+ <td>Item 2</td>
+ <td>Item 3</td>
+ </tr>
+ <tr>
+ <td>Item 1</td>
+ <td>Item 2</td>
+ <td>Item 3</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class='vboxVMMMediumInfo'>
+ <table>
+ <tr>
+ <th><span class='translate'>Type:</span></th>
+ <td><input id='vmmMediumType' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Location:</span></th>
+ <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Format:</span></th>
+ <td><input class='vmmMediumFormat' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Storage details:</span></th>
+ <td><input class='vmmMediumHDDetails' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Attached to:</span></th>
+ <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>UUID:</span></th>
+ <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr class='vmmAccessErr'>
+ <td colspan='2'></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!--
+
+ CD / DVD IMAGES
+
+ -->
+ <div id='vmmCDs'>
+ <div class='vboxVMMList vboxBordered'>
+ <div class='vmmTableHead'>
+ <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList'>
+ <thead>
+ <tr>
+ <th style='width: 100%'><span class='translate'>Name</span></th>
+ <th style='width: auto'><span class='translate'>Size</span></th>
+ <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ <div class='vmmTableBody'>
+ <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
+ <tbody id='vboxVMMCDList' class='vboxHover'>
+ <tr>
+ <td>Item 1</td>
+ <td>Item 3</td>
+ </tr>
+ <tr>
+ <td>Item 1</td>
+ <td>Item 3</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class='vboxVMMMediumInfo'>
+ <table>
+ <tr>
+ <th><span class='translate'>Location:</span></th>
+ <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Attached to:</span></th>
+ <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>UUID:</span></th>
+ <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr class='vmmAccessErr'>
+ <td colspan='2'></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+
+ <!--
+
+ FLOPPY IMAGES
+
+ -->
+ <div id='vmmFloppys'>
+ <div class='vboxVMMList vboxBordered'>
+ <div class='vmmTableHead'>
+ <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList'>
+ <thead>
+ <tr>
+ <th style='width: 100%'><span class='translate'>Name</span></th>
+ <th style='width: auto'><span class='translate'>Size</span></th>
+ <th style='width: auto;padding:0px;margin:0px;'><img src="images/vbox/blank.gif" style="height:1px;width:1px" /></th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ <div class='vmmTableBody'>
+ <table style='width: 100%; border-spacing: 0px; border: 0px;' class='vboxHorizontal vboxListTable vboxVMMList' tabindex='1'>
+ <tbody id='vboxVMMFDList' class='vboxHover'>
+ <tr>
+ <td>Item 1</td>
+ <td>Item 2</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class='vboxVMMMediumInfo'>
+ <table>
+ <tr>
+ <th><span class='translate'>Location:</span></th>
+ <td><input class='vmmMediumLocation' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Attached to:</span></th>
+ <td><input class='vmmMediumAttachedTo' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>UUID:</span></th>
+ <td><input class='vmmMediumUUID' type='text' style='width:100%;border:0px solid transparent;background:transparent;' value='' readonly spellcheck='false'/></td>
+ </tr>
+ <tr class='vmmAccessErr'>
+ <td colspan='2'></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div></td>
+ </tr>
+</table>
+<script type='text/javascript'>
+
+/*
+ * Translate
+ */
+
+// These are translated under a different context for some reason
+$('#vboxVMMTabList').find(".translate").html(function(i,h){return trans(h,'UIMediumManager');}).removeClass('translate');
+
+$("#vboxVMMTabs").find(".translate").html(function(i,h){return trans(h,'VBoxMediaManagerDlg');}).removeClass('translate');
+
+/*
+ * Keypress events
+ */
+$('div.vmmTableBody table').click(function(){$(this).focus();}).keydown(function(e){
+
+ var keynum = 0;
+
+ if(e.keyCode)
+ keynum = e.keyCode;
+ else if(e.which)
+ keynum = e.which;
+
+ switch(keynum) {
+
+ // up
+ case 38:
+ $(this).find('tr.vboxListItemSelected').prevAll('tr:not([class~="vboxHidden"]):first').children().first().click();
+ break;
+
+ // right / expand
+ case 39:
+ $(this).find('tr.vboxListItemSelected.collapsed').find('input').click();
+ break;
+
+ // left / contract
+ case 37:
+ $(this).find('tr.vboxListItemSelected:not(.collapsed)').find('input').click();
+ break;
+
+ // down
+ case 40:
+ $(this).find('tr.vboxListItemSelected').nextAll('tr:not([class~="vboxHidden"]):first').children().first().click();
+ break;
+
+ }
+
+ return false;
+
+}).css('outline','none');
+
+/*
+ * Setup Tabs
+ */
+$("#vboxVMMTabs").tabs().on("tabsactivate",function(ev,ui){
+
+ // Resize table
+ vboxVMMSizeTable(ui.newPanel);
+
+ // Medium selection
+ if(!$(ui.newPanel).find('tbody').children('tr.vboxListItemSelected').first().children().first().click().length) {
+ $('#vboxVirtualMediaManager').trigger('mediumselect',[null]);
+ }
+});
+
+/*
+ * Toolbar Buttons
+ */
+var vmmButtons = new Array(
+
+ {
+ /*
+ * Create new HardDisk
+ */
+ 'name' : 'vmmnew',
+ 'label' : 'New',
+ 'icon' : 'hd_new',
+ 'enabled' : function (item) { return(!$("#vboxVMMTabs").tabs('option','active')); },
+ 'click' : function () {
+ $.when(new vboxWizardNewHDDialog({'path':$('#vboxVirtualMediaManager').data('vmPath')}).run()).done(function(id){
+ vboxVMMFillMedia(id);
+ });
+ }
+ },
+
+ {
+ /*
+ * Add existing medium to virtualbox
+ */
+ 'name' : 'vmmadd',
+ 'label' : 'Add',
+ 'icon' : 'hd_add',
+ 'click' : function () {
+ var type = '';
+ switch($("#vboxVMMTabs").tabs('option','active')) {
+ case 1: type = 'DVD'; break;
+ case 2: type = 'Floppy'; break;
+ default: type = 'HardDisk'; break;
+ }
+
+ vboxMedia.actions.choose(null,type,function(ret){
+ vboxVMMFillMedia((ret && ret.id ? ret.id : null));
+ });
+
+ }
+ },
+ {
+ /*
+ * Add iSCSI medium to virtualbox
+ */
+ 'name' : 'vmmaddiscsi',
+ 'label' : 'Add iSCSI',
+ 'icon' : 'hd_add',
+ 'enabled' : function (item) { return(!$("#vboxVMMTabs").tabs('option','active')); },
+ 'click' : function () {
+
+
+ var d = $('<div />').attr({'id':'vboxVMMAddMediumImageDialog'});
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ var frm = document.forms.vboxISCSIForm;
+ var server = $(frm.vboxISCSIServer).val();
+ var port = $(frm.vboxISCSIPort).val();
+ var intnet = frm.vboxISCSIIntnet.checked;
+ var target = $(frm.vboxISCSITarget).val();
+ var lun = $(frm.vboxISCSILun).val();
+ var enclun = frm.vboxISCSILunEnc.checked;
+ var user = $(frm.vboxISCSIUser).val();
+ var pass = $(frm.vboxISCSIPass).val();
+
+ if(server && target) {
+ if(!lun) lun = '0';
+ var l = new vboxLoader('addiscsi');
+ l.add('mediumAddISCSI',function(ret){
+ if(ret && ret.responseData && ret.responseData.id) {
+ var nl = new vboxLoader('getMedia');
+ nl.add('vboxGetMedia',function(dat){$('#vboxPane').data('vboxMedia',dat.responseData);});
+ nl.onLoad = function() {
+ vboxVMMFillMedia(ret.responseData.id);
+ };
+ nl.run();
+ }
+ },{'server':server,'port':port,'intnet':intnet,'target':target,'lun':lun,'enclun':enclun,'targetUser':user,'targetPass':pass});
+ l.run();
+ }
+
+ $(this).empty().remove();
+
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { $(this).empty().remove(); };
+
+ var l = new vboxLoader();
+ l.addFileToDOM("panes/vmmISCSI.html",$(d));
+ l.onLoad = function() {
+ $(d).dialog({'width':400,'height':350,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':trans('Add iSCSI')});
+ };
+ l.run();
+
+
+ }
+ },
+ {
+ /*
+ * Copy Medium
+ */
+ 'name' : 'vmmcopy',
+ 'label' : 'Copy...',
+ 'icon' : 'vdm_add',
+ 'separator' : $('#vboxPane').data('vboxConfig').enableAdvancedConfig,
+ 'enabled' : function (item) {
+ if(!item) return false;
+ if($("#vboxVMMTabs").tabs('option','active')) return false;
+ if(!$(item).data('medium')) return false;
+ var m = vboxMedia.getMediumById($(item).data('medium'));
+ return (!m || !m.parent);
+
+ },
+ 'click' : function () {
+ var elm = null;
+ switch($("#vboxVMMTabs").tabs('option','active')) {
+ case 1:
+ elm = $('#vboxVMMCDList');
+ break;
+ case 2:
+ elm = $('#vboxVMMFDList');
+ break;
+ default:
+ elm = $('#vboxVMMHDList');
+ break;
+ }
+ $.when(new vboxWizardCopyHDDialog({'medium':$(elm).find('tr.vboxListItemSelected').first().data('medium')}).run()).done(function(id){
+ vboxVMMFillMedia(id);
+ });
+ }
+ },
+ {
+ /*
+ * Modify Medium
+ */
+ 'name' : 'vmmmodify',
+ 'label' : 'Modify...',
+ 'icon' : 'vdm_new',
+ 'enabled' : function (item) {
+ if(!item) return false;
+ if($("#vboxVMMTabs").tabs('option','active')) return false;
+ var m = vboxMedia.getMediumById($(item).data('medium'));
+ return (m && !m.parent);
+
+ },
+ 'click' : function () {
+
+ var d = $('<div />').attr({'id':'vboxVMMModifyDialog'});
+
+ var med = $('#vboxVMMHDList').find('tr.vboxListItemSelected').first();
+ med = vboxMedia.getMediumById(med.data('medium'));
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function() {
+
+ var mtype = document.forms.vboxVMMModifyForm.vmmMType;
+ for(var i = 0; i < mtype.length; i++) {
+ if(mtype[i].checked) {
+ mtype = mtype[i].value;
+ break;
+ }
+ }
+
+ $.when(vboxAjaxRequest('mediumSetType',{'medium':med.location,'type':mtype})).done(function(ret){
+
+ if(ret && ret.success) {
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(data){$('#vboxPane').data('vboxMedia',data.responseData);});
+ l.onLoad = function() {
+ if($('#vboxVirtualMediaManager').data('hideDiff')) {
+ var d = vboxMedia.getMediumById(med.id);
+ if(d.readOnly) $('#vboxVMMMediaTitle-'+d.id).addClass('vboxMediumReadOnly');
+ else $('#vboxVMMMediaTitle-'+d.id).removeClass('vboxMediumReadOnly');
+ }
+ $('#vmmMediumType').val(trans(mtype,'VBoxGlobal'));
+ };
+ l.run();
+ $('#vboxVMMModifyDialog').empty().remove();
+ }
+ });
+
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function() { $(this).empty().remove(); };
+
+ var l = new vboxLoader();
+ l.addFileToDOM("panes/vmmModify.html",$(d));
+ l.onLoad = function() {
+
+ var msg = trans('<p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p>','UIMediumTypeChangeDialog');
+ var title = trans('Modify medium attributes','UIMediumTypeChangeDialog');
+
+ msg = msg.replace('%1',med.location).replace('%2',trans('OK','QIMessageBox')).replace('%3',trans('Cancel','QIMessageBox'));
+
+ $(d).dialog({'width':400,'height':370,'buttons':buttons,'modal':true,'autoOpen':true,'dialogClass':'vboxDialogContent','title':'<img src="images/vbox/diskimage_16px.png" /> '+title});
+
+ // Translations
+ $('#vboxVMMModifyInstructions').html(msg);
+
+ $('#vboxVMMModify').find(".translate").html(function(i,h){return trans(h,'UIMediumTypeChangeDialog');}).removeClass('translate');
+
+ $('#vboxVMMModify').find('table.vboxOptions').find('span').html(function(i,h){return trans(h,'VBoxGlobal', 'MediumType');});
+
+ // Set correct option
+ $('#vboxVMMModify').find('input').prop('checked',false);
+ $('#vboxVMMModify').find('input[value='+med.type+']').prop('checked',true);
+
+
+ };
+ l.run();
+
+ }
+ },
+
+ {
+ /*
+ * Remove a medium
+ */
+ 'name' : 'vmmremove',
+ 'label' : 'Remove',
+ 'icon' : 'hd_remove',
+ 'enabled' : function (item) {
+ if(!item || item.target) return false;
+ var m = vboxMedia.getMediumById($(item).data('medium'));
+ return (m && m.attachedTo.length == 0 && m.children.length == 0);
+ },
+ 'click' : function () {
+ var mtype = null;
+ var elm = null;
+ switch($("#vboxVMMTabs").tabs('option','active')) {
+ case 1:
+ elm = $('#vboxVMMCDList');
+ mtype = 'CD/DVD image';
+ break;
+ case 2:
+ elm = $('#vboxVMMFDList');
+ mtype = 'floppy image';
+ break;
+ default:
+ elm = $('#vboxVMMHDList');
+ mtype = 'hard disk';
+ break;
+ }
+ var m = vboxMedia.getMediumById($(elm).find('tr.vboxListItemSelected').first().data('medium'));
+
+ var buttons = {};
+ var q = '';
+
+ // If we are removing a hard disk and configured to allow deletions
+ if(m.deviceType == 'HardDisk' && $('#vboxPane').data('vboxConfig').deleteOnRemove && m.format != 'iSCSI') {
+
+
+ q = trans('<p>Do you want to delete the storage unit of the virtual hard disk <nobr><b>%1</b></nobr>?'+
+ '</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. '+
+ 'This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will '+
+ 'be only removed from the list of known hard disks, but the storage unit will be left untouched '+
+ 'which makes it possible to add this hard disk to the list later again.</p>','UIMessageCenter').replace('%1',m.location);
+
+ buttons[trans('Delete','UIMessageCenter')] = function(){
+ $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType,'delete':1})).done(function(ret){
+ if(ret && ret.responseData && ret.responseData.progress) {
+ vboxProgress(ret.responseData,function(){
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function() {vboxVMMFillMedia(); };
+ l.run();
+ },'progress_media_delete_90px.png',trans('Delete','UIMessageCenter'),
+ vboxBasename(m.location));
+ }
+ });
+ $(this).empty().remove();
+ };
+
+ buttons[trans('Keep','UIMessageCenter')] = function(){
+ $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType})).done(function(ret){
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function() {vboxVMMFillMedia(); };
+ l.run();
+ });
+ $(this).empty().remove();
+ };
+
+ } else {
+
+ q = trans('<p>Are you sure you want to remove the %1 <nobr><b>%2</b></nobr> from the list of known media?</p>','UIMessageCenter').replace('%1',trans(mtype,'UIMessageCenter')).replace('%2',m.location);
+ q+= trans('<p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p>','UIMessageCenter');
+
+ buttons[trans('Remove','UIMessageCenter')] = function(){
+ var b = this;
+ $.when(vboxAjaxRequest('mediumRemove',{'medium':m.location,'type':m.deviceType})).done(function(ret){
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function() {vboxVMMFillMedia(); };
+ $(b).empty().remove();
+ l.run();
+ });
+ };
+
+ }
+ vboxConfirm(q,buttons);
+ }
+ },
+
+ {
+ /*
+ * Release a medium from all attachments
+ */
+ 'name' : 'vmmrelease',
+ 'label' : 'Release',
+ 'icon' : 'hd_release',
+ 'enabled' : function (item) {
+ if(!item || item.target) return false;
+ var m = vboxMedia.getMediumById($(item).data('medium'));
+ return (m && m.attachedTo.length > 0 && m.children.length == 0 && m.hasSnapshots == 0);
+ },
+ 'click' : function () {
+ var elm = null;
+ var mtype = null;
+ switch($("#vboxVMMTabs").tabs('option','active')) {
+ case 1:
+ elm = $('#vboxVMMCDList');
+ mtype = 'CD/DVD image';
+ break;
+ case 2:
+ elm = $('#vboxVMMFDList');
+ mtype = 'floppy image';
+ break;
+ default:
+ elm = $('#vboxVMMHDList');
+ mtype = 'hard disk';
+ break;
+ }
+
+
+ var m = vboxMedia.getMediumById($(elm).find('tr.vboxListItemSelected').first().data('medium'));
+ var q = trans('<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>','UIMessageCenter');
+ q = q.replace('%1',m.location);
+
+ var buttons = {};
+ buttons[trans('Release','UIMessageCenter')] = function(){
+ var b = this;
+ $.when(vboxAjaxRequest('mediumRelease',{'medium':m.location,'type':m.deviceType})).done(function(ret){
+
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function(){
+ vboxVMMFillMedia(m.id);
+ };
+ $(b).empty().remove();
+ l.run();
+ });
+ };
+
+ if(m.attachedTo.length) {
+ var machines = new Array();
+ for(var i = 0; i < m.attachedTo.length; i++) {
+ machines[machines.length] = m.attachedTo[i].machine;
+ }
+ q = q.replace('%2','<b>'+machines.join('</b>, <b>') + '</b>');
+ };
+
+
+ vboxConfirm(q,buttons);
+ }
+ },
+
+ {
+ 'name' : 'vmmrefresh',
+ 'label' : 'Refresh',
+ 'icon' : 'refresh',
+ 'click' : function () {
+
+ // Force a refresh of media
+ var l = new vboxLoader();
+ l.add('vboxGetMedia',function(d){$('#vboxPane').data('vboxMedia',d.responseData);});
+ l.onLoad = function() {vboxVMMFillMedia(); };
+ l.run();
+
+ }
+ }
+
+
+);
+
+// Check for advanced config
+if(!$('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ vmmButtons.shift();
+ vmmButtons.shift();
+ vmmButtons.shift();
+}
+
+/* Toolbar */
+var vmmToolbar = new vboxToolbar({buttons: vmmButtons,
+ language_context: 'VBoxMediaManagerDlg',
+ renderTo: 'vboxMMToolbar'});
+
+/* Actions Menu */
+var vmmMenu = new vboxMenuBar({name: 'vboxMMMenu', language_context: 'VBoxMediaManagerDlg'});
+vmmMenu.addMenu({
+ 'name':'vboxMMactions',
+ 'label':'Actions',
+ 'menu': vmmButtons
+});
+vmmMenu.renderTo('vboxMMMenu');
+
+/* Context menu for media */
+var vmmCMButtons;
+
+// Check for advanced config. We don't want these in our context menu
+if($('#vboxPane').data('vboxConfig').enableAdvancedConfig) {
+ vmmCMButtons = vmmButtons.slice(3,-1);
+} else {
+ vmmCMButtons = vmmButtons.slice(0,-1);
+}
+var vmmCMenu = new vboxMenu({name: 'vboxVMMMediaContextMenu', menuItems: vmmCMButtons,
+ language_context: 'VBoxMediaManagerDlg'});
+
+
+/**
+ * Displays medium info
+ * @param {HTMLElement} med selected medium row
+ */
+function vboxVMMMediaInfo(med) {
+
+ var m = (med ? vboxMedia.getMediumById($(med).data('medium')) : null);
+
+ $('#vboxVirtualMediaManager').find('.vmmMediumLocation').val((m && m.location ? m.location : '--'));
+ $('#vboxVirtualMediaManager').find('.vmmMediumFormat').val(m ? m.format.toUpperCase() : '--');
+ $('#vboxVirtualMediaManager').find('.vmmMediumHDDetails').val(m ? vboxMedia.getHardDiskVariant(m) : '--');
+ $('#vmmMediumType').val(m ? trans(m.type,'VBoxGlobal') : '--');
+
+ if(m && m.parent) {
+ $('#vmmMediumType').val(trans('Differencing','VBoxGlobal'));
+ }
+
+ // Attached To val
+ var attch = null;
+ var attchElm = $('#vboxVirtualMediaManager').find('.vmmMediumAttachedTo');
+ attchElm.css({'font-style':''});
+ if(m) {
+ attch = vboxMedia.attachedTo(m,true);
+ if(!attch) {
+ attch = trans('Not Attached','UIGDetails','details (storage)');
+ attchElm.css({'font-style':'italic'});
+ }
+ attchElm.val(attch);
+ } else {
+ attchElm.val('--');
+ }
+
+ // UUID
+ $('#vboxVirtualMediaManager').find('.vmmMediumUUID').val(m ? m.id : '--');
+
+ if(m && m.state == 'Inaccessible' && m.lastAccessError) {
+ $('#vboxVirtualMediaManager').find('tr.vmmAccessErr').css({'display':''}).children().html(m.lastAccessError);
+ } else {
+ $('#vboxVirtualMediaManager').find('tr.vmmAccessErr').css({'display':'none'}).children().html('');
+ }
+}
+
+// Update items on mediumselect
+$('#vboxVirtualMediaManager').on('mediumselect',function(e,m){
+ vmmToolbar.update(m);
+ vboxVMMMediaInfo(m);
+ vmmMenu.update(m);
+ vmmCMenu.update(m);
+});
+
+/*
+ * Add medium to a table
+ */
+function vboxVMMAddMedium(d,depth,hideDiff,topLevelParent) {
+
+ var tr = $('<tr />').data({'medium':d.id,'mediumname':d.name,'mediumsize':d.size,'mediumlogicalSize':d.logicalSize})
+ .attr({'id':'vboxVMMMedium'+(d.id),'class':'vboxListItem collapsed','title':d.id})
+ .hover(function(){
+ if(!$(this).hasClass('vboxListItemSelected'))
+ $(this).addClass('vboxHover');
+ },function(){
+ $(this).removeClass('vboxHover');
+ }
+ )
+ .addClass('vboxVMMTopLevel'+(topLevelParent ? topLevelParent : '0')+' vboxVMMChildOf'+(d.parent ? d.parent : '0') +' vboxVMMChildDepth'+depth)
+ .contextMenu({
+ menu: vmmCMenu.menuId(),
+ menusetup : function(el) {
+ if(!$(el).hasClass('vboxListItemSelected')) $(el).children().first().trigger('click');
+ }
+ },vmmCMenu.menuClickCallback);
+
+
+ if(d.children && d.children.length && !hideDiff) $(tr).addClass('vboxVMMParent');
+ if(d.parent) $(tr).addClass('vboxHidden').attr('style','display: none');
+
+ /* Expand / collapse button and/or spacers */
+ var td = $('<td />').addClass('vboxHoverFirst');
+
+ // Add spacer image to pad for depth
+ if(depth) {
+ for(var i = 0; i < depth; i++) {
+ $('<img />').attr({'class':'vboxVMMSpacer','src':'images/vbox/blank.gif'}).appendTo(td);
+ }
+ }
+
+ // Show / hide children button
+ if(d.children && d.children.length && !hideDiff) {
+
+ $('<input />').attr({'type':'button','class':'vboxImgButton vboxVMMMediaExpand','style':'background-image: url(images/vbox/arrow_right_10px.png)'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+ $(this).css({'background-image':'url(images/vbox/arrow_down_10px.png)'});
+ $(this).closest('tr').toggleClass('collapsed').trigger('showChildren',true);
+
+ } else {
+ $(this).data('toggleClicked', false);
+ $(this).css({'background-image':'url(images/vbox/arrow_right_10px.png)'});
+ $(this).closest('tr').toggleClass('collapsed').trigger('hideChildren',true);
+ }
+
+ return false;
+
+ }).appendTo(td);
+
+ } else if(depth) {
+ $('<img />').attr({'class':'vboxVMMSpacer','src':'images/vbox/blank.gif'}).appendTo(td);
+ }
+
+ // Title div
+ var span = $('<span />').attr({'id':'vboxVMMMediaTitle-'+d.id}).html($('<div />').html(d.name).text());
+
+ // Add read-only or inaccessible class?
+ if(d.state == 'Inaccessible') {
+ $(span).addClass('vboxMediumInaccessible');
+ } else if(hideDiff !== undefined && d.readOnly) {
+ $(span).addClass('vboxMediumReadOnly');
+ }
+
+ $(td).append(span).appendTo(tr);
+
+ // Set target list
+ //////////////////////
+ var target = '';
+ switch(d.deviceType) {
+ case 'HardDisk':
+ // Logical size column
+ $('<td />').addClass('vboxHoverMid').append($('<span />').html(vboxMbytesConvert(d.logicalSize))).appendTo(tr);
+ target = '#vboxVMMHDList';
+ break;
+ case 'DVD':
+ target = '#vboxVMMCDList';
+ break;
+ case 'Floppy':
+ target = '#vboxVMMFDList';
+ break;
+ }
+
+ // Size column
+ $('<td />').addClass('vboxHoverLast').append($('<div />').html(vboxBytesConvert(d.size))).appendTo(tr);
+
+ /* Show / hide children of this medium */
+ $(tr).on('showChildren',function(e,first){
+
+ var thisid = $(this).data('medium');
+ var trTarget = this;
+
+ if($(this).hasClass('collapsed') || !$(this).hasClass('vboxVMMParent')) return;
+
+ $(trTarget).siblings('tr.vboxVMMChildOf'+thisid).show().removeClass('vboxHidden').trigger('showChildren',false);
+
+ // Only set by original button click
+ if(first) { vboxColorRows($('#vboxVMMHDList')); vboxVMMTableHeaderSetup($('#vmmDisks')); }
+
+ }).on('hideChildren',function(e,first){
+
+ if(!$(this).hasClass('vboxVMMParent')) return;
+
+ $(this).siblings('tr.vboxVMMChildOf'+$(this).data('medium')).hide().addClass('vboxHidden').trigger('hideChildren',false);
+
+ // Only set by original button click
+ if(first) { vboxColorRows($('#vboxVMMHDList')); vboxVMMTableHeaderSetup($('#vmmDisks'));}
+
+
+ }).children().click(function(){
+ $(this).parent().removeClass('vboxListItem vboxHover').addClass('vboxListItemSelected')
+ .siblings().removeClass('vboxListItemSelected').addClass('vboxListItem');
+ $('#vboxVirtualMediaManager').trigger('mediumselect',[$(this).parent()]);
+ });
+
+ $(target).append(tr);
+
+ if(d.children && d.children.length) {
+ if(depth) depth++;
+ else depth = 1;
+ for(var i = 0; i < d.children.length; i++) {
+ vboxVMMAddMedium(d.children[i],depth,hideDiff,(topLevelParent ? topLevelParent : d.id));
+ }
+ }
+}
+
+/* Fill medium tables and info with Medium info */
+function vboxVMMFillMedia(sel) {
+
+ // Remove stub items
+ $('#vboxVMMHDList').children().remove();
+ $('#vboxVMMCDList').children().remove();
+ $('#vboxVMMFDList').children().remove();
+
+ // Set icons
+ $('#vmmDisksIcon').attr('src','images/vbox/hd_16px.png');
+ $('#vmmCDsIcon').attr('src','images/vbox/cd_16px.png');
+ $('#vmmFloppysIcon').attr('src','images/vbox/fd_16px.png');
+
+ var media = $('#vboxPane').data('vboxMedia').sort(function(a,b) {
+ return strnatcasecmp(a.name,b.name);
+ });
+
+ var hideDiff = $('#vboxVirtualMediaManager').data('hideDiff');
+
+ for(var i in media) {
+ vboxVMMAddMedium(media[i],0,hideDiff,media[i].parent);
+ if(media[i].state == 'Inaccessible') {
+ var elm = null;
+ switch(media[i].deviceType) {
+ case 'HardDisk':
+ elm = $('#vmmDisksIcon');
+ break;
+ case 'DVD':
+ elm = $('#vmmCDsIcon');
+ break;
+ default:
+ elm = $('#vmmFloppysIcon');
+ }
+ elm.attr('src','images/vbox/state_aborted_16px.png');
+ }
+
+ }
+
+ vboxVMMTableHeaderSetup($('#vmmDisks'));
+ vboxVMMTableHeaderSetup($('#vmmCDs'));
+ vboxVMMTableHeaderSetup($('#vmmFloppys'));
+
+ // Select medium?
+ if(sel) {
+
+ $('#vboxVMMMedium'+sel).children().first().click();
+
+ } else {
+ $('#vboxVirtualMediaManager').trigger('mediumselect',null);
+ }
+ vboxVMMTableSort($('#vboxVMMHDList'));
+ vboxVMMTableSort($('#vboxVMMFDList'));
+ vboxVMMTableSort($('#vboxVMMCDList'));
+
+
+}
+
+/*
+ *
+ * Sort table according to selected items
+ *
+ */
+function vboxVMMTableSort(t) {
+
+ // Get Selected Heading and sort order
+ ////////////////////////////////////////
+ var ths = $(t).closest('div').siblings('div.vmmTableHead').find('thead').find('th');
+ var cthIndex = 0;
+ var sortOrder = null;
+ for(var i = 0; i < ths.length; i++) {
+ if($(ths[i]).data('sorted')) {
+ cthIndex = i;
+ sortOrder = $(ths[i]).data('sorted');
+ break;
+ }
+ }
+ ths =null;
+
+ // Sort table
+ ///////////////////////
+ $(t).each(function(){
+
+ // Sort function (vboxVMMChildOf0 are top-level)
+ var rows = $(this).find('tr.vboxVMMChildOf0').get();
+ switch(cthIndex) {
+ // Name
+ case 0:
+ rows.sort(function(a,b){
+ return strnatcasecmp($(a).data('mediumname'),$(b).data('mediumname'));
+ });
+ break;
+ // size or logical size
+ default:
+
+ // HD has an extra column for logical size
+
+ // size
+ var sortOpt = ($("#vboxVMMTabs").tabs('option','active') ? '' : 'HD');
+ if(sortOpt == 'HD' && cthIndex == 2 || (sortOpt != 'HD')) {
+ rows.sort(function(a,b){
+ if($(a).data('mediumsize') == $(b).data('mediumsize')) return 0;
+ return (parseInt($(a).data('mediumsize')) > parseInt($(b).data('mediumsize')) ? 1 : -1);
+ });
+ // logical size
+ } else {
+ rows.sort(function(a,b){
+ if($(a).data('mediumlogicalSize') == $(b).data('mediumlogicalSize')) return 0;
+ return (parseInt($(a).data('mediumlogicalSize')) > parseInt($(b).data('mediumlogicalSize')) ? 1 : -1);
+ });
+ }
+ break;
+ }
+ // reverse?
+ if(sortOrder == 'asc') rows.reverse();
+
+ // Append rows and children
+ var target = $(this);
+ $(rows).each(function(){
+ // top-level (parent) medium
+ $(this).detach().appendTo($(target));
+ // Children
+ $(target).find('tr.vboxVMMTopLevel'+($(this).data('medium'))).detach().appendTo($(target));
+ });
+ vboxColorRows(target);
+ });
+
+}
+/*
+ *
+ * Resizing and setup
+ *
+ */
+
+function vboxVMMSizeTable(elm) {
+
+ // Hide table body
+ var TB = $(elm).find('div.vmmTableBody');
+
+ TB.css({'display':'none'});
+
+ // Get height
+ var cH = $(elm).parent().innerHeight() - $(elm).outerHeight(true);
+
+ // Apply to difference in height to table body
+ TB.height(cH-4).css({'display':'','overflow':'auto'});
+
+ // Set table head width
+ vboxVMMTableHeaderSetup(elm);
+
+}
+/* Setup tables */
+function vboxVMMTableHeaderSetup(elm) {
+
+ // Set column width
+
+ // Get each column width
+ var hCols = $(elm).find('div.vmmTableHead').find('tr:eq(0)').children();
+ var tCols = $(elm).find('div.vmmTableBody').find('tbody tr:eq(0)').children();
+ for(var i = 0; i < tCols.length; i++) {
+ $(hCols[i]).width($(tCols[i]).width());
+ }
+
+}
+
+
+/* Init virtual media manager */
+function vboxVMMInit(hideDiff,vmPath) {
+
+ // SEVERE hack-fooery ensues..
+ /////////////////////////////////
+ $('#vboxVirtualMediaManager').parent().on( "dialogresizestart",function(e){
+
+ $('#vboxVMMTabs').css({'height':'auto'});
+ $('#vboxVMMContainer').css({'height':'auto'});
+
+ }).on("dialogresizestop",function(e){
+
+ $('#vmmDisks .vmmTableBody').css({'display':'none'});
+ $('#vmmCDs .vmmTableBody').css({'display':'none'});
+ $('#vmmFloppys .vmmTableBody').css({'display':'none'});
+
+ $('#vboxVMMContainer').height($('#vboxVMMContainer').height());
+ $('#vboxVMMTabs').height($('#vboxVMMContainer').innerHeight());
+
+ vboxVMMSizeTable($('#vmmDisks'));
+ vboxVMMSizeTable($('#vmmCDs'));
+ vboxVMMSizeTable($('#vmmFloppys'));
+ });
+
+ $('#vboxVMMTabList').css({'border-bottom':'0px','margin-bottom':'0px','padding-bottom':'0px'}).detach().appendTo($('#vboxVMMContainerTop').attr({'class':$('#vboxVMMTabs').css({'border-top':'0px','margin-top':'0px','padding-top':'0px'}).removeClass('ui-corner-all').attr('class')}));
+
+ $('#vboxVMMContainer').height($('#vboxVMMContainer').height()).css({'padding':'0px','margin':'0px'});
+ $('#vboxVMMTabs').height($('#vboxVMMContainer').innerHeight()).css({'padding-top':'0px','padding-bottom':'0px','margin-top':'0px','margin-bottom':'0px'});
+
+ // Resize disks table body
+ vboxVMMSizeTable($('#vmmDisks'));
+
+ // Save options for later
+ $('#vboxVirtualMediaManager').data('hideDiff', hideDiff);
+ $('#vboxVirtualMediaManager').data('vmPath', vmPath);
+
+ // Column sorting
+ ////////////////////////////
+ $("#vboxVirtualMediaManager div.vmmTableHead thead th").each(function(thIndex){
+
+ // Skip last column header. It is just kept for spacing
+ if($(this).children('img').length) return true;
+
+ $(this).hover(function(){
+ $(this).children('img').css({'visibility':'visible'});
+ },function(){
+ if($(this).data('sorted')) return;
+ $(this).children('img').css({'visibility':'hidden'});
+
+ }).addClass('vboxVMMSortImgFaded').append(' ').append($('<img />').attr({'src':'images/upArrow.png','style':'visibility:hidden;cursor:pointer'}).click(function(e,sortDefault){
+
+ var p = $(this).parent();
+
+ // Get current sort order and set accordingly
+ //////////////////////////////////////////////
+ switch(p.data('sorted')) {
+ case 'asc':
+ $(this).attr({'src':'images/upArrow.png'}).css({'visibility':'visible'});
+ p.data('sorted','desc');
+ break;
+ case 'desc':
+ $(this).attr({'src':'images/downArrow.png'}).css({'visibility':'visible'});
+ p.data('sorted','asc');
+ break;
+ default:
+ p.data({'sorted':'desc'}).removeClass('vboxVMMSortImgFaded').siblings().data({'sorted':null}).addClass('vboxVMMSortImgFaded').children('img').attr({'src':'images/upArrow.png'}).css({'visibility':'hidden'});
+ break;
+ }
+
+ vboxVMMTableSort($(p).closest('div').siblings('div.vmmTableBody').find('tbody').first());
+
+ }));
+
+ // Default is sort by name
+ if($(this).index() == 0) {
+ $(this).data({'sorted':'desc'}).removeClass('vboxVMMSortImgFaded').children('img').css({'visibility':'visible'});
+ }
+
+
+ });
+
+ vboxVMMFillMedia();
+
+}
+
+
+</script>
+
+
diff --git a/panes/vmmISCSI.html b/panes/vmmISCSI.html
index d259fef..c7fe86d 100644
--- a/panes/vmmISCSI.html
+++ b/panes/vmmISCSI.html
@@ -1,51 +1,51 @@
-<!--
- Add iSCSI disk dialog
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: vmmISCSI.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div id='vboxISCSI'>
- <form name='vboxISCSIForm' style='width:100%;'>
- <table class='vboxVertical' style='width: 100%;'>
- <tr>
- <th><span class='translate'>Server</span>:</th>
- <td><input type='text' name='vboxISCSIServer' class='vboxText' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Port</span>:</th>
- <td><input type='text' name='vboxISCSIPort' class='vboxText' /></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' name='vboxISCSIIntnet' class='vboxCheckbox' /> <span class='translate'>Internal Networking</span></label></td>
- </tr>
- <tr>
- <th><span class='translate'>Target</span>:</th>
- <td><input type='text' name='vboxISCSITarget' class='vboxText' /></td>
- </tr>
- <tr>
- <th><span class='translate'>LUN</span>:</th>
- <td><input type='text' name='vboxISCSILun' class='vboxText' value="0" /></td>
- </tr>
- <tr>
- <th></th>
- <td><label><input type='checkbox' name='vboxISCSILunEnc' class='vboxCheckbox' /> <span class='translate'>Encoded</span></label></td>
- </tr>
- <tr>
- <th><span class='translate'>Username</span>:</th>
- <td><input type='text' name='vboxISCSIUser' class='vboxText' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Password</span>:</th>
- <td><input type='password' name='vboxISCSIPass' class='vboxText' /></td>
- </tr>
- </table>
- </form>
-</div>
-<script type='text/javascript'>
-
-// Translations
-$('#vboxISCSI').find(".translate").html(function(i,h){return trans(h,'vboxISCSI');}).removeClass('translate');
-
+<!--
+ Add iSCSI disk dialog
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: vmmISCSI.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div id='vboxISCSI'>
+ <form name='vboxISCSIForm' style='width:100%;'>
+ <table class='vboxVertical' style='width: 100%;'>
+ <tr>
+ <th><span class='translate'>Server</span>:</th>
+ <td><input type='text' name='vboxISCSIServer' class='vboxText' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Port</span>:</th>
+ <td><input type='text' name='vboxISCSIPort' class='vboxText' /></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' name='vboxISCSIIntnet' class='vboxCheckbox' /> <span class='translate'>Internal Networking</span></label></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Target</span>:</th>
+ <td><input type='text' name='vboxISCSITarget' class='vboxText' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>LUN</span>:</th>
+ <td><input type='text' name='vboxISCSILun' class='vboxText' value="0" /></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td><label><input type='checkbox' name='vboxISCSILunEnc' class='vboxCheckbox' /> <span class='translate'>Encoded</span></label></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Username</span>:</th>
+ <td><input type='text' name='vboxISCSIUser' class='vboxText' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Password</span>:</th>
+ <td><input type='password' name='vboxISCSIPass' class='vboxText' /></td>
+ </tr>
+ </table>
+ </form>
+</div>
+<script type='text/javascript'>
+
+// Translations
+$('#vboxISCSI').find(".translate").html(function(i,h){return trans(h,'vboxISCSI');}).removeClass('translate');
+
</script> \ No newline at end of file
diff --git a/panes/vmmModify.html b/panes/vmmModify.html
index cad0a33..f94b326 100644
--- a/panes/vmmModify.html
+++ b/panes/vmmModify.html
@@ -1,34 +1,34 @@
-<!--
- Modify Medium dialog
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: vmmModify.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<div id='vboxVMMModify'>
-
- <div id='vboxVMMModifyInstructions'></div>
-
- <span class='vboxTableLabel translate'>Choose medium type:</span>
- <div class='vboxBordered'>
- <form name='vboxVMMModifyForm' style='width:100%;'>
- <table class='vboxOptions' style='margin-top: 6px;'>
- <tr>
- <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Normal' id='vbRadioNormal'/> <span>Normal</span></label></td>
- </tr>
- <tr >
- <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Immutable' id='vbRadioImmutable'/> <span>Immutable</span></label></td>
- </tr>
- <tr >
- <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Writethrough' id='vbRadioWritethrough'/> <span>Writethrough</span></label></td>
- </tr>
- <tr >
- <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Shareable' id='vbRadioShareable'/> <span>Shareable</span></label></td>
- </tr>
- <tr >
- <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='MultiAttach' id='vbRadioMultiAttach'/> <span>Multi-attach</span></label></td>
- </tr>
- </table>
- </form>
- </div>
-</div>
+<!--
+ Modify Medium dialog
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: vmmModify.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<div id='vboxVMMModify'>
+
+ <div id='vboxVMMModifyInstructions'></div>
+
+ <span class='vboxTableLabel translate'>Choose medium type:</span>
+ <div class='vboxBordered'>
+ <form name='vboxVMMModifyForm' style='width:100%;'>
+ <table class='vboxOptions' style='margin-top: 6px;'>
+ <tr>
+ <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Normal' id='vbRadioNormal'/> <span>Normal</span></label></td>
+ </tr>
+ <tr >
+ <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Immutable' id='vbRadioImmutable'/> <span>Immutable</span></label></td>
+ </tr>
+ <tr >
+ <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Writethrough' id='vbRadioWritethrough'/> <span>Writethrough</span></label></td>
+ </tr>
+ <tr >
+ <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='Shareable' id='vbRadioShareable'/> <span>Shareable</span></label></td>
+ </tr>
+ <tr >
+ <td><label><input type='radio' class='vboxRadio' name='vmmMType' value='MultiAttach' id='vbRadioMultiAttach'/> <span>Multi-attach</span></label></td>
+ </tr>
+ </table>
+ </form>
+ </div>
+</div>
diff --git a/panes/wizardCloneVM.html b/panes/wizardCloneVM.html
index a7844a6..ea613f7 100644
--- a/panes/wizardCloneVM.html
+++ b/panes/wizardCloneVM.html
@@ -1,128 +1,128 @@
-<!--
-
- Panes for clone virtual machine wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardCloneVM.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardCloneVMStep1' title='New machine name' style='display: none'>
-
- <span id='vboxWizCloneMessage1'></span>
-
- <div class='vboxOptions' style='padding: 6px'>
- <input type='text' class='vboxText' name='machineCloneName' style='width: 95%' />
-
- <p><label><input type='checkbox' class='vboxCheckbox' name='vboxCloneReinitNetwork' checked='checked' />
- <span class='translate'>Reinitialize the MAC address of all network cards</span></label>
- </p>
- </div>
-
-</div>
-
-
-<!-- Step 2 -->
-<div id='wizardCloneVMStep2' title='Clone type' style='display: none'>
-
- <span class='translate'>&lt;p&gt;Please choose the type of clone you wish to create.&lt;/p&gt;&lt;p&gt;If you choose &lt;b&gt;Full clone&lt;/b&gt;, an exact copy (including all virtual hard disk files) of the original virtual machine will be created.&lt;/p&gt;&lt;p&gt;If you choose &lt;b&gt;Linked clone&lt;/b&gt;, a new machine will be created, but the virtual hard disk files will be tied to the virtual hard disk files of original machine and you will not be able to move the new virtual machine to a different computer without moving the original as well.&lt;/p&gt;</span>
-
- <span class='translate' id='vboxCloneVMNewSnap'>&lt;p&gt;If you create a &lt;b&gt;Linked clone&lt;/b&gt; then a new snapshot will be created in the original virtual machine as part of the cloning process.&lt;/p&gt;</span>
-
- <div class='vboxOptions'>
- <table>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' name='vboxCloneType' value='Full' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Full Clone</span></label></td>
- </tr>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='vboxCloneType' value='Linked' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Linked Clone</span></label></td>
- </tr>
- </table>
- </div>
-</div>
-
-<!-- Step 3 -->
-<div id='wizardCloneVMStep3' title='Snapshots' style='display: none'>
-
- <span class='translate'>&lt;p&gt;Please choose which parts of the snapshot tree should be cloned with the machine.&lt;/p&gt;</span>
-
- <p><span class='translate'>&lt;p&gt;If you choose &lt;b&gt;Current machine state&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have no snapshots.&lt;/p&gt;</span>
- <span class='translate' id='wizardCloneVMCurrentAll' style='display: none;'>&lt;p&gt;If you choose &lt;b&gt;Current snapshot tree branch&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.&lt;/p&gt;</span>
- <span class='translate'>&lt;p&gt;If you choose &lt;b&gt;Everything&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.&lt;/p&gt;</span>
- </p>
-
- <div class='vboxOptions'>
- <table>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='vmState' value='MachineState' /> <span class='translate'>Current machine state</span></label></td>
- </tr>
- <tr style='vertical-align: bottom; display:none;' id='vboxCloneCurrentAll'>
- <td><label><input type='radio' class='vboxRadio' name='vmState' value='MachineAndChildStates' /> <span class='translate'>Current snapshot tree branch</span></label></td>
- </tr>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' name='vmState' value='AllStates' /> <span class='translate'>Everything</span></label></td>
- </tr>
- </table>
- </div>
-</div>
-
-
-
-<script type='text/javascript'>
-
-$('#wizardCloneVMStep1').on('show',function(e,wiz){
-
- // Already initialized?
- if($('#wizardCloneVMStep1').data('init') || !wiz.args) return;
-
- $('#wizardCloneVMStep1').data('init',1);
-
- // Hold wizard
- $('#wizardCloneVMStep1').data('wiz',wiz);
-
- // Hold wizard original steps
- $('#wizardCloneVMStep1').data('wizSteps',wiz.steps);
-
- // Hide "new snapshot" message if we're cloning a snapshot
- if(wiz.args && wiz.args.snapshot)
- $('#vboxCloneVMNewSnap').hide();
-
- $('#vboxWizCloneMessage1').html(trans('<p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p>','UIWizardCloneVM').replace('%1',wiz.args.vm.name));
-
-
- if((wiz.args.snapshot && wiz.args.snapshot.children && wiz.args.snapshot.children.length)) {
- $('#wizardCloneVMCurrentAll').show();
- $('#vboxCloneCurrentAll').show();
- }
-
- $(document.forms['frmwizardCloneVM'].elements.machineCloneName).focus();
- document.forms['frmwizardCloneVM'].elements.machineCloneName.value = trans('%1 Clone','UIWizardCloneVMPage1').replace('%1',wiz.args.vm.name);
-
- var inputBox = $('#wizardCloneVMStep1').find('input.vboxText').select();
- setTimeout(inputBox.focus.bind(inputBox),10);
-});
-
-/* When going to step2, make sure a name is entered */
-$('#wizardCloneVMStep2').on('show',function(e,wiz){
-
- document.forms['frmwizardCloneVM'].elements.machineCloneName.value = jQuery.trim(document.forms['frmwizardCloneVM'].elements.machineCloneName.value);
-
- if(!document.forms['frmwizardCloneVM'].elements.machineCloneName.value) {
- // Go back
- wiz.displayStep(1);
- }
-
-
-
-});
-
-function vboxCloneVMUpdateSteps(cval) {
-
- if(cval == 'Linked') {
- $('#wizardCloneVMStep1').data('wiz').setLast();
- } else if($('#wizardCloneVMStep1').data('wizSteps') != $('#wizardCloneVMStep1').data('wiz').steps) {
- $('#wizardCloneVMStep1').data('wiz').unsetLast();
- }
-}
-
-</script>
+<!--
+
+ Panes for clone virtual machine wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardCloneVM.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardCloneVMStep1' title='New machine name' style='display: none'>
+
+ <span id='vboxWizCloneMessage1'></span>
+
+ <div class='vboxOptions' style='padding: 6px'>
+ <input type='text' class='vboxText' name='machineCloneName' style='width: 95%' />
+
+ <p><label><input type='checkbox' class='vboxCheckbox' name='vboxCloneReinitNetwork' checked='checked' />
+ <span class='translate'>Reinitialize the MAC address of all network cards</span></label>
+ </p>
+ </div>
+
+</div>
+
+
+<!-- Step 2 -->
+<div id='wizardCloneVMStep2' title='Clone type' style='display: none'>
+
+ <span class='translate'>&lt;p&gt;Please choose the type of clone you wish to create.&lt;/p&gt;&lt;p&gt;If you choose &lt;b&gt;Full clone&lt;/b&gt;, an exact copy (including all virtual hard disk files) of the original virtual machine will be created.&lt;/p&gt;&lt;p&gt;If you choose &lt;b&gt;Linked clone&lt;/b&gt;, a new machine will be created, but the virtual hard disk files will be tied to the virtual hard disk files of original machine and you will not be able to move the new virtual machine to a different computer without moving the original as well.&lt;/p&gt;</span>
+
+ <span class='translate' id='vboxCloneVMNewSnap'>&lt;p&gt;If you create a &lt;b&gt;Linked clone&lt;/b&gt; then a new snapshot will be created in the original virtual machine as part of the cloning process.&lt;/p&gt;</span>
+
+ <div class='vboxOptions'>
+ <table>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' name='vboxCloneType' value='Full' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Full Clone</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' checked='checked' name='vboxCloneType' value='Linked' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Linked Clone</span></label></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+<!-- Step 3 -->
+<div id='wizardCloneVMStep3' title='Snapshots' style='display: none'>
+
+ <span class='translate'>&lt;p&gt;Please choose which parts of the snapshot tree should be cloned with the machine.&lt;/p&gt;</span>
+
+ <p><span class='translate'>&lt;p&gt;If you choose &lt;b&gt;Current machine state&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have no snapshots.&lt;/p&gt;</span>
+ <span class='translate' id='wizardCloneVMCurrentAll' style='display: none;'>&lt;p&gt;If you choose &lt;b&gt;Current snapshot tree branch&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.&lt;/p&gt;</span>
+ <span class='translate'>&lt;p&gt;If you choose &lt;b&gt;Everything&lt;/b&gt;, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.&lt;/p&gt;</span>
+ </p>
+
+ <div class='vboxOptions'>
+ <table>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' checked='checked' name='vmState' value='MachineState' /> <span class='translate'>Current machine state</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom; display:none;' id='vboxCloneCurrentAll'>
+ <td><label><input type='radio' class='vboxRadio' name='vmState' value='MachineAndChildStates' /> <span class='translate'>Current snapshot tree branch</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' name='vmState' value='AllStates' /> <span class='translate'>Everything</span></label></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+
+
+<script type='text/javascript'>
+
+$('#wizardCloneVMStep1').on('show',function(e,wiz){
+
+ // Already initialized?
+ if($('#wizardCloneVMStep1').data('init') || !wiz.args) return;
+
+ $('#wizardCloneVMStep1').data('init',1);
+
+ // Hold wizard
+ $('#wizardCloneVMStep1').data('wiz',wiz);
+
+ // Hold wizard original steps
+ $('#wizardCloneVMStep1').data('wizSteps',wiz.steps);
+
+ // Hide "new snapshot" message if we're cloning a snapshot
+ if(wiz.args && wiz.args.snapshot)
+ $('#vboxCloneVMNewSnap').hide();
+
+ $('#vboxWizCloneMessage1').html(trans('<p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p>','UIWizardCloneVM').replace('%1',wiz.args.vm.name));
+
+
+ if((wiz.args.snapshot && wiz.args.snapshot.children && wiz.args.snapshot.children.length)) {
+ $('#wizardCloneVMCurrentAll').show();
+ $('#vboxCloneCurrentAll').show();
+ }
+
+ $(document.forms['frmwizardCloneVM'].elements.machineCloneName).focus();
+ document.forms['frmwizardCloneVM'].elements.machineCloneName.value = trans('%1 Clone','UIWizardCloneVMPage1').replace('%1',wiz.args.vm.name);
+
+ var inputBox = $('#wizardCloneVMStep1').find('input.vboxText').select();
+ setTimeout(inputBox.focus.bind(inputBox),10);
+});
+
+/* When going to step2, make sure a name is entered */
+$('#wizardCloneVMStep2').on('show',function(e,wiz){
+
+ document.forms['frmwizardCloneVM'].elements.machineCloneName.value = jQuery.trim(document.forms['frmwizardCloneVM'].elements.machineCloneName.value);
+
+ if(!document.forms['frmwizardCloneVM'].elements.machineCloneName.value) {
+ // Go back
+ wiz.displayStep(1);
+ }
+
+
+
+});
+
+function vboxCloneVMUpdateSteps(cval) {
+
+ if(cval == 'Linked') {
+ $('#wizardCloneVMStep1').data('wiz').setLast();
+ } else if($('#wizardCloneVMStep1').data('wizSteps') != $('#wizardCloneVMStep1').data('wiz').steps) {
+ $('#wizardCloneVMStep1').data('wiz').unsetLast();
+ }
+}
+
+</script>
diff --git a/panes/wizardCloneVMAdvanced.html b/panes/wizardCloneVMAdvanced.html
index 059d2cc..508d2b3 100644
--- a/panes/wizardCloneVMAdvanced.html
+++ b/panes/wizardCloneVMAdvanced.html
@@ -1,100 +1,100 @@
-<!--
-
- Advanced panes for clone virtual machine wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardCloneVMAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardCloneVMStep1' style='display: none'>
-
- <span class='vboxTableLabel translate'>New machine name</span>
- <div class='vboxOptions' style='padding: 6px; padding-top: 8px;'>
- <input type='text' class='vboxText' name='machineCloneName' style='width: 95%' />
- </div>
-
- <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px;'>
- <tr style='vertical-align: top'>
- <td>
- <span class='vboxTableLabel translate'>Clone type</span>
- <div class='vboxOptions'>
- <table style='margin-top: 8px'>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' name='vboxCloneType' value='Full' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Full Clone</span></label></td>
- </tr>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='vboxCloneType' value='Linked' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Linked Clone</span></label></td>
- </tr>
- </table>
- </div>
- </td>
- <td>
- <span class='vboxTableLabel translate'>Snapshots</span>
- <div class='vboxOptions'>
- <table style='margin-top: 8px' class='vboxWizardCloneVMSnapshotOpts'>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' checked='checked' name='vmState' value='MachineState' /> <span class='translate'>Current machine state</span></label></td>
- </tr>
- <tr style='vertical-align: bottom; display:none;' id='vboxCloneCurrentAll'>
- <td><label><input type='radio' class='vboxRadio' name='vmState' value='MachineAndChildStates' /> <span class='translate'>Current snapshot tree branch</span></label></td>
- </tr>
- <tr style='vertical-align: bottom;'>
- <td><label><input type='radio' class='vboxRadio' name='vmState' value='AllStates' /> <span class='translate'>Everything</span></label></td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- </table>
-
- <p><label><input type='checkbox' class='vboxCheckbox' name='vboxCloneReinitNetwork' checked='checked' />
- <span class='translate'>Reinitialize the MAC address of all network cards</span></label>
- </p>
-</div>
-
-
-<script type='text/javascript'>
-
-$('#wizardCloneVMStep1').on('show',function(e,wiz){
-
- // Already initialized?
- if($('#wizardCloneVMStep1').data('init') || !wiz.args) return;
-
- $('#wizardCloneVMStep1').data('init',1);
-
- // Hold wizard
- $('#wizardCloneVMStep1').data('wiz',wiz);
-
- // Hold wizard original steps
- $('#wizardCloneVMStep1').data('wizSteps',wiz.steps);
-
- // Hide "new snapshot" message if we're cloning a snapshot
- if(wiz.args && wiz.args.snapshot)
- $('#vboxCloneVMNewSnap').hide();
-
-
- if((wiz.args.snapshot && wiz.args.snapshot.children && wiz.args.snapshot.children.length)) {
- $('#wizardCloneVMCurrentAll').show();
- $('#vboxCloneCurrentAll').show();
- }
-
- $(document.forms['frmwizardCloneVM'].elements.machineCloneName).focus();
-
- document.forms['frmwizardCloneVM'].elements.machineCloneName.value = trans('%1 Clone','UIWizardCloneVMPage1').replace('%1',wiz.args.vm.name);
-
- var inputBox = $('#wizardCloneVMStep1').find('input.vboxText').select();
- setTimeout(inputBox.focus.bind(inputBox),10);
-});
-
-
-function vboxCloneVMUpdateSteps(cval) {
-
- if(cval == 'Linked') {
- $('#wizardCloneVMStep1').find('table.vboxWizardCloneVMSnapshotOpts').find('tr').addClass('disabled').find('input').prop('disabled', true);
- } else {
- $('#wizardCloneVMStep1').find('table.vboxWizardCloneVMSnapshotOpts').find('tr').removeClass('disabled').find('input').prop('disabled', false);
- }
-}
-
-</script>
+<!--
+
+ Advanced panes for clone virtual machine wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardCloneVMAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardCloneVMStep1' style='display: none'>
+
+ <span class='vboxTableLabel translate'>New machine name</span>
+ <div class='vboxOptions' style='padding: 6px; padding-top: 8px;'>
+ <input type='text' class='vboxText' name='machineCloneName' style='width: 95%' />
+ </div>
+
+ <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px;'>
+ <tr style='vertical-align: top'>
+ <td>
+ <span class='vboxTableLabel translate'>Clone type</span>
+ <div class='vboxOptions'>
+ <table style='margin-top: 8px'>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' name='vboxCloneType' value='Full' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Full Clone</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' checked='checked' name='vboxCloneType' value='Linked' onclick='vboxCloneVMUpdateSteps(this.value)' /> <span class='translate'>Linked Clone</span></label></td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ <td>
+ <span class='vboxTableLabel translate'>Snapshots</span>
+ <div class='vboxOptions'>
+ <table style='margin-top: 8px' class='vboxWizardCloneVMSnapshotOpts'>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' checked='checked' name='vmState' value='MachineState' /> <span class='translate'>Current machine state</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom; display:none;' id='vboxCloneCurrentAll'>
+ <td><label><input type='radio' class='vboxRadio' name='vmState' value='MachineAndChildStates' /> <span class='translate'>Current snapshot tree branch</span></label></td>
+ </tr>
+ <tr style='vertical-align: bottom;'>
+ <td><label><input type='radio' class='vboxRadio' name='vmState' value='AllStates' /> <span class='translate'>Everything</span></label></td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+ <p><label><input type='checkbox' class='vboxCheckbox' name='vboxCloneReinitNetwork' checked='checked' />
+ <span class='translate'>Reinitialize the MAC address of all network cards</span></label>
+ </p>
+</div>
+
+
+<script type='text/javascript'>
+
+$('#wizardCloneVMStep1').on('show',function(e,wiz){
+
+ // Already initialized?
+ if($('#wizardCloneVMStep1').data('init') || !wiz.args) return;
+
+ $('#wizardCloneVMStep1').data('init',1);
+
+ // Hold wizard
+ $('#wizardCloneVMStep1').data('wiz',wiz);
+
+ // Hold wizard original steps
+ $('#wizardCloneVMStep1').data('wizSteps',wiz.steps);
+
+ // Hide "new snapshot" message if we're cloning a snapshot
+ if(wiz.args && wiz.args.snapshot)
+ $('#vboxCloneVMNewSnap').hide();
+
+
+ if((wiz.args.snapshot && wiz.args.snapshot.children && wiz.args.snapshot.children.length)) {
+ $('#wizardCloneVMCurrentAll').show();
+ $('#vboxCloneCurrentAll').show();
+ }
+
+ $(document.forms['frmwizardCloneVM'].elements.machineCloneName).focus();
+
+ document.forms['frmwizardCloneVM'].elements.machineCloneName.value = trans('%1 Clone','UIWizardCloneVMPage1').replace('%1',wiz.args.vm.name);
+
+ var inputBox = $('#wizardCloneVMStep1').find('input.vboxText').select();
+ setTimeout(inputBox.focus.bind(inputBox),10);
+});
+
+
+function vboxCloneVMUpdateSteps(cval) {
+
+ if(cval == 'Linked') {
+ $('#wizardCloneVMStep1').find('table.vboxWizardCloneVMSnapshotOpts').find('tr').addClass('disabled').find('input').prop('disabled', true);
+ } else {
+ $('#wizardCloneVMStep1').find('table.vboxWizardCloneVMSnapshotOpts').find('tr').removeClass('disabled').find('input').prop('disabled', false);
+ }
+}
+
+</script>
diff --git a/panes/wizardCopyHD.html b/panes/wizardCopyHD.html
index 657a2d3..e19d0fb 100644
--- a/panes/wizardCopyHD.html
+++ b/panes/wizardCopyHD.html
@@ -1,245 +1,245 @@
-<!--
-
- Panes for copy hard disk wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardCopyHD.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardCopyHDStep1' title='Hard disk to copy' style='display: none'>
-
- <span class='translate'>&lt;p&gt;Please select the virtual hard disk file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.&lt;/p&gt;</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>
-</div>
-
-
-<!-- Step 2 -->
-<div id='wizardCopyHDStep2' 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='copyHDFileType' 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='copyHDFileType' 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='copyHDFileType' value='vhd' /> <span class='translate'>VHD (Virtual Hard Disk)</span></label></td>
- </tr>
-
- </table>
- </div>
-
-</div>
-
-
-<!-- Step 3 -->
-<div id='wizardCopyHDStep3' 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'>&lt;p&gt;A &lt;b&gt;dynamically allocated&lt;/b&gt; hard disk file will only use space on your physical hard disk as it fills up (up to a maximum &lt;b&gt;fixed size&lt;/b&gt;), although it will not shrink again automatically when space on it is freed.&lt;/p&gt;</span>
-
- <span class='translate vboxCreateFixed'>&lt;p&gt;A &lt;b&gt;fixed size&lt;/b&gt; hard disk file may take longer to create on some systems but is often faster to use.&lt;/p&gt;</span>
-
- <span class='translate vboxCreateSplit2G'>&lt;p&gt;You can also choose to &lt;b&gt;split&lt;/b&gt; 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 4 -->
-<div id='wizardCopyHDStep4' title='New hard disk to create' 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='wizardCopyHDLocation' style='width: 100%'/>
- </td>
- <td style='width: 1%;' id='newVMDiskVMMDest'></td>
- </tr>
- </table>
- </div>
-
-</div>
-
-<script type='text/javascript'>
-
-
-// Fill HD type options
-var vboxHDTypesTbl = $('#wizardCopyHDStep2').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='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 disk button */
-new vboxToolbarSingle({button: {
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a virtual hard disk 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 disk 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);
-
-});
-
-$('#wizardCopyHDStep2').on('show',function(e,wiz){
- wiz._lastStep = 2;
-});
-$('#wizardCopyHDStep4').on('show',function(e,wiz){
- wiz._lastStep = 4;
-});
-
-/* WHen showing step 3, show / hide split option */
-$('#wizardCopyHDStep3').on('show',function(e,wiz){
-
- 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) {
- $('#wizardCopyHDStep3').find('.vbox'+capOpts[i]).hide();
- } else {
- $('#wizardCopyHDStep3').find('.vbox'+capOpts[i]).show();
- }
- }
-
- // Select first visible option
- $('#wizardCopyHDStep3').find('tr:visible').first().find('input').prop('checked',true);
-
- if($('#wizardCopyHDStep3').find('tr:visible').length == 1) {
- if(wiz._lastStep == 2) wiz.displayStep(4);
- else if(wiz._lastStep == 4) wiz.displayStep(2);
- }
-});
-
-
-</script>
+<!--
+
+ Panes for copy hard disk wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardCopyHD.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardCopyHDStep1' title='Hard disk to copy' style='display: none'>
+
+ <span class='translate'>&lt;p&gt;Please select the virtual hard disk file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.&lt;/p&gt;</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>
+</div>
+
+
+<!-- Step 2 -->
+<div id='wizardCopyHDStep2' 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='copyHDFileType' 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='copyHDFileType' 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='copyHDFileType' value='vhd' /> <span class='translate'>VHD (Virtual Hard Disk)</span></label></td>
+ </tr>
+
+ </table>
+ </div>
+
+</div>
+
+
+<!-- Step 3 -->
+<div id='wizardCopyHDStep3' 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'>&lt;p&gt;A &lt;b&gt;dynamically allocated&lt;/b&gt; hard disk file will only use space on your physical hard disk as it fills up (up to a maximum &lt;b&gt;fixed size&lt;/b&gt;), although it will not shrink again automatically when space on it is freed.&lt;/p&gt;</span>
+
+ <span class='translate vboxCreateFixed'>&lt;p&gt;A &lt;b&gt;fixed size&lt;/b&gt; hard disk file may take longer to create on some systems but is often faster to use.&lt;/p&gt;</span>
+
+ <span class='translate vboxCreateSplit2G'>&lt;p&gt;You can also choose to &lt;b&gt;split&lt;/b&gt; 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 4 -->
+<div id='wizardCopyHDStep4' title='New hard disk to create' 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='wizardCopyHDLocation' style='width: 100%'/>
+ </td>
+ <td style='width: 1%;' id='newVMDiskVMMDest'></td>
+ </tr>
+ </table>
+ </div>
+
+</div>
+
+<script type='text/javascript'>
+
+
+// Fill HD type options
+var vboxHDTypesTbl = $('#wizardCopyHDStep2').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='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 disk button */
+new vboxToolbarSingle({button: {
+ 'name' : 'mselecthdbtn',
+ 'label' : 'Choose a virtual hard disk 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 disk 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);
+
+});
+
+$('#wizardCopyHDStep2').on('show',function(e,wiz){
+ wiz._lastStep = 2;
+});
+$('#wizardCopyHDStep4').on('show',function(e,wiz){
+ wiz._lastStep = 4;
+});
+
+/* WHen showing step 3, show / hide split option */
+$('#wizardCopyHDStep3').on('show',function(e,wiz){
+
+ 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) {
+ $('#wizardCopyHDStep3').find('.vbox'+capOpts[i]).hide();
+ } else {
+ $('#wizardCopyHDStep3').find('.vbox'+capOpts[i]).show();
+ }
+ }
+
+ // Select first visible option
+ $('#wizardCopyHDStep3').find('tr:visible').first().find('input').prop('checked',true);
+
+ if($('#wizardCopyHDStep3').find('tr:visible').length == 1) {
+ if(wiz._lastStep == 2) wiz.displayStep(4);
+ else if(wiz._lastStep == 4) wiz.displayStep(2);
+ }
+});
+
+
+</script>
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>
diff --git a/panes/wizardExportAppliance.html b/panes/wizardExportAppliance.html
index ea2bcf0..4bbcd9a 100644
--- a/panes/wizardExportAppliance.html
+++ b/panes/wizardExportAppliance.html
@@ -1,340 +1,340 @@
-<!--
-
- Export appliance wizard panes. Logic in vboxWizard() class
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardExportAppliance.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardExportApplianceStep1' title='Virtual machines to export' style='display: none'>
-
- <span class='translate'>&lt;p&gt;Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.&lt;/p&gt;</span>
-
- <div id='vboxExportAppVMListContainer' style='overflow:auto;padding:0px;margin:0px;' class='vboxBordered'>
- <ul style='width: 100%;margin:0px;' id='vboxExportAppVMList' class='vboxList'>
- <li><img src='images/spinner.gif' /></li>
- </ul>
- </div>
-</div>
-
-
-<!-- Step 2 -->
-<div id='wizardExportApplianceStep2' title='Appliance Export Settings' style='display: none; width: 100%;'>
-<!--
- Just here for translation skipping
- -->
-</div>
-
-<!-- Step 3 -->
-<div id='wizardExportApplianceStep3' title='Appliance settings' style='display: none; width: 100%;'>
-
- <span class='translatep3'>&lt;p&gt;Please choose a filename to export the OVF/OVA to.&lt;/p&gt;&lt;p&gt;If you use an &lt;i&gt;ova&lt;/i&gt; extension, then all the files will be combined into one Open Virtualization Format Archive.&lt;/p&gt;&lt;p&gt;If you use an &lt;i&gt;ovf&lt;/i&gt; extension, several files will be written separately.&lt;/p&gt;&lt;p&gt;Other extensions are not allowed.&lt;/p&gt;</span>
-
- <div class='vboxOptions'>
- <table style='width: 100%;' class='vboxOptions'>
- <tr>
- <th width='1%'><span class='translate'>File:</span></th>
- <td class='vboxFileFolderInput'>
- <input type='text' class='vboxText' name='wizardExportApplianceLocation' />
- <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="wizardExportApplianceBrowseLocation()" />
- </td>
- </tr>
- <tr>
- <th width='1%'><span class='translate'>Format:</span></th>
- <td>
- <select name='wizardExportApplianceFormat'>
- <option value="ovf-0.9">OVF 0.9</option>
- <option value="ovf-1.0" selected>OVF 1.0</option>
- <option value="ovf-2.0">OVF 2.0</option>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <label><input type='checkbox' class='vboxCheckbox' name='wizardExportApplianceManifest'/>
- <span class='translate'>Write Manifest file</span></label>
- </td>
- </tr>
- </table>
-
- </div>
-</div>
-
-<!-- Step 4 -->
-<div id='wizardExportApplianceStep4' title='Appliance settings' style='display: none; width: 100%;'>
-
- <div class='translate' style='margin-bottom:8px; width: 100%'>This is the descriptive information which will be added to the virtual appliance. You can change it by double clicking on individual lines.</div>
-
- <div class='vboxBordered' id='vboxExportPropsContainer' style='overflow: auto' style='width: 100%'>
- <table class='vboxHorizontal' style='width: 100%;'>
- <tbody id='vboxExportProps'>
- </tbody>
- </table>
- </div>
-</div>
-
-
-<script type='text/javascript'>
-
-// On keypress, mark this as changed
-$(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).on('keyup',function(){
- $(this).data('vboxChanged', true);
-});
-
-// Translate step 3
-$('#wizardExportApplianceStep3').find('.translatep3').html(function(i,h){
- return trans($('<span />').html(h).text(),'UIWizardExportAppPageBasic3');
-}).removeClass('translatep3');
-
-// Add format options
-$(document.forms['frmwizardExportAppliance'].wizardExportApplianceFormat).find('option').html(function(i,h){return trans(h,'UIWizardExportApp');});
-
-
-var l = new vboxLoader();
-l.add('vboxGetExportableMachines',function(d){$('#wizardExportApplianceStep1').data('vms',d.responseData);});
-l.onLoad = function() {
- var vms = $('#wizardExportApplianceStep1').data('vms');
- var vmlist = $('#vboxExportAppVMList');
- $(vmlist).children().remove();
- vms.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
- for(var i in vms) {
- var li = $('<li />').data({'vm':vms[i]});
- if(vboxVMStates.isRunning(vms[i]) || vboxVMStates.isPaused(vms[i])) {
- $(li).addClass('vboxDisabled disabled');
- } else {
- $(li).click(function(){$(this).toggleClass('vboxListItemSelected');}).addClass('vboxListItem');
- if(vboxChooser.isVMSelected(vms[i].id))
- $(li).addClass('vboxListItemSelected');
- }
- $(li).html("<img style='width: 16px; height: 16px;' src='images/vbox/" + vboxGuestOSTypeIcon(vms[i].OSTypeId) + "' /> " + vms[i].name)
- .data('vboxVMName', vms[i].name);
- $(vmlist).append(li);
- }
- vboxColorRows(vmlist);
-};
-l.run();
-
-
-function wizardExportApplianceStepResizeList() {
-
- // Resize list
- $('#vboxExportAppVMListContainer').hide();
- var h = $('#wizardExportApplianceStep1').parent().innerHeight() - $('#wizardExportApplianceTitle').outerHeight(true);
-
- $('#vboxExportAppVMListContainer').siblings().each(function(){
- h -= $(this).outerHeight(true);
- });
- h-=20;
- $('#vboxExportAppVMListContainer').height(h).show();
-
- // Resize properties
- $('#vboxExportPropsContainer').hide();
- var h = $('#wizardExportApplianceStep3').parent().innerHeight() - $('#wizardExportApplianceTitle').outerHeight(true);
-
- $('#vboxExportPropsContainer').siblings().each(function(){
- h -= $(this).outerHeight(true);
- });
- $('#vboxExportPropsContainer').width($('#vboxExportPropsContainer').parent().innerWidth()).height(h-4).show();
-
-}
-
-$('#wizardExportApplianceStep1').on('show',function(e,wiz){
-
- wizardExportApplianceStepResizeList();
-
- // Keep track of where we were
- $('#wizardExportApplianceStep2').data('fromStep',1);
-
-});
-
-$('#wizardExportApplianceDialog').on('dialogresizestop',wizardExportApplianceStepResizeList);
-
-/*
- *
- * VM Properties to edit / export
- *
- */
-var vboxApplianceProps = {
- 'name' : {'label':'Name','icon':'name'},
- 'product' : {'label':'Product','icon':'description'},
- 'product-url' : {'label':'Product-URL','icon':'description'},
- 'vendor' : {'label':'Vendor','icon':'description'},
- 'vendor-url' : {'label':'Vendor-URL','icon':'description'},
- 'version' : {'label':'Version','icon':'description'},
- 'description' : {'label':'Description','icon':'description','textarea':true},
- 'license' : {'label':'License','icon':'description','textarea':true}
-};
-
-/* Browse for export location */
-function wizardExportApplianceBrowseLocation() {
-
- var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
- if(dsepRegEx == '\\') dsepRegEx += '\\';
-
- // Get current location
- var loc = document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value;
- if(loc.indexOf($('#vboxPane').data('vboxConfig').DSEP) > -1) {
- var r = new RegExp(dsepRegEx+'([^'+dsepRegEx+']*)?$');
- loc = loc.replace(r,'');
- } else {
- // no path set
- loc = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP;
- }
- vboxFileBrowser(loc,function(f){
- if(!f) return;
- // get file name
- var r = new RegExp('.*'+dsepRegEx);
- file = $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val().replace(r,'');
- document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value = f+($('#vboxPane').data('vboxConfig').DSEP)+file;
- $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('vboxChanged', true);
- },true,trans('Select a file to export into','UIWizardExportAppPage3'));
-
-}
-
-/* Skip step 2 */
-$('#wizardExportApplianceStep2').on('show',function(e,wiz){
- if($('#wizardExportApplianceStep2').data('fromStep') == 3)
- wiz.displayStep(1);
- else
- wiz.displayStep(3);
-});
-
-/* When going to step3, determine default OVF name */
-$('#wizardExportApplianceStep3').on('show',function(e,wiz){
-
- // Keep track of where we were
- $('#wizardExportApplianceStep2').data('fromStep',3);
-
- var vmSel = $('#vboxExportAppVMList').children('li.vboxListItemSelected');
-
- /* When going to step3, make sure vms are selected */
- if(!vmSel.length) {
- $('#vboxExportAppVMListContainer').addClass('vboxRequired');
- wiz.displayStep(1);
- return;
- };
-
- $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
-
- if($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('vboxChanged'))
- return;
-
- var name = '';
- if(vmSel.length == 1) {
- name = jQuery.trim($(vmSel[0]).data('vboxVMName'));
- }
-
- if(!name) name = 'Appliance';
-
- name = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
- $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val(name);
-});
-
-$('#wizardExportApplianceStep4').on('show',function(e,wiz){
-
- var vms = $('#vboxExportAppVMList').children('li');
-
- var tbl = $('#vboxExportProps');
-
- for(var i = 0; i < vms.length; i++) {
-
- var vmid = $(vms[i]).data('vm').id;
-
- // Selected ?
- if($(vms[i]).hasClass('vboxListItemSelected')) {
- if($('#vboxAppliance-'+vmid).attr('id')) continue;
- } else {
- $(tbl).children('tr.vboxAppliance-'+vmid).remove();
- continue;
- }
-
- // VM header row
- var trparent = $('<tr />').attr({'id':'vboxAppliance-'+vmid}).addClass('vboxAppliance-'+vmid + ' vboxTableParent');
- var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'}).append(
- $('<div />').css({'font-weight':'bold','padding-left':'6px'}).append(
- $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); margin:0px;margin-right:4px;padding:0px;vspace:0px;hspace:0px;width: 12px; height: 12px;'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
-
- $(this).css({'background-image':'url(images/rightArrow.png)'});
- var tr = $(this).closest('tr');
- $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).hide();
- } else {
-
- $(this).data('toggleClicked', false);
-
- $(this).css({'background-image':'url(images/downArrow.png)'});
- var tr = $(this).closest('tr');
- $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).show();
- }
- })
- ).append(
- //trans('Virtual System X').replace('%s',(i+1))
- $('<div />').text($(vms[i]).data('vm').name).html()
- )
- ).disableSelection();
- $(trparent).append(td).data({'vm':$(vms[i]).data('vm'),'vboxOrder':i}).appendTo(tbl);
-
- // VM properties
- for(var p in vboxApplianceProps) {
-
- var tr = $('<tr />').attr({'class':'vboxAppliance-'+vmid+' vboxChildOf' + i}).data({'vmprop':p});
-
- $('<td />').css({'padding-left':'18px','white-space':'nowrap','width':'1%'}).html('<img src="images/vbox/'+vboxApplianceProps[p].icon+'_16px.png" /> ' + trans(vboxApplianceProps[p].label,'UIApplianceEditorWidget')).appendTo(tr);
-
- $('<td />').attr({'class':'vboxHideOverflow vboxAppProp'+p}).css({'width':'100%','padding-left':'10px','padding-right':'2px'}).html('<div>'+$('<div />').text(($(trparent).data('vm')[p]||'')).html()+'</div>').dblclick((vboxApplianceProps[p].textarea ? vboxExportAppliancePropEditArea : vboxExportAppliancePropEdit )).appendTo(tr);
-
- $(tbl).append(tr);
- }
- }
- vboxColorRows(tbl,false,'vboxTableParent');
-
- wizardExportApplianceStepResizeList();
-
-});
-
-
-/* Edit property that has a text area */
-function vboxExportAppliancePropEditArea(evt,elm) {
-
- vboxExportAppliancePropEditDialog(evt.target, $('<span />').html($(evt.target).html()).text());
-
-}
-/* Edit property dialog */
-function vboxExportAppliancePropEditDialog(elm, defaults) {
-
- var d = $('<div />').css({'display':'none'});
- var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
- $('<textarea />').attr({'id':'vboxExportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val(defaults).appendTo(frm);
- $(d).append(frm);
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- var d = vboxDivOverflowHidden(elm);
- $(d).html($('<div />').text($('#vboxExportAppliancePropTextarea').val()).html());
- $(elm).html('').append(d);
- $(this).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).empty().remove();
- };
- $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(elm).parent().siblings().first().html()});
-
-}
-/* Edit property that has a text box */
-function vboxExportAppliancePropEdit(evt,elm) {
- var input = $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(this).innerWidth()-12)+'px','margin':'0px'}).val($('<div />').html($(this).children().first().html()).text()).blur(function(){
- var v = $(this).val();
- var p = $(this).parent();
- var d = vboxDivOverflowHidden(p);
- $(this).remove();
- $(d).html($('<div />').text(v).html());
- $(p).html('').append(d);
- }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');});
- $(this).html('').append(input).children().first().focus();
-}
-
-</script>
+<!--
+
+ Export appliance wizard panes. Logic in vboxWizard() class
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardExportAppliance.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardExportApplianceStep1' title='Virtual machines to export' style='display: none'>
+
+ <span class='translate'>&lt;p&gt;Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.&lt;/p&gt;</span>
+
+ <div id='vboxExportAppVMListContainer' style='overflow:auto;padding:0px;margin:0px;' class='vboxBordered'>
+ <ul style='width: 100%;margin:0px;' id='vboxExportAppVMList' class='vboxList'>
+ <li><img src='images/spinner.gif' /></li>
+ </ul>
+ </div>
+</div>
+
+
+<!-- Step 2 -->
+<div id='wizardExportApplianceStep2' title='Appliance Export Settings' style='display: none; width: 100%;'>
+<!--
+ Just here for translation skipping
+ -->
+</div>
+
+<!-- Step 3 -->
+<div id='wizardExportApplianceStep3' title='Appliance settings' style='display: none; width: 100%;'>
+
+ <span class='translatep3'>&lt;p&gt;Please choose a filename to export the OVF/OVA to.&lt;/p&gt;&lt;p&gt;If you use an &lt;i&gt;ova&lt;/i&gt; extension, then all the files will be combined into one Open Virtualization Format Archive.&lt;/p&gt;&lt;p&gt;If you use an &lt;i&gt;ovf&lt;/i&gt; extension, several files will be written separately.&lt;/p&gt;&lt;p&gt;Other extensions are not allowed.&lt;/p&gt;</span>
+
+ <div class='vboxOptions'>
+ <table style='width: 100%;' class='vboxOptions'>
+ <tr>
+ <th width='1%'><span class='translate'>File:</span></th>
+ <td class='vboxFileFolderInput'>
+ <input type='text' class='vboxText' name='wizardExportApplianceLocation' />
+ <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="wizardExportApplianceBrowseLocation()" />
+ </td>
+ </tr>
+ <tr>
+ <th width='1%'><span class='translate'>Format:</span></th>
+ <td>
+ <select name='wizardExportApplianceFormat'>
+ <option value="ovf-0.9">OVF 0.9</option>
+ <option value="ovf-1.0" selected>OVF 1.0</option>
+ <option value="ovf-2.0">OVF 2.0</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan='2'>
+ <label><input type='checkbox' class='vboxCheckbox' name='wizardExportApplianceManifest'/>
+ <span class='translate'>Write Manifest file</span></label>
+ </td>
+ </tr>
+ </table>
+
+ </div>
+</div>
+
+<!-- Step 4 -->
+<div id='wizardExportApplianceStep4' title='Appliance settings' style='display: none; width: 100%;'>
+
+ <div class='translate' style='margin-bottom:8px; width: 100%'>This is the descriptive information which will be added to the virtual appliance. You can change it by double clicking on individual lines.</div>
+
+ <div class='vboxBordered' id='vboxExportPropsContainer' style='overflow: auto' style='width: 100%'>
+ <table class='vboxHorizontal' style='width: 100%;'>
+ <tbody id='vboxExportProps'>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+
+<script type='text/javascript'>
+
+// On keypress, mark this as changed
+$(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).on('keyup',function(){
+ $(this).data('vboxChanged', true);
+});
+
+// Translate step 3
+$('#wizardExportApplianceStep3').find('.translatep3').html(function(i,h){
+ return trans($('<span />').html(h).text(),'UIWizardExportAppPageBasic3');
+}).removeClass('translatep3');
+
+// Add format options
+$(document.forms['frmwizardExportAppliance'].wizardExportApplianceFormat).find('option').html(function(i,h){return trans(h,'UIWizardExportApp');});
+
+
+var l = new vboxLoader();
+l.add('vboxGetExportableMachines',function(d){$('#wizardExportApplianceStep1').data('vms',d.responseData);});
+l.onLoad = function() {
+ var vms = $('#wizardExportApplianceStep1').data('vms');
+ var vmlist = $('#vboxExportAppVMList');
+ $(vmlist).children().remove();
+ vms.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
+ for(var i in vms) {
+ var li = $('<li />').data({'vm':vms[i]});
+ if(vboxVMStates.isRunning(vms[i]) || vboxVMStates.isPaused(vms[i])) {
+ $(li).addClass('vboxDisabled disabled');
+ } else {
+ $(li).click(function(){$(this).toggleClass('vboxListItemSelected');}).addClass('vboxListItem');
+ if(vboxChooser.isVMSelected(vms[i].id))
+ $(li).addClass('vboxListItemSelected');
+ }
+ $(li).html("<img style='width: 16px; height: 16px;' src='images/vbox/" + vboxGuestOSTypeIcon(vms[i].OSTypeId) + "' /> " + vms[i].name)
+ .data('vboxVMName', vms[i].name);
+ $(vmlist).append(li);
+ }
+ vboxColorRows(vmlist);
+};
+l.run();
+
+
+function wizardExportApplianceStepResizeList() {
+
+ // Resize list
+ $('#vboxExportAppVMListContainer').hide();
+ var h = $('#wizardExportApplianceStep1').parent().innerHeight() - $('#wizardExportApplianceTitle').outerHeight(true);
+
+ $('#vboxExportAppVMListContainer').siblings().each(function(){
+ h -= $(this).outerHeight(true);
+ });
+ h-=20;
+ $('#vboxExportAppVMListContainer').height(h).show();
+
+ // Resize properties
+ $('#vboxExportPropsContainer').hide();
+ var h = $('#wizardExportApplianceStep3').parent().innerHeight() - $('#wizardExportApplianceTitle').outerHeight(true);
+
+ $('#vboxExportPropsContainer').siblings().each(function(){
+ h -= $(this).outerHeight(true);
+ });
+ $('#vboxExportPropsContainer').width($('#vboxExportPropsContainer').parent().innerWidth()).height(h-4).show();
+
+}
+
+$('#wizardExportApplianceStep1').on('show',function(e,wiz){
+
+ wizardExportApplianceStepResizeList();
+
+ // Keep track of where we were
+ $('#wizardExportApplianceStep2').data('fromStep',1);
+
+});
+
+$('#wizardExportApplianceDialog').on('dialogresizestop',wizardExportApplianceStepResizeList);
+
+/*
+ *
+ * VM Properties to edit / export
+ *
+ */
+var vboxApplianceProps = {
+ 'name' : {'label':'Name','icon':'name'},
+ 'product' : {'label':'Product','icon':'description'},
+ 'product-url' : {'label':'Product-URL','icon':'description'},
+ 'vendor' : {'label':'Vendor','icon':'description'},
+ 'vendor-url' : {'label':'Vendor-URL','icon':'description'},
+ 'version' : {'label':'Version','icon':'description'},
+ 'description' : {'label':'Description','icon':'description','textarea':true},
+ 'license' : {'label':'License','icon':'description','textarea':true}
+};
+
+/* Browse for export location */
+function wizardExportApplianceBrowseLocation() {
+
+ var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
+ if(dsepRegEx == '\\') dsepRegEx += '\\';
+
+ // Get current location
+ var loc = document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value;
+ if(loc.indexOf($('#vboxPane').data('vboxConfig').DSEP) > -1) {
+ var r = new RegExp(dsepRegEx+'([^'+dsepRegEx+']*)?$');
+ loc = loc.replace(r,'');
+ } else {
+ // no path set
+ loc = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP;
+ }
+ vboxFileBrowser(loc,function(f){
+ if(!f) return;
+ // get file name
+ var r = new RegExp('.*'+dsepRegEx);
+ file = $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val().replace(r,'');
+ document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value = f+($('#vboxPane').data('vboxConfig').DSEP)+file;
+ $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('vboxChanged', true);
+ },true,trans('Select a file to export into','UIWizardExportAppPage3'));
+
+}
+
+/* Skip step 2 */
+$('#wizardExportApplianceStep2').on('show',function(e,wiz){
+ if($('#wizardExportApplianceStep2').data('fromStep') == 3)
+ wiz.displayStep(1);
+ else
+ wiz.displayStep(3);
+});
+
+/* When going to step3, determine default OVF name */
+$('#wizardExportApplianceStep3').on('show',function(e,wiz){
+
+ // Keep track of where we were
+ $('#wizardExportApplianceStep2').data('fromStep',3);
+
+ var vmSel = $('#vboxExportAppVMList').children('li.vboxListItemSelected');
+
+ /* When going to step3, make sure vms are selected */
+ if(!vmSel.length) {
+ $('#vboxExportAppVMListContainer').addClass('vboxRequired');
+ wiz.displayStep(1);
+ return;
+ };
+
+ $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
+
+ if($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('vboxChanged'))
+ return;
+
+ var name = '';
+ if(vmSel.length == 1) {
+ name = jQuery.trim($(vmSel[0]).data('vboxVMName'));
+ }
+
+ if(!name) name = 'Appliance';
+
+ name = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
+ $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val(name);
+});
+
+$('#wizardExportApplianceStep4').on('show',function(e,wiz){
+
+ var vms = $('#vboxExportAppVMList').children('li');
+
+ var tbl = $('#vboxExportProps');
+
+ for(var i = 0; i < vms.length; i++) {
+
+ var vmid = $(vms[i]).data('vm').id;
+
+ // Selected ?
+ if($(vms[i]).hasClass('vboxListItemSelected')) {
+ if($('#vboxAppliance-'+vmid).attr('id')) continue;
+ } else {
+ $(tbl).children('tr.vboxAppliance-'+vmid).remove();
+ continue;
+ }
+
+ // VM header row
+ var trparent = $('<tr />').attr({'id':'vboxAppliance-'+vmid}).addClass('vboxAppliance-'+vmid + ' vboxTableParent');
+ var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'}).append(
+ $('<div />').css({'font-weight':'bold','padding-left':'6px'}).append(
+ $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); margin:0px;margin-right:4px;padding:0px;vspace:0px;hspace:0px;width: 12px; height: 12px;'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+
+ $(this).css({'background-image':'url(images/rightArrow.png)'});
+ var tr = $(this).closest('tr');
+ $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).hide();
+ } else {
+
+ $(this).data('toggleClicked', false);
+
+ $(this).css({'background-image':'url(images/downArrow.png)'});
+ var tr = $(this).closest('tr');
+ $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).show();
+ }
+ })
+ ).append(
+ //trans('Virtual System X').replace('%s',(i+1))
+ $('<div />').text($(vms[i]).data('vm').name).html()
+ )
+ ).disableSelection();
+ $(trparent).append(td).data({'vm':$(vms[i]).data('vm'),'vboxOrder':i}).appendTo(tbl);
+
+ // VM properties
+ for(var p in vboxApplianceProps) {
+
+ var tr = $('<tr />').attr({'class':'vboxAppliance-'+vmid+' vboxChildOf' + i}).data({'vmprop':p});
+
+ $('<td />').css({'padding-left':'18px','white-space':'nowrap','width':'1%'}).html('<img src="images/vbox/'+vboxApplianceProps[p].icon+'_16px.png" /> ' + trans(vboxApplianceProps[p].label,'UIApplianceEditorWidget')).appendTo(tr);
+
+ $('<td />').attr({'class':'vboxHideOverflow vboxAppProp'+p}).css({'width':'100%','padding-left':'10px','padding-right':'2px'}).html('<div>'+$('<div />').text(($(trparent).data('vm')[p]||'')).html()+'</div>').dblclick((vboxApplianceProps[p].textarea ? vboxExportAppliancePropEditArea : vboxExportAppliancePropEdit )).appendTo(tr);
+
+ $(tbl).append(tr);
+ }
+ }
+ vboxColorRows(tbl,false,'vboxTableParent');
+
+ wizardExportApplianceStepResizeList();
+
+});
+
+
+/* Edit property that has a text area */
+function vboxExportAppliancePropEditArea(evt,elm) {
+
+ vboxExportAppliancePropEditDialog(evt.target, $('<span />').html($(evt.target).html()).text());
+
+}
+/* Edit property dialog */
+function vboxExportAppliancePropEditDialog(elm, defaults) {
+
+ var d = $('<div />').css({'display':'none'});
+ var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
+ $('<textarea />').attr({'id':'vboxExportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val(defaults).appendTo(frm);
+ $(d).append(frm);
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ var d = vboxDivOverflowHidden(elm);
+ $(d).html($('<div />').text($('#vboxExportAppliancePropTextarea').val()).html());
+ $(elm).html('').append(d);
+ $(this).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).empty().remove();
+ };
+ $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(elm).parent().siblings().first().html()});
+
+}
+/* Edit property that has a text box */
+function vboxExportAppliancePropEdit(evt,elm) {
+ var input = $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(this).innerWidth()-12)+'px','margin':'0px'}).val($('<div />').html($(this).children().first().html()).text()).blur(function(){
+ var v = $(this).val();
+ var p = $(this).parent();
+ var d = vboxDivOverflowHidden(p);
+ $(this).remove();
+ $(d).html($('<div />').text(v).html());
+ $(p).html('').append(d);
+ }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');});
+ $(this).html('').append(input).children().first().focus();
+}
+
+</script>
diff --git a/panes/wizardExportApplianceAdvanced.html b/panes/wizardExportApplianceAdvanced.html
index 5eec268..4a19f3e 100644
--- a/panes/wizardExportApplianceAdvanced.html
+++ b/panes/wizardExportApplianceAdvanced.html
@@ -1,320 +1,320 @@
-<!--
-
- Advanced export appliance wizard panes. Logic in vboxWizard() class
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardExportApplianceAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardExportApplianceStep1' style='display: none;'>
-
- <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px; height: 100%;'>
- <tr style='vertical-align: top'>
- <td style='width: 50%'>
-
- <span class='translate vboxTableLabel'>Virtual machines to export</span>
- <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
-
- <div id='vboxExportAppVMListContainer' style='overflow:auto;padding:0px;margin:0px;' class='vboxBordered'>
- <ul style='width: 100%;margin:0px;' id='vboxExportAppVMList' class='vboxList'>
- <li><img src='images/spinner.gif' /></li>
- </ul>
- </div>
- </td>
- <td>
- <span class='translate vboxTableLabel'>Appliance settings</span>
- <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
-
- <div class='vboxBordered' id='vboxExportPropsContainer' style='overflow: auto' style='width: 100%'>
- <table class='vboxHorizontal' style='width: 100%; font-size: 0.9em'>
- <tbody id='vboxExportProps'>
- </tbody>
- </table>
- </div>
-
- </td>
- </tr>
-
- <tr style='vertical-align: top; height: 1%;'>
- <td colspan='2'>
-
- <table style='width: 100%;' class='vboxOptions'>
- <tr>
- <th width='1%'><span class='translate'>File:</span></th>
- <td class='vboxFileFolderInput'>
- <input type='text' class='vboxText' name='wizardExportApplianceLocation' />
- <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="wizardExportApplianceBrowseLocation()" />
- </td>
- </tr>
- <tr>
- <th width='1%'><span class='translate'>Format:</span></th>
- <td>
- <select name='wizardExportApplianceFormat'>
- <option value="ovf-0.9">OVF 0.9</option>
- <option value="ovf-1.0" selected>OVF 1.0</option>
- <option value="ovf-2.0">OVF 2.0</option>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <label><input type='checkbox' class='vboxCheckbox' name='wizardExportApplianceManifest'/>
- <span class='translate'>Write Manifest file</span></label>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-</div>
-
-
-<script type='text/javascript'>
-
-//Add format options
-$(document.forms['frmwizardExportAppliance'].wizardExportApplianceFormat).find('option').html(function(i,h){return trans(h,'UIWizardExportApp');});
-
-
-// Load list of exportable machines
-var l = new vboxLoader();
-l.add('vboxGetExportableMachines',function(d){$('#wizardExportApplianceStep1').data('vms',d.responseData);});
-l.onLoad = function() {
- var vms = $('#wizardExportApplianceStep1').data('vms');
- var vmlist = $('#vboxExportAppVMList');
- $(vmlist).children().remove();
- vms.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
- for(var i in vms) {
- var li = $('<li />').data({'vm':vms[i]});
- if(vboxVMStates.isPaused(vms[i]) || vboxVMStates.isRunning(vms[i])) {
- $(li).addClass('vboxDisabled disabled');
- } else {
-
- /* Exportable appliance clicked */
- $(li).click(function(){
-
- $(this).toggleClass('vboxListItemSelected');
-
- vboxWizardExportApplianceUpdateList();
- vboxWizardExportApplianceOVFName();
-
-
- }).addClass('vboxListItem');
-
- if(vboxChooser.isVMSelected(vms[i].id))
- $(li).addClass('vboxListItemSelected');
-
- }
- $(li).html("<img style='width: 16px; height: 16px;' src='images/vbox/" + vboxGuestOSTypeIcon(vms[i].OSTypeId) + "' /> " + vms[i].name);
- $(vmlist).append(li);
- }
- vboxColorRows(vmlist);
- vboxWizardExportApplianceUpdateList();
- vboxWizardExportApplianceOVFName();
-
-};
-l.run();
-
-// Resize panes function
-function wizardExportApplianceStepResizeList() {
-
- $('#wizardExportApplianceStep1').hide();
- $('#vboxExportAppVMListContainer').hide();
- $('#vboxExportPropsContainer').hide();
-
- $('#wizardExportApplianceStep1').css({'height':($('#wizardExportApplianceStep1').parent().height()-8)+'px'}).show();
- $('#vboxExportAppVMListContainer').css({'height':($('#vboxExportAppVMListContainer').parent().height()-16)+'px'}).show();
- $('#vboxExportPropsContainer').css({'height':$('#vboxExportAppVMListContainer').css('height'),
- 'width':$('#vboxExportAppVMListContainer').parent().width()}).show();
-
-}
-
-// Resize panes when wizard is resized
-$('#wizardExportApplianceDialog').on('dialogresizestop',wizardExportApplianceStepResizeList);
-//Resize panes after this div is shown
-$('#wizardExportApplianceStep1').on('show', wizardExportApplianceStepResizeList);
-
-
-/*
- *
- * VM Properties to edit / export
- *
- */
-var vboxApplianceProps = {
- 'name' : {'label':'Name','icon':'name'},
- 'product' : {'label':'Product','icon':'description'},
- 'product-url' : {'label':'Product-URL','icon':'description'},
- 'vendor' : {'label':'Vendor','icon':'description'},
- 'vendor-url' : {'label':'Vendor-URL','icon':'description'},
- 'version' : {'label':'Version','icon':'description'},
- 'description' : {'label':'Description','icon':'description','textarea':true},
- 'license' : {'label':'License','icon':'description','textarea':true}
-};
-
-/* Browse for export location */
-function wizardExportApplianceBrowseLocation() {
-
- var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
- if(dsepRegEx == '\\') dsepRegEx += '\\';
-
- // Get current location
- var loc = document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value;
- if(loc.indexOf($('#vboxPane').data('vboxConfig').DSEP) > -1) {
- var r = new RegExp(dsepRegEx+'([^'+dsepRegEx+']*)?$');
- loc = loc.replace(r,'');
- } else {
- // no path set
- loc = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP;
- }
- vboxFileBrowser(loc,function(f){
- if(!f) return;
- // get file name
- var r = new RegExp('.*'+dsepRegEx);
- file = $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val().replace(r,'');
- document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value = f+($('#vboxPane').data('vboxConfig').DSEP)+file;
- },true,trans('Select a file to export into','UIWizardExportAppPage3'));
-
-}
-
-/* Determine default OVF name */
-function vboxWizardExportApplianceOVFName() {
-
- // Keep track of where we were
- var vmSel = $('#vboxExportAppVMList').children('li.vboxListItemSelected');
-
- /* When going to step3, make sure vms are selected */
- if(!vmSel.length) {
- $('#vboxExportAppVMListContainer').addClass('vboxRequired');
- return;
- }
- $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
-
-
- if(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val()) && $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('userChanged'))
- return;
-
- $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('userChanged', false);
-
- var name = '';
- if(vmSel.length > 1) {
- name = 'Appliance';
- } else {
- name = jQuery.trim($(vmSel[0]).text());
- }
-
- // If there is already a folder chosen, don't change it
- if(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val())) {
- name = vboxDirname(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val())) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
- } else {
- name = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
- }
-
- $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val(name);
-
-};
-
-function vboxWizardExportApplianceUpdateList() {
-
- var vms = $('#vboxExportAppVMList').children('li');
-
- var tbl = $('#vboxExportProps');
-
- for(var i = 0; i < vms.length; i++) {
-
- var vmid = $(vms[i]).data('vm').id;
-
- // Selected ?
- if($(vms[i]).hasClass('vboxListItemSelected')) {
- if($('#vboxAppliance-'+vmid).attr('id')) continue;
- } else {
- $(tbl).children('tr.vboxAppliance-'+vmid).remove();
- continue;
- }
-
- // VM header row
- var trparent = $('<tr />').attr({'id':'vboxAppliance-'+vmid}).addClass('vboxAppliance-'+vmid + ' vboxTableParent');
- var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'}).append(
- $('<div />').css({'font-weight':'bold','padding-left':'6px'}).append(
- $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); margin:0px;margin-right:4px;padding:0px;vspace:0px;hspace:0px;width: 12px; height: 12px;'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
-
- $(this).data('toggleClicked', true);
-
- $(this).css({'background-image':'url(images/rightArrow.png)'});
- var tr = $(this).closest('tr');
- $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).hide();
- } else {
-
- $(this).data('toggleClicked', false);
-
- $(this).css({'background-image':'url(images/downArrow.png)'});
- var tr = $(this).closest('tr');
- $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).show();
- }
- })
- ).append(
- //trans('Virtual System X').replace('%s',(i+1))
- $('<div />').text($(vms[i]).data('vm').name).html()
- )
- ).disableSelection();
- $(trparent).append(td).data({'vm':$(vms[i]).data('vm'),'vboxOrder':i}).appendTo(tbl);
-
- // VM properties
- for(var p in vboxApplianceProps) {
-
- var tr = $('<tr />').attr({'class':'vboxAppliance-'+vmid+' vboxChildOf' + i}).data({'vmprop':p});
-
- $('<td />').css({'padding-left':'18px','white-space':'nowrap','width':'1%'}).html('<img src="images/vbox/'+vboxApplianceProps[p].icon+'_16px.png" /> ' + trans(vboxApplianceProps[p].label,'UIApplianceEditorWidget')).appendTo(tr);
-
- $('<td />').attr({'class':'vboxHideOverflow vboxAppProp'+p}).css({'width':'100%','padding-left':'10px','padding-right':'2px'}).html('<div>'+$('<div />').text(($(trparent).data('vm')[p]||'')).html()+'</div>').dblclick((vboxApplianceProps[p].textarea ? vboxExportAppliancePropEditArea : vboxExportAppliancePropEdit )).appendTo(tr);
-
- $(tbl).append(tr);
- }
- }
- vboxColorRows(tbl,false,'vboxTableParent');
-
-
-};
-
-
-/* Edit property that has a text area */
-function vboxExportAppliancePropEditArea(evt,elm) {
- vboxExportAppliancePropEditDialog(evt.target, $('<span />').html($(evt.target).html()).text());
-}
-
-/* Edit property dialog */
-function vboxExportAppliancePropEditDialog(elm, defaults) {
-
- var d = $('<div />').css({'display':'none'});
- var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
- $('<textarea />').attr({'id':'vboxExportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val(defaults).appendTo(frm);
- $(d).append(frm);
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- var d = vboxDivOverflowHidden(elm);
- $(d).html($('<div />').text($('#vboxExportAppliancePropTextarea').val()).html());
- $(elm).html('').append(d);
- $(this).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){
- $(this).empty().remove();
- };
- $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(elm).parent().siblings().first().html()});
-
-}
-/* Edit property that has a text box */
-function vboxExportAppliancePropEdit(evt,elm) {
- var input = $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(this).innerWidth()-12)+'px','margin':'0px'}).val($('<div />').html($(this).children().first().html()).text()).blur(function(){
- var v = $(this).val();
- var p = $(this).parent();
- var d = vboxDivOverflowHidden(p);
- $(this).remove();
- $(d).html($('<div />').text(v).html());
- $(p).html('').append(d);
- }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');});
- $(this).html('').append(input).children().first().focus();
-}
-
-</script>
+<!--
+
+ Advanced export appliance wizard panes. Logic in vboxWizard() class
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardExportApplianceAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardExportApplianceStep1' style='display: none;'>
+
+ <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px; height: 100%;'>
+ <tr style='vertical-align: top'>
+ <td style='width: 50%'>
+
+ <span class='translate vboxTableLabel'>Virtual machines to export</span>
+ <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
+
+ <div id='vboxExportAppVMListContainer' style='overflow:auto;padding:0px;margin:0px;' class='vboxBordered'>
+ <ul style='width: 100%;margin:0px;' id='vboxExportAppVMList' class='vboxList'>
+ <li><img src='images/spinner.gif' /></li>
+ </ul>
+ </div>
+ </td>
+ <td>
+ <span class='translate vboxTableLabel'>Appliance settings</span>
+ <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
+
+ <div class='vboxBordered' id='vboxExportPropsContainer' style='overflow: auto' style='width: 100%'>
+ <table class='vboxHorizontal' style='width: 100%; font-size: 0.9em'>
+ <tbody id='vboxExportProps'>
+ </tbody>
+ </table>
+ </div>
+
+ </td>
+ </tr>
+
+ <tr style='vertical-align: top; height: 1%;'>
+ <td colspan='2'>
+
+ <table style='width: 100%;' class='vboxOptions'>
+ <tr>
+ <th width='1%'><span class='translate'>File:</span></th>
+ <td class='vboxFileFolderInput'>
+ <input type='text' class='vboxText' name='wizardExportApplianceLocation' />
+ <input type="button" class="vboxImgButton" style="background-image: url(images/vbox/select_file_16px.png)" onClick="wizardExportApplianceBrowseLocation()" />
+ </td>
+ </tr>
+ <tr>
+ <th width='1%'><span class='translate'>Format:</span></th>
+ <td>
+ <select name='wizardExportApplianceFormat'>
+ <option value="ovf-0.9">OVF 0.9</option>
+ <option value="ovf-1.0" selected>OVF 1.0</option>
+ <option value="ovf-2.0">OVF 2.0</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan='2'>
+ <label><input type='checkbox' class='vboxCheckbox' name='wizardExportApplianceManifest'/>
+ <span class='translate'>Write Manifest file</span></label>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</div>
+
+
+<script type='text/javascript'>
+
+//Add format options
+$(document.forms['frmwizardExportAppliance'].wizardExportApplianceFormat).find('option').html(function(i,h){return trans(h,'UIWizardExportApp');});
+
+
+// Load list of exportable machines
+var l = new vboxLoader();
+l.add('vboxGetExportableMachines',function(d){$('#wizardExportApplianceStep1').data('vms',d.responseData);});
+l.onLoad = function() {
+ var vms = $('#wizardExportApplianceStep1').data('vms');
+ var vmlist = $('#vboxExportAppVMList');
+ $(vmlist).children().remove();
+ vms.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
+ for(var i in vms) {
+ var li = $('<li />').data({'vm':vms[i]});
+ if(vboxVMStates.isPaused(vms[i]) || vboxVMStates.isRunning(vms[i])) {
+ $(li).addClass('vboxDisabled disabled');
+ } else {
+
+ /* Exportable appliance clicked */
+ $(li).click(function(){
+
+ $(this).toggleClass('vboxListItemSelected');
+
+ vboxWizardExportApplianceUpdateList();
+ vboxWizardExportApplianceOVFName();
+
+
+ }).addClass('vboxListItem');
+
+ if(vboxChooser.isVMSelected(vms[i].id))
+ $(li).addClass('vboxListItemSelected');
+
+ }
+ $(li).html("<img style='width: 16px; height: 16px;' src='images/vbox/" + vboxGuestOSTypeIcon(vms[i].OSTypeId) + "' /> " + vms[i].name);
+ $(vmlist).append(li);
+ }
+ vboxColorRows(vmlist);
+ vboxWizardExportApplianceUpdateList();
+ vboxWizardExportApplianceOVFName();
+
+};
+l.run();
+
+// Resize panes function
+function wizardExportApplianceStepResizeList() {
+
+ $('#wizardExportApplianceStep1').hide();
+ $('#vboxExportAppVMListContainer').hide();
+ $('#vboxExportPropsContainer').hide();
+
+ $('#wizardExportApplianceStep1').css({'height':($('#wizardExportApplianceStep1').parent().height()-8)+'px'}).show();
+ $('#vboxExportAppVMListContainer').css({'height':($('#vboxExportAppVMListContainer').parent().height()-16)+'px'}).show();
+ $('#vboxExportPropsContainer').css({'height':$('#vboxExportAppVMListContainer').css('height'),
+ 'width':$('#vboxExportAppVMListContainer').parent().width()}).show();
+
+}
+
+// Resize panes when wizard is resized
+$('#wizardExportApplianceDialog').on('dialogresizestop',wizardExportApplianceStepResizeList);
+//Resize panes after this div is shown
+$('#wizardExportApplianceStep1').on('show', wizardExportApplianceStepResizeList);
+
+
+/*
+ *
+ * VM Properties to edit / export
+ *
+ */
+var vboxApplianceProps = {
+ 'name' : {'label':'Name','icon':'name'},
+ 'product' : {'label':'Product','icon':'description'},
+ 'product-url' : {'label':'Product-URL','icon':'description'},
+ 'vendor' : {'label':'Vendor','icon':'description'},
+ 'vendor-url' : {'label':'Vendor-URL','icon':'description'},
+ 'version' : {'label':'Version','icon':'description'},
+ 'description' : {'label':'Description','icon':'description','textarea':true},
+ 'license' : {'label':'License','icon':'description','textarea':true}
+};
+
+/* Browse for export location */
+function wizardExportApplianceBrowseLocation() {
+
+ var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
+ if(dsepRegEx == '\\') dsepRegEx += '\\';
+
+ // Get current location
+ var loc = document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value;
+ if(loc.indexOf($('#vboxPane').data('vboxConfig').DSEP) > -1) {
+ var r = new RegExp(dsepRegEx+'([^'+dsepRegEx+']*)?$');
+ loc = loc.replace(r,'');
+ } else {
+ // no path set
+ loc = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP;
+ }
+ vboxFileBrowser(loc,function(f){
+ if(!f) return;
+ // get file name
+ var r = new RegExp('.*'+dsepRegEx);
+ file = $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val().replace(r,'');
+ document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation.value = f+($('#vboxPane').data('vboxConfig').DSEP)+file;
+ },true,trans('Select a file to export into','UIWizardExportAppPage3'));
+
+}
+
+/* Determine default OVF name */
+function vboxWizardExportApplianceOVFName() {
+
+ // Keep track of where we were
+ var vmSel = $('#vboxExportAppVMList').children('li.vboxListItemSelected');
+
+ /* When going to step3, make sure vms are selected */
+ if(!vmSel.length) {
+ $('#vboxExportAppVMListContainer').addClass('vboxRequired');
+ return;
+ }
+ $('#vboxExportAppVMListContainer').removeClass('vboxRequired');
+
+
+ if(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val()) && $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('userChanged'))
+ return;
+
+ $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).data('userChanged', false);
+
+ var name = '';
+ if(vmSel.length > 1) {
+ name = 'Appliance';
+ } else {
+ name = jQuery.trim($(vmSel[0]).text());
+ }
+
+ // If there is already a folder chosen, don't change it
+ if(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val())) {
+ name = vboxDirname(jQuery.trim($(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val())) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
+ } else {
+ name = vboxDirname($('#vboxPane').data('vboxConfig').version.settingsFilePath) + $('#vboxPane').data('vboxConfig').DSEP + name + '.ova';
+ }
+
+ $(document.forms['frmwizardExportAppliance'].elements.wizardExportApplianceLocation).val(name);
+
+};
+
+function vboxWizardExportApplianceUpdateList() {
+
+ var vms = $('#vboxExportAppVMList').children('li');
+
+ var tbl = $('#vboxExportProps');
+
+ for(var i = 0; i < vms.length; i++) {
+
+ var vmid = $(vms[i]).data('vm').id;
+
+ // Selected ?
+ if($(vms[i]).hasClass('vboxListItemSelected')) {
+ if($('#vboxAppliance-'+vmid).attr('id')) continue;
+ } else {
+ $(tbl).children('tr.vboxAppliance-'+vmid).remove();
+ continue;
+ }
+
+ // VM header row
+ var trparent = $('<tr />').attr({'id':'vboxAppliance-'+vmid}).addClass('vboxAppliance-'+vmid + ' vboxTableParent');
+ var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'}).append(
+ $('<div />').css({'font-weight':'bold','padding-left':'6px'}).append(
+ $('<input />').attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); margin:0px;margin-right:4px;padding:0px;vspace:0px;hspace:0px;width: 12px; height: 12px;'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+
+ $(this).data('toggleClicked', true);
+
+ $(this).css({'background-image':'url(images/rightArrow.png)'});
+ var tr = $(this).closest('tr');
+ $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).hide();
+ } else {
+
+ $(this).data('toggleClicked', false);
+
+ $(this).css({'background-image':'url(images/downArrow.png)'});
+ var tr = $(this).closest('tr');
+ $(tr).siblings('tr.vboxChildOf'+$(tr).data('vboxOrder')).show();
+ }
+ })
+ ).append(
+ //trans('Virtual System X').replace('%s',(i+1))
+ $('<div />').text($(vms[i]).data('vm').name).html()
+ )
+ ).disableSelection();
+ $(trparent).append(td).data({'vm':$(vms[i]).data('vm'),'vboxOrder':i}).appendTo(tbl);
+
+ // VM properties
+ for(var p in vboxApplianceProps) {
+
+ var tr = $('<tr />').attr({'class':'vboxAppliance-'+vmid+' vboxChildOf' + i}).data({'vmprop':p});
+
+ $('<td />').css({'padding-left':'18px','white-space':'nowrap','width':'1%'}).html('<img src="images/vbox/'+vboxApplianceProps[p].icon+'_16px.png" /> ' + trans(vboxApplianceProps[p].label,'UIApplianceEditorWidget')).appendTo(tr);
+
+ $('<td />').attr({'class':'vboxHideOverflow vboxAppProp'+p}).css({'width':'100%','padding-left':'10px','padding-right':'2px'}).html('<div>'+$('<div />').text(($(trparent).data('vm')[p]||'')).html()+'</div>').dblclick((vboxApplianceProps[p].textarea ? vboxExportAppliancePropEditArea : vboxExportAppliancePropEdit )).appendTo(tr);
+
+ $(tbl).append(tr);
+ }
+ }
+ vboxColorRows(tbl,false,'vboxTableParent');
+
+
+};
+
+
+/* Edit property that has a text area */
+function vboxExportAppliancePropEditArea(evt,elm) {
+ vboxExportAppliancePropEditDialog(evt.target, $('<span />').html($(evt.target).html()).text());
+}
+
+/* Edit property dialog */
+function vboxExportAppliancePropEditDialog(elm, defaults) {
+
+ var d = $('<div />').css({'display':'none'});
+ var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
+ $('<textarea />').attr({'id':'vboxExportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val(defaults).appendTo(frm);
+ $(d).append(frm);
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ var d = vboxDivOverflowHidden(elm);
+ $(d).html($('<div />').text($('#vboxExportAppliancePropTextarea').val()).html());
+ $(elm).html('').append(d);
+ $(this).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){
+ $(this).empty().remove();
+ };
+ $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(elm).parent().siblings().first().html()});
+
+}
+/* Edit property that has a text box */
+function vboxExportAppliancePropEdit(evt,elm) {
+ var input = $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(this).innerWidth()-12)+'px','margin':'0px'}).val($('<div />').html($(this).children().first().html()).text()).blur(function(){
+ var v = $(this).val();
+ var p = $(this).parent();
+ var d = vboxDivOverflowHidden(p);
+ $(this).remove();
+ $(d).html($('<div />').text(v).html());
+ $(p).html('').append(d);
+ }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');});
+ $(this).html('').append(input).children().first().focus();
+}
+
+</script>
diff --git a/panes/wizardFirstRun.html b/panes/wizardFirstRun.html
index b2c6bac..d6f8365 100644
--- a/panes/wizardFirstRun.html
+++ b/panes/wizardFirstRun.html
@@ -1,78 +1,78 @@
-<!--
-
- Panes for "First Run" wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardFirstRun.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardFirstRunStep1' title='Select start-up disk' style='display: none'>
-
- <span class='translate' id='wizardFirstRunStepWHD'>&lt;p&gt;Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.&lt;/p&gt;&lt;p&gt;The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed using the Devices menu.&lt;/p&gt;</span>
- <span class='translate' id='wizardFirstRunStepNoHD'>&lt;p&gt;Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.&lt;/p&gt;&lt;p&gt;The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.&lt;/p&gt;</span>
-
- <table class='vboxInvisible'>
- <tr style='vertical-align: middle'><td>
- <select id='wizardFirstRunMedia'>
- </select>
- </td>
- <td style='width:1%' id='wizardFirstRunChoose'></td></tr>
- </table>
-</div>
-
-<script type='text/javascript'>
-
-$('#wizardFirstRunStep1').on('show',function(e,wiz){
-
- var hdFound = false;
- for(var i = 0; i < wiz.args.storageControllers.length; i++) {
- for(var a = 0; a < wiz.args.storageControllers[i].mediumAttachments.length; a++) {
- if(wiz.args.storageControllers[i].mediumAttachments[a].type == "HardDisk" &&
- wiz.args.storageControllers[i].mediumAttachments[a].medium != null) {
- hdFound = true;
- break;
- }
- }
- }
-
- $('#wizardFirstRunStepWHD').css({'display':(hdFound ? '' : 'none')});
- $('#wizardFirstRunStepNoHD').css({'display':(hdFound ? 'none' : '')});
-
- function wizardFirstRunFillMedia(sel) {
-
- var cds = vboxMedia.mediaForAttachmentType('DVD');
-
- $('#wizardFirstRunMedia')[0].options = [];
-
- for(var i = 0; i < cds.length; i++) {
- $('#wizardFirstRunMedia')[0].options[i] = new Option(vboxMedia.getName(cds[i]), cds[i].id, (sel && sel == cds[i].id), (sel && sel == cds[i].id));
- }
-
- }
-
- wizardFirstRunFillMedia();
-
- var wizardFirstRunBar = new vboxToolbarSingle({button: {
- /* Add Attachment Button */
- 'name' : 'mselecthdbtnd',
- 'label' : 'Choose a virtual optical disk file...',
- 'language_context': 'UIWizardFirstRun',
- 'icon' : 'select_file',
- 'click' : function () {
- vboxMedia.actions.choose(null,'DVD',function(med){
- if(!med) return;
- wizardFirstRunFillMedia(med.id);
- });
- }
- }});
- wizardFirstRunBar.renderTo('wizardFirstRunChoose');
-
- $('#wizardFirstRunMedia').hide();
- var w = $('#wizardFirstRunMedia').parent().innerWidth();
- $('#wizardFirstRunMedia').css({'width':w+'px'}).show();
-
-
-});
-
-</script>
+<!--
+
+ Panes for "First Run" wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardFirstRun.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardFirstRunStep1' title='Select start-up disk' style='display: none'>
+
+ <span class='translate' id='wizardFirstRunStepWHD'>&lt;p&gt;Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.&lt;/p&gt;&lt;p&gt;The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed using the Devices menu.&lt;/p&gt;</span>
+ <span class='translate' id='wizardFirstRunStepNoHD'>&lt;p&gt;Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.&lt;/p&gt;&lt;p&gt;The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.&lt;/p&gt;</span>
+
+ <table class='vboxInvisible'>
+ <tr style='vertical-align: middle'><td>
+ <select id='wizardFirstRunMedia'>
+ </select>
+ </td>
+ <td style='width:1%' id='wizardFirstRunChoose'></td></tr>
+ </table>
+</div>
+
+<script type='text/javascript'>
+
+$('#wizardFirstRunStep1').on('show',function(e,wiz){
+
+ var hdFound = false;
+ for(var i = 0; i < wiz.args.storageControllers.length; i++) {
+ for(var a = 0; a < wiz.args.storageControllers[i].mediumAttachments.length; a++) {
+ if(wiz.args.storageControllers[i].mediumAttachments[a].type == "HardDisk" &&
+ wiz.args.storageControllers[i].mediumAttachments[a].medium != null) {
+ hdFound = true;
+ break;
+ }
+ }
+ }
+
+ $('#wizardFirstRunStepWHD').css({'display':(hdFound ? '' : 'none')});
+ $('#wizardFirstRunStepNoHD').css({'display':(hdFound ? 'none' : '')});
+
+ function wizardFirstRunFillMedia(sel) {
+
+ var cds = vboxMedia.mediaForAttachmentType('DVD');
+
+ $('#wizardFirstRunMedia')[0].options = [];
+
+ for(var i = 0; i < cds.length; i++) {
+ $('#wizardFirstRunMedia')[0].options[i] = new Option(vboxMedia.getName(cds[i]), cds[i].id, (sel && sel == cds[i].id), (sel && sel == cds[i].id));
+ }
+
+ }
+
+ wizardFirstRunFillMedia();
+
+ var wizardFirstRunBar = new vboxToolbarSingle({button: {
+ /* Add Attachment Button */
+ 'name' : 'mselecthdbtnd',
+ 'label' : 'Choose a virtual optical disk file...',
+ 'language_context': 'UIWizardFirstRun',
+ 'icon' : 'select_file',
+ 'click' : function () {
+ vboxMedia.actions.choose(null,'DVD',function(med){
+ if(!med) return;
+ wizardFirstRunFillMedia(med.id);
+ });
+ }
+ }});
+ wizardFirstRunBar.renderTo('wizardFirstRunChoose');
+
+ $('#wizardFirstRunMedia').hide();
+ var w = $('#wizardFirstRunMedia').parent().innerWidth();
+ $('#wizardFirstRunMedia').css({'width':w+'px'}).show();
+
+
+});
+
+</script>
diff --git a/panes/wizardImportAppliance.html b/panes/wizardImportAppliance.html
index 9112a8c..b9f3563 100644
--- a/panes/wizardImportAppliance.html
+++ b/panes/wizardImportAppliance.html
@@ -1,552 +1,552 @@
-<!--
-
- Panes for import appliance wizard. Logic in vboxWizard() class
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardImportAppliance.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardImportApplianceStep1' title='Appliance to import' style='display: none'>
-
- <span class='translate'>&lt;p&gt;VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.&lt;/p&gt;</span>
-
- <div class='vboxOptions'>
- <table style='width: 100%;' class='vboxOptions'>
- <tr>
- <td style='width: 100%; white-space: nowrap' class='vboxFileFolderInput'>
- <input type='text' class='vboxText' name='wizardImportApplianceLocation' style='width: 100%'/>
- </td>
- <td style='width:1%' id='wizardImportApplianceLocationButton'></td>
- </tr>
- </table>
- </div>
-
-</div>
-
-
-<!-- Step 2 -->
-<div id='wizardImportApplianceStep2' title='Appliance settings' style='display: none; width: 100%;'>
-
- <div class='translate' style='margin-bottom:8px;'>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</div>
-
- <div class='vboxBordered' id='vboxImportPropsContainer' style='overflow: auto;'>
- <table style='width: 100%;' class='vboxHorizontal'>
- <!--
- <thead>
- <tr>
- <th style='text-align: left; width: 1%; padding-left: 10px' class='translate'>Description</th>
- <th style='text-align: left; padding-left: 10px;' class='translate'>Configuration</th>
- </tr>
- </thead>
- -->
- <tbody id='vboxImportProps'>
- </tbody>
- </table>
- </div>
- <div style='margin:2px;margin-top:4px;padding:0px;'><label><input type='checkbox' class='vboxCheckbox' name='vboxImportReinitNetwork' />
- <span class='translateglob'>Reinitialize the MAC address of all network cards</span></label>
- </div>
-
-</div>
-<script type='text/javascript'>
-
-/* Draw button */
-new vboxToolbarSingle({button: {
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a virtual appliance file to import...',
- 'language_context': 'UIWizardImportApp',
- 'icon' : 'select_file',
- 'click' : function () {
- wizardImportApplianceBrowseLocation()
- }
-}}).renderTo('wizardImportApplianceLocationButton');
-
-$('#wizardImportApplianceStep2').find('span.translateglob').html(function(i,h){
- return trans(h,'UIApplianceEditorWidget');
-});
-
-/*
- *
- * VM Properties to edit / import
- *
- */
-var vboxApplianceImportProps = {
- 'Name' : {'label':'Name','icon':'name','edit':'text'},
- 'Description' : {'label':'Description','icon':'description','edit':'textarea'},
- 'OS' : {'label':'Guest OS Type','icon':'os_type','edit':function(elm){
- var input = $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).find('span.vboxApplianceOSTitle').html());
- $(elm).children().hide();
- $(elm).append(input);
- $(elm).children('input:button').first().contextMenu({
- menu: 'vboxOSTypesMenu',
- button: 0,
- mode: 'menu',
- inSpeed : -1,
- outSpeed : -1
- },
- function(a, el, pos, srcEl) {
- $(elm).find('span.vboxApplianceOSTitle').html(vboxSettingsOSTypesObj[a]['description']);
- $(elm).find('img.vboxApplianceOSIcon').attr('src','images/vbox/'+vboxGuestOSTypeIcon(a));
- $(elm).closest('td').data('descValue',a);
- $('#vboxImportProps').trigger('selectProp');
- }).focus();
- $('#vboxImportProps').one('selectProp',function(){
- $(elm).children('input:button').first().hide().siblings().show();
- $(elm).children('input:button').first().remove();
- });
-
- },'display':function(val){
- return $('<span />').append('<img class="vboxApplianceOSIcon" src="images/vbox/'+vboxGuestOSTypeIcon(val)+'" style="height: 16px; width: 16px; float: left; margin-top: 2px; margin-right: 4px; " /> <span class="vboxApplianceOSTitle">' + vboxSettingsOSTypesObj[val].description +'</span>').disableSelection().on('selectstart',function(e){e.preventDefault();return false;});
- }},
- 'CPU' : {'label':'CPU','icon':'cpu','edit':'text','postEdit':function(val,old){
- val = parseInt(val);
- if(isNaN(val)) return old;
- return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestCPUCount,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestCPUCount,val));
- }},
- 'Memory' : {'label':'RAM','icon':'ram','edit':'text','display':function(val){
- return Math.max(parseInt(val),0) + ' ' + trans('MB','VBoxGlobal');
- },'postEdit':function(val,old) {
- val = parseInt(val);
- if(isNaN(val)) return old;
- return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestRAM,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestRAM,val));
- }},
- 'SoundCard' : {'label':'Sound Card','icon':'sound','checkbox':true,'edit':'options','display':function(val){
- return trans(vboxAudioController($('#vboxPane').data('vboxAudioControllerTypes')[val]),'VBoxGlobal');
- }},
- 'CDROM' : {'label':'DVD','icon':'cd','checkbox':true,'edit':'checkbox'},
- 'USBController' : {'label':'USB Controller','icon':'usb','checkbox':true},
- 'NetworkAdapter' : {'label':'Network Adapter','icon':'nw','checkbox':true,'edit':'options','option_offset':-1,'display':function(val){
- return trans(vboxNetworkAdapterType($('#vboxPane').data('vboxNetworkAdapterTypes')[val]),'VBoxGlobal');
- }},
- 'Floppy' : {'label':'Floppy','icon':'floppy','checkbox':true},
- 'HardDiskControllerIDE' : {'label':'Storage Controller (IDE)','icon':'ide','edit':''},
- 'HardDiskControllerSATA' : {'label':'Storage Controller (SATA)','icon':'sata','edit':null},
- 'HardDiskControllerSAS' : {'label':'Storage Controller (SAS)','icon':'scsi','edit':null},
- 'HardDiskControllerSCSI' : {'label':'Storage Controller (SCSI)','icon':'scsi','edit':null},
- 'HardDiskImage' : {'label':'Virtual Disk Image','icon':'hd','edit':'text'}
-};
-
-/*
- *
- * Add Property Options
- *
- */
-// Storage controllers
-var stTypes = vboxStorage.getBusTypes();
-for(var i = 0; i < stTypes.length; i++) {
-
- if(!vboxApplianceImportProps['HardDiskController'+stTypes[i]]) continue;
-
- // Translate value
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['display'] = function(val){return trans(vboxStorageControllerType(val),'VBoxGlobal');};
-
- var ctypes = vboxStorage[stTypes[i]].types;
- if(ctypes.length < 2) continue;
-
- var opts = {};
- for(var a = 0; a < ctypes.length; a++) {
- opts[ctypes[a]] = trans(vboxStorageControllerType(ctypes[a]),'VBoxGlobal');
- }
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['edit'] = 'options';
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['options'] = opts;
-}
-
-vboxApplianceImportProps['NetworkAdapter']['options'] = [];
-vboxApplianceImportProps['SoundCard']['options'] = [];
-
-// Network adapters
-var cs = $('#vboxPane').data('vboxNetworkAdapterTypes');
-for(var i = 1; i < cs.length; i++) {
- vboxApplianceImportProps['NetworkAdapter']['options'][(i-1)] = trans(vboxNetworkAdapterType(cs[i]),'VBoxGlobal');
-}
-// Sound cards
-var cs = $('#vboxPane').data('vboxAudioControllerTypes');
-for(var i = 0; i < cs.length; i++) {
- vboxApplianceImportProps['SoundCard']['options'][i] = trans(vboxAudioController(cs[i]),'VBoxGlobal');
-}
-
-
-// OS Types
-/////////////////////////
-$('ul.vboxOSTypesMenuList').remove();
-
-// shorthand
-var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
-var vboxSettingsOSTypes = {};
-var vboxSettingsOSTypesObj = {};
-
-for(var i in vboxOSTypes) {
-
- // Skip unsupported OS Types
- if(!vboxOSTypes[i].supported) continue;
-
- // create array of os family types
- if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
- vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
- }
-
- vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
-
- vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
-
- // Preload icons
- vboxOSTypes[i].icon = new Image();
- vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
-
-}
-
-var ul = $('<ul />').attr({'id':'vboxOSTypesMenu','class':'contextMenu contextMenuNoBG vboxOSTypesMenuList'});
-for(var i in vboxSettingsOSTypes) {
- var li = $('<li />').html('<a href="#null-'+i+'">'+vboxSettingsOSTypes[i].description+'</a>');
- var ul2 = $('<ul />').addClass('vboxOSTypesMenuList');
- for(var a in vboxSettingsOSTypes[i]['osTypes']) {
- $('<li />').html('<a href="#'+vboxSettingsOSTypes[i]['osTypes'][a]['id']+'"><img style="height: 16px; width:16px; margin-left: -22px; margin-top: 2px; float: left; " src="images/vbox/'+vboxGuestOSTypeIcon(vboxSettingsOSTypes[i]['osTypes'][a]['id'])+'" /> '+vboxSettingsOSTypes[i]['osTypes'][a]['description']+"</a>").appendTo(ul2);
- }
- $(li).append(ul2).appendTo(ul);
-}
-$('#vboxPane').append(ul);
-
-
-
-/* Browse for import location */
-function wizardImportApplianceBrowseLocation() {
-
- var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
- if(dsepRegEx == '\\') dsepRegEx += '\\';
-
- var loc = $('#vboxPane').data('vboxSystemProperties').defaultMachineFolder;
-
- vboxFileBrowser(loc,function(f){
- if(!f) return;
- document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = f;
- },false,trans('Select an appliance to import','UIWizardImportApp'),'images/vbox/os_type_16px.png');
-
-}
-
-/* When going to step2, make sure a file is selected and
- * appliance file was parsed
- */
-$('#wizardImportApplianceStep2').on('show',function(e,wiz){
-
- if(!$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()) {
- $(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).addClass('vboxRequired');
- wiz.displayStep(1);
- return;
- }
- $(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).removeClass('vboxRequired').focus();
-
- wizardImportAppResize();
-
- // Remove any existing VMs from Back / Forward wizard navigation
- $('#vboxImportProps').children().remove();
-
- /* Parse appliance file */
- var l = new vboxLoader();
- l.add('applianceReadInterpret',function(d){
- if(d && d.responseData && d.responseData.descriptions && d.responseData.descriptions.length) { wizardImportApplianceParsed(d.responseData); }
- else if(!d) { vboxAlert(trans('Unkown Error')); wiz.displayStep(1);}
- else { wiz.displayStep(1); } // no data. assume error was displayed
- },{'file':$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()});
- l.run();
-
-});
-
-
-function wizardImportAppResize(){
- // Resize properties
- $('#vboxImportPropsContainer').hide();
- var h = $('#wizardImportApplianceStep2').parent().innerHeight() - $('#wizardImportApplianceTitle').outerHeight(true);
-
- $('#vboxImportPropsContainer').siblings().each(function(){
- h -= $(this).outerHeight(true);
- });
- $('#vboxImportPropsContainer').width($('#vboxImportPropsContainer').parent().innerWidth()).height(h-4).show();
-
-}
-$('#wizardImportApplianceDialog').on('dialogresizestop',wizardImportAppResize);
-
-/* After appliance file is parsed */
-function wizardImportApplianceParsed(d) {
-
- // Remove any existing data
- $('#vboxImportProps').children().remove();
-
- var tbl = $('#vboxImportProps');
- if(!d) d = {'descriptions':$(tbl).data('descriptions')};
- else $(tbl).data('descriptions',d.descriptions);
-
-
- for(var vm = 0; vm < d.descriptions.length; vm++) {
-
- var tr = $('<tr />').data({'vmDesc':d.descriptions[vm]}).attr({'class':'vboxApplianceHeaderRow'});
- var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'});
- $('<input />').data({'vboxOrder':vm}).attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
-
- if(!$(this).data('toggleClicked')) {
- $(this).data('toggleClicked', true);
- $(this).css({'background-image':'url(images/rightArrow.png)'});
- $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','none');
- } else {
- $(this).data('toggleClicked', false);
- $(this).css({'background-image':'url(images/downArrow.png)'});
- $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','');
- }
- }).appendTo(td);
- $(td).append(trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',(vm+1))).appendTo(tr);
- $(tbl).append(tr);
-
- // Hard Disks are handled differently
- var hds = [];
-
- for(var i = 0; i < d.descriptions[vm][0].length; i++) {
-
- var desc = vboxApplianceImportProps[d.descriptions[vm][0][i]];
- if(desc == undefined) continue;
-
- var tr = $('<tr />').data({'descType':d.descriptions[vm][0][i],'descOrder':i}).addClass('vboxChildOf'+vm, ' vboxListItem').attr({'id':'vboxVM-'+vm+'-item-'+i}).click(function(){
- $('#vboxImportProps').find('input').trigger('blur');
- if($(this).hasClass('vboxListItemSelected')) return;
- $(this).siblings('tr.vboxListItemSelected').removeClass('vboxListItemSelected');
- $(this).addClass('vboxListItemSelected');
- $(this).parent().trigger('selectProp',this);
- });
-
- $('<td />').css({'white-space':'nowrap','width':'1%'}).attr({'class':'vbox'+d.descriptions[vm][0][i]}).html('<img src="images/vbox/blank.gif" class="vboxSpacer" style="height:2px;"/><img src="images/vbox/'+desc.icon+'_16px.png" style="height: 16px; width: 16px;"/> ' + trans(desc.label,'UIApplianceEditorWidget')).appendTo(tr);
-
- var td = $('<td />').attr({'class':'vboxHideOverflow'}).css({'padding-left':'10px'});
- if(desc.checkbox) {
- $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop('checked',true).css({'margin-right':'5px'}).click(function(){
- $(this).closest('tr').data('propdisabled',!(this.checked));
- if(this.checked) {
- $(this).siblings().removeClass('vboxDisabled');
- } else {
- $(this).siblings().addClass('vboxDisabled');
- }
- }).appendTo(td);
- }
- var sp = $('<span />').css({'display':'inline-block'}).attr({'class':'vboxImportAppProp'});
- if(desc.display) {
- $(sp).html(desc.display(d.descriptions[vm][3][i]));
- } else {
- $(sp).text(d.descriptions[vm][3][i]);
- }
-
- $(td).data({'descValue':d.descriptions[vm][3][i]}).append(sp).dblclick(function(){
-
- // Edit property function
- var desc = vboxApplianceImportProps[$(this).parent().data('descType')];
-
- // Check for checkbox
- if(desc.checkbox && !$(this).children('input:checkbox').first().prop('checked')) return;
-
- switch(desc.edit) {
- case 'options':
- vboxImportAppliancePropEditOptions(this,desc);
- break;
- case 'text':
- vboxImportAppliancePropEdit(this,desc);
- break;
- case 'textarea':
- vboxImportAppliancePropEditArea(this,desc);
- break;
- default:
- if(typeof desc.edit == 'function') desc.edit(this,desc);
- }
- }).disableSelection().appendTo(tr);
-
- // Hard Disks are handled differently
- if(d.descriptions[vm][0][i] == 'HardDiskImage') {
- var place = d.descriptions[vm][4][i].split(';');
- var con = parseInt(place[0].replace(/.*=/,''));
- var dev = parseInt(place[1].replace(/.*=/,''));
- hds[hds.length] = {'element':tr,'controller':con,'device':dev};
- } else {
- $(tbl).append(tr);
- }
-
- } // </ foreach description item >
-
- // Attach hard disks
- hds.sort(function(a,b){
- if(a.device == b.device) return 0;
- return (a.device < b.device ? 1 : -1); // Yes. Reverse order.
- });
- for(var i = 0; i < hds.length; i++) {
- $('#vboxVM-'+vm+'-item-'+hds[i].controller).after(hds[i].element);
- }
-
- } // </ foreach vm >
-
- vboxColorRows(tbl,false,'vboxApplianceHeaderRow');
-
-
-
- $('#vboxImportProps').disableSelection();
-
- // Check for import warnings
- if(d.warnings && d.warnings.length) {
-
- var div = $('<div />');
- $(div).append(trans('Warnings:','UIApplianceEditorWidget'));
-
- var ul = $('<ul />');
-
- for(var i = 0; i < d.warnings.length; i++) {
- $('<li />').html(d.warnings[i]).appendTo(ul);
- }
- $(div).append(ul);
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){$(this).empty().remove();};
- $(div).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'draggable':true,'buttons':buttons,'title':trans('Warnings:')});
-
- }
-
-
-};
-
-
-
-/*
- *
- * Edit property that has options
- *
- */
-function vboxImportAppliancePropEditOptions(elm,desc) {
-
- var s = $('<select />').attr({'id':'vboxImportAppSelect'}).css({'width':'100%'}).change(function(){
- $(this).parent().data('descValue',$(this).val());
- var txt = this.options[this.selectedIndex].text;
-
- $(this).siblings('span.vboxImportAppProp').text(txt);
-
- });
- var val = $(elm).data('descValue');
- if(desc.option_offset) {
- val = parseInt(val) + parseInt(desc.option_offset);
- val = ''+val;
- }
- selOpt = 0;
- var a = 0;
- for(var i in desc.options) {
- $(s).prop('options').add(new Option(desc.options[i],i,(i == val),(i == val)));
- if(i==val) selOpt = a;
- a++;
- }
- $(s).attr('selectedIndex',selOpt);
- $(elm).children().hide();
- $(elm).append(s);
- $('#vboxImportProps').one('selectProp',function(){
- $('#vboxImportAppSelect').hide().siblings().show();
- $('#vboxImportAppSelect').remove();
- });
-
-}
-
-
-
-/*
- *
- * Edit property that has a text area
- *
- */
-function vboxImportAppliancePropEditArea(elm) {
-
- $(elm).children().hide();
-
- $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val(trans('Edit text','VBoxTextEditor')).click(function(){
- vboxImportAppliancePropEditDialog(elm);
- $('#vboxImportProps').trigger('selectProp');
- }).appendTo(elm);
-
- $(elm).children('input:button').first().focus();
- $('#vboxImportProps').one('selectProp',function(){
- $(elm).children('input:button').first().hide().siblings().show();
- $(elm).children('input:button').first().remove();
- });
-}
-
-/*
- *
- * Edit property dialog
- *
- */
-function vboxImportAppliancePropEditDialog(td) {
-
- var d = $('<div />').css({'display':'none'});
- var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
-
- $('<textarea />').attr({'id':'vboxImportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val($(td).data('descValue')).appendTo(frm);
-
- $(d).append(frm);
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- $(td).data('descValue',$('#vboxImportAppliancePropTextarea').val());
- $(td).children('span.vboxImportAppProp').html($('<div />').text($('#vboxImportAppliancePropTextarea').val()).html());
- $(this).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){$(this).empty().remove();};
- $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(td).prev().html()});
-
-}
-
-/*
- *
- * Edit property that has a text box
- *
- */
-function vboxImportAppliancePropEdit(elm,desc) {
- $(elm).children().hide();
- $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).data('descValue')).blur(function(){
-
- var tbox = this;
-
- var val = (desc.postEdit ? desc.postEdit($(tbox).val(),$(tbox).parent().data('descValue')) : $(tbox).val());
- if(val != $(tbox).parent().data('descValue')) {
- $(tbox).parent().data('descValue',val);
- if(desc.display) {
- $(tbox).siblings('span.vboxImportAppProp').html(desc.display(val));
- } else {
- $(tbox).siblings('span.vboxImportAppProp').text(val);
- }
- $(tbox).parent().data('edited', true);
-
- // Special case for name
- if(desc.label == 'Name') {
-
- // Get ChildOf class
- var r = /(vboxChildOf\d+)/;
- var coClass = r.exec($(tbox).closest('tr').attr('class'));
- coClass = coClass[1];
-
- // Get unedited disk rows
- var diskRows = new Array();
- $.each($(tbox).parent().closest('tr').siblings('.'+coClass), function(i,e){
- if(!$(e).data('edited') && $(e).data('descType') == 'HardDiskImage') {
- diskRows[diskRows.length] = e;
- }
- });
-
- if(diskRows.length) {
- var mfd = new vboxLoader();
- mfd.add('vboxGetComposedMachineFilename',function(d){
- var mfolder = vboxDirname(d.responseData) + $("#vboxPane").data('vboxConfig').DSEP;
- for(var i = 0; i < diskRows.length; i++) {
- var tdc = $(diskRows[i]).children().eq(1);
- var dname = vboxBasename($(tdc).data('descValue'));
- $(tdc).data({'descValue':mfolder + dname}).find('span.vboxImportAppProp').text(mfolder + dname);
- }
- },{'name':val,'group':''});
- mfd.run();
- }
- }
- }
- $(tbox).hide();
- $(tbox).siblings().show();
- $(tbox).remove();
- }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');}).appendTo(elm);
- $(elm).children('input:text').first().focus();
-}
-
-</script>
+<!--
+
+ Panes for import appliance wizard. Logic in vboxWizard() class
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardImportAppliance.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardImportApplianceStep1' title='Appliance to import' style='display: none'>
+
+ <span class='translate'>&lt;p&gt;VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.&lt;/p&gt;</span>
+
+ <div class='vboxOptions'>
+ <table style='width: 100%;' class='vboxOptions'>
+ <tr>
+ <td style='width: 100%; white-space: nowrap' class='vboxFileFolderInput'>
+ <input type='text' class='vboxText' name='wizardImportApplianceLocation' style='width: 100%'/>
+ </td>
+ <td style='width:1%' id='wizardImportApplianceLocationButton'></td>
+ </tr>
+ </table>
+ </div>
+
+</div>
+
+
+<!-- Step 2 -->
+<div id='wizardImportApplianceStep2' title='Appliance settings' style='display: none; width: 100%;'>
+
+ <div class='translate' style='margin-bottom:8px;'>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</div>
+
+ <div class='vboxBordered' id='vboxImportPropsContainer' style='overflow: auto;'>
+ <table style='width: 100%;' class='vboxHorizontal'>
+ <!--
+ <thead>
+ <tr>
+ <th style='text-align: left; width: 1%; padding-left: 10px' class='translate'>Description</th>
+ <th style='text-align: left; padding-left: 10px;' class='translate'>Configuration</th>
+ </tr>
+ </thead>
+ -->
+ <tbody id='vboxImportProps'>
+ </tbody>
+ </table>
+ </div>
+ <div style='margin:2px;margin-top:4px;padding:0px;'><label><input type='checkbox' class='vboxCheckbox' name='vboxImportReinitNetwork' />
+ <span class='translateglob'>Reinitialize the MAC address of all network cards</span></label>
+ </div>
+
+</div>
+<script type='text/javascript'>
+
+/* Draw button */
+new vboxToolbarSingle({button: {
+ 'name' : 'mselecthdbtn',
+ 'label' : 'Choose a virtual appliance file to import...',
+ 'language_context': 'UIWizardImportApp',
+ 'icon' : 'select_file',
+ 'click' : function () {
+ wizardImportApplianceBrowseLocation()
+ }
+}}).renderTo('wizardImportApplianceLocationButton');
+
+$('#wizardImportApplianceStep2').find('span.translateglob').html(function(i,h){
+ return trans(h,'UIApplianceEditorWidget');
+});
+
+/*
+ *
+ * VM Properties to edit / import
+ *
+ */
+var vboxApplianceImportProps = {
+ 'Name' : {'label':'Name','icon':'name','edit':'text'},
+ 'Description' : {'label':'Description','icon':'description','edit':'textarea'},
+ 'OS' : {'label':'Guest OS Type','icon':'os_type','edit':function(elm){
+ var input = $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).find('span.vboxApplianceOSTitle').html());
+ $(elm).children().hide();
+ $(elm).append(input);
+ $(elm).children('input:button').first().contextMenu({
+ menu: 'vboxOSTypesMenu',
+ button: 0,
+ mode: 'menu',
+ inSpeed : -1,
+ outSpeed : -1
+ },
+ function(a, el, pos, srcEl) {
+ $(elm).find('span.vboxApplianceOSTitle').html(vboxSettingsOSTypesObj[a]['description']);
+ $(elm).find('img.vboxApplianceOSIcon').attr('src','images/vbox/'+vboxGuestOSTypeIcon(a));
+ $(elm).closest('td').data('descValue',a);
+ $('#vboxImportProps').trigger('selectProp');
+ }).focus();
+ $('#vboxImportProps').one('selectProp',function(){
+ $(elm).children('input:button').first().hide().siblings().show();
+ $(elm).children('input:button').first().remove();
+ });
+
+ },'display':function(val){
+ return $('<span />').append('<img class="vboxApplianceOSIcon" src="images/vbox/'+vboxGuestOSTypeIcon(val)+'" style="height: 16px; width: 16px; float: left; margin-top: 2px; margin-right: 4px; " /> <span class="vboxApplianceOSTitle">' + vboxSettingsOSTypesObj[val].description +'</span>').disableSelection().on('selectstart',function(e){e.preventDefault();return false;});
+ }},
+ 'CPU' : {'label':'CPU','icon':'cpu','edit':'text','postEdit':function(val,old){
+ val = parseInt(val);
+ if(isNaN(val)) return old;
+ return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestCPUCount,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestCPUCount,val));
+ }},
+ 'Memory' : {'label':'RAM','icon':'ram','edit':'text','display':function(val){
+ return Math.max(parseInt(val),0) + ' ' + trans('MB','VBoxGlobal');
+ },'postEdit':function(val,old) {
+ val = parseInt(val);
+ if(isNaN(val)) return old;
+ return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestRAM,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestRAM,val));
+ }},
+ 'SoundCard' : {'label':'Sound Card','icon':'sound','checkbox':true,'edit':'options','display':function(val){
+ return trans(vboxAudioController($('#vboxPane').data('vboxAudioControllerTypes')[val]),'VBoxGlobal');
+ }},
+ 'CDROM' : {'label':'DVD','icon':'cd','checkbox':true,'edit':'checkbox'},
+ 'USBController' : {'label':'USB Controller','icon':'usb','checkbox':true},
+ 'NetworkAdapter' : {'label':'Network Adapter','icon':'nw','checkbox':true,'edit':'options','option_offset':-1,'display':function(val){
+ return trans(vboxNetworkAdapterType($('#vboxPane').data('vboxNetworkAdapterTypes')[val]),'VBoxGlobal');
+ }},
+ 'Floppy' : {'label':'Floppy','icon':'floppy','checkbox':true},
+ 'HardDiskControllerIDE' : {'label':'Storage Controller (IDE)','icon':'ide','edit':''},
+ 'HardDiskControllerSATA' : {'label':'Storage Controller (SATA)','icon':'sata','edit':null},
+ 'HardDiskControllerSAS' : {'label':'Storage Controller (SAS)','icon':'scsi','edit':null},
+ 'HardDiskControllerSCSI' : {'label':'Storage Controller (SCSI)','icon':'scsi','edit':null},
+ 'HardDiskImage' : {'label':'Virtual Disk Image','icon':'hd','edit':'text'}
+};
+
+/*
+ *
+ * Add Property Options
+ *
+ */
+// Storage controllers
+var stTypes = vboxStorage.getBusTypes();
+for(var i = 0; i < stTypes.length; i++) {
+
+ if(!vboxApplianceImportProps['HardDiskController'+stTypes[i]]) continue;
+
+ // Translate value
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['display'] = function(val){return trans(vboxStorageControllerType(val),'VBoxGlobal');};
+
+ var ctypes = vboxStorage[stTypes[i]].types;
+ if(ctypes.length < 2) continue;
+
+ var opts = {};
+ for(var a = 0; a < ctypes.length; a++) {
+ opts[ctypes[a]] = trans(vboxStorageControllerType(ctypes[a]),'VBoxGlobal');
+ }
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['edit'] = 'options';
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['options'] = opts;
+}
+
+vboxApplianceImportProps['NetworkAdapter']['options'] = [];
+vboxApplianceImportProps['SoundCard']['options'] = [];
+
+// Network adapters
+var cs = $('#vboxPane').data('vboxNetworkAdapterTypes');
+for(var i = 1; i < cs.length; i++) {
+ vboxApplianceImportProps['NetworkAdapter']['options'][(i-1)] = trans(vboxNetworkAdapterType(cs[i]),'VBoxGlobal');
+}
+// Sound cards
+var cs = $('#vboxPane').data('vboxAudioControllerTypes');
+for(var i = 0; i < cs.length; i++) {
+ vboxApplianceImportProps['SoundCard']['options'][i] = trans(vboxAudioController(cs[i]),'VBoxGlobal');
+}
+
+
+// OS Types
+/////////////////////////
+$('ul.vboxOSTypesMenuList').remove();
+
+// shorthand
+var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+var vboxSettingsOSTypes = {};
+var vboxSettingsOSTypesObj = {};
+
+for(var i in vboxOSTypes) {
+
+ // Skip unsupported OS Types
+ if(!vboxOSTypes[i].supported) continue;
+
+ // create array of os family types
+ if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
+ }
+
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
+
+ vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
+
+ // Preload icons
+ vboxOSTypes[i].icon = new Image();
+ vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
+
+}
+
+var ul = $('<ul />').attr({'id':'vboxOSTypesMenu','class':'contextMenu contextMenuNoBG vboxOSTypesMenuList'});
+for(var i in vboxSettingsOSTypes) {
+ var li = $('<li />').html('<a href="#null-'+i+'">'+vboxSettingsOSTypes[i].description+'</a>');
+ var ul2 = $('<ul />').addClass('vboxOSTypesMenuList');
+ for(var a in vboxSettingsOSTypes[i]['osTypes']) {
+ $('<li />').html('<a href="#'+vboxSettingsOSTypes[i]['osTypes'][a]['id']+'"><img style="height: 16px; width:16px; margin-left: -22px; margin-top: 2px; float: left; " src="images/vbox/'+vboxGuestOSTypeIcon(vboxSettingsOSTypes[i]['osTypes'][a]['id'])+'" /> '+vboxSettingsOSTypes[i]['osTypes'][a]['description']+"</a>").appendTo(ul2);
+ }
+ $(li).append(ul2).appendTo(ul);
+}
+$('#vboxPane').append(ul);
+
+
+
+/* Browse for import location */
+function wizardImportApplianceBrowseLocation() {
+
+ var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
+ if(dsepRegEx == '\\') dsepRegEx += '\\';
+
+ var loc = $('#vboxPane').data('vboxSystemProperties').defaultMachineFolder;
+
+ vboxFileBrowser(loc,function(f){
+ if(!f) return;
+ document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = f;
+ },false,trans('Select an appliance to import','UIWizardImportApp'),'images/vbox/os_type_16px.png');
+
+}
+
+/* When going to step2, make sure a file is selected and
+ * appliance file was parsed
+ */
+$('#wizardImportApplianceStep2').on('show',function(e,wiz){
+
+ if(!$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()) {
+ $(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).addClass('vboxRequired');
+ wiz.displayStep(1);
+ return;
+ }
+ $(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).removeClass('vboxRequired').focus();
+
+ wizardImportAppResize();
+
+ // Remove any existing VMs from Back / Forward wizard navigation
+ $('#vboxImportProps').children().remove();
+
+ /* Parse appliance file */
+ var l = new vboxLoader();
+ l.add('applianceReadInterpret',function(d){
+ if(d && d.responseData && d.responseData.descriptions && d.responseData.descriptions.length) { wizardImportApplianceParsed(d.responseData); }
+ else if(!d) { vboxAlert(trans('Unkown Error')); wiz.displayStep(1);}
+ else { wiz.displayStep(1); } // no data. assume error was displayed
+ },{'file':$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()});
+ l.run();
+
+});
+
+
+function wizardImportAppResize(){
+ // Resize properties
+ $('#vboxImportPropsContainer').hide();
+ var h = $('#wizardImportApplianceStep2').parent().innerHeight() - $('#wizardImportApplianceTitle').outerHeight(true);
+
+ $('#vboxImportPropsContainer').siblings().each(function(){
+ h -= $(this).outerHeight(true);
+ });
+ $('#vboxImportPropsContainer').width($('#vboxImportPropsContainer').parent().innerWidth()).height(h-4).show();
+
+}
+$('#wizardImportApplianceDialog').on('dialogresizestop',wizardImportAppResize);
+
+/* After appliance file is parsed */
+function wizardImportApplianceParsed(d) {
+
+ // Remove any existing data
+ $('#vboxImportProps').children().remove();
+
+ var tbl = $('#vboxImportProps');
+ if(!d) d = {'descriptions':$(tbl).data('descriptions')};
+ else $(tbl).data('descriptions',d.descriptions);
+
+
+ for(var vm = 0; vm < d.descriptions.length; vm++) {
+
+ var tr = $('<tr />').data({'vmDesc':d.descriptions[vm]}).attr({'class':'vboxApplianceHeaderRow'});
+ var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'});
+ $('<input />').data({'vboxOrder':vm}).attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
+
+ if(!$(this).data('toggleClicked')) {
+ $(this).data('toggleClicked', true);
+ $(this).css({'background-image':'url(images/rightArrow.png)'});
+ $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','none');
+ } else {
+ $(this).data('toggleClicked', false);
+ $(this).css({'background-image':'url(images/downArrow.png)'});
+ $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','');
+ }
+ }).appendTo(td);
+ $(td).append(trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',(vm+1))).appendTo(tr);
+ $(tbl).append(tr);
+
+ // Hard Disks are handled differently
+ var hds = [];
+
+ for(var i = 0; i < d.descriptions[vm][0].length; i++) {
+
+ var desc = vboxApplianceImportProps[d.descriptions[vm][0][i]];
+ if(desc == undefined) continue;
+
+ var tr = $('<tr />').data({'descType':d.descriptions[vm][0][i],'descOrder':i}).addClass('vboxChildOf'+vm, ' vboxListItem').attr({'id':'vboxVM-'+vm+'-item-'+i}).click(function(){
+ $('#vboxImportProps').find('input').trigger('blur');
+ if($(this).hasClass('vboxListItemSelected')) return;
+ $(this).siblings('tr.vboxListItemSelected').removeClass('vboxListItemSelected');
+ $(this).addClass('vboxListItemSelected');
+ $(this).parent().trigger('selectProp',this);
+ });
+
+ $('<td />').css({'white-space':'nowrap','width':'1%'}).attr({'class':'vbox'+d.descriptions[vm][0][i]}).html('<img src="images/vbox/blank.gif" class="vboxSpacer" style="height:2px;"/><img src="images/vbox/'+desc.icon+'_16px.png" style="height: 16px; width: 16px;"/> ' + trans(desc.label,'UIApplianceEditorWidget')).appendTo(tr);
+
+ var td = $('<td />').attr({'class':'vboxHideOverflow'}).css({'padding-left':'10px'});
+ if(desc.checkbox) {
+ $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop('checked',true).css({'margin-right':'5px'}).click(function(){
+ $(this).closest('tr').data('propdisabled',!(this.checked));
+ if(this.checked) {
+ $(this).siblings().removeClass('vboxDisabled');
+ } else {
+ $(this).siblings().addClass('vboxDisabled');
+ }
+ }).appendTo(td);
+ }
+ var sp = $('<span />').css({'display':'inline-block'}).attr({'class':'vboxImportAppProp'});
+ if(desc.display) {
+ $(sp).html(desc.display(d.descriptions[vm][3][i]));
+ } else {
+ $(sp).text(d.descriptions[vm][3][i]);
+ }
+
+ $(td).data({'descValue':d.descriptions[vm][3][i]}).append(sp).dblclick(function(){
+
+ // Edit property function
+ var desc = vboxApplianceImportProps[$(this).parent().data('descType')];
+
+ // Check for checkbox
+ if(desc.checkbox && !$(this).children('input:checkbox').first().prop('checked')) return;
+
+ switch(desc.edit) {
+ case 'options':
+ vboxImportAppliancePropEditOptions(this,desc);
+ break;
+ case 'text':
+ vboxImportAppliancePropEdit(this,desc);
+ break;
+ case 'textarea':
+ vboxImportAppliancePropEditArea(this,desc);
+ break;
+ default:
+ if(typeof desc.edit == 'function') desc.edit(this,desc);
+ }
+ }).disableSelection().appendTo(tr);
+
+ // Hard Disks are handled differently
+ if(d.descriptions[vm][0][i] == 'HardDiskImage') {
+ var place = d.descriptions[vm][4][i].split(';');
+ var con = parseInt(place[0].replace(/.*=/,''));
+ var dev = parseInt(place[1].replace(/.*=/,''));
+ hds[hds.length] = {'element':tr,'controller':con,'device':dev};
+ } else {
+ $(tbl).append(tr);
+ }
+
+ } // </ foreach description item >
+
+ // Attach hard disks
+ hds.sort(function(a,b){
+ if(a.device == b.device) return 0;
+ return (a.device < b.device ? 1 : -1); // Yes. Reverse order.
+ });
+ for(var i = 0; i < hds.length; i++) {
+ $('#vboxVM-'+vm+'-item-'+hds[i].controller).after(hds[i].element);
+ }
+
+ } // </ foreach vm >
+
+ vboxColorRows(tbl,false,'vboxApplianceHeaderRow');
+
+
+
+ $('#vboxImportProps').disableSelection();
+
+ // Check for import warnings
+ if(d.warnings && d.warnings.length) {
+
+ var div = $('<div />');
+ $(div).append(trans('Warnings:','UIApplianceEditorWidget'));
+
+ var ul = $('<ul />');
+
+ for(var i = 0; i < d.warnings.length; i++) {
+ $('<li />').html(d.warnings[i]).appendTo(ul);
+ }
+ $(div).append(ul);
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){$(this).empty().remove();};
+ $(div).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'draggable':true,'buttons':buttons,'title':trans('Warnings:')});
+
+ }
+
+
+};
+
+
+
+/*
+ *
+ * Edit property that has options
+ *
+ */
+function vboxImportAppliancePropEditOptions(elm,desc) {
+
+ var s = $('<select />').attr({'id':'vboxImportAppSelect'}).css({'width':'100%'}).change(function(){
+ $(this).parent().data('descValue',$(this).val());
+ var txt = this.options[this.selectedIndex].text;
+
+ $(this).siblings('span.vboxImportAppProp').text(txt);
+
+ });
+ var val = $(elm).data('descValue');
+ if(desc.option_offset) {
+ val = parseInt(val) + parseInt(desc.option_offset);
+ val = ''+val;
+ }
+ selOpt = 0;
+ var a = 0;
+ for(var i in desc.options) {
+ $(s).prop('options').add(new Option(desc.options[i],i,(i == val),(i == val)));
+ if(i==val) selOpt = a;
+ a++;
+ }
+ $(s).attr('selectedIndex',selOpt);
+ $(elm).children().hide();
+ $(elm).append(s);
+ $('#vboxImportProps').one('selectProp',function(){
+ $('#vboxImportAppSelect').hide().siblings().show();
+ $('#vboxImportAppSelect').remove();
+ });
+
+}
+
+
+
+/*
+ *
+ * Edit property that has a text area
+ *
+ */
+function vboxImportAppliancePropEditArea(elm) {
+
+ $(elm).children().hide();
+
+ $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val(trans('Edit text','VBoxTextEditor')).click(function(){
+ vboxImportAppliancePropEditDialog(elm);
+ $('#vboxImportProps').trigger('selectProp');
+ }).appendTo(elm);
+
+ $(elm).children('input:button').first().focus();
+ $('#vboxImportProps').one('selectProp',function(){
+ $(elm).children('input:button').first().hide().siblings().show();
+ $(elm).children('input:button').first().remove();
+ });
+}
+
+/*
+ *
+ * Edit property dialog
+ *
+ */
+function vboxImportAppliancePropEditDialog(td) {
+
+ var d = $('<div />').css({'display':'none'});
+ var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
+
+ $('<textarea />').attr({'id':'vboxImportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val($(td).data('descValue')).appendTo(frm);
+
+ $(d).append(frm);
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ $(td).data('descValue',$('#vboxImportAppliancePropTextarea').val());
+ $(td).children('span.vboxImportAppProp').html($('<div />').text($('#vboxImportAppliancePropTextarea').val()).html());
+ $(this).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){$(this).empty().remove();};
+ $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(td).prev().html()});
+
+}
+
+/*
+ *
+ * Edit property that has a text box
+ *
+ */
+function vboxImportAppliancePropEdit(elm,desc) {
+ $(elm).children().hide();
+ $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).data('descValue')).blur(function(){
+
+ var tbox = this;
+
+ var val = (desc.postEdit ? desc.postEdit($(tbox).val(),$(tbox).parent().data('descValue')) : $(tbox).val());
+ if(val != $(tbox).parent().data('descValue')) {
+ $(tbox).parent().data('descValue',val);
+ if(desc.display) {
+ $(tbox).siblings('span.vboxImportAppProp').html(desc.display(val));
+ } else {
+ $(tbox).siblings('span.vboxImportAppProp').text(val);
+ }
+ $(tbox).parent().data('edited', true);
+
+ // Special case for name
+ if(desc.label == 'Name') {
+
+ // Get ChildOf class
+ var r = /(vboxChildOf\d+)/;
+ var coClass = r.exec($(tbox).closest('tr').attr('class'));
+ coClass = coClass[1];
+
+ // Get unedited disk rows
+ var diskRows = new Array();
+ $.each($(tbox).parent().closest('tr').siblings('.'+coClass), function(i,e){
+ if(!$(e).data('edited') && $(e).data('descType') == 'HardDiskImage') {
+ diskRows[diskRows.length] = e;
+ }
+ });
+
+ if(diskRows.length) {
+ var mfd = new vboxLoader();
+ mfd.add('vboxGetComposedMachineFilename',function(d){
+ var mfolder = vboxDirname(d.responseData) + $("#vboxPane").data('vboxConfig').DSEP;
+ for(var i = 0; i < diskRows.length; i++) {
+ var tdc = $(diskRows[i]).children().eq(1);
+ var dname = vboxBasename($(tdc).data('descValue'));
+ $(tdc).data({'descValue':mfolder + dname}).find('span.vboxImportAppProp').text(mfolder + dname);
+ }
+ },{'name':val,'group':''});
+ mfd.run();
+ }
+ }
+ }
+ $(tbox).hide();
+ $(tbox).siblings().show();
+ $(tbox).remove();
+ }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');}).appendTo(elm);
+ $(elm).children('input:text').first().focus();
+}
+
+</script>
diff --git a/panes/wizardImportApplianceAdvanced.html b/panes/wizardImportApplianceAdvanced.html
index 8ff832f..74df797 100644
--- a/panes/wizardImportApplianceAdvanced.html
+++ b/panes/wizardImportApplianceAdvanced.html
@@ -1,536 +1,536 @@
-<!--
-
- Advanced panes for import appliance wizard. Logic in vboxWizard() class
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardImportApplianceAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-<!-- Step 1 -->
-<div id='wizardImportApplianceStep1' style='display: none'>
-
- <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px; height: 100%;'>
- <tr style='vertical-align: top'>
- <td style='height: 1%'>
-
- <span class='translate vboxTableLabel'>Appliance to import</span>
- <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
-
- <input type="button" id='vboxWizardImportApplianceButton' value='Open appliance...' onClick="wizardImportApplianceBrowseLocation()" />
- <input type='hidden' name='wizardImportApplianceLocation' />
- <span id='vboxWizardImportApplianceFilename'> </span>
- </td>
- <tr style='vertical-align: top'>
- <td>
- <div class='vboxBordered' id='vboxImportPropsContainer' style='overflow: auto;'>
- <table style='width: 100%;' class='vboxHorizontal'>
- <!--
- <thead>
- <tr>
- <th style='text-align: left; width: 1%; padding-left: 10px' class='translate'>Description</th>
- <th style='text-align: left; padding-left: 10px;' class='translate'>Configuration</th>
- </tr>
- </thead>
- -->
- <tbody id='vboxImportProps' style='font-size: 0.9em;'>
- </tbody>
- </table>
- </div>
- </td>
- </tr>
- <tr style='vertical-align: top'>
- <td style='height: 1%'>
- <div style='margin:2px;margin-top:4px;padding:0px;'><label><input type='checkbox' class='vboxCheckbox' name='vboxImportReinitNetwork' />
- <span class='translateglob'>Reinitialize the MAC address of all network cards</span></label>
- </div>
- </td>
- </tr>
- </table>
-
-</div>
-
-
-<script type='text/javascript'>
-
-// Translations
-$('#wizardImportApplianceStep1').find('span.translateglob').html(function(i,h){
- return trans(h,'UIApplianceEditorWidget');
-});
-
-$('#vboxWizardImportApplianceButton').val(trans('Choose a virtual appliance file to import...','UIWizardImportApp'));
-
-/*
- *
- * VM Properties to edit / import
- *
- */
-var vboxApplianceImportProps = {
- 'Name' : {'label':'Name','icon':'name','edit':'text'},
- 'Description' : {'label':'Description','icon':'description','edit':'textarea'},
- 'OS' : {'label':'Guest OS Type','icon':'os_type','edit':function(elm){
- var input = $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).find('span.vboxApplianceOSTitle').html());
- $(elm).children().hide();
- $(elm).append(input);
- $(elm).children('input:button').first().contextMenu({
- menu: 'vboxOSTypesMenu',
- button: 0,
- mode: 'menu',
- inSpeed : -1,
- outSpeed : -1
- },
- function(a, el, pos, srcEl) {
- $(elm).find('span.vboxApplianceOSTitle').html(vboxSettingsOSTypesObj[a]['description']);
- $(elm).find('img.vboxApplianceOSIcon').attr('src','images/vbox/'+vboxGuestOSTypeIcon(a));
- $(elm).closest('td').data('descValue',a);
- $('#vboxImportProps').trigger('selectProp');
- }).focus();
- $('#vboxImportProps').one('selectProp',function(){
- $(elm).children('input:button').first().hide().siblings().show();
- $(elm).children('input:button').first().remove();
- });
-
- },'display':function(val){
- return $('<span />').append('<img class="vboxApplianceOSIcon" src="images/vbox/'+vboxGuestOSTypeIcon(val)+'" style="height: 16px; width: 16px; float: left; margin-top: 2px; margin-right: 4px; " /> <span class="vboxApplianceOSTitle">' + vboxSettingsOSTypesObj[val].description +'</span>').disableSelection().on('selectstart',function(e){e.preventDefault();return false;});
- }},
- 'CPU' : {'label':'CPU','icon':'cpu','edit':'text','postEdit':function(val,old){
- val = parseInt(val);
- if(isNaN(val)) return old;
- return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestCPUCount,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestCPUCount,val));
- }},
- 'Memory' : {'label':'RAM','icon':'ram','edit':'text','display':function(val){
- return Math.max(parseInt(val),0) + ' ' + trans('MB','VBoxGlobal');
- },'postEdit':function(val,old) {
- val = parseInt(val);
- if(isNaN(val)) return old;
- return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestRAM,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestRAM,val));
- }},
- 'SoundCard' : {'label':'Sound Card','icon':'sound','checkbox':true,'edit':'options','display':function(val){
- return trans(vboxAudioController($('#vboxPane').data('vboxAudioControllerTypes')[val]),'VBoxGlobal');
- }},
- 'CDROM' : {'label':'DVD','icon':'cd','checkbox':true,'edit':'checkbox'},
- 'USBController' : {'label':'USB Controller','icon':'usb','checkbox':true},
- 'NetworkAdapter' : {'label':'Network Adapter','icon':'nw','checkbox':true,'edit':'options','option_offset':-1,'display':function(val){
- return trans(vboxNetworkAdapterType($('#vboxPane').data('vboxNetworkAdapterTypes')[val]),'VBoxGlobal');
- }},
- 'Floppy' : {'label':'Floppy','icon':'floppy','checkbox':true},
- 'HardDiskControllerIDE' : {'label':'Storage Controller (IDE)','icon':'ide','edit':''},
- 'HardDiskControllerSATA' : {'label':'Storage Controller (SATA)','icon':'sata','edit':null},
- 'HardDiskControllerSAS' : {'label':'Storage Controller (SAS)','icon':'scsi','edit':null},
- 'HardDiskControllerSCSI' : {'label':'Storage Controller (SCSI)','icon':'scsi','edit':null},
- 'HardDiskImage' : {'label':'Virtual Disk Image','icon':'hd','edit':'text'}
-};
-
-/*
- *
- * Add Property Options
- *
- */
-// Storage controllers
-var stTypes = vboxStorage.getBusTypes();
-for(var i = 0; i < stTypes.length; i++) {
-
- if(!vboxApplianceImportProps['HardDiskController'+stTypes[i]]) continue;
-
- // Translate value
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['display'] = function(val){return trans(vboxStorageControllerType(val),'VBoxGlobal');};
-
- var ctypes = vboxStorage[stTypes[i]].types;
- if(ctypes.length < 2) continue;
-
- var opts = {};
- for(var a = 0; a < ctypes.length; a++) {
- opts[ctypes[a]] = trans(vboxStorageControllerType(ctypes[a]),'VBoxGlobal');
- }
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['edit'] = 'options';
- vboxApplianceImportProps['HardDiskController'+stTypes[i]]['options'] = opts;
-}
-
-vboxApplianceImportProps['NetworkAdapter']['options'] = [];
-vboxApplianceImportProps['SoundCard']['options'] = [];
-
-// Network adapters
-var cs = $('#vboxPane').data('vboxNetworkAdapterTypes');
-for(var i = 1; i < cs.length; i++) {
- vboxApplianceImportProps['NetworkAdapter']['options'][(i-1)] = trans(vboxNetworkAdapterType(cs[i]),'VBoxGlobal');
-}
-// Sound cards
-var cs = $('#vboxPane').data('vboxAudioControllerTypes');
-for(var i = 0; i < cs.length; i++) {
- vboxApplianceImportProps['SoundCard']['options'][i] = trans(vboxAudioController(cs[i]),'VBoxGlobal');
-}
-
-
-// OS Types
-/////////////////////////
-$('ul.vboxOSTypesMenuList').remove();
-
-// shorthand
-var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
-var vboxSettingsOSTypes = {};
-var vboxSettingsOSTypesObj = {};
-
-for(var i in vboxOSTypes) {
-
- // Skip unsupported OS Types
- if(!vboxOSTypes[i].supported) continue;
-
- // create array of os family types
- if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
- vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
- }
-
- vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
-
- vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
-
- // Preload icons
- vboxOSTypes[i].icon = new Image();
- vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
-
-}
-
-var ul = $('<ul />').attr({'id':'vboxOSTypesMenu','class':'contextMenu contextMenuNoBG vboxOSTypesMenuList'});
-for(var i in vboxSettingsOSTypes) {
- var li = $('<li />').html('<a href="#null-'+i+'">'+vboxSettingsOSTypes[i].description+'</a>');
- var ul2 = $('<ul />').addClass('vboxOSTypesMenuList');
- for(var a in vboxSettingsOSTypes[i]['osTypes']) {
- $('<li />').html('<a href="#'+vboxSettingsOSTypes[i]['osTypes'][a]['id']+'"><img style="height: 16px; width:16px; margin-left: -22px; margin-top: 2px; float: left; " src="images/vbox/'+vboxGuestOSTypeIcon(vboxSettingsOSTypes[i]['osTypes'][a]['id'])+'" /> '+vboxSettingsOSTypes[i]['osTypes'][a]['description']+"</a>").appendTo(ul2);
- }
- $(li).append(ul2).appendTo(ul);
-}
-$('#vboxPane').append(ul);
-
-
-
-/* Browse for import location */
-function wizardImportApplianceBrowseLocation() {
-
- var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
- if(dsepRegEx == '\\') dsepRegEx += '\\';
-
- var loc = $('#vboxPane').data('vboxSystemProperties').defaultMachineFolder;
-
- vboxFileBrowser(loc,function(f){
-
- if(!f) return;
-
- document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = f;
- $('#vboxWizardImportApplianceFilename').html(f);
-
- // Remove any existing VMs from Back / Forward wizard navigation
- $('#vboxImportProps').children().remove();
-
- /* Parse appliance file */
- var l = new vboxLoader();
- l.add('applianceReadInterpret',function(d){
- if(d && d.responseData && d.responseData.descriptions && d.responseData.descriptions.length) { wizardImportApplianceParsed(d.responseData); }
- else {
- if(!d) { vboxAlert(trans('Unkown Error')); }
- document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = '';
- $('#vboxWizardImportApplianceFilename').html('');
- } // no data. assume error was displayed
- },{'file':$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()});
- l.run();
-
- },false,trans('Select an appliance to import','UIWizardImportApp'),'images/vbox/os_type_16px.png');
-
-}
-
-
-function wizardImportAppResize(){
-
- // Resize properties
- $('#wizardImportApplianceStep1').hide();
- $('#wizardImportApplianceStep1').css({'height':($('#wizardImportApplianceStep1').parent().height()-8)+'px'}).show();
- $('#vboxImportPropsContainer').hide();
- $('#vboxImportPropsContainer').css({'height':($('#vboxImportPropsContainer').parent().height()-2)+'px'}).show();
-
-}
-$('#wizardImportApplianceDialog').on('dialogresizestop',wizardImportAppResize);
-$('#wizardImportApplianceStep1').on('show',wizardImportAppResize);
-
-/* After appliance file is parsed */
-function wizardImportApplianceParsed(d) {
-
- // Remove any existing data
- $('#vboxImportProps').children().remove();
-
- var tbl = $('#vboxImportProps');
- if(!d) d = {'descriptions':$(tbl).data('descriptions')};
- else $(tbl).data('descriptions',d.descriptions);
-
- // No descriptions.. nothing to do..
- if(!$(tbl).data('descriptions')) return;
-
- for(var vm = 0; vm < d.descriptions.length; vm++) {
-
- var tr = $('<tr />').data({'vmDesc':d.descriptions[vm]}).attr({'class':'vboxApplianceHeaderRow'});
- var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'});
- $('<input />').data({'vboxOrder':vm}).attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
- if(!$(this).data('toggleClicked')) {
- $(this).data('toggleClicked', true);
- $(this).css({'background-image':'url(images/rightArrow.png)'});
- $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','none');
- } else {
- $(this).data('toggleClicked', false);
- $(this).css({'background-image':'url(images/downArrow.png)'});
- $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','');
- }
- }).appendTo(td);
- $(td).append(trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',(vm+1))).appendTo(tr);
- $(tbl).append(tr);
-
- // Hard Disks are handled differently
- var hds = [];
-
- for(var i = 0; i < d.descriptions[vm][0].length; i++) {
-
- var desc = vboxApplianceImportProps[d.descriptions[vm][0][i]];
- if(desc == undefined) continue;
-
- var tr = $('<tr />').data({'descType':d.descriptions[vm][0][i],'descOrder':i}).addClass('vboxChildOf'+vm, ' vboxListItem').attr({'id':'vboxVM-'+vm+'-item-'+i}).click(function(){
- $('#vboxImportProps').find('input').trigger('blur');
- if($(this).hasClass('vboxListItemSelected')) return;
- $(this).siblings('tr.vboxListItemSelected').removeClass('vboxListItemSelected');
- $(this).addClass('vboxListItemSelected');
- $(this).parent().trigger('selectProp',this);
- });
-
- $('<td />').css({'white-space':'nowrap','width':'1%'}).attr({'class':'vbox'+d.descriptions[vm][0][i]}).html('<img src="images/vbox/blank.gif" class="vboxSpacer" style="height:2px;"/><img src="images/vbox/'+desc.icon+'_16px.png" style="height: 16px; width: 16px;"/> ' + trans(desc.label,'UIApplianceEditorWidget')).appendTo(tr);
-
- var td = $('<td />').attr({'class':'vboxHideOverflow'}).css({'padding-left':'10px'});
- if(desc.checkbox) {
- $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop('checked',true).css({'margin-right':'5px'}).click(function(){
- $(this).closest('tr').data('propdisabled',!(this.checked));
- if(this.checked) {
- $(this).siblings().removeClass('vboxDisabled');
- } else {
- $(this).siblings().addClass('vboxDisabled');
- }
- }).appendTo(td);
- }
- var sp = $('<span />').css({'display':'inline-block'}).attr({'class':'vboxImportAppProp'});
- if(desc.display) {
- $(sp).html(desc.display(d.descriptions[vm][3][i]));
- } else {
- $(sp).text(d.descriptions[vm][3][i]);
- }
-
- $(td).data({'descValue':d.descriptions[vm][3][i]}).append(sp).dblclick(function(){
-
- // Edit property function
- var desc = vboxApplianceImportProps[$(this).parent().data('descType')];
-
- // Check for checkbox
- if(desc.checkbox && !$(this).children('input:checkbox').first().prop('checked')) return;
-
- switch(desc.edit) {
- case 'options':
- vboxImportAppliancePropEditOptions(this,desc);
- break;
- case 'text':
- vboxImportAppliancePropEdit(this,desc);
- break;
- case 'textarea':
- vboxImportAppliancePropEditArea(this,desc);
- break;
- default:
- if(typeof desc.edit == 'function') desc.edit(this,desc);
- }
- }).disableSelection().appendTo(tr);
-
- // Hard Disks are handled differently
- if(d.descriptions[vm][0][i] == 'HardDiskImage') {
- var place = d.descriptions[vm][4][i].split(';');
- var con = parseInt(place[0].replace(/.*=/,''));
- var dev = parseInt(place[1].replace(/.*=/,''));
- hds[hds.length] = {'element':tr,'controller':con,'device':dev};
- } else {
- $(tbl).append(tr);
- }
-
- } // </ foreach description item >
-
- // Attach hard disks
- hds.sort(function(a,b){
- if(a.device == b.device) return 0;
- return (a.device < b.device ? 1 : -1); // Yes. Reverse order.
- });
- for(var i = 0; i < hds.length; i++) {
- $('#vboxVM-'+vm+'-item-'+hds[i].controller).after(hds[i].element);
- }
-
- } // </ foreach vm >
-
- vboxColorRows(tbl,false,'vboxApplianceHeaderRow');
-
-
-
- $('#vboxImportProps').disableSelection();
-
- // Check for import warnings
- if(d.warnings && d.warnings.length) {
-
- var div = $('<div />');
- $(div).append(trans('Warnings:','UIApplianceEditorWidget'));
-
- var ul = $('<ul />');
-
- for(var i = 0; i < d.warnings.length; i++) {
- $('<li />').html(d.warnings[i]).appendTo(ul);
- }
- $(div).append(ul);
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){$(this).empty().remove();};
- $(div).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'draggable':true,'buttons':buttons,'title':trans('Warnings:')});
-
- }
-
-
-};
-
-
-
-/*
- *
- * Edit property that has options
- *
- */
-function vboxImportAppliancePropEditOptions(elm,desc) {
-
- var s = $('<select />').attr({'id':'vboxImportAppSelect'}).css({'width':'100%'}).change(function(){
- $(this).parent().data('descValue',$(this).val());
- var txt = this.options[this.selectedIndex].text;
-
- $(this).siblings('span.vboxImportAppProp').text(txt);
-
- });
- var val = $(elm).data('descValue');
- if(desc.option_offset) {
- val = parseInt(val) + parseInt(desc.option_offset);
- val = ''+val;
- }
- selOpt = 0;
- var a = 0;
- for(var i in desc.options) {
- $(s).prop('options').add(new Option(desc.options[i],i,(i == val),(i == val)));
- if(i==val) selOpt = a;
- a++;
- }
- $(s).attr('selectedIndex',selOpt);
- $(elm).children().hide();
- $(elm).append(s);
- $('#vboxImportProps').one('selectProp',function(){
- $('#vboxImportAppSelect').hide().siblings().show();
- $('#vboxImportAppSelect').remove();
- });
-
-}
-
-
-
-/*
- *
- * Edit property that has a text area
- *
- */
-function vboxImportAppliancePropEditArea(elm) {
-
- $(elm).children().hide();
-
- $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val(trans('Edit text','VBoxTextEditor')).click(function(){
- vboxImportAppliancePropEditDialog(elm);
- $('#vboxImportProps').trigger('selectProp');
- }).appendTo(elm);
-
- $(elm).children('input:button').first().focus();
- $('#vboxImportProps').one('selectProp',function(){
- $(elm).children('input:button').first().hide().siblings().show();
- $(elm).children('input:button').first().remove();
- });
-}
-
-/*
- *
- * Edit property dialog
- *
- */
-function vboxImportAppliancePropEditDialog(td) {
-
- var d = $('<div />').css({'display':'none'});
- var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
-
- $('<textarea />').attr({'id':'vboxImportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val($(td).data('descValue')).appendTo(frm);
-
- $(d).append(frm);
-
- var buttons = {};
- buttons[trans('OK','QIMessageBox')] = function(){
- $(td).data('descValue',$('#vboxImportAppliancePropTextarea').val());
- $(td).children('span.vboxImportAppProp').html($('<div />').text($('#vboxImportAppliancePropTextarea').val()).html());
- $(this).empty().remove();
- };
- buttons[trans('Cancel','QIMessageBox')] = function(){$(this).empty().remove();};
- $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(td).prev().html()});
-
-}
-
-/*
- *
- * Edit property that has a text box
- *
- */
-function vboxImportAppliancePropEdit(elm,desc) {
- $(elm).children().hide();
- $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).data('descValue')).blur(function(){
-
- var tbox = this;
-
- var val = (desc.postEdit ? desc.postEdit($(tbox).val(),$(tbox).parent().data('descValue')) : $(tbox).val());
- if(val != $(tbox).parent().data('descValue')) {
- $(tbox).parent().data('descValue',val);
- if(desc.display) {
- $(tbox).siblings('span.vboxImportAppProp').html(desc.display(val));
- } else {
- $(tbox).siblings('span.vboxImportAppProp').text(val);
- }
- $(tbox).parent().data('edited', true);
-
- // Special case for name
- if(desc.label == 'Name') {
-
- // Get ChildOf class
- var r = /(vboxChildOf\d+)/;
- var coClass = r.exec($(tbox).closest('tr').attr('class'));
- coClass = coClass[1];
-
- // Get unedited disk rows
- var diskRows = new Array();
- $.each($(tbox).parent().closest('tr').siblings('.'+coClass), function(i,e){
- if(!$(e).data('edited') && $(e).data('descType') == 'HardDiskImage') {
- diskRows[diskRows.length] = e;
- }
- });
-
- if(diskRows.length) {
- var mfd = new vboxLoader();
- mfd.add('vboxGetComposedMachineFilename',function(d){
- var mfolder = vboxDirname(d.responseData) + $("#vboxPane").data('vboxConfig').DSEP;
- for(var i = 0; i < diskRows.length; i++) {
- var tdc = $(diskRows[i]).children().eq(1);
- var dname = vboxBasename($(tdc).data('descValue'));
- $(tdc).data({'descValue':mfolder + dname}).find('span.vboxImportAppProp').text(mfolder + dname);
- }
- },{'name':val,'group':''});
- mfd.run();
- }
- }
- }
- $(tbox).hide();
- $(tbox).siblings().show();
- $(tbox).remove();
- }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');}).appendTo(elm);
- $(elm).children('input:text').first().focus();
-}
-
-</script>
+<!--
+
+ Advanced panes for import appliance wizard. Logic in vboxWizard() class
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardImportApplianceAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+<!-- Step 1 -->
+<div id='wizardImportApplianceStep1' style='display: none'>
+
+ <table class='vboxInvisible' style='border: 0px solid transparent; border-spacing: 4px; height: 100%;'>
+ <tr style='vertical-align: top'>
+ <td style='height: 1%'>
+
+ <span class='translate vboxTableLabel'>Appliance to import</span>
+ <hr style='width: 100%; margin: 0px; margin-bottom: 6px; display: block' class='vboxSeparatorLine'/>
+
+ <input type="button" id='vboxWizardImportApplianceButton' value='Open appliance...' onClick="wizardImportApplianceBrowseLocation()" />
+ <input type='hidden' name='wizardImportApplianceLocation' />
+ <span id='vboxWizardImportApplianceFilename'> </span>
+ </td>
+ <tr style='vertical-align: top'>
+ <td>
+ <div class='vboxBordered' id='vboxImportPropsContainer' style='overflow: auto;'>
+ <table style='width: 100%;' class='vboxHorizontal'>
+ <!--
+ <thead>
+ <tr>
+ <th style='text-align: left; width: 1%; padding-left: 10px' class='translate'>Description</th>
+ <th style='text-align: left; padding-left: 10px;' class='translate'>Configuration</th>
+ </tr>
+ </thead>
+ -->
+ <tbody id='vboxImportProps' style='font-size: 0.9em;'>
+ </tbody>
+ </table>
+ </div>
+ </td>
+ </tr>
+ <tr style='vertical-align: top'>
+ <td style='height: 1%'>
+ <div style='margin:2px;margin-top:4px;padding:0px;'><label><input type='checkbox' class='vboxCheckbox' name='vboxImportReinitNetwork' />
+ <span class='translateglob'>Reinitialize the MAC address of all network cards</span></label>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+</div>
+
+
+<script type='text/javascript'>
+
+// Translations
+$('#wizardImportApplianceStep1').find('span.translateglob').html(function(i,h){
+ return trans(h,'UIApplianceEditorWidget');
+});
+
+$('#vboxWizardImportApplianceButton').val(trans('Choose a virtual appliance file to import...','UIWizardImportApp'));
+
+/*
+ *
+ * VM Properties to edit / import
+ *
+ */
+var vboxApplianceImportProps = {
+ 'Name' : {'label':'Name','icon':'name','edit':'text'},
+ 'Description' : {'label':'Description','icon':'description','edit':'textarea'},
+ 'OS' : {'label':'Guest OS Type','icon':'os_type','edit':function(elm){
+ var input = $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).find('span.vboxApplianceOSTitle').html());
+ $(elm).children().hide();
+ $(elm).append(input);
+ $(elm).children('input:button').first().contextMenu({
+ menu: 'vboxOSTypesMenu',
+ button: 0,
+ mode: 'menu',
+ inSpeed : -1,
+ outSpeed : -1
+ },
+ function(a, el, pos, srcEl) {
+ $(elm).find('span.vboxApplianceOSTitle').html(vboxSettingsOSTypesObj[a]['description']);
+ $(elm).find('img.vboxApplianceOSIcon').attr('src','images/vbox/'+vboxGuestOSTypeIcon(a));
+ $(elm).closest('td').data('descValue',a);
+ $('#vboxImportProps').trigger('selectProp');
+ }).focus();
+ $('#vboxImportProps').one('selectProp',function(){
+ $(elm).children('input:button').first().hide().siblings().show();
+ $(elm).children('input:button').first().remove();
+ });
+
+ },'display':function(val){
+ return $('<span />').append('<img class="vboxApplianceOSIcon" src="images/vbox/'+vboxGuestOSTypeIcon(val)+'" style="height: 16px; width: 16px; float: left; margin-top: 2px; margin-right: 4px; " /> <span class="vboxApplianceOSTitle">' + vboxSettingsOSTypesObj[val].description +'</span>').disableSelection().on('selectstart',function(e){e.preventDefault();return false;});
+ }},
+ 'CPU' : {'label':'CPU','icon':'cpu','edit':'text','postEdit':function(val,old){
+ val = parseInt(val);
+ if(isNaN(val)) return old;
+ return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestCPUCount,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestCPUCount,val));
+ }},
+ 'Memory' : {'label':'RAM','icon':'ram','edit':'text','display':function(val){
+ return Math.max(parseInt(val),0) + ' ' + trans('MB','VBoxGlobal');
+ },'postEdit':function(val,old) {
+ val = parseInt(val);
+ if(isNaN(val)) return old;
+ return Math.min($('#vboxPane').data('vboxSystemProperties').maxGuestRAM,Math.max($('#vboxPane').data('vboxSystemProperties').minGuestRAM,val));
+ }},
+ 'SoundCard' : {'label':'Sound Card','icon':'sound','checkbox':true,'edit':'options','display':function(val){
+ return trans(vboxAudioController($('#vboxPane').data('vboxAudioControllerTypes')[val]),'VBoxGlobal');
+ }},
+ 'CDROM' : {'label':'DVD','icon':'cd','checkbox':true,'edit':'checkbox'},
+ 'USBController' : {'label':'USB Controller','icon':'usb','checkbox':true},
+ 'NetworkAdapter' : {'label':'Network Adapter','icon':'nw','checkbox':true,'edit':'options','option_offset':-1,'display':function(val){
+ return trans(vboxNetworkAdapterType($('#vboxPane').data('vboxNetworkAdapterTypes')[val]),'VBoxGlobal');
+ }},
+ 'Floppy' : {'label':'Floppy','icon':'floppy','checkbox':true},
+ 'HardDiskControllerIDE' : {'label':'Storage Controller (IDE)','icon':'ide','edit':''},
+ 'HardDiskControllerSATA' : {'label':'Storage Controller (SATA)','icon':'sata','edit':null},
+ 'HardDiskControllerSAS' : {'label':'Storage Controller (SAS)','icon':'scsi','edit':null},
+ 'HardDiskControllerSCSI' : {'label':'Storage Controller (SCSI)','icon':'scsi','edit':null},
+ 'HardDiskImage' : {'label':'Virtual Disk Image','icon':'hd','edit':'text'}
+};
+
+/*
+ *
+ * Add Property Options
+ *
+ */
+// Storage controllers
+var stTypes = vboxStorage.getBusTypes();
+for(var i = 0; i < stTypes.length; i++) {
+
+ if(!vboxApplianceImportProps['HardDiskController'+stTypes[i]]) continue;
+
+ // Translate value
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['display'] = function(val){return trans(vboxStorageControllerType(val),'VBoxGlobal');};
+
+ var ctypes = vboxStorage[stTypes[i]].types;
+ if(ctypes.length < 2) continue;
+
+ var opts = {};
+ for(var a = 0; a < ctypes.length; a++) {
+ opts[ctypes[a]] = trans(vboxStorageControllerType(ctypes[a]),'VBoxGlobal');
+ }
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['edit'] = 'options';
+ vboxApplianceImportProps['HardDiskController'+stTypes[i]]['options'] = opts;
+}
+
+vboxApplianceImportProps['NetworkAdapter']['options'] = [];
+vboxApplianceImportProps['SoundCard']['options'] = [];
+
+// Network adapters
+var cs = $('#vboxPane').data('vboxNetworkAdapterTypes');
+for(var i = 1; i < cs.length; i++) {
+ vboxApplianceImportProps['NetworkAdapter']['options'][(i-1)] = trans(vboxNetworkAdapterType(cs[i]),'VBoxGlobal');
+}
+// Sound cards
+var cs = $('#vboxPane').data('vboxAudioControllerTypes');
+for(var i = 0; i < cs.length; i++) {
+ vboxApplianceImportProps['SoundCard']['options'][i] = trans(vboxAudioController(cs[i]),'VBoxGlobal');
+}
+
+
+// OS Types
+/////////////////////////
+$('ul.vboxOSTypesMenuList').remove();
+
+// shorthand
+var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+var vboxSettingsOSTypes = {};
+var vboxSettingsOSTypesObj = {};
+
+for(var i in vboxOSTypes) {
+
+ // Skip unsupported OS Types
+ if(!vboxOSTypes[i].supported) continue;
+
+ // create array of os family types
+ if(!vboxSettingsOSTypes[vboxOSTypes[i].familyId]) {
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
+ }
+
+ vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes[vboxSettingsOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
+
+ vboxSettingsOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
+
+ // Preload icons
+ vboxOSTypes[i].icon = new Image();
+ vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
+
+}
+
+var ul = $('<ul />').attr({'id':'vboxOSTypesMenu','class':'contextMenu contextMenuNoBG vboxOSTypesMenuList'});
+for(var i in vboxSettingsOSTypes) {
+ var li = $('<li />').html('<a href="#null-'+i+'">'+vboxSettingsOSTypes[i].description+'</a>');
+ var ul2 = $('<ul />').addClass('vboxOSTypesMenuList');
+ for(var a in vboxSettingsOSTypes[i]['osTypes']) {
+ $('<li />').html('<a href="#'+vboxSettingsOSTypes[i]['osTypes'][a]['id']+'"><img style="height: 16px; width:16px; margin-left: -22px; margin-top: 2px; float: left; " src="images/vbox/'+vboxGuestOSTypeIcon(vboxSettingsOSTypes[i]['osTypes'][a]['id'])+'" /> '+vboxSettingsOSTypes[i]['osTypes'][a]['description']+"</a>").appendTo(ul2);
+ }
+ $(li).append(ul2).appendTo(ul);
+}
+$('#vboxPane').append(ul);
+
+
+
+/* Browse for import location */
+function wizardImportApplianceBrowseLocation() {
+
+ var dsepRegEx = $('#vboxPane').data('vboxConfig').DSEP;
+ if(dsepRegEx == '\\') dsepRegEx += '\\';
+
+ var loc = $('#vboxPane').data('vboxSystemProperties').defaultMachineFolder;
+
+ vboxFileBrowser(loc,function(f){
+
+ if(!f) return;
+
+ document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = f;
+ $('#vboxWizardImportApplianceFilename').html(f);
+
+ // Remove any existing VMs from Back / Forward wizard navigation
+ $('#vboxImportProps').children().remove();
+
+ /* Parse appliance file */
+ var l = new vboxLoader();
+ l.add('applianceReadInterpret',function(d){
+ if(d && d.responseData && d.responseData.descriptions && d.responseData.descriptions.length) { wizardImportApplianceParsed(d.responseData); }
+ else {
+ if(!d) { vboxAlert(trans('Unkown Error')); }
+ document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation.value = '';
+ $('#vboxWizardImportApplianceFilename').html('');
+ } // no data. assume error was displayed
+ },{'file':$(document.forms['frmwizardImportAppliance'].elements.wizardImportApplianceLocation).val()});
+ l.run();
+
+ },false,trans('Select an appliance to import','UIWizardImportApp'),'images/vbox/os_type_16px.png');
+
+}
+
+
+function wizardImportAppResize(){
+
+ // Resize properties
+ $('#wizardImportApplianceStep1').hide();
+ $('#wizardImportApplianceStep1').css({'height':($('#wizardImportApplianceStep1').parent().height()-8)+'px'}).show();
+ $('#vboxImportPropsContainer').hide();
+ $('#vboxImportPropsContainer').css({'height':($('#vboxImportPropsContainer').parent().height()-2)+'px'}).show();
+
+}
+$('#wizardImportApplianceDialog').on('dialogresizestop',wizardImportAppResize);
+$('#wizardImportApplianceStep1').on('show',wizardImportAppResize);
+
+/* After appliance file is parsed */
+function wizardImportApplianceParsed(d) {
+
+ // Remove any existing data
+ $('#vboxImportProps').children().remove();
+
+ var tbl = $('#vboxImportProps');
+ if(!d) d = {'descriptions':$(tbl).data('descriptions')};
+ else $(tbl).data('descriptions',d.descriptions);
+
+ // No descriptions.. nothing to do..
+ if(!$(tbl).data('descriptions')) return;
+
+ for(var vm = 0; vm < d.descriptions.length; vm++) {
+
+ var tr = $('<tr />').data({'vmDesc':d.descriptions[vm]}).attr({'class':'vboxApplianceHeaderRow'});
+ var td = $('<td />').attr({'colspan':'2','class':'vboxApplianceHeader'});
+ $('<input />').data({'vboxOrder':vm}).attr({'type':'button','class':'vboxImgButton','style':'background-image: url(images/downArrow.png); width: 12px; height: 12px; margin-right: 4px;'}).click(function(){
+ if(!$(this).data('toggleClicked')) {
+ $(this).data('toggleClicked', true);
+ $(this).css({'background-image':'url(images/rightArrow.png)'});
+ $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','none');
+ } else {
+ $(this).data('toggleClicked', false);
+ $(this).css({'background-image':'url(images/downArrow.png)'});
+ $(this).parent().parent().parent().children('tr.vboxChildOf'+$(this).data('vboxOrder')).css('display','');
+ }
+ }).appendTo(td);
+ $(td).append(trans('Virtual System %1','UIApplianceEditorWidget').replace('%1',(vm+1))).appendTo(tr);
+ $(tbl).append(tr);
+
+ // Hard Disks are handled differently
+ var hds = [];
+
+ for(var i = 0; i < d.descriptions[vm][0].length; i++) {
+
+ var desc = vboxApplianceImportProps[d.descriptions[vm][0][i]];
+ if(desc == undefined) continue;
+
+ var tr = $('<tr />').data({'descType':d.descriptions[vm][0][i],'descOrder':i}).addClass('vboxChildOf'+vm, ' vboxListItem').attr({'id':'vboxVM-'+vm+'-item-'+i}).click(function(){
+ $('#vboxImportProps').find('input').trigger('blur');
+ if($(this).hasClass('vboxListItemSelected')) return;
+ $(this).siblings('tr.vboxListItemSelected').removeClass('vboxListItemSelected');
+ $(this).addClass('vboxListItemSelected');
+ $(this).parent().trigger('selectProp',this);
+ });
+
+ $('<td />').css({'white-space':'nowrap','width':'1%'}).attr({'class':'vbox'+d.descriptions[vm][0][i]}).html('<img src="images/vbox/blank.gif" class="vboxSpacer" style="height:2px;"/><img src="images/vbox/'+desc.icon+'_16px.png" style="height: 16px; width: 16px;"/> ' + trans(desc.label,'UIApplianceEditorWidget')).appendTo(tr);
+
+ var td = $('<td />').attr({'class':'vboxHideOverflow'}).css({'padding-left':'10px'});
+ if(desc.checkbox) {
+ $('<input />').attr({'type':'checkbox','class':'vboxCheckbox'}).prop('checked',true).css({'margin-right':'5px'}).click(function(){
+ $(this).closest('tr').data('propdisabled',!(this.checked));
+ if(this.checked) {
+ $(this).siblings().removeClass('vboxDisabled');
+ } else {
+ $(this).siblings().addClass('vboxDisabled');
+ }
+ }).appendTo(td);
+ }
+ var sp = $('<span />').css({'display':'inline-block'}).attr({'class':'vboxImportAppProp'});
+ if(desc.display) {
+ $(sp).html(desc.display(d.descriptions[vm][3][i]));
+ } else {
+ $(sp).text(d.descriptions[vm][3][i]);
+ }
+
+ $(td).data({'descValue':d.descriptions[vm][3][i]}).append(sp).dblclick(function(){
+
+ // Edit property function
+ var desc = vboxApplianceImportProps[$(this).parent().data('descType')];
+
+ // Check for checkbox
+ if(desc.checkbox && !$(this).children('input:checkbox').first().prop('checked')) return;
+
+ switch(desc.edit) {
+ case 'options':
+ vboxImportAppliancePropEditOptions(this,desc);
+ break;
+ case 'text':
+ vboxImportAppliancePropEdit(this,desc);
+ break;
+ case 'textarea':
+ vboxImportAppliancePropEditArea(this,desc);
+ break;
+ default:
+ if(typeof desc.edit == 'function') desc.edit(this,desc);
+ }
+ }).disableSelection().appendTo(tr);
+
+ // Hard Disks are handled differently
+ if(d.descriptions[vm][0][i] == 'HardDiskImage') {
+ var place = d.descriptions[vm][4][i].split(';');
+ var con = parseInt(place[0].replace(/.*=/,''));
+ var dev = parseInt(place[1].replace(/.*=/,''));
+ hds[hds.length] = {'element':tr,'controller':con,'device':dev};
+ } else {
+ $(tbl).append(tr);
+ }
+
+ } // </ foreach description item >
+
+ // Attach hard disks
+ hds.sort(function(a,b){
+ if(a.device == b.device) return 0;
+ return (a.device < b.device ? 1 : -1); // Yes. Reverse order.
+ });
+ for(var i = 0; i < hds.length; i++) {
+ $('#vboxVM-'+vm+'-item-'+hds[i].controller).after(hds[i].element);
+ }
+
+ } // </ foreach vm >
+
+ vboxColorRows(tbl,false,'vboxApplianceHeaderRow');
+
+
+
+ $('#vboxImportProps').disableSelection();
+
+ // Check for import warnings
+ if(d.warnings && d.warnings.length) {
+
+ var div = $('<div />');
+ $(div).append(trans('Warnings:','UIApplianceEditorWidget'));
+
+ var ul = $('<ul />');
+
+ for(var i = 0; i < d.warnings.length; i++) {
+ $('<li />').html(d.warnings[i]).appendTo(ul);
+ }
+ $(div).append(ul);
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){$(this).empty().remove();};
+ $(div).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'draggable':true,'buttons':buttons,'title':trans('Warnings:')});
+
+ }
+
+
+};
+
+
+
+/*
+ *
+ * Edit property that has options
+ *
+ */
+function vboxImportAppliancePropEditOptions(elm,desc) {
+
+ var s = $('<select />').attr({'id':'vboxImportAppSelect'}).css({'width':'100%'}).change(function(){
+ $(this).parent().data('descValue',$(this).val());
+ var txt = this.options[this.selectedIndex].text;
+
+ $(this).siblings('span.vboxImportAppProp').text(txt);
+
+ });
+ var val = $(elm).data('descValue');
+ if(desc.option_offset) {
+ val = parseInt(val) + parseInt(desc.option_offset);
+ val = ''+val;
+ }
+ selOpt = 0;
+ var a = 0;
+ for(var i in desc.options) {
+ $(s).prop('options').add(new Option(desc.options[i],i,(i == val),(i == val)));
+ if(i==val) selOpt = a;
+ a++;
+ }
+ $(s).attr('selectedIndex',selOpt);
+ $(elm).children().hide();
+ $(elm).append(s);
+ $('#vboxImportProps').one('selectProp',function(){
+ $('#vboxImportAppSelect').hide().siblings().show();
+ $('#vboxImportAppSelect').remove();
+ });
+
+}
+
+
+
+/*
+ *
+ * Edit property that has a text area
+ *
+ */
+function vboxImportAppliancePropEditArea(elm) {
+
+ $(elm).children().hide();
+
+ $('<input />').attr({'type':'button','class':'vboxbutton'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val(trans('Edit text','VBoxTextEditor')).click(function(){
+ vboxImportAppliancePropEditDialog(elm);
+ $('#vboxImportProps').trigger('selectProp');
+ }).appendTo(elm);
+
+ $(elm).children('input:button').first().focus();
+ $('#vboxImportProps').one('selectProp',function(){
+ $(elm).children('input:button').first().hide().siblings().show();
+ $(elm).children('input:button').first().remove();
+ });
+}
+
+/*
+ *
+ * Edit property dialog
+ *
+ */
+function vboxImportAppliancePropEditDialog(td) {
+
+ var d = $('<div />').css({'display':'none'});
+ var frm = $('<form />').attr({'onSubmit':'return false;'}).css({'margin':'0px','border':'0px','padding':'0px','width':'100%','height':'100%'});
+
+ $('<textarea />').attr({'id':'vboxImportAppliancePropTextarea'}).css({'height':'99%','width':'99%'}).val($(td).data('descValue')).appendTo(frm);
+
+ $(d).append(frm);
+
+ var buttons = {};
+ buttons[trans('OK','QIMessageBox')] = function(){
+ $(td).data('descValue',$('#vboxImportAppliancePropTextarea').val());
+ $(td).children('span.vboxImportAppProp').html($('<div />').text($('#vboxImportAppliancePropTextarea').val()).html());
+ $(this).empty().remove();
+ };
+ buttons[trans('Cancel','QIMessageBox')] = function(){$(this).empty().remove();};
+ $(d).dialog({'height':300,'width':300,'closeOnEscape':false,'modal':true,'resizable':true,'dialogClass':'vboxDialogContent','draggable':true,'buttons':buttons,'title':$(td).prev().html()});
+
+}
+
+/*
+ *
+ * Edit property that has a text box
+ *
+ */
+function vboxImportAppliancePropEdit(elm,desc) {
+ $(elm).children().hide();
+ $('<input />').attr({'type':'text','class':'vboxText'}).css({'width':($(elm).innerWidth()-12)+'px','margin':'0px'}).val($(elm).data('descValue')).blur(function(){
+
+ var tbox = this;
+
+ var val = (desc.postEdit ? desc.postEdit($(tbox).val(),$(tbox).parent().data('descValue')) : $(tbox).val());
+ if(val != $(tbox).parent().data('descValue')) {
+ $(tbox).parent().data('descValue',val);
+ if(desc.display) {
+ $(tbox).siblings('span.vboxImportAppProp').html(desc.display(val));
+ } else {
+ $(tbox).siblings('span.vboxImportAppProp').text(val);
+ }
+ $(tbox).parent().data('edited', true);
+
+ // Special case for name
+ if(desc.label == 'Name') {
+
+ // Get ChildOf class
+ var r = /(vboxChildOf\d+)/;
+ var coClass = r.exec($(tbox).closest('tr').attr('class'));
+ coClass = coClass[1];
+
+ // Get unedited disk rows
+ var diskRows = new Array();
+ $.each($(tbox).parent().closest('tr').siblings('.'+coClass), function(i,e){
+ if(!$(e).data('edited') && $(e).data('descType') == 'HardDiskImage') {
+ diskRows[diskRows.length] = e;
+ }
+ });
+
+ if(diskRows.length) {
+ var mfd = new vboxLoader();
+ mfd.add('vboxGetComposedMachineFilename',function(d){
+ var mfolder = vboxDirname(d.responseData) + $("#vboxPane").data('vboxConfig').DSEP;
+ for(var i = 0; i < diskRows.length; i++) {
+ var tdc = $(diskRows[i]).children().eq(1);
+ var dname = vboxBasename($(tdc).data('descValue'));
+ $(tdc).data({'descValue':mfolder + dname}).find('span.vboxImportAppProp').text(mfolder + dname);
+ }
+ },{'name':val,'group':''});
+ mfd.run();
+ }
+ }
+ }
+ $(tbox).hide();
+ $(tbox).siblings().show();
+ $(tbox).remove();
+ }).keydown(function(e){if(e.keyCode == 13) $(this).trigger('blur');}).appendTo(elm);
+ $(elm).children('input:text').first().focus();
+}
+
+</script>
diff --git a/panes/wizardNewVM.html b/panes/wizardNewVM.html
index 3fe1641..0e711d0 100644
--- a/panes/wizardNewVM.html
+++ b/panes/wizardNewVM.html
@@ -1,343 +1,343 @@
-<!--
-
- Panes for new virtual machine wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardNewVM.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-
-<!-- Step 1 -->
-<div id='wizardNewVMStep1' title='Name and operating system' style='display: none'>
-
- <p class='translate vboxWizardDescription'>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</p>
-
- <div class='vboxOptions'>
- <table class='vboxOptions' style='width:100%'>
- <tr>
- <th style='width: 1%'><span class='translate'>Name:</span></th>
- <td colspan='2'><input type='text' class='vboxText' name='newVMName' style='width: 95%' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Type:</span></th>
- <td style='width: 100%'><select name='newVMOSFamily' id='newVMOSFamily' style='width: 100%'>
- <option value='Linux'>Linux</option>
- </select></td>
- <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Version:</span></th>
- <td><select id='newVMOSType' name='newVMOSType' style='width: 100%'>
- <option value='Debian'>Debian</option>
- </select></td>
- </tr>
- </table>
- </div>
-</div>
-
-
-<!-- Step 2 -->
-<div id='wizardNewVMStep2' title='Memory size' style='display: none'>
- <span id='newVMSizeLabel'></span>
-
- <div class='vboxOptions'>
-
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='wizardNewVMSize' class='slider translateglob'><div class='sliderScale'></div></div>
- </td>
- <td style='white-space: nowrap'><input type='text' class='vboxText' name='wizardNewVMSizeValue' size='5' class='sliderValue' /> <span class='translate'>MB</span></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='wizardNewVMMin'>1</span> <span class='translate'>MB</span></td>
- <td style='text-align: right;'><span id='wizardNewVMMax'>128</span> <span class='translate'>MB</span></td>
- </tr>
- </table>
- </td>
- <td></td>
- </tr>
- </table>
- </div>
-
-</div>
-
-<!-- Step 3 -->
-<div id='wizardNewVMStep3' title='Hard disk' style='display: none'>
-
- <span id='newVMHDSizeLabel'></span>
-
-
- <div class='vboxOptions'>
-
- <table class='vboxOptions' id='newVMBootDiskTable' style='width:100%;'>
- <tr>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="none" onClick="newVMToggleNewDisk(true)" /> <span class='translate vboxEnablerListen'>Do not add a virtual hard disk</span></label></td>
- </tr>
- <tr id='newVMHDTriggerBind' class='vboxEnablerTrigger'>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="create" onClick="newVMToggleNewDisk(true)" checked='checked' /> <span class='translate vboxEnablerListen'>Create a virtual hard disk now</span></label></td>
- </tr>
- <tr>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="existing" onClick="newVMToggleNewDisk(false)" /> <span class='translate vboxEnablerListen'>Use an existing virtual hard disk file</span></label></td>
- </tr>
- <tr>
- <td style='padding-left: 24px; white-space: nowrap'>
- <table class='vboxInvisible' style='width: 99%;'>
- <tr>
- <td><select id="newVMDiskSelectId" name="newVMDiskSelect" disabled='disabled'></select></td>
- <td style='width:1%' id='newVMDiskVMM'></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
-</div>
-
-
-<script type='text/javascript'>
-
-/* Translations */
-$('#wizardNewVMStep1').find('table.vboxOptions').find('span.translate').html(function(i,h) {
- return trans(h,'UINameAndSystemEditor');
-}).removeClass('translate');
-
-
-
-var wizardNewVMToolbar = new vboxToolbarSingle({button: {
- /* Add Attachment Button */
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a virtual hard disk file...',
- 'language_context': 'UIMachineSettingsStorage',
- 'icon' : 'select_file',
- 'click' : function () {
- vboxMedia.actions.choose(null,'HardDisk',function(med){
- if(med) vmNewFillExistingDisks(med.base);
- });
- }
-}});
-wizardNewVMToolbar.renderTo('newVMDiskVMM');
-
-/* Toggle new / existing */
-function newVMToggleNewDisk(dis) {
-
- if(dis) {
- wizardNewVMToolbar.disable();
- document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = true;
- $('#wizardNewVMStep3').find('.vboxMediumSelect').trigger('disable');
- } else {
- wizardNewVMToolbar.enable();
- document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = (document.forms['frmwizardNewVM'].newVMDiskSelect.options.length > 0 ? false : true);
- $('#wizardNewVMStep3').find('.vboxMediumSelect').trigger('enable');
- }
-
-}
-
-/* Mem size slider */
-var min = 4;
-var max = parseInt($('#vboxPane').data('vboxHostDetails').memorySize);
-
-$('#wizardNewVMSize').data('form','frmwizardNewVM');
-
-$('#wizardNewVMSize').slider({'min':min,'max':max,'step':1});
-$('#wizardNewVMSize').slider('value',4);
-
-$('#wizardNewVMMin').html(min);
-$('#wizardNewVMMax').html(max);
-
-/* Fill existing attachments */
-function vmNewFillExistingDisks(sel) {
-
- document.forms['frmwizardNewVM'].newVMDiskSelect.options.length = 0;
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).children().remove();
-
- var s = vboxMedia.mediaForAttachmentType('HardDisk');
-
- // Sort media
- s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
-
- var mediumSelects = [];
- var selectedIndex = 0;
- for(var i = 0; i < s.length; i++) {
- document.forms['frmwizardNewVM'].newVMDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id);
- if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardNewVM'].newVMDiskSelect.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 == s[i].id) {
- selectedIndex = i;
- }
- }
- if(selectedIndex) {
- document.forms['frmwizardNewVM'].newVMDiskSelect.selectedIndex = selectedIndex;
- }
-
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
-}
-
-vmNewFillExistingDisks();
-
-/*
- *
- * Called when OS family type changes
- *
- */
-function newVMUpdateOSList(osfam) {
-
- document.forms['frmwizardNewVM'].newVMOSType.options.length = 0;
- $(document.forms['frmwizardNewVM'].newVMOSType).children().remove();
- for(var i = 0; i < newVMOSTypes[osfam].osTypes.length; i++) {
- document.forms['frmwizardNewVM'].newVMOSType.options[i] = new Option(newVMOSTypes[osfam].osTypes[i].description, newVMOSTypes[osfam].osTypes[i].id);
- }
- // Trigger change
- newVMUpdateOS(newVMOSTypes[osfam].osTypes[0].id);
-}
-
-function newVMUpdateOS(ostype) {
-
- document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(ostype);
-
- ostype = newVMOSTypesObj[ostype];
-
- $('#wizardNewVMSize').slider('value',ostype.recommendedRAM);
-
- $('#newVMSizeLabel').html(trans("<p>Select the amount of memory (RAM) in megabytes "+
- "to be allocated to the virtual machine.</p>"+
- "<p>The recommended memory size is <b>%1</b> MB.</p>",'UIWizardNewVM').replace('%1',ostype.recommendedRAM));
-
- $('#newVMHDSizeLabel').html(trans("<p>If you wish you can add a virtual hard disk to the new machine. "+
- "You can either create a new hard disk file or select one from the list or from another location "+
- "using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step "+
- "and make the changes to the machine settings once the machine is created.</p><p>The recommended "+
- "size of the hard disk is <b>%1</b>.</p>",'UIWizardNewVM').replace('%1',vboxMbytesConvert(ostype.recommendedHDD)));
-
-}
-
-var newVMOSTypes = new Array();
-var newVMOSTypesObj = {};
-
-// shorthand
-var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
-
-// Default OS Type set to my fav :) Eventually will move to config.php
-var vboxDefaultOSTypeId = 'Debian';
-
-
-var dosfam = null; // holds defaultostype family id
-for(var i in vboxOSTypes) {
-
- // Skip unsupported OS types
- if(!vboxOSTypes[i].supported) continue;
-
- // create array of os family types
- if(!newVMOSTypes[vboxOSTypes[i].familyId]) {
- newVMOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
- }
-
- // We're on the default os type, record family id and index number
- // so that we can set it later on
- if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
- dosfam = vboxOSTypes[i].familyId;
- vboxDefaultOSTypeId = newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length;
- }
-
- newVMOSTypes[vboxOSTypes[i].familyId].osTypes[newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
-
- newVMOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
-
- // Preload icons
- vboxOSTypes[i].icon = new Image();
- vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
-
-}
-// clear all options
-document.forms['frmwizardNewVM'].newVMOSFamily.options.length = 0;
-$(document.forms['frmwizardNewVM'].newVMOSFamily).children().remove();
-for(var i in newVMOSTypes) {
- // default os type family? record in dosfam
- if(i == dosfam) dosfam = document.forms['frmwizardNewVM'].newVMOSFamily.options.length;
- document.forms['frmwizardNewVM'].newVMOSFamily.options[document.forms['frmwizardNewVM'].newVMOSFamily.options.length] = new Option(newVMOSTypes[i].description, newVMOSTypes[i].id);
-}
-// OnChange, update os type list and icon
-document.getElementById('newVMOSFamily').setAttribute('onChange','newVMUpdateOSList(this.value)');
-document.getElementById('newVMOSType').setAttribute('onChange','newVMUpdateOS(this.value)');
-
-document.forms['frmwizardNewVM'].newVMOSFamily.selectedIndex = dosfam;
-newVMUpdateOSList(document.forms['frmwizardNewVM'].newVMOSFamily.value);
-document.forms['frmwizardNewVM'].newVMOSType.selectedIndex = vboxDefaultOSTypeId;
-newVMUpdateOS(document.forms['frmwizardNewVM'].newVMOSType.options[document.forms['frmwizardNewVM'].newVMOSType.selectedIndex].value);
-
-/*
- * END OS TYPES
- */
-
-$('#wizardNewVMStep1').on('show',function(e,wiz){
- $(document.forms['frmwizardNewVM'].newVMName).focus();
-});
-
-/* When going to step2, make sure a name is entered */
-$('#wizardNewVMStep2').on('show',function(e,wiz){
-
- document.forms['frmwizardNewVM'].newVMName.value = jQuery.trim(document.forms['frmwizardNewVM'].newVMName.value);
-
- if(!document.forms['frmwizardNewVM'].newVMName.value) {
- $(document.forms['frmwizardNewVM'].newVMName).addClass('vboxRequired');
- // Go back
- wiz.displayStep(1);
- return;
- }
-
- var l = new vboxLoader();
- l.add('vboxGetComposedMachineFilename',function(d){
-
- loc = vboxDirname(d.responseData);
-
- var fe = new vboxLoader();
- fe.add('fileExists',function(d){
- fileExists = d.responseData;
- },{'file':loc});
- fe.onLoad = function() {
- if(fileExists) {
- vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(loc)).replace('%2',vboxDirname(loc)));
- // Go back
- wiz.displayStep(1);
-
- return;
- }
- $(document.forms['frmwizardNewVM'].newVMName).removeClass('vboxRequired');
-
- // Update disabled / enabled items
- if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
- $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
- } else {
- $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
- }
-
- };
- fe.run();
-
-
- },{'name':document.forms['frmwizardNewVM'].newVMName.value, 'group':wiz.vmgroup});
-
- l.run();
-
-});
-
-/* When hard disk is enabled / disabled */
-$('#newVMHDTriggerBind').on('enable',function(){
-
- // Update disabled / enabled items
- if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
- $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
- } else {
- $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
- }
-
-}).on('disable',function(){
- newVMToggleNewDisk(true);
-});
-
-
-
-</script>
+<!--
+
+ Panes for new virtual machine wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardNewVM.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+
+<!-- Step 1 -->
+<div id='wizardNewVMStep1' title='Name and operating system' style='display: none'>
+
+ <p class='translate vboxWizardDescription'>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</p>
+
+ <div class='vboxOptions'>
+ <table class='vboxOptions' style='width:100%'>
+ <tr>
+ <th style='width: 1%'><span class='translate'>Name:</span></th>
+ <td colspan='2'><input type='text' class='vboxText' name='newVMName' style='width: 95%' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Type:</span></th>
+ <td style='width: 100%'><select name='newVMOSFamily' id='newVMOSFamily' style='width: 100%'>
+ <option value='Linux'>Linux</option>
+ </select></td>
+ <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Version:</span></th>
+ <td><select id='newVMOSType' name='newVMOSType' style='width: 100%'>
+ <option value='Debian'>Debian</option>
+ </select></td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+
+<!-- Step 2 -->
+<div id='wizardNewVMStep2' title='Memory size' style='display: none'>
+ <span id='newVMSizeLabel'></span>
+
+ <div class='vboxOptions'>
+
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='wizardNewVMSize' class='slider translateglob'><div class='sliderScale'></div></div>
+ </td>
+ <td style='white-space: nowrap'><input type='text' class='vboxText' name='wizardNewVMSizeValue' size='5' class='sliderValue' /> <span class='translate'>MB</span></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='wizardNewVMMin'>1</span> <span class='translate'>MB</span></td>
+ <td style='text-align: right;'><span id='wizardNewVMMax'>128</span> <span class='translate'>MB</span></td>
+ </tr>
+ </table>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+
+</div>
+
+<!-- Step 3 -->
+<div id='wizardNewVMStep3' title='Hard disk' style='display: none'>
+
+ <span id='newVMHDSizeLabel'></span>
+
+
+ <div class='vboxOptions'>
+
+ <table class='vboxOptions' id='newVMBootDiskTable' style='width:100%;'>
+ <tr>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="none" onClick="newVMToggleNewDisk(true)" /> <span class='translate vboxEnablerListen'>Do not add a virtual hard disk</span></label></td>
+ </tr>
+ <tr id='newVMHDTriggerBind' class='vboxEnablerTrigger'>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="create" onClick="newVMToggleNewDisk(true)" checked='checked' /> <span class='translate vboxEnablerListen'>Create a virtual hard disk now</span></label></td>
+ </tr>
+ <tr>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="existing" onClick="newVMToggleNewDisk(false)" /> <span class='translate vboxEnablerListen'>Use an existing virtual hard disk file</span></label></td>
+ </tr>
+ <tr>
+ <td style='padding-left: 24px; white-space: nowrap'>
+ <table class='vboxInvisible' style='width: 99%;'>
+ <tr>
+ <td><select id="newVMDiskSelectId" name="newVMDiskSelect" disabled='disabled'></select></td>
+ <td style='width:1%' id='newVMDiskVMM'></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+
+<script type='text/javascript'>
+
+/* Translations */
+$('#wizardNewVMStep1').find('table.vboxOptions').find('span.translate').html(function(i,h) {
+ return trans(h,'UINameAndSystemEditor');
+}).removeClass('translate');
+
+
+
+var wizardNewVMToolbar = new vboxToolbarSingle({button: {
+ /* Add Attachment Button */
+ 'name' : 'mselecthdbtn',
+ 'label' : 'Choose a virtual hard disk file...',
+ 'language_context': 'UIMachineSettingsStorage',
+ 'icon' : 'select_file',
+ 'click' : function () {
+ vboxMedia.actions.choose(null,'HardDisk',function(med){
+ if(med) vmNewFillExistingDisks(med.base);
+ });
+ }
+}});
+wizardNewVMToolbar.renderTo('newVMDiskVMM');
+
+/* Toggle new / existing */
+function newVMToggleNewDisk(dis) {
+
+ if(dis) {
+ wizardNewVMToolbar.disable();
+ document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = true;
+ $('#wizardNewVMStep3').find('.vboxMediumSelect').trigger('disable');
+ } else {
+ wizardNewVMToolbar.enable();
+ document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = (document.forms['frmwizardNewVM'].newVMDiskSelect.options.length > 0 ? false : true);
+ $('#wizardNewVMStep3').find('.vboxMediumSelect').trigger('enable');
+ }
+
+}
+
+/* Mem size slider */
+var min = 4;
+var max = parseInt($('#vboxPane').data('vboxHostDetails').memorySize);
+
+$('#wizardNewVMSize').data('form','frmwizardNewVM');
+
+$('#wizardNewVMSize').slider({'min':min,'max':max,'step':1});
+$('#wizardNewVMSize').slider('value',4);
+
+$('#wizardNewVMMin').html(min);
+$('#wizardNewVMMax').html(max);
+
+/* Fill existing attachments */
+function vmNewFillExistingDisks(sel) {
+
+ document.forms['frmwizardNewVM'].newVMDiskSelect.options.length = 0;
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).children().remove();
+
+ var s = vboxMedia.mediaForAttachmentType('HardDisk');
+
+ // Sort media
+ s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
+
+ var mediumSelects = [];
+ var selectedIndex = 0;
+ for(var i = 0; i < s.length; i++) {
+ document.forms['frmwizardNewVM'].newVMDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id);
+ if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardNewVM'].newVMDiskSelect.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 == s[i].id) {
+ selectedIndex = i;
+ }
+ }
+ if(selectedIndex) {
+ document.forms['frmwizardNewVM'].newVMDiskSelect.selectedIndex = selectedIndex;
+ }
+
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
+}
+
+vmNewFillExistingDisks();
+
+/*
+ *
+ * Called when OS family type changes
+ *
+ */
+function newVMUpdateOSList(osfam) {
+
+ document.forms['frmwizardNewVM'].newVMOSType.options.length = 0;
+ $(document.forms['frmwizardNewVM'].newVMOSType).children().remove();
+ for(var i = 0; i < newVMOSTypes[osfam].osTypes.length; i++) {
+ document.forms['frmwizardNewVM'].newVMOSType.options[i] = new Option(newVMOSTypes[osfam].osTypes[i].description, newVMOSTypes[osfam].osTypes[i].id);
+ }
+ // Trigger change
+ newVMUpdateOS(newVMOSTypes[osfam].osTypes[0].id);
+}
+
+function newVMUpdateOS(ostype) {
+
+ document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(ostype);
+
+ ostype = newVMOSTypesObj[ostype];
+
+ $('#wizardNewVMSize').slider('value',ostype.recommendedRAM);
+
+ $('#newVMSizeLabel').html(trans("<p>Select the amount of memory (RAM) in megabytes "+
+ "to be allocated to the virtual machine.</p>"+
+ "<p>The recommended memory size is <b>%1</b> MB.</p>",'UIWizardNewVM').replace('%1',ostype.recommendedRAM));
+
+ $('#newVMHDSizeLabel').html(trans("<p>If you wish you can add a virtual hard disk to the new machine. "+
+ "You can either create a new hard disk file or select one from the list or from another location "+
+ "using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step "+
+ "and make the changes to the machine settings once the machine is created.</p><p>The recommended "+
+ "size of the hard disk is <b>%1</b>.</p>",'UIWizardNewVM').replace('%1',vboxMbytesConvert(ostype.recommendedHDD)));
+
+}
+
+var newVMOSTypes = new Array();
+var newVMOSTypesObj = {};
+
+// shorthand
+var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+
+// Default OS Type set to my fav :) Eventually will move to config.php
+var vboxDefaultOSTypeId = 'Debian';
+
+
+var dosfam = null; // holds defaultostype family id
+for(var i in vboxOSTypes) {
+
+ // Skip unsupported OS types
+ if(!vboxOSTypes[i].supported) continue;
+
+ // create array of os family types
+ if(!newVMOSTypes[vboxOSTypes[i].familyId]) {
+ newVMOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
+ }
+
+ // We're on the default os type, record family id and index number
+ // so that we can set it later on
+ if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
+ dosfam = vboxOSTypes[i].familyId;
+ vboxDefaultOSTypeId = newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length;
+ }
+
+ newVMOSTypes[vboxOSTypes[i].familyId].osTypes[newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
+
+ newVMOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
+
+ // Preload icons
+ vboxOSTypes[i].icon = new Image();
+ vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
+
+}
+// clear all options
+document.forms['frmwizardNewVM'].newVMOSFamily.options.length = 0;
+$(document.forms['frmwizardNewVM'].newVMOSFamily).children().remove();
+for(var i in newVMOSTypes) {
+ // default os type family? record in dosfam
+ if(i == dosfam) dosfam = document.forms['frmwizardNewVM'].newVMOSFamily.options.length;
+ document.forms['frmwizardNewVM'].newVMOSFamily.options[document.forms['frmwizardNewVM'].newVMOSFamily.options.length] = new Option(newVMOSTypes[i].description, newVMOSTypes[i].id);
+}
+// OnChange, update os type list and icon
+document.getElementById('newVMOSFamily').setAttribute('onChange','newVMUpdateOSList(this.value)');
+document.getElementById('newVMOSType').setAttribute('onChange','newVMUpdateOS(this.value)');
+
+document.forms['frmwizardNewVM'].newVMOSFamily.selectedIndex = dosfam;
+newVMUpdateOSList(document.forms['frmwizardNewVM'].newVMOSFamily.value);
+document.forms['frmwizardNewVM'].newVMOSType.selectedIndex = vboxDefaultOSTypeId;
+newVMUpdateOS(document.forms['frmwizardNewVM'].newVMOSType.options[document.forms['frmwizardNewVM'].newVMOSType.selectedIndex].value);
+
+/*
+ * END OS TYPES
+ */
+
+$('#wizardNewVMStep1').on('show',function(e,wiz){
+ $(document.forms['frmwizardNewVM'].newVMName).focus();
+});
+
+/* When going to step2, make sure a name is entered */
+$('#wizardNewVMStep2').on('show',function(e,wiz){
+
+ document.forms['frmwizardNewVM'].newVMName.value = jQuery.trim(document.forms['frmwizardNewVM'].newVMName.value);
+
+ if(!document.forms['frmwizardNewVM'].newVMName.value) {
+ $(document.forms['frmwizardNewVM'].newVMName).addClass('vboxRequired');
+ // Go back
+ wiz.displayStep(1);
+ return;
+ }
+
+ var l = new vboxLoader();
+ l.add('vboxGetComposedMachineFilename',function(d){
+
+ loc = vboxDirname(d.responseData);
+
+ var fe = new vboxLoader();
+ fe.add('fileExists',function(d){
+ fileExists = d.responseData;
+ },{'file':loc});
+ fe.onLoad = function() {
+ if(fileExists) {
+ vboxAlert(trans('<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p>','UIMessageCenter').replace('%1',vboxBasename(loc)).replace('%2',vboxDirname(loc)));
+ // Go back
+ wiz.displayStep(1);
+
+ return;
+ }
+ $(document.forms['frmwizardNewVM'].newVMName).removeClass('vboxRequired');
+
+ // Update disabled / enabled items
+ if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
+ $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
+ } else {
+ $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
+ }
+
+ };
+ fe.run();
+
+
+ },{'name':document.forms['frmwizardNewVM'].newVMName.value, 'group':wiz.vmgroup});
+
+ l.run();
+
+});
+
+/* When hard disk is enabled / disabled */
+$('#newVMHDTriggerBind').on('enable',function(){
+
+ // Update disabled / enabled items
+ if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
+ $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
+ } else {
+ $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
+ }
+
+}).on('disable',function(){
+ newVMToggleNewDisk(true);
+});
+
+
+
+</script>
diff --git a/panes/wizardNewVMAdvanced.html b/panes/wizardNewVMAdvanced.html
index 5c7a3c1..3b92917 100644
--- a/panes/wizardNewVMAdvanced.html
+++ b/panes/wizardNewVMAdvanced.html
@@ -1,276 +1,276 @@
-<!--
-
- Advanced panes for new virtual machine wizard. Logic in vboxWizard()
- Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
-
- $Id: wizardNewVMAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
-
- -->
-
-<!-- Step 1 -->
-<div id='wizardNewVMStep1' style='display: none'>
-
- <span class='vboxTableLabel translate'>Name and operating system</span>
- <div class='vboxOptions'>
- <table class='vboxOptions vboxOSTypeOptions' style='width:100%'>
- <tr>
- <th style='width: 1%'><span class='translate'>Name:</span></th>
- <td colspan='2'><input type='text' class='vboxText' name='newVMName' style='width: 95%' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Type:</span></th>
- <td style='width: 100%'><select name='newVMOSFamily' id='newVMOSFamily' style='width: 100%'>
- <option value='Linux'>Linux</option>
- </select></td>
- <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
- </tr>
- <tr>
- <th><span class='translate'>Version:</span></th>
- <td><select id='newVMOSType' name='newVMOSType' style='width: 100%'>
- <option value='Debian'>Debian</option>
- </select></td>
- </tr>
- </table>
- </div>
-
- <span class='vboxTableLabel translate'>Memory size</span>
- <div class='vboxOptions'>
-
- <table style='width: 100%'>
- <tr>
- <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
- <div style='margin-top: 4px' id='wizardNewVMSize' class='slider translateglob'><div class='sliderScale'></div></div>
- </td>
- <td style='white-space: nowrap'><input type='text' class='vboxText' name='wizardNewVMSizeValue' size='5' class='sliderValue' /> <span class='translate'>MB</span></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='wizardNewVMMin'>1</span> <span class='translate'>MB</span></td>
- <td style='text-align: right;'><span id='wizardNewVMMax'>128</span> <span class='translate'>MB</span></td>
- </tr>
- </table>
- </td>
- <td></td>
- </tr>
- </table>
- </div>
-
- <span class='vboxTableLabel translate'>Hard disk</span>
- <div class='vboxOptions'>
-
- <table class='vboxOptions' id='newVMBootDiskTable' style='width:100%;'>
- <tr>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="none" onClick="newVMToggleNewDisk(true)" /> <span class='translate vboxEnablerListen'>Do not add a virtual hard disk</span></label></td>
- </tr>
- <tr id='newVMHDTriggerBind' class='vboxEnablerTrigger'>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="create" onClick="newVMToggleNewDisk(true)" checked='checked' /> <span class='translate vboxEnablerListen'>Create a virtual hard disk now</span></label></td>
- </tr>
- <tr>
- <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="existing" onClick="newVMToggleNewDisk(false)" /> <span class='translate vboxEnablerListen'>Use an existing virtual hard disk file</span></label></td>
- </tr>
- <tr>
- <td style='padding-left: 24px; white-space: nowrap'>
- <table class='vboxInvisible' style='width: 99%;'>
- <tr>
- <td><select id="newVMDiskSelectId" name="newVMDiskSelect" disabled='disabled'></select></td>
- <td style='width:1%' id='newVMDiskVMM'></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
-</div>
-
-
-<script type='text/javascript'>
-
-/* Translations */
-$('#wizardNewVMStep1').find('table.vboxOSTypeOptions').find('span.translate').html(function(i,h) {
- return trans(h,'UINameAndSystemEditor');
-}).removeClass('translate');
-
-
-var wizardNewVMToolbar = new vboxToolbarSingle({button: {
- /* Add Attachment Button */
- 'name' : 'mselecthdbtn',
- 'label' : 'Choose a virtual hard disk file...',
- 'language_context': 'UIMachineSettingsStorage',
- 'icon' : 'select_file',
- 'click' : function () {
- vboxMedia.actions.choose(null,'HardDisk',function(med){
- if(med) vmNewFillExistingDisks(med.base);
- });
- }
-}});
-wizardNewVMToolbar.renderTo('newVMDiskVMM');
-
-/* Toggle new / existing */
-function newVMToggleNewDisk(dis) {
-
- if(dis) {
- wizardNewVMToolbar.disable();
- document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = true;
- $('#wizardNewVMStep1').find('.vboxMediumSelect').trigger('disable');
- } else {
- wizardNewVMToolbar.enable();
- document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = (document.forms['frmwizardNewVM'].newVMDiskSelect.options.length > 0 ? false : true);
- $('#wizardNewVMStep1').find('.vboxMediumSelect').trigger('enable');
- }
-
-}
-
-/* Mem size slider */
-var min = 4;
-var max = parseInt($('#vboxPane').data('vboxHostDetails').memorySize);
-
-$('#wizardNewVMSize').data('form','frmwizardNewVM');
-
-$('#wizardNewVMSize').slider({'min':min,'max':max,'step':1});
-$('#wizardNewVMSize').slider('value',4);
-
-$('#wizardNewVMMin').html(min);
-$('#wizardNewVMMax').html(max);
-
-/* Fill existing attachments */
-function vmNewFillExistingDisks(sel) {
-
- document.forms['frmwizardNewVM'].newVMDiskSelect.options.length = 0;
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).children().remove();
-
- var s = vboxMedia.mediaForAttachmentType('HardDisk');
-
- // Sort media
- s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
-
- var mediumSelects = [];
- var selectedIndex = -1;
- for(var i = 0; i < s.length; i++) {
- document.forms['frmwizardNewVM'].newVMDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id, (sel && sel == s[i].id));
- if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardNewVM'].newVMDiskSelect.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 == s[i].id) {
- selectedIndex = i;
- }
- }
- if(selectedIndex > -1) {
- document.forms['frmwizardNewVM'].newVMDiskSelect.selectedIndex = selectedIndex;
- }
-
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
-
- if(sel) {
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'selectMedium':sel});
- $(document.forms['frmwizardNewVM'].newVMDiskSelect).val(sel);
- }
-}
-
-vmNewFillExistingDisks();
-
-/*
- *
- * Called when OS family type changes
- *
- */
-function newVMUpdateOSList(osfam) {
-
- document.forms['frmwizardNewVM'].newVMOSType.options.length = 0;
- $(document.forms['frmwizardNewVM'].newVMOSType).children().remove();
- for(var i = 0; i < newVMOSTypes[osfam].osTypes.length; i++) {
- document.forms['frmwizardNewVM'].newVMOSType.options[i] = new Option(newVMOSTypes[osfam].osTypes[i].description, newVMOSTypes[osfam].osTypes[i].id);
- }
- // Trigger change
- newVMUpdateOS(newVMOSTypes[osfam].osTypes[0].id);
-}
-
-function newVMUpdateOS(ostype) {
-
- document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(ostype);
-
- ostype = newVMOSTypesObj[ostype];
-
- $('#wizardNewVMSize').slider('value',ostype.recommendedRAM);
- $('#newVMSizeLabel').html(trans('The recommended memory size is <b>%1</b> MB.','UIWizardNewVMPage3').replace('%1',ostype.recommendedRAM));
- $('#newVMHDSizeLabel').html(trans('<p>If you wish you can add a virtual hard disk to the new machine. You can either create a new hard disk file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard disk is <b>%1</b>.</p>','UIWizardNewVMPage4').replace('%1',vboxMbytesConvert(ostype.recommendedHDD)));
-
-}
-
-var newVMOSTypes = new Array();
-var newVMOSTypesObj = {};
-
-// shorthand
-var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
-
-// Default OS Type set to my fav :) Eventually will move to config.php
-var vboxDefaultOSTypeId = 'Debian';
-
-
-var dosfam = null; // holds defaultostype family id
-for(var i in vboxOSTypes) {
-
- // Skip unsupported OS types
- if(!vboxOSTypes[i].supported) continue;
-
- // create array of os family types
- if(!newVMOSTypes[vboxOSTypes[i].familyId]) {
- newVMOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
- }
-
- // We're on the default os type, record family id and index number
- // so that we can set it later on
- if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
- dosfam = vboxOSTypes[i].familyId;
- vboxDefaultOSTypeId = newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length;
- }
-
- newVMOSTypes[vboxOSTypes[i].familyId].osTypes[newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
-
- newVMOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
-
- // Preload icons
- vboxOSTypes[i].icon = new Image();
- vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
-
-}
-// clear all options
-document.forms['frmwizardNewVM'].newVMOSFamily.options.length = 0;
-$(document.forms['frmwizardNewVM'].newVMOSFamily).children().remove();
-for(var i in newVMOSTypes) {
- // default os type family? record in dosfam
- if(i == dosfam) dosfam = document.forms['frmwizardNewVM'].newVMOSFamily.options.length;
- document.forms['frmwizardNewVM'].newVMOSFamily.options[document.forms['frmwizardNewVM'].newVMOSFamily.options.length] = new Option(newVMOSTypes[i].description, newVMOSTypes[i].id);
-}
-// OnChange, update os type list and icon
-document.getElementById('newVMOSFamily').setAttribute('onChange','newVMUpdateOSList(this.value)');
-document.getElementById('newVMOSType').setAttribute('onChange','newVMUpdateOS(this.value)');
-
-document.forms['frmwizardNewVM'].newVMOSFamily.selectedIndex = dosfam;
-newVMUpdateOSList(document.forms['frmwizardNewVM'].newVMOSFamily.value);
-document.forms['frmwizardNewVM'].newVMOSType.selectedIndex = vboxDefaultOSTypeId;
-newVMUpdateOS(document.forms['frmwizardNewVM'].newVMOSType.options[document.forms['frmwizardNewVM'].newVMOSType.selectedIndex].value);
-
-/*
- * END OS TYPES
- */
-
-/* When hard disk is enabled / disabled */
-$('#newVMHDTriggerBind').on('enable',function(){
-
- // Update disabled / enabled items
- if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
- $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
- } else {
- $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
- }
-
-}).on('disable',function(){
- newVMToggleNewDisk(true);
-}).trigger('disable');
-
-$('#wizardNewVMStep1').on('show',function() {
- $(document.forms['frmwizardNewVM'].newVMName).focus();
-});
-
-</script>
+<!--
+
+ Advanced panes for new virtual machine wizard. Logic in vboxWizard()
+ Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+
+ $Id: wizardNewVMAdvanced.html 595 2015-04-17 09:50:36Z imoore76 $
+
+ -->
+
+<!-- Step 1 -->
+<div id='wizardNewVMStep1' style='display: none'>
+
+ <span class='vboxTableLabel translate'>Name and operating system</span>
+ <div class='vboxOptions'>
+ <table class='vboxOptions vboxOSTypeOptions' style='width:100%'>
+ <tr>
+ <th style='width: 1%'><span class='translate'>Name:</span></th>
+ <td colspan='2'><input type='text' class='vboxText' name='newVMName' style='width: 95%' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Type:</span></th>
+ <td style='width: 100%'><select name='newVMOSFamily' id='newVMOSFamily' style='width: 100%'>
+ <option value='Linux'>Linux</option>
+ </select></td>
+ <td rowspan='2'><img name='vboxOSTypeImg' height='32' width='32' /></td>
+ </tr>
+ <tr>
+ <th><span class='translate'>Version:</span></th>
+ <td><select id='newVMOSType' name='newVMOSType' style='width: 100%'>
+ <option value='Debian'>Debian</option>
+ </select></td>
+ </tr>
+ </table>
+ </div>
+
+ <span class='vboxTableLabel translate'>Memory size</span>
+ <div class='vboxOptions'>
+
+ <table style='width: 100%'>
+ <tr>
+ <td style='width: 100%; border: 0px; margin: 0px; padding: 0px;'>
+ <div style='margin-top: 4px' id='wizardNewVMSize' class='slider translateglob'><div class='sliderScale'></div></div>
+ </td>
+ <td style='white-space: nowrap'><input type='text' class='vboxText' name='wizardNewVMSizeValue' size='5' class='sliderValue' /> <span class='translate'>MB</span></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='wizardNewVMMin'>1</span> <span class='translate'>MB</span></td>
+ <td style='text-align: right;'><span id='wizardNewVMMax'>128</span> <span class='translate'>MB</span></td>
+ </tr>
+ </table>
+ </td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+
+ <span class='vboxTableLabel translate'>Hard disk</span>
+ <div class='vboxOptions'>
+
+ <table class='vboxOptions' id='newVMBootDiskTable' style='width:100%;'>
+ <tr>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="none" onClick="newVMToggleNewDisk(true)" /> <span class='translate vboxEnablerListen'>Do not add a virtual hard disk</span></label></td>
+ </tr>
+ <tr id='newVMHDTriggerBind' class='vboxEnablerTrigger'>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="create" onClick="newVMToggleNewDisk(true)" checked='checked' /> <span class='translate vboxEnablerListen'>Create a virtual hard disk now</span></label></td>
+ </tr>
+ <tr>
+ <td style='padding:2px; padding-left: 14px'><label><input type="radio" class="vboxRadio" name="newVMDisk" value="existing" onClick="newVMToggleNewDisk(false)" /> <span class='translate vboxEnablerListen'>Use an existing virtual hard disk file</span></label></td>
+ </tr>
+ <tr>
+ <td style='padding-left: 24px; white-space: nowrap'>
+ <table class='vboxInvisible' style='width: 99%;'>
+ <tr>
+ <td><select id="newVMDiskSelectId" name="newVMDiskSelect" disabled='disabled'></select></td>
+ <td style='width:1%' id='newVMDiskVMM'></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+
+
+<script type='text/javascript'>
+
+/* Translations */
+$('#wizardNewVMStep1').find('table.vboxOSTypeOptions').find('span.translate').html(function(i,h) {
+ return trans(h,'UINameAndSystemEditor');
+}).removeClass('translate');
+
+
+var wizardNewVMToolbar = new vboxToolbarSingle({button: {
+ /* Add Attachment Button */
+ 'name' : 'mselecthdbtn',
+ 'label' : 'Choose a virtual hard disk file...',
+ 'language_context': 'UIMachineSettingsStorage',
+ 'icon' : 'select_file',
+ 'click' : function () {
+ vboxMedia.actions.choose(null,'HardDisk',function(med){
+ if(med) vmNewFillExistingDisks(med.base);
+ });
+ }
+}});
+wizardNewVMToolbar.renderTo('newVMDiskVMM');
+
+/* Toggle new / existing */
+function newVMToggleNewDisk(dis) {
+
+ if(dis) {
+ wizardNewVMToolbar.disable();
+ document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = true;
+ $('#wizardNewVMStep1').find('.vboxMediumSelect').trigger('disable');
+ } else {
+ wizardNewVMToolbar.enable();
+ document.forms['frmwizardNewVM'].newVMDiskSelect.disabled = (document.forms['frmwizardNewVM'].newVMDiskSelect.options.length > 0 ? false : true);
+ $('#wizardNewVMStep1').find('.vboxMediumSelect').trigger('enable');
+ }
+
+}
+
+/* Mem size slider */
+var min = 4;
+var max = parseInt($('#vboxPane').data('vboxHostDetails').memorySize);
+
+$('#wizardNewVMSize').data('form','frmwizardNewVM');
+
+$('#wizardNewVMSize').slider({'min':min,'max':max,'step':1});
+$('#wizardNewVMSize').slider('value',4);
+
+$('#wizardNewVMMin').html(min);
+$('#wizardNewVMMax').html(max);
+
+/* Fill existing attachments */
+function vmNewFillExistingDisks(sel) {
+
+ document.forms['frmwizardNewVM'].newVMDiskSelect.options.length = 0;
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).children().remove();
+
+ var s = vboxMedia.mediaForAttachmentType('HardDisk');
+
+ // Sort media
+ s.sort(function(a,b){return strnatcasecmp(a.name,b.name);});
+
+ var mediumSelects = [];
+ var selectedIndex = -1;
+ for(var i = 0; i < s.length; i++) {
+ document.forms['frmwizardNewVM'].newVMDiskSelect.options[i] = new Option(vboxMedia.mediumPrint(s[i]),s[i].id, (sel && sel == s[i].id));
+ if(s[i].readOnly && s[i].deviceType == 'HardDisk') $(document.forms['frmwizardNewVM'].newVMDiskSelect.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 == s[i].id) {
+ selectedIndex = i;
+ }
+ }
+ if(selectedIndex > -1) {
+ document.forms['frmwizardNewVM'].newVMDiskSelect.selectedIndex = selectedIndex;
+ }
+
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'type':'HardDisk','showdiff':false,'media':mediumSelects});
+
+ if(sel) {
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).mediumselect({'selectMedium':sel});
+ $(document.forms['frmwizardNewVM'].newVMDiskSelect).val(sel);
+ }
+}
+
+vmNewFillExistingDisks();
+
+/*
+ *
+ * Called when OS family type changes
+ *
+ */
+function newVMUpdateOSList(osfam) {
+
+ document.forms['frmwizardNewVM'].newVMOSType.options.length = 0;
+ $(document.forms['frmwizardNewVM'].newVMOSType).children().remove();
+ for(var i = 0; i < newVMOSTypes[osfam].osTypes.length; i++) {
+ document.forms['frmwizardNewVM'].newVMOSType.options[i] = new Option(newVMOSTypes[osfam].osTypes[i].description, newVMOSTypes[osfam].osTypes[i].id);
+ }
+ // Trigger change
+ newVMUpdateOS(newVMOSTypes[osfam].osTypes[0].id);
+}
+
+function newVMUpdateOS(ostype) {
+
+ document.images["vboxOSTypeImg"].src = "images/vbox/" + vboxGuestOSTypeIcon(ostype);
+
+ ostype = newVMOSTypesObj[ostype];
+
+ $('#wizardNewVMSize').slider('value',ostype.recommendedRAM);
+ $('#newVMSizeLabel').html(trans('The recommended memory size is <b>%1</b> MB.','UIWizardNewVMPage3').replace('%1',ostype.recommendedRAM));
+ $('#newVMHDSizeLabel').html(trans('<p>If you wish you can add a virtual hard disk to the new machine. You can either create a new hard disk file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard disk is <b>%1</b>.</p>','UIWizardNewVMPage4').replace('%1',vboxMbytesConvert(ostype.recommendedHDD)));
+
+}
+
+var newVMOSTypes = new Array();
+var newVMOSTypesObj = {};
+
+// shorthand
+var vboxOSTypes = $('#vboxPane').data('vboxOSTypes');
+
+// Default OS Type set to my fav :) Eventually will move to config.php
+var vboxDefaultOSTypeId = 'Debian';
+
+
+var dosfam = null; // holds defaultostype family id
+for(var i in vboxOSTypes) {
+
+ // Skip unsupported OS types
+ if(!vboxOSTypes[i].supported) continue;
+
+ // create array of os family types
+ if(!newVMOSTypes[vboxOSTypes[i].familyId]) {
+ newVMOSTypes[vboxOSTypes[i].familyId] = {'id':vboxOSTypes[i].familyId,'description':vboxOSTypes[i].familyDescription,'osTypes':[]};
+ }
+
+ // We're on the default os type, record family id and index number
+ // so that we can set it later on
+ if(vboxOSTypes[i].id == vboxDefaultOSTypeId) {
+ dosfam = vboxOSTypes[i].familyId;
+ vboxDefaultOSTypeId = newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length;
+ }
+
+ newVMOSTypes[vboxOSTypes[i].familyId].osTypes[newVMOSTypes[vboxOSTypes[i].familyId].osTypes.length] = {'id':vboxOSTypes[i].id,'description':vboxOSTypes[i].description };
+
+ newVMOSTypesObj[vboxOSTypes[i].id] = vboxOSTypes[i];
+
+ // Preload icons
+ vboxOSTypes[i].icon = new Image();
+ vboxOSTypes[i].icon.src = "images/vbox/" + vboxGuestOSTypeIcon(vboxOSTypes[i].id);
+
+}
+// clear all options
+document.forms['frmwizardNewVM'].newVMOSFamily.options.length = 0;
+$(document.forms['frmwizardNewVM'].newVMOSFamily).children().remove();
+for(var i in newVMOSTypes) {
+ // default os type family? record in dosfam
+ if(i == dosfam) dosfam = document.forms['frmwizardNewVM'].newVMOSFamily.options.length;
+ document.forms['frmwizardNewVM'].newVMOSFamily.options[document.forms['frmwizardNewVM'].newVMOSFamily.options.length] = new Option(newVMOSTypes[i].description, newVMOSTypes[i].id);
+}
+// OnChange, update os type list and icon
+document.getElementById('newVMOSFamily').setAttribute('onChange','newVMUpdateOSList(this.value)');
+document.getElementById('newVMOSType').setAttribute('onChange','newVMUpdateOS(this.value)');
+
+document.forms['frmwizardNewVM'].newVMOSFamily.selectedIndex = dosfam;
+newVMUpdateOSList(document.forms['frmwizardNewVM'].newVMOSFamily.value);
+document.forms['frmwizardNewVM'].newVMOSType.selectedIndex = vboxDefaultOSTypeId;
+newVMUpdateOS(document.forms['frmwizardNewVM'].newVMOSType.options[document.forms['frmwizardNewVM'].newVMOSType.selectedIndex].value);
+
+/*
+ * END OS TYPES
+ */
+
+/* When hard disk is enabled / disabled */
+$('#newVMHDTriggerBind').on('enable',function(){
+
+ // Update disabled / enabled items
+ if(document.forms['frmwizardNewVM'].newVMDisk[0].checked) {
+ $(document.forms['frmwizardNewVM'].newVMDisk[0]).trigger('click');
+ } else {
+ $(document.forms['frmwizardNewVM'].newVMDisk[1]).trigger('click');
+ }
+
+}).on('disable',function(){
+ newVMToggleNewDisk(true);
+}).trigger('disable');
+
+$('#wizardNewVMStep1').on('show',function() {
+ $(document.forms['frmwizardNewVM'].newVMName).focus();
+});
+
+</script>
diff --git a/recovery.php-disabled b/recovery.php-disabled
index a516059..bb4bd71 100644
--- a/recovery.php-disabled
+++ b/recovery.php-disabled
@@ -1,70 +1,70 @@
-<?php
-/*
-
- phpVirtualBox admin password recovery.
-
- Rename recovery.php-disabled to recovery.php, navigate to it in your web
- browser and follow the instructions presented.
-
-*/
-
-# Turn off PHP errors
-error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
-
-
-//Set no caching
-header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
-header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
-header("Pragma: no-cache");
-
-require_once(dirname(__FILE__).'/endpoints/lib/config.php');
-require_once(dirname(__FILE__).'/endpoints/lib/utils.php');
-require_once(dirname(__FILE__).'/endpoints/lib/vboxconnector.php');
-
-
-/*
- * Clean request
- */
-$vboxRequest = clean_request();
-
-/* Check for recovery */
-
-if($vboxRequest['recover']) {
-
- try {
- // Use main / auth server
- $vbox = new vboxconnector(true);
- $vbox->skipSessionCheck = true;
- $vbox->connect();
-
- $vbox->vbox->setExtraData('phpvb/users/admin/pass', hash('sha512', 'admin'));
- $vbox->vbox->setExtraData('phpvb/users/admin/admin', '1');
- echo("Admin account updated. Please rename this file to <b>recovery.php-disabled</b>. phpVirtualBox will refuse to run if this has not been done.");
-
- } catch (Exception $e) {
- echo("<pre>");
- print_r($e);
- echo("</pre>");
- }
- return;
-}
-
-?>
-<html>
-<head>
-<title>Admin Account Recovery</title>
-</head>
-<body>
-<h3>Admin Account Recovery</h3>
-<p>This form will add the default user <b>admin</b> with a default password of <b>admin</b>. If the user <b>admin</b> already exists, its password will be changed to <b>admin</b>.</p>
-<p>Click the Recover button to add / update this user.</p>
-<form method='POST'>
- <p>
- <input type='hidden' name='recover' value='1' />
- <input type='submit' value='Recover' />
- </p>
-</form>
-</body>
-</html>
-
+<?php
+/*
+
+ phpVirtualBox admin password recovery.
+
+ Rename recovery.php-disabled to recovery.php, navigate to it in your web
+ browser and follow the instructions presented.
+
+*/
+
+# Turn off PHP errors
+error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING);
+
+
+//Set no caching
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
+header("Pragma: no-cache");
+
+require_once(dirname(__FILE__).'/endpoints/lib/config.php');
+require_once(dirname(__FILE__).'/endpoints/lib/utils.php');
+require_once(dirname(__FILE__).'/endpoints/lib/vboxconnector.php');
+
+
+/*
+ * Clean request
+ */
+$vboxRequest = clean_request();
+
+/* Check for recovery */
+
+if($vboxRequest['recover']) {
+
+ try {
+ // Use main / auth server
+ $vbox = new vboxconnector(true);
+ $vbox->skipSessionCheck = true;
+ $vbox->connect();
+
+ $vbox->vbox->setExtraData('phpvb/users/admin/pass', hash('sha512', 'admin'));
+ $vbox->vbox->setExtraData('phpvb/users/admin/admin', '1');
+ echo("Admin account updated. Please rename this file to <b>recovery.php-disabled</b>. phpVirtualBox will refuse to run if this has not been done.");
+
+ } catch (Exception $e) {
+ echo("<pre>");
+ print_r($e);
+ echo("</pre>");
+ }
+ return;
+}
+
+?>
+<html>
+<head>
+<title>Admin Account Recovery</title>
+</head>
+<body>
+<h3>Admin Account Recovery</h3>
+<p>This form will add the default user <b>admin</b> with a default password of <b>admin</b>. If the user <b>admin</b> already exists, its password will be changed to <b>admin</b>.</p>
+<p>Click the Recover button to add / update this user.</p>
+<form method='POST'>
+ <p>
+ <input type='hidden' name='recover' value='1' />
+ <input type='submit' value='Recover' />
+ </p>
+</form>
+</body>
+</html>
+