8 * display the form for editing something (room info, bio, etc)
9 * description the descriptive text for the box
10 * check_cmd command to check????
11 * read_cmd read answer from citadel server???
12 * save_cmd save comand to the citadel server??
13 * with_room_banner should we bisplay a room banner?
15 void display_edit(char *description
, char *check_cmd
,
16 char *read_cmd
, char *save_cmd
, int with_room_banner
)
21 serv_getln(buf
, sizeof buf
);
24 safestrncpy(WC
->ImportantMessage
, &buf
[4], sizeof WC
->ImportantMessage
);
28 if (with_room_banner
) {
29 output_headers(1, 1, 1, 0, 0, 0);
32 output_headers(1, 1, 0, 0, 0, 0);
35 svprintf(HKEY("BOXTITLE"), WCS_STRING
, _("Edit %s"), description
);
36 do_template("beginboxx", NULL
);
38 wprintf(_("Enter %s below. Text is formatted to the reader's browser."
39 " A newline is forced by preceding the next line by a blank."), description
);
41 wprintf("<form method=\"post\" action=\"%s\">\n", save_cmd
);
42 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC
->nonce
);
43 wprintf("<textarea name=\"msgtext\" wrap=soft "
44 "rows=10 cols=80 width=80>\n");
46 serv_getln(buf
, sizeof buf
);
49 wprintf("</textarea><div class=\"buttons\" >\n");
50 wprintf("<input type=\"submit\" name=\"save_button\" value=\"%s\">", _("Save changes"));
52 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
53 wprintf("</div></form>\n");
55 do_template("endbox", NULL
);
61 * save a screen which was displayed with display_edit()
62 * description the window title???
63 * enter_cmd which command to enter at the citadel server???
64 * regoto should we go to that room again after executing that command?
66 void save_edit(char *description
, char *enter_cmd
, int regoto
)
70 if (!havebstr("save_button")) {
71 sprintf(WC
->ImportantMessage
,
72 _("Cancelled. %s was not saved."),
78 serv_getln(buf
, sizeof buf
);
80 safestrncpy(WC
->ImportantMessage
, &buf
[4], sizeof WC
->ImportantMessage
);
84 text_to_server(bstr("msgtext"));
88 smart_goto(WC
->wc_roomname
);
90 sprintf(WC
->ImportantMessage
,
91 _("%s has been saved."),
99 void display_editinfo(void){ display_edit(_("Room info"), "EINF 0", "RINF", "editinfo", 1);}
100 void editinfo(void) {save_edit(_("Room info"), "EINF 1", 1);}
101 void display_editbio(void) {
104 snprintf(buf
, SIZ
, "RBIO %s", ChrPtr(WC
->wc_fullname
));
105 display_edit(_("Your bio"), "NOOP", buf
, "editbio", 3);
107 void editbio(void) { save_edit(_("Your bio"), "EBIO", 0); }
113 WebcitAddUrlHandler(HKEY("display_editinfo"), display_editinfo
, 0);
114 WebcitAddUrlHandler(HKEY("editinfo"), editinfo
, 0);
115 WebcitAddUrlHandler(HKEY("display_editbio"), display_editbio
, 0);
116 WebcitAddUrlHandler(HKEY("editbio"), editbio
, 0);