From cbad09371e24c0dee4ada51e037256dec785b6a3 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 5 Aug 2002 15:53:00 +0000 Subject: [PATCH] * Commands to add, change, delete floors --- webcit/ChangeLog | 4 +- webcit/Makefile.in | 4 +- webcit/floors.c | 169 +++++++++++++++++++++++++++++++++++++++++++++ webcit/mainmenu.c | 3 + webcit/webcit.c | 8 +++ webcit/webcit.h | 4 ++ 6 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 webcit/floors.c diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 5095b0d64..12e1ae655 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 323.54 2002/08/05 15:53:00 ajc +* Commands to add, change, delete floors + Revision 323.53 2002/07/26 03:20:04 ajc * Beautified the folder tabs in "edit room" @@ -884,4 +887,3 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix - diff --git a/webcit/Makefile.in b/webcit/Makefile.in index f9b04c1c2..8d73ab61a 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -23,7 +23,7 @@ distclean: clean webserver: webserver.o context_loop.o tools.o \ - cookie_conversion.o locate_host.o \ + cookie_conversion.o locate_host.o floors.o \ webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \ vcard.o vcard_edit.o preferences.o html2html.o \ @@ -31,7 +31,7 @@ webserver: webserver.o context_loop.o tools.o \ $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \ webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \ - locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o \ + locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o floors.o \ mime_parser.o graphics.o netconf.o preferences.o html2html.o \ $(LIBOBJS) $(LIBS) -o webserver diff --git a/webcit/floors.c b/webcit/floors.c new file mode 100644 index 000000000..ebcafcaef --- /dev/null +++ b/webcit/floors.c @@ -0,0 +1,169 @@ +/* + * 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" + + + + +/* + * Display floor configuration. If prepend_html is not NULL, its contents + * will be displayed at the top of the screen. + */ +void display_floorconfig(char *prepend_html) +{ + char buf[SIZ]; + + int floornum; + char floorname[SIZ]; + int refcount; + + output_headers(3); + + if (prepend_html != NULL) { + write(WC->http_sock, prepend_html, strlen(prepend_html)); + } + + serv_printf("LFLR"); /* FIXME put a real test here */ + serv_gets(buf); + if (buf[0] != '1') { + wprintf("
"); + wprintf("Error\n"); + wprintf("

\n"); + wprintf("%s
\n", &buf[4]); + wDumpContent(1); + return; + } + + wprintf("
" + "Floor configuration" + "
\n" + ); + + wprintf("\n" + "" + "" + "\n" + ); + + while (serv_gets(buf), strcmp(buf, "000")) { + floornum = extract_int(buf, 0); + extract(floorname, buf, 1); + refcount = extract_int(buf, 2); + + wprintf(""); + + wprintf(""); + + wprintf("\n", refcount); + } + + wprintf("" + "" + "\n"); + + wprintf("
Floor numberFloor nameNumber of rooms
%d", floornum); + if (refcount == 0) { + wprintf(" " + "(delete floor)"); + } + wprintf("" + "
" + "" + "\n", + floornum, floorname); + wprintf("" + "
%d
 
" + "\n" + "" + "
 
\n"); + + wDumpContent(1); +} + + + +void delete_floor(void) { + int floornum; + char buf[SIZ]; + char message[SIZ]; + + floornum = atoi(bstr("floornum")); + + serv_printf("KFLR %d|1", floornum); + serv_gets(buf); + + if (buf[0] == '2') { + sprintf(message, "Floor has been deleted." + "

\n"); + } + else { + sprintf(message, "%s>
", &buf[4]); + } + + display_floorconfig(message); +} + + +void create_floor(void) { + char buf[SIZ]; + char message[SIZ]; + char floorname[SIZ]; + + strcpy(floorname, bstr("floorname")); + + serv_printf("CFLR %s|1", floorname); + serv_gets(buf); + + sprintf(message, "%s>
", &buf[4]); + + display_floorconfig(message); +} + + +void rename_floor(void) { + int floornum; + char buf[SIZ]; + char message[SIZ]; + char floorname[SIZ]; + + floornum = atoi(bstr("floornum")); + strcpy(floorname, bstr("floorname")); + + serv_printf("EFLR %d|%s", floornum, floorname); + serv_gets(buf); + + sprintf(message, "%s>
", &buf[4]); + + display_floorconfig(message); +} + + diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index c9855d613..805506d06 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -177,6 +177,9 @@ void display_main_menu(void) wprintf("
  • \n"); wprintf("Validate new users\n"); + wprintf("
  • \n"); + wprintf("Add, change, or delete floors\n"); + wprintf("
  • \n"); wprintf("Set or change a floor label graphic\n"); diff --git a/webcit/webcit.c b/webcit/webcit.c index 71df42eca..5bf13354e 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1055,6 +1055,12 @@ void session_loop(struct httprequest *req) do_graphics_upload("UIMG 1|_roompic_"); } else if (!strcasecmp(action, "select_floor_to_edit_pic")) { select_floor_to_edit_pic(); + } else if (!strcasecmp(action, "delete_floor")) { + delete_floor(); + } else if (!strcasecmp(action, "rename_floor")) { + rename_floor(); + } else if (!strcasecmp(action, "create_floor")) { + create_floor(); } else if (!strcasecmp(action, "display_editfloorpic")) { sprintf(buf, "UIMG 0|_floorpic_|%s", bstr("which_floor")); @@ -1126,6 +1132,8 @@ void session_loop(struct httprequest *req) do_stuff_to_msgs(); } else if (!strcasecmp(action, "change_start_page")) { change_start_page(); + } else if (!strcasecmp(action, "display_floorconfig")) { + display_floorconfig(NULL); } else if (!strcasecmp(action, "diagnostics")) { output_headers(1); diff --git a/webcit/webcit.h b/webcit/webcit.h index 500fa6f1b..9797ed593 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -315,3 +315,7 @@ void display_addressbook(long msgnum, char alpha); void offer_start_page(void); void change_start_page(void); void output_html(void); +void display_floorconfig(char *); +void delete_floor(void); +void create_floor(void); +void rename_floor(void); -- 2.39.2