WHQ: templatize editing of user; fix handling of output after edit.
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 9 Jul 2012 18:04:45 +0000 (20:04 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 9 Jul 2012 18:04:45 +0000 (20:04 +0200)
webcit/static/t/who/edit.html [new file with mode: 0644]
webcit/who.c

diff --git a/webcit/static/t/who/edit.html b/webcit/static/t/who/edit.html
new file mode 100644 (file)
index 0000000..90345f0
--- /dev/null
@@ -0,0 +1,52 @@
+<?=("head")>
+<div id="banner">
+<table class="who_banner"><tr><td>
+<span class="titlebar">
+<?_("Edit your session display")>
+</span></td></tr></table>
+</div>
+<div id="content">
+
+<?_("This screen allows you to change the way your session appears in the 'Who is online' listing. To turn off any 'fake' name you've previously set, simply click the appropriate 'change' button without typing anything in the corresponding box. ")>
+<br>
+
+<form method="POST" action="edit_me">
+<input type="hidden" name="nonce" value="<?NONCE>">
+<table border=0 width=100%%>
+
+<tr><td><b>
+<?_("Room name:")>
+</b></td>
+<td>
+<input type="text" name="fake_roomname" maxlength="64">
+</td>
+<td align="center">
+<input type="submit" name="change_room_name_button" value="<?_("Change room name")>">
+</td>
+</tr>
+
+<tr><td><b>
+<?_("Host name:")>
+</b></td><td>
+<input type="text" name="fake_hostname" maxlength="64">
+</td>
+<td align="center">
+<input type="submit" name="change_host_name_button" value="<?_("Change host name")>">
+</td>
+</tr>
+<??("COND:AIDE", 1)>
+       <tr><td><b>
+       <?_("User name:")>
+       </b></td><td>
+       <input type="text" name="fake_username" maxlength="64">
+       </td>
+       <td align="center">
+       <input type="submit" name "change_user_name_button" value="<?_("Change user name")>">           
+       </td>
+       </tr>
+<??("X", 1)>
+<tr><td> </td><td> </td><td align="center">
+<input type="submit" name="cancel_button" value="<?_("Cancel")>">
+</td></tr></table>
+</form></center>
+<?=("trailing")>
index 9fdd9a90b53838f47377cde67ad00a520bee23eb..1c2984584ada5534ebe22ed4f95780ef461cb351 100644 (file)
@@ -131,77 +131,25 @@ void edit_me(void)
 {
        char buf[SIZ];
 
+       output_headers(1, 0, 0, 0, 0, 0);
        if (havebstr("change_room_name_button")) {
                serv_printf("RCHG %s", bstr("fake_roomname"));
                serv_getln(buf, sizeof buf);
-               http_redirect("who");
+               do_template("who");
        } else if (havebstr("change_host_name_button")) {
                serv_printf("HCHG %s", bstr("fake_hostname"));
                serv_getln(buf, sizeof buf);
-               http_redirect("who");
+               do_template("who");
        } else if (havebstr("change_user_name_button")) {
                serv_printf("UCHG %s", bstr("fake_username"));
                serv_getln(buf, sizeof buf);
-               http_redirect("who");
+               do_template("who");
        } else if (havebstr("cancel_button")) {
-               http_redirect("who");
+               do_template("who");
        } else {
-               output_headers(1, 1, 0, 0, 0, 0);
-
-               wc_printf("<div id=\"banner\">\n");
-               wc_printf("<table class=\"who_banner\"><tr><td>");
-               wc_printf("<span class=\"titlebar\">");
-               wc_printf(_("Edit your session display"));
-               wc_printf("</span></td></tr></table>\n");
-               wc_printf("</div>\n<div id=\"content\">\n");
-
-               wc_printf(_("This screen allows you to change the way your "
-                       "session appears in the 'Who is online' listing. "
-                       "To turn off any 'fake' name you've previously "
-                       "set, simply click the appropriate 'change' button "
-                       "without typing anything in the corresponding box. "));
-               wc_printf("<br>\n");
-
-               wc_printf("<form method=\"POST\" action=\"edit_me\">\n");
-               wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
-
-               wc_printf("<table border=0 width=100%%>\n");
-
-               wc_printf("<tr><td><b>");
-               wc_printf(_("Room name:"));
-               wc_printf("</b></td>\n<td>");
-               wc_printf("<input type=\"text\" name=\"fake_roomname\" maxlength=\"64\">\n");
-               wc_printf("</td>\n<td align=center>");
-               wc_printf("<input type=\"submit\" name=\"change_room_name_button\" value=\"%s\">",
-                       _("Change room name"));
-               wc_printf("</td>\n</tr>\n");
-
-               wc_printf("<tr><td><b>");
-               wc_printf(_("Host name:"));
-               wc_printf("</b></td><td>");
-               wc_printf("<input type=\"text\" name=\"fake_hostname\" maxlength=\"64\">\n");
-               wc_printf("</td>\n<td align=center>");
-               wc_printf("<input type=\"submit\" name=\"change_host_name_button\" value=\"%s\">",
-                       _("Change host name"));
-               wc_printf("</td>\n</tr>\n");
-
-               if (WC->is_aide) {
-                       wc_printf("<tr><td><b>");
-                       wc_printf(_("User name:"));
-                       wc_printf("</b></td><td>");
-                       wc_printf("<input type=\"text\" name=\"fake_username\" maxlength=\"64\">\n");
-                       wc_printf("</td>\n<td align=center>");
-                       wc_printf("<input type=\"submit\" name \"change_user_name_button\" value=\"%s\">",
-                               _("Change user name"));
-                       wc_printf("</td>\n</tr>\n");
-               }
-               wc_printf("<tr><td> </td><td> </td><td align=center>");
-               wc_printf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
-                       _("Cancel"));
-               wc_printf("</td></tr></table>\n");
-               wc_printf("</form></center>\n");
-               wDumpContent(1);
+               do_template("who_edit");
        }
+       end_burst();
 }
 
 void _terminate_session(void) {