}
+/*
+ * Display the icon bar as long as we have an active session,
+ * and either the user is logged in or the server allows guest mode.
+ */
void tmplput_iconbar(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
- if ((WCC != NULL) && (WCC->logged_in)) {
- DoTemplate(HKEY("iconbar"), NULL, &NoCtx);
+ if ( (WCC != NULL)
+ && ( (WCC->logged_in)
+ || (WCC->serv_info->serv_supports_guest)
+ )
+ ) {
+ DoTemplate(HKEY("iconbar"), NULL, &NoCtx);
}
}
<?_("Summary")>
</span></a>
</li>
+<??("COND:LOGGEDIN",3)>
<li id="ib_inbox" class="ib_button">
<a class="ib_button_link" href="dotgoto?room=_MAIL_" title="<?_("Go to your email inbox")>"><span>
<?_("Mail")></span>
<?_("Tasks")></span>
</a>
</li>
+<??("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")>"><span>
<?_("Rooms")></span>
<li><?_("Loading")></li>
</ul>
</li>
+<??("COND:LOGGEDIN",5)>
<li id="ib_chat" class="ib_button">
<a class="ib_button_link" href="chat"><span>
<?_("Chat")>
</span>
</a>
</li>
+<??("X",5)>
<??("COND:AIDE", 1)>
<li id="ib_admin" class="ib_button">
<a class="ib_button_link" href="do_template?template=aide_display_menu" title="<?_("Room and system administration functions")>"><span><?_("Administration")></span></a>
<span><a href="do_template?template=iconbar_edit"><?_("customize this menu")></a></span>
</div>
<??("X",2)>
+<?!("COND:LOGGEDIN",4)>
+<div id="ib_logoff" class="ib_button">
+<a class="ib_button_link" href="login" title="<?_("Login")>"><span><?_("Login")></span></a>
+</div>
+<?!("X",4)>
<div class="ctdlTemplate">
<span id="rmlist_template"><?_("switch to room list")></span>
<span id="mnlist_template"><?_("switch to menu")></span>
/*
* Output a piece of content to the web browser using conformant HTTP and MIME semantics
*/
-void http_transmit_thing(const char *content_type,
- int is_static) {
+void http_transmit_thing(const char *content_type, int is_static)
+{
-#ifndef TECH_PREVIEW
- lprintf(9, "http_transmit_thing(%s)%s\n",
- content_type,
- ((is_static > 0) ? " (static)" : "")
- );
-#endif
+ lprintf(9, "http_transmit_thing(%s)%s\n", content_type, ((is_static > 0) ? " (static)" : ""));
output_headers(0, 0, 0, 0, 0, is_static);
hprintf("Content-type: %s\r\n"
/*
- * Authorization required page
- * This is probably temporary and should be revisited
+ * Authorization required page (sends a 401, causing the browser to request login credentials)
*/
void authorization_required(void)
{
}
if (WCC->Hdr->HR.Handler != NULL) {
- if (!WCC->logged_in && ((WCC->Hdr->HR.Handler->Flags & ANONYMOUS) == 0)) {
+ if ( (!WCC->logged_in)
+ && ((WCC->Hdr->HR.Handler->Flags & ANONYMOUS) == 0)
+ && (WCC->serv_info->serv_supports_guest == 0)
+ ) {
display_login();
}
else {
end_ajax_response();
}
}
- /* When all else fais, display the main menu. */
+ /* When all else fails, display the main menu. */
else {
/*
* ordinary browser users get a nice login screen, DAV etc. requsets
* are given a 401 so they can handle it appropriate.
*/
if (!WCC->logged_in) {
- if (xhttp)
+ if (xhttp) {
authorization_required();
- else
+ }
+ 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();
+ }
}
/*
* Toplevel dav requests? or just a flat browser request?