1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
#include <stdarg.h>
#define SHOW_ME_VAPPEND_PRINTF
#include "webcit.h"
/*
* print tabbed dialog
*/
void tabbed_dialog(int num_tabs, const char *tabnames[]) {
int i;
StrBufAppendPrintf(WC->trailing_javascript,
"var previously_selected_tab = '0'; \n"
"function tabsel(which_tab) { \n"
" if (which_tab == previously_selected_tab) { \n"
" return; \n"
" } \n"
" $('tabdiv'+previously_selected_tab).style.display = 'none'; \n"
" $('tabdiv'+which_tab).style.display = 'block'; \n"
" $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; \n"
" $('tabtd'+which_tab).className = 'tab_cell_label'; \n"
" previously_selected_tab = which_tab; \n"
"} \n"
);
wc_printf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
"<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
);
for (i=0; i<num_tabs; ++i) {
wc_printf("<td id=\"tabtd%d\" class=\"%s\" "
"onClick='tabsel(\"%d\");'"
">",
i,
( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
i
);
wc_printf("%s", tabnames[i]);
wc_printf("</td>");
wc_printf("<td> </td>\n");
}
wc_printf("</tr></table>\n");
}
/*
* print the tab-header
*
* tabnum: number of the tab to print
* num_tabs: total number oftabs to be printed
*
*/
void begin_tab(int tabnum, int num_tabs) {
if (tabnum == num_tabs) {
wc_printf("<!-- begin tab-common epilogue -->\n");
wc_printf("<div class=\"tabcontent_submit\">");
}
else {
wc_printf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
wc_printf("<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
tabnum,
( (tabnum == 0) ? "block" : "none" )
);
}
}
/*
* print the tab-footer
* tabnum: number of the tab to print
* num_tabs: total number of tabs to be printed
*
*/
void end_tab(int tabnum, int num_tabs) {
if (tabnum == num_tabs) {
wc_printf("</div> <!-- end of 'tabcontent_submit' div -->\n");
wc_printf("<!-- end tab-common epilogue -->\n");
}
else {
wc_printf("</div>\n");
wc_printf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
}
}
/*
* print tabbed dialog
*/
void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) {
int i;
StrBufAppendBufPlain(
Target,
HKEY(
"<script type=\"text/javascript\"> "
"var previously_selected_tab = '0'; "
"function tabsel(which_tab) { "
" if (which_tab == previously_selected_tab) { "
" return; "
" } "
" $('tabdiv'+previously_selected_tab).style.display = 'none'; "
" $('tabdiv'+which_tab).style.display = 'block'; "
" $('tabtd'+previously_selected_tab).className = 'tab_cell_edit'; "
" $('tabtd'+which_tab).className = 'tab_cell_label'; "
" previously_selected_tab = which_tab; "
"} "
"</script> \n"
), 0);
StrBufAppendBufPlain(
Target,
HKEY(
"<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
"<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
), 0);
for (i=0; i<num_tabs; ++i) {
StrBufAppendPrintf(
Target,
"<td id=\"tabtd%d\" class=\"%s\" "
"onClick='tabsel(\"%d\");'"
">",
i,
( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
i
);
StrEscAppend(Target, tabnames[i], NULL, 0, 0);
StrBufAppendBufPlain(
Target,
HKEY(
"</td>"
"<td> </td>\n"), 0);
}
StrBufAppendBufPlain(
Target,
HKEY("</tr></table>\n"), 0);
}
/*
* print the tab-header
*
* tabnum: number of the tab to print
* num_tabs: total number oftabs to be printed
*
*/
void StrBeginTab(StrBuf *Target, int tabnum, int num_tabs, StrBuf **Names) {
if (tabnum == num_tabs) {
StrBufAppendBufPlain(
Target,
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,
"] -->\n<div id=\"tabdiv%d\" style=\"display:%s\" class=\"tabcontent\" >",
tabnum,
( (tabnum == 0) ? "block" : "none" )
);
}
}
/*
* print the tab-footer
* tabnum: number of the tab to print
* num_tabs: total number of tabs to be printed
*
*/
void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) {
if (tabnum == num_tabs) {
StrBufAppendBufPlain(
Target,
HKEY(
"</div>\n"
"<!-- end tab-common epilogue -->\n"), 0);
}
else {
StrBufAppendPrintf(
Target,
"</div>\n",
"<!-- 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"));
}
}
|