Changed the tabbed dialog API to include an epilogue that
authorArt Cancro <ajc@citadel.org>
Wed, 20 Aug 2008 17:46:33 +0000 (17:46 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 20 Aug 2008 17:46:33 +0000 (17:46 +0000)
can be used to display data common to all tabs, such as submit buttons.
Removed recurring event support from TECH_PREVIEW and moved into the mainline
code.  Event editor tabs for Event/Attendees/Recurrence are now working, even
though the Recurrence tab doesn't yet display an editor, for now it just
displays the raw RRULE data.

webcit/event.c
webcit/messages.c
webcit/siteconfig.c
webcit/static/t/trailing.html
webcit/static/webcit.css
webcit/tabs.c

index 05d08400a9fffec1483911b1a77f38337d41c533..cb6b75ddab22d92d68c649d925a3223737f634c8 100644 (file)
@@ -79,9 +79,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<div class=\"fix_scrollbar_bug\">");
-#ifndef TECH_PREVIEW
-       wprintf("<table  class=\"event_background\"><tr><td>\n");
-#endif
 
        /************************************************************
         * Uncomment this to see the UID in calendar events for debugging
@@ -108,16 +105,14 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        wprintf("<INPUT TYPE=\"hidden\" NAME=\"day\" VALUE=\"%s\">\n",
                bstr("day"));
 
-#ifdef TECH_PREVIEW
-       char *tabnames[] = {            // FIXME localize these when the code is finished
-               "Event",
-               "Attendees",
-               "Recurrence"
+       char *tabnames[] = {
+               _("Event"),
+               _("Attendees"),
+               _("Recurrence")
        };
 
        tabbed_dialog(3, tabnames);
        begin_tab(0, 3);
-#endif
 
        /* Put it in a borderless table so it lines up nicely */
        wprintf("<TABLE border=0 width=100%%>\n");
@@ -193,7 +188,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        wprintf("</TD></TR>\n");
 
-       /**
+       /*
         * If this is an all-day-event, set the end time to be identical to
         * the start time (the hour/minute/second will be set to midnight).
         * Otherwise extract or create it.
@@ -211,7 +206,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                        t_end = icalproperty_get_dtend(p);
                }
                else {
-                       /**
+                       /*
                         * If this is not an all-day event and there is no
                         * end time specified, make the default one hour
                         * from the start time.
@@ -325,7 +320,15 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
 
        wprintf("</TD></TR>\n");
 
-       /** Attendees */
+
+       /** Done with properties. */
+       wprintf("</TABLE>\n");
+
+       end_tab(0, 3);
+
+       /* Attendees tab (need to move things here) */
+       begin_tab(1, 3);
+       wprintf("<TABLE border=0 width=100%%>\n");      /* same table style as the event tab */
        wprintf("<TR><TD><B>");
        wprintf(_("Attendees"));
        wprintf("</B><br />"
@@ -342,7 +345,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                _("Attendees"),
                _("Contacts")
        );
-       /** Pop open an address book -- end **/
+       /* Pop open an address book -- end **/
 
        wprintf("</TD><TD>"
                "<TEXTAREA %s NAME=\"attendees\" id=\"attendees_box\" wrap=soft "
@@ -369,9 +372,24 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                }
        }
        wprintf("</TEXTAREA></TD></TR>\n");
+       wprintf("</TABLE>\n");
+       end_tab(1, 3);
 
