]> code.citadel.org Git - citadel.git/blobdiff - webcit/summary.c
* split tasks view into its own file
[citadel.git] / webcit / summary.c
index 6f03c42d8471de47b0e86bcbc427a83218a90ba9..fb34a85837a4fa08f84fd1a6c091933ceb891750 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include "webcit.h"
+#include "calendar.h"
 
 /*
  * Display today's date in a friendly format
@@ -29,7 +30,7 @@ void output_date(void) {
  */
 void dummy_section(void) {
        svput("BOXTITLE", WCS_STRING, "(dummy section)");
-       do_template("beginbox", NULL);
+       do_template("beginboxx", NULL);
        wprintf(_("(nothing)"));
        do_template("endbox", NULL);
 }
@@ -82,30 +83,35 @@ void tasks_section(void) {
        long HKLen;
        void *vMsg;
        message_summary *Msg;
-       struct wcsession *WCC = WC;
-
-       gotoroom("_TASKS_");
+       wcsession *WCC = WC;
+       StrBuf *Buf;
+       SharedMessageStatus Stat;
+
+       memset(&Stat, 0, sizeof(SharedMessageStatus));
+       Buf = NewStrBufPlain(HKEY("_TASKS_"));
+       gotoroom(Buf);
+       FreeStrBuf(&Buf);
        if (WCC->wc_view != VIEW_TASKS) {
                num_msgs = 0;
        }
        else {
-               num_msgs = load_msg_ptrs("MSGS ALL", 0);
+               num_msgs = load_msg_ptrs("MSGS ALL", &Stat);
        }
 
-       if (num_msgs < 1) {
-               wprintf("<i>");
-               wprintf(_("(None)"));
-               wprintf("</i><br />\n");
-       }
-       else {
-               at = GetNewHashPos();
+       if (num_msgs > 0) {
+               at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
-                       display_task(Msg, 0);
+                       tasks_LoadMsgFromServer(NULL, NULL, Msg, 0, 0);
                }
+               DeleteHashPos(&at);
        }
 
-       calendar_summary_view();
+       if (calendar_summary_view() < 1) {
+               wprintf("<i>");
+               wprintf(_("(None)"));
+               wprintf("</i><br />\n");
+       }
 }
 
 
@@ -113,37 +119,47 @@ void tasks_section(void) {
  * Calendar section
  */
 void calendar_section(void) {
+       char cmd[SIZ];
        int num_msgs = 0;
        HashPos *at;
        const char *HashKey;
        long HKLen;
        void *vMsg;
        message_summary *Msg;
-       struct wcsession *WCC = WC;
-       struct calview c;
-
-       gotoroom("_CALENDAR_");
+       wcsession *WCC = WC;
+       calview c;
+       StrBuf *Buf;
+       void *v = &c;
+       SharedMessageStatus Stat;
+
+       memset(&Stat, 0, sizeof(SharedMessageStatus));
+       Buf = NewStrBufPlain(HKEY("_CALENDAR_"));
+       gotoroom(Buf);
+       FreeStrBuf(&Buf);
        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", &Stat);
        }
-
-       parse_calendar_view_request(&c);
-
-       if (num_msgs < 1) {
-               wprintf("<i>");
-               wprintf(_("(Nothing)"));
-               wprintf("</i><br />\n");
-       }
-       else {
-               at = GetNewHashPos();
+       calendar_GetParamsGetServerCall(&Stat, 
+                                       &c,
+                                       readnew, 
+                                       cmd, 
+                                       sizeof(cmd));
+
+       if (num_msgs > 0) {
+               at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
-                       load_calendar_item(Msg, 0, &c);
+                       calendar_LoadMsgFromServer(NULL, &v, Msg, 0, 0);
                }
-               calendar_summary_view();
+               DeleteHashPos(&at);
+       }
+       if (calendar_summary_view() < 1) {
+               wprintf("<i>");
+               wprintf(_("(Nothing)"));
+               wprintf("</i><br />\n");
        }
 }
 
@@ -152,15 +168,16 @@ void calendar_section(void) {
  */
 void server_info_section(void) {
        char message[512];
+       wcsession *WCC = WC;
 
        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);
+                ChrPtr(WCC->serv_info->serv_humannode),
+                ChrPtr(WCC->serv_info->serv_software),
+                PACKAGE_STRING,
+                ChrPtr(WCC->serv_info->serv_svn_revision),
+                ChrPtr(WCC->serv_info->serv_bbs_city),
+                ChrPtr(WCC->serv_info->serv_sysadm));
        escputs(message);
 }
 
@@ -262,16 +279,18 @@ void summary(void) {
        wprintf("<div class=\"room_banner\">");
         wprintf("<img src=\"static/summscreen_48x.gif\">");
         wprintf("<h1>");
-        snprintf(title, sizeof title, _("Summary page for %s"), WC->wc_fullname);
+        snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname));
         escputs(title);
         wprintf("</h1><h2>");
         output_date();
         wprintf("</h2></div>");
+       wprintf("<div id=\"actiondiv\">");
        wprintf("<ul class=\"room_actions\">\n");
        wprintf("<li class=\"start_page\">");
-       offer_start_page(NULL, 0, NULL, NULL, CTX_NONE);
+       offer_start_page(NULL, &NoCtx);
         wprintf("</li></ul>");
         wprintf("</div>");
+        wprintf("</div>");
 
        /*
         * You guessed it ... we're going to refresh using ajax.