Sun, 08 Apr 2018 15:34:11 +0200
Module names and descriptions + some more styling
1.1 --- a/src/java/de/uapcore/lightpit/entities/Module.java Sun Apr 08 14:41:10 2018 +0200 1.2 +++ b/src/java/de/uapcore/lightpit/entities/Module.java Sun Apr 08 15:34:11 2018 +0200 1.3 @@ -30,7 +30,7 @@ 1.4 1.5 import de.uapcore.lightpit.LightPITModule; 1.6 1.7 -public class Module { 1.8 +public final class Module { 1.9 private int modID; 1.10 private String classname; 1.11 private boolean visible;
2.1 --- a/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 14:41:10 2018 +0200 2.2 +++ b/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 15:34:11 2018 +0200 2.3 @@ -43,6 +43,19 @@ 2.4 public abstract class ModuleDao { 2.5 2.6 /** 2.7 + * Maps database columns to POJO fields. 2.8 + * @param result the database result set 2.9 + * @param mod the POJO 2.10 + * @throws SQLException 2.11 + */ 2.12 + protected void mapColumns(ResultSet result, Module mod) throws SQLException { 2.13 + mod.setModID(result.getInt("modid")); 2.14 + mod.setClassname(result.getString("classname")); 2.15 + mod.setVisible(result.getBoolean("visible")); 2.16 + } 2.17 + 2.18 + 2.19 + /** 2.20 * Must return a prepared statement for a single object query with the specified properties. 2.21 * 2.22 * <ul> 2.23 @@ -136,9 +149,7 @@ 2.24 ResultSet result = stmt.executeQuery("SELECT * FROM lpitcore_module")) { 2.25 while (result.next()) { 2.26 final Module mod = new Module(); 2.27 - mod.setModID(result.getInt("modid")); 2.28 - mod.setClassname(result.getString("classname")); 2.29 - mod.setVisible(result.getBoolean("visible")); 2.30 + mapColumns(result, mod); 2.31 list.add(mod); 2.32 } 2.33 }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/java/de/uapcore/lightpit/entities/User.java Sun Apr 08 15:34:11 2018 +0200 3.3 @@ -0,0 +1,92 @@ 3.4 +/* 3.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3.6 + * 3.7 + * Copyright 2018 Mike Becker. All rights reserved. 3.8 + * 3.9 + * Redistribution and use in source and binary forms, with or without 3.10 + * modification, are permitted provided that the following conditions are met: 3.11 + * 3.12 + * 1. Redistributions of source code must retain the above copyright 3.13 + * notice, this list of conditions and the following disclaimer. 3.14 + * 3.15 + * 2. Redistributions in binary form must reproduce the above copyright 3.16 + * notice, this list of conditions and the following disclaimer in the 3.17 + * documentation and/or other materials provided with the distribution. 3.18 + * 3.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 3.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 3.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 3.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3.29 + * POSSIBILITY OF SUCH DAMAGE. 3.30 + * 3.31 + */ 3.32 +package de.uapcore.lightpit.entities; 3.33 + 3.34 +import java.util.Optional; 3.35 + 3.36 +public final class User { 3.37 + 3.38 + public static final int ANONYMOUS_USERID = -1; 3.39 + 3.40 + private int userID; 3.41 + private String username; 3.42 + private Optional<String> givenname; 3.43 + private Optional<String> lastname; 3.44 + 3.45 + public int getUserID() { 3.46 + return userID; 3.47 + } 3.48 + 3.49 + public void setUserID(int userID) { 3.50 + this.userID = userID; 3.51 + } 3.52 + 3.53 + public String getUsername() { 3.54 + return username; 3.55 + } 3.56 + 3.57 + public void setUsername(String username) { 3.58 + this.username = username; 3.59 + } 3.60 + 3.61 + public Optional<String> getGivenname() { 3.62 + return givenname; 3.63 + } 3.64 + 3.65 + public void setGivenname(Optional<String> givenname) { 3.66 + this.givenname = givenname; 3.67 + } 3.68 + 3.69 + public Optional<String> getLastname() { 3.70 + return lastname; 3.71 + } 3.72 + 3.73 + public void setLastname(Optional<String> lastname) { 3.74 + this.lastname = lastname; 3.75 + } 3.76 + 3.77 + @Override 3.78 + public int hashCode() { 3.79 + int hash = 3; 3.80 + hash = 41 * hash + this.userID; 3.81 + return hash; 3.82 + } 3.83 + 3.84 + @Override 3.85 + public boolean equals(Object obj) { 3.86 + if (this == obj) { 3.87 + return true; 3.88 + } 3.89 + if (obj == null || getClass() != obj.getClass()) { 3.90 + return false; 3.91 + } else { 3.92 + return this.userID == ((User) obj).userID; 3.93 + } 3.94 + } 3.95 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/src/java/de/uapcore/lightpit/entities/UserDao.java Sun Apr 08 15:34:11 2018 +0200 4.3 @@ -0,0 +1,77 @@ 4.4 +/* 4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 4.6 + * 4.7 + * Copyright 2018 Mike Becker. All rights reserved. 4.8 + * 4.9 + * Redistribution and use in source and binary forms, with or without 4.10 + * modification, are permitted provided that the following conditions are met: 4.11 + * 4.12 + * 1. Redistributions of source code must retain the above copyright 4.13 + * notice, this list of conditions and the following disclaimer. 4.14 + * 4.15 + * 2. Redistributions in binary form must reproduce the above copyright 4.16 + * notice, this list of conditions and the following disclaimer in the 4.17 + * documentation and/or other materials provided with the distribution. 4.18 + * 4.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 4.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 4.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 4.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 4.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 4.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 4.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 4.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4.29 + * POSSIBILITY OF SUCH DAMAGE. 4.30 + * 4.31 + */ 4.32 +package de.uapcore.lightpit.entities; 4.33 + 4.34 +import java.sql.Connection; 4.35 +import java.sql.ResultSet; 4.36 +import java.sql.SQLException; 4.37 +import java.sql.Statement; 4.38 +import java.util.ArrayList; 4.39 +import java.util.List; 4.40 +import java.util.Optional; 4.41 + 4.42 +public abstract class UserDao { 4.43 + 4.44 + /** 4.45 + * Maps SQL columns to POJO fields. 4.46 + * @param result the database result set 4.47 + * @param user the POJO 4.48 + * @throws SQLException 4.49 + */ 4.50 + protected void mapColumns(ResultSet result, User user) throws SQLException { 4.51 + user.setUserID(result.getInt("userid")); 4.52 + user.setUsername(result.getString("username")); 4.53 + user.setGivenname(Optional.ofNullable(result.getString("givenname"))); 4.54 + user.setLastname(Optional.ofNullable(result.getString("lastname"))); 4.55 + } 4.56 + 4.57 + /** 4.58 + * Returns a list of all users ordered by their username. 4.59 + * 4.60 + * Does not return reserved system users with negative user IDs. 4.61 + * 4.62 + * @param conn the connection to use 4.63 + * @return a list of all users 4.64 + * @throws SQLException 4.65 + */ 4.66 + public List<User> listAll(Connection conn) throws SQLException { 4.67 + List<User> list = new ArrayList<>(); 4.68 + try ( 4.69 + Statement stmt = conn.createStatement(); 4.70 + ResultSet result = stmt.executeQuery( 4.71 + "SELECT * FROM lpitcore_user WHERE userid >= 0 ORDER BY username")) { 4.72 + while (result.next()) { 4.73 + final User user = new User(); 4.74 + mapColumns(result, user); 4.75 + list.add(user); 4.76 + } 4.77 + } 4.78 + return list; 4.79 + } 4.80 +}
5.1 --- a/src/java/de/uapcore/lightpit/resources/localization/home.properties Sun Apr 08 14:41:10 2018 +0200 5.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/home.properties Sun Apr 08 15:34:11 2018 +0200 5.3 @@ -21,4 +21,6 @@ 5.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5.6 5.7 +name = Home Page 5.8 +description = The default page that is displayed when visiting the site. 5.9 menuLabel = Home
6.1 --- a/src/java/de/uapcore/lightpit/resources/localization/home_de.properties Sun Apr 08 14:41:10 2018 +0200 6.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/home_de.properties Sun Apr 08 15:34:11 2018 +0200 6.3 @@ -21,4 +21,6 @@ 6.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 6.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 6.6 6.7 +name = Startseite 6.8 +description = Die Seite, die dem Benutzer standardm\u00e4\u00dfig beim Besuch angezeigt wird. 6.9 menuLabel = Startseite
7.1 --- a/src/java/de/uapcore/lightpit/resources/localization/language.properties Sun Apr 08 14:41:10 2018 +0200 7.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/language.properties Sun Apr 08 15:34:11 2018 +0200 7.3 @@ -21,7 +21,10 @@ 7.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 7.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 7.6 7.7 +name = Language Selector 7.8 +description = Where the user can choose his / her language setting. 7.9 menuLabel = Languages 7.10 + 7.11 submit = Switch language 7.12 browserLanguage = Browser language 7.13 browserLanguageNotAvailable = Browser language not available.
8.1 --- a/src/java/de/uapcore/lightpit/resources/localization/language_de.properties Sun Apr 08 14:41:10 2018 +0200 8.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/language_de.properties Sun Apr 08 15:34:11 2018 +0200 8.3 @@ -21,7 +21,11 @@ 8.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 8.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 8.6 8.7 +name = Sprachauswahl 8.8 +description = Hier kann der Benutzer die Sprache f\u00fcr die Website ausw\u00e4hlen. 8.9 + 8.10 menuLabel = Sprache 8.11 + 8.12 submit = Sprache ausw\u00e4hlen 8.13 browserLanguage = Browsersprache 8.14 browserLanguageNotAvailable = Browsersprache nicht verf\u00fcgbar.
9.1 --- a/src/java/de/uapcore/lightpit/resources/localization/modmgmt.properties Sun Apr 08 14:41:10 2018 +0200 9.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/modmgmt.properties Sun Apr 08 15:34:11 2018 +0200 9.3 @@ -21,4 +21,16 @@ 9.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 9.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9.6 9.7 +name = Module Management 9.8 +description = Configure the visible LightPIT modules and the required access powers. 9.9 menuLabel = Modules 9.10 + 9.11 +section.modlist.title = List of Modules 9.12 + 9.13 +caption.module = Module 9.14 +caption.path = Path 9.15 +caption.desc = Description 9.16 +caption.active = Active 9.17 +caption.class = Class 9.18 +caption.bundle = Resource Bundle 9.19 +
10.1 --- a/src/java/de/uapcore/lightpit/resources/localization/modmgmt_de.properties Sun Apr 08 14:41:10 2018 +0200 10.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/modmgmt_de.properties Sun Apr 08 15:34:11 2018 +0200 10.3 @@ -21,4 +21,15 @@ 10.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 10.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10.6 10.7 +name = Modulverwaltung 10.8 +description = Konfiguration der sichtbaren LightPIT Module und deren Zugriffsrechte. 10.9 menuLabel = Module 10.10 + 10.11 +section.modlist.title = Liste der Module 10.12 + 10.13 +caption.module = Modul 10.14 +caption.path = Pfad 10.15 +caption.desc = Beschreibung 10.16 +caption.active = Aktiv 10.17 +caption.class = Klasse 10.18 +caption.bundle = Ressourcen-Datei
11.1 --- a/src/java/de/uapcore/lightpit/resources/localization/versions.properties Sun Apr 08 14:41:10 2018 +0200 11.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/versions.properties Sun Apr 08 15:34:11 2018 +0200 11.3 @@ -21,4 +21,6 @@ 11.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 11.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 11.6 11.7 +name = Version Management 11.8 +description = Allows the configuration of versions and milestones within your project. 11.9 menuLabel = Versions
12.1 --- a/src/java/de/uapcore/lightpit/resources/localization/versions_de.properties Sun Apr 08 14:41:10 2018 +0200 12.2 +++ b/src/java/de/uapcore/lightpit/resources/localization/versions_de.properties Sun Apr 08 15:34:11 2018 +0200 12.3 @@ -21,4 +21,6 @@ 12.4 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 12.5 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12.6 12.7 +name = Versionsverwaltung 12.8 +description = Erlaubt die Konfiguration von Versionen und Meilensteinen im Projekt. 12.9 menuLabel = Versionen
13.1 --- a/web/WEB-INF/dynamic_fragments/modules.jsp Sun Apr 08 14:41:10 2018 +0200 13.2 +++ b/web/WEB-INF/dynamic_fragments/modules.jsp Sun Apr 08 15:34:11 2018 +0200 13.3 @@ -29,24 +29,26 @@ 13.4 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 13.5 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 13.6 13.7 -<%-- TODO: a lot of work --%> 13.8 -<table> 13.9 +<h2><fmt:message key="section.modlist.title"/></h2> 13.10 +<table class="datatable"> 13.11 <tr> 13.12 - <th>Module</th> 13.13 - <th>Path</th> 13.14 - <th>Description</th> 13.15 - <th>Active</th> 13.16 - <th>Class</th> 13.17 - <th>Resource Bundle</th> 13.18 + <th class="hcenter"><fmt:message key="caption.active" /></th> 13.19 + <th><fmt:message key="caption.module" /></th> 13.20 + <th><fmt:message key="caption.path" /></th> 13.21 + <th><fmt:message key="caption.desc" /></th> 13.22 + <th><fmt:message key="caption.class" /></th> 13.23 + <th><fmt:message key="caption.bundle" /></th> 13.24 </tr> 13.25 <c:forEach items="${modules}" var="module"> 13.26 <tr> 13.27 - <td>${module.annotatedInfos.nameKey}</td> 13.28 - <td>${module.annotatedInfos.modulePath}</td> 13.29 - <td>${module.annotatedInfos.descKey}</td> 13.30 - <td align="center">${module.visible}</td> 13.31 - <td>${module.classname}</td> 13.32 - <td>${module.annotatedInfos.bundleBaseName}</td> 13.33 + <td class="hcenter">${module.visible}</td> 13.34 + <fmt:bundle basename="${module.annotatedInfos.bundleBaseName}"> 13.35 + <td class="nowrap"><fmt:message key="${module.annotatedInfos.nameKey}" /></td> 13.36 + <td>/${module.annotatedInfos.modulePath}</td> 13.37 + <td><fmt:message key="${module.annotatedInfos.descKey}" /></td> 13.38 + <td class="smalltext">${module.classname}</td> 13.39 + <td class="smalltext">${module.annotatedInfos.bundleBaseName}</td> 13.40 + </fmt:bundle> 13.41 </tr> 13.42 </c:forEach> 13.43 </table> 13.44 \ No newline at end of file
14.1 --- a/web/lightpit.css Sun Apr 08 14:41:10 2018 +0200 14.2 +++ b/web/lightpit.css Sun Apr 08 15:34:11 2018 +0200 14.3 @@ -33,7 +33,7 @@ 14.4 14.5 body { 14.6 background: white; 14.7 - font-family: sans-serif; 14.8 + font-family: serif; 14.9 14.10 border-color: #505050; 14.11 border-style: solid; 14.12 @@ -42,6 +42,10 @@ 14.13 color: #1c202e; 14.14 } 14.15 14.16 +h1, h2, h3, h4, #mainMenu, #subMenu { 14.17 + font-family: sans-serif; 14.18 +} 14.19 + 14.20 a { 14.21 color: #3060f8; 14.22 text-decoration: none; 14.23 @@ -52,7 +56,7 @@ 14.24 display: flex; 14.25 flex-flow: row wrap; 14.26 background: #f0f0f5; 14.27 - font-size: large; 14.28 + font-size: larger; 14.29 } 14.30 14.31 #subMenu { 14.32 @@ -82,26 +86,42 @@ 14.33 padding: 1em; 14.34 } 14.35 14.36 -table { 14.37 +th { 14.38 + text-align: left; 14.39 +} 14.40 + 14.41 +table.datatable { 14.42 + width: 100%; 14.43 border-style: solid; 14.44 border-width: 1pt; 14.45 border-color: black; 14.46 border-collapse: collapse; 14.47 } 14.48 14.49 -th { 14.50 - text-align: left; 14.51 +table.datatable th { 14.52 font-weight: bold; 14.53 background: lightsteelblue; 14.54 } 14.55 14.56 -th, td { 14.57 +table.datatable th, table.datatable td { 14.58 border-style: solid; 14.59 border-width: 1pt; 14.60 border-color: black; 14.61 padding: .4em; 14.62 } 14.63 14.64 -tr:nth-child(2n) { 14.65 +table.datatable tr:nth-child(2n) { 14.66 background: lightblue; 14.67 } 14.68 + 14.69 +.hcenter { 14.70 + text-align: center; 14.71 +} 14.72 + 14.73 +.smalltext { 14.74 + font-size: smaller; 14.75 +} 14.76 + 14.77 +.nowrap { 14.78 + white-space: nowrap; 14.79 +} 14.80 \ No newline at end of file