From 8217ed8772edbc04987f10ee2d93ace9c4932317 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 14 Aug 2010 17:11:39 +0000 Subject: [PATCH] * add a way for the tabbed api to re-open the same tab on save again. --- webcit/static/t/room/edit/tab_access.html | 4 +-- webcit/static/t/room/edit/tab_config.html | 3 +- webcit/static/t/room/edit/tab_expire.html | 2 +- webcit/static/t/room/edit/tab_feed.html | 4 +-- webcit/static/t/room/edit/tab_listserv.html | 6 ++-- webcit/subst.c | 36 ++++++++++++++++++++- webcit/subst.h | 3 +- webcit/tabs.c | 4 +++ 8 files changed, 52 insertions(+), 10 deletions(-) diff --git a/webcit/static/t/room/edit/tab_access.html b/webcit/static/t/room/edit/tab_access.html index e38c31511..53d395fe5 100644 --- a/webcit/static/t/room/edit/tab_access.html +++ b/webcit/static/t/room/edit/tab_access.html @@ -7,7 +7,7 @@
- + @@ -21,7 +21,7 @@

- +
diff --git a/webcit/static/t/room/edit/tab_config.html b/webcit/static/t/room/edit/tab_config.html index 59e9fd06c..4564b453f 100644 --- a/webcit/static/t/room/edit/tab_config.html +++ b/webcit/static/t/room/edit/tab_config.html @@ -139,9 +139,10 @@
- + " />   " />
+ diff --git a/webcit/static/t/room/edit/tab_expire.html b/webcit/static/t/room/edit/tab_expire.html index 2f65cc8cd..fbf207936 100644 --- a/webcit/static/t/room/edit/tab_expire.html +++ b/webcit/static/t/room/edit/tab_expire.html @@ -66,6 +66,6 @@ - + diff --git a/webcit/static/t/room/edit/tab_feed.html b/webcit/static/t/room/edit/tab_feed.html index 1d61afdb6..9a5e1e286 100644 --- a/webcit/static/t/room/edit/tab_feed.html +++ b/webcit/static/t/room/edit/tab_feed.html @@ -3,7 +3,7 @@

- +

@@ -32,7 +32,7 @@

- +

diff --git a/webcit/static/t/room/edit/tab_listserv.html b/webcit/static/t/room/edit/tab_listserv.html index f7a763996..d76df96f9 100644 --- a/webcit/static/t/room/edit/tab_listserv.html +++ b/webcit/static/t/room/edit/tab_listserv.html @@ -7,7 +7,7 @@

- + @@ -21,7 +21,7 @@

- + @@ -67,6 +67,8 @@ + + " /> diff --git a/webcit/subst.c b/webcit/subst.c index 02d9fa550..ed060b173 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -112,6 +112,7 @@ const char *CtxNames[] = { "Context ITERATE", "Context ICAL", "Context DavNamespace", + "Context TAB", "Context UNKNOWN" }; @@ -2645,6 +2646,12 @@ void tmpl_do_boxed(StrBuf *Target, WCTemplputParams *TP) /*----------------------------------------------------------------------------- * Tabbed-API */ + +typedef struct _tab_struct { + long CurrentTab; + StrBuf *TabTitle; +} tab_struct; + int preeval_do_tabbed(WCTemplateToken *Token) { WCTemplputParams TPP; @@ -2712,6 +2719,11 @@ void tmpl_do_tabbed(StrBuf *Target, WCTemplputParams *TP) { StrBuf **TabNames; int i, ntabs, nTabs; + tab_struct TS; + WCTemplputParams SubTP; + + memset(&TS, 0, sizeof(tab_struct)); + memcpy (&SubTP, &TP, sizeof(WCTemplputParams)); nTabs = ntabs = TP->Tokens->nParameters / 2; TabNames = (StrBuf **) malloc(ntabs * sizeof(StrBuf*)); @@ -2738,17 +2750,35 @@ void tmpl_do_tabbed(StrBuf *Target, WCTemplputParams *TP) nTabs --; } } + memcpy (&SubTP, TP, sizeof(WCTemplputParams)); + SubTP.Filter.ControlContextType = CTX_TAB; + SubTP.ControlContext = &TS; StrTabbedDialog(Target, nTabs, TabNames); for (i = 0; i < ntabs; i++) { + memset(&TS, 0, sizeof(tab_struct)); + TS.CurrentTab = i; + TS.TabTitle = TabNames[i]; StrBeginTab(Target, i, nTabs, TabNames); - DoTemplate(TKEY(i * 2 + 1), Target, TP); + DoTemplate(TKEY(i * 2 + 1), Target, &SubTP); StrEndTab(Target, i, nTabs); } for (i = 0; i < ntabs; i++) FreeStrBuf(&TabNames[i]); } +void tmplput_TAB_N(StrBuf *Target, WCTemplputParams *TP) +{ + tab_struct *Ctx = CCTX; + + StrBufAppendPrintf(Target, "%d", Ctx->CurrentTab); +} + +void tmplput_TAB_TITLE(StrBuf *Target, WCTemplputParams *TP) +{ + tab_struct *Ctx = CCTX; + StrBufAppendTemplate(Target, TP, Ctx->TabTitle, 0); +} /*----------------------------------------------------------------------------- * Sorting-API @@ -3127,6 +3157,10 @@ InitModule_SUBST RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl, preeval_iterate, CTX_NONE); RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed, NULL, CTX_NONE); RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, preeval_do_tabbed, CTX_NONE); + RegisterControlNS(HKEY("TAB:N"), 0, 0, tmplput_TAB_N, CTX_TAB); + RegisterControlNS(HKEY("TAB:SUBJECT"), 0, 1, tmplput_TAB_TITLE, CTX_TAB); + + RegisterNamespace("LONGVECTOR", 1, 1, tmplput_long_vector, NULL, CTX_LONGVECTOR); diff --git a/webcit/subst.h b/webcit/subst.h index adfaf8b38..4bf5728ed 100644 --- a/webcit/subst.h +++ b/webcit/subst.h @@ -55,8 +55,9 @@ enum { #define CTX_ITERATE 17 #define CTX_ICAL 18 #define CTX_DAVNS 19 +#define CTX_TAB 20 -#define CTX_UNKNOWN 20 +#define CTX_UNKNOWN 21 /** diff --git a/webcit/tabs.c b/webcit/tabs.c index d6172de36..53b8e87c0 100644 --- a/webcit/tabs.c +++ b/webcit/tabs.c @@ -220,6 +220,10 @@ void StrEndTab(StrBuf *Target, int tabnum, int num_tabs) { ""), 0); } } + if (HAVEBSTR("last_tabsel")) + { + StrBufAppendPrintf(Target, "", BSTR("last_tabsel")); + } } -- 2.30.2