From 7ec6747f12715155e4f61269ae1d0fbba7c42dc5 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 28 Dec 2010 17:55:36 -0500 Subject: [PATCH] Summary page displays site name instead of user name when not logged in --- webcit/summary.c | 4 +++- webcit/webcit.c | 27 +++++++++++++++++++-------- webcit/webcit.h | 1 + 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/webcit/summary.c b/webcit/summary.c index b9803a084..3ae86f835 100644 --- a/webcit/summary.c +++ b/webcit/summary.c @@ -272,7 +272,9 @@ void summary(void) { wc_printf(""); wc_printf(""); wc_printf("

"); - snprintf(title, sizeof title, _("Summary page for %s"), ChrPtr(WC->wc_fullname)); + snprintf(title, sizeof title, _("Summary page for %s"), + ( (WC->logged_in) ? ChrPtr(WC->wc_fullname) : ChrPtr(WC->serv_info->serv_humannode)) + ); escputs(title); wc_printf("

"); output_date(); diff --git a/webcit/webcit.c b/webcit/webcit.c index 5a0eec744..b02368388 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -752,7 +752,7 @@ void session_loop(void) end_ajax_response(); } } - /* When all else fails, display the main menu. */ + /* When all else fails, display the default landing page or a main menu. */ else { /* * ordinary browser users get a nice login screen, DAV etc. requsets @@ -762,14 +762,8 @@ void session_loop(void) if (xhttp) { authorization_required(); } - else if (WCC->serv_info->serv_supports_guest) { - /* default action. probably revisit this. */ - StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_")); - smart_goto(teh_lobby); - FreeStrBuf(&teh_lobby); - } else { - display_login(); + display_default_landing_page(); } } /* @@ -789,6 +783,23 @@ SKIP_ALL_THIS_CRAP: } + +/* + * Display the appropriate landing page for this site. + */ +void display_default_landing_page(void) { + if (WC->serv_info->serv_supports_guest) { + /* default action. probably revisit this. */ + StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_")); + smart_goto(teh_lobby); + FreeStrBuf(&teh_lobby); + } + else { + display_login(); + } +} + + /* * Replacement for sleep() that uses select() in order to avoid SIGALRM */ diff --git a/webcit/webcit.h b/webcit/webcit.h index d772b27ad..59d2dec1a 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -639,6 +639,7 @@ void become_logged_in(const StrBuf *user, const StrBuf *pass, StrBuf *serv_respo void openid_manual_create(void); void display_login(void); void display_openids(void); +void display_default_landing_page(void); void do_welcome(void); void do_logout(void); void display_main_menu(void); -- 2.30.2