2 #define SHOW_ME_VAPPEND_PRINTF
8 void tabbed_dialog(int num_tabs, char *tabnames[]) {
11 StrBufAppendPrintf(WC->trailing_javascript,
12 "var previously_selected_tab = '0'; \n"
13 "function tabsel(which_tab) { \n"
14 " if (which_tab == previously_selected_tab) { \n"
17 " $('tabdiv'+previously_selected_tab).style.display = 'none'; \n"
18 " $('tabdiv'+which_tab).style.display = 'block'; \n"
19 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; \n"
20 " $('tabtd'+which_tab).className = 'tab_cell_label'; \n"
21 " previously_selected_tab = which_tab; \n"
25 wc_printf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
26 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
29 for (i=0; i<num_tabs; ++i) {
30 wc_printf("<td id=\"tabtd%d\" class=\"%s\" "
31 "onClick='tabsel(\"%d\");'"
34 ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
37 wc_printf("%s", tabnames[i]);
40 wc_printf("<td> </td>\n");
43 wc_printf("</tr></table>\n");
47 * print the tab-header
49 * tabnum: number of the tab to print
50 * num_tabs: total number oftabs to be printed
53 void begin_tab(int tabnum, int num_tabs) {
55 if (tabnum == num_tabs) {
56 wc_printf("<!-- begin tab-common epilogue -->\n");
57 wc_printf("<div class=\"tabcontent_submit\">");
61 wc_printf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
62 wc_printf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
64 ( (tabnum == 0) ? "block" : "none" )
70 * print the tab-footer
71 * tabnum: number of the tab to print
72 * num_tabs: total number of tabs to be printed
75 void end_tab(int tabnum, int num_tabs) {
77 if (tabnum == num_tabs) {
78 wc_printf("</div> <!-- end of 'tabcontent_submit' div -->\n");
79 wc_printf("<!-- end tab-common epilogue -->\n");
83 wc_printf("</div>\n");
84 wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
86 if (tabnum == num_tabs-1) {
87 wc_printf("<script type=\"text/javascript\">"
88 " Nifty(\"table#TheTabs td\", \"small transparent top\");"
99 void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) {
102 StrBufAppendBufPlain(
105 "<script type=\"text/javascript\"> "
106 "var previously_selected_tab = '0'; "
107 "function tabsel(which_tab) { "
108 " if (which_tab == previously_selected_tab) { "
111 " $('tabdiv'+previously_selected_tab).style.display = 'none'; "
112 " $('tabdiv'+which_tab).style.display = 'block'; "
113 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; "
114 " $('tabtd'+which_tab).className = 'tab_cell_label'; "
115 " previously_selected_tab = which_tab; "
120 StrBufAppendBufPlain(
123 "<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
124 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
127 for (i=0; i<num_tabs; ++i) {
130 "<td id=\"tabtd%d\" class=\"%s\" "
131 "onClick='tabsel(\"%d\");'"
134 ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
137 StrBufAppendBuf(Target, tabnames[i], 0);
138 StrBufAppendBufPlain(
142 "<td> </td>\n"), 0);
145 StrBufAppendBufPlain(
147 HKEY("</tr></table>\n"), 0);
151 * print the tab-header
153 * tabnum: number of the tab to print
154 * num_tabs: total number oftabs to be printed
157 void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names) {
159 if (tabnum == num_tabs) {
160 StrBufAppendBufPlain(
162 HKEY("<!-- begin tab-common epilogue ["), 0);
163 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
164 StrBufAppendBufPlain(
166 HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
170 StrBufAppendBufPlain(
172 HKEY("<!-- begin tab "), 0);
174 Target, "%d of %d [",
177 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
181 "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
183 ( (tabnum == 0) ? "block" : "none" )
189 * print the tab-footer
190 * tabnum: number of the tab to print
191 * num_tabs: total number of tabs to be printed
194 void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) {
196 if (tabnum == num_tabs) {
197 StrBufAppendBufPlain(
201 "<!-- end tab-common epilogue -->\n"), 0);
208 "<!-- end tab %d of %d -->\n", tabnum, num_tabs);
210 if (tabnum == num_tabs-1) {
211 StrBufAppendBufPlain(
214 "<script type=\"text/javascript\">"
215 " Nifty(\"table#TheTabs td\", \"small transparent top\");"
219 if (HAVEBSTR("last_tabsel"))
221 StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));