Better printing, and move to 0.3 release

This commit is contained in:
tim holloway 2024-03-01 12:42:11 -05:00
parent 7bbd9df624
commit 6f7ae313ce
6 changed files with 370 additions and 83 deletions

View File

@ -7,7 +7,7 @@
<groupId>com.mousetech.gourmet</groupId> <groupId>com.mousetech.gourmet</groupId>
<artifactId>gourmetj</artifactId> <artifactId>gourmetj</artifactId>
<version>0.2.8</version> <version>0.3.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>GourmetJ</name> <name>GourmetJ</name>

View File

@ -136,6 +136,6 @@ public class SpringSecurityConfig {
"/recipeDetails.jsf", "/recipeDetails.jsf",
"/recipeDetails.xhtml", "/recipeDetails.xhtml",
"/shoppingList.jsf", "/shoppingList.jsf",
"/recipePrint.xhtml"); "/recipePrint.jsf");
} }
} }

View File

@ -17,9 +17,6 @@ import java.io.InputStream;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageInputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.Part;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -37,6 +34,9 @@ import com.mousetech.gourmetj.UserSession;
import com.mousetech.gourmetj.persistence.model.Recipe; import com.mousetech.gourmetj.persistence.model.Recipe;
import com.mousetech.gourmetj.persistence.service.RecipeService; import com.mousetech.gourmetj.persistence.service.RecipeService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
/** /**
* @author timh * @author timh
* @since Nov 26, 2021 * @since Nov 26, 2021

View File

@ -54,7 +54,7 @@
<p:commandButton ajax="false" <p:commandButton ajax="false"
value="Print" value="Print"
icon="ui-icon-print" icon="ui-icon-print"
action="recipePrint.jsf?faces-redirect=true" action="/recipePrint.jsf?faces-redirect=true"
styleClass="ui-button-print" styleClass="ui-button-print"
immediate="true" immediate="true"
/> />

View File

@ -9,100 +9,106 @@
<!-- Print Recipe --> <!-- Print Recipe -->
<ui:define name="title">Gourmet Recipe Manager</ui:define> <ui:define name="title">Gourmet Recipe Manager</ui:define>
<ui:define name="content"> <ui:define name="content">
<h:form id="printForm"> <h:form id="printForm" style="font-size: 12pt;">
<h:messages /> <h:messages />
<p:panelGrid <p:commandButton value="Back" immediate="true"
style="margin-bottom: 5px; border-style: none" ajax="false" icon="ui-icon-arrowthick-1-w"
style="margin-left: 2em" styleClass="noprint"
action="recipeDetails.jsf?faces-redirect=true"
/>
<p:panelGrid id="pTopGrid"
columns="2" style="margin-bottom: 5px; border-style: none"
> >
<p:column> <p:column width="50%">
<img id="bigpix" <img id="bigpix"
SRC="/img/picture/#{recipeDetailBean.recipe.id}" SRC="/img/picture/#{recipeDetailBean.recipe.id}"
/> />
<p:panelGrid columns="2" id="pGrid2">
<h:outputLabel for="@next"
value="Category: "
/>
<h:outputText
value="#{userSession.formatCategories(recipeDetailBean.recipe)}"
/>
<h:outputLabel for="@next"
value="Cuisine: "
/>
<h:outputText
value="#{recipeDetailBean.recipe.cuisine}"
/>
<h:outputLabel for="@next"
value="Prep Time: "
/>
<h:outputText
value="#{userSession.formatTime(recipeDetailBean.recipe.preptime)}"
/>
<h:outputLabel for="@next"
value="Cook Time: "
/>
<h:outputText label="Cook Time: "
value="#{userSession.formatTime(recipeDetailBean.recipe.cooktime)}"
/>
</p:panelGrid>
</p:column> </p:column>
<p:column <p:column
style="vertical-align: middle; text-align: left; border: none" width="50%" style="vertical-align: middle; text-align: left; border: none"
> >
<p:commandButton value="Back" <p:panelGrid id="ingredientsc" columns="1">
immediate="true" ajax="false" <f:facet name="header">
icon="ui-icon-arrowthick-1-w" <h:outputText styleClass="subtitle"
style="margin-left: 2em" value="Ingredients"
styleClass="noprint" />
action="recipeDetails.jsf?faces-redirect=true" </f:facet>
/> <p:column style="padding: 0px 4px">
</p:column> <p:dataTable id="ingredients"
</p:panelGrid> showDirectLinksArrows="true"
<p:panelGrid columns="2"> value="#{recipeDetailBean.ingredients}"
<h:outputLabel for="@next" value="Category: " /> var="ingredient"
<h:outputText style="width: 100%; font-size: 12pt;"
value="#{userSession.formatCategories(recipeDetailBean.recipe)}" >
/> <p:column
<h:outputLabel for="@next" value="Cuisine: " /> style="text-align: right; width: 2em"
<h:outputText >
value="#{recipeDetailBean.recipe.cuisine}" <f:facet name="header">
/>
<h:outputLabel for="@next" value="Prep Time: " />
<h:outputText
value="#{userSession.formatTime(recipeDetailBean.recipe.preptime)}"
/>
<h:outputLabel for="@next" value="Cook Time: " />
<h:outputText label="Cook Time: "
value="#{userSession.formatTime(recipeDetailBean.recipe.cooktime)}"
/>
</p:panelGrid>
<!-- -->
<p:panelGrid id="ingredientsc" columns="1">
<f:facet name="header">
<h:outputText styleClass="subtitle"
value="Ingredients"
/>
</f:facet>
<p:column style="padding: 0px 4px">
<p:dataTable id="ingredients"
showDirectLinksArrows="true"
value="#{recipeDetailBean.ingredients}"
var="ingredient"
style="width: 100%"
>
<p:column
style="text-align: right; width: 2em"
>
<f:facet name="header">
Amt. Amt.
</f:facet> </f:facet>
<h:outputText <h:outputText
value="#{ingredient.displayAmount}" value="#{ingredient.displayAmount}"
/> />
</p:column> </p:column>
<p:column style="width: 6em"> <p:column style="width: 6em">
<f:facet name="header">Units</f:facet> <f:facet name="header">Units</f:facet>
<h:outputText <h:outputText
value="#{ingredient.unit}" value="#{ingredient.unit}"
/> />
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
Item Item
</f:facet> </f:facet>
<h:outputText <h:outputText
value="#{ingredient.item}" value="#{ingredient.item}"
/> />
</p:column> </p:column>
<p:column align="center" <p:column align="center"
style="width: 2em" style="width: 2em"
> >
<f:facet name="header"> <f:facet name="header">
Opt. Opt.
</f:facet> </f:facet>
<p:selectBooleanCheckbox <p:selectBooleanCheckbox
readonly="true" readonly="true"
value="#{ingredient.optionalCB}" value="#{ingredient.optionalCB}"
/> />
</p:column>
</p:dataTable>
</p:column> </p:column>
</p:dataTable> </p:panelGrid>
</p:column> </p:column>
</p:panelGrid> </p:panelGrid>
<!-- --> <!-- -->
<p:panelGrid columns="1" style="width: 100%"> <!-- -->
<p:panelGrid columns="1" style="width: 100%; font-size: 12pt;">
<f:facet name="header"> <f:facet name="header">
<h:outputText styleClass="subtitle" <h:outputText styleClass="subtitle"
value="Instructions" value="Instructions"
@ -113,7 +119,7 @@
value="#{recipeDetailBean.instructions}" value="#{recipeDetailBean.instructions}"
/> />
</p:panelGrid> </p:panelGrid>
<p:panelGrid columns="1" style="width: 100%" <p:panelGrid columns="1" style="width: 100%; font-size: 12pt"
rendered="#{not empty recipeDetailBean.modifications}" rendered="#{not empty recipeDetailBean.modifications}"
> >
<f:facet name="header"> <f:facet name="header">

View File

@ -0,0 +1,281 @@
-- MariaDB dump 10.19 Distrib 10.5.23-MariaDB, for Linux (x86_64)
--
-- Host: dbase Database: recipes
-- ------------------------------------------------------
-- Server version 10.3.35-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `categories`
--
DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`recipe_id` int(11) DEFAULT NULL,
`category` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_CATEGORY_RECIPE` (`recipe_id`),
CONSTRAINT `FK_CATEGORY_RECIPE` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=233 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `convtable`
--
DROP TABLE IF EXISTS `convtable`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `convtable` (
`id` int(11) NOT NULL,
`ckey` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
`value` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `crossunitdict`
--
DROP TABLE IF EXISTS `crossunitdict`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `crossunitdict` (
`id` int(11) NOT NULL,
`cukey` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
`value` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `density`
--
DROP TABLE IF EXISTS `density`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `density` (
`id` int(11) NOT NULL,
`dkey` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
`value` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `info`
--
DROP TABLE IF EXISTS `info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `info` (
`version_super` int(11) DEFAULT NULL,
`version_major` int(11) DEFAULT NULL,
`version_minor` int(11) DEFAULT NULL,
`last_access` int(11) DEFAULT NULL,
`rowid` int(11) NOT NULL,
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `ingredients`
--
DROP TABLE IF EXISTS `ingredients`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ingredients` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`recipe_id` int(11) DEFAULT NULL,
`refid` int(11) DEFAULT NULL,
`unit` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`amount` float DEFAULT NULL,
`rangeamount` float DEFAULT NULL,
`item` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`ingkey` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`optional` tinyint(1) DEFAULT NULL,
`shopoptional` int(11) DEFAULT NULL,
`inggroup` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`position` int(11) DEFAULT NULL,
`deleted` tinyint(1) DEFAULT NULL,
`shopCat_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `refid` (`refid`),
KEY `FK_INGREDIENT_RECIPE` (`recipe_id`),
CONSTRAINT `FK_INGREDIENT_RECIPE` FOREIGN KEY (`recipe_id`) REFERENCES `recipe` (`id`),
CONSTRAINT `CONSTRAINT_1` CHECK (`deleted` in (0,1)),
CONSTRAINT `CONSTRAINT_2` CHECK (`optional` in (0,1))
) ENGINE=InnoDB AUTO_INCREMENT=3540 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `keylookup`
--
DROP TABLE IF EXISTS `keylookup`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `keylookup` (
`id` int(11) NOT NULL,
`word` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`item` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`ingkey` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`count` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `pantry`
--
DROP TABLE IF EXISTS `pantry`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pantry` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ingkey` text COLLATE utf8mb4_bin DEFAULT NULL,
`pantry` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `CONSTRAINT_1` CHECK (`pantry` in (0,1))
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `plugin_info`
--
DROP TABLE IF EXISTS `plugin_info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `plugin_info` (
`plugin` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`id` int(11) NOT NULL,
`version_super` int(11) DEFAULT NULL,
`version_major` int(11) DEFAULT NULL,
`version_minor` int(11) DEFAULT NULL,
`plugin_version` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recipe`
--
DROP TABLE IF EXISTS `recipe`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `recipe` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`instructions` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`modifications` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`cuisine` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`rating` int(11) DEFAULT NULL,
`description` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`source` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`preptime` int(11) DEFAULT NULL,
`cooktime` int(11) DEFAULT NULL,
`servings` float DEFAULT NULL,
`yields` float DEFAULT NULL,
`yield_unit` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL,
`image` mediumblob DEFAULT NULL,
`thumb` blob DEFAULT NULL,
`deleted` tinyint(1) DEFAULT NULL,
`recipe_hash` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
`ingredient_hash` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
`link` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`last_modified` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `CONSTRAINT_1` CHECK (`deleted` in (0,1))
) ENGINE=InnoDB AUTO_INCREMENT=535 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `recipe_ingredients`
--
DROP TABLE IF EXISTS `recipe_ingredients`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `recipe_ingredients` (
`Recipe_id` int(11) NOT NULL,
`ingredientHash_id` int(11) NOT NULL,
UNIQUE KEY `ingredientHash_id` (`ingredientHash_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shopcats`
--
DROP TABLE IF EXISTS `shopcats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shopcats` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ingkey` text COLLATE utf8mb4_bin DEFAULT NULL,
`shopcategory` mediumtext COLLATE utf8mb4_bin DEFAULT NULL,
`position` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=679 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `shopcatsorder`
--
DROP TABLE IF EXISTS `shopcatsorder`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shopcatsorder` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`shopcategory` text COLLATE utf8mb4_bin DEFAULT NULL,
`position` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `unitdict`
--
DROP TABLE IF EXISTS `unitdict`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `unitdict` (
`id` int(11) NOT NULL,
`ukey` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
`value` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-02-18 17:34:22