X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Ftabs.c;h=90dac77b0be8c8e7e5e614e2f57163510adc649d;hp=72fc34073c9ab6a584078f1bfd1c62d2bdf4e99f;hb=b98d9f087b3a24a9549470ab066c2aea187ecfba;hpb=0a76cdaf6da64dacbc206dbb61c7725384aaa4b1 diff --git a/webcit/tabs.c b/webcit/tabs.c index 72fc34073..90dac77b0 100644 --- a/webcit/tabs.c +++ b/webcit/tabs.c @@ -1,90 +1,210 @@ -/* - * $Id$ - */ -/** - * \defgroup TabUtils Utility functions for creating tabbed dialogs - * \ingroup WebcitDisplayItems - */ -/*@{*/ +#include +#define SHOW_ME_VAPPEND_PRINTF #include "webcit.h" -/** - * \brief print tabbed dialog - * \param num_tabs how many tabs do we have? - * \param tabnames the headers of the tables +/* + * print tabbed dialog */ void tabbed_dialog(int num_tabs, char *tabnames[]) { int i; - wprintf(" \n" + 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" ); - wprintf("" + wc_printf("
" "" ); for (i=0; i" - "", - i, - ( (i==0) ? "ffffff" : "cccccc" ), + ">", i, + ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ), i - ); - wprintf("%s", tabnames[i]); - wprintf(""); + ); + wc_printf("%s", tabnames[i]); + wc_printf(""); - wprintf("\n"); + wc_printf("\n"); } - wprintf("
   
\n"); - wprintf("
"); + wc_printf("
\n"); } -/** - * \brief print the tab-header - * \param tabnum number of the tab to print - * \param num_tabs total number oftabs to be printed +/* + * 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) { - wprintf("\n", tabnum, num_tabs); - wprintf("
", - tabnum, - ( (tabnum == 0) ? "block" : "none" ) - ); + + if (tabnum == num_tabs) { + wc_printf("\n"); + wc_printf("
"); + } + + else { + wc_printf("\n", tabnum, num_tabs); + wc_printf("
", + tabnum, + ( (tabnum == 0) ? "block" : "none" ) + ); + } } -/** - * \brief print the tab-footer - * \param tabnum number of the tab to print - * \param num_tabs total number of tabs to be printed +/* + * 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) { - wprintf("
\n"); - wprintf("\n", tabnum, num_tabs); - - if (tabnum == num_tabs-1) { - wprintf("\n"); - wprintf("" + + if (tabnum == num_tabs) { + wc_printf("
\n"); + wc_printf("\n"); + } + + else { + wc_printf("
\n"); + wc_printf("\n", tabnum, num_tabs); + } +} + + +/* + * print tabbed dialog + */ +void StrTabbedDialog(StrBuf *Target, int num_tabs, StrBuf *tabnames[]) { + int i; + + StrBufAppendBufPlain( + Target, + HKEY( + " \n" + ), 0); + + StrBufAppendBufPlain( + Target, + HKEY( + "" + "" + ), 0); + + for (i=0; i", + i, + ( (i==0) ? "tab_cell_label" : "tab_cell_edit" ), + i + ); + StrBufAppendBuf(Target, tabnames[i], 0); + StrBufAppendBufPlain( + Target, + HKEY( + "" + "\n"), 0); + } + + StrBufAppendBufPlain( + Target, + HKEY("
  
\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("\n
"), 0); + } + + else { + StrBufAppendBufPlain( + Target, + HKEY("\n
", + 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( + "
\n" + "\n"), 0); + } + + else { + StrBufAppendPrintf( + Target, + "
\n", + "\n", tabnum, num_tabs ); } + if (havebstr("last_tabsel")) + { + StrBufAppendPrintf(Target, "", BSTR("last_tabsel")); + } } -/*@}*/