[pve-devel] r5690 - pve-manager/pve2/www/manager/window

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Mar 14 06:43:50 CET 2011


Author: dietmar
Date: 2011-03-14 06:43:50 +0100 (Mon, 14 Mar 2011)
New Revision: 5690

Modified:
   pve-manager/pve2/www/manager/window/LoginWindow.js
Log:
save last login realm


Modified: pve-manager/pve2/www/manager/window/LoginWindow.js
===================================================================
--- pve-manager/pve2/www/manager/window/LoginWindow.js	2011-03-14 05:23:44 UTC (rev 5689)
+++ pve-manager/pve2/www/manager/window/LoginWindow.js	2011-03-14 05:43:50 UTC (rev 5690)
@@ -51,21 +51,34 @@
 	    autoSelect: false,
 	    triggerAction: 'all',
 	    valueField: 'realm',
-	    displayField: 'comment'
+	    displayField: 'comment',
+	    getState: function() {
+		return { value: this.getValue() };
+	    },
+	    applyState : function(state) {
+		if (state && state.value) {
+		    this.setValue(state.value);
+		}
+	    },
+	    stateEvents: [ 'select' ],
+	    stateful: true,
+	    stateId: 'pveloginrealm'        
 	});
 
 	realmstore.load({
 	    callback: function(r, o, success) {
 		if (success) {
-		    var def;
-		    if (r[0] && r[0].data)
-			def = r[0].data.realm;
-		    Ext.each(r, function(record) {
-			if (record.data && record.data["default"]) 
-			    def = record.data.realm;
-		    });
+		    var def = combo.getValue();
+		    if (!def) {
+			if (r[0] && r[0].data)
+			    def = r[0].data.realm;
+			Ext.each(r, function(record) {
+			    if (record.data && record.data["default"]) 
+				def = record.data.realm;
+			});
+		    }
 		    if (def)
-			combo.setValue(def);
+			combo.setValue(def)
 		}
 	    }
 	});




More information about the pve-devel mailing list