6 #define SHOW_ME_VAPPEND_PRINTF
12 void tabbed_dialog(int num_tabs, char *tabnames[]) {
15 StrBufAppendPrintf(WC->trailing_javascript,
16 "var previously_selected_tab = '0'; \n"
17 "function tabsel(which_tab) { \n"
18 " if (which_tab == previously_selected_tab) { \n"
21 " $('tabdiv'+previously_selected_tab).style.display = 'none'; \n"
22 " $('tabdiv'+which_tab).style.display = 'block'; \n"
23 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; \n"
24 " $('tabtd'+which_tab).className = 'tab_cell_label'; \n"
25 " previously_selected_tab = which_tab; \n"
29 wc_printf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
30 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
33 for (i=0; i<num_tabs; ++i) {
34 wc_printf("<td id=\"tabtd%d\" class=\"%s\" "
35 "onClick='tabsel(\"%d\");'"
38 ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
41 wc_printf("%s", tabnames[i]);
44 wc_printf("<td> </td>\n");
47 wc_printf("</tr></table>\n");
51 * print the tab-header
53 * tabnum: number of the tab to print
54 * num_tabs: total number oftabs to be printed
57 void begin_tab(int tabnum, int num_tabs) {
59 if (tabnum == num_tabs) {
60 wc_printf("<!-- begin tab-common epilogue -->\n");
61 wc_printf("<div class=\"tabcontent_submit\">");
65 wc_printf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
66 wc_printf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
68 ( (tabnum == 0) ? "block" : "none" )
74 * print the tab-footer
75 * tabnum: number of the tab to print
76 * num_tabs: total number of tabs to be printed
79 void end_tab(int tabnum, int num_tabs) {
81 if (tabnum == num_tabs) {
82 wc_printf("</div> <!-- end of 'tabcontent_submit' div -->\n");
83 wc_printf("<!-- end tab-common epilogue -->\n");
87 wc_printf("</div>\n");
88 wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
90 if (tabnum == num_tabs-1) {
91 wc_printf("<script type=\"text/javascript\">"
92 " Nifty(\"table#TheTabs td\", \"small transparent top\");"
101 * print tabbed dialog
103 void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) {
106 StrBufAppendBufPlain(
109 "<script type=\"text/javascript\"> "
110 "var previously_selected_tab = '0'; "
111 "function tabsel(which_tab) { "
112 " if (which_tab == previously_selected_tab) { "
115 " $('tabdiv'+previously_selected_tab).style.display = 'none'; "
116 " $('tabdiv'+which_tab).style.display = 'block'; "
117 " $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; "
118 " $('tabtd'+which_tab).className = 'tab_cell_label'; "
119 " previously_selected_tab = which_tab; "
124 StrBufAppendBufPlain(
127 "<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
128 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
131 for (i=0; i<num_tabs; ++i) {
134 "<td id=\"tabtd%d\" class=\"%s\" "
135 "onClick='tabsel(\"%d\");'"
138 ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
141 StrBufAppendBuf(Target, tabnames[i], 0);
142 StrBufAppendBufPlain(
146 "<td> </td>\n"), 0);
149 StrBufAppendBufPlain(
151 HKEY("</tr></table>\n"), 0);
155 * print the tab-header
157 * tabnum: number of the tab to print
158 * num_tabs: total number oftabs to be printed
161 void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names) {
163 if (tabnum == num_tabs) {
164 StrBufAppendBufPlain(
166 HKEY("<!-- begin tab-common epilogue ["), 0);
167 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
168 StrBufAppendBufPlain(
170 HKEY("] -->\n<div class=\"tabcontent_submit\">"), 0);
174 StrBufAppendBufPlain(
176 HKEY("<!-- begin tab "), 0);
178 Target, "%d of %d [",
181 StrEscAppend(Target, Names[tabnum], NULL, 0, 2);
185 "] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
187 ( (tabnum == 0) ? "block" : "none" )
193 * print the tab-footer
194 * tabnum: number of the tab to print
195 * num_tabs: total number of tabs to be printed
198 void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) {
200 if (tabnum == num_tabs) {
201 StrBufAppendBufPlain(
205 "<!-- end tab-common epilogue -->\n"), 0);
212 "<!-- end tab %d of %d -->\n", tabnum, num_tabs);
214 if (tabnum == num_tabs-1) {
215 StrBufAppendBufPlain(
218 "<script type=\"text/javascript\">"
219 " Nifty(\"table#TheTabs td\", \"small transparent top\");"
223 if (HAVEBSTR("last_tabsel"))
225 StrBufAppendPrintf(Target, "<script type=\"text/javascript\">tabsel(%s);</script>", BSTR("last_tabsel"));