]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with project:
authorRoland Haeder <roland@mxchange.org>
Thu, 13 Aug 2015 11:21:21 +0000 (13:21 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 13 Aug 2015 13:36:11 +0000 (15:36 +0200)
- added placeholder class for category datbase constants
- added stub JSPs for handling category and product requests in admin area
- improved category handling a little more
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java [new file with mode: 0644]
web/admin/category.jsp
web/form_handler/admin/do_category.jsp [new file with mode: 0644]
web/form_handler/admin/do_product.jsp [new file with mode: 0644]
web/form_handler/do_order.jsp

diff --git a/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java b/src/java/org/mxchange/pizzaapplication/database/category/PizzaCategoryDatabaseConstants.java
new file mode 100644 (file)
index 0000000..7ccc897
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.database.category;
+
+/**
+ * Holder class for database columns for product frontend
+ *
+ * @author Roland Haeder
+ */
+public final class PizzaCategoryDatabaseConstants {
+       /**
+        * Column name for "id"
+        */
+       public static final String COLUMN_ID = "id";
+
+       /**
+        * Column name for "parent"
+        */
+       public static final String COLUMN_PARENT = "parent";
+
+       /**
+        * Column name for "title"
+        */
+       public static final String COLUMN_TITLE = "title";
+
+       /**
+        * No instance from this class
+        */
+       private PizzaCategoryDatabaseConstants () {
+       }
+}
index 35e879197291d3febd7b08d079aa5ed4cc211d73..246fd5b5a19aa8ac24a0b521ab5ad11da94c7cfa 100644 (file)
@@ -7,6 +7,7 @@
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="org.mxchange.pizzaapplication.category.Category"%>
+<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
                                                <thead class="table_header">
                                                        <tr>
                                                                <th class="table_header_column">
-                                                                       Produktname: (Schlüssel)
+                                                                       Auswählen:
                                                                </th>
                                                                <th class="table_header_column">
-                                                                       Produktbezeichnung:
+                                                                       Bezeichnung:
                                                                </th>
                                                                <th class="table_header_column">
-                                                                       Einzelpreis:
+                                                                       Elternkategorie:
                                                                </th>
                                                        </tr>
                                                </thead>
                                                        <c:forEach var="category" items="<%=app.getCategories()%>">
                                                        <tr>
                                                                <td>
-                                                                       ${category.getId()}
+                                                                       <input type="checkbox" name="<%=PizzaCategoryDatabaseConstants.COLUMN_ID%>[${category.getId()}]" value="1" />
                                                                </td>
                                                                <td>
                                                                        ${category.getTitle()}
                                                                </td>
                                                                <td>
-                                                                       ${category.getPrice()}
+                                                                       ${category.getPrintableParent()}
                                                                </td>
                                                        </tr>
                                                        </c:forEach>
 
                                                        <div class="data_row">
                                                                <div class="table_left">
-                                                                       Produktbezeichnung:
-                                                                       <div class="tiny">(z.B. <em>Pizza Italia</em>)</div>
+                                                                       Bezeichnung:
+                                                                       <div class="tiny">(z.B. <em>Pizzen</em>)</div>
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <input type="text" name="title" size="10" maxlength="255" />
+                                                                       <input type="text" name="<%=PizzaCategoryDatabaseConstants.COLUMN_TITLE%>" size="10" maxlength="255" />
                                                                </div>
 
                                                                <div class="clear"></div>
 
                                                        <div class="data_row">
                                                                <div class="table_left">
-                                                                       Einzelpreis:
-                                                                       <div class="tiny">(z.B. <em>50.0</em>)</div>
+                                                                       Elternkategorie:
                                                                </div>
 
                                                                <div class="table_right">
-                                                                       <input type="text" name="price" size="10" maxlength="255" />
+                                                                       <select name="<%=PizzaCategoryDatabaseConstants.COLUMN_PARENT%>" size="1">
+                                                                               <option value="">Ist oberste Kategorie</option>
+                                                                       </select>
                                                                </div>
 
                                                                <div class="clear"></div>
diff --git a/web/form_handler/admin/do_category.jsp b/web/form_handler/admin/do_category.jsp
new file mode 100644 (file)
index 0000000..611df6f
--- /dev/null
@@ -0,0 +1,61 @@
+<%-- 
+       Document   : order
+       Created on : 07.08.2015, 14:58:21
+       Author     : Roland Haeder
+--%>
+
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+
+<%
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
+
+       // Is it post?
+       if ("POST".equals(request.getMethod())) { //NOI18N
+               // Is "add/edit/delete" set?
+               if (request.getAttribute("add") != null) { //NOI18N
+                       // Add new category
+                       app.doAdminAddCategory(request);
+               } else if (request.getAttribute("edit") != null) { //NOI18N
+                       // @TODO
+               } else if (request.getAttribute("delete") != null) { //NOI18N
+                       // @TODO
+               }
+
+               // Redirect to proper URL
+               // @TODO Commented out for developing:
+               //response.sendRedirect(request.getContextPath() + "/finished.jsp");
+       }
+%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+       </head>
+
+       <body>
+               <div id="title">
+                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+               </div>
+
+               <jsp:include page="/static/admin/menu.jsp" flush="true" />
+
+               <div id="content_outer">
+                       <div id="content_title">
+                               <h2>Bitte nicht direkt aufrufen:</h2>
+                       </div>
+
+                       <div id="content">
+                               Bitte rufen Sie diese Seite nicht direkt auf.
+                       </div>
+               </div>
+       </body>
+</html>
diff --git a/web/form_handler/admin/do_product.jsp b/web/form_handler/admin/do_product.jsp
new file mode 100644 (file)
index 0000000..e94cdca
--- /dev/null
@@ -0,0 +1,61 @@
+<%-- 
+       Document   : order
+       Created on : 07.08.2015, 14:58:21
+       Author     : Roland Haeder
+--%>
+
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+
+<%
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
+
+       // Is it post?
+       if ("POST".equals(request.getMethod())) { //NOI18N
+               // Is "add/edit/delete" set?
+               if (request.getAttribute("add") != null) { //NOI18N
+                       // Add new product
+                       app.doAdminAddProduct(request);
+               } else if (request.getAttribute("edit") != null) { //NOI18N
+                       // @TODO
+               } else if (request.getAttribute("delete") != null) { //NOI18N
+                       // @TODO
+               }
+
+               // Redirect to proper URL
+               // @TODO Commented out for developing:
+               //response.sendRedirect(request.getContextPath() + "/finished.jsp");
+       }
+%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+       </head>
+
+       <body>
+               <div id="title">
+                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+               </div>
+
+               <jsp:include page="/static/admin/menu.jsp" flush="true" />
+
+               <div id="content_outer">
+                       <div id="content_title">
+                               <h2>Bitte nicht direkt aufrufen:</h2>
+                       </div>
+
+                       <div id="content">
+                               Bitte rufen Sie diese Seite nicht direkt auf.
+                       </div>
+               </div>
+       </body>
+</html>
index e0901b2a3de09bd6099d3f62d8a162f8a25d1636..7305c3655e06f03d6d352883e84fba1a19046979 100644 (file)
@@ -18,7 +18,7 @@
        // Is it post?
        if ("POST".equals(request.getMethod())) { //NOI18N
                // @TODO Handle saving customer data and such things
-               
+
                // Mark all choosen products as ordered
                app.markAllChoosenProductsAsOrdered(request, session);