[pve-devel] r5895 - in pve-manager/pve2/www/new: qemu window

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 3 11:03:17 CEST 2011


Author: dietmar
Date: 2011-05-03 11:03:17 +0200 (Tue, 03 May 2011)
New Revision: 5895

Modified:
   pve-manager/pve2/www/new/qemu/CreateWizard.js
   pve-manager/pve2/www/new/window/Wizard.js
Log:
use RadioGroup, per tab validation


Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 07:45:37 UTC (rev 5894)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-03 09:03:17 UTC (rev 5895)
@@ -1,7 +1,10 @@
 
 Ext.define('PVE.qemu.CreateWizard', {
     extend: 'PVE.window.Wizard',
-    requires: ['PVE.data.ResourceStore'],
+    requires: [    
+	'Ext.form.*',
+	'PVE.data.ResourceStore'
+    ],
 
     initComponent: function() {
 	var me = this;
@@ -40,7 +43,82 @@
 			}
 		    ]
 		},
+
 		{
+		    title: 'OS Type',
+		    layout: 'fit',
+		    items: {
+			xtype: 'radiogroup',
+			allowBlank: false,
+			//msgTarget: 'side',
+			//autoFitErrors: false,
+			//anchor: '-18',
+			layout: 'column',
+			defaultType: 'container',
+			items: [{
+			    columnWidth: .5,
+			    items: [
+				{
+				    xtype: 'component', 
+				    html: 'Microsoft Windows', 
+				    cls:'x-form-check-group-label'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'win7',
+				    boxLabel: 'Microsoft Windows 7/2008r2'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'w2k8',
+				    boxLabel: 'Microsoft Windows Vista/2008'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'wxp',
+				    boxLabel: 'Microsoft Windows XP/2003'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'w2k',
+				    boxLabel: 'Microsoft Windows 2000'
+				}
+			    ]
+			},{
+			    columnWidth: .5,
+			    items: [
+				{
+				    xtype: 'component', 
+				    html: 'Linux/Other', 
+				    cls:'x-form-check-group-label'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'l26',
+				    boxLabel: 'Linux 2.6 Kernel'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'l24',
+				    boxLabel: 'Linux 2.4 Kernel'
+				},
+				{
+				    xtype: 'radiofield',
+				    name: 'ostype',
+				    inputValue: 'other',
+				    boxLabel: 'Other'
+				}
+			    ]
+			}]
+		    }
+		},
+		{
 		    title: 'CPU',
 		    items: [
 			{
@@ -172,54 +250,6 @@
 		    ]
 		},
 		{
-		    title: 'OS Type',
-		    items: [
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'win7',
-			    checked: true,
-			    boxLabel: 'Microsoft Windows 7/2008r2'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'w2k8',
-			    boxLabel: 'Microsoft Windows Vista/2008'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'wxp',
-			    boxLabel: 'Microsoft Windows XP/2003'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'w2k',
-			    boxLabel: 'Microsoft Windows 2000'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'l26',
-			    boxLabel: 'Linux 2.6 Kernel'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'l24',
-			    boxLabel: 'Linux 2.4 Kernel'
-			},
-			{
-			    xtype: 'radiofield',
-			    name: 'ostype',
-			    inputValue: 'other',
-			    boxLabel: 'Other'
-			}
-		    ]
-		},
-		{
 		    title: 'Confirm',
 		    listeners: {
 			show: function() {

Modified: pve-manager/pve2/www/new/window/Wizard.js
===================================================================
--- pve-manager/pve2/www/new/window/Wizard.js	2011-05-03 07:45:37 UTC (rev 5894)
+++ pve-manager/pve2/www/new/window/Wizard.js	2011-05-03 09:03:17 UTC (rev 5895)
@@ -10,6 +10,12 @@
 
 	var tabs = me.items || [];
 	delete me.items;
+	
+	/* 
+	 * Items may have the following functions:
+	 * validate(): per tab custom validation
+	 * onSubmit(): submit handler
+	 */
 
 	Ext.Array.each(tabs, function(tab) {
 	    tab.disabled = true;
@@ -18,11 +24,15 @@
 
 	var check_card = function(card) {
 	    var valid = true;
-	    var fields = card.query('field');
+	    var fields = card.query('field, fieldcontainer');
 	    Ext.Array.each(fields, function(field) {
 		if (!field.isValid())
 		    valid = false;
 	    });
+
+	    if (Ext.isFunction(card.validate))
+		return card.validate();
+
 	    return valid;
 	};
 




More information about the pve-devel mailing list