$Log$
+Revision 323.65 2002/08/26 01:24:09 ajc
+* Added a "summary" page (rather sparse for now)
+
Revision 323.64 2002/08/24 15:30:48 ajc
* GET instead of POST for listsub. Also add a 'Back...' link.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
webserver: webserver.o context_loop.o tools.o \
- cookie_conversion.o locate_host.o floors.o \
+ cookie_conversion.o locate_host.o floors.o summary.o \
webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
vcard.o vcard_edit.o preferences.o html2html.o listsub.o \
roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o floors.o \
mime_parser.o graphics.o netconf.o preferences.o html2html.o \
+ summary.o \
$(LIBOBJS) $(LIBS) -o webserver
.c.o:
wprintf("</TD><TD>"); /* start of third column */
wprintf("<UL>");
- wprintf("<LI><B><A HREF=\"/whobbs\">\n");
- wprintf("Who is online?</B></A><BR>(users <EM>currently</EM> logged on)</LI>\n");
+ wprintf("<LI><B><A HREF=\"/summary\">\n");
+ wprintf("Summary page</B></A><BR>Summary of my account</LI>\n");
wprintf("<LI><B><A HREF=\"/userlist\">\n");
wprintf("User list</B></A><BR>(all registered users)</LI>\n");
wprintf("</FONT></TD></TR></TABLE>\n");
wprintf("<UL>");
+ wprintf("<LI><A HREF=\"/whobbs\">\n");
+ wprintf("Who is online?</A><font size=-2> "
+ "(users <EM>currently</EM> logged on)</font>\n");
wprintf("<LI><A HREF=\"/chat\">");
wprintf("Chat with other online users</A>\n");
}
+
+
char buf[SIZ];
int levels, oldlevels;
+ int swap = 0;
struct folder {
char room[SIZ];
struct folder ftmp;
int max_folders = 0;
int alloc_folders = 0;
- int i, j, k;
+ int i, j, k, t;
int p;
int flags;
int floor;
fold = malloc(sizeof(struct folder));
memset(fold, 0, sizeof(struct folder));
strcpy(fold[0].name, "My folders");
+ fold[0].is_mailbox = 1;
/* Then add floors */
serv_puts("LFLR");
/* Bubble-sort the folder list */
for (i=0; i<max_folders; ++i) {
for (j=0; j<(max_folders-1)-i; ++j) {
- if (strcasecmp(fold[j].name, fold[j+1].name) > 0) {
+ if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
+ swap = strcasecmp(fold[j].name, fold[j+1].name);
+ }
+ else {
+ if ( (fold[j+1].is_mailbox)
+ && (!fold[j].is_mailbox)) {
+ swap = 1;
+ }
+ else {
+ swap = 0;
+ }
+ }
+ if (swap > 0) {
memcpy(&ftmp, &fold[j], sizeof(struct folder));
memcpy(&fold[j], &fold[j+1],
sizeof(struct folder));
levels = num_tokens(fold[i].name, '|');
if (levels > oldlevels) {
for (k=0; k<(levels-oldlevels); ++k) {
- wprintf("<UL>");
++nests;
}
}
if (levels < oldlevels) {
for (k=0; k<(oldlevels-levels); ++k) {
- wprintf("</UL>");
--nests;
}
}
oldlevels = levels;
- wprintf("<LI>");
+ for (t=0; t<nests; ++t) wprintf(" ");
if (fold[i].selectable) {
wprintf("<A HREF=\"/dotgoto?room=");
urlescputs(fold[i].room);
wprintf("\">");
}
+ else {
+ wprintf("<i>");
+ }
if (fold[i].hasnewmsgs) wprintf("<B>");
extract(buf, fold[i].name, levels-1);
escputs(buf);
if (fold[i].hasnewmsgs) wprintf("</B>");
- if (fold[i].selectable) wprintf("</A>\n");
+ if (fold[i].selectable) {
+ wprintf("</A>");
+ }
+ else {
+ wprintf("</i>");
+ }
+ if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
+ wprintf(" (INBOX)");
+ }
+ wprintf("<BR>\n");
}
- while (nests-- > 0) wprintf("</UL>\n");
+ while (nests-- > 0) ;;
free(fold);
wDumpContent(1);
--- /dev/null
+/* $Id$ */
+
+
+
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <time.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
+#include "webcit.h"
+
+/*
+ * Display today's date in a friendly format
+ */
+void output_date(void) {
+ struct tm tm;
+ time_t now;
+
+ static char *wdays[] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ };
+ static char *months[] = {
+ "January", "February", "March", "April", "May", "June", "July",
+ "August", "September", "October", "November", "December"
+ };
+
+ time(&now);
+ localtime_r(&now, &tm);
+
+ wprintf("%s, %s %d, %d",
+ wdays[tm.tm_wday],
+ months[tm.tm_mon],
+ tm.tm_mday,
+ tm.tm_year + 1900
+ );
+}
+
+
+
+/*
+ * Display the title bar for a section
+ */
+void section_title(char *title) {
+
+ wprintf("<TABLE width=100%% border=0 cellpadding=5 cellspacing=0>"
+ "<TR><TD BGCOLOR=444455>"
+ "<FONT COLOR=FFFFEE>");
+ escputs(title);
+ wprintf("</FONT></TD></TR></TABLE>\n");
+}
+
+
+/*
+ * Dummy section
+ */
+void dummy_section(void) {
+ section_title("---");
+}
+
+
+/*
+ * New messages section
+ */
+void new_messages_section(void) {
+ char buf[SIZ];
+ char room[SIZ];
+ int i;
+ int number_of_rooms_to_check;
+ char *rooms_to_check = "Mail|Lobby";
+
+ section_title("Messages");
+
+ number_of_rooms_to_check = num_tokens(rooms_to_check, '|');
+ if (number_of_rooms_to_check == 0) return;
+
+ wprintf("<TABLE BORDER=0 WIDTH=100%%>\n");
+ for (i=0; i<number_of_rooms_to_check; ++i) {
+ extract(room, rooms_to_check, i);
+
+ serv_printf("GOTO %s", room);
+ serv_gets(buf);
+ if (buf[0] == '2') {
+ extract(room, &buf[4], 0);
+ wprintf("<TR><TD>");
+ escputs(room);
+ wprintf("</TD><TD>%d/%d</TD></TR>\n",
+ extract_int(&buf[4], 1),
+ extract_int(&buf[4], 2)
+ );
+ }
+ }
+ wprintf("</TABLE>\n");
+
+}
+
+
+/*
+ * Wholist section
+ */
+void wholist_section(void) {
+ char buf[SIZ];
+ char user[SIZ];
+
+ section_title("Who's online now");
+ serv_puts("RWHO");
+ serv_gets(buf);
+ if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) {
+ extract(user, buf, 1);
+ escputs(user);
+ wprintf("<BR>\n");
+ }
+}
+
+
+
+
+/*
+ * Display this user's summary page
+ */
+void summary(void) {
+ output_headers(7);
+
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
+ "<FONT SIZE=+1 COLOR=\"FFFFFF\""
+ "<B>Summary page for ");
+ escputs(WC->wc_username);
+ wprintf("</B><FONT></TD><TD>\n");
+ offer_start_page();
+ wprintf("</TD></TR></TABLE>\n");
+
+ wprintf("<DIV ALIGN=RIGHT>");
+ output_date();
+ wprintf("</DIV>\n");
+
+ /*
+ * Now let's do three columns of crap. All portals and all groupware
+ * clients seem to want to do three columns, so we'll do three
+ * columns too. Conformity is not inherently a virtue, but there are
+ * a lot of really shallow people out there, and even though they're
+ * not people I consider worthwhile, I still want them to use WebCit.
+ */
+
+ wprintf("<TABLE WIDTH=100%% BORDER=0 CELLPADDING=10><TR VALIGN=TOP>");
+
+ /*
+ * Column One
+ */
+ wprintf("<TD>");
+ wholist_section();
+
+ /*
+ * Column Two
+ */
+ wprintf("</TD><TD>");
+ dummy_section();
+
+ /*
+ * Column Three
+ */
+ wprintf("</TD><TD>");
+ new_messages_section();
+
+ /*
+ * End of columns
+ */
+ wprintf("</TD></TR></TABLE>\n");
+
+ wDumpContent(1);
+}
display_floorconfig(NULL);
} else if (!strcasecmp(action, "toggle_self_service")) {
toggle_self_service();
+ } else if (!strcasecmp(action, "summary")) {
+ summary();
} else if (!strcasecmp(action, "diagnostics")) {
output_headers(1);
void rename_floor(void);
void do_listsub(void);
void toggle_self_service(void);
+void summary(void);