sysmsgs.c

00001 /*
00002  * $Id: sysmsgs.c 5147 2007-05-08 15:36:22Z ajc $
00003  */
00009 #include "webcit.h"
00010 
00011 
00020 void display_edit(char *description, char *check_cmd,
00021                   char *read_cmd, char *save_cmd, int with_room_banner)
00022 {
00023         char buf[SIZ];
00024 
00025         serv_puts(check_cmd);
00026         serv_getln(buf, sizeof buf);
00027 
00028         if (buf[0] != '2') {
00029                 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
00030                 display_main_menu();
00031                 return;
00032         }
00033         if (with_room_banner) {
00034                 output_headers(1, 1, 1, 0, 0, 0);
00035         }
00036         else {
00037                 output_headers(1, 1, 0, 0, 0, 0);
00038         }
00039 
00040         svprintf("BOXTITLE", WCS_STRING, _("Edit %s"), description);
00041         do_template("beginbox");
00042 
00043         wprintf("<div>");
00044         wprintf(_("Enter %s below.  Text is formatted to "
00045                 "the reader's screen width.  To defeat the "
00046                 "formatting, indent a line at least one space."), description);
00047         wprintf("<br />");
00048 
00049         wprintf("<FORM METHOD=\"POST\" action=\"%s\">\n", save_cmd);
00050         wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft "
00051                 "ROWS=10 COLS=80 WIDTH=80>\n");
00052         serv_puts(read_cmd);
00053         serv_getln(buf, sizeof buf);
00054         if (buf[0] == '1')
00055                 server_to_text();
00056         wprintf("</TEXTAREA><br /><br />\n");
00057         wprintf("<INPUT TYPE=\"submit\" NAME=\"save_button\" VALUE=\"%s\">", _("Save changes"));
00058         wprintf("&nbsp;");
00059         wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\"><br />\n", _("Cancel"));
00060 
00061         wprintf("</FORM></div>\n");
00062         do_template("endbox");
00063         wDumpContent(1);
00064 }
00065 
00066 
00073 void save_edit(char *description, char *enter_cmd, int regoto)
00074 {
00075         char buf[SIZ];
00076 
00077         if (strlen(bstr("save_button")) == 0) {
00078                 sprintf(WC->ImportantMessage,
00079                         _("Cancelled.  %s was not saved."),
00080                         description);
00081                 display_main_menu();
00082                 return;
00083         }
00084         serv_puts(enter_cmd);
00085         serv_getln(buf, sizeof buf);
00086         if (buf[0] != '4') {
00087                 safestrncpy(WC->ImportantMessage, &buf[4], sizeof WC->ImportantMessage);
00088                 display_main_menu();
00089                 return;
00090         }
00091         text_to_server(bstr("msgtext"));
00092         serv_puts("000");
00093 
00094         if (regoto) {
00095                 smart_goto(WC->wc_roomname);
00096         } else {
00097                 sprintf(WC->ImportantMessage,
00098                         _("%s has been saved."),
00099                         description);
00100                 display_main_menu();
00101                 return;
00102         }
00103 }
00104 
00105 

Generated on Wed Jun 20 23:13:10 2007 for webcit by  doxygen 1.5.2