X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsummary.c;h=13dfdf70abca7e2bc4d2bda46677ca73bed42747;hb=8d8c5af38e5026933ea3b9d5eb1b75f276df1d99;hp=46bed8fdec0eef8c29f49ad9fabff3a94e69d955;hpb=069ad0b4147645fe42dad360773ab9f1a3b98ca3;p=citadel.git diff --git a/webcit/summary.c b/webcit/summary.c index 46bed8fde..13dfdf70a 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -1,79 +1,44 @@ -/* $Id$ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* + * $Id$ + */ +/** + * \defgroup SymaryFuncs Displays the "Summary Page" + * \ingroup WebcitDisplayItems + */ +/*@{*/ #include "webcit.h" -/* - * Display today's date in a friendly format +/** + * \brief 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" - }; + char buf[128]; 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 - ); + wc_strftime(buf, 32, "%A, %x", &tm); + wprintf("%s", buf); } -/* - * Display the title bar for a section - */ -void section_title(char *title) { - wprintf("" - "
" - ""); - escputs(title); - wprintf("
\n"); -} - - -/* - * Dummy section +/** + * \brief Dummy section */ void dummy_section(void) { - section_title("---"); + svprintf("BOXTITLE", WCS_STRING, "(dummy section)"); + do_template("beginbox"); + wprintf(_("(nothing)")); + do_template("endbox"); } -/* - * New messages section +/** + * \brief New messages section */ void new_messages_section(void) { char buf[SIZ]; @@ -82,164 +47,163 @@ void new_messages_section(void) { int number_of_rooms_to_check; char *rooms_to_check = "Mail|Lobby"; - section_title("Messages"); + svprintf("BOXTITLE", WCS_STRING, _("Messages")); + do_template("beginbox"); number_of_rooms_to_check = num_tokens(rooms_to_check, '|'); if (number_of_rooms_to_check == 0) return; - wprintf("\n"); + wprintf("
\n"); for (i=0; i\n", + wprintf("\n", extract_int(&buf[4], 1), extract_int(&buf[4], 2) ); } } - wprintf("
"); escputs(room); - wprintf("%d/%d
%d/%d
\n"); + wprintf("\n"); + do_template("endbox"); } -/* - * Wholist section +/** + * \brief Wholist section */ void wholist_section(void) { char buf[SIZ]; char user[SIZ]; - section_title("Who's online now"); + svprintf("BOXTITLE", WCS_STRING, _("Who's online now")); + do_template("beginbox"); serv_puts("RWHO"); - serv_gets(buf); - if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) { - extract(user, buf, 1); + serv_getln(buf, sizeof buf); + if (buf[0] == '1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) { + extract_token(user, buf, 1, '|', sizeof user); escputs(user); - wprintf("
\n"); + wprintf("
\n"); } + do_template("endbox"); } -/* - * Task list section +/** + * \brief Task list section */ void tasks_section(void) { +#ifdef WEBCIT_WITH_CALENDAR_SERVICE int num_msgs = 0; int i; +#endif - section_title("Tasks"); - gotoroom("Tasks", 0); - if (strcasecmp(WC->wc_roomname, "Tasks")) { - wprintf("(You do not have a task list)
\n"); - return; + svprintf("BOXTITLE", WCS_STRING, _("Tasks")); + do_template("beginbox"); +#ifdef WEBCIT_WITH_CALENDAR_SERVICE + gotoroom("_TASKS_"); + if (WC->wc_view != VIEW_TASKS) { + num_msgs = 0; + } + else { + num_msgs = load_msg_ptrs("MSGS ALL", 0); } - num_msgs = load_msg_ptrs("MSGS ALL"); if (num_msgs < 1) { - wprintf("(None)
\n"); - return; + wprintf(""); + wprintf(_("(None)")); + wprintf("
\n"); } - - wprintf("
    "); - for (i=0; imsgarr[i]); + else { + for (i=0; imsgarr[i]); + } } - wprintf("
\n"); + + calendar_summary_view(); + +#else /* WEBCIT_WITH_CALENDAR_SERVICE */ + wprintf(""); + wprintf(_("(This server does not support task lists)")); + wprintf("\n"); +#endif /* WEBCIT_WITH_CALENDAR_SERVICE */ + do_template("endbox"); } -/* - * Calendar section +/** + * \brief Calendar section */ void calendar_section(void) { +#ifdef WEBCIT_WITH_CALENDAR_SERVICE int num_msgs = 0; int i; +#endif - section_title("Today on your calendar"); + svprintf("BOXTITLE", WCS_STRING, _("Today on your calendar")); + do_template("beginbox"); #ifdef WEBCIT_WITH_CALENDAR_SERVICE - gotoroom("Calendar", 0); - if (strcasecmp(WC->wc_roomname, "Calendar")) { - wprintf("(You do not have a calendar)
\n"); - return; + gotoroom("_CALENDAR_"); + if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) { + num_msgs = 0; + } + else { + num_msgs = load_msg_ptrs("MSGS ALL", 0); } - num_msgs = load_msg_ptrs("MSGS ALL"); if (num_msgs < 1) { - wprintf("(Nothing)
\n"); - return; + wprintf(""); + wprintf(_("(Nothing)")); + wprintf("
\n"); } - - for (i=0; imsgarr[i]); + else { + for (i=0; imsgarr[i]); + } + calendar_summary_view(); } - calendar_summary_view(); +#else /* WEBCIT_WITH_CALENDAR_SERVICE */ + wprintf(""); + wprintf(_("(This server does not support calendars)")); + wprintf("\n"); #endif /* WEBCIT_WITH_CALENDAR_SERVICE */ + do_template("endbox"); } - -/* - * Server info section (fluff, really) +/** + * \brief Server info section (fluff, really) */ void server_info_section(void) { - char buf[SIZ]; - int i = 0; - - section_title("About this server"); - serv_puts("INFO"); - serv_gets(buf); - if (buf[0] == '1') while(serv_gets(buf), strcmp(buf, "000")) { - switch(i) { - case 2: - wprintf("You are connected to "); - escputs(buf); - wprintf(", "); - break; - case 4: wprintf("running "); - escputs(buf); - wprintf(", "); - break; - case 6: wprintf("and located in "); - escputs(buf); - wprintf(".
\n"); - break; - case 7: wprintf("Your system administrator is "); - escputs(buf); - wprintf(".\n"); - break; - } - ++i; - } + char message[512]; + + svprintf("BOXTITLE", WCS_STRING, _("About this server")); + do_template("beginbox"); + + snprintf(message, sizeof message, + _("You are connected to %s, running %s with %s, and located in %s. Your system administrator is %s."), + serv_info.serv_humannode, + serv_info.serv_software, + SERVER, + serv_info.serv_bbs_city, + serv_info.serv_sysadm); + escputs(message); + do_template("endbox"); } - - - -/* - * Display this user's summary page +/** + * \brief summary of inner div???? */ -void summary(void) { - output_headers(7); - - wprintf("
" - "" - "Summary page for "); - escputs(WC->wc_username); - wprintf("\n"); - offer_start_page(); - wprintf(""); - output_date(); - wprintf("
\n"); - - /* +void summary_inner_div(void) { + /** * 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 @@ -247,34 +211,78 @@ void summary(void) { * not people I consider worthwhile, I still want them to use WebCit. */ - wprintf(""); + wprintf("
" + "
"); - /* + /** * Column One */ - wprintf("
"); + wprintf(""); wholist_section(); - /* + /** * Column Two */ - wprintf(""); + wprintf(""); server_info_section(); - wprintf("

"); + wprintf("
"); tasks_section(); - /* + /** * Column Three */ - wprintf("
"); + wprintf(""); new_messages_section(); - wprintf("

"); + wprintf("
"); calendar_section(); - /* + /** * End of columns */ - wprintf("
\n"); + wprintf(""); +} + + +/** + * \brief Display this user's summary page + */ +void summary(void) { + char title[256]; + + output_headers(1, 1, 2, 0, 0, 0); + wprintf("
\n"); + wprintf("" + "
" + "" + ); + + snprintf(title, sizeof title, _("Summary page for %s"), WC->wc_fullname); + escputs(title); + wprintf("\n"); + wprintf(""); + output_date(); + wprintf("
"); + offer_start_page(); + wprintf("
\n"); + + /** + * You guessed it ... we're going to refresh using ajax. + * In the future we might consider updating individual sections of the summary + * instead of the whole thing. + */ + wprintf("
\n
\n"); + summary_inner_div(); + wprintf("
\n"); + + wprintf( + " \n" + ); wDumpContent(1); } + + +/*@}*/