X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ffloors.c;h=b4dceb6a0a2d4cb093908bb081e1d75b1207e913;hb=aa8ca3b0af3efdabd8559b886efb3164319bdce1;hp=37b471594438fa2483bfb39e489a4da94095bc26;hpb=85df07f3bde6b66c24c3197945b0a2da04cce72a;p=citadel.git diff --git a/webcit/floors.c b/webcit/floors.c index 37b471594..b4dceb6a0 100644 --- a/webcit/floors.c +++ b/webcit/floors.c @@ -1,28 +1,11 @@ /* + * $Id$ + * * Administrative screens for floor maintenance * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "webcit.h" #include "webserver.h" @@ -41,35 +24,41 @@ 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) { + 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("\n"); + wprintf("%s
\n", &buf[4]); wDumpContent(1); return; } - svprintf("BOXTITLE", WCS_STRING, "Floor configuration"); - do_template("beginbox"); - - 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("
Floor numberFloor nameNumber of rooms
" "\n"); - wprintf("
%d", floornum); @@ -77,7 +66,7 @@ void display_floorconfig(char *prepend_html) wprintf("" "" "(delete floor)" - "
", floornum + "
", floornum ); } wprintf("" @@ -110,8 +99,7 @@ void display_floorconfig(char *prepend_html) "
 
\n"); - do_template("endbox"); + wprintf("
\n"); wDumpContent(1); } @@ -125,14 +113,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); @@ -147,9 +134,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); } @@ -165,9 +156,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); }