simplifies menu generation, adds submenus and removes VersionsModule (versions will be part of the ProjectsModule)

Wed, 13 May 2020 21:10:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 13 May 2020 21:10:23 +0200
changeset 45
cc7f082c5ef3
parent 44
835dd169642a
child 46
1574965c7dc7

simplifies menu generation, adds submenus and removes VersionsModule (versions will be part of the ProjectsModule)

src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/Constants.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/Functions.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/MenuEntry.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/ModuleManager.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/RequestMapping.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ErrorModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/VersionsModule.java file | annotate | diff | comparison | revisions
src/main/resources/localization/projects.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/projects_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/versions.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/versions_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/site.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jspf/menu-entry.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/web.xml file | annotate | diff | comparison | revisions
src/main/webapp/index.jsp file | annotate | diff | comparison | revisions
src/main/webapp/lightpit.css file | annotate | diff | comparison | revisions
     1.1 --- a/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Wed May 13 18:55:05 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/AbstractLightPITServlet.java	Wed May 13 21:10:23 2020 +0200
     1.3 @@ -71,6 +71,8 @@
     1.4       */
     1.5      private final Map<HttpMethod, Map<String, Method>> mappings = new HashMap<>();
     1.6  
     1.7 +    private final List<MenuEntry> subMenu = new ArrayList<>();
     1.8 +
     1.9      /**
    1.10       * Gives implementing modules access to the {@link ModuleManager}.
    1.11       *
    1.12 @@ -174,6 +176,14 @@
    1.13                              );
    1.14                          }
    1.15  
    1.16 +                        final var menuKey = mapping.get().menuKey();
    1.17 +                        if (!menuKey.isBlank()) {
    1.18 +                            subMenu.add(new MenuEntry(
    1.19 +                                    new ResourceKey(moduleInfo.getBundleBaseName(), menuKey),
    1.20 +                                    moduleInfo.getModulePath() + requestPath,
    1.21 +                                    mapping.get().menuSequence()));
    1.22 +                        }
    1.23 +
    1.24                          LOG.debug("{} {} maps to {}::{}",
    1.25                                  mapping.get().method(),
    1.26                                  requestPath,
    1.27 @@ -234,13 +244,16 @@
    1.28              throws IOException, ServletException {
    1.29  
    1.30          req.setAttribute(Constants.REQ_ATTR_MENU, getModuleManager().getMainMenu());
    1.31 +        req.setAttribute(Constants.REQ_ATTR_SUB_MENU, subMenu);
    1.32          req.getRequestDispatcher(SITE_JSP).forward(req, resp);
    1.33      }
    1.34  
    1.35 +    private String sanitizeRequestPath(HttpServletRequest req) {
    1.36 +        return Optional.ofNullable(req.getPathInfo()).orElse("/");
    1.37 +    }
    1.38 +
    1.39      private Optional<Method> findMapping(HttpMethod method, HttpServletRequest req) {
    1.40 -        return Optional.ofNullable(mappings.get(method))
    1.41 -                .map(rm -> rm.get(Optional.ofNullable(req.getPathInfo()).orElse("/"))
    1.42 -                );
    1.43 +        return Optional.ofNullable(mappings.get(method)).map(rm -> rm.get(sanitizeRequestPath(req)));
    1.44      }
    1.45  
    1.46      private void forwardAsSpecified(ResponseType type, HttpServletRequest req, HttpServletResponse resp)
    1.47 @@ -275,7 +288,6 @@
    1.48  
    1.49          // set some internal request attributes
    1.50          req.setAttribute(Constants.REQ_ATTR_PATH, Functions.fullPath(req));
    1.51 -        req.setAttribute(Constants.REQ_ATTR_MODULE_CLASSNAME, this.getClass().getName());
    1.52          Optional.ofNullable(moduleInfo).ifPresent((proxy) -> req.setAttribute(Constants.REQ_ATTR_MODULE_INFO, proxy));
    1.53  
    1.54          // obtain a connection and create the data access objects
     2.1 --- a/src/main/java/de/uapcore/lightpit/Constants.java	Wed May 13 18:55:05 2020 +0200
     2.2 +++ b/src/main/java/de/uapcore/lightpit/Constants.java	Wed May 13 21:10:23 2020 +0200
     2.3 @@ -38,8 +38,6 @@
     2.4  public final class Constants {
     2.5      public static final String JSP_PATH_PREFIX = "/WEB-INF/jsp/";
     2.6  
     2.7 -    public static final String JSPF_PATH_PREFIX = "/WEB-INF/jspf/";
     2.8 -
     2.9      public static final String DYN_FRAGMENT_PATH_PREFIX = "/WEB-INF/dynamic_fragments/";
    2.10  
    2.11  
    2.12 @@ -64,11 +62,6 @@
    2.13      public static final String CTX_ATTR_DB_DIALECT = "db-dialect";
    2.14  
    2.15      /**
    2.16 -     * Key for the request attribute containing the class name of the currently dispatching module.
    2.17 -     */
    2.18 -    public static final String REQ_ATTR_MODULE_CLASSNAME = fqn(AbstractLightPITServlet.class, "moduleClassname");
    2.19 -
    2.20 -    /**
    2.21       * Key for the request attribute containing the {@link LightPITModule} information of the currently dispatching module.
    2.22       */
    2.23      public static final String REQ_ATTR_MODULE_INFO = fqn(AbstractLightPITServlet.class, "moduleInfo");
    2.24 @@ -79,6 +72,11 @@
    2.25      public static final String REQ_ATTR_MENU = fqn(AbstractLightPITServlet.class, "mainMenu");
    2.26  
    2.27      /**
    2.28 +     * Key for the request attribute containing the sub menu list.
    2.29 +     */
    2.30 +    public static final String REQ_ATTR_SUB_MENU = fqn(AbstractLightPITServlet.class, "subMenu");
    2.31 +
    2.32 +    /**
    2.33       * Key for the request attribute containing the full path information (servlet path + path info).
    2.34       */
    2.35      public static final String REQ_ATTR_PATH = fqn(AbstractLightPITServlet.class, "path");
     3.1 --- a/src/main/java/de/uapcore/lightpit/Functions.java	Wed May 13 18:55:05 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/Functions.java	Wed May 13 21:10:23 2020 +0200
     3.3 @@ -54,10 +54,6 @@
     3.4          return enforceExt(Constants.JSP_PATH_PREFIX + filename, ".jsp");
     3.5      }
     3.6  
     3.7 -    public static String jspfPath(String filename) {
     3.8 -        return enforceExt(Constants.JSPF_PATH_PREFIX + filename, ".jspf");
     3.9 -    }
    3.10 -
    3.11      public static String dynFragmentPath(String filename) {
    3.12          return enforceExt(Constants.DYN_FRAGMENT_PATH_PREFIX + filename, ".jsp");
    3.13      }
     4.1 --- a/src/main/java/de/uapcore/lightpit/MenuEntry.java	Wed May 13 18:55:05 2020 +0200
     4.2 +++ b/src/main/java/de/uapcore/lightpit/MenuEntry.java	Wed May 13 21:10:23 2020 +0200
     4.3 @@ -40,11 +40,6 @@
     4.4  public class MenuEntry implements Comparable<MenuEntry> {
     4.5  
     4.6      /**
     4.7 -     * Class name of the module for which this menu is built.
     4.8 -     */
     4.9 -    private final String moduleClassName;
    4.10 -
    4.11 -    /**
    4.12       * Resource key for the menu label.
    4.13       */
    4.14      private final ResourceKey resourceKey;
    4.15 @@ -59,17 +54,12 @@
    4.16       */
    4.17      private final int sequence;
    4.18  
    4.19 -    public MenuEntry(String moduleClassName, ResourceKey resourceKey, String pathName, int sequence) {
    4.20 -        this.moduleClassName = moduleClassName;
    4.21 +    public MenuEntry(ResourceKey resourceKey, String pathName, int sequence) {
    4.22          this.resourceKey = resourceKey;
    4.23          this.pathName = pathName;
    4.24          this.sequence = sequence;
    4.25      }
    4.26  
    4.27 -    public String getModuleClassName() {
    4.28 -        return moduleClassName;
    4.29 -    }
    4.30 -
    4.31      public ResourceKey getResourceKey() {
    4.32          return resourceKey;
    4.33      }
     5.1 --- a/src/main/java/de/uapcore/lightpit/ModuleManager.java	Wed May 13 18:55:05 2020 +0200
     5.2 +++ b/src/main/java/de/uapcore/lightpit/ModuleManager.java	Wed May 13 21:10:23 2020 +0200
     5.3 @@ -36,7 +36,10 @@
     5.4  import javax.servlet.ServletContextEvent;
     5.5  import javax.servlet.ServletContextListener;
     5.6  import javax.servlet.annotation.WebListener;
     5.7 -import java.util.*;
     5.8 +import java.util.ArrayList;
     5.9 +import java.util.Collections;
    5.10 +import java.util.List;
    5.11 +import java.util.Optional;
    5.12  
    5.13  /**
    5.14   * Scans registered servlets for LightPIT modules.
    5.15 @@ -55,7 +58,7 @@
    5.16      /**
    5.17       * Maps class names to module information.
    5.18       */
    5.19 -    private final Map<String, LightPITModule> registeredModules = new HashMap<>();
    5.20 +    private final List<LightPITModule> registeredModules = new ArrayList<>();
    5.21  
    5.22      /**
    5.23       * Contains the menu entries for the loaded modules.
    5.24 @@ -114,7 +117,7 @@
    5.25      private void handleServletRegistration(String name, Registration reg) {
    5.26          final Optional<LightPITModule> moduleInfo = getModuleInfo(reg);
    5.27          if (moduleInfo.isPresent()) {
    5.28 -            registeredModules.put(reg.getClassName(), moduleInfo.get());
    5.29 +            registeredModules.add(moduleInfo.get());
    5.30              LOG.info("Module detected: {}", name);
    5.31          } else {
    5.32              LOG.debug("Servlet {} is no module, skipping.", name);
    5.33 @@ -145,16 +148,15 @@
    5.34       */
    5.35      private void createMainMenu() {
    5.36          mainMenu.clear();
    5.37 -        registeredModules.entrySet()
    5.38 +        registeredModules
    5.39                  .stream()
    5.40 -                .filter(mod -> !mod.getValue().systemModule())
    5.41 +                .filter(mod -> !mod.systemModule())
    5.42                  .map(mod -> new MenuEntry(
    5.43 -                        mod.getKey(),
    5.44                          new ResourceKey(
    5.45 -                                mod.getValue().bundleBaseName(),
    5.46 -                                mod.getValue().menuKey()),
    5.47 -                        mod.getValue().modulePath(),
    5.48 -                        mod.getValue().defaultPriority()))
    5.49 +                                mod.bundleBaseName(),
    5.50 +                                mod.menuKey()),
    5.51 +                        mod.modulePath(),
    5.52 +                        mod.defaultPriority()))
    5.53                  .sorted()
    5.54                  .forEachOrdered(mainMenu::add);
    5.55      }
     6.1 --- a/src/main/java/de/uapcore/lightpit/RequestMapping.java	Wed May 13 18:55:05 2020 +0200
     6.2 +++ b/src/main/java/de/uapcore/lightpit/RequestMapping.java	Wed May 13 21:10:23 2020 +0200
     6.3 @@ -62,11 +62,19 @@
     6.4      String requestPath() default "";
     6.5  
     6.6      /**
     6.7 -     * Returns the properties key for the (sub) menu label.
     6.8 +     * Specifies the properties key for the sub menu label.
     6.9 +     * An empty string (default) means that no sub menu entry shall be created.
    6.10       * <p>
    6.11       * This should only be used for {@link HttpMethod#GET} requests.
    6.12       *
    6.13       * @return the properties key
    6.14       */
    6.15      String menuKey() default "";
    6.16 +
    6.17 +    /**
    6.18 +     * May be changed to control the ordering of menu items.
    6.19 +     *
    6.20 +     * @return an integer to control the ordering
    6.21 +     */
    6.22 +    int menuSequence() default 0;
    6.23  }
     7.1 --- a/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Wed May 13 18:55:05 2020 +0200
     7.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ErrorModule.java	Wed May 13 21:10:23 2020 +0200
     7.3 @@ -59,17 +59,17 @@
     7.4          return ResponseType.HTML;
     7.5      }
     7.6  
     7.7 -    @RequestMapping(requestPath = "404", method = HttpMethod.GET)
     7.8 +    @RequestMapping(requestPath = "404.html", method = HttpMethod.GET)
     7.9      public ResponseType handle404(HttpServletRequest req) {
    7.10          return handle(req, 404);
    7.11      }
    7.12  
    7.13 -    @RequestMapping(requestPath = "403", method = HttpMethod.GET)
    7.14 +    @RequestMapping(requestPath = "403.html", method = HttpMethod.GET)
    7.15      public ResponseType handle403(HttpServletRequest req) {
    7.16          return handle(req, 403);
    7.17      }
    7.18  
    7.19 -    @RequestMapping(requestPath = "500", method = HttpMethod.GET)
    7.20 +    @RequestMapping(requestPath = "500.html", method = HttpMethod.GET)
    7.21      public ResponseType handle500(HttpServletRequest req) {
    7.22          return handle(req, 500);
    7.23      }
     8.1 --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Wed May 13 18:55:05 2020 +0200
     8.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Wed May 13 21:10:23 2020 +0200
     8.3 @@ -47,7 +47,13 @@
     8.4  public final class ProjectsModule extends AbstractLightPITServlet {
     8.5  
     8.6      @RequestMapping(method = HttpMethod.GET)
     8.7 -    public ResponseType handle(HttpServletRequest req, DataAccessObjects dao) {
     8.8 +    public ResponseType index(HttpServletRequest req, DataAccessObjects dao) {
     8.9 +
    8.10 +        return ResponseType.HTML;
    8.11 +    }
    8.12 +
    8.13 +    @RequestMapping(method = HttpMethod.GET, requestPath = "versions", menuKey = "menu.versions")
    8.14 +    public ResponseType versions(HttpServletRequest req, DataAccessObjects dao) {
    8.15  
    8.16          return ResponseType.HTML;
    8.17      }
     9.1 --- a/src/main/java/de/uapcore/lightpit/modules/VersionsModule.java	Wed May 13 18:55:05 2020 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,53 +0,0 @@
     9.4 -/*
     9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 - *
     9.7 - * Copyright 2018 Mike Becker. All rights reserved.
     9.8 - *
     9.9 - * Redistribution and use in source and binary forms, with or without
    9.10 - * modification, are permitted provided that the following conditions are met:
    9.11 - *
    9.12 - *   1. Redistributions of source code must retain the above copyright
    9.13 - *      notice, this list of conditions and the following disclaimer.
    9.14 - *
    9.15 - *   2. Redistributions in binary form must reproduce the above copyright
    9.16 - *      notice, this list of conditions and the following disclaimer in the
    9.17 - *      documentation and/or other materials provided with the distribution.
    9.18 - *
    9.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    9.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    9.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    9.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    9.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    9.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    9.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    9.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    9.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    9.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    9.29 - * POSSIBILITY OF SUCH DAMAGE.
    9.30 - *
    9.31 - */
    9.32 -package de.uapcore.lightpit.modules;
    9.33 -
    9.34 -import de.uapcore.lightpit.*;
    9.35 -import de.uapcore.lightpit.dao.DataAccessObjects;
    9.36 -
    9.37 -import javax.servlet.annotation.WebServlet;
    9.38 -import javax.servlet.http.HttpServletRequest;
    9.39 -
    9.40 -
    9.41 -@LightPITModule(
    9.42 -        bundleBaseName = "localization.versions",
    9.43 -        modulePath = "versions",
    9.44 -        defaultPriority = 50
    9.45 -)
    9.46 -@WebServlet(
    9.47 -        name = "VersionsModule",
    9.48 -        urlPatterns = "/versions/*"
    9.49 -)
    9.50 -public final class VersionsModule extends AbstractLightPITServlet {
    9.51 -    @RequestMapping(method = HttpMethod.GET)
    9.52 -    public ResponseType handle(HttpServletRequest req, DataAccessObjects dao) {
    9.53 -
    9.54 -        return ResponseType.HTML;
    9.55 -    }
    9.56 -}
    10.1 --- a/src/main/resources/localization/projects.properties	Wed May 13 18:55:05 2020 +0200
    10.2 +++ b/src/main/resources/localization/projects.properties	Wed May 13 21:10:23 2020 +0200
    10.3 @@ -23,3 +23,4 @@
    10.4  name=Project Management
    10.5  description=Allows the configuration of projects.
    10.6  menuLabel=Projects
    10.7 +menu.versions=Versions
    11.1 --- a/src/main/resources/localization/projects_de.properties	Wed May 13 18:55:05 2020 +0200
    11.2 +++ b/src/main/resources/localization/projects_de.properties	Wed May 13 21:10:23 2020 +0200
    11.3 @@ -23,3 +23,4 @@
    11.4  name=Projektverwaltung
    11.5  description=Erlaubt die Konfiguration von Projekten.
    11.6  menuLabel=Projekte
    11.7 +menu.versions=Versionen
    11.8 \ No newline at end of file
    12.1 --- a/src/main/resources/localization/versions.properties	Wed May 13 18:55:05 2020 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,26 +0,0 @@
    12.4 -# Copyright 2018 Mike Becker. All rights reserved.
    12.5 -#
    12.6 -# Redistribution and use in source and binary forms, with or without
    12.7 -# modification, are permitted provided that the following conditions are met:
    12.8 -#
    12.9 -# 1. Redistributions of source code must retain the above copyright
   12.10 -# notice, this list of conditions and the following disclaimer.
   12.11 -#
   12.12 -# 2. Redistributions in binary form must reproduce the above copyright
   12.13 -# notice, this list of conditions and the following disclaimer in the
   12.14 -# documentation and/or other materials provided with the distribution.
   12.15 -#
   12.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   12.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   12.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   12.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   12.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   12.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   12.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   12.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   12.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   12.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   12.26 -
   12.27 -name = Version Management
   12.28 -description = Allows the configuration of versions and milestones within your project.
   12.29 -menuLabel = Versions
    13.1 --- a/src/main/resources/localization/versions_de.properties	Wed May 13 18:55:05 2020 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,26 +0,0 @@
    13.4 -# Copyright 2018 Mike Becker. All rights reserved.
    13.5 -#
    13.6 -# Redistribution and use in source and binary forms, with or without
    13.7 -# modification, are permitted provided that the following conditions are met:
    13.8 -#
    13.9 -# 1. Redistributions of source code must retain the above copyright
   13.10 -# notice, this list of conditions and the following disclaimer.
   13.11 -#
   13.12 -# 2. Redistributions in binary form must reproduce the above copyright
   13.13 -# notice, this list of conditions and the following disclaimer in the
   13.14 -# documentation and/or other materials provided with the distribution.
   13.15 -#
   13.16 -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   13.17 -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   13.18 -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   13.19 -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   13.20 -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   13.21 -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   13.22 -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   13.23 -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   13.24 -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   13.25 -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
   13.26 -
   13.27 -name = Versionsverwaltung
   13.28 -description = Erlaubt die Konfiguration von Versionen und Meilensteinen im Projekt.
   13.29 -menuLabel = Versionen
    14.1 --- a/src/main/webapp/WEB-INF/jsp/site.jsp	Wed May 13 18:55:05 2020 +0200
    14.2 +++ b/src/main/webapp/WEB-INF/jsp/site.jsp	Wed May 13 21:10:23 2020 +0200
    14.3 @@ -30,9 +30,15 @@
    14.4  <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    14.5  <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    14.6  
    14.7 +<%-- Define an alias for the request path --%>
    14.8 +<c:set scope="page" var="requestPath" value="${requestScope[Constants.REQ_ATTR_PATH]}"/>
    14.9 +
   14.10  <%-- Define an alias for the main menu --%>
   14.11  <c:set scope="page" var="mainMenu" value="${requestScope[Constants.REQ_ATTR_MENU]}"/>
   14.12  
   14.13 +<%-- Define an alias for the sub menu --%>
   14.14 +<c:set scope="page" var="subMenu" value="${requestScope[Constants.REQ_ATTR_SUB_MENU]}"/>
   14.15 +
   14.16  <%-- Define an alias for the fragment name --%>
   14.17  <c:set scope="page" var="fragment" value="${requestScope[Constants.REQ_ATTR_FRAGMENT]}"/>
   14.18  
   14.19 @@ -65,22 +71,16 @@
   14.20      <body>
   14.21          <div id="mainMenu">
   14.22              <c:forEach var="menu" items="${mainMenu}">
   14.23 -                <div class="menuEntry"
   14.24 -                     <c:if test="${requestScope[Constants.REQ_ATTR_MODULE_CLASSNAME] eq menu.moduleClassName}">
   14.25 -                         data-active
   14.26 -                     </c:if>
   14.27 -                >
   14.28 -                    <a href="${menu.pathName}">
   14.29 -                    <fmt:bundle basename="${menu.resourceKey.bundle}">
   14.30 -                        <fmt:message key="${menu.resourceKey.key}" />
   14.31 -                    </fmt:bundle>
   14.32 -                    </a>
   14.33 -                </div>
   14.34 +                <%@ include file="../jspf/menu-entry.jspf" %>
   14.35              </c:forEach>
   14.36          </div>
   14.37 -        <div id="subMenu">
   14.38 -            
   14.39 -        </div>
   14.40 +        <c:if test="${not empty subMenu}">
   14.41 +            <div id="subMenu">
   14.42 +                <c:forEach var="menu" items="${subMenu}">
   14.43 +                    <%@ include file="../jspf/menu-entry.jspf" %>
   14.44 +                </c:forEach>
   14.45 +            </div>
   14.46 +        </c:if>
   14.47          <div id="content-area">
   14.48              <c:if test="${not empty fragment}">
   14.49                  <fmt:setBundle scope="request" basename="${moduleInfo.bundleBaseName}"/>
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/main/webapp/WEB-INF/jspf/menu-entry.jspf	Wed May 13 21:10:23 2020 +0200
    15.3 @@ -0,0 +1,38 @@
    15.4 +<%--
    15.5 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 +
    15.7 +Copyright 2018 Mike Becker. All rights reserved.
    15.8 +
    15.9 +Redistribution and use in source and binary forms, with or without
   15.10 +modification, are permitted provided that the following conditions are met:
   15.11 +
   15.12 +1. Redistributions of source code must retain the above copyright
   15.13 +notice, this list of conditions and the following disclaimer.
   15.14 +
   15.15 +2. Redistributions in binary form must reproduce the above copyright
   15.16 +notice, this list of conditions and the following disclaimer in the
   15.17 +documentation and/or other materials provided with the distribution.
   15.18 +
   15.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   15.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   15.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   15.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   15.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   15.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   15.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   15.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   15.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   15.29 +--%>
   15.30 +<div class="menuEntry"
   15.31 +        <c:set var="menuPath" value="/${menu.pathName}"/>
   15.32 +        <c:if test="${fn:startsWith(requestPath, menuPath)}">
   15.33 +            data-active
   15.34 +        </c:if>
   15.35 +>
   15.36 +    <a href="${menu.pathName}/">
   15.37 +        <fmt:bundle basename="${menu.resourceKey.bundle}">
   15.38 +            <fmt:message key="${menu.resourceKey.key}"/>
   15.39 +        </fmt:bundle>
   15.40 +    </a>
   15.41 +</div>
   15.42 \ No newline at end of file
    16.1 --- a/src/main/webapp/WEB-INF/web.xml	Wed May 13 18:55:05 2020 +0200
    16.2 +++ b/src/main/webapp/WEB-INF/web.xml	Wed May 13 21:10:23 2020 +0200
    16.3 @@ -11,14 +11,14 @@
    16.4      </context-param>
    16.5      <error-page>
    16.6          <error-code>404</error-code>
    16.7 -        <location>/error/404</location>
    16.8 +        <location>/error/404.html</location>
    16.9      </error-page>
   16.10      <error-page>
   16.11          <error-code>403</error-code>
   16.12 -        <location>/error/403</location>
   16.13 +        <location>/error/403.html</location>
   16.14      </error-page>
   16.15      <error-page>
   16.16          <error-code>500</error-code>
   16.17 -        <location>/error/500</location>
   16.18 +        <location>/error/500.html</location>
   16.19      </error-page>
   16.20  </web-app>
    17.1 --- a/src/main/webapp/index.jsp	Wed May 13 18:55:05 2020 +0200
    17.2 +++ b/src/main/webapp/index.jsp	Wed May 13 21:10:23 2020 +0200
    17.3 @@ -27,6 +27,6 @@
    17.4  <%@page import="de.uapcore.lightpit.Functions" %>
    17.5  <%@page import="de.uapcore.lightpit.modules.HomeModule" %>
    17.6  <%
    17.7 -response.setStatus(response.SC_MOVED_TEMPORARILY);
    17.8 -response.setHeader("Location", "./"+Functions.modulePathOf(HomeModule.class));
    17.9 +    response.setStatus(response.SC_MOVED_TEMPORARILY);
   17.10 +    response.setHeader("Location", Functions.modulePathOf(HomeModule.class));
   17.11  %>
    18.1 --- a/src/main/webapp/lightpit.css	Wed May 13 18:55:05 2020 +0200
    18.2 +++ b/src/main/webapp/lightpit.css	Wed May 13 21:10:23 2020 +0200
    18.3 @@ -51,21 +51,22 @@
    18.4      text-decoration: none;
    18.5  }
    18.6  
    18.7 -#mainMenu {
    18.8 +#mainMenu, #subMenu {
    18.9      width: 100%;
   18.10      display: flex;
   18.11      flex-flow: row wrap;
   18.12 -    background: #f0f0f5;
   18.13 +    border-image-source: linear-gradient(to right, #606060, rgba(60, 60, 60, .25));
   18.14 +    border-image-slice: 1;
   18.15 +    border-bottom-style: solid;
   18.16 +    border-bottom-width: 1pt;
   18.17 +}
   18.18 +
   18.19 +#mainMenu {
   18.20 +    background: #e0e0e5;
   18.21  }
   18.22  
   18.23  #subMenu {
   18.24      background: #f7f7ff;
   18.25 -    border-image-source: linear-gradient(to right, #606060, rgba(60, 60, 60, .25));
   18.26 -    border-image-slice: 1;
   18.27 -    border-top-style: solid;
   18.28 -    border-top-width: 1pt;
   18.29 -    border-bottom-style: solid;
   18.30 -    border-bottom-width: 1pt;
   18.31  }
   18.32  
   18.33  .menuEntry {
   18.34 @@ -76,7 +77,7 @@
   18.35  }
   18.36  
   18.37  #mainMenu .menuEntry[data-active] {
   18.38 -    background: #e0e0e5;
   18.39 +    background: #d0d0d5;
   18.40  }
   18.41  
   18.42  #subMenu .menuEntry[data-active] {

mercurial