src/main/webapp/WEB-INF/jsp/site.jsp

Tue, 03 Aug 2021 12:22:10 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 03 Aug 2021 12:22:10 +0200
changeset 208
785820da6485
parent 207
479dd7993ef9
child 212
c50da26a6d31
permissions
-rw-r--r--

fixes response locale not set for new sessions

<%-- 
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright 2021 Mike Becker. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
<%@page import="de.uapcore.lightpit.Constants" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%-- Version suffix for forcing browsers to update the CSS / JS files --%>
<c:set scope="page" var="versionSuffix" value="20210802"/>

<%-- Make the base href easily available at request scope --%>
<c:set scope="page" var="baseHref" value="${requestScope[Constants.REQ_ATTR_BASE_HREF]}"/>

<%-- The feed URL for this page. --%>
<c:set scope="page" var="feedHref" value="${requestScope[Constants.REQ_ATTR_FEED_HREF]}"/>

<%-- Define an alias for the request path --%>
<c:set scope="page" var="requestPath" value="${requestScope[Constants.REQ_ATTR_PATH]}"/>

<%-- Define an alias for the navigation menu --%>
<c:set scope="page" var="navMenu" value="${requestScope[Constants.REQ_ATTR_NAVIGATION]}"/>

<%-- Define an alias for the custom page title --%>
<c:set scope="page" var="pageTitle" value="${requestScope[Constants.REQ_ATTR_PAGE_TITLE]}"/>

<%-- Define an alias for the content page name --%>
<c:set scope="page" var="contentPage" value="${requestScope[Constants.REQ_ATTR_CONTENT_PAGE]}"/>

<%-- Define an alias for the optional redirect location --%>
<c:set scope="page" var="redirectLocation" value="${requestScope[Constants.REQ_ATTR_REDIRECT_LOCATION]}"/>

<%-- Define an alias for the additional stylesheet --%>
<c:set scope="page" var="extraCss" value="${requestScope[Constants.REQ_ATTR_STYLESHEET]}"/>

<%-- Define an alias for the optional JS file --%>
<c:set scope="page" var="javascriptFile" value="${requestScope[Constants.REQ_ATTR_JAVASCRIPT]}"/>

<%-- Load resource bundle --%>
<fmt:setLocale scope="request" value="${pageContext.response.locale}"/>
<fmt:setBundle scope="request" basename="localization.strings"/>

<!DOCTYPE html>
<html>
<head>
    <base href="${baseHref}">
    <title>
        LightPIT
        <c:if test="${not empty pageTitle}"> - <c:out value="${pageTitle}"/></c:if>
    </title>
    <meta charset="UTF-8">
    <c:if test="${not empty redirectLocation}">
        <meta http-equiv="refresh" content="0; URL=${redirectLocation}">
    </c:if>
    <link rel="stylesheet" href="lightpit.css?v=${versionSuffix}" type="text/css">
    <c:if test="${not empty feedHref}">
        <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="${feedHref}"/>
    </c:if>
    <c:if test="${not empty extraCss}">
        <c:forEach items="${extraCss}" var="cssFile">
            <link rel="stylesheet" href="${cssFile}?v=${versionSuffix}" type="text/css">
        </c:forEach>
    </c:if>
    <c:if test="${not empty javascriptFile}">
        <script src="${javascriptFile}?v=${versionSuffix}" type="text/javascript"></script>
    </c:if>
</head>
<body>
<div id="mainMenu">
    <div class="menuEntry"
         <c:if test="${fn:startsWith(requestPath, '/projects/')}">data-active</c:if> >
        <a href="projects/">
            <fmt:message key="menu.projects"/>
        </a>
    </div>
    <div class="menuEntry"
         <c:if test="${fn:startsWith(requestPath, '/users/')}">data-active</c:if> >
        <a href="users/">
            <fmt:message key="menu.users"/>
        </a>
    </div>
    <div class="menuEntry"
         <c:if test="${fn:startsWith(requestPath, '/language/')}">data-active</c:if> >
        <a href="language/">
            <fmt:message key="menu.languages"/>
        </a>
    </div>
    <div class="menuEntry"
         <c:if test="${fn:startsWith(requestPath, '/about/')}">data-active</c:if> >
        <a href="about/">
            <fmt:message key="menu.about"/>
        </a>
    </div>
</div>
<div>
    <c:if test="${not empty navMenu}">
        <div id="sideMenu">
            <%@include file="../jspf/navmenu.jspf" %>
        </div>
    </c:if>
    <div id="content-area" <c:if test="${not empty navMenu}">class="sidebar-spacing"</c:if>>
        <c:import url="${contentPage}"/>
    </div>
</div>
</body>
</html>

mercurial