4 * Editing of various text files on the Citadel server.
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
30 * display the form for editing something (room info, bio, etc)
32 void display_edit(char *description, char *check_cmd,
33 char *read_cmd, char *save_cmd, int with_room_banner)
38 serv_getln(buf, sizeof buf);
41 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
45 if (with_room_banner) {
46 output_headers(1, 1, 1, 0, 0, 0, 0);
49 output_headers(1, 1, 0, 0, 0, 0, 0);
52 svprintf("BOXTITLE", WCS_STRING, "Edit %s", description);
53 do_template("beginbox");
55 wprintf("<CENTER>Enter %s below. Text is formatted to\n", description);
56 wprintf("the <EM>reader's</EM> screen width. To defeat the\n");
57 wprintf("formatting, indent a line at least one space. \n");
60 wprintf("<FORM METHOD=\"POST\" ACTION=\"%s\">\n", save_cmd);
61 wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft "
62 "ROWS=10 COLS=80 WIDTH=80>\n");
64 serv_getln(buf, sizeof buf);
67 wprintf("</TEXTAREA><br /><br />\n");
68 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save\">");
70 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><br />\n");
72 wprintf("</FORM></CENTER>\n");
73 do_template("endbox");
79 * save a screen which was displayed with display_edit()
81 void save_edit(char *description, char *enter_cmd, int regoto)
85 if (strcmp(bstr("sc"), "Save")) {
86 sprintf(WC->ImportantMessage,
87 "Cancelled. %s was not saved.\n", description);
92 serv_getln(buf, sizeof buf);
94 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
98 text_to_server(bstr("msgtext"), 0);
102 smart_goto(WC->wc_roomname);
104 sprintf(WC->ImportantMessage,
105 "%s has been saved.\n", description);