5 * \defgroup AdminFloor Administrative screens for floor maintenance
6 * \ingroup CitadelConfig
11 #include "webserver.h"
17 * \brief Display floor config
18 * Display floor configuration. If prepend_html is not NULL, its contents
19 * will be displayed at the top of the screen.
20 * \param prepend_html pagetitle to prepend
22 void display_floorconfig(StrBuf
*prepend_html
)
30 output_headers(1, 1, 2, 0, 0, 0);
31 wprintf("<div id=\"banner\">\n");
33 wprintf(_("Add/change/delete floors"));
37 wprintf("<div id=\"content\" class=\"service\">\n");
39 if (prepend_html
!= NULL
) {
40 wprintf("<br /><b><i>");
41 StrBufAppendBuf(WC
->WBuf
, prepend_html
, 0);
42 wprintf("</i></b><br /><br />\n");
46 serv_getln(buf
, sizeof buf
);
48 wprintf("<TABLE class=\"floors_config\"><TR><TD>");
49 wprintf("<SPAN CLASS=\"titlebar\">");
52 wprintf("</TD></TR></TABLE>\n");
53 wprintf("%s<br />\n", &buf
[4]);
58 wprintf("<div class=\"fix_scrollbar_bug\">"
59 "<TABLE BORDER=1 WIDTH=100%% bgcolor=\"#ffffff\">\n"
61 wprintf(_("Floor number"));
63 wprintf(_("Floor name"));
65 wprintf(_("Number of rooms"));
67 wprintf(_("Floor CSS"));
68 wprintf("</TH></TR>\n");
70 while (serv_getln(buf
, sizeof buf
), strcmp(buf
, "000")) {
71 floornum
= extract_int(buf
, 0);
72 extract_token(floorname
, buf
, 1, '|', sizeof floorname
);
73 refcount
= extract_int(buf
, 2);
75 wprintf("<TR><TD><TABLE border=0><TR><TD>%d", floornum
);
78 "<a href=\"delete_floor?floornum=%d\">"
79 "<FONT SIZE=-1>", floornum
);
80 wprintf(_("(delete floor)"));
81 wprintf("</A></FONT><br />");
83 wprintf("<FONT SIZE=-1>"
84 "<a href=\"display_editfloorpic&"
85 "which_floor=%d\">", floornum
);
86 wprintf(_("(edit graphic)"));
87 wprintf("</A></TD></TR></TABLE>");
91 "<FORM METHOD=\"POST\" action=\"rename_floor\">"
92 "<INPUT TYPE=\"hidden\" NAME=\"floornum\" "
94 "<INPUT TYPE=\"text\" NAME=\"floorname\" "
95 "VALUE=\"%s\" MAXLENGTH=\"250\">\n",
97 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC
->nonce
);
98 wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
100 "</FORM></TD>", _("Change name"));
102 wprintf("<TD>%d</TD>\n", refcount
);
105 "<FORM METHOD=\"POST\" action=\"set_floor_css\">"
106 "<INPUT TYPE=\"hidden\" NAME=\"floornum\" "
108 "<INPUT TYPE=\"text\" NAME=\"floorcss\" "
109 "VALUE=\"%s\" MAXLENGTH=\"250\">\n",
110 floornum
, floorname
);
111 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC
->nonce
);
112 wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
114 "</FORM></TD>", _("Change CSS"));
119 wprintf("<TR><TD> </TD>"
120 "<TD><FORM METHOD=\"POST\" action=\"create_floor\">");
121 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC
->nonce
);
122 wprintf("<INPUT TYPE=\"text\" NAME=\"floorname\" "
123 "MAXLENGTH=\"250\">\n"
124 "<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
127 "<TD> </TD></TR>\n", _("Create new floor"));
129 wprintf("</table></div>\n");
135 * \brief delete the actual floor
137 void delete_floor(void) {
142 floornum
= ibstr("floornum");
144 serv_printf("KFLR %d|1", floornum
);
146 StrBufTCP_read_line(Buf
, &WC
->serv_sock
, 0, &Err
);
148 if (GetServerStatus(Buf
, NULL
) == 2) {
149 StrBufPlain(Buf
, _("Floor has been deleted."),-1);
152 StrBufCutLeft(Buf
, 4);
155 display_floorconfig(Buf
);
160 * \brief tart creating a new floor
162 void create_floor(void) {
167 serv_printf("CFLR %s|1", bstr("floorname"));
168 StrBufTCP_read_line(Buf
, &WC
->serv_sock
, 0, &Err
);
170 if (GetServerStatus(Buf
, NULL
) == 2) {
171 StrBufPlain(Buf
, _("New floor has been created."),-1);
174 StrBufCutLeft(Buf
, 4);
177 display_floorconfig(Buf
);
183 * \brief rename this floor
185 void rename_floor(void) {
190 serv_printf("EFLR %d|%s",
193 StrBuf_ServGetln(Buf
);
195 StrBufCutLeft(Buf
, 4);
197 display_floorconfig(Buf
);
201 void _display_floorconfig(void) {display_floorconfig(NULL
);}
207 WebcitAddUrlHandler(HKEY("delete_floor"), delete_floor
, 0);
208 WebcitAddUrlHandler(HKEY("rename_floor"), rename_floor
, 0);
209 WebcitAddUrlHandler(HKEY("create_floor"), create_floor
, 0);
210 WebcitAddUrlHandler(HKEY("display_floorconfig"), _display_floorconfig
, 0);