* New COND:FLOOR:NROOMS : whether this floor has n-rooms
authorWilfried Göesgens <willi@citadel.org>
Wed, 18 Aug 2010 21:11:13 +0000 (21:11 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 18 Aug 2010 21:11:13 +0000 (21:11 +0000)
* use the right toknes...
* use LFLR
* fix comment token function

webcit/roomlist.c
webcit/static/t/floors.html
webcit/static/t/floors_edit_one.html
webcit/subst.c

index 62f5b1578e4d5b00ff13d1967ec71bfcdc601c75..5457b3e71e63e5540363d69e7f0b4e28dfbf3c8a 100644 (file)
@@ -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);
index 18012834d6f1e2cc109f92a8011bb6ec4a6b6b59..bb0a0c3c19f604e2cd8673b852f4accb20927f99 100644 (file)
@@ -1,11 +1,11 @@
-<?=("important_msg")>
+<?=("head")><?=("important_msg")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
 
 <div id="banner">
         <h1><?_("Add/change/delete floors")></h1>
 </div>
 
-<div class="fix_scrollbar_bug">
-       <table border="1" width="100%" bgcolor="#fff">
+<div id="content" class="service fix_scrollbar_bug">
+       <table border="1" width="100%" bgcolor="#ffffff">
                <tr>
                        <th><?_("Floor number")></th>
                        <th><?_("Floor name")></th>
@@ -13,7 +13,7 @@
                        <th><?_("Floor CSS")></th>
                </tr>
 
-               <?ITERATE("LKRA", ="floors_edit_one")>
+               <?ITERATE("LFLR", ="floors_edit_one")>
 
                <tr>
                        <td>&nbsp;</td>
@@ -28,3 +28,4 @@
                </tr>
        </table>
 </div>
+<?=("trailing")>
index b61ba09f536f14314e7b3a879633519eaea52130..f05f1a1a60761e165d26f53a06755cb145ea5a14 100644 (file)
@@ -1,34 +1,36 @@
-<!--("Subtemplate to edit a single floor, called as ITERATION by floors.html")-->
+<?--("Subtemplate to edit a single floor, called as ITERATION by floors.html")>
+<??("COND:FLOOR:ISVIRTUAL", 1)>
                <tr>
                        <td>
                                <table border="0">
                                        <tr>
-                                               <td><?FLOORNUM>
-                                       <?!("COND:FLOOR:RECFOUNT",20,0)>
+                                               <td><?FLOOR:ID>
+                                       <?!("COND:FLOOR:NROOMS",20,0)>
                                                </td>
                                                <td>
-                                                       <a href="delete_floor?floornum=<?FLOORNUM>" style="font-size: -1"><?_("(delete floor)")></a><br>
+                                                       <a href="delete_floor?floornum=<?FLOOR:ID>" style="font-size: -1"><?_("(delete floor)")></a><br>
                                        <??("X",20)>
-                                                       <a href="display_editfloorpic?which_floor=<?FLOORNUM>" style="font-size: -1"><?_("(edit graphic)")></a>
+                                                       <a href="display_editfloorpic?which_floor=<?FLOOR:ID>" style="font-size: -1"><?_("(edit graphic)")></a>
                                                </td>
                                        </tr>
                                </table>
                        </td>
                        <td>
                                <form method="post" action="rename_floor">
-                                       <input type="hidden" name="floornum" value="<?FLOORNUM>">
-                                       <input type="text" name="floorname" value="<?FLOORNAME>" maxlength="250">
+                                       <input type="hidden" name="floornum" value="<?FLOOR:ID>">
+                                       <input type="text" name="floorname" value="<?FLOOR:NAME>" maxlength="250">
                                        <input type="hidden" name="nonce" value="<?NONCE>">
                                        <input type="submit" name="sc" value="<?_("Change name")>">
                                </form>
                        </td>
-                       <td><?REFCOUNT></td>
+                       <td><?FLOOR:NROOMS></td>
                        <td>
                                <form method="post" action="set_floor_css">
-                                       <input type="hidden" name="floornum" value="<?FLOORNUM>">
-                                       <input type="text" name="floorcss" value="<?FLOORNAME>" maxlength="250">
+                                       <input type="hidden" name="floornum" value="<?FLOOR:ID>">
+                                       <input type="text" name="floorcss" value="<?FLOOR:NAME>" maxlength="250">
                                        <input type="hidden" name="nonce" value="<?NONCE>">
                                        <input type="submit" name="sc" value="<?_("Change CSS")>">
                                </form>
                        </td>
                </tr>
+<??("X", 1)>
index 2bcb8949ffe6b1fef69cebe9f2f7c729f0f94306..5fff6349a8993b57bbae1568c3db8d9a4005ed8c 100644 (file)
@@ -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);
                StrBufAppendTemplate(Target, TP, Comment, 1);
-
+               StrBufAppendBufPlain(Target, HKEY("-->"), 0);
                FreeStrBuf(&Comment);
        }
 }