Finalize vcard editing:
[citadel.git] / webcit / tabs.c
index 2adaaec9a45c3114fd82fdf9999cd2e141a29c23..90dac77b0be8c8e7e5e614e2f57163510adc649d 100644 (file)
@@ -1,7 +1,3 @@
-/*
- * $Id$
- *
- */
 #include <stdarg.h>
 #define SHOW_ME_VAPPEND_PRINTF
 #include "webcit.h"
@@ -86,13 +82,6 @@ void end_tab(int tabnum, int num_tabs) {
        else {
                wc_printf("</div>\n");
                wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
-       
-               if (tabnum == num_tabs-1) {
-                       wc_printf("<script type=\"text/javascript\">"
-                               " Nifty(\"table#TheTabs td\", \"small transparent top\");"
-                               "</script>"
-                       );
-               }
        }
 }
 
@@ -158,22 +147,31 @@ void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) {
  * num_tabs:    total number oftabs to be printed
  *
  */
-void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs) {
+void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names) {
 
        if (tabnum == num_tabs) {
                StrBufAppendBufPlain(
                        Target, 
-                       HKEY(
-                               "<!-- begin tab-common epilogue -->\n"
-                               "<div class=\"tabcontent_submit\">"), 0);
+                       HKEY("<!-- begin tab-common epilogue ["), 0);
+               StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
+               StrBufAppendBufPlain(
+                       Target, 
+                       HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
        }
 
        else {
+               StrBufAppendBufPlain(
+                       Target, 
+                       HKEY("<!-- begin tab "), 0);
+               StrBufAppendPrintf(
+                       Target,  "%d of %d [",
+                       tabnum, num_tabs);
+               
+               StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
+
                StrBufAppendPrintf(
                        Target, 
-                       "<!-- begin tab %d of %d -->\n"
-                       "<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
-                       tabnum, num_tabs, 
+                       "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
                        tabnum,
                        ( (tabnum == 0) ? "block" : "none" )
                        );
@@ -200,16 +198,12 @@ void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) {
                StrBufAppendPrintf(
                        Target, 
                        "</div>\n",
-                       "<!-- end tab %d of %d -->\n", tabnum, num_tabs);
-       
-               if (tabnum == num_tabs-1) {
-                       StrBufAppendBufPlain(
-                               Target, 
-                               HKEY(
-                                       "<script type=\"text/javascript\">"
-                                       " Nifty(\"table#TheTabs td\", \"small transparent top\");"
-                                       "</script>"), 0);
-               }
+                       "<!-- end tab %d of %d -->\n", tabnum, num_tabs
+               );
+       }
+       if (havebstr("last_tabsel"))
+       {
+               StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));
        }
 }