From 314e2181c0a4103dd6eb7214f4709efbb5b9559b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 18 Aug 2010 21:11:13 +0000 Subject: [PATCH] * New COND:FLOOR:NROOMS : whether this floor has n-rooms * use the right toknes... * use LFLR * fix comment token function --- webcit/roomlist.c | 11 +++++++++++ webcit/static/t/floors.html | 9 +++++---- webcit/static/t/floors_edit_one.html | 22 ++++++++++++---------- webcit/subst.c | 5 +++-- 4 files changed, 31 insertions(+), 16 deletions(-) diff --git a/webcit/roomlist.c b/webcit/roomlist.c index 62f5b1578..5457b3e71 100644 --- a/webcit/roomlist.c +++ b/webcit/roomlist.c @@ -747,6 +747,16 @@ int ConditionalFloorIsRESTSubFloor(StrBuf *Target, WCTemplputParams *TP) return WCC->CurrentFloor == MyFloor; } +int ConditionalFloorHaveNRooms(StrBuf *Target, WCTemplputParams *TP) +{ + Floor *MyFloor = (Floor *)CTX; + int HaveN; + + HaveN = GetTemplateTokenNumber(Target, TP, 0, 0); + + return HaveN == MyFloor->NRooms; +} + int ConditionalFloorIsVirtual(StrBuf *Target, WCTemplputParams *TP) { Floor *MyFloor = (Floor *)CTX; @@ -884,6 +894,7 @@ InitModule_ROOMLIST RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, NULL, CTX_FLOORS); RegisterConditional(HKEY("COND:FLOOR:ISSUBROOM"), 0, ConditionalFloorIsSUBROOM, CTX_FLOORS); RegisterConditional(HKEY("COND:FLOOR:ISVIRTUAL"), 0, ConditionalFloorIsVirtual, CTX_FLOORS); + RegisterConditional(HKEY("COND:FLOOR:NROOMS"), 1, ConditionalFloorHaveNRooms, CTX_FLOORS); RegisterConditional(HKEY("COND:ROOM:REST:ISSUBFLOOR"), 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS); RegisterIterator("ITERATE:THISROOM:GNET", 1, NULL, GetNetConfigHash, NULL, NULL, CTX_STRBUFARR, CTX_NONE, IT_NOFLAG); diff --git a/webcit/static/t/floors.html b/webcit/static/t/floors.html index 18012834d..bb0a0c3c1 100644 --- a/webcit/static/t/floors.html +++ b/webcit/static/t/floors.html @@ -1,11 +1,11 @@ - + -
- +
+
@@ -13,7 +13,7 @@ - + @@ -28,3 +28,4 @@
 
+ diff --git a/webcit/static/t/floors_edit_one.html b/webcit/static/t/floors_edit_one.html index b61ba09f5..f05f1a1a6 100644 --- a/webcit/static/t/floors_edit_one.html +++ b/webcit/static/t/floors_edit_one.html @@ -1,34 +1,36 @@ - + + -
- + + -
+
- +
- - + + ">
- +
- - + + ">
+ diff --git a/webcit/subst.c b/webcit/subst.c index 2bcb8949f..5fff6349a 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -2175,10 +2175,11 @@ void tmplput_Comment(StrBuf *Target, WCTemplputParams *TP) const char *pch; long len; - GetTemplateTokenString(Target, TP, 2, &pch, &len); + GetTemplateTokenString(Target, TP, 0, &pch, &len); Comment = NewStrBufPlain(pch, len); + StrBufAppendBufPlain(Target, HKEY(""), 0); FreeStrBuf(&Comment); } } -- 2.30.2