X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ffloors.c;h=ceb2e5087521123e20a4f3df7eea518625b6e82d;hb=3dda3cda8acb9c1c4eb227f4780630913ffc633a;hp=ebcafcaef81e8998a1f65d9e4c59476a929447fc;hpb=cbad09371e24c0dee4ada51e037256dec785b6a3;p=citadel.git diff --git a/webcit/floors.c b/webcit/floors.c index ebcafcaef..ceb2e5087 100644 --- a/webcit/floors.c +++ b/webcit/floors.c @@ -1,4 +1,6 @@ /* + * $Id$ + * * Administrative screens for floor maintenance * */ @@ -24,6 +26,7 @@ #include #include #include "webcit.h" +#include "webserver.h" @@ -40,45 +43,56 @@ void display_floorconfig(char *prepend_html) char floorname[SIZ]; int refcount; - output_headers(3); - + output_headers(1, 1, 2, 0, 0, 0, 0); + wprintf("
\n" + "
" + "Add/change/delete floors" + "
\n" + "
\n
\n" + ); + if (prepend_html != NULL) { - write(WC->http_sock, prepend_html, strlen(prepend_html)); + wprintf("
"); + client_write(prepend_html, strlen(prepend_html)); + wprintf("

\n"); } - serv_printf("LFLR"); /* FIXME put a real test here */ - serv_gets(buf); + serv_printf("LFLR"); + serv_getln(buf, sizeof buf); if (buf[0] != '1') { - wprintf("
"); - wprintf("Error\n"); - wprintf("

\n"); - wprintf("%s
\n", &buf[4]); + wprintf("
"); + wprintf("Error\n"); + wprintf("
\n"); + wprintf("%s
\n", &buf[4]); wDumpContent(1); return; } - wprintf("
" - "Floor configuration" - "
\n" - ); - - wprintf("\n" + wprintf("
" + "
\n" "" "" "\n" ); - while (serv_gets(buf), strcmp(buf, "000")) { + while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { floornum = extract_int(buf, 0); - extract(floorname, buf, 1); + extract_token(floorname, buf, 1, '|', sizeof floorname); refcount = extract_int(buf, 2); - wprintf(""); wprintf("" "\n"); - wprintf("
Floor numberFloor nameNumber of rooms
%d", floornum); + wprintf("
%d", floornum); if (refcount == 0) { - wprintf(" " - "(delete floor)"); + wprintf("" + "" + "(delete floor)" + "
", floornum + ); } + wprintf("" + "(edit graphic)", + floornum); + wprintf("
"); wprintf("
" @@ -104,8 +118,7 @@ void display_floorconfig(char *prepend_html) " 
\n"); - + wprintf("
\n"); wDumpContent(1); } @@ -119,14 +132,13 @@ void delete_floor(void) { floornum = atoi(bstr("floornum")); serv_printf("KFLR %d|1", floornum); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { - sprintf(message, "Floor has been deleted." - "

\n"); + sprintf(message, "Floor has been deleted."); } else { - sprintf(message, "%s>
", &buf[4]); + sprintf(message, "%s", &buf[4]); } display_floorconfig(message); @@ -141,9 +153,13 @@ void create_floor(void) { strcpy(floorname, bstr("floorname")); serv_printf("CFLR %s|1", floorname); - serv_gets(buf); + serv_getln(buf, sizeof buf); - sprintf(message, "%s>
", &buf[4]); + if (buf[0] == '2') { + sprintf(message, "New floor has been created."); + } else { + sprintf(message, "%s", &buf[4]); + } display_floorconfig(message); } @@ -159,9 +175,9 @@ void rename_floor(void) { strcpy(floorname, bstr("floorname")); serv_printf("EFLR %d|%s", floornum, floorname); - serv_gets(buf); + serv_getln(buf, sizeof buf); - sprintf(message, "%s>
", &buf[4]); + sprintf(message, "%s", &buf[4]); display_floorconfig(message); }