]> code.citadel.org Git - citadel.git/commitdiff
commit
authorArt Cancro <ajc@citadel.org>
Tue, 25 Oct 2005 03:18:43 +0000 (03:18 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 25 Oct 2005 03:18:43 +0000 (03:18 +0000)
webcit/calendar_view.c
webcit/preferences.c
webcit/webcit.h

index cd898dbae1b6c450c0ba212867ece57b313667cf..64283d3512b083d0efdd573a9866718f0ad75780 100644 (file)
@@ -306,8 +306,16 @@ void calendar_day_view(int year, int month, int day) {
        int hour;
        struct icaltimetype today, yesterday, tomorrow;
        char calhourformat[16];
+       int daystart = 8;
+       int dayend = 17;
+       char daystart_str[16], dayend_str[16];
 
        get_preference("calhourformat", calhourformat, sizeof calhourformat);
+       get_preference("daystart", daystart_str, sizeof daystart_str);
+       if (strlen(daystart_str) > 0) daystart = atoi(daystart_str);
+       get_preference("dayend", dayend_str, sizeof dayend_str);
+       if (strlen(dayend_str) > 0) dayend = atoi(dayend_str);
+       
 
        /* Figure out the dates for "yesterday" and "tomorrow" links */
 
@@ -344,13 +352,13 @@ void calendar_day_view(int year, int month, int day) {
        wprintf("<TR>"
                "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
                "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
-       for (hour = (-1); hour <= 7; ++hour) {
+       for (hour = (-1); hour <= (daystart-1); ++hour) {
                calendar_day_view_display_events(year, month, day, hour);
        }
        wprintf("</TD></TR>\n");
 
        /* Now the middle of the day... */      
-       for (hour = 8; hour <= 17; ++hour) {    /* could do HEIGHT=xx */
+       for (hour = daystart; hour <= dayend; ++hour) { /* could do HEIGHT=xx */
                wprintf("<TR HEIGHT=30><TD BGCOLOR=\"#CCCCDD\" ALIGN=MIDDLE "
                        "VALIGN=MIDDLE WIDTH=10%%>");
                wprintf("<A HREF=\"/display_edit_event?msgnum=0"
@@ -380,7 +388,7 @@ void calendar_day_view(int year, int month, int day) {
        wprintf("<TR>"
                "<TD BGCOLOR=\"#CCCCDD\" VALIGN=MIDDLE WIDTH=10%%></TD>"
                "<TD BGCOLOR=\"#FFFFFF\" VALIGN=TOP>");
-       for (hour = 18; hour <= 23; ++hour) {
+       for (hour = (dayend+1); hour <= 23; ++hour) {
                calendar_day_view_display_events(year, month, day, hour);
        }
        wprintf("</TD></TR>\n");
index e832a772c5e4bd0a0bcf3e8c752a6f2061e35306..42eb04f96e13bbfc99aff5815ce71215530cba87 100644 (file)
@@ -176,6 +176,8 @@ void display_preferences(void)
        output_headers(1, 1, 2, 0, 0, 0);
        char ebuf[300];
        char buf[256];
+       char calhourformat[16];
+       int i;
 
        wprintf("<div id=\"banner\">\n");
        wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>");
@@ -222,26 +224,84 @@ void display_preferences(void)
        /*
         * Calendar hour format
         */
-       get_preference("calhourformat", buf, sizeof buf);
-       if (buf[0] == 0) strcpy(buf, "12");
+       get_preference("calhourformat", calhourformat, sizeof calhourformat);
+       if (calhourformat[0] == 0) strcpy(calhourformat, "12");
        wprintf("<tr><td>");
        wprintf(_("Calendar hour format"));
        wprintf("</td><td>");
 
        wprintf("<input type=\"radio\" name=\"calhourformat\" VALUE=\"12\"");
-       if (!strcasecmp(buf, "12")) wprintf(" checked");
+       if (!strcasecmp(calhourformat, "12")) wprintf(" checked");
        wprintf(">");
        wprintf(_("12 hour (am/pm)"));
        wprintf("<br></input>\n");
 
        wprintf("<input type=\"radio\" name=\"calhourformat\" VALUE=\"24\"");
-       if (!strcasecmp(buf, "24")) wprintf(" checked");
+       if (!strcasecmp(calhourformat, "24")) wprintf(" checked");
        wprintf(">");
        wprintf(_("24 hour"));
        wprintf("<br></input>\n");
 
        wprintf("</td></tr>\n");
 
+       /*
+        * Calendar day view -- day start time
+        */
+       get_preference("daystart", buf, sizeof buf);
+       if (buf[0] == 0) strcpy(buf, "8");
+       wprintf("<tr><td>");
+       wprintf(_("Calendar day view begins at:"));
+       wprintf("</td><td>");
+
+       wprintf("<SELECT NAME=\"daystart\" SIZE=\"1\">\n");
+       for (i=0; i<=23; ++i) {
+
+               if (!strcasecmp(calhourformat, "24")) {
+                       wprintf("<OPTION %s VALUE=\"%d\">%d:00</OPTION>\n",
+                               ((atoi(buf) == i) ? "SELECTED" : ""),
+                               i, i
+                       );
+               }
+               else {
+                       wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
+                               ((atoi(buf) == i) ? "SELECTED" : ""),
+                               i, hourname[i]
+                       );
+               }
+
+       }
+       wprintf("</SELECT>\n");
+       wprintf("</td></tr>\n");
+
+       /*
+        * Calendar day view -- day end time
+        */
+       get_preference("dayend", buf, sizeof buf);
+       if (buf[0] == 0) strcpy(buf, "17");
+       wprintf("<tr><td>");
+       wprintf(_("Calendar day view ends at:"));
+       wprintf("</td><td>");
+
+       wprintf("<SELECT NAME=\"dayend\" SIZE=\"1\">\n");
+       for (i=0; i<=23; ++i) {
+
+               if (!strcasecmp(calhourformat, "24")) {
+                       wprintf("<OPTION %s VALUE=\"%d\">%d:00</OPTION>\n",
+                               ((atoi(buf) == i) ? "SELECTED" : ""),
+                               i, i
+                       );
+               }
+               else {
+                       wprintf("<OPTION %s VALUE=\"%d\">%s</OPTION>\n",
+                               ((atoi(buf) == i) ? "SELECTED" : ""),
+                               i, hourname[i]
+                       );
+               }
+
+       }
+       wprintf("</SELECT>\n");
+       wprintf("</td></tr>\n");
+
        /*
         * Signature
         */
@@ -331,6 +391,8 @@ void set_preferences(void)
        set_preference("roomlistview", bstr("roomlistview"), 0);
        set_preference("calhourformat", bstr("calhourformat"), 0);
        set_preference("use_sig", bstr("use_sig"), 0);
+       set_preference("daystart", bstr("daystart"), 0);
+       set_preference("dayend", bstr("dayend"), 0);
 
        euid_escapize(ebuf, bstr("signature"));
        set_preference("signature", ebuf, 1);
index 6d34fd96883561e7770c0f401a68f8537fec9180..5e4732b99008b151e9e73f868c1dfa26d12ca273 100644 (file)
@@ -594,6 +594,7 @@ void begin_burst(void);
 void end_burst(void);
 
 extern char *ascmonths[];
+extern char *hourname[];
 void http_datestring(char *buf, size_t n, time_t xtime);
 
 /* Views (from citadel.h) */