New tabbed dialog API. This will be used in something later...
authorArt Cancro <ajc@citadel.org>
Fri, 6 Jan 2006 04:18:13 +0000 (04:18 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 6 Jan 2006 04:18:13 +0000 (04:18 +0000)
webcit/ChangeLog
webcit/Makefile.in
webcit/tabs.c [new file with mode: 0644]
webcit/webcit.h

index f88b0e71854a9ab678df71e0d26e5757734603e0..48f0cd7e34b6f1c3a866eb0737c6328b363f06ef 100644 (file)
@@ -1,5 +1,8 @@
 $Id$
 
+Thu Jan  5 23:17:17 EST 2006 ajc
+* New tabbed dialog API.  This will be used in something later...
+
 Tue Jan  3 18:19:53 EST 2006 ajc
 * More tweaks to instant messenger window
 
index 917950e2a4b9adfc0a0c4a7d864a00204e653859..ea2d67378f17c97afc341d33a96819e27afff106 100644 (file)
@@ -48,7 +48,7 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.o \
        calendar.o calendar_tools.o calendar_view.o event.o \
        availability.o iconbar.o crypto.o inetconf.o notes.o \
        groupdav_main.o groupdav_get.o groupdav_propfind.o fmt_date.o \
-       groupdav_options.o autocompletion.o gettext.o\
+       groupdav_options.o autocompletion.o gettext.o tabs.o \
        groupdav_delete.o groupdav_put.o http_datestring.o setup_wizard.o \
        $(LIBOBJS)
        $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
@@ -59,7 +59,7 @@ webserver: webserver.o context_loop.o tools.o ical_dezonify.o \
        summary.o calendar.o calendar_tools.o calendar_view.o event.o \
        availability.o ical_dezonify.o iconbar.o crypto.o inetconf.o notes.o \
        groupdav_main.o groupdav_get.o groupdav_propfind.o groupdav_delete.o \
-       groupdav_options.o autocompletion.o \
+       groupdav_options.o autocompletion.o tabs.o \
        groupdav_put.o http_datestring.o setup_wizard.o fmt_date.o \
        gettext.o \
        $(LIBOBJS) $(LIBS) $(LDFLAGS) -o webserver
diff --git a/webcit/tabs.c b/webcit/tabs.c
new file mode 100644 (file)
index 0000000..92e88ef
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * $Id:  $
+ *
+ * Utility functions for creating tabbed dialogs
+ */
+
+#include "webcit.h"
+
+void tabbed_dialog(int num_tabs, char *tabnames[]) {
+       int i;
+
+       wprintf("<script type=\"text/javascript\">                                              "
+               "var previously_selected_tab = '0';                                             "
+               "function tabsel(which_tab) {                                                   "
+               "       if (which_tab == previously_selected_tab) {                             "
+               "               return;                                                         "
+               "       }                                                                       "
+               "       $('tabtd'+previously_selected_tab).style.backgroundColor = '#cccccc';   "
+               "       $('tabdiv'+previously_selected_tab).style.display = 'none';             "
+               "       $('tabtd'+which_tab).style.backgroundColor = '#ffffff';                 "
+               "       $('tabdiv'+which_tab).style.display = 'block';                          "
+               "       previously_selected_tab = which_tab;                                    "
+               "}                                                                              "
+               "</script>                                                                      \n"
+       );
+
+       wprintf("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\">"
+               "<tr align=\"center\" style=\"cursor:pointer\"><td>&nbsp;</td>"
+       );
+
+       for (i=0; i<num_tabs; ++i) {
+               wprintf("<td id=\"tabtd%d\" bgcolor=\"#%s\" onClick='tabsel(\"%d\");'>"
+                       "<span class=\"tablabel\">",
+                       i,
+                       ( (i==0) ? "ffffff" : "cccccc" ),
+                       i
+               );
+               wprintf("%s", tabnames[i]);
+               wprintf("</td>");
+
+               wprintf("<td>&nbsp;</td>\n");
+       }
+
+       wprintf("</tr></table>\n");
+       wprintf("<table border=\"0\" width=\"100%%\" bgcolor=\"#ffffff\"><tr><td>");
+}
+
+void begin_tab(int tabnum, int num_tabs) {
+       wprintf("<div id=\"tabdiv%d\" style=\"display:%s\">",
+               tabnum,
+               ( (tabnum == 0) ? "block" : "none" )
+       );
+}
+
+void end_tab(int tabnum, int num_tabs) {
+       wprintf("</div>\n");
+
+       if (tabnum == num_tabs-1) {
+               wprintf("</td></tr></table>\n");
+       }
+}
index 4ed7997d6534e9406924fa48769d867a2e6367be..a87133da3ed1e65036c488e680c9864c4b6be5e7 100644 (file)
@@ -654,8 +654,12 @@ void set_selected_language(char *);
 void go_selected_language(void);
 void stop_selected_language(void);
 void httplang_to_locale(char *LocaleString);
+void tabbed_dialog(int num_tabs, char *tabnames[]);
+void begin_tab(int tabnum, int num_tabs);
+void end_tab(int tabnum, int num_tabs);
 
 void embed_room_banner(char *, int);
+
 /* navbar types that can be passed to embed_room_banner */
 enum {
        navbar_none,