Skip to content

Commit

Permalink
Patch adds a name and OS type selector to the new VM wizard. The OS t…
Browse files Browse the repository at this point in the history
…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
vboxweb committed Aug 26, 2009
1 parent 26afeee commit b7a0c07
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
46 changes: 46 additions & 0 deletions www/static/js/vboxDialogs.js
Expand Up @@ -119,6 +119,52 @@ var vboxDialogs = Class.create(


showNewVMWizard: function() 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-form").formwizard("reset");
jQuery("#newvm-dialog").dialog("open"); jQuery("#newvm-dialog").dialog("open");
} }
Expand Down
5 changes: 4 additions & 1 deletion www/static/js/vboxGlobal.js
Expand Up @@ -273,7 +273,10 @@ var vboxGlobal = Class.create(
default: default:
break; break;
} }
return strBasePath + strIcon; if (fRelative == true)
return strIcon;
else
return strBasePath + strIcon;
}, },


hardDiskType: function (type) hardDiskType: function (type)
Expand Down

0 comments on commit b7a0c07

Please sign in to comment.