-       /** Done with properties. */
-       wprintf("</TABLE>\n<CENTER>"
+       /* Recurrence tab */
+       begin_tab(2, 3);
+       icalproperty *rrule = NULL;
+       struct icalrecurrencetype recur;
+
+       rrule = icalcomponent_get_first_property(vevent, ICAL_RRULE_PROPERTY);
+       if (rrule) {
+               recur = icalproperty_get_rrule(rrule);
+               wprintf("<tt>%s</tt><br />\n", icalrecurrencetype_as_string(&recur));
+       }
+       end_tab(2, 3);
+
+       /* submit buttons (common area beneath the tabs) */
+       begin_tab(3, 3);
+       wprintf("<CENTER>"
                "<INPUT TYPE=\"submit\" NAME=\"save_button\" VALUE=\"%s\">"
                "&nbsp;&nbsp;"
                "<INPUT TYPE=\"submit\" NAME=\"delete_button\" VALUE=\"%s\">\n"
@@ -386,32 +404,8 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
                _("Check attendee availability"),
                _("Cancel")
        );
-
        wprintf("</FORM>\n");
-#ifndef TECH_PREVIEW
-       wprintf("</td></tr></table>");
-#endif
-       
-#ifdef TECH_PREVIEW
-       end_tab(0, 3);
-
-       /* Attendees tab (need to move things here) */
-       begin_tab(1, 3);
-       end_tab(1, 3);
-
-       /* Recurrence tab */
-       begin_tab(2, 3);
-       icalproperty *rrule = NULL;
-       struct icalrecurrencetype recur;
-
-       rrule = icalcomponent_get_first_property(vevent, ICAL_RRULE_PROPERTY);
-       if (rrule) {
-               recur = icalproperty_get_rrule(rrule);
-               wprintf("<tt>%s</tt><br />\n", icalrecurrencetype_as_string(&recur));
-       }
-       end_tab(2, 3);
-
-#endif
+       end_tab(3, 3);
 
        wprintf("</div>\n");
 
@@ -427,10 +421,11 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        }
 }
 
-/**
- * \brief Save an edited event
- * \param supplied_vevent the event to save
- * \param msgnum the index on the citserver
+/*
+ * Save an edited event
+ *
+ * supplied_vevent:    the event to save
+ * msgnum:             the index on the citserver
  */
 void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *from, int unread) {
        char buf[SIZ];
@@ -732,7 +727,7 @@ STARTOVER:  for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE
 
        }
 
