+/*
+ * Toggle the roomlist expanded state in session memory
+ */
+void toggle_roomlist_expanded_state(void) {
+ wcsession *WCC = WC;
+
+ if (!WCC) {
+ wc_printf("no session");
+ return;
+ }
+
+ WCC->ib_roomlist_expanded = IBSTR("wstate");
+ wc_printf("%d", WCC->ib_roomlist_expanded);
+ syslog(LOG_DEBUG, "ib_roomlist_expanded set to %d", WCC->ib_roomlist_expanded);
+}
+
+
/*
* Toggle the wholist expanded state in session memory
*/
/*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);
+ WebcitAddUrlHandler(HKEY("toggle_roomlist_expanded_state"), "", 0, toggle_roomlist_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);
<div class="iconbar_text">
<?_("Language:")><?LANG:SELECT>
</div>
- <div id="switch" class="iconbar_text"><span></span></div>
- <div id="roomlist"></div>
<div id="iconbar_menu">
<ul id="button">
<li id="ib_summary" class="ib_button">
<??("X",3)>
<li id="ib_rooms" class="ib_button">
<a class="ib_button_link" href="knrooms?template=knrooms?SortBy=byfloorroom?SortOrder=1" title="<?_("List all your accessible rooms")>">
-<img src="static/expand.gif" onClick="alert('Please do not click this button again.'); return false;">
+<img id="expand_roomlist"
+src=<?%("COND:ICONBAR:ROOMLISTEXPANDED", 1, 1, 1, "static/collapse.gif", "static/expand.gif")>
+onClick="return toggle_roomlist();">
<span><?_("Rooms")></span>
</a>
+<div id="roomlist">
+<?_("Loading")>
+</div>
</li>
<li id="ib_users" class="ib_button">
<a class="ib_button_link" href="do_template?template=who" title="<?_("See who is online right now")>">
}
+function toggle_roomlist()
+{
+ /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
+ if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) {
+ $('roomlist').style.display = 'none';
+ $('expand_roomlist').src = 'static/expand.gif';
+ wstate=0;
+ }
+
+ else {
+ $('roomlist').style.display = 'block';
+ $('expand_roomlist').src = 'static/collapse.gif';
+ /* activate_iconbar_roomlist_populat0r(); */
+ wstate=1;
+ }
+
+ // tell the server what I did
+ p = 'toggle_roomlist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
+ new Ajax.Request(p, { method: 'get' } );
+
+ return false; /* this prevents the click from registering as a roomlist button press */
+}
+
+
function toggle_wholist()
{
/* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
new Ajax.Request(p, { method: 'get' } );
return false; /* this prevents the click from registering as a wholist button press */
-
}
+
+