[pve-devel] Expiration for user in pve-manager/UserEdit.js

Dietmar Maurer dietmar at proxmox.com
Fri Jul 15 07:28:51 CEST 2011


> The gui looks good, but it does not reset the expire field to never after setting a
> date.  Do you have any idea how to make this work?

@@ -139,7 +148,12 @@
                 success: function(form, action) {
 		    var data = action.result.data;
 		    if (Ext.isDefined(data.expire)) {
-			ipanel.setValues({ expire: new Date(data.expire * 1000) });
+			if (data.expire) {
+			    ipanel.setValues({ expire: new Date(data.expire * 1000) });
+			} else {
+			    // display 'never' instead of '1970-01-01'
+			    ipanel.setValues({ expire: '' });
+			}
 		    }
                 }
             });

> Do you know how to combine two fields into one submitted?  

Just add any modification to the onGetValues() function:

@@ -122,7 +122,16 @@
 
 	var ipanel = Ext.create('PVE.panel.InputPanel', {
 	    column1: column1,
-	    column2: column2
+	    column2: column2,
+	    onGetValues: function(values) {
+		// hack: ExtJS datefield does not submit 0, so we need to set that
+		if (!values.expire) {
+		    values.expire = 0;
+		}
+
+		return values;
+	    },
+
 	});




More information about the pve-devel mailing list