-       /**
+       /*
         * If the user clicked 'Delete' then delete it.
         */
        if ( (havebstr("delete_button")) && (msgnum > 0L) ) {
@@ -744,7 +739,7 @@ STARTOVER:  for (attendee = icalcomponent_get_first_property(vevent, ICAL_ATTENDE
                icalcomponent_free(vevent);
        }
 
-       /** If this was a save or delete, go back to the calendar view. */
+       /* If this was a save or delete, go back to the calendar view. */
        if (!havebstr("check_button")) {
                readloop("readfwd");
        }
index 19f29b0451169853c971c138eb74bcb3403092bc..360be933d45a1266973369940d13d703a683331e 100644 (file)
@@ -2126,6 +2126,9 @@ void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
        wprintf("</tr></table>\n");
        end_tab((num_pages-1), num_pages);
 
+       begin_tab(num_pages, num_pages);        /* There are no submit buttons so this is empty */
+       end_tab(num_pages, num_pages);
+
        for (i=0; i<num_pages; ++i) {
                free(tablabels[i]);
        }
@@ -2134,10 +2137,11 @@ void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
 
 
 
-/**
- * \brief load message pointers from the server
- * \param servcmd the citadel command to send to the citserver
- * \param with_headers what headers???
+/*
+ * load message pointers from the server for a "read messages" operation
+ *
+ * servcmd:            the citadel command to send to the citserver
+ * with_headers:       also include some of the headers with the message numbers (more expensive)
  */
 int load_msg_ptrs(char *servcmd, int with_headers)
 {
@@ -2235,11 +2239,9 @@ int load_msg_ptrs(char *servcmd, int with_headers)
 
 
 typedef int (*QSortFunction) (const void*, const void*);
-/**
- * \brief qsort() compatible function to compare two longs in descending order.
- *
- * \param s1 first number to compare 
- * \param s2 second number to compare
+
+/*
+ * qsort() compatible function to compare two longs in descending order.
  */
 int longcmp_r(const void *s1, const void *s2) {
        long l1;
@@ -2254,11 +2256,8 @@ int longcmp_r(const void *s1, const void *s2) {
 }
 
  
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending subject.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending subject.
  */
 int summcmp_subj(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2269,11 +2268,8 @@ int summcmp_subj(const void *s1, const void *s2) {
        return strcasecmp(summ1->subj, summ2->subj);
 }
 
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending subject.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending subject.
  */
 int summcmp_rsubj(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2284,11 +2280,8 @@ int summcmp_rsubj(const void *s1, const void *s2) {
        return strcasecmp(summ2->subj, summ1->subj);
 }
 
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending sender.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending sender.
  */
 int summcmp_sender(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2299,11 +2292,8 @@ int summcmp_sender(const void *s1, const void *s2) {
        return strcasecmp(summ1->from, summ2->from);
 }
 
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending sender.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending sender.
  */
 int summcmp_rsender(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2314,11 +2304,8 @@ int summcmp_rsender(const void *s1, const void *s2) {
        return strcasecmp(summ2->from, summ1->from);
 }
 
-/**
- * \brief qsort() compatible function to compare two message summary structs by ascending date.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by ascending date.
  */
 int summcmp_date(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2332,11 +2319,8 @@ int summcmp_date(const void *s1, const void *s2) {
        else return 0;
 }
 
-/**
- * \brief qsort() compatible function to compare two message summary structs by descending date.
- *
- * \param s1 first item to compare 
- * \param s2 second item to compare
+/*
+ * qsort() compatible function to compare two message summary structs by descending date.
  */
 int summcmp_rdate(const void *s1, const void *s2) {
        struct message_summary *summ1;
@@ -2374,7 +2358,7 @@ const char* SortIcons[3] = {
        eUnSet
 }; 
 
-/** SortEnum to plain string representation */
+/* SortEnum to plain string representation */
 static const char* SortByStrings[] = {
        "date",
        "rdate",
@@ -2386,7 +2370,7 @@ static const char* SortByStrings[] = {
        "unset"
 };
 
-/** SortEnum to sort-Function Table */
+/* SortEnum to sort-Function Table */
 const QSortFunction SortFuncs[eUnSet] = {
        summcmp_date,
        summcmp_rdate,
@@ -2397,21 +2381,20 @@ const QSortFunction SortFuncs[eUnSet] = {
        summcmp_rdate
 };
 
-/** given a SortEnum, which icon should we choose? */
+/* given a SortEnum, which icon should we choose? */
 const int SortDateToIcon[eUnSet] = { eUp, eDown, eNone, eNone, eNone, eNone, eNone};
 const int SortSubjectToIcon[eUnSet] = { eNone, eNone, eUp, eDown, eNone, eNone, eNone};
 const int SortSenderToIcon[eUnSet] = { eNone, eNone, eNone, eNone, eUp, eDown, eNone};
 
-/** given a SortEnum, which would be the "opposite" search option? */
+/* given a SortEnum, which would be the "opposite" search option? */
 const int DateInvertSortString[eUnSet] =  { eRDate, eDate, eDate, eDate, eDate, eDate, eDate};
 const int SubjectInvertSortString[eUnSet] =  { eSubject, eSubject, eRSubject, eUnSet, eSubject, eSubject, eSubject};
 const int SenderInvertSortString[eUnSet] =  { eSender, eSender, eSender, eSender, eRSender, eUnSet, eSender};
 
 
-/**
- * \Brief Translates sortoption String to its SortEnum representation 
- * \param SortBy string to translate
- * \return the enum matching the string; defaults to RDate
+/*
+ * Translates sortoption String to its SortEnum representation 
+ * returns the enum matching the string; defaults to RDate
  */
 //SortByEnum 
 int StrToESort (const StrBuf *sortby)
@@ -2430,10 +2413,10 @@ int StrToESort (const StrBuf *sortby)
 
 
 
-/**
- * \brief command loop for reading messages
+/*
+ * command loop for reading messages
  *
- * \param oper Set to "readnew" or "readold" or "readfwd" or "headers"
+ * Set oper to "readnew" or "readold" or "readfwd" or "headers"
  */
 void readloop(char *oper)
 {
@@ -2487,7 +2470,7 @@ void readloop(char *oper)
        }
 
        SortBy = StrToESort(sortpref_value);
-       /** message board sort */
+       /* message board sort */
        if (SortBy == eReverse) {
                bbs_reverse = 1;
        }
@@ -2497,7 +2480,7 @@ void readloop(char *oper)
 
        output_headers(1, 1, 1, 0, 0, 0);
 
-       /**
+       /*
         * When in summary mode, always show ALL messages instead of just
         * new or old.  Otherwise, show what the user asked for.
         */
@@ -2552,7 +2535,7 @@ void readloop(char *oper)
                SortBy =  eRDate;
        }
 
-       /**
+       /*
         * Are we doing a summary view?  If so, we need to know old messages
         * and new messages, so we can do that pretty boldface thing for the
         * new messages.
index bdcaf0530c1828dcd315d7dd6674a1e14f95e7d0..cce2baebc6e8e4eb3067f0aba998f92ee2351dae 100644 (file)
@@ -772,11 +772,14 @@ void display_siteconfig(void)
        begin_tab(6, 9);        StrBufAppendBufPlain(WCC->WBuf, idxjnl, strlen(idxjnl), 0);              end_tab(6, 9);
        begin_tab(7, 9);        StrBufAppendBufPlain(WCC->WBuf, funambol, strlen(funambol), 0);  end_tab(7, 9);
        begin_tab(8, 9);        StrBufAppendBufPlain(WCC->WBuf, pop3, strlen(pop3), 0);          end_tab(8, 9);
-       wprintf("<div class=\"tabcontent_submit\">");
+
+       begin_tab(9, 9);
        wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
        wprintf("&nbsp;");
        wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">\n", _("Cancel"));
-       wprintf("</div></FORM>\n");
+       end_tab(9, 9);
+
+       wprintf("</FORM>\n");
        wprintf("</td></tr></table>\n");
        wDumpContent(1);
 }
index c23c16a2a30b892843121c359bbc7685926d378b..cf89837663dd507b3262a1fc468ce54edf7d06c2 100644 (file)
@@ -4,8 +4,8 @@
  Rounded("form.box", "big transparent top bottom");
  Rounded("div.boxlabel", "big transparent top");
  Rounded("li.tablabel", "small transparent top");
- Rounded("div.tabcontent", "big transparent bottom");
  Rounded("div.tabcontent_submit", "big transparent bottom");
+ Rounded("div.tabcontent", "big transparent bottom");
 </script>
 </body>
 </html>
index 8f07e72f7572d38f9ea596d6b5e3bb0b0155b189..e88391fbdca2e26cb306d8c31c6e379653e8012c 100644 (file)
@@ -1161,7 +1161,7 @@ ul.tabbed_dialog li {
 
 .tabcontent_submit {
         margin: 0 auto 0 auto;
-        width: 50%;
+        width: 90%;
         padding: 10px;
         text-align: center;
 }
index fd50c31b901c05ec9e33d4149147c3e31912d5aa..569a7f7633e8ea79d912115b0239e90267bfb535 100644 (file)
@@ -55,11 +55,19 @@ void tabbed_dialog(int num_tabs, char *tabnames[]) {
  *
  */
 void begin_tab(int tabnum, int num_tabs) {
-       wprintf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
-       wprintf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
-               tabnum,
-               ( (tabnum == 0) ? "block" : "none" )
-       );
+
+       if (tabnum == num_tabs) {
+               wprintf("<!-- begin tab-common epilogue -->\n");
+               wprintf("<div class=\"tabcontent_submit\">");
+       }
+
+       else {
+               wprintf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
+               wprintf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
+                       tabnum,
+                       ( (tabnum == 0) ? "block" : "none" )
+               );
+       }
 }
 
 /*
@@ -69,16 +77,22 @@ void begin_tab(int tabnum, int num_tabs) {
  *
  */
 void end_tab(int tabnum, int num_tabs) {
-       wprintf("</div>\n");
-       wprintf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
-
-       if (tabnum == num_tabs-1) {
 
-               wprintf("<script type=\"text/javascript\">"
-                       " Nifty(\"table#TheTabs td\", \"small transparent top\");"
-                       "</script>"
-               );
+       if (tabnum == num_tabs) {
+               wprintf("</div>\n");
+               wprintf("<!-- end tab-common epilogue -->\n");
+       }
 
+       else {
+               wprintf("</div>\n");
+               wprintf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
+       
+               if (tabnum == num_tabs-1) {
+                       wprintf("<script type=\"text/javascript\">"
+                               " Nifty(\"table#TheTabs td\", \"small transparent top\");"
+                               "</script>"
+                       );
+               }
        }
 }