X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsummary.c;h=00a52096dddc9e4e1cf9f99ddd8aa97617c1bae0;hb=611d86f026c1590948e1317406656bfb106217e5;hp=ed5bb61e81b7aacb3fe4f6a055c08a8cb59bb01f;hpb=aa8ca3b0af3efdabd8559b886efb3164319bdce1;p=citadel.git diff --git a/webcit/summary.c b/webcit/summary.c index ed5bb61e8..00a52096d 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -12,43 +12,31 @@ 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); } -/* - * Dummy section +/** + * \brief Dummy section */ void dummy_section(void) { - svprintf("BOXTITLE", WCS_STRING, "(dummy section)"); - do_template("beginbox"); - wprintf("(nothing)"); - do_template("endbox"); + svput("BOXTITLE", WCS_STRING, "(dummy section)"); + do_template("beginbox", NULL); + wprintf(_("(nothing)")); + do_template("endbox", NULL); } -/* - * New messages section +/** + * \brief New messages section */ void new_messages_section(void) { char buf[SIZ]; @@ -57,13 +45,11 @@ void new_messages_section(void) { int number_of_rooms_to_check; char *rooms_to_check = "Mail|Lobby"; - 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"); - do_template("endbox"); - -} + wprintf("\n"); - -/* - * Wholist section - */ -void wholist_section(void) { - char buf[SIZ]; - char user[SIZ]; - - svprintf("BOXTITLE", WCS_STRING, "Who's online now"); - do_template("beginbox"); - serv_puts("RWHO"); - 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"); - } - 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 - svprintf("BOXTITLE", WCS_STRING, "Tasks"); - do_template("beginbox"); -#ifdef WEBCIT_WITH_CALENDAR_SERVICE gotoroom("_TASKS_"); if (WC->wc_view != VIEW_TASKS) { num_msgs = 0; @@ -128,37 +88,29 @@ void tasks_section(void) { } if (num_msgs < 1) { - wprintf("(None)
\n"); + wprintf(""); + wprintf(_("(None)")); + wprintf("
\n"); } else { for (i=0; imsgarr[i]); + display_task(WC->msgarr[i], 0); } } calendar_summary_view(); - -#else /* WEBCIT_WITH_CALENDAR_SERVICE */ - wprintf("(This server does not support task lists)\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 - svprintf("BOXTITLE", WCS_STRING, "Today on your calendar"); - do_template("beginbox"); -#ifdef WEBCIT_WITH_CALENDAR_SERVICE gotoroom("_CALENDAR_"); - if (WC->wc_view != VIEW_CALENDAR) { + if ( (WC->wc_view != VIEW_CALENDAR) && (WC->wc_view != VIEW_CALBRIEF) ) { num_msgs = 0; } else { @@ -166,64 +118,43 @@ void calendar_section(void) { } if (num_msgs < 1) { - wprintf("(Nothing)
\n"); + wprintf(""); + wprintf(_("(Nothing)")); + wprintf("
\n"); } else { for (i=0; imsgarr[i]); + display_calendar(WC->msgarr[i], 0); } calendar_summary_view(); } - -#else /* WEBCIT_WITH_CALENDAR_SERVICE */ - wprintf("(This server does not support calendars)\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) { - svprintf("BOXTITLE", WCS_STRING, "About this server"); - do_template("beginbox"); - wprintf("You are connected to "); - escputs(serv_info.serv_humannode); - wprintf(", running "); - escputs(serv_info.serv_software); - wprintf(" with "); - escputs(SERVER); - wprintf(", and located in "); - escputs(serv_info.serv_bbs_city); - wprintf(".
\nYour system administrator is "); - escputs(serv_info.serv_sysadm); - wprintf(".\n"); - do_template("endbox"); + char message[512]; + + snprintf(message, sizeof message, + _("You are connected to %s, running %s with %s, server build %s and located in %s. Your system administrator is %s."), + serv_info.serv_humannode, + serv_info.serv_software, + PACKAGE_STRING, + serv_info.serv_svn_revision, + serv_info.serv_bbs_city, + serv_info.serv_sysadm); + escputs(message); } - -/* - * Display this user's summary page +/** + * \brief summary of inner div???? */ -void summary(void) { - output_headers(1, 1, 2, 0, 1, 0, 0); - wprintf("
\n"); - wprintf("" - "
" - "" - "Summary page for "); - escputs(WC->wc_username); - wprintf("\n"); - wprintf(""); - output_date(); - wprintf("
"); - offer_start_page(); - wprintf("
\n"); - wprintf("
\n
\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 @@ -231,34 +162,142 @@ void summary(void) { * not people I consider worthwhile, I still want them to use WebCit. */ - wprintf("
" - ""); + wprintf("
" + "
" + ""); - /* + /** * Column One */ wprintf(""); - /* - * Column Two + /** + * Column Two */ - wprintf(""); - /* + /** * Column Three */ - wprintf(""); + + wprintf(""); + + /** + * Row Two - Column One + */ + wprintf(""); + + /** + * Row Two - Column Two + */ + wprintf(""); + - /* + /** * End of columns */ - wprintf("
"); - wholist_section(); + wprintf("
"); + wprintf("
"); + wprintf(_("Messages")); + wprintf("
"); + wprintf("
"); + new_messages_section(); + wprintf("
"); + wprintf("
"); - server_info_section(); - wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf(_("Tasks")); + wprintf("
"); + wprintf("
"); tasks_section(); + wprintf("
"); + wprintf("
"); - new_messages_section(); - wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf(_("Today on your calendar")); + wprintf("
"); + wprintf("
"); calendar_section(); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf(_("Who's online now")); + wprintf("
"); + wprintf("
"); + do_template("wholistsummarysection", NULL); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf("
"); + wprintf(_("About this server")); + wprintf("
"); + wprintf("
"); + server_info_section(); + wprintf("
"); + 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("
"); + wprintf(""); + wprintf("

"); + snprintf(title, sizeof title, _("Summary page for %s"), WC->wc_fullname); + escputs(title); + wprintf("

"); + output_date(); + wprintf("

"); + wprintf("
    \n"); + wprintf("
  • "); + offer_start_page(NULL, 0, NULL, NULL); + wprintf("
"); + wprintf("
"); + + /** + * 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"); + summary_inner_div(); + wprintf("
\n"); + + wprintf( + " \n" + ); + wDumpContent(1); } + +void +InitModule_SUMMARY +(void) +{ + WebcitAddUrlHandler(HKEY("new_messages_html"), new_messages_section, AJAX); + WebcitAddUrlHandler(HKEY("tasks_inner_html"), tasks_section, AJAX); + WebcitAddUrlHandler(HKEY("calendar_inner_html"), calendar_section, AJAX); + WebcitAddUrlHandler(HKEY("mini_calendar"), ajax_mini_calendar, AJAX); + WebcitAddUrlHandler(HKEY("summary"), summary, 0); + WebcitAddUrlHandler(HKEY("summary_inner_div"), summary_inner_div, AJAX); +} + +/*@}*/