Wao-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
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
April 2014
- 5 participants
- 162 discussions
r1857 - trunk/wao-persistence/src/main/java/fr/ifremer/wao
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:07:49 +0200 (Mon, 07 Apr 2014)
New Revision: 1857
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1857
Log:
add method to translate I18nAble
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-04-07 17:07:12 UTC (rev 1856)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-04-07 17:07:49 UTC (rev 1857)
@@ -21,9 +21,11 @@
* #L%
*/
+import fr.ifremer.wao.entity.I18nAble;
import fr.ifremer.wao.entity.ObsProgram;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils;
+import org.nuiton.i18n.I18n;
import java.text.DateFormat;
import java.text.ParseException;
@@ -35,8 +37,6 @@
import java.util.Locale;
import java.util.regex.Pattern;
-import static org.nuiton.i18n.I18n.l;
-
public class WaoUtils {
@Deprecated
@@ -78,29 +78,33 @@
}
public static String formatTime(Locale locale, Date date) {
- return l(locale, "wao.time.formatter", date);
+ return I18n.l(locale, "wao.time.formatter", date);
}
public static String formatDateTime(Locale locale, Date date) {
- return l(locale, "wao.datetime.formatter", date);
+ return I18n.l(locale, "wao.datetime.formatter", date);
}
public static String formatDate(Locale locale, Date date) {
- return l(locale, "wao.date.formatter", date);
+ return I18n.l(locale, "wao.date.formatter", date);
}
public static String formatMonth(Locale locale, Date date) {
- return l(locale, "wao.month.formatter", date);
+ return I18n.l(locale, "wao.month.formatter", date);
}
public static Date parseMonth(Locale locale, String monthYear) throws ParseException {
- String pattern = l(locale, "wao.month.pattern");
+ String pattern = I18n.l(locale, "wao.month.pattern");
DateFormat dateFormat = new SimpleDateFormat(pattern);
return dateFormat.parse(monthYear);
}
+ public static String l(Locale locale, I18nAble i18nAble) {
+ return I18n.l(locale, i18nAble.getI18nKey());
+ }
+
public static Pattern getSampleRowCodePattern(ObsProgram obsProgram) {
- return Pattern.compile("^(\\d{4})_" + obsProgram.getShortCode() + "(\\d{4})$");
+ return Pattern.compile("^(\\d{4})_" + obsProgram.getShortCode() + "(\\d{4})$");
}
public static <T extends Enum> Collection<Integer> toOrdinals(Collection<T> enums) {
1
0
r1856 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-services/src/main/java/fr/ifremer/wao/services/service wao-services/src/main/java/fr/ifremer/wao/services/service/administration
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:07:12 +0200 (Mon, 07 Apr 2014)
New Revision: 1856
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1856
Log:
fix serializable on exceptions
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -23,6 +23,8 @@
public class WaoException extends Exception {
+ private static final long serialVersionUID = 1L;
+
public WaoException() {
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -23,6 +23,8 @@
public class WaoTechnicalException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
public WaoTechnicalException() {
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class SampleRowCodeMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class CompanyNameMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -26,6 +26,8 @@
public class InactiveWaoUserException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected WaoUser waoUser;
public InactiveWaoUserException(WaoUser waoUser) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class LoginMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -26,6 +26,8 @@
public class NoRoleAttributedException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected WaoUser waoUser;
public NoRoleAttributedException(WaoUser waoUser) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -27,6 +27,8 @@
public class UnknownBoatImmatriculationsException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected Set<String> immatriculations;
public UnknownBoatImmatriculationsException(Set<String> immatriculations) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,6 +25,8 @@
public class UnknownFishingGearDcfCodeException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected String code;
public UnknownFishingGearDcfCodeException(String code) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,6 +25,8 @@
public class UnknownTargetSpeciesDcfCodeException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected String code;
public UnknownTargetSpeciesDcfCodeException(String code) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class WrongCredentialsException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
1
0
r1855 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:05:49 +0200 (Mon, 07 Apr 2014)
New Revision: 1855
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1855
Log:
use new topia api
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-04-07 14:36:01 UTC (rev 1854)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-04-07 17:05:49 UTC (rev 1855)
@@ -258,7 +258,7 @@
Preconditions.checkState(
!getObsProgram().equals(ObsProgram.OBSDEB),
"opération non prévue pour ObsDeb");
- if (CollectionUtils.isNotEmpty(getSampleMonth())) {
+ if (isSampleMonthNotEmpty()) {
for (SampleMonth sampleMonth : getSampleMonth()) {
if (sampleMonth.isPeriodDatesContains(date)) {
return sampleMonth;
1
0
r1854 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 16:36:01 +0200 (Mon, 07 Apr 2014)
New Revision: 1854
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1854
Log:
refs #4490 fix query generation for boats registration code filter
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 14:17:38 UTC (rev 1853)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 14:36:01 UTC (rev 1854)
@@ -100,9 +100,9 @@
}
if (StringUtils.isNotEmpty(filter.getRegistrationCode())) {
- //FIXME !
- query.addLike(Boat.PROPERTY_IMMATRICULATION + "::text", filter.getRegistrationCode() + "%");
+ query.addWhereClause("str(b." + Boat.PROPERTY_IMMATRICULATION + ") like :registrationCode", ImmutableMap.of("registrationCode", (Object) (filter.getRegistrationCode() + "%")));
}
+
if (CollectionUtils.isNotEmpty(filter.getShipOwnerIds())) {
query.addWhereClause(
"b.topiaId IN (SELECT b2.topiaId FROM fr.ifremer.wao.entity.BoatImpl AS b2 JOIN b2.shipOwner AS shipOwner WHERE shipOwner.topiaId IN (:shipOwnerIds))",
1
0
r1853 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp wao-web/src/main/webapp/WEB-INF wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 16:17:38 +0200 (Mon, 07 Apr 2014)
New Revision: 1853
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1853
Log:
refs #4490 add boat infos form
Added:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml
trunk/wao-web/src/main/webapp/enpoints-js.jsp
trunk/wao-web/src/main/webapp/wao.css
trunk/wao-web/src/main/webapp/wao.js
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 14:17:38 UTC (rev 1853)
@@ -27,6 +27,7 @@
import fr.ifremer.wao.WaoTechnicalException;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.BoatInfos;
+import fr.ifremer.wao.entity.BoatInfosImpl;
import fr.ifremer.wao.entity.BoatInfosTopiaDao;
import fr.ifremer.wao.entity.BoatTopiaDao;
import fr.ifremer.wao.entity.Company;
@@ -152,6 +153,20 @@
public BoatDetails getBoatDetails(ObsProgram obsProgram, String boatId, String companyId) {
+ BoatInfos boatInfos = getBoatInfos(boatId, companyId);
+
+ Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId);
+
+ long count = getContactDao().newQueryBuilder().addTopiaIdEquals(Contact.PROPERTY_BOAT, boatId).count();
+
+ BoatDetails boatDetails = new BoatDetails(boatInfos, mostRecentContact);
+
+ return boatDetails;
+
+ }
+
+ public BoatInfos getBoatInfos(String boatId, String companyId) {
+
BoatInfosTopiaDao dao = getBoatInfosDao();
Optional<BoatInfos> optionalBoatInfos =
@@ -166,19 +181,26 @@
} else {
Boat boat = getBoatDao().findByTopiaId(boatId);
Company company = getCompanyDao().findByTopiaId(companyId);
- boatInfos = dao.create(BoatInfos.PROPERTY_BOAT, boat,
- BoatInfos.PROPERTY_COMPANY, company);
- commit();
+ boatInfos = new BoatInfosImpl();
+ boatInfos.setBoat(boat);
+ boatInfos.setCompany(company);
}
- Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId);
+ return boatInfos;
- long count = getContactDao().newQueryBuilder().addTopiaIdEquals(Contact.PROPERTY_BOAT, boatId).count();
+ }
- BoatDetails boatDetails = new BoatDetails(boatInfos, mostRecentContact);
+ public void saveBoatInfos(BoatInfos boatInfos) {
- return boatDetails;
+ BoatInfosTopiaDao dao = getBoatInfosDao();
+ if (boatInfos.isPersisted()) {
+ dao.update(boatInfos);
+ } else {
+ dao.create(boatInfos);
+ }
+
+ commit();
+
}
-
}
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java 2014-04-07 14:17:38 UTC (rev 1853)
@@ -0,0 +1,59 @@
+package fr.ifremer.wao.web.action.obsmer;
+
+import com.google.common.base.Preconditions;
+import com.opensymphony.xwork2.Preparable;
+import fr.ifremer.wao.entity.BoatInfos;
+import fr.ifremer.wao.services.service.ObsMerBoatsService;
+import fr.ifremer.wao.web.WaoJsonActionSupport;
+
+public class UpdateBoatInfosJsonAction extends WaoJsonActionSupport implements Preparable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected transient ObsMerBoatsService service;
+
+ protected String companyId;
+
+ protected String boatId;
+
+ protected BoatInfos boatInfos;
+
+ public void setService(ObsMerBoatsService service) {
+ this.service = service;
+ }
+
+ public void setCompanyId(String companyId) {
+ this.companyId = companyId;
+ }
+
+ public void setBoatId(String boatId) {
+ this.boatId = boatId;
+ }
+
+ @Override
+ public void prepare() {
+
+ Preconditions.checkState(session.getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId));
+
+ boatInfos = service.getBoatInfos(boatId, companyId);
+
+ }
+
+ public BoatInfos getBoatInfos() {
+ return boatInfos;
+ }
+
+ public void setBoatInfos(BoatInfos boatInfos) {
+ this.boatInfos = boatInfos;
+ }
+
+ @Override
+ public String execute() {
+
+ service.saveBoatInfos(boatInfos);
+
+ return SUCCESS;
+
+ }
+
+}
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-07 14:17:38 UTC (rev 1853)
@@ -97,6 +97,8 @@
wao.ui.boats.boatName=Name
wao.ui.boats.buildYear=Build year
wao.ui.boats.district=District
+wao.ui.boats.info=Details
+wao.ui.boats.interlocutor=Interlocutor
wao.ui.boats.nbObservations=%s observation(s), %s with your company (all programs considered)
wao.ui.boats.portOfRegistry=Port
wao.ui.boats.portOfRegistry.description=It's the main operating port of the boat
@@ -264,6 +266,7 @@
wao.ui.forgotPassword=Forgot password ?
wao.ui.form.Boat.name=Name
wao.ui.form.Boat.registrationCode=Registration number
+wao.ui.form.BoatInfos.success=Modifications successfuly saved
wao.ui.form.Company.error.nameMustBeUnique=Company name must be unique
wao.ui.form.Company.title.creation=Create a new company
wao.ui.form.Company.title.edition=Edit company %s
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-07 14:17:38 UTC (rev 1853)
@@ -97,6 +97,8 @@
wao.ui.boats.boatName=Nom
wao.ui.boats.buildYear=Année de construction
wao.ui.boats.district=Quartier maritime
+wao.ui.boats.info=Autres informations sur ce navire
+wao.ui.boats.interlocutor=Coordonnées de l'interlocuteur
wao.ui.boats.nbObservations=%s observation(s) dont %s avec votre société
wao.ui.boats.portOfRegistry=Port
wao.ui.boats.portOfRegistry.description=Il s'agit du port d'exploitation principal du navire
@@ -264,6 +266,7 @@
wao.ui.forgotPassword=Mot de passe oublié ?
wao.ui.form.Boat.name=Nom
wao.ui.form.Boat.registrationCode=Immatriculation
+wao.ui.form.BoatInfos.success=Les informations ont bien été enregistrées
wao.ui.form.Company.error.nameMustBeUnique=Le nom de la société doit être unique
wao.ui.form.Company.title.creation=Création d'une société
wao.ui.form.Company.title.edition=Modification de la société %s
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -21,48 +21,53 @@
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@taglib uri="/struts-tags" prefix="s" %>
-<table class="table">
- <caption>
- <s:text name="wao.ui.contact.lastContact"/>
- </caption>
- <tbody>
- <tr>
- <th>
- <s:text name="wao.ui.field.Boat.shipOwner"/>
- </th>
- <td>
- <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/>
- <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/>
+<h2>
+ <s:text name="wao.ui.boatinfo.title">
+ <s:param value="boatDetails.boatInfos.boat.name"/>
+ </s:text>
+</h2>
- <s:url action="boats" id="shipOwnerBoatsUrl">
- <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/>
- </s:url>
- <s:a href="%{shipOwnerBoatsUrl}">
- <s:text name="wao.ui.action.viewShipOwnerBoats"/>
- </s:a>
- </td>
- </tr>
- <tr>
- <th>
- <s:text name="wao.ui.field.Boat.boatGroup"/>
- </th>
- <td>
- <s:if test="boatDetails.boatInfos.boat.boatGroup == null">
- <s:text name="wao.ui.misc.N/A"/>
- </s:if>
- <s:else>
- <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/>
- </s:else>
- </td>
- </tr>
- </tbody>
-</table>
+<script>
+ $(document).ready(function () {
+ $boatInfosForm = $('#boat-infos-form');
+
+ $('#save-boat-infos').click(function () {
+ var data = {};
+ $boatInfosForm.find('input').each(function (index, input) {
+ var $input = $(input);
+ var parameterName = $input.prop('name');
+ if (parameterName.indexOf('__') === 0) {
+ return;
+ }
+ var parameterValue;
+ if ($input.attr('type') === 'checkbox') {
+ parameterValue = $input.prop('checked');
+ } else {
+ parameterValue = $input.prop('value');
+ }
+ data[parameterName] = parameterValue;
+ });
+ var successCallback = function () {
+ WAO.notifications.success('<s:text name="wao.ui.form.BoatInfos.success"/>');
+ }
+ WAO.post(WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL, data, successCallback);
+ });
+
+ $('#unlock-boat-infos-form').click(function () {
+ $boatInfosForm.find('input[readOnly="true"], button').removeAttr('readOnly').removeAttr('disabled');
+ $(this).attr('disabled', 'disabled');
+ });
+ });
+</script>
+
<s:if test="boatDetails.mostRecentContact != null">
+
+ <h3>
+ <s:text name="wao.ui.contact.lastContact"/>
+ </h3>
+
<table class="table">
- <caption>
- <s:text name="wao.ui.contact.lastContact"/>
- </caption>
<tbody>
<tr>
<th>
@@ -100,10 +105,15 @@
</table>
</s:if>
-<s:form cssClass="form-horizontal">
+<h3>
+ <s:text name="wao.ui.boats.interlocutor"/>
+</h3>
- <s:hidden name="boatInfosId" value="%{boatDetails.boatInfos.topiaId}" />
+<s:form id="boat-infos-form" cssClass="form-horizontal">
+ <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" />
+ <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" />
+
<s:textfield name="boatInfos.contactFirstName" value="%{boatDetails.boatInfos.contactFirstName}" label="%{getText('wao.ui.field.BoatInfos.contactFirstName')}" readOnly="true" />
<s:textfield name="boatInfos.contactLastName" value="%{boatDetails.boatInfos.contactLastName}" label="%{getText('wao.ui.field.BoatInfos.contactLastName')}" readOnly="true" />
<s:textfield type="email" name="boatInfos.contactEmail" value="%{boatDetails.boatInfos.contactEmail}" label="%{getText('wao.ui.field.BoatInfos.contactEmail')}" readOnly="true" />
@@ -115,9 +125,20 @@
<s:textfield name="boatInfos.contactCity" value="%{boatDetails.boatInfos.contactCity}" label="%{getText('wao.ui.field.BoatInfos.contactCity')}" readOnly="true" />
<s:textfield name="boatInfos.comment" value="%{boatDetails.boatInfos.comment}" label="%{getText('wao.ui.field.BoatInfos.comment')}" readOnly="true" />
+ <button type="button" id="unlock-boat-infos-form" class="btn">
+ <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" />
+ </button>
+
+ <button type="button" id="save-boat-infos" class="btn" disabled="disabled">
+ <i class="icon-hdd"></i> <s:text name="wao.ui.action.save" />
+ </button>
+
</s:form>
-<s:text name="wao.ui.boats.associatedLine"/>
+
+<h3>
+ <s:text name="wao.ui.boats.associatedLine"/>
+</h3>
<ul>
<s:iterator value="boatDetails.boatInfos.boat.elligibleBoat">
<li>
@@ -128,3 +149,41 @@
</li>
</s:iterator>
</ul>
+
+<h3>
+ <s:text name="wao.ui.boats.info"/>
+</h3>
+
+<table class="table">
+ <tbody>
+ <tr>
+ <th>
+ <s:text name="wao.ui.field.Boat.shipOwner"/>
+ </th>
+ <td>
+ <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/>
+ <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/>
+
+ <s:url action="boats" id="shipOwnerBoatsUrl">
+ <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/>
+ </s:url>
+ <s:a href="%{shipOwnerBoatsUrl}">
+ <s:text name="wao.ui.action.viewShipOwnerBoats"/>
+ </s:a>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <s:text name="wao.ui.field.Boat.boatGroup"/>
+ </th>
+ <td>
+ <s:if test="boatDetails.boatInfos.boat.boatGroup == null">
+ <s:text name="wao.ui.misc.N/A"/>
+ </s:if>
+ <s:else>
+ <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/>
+ </s:else>
+ </td>
+ </tr>
+ </tbody>
+</table>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -143,13 +143,13 @@
</div>
<div>
+ <h2>
+ <s:text name="wao.ui.boats.title">
+ <s:param value="%{pagination.nbRecords}"/>
+ </s:text>
+ </h2>
<table id="boats-list" class="table-condensed table-striped table-hover">
- <caption>
- <s:text name="wao.ui.boats.title">
- <s:param value="%{pagination.nbRecords}"/>
- </s:text>
- </caption>
<thead>
<tr>
<th>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml 2014-04-07 14:17:38 UTC (rev 1853)
@@ -23,6 +23,7 @@
<pattern>/css/*</pattern>
<pattern>/img/*</pattern>
<pattern>*?*fragment=true*</pattern>
+ <pattern>*-json*</pattern>
</excludes>
<decorator name="layout-login" page="layout-login.jsp">
Modified: trunk/wao-web/src/main/webapp/enpoints-js.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -29,6 +29,8 @@
WAO.OBSMER_SAMPLE_ROWS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="sample-rows-filter-values-json"/>';
WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="boats-filter-values-json"/>';
WAO.OBSMER_CONTACTS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="contacts-filter-values-json"/>';
+ WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/obsmer" action="update-boat-infos-json"/>';
+
});
Modified: trunk/wao-web/src/main/webapp/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-04-07 14:17:38 UTC (rev 1853)
@@ -292,7 +292,7 @@
}
#boats-filters-list-details-layout > div {
- margin-left: 20px;
+ margin-left: 50px;
}
#boats-filters-list-details-layout > div:nth-child(3) {
Modified: trunk/wao-web/src/main/webapp/wao.js
===================================================================
--- trunk/wao-web/src/main/webapp/wao.js 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/wao.js 2014-04-07 14:17:38 UTC (rev 1853)
@@ -54,7 +54,7 @@
this.$selects.each(function (index, select) {
var $select = $(select);
var parameterName = $select.prop('name');
- if (parameterName.indexOf('__') == 0) {
+ if (parameterName.indexOf('__') === 0) {
return;
}
var parameterValues = [];
@@ -66,11 +66,11 @@
this.$inputs.each(function (index, input) {
var $input = $(input);
var parameterName = $input.prop('name');
- if (parameterName.indexOf('__') == 0) {
+ if (parameterName.indexOf('__') === 0) {
return;
}
var parameterValue;
- if ($input.attr('type') == 'checkbox') {
+ if ($input.attr('type') === 'checkbox') {
parameterValue = $input.prop('checked');
} else {
parameterValue = $input.prop('value');
@@ -115,7 +115,7 @@
var parameterName = $input.prop('name');
var parameterValue = filter[parameterName];
$input.prop('value', parameterValue);
- if ($input.attr('type') == 'checkbox') {
+ if ($input.attr('type') === 'checkbox') {
$input.prop('checked', parameterValue);
}
});
@@ -238,6 +238,16 @@
$.get(url, data, stopSpinningAfterCallingSuccessCallback);
}
+ this.post = function (url, data, successCallback) {
+ this.startSpinner();
+ var stopSpinningAfterCallingSuccessCallback = function () {
+ var result = successCallback.apply(this, arguments);
+ self.stopSpinner();
+ return result;
+ };
+ $.post(url, data, stopSpinningAfterCallingSuccessCallback);
+ }
+
};
$(document).ready(function () {
1
0
r1852 - in trunk/wao-services/src/main: java/fr/ifremer/wao/services/service resources/i18n
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 13:01:57 +0200 (Mon, 07 Apr 2014)
New Revision: 1852
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1852
Log:
refs #4487 fix filterValues for observedDataControl
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 11:01:57 UTC (rev 1852)
@@ -120,7 +120,9 @@
}
ObservedDataControl observedDataControl = contact.getObservedDataControl();
- if (observedDataControl != null) {
+ if (observedDataControl == null) {
+ observedDataControls.add(FilterOption.forValueAndLabel("", l(locale, "wao.business.observedDataControl.undefined")));
+ } else {
observedDataControls.add(FilterOption.forEnum(locale, observedDataControl));
}
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 11:01:57 UTC (rev 1852)
@@ -8,15 +8,15 @@
csv.import.error.unableToSetValue=Unable to set value '%s' (entity '%s', line %s, column '%s')
csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s.
csv.import.logComment=Edited through import
-wao.business.completeSampling.undefined=Undefined
-wao.business.completeSampling.true=Yes
-wao.business.completeSampling.false=No
fr.ifremer.wao.services.service.mail.UserCredentialsEmail.subject=Your Wao credentials
wao.action.delete.failure.attachedContacts=Object is attached to some contacts.
wao.action.delete.failure.attachedNews=Object is attached to some news.
wao.action.delete.failure.attachedSampleRows=Object is attached to some sample rows.
wao.action.delete.failure.attachedWaoUsers=Object is attached to some users.
wao.business.boat.validation.immatriculation.wrongFormat=The boat registry number must be composed of 6 digits
+wao.business.completeSampling.false=No
+wao.business.completeSampling.true=Yes
+wao.business.completeSampling.undefined=Undefined
wao.business.contact.validation.commentAdminNecessaryForDataReliability=You must precise in admin comment why data reliability is '%s'
wao.business.contact.validation.commentMissingForState=You must give a comment for state '%s'
wao.business.contact.validation.contactStateMotifMissing=You must precise a motif for the refusal
@@ -28,6 +28,7 @@
wao.business.entity.UserProfile.description=%s on %s%s
wao.business.mammalsCapture.mail.message=Hello,\n\nAn observer of the ObsMer program provided to WAO the following information\:\n\nTide\: %s\nProfession\: %s\n\nAccidental capture\:\n%s\n\nBest regards,\n\nObsmer program\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information about an accidental capture
+wao.business.observedDataControl.undefined=Undefined
wao.business.other=Other
wao.business.readOnly=(read-only)
wao.business.validationState.refused=Refused
@@ -40,8 +41,8 @@
wao.import.contact.failure.boatMissing=You need to precise the plate number of the boat associated to the contact
wao.import.contact.failure.districtMissing=You need to precise the boat district
wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.observation.end=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.end2=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 11:01:57 UTC (rev 1852)
@@ -13,10 +13,10 @@
wao.action.delete.failure.attachedNews=L'objet est lié à des actualités.
wao.action.delete.failure.attachedSampleRows=L'objet est lié à des lignes du plan.
wao.action.delete.failure.attachedWaoUsers=L'objet est lié à des utilisateurs.
+wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
+wao.business.completeSampling.false=Non
+wao.business.completeSampling.true=Oui
wao.business.completeSampling.undefined=Non défini
-wao.business.completeSampling.true=Oui
-wao.business.completeSampling.false=Non
-wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
wao.business.contact.validation.commentAdminNecessaryForDataReliability=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
wao.business.contact.validation.commentMissingForState=Il faut préciser un commentaire pour l'état '%s'
wao.business.contact.validation.contactStateMotifMissing=Il faut préciser un motif de refus
@@ -28,6 +28,7 @@
wao.business.entity.UserProfile.description=%s sur %s%s
wao.business.mammalsCapture.mail.message=Bonjour,\n\nUn observateur du programme Obsmer a renseigné dans WAO l'information suivante \:\n\nMarée \: %s\nMétier \: %s\n\nCapture accidentelle \:\n%s\n\nCordialement,\n\nLe programme Obsmer\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information sur capture accidentelle
+wao.business.observedDataControl.undefined=Non défini
wao.business.readOnly=(lecture seule)
wao.business.validationState.refused=Réfusé
wao.business.validationState.standby=En attente
@@ -39,8 +40,8 @@
wao.import.contact.failure.boatMissing=Il faut préciser l'immatriculation du navire associé au contact
wao.import.contact.failure.districtMissing=Il faut préciser le code d'un quartier maritime
wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.observation.end=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.end2=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
1
0
r1851 - in trunk/wao-services/src/main: java/fr/ifremer/wao/services/service resources/i18n
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 12:38:17 +0200 (Mon, 07 Apr 2014)
New Revision: 1851
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1851
Log:
refs #4487 fix filterValues for completeSampling + contactStateMotif
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:17 UTC (rev 1851)
@@ -41,6 +41,7 @@
import java.util.TreeSet;
import static org.nuiton.i18n.I18n.l;
+import static org.nuiton.i18n.I18n.n;
/**
* Created on 4/3/14.
@@ -80,7 +81,6 @@
protected SortedSet<FilterOption> programAcceptations = new TreeSet<>();
- //FIXME What to do with this ?
protected SortedSet<FilterOption> completeSamplings = new TreeSet<>();
public ContactsFilterValues(Locale locale, ObsProgram obsProgram) {
@@ -135,20 +135,29 @@
terrestrialLocations.add(FilterOption.forValueAndLabel(terrestrialLocation.getTopiaId(), terrestrialLocation.getDescription()));
}
- //FIXME ?
ContactStateMotif contactStateMotif = contact.getContactStateMotif();
if (contactStateMotif != null) {
- contactStateMotives.add(FilterOption.forValueAndLabel(contactStateMotif.getTopiaId(), contactStateMotif.getCode()));
+ contactStateMotives.add(FilterOption.forValueAndLabel(contactStateMotif.getTopiaId(), contactStateMotif.getName()));
}
+
Boolean validationCompany = contact.getValidationCompany();
- addValidationFilterOption(companyAcceptations, validationCompany);
+ addBooleanFilterOption(companyAcceptations, validationCompany,
+ n("wao.business.validationState.standby"),
+ n("wao.business.validationState.validated"),
+ n("wao.business.validationState.refused"));
Boolean validationProgram = contact.getValidationProgram();
- addValidationFilterOption(programAcceptations, validationProgram);
+ addBooleanFilterOption(programAcceptations, validationProgram,
+ n("wao.business.validationState.standby"),
+ n("wao.business.validationState.validated"),
+ n("wao.business.validationState.refused"));
- //FIXME ?
Boolean completeSampling = contact.getCompleteSampling();
+ addBooleanFilterOption(completeSamplings, completeSampling,
+ n("wao.business.completeSampling.undefined"),
+ n("wao.business.completeSampling.true"),
+ n("wao.business.completeSampling.false"));
}
public BoatsFilterValues getBoatsFilterValues() {
@@ -211,18 +220,22 @@
return completeSamplings;
}
- protected void addValidationFilterOption(SortedSet<FilterOption> options, Boolean validationState) {
+ protected void addBooleanFilterOption(SortedSet<FilterOption> options,
+ Boolean booleanValue,
+ String nullI18nKey,
+ String trueI18nKey,
+ String falseI18nKey) {
String value;
String label;
- if (validationState == null) {
+ if (booleanValue == null) {
value = null;
- label = l(locale, "wao.business.validationState.standby");
- } else if (validationState) {
- value = validationState.toString();
- label = l(locale, "wao.business.validationState.validated");
+ label = l(locale, nullI18nKey);
+ } else if (booleanValue) {
+ value = booleanValue.toString();
+ label = l(locale, trueI18nKey);
} else {
- value = validationState.toString();
- label = l(locale, "wao.business.validationState.refused");
+ value = booleanValue.toString();
+ label = l(locale, falseI18nKey);
}
options.add(FilterOption.forValueAndLabel(value, label));
}
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 10:38:17 UTC (rev 1851)
@@ -8,6 +8,9 @@
csv.import.error.unableToSetValue=Unable to set value '%s' (entity '%s', line %s, column '%s')
csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s.
csv.import.logComment=Edited through import
+wao.business.completeSampling.undefined=Undefined
+wao.business.completeSampling.true=Yes
+wao.business.completeSampling.false=No
fr.ifremer.wao.services.service.mail.UserCredentialsEmail.subject=Your Wao credentials
wao.action.delete.failure.attachedContacts=Object is attached to some contacts.
wao.action.delete.failure.attachedNews=Object is attached to some news.
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 10:38:17 UTC (rev 1851)
@@ -13,6 +13,9 @@
wao.action.delete.failure.attachedNews=L'objet est lié à des actualités.
wao.action.delete.failure.attachedSampleRows=L'objet est lié à des lignes du plan.
wao.action.delete.failure.attachedWaoUsers=L'objet est lié à des utilisateurs.
+wao.business.completeSampling.undefined=Non défini
+wao.business.completeSampling.true=Oui
+wao.business.completeSampling.false=Non
wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
wao.business.contact.validation.commentAdminNecessaryForDataReliability=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
wao.business.contact.validation.commentMissingForState=Il faut préciser un commentaire pour l'état '%s'
1
0
r1850 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 12:38:06 +0200 (Mon, 07 Apr 2014)
New Revision: 1850
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1850
Log:
refs #4483 add link to contacts for each sample row in sampling-plan
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 10:33:52 UTC (rev 1849)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 10:38:06 UTC (rev 1850)
@@ -483,7 +483,9 @@
</s:if>
<li>
<s:url action="contacts" id="viewAssociatedContactsUrl">
- <s:param name="sampleRowIds" value="sampleRowId" />
+ <s:param name="filter.sampleRowFilter.sampleRowCodes" value="code" />
+ <s:param name="filter.periodFrom" />
+ <s:param name="filter.periodTo" />
</s:url>
<s:a href="%{viewAssociatedContactsUrl}">
<s:text name="wao.ui.action.viewAssociatedContacts" />
1
0
r1849 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-persistence/src/main/java/fr/ifremer/wao/entity wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 12:33:52 +0200 (Mon, 07 Apr 2014)
New Revision: 1849
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1849
Log:
review filters (obsProgram) criteria, introduce isFilled and abstract classes for Filter and FilterValues
Added:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoFilter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/AbstractFilterValues.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValues.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoFilter.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/AbstractWaoFilter.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -0,0 +1,28 @@
+package fr.ifremer.wao;
+
+import fr.ifremer.wao.entity.ObsProgram;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+
+import java.io.Serializable;
+
+public abstract class AbstractWaoFilter implements Serializable {
+
+ protected ObsProgram obsProgram;
+
+ public AbstractWaoFilter(ObsProgram obsProgram) {
+ this.obsProgram = obsProgram;
+ }
+
+ public ObsProgram getObsProgram() {
+ return obsProgram;
+ }
+
+ /** Predicate to tell if user actually gave a criteria to filter entities. */
+ public abstract boolean isFilled();
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.reflectionToString(this);
+ }
+
+}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -21,9 +21,10 @@
* #L%
*/
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import fr.ifremer.wao.entity.ObsProgram;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
-import java.io.Serializable;
import java.util.Objects;
import java.util.Set;
@@ -33,14 +34,14 @@
* @author Tony Chemit <chemit(a)codelutin.com>
* @since 4.0
*/
-public class BoatsFilter implements Serializable {
+public class BoatsFilter extends AbstractWaoFilter {
private static final long serialVersionUID = 1L;
/**
* SampleRows filter on facade, zone, linecode.
*/
- protected SampleRowsFilter elligibleBoatsFilter;
+ protected SampleRowsFilter elligibleForSampleRowsFilter;
/**
* Filter on boat name.
@@ -77,16 +78,17 @@
*/
protected Set<String> fleetIds;
- public BoatsFilter() {
- elligibleBoatsFilter = new SampleRowsFilter();
+ public BoatsFilter(ObsProgram obsProgram) {
+ super(obsProgram);
+ elligibleForSampleRowsFilter = new SampleRowsFilter(obsProgram);
}
- public SampleRowsFilter getElligibleBoatsFilter() {
- return elligibleBoatsFilter;
+ public SampleRowsFilter getElligibleForSampleRowsFilter() {
+ return elligibleForSampleRowsFilter;
}
- public void setElligibleBoatsFilter(SampleRowsFilter elligibleBoatsFilter) {
- this.elligibleBoatsFilter = elligibleBoatsFilter;
+ public void setElligibleForSampleRowsFilter(SampleRowsFilter elligibleForSampleRowsFilter) {
+ this.elligibleForSampleRowsFilter = elligibleForSampleRowsFilter;
}
public String getBoatName() {
@@ -153,7 +155,7 @@
BoatsFilter that = (BoatsFilter) o;
- boolean equals = elligibleBoatsFilter.equals(that.elligibleBoatsFilter)
+ boolean equals = elligibleForSampleRowsFilter.equals(that.elligibleForSampleRowsFilter)
&& Objects.equals(boatName, that.boatName)
&& Objects.equals(registrationCode, that.registrationCode)
&& WaoUtils.isEqualCollection(boatIds, that.boatIds)
@@ -166,7 +168,7 @@
@Override
public int hashCode() {
- int hashCode = elligibleBoatsFilter.hashCode();
+ int hashCode = elligibleForSampleRowsFilter.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(boatName);
hashCode = 31 * hashCode + Objects.hashCode(registrationCode);
hashCode = 31 * hashCode + WaoUtils.collectionHashcode(boatIds);
@@ -178,7 +180,16 @@
}
@Override
- public String toString() {
- return ReflectionToStringBuilder.reflectionToString(this);
+ public boolean isFilled() {
+ boolean filled = StringUtils.isNoneBlank(boatName)
+ || StringUtils.isNoneBlank(registrationCode)
+ || CollectionUtils.isNotEmpty(boatIds)
+ || CollectionUtils.isNotEmpty(shipOwnerIds)
+ || CollectionUtils.isNotEmpty(districtIds)
+ || CollectionUtils.isNotEmpty(portOfRegistryIds)
+ || CollectionUtils.isNotEmpty(fleetIds)
+ || elligibleForSampleRowsFilter.isFilled();
+ return filled;
}
+
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -23,17 +23,17 @@
import fr.ifremer.wao.entity.ContactState;
import fr.ifremer.wao.entity.DataReliability;
+import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.ObservationType;
import fr.ifremer.wao.entity.ObservedDataControl;
import fr.ifremer.wao.entity.SamplingStrategy;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.collections.CollectionUtils;
-import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import java.util.Set;
-public class ContactsFilter implements Serializable {
+public class ContactsFilter extends AbstractWaoFilter {
private static final long serialVersionUID = 1L;
@@ -93,9 +93,10 @@
protected boolean sortedByBoardingDate;
- public ContactsFilter() {
- sampleRowFilter = new SampleRowsFilter();
- boatFilter = new BoatsFilter();
+ public ContactsFilter(ObsProgram obsProgram) {
+ super(obsProgram);
+ sampleRowFilter = new SampleRowsFilter(obsProgram);
+ boatFilter = new BoatsFilter(obsProgram);
}
public SampleRowsFilter getSampleRowFilter() {
@@ -283,6 +284,32 @@
}
@Override
+ public boolean isFilled() {
+ boolean filled = periodFrom != null
+ || periodTo != null
+ || CollectionUtils.isNotEmpty(contactIds)
+ || CollectionUtils.isNotEmpty(contactStates)
+ || CollectionUtils.isNotEmpty(dataReliabilities)
+ || CollectionUtils.isNotEmpty(actualSamplingStrategies)
+ || CollectionUtils.isNotEmpty(observationTypes)
+ || CollectionUtils.isNotEmpty(observedDataControls)
+ || CollectionUtils.isNotEmpty(observerIds)
+ || CollectionUtils.isNotEmpty(terrestrialLocationIds)
+ || CollectionUtils.isNotEmpty(contactStateMotiveIds)
+ || CollectionUtils.isNotEmpty(companyAcceptations)
+ || CollectionUtils.isNotEmpty(programAcceptations)
+ || CollectionUtils.isNotEmpty(completeSamplings)
+ || mammalsCaptureOnly
+ || mammalsObservationOnly
+ || commentDefinedOnly
+ || commentAdminDefinedOnly
+ || commentCompanyDefinedOnly
+ || boatFilter.isFilled()
+ || sampleRowFilter.isFilled();
+ return filled;
+ }
+
+ @Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -344,9 +371,4 @@
return hashCode;
}
- @Override
- public String toString() {
- return ReflectionToStringBuilder.reflectionToString(this);
- }
-
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -23,19 +23,16 @@
import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.SamplingStrategy;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.collections4.CollectionUtils;
-import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import java.util.Set;
-public class SampleRowsFilter implements Serializable {
+public class SampleRowsFilter extends AbstractWaoFilter {
private static final long serialVersionUID = 1L;
- protected ObsProgram obsProgram;
-
protected Set<String> sampleRowIds;
/** Filter sample rows on sample month.
@@ -70,14 +67,10 @@
protected Set<String> orderByArguments;
- public ObsProgram getObsProgram() {
- return obsProgram;
+ public SampleRowsFilter(ObsProgram obsProgram) {
+ super(obsProgram);
}
- public void setObsProgram(ObsProgram obsProgram) {
- this.obsProgram = obsProgram;
- }
-
public Date getPeriodFrom() {
return periodFrom;
}
@@ -182,9 +175,24 @@
this.sampleRowIds = sampleRowIds;
}
+ @Override
public boolean isFilled() {
- return false;
+ // volontairement, on ne considère pas ObsProgram car ce n'est pas un critère de sélection en lui-même
+ boolean filled = periodFrom != null
+ || periodTo != null
+ || CollectionUtils.isNotEmpty(sampleRowIds)
+ || CollectionUtils.isNotEmpty(fishingZoneFacadeNames)
+ || CollectionUtils.isNotEmpty(fishingZoneSectorNames)
+ || CollectionUtils.isNotEmpty(sampleRowCodes)
+ || CollectionUtils.isNotEmpty(programNames)
+ || CollectionUtils.isNotEmpty(fishingGearDcfIds)
+ || CollectionUtils.isNotEmpty(targetSpeciesDcfIds)
+ || CollectionUtils.isNotEmpty(samplingStrategies)
+ || CollectionUtils.isNotEmpty(terrestrialDistrictIds)
+ || CollectionUtils.isNotEmpty(companyIds);
+ return filled;
}
+
@Override
public boolean equals(Object o) {
@@ -228,9 +236,4 @@
return hashCode;
}
- @Override
- public String toString() {
- return ReflectionToStringBuilder.reflectionToString(this);
- }
-
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -46,7 +46,7 @@
String sortProperty,
boolean sortAscendant) {
- HqlAndParametersBuilder<Boat> query = toSampleRowHqlAndParametersBuilder(filter);
+ HqlAndParametersBuilder<Boat> query = toBoatHqlAndParametersBuilder(filter);
TopiaPagerBean pager = newPager(query.getHql(), query.getHqlParameters(), pageSize);
pager.setPageIndex(pageIndex);
@@ -58,34 +58,38 @@
public List<Boat> findAll(BoatsFilter filter) {
- HqlAndParametersBuilder<Boat> query = toSampleRowHqlAndParametersBuilder(filter);
+ HqlAndParametersBuilder<Boat> query = toBoatHqlAndParametersBuilder(filter);
List<Boat> boats = findAll(query.getHql(), query.getHqlParameters());
+
return boats;
}
public List<Boat> find(BoatsFilter filter, TopiaPagerBean pager) {
- HqlAndParametersBuilder<Boat> query = toSampleRowHqlAndParametersBuilder(filter);
+ HqlAndParametersBuilder<Boat> query = toBoatHqlAndParametersBuilder(filter);
List<Boat> boats = find(query.getHql(), query.getHqlParameters(), pager);
+
return boats;
}
- protected HqlAndParametersBuilder<Boat> toSampleRowHqlAndParametersBuilder(BoatsFilter filter) {
+ protected HqlAndParametersBuilder<Boat> toBoatHqlAndParametersBuilder(BoatsFilter filter) {
HqlAndParametersBuilder<Boat> query = newHqlAndParametersBuilder();
query.setAlias("b");
- SampleRowTopiaDao sampleRowTopiaDao =
- topiaDaoSupplier.getDao(SampleRow.class, SampleRowTopiaDao.class);
- HqlAndParametersBuilder<SampleRow> sampleRowsQuery =
- sampleRowTopiaDao.toSampleRowHqlAndParametersBuilder(
- filter.getElligibleBoatsFilter()
- );
- query.addWhereClause("b.topiaId IN (SELECT eb.boat.topiaId FROM fr.ifremer.wao.entity.ElligibleBoatImpl eb WHERE eb.sampleRow.topiaId IN ( select sr.topiaId " + sampleRowsQuery.getHql() + " ))",
- sampleRowsQuery.getHqlParameters());
+ if (filter.getElligibleForSampleRowsFilter().isFilled()) {
+ SampleRowTopiaDao sampleRowTopiaDao =
+ topiaDaoSupplier.getDao(SampleRow.class, SampleRowTopiaDao.class);
+ HqlAndParametersBuilder<SampleRow> sampleRowsQuery =
+ sampleRowTopiaDao.toSampleRowHqlAndParametersBuilder(
+ filter.getElligibleForSampleRowsFilter()
+ );
+ query.addWhereClause("b.topiaId IN (SELECT eb.boat.topiaId FROM fr.ifremer.wao.entity.ElligibleBoatImpl eb WHERE eb.sampleRow.topiaId IN ( select sr.topiaId " + sampleRowsQuery.getHql() + " ))",
+ sampleRowsQuery.getHqlParameters());
+ }
if (CollectionUtils.isNotEmpty(filter.getBoatIds())) {
query.addIn(TopiaEntity.PROPERTY_TOPIA_ID, filter.getBoatIds());
@@ -124,7 +128,7 @@
}
if (log.isTraceEnabled()) {
- log.trace("query to filter sample rows for " + filter + " is " + query.getHql() + " " + query.getHqlParameters());
+ log.trace("query to filter boats for " + filter + " is " + query.getHql() + " " + query.getHqlParameters());
}
return query;
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -87,16 +87,30 @@
query.setAlias("c");
- SampleRowTopiaDao sampleRowTopiaDao =
- topiaDaoSupplier.getDao(SampleRow.class, SampleRowTopiaDao.class);
- HqlAndParametersBuilder<SampleRow> sampleRowsQuery =
- sampleRowTopiaDao.toSampleRowHqlAndParametersBuilder(
- filter.getSampleRowFilter()
- );
- query.addWhereClause(
- "c.sampleRow.topiaId in (select sr.topiaId " + sampleRowsQuery.getHql() + ")",
- sampleRowsQuery.getHqlParameters());
+ if (filter.getSampleRowFilter().isFilled()) {
+ SampleRowTopiaDao sampleRowTopiaDao =
+ topiaDaoSupplier.getDao(SampleRow.class, SampleRowTopiaDao.class);
+ HqlAndParametersBuilder<SampleRow> sampleRowsQuery =
+ sampleRowTopiaDao.toSampleRowHqlAndParametersBuilder(
+ filter.getSampleRowFilter()
+ );
+ query.addWhereClause(
+ "c.sampleRow.topiaId in (select sr.topiaId " + sampleRowsQuery.getHql() + ")",
+ sampleRowsQuery.getHqlParameters());
+ }
+ if (filter.getBoatFilter().isFilled()) {
+ BoatTopiaDao boatTopiaDao =
+ topiaDaoSupplier.getDao(Boat.class, BoatTopiaDao.class);
+ HqlAndParametersBuilder<Boat> boatsQuery =
+ boatTopiaDao.toBoatHqlAndParametersBuilder(
+ filter.getBoatFilter()
+ );
+ query.addWhereClause(
+ "c.boat.topiaId in (select b.topiaId " + boatsQuery.getHql() + ")",
+ boatsQuery.getHqlParameters());
+ }
+
String periodProperty;
if (filter.isFilterOnObservationBeginDate()) {
periodProperty = Contact.PROPERTY_OBSERVATION_BEGIN_DATE;
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/AbstractFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/AbstractFilterValues.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/AbstractFilterValues.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -0,0 +1,26 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.ObsProgram;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public abstract class AbstractFilterValues implements Serializable {
+
+ protected Locale locale;
+
+ protected ObsProgram obsProgram;
+
+ public AbstractFilterValues(Locale locale, ObsProgram obsProgram) {
+ this.locale = locale;
+ this.obsProgram = obsProgram;
+ }
+
+ public ObsProgram getObsProgram() {
+ return obsProgram;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValues.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValues.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -25,11 +25,11 @@
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.ElligibleBoat;
import fr.ifremer.wao.entity.Fleet;
+import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.entity.ShipOwner;
import fr.ifremer.wao.entity.TerrestrialLocation;
-import java.io.Serializable;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -41,14 +41,12 @@
* @author Tony Chemit <chemit(a)codelutin.com>
* @since 4.0
*/
-public class BoatsFilterValues implements Serializable {
+public class BoatsFilterValues extends AbstractFilterValues {
private static final long serialVersionUID = 1L;
- protected Locale locale;
+ protected SampleRowsFilterValues elligibleForSampleRowsFilterValues;
- protected SampleRowsFilterValues elligibleBoatsFilterValues;
-
protected SortedSet<FilterOption> shipOwners = new TreeSet<>();
protected SortedSet<FilterOption> districts = new TreeSet<>();
@@ -57,15 +55,11 @@
protected SortedSet<FilterOption> fleets = new TreeSet<>();
- public BoatsFilterValues(Locale locale) {
- this(locale, new SampleRowsFilterValues(locale));
+ public BoatsFilterValues(Locale locale, ObsProgram obsProgram) {
+ super(locale, obsProgram);
+ this.elligibleForSampleRowsFilterValues = new SampleRowsFilterValues(locale, obsProgram);
}
- public BoatsFilterValues(Locale locale, SampleRowsFilterValues elligibleBoatsFilterValues) {
- this.locale = locale;
- this.elligibleBoatsFilterValues = elligibleBoatsFilterValues;
- }
-
public void addBoat(Boat boat) {
ShipOwner shipOwner = boat.getShipOwner();
@@ -97,12 +91,14 @@
for (ElligibleBoat elligibleBoat : boat.getElligibleBoat()) {
SampleRow sampleRow = elligibleBoat.getSampleRow();
- elligibleBoatsFilterValues.addSampleRow(sampleRow);
+ if (obsProgram.equals(sampleRow.getObsProgram())) {
+ elligibleForSampleRowsFilterValues.addSampleRow(sampleRow);
+ }
}
}
- public SampleRowsFilterValues getElligibleBoatsFilterValues() {
- return elligibleBoatsFilterValues;
+ public SampleRowsFilterValues getElligibleForSampleRowsFilterValues() {
+ return elligibleForSampleRowsFilterValues;
}
public SortedSet<FilterOption> getShipOwners() {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -26,6 +26,7 @@
import fr.ifremer.wao.entity.ContactState;
import fr.ifremer.wao.entity.ContactStateMotif;
import fr.ifremer.wao.entity.DataReliability;
+import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.ObservationType;
import fr.ifremer.wao.entity.ObservedDataControl;
import fr.ifremer.wao.entity.SampleRow;
@@ -34,7 +35,6 @@
import fr.ifremer.wao.entity.WaoUser;
import org.apache.commons.collections4.CollectionUtils;
-import java.io.Serializable;
import java.util.List;
import java.util.Locale;
import java.util.SortedSet;
@@ -48,12 +48,10 @@
* @author Tony Chemit <chemit(a)codelutin.com>
* @since 4.0
*/
-public class ContactsFilterValues implements Serializable {
+public class ContactsFilterValues extends AbstractFilterValues {
private static final long serialVersionUID = 1L;
- protected Locale locale;
-
protected BoatsFilterValues boatsFilterValues;
protected SampleRowsFilterValues sampleRowsFilterValues;
@@ -85,10 +83,10 @@
//FIXME What to do with this ?
protected SortedSet<FilterOption> completeSamplings = new TreeSet<>();
- public ContactsFilterValues(Locale locale) {
- this.locale = locale;
- this.boatsFilterValues = new BoatsFilterValues(locale);
- this.sampleRowsFilterValues = new SampleRowsFilterValues(locale);
+ public ContactsFilterValues(Locale locale, ObsProgram obsProgram) {
+ super(locale, obsProgram);
+ this.boatsFilterValues = new BoatsFilterValues(locale, obsProgram);
+ this.sampleRowsFilterValues = new SampleRowsFilterValues(locale, obsProgram);
}
public void addContact(Contact contact) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -23,9 +23,7 @@
import com.google.common.base.Charsets;
import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
import fr.ifremer.wao.BoatsFilter;
-import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.WaoTechnicalException;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.BoatInfos;
@@ -65,9 +63,10 @@
BoatTopiaDao dao = getBoatDao();
List<Boat> boats = dao.findAll(filter);
- BoatsFilterValues boatsFilterValues = new BoatsFilterValues(serviceContext.getLocale());
+ BoatsFilterValues boatsFilterValues = new BoatsFilterValues(serviceContext.getLocale(), filter.getObsProgram());
for (Boat boat : boats) {
+ // TODO brendan 07/04/14 ne pas inclure les lignes qui ne sont pas associées à un autre société que celle du coordinateur
boatsFilterValues.addBoat(boat);
}
@@ -109,12 +108,8 @@
public BoatsFilter newBoatsFilter(AuthenticatedWaoUser authenticatedWaoUser) {
- SampleRowsFilter sampleRowsFilter = new SampleRowsFilter();
+ BoatsFilter boatsFilter = new BoatsFilter(authenticatedWaoUser.getObsProgram());
- BoatsFilter boatsFilter = new BoatsFilter();
-
- sampleRowsFilter.setObsProgram(authenticatedWaoUser.getObsProgram());
-
if (authenticatedWaoUser.isProfessional()) {
// Pour le profesionnel, on restreint d'office à la liste des bateaux qu'il peut voir
Collection<String> canReadBoatsTopiaIds = authenticatedWaoUser.getWaoUser().getCanReadBoatsTopiaIds();
@@ -127,13 +122,8 @@
}
}
- if (authenticatedWaoUser.isCoordinatorOrObserver()) {
-
- sampleRowsFilter.setCompanyIds(Sets.newHashSet(authenticatedWaoUser.getCompany().getTopiaId()));
- }
-
- boatsFilter.setElligibleBoatsFilter(sampleRowsFilter);
return boatsFilter;
+
}
public InputStream exportBoats(BoatsFilter filter) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -82,7 +82,7 @@
ContactTopiaDao dao = getContactDao();
List<Contact> contacts = dao.findAll(filter);
- ContactsFilterValues contactsFilterValues = new ContactsFilterValues(serviceContext.getLocale());
+ ContactsFilterValues contactsFilterValues = new ContactsFilterValues(serviceContext.getLocale(), filter.getObsProgram());
for (Contact contact : contacts) {
contactsFilterValues.addContact(contact);
@@ -124,10 +124,8 @@
public ContactsFilter newContactFilter(AuthenticatedWaoUser authenticatedWaoUser) {
- ContactsFilter newContactsFilter = new ContactsFilter();
+ ContactsFilter newContactsFilter = new ContactsFilter(authenticatedWaoUser.getObsProgram());
- newContactsFilter.getSampleRowFilter().setObsProgram(authenticatedWaoUser.getObsProgram());
-
// DO NOT REMOVE THIS
if (authenticatedWaoUser.isCoordinatorOrObserver()) {
String authenticatedWaoUserCompanyTopiaId = authenticatedWaoUser.getWaoUser().getCompany().getTopiaId();
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -136,7 +136,7 @@
public ObsMerSamplingPlanBuilder(Locale locale,
SampleRowsFilter sampleRowsFilter) {
this.sampleRowsFilter = sampleRowsFilter;
- this.sampleRowsFilterValues = new SampleRowsFilterValues(locale);
+ this.sampleRowsFilterValues = new SampleRowsFilterValues(locale, sampleRowsFilter.getObsProgram());
this.facadeMap = new TreeMap<>();
this.observationTimesInDaysTotalExpected = new MutableDouble();
this.observationTimesInDaysTotalReal = new MutableLong();
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -401,8 +401,7 @@
sampleRow);
// calcul effort réalisé et estimé
- SampleRowsFilter sampleRowsFilter1 = new SampleRowsFilter();
- sampleRowsFilter1.setObsProgram(sampleRowsFilter.getObsProgram());
+ SampleRowsFilter sampleRowsFilter1 = new SampleRowsFilter(sampleRowsFilter.getObsProgram());
sampleRowsFilter1.setPeriodFrom(periodFrom);
sampleRowsFilter1.setPeriodTo(periodTo);
sampleRowsFilter1.setSampleRowIds(ImmutableSet.of(sampleRow.getTopiaId()));
@@ -426,67 +425,37 @@
public SampleRowsFilter newSampleRowsFilter(AuthenticatedWaoUser authenticatedWaoUser) {
- SampleRowsFilter newFilter = new SampleRowsFilter();
-
// all users can see only rows for the program they are logged for
- ObsProgram obsProgram = authenticatedWaoUser.getObsProgram();
- newFilter.setObsProgram(obsProgram);
+ SampleRowsFilter newFilter = new SampleRowsFilter(authenticatedWaoUser.getObsProgram());
// We don't want to see all rows but the ones important for today
Date fromDate = serviceContext.getNow();
Date toDate = fromDate;
- if (obsProgram.isObsDeb()) {
+ // Dans ObsMer et ObsVente, le plan est mensualisé
+ fromDate = DateUtils.truncate(fromDate, Calendar.MONTH);
- if (authenticatedWaoUser.isObserver()) {
+ // la période initiale doit toujours aller d'avril à mars (contractuel).
+ // on prend la période dans laquelle on se trouve actuellement
- // observer only need to see what he has to do in the next weeks
- fromDate = DateUtils.addMonths(fromDate, -1); // needed for phone sampling plan
- toDate = DateUtils.addMonths(toDate, 1);
+ // si on est avant le premier avril de l'année courante
+ boolean beforePeriodChangeInCurrentYear = DateUtil.getMonth(fromDate) < 3;
- } else {
-
- // in the firsts months of a new year go from now to 6 months before
- // in the rest of the year, just start at the beginning of the current year
- if (DateUtil.getMonth(fromDate) < 3) {
- fromDate = DateUtils.addMonths(fromDate, -6);
- toDate = DateUtils.addMonths(toDate, 6);
- } else {
- fromDate = DateUtil.setFirstDayOfYear(fromDate);
- toDate = DateUtil.setLastDayOfYear(toDate);
- }
- }
-
- fromDate = DateUtil.setMinTimeOfDay(fromDate);
- toDate = DateUtil.setMaxTimeOfDay(toDate);
-
+ if (beforePeriodChangeInCurrentYear) {
+ // on prend la période qui a commencé l'année dernière et qui finit
+ // cette année
+ fromDate = DateUtils.setMonths(fromDate, 3);
+ fromDate = DateUtils.addYears(fromDate, -1);
} else {
-
- // Dans ObsMer et ObsVente, le plan est mensualisé
- fromDate = DateUtils.truncate(fromDate, Calendar.MONTH);
-
- // la période initiale doit toujours aller d'avril à mars (contractuel).
- // on prend la période dans laquelle on se trouve actuellement
-
- // si on est avant le premier avril de l'année courante
- boolean beforePeriodChangeInCurrentYear = DateUtil.getMonth(fromDate) < 3;
-
- if (beforePeriodChangeInCurrentYear) {
- // on prend la période qui a commencé l'année dernière et qui finit
- // cette année
- fromDate = DateUtils.setMonths(fromDate, 3);
- fromDate = DateUtils.addYears(fromDate, -1);
- } else {
- // on prend la période qui commence cette année et se termine
- // l'année prochaine
- fromDate = DateUtils.setMonths(fromDate, 3);
- }
-
- // on a fromDate sur le premier avril de la bonne année, on va
- // jusqu'au mois de mars suivant
- toDate = DateUtils.addMonths(fromDate, 11);
+ // on prend la période qui commence cette année et se termine
+ // l'année prochaine
+ fromDate = DateUtils.setMonths(fromDate, 3);
}
+ // on a fromDate sur le premier avril de la bonne année, on va
+ // jusqu'au mois de mars suivant
+ toDate = DateUtils.addMonths(fromDate, 11);
+
newFilter.setPeriodFrom(fromDate);
newFilter.setPeriodTo(toDate);
@@ -649,7 +618,7 @@
// D'abord, on a besoin de récupérer toutes les observations réalisées
// pour cette ligne du plan
- ContactsFilter contactFilter = new ContactsFilter();
+ ContactsFilter contactFilter = new ContactsFilter(sampleRowsFilter.getObsProgram());
contactFilter.setFilterOnObservationBeginDate(true);
contactFilter.setPeriodFrom(sampleRowsFilter.getPeriodFrom());
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -21,15 +21,16 @@
* #L%
*/
+import com.google.common.base.Preconditions;
import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingGearDCF;
import fr.ifremer.wao.entity.FishingZone;
+import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.entity.TargetSpeciesDCF;
import fr.ifremer.wao.entity.TerrestrialLocation;
-import java.io.Serializable;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -39,15 +40,10 @@
/**
* Bean to hold all values that user can select to fill {@link fr.ifremer.wao.SampleRowsFilter}.
*/
-public class SampleRowsFilterValues implements Serializable {
+public class SampleRowsFilterValues extends AbstractFilterValues {
private static final long serialVersionUID = 1L;
- /**
- * Locale used by this sampling plan. Need to be here as part of future cache index.
- */
- protected Locale locale;
-
protected SortedSet<FilterOption> fishingZoneFacadeNames = new TreeSet<>();
protected SortedSet<FilterOption> fishingZoneSectorNames = new TreeSet<>();
@@ -68,11 +64,12 @@
/** Values are the code and the label i18n key. */
protected SortedSet<FilterOption> targetSpeciesDcfs = new TreeSet<>();
- public SampleRowsFilterValues(Locale locale) {
- this.locale=locale;
+ public SampleRowsFilterValues(Locale locale, ObsProgram obsProgram) {
+ super(locale, obsProgram);
}
public void addSampleRow(SampleRow sampleRow) {
+ Preconditions.checkArgument(obsProgram.equals(sampleRow.getObsProgram()));
for (FishingZone fishingZone : sampleRow.getFishingZone()) {
fishingZoneFacadeNames.add(FilterOption.forString(fishingZone.getFacadeName()));
fishingZoneSectorNames.add(FilterOption.forString(fishingZone.getSectorName()));
@@ -148,7 +145,4 @@
return targetSpeciesDcfs;
}
- public Locale getLocale() {
- return locale;
- }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-04-07 10:33:52 UTC (rev 1849)
@@ -88,7 +88,7 @@
admin.sizeCanReadBoats();
admin.getCompany().getTopiaId();
UserProfile userProfile = new UserProfileImpl();
- userProfile.setUserRole(UserRole.ADMIN);
+ userProfile.setUserRole(UserRole.COORDINATOR);
userProfile.setObsProgram(ObsProgram.OBSMER);
userProfile.setCanWrite(true);
AuthenticatedWaoUser authenticatedWaoUser = new AuthenticatedWaoUser(admin, userProfile);
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 10:33:52 UTC (rev 1849)
@@ -64,29 +64,29 @@
<div>
<s:form method="GET" id="boats-filters-form" cssClass="filters-form">
- <s:select name="filter.elligibleBoatsFilter.fishingZoneFacadeNames"
+ <s:select name="filter.elligibleForSampleRowsFilter.fishingZoneFacadeNames"
label="%{getText('wao.ui.field.FishingZone.facadeName')}"
- list="filterValues.elligibleBoatsFilterValues.fishingZoneFacadeNames"
+ list="filterValues.elligibleForSampleRowsFilterValues.fishingZoneFacadeNames"
listKey="value"
listValue="label"
multiple="true"
- dataBinding="elligibleBoatsFilterValues.fishingZoneFacadeNames"/>
+ dataBinding="elligibleForSampleRowsFilterValues.fishingZoneFacadeNames"/>
- <s:select name="filter.elligibleBoatsFilter.fishingZoneSectorNames"
+ <s:select name="filter.elligibleForSampleRowsFilter.fishingZoneSectorNames"
label="%{getText('wao.ui.field.FishingZone.sectorName')}"
- list="filterValues.elligibleBoatsFilterValues.fishingZoneSectorNames"
+ list="filterValues.elligibleForSampleRowsFilterValues.fishingZoneSectorNames"
listKey="value"
listValue="label"
multiple="true"
- dataBinding="elligibleBoatsFilterValues.fishingZoneSectorNames"/>
+ dataBinding="elligibleForSampleRowsFilterValues.fishingZoneSectorNames"/>
- <s:select name="filter.elligibleBoatsFilter.sampleRowCodes"
+ <s:select name="filter.elligibleForSampleRowsFilter.sampleRowCodes"
label="%{getText('wao.ui.field.SampleRow.code')}"
- list="filterValues.elligibleBoatsFilterValues.sampleRowCodes"
+ list="filterValues.elligibleForSampleRowsFilterValues.sampleRowCodes"
listKey="value"
listValue="label"
multiple="true"
- dataBinding="elligibleBoatsFilterValues.sampleRowCodes"/>
+ dataBinding="elligibleForSampleRowsFilterValues.sampleRowCodes"/>
<s:textfield name="filter.boatName"
label="%{getText('wao.ui.form.Boat.name')}"
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 09:17:13 UTC (rev 1848)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 10:33:52 UTC (rev 1849)
@@ -474,7 +474,7 @@
<s:if test="elligibleBoatsProvided">
<li>
<s:url action="boats" id="viewElligibleBoatsUrl">
- <s:param name="filter.elligibleBoatsFilter.sampleRowCodes" value="code" />
+ <s:param name="filter.elligibleForSampleRowsFilter.sampleRowCodes" value="code" />
</s:url>
<s:a href="%{viewElligibleBoatsUrl}">
<s:text name="wao.ui.action.viewElligibleBoats" />
1
0
r1848 - in trunk/wao-web/src/main/webapp: . WEB-INF/content/obsmer WEB-INF/decorators
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 11:17:13 +0200 (Mon, 07 Apr 2014)
New Revision: 1848
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1848
Log:
in layout deal with active menu items
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/news.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
trunk/wao-web/src/main/webapp/wao.css
trunk/wao-web/src/main/webapp/wao.js
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 09:17:13 UTC (rev 1848)
@@ -57,6 +57,7 @@
</head>
<content tag="mainClass">large</content>
+<content tag="boatsMenuItemClass">active</content>
<div id="boats-filters-list-details-layout">
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp 2014-04-07 09:17:13 UTC (rev 1848)
@@ -71,6 +71,7 @@
</head>
<content tag="mainClass">large</content>
+<content tag="contactsMenuItemClass">active</content>
<s:form method="GET" id="contacts-filters-form" cssClass="filters-form">
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/news.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/news.jsp 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/news.jsp 2014-04-07 09:17:13 UTC (rev 1848)
@@ -21,6 +21,8 @@
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
+<content tag="newsMenuItemClass">active</content>
+
<html>
<head>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 09:17:13 UTC (rev 1848)
@@ -57,6 +57,7 @@
</head>
<content tag="mainClass">large</content>
+ <content tag="samplingPlanMenuItemClass">active</content>
<s:form method="GET" id="sampling-plan-filters-form" cssClass="filters-form">
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-07 09:17:13 UTC (rev 1848)
@@ -55,31 +55,31 @@
<%--<a class="brand" href="#">Wao <s:property value="%{getText(#obsProgram.getI18nKey())}" /></a>--%>
<ul class="nav">
- <li>
+ <li class="<decorator:getProperty property="page.newsMenuItemClass"/>">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="news" id="newsUrl" />
<s:a href="%{newsUrl}">
<i class="icon-home"></i> <s:text name="wao.ui.page.Index.title" />
</s:a>
</li>
- <li class="active">
+ <li class="<decorator:getProperty property="page.samplingPlanMenuItemClass"/>">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="sampling-plan" id="samplingPlanUrl" />
<s:a href="%{samplingPlanUrl}">
<i class="icon-calendar"></i> <s:text name="wao.ui.page.SamplingPlan.title" />
</s:a>
</li>
- <li>
+ <li class="<decorator:getProperty property="page.boatsMenuItemClass"/>">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="boats" id="boatsUrl" />
<s:a href="%{boatsUrl}">
<s:text name="wao.ui.page.Boats.title" />
</s:a>
</li>
- <li>
+ <li class="<decorator:getProperty property="page.contactsMenuItemClass"/>">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="contacts" id="contactsUrl" />
<s:a href="%{contactsUrl}">
<i class="icon-tasks"></i> <s:text name="wao.ui.page.Contacts.title" />
</s:a>
</li>
- <li>
+ <li class="<decorator:getProperty property="page.synthesisMenuItemClass"/>">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="synthesis" id="synthesisUrl" />
<s:a href="%{synthesisUrl}">
<i class="icon-signal"></i> <s:text name="wao.ui.page.Synthesis.title" />
Modified: trunk/wao-web/src/main/webapp/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-04-07 09:17:13 UTC (rev 1848)
@@ -287,10 +287,15 @@
#boats-filters-list-details-layout {
display: flex;
justify-content: space-around;
- align-items: stretch;
- align-items: center;
+ align-items: flex-start;
+ flex-wrap: nowrap;
}
+#boats-filters-list-details-layout > div {
+ margin-left: 20px;
+}
+
#boats-filters-list-details-layout > div:nth-child(3) {
- max-width: 35%;
+ /*max-width: 35%;*/
+ flex: 1;
}
Modified: trunk/wao-web/src/main/webapp/wao.js
===================================================================
--- trunk/wao-web/src/main/webapp/wao.js 2014-04-06 17:05:20 UTC (rev 1847)
+++ trunk/wao-web/src/main/webapp/wao.js 2014-04-07 09:17:13 UTC (rev 1848)
@@ -247,6 +247,7 @@
// $('a[data-toggle="popover"]').popover();
$('span[data-toggle="tooltip"]').tooltip();
+ // FIXME brendan 07/04/14 cannot enable select2 because we can't bind blur event without driving the application crazy, see https://github.com/ivaynberg/select2/issues/2193
//$('select').addClass('input-xlarge').select2();
WAO = new Wao();
1
0