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
- 542 discussions
Author: bpoussin
Date: 2011-04-04 18:47:23 +0200 (Mon, 04 Apr 2011)
New Revision: 56
Url: http://chorem.org/repositories/revision/chorem/56
Log:
Ajout d'un Etat sur le ProjectOrder. Les valeurs possibles
pourrait-etre: send, signed, started, vsr, closed
Modified:
trunk/chorem-entities/src/main/xmi/chorem.zargo
Modified: trunk/chorem-entities/src/main/xmi/chorem.zargo
===================================================================
(Binary files differ)
1
0
r55 - in trunk: . chorem-web/src/main/java/org/chorem/action chorem-web/src/main/webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 01 Apr '11
by bpoussin@users.chorem.org 01 Apr '11
01 Apr '11
Author: bpoussin
Date: 2011-04-01 19:06:22 +0200 (Fri, 01 Apr 2011)
New Revision: 55
Url: http://chorem.org/repositories/revision/chorem/55
Log:
implantation des requetes pour avoir les informations sur la page
d'accueil
utilisation de la derniere version de nuiton-utils pour wikitty
Modified:
trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/home.jsp
trunk/pom.xml
Modified: trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java 2011-04-01 15:32:41 UTC (rev 54)
+++ trunk/chorem-web/src/main/java/org/chorem/action/HomeAction.java 2011-04-01 17:06:22 UTC (rev 55)
@@ -1,11 +1,32 @@
package org.chorem.action;
import com.opensymphony.xwork2.ActionContext;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
import static org.nuiton.i18n.I18n.n_;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.entities.Company;
+import org.chorem.entities.Interval;
+import org.chorem.entities.Person;
+import org.chorem.entities.PersonImpl;
+import org.chorem.entities.Touch;
+import org.chorem.entities.TouchImpl;
import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyUtil;
+import org.nuiton.wikitty.entities.BusinessEntity;
+import org.nuiton.wikitty.entities.BusinessEntityImpl;
+import org.nuiton.wikitty.entities.Wikitty;
+import org.nuiton.wikitty.entities.WikittyUser;
+import org.nuiton.wikitty.entities.WikittyUserImpl;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.PagedResult;
+import org.nuiton.wikitty.search.Search;
/**
*
@@ -36,30 +57,104 @@
return SUCCESS;
}
+ /** nombre d'objet company */
protected int nbCompany = 0;
+ /** nombre d'objet person */
protected int nbPerson = 0;
- protected int nbTouchThisWeek = 0;
+ /** nombre de contact pour les 7 derniers jours jusqu'à maintenant */
+ protected int nbTouchForLast7Days = 0;
+ protected int nbTouchForLast7DaysForMe = 0;
+ /** nombre de contact pour les 7 prochains jours depuis maintenant */
protected int nbTouchForNext7Days = 0;
- protected int nbTouchThisWeekForMe = 0;
protected int nbTouchForNext7DaysForMe = 0;
+ /** nombre de projet en cours */
protected int nbProjectOrderOpen = 0;
+ /** nombre de tache a faire ou finir */
protected int nbTaskOpen = 0;
protected int nbTaskOpenForMe = 0;
+ /** nombre de facture a envoyer */
protected int nbInvoiceToSend = 0;
+ /** montant des factures a envoyer*/
protected int invoiceAmountToSend = 0;
+ /** cash flow pour les 3 prochains moins */
protected double[] cashFlow = new double[3];
+ /** nombre de facture envoyer cette annee jusqu'a maintenant */
protected int nbInvoiceSendThisYear = 0;
+ /** nombre de facture envoyer l'annee derniere jusqu'a maintenant (meme periode)*/
protected int nbInvoiceSendLastYear = 0;
+ /** nombre de facture impayer */
protected int nbInvoiceNotPaid = 0;
+ /** nombre de facture impayer et en retard */
protected int nbInvoiceNotPaidAndLate = 0;
+ /** CA cette annee jusqu'a maintenant */
protected double salesTurnoverThisYear = 0;
+ /** CA l'annee derniere jusqu'a maintenant (meme periode)*/
protected double salesTurnoverLastYear = 0;
- public void load(WikittyProxy proxy) {
-// FIXME write criteria to get information
+ public void load(WikittyProxy proxy) throws ParseException {
+
+ String now = WikittyUtil.formatDate(new Date());
+
+ WikittyUser user = proxy.getUser();
+ String userId = null;
+ if (user != null) {
+ userId = user.getWikittyId();
+ }
+
+ Criteria company = Search.query().exteq(Company.EXT_COMPANY).criteria().setEndIndex(0);
+ Criteria person = Search.query().exteq(Person.EXT_PERSON).criteria().setEndIndex(0);
+
+ Criteria touchLast7days = Search.query()
+ .exteq(Touch.EXT_TOUCH)
+ .and()
+ .le(Touch.FQ_FIELD_INTERVAL_BEGINDATE, now)
+ .criteria().addFacetField(Touch.FQ_FIELD_TOUCH_PARTICIPANT).setEndIndex(0);
+
+ Criteria touchNext7days = Search.query()
+ .exteq(Touch.EXT_TOUCH)
+ .and()
+ .gt(Touch.FQ_FIELD_INTERVAL_BEGINDATE, now)
+ .criteria().addFacetField(Touch.FQ_FIELD_TOUCH_PARTICIPANT).setEndIndex(0);
+
+
+ PagedResult<Wikitty>[] results = proxy.multiFindAllByCriteria(
+ company,
+ person,
+ touchLast7days,
+ touchNext7days
+ );
+
+ nbCompany = results[0].getNumFound();
+ nbPerson = results[1].getNumFound();
+ nbTouchForLast7Days = results[2].getNumFound();
+ nbTouchForLast7DaysForMe =
+ results[2].getTopicCount(Touch.FQ_FIELD_TOUCH_PARTICIPANT, userId);
+ nbTouchForNext7Days = results[3].getNumFound();
+ nbTouchForNext7DaysForMe =
+ results[3].getTopicCount(Touch.FQ_FIELD_TOUCH_PARTICIPANT, userId);
+
+// nbProjectOrderOpen = results[6].getNumFound();
+// nbTaskOpen = results[7].getNumFound();
+// nbTaskOpenForMe = results[8].getNumFound();
+// nbInvoiceToSend = results[9].getNumFound();
+// invoiceAmountToSend = results[10].getNumFound();
+//
+// cashFlow = new double[]{
+// results[11].getNumFound(),
+// results[12].getNumFound(),
+// results[13].getNumFound()
+// };
+//
+// nbInvoiceSendThisYear = results[14].getNumFound();
+// nbInvoiceSendLastYear = results[15].getNumFound();
+// nbInvoiceNotPaid = results[16].getNumFound();
+// nbInvoiceNotPaidAndLate = results[17].getNumFound();
+// salesTurnoverThisYear = results[18].getNumFound();
+// salesTurnoverLastYear = results[19].getNumFound();
+
}
public double[] getCashFlow() {
@@ -114,12 +209,12 @@
return nbTouchForNext7DaysForMe;
}
- public int getNbTouchThisWeek() {
- return nbTouchThisWeek;
+ public int getNbTouchForLast7Days() {
+ return nbTouchForLast7Days;
}
- public int getNbTouchThisWeekForMe() {
- return nbTouchThisWeekForMe;
+ public int getNbTouchForLast7DaysForMe() {
+ return nbTouchForLast7DaysForMe;
}
public int getInvoiceAmountToSend() {
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/home.jsp 2011-04-01 15:32:41 UTC (rev 54)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/home.jsp 2011-04-01 17:06:22 UTC (rev 55)
@@ -14,6 +14,10 @@
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> -->
+<%
+HomeAction action = HomeAction.getAction();
+%>
+
<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
xmlns:jsp="http://java.sun.com/JSP/Page">
<head>
@@ -24,38 +28,38 @@
<div class="block">
<ul>
- <li>Company: <%=HomeAction.getAction().getNbCompany()%></li>
- <li>People: <%=HomeAction.getAction().getNbPerson()%></li>
+ <li>Company: <%=action.getNbCompany()%></li>
+ <li>People: <%=action.getNbPerson()%></li>
<li>Touch
- this week <%=HomeAction.getAction().getNbTouchThisWeekForMe()%>/<%=HomeAction.getAction().getNbTouchThisWeek()%>
- planned <%=HomeAction.getAction().getNbTouchForNext7DaysForMe()%>/<%=HomeAction.getAction().getNbTouchForNext7Days()%>
+ last 7 days <%=action.getNbTouchForLast7DaysForMe()%>/<%=action.getNbTouchForLast7Days()%>
+ planned for next 7 days <%=action.getNbTouchForNext7DaysForMe()%>/<%=action.getNbTouchForNext7Days()%>
</li>
</ul>
</div>
<div class="block">
<ul>
- <li>Project open: <%=HomeAction.getAction().getNbProjectOrderOpen()%></li>
+ <li>Project open: <%=action.getNbProjectOrderOpen()%></li>
<li>Task:
- <%=HomeAction.getAction().getNbTaskOpenForMe()%>/<%=HomeAction.getAction().getNbTaskOpen()%>
+ <%=action.getNbTaskOpenForMe()%>/<%=action.getNbTaskOpen()%>
</li>
- <li>Invoice to send <%=HomeAction.getAction().getNbInvoiceToSend()%>
- for <%=HomeAction.getAction().getInvoiceAmountToSend()%>
+ <li>Invoice to send <%=action.getNbInvoiceToSend()%>
+ for <%=action.getInvoiceAmountToSend()%>
</li>
</ul>
</div>
<div class="block">
<ul>
- <li>Cash flow <%=Arrays.toString(HomeAction.getAction().getCashFlow())%></li>
- <li>Sales turnover <%=HomeAction.getAction().getSalesTurnoverThisYear()%>
- (<%=HomeAction.getAction().getSalesTurnoverLastYear()%>)
+ <li>Cash flow <%=Arrays.toString(action.getCashFlow())%></li>
+ <li>Sales turnover <%=action.getSalesTurnoverThisYear()%>
+ (<%=action.getSalesTurnoverLastYear()%>)
</li>
- <li>Invoice send <%=HomeAction.getAction().getNbInvoiceSendThisYear()%>
- (<%=HomeAction.getAction().getNbInvoiceSendLastYear()%>)
+ <li>Invoice send <%=action.getNbInvoiceSendThisYear()%>
+ (<%=action.getNbInvoiceSendLastYear()%>)
</li>
- <li>Unpaid invoice <%=HomeAction.getAction().getNbInvoiceNotPaid()%>
- and late <%=HomeAction.getAction().getNbInvoiceNotPaidAndLate()%>
+ <li>Unpaid invoice <%=action.getNbInvoiceNotPaid()%>
+ and late <%=action.getNbInvoiceNotPaidAndLate()%>
</li>
</ul>
</div>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-01 15:32:41 UTC (rev 54)
+++ trunk/pom.xml 2011-04-01 17:06:22 UTC (rev 55)
@@ -51,7 +51,7 @@
<projectId>chorem</projectId>
<eugenePluginVersion>2.3.2</eugenePluginVersion>
- <nuitonUtilsVersion>2.0</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.1-SNAPSHOT</nuitonUtilsVersion>
<nuitonI18nVersion>2.3.1</nuitonI18nVersion>
<wikittyVersion>3.0.5-SNAPSHOT</wikittyVersion>
<slf4jVersion>1.6.1</slf4jVersion>
1
0
01 Apr '11
Author: vbriand
Date: 2011-04-01 17:32:41 +0200 (Fri, 01 Apr 2011)
New Revision: 54
Url: http://chorem.org/repositories/revision/chorem/54
Log:
Removed s:property tags
Modified:
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp
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-04-01 15:32:12 UTC (rev 53)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-04-01 15:32:41 UTC (rev 54)
@@ -1,4 +1,6 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page import="java.util.List" %>
+<%@page import="org.chorem.entities.Project" %>
<%@page import="org.chorem.gepeto.action.ProjectAction" %>
<%@taglib prefix="s" uri="/struts-tags" %>
@@ -28,17 +30,21 @@
<tr>
</thead>
<tbody>
- <s:iterator value="allProjects">
+ <%
+ List<Project> projects = ProjectAction.getAction().getAllProjects();
+
+ for (Project project : projects) {
+ %>
<tr>
<s:url action="projectDetails" var="projectDetails">
- <s:param name="projectId"><s:property value="wikittyId" /></s:param>
+ <s:param name="projectId"><%= project.getWikittyId() %></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>
+ <td><a href="${projectDetails}"><%= project.getName() %></a></td>
+ <td></td>
+ <td></td>
+ <td></td>
</tr>
- </s:iterator>
+ <% } %>
</tbody>
</table>
</body>
1
0
Author: bpoussin
Date: 2011-04-01 17:32:12 +0200 (Fri, 01 Apr 2011)
New Revision: 53
Url: http://chorem.org/repositories/revision/chorem/53
Log:
add entity stereotype on Touch object
Modified:
trunk/chorem-entities/src/main/xmi/chorem.zargo
Modified: trunk/chorem-entities/src/main/xmi/chorem.zargo
===================================================================
(Binary files differ)
1
0
r52 - in trunk/chorem-web/src/main: java/org/chorem/billy/action java/org/chorem/gepeto/action resources resources/i18n 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 17:22:50 +0200 (Fri, 01 Apr 2011)
New Revision: 52
Url: http://chorem.org/repositories/revision/chorem/52
Log:
The quotation details can now be seen from the project's page
Added:
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp
Modified:
trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
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/home.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 15:22:50 UTC (rev 52)
@@ -9,6 +9,7 @@
import org.chorem.ChoremProxy;
import org.chorem.action.BaseAction;
import org.chorem.entities.Project;
+import org.chorem.entities.Quotation;
import org.chorem.entities.QuotationImpl;
import com.opensymphony.xwork2.ActionContext;
@@ -71,6 +72,45 @@
return result;
}
+ /**
+ * Retrieves the information of the quotation referenced by the
+ * quotationId
+ *
+ * @return SUCCESS if the information have been retrieved
+ * @return ERROR either if the UUID is invalid or the quotationId doesn't
+ * exist
+ */
+ public String quotationDetails() {
+ String result = SUCCESS;
+ ChoremProxy proxy = getChoremProxy();
+
+ try {
+ if (quotationId == null) {
+ result = ERROR;
+ } else {
+ //If quotationId isn't a valid UUID, an exception is thrown
+ UUID.fromString(quotationId);
+
+ Quotation quotation = proxy.restore(Quotation.class, quotationId);
+
+ if (quotation != null) { //If the quotationId exists
+ setReference(quotation.getReference());
+ setDescription(quotation.getDescription());
+ setAmount(String.valueOf(quotation.getAmount()));
+ setVta(String.valueOf(quotation.getVTA()));
+ setPostedDate(quotation.getPostedDate().toString());
+ setProjectId(quotation.getProject());
+ } else {
+ result = ERROR;
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ //quotationId is invalid
+ result = ERROR;
+ }
+ return result;
+ }
+
protected String projectId;
protected String projectName;
protected String reference;
@@ -78,6 +118,7 @@
protected String amount;
protected String vta;
protected String postedDate;
+ protected String quotationId;
/**
* Stores the new quotation through the proxy
@@ -217,4 +258,18 @@
public void setProjectName(String projectName) {
this.projectName = projectName;
}
+
+ /**
+ * @return the quotationId
+ */
+ public String getQuotationId() {
+ return quotationId;
+ }
+
+ /**
+ * @param quotationId the quotationId to set
+ */
+ public void setQuotationId(String quotationId) {
+ this.quotationId = quotationId;
+ }
}
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-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 15:22:50 UTC (rev 52)
@@ -86,6 +86,7 @@
}
}
} catch (IllegalArgumentException e) {
+ //projectId is invalid
result = ERROR;
}
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-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 15:22:50 UTC (rev 52)
@@ -3,12 +3,15 @@
chorem.billy.quotation=Quotation
chorem.billy.quotation.add=Add a new quotation
chorem.billy.quotation.addToProject=Add a new quotation to the project "{0}"
+chorem.billy.quotation.amound=
chorem.billy.quotation.amount=Amount
+chorem.billy.quotation.backToProjectDetails=Get back to project
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.billy.quotationDetails.title=
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.addressLine1=Address
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-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 15:22:50 UTC (rev 52)
@@ -3,12 +3,15 @@
chorem.billy.quotation=Devis
chorem.billy.quotation.add=Ajouter un nouveau devis
chorem.billy.quotation.addToProject=Ajouter un nouveau devis au projet "{0}"
+chorem.billy.quotation.amound=
chorem.billy.quotation.amount=Montant
+chorem.billy.quotation.backToProjectDetails=Retourner sur le projet
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.billy.quotationDetails.title=
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.addressLine1=Adresse
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 15:22:50 UTC (rev 52)
@@ -110,6 +110,10 @@
<param name="projectId">${projectId}</param>
</result>
</action>
+ <action name="quotationDetails" class="org.chorem.billy.action.QuotationAction" method="quotationDetails">
+ <result name="error" type="redirectAction">home</result>
+ <result>/WEB-INF/jsp/billy/quotationDetails.jsp</result>
+ </action>
</package>
<!--<package name="cash" namespace="/cash" extends="struts-default">
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp 2011-04-01 15:22:50 UTC (rev 52)
@@ -0,0 +1,38 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@page import="org.chorem.billy.action.QuotationAction" %>
+<%@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.quotationDetails.title">
+ <s:param><%= QuotationAction.getAction().getReference() %></s:param>
+ </s:text>
+ </title>
+ <s:head />
+ </head>
+ <body>
+ <h2>
+ <s:text name="chorem.billy.quotation">
+ <s:param><%= QuotationAction.getAction().getReference() %></s:param>
+ </s:text>
+ </h2>
+ <p>
+ <s:textarea readonly="true" name="description" key="chorem.billy.quotation.description" cols="50" rows="10" labelposition="top" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textfield readonly="true" name="amount" key="chorem.billy.quotation.amount" labelSeparator=": " />
+ <br />
+ <s:textfield readonly="true" name="vta" key="chorem.billy.quotation.vta" labelSeparator=": " />
+ <br />
+ <s:textfield readonly="true" name="postedDate" key="chorem.billy.quotation.postedDate" labelSeparator=": " />
+ <br />
+ <br />
+ <s:url namespace="/gepeto" action="projectDetails" var="projectDetails">
+ <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param>
+ </s:url>
+ <a href="${projectDetails}"><s:text name="chorem.billy.quotation.backToProjectDetails" /></a>
+ </p>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/quotationDetails.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-04-01 14:45:15 UTC (rev 51)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-04-01 15:22:50 UTC (rev 52)
@@ -10,6 +10,7 @@
<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>
+ <s:a action="addTask_input"><s:text name="chorem.gepeto.task.add" /></s:a><br />
+ <s:a action="getProjectsByYear"><s:text name="chorem.gepeto.projects" /></s:a><br />
</body>
</html>
1
0
r51 - in trunk/chorem-web/src/main: java/org/chorem/gepeto/action resources resources/i18n webapp/WEB-INF/jsp/billy webapp/WEB-INF/jsp/bonzoms 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 16:45:15 +0200 (Fri, 01 Apr 2011)
New Revision: 51
Url: http://chorem.org/repositories/revision/chorem/51
Log:
The project's quotations are shown on the project's page
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/billy/addQuotation.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp
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-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 14:45:15 UTC (rev 51)
@@ -9,6 +9,7 @@
import org.chorem.action.BaseAction;
import org.chorem.entities.Project;
import org.chorem.entities.ProjectImpl;
+import org.chorem.entities.Quotation;
import org.nuiton.wikitty.search.Criteria;
import org.nuiton.wikitty.search.PagedResult;
import org.nuiton.wikitty.search.Search;
@@ -126,13 +127,31 @@
*/
public List<Project> getAllProjects() {
ChoremProxy proxy = getChoremProxy();
- Criteria criteria = Search.query().isNotNull(Project.EXT_PROJECT).criteria();
- PagedResult<Project> result = proxy.findAllByCriteria(Project.class, criteria);
+ Search search = Search.query();
+ Criteria criteria = search.isNotNull(Project.FQ_FIELD_PROJECT_NAME).criteria();
+ PagedResult<Project> result = proxy.findAllByCriteria(Project.class,
+ criteria);
List<Project> projects = result.getAll();
return projects;
}
/**
+ * Gets the quotations attached with this project
+ *
+ * @return the quotations linked with this project
+ */
+ public List<Quotation> getAttachedQuotations() {
+ ChoremProxy proxy = getChoremProxy();
+ Search search = Search.query();
+ Criteria criteria = search.eq(Quotation.FQ_FIELD_QUOTATION_PROJECT,
+ projectId).criteria();
+ PagedResult<Quotation> result = proxy.findAllByCriteria(Quotation.class,
+ criteria);
+ List<Quotation> quotations = result.getAll();
+ return quotations;
+ }
+
+ /**
* @return the name
*/
public String getName() {
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-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 14:45:15 UTC (rev 51)
@@ -87,6 +87,8 @@
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.quotation=Quotation of {0} (ref. {1})
+chorem.gepeto.projectDetails.quotations=Project''s quotations
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-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 14:45:15 UTC (rev 51)
@@ -83,6 +83,8 @@
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.quotation=Devis du {0} (r\u00E9f. {1})
+chorem.gepeto.projectDetails.quotations=Devis du projet
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
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 14:45:15 UTC (rev 51)
@@ -104,7 +104,11 @@
<action name="addQuotation" class="org.chorem.billy.action.QuotationAction" method="add">
<result name="input">/WEB-INF/jsp/billy/addQuotation.jsp</result>
<result name="error" type="redirectAction">home</result>
- <result type="redirectAction">home</result>
+ <result type="redirectAction">
+ <param name="actionName">projectDetails</param>
+ <param name="namespace">/gepeto</param>
+ <param name="projectId">${projectId}</param>
+ </result>
</action>
</package>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 14:45:15 UTC (rev 51)
@@ -25,7 +25,7 @@
</legend>
<s:textfield key="chorem.billy.quotation.reference" name="reference" labelSeparator=": " />
<br />
- <s:textfield key="chorem.billy.quotation.description" name="description" labelSeparator=": " />
+ <s:textarea key="chorem.billy.quotation.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " />
<br />
<s:textfield key="chorem.billy.quotation.amount" name="amount" labelSeparator=": " />
<br />
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-04-01 14:45:15 UTC (rev 51)
@@ -16,7 +16,7 @@
<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" />
+ <s:textarea key="chorem.bonzoms.employmentContract.description" name="description" cols="50" rows="10" labelposition="top" labelSeparator=": " />
<br />
<br />
<s:textfield key="chorem.bonzoms.employmentContract.salary" name="salary" labelSeparator=": " />
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-04-01 13:50:42 UTC (rev 50)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-04-01 14:45:15 UTC (rev 51)
@@ -1,4 +1,6 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page import="java.util.List" %>
+<%@page import="org.chorem.entities.Quotation" %>
<%@page import="org.chorem.gepeto.action.ProjectAction" %>
<%@taglib prefix="s" uri="/struts-tags" %>
@@ -10,7 +12,7 @@
<s:param><%= ProjectAction.getAction().getName() %></s:param>
</s:text>
</title>
- <!--<s:head />-->
+ <s:head />
</head>
<body>
<h2>
@@ -22,10 +24,33 @@
<s:textarea readonly="true" name="description" key="chorem.gepeto.project.description" cols="50" rows="10" labelposition="top" />
<br />
<br />
- <s:url namespace="/billy" action="addQuotation_input" var="addQuotation">
+ <s:url namespace="/billy" action="addQuotationInput" var="addQuotation">
<s:param name="projectId"><%= ProjectAction.getAction().getProjectId() %></s:param>
</s:url>
<a href="${addQuotation}"><s:text name="chorem.billy.quotation.add" /></a>
</p>
+ <p>
+ <s:text name="chorem.gepeto.projectDetails.quotations" />
+ <br />
+ <br />
+ <%
+ List<Quotation> quotations = ProjectAction.getAction().getAttachedQuotations();
+
+ for (Quotation quotation : quotations) {
+ %>
+ <s:url namespace="/billy" action="quotationDetails" var="quotationDetails">
+ <s:param name="quotationId"><%= quotation.getWikittyId() %></s:param>
+ </s:url>
+ <s:text name="chorem.gepeto.projectDetails.quotation">
+ <s:param>
+ <%= quotation.getPostedDate() %>
+ </s:param>
+ <s:param>
+ <a href="${quotationDetails}"><%= quotation.getReference() %></a>
+ </s:param>
+ </s:text>
+ <br />
+ <% } %>
+ </p>
</body>
</html>
1
0
r50 - in trunk/chorem-web/src/main: java/org/chorem/action java/org/chorem/billy/action java/org/chorem/gepeto/action resources resources/i18n resources/org/chorem/billy/action webapp/WEB-INF/jsp/billy webapp/WEB-INF/jsp/common/inc 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 15:50:42 +0200 (Fri, 01 Apr 2011)
New Revision: 50
Url: http://chorem.org/repositories/revision/chorem/50
Log:
A quotation can now be linked with its project
Added:
trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-addQuotation-validation.xml
Removed:
trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java
trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
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/billy/addQuotation.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.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/action/BaseAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/java/org/chorem/action/BaseAction.java 2011-04-01 13:50:42 UTC (rev 50)
@@ -28,6 +28,8 @@
public static final String UNTRANSLATED_MARKER = "???";
+ protected static final String MISSING_PARAM = "param";
+
protected Map<String, Object> session;
public ChoremSession getChoremSession() {
Modified: trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/java/org/chorem/billy/action/QuotationAction.java 2011-04-01 13:50:42 UTC (rev 50)
@@ -2,13 +2,17 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.UUID;
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.QuotationImpl;
+import com.opensymphony.xwork2.ActionContext;
+
import static org.nuiton.i18n.I18n.n_;
/**
@@ -22,6 +26,10 @@
private static final Log log = LogFactory.getLog(BaseAction.class);
+ static public QuotationAction getAction() {
+ return (QuotationAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY);
+ }
+
/**
* Adds a new quotation
*
@@ -31,19 +39,40 @@
*/
public String add() {
String result = INPUT;
+ ChoremProxy proxy = getChoremProxy();
- if (reference != null && description != null && amount != null &&
- vta != null && postedDate != null) {
- //If the quotation has been created successfully
- if (addQuotation()) {
- result = SUCCESS;
+ try {
+ if (projectId == null) {
+ result = ERROR;
} else {
- result = ERROR;
+ //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 doesn't exist
+ result = ERROR;
+ } else {
+ projectName = project.getName();
+ 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;
+ }
+ }
+ }
}
+ } catch (IllegalArgumentException e) {
+ result = ERROR;
}
return result;
}
+ protected String projectId;
+ protected String projectName;
protected String reference;
protected String description;
protected String amount;
@@ -68,6 +97,7 @@
newQuotation.setDescription(description);
newQuotation.setAmount(Double.parseDouble(amount));
newQuotation.setVTA(Double.parseDouble(vta));
+ newQuotation.setProject(projectId);
//Lenient mode disabled because results may be very odd
formatter.setLenient(false);
@@ -159,4 +189,32 @@
public void setPostedDate(String postedDate) {
this.postedDate = postedDate;
}
+
+ /**
+ * @return the projectId
+ */
+ public String getProjectId() {
+ return projectId;
+ }
+
+ /**
+ * @param projectId the projectId to set
+ */
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
+ }
+
+ /**
+ * @return the projectName
+ */
+ public String getProjectName() {
+ return projectName;
+ }
+
+ /**
+ * @param projectName the projectName to set
+ */
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
}
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-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-04-01 13:50:42 UTC (rev 50)
@@ -69,16 +69,20 @@
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());
+ if (projectId == null) {
+ result = ERROR;
} else {
- result = ERROR;
+ //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());
+ } else {
+ result = ERROR;
+ }
}
} catch (IllegalArgumentException e) {
result = ERROR;
@@ -115,10 +119,14 @@
return result;
}
- public List<Project> getProjectsByYear() {
- //TODO: change
+ /**
+ * Gets all existing projects
+ *
+ * @return all projects in database
+ */
+ public List<Project> getAllProjects() {
ChoremProxy proxy = getChoremProxy();
- Criteria criteria = Search.query().isNotNull(Project.FQ_FIELD_PROJECT_NAME).criteria();
+ Criteria criteria = Search.query().isNotNull(Project.EXT_PROJECT).criteria();
PagedResult<Project> result = proxy.findAllByCriteria(Project.class, criteria);
List<Project> projects = result.getAll();
return projects;
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-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-04-01 13:50:42 UTC (rev 50)
@@ -2,6 +2,7 @@
chorem.billy.home=Home
chorem.billy.quotation=Quotation
chorem.billy.quotation.add=Add a new quotation
+chorem.billy.quotation.addToProject=Add a new quotation to the project "{0}"
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
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-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-04-01 13:50:42 UTC (rev 50)
@@ -2,6 +2,7 @@
chorem.billy.home=Accueil
chorem.billy.quotation=Devis
chorem.billy.quotation.add=Ajouter un nouveau devis
+chorem.billy.quotation.addToProject=Ajouter un nouveau devis au projet "{0}"
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
Copied: trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-addQuotation-validation.xml (from rev 49, trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml)
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-addQuotation-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-addQuotation-validation.xml 2011-04-01 13:50:42 UTC (rev 50)
@@ -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.quotation.reference.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.quotation.description.required" />
+ </field-validator>
+ </field>
+ <field name="amount">
+ <field-validator type="requiredstring">
+ <message key="chorem.billy.quotation.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.quotation.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.quotation.postedDate.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-addQuotation-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: 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 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/resources/org/chorem/billy/action/QuotationAction-validation.xml 2011-04-01 13:50:42 UTC (rev 50)
@@ -1,39 +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="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>
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-04-01 13:50:42 UTC (rev 50)
@@ -98,11 +98,12 @@
<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 name="addQuotationInput" class="org.chorem.billy.action.QuotationAction" method="add">
+ <result name="input">/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 name="error" type="redirectAction">home</result>
<result type="redirectAction">home</result>
</action>
</package>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/billy/addQuotation.jsp 2011-04-01 13:50:42 UTC (rev 50)
@@ -1,4 +1,5 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.billy.action.QuotationAction" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
@@ -8,9 +9,16 @@
<s:head />
</head>
<body>
- <h2><s:text name="chorem.billy.quotation.add" /></h2>
+ <h2>
+ <s:text name="chorem.billy.quotation.addToProject">
+ <s:param><%= QuotationAction.getAction().getProjectName() %></s:param>
+ </s:text>
+ </h2>
<s:actionerror />
- <s:form action="addQuotation" method="post">
+ <s:url action="addQuotation" var="addQuotation">
+ <s:param name="projectId"><%= QuotationAction.getAction().getProjectId() %></s:param>
+ </s:url>
+ <form action="${addQuotation}" method="post">
<fieldset>
<legend>
<s:text name="chorem.billy.quotation" />
@@ -27,6 +35,6 @@
<br />
<s:submit key="chorem.billy.quotation.add" name="submit" />
</fieldset>
- </s:form>
+ </form>
</body>
</html>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp 2011-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/common/inc/header.jsp 2011-04-01 13:50:42 UTC (rev 50)
@@ -1,7 +1,8 @@
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
<div id="header"
xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
xmlns:jsp="http://java.sun.com/JSP/Page">
- Bonzoms - Ca$h - billy - gepeto
+ <s:a namespace="/bonzoms" action="home">Bonzoms</s:a> - <s:a namespace="/cash" action="home">Ca$h</s:a> - <s:a namespace="/billy" action="home">billy</s:a> - <s:a namespace="/gepeto" action="home">gepeto</s:a>
</div>
\ No newline at end of file
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-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectDetails.jsp 2011-04-01 13:50:42 UTC (rev 50)
@@ -20,6 +20,12 @@
</h2>
<p>
<s:textarea readonly="true" name="description" key="chorem.gepeto.project.description" cols="50" rows="10" labelposition="top" />
+ <br />
+ <br />
+ <s:url namespace="/billy" action="addQuotation_input" var="addQuotation">
+ <s:param name="projectId"><%= ProjectAction.getAction().getProjectId() %></s:param>
+ </s:url>
+ <a href="${addQuotation}"><s:text name="chorem.billy.quotation.add" /></a>
</p>
</body>
</html>
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-04-01 12:14:10 UTC (rev 49)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/projectsByYear.jsp 2011-04-01 13:50:42 UTC (rev 50)
@@ -28,7 +28,7 @@
<tr>
</thead>
<tbody>
- <s:iterator value="projectsByYear">
+ <s:iterator value="allProjects">
<tr>
<s:url action="projectDetails" var="projectDetails">
<s:param name="projectId"><s:property value="wikittyId" /></s:param>
1
0
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