X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsummary.c;h=ffd840853bc1470c29ac33a6093d35ada8a8a3c0;hb=be00863d58a61c8ee070e346fb0ac70c5b7f6a8e;hp=e22bfa1d928f4f7e80eec76e92f116677b3406a3;hpb=523c1b0f7a3002c6aaa3eb833b55eb0cf07674ff;p=citadel.git diff --git a/webcit/summary.c b/webcit/summary.c index e22bfa1d9..ffd840853 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -12,40 +12,13 @@ void output_date(void) { struct tm tm; time_t now; - - static char *wdays[7]; - static char *months[12]; - - wdays[0] = _("Sunday"); - wdays[1] = _("Monday"); - wdays[2] = _("Tuesday"); - wdays[3] = _("Wednesday"); - wdays[4] = _("Thursday"); - wdays[5] = _("Friday"); - wdays[6] = _("Saturday"); - - months[0] = _("January"); - months[1] = _("February"); - months[2] = _("March"); - months[3] = _("April"); - months[4] = _("May"); - months[5] = _("June"); - months[6] = _("July"); - months[7] = _("August"); - months[8] = _("September"); - months[9] = _("October"); - months[10] = _("November"); - months[12] = _("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); } @@ -55,10 +28,10 @@ void output_date(void) { * Dummy section */ void dummy_section(void) { - svprintf("BOXTITLE", WCS_STRING, "(dummy section)"); - do_template("beginbox"); + svput("BOXTITLE", WCS_STRING, "(dummy section)"); + do_template("beginbox", NULL); wprintf(_("(nothing)")); - do_template("endbox"); + do_template("endbox", NULL); } @@ -72,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"); } @@ -126,14 +76,9 @@ void wholist_section(void) { * 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; @@ -149,18 +94,11 @@ void tasks_section(void) { } else { for (i=0; imsgarr[i]); + display_task(WC->msgarr[i], 0); } } 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"); } @@ -168,16 +106,11 @@ void tasks_section(void) { * 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 { @@ -191,17 +124,10 @@ void calendar_section(void) { } else { for (i=0; imsgarr[i]); + display_calendar(WC->msgarr[i], 0); } 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"); } /* @@ -210,58 +136,101 @@ void calendar_section(void) { void server_info_section(void) { 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."), + _("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, - SERVER, + PACKAGE_STRING, + serv_info.serv_svn_revision, serv_info.serv_bbs_city, serv_info.serv_sysadm); escputs(message); - do_template("endbox"); } +/* + * 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. + */ 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 - * 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("
" - ""); + 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("
"); + wprintf(""); } @@ -273,35 +242,54 @@ void summary(void) { output_headers(1, 1, 2, 0, 0, 0); wprintf("
\n"); - wprintf("" - "
" - "" - ); - - snprintf(title, sizeof title, _("Summary page for %s"), WC->wc_username); - escputs(title); - wprintf("\n"); - wprintf(""); - output_date(); - wprintf("
"); - offer_start_page(); - 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, CTX_NONE); + 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
\n"); + wprintf("
\n"); summary_inner_div(); wprintf("
\n"); wprintf( - " \n" + " \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); +} +