5 * \defgroup ShowSysMsgs Editing of various text files on the Citadel server.
6 * \ingroup WebcitDisplayItems
13 * \brief display the form for editing something (room info, bio, etc)
14 * \param description the descriptive text for the box
15 * \param check_cmd command to check????
16 * \param read_cmd read answer from citadel server???
17 * \param save_cmd save comand to the citadel server??
18 * \param with_room_banner should we bisplay a room banner?
20 void display_edit(char *description, char *check_cmd,
21 char *read_cmd, char *save_cmd, int with_room_banner)
26 serv_getln(buf, sizeof buf);
29 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
33 if (with_room_banner) {
34 output_headers(1, 1, 1, 0, 0, 0);
37 output_headers(1, 1, 0, 0, 0, 0);
40 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Edit %s"), description);
41 do_template("beginbox", NULL);
43 wprintf(_("Enter %s below. Text is formatted to the reader's browser."
44 " A newline is forced by preceding the next line by a blank."), description);
46 wprintf("<form method=\"post\" action=\"%s\">\n", save_cmd);
47 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
48 wprintf("<textarea name=\"msgtext\" wrap=soft "
49 "rows=10 cols=80 width=80>\n");
51 serv_getln(buf, sizeof buf);
54 wprintf("</textarea><div class=\"buttons\" >\n");
55 wprintf("<input type=\"submit\" name=\"save_button\" value=\"%s\">", _("Save changes"));
57 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
58 wprintf("</div></form>\n");
60 do_template("endbox", NULL);
66 * \brief save a screen which was displayed with display_edit()
67 * \param description the window title???
68 * \param enter_cmd which command to enter at the citadel server???
69 * \param regoto should we go to that room again after executing that command?
71 void save_edit(char *description, char *enter_cmd, int regoto)
75 if (!havebstr("save_button")) {
76 sprintf(WC->ImportantMessage,
77 _("Cancelled. %s was not saved."),
83 serv_getln(buf, sizeof buf);
85 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
89 text_to_server(bstr("msgtext"));
93 smart_goto(WC->wc_roomname);
95 sprintf(WC->ImportantMessage,
96 _("%s has been saved."),
104 void display_editinfo(void){ display_edit(_("Room info"), "EINF 0", "RINF", "editinfo", 1);}
105 void editinfo(void) {save_edit(_("Room info"), "EINF 1", 1);}
106 void display_editbio(void) {
109 snprintf(buf, SIZ, "RBIO %s", WC->wc_fullname);
110 display_edit(_("Your bio"), "NOOP", buf, "editbio", 3);
112 void editbio(void) { save_edit(_("Your bio"), "EBIO", 0); }
118 WebcitAddUrlHandler(HKEY("display_editinfo"), display_editinfo, 0);
119 WebcitAddUrlHandler(HKEY("editinfo"), editinfo, 0);
120 WebcitAddUrlHandler(HKEY("display_editbio"), display_editbio, 0);
121 WebcitAddUrlHandler(HKEY("editbio"), editbio, 0);