Permalink
Browse files

Patch adds a name and OS type selector to the new VM wizard. The OS t…

…ype list is dynamically constructed, part 2 (Achim Hasenmueller).

git-svn-id: http://vboxweb.googlecode.com/svn/trunk@80 729376a8-6c6b-11de-afdd-bb9f892af8c1
  • Loading branch information...
1 parent 26afeee commit b7a0c07e56047ddeff1d329f6c3cb057180f9c49 vboxweb committed Aug 26, 2009
Showing with 50 additions and 1 deletion.
  1. +46 −0 www/static/js/vboxDialogs.js
  2. +4 −1 www/static/js/vboxGlobal.js
@@ -119,6 +119,52 @@ var vboxDialogs = Class.create(
showNewVMWizard: function()
{
+ /*
+ * Create the OS type menu. We're doing this here and not at dialog
+ * loading time for several reasons. First of all, the OS type list
+ * might not have been loaded from the server yet and also this is a
+ * potentially time consuming task. Later, we should load the whole
+ * dialog not at startup time but when called for the first time.
+ */
+ selectOSType = function(osTypeId)
+ {
+ jQuery("#ostype-selected").html(
+ "<img alt=\"\" width=\"20px\" align=\"top\" style=\"padding-right: 20px;\" src=\"" +
+ vbGlobal.vmGuestOSTypeIcon(osTypeId, false) + "\"/>" +
+ "<span id=\"ostype-selected-id\">" +
+ vbGlobal.mVirtualBox.getGuestOSTypeById(osTypeId).getDescription() +
+ "</span>"
+ );
+ }
+ var osTypes = vbGlobal.mVirtualBox.mArrGuestOSTypes;
+ for (var i = 0; i < osTypes.length; i++)
+ {
+ /* check if the menu for the family exists */
+ var submenu = jQuery("#ostype-submenu-" + osTypes[i].getFamilyId());
+ if (submenu.length == 0)
+ {
+ /* create link to the submenu */
+ jQuery("#osfamilies-span").append(
+ "<a class=\"{menu: 'ostype-submenu-" + osTypes[i].getFamilyId() + "', " +
+ "img: 'vm_start_32px.png'}\">" + osTypes[i].getFamilyId() + "</a>"
+ );
+ /* create the submenu */
+ jQuery("#ostype_submenues").append(
+ "<div id=\"ostype-submenu-" + osTypes[i].getFamilyId() + "\" class=\"menu\">" +
+ "<span id=\"osfamily-" + osTypes[i].getFamilyId() + "-span\"></span>" +
+ "</div>"
+ );
+ }
+ /* now add the OS entry to the right submenu, check if present to multiple calls to this method */
+ if (jQuery("#ostype-entry-" + osTypes[i].getId()).length == 0)
+ jQuery("#osfamily-" + osTypes[i].getFamilyId() + "-span").append(
+ "<a id=\"ostype-entry-" + osTypes[i].getId() + "\" class=\"{action: 'selectOSType(\\'" + osTypes[i].getId() + "\\')', img: '" +
+ vbGlobal.vmGuestOSTypeIcon(osTypes[i].getId(), true) +
+ "'}\">" + osTypes[i].getDescription() + "</a>"
+ );
+ }
+ /* start with Windows XP as the default */
+ selectOSType("WindowsXP");
jQuery("#newvm-form").formwizard("reset");
jQuery("#newvm-dialog").dialog("open");
}
@@ -273,7 +273,10 @@ var vboxGlobal = Class.create(
default:
break;
}
- return strBasePath + strIcon;
+ if (fRelative == true)
+ return strIcon;
+ else
+ return strBasePath + strIcon;
},
hardDiskType: function (type)

0 comments on commit b7a0c07

Please sign in to comment.