* added gcc printf format checking to wprintf
[citadel.git] / webcit / floors.c
index 3103a36f44c5fb34a83d172f69c973bf7c6d6e7b..e06dfaa8d864bff8741912d023ac3af8d967acff 100644 (file)
@@ -3,7 +3,7 @@
  */
 /**
  * \defgroup AdminFloor Administrative screens for floor maintenance
- *
+ * \ingroup CitadelConfig
  */
 /*@{*/
 
@@ -13,7 +13,7 @@
 
 
 
-/*
+/**
  * \brief Display floor config
  * Display floor configuration.  If prepend_html is not NULL, its contents
  * will be displayed at the top of the screen.
@@ -28,14 +28,13 @@ void display_floorconfig(char *prepend_html)
        int refcount;
 
         output_headers(1, 1, 2, 0, 0, 0);
-        wprintf("<div id=\"banner\">\n"
-                "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
-                "<SPAN CLASS=\"titlebar\">");
+        wprintf("<div id=\"banner\">\n");
+        wprintf("<h1>");
        wprintf(_("Add/change/delete floors"));
-       wprintf("</SPAN>"
-                "</TD></TR></TABLE>\n"
-                "</div>\n<div id=\"content\">\n"
-        );
+       wprintf("</h1>");
+        wprintf("</div>\n");
+
+       wprintf("<div id=\"content\" class=\"service\">\n");
                                                                                                                              
        if (prepend_html != NULL) {
                wprintf("<br /><b><i>");
@@ -46,7 +45,7 @@ void display_floorconfig(char *prepend_html)
        serv_printf("LFLR");
        serv_getln(buf, sizeof buf);
        if (buf[0] != '1') {
-               wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
+               wprintf("<TABLE  class=\"floors_config\"><TR><TD>");
                wprintf("<SPAN CLASS=\"titlebar\">");
                wprintf(_("Error"));
                wprintf("</SPAN>\n");
@@ -64,6 +63,8 @@ void display_floorconfig(char *prepend_html)
        wprintf(_("Floor name"));
        wprintf("</TH><TH>");
        wprintf(_("Number of rooms"));
+       wprintf("</TH><TH>");
+       wprintf(_("Floor CSS"));
        wprintf("</TH></TR>\n");
 
        while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
@@ -93,16 +94,32 @@ void display_floorconfig(char *prepend_html)
                        "<INPUT TYPE=\"text\" NAME=\"floorname\" "
                        "VALUE=\"%s\" MAXLENGTH=\"250\">\n",
                        floornum, floorname);
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
                wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
                        "VALUE=\"%s\">"
                        "</FORM></TD>", _("Change name"));
 
-               wprintf("<TD>%d</TD></TR>\n", refcount);
+               wprintf("<TD>%d</TD>\n", refcount);
+
+               wprintf("<TD>"
+                       "<FORM METHOD=\"POST\" action=\"set_floor_css\">"
+                       "<INPUT TYPE=\"hidden\" NAME=\"floornum\" "
+                       "VALUE=\"%d\">"
+                       "<INPUT TYPE=\"text\" NAME=\"floorcss\" "
+                       "VALUE=\"%s\" MAXLENGTH=\"250\">\n",
+                       floornum, floorname);
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
+               wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
+                       "VALUE=\"%s\">"
+                       "</FORM></TD>", _("Change CSS"));
+
+               wprintf("</TR>\n");
        }
 
        wprintf("<TR><TD>&nbsp;</TD>"
-               "<TD><FORM METHOD=\"POST\" action=\"create_floor\">"
-               "<INPUT TYPE=\"text\" NAME=\"floorname\" "
+               "<TD><FORM METHOD=\"POST\" action=\"create_floor\">");
+       wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
+       wprintf("<INPUT TYPE=\"text\" NAME=\"floorname\" "
                "MAXLENGTH=\"250\">\n"
                "<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
                "VALUE=\"%s\">"
@@ -114,13 +131,15 @@ void display_floorconfig(char *prepend_html)
 }
 
 
-
+/**
+ * \brief delete the actual floor
+ */
 void delete_floor(void) {
        int floornum;
        char buf[SIZ];
        char message[SIZ];
 
-       floornum = atoi(bstr("floornum"));
+       floornum = ibstr("floornum");
 
        serv_printf("KFLR %d|1", floornum);
        serv_getln(buf, sizeof buf);
@@ -135,7 +154,9 @@ void delete_floor(void) {
        display_floorconfig(message);
 }
 
-
+/**
+ * \brief tart creating a new floor
+ */
 void create_floor(void) {
        char buf[SIZ];
        char message[SIZ];
@@ -155,14 +176,16 @@ void create_floor(void) {
        display_floorconfig(message);
 }
 
-
+/**
+ * \brief rename this floor
+ */
 void rename_floor(void) {
        int floornum;
        char buf[SIZ];
        char message[SIZ];
        char floorname[SIZ];
 
-       floornum = atoi(bstr("floornum"));
+       floornum = ibstr("floornum");
        strcpy(floorname, bstr("floorname"));
 
        serv_printf("EFLR %d|%s", floornum, floorname);
@@ -174,3 +197,4 @@ void rename_floor(void) {
 }
 
 
+/*@}*/