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
r46 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 17:57:24 +0100 (Fri, 25 Mar 2011)
New Revision: 46
Url: http://chorem.org/repositories/revision/chorem/46
Log:
Added website for company
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:57:24 UTC (rev 46)
@@ -23,13 +23,15 @@
private static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
private static final String CONTACT_DETAILS_PHONE = "Phone number";
+
+ private static final String CONTACT_DETAILS_WEBSITE = "Website";
public String add() {
String result = INPUT;
if (name != null && type != null && addressLine1 != null &&
postcode != null && city != null && country != null &&
- phoneNb != null) {
+ phoneNb != null && website != null) {
if (!name.isEmpty() && !type.isEmpty() && !addressLine1.isEmpty() &&
!postcode.isEmpty() && !city.isEmpty() &&
!country.isEmpty()) {
@@ -52,6 +54,7 @@
protected String city;
protected String country;
protected String phoneNb;
+ protected String website;
/**
* Stores the new company through the proxy
@@ -83,13 +86,25 @@
proxy.store(newCompany);
proxy.store(newContactDetails);
- newContactDetails = new ContactDetailsImpl();
- newContactDetails.setName(CONTACT_DETAILS_PHONE + " of company \"" +
- name + "\"");
- newContactDetails.setType(CONTACT_DETAILS_PHONE);
- newContactDetails.setValue(phoneNb);
- newContactDetails.setTarget(newCompany.getWikittyId());
- proxy.store(newContactDetails);
+ if (!phoneNb.isEmpty()) {
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_PHONE +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_PHONE);
+ newContactDetails.setValue(phoneNb);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
+ }
+
+ if (!website.isEmpty()) {
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_WEBSITE +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_WEBSITE);
+ newContactDetails.setValue(website);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
+ }
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.company.create.error")));
@@ -209,4 +224,18 @@
public void setPhoneNb(String phoneNb) {
this.phoneNb = phoneNb;
}
+
+ /**
+ * @return the website
+ */
+ public String getWebsite() {
+ return website;
+ }
+
+ /**
+ * @param website the website to set
+ */
+ public void setWebsite(String website) {
+ this.website = website;
+ }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:57:24 UTC (rev 46)
@@ -3,7 +3,7 @@
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.addressLine1=Address line 1
chorem.bonzoms.company.addressLine1.required=You must enter the first address line
-chorem.bonzoms.company.addressLine2=Address line 2
+chorem.bonzoms.company.addressLine2=Address line 2 (opt.)
chorem.bonzoms.company.city=City
chorem.bonzoms.company.city.required=You must enter the city
chorem.bonzoms.company.country=Country
@@ -11,11 +11,12 @@
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
chorem.bonzoms.company.name.required=You must enter the company''s name
-chorem.bonzoms.company.phoneNb=Phone number
+chorem.bonzoms.company.phoneNb=Phone number (opt.)
chorem.bonzoms.company.postcode=Postcode
chorem.bonzoms.company.postcode.required=You must enter the postcode
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.company.type.required=You must enter the company''s type
+chorem.bonzoms.company.website=Website (opt.)
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:57:24 UTC (rev 46)
@@ -3,7 +3,7 @@
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.addressLine1=Adresse
chorem.bonzoms.company.addressLine1.required=Vous devez donner l'adresse de l''entreprise
-chorem.bonzoms.company.addressLine2=Adresse (ligne 2)
+chorem.bonzoms.company.addressLine2=Adresse ligne 2 (opt.)
chorem.bonzoms.company.city=Ville
chorem.bonzoms.company.city.required=Vous devez renseigner la ville
chorem.bonzoms.company.country=Pays
@@ -11,11 +11,12 @@
chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
-chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone
+chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone (opt.)
chorem.bonzoms.company.postcode=Code postal
chorem.bonzoms.company.postcode.required=Vous devez renseigner le code postal de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
+chorem.bonzoms.company.website=Site internet (opt.)
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:31:08 UTC (rev 45)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:57:24 UTC (rev 46)
@@ -35,6 +35,8 @@
<br />
<s:textfield key="chorem.bonzoms.company.phoneNb" name="phoneNb" labelSeparator=": " />
<br />
+ <s:textfield key="chorem.bonzoms.company.website" name="website" labelSeparator=": " />
+ <br />
<s:submit key="chorem.bonzoms.company.add" name="submit" />
</fieldset>
</s:form>
1
0
r45 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/bonzoms/action resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 17:31:08 +0100 (Fri, 25 Mar 2011)
New Revision: 45
Url: http://chorem.org/repositories/revision/chorem/45
Log:
Added contact details for the company (postal address and telephone)
Implemented methods in proxy to fetch attachments and contact details linked with a wikittyId
Modified:
trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/java/org/chorem/ChoremProxy.java 2011-03-25 16:31:08 UTC (rev 45)
@@ -9,6 +9,9 @@
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.WikittyServiceFactory;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.PagedResult;
+import org.nuiton.wikitty.search.Search;
/**
* Proxy pour l'application. Certaines methodes specifiques pour l'application
@@ -61,8 +64,12 @@
* @return the list of attachments
*/
static public List<Attachment> getAttachments(String wikittyId) {
- //TODO: implement
- return null;
+ Criteria criteria = Search.query().
+ eq(Attachment.FQ_FIELD_ATTACHMENT_TARGET, wikittyId).criteria();
+ PagedResult<Attachment> result = getInstance(null).
+ findAllByCriteria(Attachment.class, criteria);
+ List<Attachment> attachments = result.getAll();
+ return attachments;
}
/**
@@ -72,7 +79,11 @@
* @return the list of contact details
*/
static public List<ContactDetails> getContactDetails(String wikittyId) {
- //TODO: implement
- return null;
+ Criteria criteria = Search.query().
+ eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, wikittyId).criteria();
+ PagedResult<ContactDetails> result = getInstance(null).
+ findAllByCriteria(ContactDetails.class, criteria);
+ List<ContactDetails> contactDetails = result.getAll();
+ return contactDetails;
}
}
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-25 16:31:08 UTC (rev 45)
@@ -5,6 +5,7 @@
import org.chorem.ChoremProxy;
import org.chorem.action.BaseAction;
import org.chorem.entities.CompanyImpl;
+import org.chorem.entities.ContactDetailsImpl;
import static org.nuiton.i18n.I18n.n_;
@@ -18,12 +19,20 @@
private static final long serialVersionUID = 2266576941588474102L;
private static final Log log = LogFactory.getLog(CompanyAction.class);
+
+ private static final String CONTACT_DETAILS_POSTAL_ADDRESS = "Postal address";
+
+ private static final String CONTACT_DETAILS_PHONE = "Phone number";
public String add() {
String result = INPUT;
- if (name != null && type != null) {
- if (!name.isEmpty() && !type.isEmpty()) {
+ if (name != null && type != null && addressLine1 != null &&
+ postcode != null && city != null && country != null &&
+ phoneNb != null) {
+ if (!name.isEmpty() && !type.isEmpty() && !addressLine1.isEmpty() &&
+ !postcode.isEmpty() && !city.isEmpty() &&
+ !country.isEmpty()) {
//If the company has been added successfully
if (addCompany()) {
result = SUCCESS;
@@ -37,6 +46,12 @@
protected String name;
protected String type;
+ protected String addressLine1;
+ protected String addressLine2;
+ protected String postcode;
+ protected String city;
+ protected String country;
+ protected String phoneNb;
/**
* Stores the new company through the proxy
@@ -50,10 +65,31 @@
try {
ChoremProxy proxy = getChoremProxy();
CompanyImpl newCompany = new CompanyImpl();
+ ContactDetailsImpl newContactDetails = new ContactDetailsImpl();
+ String address = addressLine1;
+ if (!addressLine2.isEmpty()) {
+ address += "\n" + addressLine2;
+ }
+ address += "\n" + postcode + "\n" + city + "\n" + country;
+
newCompany.setName(name);
newCompany.setType(type);
+ newContactDetails.setName(CONTACT_DETAILS_POSTAL_ADDRESS +
+ " of company \"" + name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_POSTAL_ADDRESS);
+ newContactDetails.setValue(address);
+ newContactDetails.setTarget(newCompany.getWikittyId());
proxy.store(newCompany);
+ proxy.store(newContactDetails);
+
+ newContactDetails = new ContactDetailsImpl();
+ newContactDetails.setName(CONTACT_DETAILS_PHONE + " of company \"" +
+ name + "\"");
+ newContactDetails.setType(CONTACT_DETAILS_PHONE);
+ newContactDetails.setValue(phoneNb);
+ newContactDetails.setTarget(newCompany.getWikittyId());
+ proxy.store(newContactDetails);
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.bonzoms.company.create.error")));
@@ -89,4 +125,88 @@
public void setType(String type) {
this.type = type;
}
+
+ /**
+ * @return the addressLine1
+ */
+ public String getAddressLine1() {
+ return addressLine1;
+ }
+
+ /**
+ * @param addressLine1 the addressLine1 to set
+ */
+ public void setAddressLine1(String addressLine1) {
+ this.addressLine1 = addressLine1;
+ }
+
+ /**
+ * @return the addressLine2
+ */
+ public String getAddressLine2() {
+ return addressLine2;
+ }
+
+ /**
+ * @param addressLine2 the addressLine2 to set
+ */
+ public void setAddressLine2(String addressLine2) {
+ this.addressLine2 = addressLine2;
+ }
+
+ /**
+ * @return the postcode
+ */
+ public String getPostcode() {
+ return postcode;
+ }
+
+ /**
+ * @param postcode the postcode to set
+ */
+ public void setPostcode(String postcode) {
+ this.postcode = postcode;
+ }
+
+ /**
+ * @return the city
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * @param city the city to set
+ */
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ /**
+ * @return the country
+ */
+ public String getCountry() {
+ return country;
+ }
+
+ /**
+ * @param country the country to set
+ */
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ /**
+ * @return the phoneNb
+ */
+ public String getPhoneNb() {
+ return phoneNb;
+ }
+
+ /**
+ * @param phoneNb the phoneNb to set
+ */
+ public void setPhoneNb(String phoneNb) {
+ this.phoneNb = phoneNb;
+ }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 16:31:08 UTC (rev 45)
@@ -1,9 +1,19 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
+chorem.bonzoms.company.addressLine1=Address line 1
+chorem.bonzoms.company.addressLine1.required=You must enter the first address line
+chorem.bonzoms.company.addressLine2=Address line 2
+chorem.bonzoms.company.city=City
+chorem.bonzoms.company.city.required=You must enter the city
+chorem.bonzoms.company.country=Country
+chorem.bonzoms.company.country.required=You must enter the country
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
chorem.bonzoms.company.name.required=You must enter the company''s name
+chorem.bonzoms.company.phoneNb=Phone number
+chorem.bonzoms.company.postcode=Postcode
+chorem.bonzoms.company.postcode.required=You must enter the postcode
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.company.type.required=You must enter the company''s type
chorem.bonzoms.contactDetails=Contact details
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 16:31:08 UTC (rev 45)
@@ -1,20 +1,30 @@
chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
+chorem.bonzoms.company.addressLine1=Adresse
+chorem.bonzoms.company.addressLine1.required=Vous devez donner l'adresse de l''entreprise
+chorem.bonzoms.company.addressLine2=Adresse (ligne 2)
+chorem.bonzoms.company.city=Ville
+chorem.bonzoms.company.city.required=Vous devez renseigner la ville
+chorem.bonzoms.company.country=Pays
+chorem.bonzoms.company.country.required=Vous devez indiquer le pays
chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
+chorem.bonzoms.company.phoneNb=Num\u00E9ro de t\u00E9l\u00E9phone
+chorem.bonzoms.company.postcode=Code postal
+chorem.bonzoms.company.postcode.required=Vous devez renseigner le code postal de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la méthode de contact
+chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la méthode de contact
+chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
-chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la méthode de contact
+chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la m\u00E9thode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
Modified: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-25 16:31:08 UTC (rev 45)
@@ -13,4 +13,24 @@
<message key="chorem.bonzoms.company.type.required" />
</field-validator>
</field>
+ <field name="addressLine1">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.addressLine1.required" />
+ </field-validator>
+ </field>
+ <field name="postcode">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.postcode.required" />
+ </field-validator>
+ </field>
+ <field name="city">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.city.required" />
+ </field-validator>
+ </field>
+ <field name="country">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.country.required" />
+ </field-validator>
+ </field>
</validators>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -21,6 +21,20 @@
<br />
<s:textfield key="chorem.bonzoms.company.type" name="type" labelSeparator=": " />
<br />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.addressLine1" name="addressLine1" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.addressLine2" name="addressLine2" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.postcode" name="postcode" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.city" name="city" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.country" name="country" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textfield key="chorem.bonzoms.company.phoneNb" name="phoneNb" labelSeparator=": " />
+ <br />
<s:submit key="chorem.bonzoms.company.add" name="submit" />
</fieldset>
</s:form>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -8,5 +8,7 @@
<s:head />
</head>
<body>
+ <s:a action="addCompany_input"><s:text name="chorem.bonzoms.company.add" /></s:a><br />
+ <s:a action=""></s:a>
</body>
</html>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-03-25 13:22:02 UTC (rev 44)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/home.jsp 2011-03-25 16:31:08 UTC (rev 45)
@@ -8,5 +8,8 @@
<s:head />
</head>
<body>
+ <s:a action="addProject_input"><s:text name="chorem.gepeto.project.add" /></s:a><br />
+ <s:a action="addProjectOrder_input"><s:text name="chorem.gepeto.projectOrder.add" /></s:a><br />
+ <s:a action="addTask_input"><s:text name="chorem.gepeto.task.add" /></s:a>
</body>
</html>
1
0
r44 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 14:22:02 +0100 (Fri, 25 Mar 2011)
New Revision: 44
Url: http://chorem.org/repositories/revision/chorem/44
Log:
Added missing i18n translations
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 13:22:02 UTC (rev 44)
@@ -111,7 +111,7 @@
}
} catch (Exception e) {
result = false;
- addActionError(getText(n_("chorem.bonzoms.employmentcontract.create.error")));
+ addActionError(getText(n_("chorem.bonzoms.employmentContract.create.error")));
log.error("An error occured while creating a new employment contract", e);
}
return result;
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 13:22:02 UTC (rev 44)
@@ -3,7 +3,9 @@
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company''s name
+chorem.bonzoms.company.name.required=You must enter the company''s name
chorem.bonzoms.company.type=Company''s type
+chorem.bonzoms.company.type.required=You must enter the company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
@@ -17,6 +19,7 @@
chorem.bonzoms.employmentContract.add=Add a new employment contract
chorem.bonzoms.employmentContract.beginDate=Begin date (dd/mm/yyyy)
chorem.bonzoms.employmentContract.beginDate.required=You must enter the employment contract''s begin date
+chorem.bonzoms.employmentContract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.employmentContract.description=Description
chorem.bonzoms.employmentContract.description.required=You must enter the employment contract''s description
chorem.bonzoms.employmentContract.endDate=End date (dd/mm/yyyy)
@@ -28,8 +31,6 @@
chorem.bonzoms.employmentContract.workingTime=Working time
chorem.bonzoms.employmentContract.workingTime.required=You must enter the employee''s working time
chorem.bonzoms.employmentContract.workingTime.wrongFormat=The working time must be a positive integer
-chorem.bonzoms.employmentcontract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
-chorem.bonzoms.employmentcontract.endDate.required=You must enter the employment contract''s end date
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 11:01:27 UTC (rev 43)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 13:22:02 UTC (rev 44)
@@ -10,12 +10,16 @@
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.name.required=Vous devez indiquer le nom de la méthode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.type.required=Vous devez saisir le type de la méthode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.contactDetails.value.required=Vous devez entrer la valeur de la méthode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
chorem.bonzoms.employmentContract.beginDate.required=Vous devez renseigner la date de d\u00E9but du contrat de travail
+chorem.bonzoms.employmentContract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.employmentContract.description=Description
chorem.bonzoms.employmentContract.description.required=Vous devez d\u00E9crire le contrat de travail
chorem.bonzoms.employmentContract.endDate=Date de fin
@@ -27,7 +31,6 @@
chorem.bonzoms.employmentContract.workingTime=Temps de travail
chorem.bonzoms.employmentContract.workingTime.required=Vous devez saisir le temps de travail de l'employ\u00E9
chorem.bonzoms.employmentContract.workingTime.wrongFormat=Le temps de travail doit \u00EAtre un entier positif
-chorem.bonzoms.employmentcontract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
1
0
r43 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 12:01:27 +0100 (Fri, 25 Mar 2011)
New Revision: 43
Url: http://chorem.org/repositories/revision/chorem/43
Log:
Added classes with validation for adding an employment contract and some contact details
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
Modified:
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,115 @@
+package org.chorem.bonzoms.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.ContactDetailsImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Contact details management class
+ *
+ * @author vbriand
+ */
+public class ContactDetailsAction extends BaseAction {
+
+ private static final long serialVersionUID = 2480555291620298704L;
+
+ private static final Log log = LogFactory.getLog(ContactDetailsAction.class);
+
+ /**
+ * Adds new contact details
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the contact details have been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (name != null && type != null && value != null) {
+ if (!name.isEmpty() && !type.isEmpty() && !value.isEmpty()) {
+ //If the contact details have been added successfully
+ if (addContactDetails()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String name;
+ protected String type;
+ protected String value;
+
+ /**
+ * Stores the new contact details through the proxy
+ *
+ * @return true if the contact details have been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addContactDetails() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ ContactDetailsImpl newContactDetails = new ContactDetailsImpl();
+
+ newContactDetails.setName(name);
+ newContactDetails.setType(type);
+ newContactDetails.setValue(value);
+ proxy.store(newContactDetails);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.contactDetails.create.error")));
+ log.error("An error occured while creating new contact details", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/ContactDetailsAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,203 @@
+package org.chorem.bonzoms.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.EmploymentContractImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Employment contract management class
+ *
+ * @author vbriand
+ */
+public class EmploymentContractAction extends BaseAction {
+
+ private static final long serialVersionUID = -5841507190565206548L;
+
+ private static final Log log = LogFactory.getLog(EmploymentContractAction.class);
+
+ /**
+ * Adds a new employment contract
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the employment contract has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (type != null && description != null && salary != null &&
+ workingTime != null && beginDate != null && endDate != null) {
+ if (!type.isEmpty() && !description.isEmpty() &&
+ !salary.isEmpty() && !workingTime.isEmpty() &&
+ !beginDate.isEmpty()) {
+ //If the employment contract has been added successfully
+ if (addEmploymentContract()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String type;
+ protected String description;
+ protected String salary;
+ protected String workingTime;
+ protected String beginDate;
+ protected String endDate;
+
+ /**
+ * Stores the new employment contract through the proxy
+ *
+ * @return true if the employment contract has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addEmploymentContract() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ EmploymentContractImpl newEmploymentContract = new EmploymentContractImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
+ try {
+ Calendar cal = Calendar.getInstance();
+
+ newEmploymentContract.setBeginDate(formatter.parse(beginDate));
+
+ //Subtracts 1 day to the current time so the next test willn't
+ //fail if the begin date is today's date, as the before() method
+ //is exclusive
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ //If the begin date is set before the current date
+ if (newEmploymentContract.getBeginDate().before(cal.getTime())) {
+ result = false;
+ addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
+ }
+
+ if (!endDate.isEmpty()) { //If the contract is not permanent
+ newEmploymentContract.setEndDate(formatter.parse(endDate));
+ //If the end date is anterior to the begin date (...)
+ if (newEmploymentContract.getEndDate().before(newEmploymentContract.getBeginDate())) {
+ result = false;
+ addActionError(getText(n_("chorem.endDate.afterBegin")));
+ }
+ }
+ } catch (ParseException e) {
+ //If the date doesn't match the format above
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+ newEmploymentContract.setDescription(description);
+ newEmploymentContract.setSalary(Float.parseFloat(salary));
+ newEmploymentContract.setType(type);
+ newEmploymentContract.setWorkingTime(Integer.parseInt(workingTime));
+
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newEmploymentContract);
+ }
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.employmentcontract.create.error")));
+ log.error("An error occured while creating a new employment contract", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the salary
+ */
+ public String getSalary() {
+ return salary;
+ }
+
+ /**
+ * @param salary the salary to set
+ */
+ public void setSalary(String salary) {
+ this.salary = salary;
+ }
+
+ /**
+ * @return the workingTime
+ */
+ public String getWorkingTime() {
+ return workingTime;
+ }
+
+ /**
+ * @param workingTime the workingTime to set
+ */
+ public void setWorkingTime(String workingTime) {
+ this.workingTime = workingTime;
+ }
+
+ /**
+ * @return the beginDate
+ */
+ public String getBeginDate() {
+ return beginDate;
+ }
+
+ /**
+ * @param beginDate the beginDate to set
+ */
+ public void setBeginDate(String beginDate) {
+ this.beginDate = beginDate;
+ }
+
+ /**
+ * @return the endDate
+ */
+ public String getEndDate() {
+ return endDate;
+ }
+
+ /**
+ * @param endDate the endDate to set
+ */
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/EmploymentContractAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 11:01:27 UTC (rev 43)
@@ -6,28 +6,43 @@
chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
+chorem.bonzoms.contactDetails.create.error=An error occurred while creating your new contact details, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.contactDetails.name=Contact details'' name
+chorem.bonzoms.contactDetails.name.required=You must enter the contact details'' name
chorem.bonzoms.contactDetails.type=Contact details'' type
+chorem.bonzoms.contactDetails.type.required=You must enter the contact details'' type
chorem.bonzoms.contactDetails.value=Contact details'' value
+chorem.bonzoms.contactDetails.value.required=You must enter the contact details'' value
chorem.bonzoms.employmentContract=Employment contract
chorem.bonzoms.employmentContract.add=Add a new employment contract
+chorem.bonzoms.employmentContract.beginDate=Begin date (dd/mm/yyyy)
+chorem.bonzoms.employmentContract.beginDate.required=You must enter the employment contract''s begin date
chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.description.required=You must enter the employment contract''s description
+chorem.bonzoms.employmentContract.endDate=End date (dd/mm/yyyy)
chorem.bonzoms.employmentContract.salary=Salary
+chorem.bonzoms.employmentContract.salary.required=You must enter the employee''s salary
+chorem.bonzoms.employmentContract.salary.wrongFormat=The salary must be a positive integer or floating point number (the decimal mark may be either a dot or a comma)
chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.type.required=You must enter the employment contract''s type
chorem.bonzoms.employmentContract.workingTime=Working time
+chorem.bonzoms.employmentContract.workingTime.required=You must enter the employee''s working time
+chorem.bonzoms.employmentContract.workingTime.wrongFormat=The working time must be a positive integer
+chorem.bonzoms.employmentcontract.create.error=An error occurred while creating your new employment contract, please try again. If the problem persists, please contact an administrator
+chorem.bonzoms.employmentcontract.endDate.required=You must enter the employment contract''s end date
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
-chorem.bonzoms.person.birthDate=Birth date
-chorem.bonzoms.person.birthDate.required=You must enter the person birth date
+chorem.bonzoms.person.birthDate=Birth date (dd/mm/yyyy)
+chorem.bonzoms.person.birthDate.required=You must enter the person''s birth date
chorem.bonzoms.person.create.error=An error occurred while adding the person, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.person.email=Email
-chorem.bonzoms.person.email.required=You must enter the person email
+chorem.bonzoms.person.email.required=You must enter the person''s email
chorem.bonzoms.person.email.wrongFormat=The email format is invalid
chorem.bonzoms.person.firstName=First name
-chorem.bonzoms.person.firstName.required=You must enter the person first name
+chorem.bonzoms.person.firstName.required=You must enter the person''s first name
chorem.bonzoms.person.lastName=Last name
-chorem.bonzoms.person.lastName.required=You must enter the person last name
+chorem.bonzoms.person.lastName.required=You must enter the person''s last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
@@ -43,12 +58,12 @@
chorem.gepeto.projectDetails.title=Details of project {0}
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
-chorem.gepeto.projectOrder.beginDate=Begin date
+chorem.gepeto.projectOrder.beginDate=Begin date (dd/mm/yyyy)
chorem.gepeto.projectOrder.beginDate.required=You must provide a begin date for this project order
chorem.gepeto.projectOrder.create.error=An error occurred while creating your new project order, please try again. If the problem persists, please contact an administrator
chorem.gepeto.projectOrder.description=Description
chorem.gepeto.projectOrder.description.required=You must describe the project order
-chorem.gepeto.projectOrder.estimatedEndDate=Estimated end date
+chorem.gepeto.projectOrder.estimatedEndDate=Estimated end date (dd/mm/yyyy)
chorem.gepeto.projectOrder.estimatedEndDate.required=You must enter the estimated end date for this project order
chorem.gepeto.projectOrder.type=Type
chorem.gepeto.projectOrder.type.required=You must specify the project order''s type
@@ -56,7 +71,7 @@
chorem.gepeto.results.title=Results by year
chorem.gepeto.task=Task {0}
chorem.gepeto.task.add=Add a new task
-chorem.gepeto.task.beginDate=Begin date
+chorem.gepeto.task.beginDate=Begin date (dd/mm/yyyy)
chorem.gepeto.task.beginDate.required=You must enter the begin date for this task
chorem.gepeto.task.create.error=An error occurred while creating your new task, please try again. If the problem persists, please contact an administrator
chorem.gepeto.task.description=Description
@@ -64,11 +79,11 @@
chorem.gepeto.task.estimatedDays=Estimated days
chorem.gepeto.task.estimatedDays.required=You must enter the estimated number of days for this task
chorem.gepeto.task.estimatedDays.wrongFormat=The estimated days must be a positive integer
-chorem.gepeto.task.estimatedEndDate=Estimated end date
+chorem.gepeto.task.estimatedEndDate=Estimated end date (dd/mm/yyyy)
chorem.gepeto.task.estimatedEndDate.required=You must enter the estimated end date for this task
chorem.gepeto.task.name=Task name
-chorem.gepeto.task.name.required=You must enter the task name
+chorem.gepeto.task.name.required=You must enter the task''s name
chorem.gepeto.task.price=Price
-chorem.gepeto.task.price.required=You must enter the task price
+chorem.gepeto.task.price.required=You must enter the task''s price
chorem.gepeto.task.price.wrongFormat=The price must be a positive integer or floating point number (the decimal mark may be either a dot or a comma)
chorem.home=Home
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 11:01:27 UTC (rev 43)
@@ -8,21 +8,32 @@
chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
+chorem.bonzoms.contactDetails.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle m\u00E9thode de contact, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
chorem.bonzoms.employmentContract=Contrat de travail
chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
+chorem.bonzoms.employmentContract.beginDate=Date de d\u00E9but
+chorem.bonzoms.employmentContract.beginDate.required=Vous devez renseigner la date de d\u00E9but du contrat de travail
chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.description.required=Vous devez d\u00E9crire le contrat de travail
+chorem.bonzoms.employmentContract.endDate=Date de fin
chorem.bonzoms.employmentContract.salary=Salaire
+chorem.bonzoms.employmentContract.salary.required=Vous devez entrer le salaire de l'employ\u00E9
+chorem.bonzoms.employmentContract.salary.wrongFormat=Le salaire doit \u00EAtre un entier positif ou un nombre \u00E0 virgule flottante positif (le s\u00E9parateur d\u00E9cimal peut \u00EAtre un point ou une virgule)
chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.type.required=Vous devez sp\u00E9cifier le type du contrat de travail
chorem.bonzoms.employmentContract.workingTime=Temps de travail
+chorem.bonzoms.employmentContract.workingTime.required=Vous devez saisir le temps de travail de l'employ\u00E9
+chorem.bonzoms.employmentContract.workingTime.wrongFormat=Le temps de travail doit \u00EAtre un entier positif
+chorem.bonzoms.employmentcontract.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de travail, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
chorem.bonzoms.person.birthDate.required=Vous devez entrer la date de naissance de la personne
-chorem.bonzoms.person.create.error=
+chorem.bonzoms.person.create.error=Une erreur s''est produite lors de l''ajout de la personne, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entr\u00E9e est incorrecte
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,21 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.name.required" />
+ </field-validator>
+ </field>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.type.required" />
+ </field-validator>
+ </field>
+ <field name="value">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.contactDetails.value.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/ContactDetailsAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,49 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.type.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.description.required" />
+ </field-validator>
+ </field>
+ <field name="salary">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.salary.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)([\.,][0-9]+)?]]></param>
+ <message key="chorem.bonzoms.employmentContract.salary.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="workingTime">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.workingTime.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)]]></param>
+ <message key="chorem.bonzoms.employmentContract.workingTime.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="beginDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.employmentContract.beginDate.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="endDate">
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/EmploymentContractAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 09:14:58 UTC (rev 42)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 11:01:27 UTC (rev 43)
@@ -34,9 +34,22 @@
<result name="error">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
<result type="redirectAction">home</result>
</action>
- <action name="addContactDetails">
+ <action name="addContactDetails_input">
<result>/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
</action>
+ <action name="addContactDetails" class="org.chorem.bonzoms.action.ContactDetailsAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
+ <action name="addEmploymentContract_input">
+ <result>/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ </action>
+ <action name="addEmploymentContract" class="org.chorem.bonzoms.action.EmploymentContractAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
</package>
<package name="gepeto" namespace="/gepeto" extends="struts-default">
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp 2011-03-25 11:01:27 UTC (rev 43)
@@ -0,0 +1,34 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.bonzoms.employmentContract.add" /></title>
+ <s:head />
+ </head>
+ <body>
+ <h2><s:text name="chorem.bonzoms.employmentContract.add" /></h2>
+ <s:actionerror />
+ <s:form action="addEmploymentContract" method="post">
+ <fieldset>
+ <legend><s:text name="chorem.bonzoms.employmentContract" /></legend>
+ <s:textfield key="chorem.bonzoms.employmentContract.type" name="type" labelSeparator=": " />
+ <br />
+ <br />
+ <s:textarea key="chorem.bonzoms.employmentContract.description" name="description" cols="50" rows="10" labelposition="top" />
+ <br />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.salary" name="salary" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.workingTime" name="workingTime" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.beginDate" name="beginDate" labelSeparator=": " />
+ <br />
+ <s:textfield key="chorem.bonzoms.employmentContract.endDate" name="endDate" labelSeparator=": " />
+ <br />
+ <s:submit key="chorem.bonzoms.person.add" name="submit" />
+ </fieldset>
+ </s:form>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addEmploymentContract.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
1
0
r42 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources resources/i18n
by vbriand@users.chorem.org 25 Mar '11
by vbriand@users.chorem.org 25 Mar '11
25 Mar '11
Author: vbriand
Date: 2011-03-25 10:14:58 +0100 (Fri, 25 Mar 2011)
New Revision: 42
Url: http://chorem.org/repositories/revision/chorem/42
Log:
Added missing information in struts.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-25 09:14:58 UTC (rev 42)
@@ -69,6 +69,9 @@
newPerson.setFirstName(firstName);
newPerson.setLastName(lastName);
newPerson.setEmail(email);
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
try {
newPerson.setBirthDate(formatter.parse(birthDate));
} catch (ParseException e) {
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-25 09:14:58 UTC (rev 42)
@@ -2,13 +2,19 @@
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
-chorem.bonzoms.company.name=Company name
-chorem.bonzoms.company.type=Company type
+chorem.bonzoms.company.name=Company''s name
+chorem.bonzoms.company.type=Company''s type
chorem.bonzoms.contactDetails=Contact details
chorem.bonzoms.contactDetails.add=Add a new contact details
-chorem.bonzoms.contactDetails.name=Contact details name
-chorem.bonzoms.contactDetails.type=Contact details type
-chorem.bonzoms.contactDetails.value=Contact details value
+chorem.bonzoms.contactDetails.name=Contact details'' name
+chorem.bonzoms.contactDetails.type=Contact details'' type
+chorem.bonzoms.contactDetails.value=Contact details'' value
+chorem.bonzoms.employmentContract=Employment contract
+chorem.bonzoms.employmentContract.add=Add a new employment contract
+chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.salary=Salary
+chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.workingTime=Working time
chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
@@ -32,8 +38,8 @@
chorem.gepeto.project.create.error=An error occurred while creating your new project, please try again. If the problem persists, please contact an administrator
chorem.gepeto.project.description=Description
chorem.gepeto.project.description.required=You must describe the project
-chorem.gepeto.project.name=Project name
-chorem.gepeto.project.name.required=You must enter the project name
+chorem.gepeto.project.name=Project''s name
+chorem.gepeto.project.name.required=You must enter the project''s name
chorem.gepeto.projectDetails.title=Details of project {0}
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-25 09:14:58 UTC (rev 42)
@@ -11,6 +11,12 @@
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.employmentContract=Contrat de travail
+chorem.bonzoms.employmentContract.add=Ajouter un nouveau contrat de travail
+chorem.bonzoms.employmentContract.description=Description
+chorem.bonzoms.employmentContract.salary=Salaire
+chorem.bonzoms.employmentContract.type=Type
+chorem.bonzoms.employmentContract.workingTime=Temps de travail
chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
@@ -19,9 +25,9 @@
chorem.bonzoms.person.create.error=
chorem.bonzoms.person.email=Email
chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
-chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entrée est incorrecte
+chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entr\u00E9e est incorrecte
chorem.bonzoms.person.firstName=Pr\u00E9nom
-chorem.bonzoms.person.firstName.required=Vous devez entrer le prénom de la personne
+chorem.bonzoms.person.firstName.required=Vous devez entrer le pr\u00E9nom de la personne
chorem.bonzoms.person.lastName=Nom
chorem.bonzoms.person.lastName.required=Vous devez entrer le nom de la personne
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 17:08:31 UTC (rev 41)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-25 09:14:58 UTC (rev 42)
@@ -14,6 +14,7 @@
</package>
<package name="bonzoms" namespace="/bonzoms" extends="struts-default">
+ <default-action-ref name="home" />
<action name="home">
<result>/WEB-INF/jsp/bonzoms/home.jsp</result>
</action>
@@ -25,9 +26,14 @@
<result name="error">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
<result type="redirectAction">home</result>
</action>
- <action name="addPersonPage">
+ <action name="addPerson_input">
<result>/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
</action>
+ <action name="addPerson" class="org.chorem.bonzoms.action.PersonAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
<action name="addContactDetails">
<result>/WEB-INF/jsp/bonzoms/addContactDetails.jsp</result>
</action>
@@ -57,6 +63,9 @@
<result name="error">/WEB-INF/jsp/gepeto/addTask.jsp</result>
<result type="redirectAction">home</result>
</action>
+ <action name="addProjectOrder_input">
+ <result>/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
+ </action>
<action name="addProjectOrder" class="org.chorem.gepeto.action.ProjectOrderAction" method="add">
<result name="input">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
<result name="error">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
1
0
r41 - in trunk/chorem-web/src/main: java/org/chorem/bonzoms/action resources/i18n resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 18:08:31 +0100 (Thu, 24 Mar 2011)
New Revision: 41
Url: http://chorem.org/repositories/revision/chorem/41
Log:
New class with validation for adding a person
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
Modified:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
Modified: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 17:08:31 UTC (rev 41)
@@ -56,7 +56,7 @@
proxy.store(newCompany);
} catch (Exception e) {
result = false;
- addActionError(getText(n_("chorem.gepeto.company.create.error")));
+ addActionError(getText(n_("chorem.bonzoms.company.create.error")));
log.error("An error occured while creating a new company", e);
}
return result;
@@ -68,18 +68,21 @@
public String getName() {
return name;
}
+
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
+
/**
* @return the type
*/
public String getType() {
return type;
}
+
/**
* @param type the type to set
*/
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java 2011-03-24 17:08:31 UTC (rev 41)
@@ -0,0 +1,145 @@
+package org.chorem.bonzoms.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.PersonImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Person management class
+ *
+ * @author vbriand
+ */
+public class PersonAction extends BaseAction {
+
+ private static final long serialVersionUID = -5757750975509965421L;
+
+ private static final Log log = LogFactory.getLog(PersonAction.class);
+
+ /**
+ * Adds a new person
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the person has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (firstName != null && lastName != null && email != null &&
+ birthDate != null) {
+ if (!firstName.isEmpty() && !lastName.isEmpty() &&
+ !email.isEmpty() && !birthDate.isEmpty()) {
+ //If the person has been added successfully
+ if (addPerson()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String firstName;
+ protected String lastName;
+ protected String email;
+ protected String birthDate;
+
+ /**
+ * Stores the new person through the proxy
+ *
+ * @return true if the person has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addPerson() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ PersonImpl newPerson = new PersonImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ newPerson.setFirstName(firstName);
+ newPerson.setLastName(lastName);
+ newPerson.setEmail(email);
+ try {
+ newPerson.setBirthDate(formatter.parse(birthDate));
+ } catch (ParseException e) {
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newPerson);
+ }
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.bonzoms.person.create.error")));
+ log.error("An error occured while creating a new person", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * @param firstName the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * @param lastName the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @return the email
+ */
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * @param email the email to set
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ * @return the birthDate
+ */
+ public String getBirthDate() {
+ return birthDate;
+ }
+
+ /**
+ * @param birthDate the birthDate to set
+ */
+ public void setBirthDate(String birthDate) {
+ this.birthDate = birthDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/PersonAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 17:08:31 UTC (rev 41)
@@ -1,6 +1,7 @@
chorem.beginDate.beforeToday=The date cannot be set before today''s date
chorem.bonzoms.company=Company {0}
chorem.bonzoms.company.add=Add a new company
+chorem.bonzoms.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.company.name=Company name
chorem.bonzoms.company.type=Company type
chorem.bonzoms.contactDetails=Contact details
@@ -12,14 +13,19 @@
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
chorem.bonzoms.person.birthDate=Birth date
+chorem.bonzoms.person.birthDate.required=You must enter the person birth date
+chorem.bonzoms.person.create.error=An error occurred while adding the person, please try again. If the problem persists, please contact an administrator
chorem.bonzoms.person.email=Email
+chorem.bonzoms.person.email.required=You must enter the person email
+chorem.bonzoms.person.email.wrongFormat=The email format is invalid
chorem.bonzoms.person.firstName=First name
+chorem.bonzoms.person.firstName.required=You must enter the person first name
chorem.bonzoms.person.lastName=Last name
+chorem.bonzoms.person.lastName.required=You must enter the person last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
chorem.error.internal=An internal error occurred
-chorem.gepeto.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.gepeto.home=Home
chorem.gepeto.project=Project {0}
chorem.gepeto.project.add=Add a new project
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 17:08:31 UTC (rev 41)
@@ -1,6 +1,7 @@
chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
+chorem.bonzoms.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
@@ -14,14 +15,19 @@
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
+chorem.bonzoms.person.birthDate.required=Vous devez entrer la date de naissance de la personne
+chorem.bonzoms.person.create.error=
chorem.bonzoms.person.email=Email
+chorem.bonzoms.person.email.required=Vous devez entrer l''adresse email de la personne
+chorem.bonzoms.person.email.wrongFormat=L''adresse email que vous avez entrée est incorrecte
chorem.bonzoms.person.firstName=Pr\u00E9nom
+chorem.bonzoms.person.firstName.required=Vous devez entrer le prénom de la personne
chorem.bonzoms.person.lastName=Nom
+chorem.bonzoms.person.lastName.required=Vous devez entrer le nom de la personne
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but
chorem.error.internal=Une erreur interne s''est produite
-chorem.gepeto.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.home=Accueil
chorem.gepeto.project=Projet {0}
chorem.gepeto.project.add=Ajouter un nouveau projet
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml 2011-03-24 17:08:31 UTC (rev 41)
@@ -0,0 +1,29 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="firstName">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.firstName.required" />
+ </field-validator>
+ </field>
+ <field name="lastName">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.lastName.required" />
+ </field-validator>
+ </field>
+ <field name="email">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.email.required" />
+ </field-validator>
+ <field-validator type="email">
+ <message key="chorem.bonzoms.person.email.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="birthDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.person.birthDate.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/PersonAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-24 16:17:08 UTC (rev 40)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addPerson.jsp 2011-03-24 17:08:31 UTC (rev 41)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.bonzoms.person.add" /></h2>
+ <s:actionerror />
<s:form action="addPerson" method="post">
<fieldset>
<legend><s:text name="chorem.bonzoms.person" /></legend>
1
0
r40 - in trunk/chorem-web/src/main: java/org/chorem java/org/chorem/bonzoms java/org/chorem/bonzoms/action java/org/chorem/gepeto/action resources resources/i18n resources/org/chorem resources/org/chorem/bonzoms resources/org/chorem/bonzoms/action webapp/WEB-INF/jsp/bonzoms webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 17:17:08 +0100 (Thu, 24 Mar 2011)
New Revision: 40
Url: http://chorem.org/repositories/revision/chorem/40
Log:
New class with validation for adding a company
Added:
trunk/chorem-web/src/main/java/org/chorem/bonzoms/
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/
trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/
trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
Modified:
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/struts.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
Added: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,89 @@
+package org.chorem.bonzoms.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.CompanyImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Company management class
+ *
+ * @author vbriand
+ */
+public class CompanyAction extends BaseAction {
+
+ private static final long serialVersionUID = 2266576941588474102L;
+
+ private static final Log log = LogFactory.getLog(CompanyAction.class);
+
+ public String add() {
+ String result = INPUT;
+
+ if (name != null && type != null) {
+ if (!name.isEmpty() && !type.isEmpty()) {
+ //If the company has been added successfully
+ if (addCompany()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String name;
+ protected String type;
+
+ /**
+ * Stores the new company through the proxy
+ *
+ * @return true if the company has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addCompany() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ CompanyImpl newCompany = new CompanyImpl();
+
+ newCompany.setName(name);
+ newCompany.setType(type);
+ proxy.store(newCompany);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.gepeto.company.create.error")));
+ log.error("An error occured while creating a new company", e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/bonzoms/action/CompanyAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -57,6 +57,30 @@
protected String description;
/**
+ * Stores the new project through the proxy
+ *
+ * @return true if the project has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addProject() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ ProjectImpl newProject = new ProjectImpl();
+
+ newProject.setDescription(description);
+ newProject.setName(name);
+ proxy.store(newProject);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.gepeto.project.create.error")));
+ log.error("An error occured while creating a new project", e);
+ }
+ return result;
+ }
+
+ /**
* @return the name
*/
public String getName() {
@@ -83,28 +107,4 @@
public void setDescription(String description) {
this.description = description;
}
-
- /**
- * Stores the new project through the proxy
- *
- * @return true if the project has been stored properly
- * @return false if a problem occurred
- */
- protected boolean addProject() {
- boolean result = true;
-
- try {
- ChoremProxy proxy = getChoremProxy();
- ProjectImpl newProject = new ProjectImpl();
-
- newProject.setDescription(description);
- newProject.setName(name);
- proxy.store(newProject);
- } catch (Exception e) {
- result = false;
- addActionError(getText(n_("chorem.gepeto.project.create.error")));
- log.error("An error occured while creating a new project", e);
- }
- return result;
- }
}
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -33,7 +33,7 @@
public String add() {
String result = INPUT;
- if (type!= null && description != null &&
+ if (type != null && description != null &&
beginDate != null && estimatedEndDate != null) {
if (!type.isEmpty() && !description.isEmpty()) {
//If the project order has been added successfully
@@ -87,7 +87,7 @@
addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
}
- //If the estimated end date is before the begin date (...)
+ //If the estimated end date is anterior to the begin date (...)
if (newProjectOrder.getEndDate().before(newProjectOrder.getBeginDate())) {
result = false;
addActionError(getText(n_("chorem.endDate.afterBegin")));
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 16:17:08 UTC (rev 40)
@@ -94,7 +94,7 @@
addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
}
- //If the estimated end date is before the begin date (...)
+ //If the estimated end date is anterior to the begin date (...)
if (newTask.getEndDate().before(newTask.getBeginDate())) {
result = false;
addActionError(getText(n_("chorem.endDate.afterBegin")));
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 16:17:08 UTC (rev 40)
@@ -8,6 +8,7 @@
chorem.bonzoms.contactDetails.name=Contact details name
chorem.bonzoms.contactDetails.type=Contact details type
chorem.bonzoms.contactDetails.value=Contact details value
+chorem.bonzoms.home=Home
chorem.bonzoms.person=Person
chorem.bonzoms.person.add=Add a new person
chorem.bonzoms.person.birthDate=Birth date
@@ -16,8 +17,9 @@
chorem.bonzoms.person.lastName=Last name
chorem.config.configFileName.description=chorem''s configuration filename
chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
-chorem.endDate.afterBegin=The end date cannot be before the begin date
+chorem.endDate.afterBegin=The end date cannot be posterior to the begin date
chorem.error.internal=An internal error occurred
+chorem.gepeto.company.create.error=An error occurred while creating your new company, please try again. If the problem persists, please contact an administrator
chorem.gepeto.home=Home
chorem.gepeto.project=Project {0}
chorem.gepeto.project.add=Add a new project
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 16:17:08 UTC (rev 40)
@@ -1,13 +1,16 @@
-chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre inf\u00E9rieure \u00E0 la date du jour
+chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre ant\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
+chorem.bonzoms.company.name.required=Vous devez entrer le nom de la soci\u00E9t\u00E9
chorem.bonzoms.company.type=Type de la soci\u00E9t\u00E9
+chorem.bonzoms.company.type.required=Vous devez entrer le type de la soci\u00E9t\u00E9
chorem.bonzoms.contactDetails=M\u00E9thode de contact
chorem.bonzoms.contactDetails.add=Ajouter une nouvelle m\u00E9thode de contact
chorem.bonzoms.contactDetails.name=Nom de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.type=Type de la m\u00E9thode de contact
chorem.bonzoms.contactDetails.value=Valeur de la m\u00E9thode de contact
+chorem.bonzoms.home=Accueil
chorem.bonzoms.person=Personne
chorem.bonzoms.person.add=Ajouter une nouvelle personne
chorem.bonzoms.person.birthDate=Date de naissance
@@ -16,8 +19,9 @@
chorem.bonzoms.person.lastName=Nom
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
-chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre inf\u00E9rieure \u00E0 la date de d\u00E9but
+chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but
chorem.error.internal=Une erreur interne s''est produite
+chorem.gepeto.company.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle soci\u00E9t\u00E9, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.home=Accueil
chorem.gepeto.project=Projet {0}
chorem.gepeto.project.add=Ajouter un nouveau projet
Added: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,16 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="name">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.name.required" />
+ </field-validator>
+ </field>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.bonzoms.company.type.required" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/bonzoms/action/CompanyAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 16:17:08 UTC (rev 40)
@@ -17,9 +17,14 @@
<action name="home">
<result>/WEB-INF/jsp/bonzoms/home.jsp</result>
</action>
- <action name="addCompanyPage">
+ <action name="addCompany_input">
<result>/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
</action>
+ <action name="addCompany" class="org.chorem.bonzoms.action.CompanyAction" method="add">
+ <result name="input">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
+ <result name="error">/WEB-INF/jsp/bonzoms/addCompany.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
<action name="addPersonPage">
<result>/WEB-INF/jsp/bonzoms/addPerson.jsp</result>
</action>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/addCompany.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.bonzoms.company.add" /></h2>
+ <s:actionerror />
<s:form action="addCompany" method="post">
<fieldset>
<legend>
Added: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp (rev 0)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -0,0 +1,12 @@
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="chorem.bonzoms.home" /></title>
+ <s:head />
+ </head>
+ <body>
+ </body>
+</html>
Property changes on: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/bonzoms/home.jsp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 15:19:11 UTC (rev 39)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 16:17:08 UTC (rev 40)
@@ -15,8 +15,10 @@
<legend><s:text name="chorem.gepeto.projectOrder" /></legend>
<s:textfield key="chorem.gepeto.projectOrder.type" name="type" labelSeparator=": " />
<br />
- <s:textfield key="chorem.gepeto.projectOrder.description" name="description" labelSeparator=": " />
<br />
+ <s:textarea key="chorem.gepeto.projectOrder.description" name="description" cols="50" rows="10" labelposition="top" />
+ <br />
+ <br />
<s:textfield key="chorem.gepeto.projectOrder.beginDate" name="beginDate" labelSeparator=": " />
<br />
<s:textfield key="chorem.gepeto.projectOrder.estimatedEndDate" name="estimatedEndDate" labelSeparator=": " />
1
0
r39 - in trunk/chorem-web/src/main: java/org/chorem/gepeto/action resources resources/i18n resources/org/chorem/gepeto/action webapp/WEB-INF/jsp/gepeto
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 16:19:11 +0100 (Thu, 24 Mar 2011)
New Revision: 39
Url: http://chorem.org/repositories/revision/chorem/39
Log:
Added new user input controls when adding a task or a project order
Added:
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectOrderAction-validation.xml
Modified:
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/org/chorem/gepeto/action/TaskAction-validation.xml
trunk/chorem-web/src/main/resources/struts.xml
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addTask.jsp
Added: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java (rev 0)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java 2011-03-24 15:19:11 UTC (rev 39)
@@ -0,0 +1,168 @@
+package org.chorem.gepeto.action;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.ChoremProxy;
+import org.chorem.action.BaseAction;
+import org.chorem.entities.ProjectOrderImpl;
+
+import static org.nuiton.i18n.I18n.n_;
+
+/**
+ * Project order management class
+ *
+ * @author vbriand
+ */
+public class ProjectOrderAction extends BaseAction {
+
+ private static final long serialVersionUID = -5469320345746533520L;
+
+ private static final Log log = LogFactory.getLog(ProjectOrderAction.class);
+
+ /**
+ * Adds a new project order
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the project order has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (type!= null && description != null &&
+ beginDate != null && estimatedEndDate != null) {
+ if (!type.isEmpty() && !description.isEmpty()) {
+ //If the project order has been added successfully
+ if (addProjectOrder()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
+ protected String type;
+ protected String description;
+ protected String beginDate;
+ protected String estimatedEndDate;
+
+ /**
+ * Stores the new project order through the proxy
+ *
+ * @return true if the project order has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addProjectOrder() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ ProjectOrderImpl newProjectOrder = new ProjectOrderImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
+
+ newProjectOrder.setType(type);
+ newProjectOrder.setDescription(description);
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
+ try {
+ Calendar cal = Calendar.getInstance();
+
+ newProjectOrder.setBeginDate(formatter.parse(beginDate));
+ newProjectOrder.setEndDate(formatter.parse(estimatedEndDate));
+
+ //Subtracts 1 day to the current time so the next test willn't
+ //fail if the begin date is today's date, as the before() method
+ //is exclusive
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ //If the begin date is set before the current date
+ if (newProjectOrder.getBeginDate().before(cal.getTime())) {
+ result = false;
+ addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
+ }
+
+ //If the estimated end date is before the begin date (...)
+ if (newProjectOrder.getEndDate().before(newProjectOrder.getBeginDate())) {
+ result = false;
+ addActionError(getText(n_("chorem.endDate.afterBegin")));
+ }
+ } catch (ParseException e) {
+ //If the date doesn't match the format above
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newProjectOrder);
+ }
+ } 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);
+ }
+ return result;
+ }
+
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @param type the type to set
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the beginDate
+ */
+ public String getBeginDate() {
+ return beginDate;
+ }
+
+ /**
+ * @param beginDate the beginDate to set
+ */
+ public void setBeginDate(String beginDate) {
+ this.beginDate = beginDate;
+ }
+
+ /**
+ * @return the estimatedEndDate
+ */
+ public String getEstimatedEndDate() {
+ return estimatedEndDate;
+ }
+
+ /**
+ * @param estimatedEndDate the estimatedEndDate to set
+ */
+ public void setEstimatedEndDate(String estimatedEndDate) {
+ this.estimatedEndDate = estimatedEndDate;
+ }
+}
Property changes on: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectOrderAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 15:19:11 UTC (rev 39)
@@ -3,7 +3,9 @@
*/
package org.chorem.gepeto.action;
-import java.util.Date;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,9 +36,11 @@
public String add() {
String result = INPUT;
- if (name != null && description != null &&
- beginDate != null && estimatedEndDate != null) {
- if (!name.isEmpty() && !description.isEmpty()) {
+ if (name != null && description != null && price != null &&
+ estimatedDays != null && beginDate != null &&
+ estimatedEndDate != null) {
+ if (!name.isEmpty() && !description.isEmpty() &&
+ !price.isEmpty() && !estimatedDays.isEmpty()) {
//If the task has been added successfully
if (addTask()) {
result = SUCCESS;
@@ -52,8 +56,8 @@
protected String description;
protected String price;
protected String estimatedDays;
- protected Date beginDate;
- protected Date estimatedEndDate;
+ protected String beginDate;
+ protected String estimatedEndDate;
/**
* Stores the new task through the proxy
@@ -67,14 +71,50 @@
try {
ChoremProxy proxy = getChoremProxy();
TaskImpl newTask = new TaskImpl();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
newTask.setDescription(description);
newTask.setName(name);
- newTask.setBeginDate(beginDate);
- newTask.setEndDate(estimatedEndDate);
+
+ //Lenient mode disabled because results may be very odd
+ formatter.setLenient(false);
+ try {
+ Calendar cal = Calendar.getInstance();
+
+ newTask.setBeginDate(formatter.parse(beginDate));
+ newTask.setEndDate(formatter.parse(estimatedEndDate));
+
+ //Subtracts 1 day to the current time so the next test willn't
+ //fail if the begin date is today's date, as the before() method
+ //is exclusive
+ cal.add(Calendar.DAY_OF_MONTH, -1);
+ //If the begin date is set before the current date
+ if (newTask.getBeginDate().before(cal.getTime())) {
+ result = false;
+ addFieldError("beginDate", getText(n_("chorem.beginDate.beforeToday")));
+ }
+
+ //If the estimated end date is before the begin date (...)
+ if (newTask.getEndDate().before(newTask.getBeginDate())) {
+ result = false;
+ addActionError(getText(n_("chorem.endDate.afterBegin")));
+ }
+ } catch (ParseException e) {
+ //If the date doesn't match the format above
+ result = false;
+ addActionError(getText(n_("chorem.date.wrongFormat")));
+ }
+
newTask.setEstimatedDays(Integer.parseInt(estimatedDays));
+ //Replaces the (possible) comma by a dot, so the string can be
+ //parsed successfully as a float
+ price = price.replace(',', '.');
newTask.setPrice(Float.parseFloat(price));
- proxy.store(newTask);
+
+ //If everything went smoothly
+ if (result) {
+ proxy.store(newTask);
+ }
} catch (Exception e) {
result = false;
addActionError(getText(n_("chorem.gepeto.task.create.error")));
@@ -142,28 +182,28 @@
/**
* @return the beginDate
*/
- public Date getBeginDate() {
+ public String getBeginDate() {
return beginDate;
}
/**
* @param beginDate the beginDate to set
*/
- public void setBeginDate(Date beginDate) {
+ public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
/**
* @return the estimatedEndDate
*/
- public Date getEstimatedEndDate() {
+ public String getEstimatedEndDate() {
return estimatedEndDate;
}
/**
* @param estimatedEndDate the estimatedEndDate to set
*/
- public void setEstimatedEndDate(Date estimatedEndDate) {
+ public void setEstimatedEndDate(String estimatedEndDate) {
this.estimatedEndDate = estimatedEndDate;
}
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 15:19:11 UTC (rev 39)
@@ -1,3 +1,4 @@
+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.name=Company name
@@ -14,6 +15,8 @@
chorem.bonzoms.person.firstName=First name
chorem.bonzoms.person.lastName=Last name
chorem.config.configFileName.description=chorem''s configuration filename
+chorem.date.wrongFormat=The date must be in the following format \: dd/mm/yyyy
+chorem.endDate.afterBegin=The end date cannot be before the begin date
chorem.error.internal=An internal error occurred
chorem.gepeto.home=Home
chorem.gepeto.project=Project {0}
@@ -27,9 +30,14 @@
chorem.gepeto.projectOrder=Project order
chorem.gepeto.projectOrder.add=Add a new project order
chorem.gepeto.projectOrder.beginDate=Begin date
+chorem.gepeto.projectOrder.beginDate.required=You must provide a begin date for this project order
+chorem.gepeto.projectOrder.create.error=An error occurred while creating your new project order, please try again. If the problem persists, please contact an administrator
chorem.gepeto.projectOrder.description=Description
+chorem.gepeto.projectOrder.description.required=You must describe the project order
chorem.gepeto.projectOrder.estimatedEndDate=Estimated end date
+chorem.gepeto.projectOrder.estimatedEndDate.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.title=Projects of year {0}
chorem.gepeto.results.title=Results by year
chorem.gepeto.task=Task {0}
@@ -37,7 +45,6 @@
chorem.gepeto.task.beginDate=Begin date
chorem.gepeto.task.beginDate.required=You must enter the begin date for this task
chorem.gepeto.task.create.error=An error occurred while creating your new task, please try again. If the problem persists, please contact an administrator
-chorem.gepeto.task.date.wrongFormat=The date must be in the following format \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=You must describe the task
chorem.gepeto.task.estimatedDays=Estimated days
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 15:19:11 UTC (rev 39)
@@ -1,3 +1,4 @@
+chorem.beginDate.beforeToday=La date entr\u00E9e ne peut \u00EAtre inf\u00E9rieure \u00E0 la date du jour
chorem.bonzoms.company=Soci\u00E9t\u00E9
chorem.bonzoms.company.add=Ajouter une nouvelle soci\u00E9t\u00E9
chorem.bonzoms.company.name=Nom de la soci\u00E9t\u00E9
@@ -14,6 +15,8 @@
chorem.bonzoms.person.firstName=Pr\u00E9nom
chorem.bonzoms.person.lastName=Nom
chorem.config.configFileName.description=Nom du fichier de configuration de chorem
+chorem.date.wrongFormat=La date doit respecter le format suivant \: jj/mm/yyyy
+chorem.endDate.afterBegin=La date de fin ne doit pas pas \u00EAtre inf\u00E9rieure \u00E0 la date de d\u00E9but
chorem.error.internal=Une erreur interne s''est produite
chorem.gepeto.home=Accueil
chorem.gepeto.project=Projet {0}
@@ -27,9 +30,14 @@
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
+chorem.gepeto.projectOrder.beginDate.required=Vous devez renseigner une date de d\u00E9but pour le contrat
+chorem.gepeto.projectOrder.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouveau contrat de projet, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.projectOrder.description=Description
+chorem.gepeto.projectOrder.description.required=Vous devez d\u00E9crire le contrat
chorem.gepeto.projectOrder.estimatedEndDate=Date de fin estim\u00E9e
+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.title=Projets de l''ann\u00E9e {0}
chorem.gepeto.results.title=R\u00E9sultats par ann\u00E0e
chorem.gepeto.task=T\u00E2che {0}
@@ -37,7 +45,6 @@
chorem.gepeto.task.beginDate=Date de d\u00E9but
chorem.gepeto.task.beginDate.required=Vous devez renseigner la date de d\u00E9but de la t\u00E2che
chorem.gepeto.task.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle t\u00E2che, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
-chorem.gepeto.task.date.wrongFormat=La date doit respecter le format suivant \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=Vous devez d\u00E9crire la t\u00E2che
chorem.gepeto.task.estimatedDays=Nombre de jours estim\u00E9s
Added: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectOrderAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectOrderAction-validation.xml (rev 0)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectOrderAction-validation.xml 2011-03-24 15:19:11 UTC (rev 39)
@@ -0,0 +1,34 @@
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="type">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.projectOrder.type.required" />
+ </field-validator>
+ </field>
+ <field name="description">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.projectOrder.description.required" />
+ </field-validator>
+ </field>
+ <field name="beginDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.projectOrder.beginDate.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+ <field name="estimatedEndDate">
+ <field-validator type="requiredstring">
+ <message key="chorem.gepeto.projectOrder.estimatedEndDate.required" />
+ </field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.date.wrongFormat" />
+ </field-validator>
+ </field>
+</validators>
Property changes on: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/ProjectOrderAction-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-24 15:19:11 UTC (rev 39)
@@ -32,21 +32,21 @@
</field-validator>
</field>
<field name="beginDate">
- <field-validator type="required">
+ <field-validator type="requiredstring">
<message key="chorem.gepeto.task.beginDate.required" />
</field-validator>
<field-validator type="regex">
<param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
- <message key="chorem.gepeto.task.date.wrongFormat" />
+ <message key="chorem.date.wrongFormat" />
</field-validator>
</field>
<field name="estimatedEndDate">
- <field-validator type="required">
+ <field-validator type="requiredstring">
<message key="chorem.gepeto.task.estimatedEndDate.required" />
</field-validator>
<field-validator type="regex">
<param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
- <message key="chorem.gepeto.task.date.wrongFormat" />
+ <message key="chorem.date.wrongFormat" />
</field-validator>
</field>
</validators>
Modified: trunk/chorem-web/src/main/resources/struts.xml
===================================================================
--- trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/resources/struts.xml 2011-03-24 15:19:11 UTC (rev 39)
@@ -52,8 +52,10 @@
<result name="error">/WEB-INF/jsp/gepeto/addTask.jsp</result>
<result type="redirectAction">home</result>
</action>
- <action name="addProjectOrder">
- <result>/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
+ <action name="addProjectOrder" class="org.chorem.gepeto.action.ProjectOrderAction" method="add">
+ <result name="input">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
+ <result name="error">/WEB-INF/jsp/gepeto/addProjectOrder.jsp</result>
+ <result type="redirectAction">home</result>
</action>
</package>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addProjectOrder.jsp 2011-03-24 15:19:11 UTC (rev 39)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.gepeto.projectOrder.add" /></h2>
+ <s:actionerror />
<s:form action="addProjectOrder" method="post">
<fieldset>
<legend><s:text name="chorem.gepeto.projectOrder" /></legend>
Modified: trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addTask.jsp
===================================================================
--- trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addTask.jsp 2011-03-24 10:30:02 UTC (rev 38)
+++ trunk/chorem-web/src/main/webapp/WEB-INF/jsp/gepeto/addTask.jsp 2011-03-24 15:19:11 UTC (rev 39)
@@ -9,6 +9,7 @@
</head>
<body>
<h2><s:text name="chorem.gepeto.task.add" /></h2>
+ <s:actionerror />
<s:form action="addTask" method="post">
<fieldset>
<legend>
1
0
r38 - in trunk/chorem-web/src/main: java/org/chorem/gepeto/action resources/i18n resources/org/chorem/gepeto/action
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 11:30:02 +0100 (Thu, 24 Mar 2011)
New Revision: 38
Url: http://chorem.org/repositories/revision/chorem/38
Log:
Implemented TaskAction's add method
Modified:
trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.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/org/chorem/gepeto/action/TaskAction-validation.xml
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 09:47:31 UTC (rev 37)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/ProjectAction.java 2011-03-24 10:30:02 UTC (rev 38)
@@ -5,6 +5,7 @@
import org.chorem.ChoremProxy;
import org.chorem.action.BaseAction;
import org.chorem.entities.ProjectImpl;
+
import static org.nuiton.i18n.I18n.n_;
/**
@@ -17,39 +18,8 @@
private static final long serialVersionUID = 498267854350348906L;
private static final Log log = LogFactory.getLog(ProjectAction.class);
-
- protected String name;
- protected String description;
/**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name: the project name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the project description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description: the project description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
* Adds a new project
*
* @return INPUT if the mandatory fields haven't all been filled in
@@ -79,8 +49,40 @@
* @return
*/
public String remove() {
+ //TODO: implement
return SUCCESS;
}
+
+ protected String name;
+ protected String description;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name: the project name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the project description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description: the project description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
/**
* Stores the new project through the proxy
Modified: trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java
===================================================================
--- trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 09:47:31 UTC (rev 37)
+++ trunk/chorem-web/src/main/java/org/chorem/gepeto/action/TaskAction.java 2011-03-24 10:30:02 UTC (rev 38)
@@ -3,10 +3,16 @@
*/
package org.chorem.gepeto.action;
+import java.util.Date;
+
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.TaskImpl;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* Task management class
*
@@ -18,14 +24,66 @@
private static final Log log = LogFactory.getLog(TaskAction.class);
+ /**
+ * Adds a new task
+ *
+ * @return INPUT if the mandatory fields haven't all been filled in
+ * @return SUCCESS if the task has been added successfully
+ * @return ERROR if an error occurred
+ */
+ public String add() {
+ String result = INPUT;
+
+ if (name != null && description != null &&
+ beginDate != null && estimatedEndDate != null) {
+ if (!name.isEmpty() && !description.isEmpty()) {
+ //If the task has been added successfully
+ if (addTask()) {
+ result = SUCCESS;
+ } else {
+ result = ERROR;
+ }
+ }
+ }
+ return result;
+ }
+
protected String name;
protected String description;
protected String price;
protected String estimatedDays;
- protected String beginDate;
- protected String estimatedEndDate;
+ protected Date beginDate;
+ protected Date estimatedEndDate;
/**
+ * Stores the new task through the proxy
+ *
+ * @return true if the task has been stored properly
+ * @return false if a problem occurred
+ */
+ protected boolean addTask() {
+ boolean result = true;
+
+ try {
+ ChoremProxy proxy = getChoremProxy();
+ TaskImpl newTask = new TaskImpl();
+
+ newTask.setDescription(description);
+ newTask.setName(name);
+ newTask.setBeginDate(beginDate);
+ newTask.setEndDate(estimatedEndDate);
+ newTask.setEstimatedDays(Integer.parseInt(estimatedDays));
+ newTask.setPrice(Float.parseFloat(price));
+ proxy.store(newTask);
+ } catch (Exception e) {
+ result = false;
+ addActionError(getText(n_("chorem.gepeto.task.create.error")));
+ log.error("An error occured while creating a new task", e);
+ }
+ return result;
+ }
+
+ /**
* @return the name
*/
public String getName() {
@@ -84,40 +142,28 @@
/**
* @return the beginDate
*/
- public String getBeginDate() {
+ public Date getBeginDate() {
return beginDate;
}
/**
* @param beginDate the beginDate to set
*/
- public void setBeginDate(String beginDate) {
+ public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
/**
* @return the estimatedEndDate
*/
- public String getEstimatedEndDate() {
+ public Date getEstimatedEndDate() {
return estimatedEndDate;
}
/**
* @param estimatedEndDate the estimatedEndDate to set
*/
- public void setEstimatedEndDate(String estimatedEndDate) {
+ public void setEstimatedEndDate(Date estimatedEndDate) {
this.estimatedEndDate = estimatedEndDate;
}
-
- /**
- * Adds a new task
- *
- * @return INPUT if the mandatory fields haven't all been filled in
- * @return SUCCESS if the task has been added successfully
- * @return ERROR if an error occurred
- */
- public String add() {
- //TODO: implement
- return SUCCESS;
- }
}
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 09:47:31 UTC (rev 37)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 10:30:02 UTC (rev 38)
@@ -36,6 +36,7 @@
chorem.gepeto.task.add=Add a new task
chorem.gepeto.task.beginDate=Begin date
chorem.gepeto.task.beginDate.required=You must enter the begin date for this task
+chorem.gepeto.task.create.error=An error occurred while creating your new task, please try again. If the problem persists, please contact an administrator
chorem.gepeto.task.date.wrongFormat=The date must be in the following format \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=You must describe the task
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 09:47:31 UTC (rev 37)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 10:30:02 UTC (rev 38)
@@ -36,6 +36,7 @@
chorem.gepeto.task.add=Ajouter une nouvelle t\u00E2che
chorem.gepeto.task.beginDate=Date de d\u00E9but
chorem.gepeto.task.beginDate.required=Vous devez renseigner la date de d\u00E9but de la t\u00E2che
+chorem.gepeto.task.create.error=Une erreur s''est produite lors de la cr\u00E9ation de votre nouvelle t\u00E2che, merci d''essayer \u00E0 nouveau. Si le probl\u00E8me se reproduit, merci de contacter un administrateur
chorem.gepeto.task.date.wrongFormat=La date doit respecter le format suivant \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=Vous devez d\u00E9crire la t\u00E2che
Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-24 09:47:31 UTC (rev 37)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-24 10:30:02 UTC (rev 38)
@@ -32,7 +32,7 @@
</field-validator>
</field>
<field name="beginDate">
- <field-validator type="requiredstring">
+ <field-validator type="required">
<message key="chorem.gepeto.task.beginDate.required" />
</field-validator>
<field-validator type="regex">
@@ -41,7 +41,7 @@
</field-validator>
</field>
<field name="estimatedEndDate">
- <field-validator type="requiredstring">
+ <field-validator type="required">
<message key="chorem.gepeto.task.estimatedEndDate.required" />
</field-validator>
<field-validator type="regex">
1
0
r37 - in trunk/chorem-web/src/main/resources: i18n org/chorem/gepeto/action
by vbriand@users.chorem.org 24 Mar '11
by vbriand@users.chorem.org 24 Mar '11
24 Mar '11
Author: vbriand
Date: 2011-03-24 10:47:31 +0100 (Thu, 24 Mar 2011)
New Revision: 37
Url: http://chorem.org/repositories/revision/chorem/37
Log:
Added validation for TaskAction
Modified:
trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties
trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml
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-18 17:09:22 UTC (rev 36)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_en_GB.properties 2011-03-24 09:47:31 UTC (rev 37)
@@ -36,14 +36,17 @@
chorem.gepeto.task.add=Add a new task
chorem.gepeto.task.beginDate=Begin date
chorem.gepeto.task.beginDate.required=You must enter the begin date for this task
+chorem.gepeto.task.date.wrongFormat=The date must be in the following format \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=You must describe the task
chorem.gepeto.task.estimatedDays=Estimated days
chorem.gepeto.task.estimatedDays.required=You must enter the estimated number of days for this task
+chorem.gepeto.task.estimatedDays.wrongFormat=The estimated days must be a positive integer
chorem.gepeto.task.estimatedEndDate=Estimated end date
chorem.gepeto.task.estimatedEndDate.required=You must enter the estimated end date for this task
chorem.gepeto.task.name=Task name
chorem.gepeto.task.name.required=You must enter the task name
chorem.gepeto.task.price=Price
chorem.gepeto.task.price.required=You must enter the task price
+chorem.gepeto.task.price.wrongFormat=The price must be a positive integer or floating point number (the decimal mark may be either a dot or a comma)
chorem.home=Home
Modified: trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties
===================================================================
--- trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-18 17:09:22 UTC (rev 36)
+++ trunk/chorem-web/src/main/resources/i18n/chorem-web_fr_FR.properties 2011-03-24 09:47:31 UTC (rev 37)
@@ -36,14 +36,17 @@
chorem.gepeto.task.add=Ajouter une nouvelle t\u00E2che
chorem.gepeto.task.beginDate=Date de d\u00E9but
chorem.gepeto.task.beginDate.required=Vous devez renseigner la date de d\u00E9but de la t\u00E2che
+chorem.gepeto.task.date.wrongFormat=La date doit respecter le format suivant \: XX/YY/ZZZZ
chorem.gepeto.task.description=Description
chorem.gepeto.task.description.required=Vous devez d\u00E9crire la t\u00E2che
chorem.gepeto.task.estimatedDays=Nombre de jours estim\u00E9s
chorem.gepeto.task.estimatedDays.required=Vous devez renseigner le nombre de jours estim\u00E9s
+chorem.gepeto.task.estimatedDays.wrongFormat=Le nombre de jours estim\u00E9 doit \u00EAtre un entier positif
chorem.gepeto.task.estimatedEndDate=Date de fin estim\u00E9e
chorem.gepeto.task.estimatedEndDate.required=Vous devez renseigner la date de fin de la t\u00E2che
chorem.gepeto.task.name=Nom de la t\u00E2che
chorem.gepeto.task.name.required=Vous devez donner un nom \u00E0 cette t\u00E2che
chorem.gepeto.task.price=Prix
chorem.gepeto.task.price.required=Vous devez donner un prix \u00E0 cette t\u00E2che
+chorem.gepeto.task.price.wrongFormat=Le prix doit \u00EAtre un entier positif ou un nombre \u00E0 virgule flottante positif (le s\u00E9parateur d\u00E9cimal peut \u00EAtre un point ou une virgule)
chorem.home=Accueil
Modified: trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml
===================================================================
--- trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-18 17:09:22 UTC (rev 36)
+++ trunk/chorem-web/src/main/resources/org/chorem/gepeto/action/TaskAction-validation.xml 2011-03-24 09:47:31 UTC (rev 37)
@@ -17,20 +17,36 @@
<field-validator type="requiredstring">
<message key="chorem.gepeto.task.price.required" />
</field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)([\.,][0-9]+)?]]></param>
+ <message key="chorem.gepeto.task.price.wrongFormat" />
+ </field-validator>
</field>
<field name="estimatedDays">
<field-validator type="requiredstring">
<message key="chorem.gepeto.task.estimatedDays.required" />
</field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]+)]]></param>
+ <message key="chorem.gepeto.task.estimatedDays.wrongFormat" />
+ </field-validator>
</field>
<field name="beginDate">
<field-validator type="requiredstring">
<message key="chorem.gepeto.task.beginDate.required" />
</field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.gepeto.task.date.wrongFormat" />
+ </field-validator>
</field>
<field name="estimatedEndDate">
<field-validator type="requiredstring">
<message key="chorem.gepeto.task.estimatedEndDate.required" />
</field-validator>
+ <field-validator type="regex">
+ <param name="expression"><![CDATA[([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})]]></param>
+ <message key="chorem.gepeto.task.date.wrongFormat" />
+ </field-validator>
</field>
</validators>
1
0