2 * Administrative screens for floor maintenance
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
32 * Display floor configuration. If prepend_html is not NULL, its contents
33 * will be displayed at the top of the screen.
35 void display_floorconfig(char *prepend_html)
45 if (prepend_html != NULL) {
46 write(WC->http_sock, prepend_html, strlen(prepend_html));
49 serv_printf("LFLR"); /* FIXME put a real test here */
52 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
53 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
54 wprintf("<B>Error</B>\n");
55 wprintf("</FONT></TD></TR></TABLE><BR>\n");
56 wprintf("%s<BR>\n", &buf[4]);
61 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
62 "<FONT SIZE=+1 COLOR=\"FFFFFF\"<B>Floor configuration"
63 "</B></FONT></TD></TR></TABLE>\n"
66 wprintf("<TABLE BORDER=1 WIDTH=100%>\n"
67 "<TR><TH>Floor number</TH>"
69 "<TH>Number of rooms</TH></TR>\n"
72 while (serv_gets(buf), strcmp(buf, "000")) {
73 floornum = extract_int(buf, 0);
74 extract(floorname, buf, 1);
75 refcount = extract_int(buf, 2);
77 wprintf("<TR><TD><TABLE border=0><TR><TD>%d", floornum);
80 "<A HREF=\"/delete_floor?floornum=%d\">"
81 "<FONT SIZE=-1>(delete floor)</A>"
82 "</FONT><BR>", floornum
85 wprintf("<FONT SIZE=-1>"
86 "<A HREF=\"/display_editfloorpic&"
87 "which_floor=%d\">(edit graphic)</A>",
89 wprintf("</TD></TR></TABLE>");
93 "<FORM METHOD=\"POST\" ACTION=\"/rename_floor\">"
94 "<INPUT TYPE=\"hidden\" NAME=\"floornum\" "
96 "<INPUT TYPE=\"text\" NAME=\"floorname\" "
97 "VALUE=\"%s\" MAXLENGTH=\"250\">\n",
99 wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
100 "VALUE=\"Change name\">"
103 wprintf("<TD>%d</TD></TR>\n", refcount);
106 wprintf("<TR><TD> </TD>"
107 "<TD><FORM METHOD=\"POST\" ACTION=\"/create_floor\">"
108 "<INPUT TYPE=\"text\" NAME=\"floorname\" "
109 "MAXLENGTH=\"250\">\n"
110 "<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
111 "VALUE=\"Create new floor\">"
113 "<TD> </TD></TR>\n");
115 wprintf("</TABLE>\n");
122 void delete_floor(void) {
127 floornum = atoi(bstr("floornum"));
129 serv_printf("KFLR %d|1", floornum);
133 sprintf(message, "<B><I>Floor has been deleted."
134 "</I></B><BR><BR>\n");
137 sprintf(message, "<B><I>%s</I></B>><BR>", &buf[4]);
140 display_floorconfig(message);
144 void create_floor(void) {
149 strcpy(floorname, bstr("floorname"));
151 serv_printf("CFLR %s|1", floorname);
154 sprintf(message, "<B><I>%s</I></B>><BR>", &buf[4]);
156 display_floorconfig(message);
160 void rename_floor(void) {
166 floornum = atoi(bstr("floornum"));
167 strcpy(floorname, bstr("floorname"));
169 serv_printf("EFLR %d|%s", floornum, floorname);
172 sprintf(message, "<B><I>%s</I></B>><BR>", &buf[4]);
174 display_floorconfig(message);