From 84cfe911adbe23ff0474557eac38127d9f5dd7d0 Mon Sep 17 00:00:00 2001 From: Dave West Date: Sat, 27 Oct 2007 20:43:31 +0000 Subject: [PATCH] User can now choose to hide or display floors that contain no rooms visible to them. --- webcit/preferences.c | 25 +++++++++++++++++++++++++ webcit/roomops.c | 29 +++++++++++++++++++++++++++-- webcit/webcit.h | 1 + 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/webcit/preferences.c b/webcit/preferences.c index a83f8c878..70068cb5d 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -409,6 +409,30 @@ void display_preferences(void) wprintf("\">"); wprintf(""); + /** + * Show empty floors? + */ + + get_preference("emptyfloors", buf, sizeof buf); + if (buf[0] == 0) strcpy(buf, "no"); + wprintf(""); + wprintf(_("Show empty floors")); + wprintf(""); + + wprintf(""); + wprintf(_("Yes")); + wprintf("   "); + + wprintf(""); + wprintf(_("No")); + wprintf("\n"); + + wprintf("\n"); + /** end table */ wprintf("\n"); @@ -464,6 +488,7 @@ void set_preferences(void) set_preference("daystart", bstr("daystart"), 0); set_preference("dayend", bstr("dayend"), 0); set_preference("default_header_charset", bstr("default_header_charset"), 0); + set_preference("emptyfloors", bstr("emptyfloors"), 0); euid_escapize(ebuf, bstr("signature")); set_preference("signature", ebuf, 1); diff --git a/webcit/roomops.c b/webcit/roomops.c index 565a37f37..a7790c034 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -3069,7 +3069,8 @@ void list_all_rooms_by_floor(char *viewpref) { int ra_flags = 0; int flags = 0; int num_floors = 1; /** add an extra one for private folders */ - + char buf2[SIZ]; + /** If our cached folder list is very old, burn it. */ if (WC->cache_fold != NULL) { if ((time(NULL) - WC->cache_timestamp) > 300) { @@ -3138,9 +3139,33 @@ void list_all_rooms_by_floor(char *viewpref) { fold[max_folders].floor, fold[max_folders].is_mailbox); fold[max_folders].selectable = 1; + /* Increase the room count for the associtaed floor */ + if (fold[max_folders].is_mailbox) + fold[0].num_rooms++; + else + fold[fold[max_folders].floor+1].num_rooms++; ++max_folders; } - + + /* + * Remove any floors that don't have rooms + */ + get_preference("emptyfloors", buf2, sizeof buf2); + if (buf2[0]==0 || (strcasecmp(buf2, "no") == 0)) + { + for (i=0; i