6082b925a9a70897583ac4251c96006a24b6c1c8 tdreszer Thu Apr 25 12:52:24 2013 -0700 Added cartTimeoutBoolean, which allows setting a var to true and having it timeout after a given number of hours. diff --git src/hg/inc/cart.h src/hg/inc/cart.h index 014719a..d510b9f 100644 --- src/hg/inc/cart.h +++ src/hg/inc/cart.h @@ -265,30 +265,35 @@ return cartUsualBoolean(cart, _cartVarDbName(db, var), usual); } boolean cartCgiUsualBoolean(struct cart *cart, char *var, boolean usual); /* Look for var in CGI, then in cart, if not found then return usual. */ void cartSetBoolean(struct cart *cart, char *var, boolean val); /* Set boolean value. */ INLINE void cartSetBooleanDb(struct cart *cart, char *db, char *var, boolean val) /* Set boolean value for $var_db. */ { cartSetBoolean(cart, _cartVarDbName(db, var), val); } +boolean cartTimeoutBoolean(struct cart *cart, char *var, int hours); +// Returns true if a cart var was set to non-zero less than hours ago +// If the var has expired or val=0, it will be deleted. +// If val is non-zero and not a time_t, (e.g. 'set') then the timer is started. + void cartMakeTextVar(struct cart *cart, char *var, char *defaultVal, int charSize); /* Make a text control filled with value from cart if it exists or * default value otherwise. If charSize is zero it's calculated to fit * current value. Default value may be NULL. */ void cartMakeIntVar(struct cart *cart, char *var, int defaultVal, int maxDigits); /* Make a text control filled with integer value - from cart if available * otherwise default. */ void cartMakeDoubleVar(struct cart *cart, char *var, double defaultVal, int maxDigits); /* Make a text control filled with integer value - from cart if available * otherwise default. */ void cartMakeCheckBox(struct cart *cart, char *var, boolean defaultVal); /* Make a check box filled with value from cart if it exists or