* Restored the '(none)' and '(nothing)' displays in the summary screen when the Tasks...
authorArt Cancro <ajc@citadel.org>
Thu, 29 Jan 2009 04:33:50 +0000 (04:33 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 29 Jan 2009 04:33:50 +0000 (04:33 +0000)
webcit/calendar_view.c
webcit/summary.c
webcit/webcit.h

index 323016ff39ab5ddb9dc6cebb08faa6719b17e270..bd882d066a4bd6166d48ff50a864cca709837dc1 100644 (file)
@@ -1241,9 +1241,9 @@ void calendar_day_view(int year, int month, int day) {
 
 
 /*
- * Display today's events.
+ * Display today's events.  Returns the number of items displayed.
  */
-void calendar_summary_view(void) {
+int calendar_summary_view(void) {
        long hklen;
        const char *HashKey;
        void *vCal;
@@ -1258,9 +1258,10 @@ void calendar_summary_view(void) {
        int all_day_event = 0;
        char timestring[SIZ];
        wcsession *WCC = WC;
+       int num_displayed = 0;
 
        if (GetCount(WC->disp_cal_items) == 0) {
-               return;
+               return(0);
        }
 
        now = time(NULL);
@@ -1328,12 +1329,14 @@ void calendar_summary_view(void) {
                                                wprintf(" (%s)", timestring);
                                        }
                                        wprintf("</a><br />\n");
+                                       ++num_displayed;
                                }
                        }
                }
        }
        DeleteHashPos(&Pos);
        DeleteHash(&WC->disp_cal_items);
+       return(num_displayed);
 }
 
 /*
index cb9ef3b5c24ca1538f08bc10c5dda456b9f464b0..7f3db02f51b68b1b822a8c07715bf24e43f83373 100644 (file)
@@ -95,12 +95,7 @@ void tasks_section(void) {
                num_msgs = load_msg_ptrs("MSGS ALL", 0);
        }
 
-       if (num_msgs < 1) {
-               wprintf("<i>");
-               wprintf(_("(None)"));
-               wprintf("</i><br />\n");
-       }
-       else {
+       if (num_msgs > 0) {
                at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
@@ -108,7 +103,11 @@ void tasks_section(void) {
                }
        }
 
-       calendar_summary_view();
+       if (calendar_summary_view() < 1) {
+               wprintf("<i>");
+               wprintf(_("(None)"));
+               wprintf("</i><br />\n");
+       }
 }
 
 
@@ -138,18 +137,17 @@ void calendar_section(void) {
 
        parse_calendar_view_request(&c);
 
-       if (num_msgs < 1) {
-               wprintf("<i>");
-               wprintf(_("(Nothing)"));
-               wprintf("</i><br />\n");
-       }
-       else {
+       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_summary_view();
+       }
+       if (calendar_summary_view() < 1) {
+               wprintf("<i>");
+               wprintf(_("(Nothing)"));
+               wprintf("</i><br />\n");
        }
 }
 
index 545089bad1373dc80cd257db1175b4efdf8b9d8a..5b2aa23ce95835f6d7640685a0332c8cff44b162 100644 (file)
@@ -659,7 +659,7 @@ void updatenote(void);
 void parse_calendar_view_request(struct calview *c);
 void render_calendar_view(struct calview *c);
 void do_tasks_view(void);
-void calendar_summary_view(void);
+int calendar_summary_view(void);
 void free_march_list(wcsession *wcf);
 void display_rules_editor_inner_div(void);
 void generate_uuid(char *);