X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ffloors.c;h=b11237dcfefabf2f8436bbb467d2df68d454eda6;hb=1e32899153e9e52aaec1e651e0c33a563b8aaed8;hp=e923065a3811fcd45f105b8380bc049b19338d90;hpb=37117bad89e16d3b7b89ab7e24526a5478593626;p=citadel.git diff --git a/webcit/floors.c b/webcit/floors.c index e923065a3..b11237dcf 100644 --- a/webcit/floors.c +++ b/webcit/floors.c @@ -1,36 +1,23 @@ /* - * Administrative screens for floor maintenance - * + * $Id$ */ +/** + * \defgroup AdminFloor Administrative screens for floor maintenance + * \ingroup CitadelConfig + */ +/*@{*/ - -#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" -/* +/** + * \brief Display floor config * Display floor configuration. If prepend_html is not NULL, its contents * will be displayed at the top of the screen. + * \param prepend_html pagetitle to prepend */ void display_floorconfig(char *prepend_html) { @@ -40,84 +27,96 @@ void display_floorconfig(char *prepend_html) char floorname[SIZ]; int refcount; - output_headers(3); - + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n" + "
" + ""); + wprintf(_("Add/change/delete floors")); + wprintf("" + "
\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")); + wprintf("\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")) { + wprintf("
" + "
Floor numberFloor nameNumber of rooms
\n" + "\n"); + + 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(_("Floor number")); + wprintf(""); + wprintf(_("Floor name")); + wprintf(""); + wprintf(_("Number of rooms")); + wprintf("
%d", floornum); if (refcount == 0) { wprintf("" - "" - "(delete floor)" - "
", floornum - ); + "" + "", floornum); + wprintf(_("(delete floor)")); + wprintf("
"); } wprintf("" - "(edit graphic)", - floornum); - wprintf("
"); + "", floornum); + wprintf(_("(edit graphic)")); + wprintf("
"); wprintf(""); wprintf("" - "
" + "" "" "\n", floornum, floorname); wprintf("" - "
"); + "VALUE=\"%s\">" + "", _("Change name")); wprintf("%d\n", refcount); } wprintf(" " - "
" + "" "\n" "" + "VALUE=\"%s\">" "
" - " \n"); - - wprintf("\n"); + " \n", _("Create new floor")); + wprintf("
\n"); wDumpContent(1); } - +/** + * \brief delete the actual floor + */ void delete_floor(void) { int floornum; char buf[SIZ]; @@ -126,20 +125,21 @@ 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); } - +/** + * \brief tart creating a new floor + */ void create_floor(void) { char buf[SIZ]; char message[SIZ]; @@ -148,14 +148,20 @@ 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); } - +/** + * \brief rename this floor + */ void rename_floor(void) { int floornum; char buf[SIZ]; @@ -166,11 +172,12 @@ 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); } +/*@}*/