From: Wilfried Göesgens Date: Thu, 18 Dec 2008 20:32:04 +0000 (+0000) Subject: * add conditional for whether a preference value is set or not... X-Git-Tag: v7.86~1699 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=98fa4d8e76b1604736a6fe68e75b3dfadd7f5ad6 * add conditional for whether a preference value is set or not... * avoid to get into the "other case" situation where possible --- diff --git a/webcit/preferences.c b/webcit/preferences.c index 64001d7a4..737715ed4 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -764,6 +764,19 @@ int ConditionalPreference(WCTemplateToken *Tokens, void *Context, int ContextTyp return (StrTol(Pref) == Tokens->Params[3]->lvalue); } +int ConditionalHazePreference(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + StrBuf *Pref; + + if (!get_PREFERENCE(Tokens->Params[2]->Start, + Tokens->Params[2]->len, + &Pref) || + (Pref == NULL)) + return 0; + else + return 1; +} + HashList *GetGVEAHash(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) { StrBuf *Rcp; @@ -867,6 +880,7 @@ InitModule_PREFERENCES RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, CfgZoneTempl, NULL, CTX_PREF, CTX_NONE); RegisterConditional(HKEY("COND:PREF"), 4, ConditionalPreference, CTX_NONE); + RegisterConditional(HKEY("COND:PREF:SET"), 4, ConditionalHazePreference, CTX_NONE); RegisterIterator("PREF:VALID:EMAIL:ADDR", 0, NULL, GetGVEAHash, NULL, DeleteGVEAHash, CTX_STRBUF, CTX_NONE); diff --git a/webcit/static/t/box_preferences.html b/webcit/static/t/box_preferences.html index 0181d6db8..af113e497 100644 --- a/webcit/static/t/box_preferences.html +++ b/webcit/static/t/box_preferences.html @@ -8,7 +8,7 @@ >     - > + > @@ -16,7 +16,7 @@ + >     @@ -36,7 +36,7 @@ - + @@ -53,32 +53,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -104,39 +104,39 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -167,7 +167,7 @@ > + >  ,   @@ -191,8 +191,7 @@ - + >     >