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
Jenkins build is back to normal : wao-nightly » Wao :: Services #32
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
10 Apr '14
Jenkins build is back to normal : wao-nightly » Wao :: Web #32
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
10 Apr '14
Jenkins build is back to normal : wao-nightly » Wao #32
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
by admin+ci-codelutin.com@codelutin.com 10 Apr '14
10 Apr '14
r1878 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services 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/content/obsmer
by bleny@users.forge.codelutin.com 10 Apr '14
by bleny@users.forge.codelutin.com 10 Apr '14
10 Apr '14
Author: bleny
Date: 2014-04-10 17:57:31 +0200 (Thu, 10 Apr 2014)
New Revision: 1878
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1878
Log:
refs #4490 allow admin to change information company before viewing boat details, some UI improvements
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatDetails.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.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/enpoints-js.jsp
trunk/wao-web/src/main/webapp/wao.css
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-04-10 15:57:31 UTC (rev 1878)
@@ -209,6 +209,11 @@
return authorizedToViewBoatDetails;
}
+ public boolean isAuthorizedToViewBoatDetailsForAllCompanies() {
+ boolean authorizedToViewBoatDetailsForAllCompanies = userProfile.isAdmin();
+ return authorizedToViewBoatDetailsForAllCompanies;
+ }
+
public boolean isAuthorizedToViewBoatDetails(String companyId) {
boolean authorizedToViewBoatDetails = userProfile.isAdmin()
|| userProfile.isCoordinatorOrObserver() && waoUser.getCompany().getTopiaId().equals(companyId);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatDetails.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatDetails.java 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatDetails.java 2014-04-10 15:57:31 UTC (rev 1878)
@@ -26,7 +26,6 @@
import fr.ifremer.wao.entity.ElligibleBoat;
import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.SampleRow;
-import org.apache.commons.lang3.BooleanUtils;
import java.io.Serializable;
import java.util.LinkedList;
@@ -67,7 +66,7 @@
for (ElligibleBoat elligibleBoat : boatInfos.getBoat().getElligibleBoat()) {
SampleRow sampleRow = elligibleBoat.getSampleRow();
if (sampleRow.getCompany().equals(boatInfos.getCompany()) && sampleRow.getObsProgram().equals(obsProgram)) {
- if (elligibleBoat.isGlobalActive() || BooleanUtils.isNotFalse(elligibleBoat.getCompanyActive())) {
+ if (elligibleBoat.isBoatElligible()) {
elligibleForSampleRows.add(sampleRow);
}
}
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-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-04-10 15:57:31 UTC (rev 1878)
@@ -766,4 +766,22 @@
}
}
}
+
+ public List<SampleRow> getUnfinishedSampleRows(AuthenticatedWaoUser authenticatedWaoUser, String companyId) {
+
+ SampleRowsFilter sampleRowsFilter = newSampleRowsFilter(authenticatedWaoUser);
+
+ sampleRowsFilter.setCompanyIds(ImmutableSet.of(companyId));
+
+ Date now = getNow();
+ sampleRowsFilter.setPeriodFrom(now);
+ // sampleRowsFilter.setPeriodTo(DateUtils.addYears(now, 1));
+
+ sampleRowsFilter.setOrderByArguments(ImmutableSet.of(SampleRow.PROPERTY_CODE));
+
+ List<SampleRow> unfinishedSampleRows = getSamplingPlanRows(sampleRowsFilter);
+
+ return unfinishedSampleRows;
+
+ }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-04-10 15:57:31 UTC (rev 1878)
@@ -28,6 +28,8 @@
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.web.WaoJspActionSupport;
+import java.util.List;
+
public class BoatDetailsAction extends WaoJspActionSupport {
private static final long serialVersionUID = 1L;
@@ -44,6 +46,8 @@
protected SampleRow startBoatSelectionForSampleRow;
+ private List<SampleRow> sampleRowsToSetElligible;
+
public void setService(ObsMerBoatsService service) {
this.service = service;
}
@@ -73,6 +77,8 @@
startBoatSelectionForSampleRow = obsMerSamplingPlanService.getSampleRow(startBoatSelectionForSampleRowId);
}
+ sampleRowsToSetElligible = obsMerSamplingPlanService.getUnfinishedSampleRows(getAuthenticatedWaoUser(), companyId);
+
return SUCCESS;
}
@@ -84,4 +90,8 @@
public SampleRow getStartBoatSelectionForSampleRow() {
return startBoatSelectionForSampleRow;
}
+
+ public List<SampleRow> getSampleRowsToSetElligible() {
+ return sampleRowsToSetElligible;
+ }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-04-10 15:57:31 UTC (rev 1878)
@@ -24,12 +24,14 @@
import com.opensymphony.xwork2.Preparable;
import fr.ifremer.wao.BoatsFilter;
import fr.ifremer.wao.entity.Boat;
+import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.ObsMerBoatsList;
import fr.ifremer.wao.services.service.ObsMerBoatsService;
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.services.service.PaginationBean;
+import fr.ifremer.wao.services.service.administration.CompaniesService;
import fr.ifremer.wao.web.WaoJspActionSupport;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -52,6 +54,8 @@
protected transient ObsMerBoatsService service;
+ protected transient CompaniesService companiesService;
+
protected transient ObsMerSamplingPlanService obsMerSamplingPlanService;
/**
@@ -111,6 +115,10 @@
this.obsMerSamplingPlanService = obsMerSamplingPlanService;
}
+ public void setCompaniesService(CompaniesService companiesService) {
+ this.companiesService = companiesService;
+ }
+
@Override
public void prepare() {
@@ -146,4 +154,8 @@
return startBoatSelectionForSampleRow;
}
+ public List<Company> getAllCompanies() {
+ return companiesService.getAllCompanies();
+ }
+
}
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-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-10 15:57:31 UTC (rev 1878)
@@ -524,7 +524,7 @@
wao.ui.synthesis.observationHours.categoryName=Hours of the day
wao.ui.synthesis.observationHours.description=Number of observations according to the time of the day (based on the observation begin date)
wao.ui.synthesis.observationHours.title=Observation hours
-wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=The boat is not associated to any sample row
+wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=The boat is not associated to any sample row affected to the company
wao.ui.tip.boatSelectionForSampleRowStarted=You are selecting a boat for sample row %s to create a contact. Sample row profession is %s.
wao.ui.tip.contactAlreadyExists=You can't create a new contact since another already exists
wao.ui.tip.inactiveBoat=You can't create a new contact with a inactive boat
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-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-10 15:57:31 UTC (rev 1878)
@@ -524,7 +524,7 @@
wao.ui.synthesis.observationHours.categoryName=Heures de la journée
wao.ui.synthesis.observationHours.description=Nombre d'observations effectuée selon l'heure d'arrivée
wao.ui.synthesis.observationHours.title=Distribution des périodes d'observation
-wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=Le navire n'est éligible pour aucune ligne du plan
+wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=Le navire n'est éligible pour aucune des lignes du plan affectées à la société
wao.ui.tip.boatSelectionForSampleRowStarted=Vous êtes en mode de sélection d'un navire pour la ligne %s afin de créer un contact. Le métier de la ligne est %s.
wao.ui.tip.contactAlreadyExists=Il existe déjà un contact en cours pour ce navire
wao.ui.tip.inactiveBoat=On ne peut pas créer un contact avec un navire inactif
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-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-10 15:57:31 UTC (rev 1878)
@@ -203,9 +203,11 @@
</s:iterator>
</ul>
</s:else>
- <div class="alert alert-info">
- <s:text name="wao.ui.tip.useBoatSelectionForSampleRow"/>
- </div>
+ <s:if test="authenticatedWaoUser.authorizedToCreateContact">
+ <div class="alert alert-info">
+ <s:text name="wao.ui.tip.useBoatSelectionForSampleRow"/>
+ </div>
+ </s:if>
</s:if>
<s:else>
<s:if test="boatDetails.newContactCreatable">
@@ -229,6 +231,10 @@
</div>
</s:else>
</s:else>
+
+ <s:iterator value="sampleRowsToSetElligible">
+ <s:property value="code"/>
+ </s:iterator>
</s:if>
<s:else>
<div class="alert">
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-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-10 15:57:31 UTC (rev 1878)
@@ -35,21 +35,40 @@
var boatsFilterController = new FilterController(WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL, $('#boats-filters-form'));
boatsFilterController.init();
+ $('#reset-filters').click(function () {
+ boatsFilterController.reset();
+ });
+
+ var $boatDetails = $('#boat-details');
+ var $companyId = $('#companyId');
+
+ var showBoatDetails = function (boatId) {
+ var companyId = $companyId.val();
+ var successCallback = function (data) {
+ $boatDetails.html(data);
+ $('tr.boat-row').removeClass('highlight');
+ $('tr[data-boat-id="' + boatId + '"]').addClass('highlight');
+ $boatDetails.effect('highlight', 'slow');
+ };
+ var data = {
+ fragment: true,
+ boatId: boatId,
+ companyId: companyId
+ };
+ WAO.get(WAO.OBSMER_BOAT_DETAILS_URL, data, successCallback);
+ }
$('a.boat-details-action').click(function (e) {
e.preventDefault();
- var url = $(this).prop('href');
- var successCallback = function (data) {
- $('#boat-details').html(data);
- $('tr.boat-row').removeClass('highlight');
- $('#').addClass('highlight');
+ var boatId = $(this).parents('tr.boat-row').attr('data-boat-id');
+ showBoatDetails(boatId);
+ });
+ $companyId.change(function () {
+ var boatId = $('tr.boat-row.highlight').attr('data-boat-id');
+ if (boatId) {
+ showBoatDetails(boatId);
}
- WAO.get(url, { fragment: true }, successCallback);
});
- $('#reset-filters').click(function () {
- boatsFilterController.reset();
- });
-
});
</script>
@@ -162,6 +181,20 @@
</s:text>
</h2>
+ <s:if test="authenticatedWaoUser.authorizedToViewBoatDetailsForAllCompanies">
+ <s:select id="companyId"
+ name="companyId"
+ label="Vous devez sélectionner la société pour laquelle vous souhaitez consulter les informations"
+ list="allCompanies"
+ listKey="%{topiaId}"
+ listValue="%{name}"
+ value="%{authenticatedWaoUser.waoUser.company.topiaId}"
+ cssClass="input-xxlarge" />
+ </s:if>
+ <s:else>
+ <s:hidden id="companyId" name="companyId" value="%{authenticatedWaoUser.waoUser.company.topiaId}"/>
+ </s:else>
+
<table id="boats-list" class="table-condensed table-striped table-hover">
<thead>
<tr>
@@ -189,7 +222,7 @@
</thead>
<tbody>
<s:iterator value="boats" var="boat">
- <tr id="<s:property value="topiaId"/>" class="boat-row">
+ <tr data-boat-id="<s:property value="topiaId"/>" class="boat-row">
<td>
<s:if test="authenticatedWaoUser.authorizedToViewBoatDetails">
<s:url action="boat-details" id="boatDetailsUrl">
@@ -267,9 +300,12 @@
</div>
<s:if test="authenticatedWaoUser.authorizedToViewBoatDetails">
- <div id="boat-details">
- <div class="alert alert-info">
- <s:text name="wao.ui.tip.youMustChooseBoat" />
+
+ <div>
+ <div id="boat-details">
+ <div class="alert alert-info">
+ <s:text name="wao.ui.tip.youMustChooseBoat" />
+ </div>
</div>
</div>
</s:if>
Modified: trunk/wao-web/src/main/webapp/enpoints-js.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-10 15:57:31 UTC (rev 1878)
@@ -26,11 +26,15 @@
$(document).ready(function () {
+ // json
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"/>';
+ // fragments
+ WAO.OBSMER_BOAT_DETAILS_URL = '<s:url namespace="/obsmer" action="boat-details"/>';
+
});
Modified: trunk/wao-web/src/main/webapp/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css 2014-04-10 15:47:41 UTC (rev 1877)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-04-10 15:57:31 UTC (rev 1878)
@@ -41,7 +41,8 @@
* Des classes à usage transverse
*****************************************************************************/
-.highlight {
+.highlight,
+.table-striped tbody>tr.highlight:nth-child(odd)>td, .table-striped tbody>tr.highlight:nth-child(odd)>th {
background-color: #ffff99;
}
@@ -295,7 +296,17 @@
margin-left: 50px;
}
+#boats-filters-list-details-layout > div:nth-child(1) {
+ padding-top: 60px;
+}
+
#boats-filters-list-details-layout > div:nth-child(3) {
/*max-width: 35%;*/
flex: 1;
}
+
+#boat-details .form-actions {
+ margin-top: 15px;
+ border: none;
+ background-color: inherit;
+}
1
0
r1877 - trunk/wao-services/src/main/java/fr/ifremer/wao/services/service
by bleny@users.forge.codelutin.com 10 Apr '14
by bleny@users.forge.codelutin.com 10 Apr '14
10 Apr '14
Author: bleny
Date: 2014-04-10 17:47:41 +0200 (Thu, 10 Apr 2014)
New Revision: 1877
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1877
Log:
refs #4483 fix multiple exceptions occuring on sample row creation
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
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-09 16:42:24 UTC (rev 1876)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-04-10 15:47:41 UTC (rev 1877)
@@ -48,6 +48,7 @@
import fr.ifremer.wao.entity.FishingZoneTopiaDao;
import fr.ifremer.wao.entity.LocationType;
import fr.ifremer.wao.entity.ObsProgram;
+import fr.ifremer.wao.entity.Profession;
import fr.ifremer.wao.entity.ProfessionImpl;
import fr.ifremer.wao.entity.ProfessionTopiaDao;
import fr.ifremer.wao.entity.SampleMonth;
@@ -225,12 +226,20 @@
public void preValidate(AuthenticatedWaoUser authenticatedWaoUser, UpdateSampleRowCommand updateSampleRowCommand)
throws UnknownBoatImmatriculationsException, UnknownFishingGearDcfCodeException, UnknownTargetSpeciesDcfCodeException, SampleRowCodeMustBeUniqueException {
+ SampleRow sampleRow = updateSampleRowCommand.getSampleRow();
+
+ SampleRowTopiaDao dao = getSampleRowDao();
+ List<SampleRow> existingSampleRowsForTheSameCode = dao.forCodeEquals(sampleRow.getCode()).findAll();
+ if (existingSampleRowsForTheSameCode.size() > 1) {
+ throw new SampleRowCodeMustBeUniqueException();
+ } else if (existingSampleRowsForTheSameCode.size() == 1 && !Iterables.getOnlyElement(existingSampleRowsForTheSameCode).equals(sampleRow)) {
+ throw new SampleRowCodeMustBeUniqueException();
+ }
+
String elligibleBoatImmatriculations = updateSampleRowCommand.getElligibleBoatImmatriculations();
List<Boat> elligibleBoats = getReferentialService().getBoatsFromImmatriculations(elligibleBoatImmatriculations);
- SampleRow sampleRow = updateSampleRowCommand.getSampleRow();
-
for (Boat boat : elligibleBoats) {
ElligibleBoat elligibleBoat = sampleRow.getElligibleBoatByBoat(boat);
if (elligibleBoat == null) {
@@ -245,14 +254,16 @@
}
}
- for (ElligibleBoat elligibleBoat : sampleRow.getElligibleBoat()) {
- Boat boat = elligibleBoat.getBoat();
- boolean isNoLongerActive = !elligibleBoats.contains(boat);
- if (isNoLongerActive) {
- if (authenticatedWaoUser.isAdmin()) {
- elligibleBoat.setGlobalActive(false);
- } else if (authenticatedWaoUser.isCoordinator()) {
- elligibleBoat.setCompanyActive(null);
+ if (sampleRow.isElligibleBoatNotEmpty()) {
+ for (ElligibleBoat elligibleBoat : sampleRow.getElligibleBoat()) {
+ Boat boat = elligibleBoat.getBoat();
+ boolean isNoLongerActive = !elligibleBoats.contains(boat);
+ if (isNoLongerActive) {
+ if (authenticatedWaoUser.isAdmin()) {
+ elligibleBoat.setGlobalActive(false);
+ } else if (authenticatedWaoUser.isCoordinator()) {
+ elligibleBoat.setCompanyActive(null);
+ }
}
}
}
@@ -307,14 +318,6 @@
sampleMonthDao.delete(sampleMonth);
}
- SampleRowTopiaDao dao = getSampleRowDao();
- List<SampleRow> existingSampleRowsForTheSameCode = dao.forCodeEquals(sampleRow.getCode()).findAll();
- if (existingSampleRowsForTheSameCode.size() > 1) {
- throw new SampleRowCodeMustBeUniqueException();
- } else if (existingSampleRowsForTheSameCode.size() == 1 && !Iterables.getOnlyElement(existingSampleRowsForTheSameCode).equals(sampleRow)) {
- throw new SampleRowCodeMustBeUniqueException();
- }
-
}
public void save(UpdateSampleRowCommand updateSampleRowCommand) {
@@ -327,14 +330,24 @@
}
ElligibleBoatTopiaDao elligibleBoatDao = getElligibleBoatDao();
- for (ElligibleBoat elligibleBoat : sampleRow.getElligibleBoat()) {
- if (elligibleBoat.isPersisted()) {
- elligibleBoatDao.update(elligibleBoat);
- } else {
- elligibleBoatDao.create(elligibleBoat);
+ if (sampleRow.isElligibleBoatNotEmpty()) {
+ for (ElligibleBoat elligibleBoat : sampleRow.getElligibleBoat()) {
+ if (elligibleBoat.isPersisted()) {
+ elligibleBoatDao.update(elligibleBoat);
+ } else {
+ elligibleBoatDao.create(elligibleBoat);
+ }
}
}
+ ProfessionTopiaDao professionDao = getProfessionDao();
+ Profession profession = sampleRow.getProfession();
+ if (profession.isPersisted()) {
+ professionDao.update(profession);
+ } else {
+ professionDao.create(profession);
+ }
+
SampleRowTopiaDao dao = getSampleRowDao();
if (sampleRow.isPersisted()) {
dao.update(sampleRow);
1
0
09 Apr '14
Author: tchemit
Date: 2014-04-09 18:42:24 +0200 (Wed, 09 Apr 2014)
New Revision: 1876
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1876
Log:
refs #4487 continue contacts page
- add date formatter
Added:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateConverter.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateTimeConverter.java
trunk/wao-web/src/main/resources/fr/ifremer/wao/entity/Contact-conversion.properties
trunk/wao-web/src/main/webapp/img/
trunk/wao-web/src/main/webapp/img/eye-22px.png
trunk/wao-web/src/main/webapp/img/false-22px.png
trunk/wao-web/src/main/webapp/img/fishing-net-22px.png
trunk/wao-web/src/main/webapp/img/help-22px.png
trunk/wao-web/src/main/webapp/img/true-22px.png
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ContactsAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/MonthConverter.java
trunk/wao-web/src/main/resources/fr/ifremer/wao/ContactsFilter-conversion.properties
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/contacts.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
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-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -94,11 +94,23 @@
}
public static Date parseMonth(Locale locale, String monthYear) throws ParseException {
- String pattern = I18n.l(locale, "wao.month.pattern");
+ String pattern = I18n.l(locale, "wao.month.parser");
DateFormat dateFormat = new SimpleDateFormat(pattern);
return dateFormat.parse(monthYear);
}
+ public static Date parseDate(Locale locale, String monthYear) throws ParseException {
+ String pattern = I18n.l(locale, "wao.date.parser");
+ DateFormat dateFormat = new SimpleDateFormat(pattern);
+ return dateFormat.parse(monthYear);
+ }
+
+ public static Date parseDateTime(Locale locale, String monthYear) throws ParseException {
+ String pattern = I18n.l(locale, "wao.datetime.parser");
+ DateFormat dateFormat = new SimpleDateFormat(pattern);
+ return dateFormat.parse(monthYear);
+ }
+
public static String l(Locale locale, I18nAble i18nAble) {
return I18n.l(locale, i18nAble.getI18nKey());
}
Modified: trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -139,7 +139,9 @@
fr.ifremer.wao.entity.TerrestrialLocation=Terrestrial locations
wao.business.other=
wao.date.formatter=%1$td-%1$tm-%1$tY
+wao.date.parser=dd-MM-yyyy
wao.datetime.formatter=%1$td-%1$tm-%1$tY %1$tH\:%1$tM
+wao.datetime.parser=dd-MM-yyyy HH\:mm
wao.month.formatter=%1$tm-%1$tY
-wao.month.pattern=MM-yyyy
+wao.month.parser=MM-yyyy
wao.time.formatter=%1$tH\:%1$tM
Modified: trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -138,7 +138,10 @@
fr.ifremer.wao.entity.TerrestrialLocation=Lieux terrestres
wao.business.other=
wao.date.formatter=%1$td/%1$tm/%1$tY
+wao.date.parser=dd/MM/yyyy
wao.datetime.formatter=%1$td/%1$tm/%1$tY %1$tH\:%1$tM
+wao.datetime.parser=dd/MM/yyyy HH\:mm
wao.month.formatter=%1$tm/%1$tY
+wao.month.parser=MM/yyyy
wao.month.pattern=MM/yyyy
wao.time.formatter=%1$tH\:%1$tM
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-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -88,7 +88,7 @@
admin.sizeCanReadBoats();
admin.getCompany().getTopiaId();
UserProfile userProfile = new UserProfileImpl();
- userProfile.setUserRole(UserRole.COORDINATOR);
+ userProfile.setUserRole(UserRole.ADMIN);
userProfile.setObsProgram(ObsProgram.OBSMER);
userProfile.setCanWrite(true);
AuthenticatedWaoUser authenticatedWaoUser = new AuthenticatedWaoUser(admin, userProfile);
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ContactsAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ContactsAction.java 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ContactsAction.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -25,6 +25,7 @@
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.entity.ContactState;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.entity.Profession;
@@ -117,12 +118,12 @@
protected Date now = new Date();
public String getFilterPeriodFromPlaceholder() {
- String placeholder = formatMonth(DateUtils.addMonths(now, 1));
+ String placeholder = formatDateTime(DateUtils.addMonths(now, 1));
return placeholder;
}
public String getFilterPeriodToPlaceholder() {
- String placeholder = formatMonth(DateUtils.addYears(now, 1));
+ String placeholder = formatDateTime(DateUtils.addYears(now, 1));
return placeholder;
}
@@ -135,6 +136,10 @@
return escapeForToolTip(contact.getMammalsInfo());
}
+ public boolean isBoardingDone(Contact contact) {
+ return ContactState.OBSERVATION_DONE == contact.getContactState();
+ }
+
//FIXME Use ellipse
public String getCommentDisplayText(String comment) {
if (comment != null && comment.length() > 20) {
Copied: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java (from rev 1875, trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/MonthConverter.java)
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -0,0 +1,138 @@
+package fr.ifremer.wao.web.converter;
+
+/*
+ * #%L
+ * Wao :: Web
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.conversion.TypeConversionException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.util.StrutsTypeConverter;
+
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+
+
+/**
+ * To convert a date as a month.
+ * <p/>
+ * FIXME-tchemit 2014-04-06 When user change his locale, we could have in parameters some date formatted with the previous
+ * FIXME-tchemit 2014-04-06 locale, we need then to try with previous locale date pattern.
+ *
+ * @since 4.0
+ */
+public abstract class AbstractDateConverter extends StrutsTypeConverter {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(AbstractDateConverter.class);
+
+ protected abstract Date parse(Locale locale, String string) throws ParseException;
+
+ protected abstract String format(Locale locale, Date date);
+
+ @Override
+ public Date convertFromString(Map map, String[] strings, Class aClass) {
+
+ if (strings.length == 1) {
+
+ String string = strings[0];
+
+ Date parsedValue;
+
+ if (StringUtils.isEmpty(string)) {
+
+ parsedValue = null;
+
+ } else {
+
+ Locale locale = (Locale) map.get(ActionContext.LOCALE);
+ Preconditions.checkNotNull(locale, "No locale found in ActionContext");
+
+ parsedValue = parseDate(locale, string, strings, true);
+
+ if (parsedValue == null) {
+
+ //FIXME If action is changing language, then date are not in good format
+ //FIXME Let's try why other locale...
+ if (Locale.FRENCH.equals(locale)) {
+ locale = Locale.ENGLISH;
+ } else {
+ locale = Locale.FRENCH;
+ }
+ parsedValue = parseDate(locale, string, strings, false);
+ }
+ }
+
+ return parsedValue;
+
+ } else {
+ throw new TypeConversionException("strings=" + Arrays.toString(strings));
+ }
+ }
+
+ protected Date parseDate(Locale locale, String string, String[] strings, boolean swallonError) {
+ Preconditions.checkNotNull(locale);
+ try {
+ return parse(locale, string);
+ } catch (ParseException e) {
+ if (swallonError) {
+ return null;
+ }
+ //FIXME See why we don't see the error
+ if (log.isErrorEnabled()) {
+ log.error("Could not format parse date " + string, e);
+ }
+ throw new TypeConversionException("strings=" + Arrays.toString(strings));
+ }
+ }
+
+ @Override
+ public String convertToString(Map map, Object o) {
+
+ String str;
+
+ if (o == null) {
+
+ str = StringUtils.EMPTY;
+
+ } else {
+
+ if (o instanceof Date) {
+
+ Date date = (Date) o;
+
+ Locale locale = (Locale) map.get(ActionContext.LOCALE);
+ Preconditions.checkNotNull(locale, "No locale found in ActionContext");
+ str = format(locale, date);
+ } else {
+ throw new UnsupportedOperationException("cannot convert to month " + o);
+ }
+ }
+
+ return str;
+
+ }
+}
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateConverter.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateConverter.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -0,0 +1,50 @@
+package fr.ifremer.wao.web.converter;
+
+/*
+ * #%L
+ * Wao :: Web
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.wao.WaoUtils;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * To convert date to string.
+ * <p/>
+ * Created on 4/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @see WaoUtils#parseDate(Locale, String)
+ * @see WaoUtils#formatDate(Locale, Date)
+ * @since 4.0
+ */
+public class DateConverter extends AbstractDateConverter {
+ @Override
+ protected Date parse(Locale locale, String string) throws ParseException {
+ return WaoUtils.parseDate(locale, string);
+ }
+
+ @Override
+ protected String format(Locale locale, Date date) {
+ return WaoUtils.formatDate(locale, date);
+ }
+}
Property changes on: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateConverter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateTimeConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateTimeConverter.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateTimeConverter.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -0,0 +1,50 @@
+package fr.ifremer.wao.web.converter;
+
+/*
+ * #%L
+ * Wao :: Web
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.wao.WaoUtils;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * To convert date time to string.
+ * <p/>
+ * Created on 4/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @see WaoUtils#parseDateTime(Locale, String)
+ * @see WaoUtils#formatDateTime(Locale, Date)
+ * @since 4.0
+ */
+public class DateTimeConverter extends AbstractDateConverter {
+ @Override
+ protected Date parse(Locale locale, String string) throws ParseException {
+ return WaoUtils.parseDateTime(locale, string);
+ }
+
+ @Override
+ protected String format(Locale locale, Date date) {
+ return WaoUtils.formatDateTime(locale, date);
+ }
+}
Property changes on: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/DateTimeConverter.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/MonthConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/MonthConverter.java 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/MonthConverter.java 2014-04-09 16:42:24 UTC (rev 1876)
@@ -21,115 +21,29 @@
* #L%
*/
-import com.google.common.base.Preconditions;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.conversion.TypeConversionException;
import fr.ifremer.wao.WaoUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts2.util.StrutsTypeConverter;
import java.text.ParseException;
-import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
-import java.util.Map;
/**
* To convert a date as a month.
*
- * FIXME-tchemit 2014-04-06 When user change his locale, we could have in parameters some date formatted with the previous
- * FIXME-tchemit 2014-04-06 locale, we need then to try with previous locale date pattern.
- *
+ * @see WaoUtils#parseMonth(Locale, String)
+ * @see WaoUtils#formatMonth(Locale, Date)
* @since 4.0
*/
-public class MonthConverter extends StrutsTypeConverter {
+public class MonthConverter extends AbstractDateConverter {
- /** Logger. */
- private static final Log log = LogFactory.getLog(MonthConverter.class);
-
@Override
- public Date convertFromString(Map map, String[] strings, Class aClass) {
-
- if (strings.length == 1) {
-
- String string = strings[0];
-
- Date parsedValue;
-
- if (StringUtils.isEmpty(string)) {
-
- parsedValue = null;
-
- } else {
-
- Locale locale = (Locale) map.get(ActionContext.LOCALE);
- Preconditions.checkNotNull(locale, "No locale found in ActionContext");
-
- parsedValue = parseDate(locale, string, strings, true);
-
- if (parsedValue == null) {
-
- //FIXME If action is changing language, then date are not in good format
- //FIXME Let's try why other locale...
- if (Locale.FRENCH.equals(locale)) {
- locale = Locale.ENGLISH;
- } else {
- locale = Locale.FRENCH;
- }
- parsedValue = parseDate(locale, string, strings, false);
- }
- }
-
- return parsedValue;
-
- } else {
- throw new TypeConversionException("strings=" + Arrays.toString(strings));
- }
+ protected Date parse(Locale locale, String string) throws ParseException {
+ return WaoUtils.parseMonth(locale, string);
}
- protected Date parseDate(Locale locale, String string, String[] strings, boolean swallonError) {
- Preconditions.checkNotNull(locale);
- try {
- return WaoUtils.parseMonth(locale, string);
- } catch (ParseException e) {
- if (swallonError) {
- return null;
- }
- //FIXME See why we don't see the error
- if (log.isErrorEnabled()) {
- log.error("Could not format parse date " + string, e);
- }
- throw new TypeConversionException("strings=" + Arrays.toString(strings));
- }
- }
-
@Override
- public String convertToString(Map map, Object o) {
-
- String str;
-
- if (o == null) {
-
- str = StringUtils.EMPTY;
-
- } else {
-
- if (o instanceof Date) {
-
- Date date = (Date) o;
-
- Locale locale = (Locale) map.get(ActionContext.LOCALE);
- Preconditions.checkNotNull(locale, "No locale found in ActionContext");
- str = WaoUtils.formatMonth(locale, date);
- } else {
- throw new UnsupportedOperationException("cannot convert to month " + o);
- }
- }
-
- return str;
-
+ protected String format(Locale locale, Date date) {
+ return WaoUtils.formatMonth(locale, date);
}
}
Modified: trunk/wao-web/src/main/resources/fr/ifremer/wao/ContactsFilter-conversion.properties
===================================================================
--- trunk/wao-web/src/main/resources/fr/ifremer/wao/ContactsFilter-conversion.properties 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/resources/fr/ifremer/wao/ContactsFilter-conversion.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -18,5 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# #L%
###
+periodFrom=fr.ifremer.wao.web.converter.DateConverter
+periodTo=fr.ifremer.wao.web.converter.DateConverter
companyAcceptations=fr.ifremer.wao.web.converter.BooleanSetConverter
programAcceptations=fr.ifremer.wao.web.converter.BooleanSetConverter
\ No newline at end of file
Added: trunk/wao-web/src/main/resources/fr/ifremer/wao/entity/Contact-conversion.properties
===================================================================
--- trunk/wao-web/src/main/resources/fr/ifremer/wao/entity/Contact-conversion.properties (rev 0)
+++ trunk/wao-web/src/main/resources/fr/ifremer/wao/entity/Contact-conversion.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -0,0 +1,25 @@
+###
+# #%L
+# Wao :: Web
+# %%
+# Copyright (C) 2009 - 2014 Ifremer
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# #L%
+###
+observationBeginDate=fr.ifremer.wao.web.converter.DateTimeConverter
+observationEndDate=fr.ifremer.wao.web.converter.DateTimeConverter
+creationDate=fr.ifremer.wao.web.converter.DateConverter
+dataInputDate=fr.ifremer.wao.web.converter.DateConverter
+restitution=fr.ifremer.wao.web.converter.DateConverter
\ No newline at end of file
Property changes on: trunk/wao-web/src/main/resources/fr/ifremer/wao/entity/Contact-conversion.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -116,7 +116,7 @@
wao.ui.chart.numberOfBoatsWithBoardings=Number of boats with x observations
wao.ui.chooseUserProfile=Choose your user profile
wao.ui.contact.creation=Creation of a contact
-wao.ui.contact.edition=Edtion of contact
+wao.ui.contact.edition=Edition of contact
wao.ui.contact.lastContact=Last observation with this boat for your company
wao.ui.contacts.FishingZone.facadeName=Fishing zone Facade
wao.ui.contacts.FishingZone.sectorName=Fishing zone Sector
@@ -467,7 +467,7 @@
wao.ui.publishedByProgram=Pusblished by program
wao.ui.publishedByYourCompany=Published by company
wao.ui.sampleRow.creation=Creation of a sample row
-wao.ui.sampleRow.edition=Edtion of line %s
+wao.ui.sampleRow.edition=Edition of line %s
wao.ui.sampleRowLog.title=%s line historic
wao.ui.samplingPlan.Actual=Actual
wao.ui.samplingPlan.actions=Actions
@@ -525,11 +525,11 @@
wao.ui.synthesis.observationHours.description=Number of observations according to the time of the day (based on the observation begin date)
wao.ui.synthesis.observationHours.title=Observation hours
wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=The boat is not associated to any sample row
+wao.ui.tip.boatSelectionForSampleRowStarted=You are selecting a boat for sample row %s to create a contact. Sample row profession is %s.
wao.ui.tip.contactAlreadyExists=You can't create a new contact since another already exists
wao.ui.tip.inactiveBoat=You can't create a new contact with a inactive boat
wao.ui.tip.useBoatSelectionForSampleRow=To create a contact for a sample-row for which the boat is not declared as eligible, you may create the contact from the sampling plan
wao.ui.tip.youMustChooseBoat=You must choose a boat in the list
-wao.ui.tip.boatSelectionForSampleRowStarted=You are selecting a boat for sample row %s to create a contact. Sample row profession is %s.
wao.ui.unavailableOperation=Unavailable operation
wao.ui.unit.days=day(s)
wao.ui.unit.observers=observer(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-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-09 16:42:24 UTC (rev 1876)
@@ -525,11 +525,11 @@
wao.ui.synthesis.observationHours.description=Nombre d'observations effectuée selon l'heure d'arrivée
wao.ui.synthesis.observationHours.title=Distribution des périodes d'observation
wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=Le navire n'est éligible pour aucune ligne du plan
+wao.ui.tip.boatSelectionForSampleRowStarted=Vous êtes en mode de sélection d'un navire pour la ligne %s afin de créer un contact. Le métier de la ligne est %s.
wao.ui.tip.contactAlreadyExists=Il existe déjà un contact en cours pour ce navire
wao.ui.tip.inactiveBoat=On ne peut pas créer un contact avec un navire inactif
wao.ui.tip.useBoatSelectionForSampleRow=Pour créer un contact avec ce navire et pour une autre ligne que celles retenues comme éligibles, vous devez vous rendre dans le plan, et pour la ligne en question, sélectionner « Créer un contact ».
wao.ui.tip.youMustChooseBoat=Vous devez sélectionner un navire dans la liste en cliquant sur son immatriculation pour afficher les détails ici.
-wao.ui.tip.boatSelectionForSampleRowStarted=Vous êtes en mode de sélection d'un navire pour la ligne %s afin de créer un contact. Le métier de la ligne est %s.
wao.ui.unavailableOperation=Opération non-disponible
wao.ui.unit.days=jour(s)
wao.ui.unit.observers=observateur(s)
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-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp 2014-04-09 16:42:24 UTC (rev 1876)
@@ -373,7 +373,7 @@
<s:iterator value="contacts" var="contact">
<tr class="contact-row <s:if test="topiaId.equals(contactToHighlightId)"> highlight</s:if>">
<td>
- <s:property value="%{formatDate(creationDate)}"/>
+ <s:property value="creationDate"/>
</td>
<td>
<s:if test="secondaryObserversEmpty">
@@ -439,12 +439,12 @@
</td>
<td>
<s:if test="observationBeginDate">
- <s:property value="%{formatDateTime(observationBeginDate)}"/>
+ <s:property value="observationBeginDate"/>
</s:if>
</td>
<td>
<s:if test="observationEndDate">
- <s:property value="%{formatDateTime(observationEndDate)}"/>
+ <s:property value="observationEndDate"/>
</s:if>
</td>
<td>
@@ -457,25 +457,25 @@
</s:if>
<s:if test="mammalsCapture">
<s:if test="mammalsInfo">
- <img src="<s:url value="fishing-net-22px.png"/>"
+ <img src="<s:url value="/img/fishing-net-22px.png"/>"
alt="<s:text name="wao.ui.field.Contact.mammalsCapture"/>"/>
<%--TODO<s:text name="wao.ui.field.Contact.mammalsInfo"><s:param value="%{getMammalsInfo(#contact)}"/></s:text>--%>
</s:if>
<s:else>
- <img src="<s:url value="fishing-net-22px.png"/>"
+ <img src="<s:url value="/img/fishing-net-22px.png"/>"
alt="<s:text name="wao.ui.field.Contact.mammalsCapture"/>"/>
</s:else>
</s:if>
</td>
<td>
- <s:if test="comment">
- <s:property value="%{getCommentDisplayText(comment)}"/>
+ <s:if test="!comment.empty">
+ <s:property value="comment"/>
<%--TODO<s:text name="wao.ui.misc.comment"><s:param value="%{getTooltipText(comment)}"/></s:text>--%>
</s:if>
</td>
<td>
<s:if test="dataInputDate">
- <s:property value="%{formatDate(dataInputDate)}"/>
+ <s:property value="dataInputDate"/>
</s:if>
</td>
<td>
@@ -485,33 +485,50 @@
</td>
<td>
<s:if test="restitution">
- <s:property value="%{formatDate(restitution)}"/>
+ <s:property value="restitution"/>
</s:if>
</td>
<td>
- Validation
- <s:property value=""/>
- <%--<t:booleanImage t:value="contact.validationCompany" t:empty="isEmpty(contact.validationCompany)"--%>
- <%--t:emptyTitle="${message:wao.ui.misc.notValidated}"--%>
- <%--t:trueTitle="${message:wao.ui.misc.validated}" t:falseTitle="${message:wao.ui.misc.refused}"/> --%>
- <%--<t:booleanImage t:value="contact.validationProgram" t:empty="isEmpty(contact.validationProgram)"--%>
- <%--t:emptyTitle="${message:wao.ui.misc.notValidated}"--%>
- <%--t:trueTitle="${message:wao.ui.misc.validated}" t:falseTitle="${message:wao.ui.misc.refused}"/>--%>
+ <s:if test="validationCompany == null">
+ <img src="<s:url value="/img/help-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.notValidated"/>"/>
+ </s:if>
+ <s:elseif test="validationCompany">
+ <img src="<s:url value="/img/true-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.validated"/>"/>
+ </s:elseif>
+ <s:else>
+ <img src="<s:url value="/img/false-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.refused"/>"/>
+ </s:else>
+ <s:if test="validationProgram == null">
+ <img src="<s:url value="/img/help-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.notValidated"/>"/>
+ </s:if>
+ <s:elseif test="validationProgram">
+ <img src="<s:url value="/img/true-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.validated"/>"/>
+ </s:elseif>
+ <s:else>
+ <img src="<s:url value="/img/false-22px.png"/>"
+ alt="<s:text name="wao.ui.misc.refused"/>"/>
+ </s:else>
</td>
<td>
- <s:if test="commentCoordinator">
- <s:property value="%{getCommentDisplayText(commentCoordinator)}"/>
+ <s:if test="!commentCoordinator.empty">
+ <s:property value="commentCoordinator"/>
<%--TODO<s:text name="wao.ui.field.Contact.commentCoordinator"><s:param value="%{getTooltipText(commentCoordinator)}"/></s:text>--%>
</s:if>
</td>
<td>
- <s:if test="commentAdmin">
- <s:property value="%{getCommentDisplayText(commentAdmin)}"/>
+ <s:if test="!commentAdmin.empty">
+ <s:property value="commentAdmin"/>
+ <%--<s:property value="%{getCommentDisplayText(commentAdmin)}"/>--%>
<%--TODO<s:text name="wao.ui.field.Contact.commentAdmin"><s:param value="%{getTooltipText(commentAdmin)}"/></s:text>--%>
</s:if>
</td>
<td>
- <s:if test="boardingDone">
+ <s:if test="isBoardingDone(#contact)">
<s:if test="validationCompany">
<s:text name="%{dataReliability.i18nKey}"/>
</s:if>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 14:04:51 UTC (rev 1875)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 16:42:24 UTC (rev 1876)
@@ -98,8 +98,8 @@
<s:textfield name="updateContactCommand.contact.creationDate"
label="%{getText('wao.ui.field.Contact.creationDate')}"
- value="%{formatDate(updateContactCommand.contact.creationDate)}"
disabled="true"/>
+ <%--value="%{formatDate(updateContactCommand.contact.creationDate)}"--%>
</fieldset>
<fieldset>
@@ -135,13 +135,11 @@
<s:textfield name="updateContactCommand.contact.observationBeginDate"
label="%{getText('wao.ui.field.Contact.beginDate')}"
- value="%{formatDateTime(updateContactCommand.contact.observationBeginDate)}"
placeholder="%{getDateTimePlaceholder()}"
disabled="%{!#editObservationReport}"/>
<s:textfield name="updateContactCommand.contact.observationEndDate"
label="%{getText('wao.ui.field.Contact.endDate')}"
- value="%{formatDateTime(updateContactCommand.contact.observationEndDate)}"
placeholder="%{getDateTimePlaceholder()}"
disabled="%{!#editObservationReport}"/>
@@ -177,7 +175,6 @@
<s:textfield name="updateContactCommand.contact.dataInputDate"
label="%{getText('wao.ui.field.Contact.dataInputDate')}"
- value="%{formatDate(updateContactCommand.contact.dataInputDate)}"
placeholder="%{getDatePlaceholder()}"
disabled="%{!#editObservationReport}"/>
@@ -189,16 +186,17 @@
<s:textfield name="updateContactCommand.contact.restitution"
label="%{getText('wao.ui.field.Contact.restitution')}"
- value="%{formatDate(updateContactCommand.contact.restitution)}"
placeholder="%{getDatePlaceholder()}"
disabled="%{!#editObservationReport}"/>
<s:textarea name="updateContactCommand.contact.comment"
label="%{getText('wao.ui.field.Contact.comment')}"
+ placeholder="%{getText('wao.ui.misc.noComment')}"
disabled="%{!#editObservationReport || !authenticatedWaoUser.coordinatorOrObserver}"/>
<s:textarea name="updateContactCommand.contact.commentCoordinator"
label="%{getText('wao.ui.field.Contact.commentCoordinator')}"
+ placeholder="%{getText('wao.ui.misc.noComment')}"
disabled="%{!#editObservationReport || !authenticatedWaoUser.coordinator}"/>
</fieldset>
@@ -217,7 +215,8 @@
<s:textarea name="updateContactCommand.contact.commentAdmin"
label="%{getText('wao.ui.field.Contact.commentAdmin')}"
- readonly="%{!authenticatedWaoUser.admin}"/>
+ placeholder="%{getText('wao.ui.misc.noComment')}"
+ disabled="%{!authenticatedWaoUser.admin}"/>
</fieldset>
<div class="form-actions">
Copied: trunk/wao-web/src/main/webapp/img/eye-22px.png (from rev 1734, tags/wao-3.4.1/wao-ui/src/main/webapp/img/eye-22px.png)
===================================================================
(Binary files differ)
Copied: trunk/wao-web/src/main/webapp/img/false-22px.png (from rev 1734, tags/wao-3.4.1/wao-ui/src/main/webapp/img/false-22px.png)
===================================================================
(Binary files differ)
Copied: trunk/wao-web/src/main/webapp/img/fishing-net-22px.png (from rev 1734, tags/wao-3.4.1/wao-ui/src/main/webapp/img/fishing-net-22px.png)
===================================================================
(Binary files differ)
Copied: trunk/wao-web/src/main/webapp/img/help-22px.png (from rev 1734, tags/wao-3.4.1/wao-ui/src/main/webapp/img/help-22px.png)
===================================================================
(Binary files differ)
Copied: trunk/wao-web/src/main/webapp/img/true-22px.png (from rev 1734, tags/wao-3.4.1/wao-ui/src/main/webapp/img/true-22px.png)
===================================================================
(Binary files differ)
1
0
r1875 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 09 Apr '14
by tchemit@users.forge.codelutin.com 09 Apr '14
09 Apr '14
Author: tchemit
Date: 2014-04-09 16:04:51 +0200 (Wed, 09 Apr 2014)
New Revision: 1875
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1875
Log:
refs #4487 fix focus
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
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-09 14:04:13 UTC (rev 1874)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/contacts.jsp 2014-04-09 14:04:51 UTC (rev 1875)
@@ -530,7 +530,7 @@
<s:set name="focusAnchor">adminFocus</s:set>
</s:if>
<s:else>
- <s:set name="focusAnchor">coordinatorFocus</s:set>
+ <s:set name="focusAnchor">coordinatorOrObserverFocus</s:set>
</s:else>
<s:url action="edit-contact!input" id="editContactUrl" anchor='%{focusAnchor}'>
<s:param name="contactId" value="topiaId"/>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 14:04:13 UTC (rev 1874)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 14:04:51 UTC (rev 1875)
@@ -126,7 +126,8 @@
</fieldset>
- <fieldset id="coordinatorFocus">
+ <%--Do not remove the id (use by contacts page)--%>
+ <fieldset id="coordinatorOrObserverFocus">
<legend><s:text name="wao.ui.misc.observationReport"/></legend>
<s:set name="editObservationReport"
@@ -202,7 +203,8 @@
</fieldset>
- <fieldset name="adminFocus">
+ <%--Do not remove the id (use by contacts page)--%>
+ <fieldset id="adminFocus">
<legend><s:text name="wao.ui.form.programEvaluation"/></legend>
<s:if test="authenticatedWaoUser.authorizedToDisplayContactDataReliability">
1
0
r1874 - trunk/wao-persistence/src/main/java/fr/ifremer/wao
by tchemit@users.forge.codelutin.com 09 Apr '14
by tchemit@users.forge.codelutin.com 09 Apr '14
09 Apr '14
Author: tchemit
Date: 2014-04-09 16:04:13 +0200 (Wed, 09 Apr 2014)
New Revision: 1874
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1874
Log:
refs #4487 make sure to hav only sample rows within the connected user obsProgram
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
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-09 12:58:06 UTC (rev 1873)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-04-09 14:04:13 UTC (rev 1874)
@@ -178,7 +178,8 @@
@Override
public boolean isFilled() {
// 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
+ boolean filled = obsProgram != null
+ || periodFrom != null
|| periodTo != null
|| CollectionUtils.isNotEmpty(sampleRowIds)
|| CollectionUtils.isNotEmpty(fishingZoneFacadeNames)
1
0
r1873 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao/entity wao-persistence/src/main/xmi wao-web/src/main/java/fr/ifremer/wao/web wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 09 Apr '14
by bleny@users.forge.codelutin.com 09 Apr '14
09 Apr '14
Author: bleny
Date: 2014-04-09 14:58:06 +0200 (Wed, 09 Apr 2014)
New Revision: 1873
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1873
Log:
refs #4487 enable contact creation from sampling plan
Added:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ElligibleBoatImpl.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
trunk/wao-persistence/src/main/xmi/wao-model.zargo
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoActionSupport.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoSession.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CreateContactAction.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/content/obsmer/sampling-plan.jsp
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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -47,9 +47,9 @@
if (sort) {
if (filter.isSortedByBoardingDate()) {
- query.setOrderByArguments(Contact.PROPERTY_OBSERVATION_BEGIN_DATE);
+ query.setOrderByArguments(Contact.PROPERTY_OBSERVATION_BEGIN_DATE + " desc");
} else {
- query.setOrderByArguments(Contact.PROPERTY_CREATION_DATE);
+ query.setOrderByArguments(Contact.PROPERTY_CREATION_DATE + " desc");
}
}
@@ -83,7 +83,7 @@
} else {
pager.setSortColumn(Contact.PROPERTY_CREATION_DATE);
}
- pager.setSortAscendant(true);
+ pager.setSortAscendant(false);
return pager;
}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ElligibleBoatImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ElligibleBoatImpl.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ElligibleBoatImpl.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -0,0 +1,10 @@
+package fr.ifremer.wao.entity;
+
+public class ElligibleBoatImpl extends ElligibleBoatAbstract {
+
+ @Override
+ public boolean isBoatElligible() {
+ boolean boatElligible = getCompanyActive() == null && isGlobalActive() || getCompanyActive();
+ return boatElligible;
+ }
+}
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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -30,8 +30,10 @@
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.LinkedHashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -278,4 +280,15 @@
stringBuffer.append(")");
return stringBuffer.toString();
}
+
+ @Override
+ public List<ElligibleBoat> getTrulyElligibleBoats() {
+ List<ElligibleBoat> trulyElligibleBoats = new LinkedList<ElligibleBoat>();
+ for (ElligibleBoat elligibleBoat : getElligibleBoat()) {
+ if (elligibleBoat.isBoatElligible()) {
+ trulyElligibleBoats.add(elligibleBoat);
+ }
+ }
+ return trulyElligibleBoats;
+ }
}
Modified: trunk/wao-persistence/src/main/xmi/wao-model.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoActionSupport.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoActionSupport.java 2014-04-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoActionSupport.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -44,4 +44,11 @@
this.session = session;
}
+ public void set_(String _) {
+ // ignore jQuery timestamp
+ }
+
+ public void setFragment(boolean fragment) {
+ // ignore fragment get parameter: it's managed by sitemesh decorators
+ }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoSession.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoSession.java 2014-04-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoSession.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -43,6 +43,8 @@
protected String contactToHighlightId;
+ protected String startBoatSelectionForSampleRowId;
+
public Collection<String> getMessages() {
if (messages == null) {
messages = Lists.newLinkedList();
@@ -93,4 +95,12 @@
public String getContactToHighlightId() {
return contactToHighlightId;
}
+
+ public void setStartBoatSelectionForSampleRowId(String startBoatSelectionForSampleRowId) {
+ this.startBoatSelectionForSampleRowId = startBoatSelectionForSampleRowId;
+ }
+
+ public String getStartBoatSelectionForSampleRowId() {
+ return startBoatSelectionForSampleRowId;
+ }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-04-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatDetailsAction.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -22,8 +22,10 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.services.service.BoatDetails;
import fr.ifremer.wao.services.service.ObsMerBoatsService;
+import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.web.WaoJspActionSupport;
public class BoatDetailsAction extends WaoJspActionSupport {
@@ -32,16 +34,24 @@
protected transient ObsMerBoatsService service;
+ protected transient ObsMerSamplingPlanService obsMerSamplingPlanService;
+
protected String companyId;
protected String boatId;
protected BoatDetails boatDetails;
+ protected SampleRow startBoatSelectionForSampleRow;
+
public void setService(ObsMerBoatsService service) {
this.service = service;
}
+ public void setObsMerSamplingPlanService(ObsMerSamplingPlanService obsMerSamplingPlanService) {
+ this.obsMerSamplingPlanService = obsMerSamplingPlanService;
+ }
+
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
@@ -57,6 +67,12 @@
boatDetails = service.getBoatDetails(getObsProgram(), boatId, companyId);
+ String startBoatSelectionForSampleRowId = session.getStartBoatSelectionForSampleRowId();
+
+ if (startBoatSelectionForSampleRowId != null) {
+ startBoatSelectionForSampleRow = obsMerSamplingPlanService.getSampleRow(startBoatSelectionForSampleRowId);
+ }
+
return SUCCESS;
}
@@ -65,4 +81,7 @@
return boatDetails;
}
+ public SampleRow getStartBoatSelectionForSampleRow() {
+ return startBoatSelectionForSampleRow;
+ }
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-04-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/BoatsAction.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -24,11 +24,16 @@
import com.opensymphony.xwork2.Preparable;
import fr.ifremer.wao.BoatsFilter;
import fr.ifremer.wao.entity.Boat;
+import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.ObsMerBoatsList;
import fr.ifremer.wao.services.service.ObsMerBoatsService;
+import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.services.service.PaginationBean;
import fr.ifremer.wao.web.WaoJspActionSupport;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.pager.TopiaPagerBean;
import java.util.List;
@@ -43,8 +48,12 @@
private static final long serialVersionUID = 1L;
+ private static final Log log = LogFactory.getLog(BoatsAction.class);
+
protected transient ObsMerBoatsService service;
+ protected transient ObsMerSamplingPlanService obsMerSamplingPlanService;
+
/**
* Input pager.
*/
@@ -60,6 +69,10 @@
*/
protected ObsMerBoatsList boatList;
+ protected String startBoatSelectionForSampleRowId;
+
+ protected SampleRow startBoatSelectionForSampleRow;
+
public void setService(ObsMerBoatsService service) {
this.service = service;
}
@@ -90,10 +103,35 @@
return boatList.getPagination();
}
+ public void setStartBoatSelectionForSampleRowId(String startBoatSelectionForSampleRowId) {
+ this.startBoatSelectionForSampleRowId = startBoatSelectionForSampleRowId;
+ }
+
+ public void setObsMerSamplingPlanService(ObsMerSamplingPlanService obsMerSamplingPlanService) {
+ this.obsMerSamplingPlanService = obsMerSamplingPlanService;
+ }
+
@Override
public void prepare() {
filter = service.newBoatsFilter(getAuthenticatedWaoUser());
+
+ if (StringUtils.isNotBlank(startBoatSelectionForSampleRowId)) {
+
+ session.setStartBoatSelectionForSampleRowId(startBoatSelectionForSampleRowId);
+
+ if (log.isInfoEnabled()) {
+ log.info("user " + getAuthenticatedWaoUser().getWaoUser() + " is starting to select a boat for sample row " + startBoatSelectionForSampleRow);
+ }
+
+ }
+
+ if (session.getStartBoatSelectionForSampleRowId() != null) {
+
+ startBoatSelectionForSampleRow = obsMerSamplingPlanService.getSampleRow(session.getStartBoatSelectionForSampleRowId());
+
+ }
+
}
@Override
@@ -103,4 +141,9 @@
return SUCCESS;
}
+
+ public SampleRow getStartBoatSelectionForSampleRow() {
+ return startBoatSelectionForSampleRow;
+ }
+
}
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CancelBoatSelectionAction.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -0,0 +1,22 @@
+package fr.ifremer.wao.web.action.obsmer;
+
+import fr.ifremer.wao.web.WaoJspActionSupport;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.Results;
+
+
+@Results({
+ @Result(name="success", type="redirectAction", params = { "actionName", "boats" })
+})
+public class CancelBoatSelectionAction extends WaoJspActionSupport {
+
+ @Override
+ public String execute() {
+
+ session.setStartBoatSelectionForSampleRowId(null);
+
+ return SUCCESS;
+
+ }
+
+}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CreateContactAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CreateContactAction.java 2014-04-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/CreateContactAction.java 2014-04-09 12:58:06 UTC (rev 1873)
@@ -34,6 +34,8 @@
Contact contact = service.createContact(getAuthenticatedWaoUser(), sampleRowId, boatId);
+ session.setStartBoatSelectionForSampleRowId(null);
+
session.setContactToHighlightId(contact.getTopiaId());
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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-09 12:58:06 UTC (rev 1873)
@@ -126,6 +126,7 @@
wao.ui.contacts.createFromBoat=Create a new contact for this boat and this sample row
wao.ui.contacts.createFromBoat.fail=Contact creation failed
wao.ui.contacts.createFromBoat.warn=Warning \:this sample-row is out of date, are your sure you want to create a new contact ?
+wao.ui.contacts.createFromBoatAndSelectedSampleRow=Create a contact for this boat and sample row %s (%s)
wao.ui.contacts.district=Boat District Code
wao.ui.contacts.division=Fishing Zone Division
wao.ui.contacts.immatriculation=Boat Immatriculation
@@ -523,6 +524,12 @@
wao.ui.synthesis.observationHours.categoryName=Hours of the day
wao.ui.synthesis.observationHours.description=Number of observations according to the time of the day (based on the observation begin date)
wao.ui.synthesis.observationHours.title=Observation hours
+wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=The boat is not associated to any sample row
+wao.ui.tip.contactAlreadyExists=You can't create a new contact since another already exists
+wao.ui.tip.inactiveBoat=You can't create a new contact with a inactive boat
+wao.ui.tip.useBoatSelectionForSampleRow=To create a contact for a sample-row for which the boat is not declared as eligible, you may create the contact from the sampling plan
+wao.ui.tip.youMustChooseBoat=You must choose a boat in the list
+wao.ui.tip.boatSelectionForSampleRowStarted=You are selecting a boat for sample row %s to create a contact. Sample row profession is %s.
wao.ui.unavailableOperation=Unavailable operation
wao.ui.unit.days=day(s)
wao.ui.unit.observers=observer(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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-09 12:58:06 UTC (rev 1873)
@@ -115,7 +115,7 @@
wao.ui.chart.numberObservations=Nb observations
wao.ui.chart.numberOfBoatsWithBoardings=Nombre de navires avec x embarquements
wao.ui.chooseUserProfile=Choisissez votre rôle
-wao.ui.contact.creation=Création d'u contact
+wao.ui.contact.creation=Création d'un contact
wao.ui.contact.edition=Modification du contact
wao.ui.contact.lastContact=Dernière observation concernant ce navire pour votre société (tous programmes confondus)
wao.ui.contacts.FishingZone.facadeName=Façade
@@ -126,6 +126,7 @@
wao.ui.contacts.createFromBoat=Créer un nouveau contact pour ce navire et cette ligne du plan
wao.ui.contacts.createFromBoat.fail=Création d'un nouveau contact impossible
wao.ui.contacts.createFromBoat.warn=Attention \: cette ligne du plan est arrivée à échéance, êtes-vous sûr de vouloir créer un nouveau contact ?
+wao.ui.contacts.createFromBoatAndSelectedSampleRow=Créer un nouveau contact avec ce navire pour la ligne %s (%s)
wao.ui.contacts.district=CQ
wao.ui.contacts.division=Division
wao.ui.contacts.immatriculation=N°
@@ -523,6 +524,12 @@
wao.ui.synthesis.observationHours.categoryName=Heures de la journée
wao.ui.synthesis.observationHours.description=Nombre d'observations effectuée selon l'heure d'arrivée
wao.ui.synthesis.observationHours.title=Distribution des périodes d'observation
+wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty=Le navire n'est éligible pour aucune ligne du plan
+wao.ui.tip.contactAlreadyExists=Il existe déjà un contact en cours pour ce navire
+wao.ui.tip.inactiveBoat=On ne peut pas créer un contact avec un navire inactif
+wao.ui.tip.useBoatSelectionForSampleRow=Pour créer un contact avec ce navire et pour une autre ligne que celles retenues comme éligibles, vous devez vous rendre dans le plan, et pour la ligne en question, sélectionner « Créer un contact ».
+wao.ui.tip.youMustChooseBoat=Vous devez sélectionner un navire dans la liste en cliquant sur son immatriculation pour afficher les détails ici.
+wao.ui.tip.boatSelectionForSampleRowStarted=Vous êtes en mode de sélection d'un navire pour la ligne %s afin de créer un contact. Le métier de la ligne est %s.
wao.ui.unavailableOperation=Opération non-disponible
wao.ui.unit.days=jour(s)
wao.ui.unit.observers=observateur(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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-09 12:58:06 UTC (rev 1873)
@@ -55,12 +55,83 @@
});
$('#unlock-boat-infos-form').click(function () {
- $boatInfosForm.find('input[readOnly="true"], button').removeAttr('readOnly').removeAttr('disabled');
+ $boatInfosForm.find('input[readonly], button').removeAttr('readonly').removeAttr('disabled');
$(this).attr('disabled', 'disabled');
});
});
</script>
+<h3>
+ <s:text name="wao.ui.boats.interlocutor"/>
+</h3>
+
+<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" />
+ <s:textfield type="phone" name="boatInfos.contactPhoneNumber" value="%{boatDetails.boatInfos.contactPhoneNumber}" label="%{getText('wao.ui.field.BoatInfos.contactPhoneNumber')}" readonly="true" />
+ <s:textfield type="number" name="boatInfos.dup" value="%{boatDetails.boatInfos.dup}" label="%{getText('wao.ui.field.BoatInfos.dup')}" readonly="true" />
+ <s:textfield name="boatInfos.contactAddress1" value="%{boatDetails.boatInfos.contactAddress1}" label="%{getText('wao.ui.field.BoatInfos.contactAddress1')}" readonly="true" />
+ <s:textfield name="boatInfos.contactAddress2" value="%{boatDetails.boatInfos.contactAddress2}" label="%{getText('wao.ui.field.BoatInfos.contactAddress2')}" readonly="true" />
+ <s:textfield name="boatInfos.contactPostalCode" value="%{boatDetails.boatInfos.contactPostalCode}" label="%{getText('wao.ui.field.BoatInfos.contactPostalCode')}" readonly="true" />
+ <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" />
+
+ <div class="form-actions">
+ <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>
+ </div>
+
+</s:form>
+
+<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>
+
+
<s:if test="boatDetails.mostRecentContact != null">
<h3>
@@ -106,90 +177,61 @@
</s:if>
<h3>
- <s:text name="wao.ui.boats.interlocutor"/>
+ <s:text name="wao.ui.contact.creation"/>
</h3>
-
-<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" />
- <s:textfield type="phone" name="boatInfos.contactPhoneNumber" value="%{boatDetails.boatInfos.contactPhoneNumber}" label="%{getText('wao.ui.field.BoatInfos.contactPhoneNumber')}" readOnly="true" />
- <s:textfield type="number" name="boatInfos.dup" value="%{boatDetails.boatInfos.dup}" label="%{getText('wao.ui.field.BoatInfos.dup')}" readOnly="true" />
- <s:textfield name="boatInfos.contactAddress1" value="%{boatDetails.boatInfos.contactAddress1}" label="%{getText('wao.ui.field.BoatInfos.contactAddress1')}" readOnly="true" />
- <s:textfield name="boatInfos.contactAddress2" value="%{boatDetails.boatInfos.contactAddress2}" label="%{getText('wao.ui.field.BoatInfos.contactAddress2')}" readOnly="true" />
- <s:textfield name="boatInfos.contactPostalCode" value="%{boatDetails.boatInfos.contactPostalCode}" label="%{getText('wao.ui.field.BoatInfos.contactPostalCode')}" readOnly="true" />
- <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>
-
-
-<h3>
- <s:text name="wao.ui.boats.associatedLine"/>
-</h3>
-<ul>
- <s:iterator value="boatDetails.elligibleForSampleRows">
- <li>
- <s:property value="code"/>
+<s:if test="boatDetails.boatInfos.boat.active">
+ <s:if test="startBoatSelectionForSampleRow == null">
+ <s:if test="boatDetails.elligibleForSampleRows.empty">
+ <s:text name="wao.ui.tip.boatDetails.elligibleForSampleRowsEmpty" />
+ </s:if>
+ <s:else>
+ <s:text name="wao.ui.boats.associatedLine"/>
+ <ul>
+ <s:iterator value="boatDetails.elligibleForSampleRows">
+ <li>
+ <s:property value="code"/>
+ <s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact">
+ <s:url action="create-contact" id="createContactUrl">
+ <s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/>
+ <s:param name="sampleRowId" value="topiaId"/>
+ </s:url>
+ <s:a href="%{createContactUrl}">
+ <s:text name="wao.ui.contacts.createFromBoat"/>
+ </s:a>
+ </s:if>
+ </li>
+ </s:iterator>
+ </ul>
+ </s:else>
+ <div class="alert alert-info">
+ <s:text name="wao.ui.tip.useBoatSelectionForSampleRow"/>
+ </div>
+ </s:if>
+ <s:else>
+ <s:if test="boatDetails.newContactCreatable">
<s:if test="boatDetails.newContactCreatable && authenticatedWaoUser.authorizedToCreateContact">
<s:url action="create-contact" id="createContactUrl">
<s:param name="boatId" value="boatDetails.boatInfos.boat.topiaId"/>
- <s:param name="sampleRowId" value="topiaId"/>
+ <s:param name="sampleRowId" value="startBoatSelectionForSampleRow.topiaId"/>
</s:url>
- <s:a href="%{createContactUrl}">
- <s:text name="wao.ui.contacts.createFromBoat"/>
+ <s:a href="%{createContactUrl}" cssClass="btn btn-success">
+ <i class="icon-plus"></i>
+ <s:text name="wao.ui.contacts.createFromBoatAndSelectedSampleRow">
+ <s:param value="startBoatSelectionForSampleRow.code"/>
+ <s:param value="startBoatSelectionForSampleRow.professionDescription"/>
+ </s:text>
</s:a>
</s:if>
- </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>
+ </s:if>
+ <s:else>
+ <div class="alert">
+ <s:text name="wao.ui.tip.contactAlreadyExists"/>
+ </div>
+ </s:else>
+ </s:else>
+</s:if>
+<s:else>
+ <div class="alert">
+ <s:text name="wao.ui.tip.inactiveBoat"/>
+ </div>
+</s:else>
\ No newline at end of file
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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-09 12:58:06 UTC (rev 1873)
@@ -59,6 +59,19 @@
<content tag="mainClass">large</content>
<content tag="boatsMenuItemClass">active</content>
+<s:if test="startBoatSelectionForSampleRow != null">
+ <div class="alert alert-info">
+ <s:text name="wao.ui.tip.boatSelectionForSampleRowStarted">
+ <s:param value="startBoatSelectionForSampleRow.code"/>
+ <s:param value="startBoatSelectionForSampleRow.professionDescription"/>
+ </s:text>
+ <s:url action="cancel-boat-selection" id="cancelBoatSelectionUrl"/>
+ <s:a href="%{cancelBoatSelectionUrl}" cssClass="btn btn-link">
+ <s:text name="wao.ui.action.cancel"/>
+ </s:a>
+ </div>
+</s:if>
+
<div id="boats-filters-list-details-layout">
<div>
@@ -256,7 +269,7 @@
<s:if test="authenticatedWaoUser.authorizedToViewBoatDetails">
<div id="boat-details">
<div class="alert alert-info">
- Vous devez sélectionner un navire dans la liste en cliquant sur son immatriculation pour afficher les détails ici.
+ <s:text name="wao.ui.tip.youMustChooseBoat" />
</div>
</div>
</s:if>
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-09 10:25:28 UTC (rev 1872)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-09 12:58:06 UTC (rev 1873)
@@ -493,8 +493,8 @@
</li>
<s:if test="authenticatedWaoUser.authorizedToCreateContact && newContactCreatable">
<li>
- <s:url action="contacts" id="createAssociatedContactUrl">
- <s:param name="sampleRowIds" value="sampleRowId" />
+ <s:url action="boats" id="createAssociatedContactUrl">
+ <s:param name="startBoatSelectionForSampleRowId" value="sampleRowId" />
</s:url>
<s:a href="%{createAssociatedContactUrl}">
<i class="icon-plus"></i> <s:text name="wao.ui.action.createAssociatedContact" />
1
0
r1872 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 09 Apr '14
by tchemit@users.forge.codelutin.com 09 Apr '14
09 Apr '14
Author: tchemit
Date: 2014-04-09 12:25:28 +0200 (Wed, 09 Apr 2014)
New Revision: 1872
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1872
Log:
refs #4487 edit-contact (disable some form fields)
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 09:38:33 UTC (rev 1871)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-04-09 10:25:28 UTC (rev 1872)
@@ -59,59 +59,61 @@
<s:textfield name="updateContactCommand.contact.boat.name"
label="%{getText('wao.ui.field.Boat.name')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.boat.immatriculation"
value="%{'' + updateContactCommand.contact.boat.immatriculation}"
label="%{getText('wao.ui.field.Boat.immatriculation')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.boat.districtCode"
label="%{getText('wao.ui.field.Boat.districtCode')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.boat.boatLength"
label="%{getText('wao.ui.field.Boat.boatLength')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.boat.buildYear"
value="%{'' + updateContactCommand.contact.boat.buildYear}"
label="%{getText('wao.ui.field.Boat.buildYear')}"
- readonly="true"/>
+ disabled="true"/>
<hr/>
<s:textfield name="updateContactCommand.contact.sampleRow.professionDescription"
label="%{getText('wao.ui.field.SampleRow.profession')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.sampleRow.programName"
label="%{getText('wao.ui.field.SampleRow.programName')}"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.sampleRow.periodBegin"
label="%{getText('wao.ui.field.SampleRow.periodBegin')}"
value="%{formatMonth(updateContactCommand.contact.sampleRow.periodBegin)}"
cssClass="input-small"
- readonly="true"/>
+ disabled="true"/>
<s:textfield name="updateContactCommand.contact.sampleRow.periodEnd"
label="%{getText('wao.ui.field.SampleRow.periodEnd')}"
value="%{formatMonth(updateContactCommand.contact.sampleRow.periodEnd)}"
cssClass="input-small"
- readonly="true"/>
+ disabled="true"/>
<hr/>
<s:textfield name="updateContactCommand.contact.creationDate"
label="%{getText('wao.ui.field.Contact.creationDate')}"
value="%{formatDate(updateContactCommand.contact.creationDate)}"
- readonly="true"/>
+ disabled="true"/>
</fieldset>
- <%--TODO Editable (cssClass edit-observers) if authenticatedWaoUser.isAuthorizedToEditContactObservers(updateContactCommand.contact)--%>
<fieldset>
<legend><s:text name="wao.ui.misc.observers"/></legend>
+ <s:set name="editObservers"
+ value="%{authenticatedWaoUser.isAuthorizedToEditContactObservers(updateContactCommand.contact)}"/>
+
<s:select name="updateContactCommand.contact.mainObserver"
value="%{updateContactCommand.contact.mainObserver.topiaId}"
label="%{getText('wao.ui.field.Contact.mainObserver')}"
list="observers"
emptyOption="true"
- cssClass="edit-observers"/>
+ disabled="%{!#editObservers}"/>
<s:if test="authenticatedWaoUser.isAuthorizedToDisplayContactSecondaryObservers(updateContactCommand.contact)">
<s:select name="updateContactCommand.contact.secondaryObservers"
@@ -119,47 +121,49 @@
label="%{getText('wao.ui.field.Contact.secondaryObservers')}"
list="observers"
multiple="true"
- cssClass="edit-observers"/>
+ disabled="%{!#editObservers}"/>
</s:if>
</fieldset>
- <%--TODO Editable (cssClass edit-observationReport) if authenticatedWaoUser.authorizedToEditObservationReport(updateContactCommand.contactcontact)--%>
<fieldset id="coordinatorFocus">
<legend><s:text name="wao.ui.misc.observationReport"/></legend>
+ <s:set name="editObservationReport"
+ value="%{authenticatedWaoUser.isAuthorizedToEditObservationReport(updateContactCommand.contact)}"/>
+
<s:textfield name="updateContactCommand.contact.observationBeginDate"
label="%{getText('wao.ui.field.Contact.beginDate')}"
value="%{formatDateTime(updateContactCommand.contact.observationBeginDate)}"
placeholder="%{getDateTimePlaceholder()}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:textfield name="updateContactCommand.contact.observationEndDate"
label="%{getText('wao.ui.field.Contact.endDate')}"
value="%{formatDateTime(updateContactCommand.contact.observationEndDate)}"
placeholder="%{getDateTimePlaceholder()}"
- cssClass="observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:select name="updateContactCommand.contact.contactState"
label="%{getText('wao.ui.field.Contact.contactState')}"
requiredLabel="true"
list="contactStates"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:select name="updateContactCommand.contact.contactStateMotif"
value="%{updateContactCommand.contact.contactState.topiaId}"
label="%{getText('wao.ui.field.Contact.contactStateMotif')}"
list="contactStateMotives"
emptyOption="true"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:checkbox name="updateContactCommand.contact.mammalsObservation"
label="%{getText('wao.ui.field.Contact.mammalsObservation')}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:checkbox name="updateContactCommand.contact.mammalsCapture"
label="%{getText('wao.ui.field.Contact.mammalsCapture')}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<%--TODO onclick="updateMammalsInfoBox(this);" />--%>
<%--<span style="color: red;">--%>
@@ -168,36 +172,33 @@
<s:textarea name="updateContactCommand.contact.mammalsInfo"
label="%{getText('wao.ui.field.Contact.mammalsInfo')}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:textfield name="updateContactCommand.contact.dataInputDate"
label="%{getText('wao.ui.field.Contact.dataInputDate')}"
value="%{formatDate(updateContactCommand.contact.dataInputDate)}"
placeholder="%{getDatePlaceholder()}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
- <%--TODO Editable for authenticatedWaoUser.coordinator--%>
<s:select name="updateContactCommand.contact.observedDataControl"
label="%{getText('wao.ui.field.Contact.observedDataControl')}"
list="observedDataControls"
emptyOption="true"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport || !authenticatedWaoUser.coordinator}"/>
<s:textfield name="updateContactCommand.contact.restitution"
label="%{getText('wao.ui.field.Contact.restitution')}"
value="%{formatDate(updateContactCommand.contact.restitution)}"
placeholder="%{getDatePlaceholder()}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport}"/>
<s:textarea name="updateContactCommand.contact.comment"
label="%{getText('wao.ui.field.Contact.comment')}"
- readonly="%{!authenticatedWaoUser.coordinatorOrObserver}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport || !authenticatedWaoUser.coordinatorOrObserver}"/>
<s:textarea name="updateContactCommand.contact.commentCoordinator"
label="%{getText('wao.ui.field.Contact.commentCoordinator')}"
- readonly="%{!authenticatedWaoUser.coordinator}"
- cssClass="edit-observationReport"/>
+ disabled="%{!#editObservationReport || !authenticatedWaoUser.coordinator}"/>
</fieldset>
@@ -205,11 +206,11 @@
<legend><s:text name="wao.ui.form.programEvaluation"/></legend>
<s:if test="authenticatedWaoUser.authorizedToDisplayContactDataReliability">
- <%--TODO Editable for authenticatedWaoUser.isAuthorizedToEditContactDataReliability(updateContactCommand.contact)--%>
<s:select name="updateContactCommand.contact.dataReliability"
label="%{getText('wao.ui.field.Contact.dataReliability')}"
list="dataReliabilities"
- emptyOption="true"/>
+ emptyOption="true"
+ disabled="%{!authenticatedWaoUser.isAuthorizedToEditContactDataReliability(updateContactCommand.contact)}"/>
</s:if>
<s:textarea name="updateContactCommand.contact.commentAdmin"
1
0