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);
92 void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) {
98 "<script type=\"text/javascript\"> "
99 "var previously_selected_tab = '0'; "
100 "function tabsel(which_tab) { "
101 " if (which_tab == previously_selected_tab) { "
104 " $('tabdiv'+previously_selected_tab).style.display = 'none'; "
105 " $('tabdiv'+which_tab).style.display = 'block'; "
106 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; "
107 " $('tabtd'+which_tab).className = 'tab_cell_label'; "
108 " previously_selected_tab = which_tab; "
113 StrBufAppendBufPlain(
116 "<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
117 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
120 for (i=0; i<num_tabs; ++i) {
123 "<td id=\"tabtd%d\" class=\"%s\" "
124 "onClick='tabsel(\"%d\");'"
127 ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
130 StrBufAppendBuf(Target, tabnames[i], 0);
131 StrBufAppendBufPlain(
135 "<td> </td>\n"), 0);
138 StrBufAppendBufPlain(
140 HKEY("</tr></table>\n"), 0);
144 * print the tab-header
146 * tabnum: number of the tab to print
147 * num_tabs: total number oftabs to be printed
150 void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names) {
152 if (tabnum == num_tabs) {
153 StrBufAppendBufPlain(
155 HKEY("<!-- begin tab-common epilogue ["), 0);
156 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
157 StrBufAppendBufPlain(
159 HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
163 StrBufAppendBufPlain(
165 HKEY("<!-- begin tab "), 0);
167 Target, "%d of %d [",
170 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
174 "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
176 ( (tabnum == 0) ? "block" : "none" )
182 * print the tab-footer
183 * tabnum: number of the tab to print
184 * num_tabs: total number of tabs to be printed
187 void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) {
189 if (tabnum == num_tabs) {
190 StrBufAppendBufPlain(
194 "<!-- end tab-common epilogue -->\n"), 0);
201 "<!-- end tab %d of %d -->\n", tabnum, num_tabs
204 if (HAVEBSTR("last_tabsel"))
206 StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));