Chorem-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 545 discussions
r49 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/billy java/org/chorem/billy/action java/org/chorem/gepeto/action resources resources/i18n resources/org/chorem resources/org/chorem/billy resources/org/chorem/billy/action resources/org/chorem/gepeto/action webapp/WEB-INF/jsp webapp/WEB-INF/jsp/billy webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 01 Apr '11
by vbriand@users.chorem.org 01 Apr '11
01 Apr '11
Author: vbriand
Date: 2011-04-01 14:14:10 +0200 (Fri, 01 Apr 2011)
New Revision: 49
Url: http://chorem.org/repositories/revision/chorem/49
Log:
New class with validation for adding a quotation.
The project details can now displayed properly (only name and description)
The "every method returns INPUT" bug has been resolved by renaming ProjectAction-validation.xml to ProjectAction-addProject-validation.xml
Added:
trunk/chorem-web/src/main/java/org/chorem/billy/
trunk/chorem-web/src/main/java/org/chorem/billy/action/
trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
trunk/chorem-web/src/main/resources/org/chorem/billy/
trunk/chorem-web/src/main/resources/org/chorem/billy/action/
trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml
trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/home.jsp
Removed:
trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-validation.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp
Added: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 12:14:10 UTC (rev 49)
@@ -0,0 +1,162 @@
+package org.chorem.billy.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.QuotationImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Quotation management class
+ *
+ * @author vbriand
+ */
+public class QuotationAction extends BaseAction {
+
+ private static final long serialVersionUID = -8773692389143447193L;
+
+ private static final Log log = LogFactory.getLog(BaseAction.class);
+
+ /**
+ * Adds a new quotation
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the quotation has been added
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (reference != null && description != null && amount != null &&
+ vta != null && postedDate != null) {
+ //If the quotation has been created successfully
+ if (addQuotation()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ return result;
+ }
+
+ protected String reference;
+ protected String description;
+ protected String amount;
+ protected String vta;
+ protected String postedDate;
+
+ /**
+ * Stores the new quotation through the proxy
+ *
+ * @return true if the quotation has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addQuotation() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ QuotationImpl newQuotation = new QuotationImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ newQuotation.setReference(reference);
+ newQuotation.setDescription(description);
+ newQuotation.setAmount(Double.parseDouble(amount));
+ newQuotation.setVTA(Double.parseDouble(vta));
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
+ try {
+ newQuotation.setPostedDate(formatter.parse(postedDate));
+ } catch (ParseException e) {
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newQuotation);
+ }
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.billy.quotation.create.error")));
+ log.error("An error occurred while creating a new quotation", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the reference
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /**
+ * @param reference the reference to set
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the amount
+ */
+ public String getAmount() {
+ return amount;
+ }
+
+ /**
+ * @param amount the amount to set
+ */
+ public void setAmount(String amount) {
+ this.amount = amount;
+ }
+
+ /**
+ * @return the vta
+ */
+ public String getVta() {
+ return vta;
+ }
+
+ /**
+ * @param vta the vta to set
+ */
+ public void setVta(String vta) {
+ this.vta = vta;
+ }
+
+ /**
+ * @return the postedDate
+ */
+ public String getPostedDate() {
+ return postedDate;
+ }
+
+ /**
+ * @param postedDate the postedDate to set
+ */
+ public void setPostedDate(String postedDate) {
+ this.postedDate = postedDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 12:14:10 UTC (rev 49)
@@ -1,6 +1,7 @@
package org.chorem.gepeto.action;
import java.util.List;
+import java.util.UUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,43 +54,37 @@
}
}
return result;
- }
- public String execute() throws Exception {
- log.info("execute");
- return super.execute();
- }
+ }
- public String input() throws Exception {
- log.info("input");
- return super.input();
- }
-
+ /**
+ * Retrieves the name and the description of the project referenced by the
+ * projectId
+ *
+ * @return SUCCESS if the name and the description have been retrieved
+ * @return ERROR either if the UUID is invalid or the projectId doesn't
+ * exist
+ */
public String projectDetails() {
- System.out.println("TOTOTOTOTO");
- /*ChoremProxy proxy = getChoremProxy();
- Criteria criteria = Search.query().eq(element, value)*/
- /*List<Project> projects = getProjectsByYear();
- System.out.println("ID:"+projectId);
- for (Project project : projects) {
- System.out.println("[[["+project.getWikittyId() + "]]]");
- if (project.getWikittyId().equals(projectId)) {
+ String result = SUCCESS;
+ ChoremProxy proxy = getChoremProxy();
+
+ try {
+ //If projectId isn't a valid UUID, an exception is thrown
+ UUID.fromString(projectId);
+
+ Project project = proxy.restore(Project.class, projectId);
+
+ if (project != null) { //If the projectId exists
setName(project.getName());
setDescription(project.getDescription());
- break;
+ } else {
+ result = ERROR;
}
- }*/
- return SUCCESS;
+ } catch (IllegalArgumentException e) {
+ result = ERROR;
+ }
+ return result;
}
-
- /**
- * Removes a project
- *
- * @return
- */
- public String remove() {
- //TODO: implement
- return SUCCESS;
- }
protected String year;
protected String name;
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 12:14:10 UTC (rev 49)
@@ -1,4 +1,13 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
+chorem.billy.home=Home
+chorem.billy.quotation=Quotation
+chorem.billy.quotation.add=Add a new quotation
+chorem.billy.quotation.amount=Amount
+chorem.billy.quotation.create.error=An error occurred while creating your new quotation, please try again. If the problem persists, please contact an administrator
+chorem.billy.quotation.description=Description
+chorem.billy.quotation.postedDate=Posted date
+chorem.billy.quotation.reference=Reference
+chorem.billy.quotation.vta=VTA
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.addressLine1=Address
@@ -77,7 +86,7 @@
chorem.gepeto.project.description.required=You must describe the project
chorem.gepeto.project.name=Project''s name
chorem.gepeto.project.name.required=You must enter the project''s name
-chorem.gepeto.projectDetails.title=Details of project {0}
+chorem.gepeto.projectDetails.title=Details of project "{0}"
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
chorem.gepeto.projectOrder.beginDate=Begin date (dd/mm/yyyy)
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 12:14:10 UTC (rev 49)
@@ -1,4 +1,13 @@
chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
+chorem.billy.home=Accueil
+chorem.billy.quotation=Devis
+chorem.billy.quotation.add=Ajouter un nouveau devis
+chorem.billy.quotation.amount=Montant
+chorem.billy.quotation.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau devis, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
+chorem.billy.quotation.description=Description
+chorem.billy.quotation.postedDate=Date de d\u00E9p\u00F4t
+chorem.billy.quotation.reference=R\u00E9f\u00E9rence
+chorem.billy.quotation.vta=TVA
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.addressLine1=Adresse
@@ -73,7 +82,7 @@
chorem.gepeto.project.description.required=Vous devez d\u00E9crire le projet
chorem.gepeto.project.name=Nom du projet
chorem.gepeto.project.name.required=Vous devez renseigner un nom pour le projet
-chorem.gepeto.projectDetails.title=D\u00E9tails du projet {0}
+chorem.gepeto.projectDetails.title=D\u00E9tails du projet "{0}"
chorem.gepeto.projectOrder=Contrat de commande d''un projet
chorem.gepeto.projectOrder.add=Ajouter le contrat d''un projet
chorem.gepeto.projectOrder.beginDate=Date de d\u00E9but
Added: trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml 2011-04-01 12:14:10 UTC (rev 49)
@@ -0,0 +1,39 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="reference">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.reference.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.description.required" />
+ </field-validator>
+ </field>
+ <field name="amount">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.amount.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)([\.,][0-9]+)?]]></param>
+ <message key="chorem.billy.quotation.amount.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="vta">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.vta.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)([\.,][0-9]+)?]]></param>
+ <message key="chorem.billy.quotation.vta.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="postedDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.postedDate.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml (from rev 48, trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-validation.xml)
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml 2011-04-01 12:14:10 UTC (rev 49)
@@ -0,0 +1,16 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.project.name.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.project.description.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-addProject-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-validation.xml 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectAction-validation.xml 2011-04-01 12:14:10 UTC (rev 49)
@@ -1,16 +0,0 @@
-<!DOCTYPE validators PUBLIC
- "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
-
-<validators>
- <field name="name">
- <field-validator type="requiredstring">
- <message key="chorem.gepeto.project.name.required" />
- </field-validator>
- </field>
- <field name="description">
- <field-validator type="requiredstring">
- <message key="chorem.gepeto.project.description.required" />
- </field-validator>
- </field>
-</validators>
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 12:14:10 UTC (rev 49)
@@ -54,7 +54,6 @@
<package name="gepeto" namespace="/gepeto" extends="struts-default">
<default-action-ref name="home" />
-
<action name="home">
<result>/WEB-INF/jsp/gepeto/home.jsp</result>
</action>
@@ -86,22 +85,29 @@
<result type="redirectAction">home</result>
</action>
<action name="getProjectsByYear" class="org.chorem.gepeto.action.ProjectAction">
- <result name="input">/WEB-INF/jsp/gepeto/projectsByYear.jsp</result>
+ <result>/WEB-INF/jsp/gepeto/projectsByYear.jsp</result>
</action>
<action name="projectDetails" class="org.chorem.gepeto.action.ProjectAction" method="projectDetails">
-
- <result name="success">/WEB-INF/jsp/gepeto/projectDetails.jsp</result>
+ <result name="error" type="redirectAction">home</result>
+ <result>/WEB-INF/jsp/gepeto/projectDetails.jsp</result>
</action>
</package>
-<!--<package name="billy" namespace="/billy" extends="struts-default">
+ <package name="billy" namespace="/billy" extends="struts-default">
<default-action-ref name="home" />
<action name="home">
<result>/WEB-INF/jsp/billy/home.jsp</result>
</action>
+ <action name="addQuotation_input">
+ <result>/WEB-INF/jsp/billy/addQuotation.jsp</result>
+ </action>
+ <action name="addQuotation" class="org.chorem.billy.action.QuotationAction" method="add">
+ <result name="input">/WEB-INF/jsp/billy/addQuotation.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
</package>
- <package name="cash" namespace="/cash" extends="struts-default">
+<!--<package name="cash" namespace="/cash" extends="struts-default">
<default-action-ref name="home" />
<action name="home">
<result>/WEB-INF/jsp/cash/home.jsp</result>
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 12:14:10 UTC (rev 49)
@@ -0,0 +1,32 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.billy.quotation.add" /></title>
+ <s:head />
+ </head>
+ <body>
+ <h2><s:text name="chorem.billy.quotation.add" /></h2>
+ <s:actionerror />
+ <s:form action="addQuotation" method="post">
+ <fieldset>
+ <legend>
+ <s:text name="chorem.billy.quotation" />
+ </legend>
+ <s:textfield key="chorem.billy.quotation.reference" name="reference" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.billy.quotation.description" name="description" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.billy.quotation.amount" name="amount" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.billy.quotation.vta" name="vta" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.billy.quotation.postedDate" name="postedDate" labelSeparator=": " />
+ <br />
+ <s:submit key="chorem.billy.quotation.add" name="submit" />
+ </fieldset>
+ </s:form>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/home.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/home.jsp 2011-04-01 12:14:10 UTC (rev 49)
@@ -0,0 +1,13 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.billy.home" /></title>
+ <s:head />
+ </head>
+ <body>
+ <s:a action="addQuotation_input"><s:text name="chorem.billy.quotation.add" /></s:a><br />
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/home.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-03-31 16:20:53 UTC (rev 48)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-04-01 12:14:10 UTC (rev 49)
@@ -10,16 +10,16 @@
<s:param><%= ProjectAction.getAction().getName() %></s:param>
</s:text>
</title>
- <s:head />
+ <!--<s:head />-->
</head>
<body>
<h2>
<s:text name="chorem.gepeto.project">
- <%= ProjectAction.getAction().getName() %>
+ <s:param><%= ProjectAction.getAction().getName() %></s:param>
</s:text>
</h2>
<p>
- <s:textarea readonly="true" value="projectDescription" key="chorem.gepeto.project.description" cols="50" rows="10" labelposition="top" />
+ <s:textarea readonly="true" name="description" key="chorem.gepeto.project.description" cols="50" rows="10" labelposition="top" />
</p>
</body>
</html>
1
0
r48 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action java/org/chorem/gepeto/action resources resources/i18n webapp/WEB-INF/jsp/bonzoms webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 31 Mar '11
by vbriand@users.chorem.org 31 Mar '11
31 Mar '11
Author: vbriand
Date: 2011-03-31 18:20:53 +0200 (Thu, 31 Mar 2011)
New Revision: 48
Url: http://chorem.org/repositories/revision/chorem/48
Log:
For Tony
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -103,7 +103,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.company.create.error")));
- log.error("An error occured while creating a new company", e);
+ log.error("An error occurred while creating a new company", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -66,7 +66,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.contactDetails.create.error")));
- log.error("An error occured while creating new contact details", e);
+ log.error("An error occurred while creating new contact details", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -112,7 +112,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.employmentContract.create.error")));
- log.error("An error occured while creating a new employment contract", e);
+ log.error("An error occurred while creating a new employment contract", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -118,7 +118,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.person.create.error")));
- log.error("An error occured while creating a new person", e);
+ log.error("An error occurred while creating a new person", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -1,11 +1,19 @@
package org.chorem.gepeto.action;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.ChoremProxy;
import org.chorem.action.BaseAction;
+import org.chorem.entities.Project;
import org.chorem.entities.ProjectImpl;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.PagedResult;
+import org.nuiton.wikitty.search.Search;
+import com.opensymphony.xwork2.ActionContext;
+
import static org.nuiton.i18n.I18n.n_;
/**
@@ -18,7 +26,11 @@
private static final long serialVersionUID = 498267854350348906L;
private static final Log log = LogFactory.getLog(ProjectAction.class);
-
+
+ static public ProjectAction getAction() {
+ return (ProjectAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY);
+ }
+
/**
* Adds a new project
*
@@ -42,7 +54,33 @@
}
return result;
}
+ public String execute() throws Exception {
+ log.info("execute");
+ return super.execute();
+ }
+ public String input() throws Exception {
+ log.info("input");
+ return super.input();
+ }
+
+ public String projectDetails() {
+ System.out.println("TOTOTOTOTO");
+ /*ChoremProxy proxy = getChoremProxy();
+ Criteria criteria = Search.query().eq(element, value)*/
+ /*List<Project> projects = getProjectsByYear();
+ System.out.println("ID:"+projectId);
+ for (Project project : projects) {
+ System.out.println("[[["+project.getWikittyId() + "]]]");
+ if (project.getWikittyId().equals(projectId)) {
+ setName(project.getName());
+ setDescription(project.getDescription());
+ break;
+ }
+ }*/
+ return SUCCESS;
+ }
+
/**
* Removes a project
*
@@ -53,8 +91,10 @@
return SUCCESS;
}
+ protected String year;
protected String name;
protected String description;
+ protected String projectId;
/**
* Stores the new project through the proxy
@@ -75,11 +115,20 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.gepeto.project.create.error")));
- log.error("An error occured while creating a new project", e);
+ log.error("An error occurred while creating a new project", e);
}
return result;
}
-
+
+ public List<Project> getProjectsByYear() {
+ //TODO: change
+ ChoremProxy proxy = getChoremProxy();
+ Criteria criteria = Search.query().isNotNull(Project.FQ_FIELD_PROJECT_NAME).criteria();
+ PagedResult<Project> result = proxy.findAllByCriteria(Project.class, criteria);
+ List<Project> projects = result.getAll();
+ return projects;
+ }
+
/**
* @return the name
*/
@@ -107,4 +156,32 @@
public void setDescription(String description) {
this.description = description;
}
+
+ /**
+ * @return the year
+ */
+ public String getYear() {
+ return year;
+ }
+
+ /**
+ * @param year the year to set
+ */
+ public void setYear(String year) {
+ this.year = year;
+ }
+
+ /**
+ * @return the projectId
+ */
+ public String getProjectId() {
+ return projectId;
+ }
+
+ /**
+ * @param projectId the projectId to set
+ */
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
}
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -105,7 +105,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.gepeto.projectOrder.create.error")));
- log.error("An error occured while creating a new project order", e);
+ log.error("An error occurred while creating a new project order", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-31 16:20:53 UTC (rev 48)
@@ -118,7 +118,7 @@
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.gepeto.task.create.error")));
- log.error("An error occured while creating a new task", e);
+ log.error("An error occurred while creating a new task", e);
}
return result;
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-31 16:20:53 UTC (rev 48)
@@ -89,6 +89,10 @@
chorem.gepeto.projectOrder.estimatedEndDate.required=You must enter the estimated end date for this project order
chorem.gepeto.projectOrder.type=Type
chorem.gepeto.projectOrder.type.required=You must specify the project order''s type
+chorem.gepeto.projectsByYear.thead.company=Company
+chorem.gepeto.projectsByYear.thead.end=End
+chorem.gepeto.projectsByYear.thead.name=Name
+chorem.gepeto.projectsByYear.thead.start=Start
chorem.gepeto.projectsByYear.title=Projects of year {0}
chorem.gepeto.results.title=Results by year
chorem.gepeto.task=Task {0}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-31 16:20:53 UTC (rev 48)
@@ -85,6 +85,10 @@
chorem.gepeto.projectOrder.estimatedEndDate.required=Vous devez renseigner la date de fin estim\u00E9e du contrat
chorem.gepeto.projectOrder.type=Type
chorem.gepeto.projectOrder.type.required=Vous devez sp\u00E9cifier le type du contrat
+chorem.gepeto.projectsByYear.thead.company=Demandeur
+chorem.gepeto.projectsByYear.thead.end=Fin
+chorem.gepeto.projectsByYear.thead.name=Nom
+chorem.gepeto.projectsByYear.thead.start=D\u00E9but
chorem.gepeto.projectsByYear.title=Projets de l''ann\u00E9e {0}
chorem.gepeto.results.title=R\u00E9sultats par ann\u00E0e
chorem.gepeto.task=T\u00E2che {0}
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-31 16:20:53 UTC (rev 48)
@@ -54,6 +54,7 @@
<package name="gepeto" namespace="/gepeto" extends="struts-default">
<default-action-ref name="home" />
+
<action name="home">
<result>/WEB-INF/jsp/gepeto/home.jsp</result>
</action>
@@ -84,6 +85,13 @@
<result name="error">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
<result type="redirectAction">home</result>
</action>
+ <action name="getProjectsByYear" class="org.chorem.gepeto.action.ProjectAction">
+ <result name="input">/WEB-INF/jsp/gepeto/projectsByYear.jsp</result>
+ </action>
+ <action name="projectDetails" class="org.chorem.gepeto.action.ProjectAction" method="projectDetails">
+
+ <result name="success">/WEB-INF/jsp/gepeto/projectDetails.jsp</result>
+ </action>
</package>
<!--<package name="billy" namespace="/billy" extends="struts-default">
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-31 16:20:53 UTC (rev 48)
@@ -9,6 +9,7 @@
</head>
<body>
<s:a action="addCompany_input"><s:text name="chorem.bonzoms.company.add" /></s:a><br />
- <s:a action=""></s:a>
+ <s:a action="addEmploymentContract_input"><s:text name="chorem.bonzoms.employmentContract.add" /></s:a><br />
+ <s:a action="addPerson_input"><s:text name="chorem.bonzoms.person.add" /></s:a>
</body>
</html>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-03-31 16:20:53 UTC (rev 48)
@@ -1,4 +1,5 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.gepeto.action.ProjectAction" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
@@ -6,7 +7,7 @@
<head>
<title>
<s:text name="chorem.gepeto.projectDetails.title">
- <s:param><s:property value="projectName" /></s:param>
+ <s:param><%= ProjectAction.getAction().getName() %></s:param>
</s:text>
</title>
<s:head />
@@ -14,7 +15,7 @@
<body>
<h2>
<s:text name="chorem.gepeto.project">
- <s:property value="projectName" />
+ <%= ProjectAction.getAction().getName() %>
</s:text>
</h2>
<p>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-03-31 08:26:28 UTC (rev 47)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-03-31 16:20:53 UTC (rev 48)
@@ -1,4 +1,5 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.gepeto.action.ProjectAction" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
@@ -6,11 +7,39 @@
<head>
<title>
<s:text name="chorem.gepeto.projectsByYear.title">
- <s:param><s:property value="year" /></s:param>
+ <s:param><%= ProjectAction.getAction().getYear() %></s:param>
</s:text>
</title>
<s:head />
</head>
<body>
+ <h2>
+ <s:text name="chorem.gepeto.projectsByYear.title">
+ <s:param><%= ProjectAction.getAction().getYear() %></s:param>
+ </s:text>
+ </h2>
+ <table>
+ <thead>
+ <tr>
+ <th><s:text name="chorem.gepeto.projectsByYear.thead.name" /></th>
+ <th><s:text name="chorem.gepeto.projectsByYear.thead.company" /></th>
+ <th><s:text name="chorem.gepeto.projectsByYear.thead.start" /></th>
+ <th><s:text name="chorem.gepeto.projectsByYear.thead.end" /></th>
+ <tr>
+ </thead>
+ <tbody>
+ <s:iterator value="projectsByYear">
+ <tr>
+ <s:url action="projectDetails" var="projectDetails">
+ <s:param name="projectId"><s:property value="wikittyId" /></s:param>
+ </s:url>
+ <td><a href="${projectDetails}"><s:property value="name" /></a></td>
+ <td><s:property value="company" /></td>
+ <td><s:property value="start" /></td>
+ <td><s:property value="end" /></td>
+ </tr>
+ </s:iterator>
+ </tbody>
+ </table>
</body>
</html>
1
0
r47 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/bonzoms/action resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 31 Mar '11
by vbriand@users.chorem.org 31 Mar '11
31 Mar '11
Author: vbriand
Date: 2011-03-31 10:26:28 +0200 (Thu, 31 Mar 2011)
New Revision: 47
Url: http://chorem.org/repositories/revision/chorem/47
Log:
Added contact details for the person (postal address, phone number)
Added:
trunk/chorem-web/src/main/java/org/chorem/ContactDetailsConstants.java
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
Added: trunk/chorem-web/src/main/java/org/chorem/ContactDetailsConstants.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/ContactDetailsConstants.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/ContactDetailsConstants.java 2011-03-31 08:26:28 UTC (rev 47)
@@ -0,0 +1,12 @@
+package org.chorem;
+
+/**
+ * Contact details constants
+ *
+ * @author vbriand
+ */
+public interface ContactDetailsConstants {
+ public static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
+ public static final String CONTACT_DETAILS_PHONE = "Phone number";
+ public static final String CONTACT_DETAILS_WEBSITE = "Website";
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/ContactDetailsConstants.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-31 08:26:28 UTC (rev 47)
@@ -3,6 +3,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.ChoremProxy;
+import org.chorem.ContactDetailsConstants;
import org.chorem.action.BaseAction;
import org.chorem.entities.CompanyImpl;
import org.chorem.entities.ContactDetailsImpl;
@@ -14,17 +15,11 @@
*
* @author vbriand
*/
-public class CompanyAction extends BaseAction {
+public class CompanyAction extends BaseAction implements ContactDetailsConstants {
private static final long serialVersionUID = 2266576941588474102L;
private static final Log log = LogFactory.getLog(CompanyAction.class);
-
- private static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
-
- private static final String CONTACT_DETAILS_PHONE = "Phone number";
-
- private static final String CONTACT_DETAILS_WEBSITE = "Website";
public String add() {
String result = INPUT;
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-31 08:26:28 UTC (rev 47)
@@ -6,7 +6,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.ChoremProxy;
+import org.chorem.ContactDetailsConstants;
import org.chorem.action.BaseAction;
+import org.chorem.entities.ContactDetailsImpl;
import org.chorem.entities.PersonImpl;
import static org.nuiton.i18n.I18n.n_;
@@ -16,7 +18,7 @@
*
* @author vbriand
*/
-public class PersonAction extends BaseAction {
+public class PersonAction extends BaseAction implements ContactDetailsConstants {
private static final long serialVersionUID = -5757750975509965421L;
@@ -51,6 +53,12 @@
protected String lastName;
protected String email;
protected String birthDate;
+ protected String addressLine1;
+ protected String addressLine2;
+ protected String postcode;
+ protected String city;
+ protected String country;
+ protected String phoneNb;
/**
* Stores the new person through the proxy
@@ -64,6 +72,7 @@
try {
ChoremProxy proxy = getChoremProxy();
PersonImpl newPerson = new PersonImpl();
+ ContactDetailsImpl newContactDetails = new ContactDetailsImpl();
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
newPerson.setFirstName(firstName);
@@ -78,8 +87,32 @@
result = false;
addActionError(getText(n_("chorem.date.wrongFormat")));
}
+
//If everything went smoothly
if (result) {
+ String address = addressLine1;
+
+ if (!addressLine2.isEmpty()) {
+ address += "\n" + addressLine2;
+ }
+ address += "\n" + postcode + "\n" + city + "\n" + country;
+
+ newContactDetails.setName(CONTACT_DETAILS_POSTAL_ADDRESS +
+ " of person \"" + firstName + " " + lastName + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_POSTAL_ADDRESS);
+ newContactDetails.setValue(address);
+ newContactDetails.setTarget(newPerson.getWikittyId());
+ proxy.store(newContactDetails);
+
+ if (!phoneNb.isEmpty()) {
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_PHONE +
+ " of person \"" + firstName + " " + lastName + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_PHONE);
+ newContactDetails.setValue(phoneNb);
+ newContactDetails.setTarget(newPerson.getWikittyId());
+ proxy.store(newContactDetails);
+ }
proxy.store(newPerson);
}
} catch (Exception e) {
@@ -145,4 +178,88 @@
public void setBirthDate(String birthDate) {
this.birthDate = birthDate;
}
+
+ /**
+ * @return the addressLine1
+ */
+ public String getAddressLine1() {
+ return addressLine1;
+ }
+
+ /**
+ * @param addressLine1 the addressLine1 to set
+ */
+ public void setAddressLine1(String addressLine1) {
+ this.addressLine1 = addressLine1;
+ }
+
+ /**
+ * @return the addressLine2
+ */
+ public String getAddressLine2() {
+ return addressLine2;
+ }
+
+ /**
+ * @param addressLine2 the addressLine2 to set
+ */
+ public void setAddressLine2(String addressLine2) {
+ this.addressLine2 = addressLine2;
+ }
+
+ /**
+ * @return the postcode
+ */
+ public String getPostcode() {
+ return postcode;
+ }
+
+ /**
+ * @param postcode the postcode to set
+ */
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ /**
+ * @return the city
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * @param city the city to set
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the phoneNb
+ */
+ public String getPhoneNb() {
+ return phoneNb;
+ }
+
+ /**
+ * @param phoneNb the phoneNb to set
+ */
+ public void setPhoneNb(String phoneNb) {
+ this.phoneNb = phoneNb;
+ }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-31 08:26:28 UTC (rev 47)
@@ -1,7 +1,7 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
-chorem.bonzoms.company.addressLine1=Address line 1
+chorem.bonzoms.company.addressLine1=Address
chorem.bonzoms.company.addressLine1.required=You must enter the first address line
chorem.bonzoms.company.addressLine2=Address line 2 (opt.)
chorem.bonzoms.company.city=City
@@ -45,8 +45,15 @@
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
+chorem.bonzoms.person.addressLine1=Address
+chorem.bonzoms.person.addressLine1.required=You must enter the first address line
+chorem.bonzoms.person.addressLine2=Address line 2 (opt.)
chorem.bonzoms.person.birthDate=Birth date (dd/mm/yyyy)
chorem.bonzoms.person.birthDate.required=You must enter the person''s birth date
+chorem.bonzoms.person.city=City
+chorem.bonzoms.person.city.required=You must enter the city
+chorem.bonzoms.person.country=Country
+chorem.bonzoms.person.country.required=You must enter the country
chorem.bonzoms.person.create.error=An error occurred while adding the person, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=You must enter the person''s email
@@ -55,6 +62,9 @@
chorem.bonzoms.person.firstName.required=You must enter the person''s first name
chorem.bonzoms.person.lastName=Last name
chorem.bonzoms.person.lastName.required=You must enter the person''s last name
+chorem.bonzoms.person.phoneNb=Phone number (opt.)
+chorem.bonzoms.person.postcode=Postcode
+chorem.bonzoms.person.postcode.required=You must enter the postcode
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-31 08:26:28 UTC (rev 47)
@@ -45,8 +45,12 @@
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
+chorem.bonzoms.person.addressLine1=Adresse
+chorem.bonzoms.person.addressLine2=Adresse ligne 2 (opt.)
chorem.bonzoms.person.birthDate=Date de naissance
chorem.bonzoms.person.birthDate.required=Vous devez entrer la date de naissance de la personne
+chorem.bonzoms.person.city=Ville
+chorem.bonzoms.person.country=Pays
chorem.bonzoms.person.create.error=Une erreur s''est produite lors de l''ajout de la personne, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
@@ -55,6 +59,8 @@
chorem.bonzoms.person.firstName.required=Vous devez entrer le pr\u00E9nom de la personne
chorem.bonzoms.person.lastName=Nom
chorem.bonzoms.person.lastName.required=Vous devez entrer le nom de la personne
+chorem.bonzoms.person.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone (opt.)
+chorem.bonzoms.person.postcode=Code postal
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but
Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml 2011-03-31 08:26:28 UTC (rev 47)
@@ -26,4 +26,24 @@
<message key="chorem.bonzoms.person.birthDate.required" />
</field-validator>
</field>
+ <field name="addressLine1">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.addressLine1.required" />
+ </field-validator>
+ </field>
+ <field name="postcode">
+ <field-validator type="postcode">
+ <message key="chorem.bonzoms.person.postcode.required" />
+ </field-validator>
+ </field>
+ <field name="city">
+ <field-validator type="city">
+ <message key="chorem.bonzoms.person.city.required" />
+ </field-validator>
+ </field>
+ <field name="country">
+ <field-validator type="country">
+ <message key="chorem.bonzoms.person.country.required" />
+ </field-validator>
+ </field>
</validators>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-25 16:57:24 UTC (rev 46)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-31 08:26:28 UTC (rev 47)
@@ -21,6 +21,20 @@
<br />
<s:textfield key="chorem.bonzoms.person.birthDate" name="birthDate" labelSeparator=": " />
<br />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.addressLine1" name="addressLine1" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.addressLine2" name="addressLine2" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.postcode" name="postcode" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.city" name="city" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.country" name="country" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textfield key="chorem.bonzoms.person.phoneNb" name="phoneNb" labelSeparator=": " />
+ <br />
<s:submit key="chorem.bonzoms.person.add" name="submit" />
</fieldset>
</s:form>
1
0
r46 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 17:57:24 +0100 (Fri, 25 Mar 2011)
New Revision: 46
Url: http://chorem.org/repositories/revision/chorem/46
Log:
Added website for company
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:57:24 UTC (rev 46)
@@ -23,13 +23,15 @@
private static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
private static final String CONTACT_DETAILS_PHONE = "Phone number";
+
+ private static final String CONTACT_DETAILS_WEBSITE = "Website";
public String add() {
String result = INPUT;
if (name != null && type != null && addressLine1 != null &&
postcode != null && city != null && country != null &&
- phoneNb != null) {
+ phoneNb != null && website != null) {
if (!name.isEmpty() && !type.isEmpty() && !addressLine1.isEmpty() &&
!postcode.isEmpty() && !city.isEmpty() &&
!country.isEmpty()) {
@@ -52,6 +54,7 @@
protected String city;
protected String country;
protected String phoneNb;
+ protected String website;
/**
* Stores the new company through the proxy
@@ -83,13 +86,25 @@
proxy.store(newCompany);
proxy.store(newContactDetails);
- newContactDetails = new ContactDetailsImpl();
- newContactDetails.setName(CONTACT_DETAILS_PHONE + " of company \"" +
- name + "\"");
- newContactDetails.setType(CONTACT_DETAILS_PHONE);
- newContactDetails.setValue(phoneNb);
- newContactDetails.setTarget(newCompany.getWikittyId());
- proxy.store(newContactDetails);
+ if (!phoneNb.isEmpty()) {
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_PHONE +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_PHONE);
+ newContactDetails.setValue(phoneNb);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
+ }
+
+ if (!website.isEmpty()) {
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_WEBSITE +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_WEBSITE);
+ newContactDetails.setValue(website);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
+ }
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.company.create.error")));
@@ -209,4 +224,18 @@
public void setPhoneNb(String phoneNb) {
this.phoneNb = phoneNb;
}
+
+ /**
+ * @return the website
+ */
+ public String getWebsite() {
+ return website;
+ }
+
+ /**
+ * @param website the website to set
+ */
+ public void setWebsite(String website) {
+ this.website = website;
+ }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:57:24 UTC (rev 46)
@@ -3,7 +3,7 @@
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.addressLine1=Address line 1
chorem.bonzoms.company.addressLine1.required=You must enter the first address line
-chorem.bonzoms.company.addressLine2=Address line 2
+chorem.bonzoms.company.addressLine2=Address line 2 (opt.)
chorem.bonzoms.company.city=City
chorem.bonzoms.company.city.required=You must enter the city
chorem.bonzoms.company.country=Country
@@ -11,11 +11,12 @@
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
chorem.bonzoms.company.name.required=You must enter the company''s name
-chorem.bonzoms.company.phoneNb=Phone number
+chorem.bonzoms.company.phoneNb=Phone number (opt.)
chorem.bonzoms.company.postcode=Postcode
chorem.bonzoms.company.postcode.required=You must enter the postcode
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.company.type.required=You must enter the company''s type
+chorem.bonzoms.company.website=Website (opt.)
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:57:24 UTC (rev 46)
@@ -3,7 +3,7 @@
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.addressLine1=Adresse
chorem.bonzoms.company.addressLine1.required=Vous devez donner l'adresse de l''entreprise
-chorem.bonzoms.company.addressLine2=Adresse (ligne 2)
+chorem.bonzoms.company.addressLine2=Adresse ligne 2 (opt.)
chorem.bonzoms.company.city=Ville
chorem.bonzoms.company.city.required=Vous devez renseigner la ville
chorem.bonzoms.company.country=Pays
@@ -11,11 +11,12 @@
chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
-chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone
+chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone (opt.)
chorem.bonzoms.company.postcode=Code postal
chorem.bonzoms.company.postcode.required=Vous devez renseigner le code postal de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
+chorem.bonzoms.company.website=Site internet (opt.)
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:57:24 UTC (rev 46)
@@ -35,6 +35,8 @@
<br />
<s:textfield key="chorem.bonzoms.company.phoneNb" name="phoneNb" labelSeparator=": " />
<br />
+ <s:textfield key="chorem.bonzoms.company.website" name="website" labelSeparator=": " />
+ <br />
<s:submit key="chorem.bonzoms.company.add" name="submit" />
</fieldset>
</s:form>
1
0
r45 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/bonzoms/action resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 17:31:08 +0100 (Fri, 25 Mar 2011)
New Revision: 45
Url: http://chorem.org/repositories/revision/chorem/45
Log:
Added contact details for the company (postal address and telephone)
Implemented methods in proxy to fetch attachments and contact details linked with a wikittyId
Modified:
trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-03-25 16:31:08 UTC (rev 45)
@@ -9,6 +9,9 @@
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.WikittyServiceFactory;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.PagedResult;
+import org.nuiton.wikitty.search.Search;
/**
* Proxy pour l'application. Certaines methodes specifiques pour l'application
@@ -61,8 +64,12 @@
* @return the list of attachments
*/
static public List<Attachment> getAttachments(String wikittyId) {
- //TODO: implement
- return null;
+ Criteria criteria = Search.query().
+ eq(Attachment.FQ_FIELD_ATTACHMENT_TARGET, wikittyId).criteria();
+ PagedResult<Attachment> result = getInstance(null).
+ findAllByCriteria(Attachment.class, criteria);
+ List<Attachment> attachments = result.getAll();
+ return attachments;
}
/**
@@ -72,7 +79,11 @@
* @return the list of contact details
*/
static public List<ContactDetails> getContactDetails(String wikittyId) {
- //TODO: implement
- return null;
+ Criteria criteria = Search.query().
+ eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, wikittyId).criteria();
+ PagedResult<ContactDetails> result = getInstance(null).
+ findAllByCriteria(ContactDetails.class, criteria);
+ List<ContactDetails> contactDetails = result.getAll();
+ return contactDetails;
}
}
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:31:08 UTC (rev 45)
@@ -5,6 +5,7 @@
import org.chorem.ChoremProxy;
import org.chorem.action.BaseAction;
import org.chorem.entities.CompanyImpl;
+import org.chorem.entities.ContactDetailsImpl;
import static org.nuiton.i18n.I18n.n_;
@@ -18,12 +19,20 @@
private static final long serialVersionUID = 2266576941588474102L;
private static final Log log = LogFactory.getLog(CompanyAction.class);
+
+ private static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
+
+ private static final String CONTACT_DETAILS_PHONE = "Phone number";
public String add() {
String result = INPUT;
- if (name != null && type != null) {
- if (!name.isEmpty() && !type.isEmpty()) {
+ if (name != null && type != null && addressLine1 != null &&
+ postcode != null && city != null && country != null &&
+ phoneNb != null) {
+ if (!name.isEmpty() && !type.isEmpty() && !addressLine1.isEmpty() &&
+ !postcode.isEmpty() && !city.isEmpty() &&
+ !country.isEmpty()) {
//If the company has been added successfully
if (addCompany()) {
result = SUCCESS;
@@ -37,6 +46,12 @@
protected String name;
protected String type;
+ protected String addressLine1;
+ protected String addressLine2;
+ protected String postcode;
+ protected String city;
+ protected String country;
+ protected String phoneNb;
/**
* Stores the new company through the proxy
@@ -50,10 +65,31 @@
try {
ChoremProxy proxy = getChoremProxy();
CompanyImpl newCompany = new CompanyImpl();
+ ContactDetailsImpl newContactDetails = new ContactDetailsImpl();
+ String address = addressLine1;
+ if (!addressLine2.isEmpty()) {
+ address += "\n" + addressLine2;
+ }
+ address += "\n" + postcode + "\n" + city + "\n" + country;
+
newCompany.setName(name);
newCompany.setType(type);
+ newContactDetails.setName(CONTACT_DETAILS_POSTAL_ADDRESS +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_POSTAL_ADDRESS);
+ newContactDetails.setValue(address);
+ newContactDetails.setTarget(newCompany.getWikittyId());
proxy.store(newCompany);
+ proxy.store(newContactDetails);
+
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_PHONE + " of company \"" +
+ name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_PHONE);
+ newContactDetails.setValue(phoneNb);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.company.create.error")));
@@ -89,4 +125,88 @@
public void setType(String type) {
this.type = type;
}
+
+ /**
+ * @return the addressLine1
+ */
+ public String getAddressLine1() {
+ return addressLine1;
+ }
+
+ /**
+ * @param addressLine1 the addressLine1 to set
+ */
+ public void setAddressLine1(String addressLine1) {
+ this.addressLine1 = addressLine1;
+ }
+
+ /**
+ * @return the addressLine2
+ */
+ public String getAddressLine2() {
+ return addressLine2;
+ }
+
+ /**
+ * @param addressLine2 the addressLine2 to set
+ */
+ public void setAddressLine2(String addressLine2) {
+ this.addressLine2 = addressLine2;
+ }
+
+ /**
+ * @return the postcode
+ */
+ public String getPostcode() {
+ return postcode;
+ }
+
+ /**
+ * @param postcode the postcode to set
+ */
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ /**
+ * @return the city
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * @param city the city to set
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the phoneNb
+ */
+ public String getPhoneNb() {
+ return phoneNb;
+ }
+
+ /**
+ * @param phoneNb the phoneNb to set
+ */
+ public void setPhoneNb(String phoneNb) {
+ this.phoneNb = phoneNb;
+ }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:31:08 UTC (rev 45)
@@ -1,9 +1,19 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
+chorem.bonzoms.company.addressLine1=Address line 1
+chorem.bonzoms.company.addressLine1.required=You must enter the first address line
+chorem.bonzoms.company.addressLine2=Address line 2
+chorem.bonzoms.company.city=City
+chorem.bonzoms.company.city.required=You must enter the city
+chorem.bonzoms.company.country=Country
+chorem.bonzoms.company.country.required=You must enter the country
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
chorem.bonzoms.company.name.required=You must enter the company''s name
+chorem.bonzoms.company.phoneNb=Phone number
+chorem.bonzoms.company.postcode=Postcode
+chorem.bonzoms.company.postcode.required=You must enter the postcode
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.company.type.required=You must enter the company''s type
chorem.bonzoms.contactDetails=Contact details
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:31:08 UTC (rev 45)
@@ -1,20 +1,30 @@
chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
+chorem.bonzoms.company.addressLine1=Adresse
+chorem.bonzoms.company.addressLine1.required=Vous devez donner l'adresse de l''entreprise
+chorem.bonzoms.company.addressLine2=Adresse (ligne 2)
+chorem.bonzoms.company.city=Ville
+chorem.bonzoms.company.city.required=Vous devez renseigner la ville
+chorem.bonzoms.company.country=Pays
+chorem.bonzoms.company.country.required=Vous devez indiquer le pays
chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
+chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone
+chorem.bonzoms.company.postcode=Code postal
+chorem.bonzoms.company.postcode.required=Vous devez renseigner le code postal de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la méthode de contact
+chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la méthode de contact
+chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la méthode de contact
+chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la m\u00E9thode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-25 16:31:08 UTC (rev 45)
@@ -13,4 +13,24 @@
<message key="chorem.bonzoms.company.type.required" />
</field-validator>
</field>
+ <field name="addressLine1">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.addressLine1.required" />
+ </field-validator>
+ </field>
+ <field name="postcode">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.postcode.required" />
+ </field-validator>
+ </field>
+ <field name="city">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.city.required" />
+ </field-validator>
+ </field>
+ <field name="country">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.country.required" />
+ </field-validator>
+ </field>
</validators>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -21,6 +21,20 @@
<br />
<s:textfield key="chorem.bonzoms.company.type" name="type" labelSeparator=": " />
<br />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.addressLine1" name="addressLine1" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.addressLine2" name="addressLine2" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.postcode" name="postcode" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.city" name="city" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.country" name="country" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.phoneNb" name="phoneNb" labelSeparator=": " />
+ <br />
<s:submit key="chorem.bonzoms.company.add" name="submit" />
</fieldset>
</s:form>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -8,5 +8,7 @@
<s:head />
</head>
<body>
+ <s:a action="addCompany_input"><s:text name="chorem.bonzoms.company.add" /></s:a><br />
+ <s:a action=""></s:a>
</body>
</html>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -8,5 +8,8 @@
<s:head />
</head>
<body>
+ <s:a action="addProject_input"><s:text name="chorem.gepeto.project.add" /></s:a><br />
+ <s:a action="addProjectOrder_input"><s:text name="chorem.gepeto.projectOrder.add" /></s:a><br />
+ <s:a action="addTask_input"><s:text name="chorem.gepeto.task.add" /></s:a>
</body>
</html>
1
0
r44 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 14:22:02 +0100 (Fri, 25 Mar 2011)
New Revision: 44
Url: http://chorem.org/repositories/revision/chorem/44
Log:
Added missing i18n translations
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 13:22:02 UTC (rev 44)
@@ -111,7 +111,7 @@
}
} catch (Exception e) {
result = false;
- addActionError(getText(n_("chorem.bonzoms.employmentcontract.create.error")));
+ addActionError(getText(n_("chorem.bonzoms.employmentContract.create.error")));
log.error("An error occured while creating a new employment contract", e);
}
return result;
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 13:22:02 UTC (rev 44)
@@ -3,7 +3,9 @@
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
+chorem.bonzoms.company.name.required=You must enter the company''s name
chorem.bonzoms.company.type=Company''s type
+chorem.bonzoms.company.type.required=You must enter the company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
@@ -17,6 +19,7 @@
chorem.bonzoms.employmentContract.add=Add a new employment contract
chorem.bonzoms.employmentContract.beginDate=Begin date (dd/mm/yyyy)
chorem.bonzoms.employmentContract.beginDate.required=You must enter the employment contract''s begin date
+chorem.bonzoms.employmentContract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.employmentContract.description=Description
chorem.bonzoms.employmentContract.description.required=You must enter the employment contract''s description
chorem.bonzoms.employmentContract.endDate=End date (dd/mm/yyyy)
@@ -28,8 +31,6 @@
chorem.bonzoms.employmentContract.workingTime=Working time
chorem.bonzoms.employmentContract.workingTime.required=You must enter the employee''s working time
chorem.bonzoms.employmentContract.workingTime.wrongFormat=The working time must be a positive integer
-chorem.bonzoms.employmentcontract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
-chorem.bonzoms.employmentcontract.endDate.required=You must enter the employment contract''s end date
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 13:22:02 UTC (rev 44)
@@ -10,12 +10,16 @@
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la méthode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la méthode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la méthode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
chorem.bonzoms.employmentContract.beginDate.required=Vous devez renseigner la date de d\u00E9but du contrat de travail
+chorem.bonzoms.employmentContract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.employmentContract.description=Description
chorem.bonzoms.employmentContract.description.required=Vous devez d\u00E9crire le contrat de travail
chorem.bonzoms.employmentContract.endDate=Date de fin
@@ -27,7 +31,6 @@
chorem.bonzoms.employmentContract.workingTime=Temps de travail
chorem.bonzoms.employmentContract.workingTime.required=Vous devez saisir le temps de travail de l'employ\u00E9
chorem.bonzoms.employmentContract.workingTime.wrongFormat=Le temps de travail doit \u00EAtre un entier positif
-chorem.bonzoms.employmentcontract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
1
0
r43 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 12:01:27 +0100 (Fri, 25 Mar 2011)
New Revision: 43
Url: http://chorem.org/repositories/revision/chorem/43
Log:
Added classes with validation for adding an employment contract and some contact details
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
Modified:
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,115 @@
+package org.chorem.bonzoms.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.ContactDetailsImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Contact details management class
+ *
+ * @author vbriand
+ */
+public class ContactDetailsAction extends BaseAction {
+
+ private static final long serialVersionUID = 2480555291620298704L;
+
+ private static final Log log = LogFactory.getLog(ContactDetailsAction.class);
+
+ /**
+ * Adds new contact details
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the contact details have been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (name != null && type != null && value != null) {
+ if (!name.isEmpty() && !type.isEmpty() && !value.isEmpty()) {
+ //If the contact details have been added successfully
+ if (addContactDetails()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String name;
+ protected String type;
+ protected String value;
+
+ /**
+ * Stores the new contact details through the proxy
+ *
+ * @return true if the contact details have been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addContactDetails() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ ContactDetailsImpl newContactDetails = new ContactDetailsImpl();
+
+ newContactDetails.setName(name);
+ newContactDetails.setType(type);
+ newContactDetails.setValue(value);
+ proxy.store(newContactDetails);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.contactDetails.create.error")));
+ log.error("An error occured while creating new contact details", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,203 @@
+package org.chorem.bonzoms.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.EmploymentContractImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Employment contract management class
+ *
+ * @author vbriand
+ */
+public class EmploymentContractAction extends BaseAction {
+
+ private static final long serialVersionUID = -5841507190565206548L;
+
+ private static final Log log = LogFactory.getLog(EmploymentContractAction.class);
+
+ /**
+ * Adds a new employment contract
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the employment contract has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (type != null && description != null && salary != null &&
+ workingTime != null && beginDate != null && endDate != null) {
+ if (!type.isEmpty() && !description.isEmpty() &&
+ !salary.isEmpty() && !workingTime.isEmpty() &&
+ !beginDate.isEmpty()) {
+ //If the employment contract has been added successfully
+ if (addEmploymentContract()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String type;
+ protected String description;
+ protected String salary;
+ protected String workingTime;
+ protected String beginDate;
+ protected String endDate;
+
+ /**
+ * Stores the new employment contract through the proxy
+ *
+ * @return true if the employment contract has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addEmploymentContract() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ EmploymentContractImpl newEmploymentContract = new EmploymentContractImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
+ try {
+ Calendar cal = Calendar.getInstance();
+
+ newEmploymentContract.setBeginDate(formatter.parse(beginDate));
+
+ //Subtracts 1 day to the current time so the next test willn't
+ //fail if the begin date is today's date, as the before() method
+ //is exclusive
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ //If the begin date is set before the current date
+ if (newEmploymentContract.getBeginDate().before(cal.getTime())) {
+ result = false;
+ addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
+ }
+
+ if (!endDate.isEmpty()) { //If the contract is not permanent
+ newEmploymentContract.setEndDate(formatter.parse(endDate));
+ //If the end date is anterior to the begin date (...)
+ if (newEmploymentContract.getEndDate().before(newEmploymentContract.getBeginDate())) {
+ result = false;
+ addActionError(getText(n_("chorem.endDate.afterBegin")));
+ }
+ }
+ } catch (ParseException e) {
+ //If the date doesn't match the format above
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+ newEmploymentContract.setDescription(description);
+ newEmploymentContract.setSalary(Float.parseFloat(salary));
+ newEmploymentContract.setType(type);
+ newEmploymentContract.setWorkingTime(Integer.parseInt(workingTime));
+
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newEmploymentContract);
+ }
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.employmentcontract.create.error")));
+ log.error("An error occured while creating a new employment contract", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the salary
+ */
+ public String getSalary() {
+ return salary;
+ }
+
+ /**
+ * @param salary the salary to set
+ */
+ public void setSalary(String salary) {
+ this.salary = salary;
+ }
+
+ /**
+ * @return the workingTime
+ */
+ public String getWorkingTime() {
+ return workingTime;
+ }
+
+ /**
+ * @param workingTime the workingTime to set
+ */
+ public void setWorkingTime(String workingTime) {
+ this.workingTime = workingTime;
+ }
+
+ /**
+ * @return the beginDate
+ */
+ public String getBeginDate() {
+ return beginDate;
+ }
+
+ /**
+ * @param beginDate the beginDate to set
+ */
+ public void setBeginDate(String beginDate) {
+ this.beginDate = beginDate;
+ }
+
+ /**
+ * @return the endDate
+ */
+ public String getEndDate() {
+ return endDate;
+ }
+
+ /**
+ * @param endDate the endDate to set
+ */
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 11:01:27 UTC (rev 43)
@@ -6,28 +6,43 @@
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
+chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.contactDetails.name=Contact details'' name
+chorem.bonzoms.contactDetails.name.required=You must enter the contact details'' name
chorem.bonzoms.contactDetails.type=Contact details'' type
+chorem.bonzoms.contactDetails.type.required=You must enter the contact details'' type
chorem.bonzoms.contactDetails.value=Contact details'' value
+chorem.bonzoms.contactDetails.value.required=You must enter the contact details'' value
chorem.bonzoms.employmentContract=Employment contract
chorem.bonzoms.employmentContract.add=Add a new employment contract
+chorem.bonzoms.employmentContract.beginDate=Begin date (dd/mm/yyyy)
+chorem.bonzoms.employmentContract.beginDate.required=You must enter the employment contract''s begin date
chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.description.required=You must enter the employment contract''s description
+chorem.bonzoms.employmentContract.endDate=End date (dd/mm/yyyy)
chorem.bonzoms.employmentContract.salary=Salary
+chorem.bonzoms.employmentContract.salary.required=You must enter the employee''s salary
+chorem.bonzoms.employmentContract.salary.wrongFormat=The salary must be a positive integer or floating point number (the decimal mark may be either a dot or a comma)
chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.type.required=You must enter the employment contract''s type
chorem.bonzoms.employmentContract.workingTime=Working time
+chorem.bonzoms.employmentContract.workingTime.required=You must enter the employee''s working time
+chorem.bonzoms.employmentContract.workingTime.wrongFormat=The working time must be a positive integer
+chorem.bonzoms.employmentcontract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
+chorem.bonzoms.employmentcontract.endDate.required=You must enter the employment contract''s end date
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
-chorem.bonzoms.person.birthDate=Birth date
-chorem.bonzoms.person.birthDate.required=You must enter the person birth date
+chorem.bonzoms.person.birthDate=Birth date (dd/mm/yyyy)
+chorem.bonzoms.person.birthDate.required=You must enter the person''s birth date
chorem.bonzoms.person.create.error=An error occurred while adding the person, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.person.email=Email
-chorem.bonzoms.person.email.required=You must enter the person email
+chorem.bonzoms.person.email.required=You must enter the person''s email
chorem.bonzoms.person.email.wrongFormat=The email format is invalid
chorem.bonzoms.person.firstName=First name
-chorem.bonzoms.person.firstName.required=You must enter the person first name
+chorem.bonzoms.person.firstName.required=You must enter the person''s first name
chorem.bonzoms.person.lastName=Last name
-chorem.bonzoms.person.lastName.required=You must enter the person last name
+chorem.bonzoms.person.lastName.required=You must enter the person''s last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
@@ -43,12 +58,12 @@
chorem.gepeto.projectDetails.title=Details of project {0}
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
-chorem.gepeto.projectOrder.beginDate=Begin date
+chorem.gepeto.projectOrder.beginDate=Begin date (dd/mm/yyyy)
chorem.gepeto.projectOrder.beginDate.required=You must provide a begin date for this project order
chorem.gepeto.projectOrder.create.error=An error occurred while creating your new project order, please try again. If the problem persists, please contact an administrator
chorem.gepeto.projectOrder.description=Description
chorem.gepeto.projectOrder.description.required=You must describe the project order
-chorem.gepeto.projectOrder.estimatedEndDate=Estimated end date
+chorem.gepeto.projectOrder.estimatedEndDate=Estimated end date (dd/mm/yyyy)
chorem.gepeto.projectOrder.estimatedEndDate.required=You must enter the estimated end date for this project order
chorem.gepeto.projectOrder.type=Type
chorem.gepeto.projectOrder.type.required=You must specify the project order''s type
@@ -56,7 +71,7 @@
chorem.gepeto.results.title=Results by year
chorem.gepeto.task=Task {0}
chorem.gepeto.task.add=Add a new task
-chorem.gepeto.task.beginDate=Begin date
+chorem.gepeto.task.beginDate=Begin date (dd/mm/yyyy)
chorem.gepeto.task.beginDate.required=You must enter the begin date for this task
chorem.gepeto.task.create.error=An error occurred while creating your new task, please try again. If the problem persists, please contact an administrator
chorem.gepeto.task.description=Description
@@ -64,11 +79,11 @@
chorem.gepeto.task.estimatedDays=Estimated days
chorem.gepeto.task.estimatedDays.required=You must enter the estimated number of days for this task
chorem.gepeto.task.estimatedDays.wrongFormat=The estimated days must be a positive integer
-chorem.gepeto.task.estimatedEndDate=Estimated end date
+chorem.gepeto.task.estimatedEndDate=Estimated end date (dd/mm/yyyy)
chorem.gepeto.task.estimatedEndDate.required=You must enter the estimated end date for this task
chorem.gepeto.task.name=Task name
-chorem.gepeto.task.name.required=You must enter the task name
+chorem.gepeto.task.name.required=You must enter the task''s name
chorem.gepeto.task.price=Price
-chorem.gepeto.task.price.required=You must enter the task price
+chorem.gepeto.task.price.required=You must enter the task''s price
chorem.gepeto.task.price.wrongFormat=The price must be a positive integer or floating point number (the decimal mark may be either a dot or a comma)
chorem.home=Home
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 11:01:27 UTC (rev 43)
@@ -8,21 +8,32 @@
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
+chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
+chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
+chorem.bonzoms.employmentContract.beginDate.required=Vous devez renseigner la date de d\u00E9but du contrat de travail
chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.description.required=Vous devez d\u00E9crire le contrat de travail
+chorem.bonzoms.employmentContract.endDate=Date de fin
chorem.bonzoms.employmentContract.salary=Salaire
+chorem.bonzoms.employmentContract.salary.required=Vous devez entrer le salaire de l'employ\u00E9
+chorem.bonzoms.employmentContract.salary.wrongFormat=Le salaire doit \u00EAtre un entier positif ou un nombre \u00E0 virgule flottante positif (le s\u00E9parateur d\u00E9cimal peut \u00EAtre un point ou une virgule)
chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.type.required=Vous devez sp\u00E9cifier le type du contrat de travail
chorem.bonzoms.employmentContract.workingTime=Temps de travail
+chorem.bonzoms.employmentContract.workingTime.required=Vous devez saisir le temps de travail de l'employ\u00E9
+chorem.bonzoms.employmentContract.workingTime.wrongFormat=Le temps de travail doit \u00EAtre un entier positif
+chorem.bonzoms.employmentcontract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
chorem.bonzoms.person.birthDate.required=Vous devez entrer la date de naissance de la personne
-chorem.bonzoms.person.create.error=
+chorem.bonzoms.person.create.error=Une erreur s''est produite lors de l''ajout de la personne, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entr\u00E9e est incorrecte
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,21 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.name.required" />
+ </field-validator>
+ </field>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.type.required" />
+ </field-validator>
+ </field>
+ <field name="value">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.value.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,49 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.type.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.description.required" />
+ </field-validator>
+ </field>
+ <field name="salary">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.salary.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)([\.,][0-9]+)?]]></param>
+ <message key="chorem.bonzoms.employmentContract.salary.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="workingTime">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.workingTime.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)]]></param>
+ <message key="chorem.bonzoms.employmentContract.workingTime.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="beginDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.beginDate.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="endDate">
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -34,9 +34,22 @@
<result name="error">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
<result type="redirectAction">home</result>
</action>
- <action name="addContactDetails">
+ <action name="addContactDetails_input">
<result>/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
</action>
+ <action name="addContactDetails" class="org.chorem.bonzoms.action.ContactDetailsAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
+ <action name="addEmploymentContract_input">
+ <result>/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ </action>
+ <action name="addEmploymentContract" class="org.chorem.bonzoms.action.EmploymentContractAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
</package>
<package name="gepeto" namespace="/gepeto" extends="struts-default">
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,34 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.bonzoms.employmentContract.add" /></title>
+ <s:head />
+ </head>
+ <body>
+ <h2><s:text name="chorem.bonzoms.employmentContract.add" /></h2>
+ <s:actionerror />
+ <s:form action="addEmploymentContract" method="post">
+ <fieldset>
+ <legend><s:text name="chorem.bonzoms.employmentContract" /></legend>
+ <s:textfield key="chorem.bonzoms.employmentContract.type" name="type" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textarea key="chorem.bonzoms.employmentContract.description" name="description" cols="50" rows="10" labelposition="top" />
+ <br />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.salary" name="salary" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.workingTime" name="workingTime" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.beginDate" name="beginDate" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.endDate" name="endDate" labelSeparator=": " />
+ <br />
+ <s:submit key="chorem.bonzoms.person.add" name="submit" />
+ </fieldset>
+ </s:form>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
1
0
r42 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources resources/i18n
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 10:14:58 +0100 (Fri, 25 Mar 2011)
New Revision: 42
Url: http://chorem.org/repositories/revision/chorem/42
Log:
Added missing information in struts.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-25 09:14:58 UTC (rev 42)
@@ -69,6 +69,9 @@
newPerson.setFirstName(firstName);
newPerson.setLastName(lastName);
newPerson.setEmail(email);
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
try {
newPerson.setBirthDate(formatter.parse(birthDate));
} catch (ParseException e) {
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 09:14:58 UTC (rev 42)
@@ -2,13 +2,19 @@
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
-chorem.bonzoms.company.name=Company name
-chorem.bonzoms.company.type=Company type
+chorem.bonzoms.company.name=Company''s name
+chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
-chorem.bonzoms.contactDetails.name=Contact details name
-chorem.bonzoms.contactDetails.type=Contact details type
-chorem.bonzoms.contactDetails.value=Contact details value
+chorem.bonzoms.contactDetails.name=Contact details'' name
+chorem.bonzoms.contactDetails.type=Contact details'' type
+chorem.bonzoms.contactDetails.value=Contact details'' value
+chorem.bonzoms.employmentContract=Employment contract
+chorem.bonzoms.employmentContract.add=Add a new employment contract
+chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.salary=Salary
+chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.workingTime=Working time
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
@@ -32,8 +38,8 @@
chorem.gepeto.project.create.error=An error occurred while creating your new project, please try again. If the problem persists, please contact an administrator
chorem.gepeto.project.description=Description
chorem.gepeto.project.description.required=You must describe the project
-chorem.gepeto.project.name=Project name
-chorem.gepeto.project.name.required=You must enter the project name
+chorem.gepeto.project.name=Project''s name
+chorem.gepeto.project.name.required=You must enter the project''s name
chorem.gepeto.projectDetails.title=Details of project {0}
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 09:14:58 UTC (rev 42)
@@ -11,6 +11,12 @@
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.employmentContract=Contrat de travail
+chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
+chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.salary=Salaire
+chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.workingTime=Temps de travail
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
@@ -19,9 +25,9 @@
chorem.bonzoms.person.create.error=
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
-chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entrée est incorrecte
+chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entr\u00E9e est incorrecte
chorem.bonzoms.person.firstName=Pr\u00E9nom
-chorem.bonzoms.person.firstName.required=Vous devez entrer le prénom de la personne
+chorem.bonzoms.person.firstName.required=Vous devez entrer le pr\u00E9nom de la personne
chorem.bonzoms.person.lastName=Nom
chorem.bonzoms.person.lastName.required=Vous devez entrer le nom de la personne
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 09:14:58 UTC (rev 42)
@@ -14,6 +14,7 @@
</package>
<package name="bonzoms" namespace="/bonzoms" extends="struts-default">
+ <default-action-ref name="home" />
<action name="home">
<result>/WEB-INF/jsp/bonzoms/home.jsp</result>
</action>
@@ -25,9 +26,14 @@
<result name="error">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
<result type="redirectAction">home</result>
</action>
- <action name="addPersonPage">
+ <action name="addPerson_input">
<result>/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
</action>
+ <action name="addPerson" class="org.chorem.bonzoms.action.PersonAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
<action name="addContactDetails">
<result>/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
</action>
@@ -57,6 +63,9 @@
<result name="error">/WEB-INF/jsp/gepeto/addTask.jsp</result>
<result type="redirectAction">home</result>
</action>
+ <action name="addProjectOrder_input">
+ <result>/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
+ </action>
<action name="addProjectOrder" class="org.chorem.gepeto.action.ProjectOrderAction" method="add">
<result name="input">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
<result name="error">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
1
0
r41 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 18:08:31 +0100 (Thu, 24 Mar 2011)
New Revision: 41
Url: http://chorem.org/repositories/revision/chorem/41
Log:
New class with validation for adding a person
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 17:08:31 UTC (rev 41)
@@ -56,7 +56,7 @@
proxy.store(newCompany);
} catch (Exception e) {
result = false;
- addActionError(getText(n_("chorem.gepeto.company.create.error")));
+ addActionError(getText(n_("chorem.bonzoms.company.create.error")));
log.error("An error occured while creating a new company", e);
}
return result;
@@ -68,18 +68,21 @@
public String getName() {
return name;
}
+
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
+
/**
* @return the type
*/
public String getType() {
return type;
}
+
/**
* @param type the type to set
*/
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-24 17:08:31 UTC (rev 41)
@@ -0,0 +1,145 @@
+package org.chorem.bonzoms.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.PersonImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Person management class
+ *
+ * @author vbriand
+ */
+public class PersonAction extends BaseAction {
+
+ private static final long serialVersionUID = -5757750975509965421L;
+
+ private static final Log log = LogFactory.getLog(PersonAction.class);
+
+ /**
+ * Adds a new person
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the person has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (firstName != null && lastName != null && email != null &&
+ birthDate != null) {
+ if (!firstName.isEmpty() && !lastName.isEmpty() &&
+ !email.isEmpty() && !birthDate.isEmpty()) {
+ //If the person has been added successfully
+ if (addPerson()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String firstName;
+ protected String lastName;
+ protected String email;
+ protected String birthDate;
+
+ /**
+ * Stores the new person through the proxy
+ *
+ * @return true if the person has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addPerson() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ PersonImpl newPerson = new PersonImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ newPerson.setFirstName(firstName);
+ newPerson.setLastName(lastName);
+ newPerson.setEmail(email);
+ try {
+ newPerson.setBirthDate(formatter.parse(birthDate));
+ } catch (ParseException e) {
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newPerson);
+ }
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.person.create.error")));
+ log.error("An error occured while creating a new person", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return the email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * @param email the email to set
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ * @return the birthDate
+ */
+ public String getBirthDate() {
+ return birthDate;
+ }
+
+ /**
+ * @param birthDate the birthDate to set
+ */
+ public void setBirthDate(String birthDate) {
+ this.birthDate = birthDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 17:08:31 UTC (rev 41)
@@ -1,6 +1,7 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
+chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company name
chorem.bonzoms.company.type=Company type
chorem.bonzoms.contactDetails=Contact details
@@ -12,14 +13,19 @@
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
chorem.bonzoms.person.birthDate=Birth date
+chorem.bonzoms.person.birthDate.required=You must enter the person birth date
+chorem.bonzoms.person.create.error=An error occurred while adding the person, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.person.email=Email
+chorem.bonzoms.person.email.required=You must enter the person email
+chorem.bonzoms.person.email.wrongFormat=The email format is invalid
chorem.bonzoms.person.firstName=First name
+chorem.bonzoms.person.firstName.required=You must enter the person first name
chorem.bonzoms.person.lastName=Last name
+chorem.bonzoms.person.lastName.required=You must enter the person last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
chorem.error.internal=An internal error occurred
-chorem.gepeto.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.gepeto.home=Home
chorem.gepeto.project=Project {0}
chorem.gepeto.project.add=Add a new project
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 17:08:31 UTC (rev 41)
@@ -1,6 +1,7 @@
chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
+chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
@@ -14,14 +15,19 @@
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
+chorem.bonzoms.person.birthDate.required=Vous devez entrer la date de naissance de la personne
+chorem.bonzoms.person.create.error=
chorem.bonzoms.person.email=Email
+chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
+chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entrée est incorrecte
chorem.bonzoms.person.firstName=Pr\u00E9nom
+chorem.bonzoms.person.firstName.required=Vous devez entrer le prénom de la personne
chorem.bonzoms.person.lastName=Nom
+chorem.bonzoms.person.lastName.required=Vous devez entrer le nom de la personne
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but
chorem.error.internal=Une erreur interne s''est produite
-chorem.gepeto.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.home=Accueil
chorem.gepeto.project=Projet {0}
chorem.gepeto.project.add=Ajouter un nouveau projet
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml 2011-03-24 17:08:31 UTC (rev 41)
@@ -0,0 +1,29 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="firstName">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.firstName.required" />
+ </field-validator>
+ </field>
+ <field name="lastName">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.lastName.required" />
+ </field-validator>
+ </field>
+ <field name="email">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.email.required" />
+ </field-validator>
+ <field-validator type="email">
+ <message key="chorem.bonzoms.person.email.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="birthDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.birthDate.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-24 17:08:31 UTC (rev 41)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.bonzoms.person.add" /></h2>
+ <s:actionerror />
<s:form action="addPerson" method="post">
<fieldset>
<legend><s:text name="chorem.bonzoms.person" /></legend>
1
0
r40 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/bonzoms java/org/chorem/bonzoms/action java/org/chorem/gepeto/action resources resources/i18n resources/org/chorem resources/org/chorem/bonzoms resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 17:17:08 +0100 (Thu, 24 Mar 2011)
New Revision: 40
Url: http://chorem.org/repositories/revision/chorem/40
Log:
New class with validation for adding a company
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
Modified:
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,89 @@
+package org.chorem.bonzoms.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.CompanyImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Company management class
+ *
+ * @author vbriand
+ */
+public class CompanyAction extends BaseAction {
+
+ private static final long serialVersionUID = 2266576941588474102L;
+
+ private static final Log log = LogFactory.getLog(CompanyAction.class);
+
+ public String add() {
+ String result = INPUT;
+
+ if (name != null && type != null) {
+ if (!name.isEmpty() && !type.isEmpty()) {
+ //If the company has been added successfully
+ if (addCompany()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String name;
+ protected String type;
+
+ /**
+ * Stores the new company through the proxy
+ *
+ * @return true if the company has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addCompany() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ CompanyImpl newCompany = new CompanyImpl();
+
+ newCompany.setName(name);
+ newCompany.setType(type);
+ proxy.store(newCompany);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.gepeto.company.create.error")));
+ log.error("An error occured while creating a new company", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -57,6 +57,30 @@
protected String description;
/**
+ * Stores the new project through the proxy
+ *
+ * @return true if the project has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addProject() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ ProjectImpl newProject = new ProjectImpl();
+
+ newProject.setDescription(description);
+ newProject.setName(name);
+ proxy.store(newProject);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.gepeto.project.create.error")));
+ log.error("An error occured while creating a new project", e);
+ }
+ return result;
+ }
+
+ /**
* @return the name
*/
public String getName() {
@@ -83,28 +107,4 @@
public void setDescription(String description) {
this.description = description;
}
-
- /**
- * Stores the new project through the proxy
- *
- * @return true if the project has been stored properly
- * @return false if a problem occurred
- */
- protected boolean addProject() {
- boolean result = true;
-
- try {
- ChoremProxy proxy = getChoremProxy();
- ProjectImpl newProject = new ProjectImpl();
-
- newProject.setDescription(description);
- newProject.setName(name);
- proxy.store(newProject);
- } catch (Exception e) {
- result = false;
- addActionError(getText(n_("chorem.gepeto.project.create.error")));
- log.error("An error occured while creating a new project", e);
- }
- return result;
- }
}
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -33,7 +33,7 @@
public String add() {
String result = INPUT;
- if (type!= null && description != null &&
+ if (type != null && description != null &&
beginDate != null && estimatedEndDate != null) {
if (!type.isEmpty() && !description.isEmpty()) {
//If the project order has been added successfully
@@ -87,7 +87,7 @@
addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
}
- //If the estimated end date is before the begin date (...)
+ //If the estimated end date is anterior to the begin date (...)
if (newProjectOrder.getEndDate().before(newProjectOrder.getBeginDate())) {
result = false;
addActionError(getText(n_("chorem.endDate.afterBegin")));
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -94,7 +94,7 @@
addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
}
- //If the estimated end date is before the begin date (...)
+ //If the estimated end date is anterior to the begin date (...)
if (newTask.getEndDate().before(newTask.getBeginDate())) {
result = false;
addActionError(getText(n_("chorem.endDate.afterBegin")));
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 16:17:08 UTC (rev 40)
@@ -8,6 +8,7 @@
chorem.bonzoms.contactDetails.name=Contact details name
chorem.bonzoms.contactDetails.type=Contact details type
chorem.bonzoms.contactDetails.value=Contact details value
+chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
chorem.bonzoms.person.birthDate=Birth date
@@ -16,8 +17,9 @@
chorem.bonzoms.person.lastName=Last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
-chorem.endDate.afterBegin=The end date cannot be before the begin date
+chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
chorem.error.internal=An internal error occurred
+chorem.gepeto.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.gepeto.home=Home
chorem.gepeto.project=Project {0}
chorem.gepeto.project.add=Add a new project
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 16:17:08 UTC (rev 40)
@@ -1,13 +1,16 @@
-chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre inf\u00E9rieure \u00E0 la date du jour
+chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
+chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
+chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
@@ -16,8 +19,9 @@
chorem.bonzoms.person.lastName=Nom
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
-chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre inf\u00E9rieure \u00E0 la date de d\u00E9but
+chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but
chorem.error.internal=Une erreur interne s''est produite
+chorem.gepeto.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.home=Accueil
chorem.gepeto.project=Projet {0}
chorem.gepeto.project.add=Ajouter un nouveau projet
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,16 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.name.required" />
+ </field-validator>
+ </field>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.type.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 16:17:08 UTC (rev 40)
@@ -17,9 +17,14 @@
<action name="home">
<result>/WEB-INF/jsp/bonzoms/home.jsp</result>
</action>
- <action name="addCompanyPage">
+ <action name="addCompany_input">
<result>/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
</action>
+ <action name="addCompany" class="org.chorem.bonzoms.action.CompanyAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
<action name="addPersonPage">
<result>/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
</action>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.bonzoms.company.add" /></h2>
+ <s:actionerror />
<s:form action="addCompany" method="post">
<fieldset>
<legend>
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,12 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.bonzoms.home" /></title>
+ <s:head />
+ </head>
+ <body>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -15,8 +15,10 @@
<legend><s:text name="chorem.gepeto.projectOrder" /></legend>
<s:textfield key="chorem.gepeto.projectOrder.type" name="type" labelSeparator=": " />
<br />
- <s:textfield key="chorem.gepeto.projectOrder.description" name="description" labelSeparator=": " />
<br />
+ <s:textarea key="chorem.gepeto.projectOrder.description" name="description" cols="50" rows="10" labelposition="top" />
+ <br />
+ <br />
<s:textfield key="chorem.gepeto.projectOrder.beginDate" name="beginDate" labelSeparator=": " />
<br />
<s:textfield key="chorem.gepeto.projectOrder.estimatedEndDate" name="estimatedEndDate" labelSeparator=": " />
1
0