From b6236ff23114e8374f60f9b376766fb5176867ef Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 12 May 2011 17:14:07 -0400 Subject: [PATCH] The in-iconbar wholist is now expandable and collapsible. It also maintains its state across page reloads. I *may* move it into the ib-vector to make it persistent across logins. TODO: same for the in-inconbar roomlist. --- webcit/iconbar.c | 26 +++++++++++++++-- webcit/static/t/iconbar.html | 4 ++- webcit/static/wclib.js | 55 ++++++++++++++++++++++++++++++------ 3 files changed, 74 insertions(+), 11 deletions(-) diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 3b4b17554..60e421bd3 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -261,8 +261,10 @@ ServerStartModule_ICONBAR int ConditionalWholistExpanded(StrBuf *Target, WCTemplputParams *TP) { - if (WC) return(WC->ib_wholist_expanded); - return(0); + int r = 0; + if (WC) r = WC->ib_wholist_expanded; + syslog(LOG_DEBUG, "ConditionalWholistExpanded() returns %d", r); + return(r); } @@ -273,6 +275,24 @@ int ConditionalRoomlistExpanded(StrBuf *Target, WCTemplputParams *TP) } + +/* + * Toggle the wholist expanded state in session memory + */ +void toggle_wholist_expanded_state(void) { + wcsession *WCC = WC; + + if (!WCC) { + wc_printf("no session"); + return; + } + + WCC->ib_wholist_expanded = IBSTR("wstate"); + wc_printf("%d", WCC->ib_wholist_expanded); + syslog(LOG_DEBUG, "ib_wholist_expanded set to %d", WCC->ib_wholist_expanded); +} + + void InitModule_ICONBAR (void) @@ -281,6 +301,7 @@ InitModule_ICONBAR /*WebcitAddUrlHandler(HKEY("user_iconbar"), "", 0, doUserIconStylesheet, 0); */ WebcitAddUrlHandler(HKEY("commit_iconbar"), "", 0, commit_iconbar, 0); + WebcitAddUrlHandler(HKEY("toggle_wholist_expanded_state"), "", 0, toggle_wholist_expanded_state, AJAX); RegisterConditional(HKEY("COND:ICONBAR:ACTIVE"), 3, ConditionalIsActiveStylesheet, CTX_NONE); RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar, NULL, CTX_NONE); RegisterConditional(HKEY("COND:ICONBAR:WHOLISTEXPANDED"), 0, ConditionalWholistExpanded, CTX_NONE); @@ -306,3 +327,4 @@ SessionDestroyModule_ICONBAR if (sess->IBSettingsVec != NULL) free(sess->IBSettingsVec); } + diff --git a/webcit/static/t/iconbar.html b/webcit/static/t/iconbar.html index 038d0d8d4..bc4c2952b 100644 --- a/webcit/static/t/iconbar.html +++ b/webcit/static/t/iconbar.html @@ -50,7 +50,9 @@
  • "> - + +onClick="return toggle_wholist();">