[pve-devel] r5892 - pve-manager/pve2/www/new/window

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 3 09:33:11 CEST 2011


Author: dietmar
Date: 2011-05-03 09:33:11 +0200 (Tue, 03 May 2011)
New Revision: 5892

Modified:
   pve-manager/pve2/www/new/window/Wizard.js
Log:
verify after render


Modified: pve-manager/pve2/www/new/window/Wizard.js
===================================================================
--- pve-manager/pve2/www/new/window/Wizard.js	2011-05-03 06:19:55 UTC (rev 5891)
+++ pve-manager/pve2/www/new/window/Wizard.js	2011-05-03 07:33:11 UTC (rev 5892)
@@ -108,6 +108,30 @@
 	    }
 	};
 
+	var tabchange = function(tp, newcard, oldcard) {	    
+	    if (newcard.onSubmit) {
+		me.down('#next').setVisible(false);
+		me.down('#submit').setVisible(true); 
+	    } else {
+		me.down('#next').setVisible(true);
+		me.down('#submit').setVisible(false); 
+	    }
+	    var valid = check_card(newcard);
+	    me.down('#next').setDisabled(!valid);    
+	    me.down('#submit').setDisabled(!valid);    
+	    me.down('#back').setDisabled(tp.items.indexOf(newcard) == 0);
+
+	    if (oldcard && !check_card(oldcard)) {
+		disable_at(oldcard);
+	    }
+
+	    var next = tp.items.indexOf(newcard) + 1;
+	    var ntab = tp.items.getAt(next);
+	    if (valid && ntab && !newcard.onSubmit) {
+		ntab.enable();
+	    }
+	};
+
 	Ext.applyIf(me, {
 	    width: 600,
 	    height: 400,
@@ -145,28 +169,13 @@
 			    layout: 'vbox'
 			},
  			listeners: {
+			    afterrender: function(tp) {
+				var atab = this.getActiveTab();
+				tabchange(tp, atab);
+			    },
 			    tabchange: function(tp, newcard, oldcard) {
 				display_header(newcard);
-				if (newcard.onSubmit) {
-				    me.down('#next').setVisible(false);
-				    me.down('#submit').setVisible(true); 
-				} else {
-				    me.down('#next').setVisible(true);
-				    me.down('#submit').setVisible(false); 
-				}
-				var valid = check_card(newcard);
-				me.down('#next').setDisabled(!valid);    
-				me.down('#submit').setDisabled(!valid);    
-				me.down('#back').setDisabled(tp.items.indexOf(newcard) == 0);
-
-				if (oldcard && !check_card(oldcard)) {
-				    disable_at(oldcard);
-				}
-				var next = tp.items.indexOf(newcard) + 1;
-				var ntab = tp.items.getAt(next);
-				if (valid && ntab && !newcard.onSubmit) {
-				    ntab.enable();
-				}
+				tabchange(tp, newcard, oldcard);
 			    }
 			},
 			items: tabs
@@ -194,6 +203,5 @@
 		}
 	    });
 	});
-
     }
 });




More information about the pve-devel mailing list