adds the possibility to add users / developers

Sat, 16 May 2020 13:29:44 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 16 May 2020 13:29:44 +0200
changeset 51
dd0a45ae25d7
parent 50
2a90d105edec
child 52
67a02e79b7a1

adds the possibility to add users / developers

setup/postgres/psql_default_data.sql file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/LightPITModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/postgres/PGProjectDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/User.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/UsersModule.java file | annotate | diff | comparison | revisions
src/main/resources/localization/home.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/home_de.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/language.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/language_de.properties 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/users.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/users_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/user-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/users.jsp file | annotate | diff | comparison | revisions
src/main/webapp/lightpit.css file | annotate | diff | comparison | revisions
--- a/setup/postgres/psql_default_data.sql	Sat May 16 11:37:57 2020 +0200
+++ b/setup/postgres/psql_default_data.sql	Sat May 16 13:29:44 2020 +0200
@@ -1,6 +0,0 @@
-/*
- * Some default data.
- */
-
-insert into lpit_user (userid, username)
-values (-1, 'Anonymous');
--- a/src/main/java/de/uapcore/lightpit/LightPITModule.java	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/LightPITModule.java	Sat May 16 13:29:44 2020 +0200
@@ -68,21 +68,6 @@
     String modulePath();
 
     /**
-     * Returns the properties key for the module name.
-     *
-     * @return the properties key
-     */
-    String nameKey() default "name";
-
-    /**
-     * Returns the properties key for the module description.
-     *
-     * @return the properties key
-     */
-    String descKey() default "description";
-
-
-    /**
      * Returns the properties key for the menu label.
      * <p>
      * Set this string to empty string, if the module should be hidden from
@@ -126,15 +111,13 @@
      * are proxied by this object.
      */
     class ELProxy {
-        private final String bundleBaseName, modulePath, menuKey, titleKey, nameKey, descKey;
+        private final String bundleBaseName, modulePath, menuKey, titleKey;
 
         public ELProxy(LightPITModule annotation) {
             bundleBaseName = annotation.bundleBaseName();
             modulePath = annotation.modulePath();
             menuKey = annotation.menuKey();
             titleKey = annotation.titleKey();
-            nameKey = annotation.nameKey();
-            descKey = annotation.descKey();
         }
 
         public String getBundleBaseName() {
@@ -152,14 +135,5 @@
         public String getTitleKey() {
             return titleKey;
         }
-
-        public String getNameKey() {
-            return nameKey;
-        }
-
-        public String getDescKey() {
-            return descKey;
-        }
-
     }
 }
--- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGProjectDao.java	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGProjectDao.java	Sat May 16 13:29:44 2020 +0200
@@ -96,7 +96,7 @@
         insert.setString(1, instance.getName());
         setStringOrNull(insert, 2, instance.getDescription());
         setStringOrNull(insert, 3, instance.getRepoUrl());
-        setForeignKeyOrNull(insert, 4, instance.getOwner(), User::getUserID);
+        setForeignKeyOrNull(insert, 4, instance.getOwner(), User::getId);
         insert.executeUpdate();
     }
 
@@ -106,7 +106,7 @@
         update.setString(1, instance.getName());
         setStringOrNull(update, 2, instance.getDescription());
         setStringOrNull(update, 3, instance.getRepoUrl());
-        setForeignKeyOrNull(update, 4, instance.getOwner(), User::getUserID);
+        setForeignKeyOrNull(update, 4, instance.getOwner(), User::getId);
         update.setInt(5, instance.getId());
         return update.executeUpdate() > 0;
     }
--- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java	Sat May 16 13:29:44 2020 +0200
@@ -44,10 +44,6 @@
 
 public final class PGUserDao implements UserDao, GenericDao<User> {
 
-    public static final String[] COLUMNS = {
-            "id", "username", "lastname", "givenname", "mail"
-    };
-
     private final PreparedStatement insert, update, list, find;
 
     public PGUserDao(Connection connection) throws SQLException {
@@ -89,7 +85,7 @@
         setStringOrNull(update, 1, instance.getLastname());
         setStringOrNull(update, 2, instance.getGivenname());
         setStringOrNull(update, 3, instance.getMail());
-        update.setInt(4, instance.getUserID());
+        update.setInt(4, instance.getId());
         return update.executeUpdate() > 0;
     }
 
--- a/src/main/java/de/uapcore/lightpit/entities/User.java	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/entities/User.java	Sat May 16 13:29:44 2020 +0200
@@ -34,18 +34,18 @@
 
     public static final int ANONYMOUS_USERID = -1;
 
-    private final int userID;
+    private final int id;
     private String username;
     private String mail;
     private String givenname;
     private String lastname;
 
-    public User(int userID) {
-        this.userID = userID;
+    public User(int id) {
+        this.id = id;
     }
 
-    public int getUserID() {
-        return userID;
+    public int getId() {
+        return id;
     }
 
     public String getUsername() {
@@ -82,9 +82,11 @@
 
     public String getDisplayname() {
         StringBuilder dn = new StringBuilder();
-        dn.append(givenname);
+        if (givenname != null)
+            dn.append(givenname);
         dn.append(' ');
-        dn.append(lastname);
+        if (lastname != null)
+            dn.append(lastname);
         dn.append(' ');
         if (mail != null && !mail.isBlank()) {
             dn.append("<"+mail+">");
@@ -98,11 +100,11 @@
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
         User user = (User) o;
-        return userID == user.userID;
+        return id == user.id;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(userID);
+        return Objects.hash(id);
     }
 }
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat May 16 13:29:44 2020 +0200
@@ -52,16 +52,14 @@
 
     @RequestMapping(method = HttpMethod.GET)
     public ResponseType index(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
-        final var projectDao = dao.getProjectDao();
-
-        req.setAttribute("projects", projectDao.list());
+        req.setAttribute("projects", dao.getProjectDao().list());
         setDynamicFragment(req, "projects");
 
         return ResponseType.HTML;
     }
 
     @RequestMapping(requestPath = "edit", method = HttpMethod.GET)
-    public ResponseType displayCreateForm(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
+    public ResponseType edit(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
         final var projectDao = dao.getProjectDao();
 
         Optional<Integer> id = getParameter(req, Integer.class, "id");
@@ -70,6 +68,7 @@
         } else {
             req.setAttribute("project", new Project(-1));
         }
+        req.setAttribute("users", dao.getUserDao().list());
 
         setDynamicFragment(req, "project-form");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/uapcore/lightpit/modules/UsersModule.java	Sat May 16 13:29:44 2020 +0200
@@ -0,0 +1,101 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2018 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.
+ *
+ */
+package de.uapcore.lightpit.modules;
+
+
+import de.uapcore.lightpit.*;
+import de.uapcore.lightpit.dao.DataAccessObjects;
+import de.uapcore.lightpit.entities.User;
+
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServletRequest;
+import java.sql.SQLException;
+import java.util.Optional;
+
+@LightPITModule(
+        bundleBaseName = "localization.users",
+        modulePath = "teams",
+        defaultPriority = 100
+)
+@WebServlet(
+        name = "UsersModule",
+        urlPatterns = "/teams/*"
+)
+public final class UsersModule extends AbstractLightPITServlet {
+
+    @RequestMapping(method = HttpMethod.GET)
+    public ResponseType index(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
+        final var userDao = dao.getUserDao();
+
+        req.setAttribute("users", userDao.list());
+        setDynamicFragment(req, "users");
+
+        return ResponseType.HTML;
+    }
+
+    @RequestMapping(requestPath = "edit", method = HttpMethod.GET)
+    public ResponseType edit(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
+        final var userDao = dao.getUserDao();
+
+        Optional<Integer> id = getParameter(req, Integer.class, "id");
+        if (id.isPresent()) {
+            req.setAttribute("user", Optional.ofNullable(userDao.find(id.get())).orElse(new User(-1)));
+        } else {
+            req.setAttribute("user", new User(-1));
+        }
+
+        setDynamicFragment(req, "user-form");
+
+        return ResponseType.HTML;
+    }
+
+    @RequestMapping(requestPath = "commit", method = HttpMethod.POST)
+    public ResponseType commit(HttpServletRequest req, DataAccessObjects dao) {
+
+        User user = new User(-1);
+        try {
+            user = new User(getParameter(req, Integer.class, "userid").orElseThrow());
+            user.setUsername(getParameter(req, String.class, "username").orElseThrow());
+            getParameter(req, String.class, "givenname").ifPresent(user::setGivenname);
+            getParameter(req, String.class, "lastname").ifPresent(user::setLastname);
+            getParameter(req, String.class, "mail").ifPresent(user::setMail);
+
+            dao.getUserDao().saveOrUpdate(user);
+
+            setRedirectLocation(req, "./teams/");
+            setDynamicFragment(req, Constants.DYN_FRAGMENT_COMMIT_SUCCESSFUL);
+        } catch (NullPointerException | NumberFormatException | SQLException ex) {
+            // TODO: set request attribute with error text
+            req.setAttribute("user", user);
+            setDynamicFragment(req, "user-form");
+        }
+
+        return ResponseType.HTML;
+    }
+}
--- a/src/main/resources/localization/home.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/home.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,8 +21,6 @@
 # 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. 
 
-name = Home Page
-description = The default page that is displayed when visiting the site.
 menuLabel = Home
 
 version=LightPIT - Version 0.1 (Snapshot) 
\ No newline at end of file
--- a/src/main/resources/localization/home_de.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/home_de.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,8 +21,6 @@
 # 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. 
 
-name = Startseite
-description = Die Seite, die dem Benutzer standardm\u00e4\u00dfig beim Besuch angezeigt wird.
 menuLabel = Startseite
 
 version=LightPIT - Version 0.1 (Entwicklungsversion) 
--- a/src/main/resources/localization/language.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/language.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,8 +21,6 @@
 # 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. 
 
-name = Language Selector
-description=Where the user can choose his / her language setting.
 menuLabel=Language
 
 submit = Switch language
--- a/src/main/resources/localization/language_de.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/language_de.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,9 +21,6 @@
 # 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. 
 
-name = Sprachauswahl
-description = Hier kann der Benutzer die Sprache f\u00fcr die Website ausw\u00e4hlen.
-
 menuLabel = Sprache
 
 submit = Sprache ausw\u00e4hlen
--- a/src/main/resources/localization/projects.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/projects.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,8 +21,6 @@
 # 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.
 
-name=Project Management
-description=Allows the configuration of projects.
 menuLabel=Projects
 
 menu.versions=Versions
--- a/src/main/resources/localization/projects_de.properties	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/resources/localization/projects_de.properties	Sat May 16 13:29:44 2020 +0200
@@ -21,8 +21,6 @@
 # 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.
 
-name=Projektverwaltung
-description=Erlaubt die Konfiguration von Projekten.
 menuLabel=Projekte
 
 menu.versions=Versionen
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/localization/users.properties	Sat May 16 13:29:44 2020 +0200
@@ -0,0 +1,35 @@
+# Copyright 2018 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.
+
+menuLabel=Developer
+
+button.create=Add Developer
+
+no-users=No developers have been configured yet.
+
+thead.username=User Name
+thead.givenname=Given Name
+thead.lastname=Last Name
+thead.mail=E-Mail
+
+thead.displayname=Developer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/resources/localization/users_de.properties	Sat May 16 13:29:44 2020 +0200
@@ -0,0 +1,35 @@
+# Copyright 2018 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.
+
+menuLabel=Entwickler
+
+button.create=Neuer Entwickler
+
+no-users=Bislang wurden keine Entwickler hinterlegt.
+
+thead.username=Benutzername
+thead.givenname=Vorname
+thead.lastname=Nachname
+thead.mail=E-Mail
+
+thead.displayname=Entwickler
--- a/src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp	Sat May 16 13:29:44 2020 +0200
@@ -32,6 +32,7 @@
 <c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
 
 <jsp:useBean id="project" type="de.uapcore.lightpit.entities.Project" scope="request"/>
+<jsp:useBean id="users" type="java.util.List<de.uapcore.lightpit.entities.User>" scope="request"/>
 
 <form action="./${moduleInfo.modulePath}/commit" method="post">
     <table class="formtable" style="width: 80ch">
@@ -57,7 +58,9 @@
             <td>
                 <select name="owner">
                     <option value="-1"><fmt:message key="placeholder.null-owner" /> </option>
-                    <!-- TODO: add user selection -->
+                    <c:forEach var="user" items="${users}">
+                        <option value="${user.id}">${user.displayname}</option>
+                    </c:forEach>
                 </select>
             </td>
         </tr>
--- a/src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp	Sat May 16 13:29:44 2020 +0200
@@ -47,10 +47,10 @@
 <table class="datatable medskip">
     <colgroup>
         <col>
-        <col style="width: 15%">
+        <col style="width: 10%">
         <col style="width: 35%">
         <col style="width: 30%">
-        <col style="width: 20%">
+        <col style="width: 25%">
     </colgroup>
     <thead>
     <tr>
@@ -64,7 +64,7 @@
     <tbody>
     <c:forEach var="project" items="${projects}">
         <tr>
-            <td><a href="./${moduleInfo.modulePath}/edit?id=${project.id}">&#x270e;</a></td>
+            <td style="width: 2em;"><a href="./${moduleInfo.modulePath}/edit?id=${project.id}">&#x270e;</a></td>
             <td><c:out value="${project.name}"/></td>
             <td><c:out value="${project.description}"/></td>
             <td>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/user-form.jsp	Sat May 16 13:29:44 2020 +0200
@@ -0,0 +1,70 @@
+<%--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright 2018 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 pageEncoding="UTF-8" %>
+<%@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" %>
+
+<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
+
+<jsp:useBean id="user" type="de.uapcore.lightpit.entities.User" scope="request"/>
+
+<form action="./${moduleInfo.modulePath}/commit" method="post">
+    <table class="formtable" style="width: 35ch">
+        <colgroup>
+            <col>
+            <col style="width: 100%">
+        </colgroup>
+        <tbody>
+        <tr>
+            <th><fmt:message key="thead.username"/></th>
+            <td><input name="username" type="text" maxlength="50" required value="${user.username}" <c:if test="${user.id ge 0}">readonly</c:if> /> </td>
+        </tr>
+        <tr>
+            <th><fmt:message key="thead.givenname"/></th>
+            <td><input name="givenname" type="text" maxlength="50" value="${user.givenname}"/> </td>
+        </tr>
+        <tr>
+            <th><fmt:message key="thead.lastname"/></th>
+            <td><input name="lastname" type="text" maxlength="50" value="${user.lastname}"/> </td>
+        </tr>
+        <tr>
+            <th><fmt:message key="thead.mail"/></th>
+            <td><input name="mail" type="email" maxlength="50" value="${user.mail}"/> </td>
+        </tr>
+        </tbody>
+        <tfoot>
+        <tr>
+            <td colspan="2">
+                <input type="hidden" name="userid" value="${user.id}" />
+                <a href="./${moduleInfo.modulePath}" class="button"><fmt:message bundle="${lightpit_bundle}" key="button.cancel"/></a>
+                <button type="submit"><fmt:message bundle="${lightpit_bundle}" key="button.okay" /></button>
+            </td>
+        </tr>
+        </tfoot>
+    </table>
+</form>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/users.jsp	Sat May 16 13:29:44 2020 +0200
@@ -0,0 +1,63 @@
+<%--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright 2018 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 pageEncoding="UTF-8" %>
+<%@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" %>
+
+<c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
+
+<jsp:useBean id="users" type="java.util.List<de.uapcore.lightpit.entities.User>" scope="request"/>
+
+<c:if test="${empty users}">
+    <div class="info-box">
+        <fmt:message key="no-users" />
+    </div>
+</c:if>
+
+<div id="tool-area">
+    <a href="./${moduleInfo.modulePath}/edit" class="button"><fmt:message key="button.create" /></a>
+</div>
+
+<c:if test="${not empty users}">
+    <table class="datatable medskip" style="width: auto">
+        <thead>
+        <tr>
+            <th></th>
+            <th><fmt:message key="thead.displayname"/></th>
+        </tr>
+        </thead>
+        <tbody>
+        <c:forEach var="user" items="${users}">
+            <tr>
+                <td><a href="./${moduleInfo.modulePath}/edit?id=${user.id}">&#x270e;</a></td>
+                <td><c:out value="${user.displayname}"/></td>
+            </tr>
+        </c:forEach>
+        </tbody>
+    </table>
+</c:if>
--- a/src/main/webapp/lightpit.css	Sat May 16 11:37:57 2020 +0200
+++ b/src/main/webapp/lightpit.css	Sat May 16 13:29:44 2020 +0200
@@ -136,7 +136,7 @@
 }
 
 table.datatable tr:nth-child(2n) {
-    background: lightblue;
+    background: #f0ffff;
 }
 
 table.formtable {

mercurial