]> code.citadel.org Git - citadel.git/blobdiff - webcit/who.c
fix the who is online display
[citadel.git] / webcit / who.c
index 341b9bdf6f15f4842d58f5cbb31aed8e64884b3a..d1e05518f925a63fc2d399294c7932c303e816db 100644 (file)
@@ -1,15 +1,17 @@
 /*
  * $Id$
- *
- * Display a list of all users currently logged on to the Citadel server.
  */
-
+/**
+ * \defgroup DislpayWho Display a list of all users currently logged on to the Citadel server.
+ * \ingroup WebcitDisplayItems
+ */
+/*@{*/
 #include "webcit.h"
 
 
 
-/*
- * Display inner div of Wholist
+/**
+ * \brief Display inner div of Wholist
  */
 void who_inner_div(void) {
        char buf[SIZ], user[SIZ], room[SIZ], host[SIZ],
@@ -19,12 +21,13 @@ void who_inner_div(void) {
        time_t now;
        int bg = 0;
 
-       wprintf("<table border=\"0\" cellspacing=\"0\" width=\"100%%\" bgcolor=\"#FFFFFF\">"
+       wprintf("<table class=\"altern\">"
                "<tr>\n");
-       wprintf("<th colspan=\"3\"> </th>\n");
+       wprintf("<th class=\"edit_col\"> </th>\n");
+       wprintf("<th colspan=\"2\"> </th>\n");
        wprintf("<th>%s</th>\n", _("User name"));
        wprintf("<th>%s</th>", _("Room"));
-       wprintf("<th>%s</th>\n</tr>\n", _("From host"));
+       wprintf("<th class=\"host_col\">%s</th>\n</tr>\n", _("From host"));
 
        serv_puts("TIME");
        serv_getln(buf, sizeof buf);
@@ -48,12 +51,12 @@ void who_inner_div(void) {
                        last_activity = extract_long(buf, 5);
 
                        bg = 1 - bg;
-                       wprintf("<tr bgcolor=\"#%s\">",
-                               (bg ? "DDDDDD" : "FFFFFF")
+                       wprintf("<tr class=\"%s\">",
+                               (bg ? "even" : "odd")
                        );
 
 
-                       wprintf("<td>");
+                       wprintf("<td class=\"edit_col\">");
                        if ((WC->is_aide) &&
                            (sess != WC->ctdl_pid)) {
                                wprintf(" <a href=\"terminate_session?which_session=%d", sess);
@@ -64,8 +67,8 @@ void who_inner_div(void) {
                        }
                        wprintf("</td>");
 
-                       /* (link to page this user) */
-                       wprintf("<td><a href=\"display_page?recp=");
+                       /** (link to page this user) */
+                       wprintf("<td width=\"5%\"><a href=\"display_page?recp=");
                        urlescputs(user);
                        wprintf("\">"
                                "<img align=\"middle\" "
@@ -74,8 +77,8 @@ void who_inner_div(void) {
                                " border=\"0\" /></a> ");
                        wprintf("</td>");
 
-                       /* (idle flag) */
-                       wprintf("<td>");
+                       /** (idle flag) */
+                       wprintf("<td width=\"5%\">");
                        if ((now - last_activity) > 900L) {
                                wprintf(" "
                                        "<img align=\"middle\" "
@@ -92,26 +95,26 @@ void who_inner_div(void) {
 
 
 
-                       /* username (link to user bio/photo page) */
+                       /** username (link to user bio/photo page) */
                        wprintf("<a href=\"showuser?who=");
                        urlescputs(user);
                        wprintf("\">");
                        escputs(user);
                        wprintf("</a>");
 
-                       /* room */
+                       /** room */
                        wprintf("</td>\n\t<td>");
                        escputs(room);
-                       if (strlen(realroom) > 0) {
+                       if (!IsEmptyStr(realroom) ) {
                                wprintf("<br /><i>");
                                escputs(realroom);
                                wprintf("</i>");
                        }
-                       wprintf("</td>\n\t<td>");
+                       wprintf("</td>\n\t<td class=\"host_col\">");
 
-                       /* hostname */
+                       /** hostname */
                        escputs(host);
-                       if (strlen(realhost) > 0) {
+                       if (!IsEmptyStr(realhost)) {
                                wprintf("<br /><i>");
                                escputs(realhost);
                                wprintf("</i>");
@@ -123,8 +126,8 @@ void who_inner_div(void) {
 }
 
 
-/*
- * who is on?
+/**
+ * \brief who is on?
  */
 void who(void)
 {
@@ -140,34 +143,38 @@ void who(void)
        );
 
        wprintf("<div id=\"banner\">\n");
-       wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
-       wprintf("<img src=\"static/usermanag_48x.gif\" ALT=\" \" "
-               "ALIGN=MIDDLE "
-               ">");
-       wprintf("<SPAN CLASS=\"titlebar\"> ");
-
+       wprintf("<div class=\"room_banner\">");
+       wprintf("<img src=\"static/usermanag_48x.gif\">");
+       wprintf("<h1>");
        snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
        escputs(title);
-
-       wprintf("</SPAN></TD><TD ALIGN=RIGHT>");
+       wprintf("</h1></div>");
+       wprintf("<ul class=\"room_actions\">\n");
+       wprintf("<li class=\"start_page\">");
        offer_start_page();
-       wprintf("</TD></TR></TABLE>\n");
-       wprintf("</div>\n");
+       wprintf("</li></ul>");
+       wprintf("</div>");
 
-       wprintf("<div id=\"content\">\n");
-
-       wprintf("<div style=\"display:inline\" id=\"fix_scrollbar_bug\">");
+       wprintf("<div id=\"content\" class=\"fix_scrollbar_bug who_is_online\">\n");
+       wprintf("<div class=\"box\">");
+       wprintf("<div class=\"boxlabel\">");    
+       snprintf(title, sizeof title, _("Users currently on %s"), serv_info.serv_humannode);
+       escputs(title);
+       wprintf("</div>");      
+       wprintf("<div class=\"boxcontent\">");
+        wprintf("<div id=\"who_inner\" >");
        who_inner_div();
-       wprintf("</div>\n");
+       wprintf("</div>");
 
-       wprintf("<div id=\"instructions\" align=center>");
+       wprintf("<div class=\"instructions\">");
        wprintf(_("Click on a name to read user info.  Click on %s "
                "to send an instant message to that user."),
                "<img align=\"middle\" src=\"static/citadelchat_16x.gif\" alt=\"(p)\" border=\"0\">"
        );
-       wprintf("</div>\n");
+       wprintf("</div></div>\n");
 
-       /* JavaScript to make the ajax refresh happen:
+       /**
+        * JavaScript to make the ajax refresh happen:
         * See http://www.sergiopereira.com/articles/prototype.js.html for info on Ajax.PeriodicalUpdater
         * It wants: 1. The div being updated
         *           2. The URL of the update source
@@ -175,14 +182,16 @@ void who(void)
         */
        wprintf(
                "<script type=\"text/javascript\">                                      "
-               " new Ajax.PeriodicalUpdater('fix_scrollbar_bug', 'who_inner_html',     "
+               " new Ajax.PeriodicalUpdater('who_inner', 'who_inner_html',     "
                "                            { method: 'get', frequency: 30 }  );       "
                "</script>                                                              \n"
        );
        wDumpContent(1);
 }
 
-
+/**
+ * \brief end session \todo what??? does this belong here? 
+ */
 void terminate_session(void)
 {
        char buf[SIZ];
@@ -193,35 +202,35 @@ void terminate_session(void)
 }
 
 
-/*
- * Change your session info (fake roomname and hostname)
+/**
+ * \brief Change your session info (fake roomname and hostname)
  */
 void edit_me(void)
 {
        char buf[SIZ];
 
-       if (strlen(bstr("change_room_name_button")) > 0) {
+       if (!IsEmptyStr(bstr("change_room_name_button"))) {
                serv_printf("RCHG %s", bstr("fake_roomname"));
                serv_getln(buf, sizeof buf);
                http_redirect("who");
-       } else if (strlen(bstr("change_host_name_button")) > 0) {
+       } else if (!IsEmptyStr(bstr("change_host_name_button"))) {
                serv_printf("HCHG %s", bstr("fake_hostname"));
                serv_getln(buf, sizeof buf);
                http_redirect("who");
-       } else if (strlen(bstr("change_user_name_button")) > 0) {
+       } else if (!IsEmptyStr(bstr("change_user_name_button"))) {
                serv_printf("UCHG %s", bstr("fake_username"));
                serv_getln(buf, sizeof buf);
                http_redirect("who");
-       } else if (strlen(bstr("cancel_button")) > 0) {
+       } else if (!IsEmptyStr(bstr("cancel_button"))) {
                http_redirect("who");
        } else {
                output_headers(1, 1, 0, 0, 0, 0);
 
                wprintf("<div id=\"banner\">\n");
-               wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
-               wprintf("<SPAN CLASS=\"titlebar\">");
+               wprintf("<table class=\"who_banner\"><tr><td>");
+               wprintf("<span class=\"titlebar\">");
                wprintf(_("Edit your session display"));
-               wprintf("</SPAN></TD></TR></TABLE>\n");
+               wprintf("</span></td></tr></table>\n");
                wprintf("</div>\n<div id=\"content\">\n");
 
                wprintf(_("This screen allows you to change the way your "
@@ -232,6 +241,7 @@ void edit_me(void)
                wprintf("<br />\n");
 
                wprintf("<form method=\"POST\" action=\"edit_me\">\n");
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
 
                wprintf("<table border=0 width=100%%>\n");
 
@@ -244,30 +254,33 @@ void edit_me(void)
                        _("Change room name"));
                wprintf("</td>\n</tr>\n");
 
-               wprintf("<TR><TD><B>");
+               wprintf("<tr><td><b>");
                wprintf(_("Host name:"));
-               wprintf("</B></TD><TD>");
-               wprintf("<INPUT TYPE=\"text\" NAME=\"fake_hostname\" MAXLENGTH=\"64\">\n");
-               wprintf("</TD>\n<TD ALIGN=center>");
-               wprintf("<INPUT TYPE=\"submit\" NAME=\"change_host_name_button\" VALUE=\"%s\">",
+               wprintf("</b></td><td>");
+               wprintf("<input type=\"text\" name=\"fake_hostname\" maxlength=\"64\">\n");
+               wprintf("</td>\n<td align=center>");
+               wprintf("<input type=\"submit\" name=\"change_host_name_button\" value=\"%s\">",
                        _("Change host name"));
-               wprintf("</TD>\n</TR>\n");
+               wprintf("</td>\n</tr>\n");
 
                if (WC->is_aide) {
-                       wprintf("<TR><TD><B>");
+                       wprintf("<tr><td><b>");
                        wprintf(_("User name:"));
-                       wprintf("</B></TD><TD>");
-                       wprintf("<INPUT TYPE=\"text\" NAME=\"fake_username\" MAXLENGTH=\"64\">\n");
-                       wprintf("</TD>\n<TD ALIGN=center>");
-                       wprintf("<INPUT TYPE=\"submit\" NAME=\"change_user_name_button\" VALUE=\"%s\">",
+                       wprintf("</b></td><td>");
+                       wprintf("<input type=\"text\" name=\"fake_username\" maxlength=\"64\">\n");
+                       wprintf("</td>\n<td align=center>");
+                       wprintf("<input type=\"submit\" name \"change_user_name_button\" value=\"%s\">",
                                _("Change user name"));
-                       wprintf("</TD>\n</TR>\n");
+                       wprintf("</td>\n</tr>\n");
                }
-               wprintf("<TR><TD> </TD><TD> </TD><TD ALIGN=center>");
-               wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">",
+               wprintf("<tr><td> </td><td> </td><td align=center>");
+               wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
                        _("Cancel"));
-               wprintf("</TD></TR></TABLE>\n");
-               wprintf("</FORM></CENTER>\n");
+               wprintf("</td></tr></table>\n");
+               wprintf("</form></center>\n");
                wDumpContent(1);
        }
 }
+
+
+/*@}*/