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
January 2010
- 4 participants
- 139 discussions
[Suiviobsmer-commits] r270 - in trunk/suiviobsmer-ui/src/main: java/fr/ifremer/suiviobsmer/ui/pages resources/fr/ifremer/suiviobsmer/ui/components resources/fr/ifremer/suiviobsmer/ui/pages webapp webapp/css webapp/js
by fdesbois@users.labs.libre-entreprise.org 25 Jan '10
by fdesbois@users.labs.libre-entreprise.org 25 Jan '10
25 Jan '10
Author: fdesbois
Date: 2010-01-25 19:10:01 +0000 (Mon, 25 Jan 2010)
New Revision: 270
Added:
trunk/suiviobsmer-ui/src/main/webapp/js/wao.js
Modified:
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/UserProfile.properties
trunk/suiviobsmer-ui/src/main/webapp/Administration.tml
trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml
trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml
trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
trunk/suiviobsmer-ui/src/main/webapp/css/main.css
trunk/suiviobsmer-ui/src/main/webapp/css/news.css
trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css
Log:
- Change some style and text
- Improve comment popup
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-25 19:10:01 UTC (rev 270)
@@ -110,19 +110,19 @@
@Inject
private ServiceBoat serviceBoat;
- @Persist(PersistenceConstants.FLASH)
- private String editableContactId;
+// @Persist(PersistenceConstants.FLASH)
+// private String contactEditedId;
@Log
void setupRender() throws SuiviObsmerException {
- if (StringUtils.isEmpty(editableContactId)) {
+// if (contactEdited == null) {
if (log.isDebugEnabled()) {
log.debug("RESET DATA");
}
initSelectFilters(true ,true);
contacts = null;
getContacts();
- }
+// }
String boatName = getFilter().getBoatName();
boolean companyFiltered = getFilter().getCompany() != null && user.getAdmin();
// Show filters only if no boatName is set
@@ -157,7 +157,7 @@
if (contactFilter == null) {
contactFilter = new ContactFilterImpl();
// Initialized to 12 months before the current day
- Date fromDate = DateUtils.createDateAfterToday(0, -6, 0);
+ Date fromDate = DateUtils.createDateAfterToday(0, -3, 0);
contactFilter.setFromDate(fromDate);
}
return contactFilter;
@@ -310,7 +310,7 @@
public ContactState getContactState() {
if (contactState == null) {
// initialization
- this.contactState = ContactState.createContactStateEnum(contact.getState());
+ this.contactState = ContactState.createContactStateEnum(contactEdited.getState());
}
return this.contactState;
}
@@ -337,6 +337,10 @@
return contact.getComment();
}
+ public String getCommentTooltip() {
+ return contact.getComment().replaceAll("\n", "<br />").replaceAll("\r", "");
+ }
+
public String getSampleRowDescription() {
return BusinessUtils.getTooltipSampleRow(contact.getSampleRow());
}
@@ -362,7 +366,8 @@
}
public boolean isEditionMode() {
- return contact.getTopiaId().equals(editableContactId);
+ //return contact.getTopiaId().equals(contactEditedId);
+ return contactEdited != null && contact.equals(contactEdited);
}
public boolean isEmpty(Boolean validation) {
@@ -374,13 +379,24 @@
/**
* Flag to know if it's only edition (=true) or save action (=false)
*/
- private boolean contactEdited;
+ private boolean edited;
- private boolean contactDeleted;
+ private boolean deleted;
@Persist
+ @Property
+ private Contact contactEdited;
+
+ @Persist
private String oldComment;
+ public void prepareContactEdited(String contactId) throws SuiviObsmerException {
+ if (contactEdited == null) {
+ contactEdited = getContacts().get(contactId);
+ }
+ //contact = contactEdited;
+ }
+
public boolean hasActions() {
return !user.getAdmin() && contact.getValidationCompany() == null;
}
@@ -407,72 +423,79 @@
}
void onSelectedFromAcceptContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
if (user.getAdmin()) {
- contact.setValidationProgram(Boolean.TRUE);
+ contactEdited.setValidationProgram(Boolean.TRUE);
} else {
// For company accepted, addRealTideTime
- contact.getSampleRow().addRealTideTime(contact);
- contact.setValidationCompany(Boolean.TRUE);
+ contactEdited.getSampleRow().addRealTideTime(contactEdited);
+ contactEdited.setValidationCompany(Boolean.TRUE);
}
}
void onSelectedFromRefuseContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
if (user.getAdmin()) {
// For program refused, removeRealTideTime
- contact.getSampleRow().removeRealTideTime(contact);
- contact.setValidationProgram(Boolean.FALSE);
+ contactEdited.getSampleRow().removeRealTideTime(contactEdited);
+ contactEdited.setValidationProgram(Boolean.FALSE);
} else {
- contact.setValidationCompany(Boolean.FALSE);
+ contactEdited.setValidationCompany(Boolean.FALSE);
}
}
void onSelectedFromUnvalidateContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
if (user.getAdmin()) {
// For program unvalidate from previous refused validation, addRealTideTime
- if (BooleanUtils.isFalse(contact.getValidationProgram())) {
- contact.getSampleRow().addRealTideTime(contact);
+ if (BooleanUtils.isFalse(contactEdited.getValidationProgram())) {
+ contactEdited.getSampleRow().addRealTideTime(contactEdited);
}
- contact.setValidationProgram(null);
+ contactEdited.setValidationProgram(null);
} else {
// For company unvalidate from previous accepted validation,
// removeRealTideTime
- if (BooleanUtils.isTrue(contact.getValidationCompany())) {
- contact.getSampleRow().removeRealTideTime(contact);
+ if (BooleanUtils.isTrue(contactEdited.getValidationCompany())) {
+ contactEdited.getSampleRow().removeRealTideTime(contactEdited);
}
- contact.setValidationCompany(null);
+ contactEdited.setValidationCompany(null);
}
}
void onSelectedFromEditContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
- contactUserId = contact.getUser().getTopiaId();
- editableContactId = contactId;
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
+ contactUserId = contactEdited.getUser().getTopiaId();
+ //contactEditedId = contactId;
contactSelectedId = contactId;
- oldComment = contact.getComment();
- contactEdited = true;
+ oldComment = contactEdited.getComment();
+ edited = true;
}
void onSelectedFromDeleteContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
- contactDeleted = true;
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
+ deleted = true;
}
void onSelectedFromSaveContact(String contactId) throws SuiviObsmerException {
- contact = getContacts().get(contactId);
- contact.setState(contactState.toString());
+ //contact = getContacts().get(contactId);
+ prepareContactEdited(contactId);
+ contactEdited.setState(contactState.toString());
User contactUser = getUserSelectModel().findObject(contactUserId);
- contact.setUser(contactUser);
+ contactEdited.setUser(contactUser);
if (log.isDebugEnabled()) {
- log.debug("Comment : " + contact.getComment());
+ log.debug("Comment : " + contactEdited.getComment());
}
}
void onSelectedFromCancelEditContact() throws SuiviObsmerException {
- contactEdited = true;
+ contactEdited = null;
+ edited = true;
}
// @Log
@@ -493,6 +516,9 @@
private Form contactsForm;
@InjectComponent
+ private Zone gridZone;
+
+ @InjectComponent
private Field beginDate;
@InjectComponent
@@ -501,8 +527,8 @@
@InjectComponent
private Field nbObservants;
-// @InjectComponent
-// private Field comment;
+ @InjectComponent
+ private Field comment;
@InjectComponent
private Field inputDate;
@@ -512,16 +538,16 @@
contactsForm.clearErrors();
// Validation for saving contact depends on contactState (only edition
// form)
- if (!contactEdited && contactState != null) {
+ if (!edited && contactState != null) {
if (log.isInfoEnabled()) {
log.info("For state : " + contactState);
}
- Date begin = contact.getTideBeginDate();
- Date end = contact.getTideEndDate();
- Date input = contact.getDataInputDate();
- SampleRow row = contact.getSampleRow();
- DateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+ Date begin = contactEdited.getTideBeginDate();
+ Date end = contactEdited.getTideEndDate();
+ Date input = contactEdited.getDataInputDate();
+ SampleRow row = contactEdited.getSampleRow();
+ //DateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
if (begin != null && !row.isValid(begin)) {
contactsForm.recordError(beginDate,
@@ -548,16 +574,16 @@
// Non abouti, Refus ou Refus Définitif
if (contactState.isUnfinishedState()) {
- if (oldComment != null && StringUtils.isNotEmpty(contact.getComment()) && !oldComment.equals(contact.getComment())) {
+ if (oldComment != null && StringUtils.isNotEmpty(contactEdited.getComment()) && !oldComment.equals(contactEdited.getComment())) {
// RAZ des champs
- contact.setTideBeginDate(null);
- contact.setTideEndDate(null);
- contact.setNbObservants(0);
- contact.setMammalsCapture(false);
- contact.setMammalsObservation(false);
- contact.setDataInputDate(null);
+ contactEdited.setTideBeginDate(null);
+ contactEdited.setTideEndDate(null);
+ contactEdited.setNbObservants(0);
+ contactEdited.setMammalsCapture(false);
+ contactEdited.setMammalsObservation(false);
+ contactEdited.setDataInputDate(null);
} else {
- contactsForm.recordError("Vous devez ajouter un commentaire pour l'état '" + contactState + "'");
+ contactsForm.recordError(comment, "Vous devez ajouter un commentaire pour l'état '" + contactState + "'");
}
// Embarquement Réalisé
} else if (contactState.equals(ContactState.BOARDING_DONE)) {
@@ -567,7 +593,7 @@
if (end == null) {
contactsForm.recordError(endDate, "La date de fin de marée est obligatoire pour l'état '" + contactState + "'");
}
- if (contact.getNbObservants() == 0) {
+ if (contactEdited.getNbObservants() == 0) {
contactsForm.recordError(nbObservants, "Il ne peut y avoir aucun observateur pour l'état '" + contactState + "'");
}
}
@@ -576,14 +602,15 @@
@Log
Object onSuccessFromContactsForm() {
- if (!contactEdited) {
+ if (!edited) {
try {
if (log.isDebugEnabled()) {
- log.debug("Contact save : " + contact);
+ log.debug("Contact save : " + contactEdited);
}
- serviceContact.saveContact(contact, contactDeleted);
- contactSelectedId = contact.getTopiaId();
+ serviceContact.saveContact(contactEdited, deleted);
+ contactSelectedId = contactEdited.getTopiaId();
oldComment = null;
+ contactEdited = null;
} catch (SuiviObsmerException eee) {
layout.getFeedBack().addError(eee.getMessage());
}
@@ -598,14 +625,15 @@
}
// The contact is not saved, the contact must be editable to show form
// and correct errors
- contactEdited = true;
- editableContactId = contact.getTopiaId();
+ edited = true;
+ //contactEditedId = contact.getTopiaId();
return contactsForm;
+ //return gridZone;
}
public void createNewContact(Boat boat, SampleRow sampleRow) throws SuiviObsmerException {
contact = serviceContact.getNewContact(user, sampleRow, boat);
serviceContact.saveContact(contact, Boolean.FALSE);
- contactSelectedId = contact.getTopiaId();
+ contactSelectedId = contact.getTopiaId();
}
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-01-25 19:10:01 UTC (rev 270)
@@ -283,6 +283,10 @@
return NumberFormat.getPercentInstance().format(result);
}
+ public NumberFormat getNumberFormat() {
+ return NumberFormat.getNumberInstance();
+ }
+
/** ------------------------- HTML & STYLE ------------------------------ **/
@Property
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -5,9 +5,10 @@
<title>WAO - Web Applicatif Obsmer : ${pageTitle}</title>
<link rel="stylesheet" type="text/css" href="${asset:context:}/css/common.css" />
<link rel="stylesheet" type="text/css" href="${asset:context:}/css/main.css" />
- </head>
- <body>
- <t:if t:test="currentUserExists">
+ <script type="text/javascript" src="${asset:context:}/js/wao.js"/>
+ </head>
+ <t:if t:test="currentUserExists">
+ <body>
<div id="so-session" class="clearfix">
<div class="fleft">
<a t:type="pagelink" t:page="index" title="Page d'accueil">
@@ -58,7 +59,7 @@
</li>
</t:if>
</ul>
-
+
<div id="${contentId}">
<t:feedback t:id="contentFeedback" />
<t:if t:test="canShowPage()">
@@ -68,7 +69,7 @@
<div id="so-footer">
<a href="http://suiviobsmer.labs.libre-entreprise.org/suiviobsmer/" title="Documentation de l'application" target="blank">
WAO
- </a>
+ </a>
<a href="http://suiviobsmer.labs.libre-entreprise.org/suiviobsmer/release-note.html" title="Modifications faites pour cette version" target="blank">
${version}
</a> -
@@ -80,7 +81,7 @@
</a> -
<a href="http://www.gnu.org/licenses/gpl.html" title="License GPL v3" target="blank">
GPLv3
- </a> - Copyright 2009-2010
+ </a> - Copyright 2009-2010
<a href="http://agriculture.gouv.fr/sections/thematiques/peche-aquaculture" title="Direction des Pêches Maritimes et de l'Aquaculture" target="blank">
DPMA</a>,
<a href="http://www.ifremer.fr" title="Ifremer" target="blank">
@@ -93,9 +94,11 @@
Bugs
</a>-->
</div>
+ </body>
- <!-- Connexion -->
- <p:else>
+ <!-- Connexion -->
+ <p:else>
+ <body class="so-connexion">
<div id="so-connexion-feedback">
<t:feedback t:id="connexionFeedback" />
<t:if t:test="hasConnexionErrors()">
@@ -107,7 +110,7 @@
</form>
</t:if>
</div>
- <div class="clearfix" id="so-connexion">
+ <div class="clearfix" id="so-connexion-box">
<form t:id="connexionForm" t:type="form">
<div class="fleft clearfix" id="so-connexion-form">
<p><t:label for="login" /> : </p>
@@ -115,7 +118,6 @@
<p><t:label for="password" /> : </p>
<p><input t:type="passwordfield" t:id="password" t:value="password" /></p>
<div class="fright" id="so-connexion-form-buttons">
- <input class="ico refuse" type="reset" value="Annuler" title="Annuler" />
<input class="ico accept" t:type="submit" value="Connexion" title="Connexion à l'application SuiviObsmer" />
</div>
</div>
@@ -124,10 +126,11 @@
</div>
</form>
</div>
- <!--<div class="acenter">
- <img src="${asset:context:}/img/logo_WAO.png" alt="Logo WAO" title="WAO - Web Applicatif Obsmer"/>
- </div>-->
- </p:else>
- </t:if>
- </body>
+
+ </body>
+ <!--<div class="acenter">
+ <img src="${asset:context:}/img/logo_WAO.png" alt="Logo WAO" title="WAO - Web Applicatif Obsmer"/>
+ </div>-->
+ </p:else>
+ </t:if>
</html>
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2010-01-25 19:10:01 UTC (rev 270)
@@ -27,5 +27,5 @@
contactPhoneNumber-label: T\u00E9l\u00E9phone
contactEmail-label: E-mail
shipOwner-label: Armateur
-fromDate-label: Embarquements depuis le
+fromDate-label: Sollicitations du navire depuis le
dup-label: Capacit\u00E9 d'accueil du navire en personnels sp\u00E9cialis\u00E9s
\ No newline at end of file
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties 2010-01-25 19:10:01 UTC (rev 270)
@@ -26,6 +26,7 @@
professionCode-label: M\u00E9tier
professionLibelle-label: Libell\u00E9 m\u00E9tier
professionSpecies-label: Esp\u00E8ces cibles
+validation-label: Validations
# Form labels
contactsForm-errors-banner: Le contact n'a pas \u00E9t\u00E9 sauvegard\u00E9 \u00E0 cause des erreurs suivantes :
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/UserProfile.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/UserProfile.properties 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/UserProfile.properties 2010-01-25 19:10:01 UTC (rev 270)
@@ -1,6 +1,8 @@
-login-label: Identifiant de connexion (e-mail)
+firstName-label: Pr\u00E9nom
+lastName-label: Nom
+login-label: Id. connexion (email)
name-label: Pr\u00E9nom et nom
phoneNumber-label: T\u00E9l\u00E9phone
-password-label: Nouveau password
-password2-label: V\u00E9rification password
+password-label: Nouveau mot de passe
+password2-label: V\u00E9rification mot de passe
active-label: Actif
\ No newline at end of file
Modified: trunk/suiviobsmer-ui/src/main/webapp/Administration.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Administration.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/Administration.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -9,7 +9,7 @@
<t:errors />
<t:label for="fishingZoneCsvFile" /> :
<input t:type="upload" t:id="fishingZoneCsvFile" t:validate="required" />
- <input t:type="submit" class="ico import" value="OK" title="Importer des zones de pêche" />
+ <input t:type="submit" class="ico import" value="OK" title="Importer des zones de pêche (format CSV avec encodage UTF-8)" />
</form>
</fieldset>
</div>
Modified: trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -5,9 +5,9 @@
<t:if t:test="activityCalendar">
<h1>Calendrier d'activité ${activityCalendar.year}</h1>
<p class="acenter">
- <a t:type="pagelink" class="return" t:context="[norow,activityCalendar.boat.immatriculation]" t:page="boats" title="Revenir sur les informations du navire">
+ <a t:type="pagelink" class="return" t:context="[norow,activityCalendar.boat.immatriculation]" t:page="boats" title="Retour sur ${activityCalendar.boat.name}">
<img src="${asset:context:}/img/boat.png" alt="Navire"/>
- Retour sur ${activityCalendar.boat.name}
+ Revenir sur les informations du navire
<img src="${asset:context:}/img/boat.png" alt="Navire"/>
</a>
</p>
Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -11,7 +11,7 @@
<t:errors />
<t:label for="boatsCsvFile" /> :
<input t:type="upload" t:id="boatsCsvFile" t:validate="required" />
- <input t:type="submit" class="ico import" value="OK" title="Importer une liste de navires (format CSV)" />
+ <input t:type="submit" class="ico import" value="OK" title="Importer une liste de navires (format CSV avec encodage UTF-8)" />
</form>
<!--/t:zone-->
</fieldset>
@@ -25,7 +25,7 @@
<t:label for="activityCalendarsCsvFile" /> :
<input t:type="upload" t:id="activityCalendarsCsvFile" t:validate="required" />
<input t:type="submit" class="ico import" value="OK"
- title="Importer les calendriers d'activité des navires (format CSV)" />
+ title="Importer les calendriers d'activité des navires (format CSV avec encodage UTF-8)" />
</form>
<t:if t:test="logFileExists">
<div class="fright">
@@ -183,7 +183,7 @@
<!-- ACTIONS -->
<div class="fright">
<a t:type="actionlink" t:id="editBoatInfos" t:zone="so-boats-boat-infos">
- <img src="${asset:context:}/img/edit.png" title="Editer les informations"/>
+ <img src="${asset:context:}/img/edit-32px.png" title="Editer les informations"/>
</a>
</div>
</div>
@@ -227,7 +227,7 @@
<label>${message:dup-label} : </label>
<t:if t:test="boatInfos.dup">
${boatInfos.dup}
- <p:else>aucun</p:else>
+ <p:else>non renseigné</p:else>
</t:if>
</p>
<p class="sep"> </p>
@@ -239,12 +239,12 @@
</form>
</p>
<p>
- <strong>${boatInfos.getNbBoarding(boardingFromDate)}</strong> embarquements
+ <strong>${boatInfos.getNbBoarding(boardingFromDate)}</strong> embarquement(s)
dont <strong>${boatInfos.getNbBoardingForCompany(boardingFromDate)}</strong> dans votre société
</p>
<t:if t:test="companyBoatInfos.elligibleBoatsValues.size()">
<p class="sep"> </p>
- <label>Ligne(s) du plan :</label>
+ <label>Ligne(s) du plan associée(s) à ce navire :</label>
<ul>
<li t:type="loop" t:source="companyBoatInfos.elligibleBoatsValues" t:value="elligibleBoat">
<span t:type="ck/Tooltip" title="Infos" t:value="prop:elligibleRowInfos" t:effect="appear">
@@ -286,10 +286,10 @@
</div>
<!-- En-tête - actions -->
<div class="fright">
- <input t:type="submit" t:id="saveBoatInfos" class="ico22px save22px" value="Save"
+ <input t:type="submit" t:id="saveBoatInfos" class="ico save" value="Save"
title="Enregistrer les modifications" />
<a t:type="actionlink" t:id="cancelEditBoatInfos" t:zone="so-boats-boat-infos">
- <img src="${asset:context:}/img/undo-22px.png" title="Annuler les modifications"/>
+ <img src="${asset:context:}/img/undo.png" title="Annuler les modifications"/>
</a>
</div>
</div>
Modified: trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -57,14 +57,15 @@
<t:label t:for="sampleRow" />:
<input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
<!-- Contact filter -->
- <label>Mammifères: </label>
+ <label>Observations: </label>
<input t:type="checkbox" t:id="mammalsObservation1" value="contactFilter.mammalsObservation" />
<t:label t:for="mammalsObservation1">
- <img src="${asset:context:}/img/eye-22px.png" alt="Observations de mammifères" title="Observations de mammifères" />
+ <img src="${asset:context:}/img/eye-22px.png" alt="Observations" title="Observations" />
</t:label>
+ <label>Captures acc.: </label>
<input t:type="checkbox" t:id="mammalsCapture1" value="contactFilter.mammalsCapture" />
<t:label t:for="mammalsCapture1">
- <img src="${asset:context:}/img/fishing-net-22px.png" alt="Capture de mammifères" title="Capture de mammifères" />
+ <img src="${asset:context:}/img/fishing-net-22px.png" alt="Captures" title="Captures" />
</t:label>
</div><p> </p>
<div>
@@ -116,16 +117,22 @@
<t:errors />
<t:label for="contactsCsvFile" /> :
<input t:type="upload" t:id="contactsCsvFile" t:validate="required" />
- <input t:type="submit" class="ico import" value="OK" title="Importer une liste de contacts (format CSV)" />
+ <input t:type="submit" class="ico import" value="OK" title="Importer une liste de contacts (format CSV avec encodage UTF-8)" />
<a t:type="actionlink" t:id="exportShowContacts">
- EXPORT
+ <img src="${asset:context:}/img/file-export-22px.png" alt="Export"
+ title="Exporter les ${contacts.availableRows} contacts trouvés depuis le ${dateFormat.format(contactFilter.fromDate)}" />
</a>
</form>
</fieldset>
</div>
<!-- CONTACT LIST -->
-<p><strong>${contacts.availableRows} contacts trouvés</strong></p>
-<!--<t:zone t:id="gridZone" t:update="show">-->
+<p>
+ <strong>${contacts.availableRows} contacts trouvés</strong>
+ <t:if t:test="contactFilter.fromDate">
+ depuis le <t:output value="contactFilter.fromDate" format="dateFormat" />
+ </t:if>
+</p>
+<t:zone t:id="gridZone">
<form t:type="form" t:id="contactsForm" t:zone="gridZone">
<t:errors id="so-contact-form-errors" t:banner="message:contactsForm-errors-banner"/>
<div t:type="grid" t:source="contacts" t:row="contact" class="t-data-grid ${gridClass}" t:model="contactModel" t:rowClass="prop:rowClass"
@@ -157,44 +164,40 @@
</p:stateCell>
<p:tideBeginDateCell>
<t:if t:test="editionMode">
- <input t:type="datefield" t:id="beginDate" class="date" value="contact.tideBeginDate" />
+ <input t:type="datefield" t:id="beginDate" class="date" value="contactEdited.tideBeginDate" />
<p:else><t:output value="contact.tideBeginDate" format="dateFormat" /></p:else>
</t:if>
</p:tideBeginDateCell>
<p:tideEndDateCell>
<t:if t:test="editionMode">
- <input t:type="datefield" t:id="endDate" class="date" value="contact.tideEndDate" />
+ <input t:type="datefield" t:id="endDate" class="date" value="contactEdited.tideEndDate" />
<p:else><t:output value="contact.tideEndDate" format="dateFormat" /></p:else>
</t:if>
</p:tideEndDateCell>
<p:nbObservantsCell>
<t:if t:test="editionMode">
- <input t:type="textfield" t:id="nbObservants" class="nbObservants" value="contact.nbObservants" />
+ <input t:type="textfield" t:id="nbObservants" class="nbObservants" value="contactEdited.nbObservants" />
<p:else>${contact.nbObservants}</p:else>
</t:if>
</p:nbObservantsCell>
<p:mammalsCell>
<t:if t:test="editionMode">
- <input t:type="checkbox" t:id="mammalsObservation" value="contact.mammalsObservation"/>
+ <input t:type="checkbox" t:id="mammalsObservation" value="contactEdited.mammalsObservation"/>
<t:label t:for="mammalsObservation">
- <img src="${asset:context:}/img/eye-22px.png" alt="Observations de mammifères"
- title="Observations de mammifères" />
+ <img src="${asset:context:}/img/eye-22px.png" alt="Observations"
+ title="Observations" />
</t:label>
- <input t:type="checkbox" t:id="mammalsCapture" value="contact.mammalsCapture" />
+ <input t:type="checkbox" t:id="mammalsCapture" value="contactEdited.mammalsCapture" />
<t:label t:for="mammalsCapture">
- <img src="${asset:context:}/img/fishing-net-22px.png" alt="Capture de mammifères"
- title="Capture de mammifères" />
+ <img src="${asset:context:}/img/fishing-net-22px.png" alt="Captures"
+ title="Captures" />
</t:label>
<p:else>
- <!--t:booleanImage t:value="contact.mammalsObservation"
- t:trueTitle="Observations de mammifères" t:falseTitle="Aucune observation faites" />
- <t:booleanImage t:value="contact.mammalsCapture"
- t:trueTitle="Capture de mammifères" t:falseTitle="Aucune capture faites" /-->
<t:if t:test="contact.mammalsObservation">
- <img src="${asset:context:}/img/eye-22px.png" alt="Observations de mammifères" title="Observations de mammifères" />
+ <img src="${asset:context:}/img/eye-22px.png" alt="Observations" title="Observations" />
</t:if>
<t:if t:test="contact.mammalsCapture">
- <img src="${asset:context:}/img/fishing-net-22px.png" alt="Capture de mammifères" title="Capture de mammifères" />
+ <img src="${asset:context:}/img/fishing-net-22px.png" alt="Captures" title="Captures" />
</t:if>
</p:else>
</t:if>
@@ -209,29 +212,19 @@
</p:validationCell>
<p:dataInputDateCell>
<t:if t:test="editionMode">
- <input t:type="datefield" t:id="inputDate" class="date" value="contact.dataInputDate" />
+ <input t:type="datefield" t:id="inputDate" class="date" value="contactEdited.dataInputDate" />
<p:else><t:output value="contact.dataInputDate" format="dateFormat" /></p:else>
</t:if>
</p:dataInputDateCell>
<p:commentCell>
- <t:if t:test="editionMode">
- <!--<img src="${asset:context:}/img/comment-22px.png" alt="Add comment" t:type="any"
- t:mixins="popupPageLink" t:title="Commentaire sur le contact" t:page="comment" t:context="contact.topiaId"/>-->
-<!-- <img src="${asset:context:}/img/comment-22px.png" alt="Add comment" t:type="any"
- t:mixins="window" t:title="Commentaire sur le contact" t:block="comment" />
- <t:block t:id="comment">
- <t:form t:id="commentForm">
- <input t:type="textarea" t:id="comment" cols="5" rows="3" value="contact.comment" />
- </t:form>
- </t:block>-->
- <!--<input t:type="hidden" t:id="comment" id="commentHidden" value="contact.comment"/>-->
-
- <span t:type="ck/Tooltip" title="Commentaire" t:value="prop:contact.comment" t:effect="appear">
- <a href="#" onclick="windowComment.showCenter(true); $('commentPopup').setValue($F('comment'))">
- <img src="${asset:context:}/img/comment-22px.png" alt="Add comment" />
+ <t:if t:test="editionMode">
+ <!--<span t:type="ck/Tooltip" title="Commentaire" t:value="prop:commentTooltip" t:effect="appear">-->
+ <a href="#" onclick="openCommentWindow(windowComment, 'commentPopup', 'contact-comment', ${contactstate.isUnfinishedState()})">
+ <img src="${asset:context:}/img/comment-22px.png" id="commentImg" alt="Add comment" />
</a>
- </span>
- <textarea t:type="textarea" t:id="comment" class="hidden" value="contact.comment" />
+ <!--</span>-->
+
+ <textarea t:type="textarea" t:id="comment" class="hidden contact-comment" value="contactEdited.comment" />
<div t:type="ck/Window" t:id="windowComment" show="false" modal="true"
title="literal:Ajouter un commentaire" width="488" height="210">
@@ -240,16 +233,18 @@
</p>
<p> </p>
<p class="aright">
- <a onclick="$('comment').setValue($F('commentPopup')); windowComment.close()" class="save">
+ <a onclick="closeCommentWindow(windowComment, 'commentPopup', 'contact-comment', ${contactstate.isUnfinishedState()}, 'commentImg', '${asset:context:}')" class="save">
<img src="${asset:context:}/img/save-22px.png" alt="Save comment" title="Enregistrer le commentaire"/>
</a>
</p>
</div>
<p:else>
- <span t:type="ck/Tooltip" title="Commentaire" t:value="prop:contact.comment" t:effect="appear">
- ${commentDisplayed}
- </span>
+ <t:if t:test="contact.comment">
+ <span t:type="ck/Tooltip" title="Commentaire" t:value="prop:commentTooltip" t:effect="appear">
+ ${commentDisplayed}
+ </span>
+ </t:if>
</p:else>
</t:if>
</p:commentCell>
@@ -294,6 +289,6 @@
</p:actionsCell>
</div>
</form>
-<!--</t:zone>-->
+</t:zone>
</t:layout>
Modified: trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -75,7 +75,7 @@
<!-- PROGRAM and SAMPLE MONTHS -->
<fieldset>
- <legend>Programme et données des marées par mois</legend>
+ <legend>Programme de rattachement et effort d'observation par mois</legend>
<t:if t:test="sampleRow.hasSampleMonthRealTideTime()">
<!-- DISPLAY PROGRAM -->
<dl class="t-beandisplay">
Modified: trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2010-01-25 19:10:01 UTC (rev 270)
@@ -10,7 +10,7 @@
<t:errors />
<t:label for="samplingPlanCsvFile" /> :
<input t:type="upload" t:id="samplingPlanCsvFile" t:validate="required" />
- <input t:type="submit" class="ico import" value="OK" title="Importer un plan d'échantillonnage (format CSV)" />
+ <input t:type="submit" class="ico import" value="OK" title="Importer un plan d'échantillonnage (format CSV avec encodage UTF-8)" />
</form>
</fieldset>
</div>
@@ -21,7 +21,7 @@
<form t:type="form" t:id="periodForm">
<t:label t:for="periodBegin" /> : <input t:type="datefield" t:id="periodBegin" />
<t:label t:for="periodEnd" /> : <input t:type="datefield" t:id="periodEnd" />
- <input t:type="submit" class="ico search" value="Search" t:title="Afficher les lignes sur cette période" />
+ <input t:type="submit" class="ico search" value="Search" t:title="Affichage des lignes du plan couverte par la période sélectionnée" />
</form>
</div>
<t:if t:test="user.admin">
@@ -45,7 +45,7 @@
<thead>
<tr class="main">
<td colspan="${nbColumnsForProfession}">Métiers échantillonnés</td>
- <td colspan="${nbColumnsForMonths}">Nombre de marées</td>
+ <td colspan="${nbColumnsForMonths}">Effort d'observation en nombre de marées [ planifié <em>(réalisé)</em> ]</td>
<td colspan="${nbColumnsForOther}">Autres</td>
</tr>
<tr>
@@ -74,8 +74,9 @@
<td class="width50"><t:output value="month" format="dateFormat" /></td>
</t:loop>
<td class="width50 bright">total</td>
- <td class="width60">Durée moyenne d'une marée</td>
- <td colspan="2" class="width60 bright">Nombre d'observateurs</td>
+ <td class="width60">Durée moyenne d'une marée (J.)</td>
+ <td class="width60 bright">Nb. d'observateurs</td>
+ <td> </td>
</tr>
</thead>
<tbody>
@@ -89,7 +90,7 @@
</t:if>
<t:if t:test="sectorChanged">
<tr>
- <td colspan="${nbColumnsTotal}" class="sector">
+ <td colspan="${nbColumnsTotal}" class="sector bright bleft">
${currentSectorName}
</td>
</tr>
@@ -134,12 +135,16 @@
<td class="width50 acenter ${monthCurrentClass}">
${nbTidesExpected}
<t:if t:test="hasNbTidesReal()">
- <span class="${realTidesClass}">(${nbTidesReal})</span>
+ <span class="${realTidesClass}"><em>(${nbTidesReal})</em></span>
</t:if>
</td>
</t:loop>
- <td class="width50 acenter bright">${totalTidesExpected} (${totalTidesReal})<br /><strong>${totalPercentage}</strong></td>
- <td class="width60 acenter">${row.averageTideTime}</td>
+ <td class="width50 acenter bright">
+ <span t:type="ck/Tooltip" title="Infos" t:value="Total sur la période du ${dateFormat.format(periodBegin)} au ${dateFormat.format(periodEnd)}" t:effect="appear">
+ ${totalTidesExpected} <em>(${totalTidesReal})</em><br /><strong>${totalPercentage}</strong>
+ </span>
+ </td>
+ <td class="width60 acenter"><t:output t:value="row.averageTideTime" t:format="numberFormat" /></td>
<td class="width60 acenter bright">${row.nbObservants}</td>
<!-- Actions -->
<td class="${actionsClass} bright">
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/main.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/main.css 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/main.css 2010-01-25 19:10:01 UTC (rev 270)
@@ -34,6 +34,11 @@
}
/* CONNEXION */
+body.so-connexion {
+ background: url(../img/background.jpg) repeat-x top left;
+}
+
+
div#so-connexion-feedback {
margin-top: 50px;
width: 60%;
@@ -42,7 +47,12 @@
text-align: center;
}
-div#so-connexion {
+div#so-connexion-feedback .fb-error,
+div#so-connexion-feedback .fb-info {
+ background-color: #DEE7EC;
+}
+
+div#so-connexion-box {
margin-top: 50px;
margin-left: auto;
margin-right: auto;
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/news.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/news.css 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/news.css 2010-01-25 19:10:01 UTC (rev 270)
@@ -24,6 +24,7 @@
div#so-news div.item h2 {
margin: 5px;
padding: 5px;
+ color: #007CC2;
}
div#so-news div.item div.content {
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css 2010-01-25 10:46:47 UTC (rev 269)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css 2010-01-25 19:10:01 UTC (rev 270)
@@ -61,6 +61,10 @@
border-right: 2px solid black;
}
+div#so-sampling table tr.bbottom {
+ border-bottom: 2px solid black;
+}
+
/* Specific styles for table body rows */
div#so-sampling table tbody td.current {
background-color: yellow;
Added: trunk/suiviobsmer-ui/src/main/webapp/js/wao.js
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/js/wao.js (rev 0)
+++ trunk/suiviobsmer-ui/src/main/webapp/js/wao.js 2010-01-25 19:10:01 UTC (rev 270)
@@ -0,0 +1,26 @@
+function openCommentWindow(window, commentPopupId, commentHiddenClass) {
+ window.showCenter(true);
+ var hidden = $$('.' + commentHiddenClass)[0];
+ var value = hidden.getValue();
+// Tapestry.debug("unfinishedstate : " + unfinishedState);
+// if (unfinishedState) {
+// value += "\nRaison de l'échec :\n";
+// }
+ $(commentPopupId).setValue(value);
+}
+
+function closeCommentWindow(window, commentPopupId, commentHiddenClass, unfinishedState, imgId, context) {
+ var hidden = $$('.' + commentHiddenClass)[0];
+ var oldValue = hidden.getValue();
+ var newValue = $F(commentPopupId);
+ var img = $(imgId);
+ if (oldValue != newValue) {
+ img.setAttribute('src', context + '/img/comment-valid-22px.png');
+ img.setAttribute('title', 'Le commentaire a bien été ajouté');
+ } else if (unfinishedState && oldValue == newValue) {
+ img.setAttribute('src', context + '/img/comment-invalid-22px.png');
+ img.setAttribute('title', 'Le commentaire est obligatoire pour un échec');
+ }
+ hidden.setValue(newValue);
+ window.close();
+}
\ No newline at end of file
1
0
[Suiviobsmer-commits] r269 - in trunk/src/site: . resources resources/admin rst rst/admin
by jcouteau@users.labs.libre-entreprise.org 25 Jan '10
by jcouteau@users.labs.libre-entreprise.org 25 Jan '10
25 Jan '10
Author: jcouteau
Date: 2010-01-25 10:46:47 +0000 (Mon, 25 Jan 2010)
New Revision: 269
Added:
trunk/src/site/resources/admin/
trunk/src/site/resources/admin/creationDepeche.png
trunk/src/site/resources/admin/depeche.png
trunk/src/site/resources/admin/listeNavires.png
trunk/src/site/resources/admin/users.png
trunk/src/site/rst/admin/
trunk/src/site/rst/admin/boats.rst
trunk/src/site/rst/admin/contacts.rst
trunk/src/site/rst/admin/echantillonage.rst
trunk/src/site/rst/admin/firstlaunch.rst
trunk/src/site/rst/admin/news.rst
trunk/src/site/rst/admin/syntheses.rst
trunk/src/site/rst/admin/users.rst
Modified:
trunk/src/site/site_fr.xml
Log:
Initiate admin doc
Added: trunk/src/site/resources/admin/creationDepeche.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/admin/creationDepeche.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/admin/depeche.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/admin/depeche.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/admin/listeNavires.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/admin/listeNavires.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/resources/admin/users.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/admin/users.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/site/rst/admin/boats.rst
===================================================================
--- trunk/src/site/rst/admin/boats.rst (rev 0)
+++ trunk/src/site/rst/admin/boats.rst 2010-01-25 10:46:47 UTC (rev 269)
@@ -0,0 +1,32 @@
+Créer/Gérer la base des navires
+===============================
+
+Pour gérer la base des navires, il faut se rendre sur l'onglet Navires. A partir
+de cet onglet, il est possible de charger la liste des navires depuis un
+fichier csv ou les calendriers d'activité depuis un fichier csv ou un fichier
+gzip (un fichier csv compressé au format gzip).
+
+Il est possible de continuer la navigation pendant l'import des calendriers
+d'activité qui peut être long. Les informations des navires ne sont pas
+accessibles pendant l'import.
+
+Import des navires_
+
+Import des calendriers
+
+.. _navires: ../import/boats.html
+
+Consulter les informations d'un navire
+--------------------------------------
+
+Il est possible de consulter les informations d'un navire en sélectionnant ce
+dernier dans le tableau des navires. Pour réduire la liste, vous pouvez utiliser
+les filtres de recherche.
+
+On visionne le calendrier d'activité en cliquant sur le calendrier.
+On visionne les informations rentrées par les observateurs d'une société en
+sélectionnant la société correspondante dans la liste déroulante et en validant
+avec la loupe.
+
+.. image:: listeNavires.png
+ :width: 800px
Added: trunk/src/site/rst/admin/news.rst
===================================================================
--- trunk/src/site/rst/admin/news.rst (rev 0)
+++ trunk/src/site/rst/admin/news.rst 2010-01-25 10:46:47 UTC (rev 269)
@@ -0,0 +1,24 @@
+Gérer la page d'accueil
+=======================
+
+Quand un administrateur s'est authentifié, il arrive sur la page d'accueil, qui
+par défaut est vide. Cette page d'accueil est remplie de dépèches par
+l'administrateur et visible par tous les utilisateurs.
+
+Ajouter une dépèche
+-------------------
+
+Pour ajouter une dépèche, l'administrateur clique sur le bouton 'plus' bleu. Il
+choisit un titre pour sa dépèche, remplit le texte et le met en page. Il peut
+ensuite l'enregistrer en cliquant sur la disquette ou annuler en cliquant sur la
+flèche rouge.
+
+.. image:: creationDepeche.png
+ :width: 800px
+
+Une fois enregistrée, la dépèche est publiée. Un administrateur peut modifier
+une dépèche publiée ou la supprimer en utilisant les boutons situés à droite de
+cette dernière.
+
+.. image:: depeche.png
+ :width: 800px
Added: trunk/src/site/rst/admin/users.rst
===================================================================
--- trunk/src/site/rst/admin/users.rst (rev 0)
+++ trunk/src/site/rst/admin/users.rst 2010-01-25 10:46:47 UTC (rev 269)
@@ -0,0 +1,59 @@
+Gérer les sociétés et les utilisateurs
+======================================
+
+Pour gérer les sociétés et les utilisateurs, il faut se rendre sur la page
+d'administration.
+
+.. image:: users.png
+ :width: 800px
+
+Les sociétés
+------------
+
+Vous pouvez visualiser/modifier les sociétés existantes en les sélectionnant
+dans la liste des sociétés et en cliquant sur la loupe située à côté pour
+valider. Vous pouvez aussi créer une nouvelle société en cliquant sur le bouton
+'plus'. Cette société ne sera enregistrée que si vous cliquez sur le bouton
+enregistrer. Si vous ne souhaitez pas créer de nouvelle société, continuez votre
+navigation, la société ne sera pas enregistrée.
+
+Une société peut être active ou non. Une société non-active ne peut participer
+au plan d'échantillonage.
+
+Les utilisateurs
+----------------
+
+Vous pouvez visualiser/modifier/supprimer les utilisateurs d'une société
+existante.
+
+Sélectionnez l'utilisateur souhaité dans la liste déroulante. Pour
+visualiser/modifier un utilisateur, cliquez sur la loupe. Pour supprimer un
+utilisateur, cliquez sur la poubelle. Pour supprimer un utilisateur, il faut que
+ce dernier ne soit associé à aucune ligne du plan d'achantillonage.
+
+Pour créer un utilisateur, comme pour une société, cliquez sur le bouton plus.
+Si vous souhaitez annuler une création d'utilisateur, poursuivez votre
+navigation, le nouvel ne sera pas sauvegardé à moins que vous ne cliquiez sur la
+disquette.
+
+On peut rendre un utilisateur administrateur de l'application. Attention, il
+est conseillé de réserver les droits d'administration à un très petit nombre de
+personnes.
+
+Comme pour les sociétés, il est possible de rendre un utilisateur inactif. Un
+utilisateur inactif ne peut se connecter à l'application.
+
+L'identifiant de connection
+$$$$$$$$$$$$$$$$$$$$$$$$$$$
+
+Il est très fortement conseiller que l'identifiant de connection soit une
+addresse e-mail, car ce dernier sert à recevoir son mot de passe en cas d'oubli.
+
+Le mot de passe
+$$$$$$$$$$$$$$$
+
+Le mot de passe peut être généré (conseillé). Dans ce cas il faut cocher la case,
+le mot de passe est envoyé par e-mail à l'utilisateur (grace à son identifiant
+de connection). Si l'identifiant de connection n'est pas un e-mail, il est
+préférable de rentrer le mot de passe à la main et de le transmettre oralement à
+l'utilsiateur.
\ No newline at end of file
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2010-01-24 21:26:26 UTC (rev 268)
+++ trunk/src/site/site_fr.xml 2010-01-25 10:46:47 UTC (rev 269)
@@ -30,6 +30,23 @@
</links>-->
<menu name ="Documentation">
+
+ <item name="Administrateur">
+ <item name="Premier lancement" href="admin/firstLaunch.html"/>
+ <item name="Créer/Gérer la base d'utilisateurs" href="admin/users.html"/>
+ <item name="Créer/Gérer le plan d'échantillonage" href="admin/echantillonage.html"/>
+ <item name="Créer/Gérer la base des navires" href="admin/boats.html"/>
+ <item name="Gérer les contacts" href="admin/contacts.html"/>
+ <item name="Visionner les synthèses" href="admin/syntheses.html"/>
+ <item name="Gérer la page d'accueil" href="admin/news.html"/>
+ </item>
+
+ <item name="Utilisateur">
+ <item name="Se connecter" href="user/authentication.html"/>
+ <item name="Mon compte utilisateur" href="user/account.html"/>
+ <item name="La page d'accueil" href="user/news.html"/>
+ </item>
+
<item name="Import/Export">
<item name="Plan d'échantillonnage" href="import/samplingPlan.html"/>
<item name="Navires" href="import/boats.html"/>
1
0
[Suiviobsmer-commits] r268 - in trunk: . suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages suiviobsmer-ui/src/main/webapp
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
24 Jan '10
Author: fdesbois
Date: 2010-01-24 21:26:26 +0000 (Sun, 24 Jan 2010)
New Revision: 268
Modified:
trunk/changelog.txt
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java
trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
Log:
Evo #2035 : Add percentage on each sampleRow
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-01-24 21:06:28 UTC (rev 267)
+++ trunk/changelog.txt 2010-01-24 21:26:26 UTC (rev 268)
@@ -7,13 +7,15 @@
Note
Il est préférable de supprimer la base de données existante d'une version 0.1.1 avant le déploiement de cette version.
+- [fdesbois] Evo #2035 : Ajouter pourcentage sur le total sur chaque ligne du plan
+- [fdesbois] Evo #2041 : Modifier codes couleurs sur les contacts
- [fdesbois] Ano #2040 : Problème de sauvegarde du programme lors de la création d'une ligne d'échantillonnage
- [fdesbois] Ano #2037 : Le retour depuis les calendriers d'activité ne ramène pas sur le navire sélectionnée (ajout d'un lien retour)
-- [fdesbois] Evol #2036 : Optimiser la pagination des contacts (suppression des tris sur les colonnes du tableau)
-- [fdesbois] Evol #2030, #2038, Ano #2033, #2042 : Revoir la gestion des filtres sur les pages navires, contacts et synthèse
+- [fdesbois] Evo #2036 : Optimiser la pagination des contacts (suppression des tris sur les colonnes du tableau)
+- [fdesbois] Evo #2030, #2038, Ano #2033, #2042 : Revoir la gestion des filtres sur les pages navires, contacts et synthèse
- [fdesbois] Ano #2034 : Mauvais calcul des marées réels
-- [fdesbois] Evol #2017 : Permettre la suppression d'un utilisateur non utilisé dans l'application
-- [fdesbois] Evol #1959 : Contacts : Popup pour la sasie d'un commentaire sur une ligne
+- [fdesbois] Evo #2017 : Permettre la suppression d'un utilisateur non utilisé dans l'application
+- [fdesbois] Evo #1959 : Contacts : Popup pour la sasie d'un commentaire sur une ligne
- [fdesbois] Ano #2019 : L'affichage des zones sur le plan d'échantillonnage n'est pas cohérent avec les lignes.
0.1.1
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-01-24 21:06:28 UTC (rev 267)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-01-24 21:26:26 UTC (rev 268)
@@ -34,6 +34,8 @@
import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage;
import fr.ifremer.suiviobsmer.ui.components.Layout;
import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -273,6 +275,14 @@
return total;
}
+ public String getTotalPercentage() {
+ double result = 0;
+ if (getTotalTidesExpected() > 0) {
+ result = (double)getTotalTidesReal() / (double)getTotalTidesExpected();
+ }
+ return NumberFormat.getPercentInstance().format(result);
+ }
+
/** ------------------------- HTML & STYLE ------------------------------ **/
@Property
Modified: trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2010-01-24 21:06:28 UTC (rev 267)
+++ trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2010-01-24 21:26:26 UTC (rev 268)
@@ -138,7 +138,7 @@
</t:if>
</td>
</t:loop>
- <td class="width50 acenter bright">${totalTidesExpected} (${totalTidesReal})</td>
+ <td class="width50 acenter bright">${totalTidesExpected} (${totalTidesReal})<br /><strong>${totalPercentage}</strong></td>
<td class="width60 acenter">${row.averageTideTime}</td>
<td class="width60 acenter bright">${row.nbObservants}</td>
<!-- Actions -->
1
0
[Suiviobsmer-commits] r267 - trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
24 Jan '10
Author: fdesbois
Date: 2010-01-24 21:06:28 +0000 (Sun, 24 Jan 2010)
New Revision: 267
Modified:
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java
Log:
Evol #2041 : Change colors for contact depends on state
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java 2010-01-24 20:52:33 UTC (rev 266)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java 2010-01-24 21:06:28 UTC (rev 267)
@@ -122,16 +122,18 @@
public static String getContactStyle(Contact contact, boolean admin) {
String result = "";
+ boolean accepted = BooleanUtils.isTrue(contact.getValidationProgram()) ||
+ (!admin && BooleanUtils.isTrue(contact.getValidationCompany()));
+
ContactState state = ContactState.createContactStateEnum(contact.getState());
if (BooleanUtils.isFalse(contact.getValidationProgram()) ||
(!admin && BooleanUtils.isFalse(contact.getValidationCompany()))) {
result = "refused";
- } else if (BooleanUtils.isTrue(contact.getValidationProgram()) ||
- (!admin && BooleanUtils.isTrue(contact.getValidationCompany()))) {
+ } else if (accepted && state.equals(ContactState.BOARDING_DONE)) {
result = "accepted";
- } else if (state.isUnfinishedState()) {
+ } else if (accepted && state.isUnfinishedState()) {
result = "unfinished";
- } else if (state.equals(ContactState.BOARDING_DONE)) {
+ } else if (state.isFinalState()) {
result = "even";
} else {
result = "odd";
1
0
[Suiviobsmer-commits] r266 - in trunk: . suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
24 Jan '10
Author: fdesbois
Date: 2010-01-24 20:52:33 +0000 (Sun, 24 Jan 2010)
New Revision: 266
Modified:
trunk/changelog.txt
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java
Log:
Ano #2040 : Problem with programName save
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-01-24 19:40:04 UTC (rev 265)
+++ trunk/changelog.txt 2010-01-24 20:52:33 UTC (rev 266)
@@ -7,6 +7,7 @@
Note
Il est préférable de supprimer la base de données existante d'une version 0.1.1 avant le déploiement de cette version.
+- [fdesbois] Ano #2040 : Problème de sauvegarde du programme lors de la création d'une ligne d'échantillonnage
- [fdesbois] Ano #2037 : Le retour depuis les calendriers d'activité ne ramène pas sur le navire sélectionnée (ajout d'un lien retour)
- [fdesbois] Evol #2036 : Optimiser la pagination des contacts (suppression des tris sur les colonnes du tableau)
- [fdesbois] Evol #2030, #2038, Ano #2033, #2042 : Revoir la gestion des filtres sur les pages navires, contacts et synthèse
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-01-24 19:40:04 UTC (rev 265)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-01-24 20:52:33 UTC (rev 266)
@@ -431,8 +431,21 @@
// Reset sampleMonths for new period
sampleMonths = null;
getSampleMonths();
+ saveProgram();
}
+ protected void saveProgram() throws SuiviObsmerException {
+ // Save programName
+ if (StringUtils.isNotEmpty(programName)) {
+ getSampleRow().setProgramName(programName);
+ programId = null;
+ } else if (StringUtils.isNotEmpty(programId)) {
+ getSampleRow().setProgramName(programId);
+ }
+ if (log.isInfoEnabled()) {
+ log.info("Program : " + getSampleRow().getProgramName());
+ }
+ }
@Log
void onSelectedFromDeleteMonth(int index) throws SuiviObsmerException {
@@ -523,6 +536,10 @@
cancel = true;
}
+ void onSelectedFromSaveData() throws SuiviObsmerException {
+ saveProgram();
+ }
+
@Log
void onValidateFormFromSampleRowForm() throws SuiviObsmerException {
sampleRowForm.clearErrors();
@@ -616,14 +633,7 @@
if (cancel) {
return this;
}
- if (!edited && !periodChanged) {
- // Save programName
- if (StringUtils.isNotEmpty(programName)) {
- getSampleRow().setProgramName(programName);
- programId = null;
- } else if (StringUtils.isNotEmpty(programId)) {
- getSampleRow().setProgramName(programId);
- }
+ if (!edited && !periodChanged) {
// No company change possible when sampleRow has real tide time
if (!getSampleRow().hasSampleMonthRealTideTime()) {
1
0
[Suiviobsmer-commits] r265 - in trunk: . suiviobsmer-business suiviobsmer-business/src/main/filters suiviobsmer-ui
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
by fdesbois@users.labs.libre-entreprise.org 24 Jan '10
24 Jan '10
Author: fdesbois
Date: 2010-01-24 19:40:04 +0000 (Sun, 24 Jan 2010)
New Revision: 265
Modified:
trunk/changelog.txt
trunk/pom.xml
trunk/suiviobsmer-business/pom.xml
trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties
trunk/suiviobsmer-ui/pom.xml
Log:
Change snapshot version to 0.2.0 : more major than expected (import problems resolved and suppress deprecated fields)
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-01-24 19:30:15 UTC (rev 264)
+++ trunk/changelog.txt 2010-01-24 19:40:04 UTC (rev 265)
@@ -1,9 +1,12 @@
Release note
============
-0.1.2
+0.2.0
-----
+Note
+ Il est préférable de supprimer la base de données existante d'une version 0.1.1 avant le déploiement de cette version.
+
- [fdesbois] Ano #2037 : Le retour depuis les calendriers d'activité ne ramène pas sur le navire sélectionnée (ajout d'un lien retour)
- [fdesbois] Evol #2036 : Optimiser la pagination des contacts (suppression des tris sur les colonnes du tableau)
- [fdesbois] Evol #2030, #2038, Ano #2033, #2042 : Revoir la gestion des filtres sur les pages navires, contacts et synthèse
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-24 19:30:15 UTC (rev 264)
+++ trunk/pom.xml 2010-01-24 19:40:04 UTC (rev 265)
@@ -15,7 +15,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>suiviobsmer</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
<modules>
<module>suiviobsmer-ui</module>
Modified: trunk/suiviobsmer-business/pom.xml
===================================================================
--- trunk/suiviobsmer-business/pom.xml 2010-01-24 19:30:15 UTC (rev 264)
+++ trunk/suiviobsmer-business/pom.xml 2010-01-24 19:40:04 UTC (rev 265)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>suiviobsmer</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.suiviobsmer</groupId>
Modified: trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties
===================================================================
--- trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties 2010-01-24 19:30:15 UTC (rev 264)
+++ trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties 2010-01-24 19:40:04 UTC (rev 265)
@@ -16,4 +16,4 @@
suiviobsmer.email.from=admin at suiviobsmer.org
## Version
-suiviobsmer.version=0.1.2
\ No newline at end of file
+suiviobsmer.version=0.2.0
\ No newline at end of file
Modified: trunk/suiviobsmer-ui/pom.xml
===================================================================
--- trunk/suiviobsmer-ui/pom.xml 2010-01-24 19:30:15 UTC (rev 264)
+++ trunk/suiviobsmer-ui/pom.xml 2010-01-24 19:40:04 UTC (rev 265)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>suiviobsmer</artifactId>
- <version>0.1.2-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.suiviobsmer</groupId>
1
0
24 Jan '10
Author: fdesbois
Date: 2010-01-24 19:30:15 +0000 (Sun, 24 Jan 2010)
New Revision: 264
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java
trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml
trunk/suiviobsmer-ui/src/main/webapp/css/synthesis.css
Log:
- Debug boatInfos managment
- Change position of company filter + interpret company selected for facades and sectors in filters forms
- Clean names in services + suppress deprecated fields in SampleMonth (problem with addRealTideTime resolved)
- Other cleaning and javadoc fixes
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -25,10 +25,9 @@
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
import java.io.Serializable;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import org.nuiton.topia.TopiaContext;
-import org.nuiton.util.PeriodDates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,61 +55,61 @@
// return period;
// }
- protected Calendar getCalendar() {
- Calendar calendar = new GregorianCalendar();
- if (getPeriodDate() != null) {
- calendar.setTime(getPeriodDate());
- }
- return calendar;
- }
+// protected Calendar getCalendar() {
+// Calendar calendar = new GregorianCalendar();
+// if (getPeriodDate() != null) {
+// calendar.setTime(getPeriodDate());
+// }
+// return calendar;
+// }
+//
+// /**
+// * @since 0.0.3 new attribute periodDate
+// * @deprecated
+// */
+// @Override
+// @Deprecated
+// public int getPeriodMonth() {
+// return getCalendar().get(Calendar.MONTH) + 1;
+// }
+//
+// /**
+// * @since 0.0.3 new attribute periodDate
+// * @deprecated
+// */
+// @Override
+// @Deprecated
+// public int getPeriodYear() {
+// return getCalendar().get(Calendar.YEAR);
+// }
+//
+// /**
+// * @since 0.0.3 new attribute periodDate
+// * @param month
+// * @deprecated
+// */
+// @Override
+// @Deprecated
+// public void setPeriodMonth(int month) {
+// Calendar calendar = getCalendar();
+// calendar.set(Calendar.MONTH, month - 1);
+// setPeriodDate(calendar.getTime());
+// }
+//
+// /**
+// * @since 0.0.3 new attribute periodDate
+// * @param year
+// * @deprecated
+// */
+// @Override
+// @Deprecated
+// public void setPeriodYear(int year) {
+// Calendar calendar = getCalendar();
+// calendar.set(Calendar.YEAR, year);
+// setPeriodDate(calendar.getTime());
+// }
/**
- * @since 0.0.3 new attribute periodDate
- * @deprecated
- */
- @Override
- @Deprecated
- public int getPeriodMonth() {
- return getCalendar().get(Calendar.MONTH) + 1;
- }
-
- /**
- * @since 0.0.3 new attribute periodDate
- * @deprecated
- */
- @Override
- @Deprecated
- public int getPeriodYear() {
- return getCalendar().get(Calendar.YEAR);
- }
-
- /**
- * @since 0.0.3 new attribute periodDate
- * @param month
- * @deprecated
- */
- @Override
- @Deprecated
- public void setPeriodMonth(int month) {
- Calendar calendar = getCalendar();
- calendar.set(Calendar.MONTH, month - 1);
- setPeriodDate(calendar.getTime());
- }
-
- /**
- * @since 0.0.3 new attribute periodDate
- * @param year
- * @deprecated
- */
- @Override
- @Deprecated
- public void setPeriodYear(int year) {
- Calendar calendar = getCalendar();
- calendar.set(Calendar.YEAR, year);
- setPeriodDate(calendar.getTime());
- }
-
- /**
* Method could be use to add some time for realTidesValue or
* remove time with a negative nbDays.
* If nbDays is negative and superior to the current value,
@@ -120,19 +119,20 @@
*/
@Override
public void addRealTideTime(int nbDays) throws SuiviObsmerException {
- int result = getRealTidesValue() + nbDays;
- if (result < 0) {
- result = 0;
- }
TopiaContext transaction = null;
try {
transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
SampleMonthDAO dao = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction);
- SampleMonth month = dao.findByTopiaId(this.getTopiaId());
+ SampleMonth month = dao.findByTopiaId(getTopiaId());
+ int result = month.getRealTidesValue() + nbDays;
+ if (result < 0) {
+ result = 0;
+ }
+
month.setRealTidesValue(result);
if (log.isDebugEnabled()) {
- log.debug("Change realTideTime from " + getRealTidesValue() + " to " + result);
+ log.debug("Change realTideTime from " + month.getRealTidesValue() + " to " + result);
}
transaction.commitTransaction();
@@ -140,8 +140,14 @@
} catch (Exception eee) {
SuiviObsmerContext.serviceException(transaction,
"Impossible d'enregistrer le nombre de marées réels pour le mois de " +
- this.getPeriodMonth() + "/" + this.getPeriodYear() + " [ligne : " + this.getSampleRow().getCode() + "]", eee);
+ formatMonth() + " [ligne : " + this.getSampleRow().getCode() + "]", eee);
}
}
+ @Override
+ public String formatMonth() {
+ DateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+ return dateFormat.format(getPeriodDate());
+ }
+
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -24,6 +24,8 @@
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@@ -31,6 +33,7 @@
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.BooleanUtils;
+import org.nuiton.util.DateUtils;
import org.nuiton.util.PeriodDates;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,12 +65,17 @@
if (getSampleMonth() == null) {
return null;
}
- Calendar ref = new GregorianCalendar();
- ref.setTime(date);
+// Calendar ref = new GregorianCalendar();
+// ref.setTime(date);
//log.info("Ref : " + date);
for (SampleMonth curr : getSampleMonth()) {
//log.info("Curr month : " + curr.getPeriodDate() + " : " + curr.getPeriodMonth() + " / " + curr.getPeriodYear());
- if (ref.get(Calendar.MONTH) == (curr.getPeriodMonth()-1) && ref.get(Calendar.YEAR) == curr.getPeriodYear()) {
+// if (ref.get(Calendar.MONTH) == (curr.getPeriodMonth()-1) && ref.get(Calendar.YEAR) == curr.getPeriodYear()) {
+// return curr;
+// }
+ Date min = DateUtils.setFirstDayOfMonth(curr.getPeriodDate());
+ Date max = DateUtils.setLastDayOfMonth(curr.getPeriodDate());
+ if (DateUtils.between(date, min, max)) {
return curr;
}
}
@@ -201,17 +209,20 @@
}
@Override
- public void addRealTideTime(Contact contact) throws SuiviObsmerException {
+ public boolean addRealTideTime(Contact contact) throws SuiviObsmerException {
if (contact.getTideEndDate() == null || contact.getTideBeginDate() == null) {
- return;
+ return false;
}
//int nbDays = contact.getTideNbDays(); //getDifferenceDays(contact);
SampleMonth month = getSampleMonth(contact.getTideBeginDate());
- if (log.isTraceEnabled()) {
- log.trace("Add 1 tide for " +
- month.getPeriodMonth() + "/" + month.getPeriodYear() + " [" + this.getCode() + "]");
+ if (month == null) {
+ return false;
}
+ if (log.isTraceEnabled()) {
+ log.trace("Add 1 tide for " + month.formatMonth() + " [" + this.getCode() + "]");
+ }
month.addRealTideTime(1);
+ return true;
}
@Override
@@ -222,8 +233,7 @@
//int nbDays = contact.getTideNbDays(); //getDifferenceDays(contact);
SampleMonth month = getSampleMonth(contact.getTideBeginDate());
if (log.isTraceEnabled()) {
- log.trace("Remove 1 tide for " +
- month.getPeriodMonth() + "/" + month.getPeriodYear() + " [" + this.getCode() + "]");
+ log.trace("Remove 1 tide for " + month.formatMonth() + " [" + this.getCode() + "]");
}
month.addRealTideTime(-1);
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -94,6 +94,8 @@
query.addOrder("B." + filter.getOrderBy());
}
+ query.addLoad(Boat.ACTIVITY_CALENDAR);
+
if (log.isDebugEnabled()) {
log.debug("Query : " + query);
}
@@ -106,6 +108,27 @@
}
return results;
}
+
+ @Override
+ public int getNbBoatsByFilter(BoatFilter filter) throws SuiviObsmerException {
+ TopiaContext transaction = null;
+ int result = 0;
+ try {
+ transaction = rootContext.beginTransaction();
+
+ BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
+ TopiaQuery<Boat> query = dao.createQuery("B");
+
+ query = createQueryForBoatFilter(query, filter);
+
+ result = query.executeCount();
+
+ transaction.closeContext();
+ } catch (Exception eee) {
+ SuiviObsmerContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee);
+ }
+ return result;
+ }
protected TopiaQuery<Boat> createQueryForBoatFilter(TopiaQuery<Boat> query, BoatFilter filter) {
String main = query.getMainAlias();
@@ -131,36 +154,18 @@
return query;
}
- @Override
- public int countBoatsByFilter(BoatFilter filter) throws SuiviObsmerException {
- TopiaContext transaction = null;
- int result = 0;
- try {
- transaction = rootContext.beginTransaction();
-
- BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
- TopiaQuery<Boat> query = dao.createQuery("B");
-
- query = createQueryForBoatFilter(query, filter);
-
- result = query.executeCount();
-
- transaction.closeContext();
- } catch (Exception eee) {
- SuiviObsmerContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee);
- }
- return result;
- }
-
/**
- * Get boat infos and elligible boats for a company and a boat. This method is useful to get sampleRows elligibles for
- * the boat. Only sampleRows not closed linked with the company argument will be returned.
- * The result give a Map with sampleRowCode in key and ElligibleBoat in value. The ElligibleBoat entity
- * contains the SampleRow and attributes useful to know if the link is active or specific for the company.
+ * Get boat infos and elligible boats for a company and a boat. This method
+ * is useful to get sampleRows elligibles for the boat. Only sampleRows not
+ * closed linked with the company argument will be returned. The result give
+ * a Map with sampleRowCode in key and ElligibleBoat in value.
+ * The ElligibleBoat entity contains the SampleRow and attributes useful
+ * to know if the link is active or specific for the company.
+ *
* @param boatImmatriculation immatriculation of the boat
* @param company the Company to filter the ElligibleBoats
- * @return an ElligibleBoatsCompany wich contains the map of ElligibleBoat, the company and an empty list for
- * deleted elements
+ * @return an ElligibleBoatsCompany wich contains the map of ElligibleBoat,
+ * the company and an empty list for deleted elements.
*/
@Override
public CompanyBoatInfos getCompanyBoatInfos(int boatImmatriculation, Company company)
@@ -269,7 +274,7 @@
}
@Override
- public List<Boat> getBoats(String immatriculations) throws SuiviObsmerException {
+ public List<Boat> getBoatsByImmatriculations(String immatriculations) throws SuiviObsmerException {
List<Boat> boats = new ArrayList<Boat>();
TopiaContext transaction = null;
if (StringUtils.isEmpty(immatriculations)) {
@@ -320,19 +325,22 @@
}
@Override
- public List<Boat> getAllBoats() throws SuiviObsmerException {
+ public List<String> getBoatNamesStartWith(String input) throws SuiviObsmerException {
TopiaContext transaction = null;
- List<Boat> results = new ArrayList<Boat>();
+ List<String> results = new ArrayList<String>();
try {
transaction = rootContext.beginTransaction();
+ input = StringUtils.upperCase(input);
+
BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
- results = dao.findAll();
+ results = (List<String>)dao.createQuery().addDistinct().setSelect(Boat.NAME).add(Boat.NAME, Op.LIKE, input + "%").execute();
transaction.closeContext();
} catch (Exception eee) {
- SuiviObsmerContext.serviceException(transaction, "Unable to get all boats", eee);
+ SuiviObsmerContext.serviceException(transaction,
+ "Impossible de récupérer les navires avec un nom commencant par '" + input + "'", eee);
}
return results;
}
@@ -340,12 +348,13 @@
/**
* Import boats from a CSV file. Warning, must be UTF-8 encoding.
* Use of CsvReader to manage InputStream and create or update boats.
- * Header file must be : NAVS_COD,CARN_NOM,CARN_LONGUEUR_HT,CARN_ANNEE,QUARTIER_IMMA,PER_COD,
- * PER_NOM,PER_PRENOM.
+ * Header file must be : NAVS_COD,CARN_NOM,CARN_LONGUEUR_HT,CARN_ANNEE,
+ * QUARTIER_IMMA,PER_COD, PER_NOM,PER_PRENOM.
* Existing boats (with same immatriculation) are updated.
+ *
* @param input Stream corresponding to Csv file
- * @return an array with two int : the first corresponding to total number of boats imported and
- * the second corresponding only to new boats added.
+ * @return an array with two int : the first corresponding to total number
+ * of boats imported and the second corresponding only to new boats added.
* @throws SuiviObsmerException
* @see com.csvreader.CsvReader
*/
@@ -387,32 +396,9 @@
String activeStr = reader.get(BOAT.NAVS_ACTIVE.name()).trim();
boolean active = !activeStr.equals("I");
-
-
// Find existing boat with immatriculation
- //
-
-// long tic1 = System.currentTimeMillis();
Boat boat = boatDAO.findByImmatriculation(immatriculation);
-// long tic2 = System.currentTimeMillis();
-// if (log.isDebugEnabled()) {
-// log.debug("findByImmatriculation : " + (tic2 - tic1));
-// }
-//
-// tic1 = System.currentTimeMillis();
-// Boat boat = QueryBuilder.getBoatByImmatriculation(transaction, immatriculation);
-// tic2 = System.currentTimeMillis();
-// if (log.isDebugEnabled()) {
-// log.debug("findByImmatriculation SQL : " + (tic2 - tic1));
-// }
-// tic1 = System.currentTimeMillis();
- //Boat boat = new TopiaQuery(Boat.class).add(Boat.IMMATRICULATION, immatriculation).executeToEntity(transaction);
-// tic2 = System.currentTimeMillis();
-// if (log.isDebugEnabled()) {
-// log.debug("findByImmatriculation TopiaQuery : " + (tic2 - tic1));
-// }
-
if (boat == null) {
boat = boatDAO.create(Boat.IMMATRICULATION, immatriculation);
result[1]++;
@@ -451,16 +437,6 @@
transaction.commitTransaction();
tic = ImportHelper.logTimeAndMemory(log, tic, "navires ligne " + result[0]);
-// if (log.isInfoEnabled()) {
-// log.info("RUNNING... Import navires ligne " + result[0]);
-// Runtime runtime = Runtime.getRuntime();
-// long mem = (runtime.totalMemory() - runtime.freeMemory()) / 1048576;
-// //long memMega = mem / 1024 / 1024;
-// log.info("Memory : " + mem + " Mo");
-// tic2 = System.currentTimeMillis();
-// log.info("Time : " + DurationFormatUtils.formatDurationHMS(tic2 - tic1));
-// tic1 = System.currentTimeMillis();
-// }
}
}
@@ -545,36 +521,9 @@
@Override
public InputStream getActivityCalendarLogFile() throws FileNotFoundException {
InputStream result = null;
-// try {
- String filename =
- SuiviObsmerContext.getProperty(SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY);
- File file = new File(filename);
- result = new FileInputStream(file);
-// } catch (FileNotFoundException eee) {
-// SuiviObsmerContext.serviceException(null,
-// "Fichier de log inexistant", eee);
-// }
+ String filename = SuiviObsmerContext.getProperty(SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY);
+ File file = new File(filename);
+ result = new FileInputStream(file);
return result;
}
-
- @Override
- public List<String> getBoatNamesStartWith(String input) throws SuiviObsmerException {
- TopiaContext transaction = null;
- List<String> results = new ArrayList<String>();
- try {
- transaction = rootContext.beginTransaction();
-
- input = StringUtils.upperCase(input);
-
- BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction);
-
- results = (List<String>)dao.createQuery().addDistinct().setSelect(Boat.NAME).add(Boat.NAME, Op.LIKE, input + "%").execute();
-
- transaction.closeContext();
- } catch (Exception eee) {
- SuiviObsmerContext.serviceException(transaction,
- "Impossible de récupérer les navires avec un nom commencant par '" + input + "'", eee);
- }
- return results;
- }
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -31,6 +31,7 @@
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
import fr.ifremer.suiviobsmer.bean.ContactState;
+import java.io.IOException;
import java.io.InputStream;
import org.nuiton.topia.framework.TopiaQuery;
import fr.ifremer.suiviobsmer.bean.states.ContactStateEnum;
@@ -58,6 +59,8 @@
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -92,7 +95,7 @@
}
@Override
- public Map<String, Contact> getContactsByFilter(ContactFilter filter) throws SuiviObsmerException {
+ public Map<String, Contact> getContacts(ContactFilter filter) throws SuiviObsmerException {
Map<String, Contact> results = new HashMap<String, Contact>();
TopiaContext transaction = null;
try {
@@ -121,7 +124,7 @@
}
@Override
- public int countContactsByFilter(ContactFilter filter) throws SuiviObsmerException {
+ public int getNbContacts(ContactFilter filter) throws SuiviObsmerException {
TopiaContext transaction = null;
int result = 0;
try {
@@ -307,10 +310,11 @@
TopiaContext transaction = null;
ImportResults result = new ImportResultsImpl();
int currRow = 1;
+ CsvReader reader = null;
try {
transaction = rootContext.beginTransaction();
- CsvReader reader = new CsvReader(input, Charset.forName("UTF-8"));
+ reader = new CsvReader(input, Charset.forName("UTF-8"));
reader.readHeaders();
ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction);
@@ -420,12 +424,14 @@
}
// new contact to import
+ boolean newContact = false;
if (contact == null) {
contact = dao.create(
TopiaEntity.TOPIA_CREATE_DATE, createDate,
Contact.USER, observer,
Contact.SAMPLE_ROW, row,
Contact.BOAT, boat);
+ newContact = true;
}
// String tideBeginString = ImportHelper.read(reader, CONTACT.CONT_DEBUT_MAREE);
@@ -457,15 +463,27 @@
contact.setMammalsObservation(mammalsObsv);
contact.setDataInputDate(dataInput);
- // Import validations only for superadmin : useful for archives
- if (user.getAdmin() && user.getLogin().equals("admin")) {
+ // Import validations only for superadmin and a new contact : useful for archives
+ if (newContact && user.getAdmin() && user.getLogin().equals("admin")) {
+ if (log.isDebugEnabled()) {
+ log.debug("SuperAdmin import :: validations");
+ }
Boolean companyValidation = ImportHelper.parseContactValidation(reader, CONTACT.CONT_SOCIETE_VALID);
Boolean programValidation = ImportHelper.parseContactValidation(reader, CONTACT.CONT_PROGRAM_VALID);
contact.setValidationCompany(companyValidation);
contact.setValidationProgram(programValidation);
+
+ // Add realTideTime for this contact if validations are ok and state is BOARDING_DONE
if (BooleanUtils.isTrue(companyValidation) && BooleanUtils.isNotFalse(programValidation) &&
contact.getState().equals(ContactState.BOARDING_DONE.toString())) {
- contact.getSampleRow().addRealTideTime(contact);
+ boolean ok = contact.getSampleRow().addRealTideTime(contact);
+ if (!ok) {
+ DateFormat dateFormat1 = new SimpleDateFormat("MM/yyyy");
+ result.addError(currRow, "Impossible de mettre à jour le nombre de marée réels, vérifiez le mois " +
+ "de " + dateFormat1.format(contact.getTideBeginDate()) + " pour la ligne du plan " + row.getCode());
+ result.incNbRefused();
+ continue;
+ }
}
}
@@ -503,6 +521,13 @@
"Erreur ligne " + currRow + " : " +
"Le format des dates est incorrect, il doit être de la forme : JJ/MM/AAAA", eee);
} catch (Exception eee) {
+ if (log.isDebugEnabled()) {
+ try {
+ log.debug("Ligne : " + currRow + " :: " + Arrays.toString(reader.getValues()));
+ } catch (IOException ex) {
+ log.error("Reader error", ex);
+ }
+ }
SuiviObsmerContext.serviceException(transaction,
"Impossible d'importer les contacts", eee);
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -26,6 +26,7 @@
import fr.ifremer.suiviobsmer.SuiviObsmerException;
import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper;
import fr.ifremer.suiviobsmer.SuiviObsmerContext;
+import fr.ifremer.suiviobsmer.entity.Company;
import fr.ifremer.suiviobsmer.entity.FishingZone;
import fr.ifremer.suiviobsmer.entity.FishingZoneDAO;
import fr.ifremer.suiviobsmer.entity.Profession;
@@ -66,7 +67,7 @@
}
@Override
- public List<String> getFacadesByUser(User user) throws SuiviObsmerException {
+ public List<String> getFacades(Company company) throws SuiviObsmerException {
TopiaContext transaction = null;
List<String> results = new ArrayList<String>();
try {
@@ -75,10 +76,10 @@
FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction);
TopiaQuery<FishingZone> query = dao.createQuery("F");
- if (!user.getAdmin()) {
+ if (company != null) {
query.addFrom(SampleRow.class.getName() + " S").
add("S IN elements(F." + FishingZone.SAMPLE_ROW + ")").
- add("S." + SampleRow.COMPANY, user.getCompany());
+ add("S." + SampleRow.COMPANY, company);
}
results = (List<String>)query.setSelect("DISTINCT F." + FishingZone.FACADE_NAME).execute();
@@ -91,7 +92,7 @@
}
@Override
- public List<String> getSectorsByUser(User user, String facadeName) throws SuiviObsmerException {
+ public List<String> getSectors(Company company, String facadeName) throws SuiviObsmerException {
TopiaContext transaction = null;
List<String> results = new ArrayList<String>();
try {
@@ -100,13 +101,13 @@
FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction);
TopiaQuery<FishingZone> query = dao.createQuery("F");
- if (!user.getAdmin()) {
+ if (company != null) {
query.addFrom(SampleRow.class.getName() + " S").
add("S IN elements(F." + FishingZone.SAMPLE_ROW + ")").
- add("S." + SampleRow.COMPANY, user.getCompany());
+ add("S." + SampleRow.COMPANY, company);
}
- if (!StringUtils.isEmpty(facadeName)) {
+ if (StringUtils.isNotEmpty(facadeName)) {
query.add("F." + FishingZone.FACADE_NAME, facadeName);
}
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties
===================================================================
--- trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties 2010-01-24 19:30:15 UTC (rev 264)
@@ -3,7 +3,7 @@
fr.ifremer.suiviobsmer.entity.Company.attribute.user.tagvalue.lazy=false
fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.lazy=false
-fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.orderBy=periodYear,periodMonth
+fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.orderBy=periodDate
fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.lazy=false
fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.orderBy=facadeName,sectorName,districtCode
fr.ifremer.suiviobsmer.entity.SampleRow.attribute.profession.tagvalue.lazy=false
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -106,7 +106,7 @@
InputStream input = getClass().getResourceAsStream("/import/navires.csv");
ServiceBoat serviceBoat = new ServiceBoatImpl();
serviceBoat.importBoatCsv(input);
- List<Boat> boats = serviceBoat.getBoats("174258");
+ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174258");
Boat boat = boats.get(0);
TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -94,7 +94,7 @@
InputStream input = getClass().getResourceAsStream("/import/navires.csv");
ServiceBoat serviceBoat = new ServiceBoatImpl();
serviceBoat.importBoatCsv(input);
- List<Boat> boats = serviceBoat.getBoats("174258");
+ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174258");
Boat boat = boats.get(0);
TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction();
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -93,8 +93,8 @@
SampleMonthDAO monthDAO = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction);
SampleMonth month = monthDAO.create(SampleMonth.SAMPLE_ROW, row);
- month.setPeriodMonth(4);
- month.setPeriodYear(2009);
+ Calendar calendar = new GregorianCalendar(2009, 3, 1);
+ month.setPeriodDate(calendar.getTime());
row.addSampleMonth(month);
transaction.commitTransaction();
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -166,10 +166,10 @@
service.importBoatCsv(input);
String immatriculations = "174592 978419 273129";
- List<Boat> results = service.getBoats(immatriculations);
+ List<Boat> results = service.getBoatsByImmatriculations(immatriculations);
assertEquals(3, results.size());
immatriculations = "174592 \\ èè-- ç999 àà \n\n 978419 00 ççç 273129";
- results = service.getBoats(immatriculations);
+ results = service.getBoatsByImmatriculations(immatriculations);
assertEquals(3, results.size());
}
@@ -233,7 +233,7 @@
transaction.closeContext();
// Set company and elligibleBoats '174592 177474' for row1
- List<Boat> boats = service.getBoats("174592 177474");
+ List<Boat> boats = service.getBoatsByImmatriculations("174592 177474");
row1.setCompany(company);
serviceSampling.createUpdateSampleRow(row1, boats, new SampleRowLogImpl());
// Set company only for row2
@@ -251,7 +251,7 @@
InputStream input = getClass().getResourceAsStream("/import/navires.csv");
service.importBoatCsv(input);
- List<Boat> boats = service.getBoats("174592");
+ List<Boat> boats = service.getBoatsByImmatriculations("174592");
Boat boat = boats.get(0);
// Two rows created : 2009_3 & 2010_4 and one Company : "TARTANPION"
@@ -328,26 +328,9 @@
/** EXEC METHOD **/
Contact result = companyBoatInfos.getLastContact();
Assert.assertEquals(contact1.getTopiaId(), result.getTopiaId());
-
-
}
/**
- * Test of getAllBoats method, of class ServiceBoatImpl.
- * @throws Exception
- */
- @Test
- public void testGetAllBoats() throws Exception {
- log.info("getAllBoats");
-
- InputStream input = getClass().getResourceAsStream("/import/navires.csv");
- service.importBoatCsv(input);
-
- List<Boat> boats = service.getAllBoats();
- assertEquals(6, boats.size());
- }
-
- /**
* Test of importBoatCsv method, of class ServiceBoatImpl.
* @throws Exception
*/
@@ -362,7 +345,7 @@
assertEquals(6, nbBoats[1]);
// Check boat 174592 is active &nd boat 177474 is inactive
- List<Boat> results = service.getBoats("174592 177474");
+ List<Boat> results = service.getBoatsByImmatriculations("174592 177474");
assertTrue(results.get(0).getActive());
assertFalse(results.get(1).getActive());
}
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -82,10 +82,8 @@
InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv");
service.importFishingZoneCsv(input);
- User user = new UserImpl();
- user.setAdmin(true);
- List<String> facades = service.getFacadesByUser(user);
+ List<String> facades = service.getFacades(null);
assertEquals(3, facades.size());
assertTrue(facades.contains("Atlantique"));
assertTrue(facades.contains("Mer du Nord"));
@@ -98,10 +96,8 @@
InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv");
service.importFishingZoneCsv(input);
- User user = new UserImpl();
- user.setAdmin(true);
- List<String> sectors = service.getSectorsByUser(user, null);
+ List<String> sectors = service.getSectors(null, null);
assertEquals(5, sectors.size());
assertTrue(sectors.contains("Manche"));
assertTrue(sectors.contains("Mer du Nord"));
@@ -109,7 +105,7 @@
assertTrue(sectors.contains("Golfe de Gascogne"));
assertTrue(sectors.contains("Méditerranée"));
- sectors = service.getSectorsByUser(user, "Atlantique");
+ sectors = service.getSectors(null, "Atlantique");
assertEquals(2, sectors.size());
assertTrue(sectors.contains("Manche Ouest"));
assertTrue(sectors.contains("Golfe de Gascogne"));
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImplTest.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -134,17 +134,17 @@
profession1.setLibelle("Chalutage de poissons tubes");
List<SampleMonth> months = new ArrayList<SampleMonth>();
- for (int i= 1; i <= 12; i++) {
+ for (int i = 0; i < 12; i++) {
SampleMonth month = new SampleMonthImpl();
- month.setPeriodMonth(i);
- month.setPeriodYear(2009);
+ Calendar calendar = new GregorianCalendar(2009, i, 1);
+ month.setPeriodDate(calendar.getTime());
month.setExpectedTidesValue(3);
months.add(month);
}
- for (int i= 1; i <= 3; i++) {
+ for (int i = 0; i < 3; i++) {
SampleMonth month = new SampleMonthImpl();
- month.setPeriodMonth(i);
- month.setPeriodYear(2010);
+ Calendar calendar = new GregorianCalendar(2010, i, 1);
+ month.setPeriodDate(calendar.getTime());
month.setExpectedTidesValue(4);
months.add(month);
}
@@ -162,7 +162,7 @@
row.setFishingZonesInfos("port tres loin du champ");
/** EXEC CREATE **/
- List<Boat> boats = serviceBoat.getBoats("174592 978419 273129");
+ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174592 978419 273129");
service.createUpdateSampleRow(row, boats, new SampleRowLogImpl());
assertNotNull(row.getTopiaId());
assertNotNull(row.getProfession().getTopiaId());
@@ -428,7 +428,7 @@
input = getClass().getResourceAsStream("/import/navires.csv");
ServiceBoat serviceBoat = new ServiceBoatImpl();
serviceBoat.importBoatCsv(input);
- List<Boat> boats = serviceBoat.getBoats("174592 978419 273129");
+ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174592 978419 273129");
service.createUpdateSampleRow(row, boats, new SampleRowLogImpl());
/** EXEC METHOD **/
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -145,7 +145,7 @@
if (getFilter().getCompany() != null) {
companyId = getFilter().getCompany().getTopiaId();
}
- } else {
+ } else if (!user.getAdmin()) {
if (log.isDebugEnabled()) {
log.debug("Company filtered : " + user.getCompany());
}
@@ -187,7 +187,7 @@
log.info("BUSINESS REQUEST [getFacades]");
}
List<OptionModel> options = new ArrayList<OptionModel>();
- for (String facadeName : serviceReferential.getFacadesByUser(user)) {
+ for (String facadeName : serviceReferential.getFacades(getFilter().getCompany())) {
options.add(new OptionModelImpl(facadeName,facadeName));
}
facadeSelectModel = new SelectModelImpl(null, options);
@@ -201,7 +201,7 @@
log.info("BUSINESS REQUEST [getSectors]");
}
List<OptionModel> options = new ArrayList<OptionModel>();
- for (String sectorName : serviceReferential.getSectorsByUser(user, getFilter().getFacadeName())) {
+ for (String sectorName : serviceReferential.getSectors(getFilter().getCompany(), getFilter().getFacadeName())) {
options.add(new OptionModelImpl(sectorName,sectorName));
}
sectorSelectModel = new SelectModelImpl(null, options);
@@ -212,7 +212,7 @@
public GenericSelectModel<SampleRow> getSampleRowSelectModel() throws SuiviObsmerException {
if (sampleRowSelectModel == null) {
if (log.isInfoEnabled()) {
- log.info("BUSINESS REQUEST [getSampleRowsForUser]");
+ log.info("BUSINESS REQUEST [getSampleRowsByFilter]");
}
// WARN : no use of sampleRow filter
@@ -330,27 +330,61 @@
private boolean edited;
+ /**
+ * EVENT :: selected on refreshByCompany submit button. Reset selects for
+ * company selected : facades, sectors, sampleRows and observers.
+ * This method set the state to edited, you can use
+ * {@link AbstractFilteredPage#isEdited() } method to test it.
+ *
+ * @throws SuiviObsmerException
+ * @see AbstractFilteredPage#onSelectedFromRefreshByFacade()
+ */
+ public void onSelectedFromRefreshByCompany() throws SuiviObsmerException {
+ // Reset facades
+ getFilter().setFacadeName(null);
+ onSelectedFromRefreshByFacade();
+ resetFacadeSelect();
+ // Reset observers
+ getFilter().setObserver(null);
+ observerSelectModel = null;
+ getObserverSelectModel();
+ edited = true;
+ }
+
+ /**
+ * EVENT :: selected on refreshByFacade submit button. Reset selects for
+ * facade selected : sectors and sampleRows.
+ * This method set the state to edited, you can use
+ * {@link AbstractFilteredPage#isEdited() } method to test it.
+ *
+ * @throws SuiviObsmerException
+ * @see AbstractFilteredPage#onSelectedFromRefreshBySector()
+ */
public void onSelectedFromRefreshByFacade() throws SuiviObsmerException {
+ // Reset sectors
getFilter().setSectorName(null);
onSelectedFromRefreshBySector();
resetSectorSelect();
}
+ /**
+ * EVENT :: selected on refreshBySector submit button. After refreshing
+ * data selected, reset selects for sector selected : sampleRows.
+ * This method set the state to edited, you can use
+ * {@link AbstractFilteredPage#isEdited() } method to test it.
+ *
+ * @throws SuiviObsmerException
+ * @see AbstractFilteredPage#onSelectedFromSearch()
+ */
public void onSelectedFromRefreshBySector() throws SuiviObsmerException {
+ // Update selected data
onSelectedFromSearch();
+ // Reset sampleRows;
getFilter().setSampleRow(null);
resetSampleRowSelect();
edited = true;
}
- public void onSelectedFromRefreshByCompany() throws SuiviObsmerException {
- onSelectedFromSearch();
- getFilter().setObserver(null);
- observerSelectModel = null;
- getObserverSelectModel();
- edited = true;
- }
-
protected boolean isEdited() {
return edited;
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -66,9 +66,9 @@
@Override
protected int count() throws SuiviObsmerException {
if (log.isInfoEnabled()) {
- log.info("BUSINESS REQUEST [countBoatsByFilter]");
+ log.info("BUSINESS REQUEST [getNbBoatsByFilter]");
}
- return service.countBoatsByFilter(filter);
+ return service.getNbBoatsByFilter(filter);
}
@Override
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -46,15 +46,15 @@
}
filter.setStartIndex(startIndex);
filter.setEndIndex(endIndex);
- return serviceContact.getContactsByFilter(filter);
+ return serviceContact.getContacts(filter);
}
@Override
protected int count() throws SuiviObsmerException {
if (log.isInfoEnabled()) {
- log.info("BUSINESS REQUEST [countContactsByFilter]");
+ log.info("BUSINESS REQUEST [getNbContacts]");
}
- return serviceContact.countContactsByFilter(filter);
+ return serviceContact.getNbContacts(filter);
}
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -37,6 +37,7 @@
import fr.ifremer.suiviobsmer.services.ServiceBoat;
import fr.ifremer.suiviobsmer.services.ServiceReferential;
import fr.ifremer.suiviobsmer.services.ServiceSampling;
+import fr.ifremer.suiviobsmer.services.ServiceUser;
import fr.ifremer.suiviobsmer.ui.base.AbstractFilteredPage;
import fr.ifremer.suiviobsmer.ui.data.BusinessUtils;
import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel;
@@ -58,6 +59,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.Block;
import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.StreamResponse;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
@@ -142,7 +144,7 @@
}
// Initialize filters using AbstractFilteredPage superclass
- initSelectFilters(true, false);
+ initSelectFilters(false, false);
companyBoatInfos = null;
//boatSelectedImmatriculation = null;
@@ -464,10 +466,14 @@
return false;
}
- Block onActionFromShowBoatInfos(Integer boatImma) {
+ Block onActionFromShowBoatInfos(Integer boatImma) throws SuiviObsmerException {
boatSelectedImmatriculation = boatImma;
// Suppress persistant boat informations
- companyBoatInfos = null;
+ companyBoatInfos = null;
+
+ if (user.getAdmin() && getCompany() != null) {
+ companySelectedId = getCompany().getTopiaId();
+ }
return boatsZone.getBody();
}
@@ -495,6 +501,17 @@
private Date boardingFromDate;
+ private GenericSelectModel<Company> companies;
+
+ @Inject
+ private ServiceUser serviceUser;
+
+ @Property
+ @Persist(PersistenceConstants.FLASH)
+ private String companySelectedId;
+
+ private Company company;
+
/*@Persist
private SuiviObsmerPropertyChangeListener propertyChange;*/
@@ -512,36 +529,62 @@
}
public CompanyBoatInfos getCompanyBoatInfos() throws SuiviObsmerException {
- if (companyBoatInfos == null && boatSelectedImmatriculation != null) {
+ if (companyBoatInfos == null && boatSelectedImmatriculation != null && getCompany() != null) {
if (log.isInfoEnabled()) {
log.info("BUSINESS REQUEST [getElligibleBoats]");
- }
- // Use filter to retrieve company
- Company company = getFilter().getCompany() != null ? getFilter().getCompany() : user.getCompany();
- companyBoatInfos =
- serviceBoat.getCompanyBoatInfos(boatSelectedImmatriculation, company);
+ }
+ companyBoatInfos = serviceBoat.getCompanyBoatInfos(boatSelectedImmatriculation, getCompany());
}
return companyBoatInfos;
}
/**
- * Used to get the selected boat name. This method is useful to avoid problems when using only boatInfos.
- * Actually, the name is displayed when the boat is selected.
+ * Retrieve companies select model for admin user. Only active companies
+ * will be used for this model.
*
- * @return
+ * @return the GenericSelectModel<Company>
* @throws SuiviObsmerException
*/
- public String getBoatName() throws SuiviObsmerException {
- Boat selectedBoat = null;
- if (getBoatInfos() != null) {
- selectedBoat = getBoatInfos().getBoat();
- } else {
- selectedBoat = getBoats().get(boatSelectedImmatriculation);
+ public GenericSelectModel<Company> getCompanies() throws SuiviObsmerException {
+ if (companies == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("BUSINESS REQUEST [getCompanies]");
+ }
+ List<Company> results = serviceUser.getCompanies(true);
+ companies = new GenericSelectModel<Company>(results, Company.class, "name","topiaId",propertyAccess);
}
- return selectedBoat.getName();
+ return companies;
}
/**
+ * Get the current company. The user one if it's not an admin or the
+ * selected one otherwise.
+ *
+ * @return the current Company
+ * @throws SuiviObsmerException
+ */
+ public Company getCompany() throws SuiviObsmerException {
+ if (company == null) {
+ if (StringUtils.isNotEmpty(companySelectedId)) {
+ company = getCompanies().findObject(companySelectedId);
+ } else if (!user.getAdmin()) {
+ company = user.getCompany();
+ }
+ }
+ return company;
+ }
+
+ /**
+ * Used to get the selected boat.
+ *
+ * @return the selected boat from the grid
+ * @throws SuiviObsmerException
+ */
+ public Boat getBoatSelected() throws SuiviObsmerException {
+ return getBoats().get(boatSelectedImmatriculation);
+ }
+
+ /**
* Date for calculate boardings done for the selected boat. All boardings (number of contacts) will be calculated from this date.
* Initialized as 12 months from today, but can be set by user.
*
@@ -566,6 +609,9 @@
}
public BoatInfos getBoatInfos() throws SuiviObsmerException {
+ if (getCompanyBoatInfos() == null) {
+ return null;
+ }
return getCompanyBoatInfos().getBoatInfos();
}
@@ -607,10 +653,7 @@
/** /////////////////////// ACTIONS //////////////////////////////////// **/
Block onSuccessFromCompanySelectForm() throws SuiviObsmerException {
- // Must be call to refresh company data from select
- super.onSelectedFromSearch();
companyBoatInfos = null;
- // boatSelectedImmatriculation is getting from Persist("flash")
getCompanyBoatInfos();
return boatInfosZone.getBody();
}
@@ -685,12 +728,10 @@
}
Object onActionFromAddNewContactFromSampleRow(String sampleRowCode) throws SuiviObsmerException {
- // Get selected boat from BoatInfos
- boat = getBoatInfos().getBoat();
// Get sampleRow from elligibleBoat list
ElligibleBoat elligible = getCompanyBoatInfos().getElligibleBoat(sampleRowCode);
sampleRow = elligible.getSampleRow();
- contacts.createNewContact(boat, sampleRow);
+ contacts.createNewContact(getBoatSelected(), sampleRow);
return contacts;
}
@@ -700,13 +741,11 @@
private BoatActivityCalendar calendarPage;
public boolean hasActivityCalendar() throws SuiviObsmerException {
- boat = getBoatInfos().getBoat();
- return boat.sizeActivityCalendar() != 0;
+ return getBoatSelected().sizeActivityCalendar() != 0;
}
Object onActionFromShowLastActivityCalendar() throws SuiviObsmerException {
- boat = getBoatInfos().getBoat();
- calendarPage.setBoat(boat);
+ calendarPage.setBoat(getBoatSelected());
return calendarPage;
}
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -157,7 +157,7 @@
if (contactFilter == null) {
contactFilter = new ContactFilterImpl();
// Initialized to 12 months before the current day
- Date fromDate = DateUtils.createDateAfterToday(0, -12, 0);
+ Date fromDate = DateUtils.createDateAfterToday(0, -6, 0);
contactFilter.setFromDate(fromDate);
}
return contactFilter;
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-01-24 19:30:15 UTC (rev 264)
@@ -593,7 +593,7 @@
"Vous devez ajouter au moins une zone de pêche à la ligne");
}
- boats = serviceBoat.getBoats(immatriculations);
+ boats = serviceBoat.getBoatsByImmatriculations(immatriculations);
// Update sampleRowCode from program only if changed
} else if (isCreateMode()) {
String rowCode = serviceSampling.getNewSampleRowCode(periodBegin);
Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-24 19:30:15 UTC (rev 264)
@@ -48,7 +48,7 @@
<!-- Filtres -->
<!--t:filters t:title="Filtres de recherche" t:mainId="so-boats-filters"-->
- <div t:type="zone" class="so-filters" t:id="filtersZone" t:update="show" id="so-boats-filters">
+ <div t:type="zone" class="so-filters" t:id="filtersZone" id="so-boats-filters">
<fieldset>
<legend>Filtres de recherche</legend>
<div class="aright">
@@ -105,8 +105,8 @@
<div t:type="zone" t:id="boatsZone" t:update="show" class="clearfix">
<!-- BOATLIST:: -->
<div class="fleft" id="so-boats-list">
- <h1>Liste des navires</h1>
- <div t:type="grid" t:source="boats" t:row="boat"
+ <h1>Liste de ${boats.availableRows} navires</h1>
+ <div t:type="grid" t:source="boats" t:row="boat" t:inPlace="true"
t:include="name, immatriculation, districtCode, boatLength, buildYear" t:rowClass="prop:rowStyle" t:rowsPerPage="20">
<p:nameCell>
<t:if t:test="canCreateNewContactFromList()">
@@ -128,15 +128,15 @@
<t:unless t:test="activityCalendarImportRun">
<!-- HEADER For admin -->
<t:if t:test="user.admin">
- <h2>Informations sur <!--${companyBoatInfos.boatInfos.boat.name}-->${boatName}</h2>
+ <h2>Informations sur ${boatSelected.name}</h2>
<form t:type="form" t:id="companySelectForm" t:zone="so-boats-boat-infos">
<t:label t:for="company" /> :
- <input t:type="select" t:id="company" t:model="companySelectModel" t:value="companyId" />
+ <input t:type="select" t:id="company" t:model="companies" t:value="companySelectedId" />
<input t:type="submit" class="ico search" t:id="searchCompany" value="Search" />
</form>
</t:if>
<!-- BODY - delegator -->
- <t:if t:test="filter.company">
+ <t:if t:test="companyBoatInfos">
<t:delegate to="activeBoatInfosBlock" />
</t:if>
<!-- BODY - activity calendar -->
Modified: trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-24 19:30:15 UTC (rev 264)
@@ -19,7 +19,7 @@
</a>
</div>
<!-- FILTRES -->
-<div t:type="zone" class="so-filters" t:id="filtersZone" t:update="show" t:visible="prop:filtersVisible" id="so-contacts-filters">
+<div t:type="zone" class="so-filters" t:id="filtersZone" t:visible="prop:filtersVisible" id="so-contacts-filters">
<fieldset>
<legend>Recherche avancée</legend>
<div class="so-filters-form">
@@ -27,6 +27,18 @@
<t:errors />
<div class="t-beaneditor">
<div>
+ <t:label t:for="fromDate" />:
+ <input t:type="datefield" class="width70" t:id="fromDate" value="contactFilter.fromDate" />
+ <t:if t:test="user.admin">
+ <t:label t:for="company" />:
+ <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
+ title="Rafraîchir les filtres en fonction de la société sélectionnée"/>
+ </t:if>
+ <t:label t:for="observer" />:
+ <select t:type="select" t:id="observer" t:model="observerSelectModel" value="observerId" />
+ </div><p> </p>
+ <div>
<!-- Boat filter -->
<label>Navire </label>
<t:label t:for="boatImmatriculation" />:
@@ -56,18 +68,6 @@
</t:label>
</div><p> </p>
<div>
- <t:label t:for="fromDate" />:
- <input t:type="datefield" class="width70" t:id="fromDate" value="contactFilter.fromDate" />
- <t:if t:test="user.admin">
- <t:label t:for="company" />:
- <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
- <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
- title="Rafraîchir les observateurs en fonction de la société sélectionnée"/>
- </t:if>
- <t:label t:for="observer" />:
- <select t:type="select" t:id="observer" t:model="observerSelectModel" value="observerId" />
- </div><p> </p>
- <div>
<t:label t:for="state" />:
<select t:type="select" t:id="state" value="contactFilter.state"/>
<label>Validation société: </label>
@@ -124,7 +124,8 @@
</fieldset>
</div>
<!-- CONTACT LIST -->
-<t:zone t:id="gridZone" t:update="show">
+<p><strong>${contacts.availableRows} contacts trouvés</strong></p>
+<!--<t:zone t:id="gridZone" t:update="show">-->
<form t:type="form" t:id="contactsForm" t:zone="gridZone">
<t:errors id="so-contact-form-errors" t:banner="message:contactsForm-errors-banner"/>
<div t:type="grid" t:source="contacts" t:row="contact" class="t-data-grid ${gridClass}" t:model="contactModel" t:rowClass="prop:rowClass"
@@ -293,6 +294,6 @@
</p:actionsCell>
</div>
</form>
-</t:zone>
+<!--</t:zone>-->
</t:layout>
Modified: trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml 2010-01-24 19:30:15 UTC (rev 264)
@@ -46,7 +46,7 @@
<div class="acenter" id="so-datasampling">
<fieldset>
<legend>Filtres</legend>
- <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters" t:update="show">
+ <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters">
<!--<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters">-->
<form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters">
<t:errors />
@@ -57,6 +57,12 @@
<input t:type="datefield" class="width70" t:id="periodBegin" t:value="filter.period.fromDate" />
<t:label t:for="periodEnd" />:
<input t:type="datefield" class="width70" t:id="periodEnd" t:value="filter.period.thruDate" />
+ <t:if t:test="user.admin">
+ <t:label t:for="company" />:
+ <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
+ title="Rafraîchir les filtres en fonction de la société sélectionnée"/>
+ </t:if>
</div>
<div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show">
<t:label t:for="facadeName" />:
@@ -67,18 +73,11 @@
<select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
<input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
-
+ <t:label t:for="sampleRow" />:
+ <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
<!--<t:label t:for="program" />:
<input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />-->
</div>
- <div>
- <t:label t:for="sampleRow" />:
- <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
- <t:if t:test="user.admin">
- <t:label t:for="company" />:
- <input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
- </t:if>
- </div>
<div class="t-beaneditor-row aright">
<input t:type="submit" class="ico search-32px" t:id="search" value="Search" />
<input t:type="submit" class="ico undo" t:id="reset" value="Reset" />
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/synthesis.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/synthesis.css 2010-01-23 18:16:17 UTC (rev 263)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/synthesis.css 2010-01-24 19:30:15 UTC (rev 264)
@@ -60,7 +60,7 @@
}*/
div#so-datasampling fieldset {
- width: 60%;
+ width: 70%;
margin-left: auto;
margin-right: auto;
text-align: left;
1
0
[Suiviobsmer-commits] r263 - in trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer: . impl
by fdesbois@users.labs.libre-entreprise.org 23 Jan '10
by fdesbois@users.labs.libre-entreprise.org 23 Jan '10
23 Jan '10
Author: fdesbois
Date: 2010-01-23 18:16:17 +0000 (Sat, 23 Jan 2010)
New Revision: 263
Modified:
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
Log:
Permission to import contact validations for superadmin
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java 2010-01-23 17:59:23 UTC (rev 262)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java 2010-01-23 18:16:17 UTC (rev 263)
@@ -336,6 +336,15 @@
return valid;
}
+ public static Boolean parseContactValidation(CsvReader reader, ImportHeader header) throws IOException {
+ String validation = read(reader, header);
+ if (validation.equals("A")) {
+ return Boolean.TRUE;
+ } else {
+ return validation.equals("R") ? Boolean.FALSE : null;
+ }
+ }
+
public static String formatContactMammals(boolean mammals) {
return mammals ? "X" : "";
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-23 17:59:23 UTC (rev 262)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-23 18:16:17 UTC (rev 263)
@@ -58,12 +58,12 @@
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.persistence.TopiaEntity;
@@ -457,6 +457,18 @@
contact.setMammalsObservation(mammalsObsv);
contact.setDataInputDate(dataInput);
+ // Import validations only for superadmin : useful for archives
+ if (user.getAdmin() && user.getLogin().equals("admin")) {
+ Boolean companyValidation = ImportHelper.parseContactValidation(reader, CONTACT.CONT_SOCIETE_VALID);
+ Boolean programValidation = ImportHelper.parseContactValidation(reader, CONTACT.CONT_PROGRAM_VALID);
+ contact.setValidationCompany(companyValidation);
+ contact.setValidationProgram(programValidation);
+ if (BooleanUtils.isTrue(companyValidation) && BooleanUtils.isNotFalse(programValidation) &&
+ contact.getState().equals(ContactState.BOARDING_DONE.toString())) {
+ contact.getSampleRow().addRealTideTime(contact);
+ }
+ }
+
result.incNbImported();
} else {
1
0
23 Jan '10
Author: fdesbois
Date: 2010-01-23 17:59:23 +0000 (Sat, 23 Jan 2010)
New Revision: 262
Modified:
trunk/changelog.txt
trunk/pom.xml
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/states/ContactState.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java
trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties
trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml
trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml
trunk/suiviobsmer-ui/src/main/webapp/css/boats.css
trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css
Log:
- Clean filters managment (replace js onChange event on selects by submit buttons)
- Clean imports + resolve issues on "INA" in ActivityCalendar and missing PLAN_COMMENT header
- Add back link from ActivityCalendar page
- Use ContactDataSource to refresh contacts grid
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/changelog.txt 2010-01-23 17:59:23 UTC (rev 262)
@@ -4,12 +4,12 @@
0.1.2
-----
-- [fdesbois] Ano #2033 : Problème avec le filtre sur un code de ligne dans les synthèses
+- [fdesbois] Ano #2037 : Le retour depuis les calendriers d'activité ne ramène pas sur le navire sélectionnée (ajout d'un lien retour)
+- [fdesbois] Evol #2036 : Optimiser la pagination des contacts (suppression des tris sur les colonnes du tableau)
+- [fdesbois] Evol #2030, #2038, Ano #2033, #2042 : Revoir la gestion des filtres sur les pages navires, contacts et synthèse
- [fdesbois] Ano #2034 : Mauvais calcul des marées réels
-- [fdesbois] Ano #2042 : Problème sur les filtres de la page contacts (une validation les enlève)
- [fdesbois] Evol #2017 : Permettre la suppression d'un utilisateur non utilisé dans l'application
- [fdesbois] Evol #1959 : Contacts : Popup pour la sasie d'un commentaire sur une ligne
-- [fdesbois] Evol #2030 : Refactoré filtres des navires pour utiliser la partie commune a ceux des contacts et des syntheses
- [fdesbois] Ano #2019 : L'affichage des zones sur le plan d'échantillonnage n'est pas cohérent avec les lignes.
0.1.1
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/pom.xml 2010-01-23 17:59:23 UTC (rev 262)
@@ -207,7 +207,7 @@
<!-- libraries version -->
<nuitonutils.version>1.1.3</nuitonutils.version>
- <topia.version>2.3.0-beta-5</topia.version>
+ <topia.version>2.3.0-beta-6-SNAPSHOT</topia.version>
<eugene.version>2.0.0-beta-3</eugene.version>
<tapestry.version>5.1.0.5</tapestry.version>
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/ImportHelper.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -72,19 +72,19 @@
/** Boat name **/
CARN_NOM(21),
/** Boat length **/
- CARN_LONGUEUR_HT(-1),
+ CARN_LONGUEUR_HT,
/** Boat build year **/
- CARN_ANNEE(-1),
+ CARN_ANNEE,
/** Boat district code **/
QUARTIER_IMMA(22),
/** ShipOwner code **/
- PER_COD(-1),
+ PER_COD,
/** ShipOwner last name **/
- PER_NOM(-1),
+ PER_NOM,
/** ShipOwner first name **/
- PER_PRENOM(-1),
+ PER_PRENOM,
/** Boat active **/
- NAVS_ACTIVE(-1);
+ NAVS_ACTIVE;
int contactHeader;
@@ -92,6 +92,10 @@
this.contactHeader = index;
}
+ BOAT() {
+ this.contactHeader = -1;
+ }
+
@Override
public int forContactCsv() {
return contactHeader;
@@ -132,9 +136,11 @@
/** Profession species **/
METIER_ESPECES(19),
/** SampleRow nb observants **/
- PLAN_NB_OBSERV(-1),
+ PLAN_NB_OBSERV,
/** SampleRow average tide time **/
- PLAN_DUREE_MOY(-1);
+ PLAN_DUREE_MOY,
+ /** SampleRow comment **/
+ PLAN_COMMENT;
int contactHeader;
@@ -142,6 +148,10 @@
this.contactHeader = index;
}
+ SAMPLING() {
+ this.contactHeader = -1;
+ }
+
@Override
public int forContactCsv() {
return contactHeader;
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -22,10 +22,12 @@
package fr.ifremer.suiviobsmer.bean;
import fr.ifremer.suiviobsmer.entity.Contact;
+import fr.ifremer.suiviobsmer.entity.SampleRow;
import fr.ifremer.suiviobsmer.entity.User;
import java.util.ArrayList;
import java.util.List;
import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.topia.persistence.TopiaEntity;
/**
* ContactFilterImpl
@@ -47,12 +49,21 @@
if (getObserver() != null) {
query.add(contact + "." + Contact.USER, getObserver());
- } else if (getCompany() != null) {
- query.add(contact + "." + Contact.USER + "." + User.COMPANY, getCompany());
}
+ // Company filter is managed by SamplingFilter cause the company is linked with the sampleRow instead of contact user
+// else if (getCompany() != null) {
+// query.add(contact + "." + Contact.USER + "." + User.COMPANY, getCompany());
+// }
- query = prepareQueryForSampling(query, query.getMainAlias() + "." + Contact.SAMPLE_ROW);
- query = prepareQueryForBoat(query, query.getMainAlias() + "." + Contact.BOAT);
+ if (isSamplingFiltered() || getFromDate() != null) {
+ // Seems to be necessary to have distinct on sampleRows in case of
+ // fishingZone join. Otherwise multiple contacts for sames sampleRow
+ // will be returned (Bad count).
+ TopiaQuery<SampleRow> subquery = TopiaQuery.createQuery(SampleRow.class, "S").setSelect("S").addDistinct();
+ subquery = prepareQueryForSampling(subquery, "S");
+ query.add(contact + "." + Contact.SAMPLE_ROW + " IN (" + subquery.fullQuery() + ")").addParams(subquery.getParams());
+ }
+ query = prepareQueryForBoat(query, contact + "." + Contact.BOAT);
if (getMammalsObservation() && getMammalsCapture()) {
query.add(contact + ".mammalsObservation = :mammals OR " + contact + ".mammalsCapture = :mammals").
@@ -85,6 +96,14 @@
query.add(contact + "." + Contact.STATE, getState().toString());
}
+ if (getFromDate() != null) {
+ String tideBeginDate = contact + "." + Contact.TIDE_BEGIN_DATE;
+ String createDate = contact + "." + TopiaEntity.TOPIA_CREATE_DATE;
+ query.add("(" + tideBeginDate + " IS NOT NULL AND " + tideBeginDate + " >= :fromDate)" +
+ " OR (" + tideBeginDate + " IS NULL AND " + createDate + " >= :fromDate)");
+ query.addParam("fromDate", getFromDate());
+ }
+
return query;
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -52,10 +52,10 @@
query.add(main, getSampleRow());
} else if (StringUtils.isNotEmpty(getSectorName())) {
query.addFrom(FishingZone.class.getName() + " F");
- query.add("F." + FishingZone.SECTOR_NAME, getSectorName()).add(main + " IN elements(F." + FishingZone.SAMPLE_ROW + ")");
+ query.add("F." + FishingZone.SECTOR_NAME, getSectorName()).add("F IN elements(" + main + "." + SampleRow.FISHING_ZONE + ")");
} else if (StringUtils.isNotEmpty(getFacadeName())) {
query.addFrom(FishingZone.class.getName() + " F");
- query.add("F." + FishingZone.FACADE_NAME, getFacadeName()).add(main + " IN elements(F." + FishingZone.SAMPLE_ROW + ")");
+ query.add("F." + FishingZone.FACADE_NAME, getFacadeName()).add("F IN elements(" + main + "." + SampleRow.FISHING_ZONE + ")");
}
// Profession filter
@@ -68,10 +68,16 @@
getPeriod().initDayOfMonthExtremities();
query.add(main + "." + SampleRow.PERIOD_BEGIN, Op.LT, getPeriod().getThruDate()).
add(main + "." + SampleRow.PERIOD_END, Op.GT, getPeriod().getFromDate());
+ } else if (getFromDate() != null) {
+ query.add(main + "." + SampleRow.PERIOD_END, Op.GE, getFromDate());
}
- /** Finished rows constraint only needed if an other filter is set **/
- if (isSamplingFiltered() && getNbMonthFinishedFromToday() != null) {
+ // Company
+ if (getCompany() != null) {
+ query.add(main + "." + SampleRow.COMPANY, getCompany());
+ }
+
+ if (getNbMonthFinishedFromToday() != null) {
// Only rows which are not finished will be kept
// Date current = SuiviObsmerContext.getCurrentDate();
Calendar calendar = new GregorianCalendar();
@@ -85,6 +91,7 @@
@Override
public boolean isSamplingFiltered() {
+ // all field except fromDate
return getSampleRow() != null || StringUtils.isNotEmpty(getSectorName()) || StringUtils.isNotEmpty(getFacadeName()) ||
getPeriod() != null || getProfession() != null;
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/states/ContactState.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/states/ContactState.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/states/ContactState.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -91,7 +91,7 @@
* changing state.
* @param context Context to manipulate for validation
* @param transitionNum Number of the transaction to validate
- * @return true if the transition is validate, false either
+ * @return true if the transition is validate, false otherwise
* @throws ContactStateException
*/
protected boolean validate(ContactContext context, int transitionNum) throws ContactStateException {
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -52,7 +52,7 @@
* The state is tested for the last created contact.
* A new contact can be created only if the last state is final and is not 'Refus définitif'.
* @param company which is the creator of the contact
- * @return true if the contact can be created, false either
+ * @return true if the contact can be created, false otherwise
* @throws SuiviObsmerException
*/
@Override
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -55,7 +55,7 @@
/**
* Get a SampleMonth from a date. The month and year of the date must correspond to the SampleMonth to get.
* @param date a Date
- * @return the SampleMonth if it exists in the SampleMonth list or null either
+ * @return the SampleMonth if it exists in the SampleMonth list or null otherwise
*/
@Override
public SampleMonth getSampleMonth(Date date) {
@@ -124,7 +124,7 @@
* Check if the sampleRow has an ElligibleBoat corresponding to the boat in argument.
* The test return true only if it's a global ElligbleBoat set by an admin and not by a user (companyActive).
* @param boat Boat to test
- * @return true if the ElligibleBoat is find, false either
+ * @return true if the ElligibleBoat is find, false otherwise
*/
@Override
public boolean hasElligibleBoat(Boat boat) {
@@ -188,7 +188,7 @@
/**
* Check if SampleMonth of the SampleRow has already realTidesValue set (different from 0).
* It means the SampleRow could'nt be deleted and have some modification constraints.
- * @return true if a SampleMonth have realTidesValue, false either
+ * @return true if a SampleMonth have realTidesValue, false otherwise
*/
@Override
public boolean hasSampleMonthRealTideTime() {
@@ -253,7 +253,7 @@
* Check if a SampleMonth is valid for the date in argument.
*
* @param begin date for testing SampleMonth existence
- * @return true if a SampleMonth exist for this begin date, false either
+ * @return true if a SampleMonth exist for this begin date, false otherwise
*/
@Override
public boolean isValid(Date begin) {
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ActivityCalendarImport.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -216,9 +216,8 @@
}
//String harbourCode = reader.get("SYNA_POR_COD").trim();
- String harbourCode = ImportHelper.read(reader, ACTIVITY_CALENDAR.SYNA_POR_COD);
- boolean active = harbourCode != null && !harbourCode.equals("INA");
- // FIXME-FD20100122 : INA a tester sur le code du métier : YOUPI ONE
+ String professionCode = ImportHelper.read(reader, ACTIVITY_CALENDAR.MET_COD);
+ boolean active = professionCode != null && !professionCode.equals("INA");
ActivityMonth month = calendar.getActivityMonth(monthNum);
@@ -258,6 +257,7 @@
Integer nbBoardingPersons = ImportHelper.readInteger(reader, ACTIVITY_CALENDAR.SYNA_NOMHE);
int harbourId = ImportHelper.readInt(reader, ACTIVITY_CALENDAR.SYNA_TPOR_COD);
+ String harbourCode = ImportHelper.read(reader, ACTIVITY_CALENDAR.SYNA_POR_COD);
String harbourLibelle = ImportHelper.read(reader, ACTIVITY_CALENDAR.SYNA_POR_LIB);
month.setHarbourId(harbourId);
@@ -274,7 +274,6 @@
// Can be equals to -1 if set to NA in Csv File (not a problem for ordering Profession)
int professionOrder = ImportHelper.readInt(reader, ACTIVITY_CALENDAR.META_ORDRE);
- String professionCode = ImportHelper.read(reader, ACTIVITY_CALENDAR.MET_COD);
int professionId = ImportHelper.readInt(reader, ACTIVITY_CALENDAR.MET_ID);
String professionLibelle = ImportHelper.read(reader, ACTIVITY_CALENDAR.MET_LIB);
@@ -334,6 +333,8 @@
transaction.commitTransaction();
availableCalendars.clear();
+ // Force garbage collector
+ System.gc();
tic2 = System.currentTimeMillis();
if (log.isDebugEnabled()) {
@@ -348,9 +349,6 @@
long stopTime = System.currentTimeMillis();
- // Force garbage collector
- System.gc();
-
String execTime = DurationFormatUtils.formatDurationHMS(stopTime - startTime);
info("Nombre de ligne ajouté : " + result, -1);
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceBoatImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -109,13 +109,8 @@
protected TopiaQuery<Boat> createQueryForBoatFilter(TopiaQuery<Boat> query, BoatFilter filter) {
String main = query.getMainAlias();
- query = filter.prepareQueryForBoat(query, main);
+ query = filter.prepareQueryForBoat(query, main).addDistinct();
-// boolean sampleRowCodeFiltered = !StringUtils.isEmpty(filter.getSampleRowCode());
-// boolean professionFiltered = filter.getProfession() != null;
-// boolean fishingZoneFiltered = filter.getFishingZone() != null;
-// boolean sampleRowFiltered = sampleRowCodeFiltered || professionFiltered || fishingZoneFiltered;
-
// Sampling filter
if (filter.isSamplingFiltered()) {
// Add join for ElligibleBoat
@@ -125,21 +120,13 @@
// Company
if (filter.getCompany() != null) {
- query.add("E." + ElligibleBoat.SAMPLE_ROW + "." + SampleRow.COMPANY, filter.getCompany());
+ //query.add("E." + ElligibleBoat.SAMPLE_ROW + "." + SampleRow.COMPANY, filter.getCompany());
// Test only valid ElligibleBoat for that company
query.add("E." + ElligibleBoat.COMPANY_ACTIVE + " = :booleanTrue " +
"OR (E." + ElligibleBoat.COMPANY_ACTIVE + " IS NULL AND E." + ElligibleBoat.GLOBAL_ACTIVE + " = :booleanTrue)");
query.addParam("booleanTrue", Boolean.TRUE);
}
}
-// // SampleRowCode
-// if (sampleRowCodeFiltered) {
-// query.add("E.sampleRow.code", filter.getSampleRowCode());
-// }
-// // Profession
-// if (professionFiltered) {
-// query.add("E.sampleRow.profession", filter.getProfession());
-// }
return query;
}
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceContactImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -100,7 +100,7 @@
ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction);
- TopiaQuery<Contact> query = dao.createQuery("C");
+ TopiaQuery<Contact> query = dao.createQuery("C").addDistinct();
query = filter.prepareQueryForContact(query);
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -30,6 +30,8 @@
import fr.ifremer.suiviobsmer.entity.FishingZoneDAO;
import fr.ifremer.suiviobsmer.entity.Profession;
import fr.ifremer.suiviobsmer.entity.ProfessionDAO;
+import fr.ifremer.suiviobsmer.entity.SampleRow;
+import fr.ifremer.suiviobsmer.entity.User;
import fr.ifremer.suiviobsmer.services.ServiceReferential;
import java.io.InputStream;
import java.nio.charset.Charset;
@@ -64,15 +66,23 @@
}
@Override
- public List<String> getFacades() throws SuiviObsmerException {
+ public List<String> getFacadesByUser(User user) throws SuiviObsmerException {
TopiaContext transaction = null;
List<String> results = new ArrayList<String>();
try {
transaction = rootContext.beginTransaction();
FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction);
- results = (List<String>)dao.createQuery().setSelect("DISTINCT " + FishingZone.FACADE_NAME).execute();
+ TopiaQuery<FishingZone> query = dao.createQuery("F");
+ if (!user.getAdmin()) {
+ query.addFrom(SampleRow.class.getName() + " S").
+ add("S IN elements(F." + FishingZone.SAMPLE_ROW + ")").
+ add("S." + SampleRow.COMPANY, user.getCompany());
+ }
+
+ results = (List<String>)query.setSelect("DISTINCT F." + FishingZone.FACADE_NAME).execute();
+
transaction.closeContext();
} catch (Exception eee) {
SuiviObsmerContext.serviceException(transaction, "Impossible de charger la liste des facades", eee);
@@ -81,20 +91,26 @@
}
@Override
- public List<String> getSectors(String facadeName) throws SuiviObsmerException {
+ public List<String> getSectorsByUser(User user, String facadeName) throws SuiviObsmerException {
TopiaContext transaction = null;
List<String> results = new ArrayList<String>();
try {
transaction = rootContext.beginTransaction();
FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction);
- TopiaQuery<FishingZone> query = dao.createQuery();
+ TopiaQuery<FishingZone> query = dao.createQuery("F");
+ if (!user.getAdmin()) {
+ query.addFrom(SampleRow.class.getName() + " S").
+ add("S IN elements(F." + FishingZone.SAMPLE_ROW + ")").
+ add("S." + SampleRow.COMPANY, user.getCompany());
+ }
+
if (!StringUtils.isEmpty(facadeName)) {
- query.add(FishingZone.FACADE_NAME, facadeName);
+ query.add("F." + FishingZone.FACADE_NAME, facadeName);
}
- results = (List<String>)query.setSelect("DISTINCT " + FishingZone.SECTOR_NAME).execute();
+ results = (List<String>)query.setSelect("DISTINCT F." + FishingZone.SECTOR_NAME).execute();
transaction.closeContext();
} catch (Exception eee) {
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSamplingImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -341,19 +341,23 @@
SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction);
- TopiaQuery<SampleRow> query = dao.createQuery("S");
+ TopiaQuery<SampleRow> query = dao.createQuery("S").addDistinct().addOrder("S." + SampleRow.CODE);
query = filter.prepareQueryForSampling(query, "S");
+ if (log.isDebugEnabled()) {
+ log.debug("Query : " + query);
+ }
+
// if (finished) {
// // Only rows which are not finished will be kept
// Date current = SuiviObsmerContext.getCurrentDate();
// query.add(SampleRow.PERIOD_END, Op.GE, current);
// }
- if (filter.getCompany() != null) {
- query.add("S." + SampleRow.COMPANY, filter.getCompany());
- }
+// if (filter.getCompany() != null) {
+// query.add("S." + SampleRow.COMPANY, filter.getCompany());
+// }
results = query.executeToEntityList();
@@ -683,21 +687,22 @@
protected void updateRow(TopiaContext transaction, SampleRow sampleRow, CsvReader reader)
throws IOException, TopiaException, ParseException {
- String fishingZoneInfos = reader.get(SAMPLING.PECHE_AUTRE.name()).trim();
- int nbObservants = Integer.parseInt(reader.get(SAMPLING.PLAN_NB_OBSERV.name()).trim());
- String averageStr = reader.get(SAMPLING.PLAN_DUREE_MOY.name()).trim();
+ String fishingZoneInfos = ImportHelper.read(reader, SAMPLING.PECHE_AUTRE);
+ int nbObservants = ImportHelper.readInt(reader, SAMPLING.PLAN_NB_OBSERV);
+ String averageStr = ImportHelper.read(reader, SAMPLING.PLAN_DUREE_MOY);
averageStr = averageStr.replaceAll(",", ".");
double averageTideTime = Double.parseDouble(averageStr);
- String programName = reader.get(SAMPLING.PROGRAMME_CODE.name()).trim();
+ String programName = ImportHelper.read(reader, SAMPLING.PROGRAMME_CODE);
+ String comment = ImportHelper.read(reader, SAMPLING.PLAN_COMMENT);
PeriodDates period = ImportHelper.readPeriod(reader, SAMPLING.PROGRAMME_DEBUT, SAMPLING.PROGRAMME_FIN);
- // Problem : not imported yet ??
sampleRow.setFishingZonesInfos(fishingZoneInfos);
sampleRow.setNbObservants(nbObservants);
sampleRow.setAverageTideTime(averageTideTime);
sampleRow.setProgramName(programName);
sampleRow.setPeriodBegin(period.getFromDate());
sampleRow.setPeriodEnd(period.getThruDate());
+ sampleRow.setComment(comment);
// 16 fixed columns : 13 before months and 3 after
final int nbFixedColumns = 16;
Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java
===================================================================
--- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -111,9 +111,9 @@
// }
// }
- if (filter.getCompany() != null) {
- query.add("M." + SampleMonth.SAMPLE_ROW + "." + SampleRow.COMPANY, filter.getCompany());
- }
+// if (filter.getCompany() != null) {
+// query.add("M." + SampleMonth.SAMPLE_ROW + "." + SampleRow.COMPANY, filter.getCompany());
+// }
if (log.isTraceEnabled()) {
log.trace("Exec query : " + query);
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java
===================================================================
--- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/impl/ServiceReferentialImplTest.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -25,6 +25,8 @@
import fr.ifremer.suiviobsmer.SuiviObsmerRunner;
import fr.ifremer.suiviobsmer.business.SuiviObsmerRunnerTest;
import fr.ifremer.suiviobsmer.entity.FishingZone;
+import fr.ifremer.suiviobsmer.entity.User;
+import fr.ifremer.suiviobsmer.entity.UserImpl;
import java.io.InputStream;
import java.util.List;
import org.junit.After;
@@ -80,8 +82,10 @@
InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv");
service.importFishingZoneCsv(input);
+ User user = new UserImpl();
+ user.setAdmin(true);
- List<String> facades = service.getFacades();
+ List<String> facades = service.getFacadesByUser(user);
assertEquals(3, facades.size());
assertTrue(facades.contains("Atlantique"));
assertTrue(facades.contains("Mer du Nord"));
@@ -94,8 +98,10 @@
InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv");
service.importFishingZoneCsv(input);
+ User user = new UserImpl();
+ user.setAdmin(true);
- List<String> sectors = service.getSectors(null);
+ List<String> sectors = service.getSectorsByUser(user, null);
assertEquals(5, sectors.size());
assertTrue(sectors.contains("Manche"));
assertTrue(sectors.contains("Mer du Nord"));
@@ -103,7 +109,7 @@
assertTrue(sectors.contains("Golfe de Gascogne"));
assertTrue(sectors.contains("Méditerranée"));
- sectors = service.getSectors("Atlantique");
+ sectors = service.getSectorsByUser(user, "Atlantique");
assertEquals(2, sectors.size());
assertTrue(sectors.contains("Manche Ouest"));
assertTrue(sectors.contains("Golfe de Gascogne"));
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -34,11 +34,9 @@
import java.util.List;
import org.apache.tapestry5.OptionModel;
import org.apache.tapestry5.SelectModel;
-import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.internal.OptionModelImpl;
import org.apache.tapestry5.internal.SelectModelImpl;
import org.apache.tapestry5.ioc.annotations.Inject;
@@ -134,17 +132,6 @@
*/
protected void initSelectFilters(boolean companySelect, boolean observerSelect) throws SuiviObsmerException {
- if (log.isDebugEnabled()) {
- log.debug("Filters : " + getFilter());
- }
-
- facadeSelectModel = null;
- getFacadeSelectModel();
- sectorSelectModel = null;
- getSectorSelectModel();
- sampleRowSelectModel = null;
- getSampleRowSelectModel();
-
if (getFilter().getSampleRow() != null) {
if (log.isDebugEnabled()) {
log.debug("SampleRow filtered : " + getFilter().getSampleRow());
@@ -173,15 +160,34 @@
observerId = getFilter().getObserver().getTopiaId();
}
}
+
+ resetFacadeSelect();
+ resetSectorSelect();
+ resetSampleRowSelect();
}
+ protected void resetFacadeSelect() throws SuiviObsmerException {
+ facadeSelectModel = null;
+ getFacadeSelectModel();
+ }
+
+ protected void resetSectorSelect() throws SuiviObsmerException {
+ sectorSelectModel = null;
+ getSectorSelectModel();
+ }
+
+ protected void resetSampleRowSelect() throws SuiviObsmerException {
+ sampleRowSelectModel = null;
+ getSampleRowSelectModel();
+ }
+
public SelectModel getFacadeSelectModel() throws SuiviObsmerException {
if (facadeSelectModel == null) {
if (log.isInfoEnabled()) {
log.info("BUSINESS REQUEST [getFacades]");
}
List<OptionModel> options = new ArrayList<OptionModel>();
- for (String facadeName : serviceReferential.getFacades()) {
+ for (String facadeName : serviceReferential.getFacadesByUser(user)) {
options.add(new OptionModelImpl(facadeName,facadeName));
}
facadeSelectModel = new SelectModelImpl(null, options);
@@ -195,7 +201,7 @@
log.info("BUSINESS REQUEST [getSectors]");
}
List<OptionModel> options = new ArrayList<OptionModel>();
- for (String sectorName : serviceReferential.getSectors(getFilter().getFacadeName())) {
+ for (String sectorName : serviceReferential.getSectorsByUser(user, getFilter().getFacadeName())) {
options.add(new OptionModelImpl(sectorName,sectorName));
}
sectorSelectModel = new SelectModelImpl(null, options);
@@ -259,7 +265,7 @@
/**
* Used to show only active company and observers.
*
- * @return true if only active users will be showed, false either
+ * @return true if only active users will be showed, false otherwise
*/
protected abstract boolean getAvailableDataForFiltersOnly();
@@ -314,10 +320,39 @@
if (user.getAdmin()) {
Company company = getCompanySelectModel().findObject(companyId);
getFilter().setCompany(company);
+ } else {
+ getFilter().setCompany(user.getCompany());
}
User observer = getObserverSelectModel().findObject(observerId);
getFilter().setObserver(observer);
}
+
+ private boolean edited;
+
+ public void onSelectedFromRefreshByFacade() throws SuiviObsmerException {
+ getFilter().setSectorName(null);
+ onSelectedFromRefreshBySector();
+ resetSectorSelect();
+ }
+
+ public void onSelectedFromRefreshBySector() throws SuiviObsmerException {
+ onSelectedFromSearch();
+ getFilter().setSampleRow(null);
+ resetSampleRowSelect();
+ edited = true;
+ }
+
+ public void onSelectedFromRefreshByCompany() throws SuiviObsmerException {
+ onSelectedFromSearch();
+ getFilter().setObserver(null);
+ observerSelectModel = null;
+ getObserverSelectModel();
+ edited = true;
+ }
+
+ protected boolean isEdited() {
+ return edited;
+ }
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -56,8 +56,8 @@
if (nbRows < 0) {
try {
nbRows = count();
- if (log.isDebugEnabled()) {
- log.debug("Count : " + nbRows);
+ if (log.isTraceEnabled()) {
+ log.trace("Count : " + nbRows);
}
} catch (SuiviObsmerException eee) {
throw new TapestryException("", eee);
@@ -68,8 +68,8 @@
@Override
public void prepare(int startIndex, int endIndex, List<SortConstraint> sortConstraints) {
- if (log.isDebugEnabled()) {
- log.debug("Prepare results : " + startIndex + ", " + endIndex);
+ if (log.isTraceEnabled()) {
+ log.trace("Prepare results : " + startIndex + ", " + endIndex);
}
nbRowsPerPage = endIndex - startIndex + 1;
try {
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -156,6 +156,14 @@
return result-1;
}
+ /** Hack for pagelink to Boats page
+ *
+ * @return null
+ */
+ public String getNorow() {
+ return null;
+ }
+
// public boolean hasZones() {
// return getZoneIndexMax() != -1;
// }
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -31,14 +31,12 @@
import fr.ifremer.suiviobsmer.entity.Company;
import fr.ifremer.suiviobsmer.entity.Contact;
import fr.ifremer.suiviobsmer.entity.ElligibleBoat;
-import fr.ifremer.suiviobsmer.entity.FishingZone;
import fr.ifremer.suiviobsmer.entity.Profession;
import fr.ifremer.suiviobsmer.entity.SampleRow;
import fr.ifremer.suiviobsmer.entity.User;
import fr.ifremer.suiviobsmer.services.ServiceBoat;
import fr.ifremer.suiviobsmer.services.ServiceReferential;
import fr.ifremer.suiviobsmer.services.ServiceSampling;
-import fr.ifremer.suiviobsmer.services.ServiceUser;
import fr.ifremer.suiviobsmer.ui.base.AbstractFilteredPage;
import fr.ifremer.suiviobsmer.ui.data.BusinessUtils;
import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel;
@@ -68,7 +66,6 @@
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
-import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.services.PropertyAccess;
@@ -120,6 +117,10 @@
@Property
private String sampleRowContextId;
+ /** Selected boat immatriculation for showing boatInfos */
+ @Property
+ private Integer boatSelectedImmatriculation;
+
@InjectComponent
private FeedBack filterFeedback;
@@ -142,21 +143,22 @@
// Initialize filters using AbstractFilteredPage superclass
initSelectFilters(true, false);
- // Only rows which are not finished nearly one month
- getFilter().setNbMonthFinishedFromToday(-1);
companyBoatInfos = null;
- boatSelectedImmatriculation = null;
+ //boatSelectedImmatriculation = null;
}
void onActivate(EventContext ec) {
if (ec.getCount() > 0) {
sampleRowContextId = ec.get(String.class, 0);
+ if (ec.getCount() > 1) {
+ boatSelectedImmatriculation = ec.get(Integer.class, 1);
+ }
}
}
- String onPassivate() {
- return sampleRowContextId;
+ Object[] onPassivate() {
+ return new Object[] { sampleRowContextId, boatSelectedImmatriculation };
}
/**************************** Import Forms ********************************/
@@ -277,7 +279,12 @@
@Override
public BoatFilter getFilter() throws SuiviObsmerException {
if (boatFilter == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Create filter");
+ }
boatFilter = new BoatFilterImpl();
+ // Only rows which are not finished nearly one month
+ boatFilter.setNbMonthFinishedFromToday(-1);
}
return boatFilter;
}
@@ -374,15 +381,20 @@
/**
* EVENT_SUCCESS :: for filtersForm. Reset persitant data to have new data using filters selected.
*
+ * @return the filtersZone if it's a refresh data for select, or the page otherwise
* @throws SuiviObsmerException for business errors
*/
- void onSuccessFromFiltersForm() throws SuiviObsmerException {
+ Object onSuccessFromFiltersForm() throws SuiviObsmerException {
+ if (isEdited()) {
+ return filtersZone.getBody();
+ }
// Suppress persistant boats list to get new one with filter
boats = null;
// Suppress persistant immatriculation for boat selected
boatSelectedImmatriculation = null;
// Suppress persistant boat informations for boat selected
companyBoatInfos = null;
+ return this;
}
/**************************** Boats List *****************************************/
@@ -392,9 +404,9 @@
private BoatDataSource boats;
/** Selected boat immatriculation for showing boatInfos */
- @Property
- @Persist
- private Integer boatSelectedImmatriculation;
+// @Property
+// @Persist
+// private Integer boatSelectedImmatriculation;
/** Current boat in the Grid */
@Property
@@ -477,7 +489,7 @@
private ElligibleBoat elligibleBoat;
@Property
- private String boatInfosSampleRowCode;
+ private String boatInfosSampleRowId;
private boolean boatInfosEditable;
@@ -603,8 +615,13 @@
return boatInfosZone.getBody();
}
- Block onActionFromEditBoatInfos() {
+ Block onActionFromEditBoatInfos() throws SuiviObsmerException {
boatInfosEditable = true;
+ // WARNING :: Reset sampleRow select for edition mode, no limit for
+ // showing sampleRows instead of filters
+ getFilter().setNbMonthFinishedFromToday(null);
+ resetSampleRowSelect();
+ getFilter().setNbMonthFinishedFromToday(-1);
return boatInfosZone.getBody();
}
@@ -625,8 +642,8 @@
void onSelectedFromAddBoatInfosSampleRow() throws SuiviObsmerException {
// We stay in edition mode
boatInfosEditable = true;
- if (!StringUtils.isEmpty(boatInfosSampleRowCode)) {
- SampleRow row = getSampleRowSelectModel().findObject(boatInfosSampleRowCode);
+ if (StringUtils.isNotEmpty(boatInfosSampleRowId)) {
+ SampleRow row = getSampleRowSelectModel().findObject(boatInfosSampleRowId);
companyBoatInfos.setNewElligibleBoat(row);
}
}
@@ -671,7 +688,8 @@
// Get selected boat from BoatInfos
boat = getBoatInfos().getBoat();
// Get sampleRow from elligibleBoat list
- sampleRow = getSampleRowSelectModel().findObject(sampleRowCode);
+ ElligibleBoat elligible = getCompanyBoatInfos().getElligibleBoat(sampleRowCode);
+ sampleRow = elligible.getSampleRow();
contacts.createNewContact(boat, sampleRow);
return contacts;
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -49,7 +49,6 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.tapestry5.ComponentResources;
@@ -70,6 +69,7 @@
import org.apache.tapestry5.services.BeanModelSource;
import org.apache.tapestry5.services.Response;
import org.apache.tapestry5.upload.services.UploadedFile;
+import org.nuiton.util.DateUtils;
import org.slf4j.Logger;
/**
@@ -150,9 +150,15 @@
private boolean reset;
+ @Property
+ private ContactState stateFilter;
+
public ContactFilter getContactFilter() throws SuiviObsmerException {
if (contactFilter == null) {
contactFilter = new ContactFilterImpl();
+ // Initialized to 12 months before the current day
+ Date fromDate = DateUtils.createDateAfterToday(0, -12, 0);
+ contactFilter.setFromDate(fromDate);
}
return contactFilter;
}
@@ -162,25 +168,11 @@
return getContactFilter();
}
-// @Override
-// protected Zone getSampleRowFilterZone() {
-// return filtersZone;
-// }
-//
-// @Override
-// protected Zone getObserverFilterZone() {
-// return filtersZone;
-// }
-
@Override
protected boolean getAvailableDataForFiltersOnly() {
return true;
}
- void onSuccessFromSearchBoat() {
-
- }
-
Object onActionFromShowFilters() {
contactFilter = null;
return filtersZone.getBody();
@@ -195,13 +187,14 @@
}
@Log
- void onSuccessFromFiltersForm() throws SuiviObsmerException {
+ Object onSuccessFromFiltersForm() throws SuiviObsmerException {
+ if (isEdited()) {
+ return filtersZone.getBody();
+ }
if (reset) {
contactFilter = null;
- filtersVisible = false;
- } else {
- filtersVisible = true;
}
+ return this;
}
/**************************** CONTACT IMPORT/EXPORT ***********************/
@@ -264,8 +257,8 @@
private ContactModelFactory contactModelFactory;
@Persist
-// private ContactDataSource contacts;
- private Map<String, Contact> contacts;
+ private ContactDataSource contacts;
+// private Map<String, Contact> contacts;
@Property
private Contact contact;
@@ -285,26 +278,26 @@
private boolean even = true;
-// public ContactDataSource getContacts() throws SuiviObsmerException {
-// if (contacts == null) {
-// if (log.isInfoEnabled()) {
-// log.info("Create DataSource");
-// }
-// contacts = new ContactDataSource(getContactFilter(), serviceContact);
-// }
-// return contacts;
-// }
-
- public Map<String, Contact> getContacts() throws SuiviObsmerException {
+ public ContactDataSource getContacts() throws SuiviObsmerException {
if (contacts == null) {
if (log.isInfoEnabled()) {
- log.info("BUSINESS REQUEST [getContactsByFilter]");
+ log.info("Create DataSource");
}
- contacts = serviceContact.getContactsByFilter(getContactFilter());
+ contacts = new ContactDataSource(getContactFilter(), serviceContact);
}
return contacts;
}
+// public Map<String, Contact> getContacts() throws SuiviObsmerException {
+// if (contacts == null) {
+// if (log.isInfoEnabled()) {
+// log.info("BUSINESS REQUEST [getContactsByFilter]");
+// }
+// contacts = serviceContact.getContactsByFilter(getContactFilter());
+// }
+// return contacts;
+// }
+
public BeanModel<Contact> getContactModel() {
if (contactModel == null) {
contactModel = user.getAdmin() ?
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -87,11 +87,8 @@
private BoatFilter dataSamplingFilter;
@InjectComponent
- private Zone sampleRowZone;
+ private Zone filtersZone;
- @InjectComponent
- private Zone observerZone;
-
@Persist
private ChartType dataSamplingChartType;
@@ -113,16 +110,6 @@
return dataSamplingFilter;
}
-// @Override
-// protected Zone getSampleRowFilterZone() {
-// return sampleRowZone;
-// }
-//
-// @Override
-// protected Zone getObserverFilterZone() {
-// return observerZone;
-// }
-
@Override
protected boolean getAvailableDataForFiltersOnly() {
return false;
@@ -167,10 +154,14 @@
reset = true;
}
- void onSuccessFromFiltersForm() {
+ Object onSuccessFromFiltersForm() {
+ if (isEdited()) {
+ return filtersZone.getBody();
+ }
if (reset) {
dataSamplingFilter = null;
}
+ return this;
}
}
Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java
===================================================================
--- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java 2010-01-23 17:59:23 UTC (rev 262)
@@ -55,8 +55,10 @@
// New properties for contactModel
contactModel.add("createdBy", null);
- contactModel.add(Contact.SAMPLE_ROW, getSampleRowPropertyConduit());
- contactModel.add(Contact.BOAT, getBoatPropertyConduit());
+// contactModel.add(Contact.SAMPLE_ROW, getSampleRowPropertyConduit());
+// contactModel.add(Contact.BOAT, getBoatPropertyConduit());
+ contactModel.add(Contact.SAMPLE_ROW, null);
+ contactModel.add(Contact.BOAT, null);
contactModel.add("mammals", null);
contactModel.add("validation", null);
contactModel.add("actions", null);
@@ -75,6 +77,14 @@
Contact.COMMENT,
"validation",
"actions");
+
+ contactModel.get(TopiaEntity.TOPIA_CREATE_DATE).sortable(false);
+ contactModel.get(Contact.STATE).sortable(false);
+ contactModel.get(Contact.TIDE_BEGIN_DATE).sortable(false);
+ contactModel.get(Contact.TIDE_END_DATE).sortable(false);
+ contactModel.get(Contact.NB_OBSERVANTS).sortable(false);
+ contactModel.get(Contact.DATA_INPUT_DATE).sortable(false);
+ contactModel.get(Contact.COMMENT).sortable(false);
return contactModel;
}
@@ -93,6 +103,30 @@
contactModel.add(RelativePosition.AFTER, "fishingZoneSector", "fishingZoneDivision", getFishingZoneDivisionPropertyConduit());
contactModel.add(RelativePosition.AFTER, Contact.BOAT, "boatImmatriculation", getBoatImmatriculationPropertyConduit());
contactModel.add(RelativePosition.AFTER, "boatImmatriculation", "boatDistrictCode", getBoatDistrictCodePropertyConduit());
+
+ contactModel.get("observer").sortable(false);
+ contactModel.get(User.COMPANY).sortable(false);
+ contactModel.get("program").sortable(false);
+ contactModel.get("professionCode").sortable(false);
+ contactModel.get("professionLibelle").sortable(false);
+ contactModel.get("professionSpecies").sortable(false);
+ contactModel.get("fishingZoneFacade").sortable(false);
+ contactModel.get("fishingZoneSector").sortable(false);
+ contactModel.get("fishingZoneDivision").sortable(false);
+ contactModel.get("boatImmatriculation").sortable(false);
+ contactModel.get("boatDistrictCode").sortable(false);
+
+// contactModel.add(RelativePosition.AFTER, TopiaEntity.TOPIA_CREATE_DATE, "observer", null);
+// contactModel.add(RelativePosition.AFTER, "observer", User.COMPANY, null);
+// contactModel.add(RelativePosition.AFTER, Contact.SAMPLE_ROW, "program", null);
+// contactModel.add(RelativePosition.AFTER, "program", "professionCode", null);
+// contactModel.add(RelativePosition.AFTER, "professionCode", "professionLibelle", null);
+// contactModel.add(RelativePosition.AFTER, "professionLibelle", "professionSpecies", null);
+// contactModel.add(RelativePosition.AFTER, "professionSpecies", "fishingZoneFacade", null);
+// contactModel.add(RelativePosition.AFTER, "fishingZoneFacade", "fishingZoneSector", null);
+// contactModel.add(RelativePosition.AFTER, "fishingZoneSector", "fishingZoneDivision", null);
+// contactModel.add(RelativePosition.AFTER, Contact.BOAT, "boatImmatriculation", null);
+// contactModel.add(RelativePosition.AFTER, "boatImmatriculation", "boatDistrictCode", null);
return contactModel;
}
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Boats.properties 2010-01-23 17:59:23 UTC (rev 262)
@@ -2,8 +2,9 @@
activityCalendarsCsvFile-label: Fichier CSV des calendriers d'activit\u00E9
# FILTERS
-sampleRow-label: Ligne du plan
+sampleRow-label: M\u00E9tier
facadeName-label: Fa\u00E7ade
+sectorName-label: Zone
profession-label: M\u00E9tier du plan
boatName-label: Navire
districtCode-label: Quartier
Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties
===================================================================
--- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties 2010-01-23 17:59:23 UTC (rev 262)
@@ -3,6 +3,7 @@
sectorName-label: Secteur
observer-label: Observateur
contactsCsvFile-label: Fichier des contacts
+fromDate-label: Depuis le
# Grid labels
createdBy-label: Observateur
Modified: trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/BoatActivityCalendar.tml 2010-01-23 17:59:23 UTC (rev 262)
@@ -4,6 +4,13 @@
<t:if t:test="activityCalendar">
<h1>Calendrier d'activité ${activityCalendar.year}</h1>
+ <p class="acenter">
+ <a t:type="pagelink" class="return" t:context="[norow,activityCalendar.boat.immatriculation]" t:page="boats" title="Revenir sur les informations du navire">
+ <img src="${asset:context:}/img/boat.png" alt="Navire"/>
+ Retour sur ${activityCalendar.boat.name}
+ <img src="${asset:context:}/img/boat.png" alt="Navire"/>
+ </a>
+ </p>
<table t:type="grid" id="so-activity-calendar-boat" t:source="boats" t:row="boat"
t:include="immatriculation, districtCode, name, boatLength, buildYear" />
Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2010-01-23 17:59:23 UTC (rev 262)
@@ -65,35 +65,32 @@
</div>
<t:feedback t:id="filterFeedback" />
<div class="so-filters-form ${hiddenStyle}">
- <form t:type="form" t:id="filtersForm">
+ <form t:type="form" t:id="filtersForm" t:zone="so-boats-filters">
<t:errors />
<div class="t-beaneditor">
- <t:beaneditor t:id="filtersEditor" t:object="filter"
- t:include="boatName" t:add="facade, sampleRow, profession" t:reorder="facade, sampleRow, profession, boatName">
- <p:facade>
- <t:label t:for="facadeName" />
- <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" />
- <span> zone </span>
- <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
- </p:facade>
- <p:sampleRow>
- <t:label t:for="sampleRow" />
- <select t:type="select" t:id="sampleRow" t:disabled="sampleRowExists" t:model="sampleRowSelectModel" value="sampleRowId" />
- </p:sampleRow>
- <p:profession>
- <t:label t:for="profession" />
- <select t:type="select" t:id="profession" t:disabled="sampleRowExists" t:model="professionSelectModel" value="professionId" />
- </p:profession>
- <p:boatName>
- <t:label t:for="boatName" />
- <span> nom </span>
- <input t:type="textfield" t:id="boatName" class="width150" t:value="filter.boatName" t:mixins="Autocomplete" />
- <span> immatriculation </span>
- <input t:type="textfield" t:id="boatImmatriculation" class="width50" t:value="filter.boatImmatriculation" />
- <span> code quartier </span>
- <input t:type="textfield" t:id="boatDistrictCode" class="width50" t:value="filter.boatDistrictCode" />
- </p:boatName>
- </t:beaneditor>
+ <div>
+ <!-- Sampling filter -->
+ <t:label t:for="facadeName" />:
+ <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh"
+ title="Rafraîchir les zones et les métiers en fonction de la façade sélectionnée"/>
+ <t:label t:for="sectorName" />:
+ <select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
+ title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
+ <t:label t:for="sampleRow" />:
+ <select t:type="select" t:id="sampleRow" t:disabled="sampleRowExists" t:model="sampleRowSelectModel" value="sampleRowId" />
+ </div><p> </p>
+ <div>
+ <!-- Boat filter -->
+ <t:label t:for="boatName" />
+ <span> nom </span>
+ <input t:type="textfield" t:id="boatName" class="width150" t:value="filter.boatName" t:mixins="Autocomplete" />
+ <span> immatriculation </span>
+ <input t:type="textfield" t:id="boatImmatriculation" class="width50" t:value="filter.boatImmatriculation" />
+ <span> code quartier </span>
+ <input t:type="textfield" t:id="boatDistrictCode" class="width50" t:value="filter.boatDistrictCode" />
+ </div>
<div class="t-beaneditor-row aright">
<input t:type="submit" class="ico search-32px" t:id="search" value="Search" />
<input t:type="submit" class="ico undo" t:id="reset" value="Reset" />
@@ -347,7 +344,7 @@
</ul>
<p>
<input t:type="select" t:id="sampleRowSelect" t:model="sampleRowSelectModel"
- t:value="boatInfosSampleRowCode"/>
+ t:value="boatInfosSampleRowId"/>
<input t:type="submit" t:id="addBoatInfosSampleRow" class="ico add" value="Add"
t:title="Associer à une ligne du plan" />
</p>
@@ -361,9 +358,4 @@
</t:if>
</div>
- <!-- Script for filters change -->
- <script type="text/javascript">
- Event.observe('facadeName', 'change', function() { $('filtersForm').submit(); } );
- Event.observe('sectorName', 'change', function() { $('filtersForm').submit(); } );
- </script>
</t:layout>
Modified: trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-23 17:59:23 UTC (rev 262)
@@ -23,21 +23,28 @@
<fieldset>
<legend>Recherche avancée</legend>
<div class="so-filters-form">
- <form t:type="form" t:id="filtersForm">
+ <form t:type="form" t:id="filtersForm" t:zone="so-contacts-filters">
<t:errors />
<div class="t-beaneditor">
<div>
+ <!-- Boat filter -->
<label>Navire </label>
<t:label t:for="boatImmatriculation" />:
<input t:type="textfield" t:id="boatImmatriculation" class="width50" t:value="contactFilter.boatImmatriculation" />
<t:label t:for="boatDistrictCode" />:
<input t:type="textfield" t:id="boatDistrictCode" class="width50" t:value="contactFilter.boatDistrictCode" />
+ <!-- Sampling filter -->
<t:label t:for="facadeName" />:
<select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="contactFilter.facadeName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh"
+ title="Rafraîchir les zones et les métiers en fonction de la façade sélectionnée"/>
<t:label t:for="sectorName" />:
<select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="contactFilter.sectorName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
+ title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
<t:label t:for="sampleRow" />:
<input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
+ <!-- Contact filter -->
<label>Mammifères: </label>
<input t:type="checkbox" t:id="mammalsObservation1" value="contactFilter.mammalsObservation" />
<t:label t:for="mammalsObservation1">
@@ -49,12 +56,20 @@
</t:label>
</div><p> </p>
<div>
+ <t:label t:for="fromDate" />:
+ <input t:type="datefield" class="width70" t:id="fromDate" value="contactFilter.fromDate" />
<t:if t:test="user.admin">
<t:label t:for="company" />:
<input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByCompany" value="Refresh"
+ title="Rafraîchir les observateurs en fonction de la société sélectionnée"/>
</t:if>
<t:label t:for="observer" />:
- <input t:type="select" t:id="observer" t:model="observerSelectModel" value="observerId" />
+ <select t:type="select" t:id="observer" t:model="observerSelectModel" value="observerId" />
+ </div><p> </p>
+ <div>
+ <t:label t:for="state" />:
+ <select t:type="select" t:id="state" value="contactFilter.state"/>
<label>Validation société: </label>
<input t:type="checkbox" t:id="companyAccepted" value="contactFilter.companyAccepted" />
<t:label t:for="companyAccepted">
@@ -112,7 +127,7 @@
<t:zone t:id="gridZone" t:update="show">
<form t:type="form" t:id="contactsForm" t:zone="gridZone">
<t:errors id="so-contact-form-errors" t:banner="message:contactsForm-errors-banner"/>
- <div t:type="grid" t:source="contacts.values()" t:row="contact" class="t-data-grid ${gridClass}" t:model="contactModel" t:rowClass="prop:rowClass"
+ <div t:type="grid" t:source="contacts" t:row="contact" class="t-data-grid ${gridClass}" t:model="contactModel" t:rowClass="prop:rowClass"
t:rowsPerPage="20">
<p:createdByCell>
<t:if t:test="editionMode">
@@ -215,7 +230,7 @@
<img src="${asset:context:}/img/comment-22px.png" alt="Add comment" />
</a>
</span>
- <textarea t:type="textarea" t:id="comment" class="hidden-textarea" cols="0" rows="0" value="contact.comment" />
+ <textarea t:type="textarea" t:id="comment" class="hidden" value="contact.comment" />
<div t:type="ck/Window" t:id="windowComment" show="false" modal="true"
title="literal:Ajouter un commentaire" width="488" height="210">
@@ -279,14 +294,5 @@
</div>
</form>
</t:zone>
-<script type="text/javascript">
- Event.observe('facadeName', 'change', function() { $('filtersForm').submit(); } );
- Event.observe('sectorName', 'change', function() { $('filtersForm').submit(); } );
-</script>
-<t:if t:test="user.admin">
- <script type="text/javascript">
- Event.observe('company', 'change', function() { $('filtersForm').submit(); } );
- </script>
- </t:if>
</t:layout>
Modified: trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/Synthesis.tml 2010-01-23 17:59:23 UTC (rev 262)
@@ -46,9 +46,9 @@
<div class="acenter" id="so-datasampling">
<fieldset>
<legend>Filtres</legend>
- <div class="so-filters-form">
+ <div t:type="zone" t:id="filtersZone" class="so-filters-form" id="so-datasampling-filters" t:update="show">
<!--<div t:type="zone" t:id="dataSamplingFiltersZone" t:update="show" id="so-datasampling-filters">-->
- <form t:type="form" t:id="filtersForm">
+ <form t:type="form" t:id="filtersForm" t:zone="so-datasampling-filters">
<t:errors />
<div class="t-beaneditor">
<div class="filterRow">
@@ -60,33 +60,25 @@
</div>
<div class="filterRow" t:type="zone" t:id="sampleRowZone" t:update="show">
<t:label t:for="facadeName" />:
- <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName"
- />
+ <select t:type="select" t:id="facadeName" t:model="facadeSelectModel" value="filter.facadeName" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshByFacade" value="Refresh"
+ title="Rafraîchir les zones et les métiers en fonction de la façade sélectionnée"/>
<t:label t:for="sectorName" />:
<select t:type="select" t:id="sectorName" t:model="sectorSelectModel" value="filter.sectorName" />
- <t:label t:for="sampleRow" />:
- <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
+ <input t:type="submit" class="ico22px refresh" t:id="refreshBySector" value="Refresh"
+ title="Rafraîchir les métiers en fonction de la zone sélectionnée"/>
+
<!--<t:label t:for="program" />:
<input t:type="select" t:id="program" t:model="programSelectModel" value="programId" />-->
</div>
-<!-- <div class="filterRow">
- <label>Navire: </label>
- <t:label t:for="boatName" />:
- <input t:type="textfield" t:id="boatName" t:value="filter.boatName" t:mixins="Autocomplete" />
- <t:label t:for="boatImmatriculation" />:
- <input t:type="textfield" t:id="boatImmatriculation" class="width50" t:value="filter.boatImmatriculation" />
- <t:label t:for="boatDistrictCode" />:
- <input t:type="textfield" t:id="boatDistrictCode" class="width50" t:value="filter.boatDistrictCode" />
- </div>-->
- <t:if t:test="user.admin">
- <div t:type="zone" t:id="observerZone" t:update="show">
- <!--<t:label t:for="observer" />:
- <input t:type="select" t:id="observer" t:model="observerSelectModel" value="observerId" />-->
-
- <t:label t:for="company" />:
+ <div>
+ <t:label t:for="sampleRow" />:
+ <input t:type="select" t:id="sampleRow" t:model="sampleRowSelectModel" value="sampleRowId" />
+ <t:if t:test="user.admin">
+ <t:label t:for="company" />:
<input t:type="select" t:id="company" t:model="companySelectModel" value="companyId"/>
- </div>
- </t:if>
+ </t:if>
+ </div>
<div class="t-beaneditor-row aright">
<input t:type="submit" class="ico search-32px" t:id="search" value="Search" />
<input t:type="submit" class="ico undo" t:id="reset" value="Reset" />
@@ -109,8 +101,4 @@
</p>
<t:chart t:width="600" t:height="400" t:chart="dataSamplingChart" />
</div>
-<script type="text/javascript">
- Event.observe('facadeName', 'change', function() { $('filtersForm').submit(); } );
- Event.observe('sectorName', 'change', function() { $('filtersForm').submit(); } );
-</script>
</t:layout>
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/boats.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/boats.css 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/boats.css 2010-01-23 17:59:23 UTC (rev 262)
@@ -19,6 +19,10 @@
width: 60%;
}
+div#so-boats-filters {
+ width: 70%;
+}
+
/*div.so-filters {
width: 60%;
margin-left: auto;
@@ -197,4 +201,15 @@
table#so-activity-calendar-months tr.profession {
background-color: silver;
+}
+
+div#so-activity-calendar a.return {
+ text-decoration: none;
+ color: #19a28d;
+ font-weight: bold;
+}
+
+div#so-activity-calendar a.return:hover {
+ text-decoration: underline;
+ color: black;
}
\ No newline at end of file
Modified: trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css
===================================================================
--- trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css 2010-01-22 18:48:46 UTC (rev 261)
+++ trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css 2010-01-23 17:59:23 UTC (rev 262)
@@ -168,9 +168,3 @@
input.nbObservants {
width: 18px;
}
-
-textarea.hidden-textarea {
- border: 0;
- width: 0;
- height: 0;
-}
1
0
[Suiviobsmer-commits] r261 - trunk/suiviobsmer-business/src/main/xmi
by fdesbois@users.labs.libre-entreprise.org 22 Jan '10
by fdesbois@users.labs.libre-entreprise.org 22 Jan '10
22 Jan '10
Author: fdesbois
Date: 2010-01-22 18:48:46 +0000 (Fri, 22 Jan 2010)
New Revision: 261
Modified:
trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
Log:
- Problem with filters Ano #2033 and #2042
- Ano #2034 : Bad calcul for realTides
Modified: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo
===================================================================
(Binary files differ)
1
0