2 #define SHOW_ME_VAPPEND_PRINTF
8 void tabbed_dialog(int num_tabs, const 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"
24 wc_printf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
25 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>");
27 for (i = 0; i < num_tabs; ++i) {
28 wc_printf("<td id=\"tabtd%d\" class=\"%s\" "
29 "onClick='tabsel(\"%d\");'" ">", i, ((i == 0) ? "tab_cell_label" : "tab_cell_edit"), i);
30 wc_printf("%s", tabnames[i]);
33 wc_printf("<td> </td>\n");
36 wc_printf("</tr></table>\n");
40 * print the tab-header
42 * tabnum: number of the tab to print
43 * num_tabs: total number oftabs to be printed
46 void begin_tab(int tabnum, int num_tabs) {
48 if (tabnum == num_tabs) {
49 wc_printf("<!-- begin tab-common epilogue -->\n");
50 wc_printf("<div class=\"tabcontent_submit\">");
54 wc_printf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
55 wc_printf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
56 tabnum, ((tabnum == 0) ? "block" : "none")
62 * print the tab-footer
63 * tabnum: number of the tab to print
64 * num_tabs: total number of tabs to be printed
67 void end_tab(int tabnum, int num_tabs) {
69 if (tabnum == num_tabs) {
70 wc_printf("</div> <!-- end of 'tabcontent_submit' div -->\n");
71 wc_printf("<!-- end tab-common epilogue -->\n");
75 wc_printf("</div>\n");
76 wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
84 void StrTabbedDialog(StrBuf * Target, int num_tabs, StrBuf * tabnames[]) {
87 StrBufAppendBufPlain(Target,
88 HKEY("<script type=\"text/javascript\"> "
89 "var previously_selected_tab = '0'; "
90 "function tabsel(which_tab) { "
91 " if (which_tab == previously_selected_tab) { "
94 " $('tabdiv'+previously_selected_tab).style.display = 'none'; "
95 " $('tabdiv'+which_tab).style.display = 'block'; "
96 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; "
97 " $('tabtd'+which_tab).className = 'tab_cell_label'; "
98 " previously_selected_tab = which_tab; "
102 StrBufAppendBufPlain(Target,
103 HKEY("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
104 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"), 0);
106 for (i = 0; i < num_tabs; ++i) {
107 StrBufAppendPrintf(Target,
108 "<td id=\"tabtd%d\" class=\"%s\" "
109 "onClick='tabsel(\"%d\");'" ">", i, ((i == 0) ? "tab_cell_label" : "tab_cell_edit"), i);
110 StrEscAppend(Target, tabnames[i], NULL, 0, 0);
111 StrBufAppendBufPlain(Target, HKEY("</td>" "<td> </td>\n"), 0);
114 StrBufAppendBufPlain(Target, HKEY("</tr></table>\n"), 0);
118 * print the tab-header
120 * tabnum: number of the tab to print
121 * num_tabs: total number oftabs to be printed
124 void StrBeginTab(StrBuf * Target, int tabnum, int num_tabs, StrBuf ** Names) {
126 if (tabnum == num_tabs) {
127 StrBufAppendBufPlain(Target, HKEY("<!-- begin tab-common epilogue ["), 0);
128 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
129 StrBufAppendBufPlain(Target, HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
133 StrBufAppendBufPlain(Target, HKEY("<!-- begin tab "), 0);
134 StrBufAppendPrintf(Target, "%d of %d [", tabnum, num_tabs);
136 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
138 StrBufAppendPrintf(Target,
139 "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
140 tabnum, ((tabnum == 0) ? "block" : "none")
146 * print the tab-footer
147 * tabnum: number of the tab to print
148 * num_tabs: total number of tabs to be printed
151 void StrEndTab(StrBuf * Target, int tabnum, int num_tabs) {
153 if (tabnum == num_tabs) {
154 StrBufAppendBufPlain(Target, HKEY("</div>\n" "<!-- end tab-common epilogue -->\n"), 0);
158 StrBufAppendPrintf(Target, "</div>\n", "<!-- end tab %d of %d -->\n", tabnum, num_tabs);
160 if (havebstr("last_tabsel")) {
161 StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));