diff -r 67d332d48562 -r 2c3451cc396c java/nekurak.net-web/web/index.jsp --- a/java/nekurak.net-web/web/index.jsp Thu Feb 25 08:26:46 2010 +0100 +++ b/java/nekurak.net-web/web/index.jsp Thu Feb 25 09:10:01 2010 +0100 @@ -15,6 +15,20 @@ <fmt:setBundle basename="cz.frantovo.nekurak.preklady" scope="application"/> <!-- </lokalizace> --> + <!-- <autentizace> --> + <c:set var="prihlasenyUzivatel" scope="request" value="${pageContext.request.userPrincipal.name}"/> + <c:if test="${param.akce == 'prihlaseni' && param.odhlasit == 'ano'}"> + <!-- + Uživatele musíme odhlásit dřív, než vykreslíme nabídku, + která závisí na tom, zda je uživatel přihlášený nebo ne. + „prihlaseni.jsp?odhlasit=ano“ už vypíše jen hlášku, že byl odhlášen. + --> + <jsp:scriptlet>session.invalidate();</jsp:scriptlet> + <c:set var="prihlasenyUzivatel" scope="request" value="${null}"/> + </c:if> + <!-- </autentizace> --> + + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> @@ -31,11 +45,17 @@ <ul id="nabidka"> <li><a href="?">Úvod</a></li> - <li><a href="${pageContext.servletContext.contextPath}/sprava">Správa</a></li> - <c:if test="${pageContext.request.userPrincipal.name != null}"> - <li><a href="?akce=pridatPodnik">Přidat podnik</a></li> - <li id="prihlasenyUzivatel">Přihlášený uživatel: ${pageContext.request.userPrincipal.name}</li> - </c:if> + + <c:choose> + <c:when test="${prihlasenyUzivatel == null}"> + <li><a href="?akce=prihlaseni">Přihlásit se</a></li> + </c:when> + <c:otherwise> + <li><a href="?akce=pridatPodnik">Přidat podnik</a></li> + <li id="prihlasenyUzivatel">Přihlášený uživatel: ${pageContext.request.userPrincipal.name}</li> + <li><a href="?akce=prihlaseni&amp;odhlasit=ano">Odhlásit se</a></li> + </c:otherwise> + </c:choose> </ul> @@ -48,6 +68,9 @@ <c:when test="${param.akce == 'pridatPodnik'}"> <jsp:include page="/WEB-INF/casti/pridatPodnik.jsp" flush="false"/> </c:when> + <c:when test="${param.akce == 'prihlaseni'}"> + <jsp:include page="/WEB-INF/casti/prihlaseni.jsp" flush="false"/> + </c:when> <c:otherwise> <jsp:include page="/WEB-INF/casti/uvod.jsp" flush="false"/> </c:otherwise>