[Suiviobsmer-commits] r149 - in trunk/suiviobsmer-ui/src/main: java/fr/ifremer/suiviobsmer/ui/components java/fr/ifremer/suiviobsmer/ui/pages webapp webapp/css webapp/img
Author: fdesbois Date: 2009-12-23 11:05:36 +0000 (Wed, 23 Dec 2009) New Revision: 149 Added: trunk/suiviobsmer-ui/src/main/webapp/img/accept-unavailable-22px.png trunk/suiviobsmer-ui/src/main/webapp/img/delete-unavailable-22px.png trunk/suiviobsmer-ui/src/main/webapp/img/edit-unavailable-22px.png trunk/suiviobsmer-ui/src/main/webapp/img/refuse-unavailable-22px.png Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.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/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/sampling.css Log: - Add icons for unavailable actions - Add some style for SampleRowForm for display parts - Resolve issue on contact form (fields were not keeped after errors) Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java 2009-12-23 11:05:36 UTC (rev 149) @@ -18,165 +18,164 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * ##%* */ - -package fr.ifremer.suiviobsmer.ui.components; - -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.entity.User; -import fr.ifremer.suiviobsmer.services.ServiceUser; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; -import fr.ifremer.suiviobsmer.ui.pages.Index; -import org.apache.tapestry5.BindingConstants; -import org.apache.tapestry5.annotations.InjectComponent; -import org.apache.tapestry5.annotations.InjectContainer; -import org.apache.tapestry5.annotations.Log; -import org.apache.tapestry5.annotations.Parameter; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.SessionState; -import org.apache.tapestry5.ioc.annotations.Inject; -import org.apache.tapestry5.services.Request; -import org.slf4j.Logger; - -/** - * Layout - * - * Created: 9 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class Layout { - - @Inject - private Logger log; - - @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) - private String pageTitle; - - @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) - private String contentId; - - /** - * Objet de session représentant l'utilisateur identifié - */ - @SessionState - private User currentUser; - - /** - * vrai si l'utilisateur s'est identifié, faux sinon - */ - @SuppressWarnings("unused") - @Property - private boolean currentUserExists; - - @InjectComponent - private FeedBack connexionFeedback; - - @InjectComponent - private FeedBack contentFeedback; - - @InjectContainer - private SuiviObsmerPage page; - - @Inject - private ServiceUser serviceUser; - - @Inject - private Request request; - - void setupRender() { - if(currentUserExists && !canShowPage()) { - contentFeedback.addError("Vous n'êtes pas autorisé à accéder à cette page !"); - } - } - - public String getContextPath() { - return request.getContextPath(); - } - - /** - * User for connexion form data - */ - @Property - private String login; - - @Property - private String password; - - public String getPageTitle() { - return this.pageTitle; - } - - public String getContentId() { - return this.contentId; - } - - public void setCurrentUser(User user) { - this.currentUser = user; - } - - public User getCurrentUser() { - return this.currentUser; - } - - public FeedBack getFeedBack() { - return this.contentFeedback; - } - - public String getAdminClass() { - return this.currentUser.getAdmin() ? " admin" : ""; - } - - public String getSamplingSelected() { - return this.contentId.equals("so-sampling") ? "selected" : ""; - } - - public String getBoatsSelected() { - return this.contentId.equals("so-boats") ? "selected" : ""; - } - - public String getContactsSelected() { - return this.contentId.equals("so-contacts") ? "selected" : ""; - } - - public String getSynthesisSelected() { - return this.contentId.equals("so-synthesis") ? "selected" : ""; - } - - public String getAdminSelected() { - return this.contentId.equals("so-admin") ? "selected" : ""; - } - - @Log - public boolean canShowPage() { - if (!currentUser.getAdmin()) { - return !page.isOnlyForAdmin(); - } - return true; - } - - @Log - Object onSuccessFromConnexionForm() { - try { - User userForm = serviceUser.connect(login, password); - if (userForm != null) { - currentUser = userForm; - } else { - connexionFeedback.addError("Connexion failed (user/password)"); - } - } catch (SuiviObsmerException eee) { - // db error, others, ... - } - return null; - } - - @Log - Object onActionFromExit() { - setCurrentUser(null); - return Index.class; - } - -} + +package fr.ifremer.suiviobsmer.ui.components; + +import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.entity.User; +import fr.ifremer.suiviobsmer.services.ServiceUser; +import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.pages.Index; +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.InjectContainer; +import org.apache.tapestry5.annotations.Log; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.annotations.SessionState; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.services.Request; +import org.slf4j.Logger; + +/** + * Layout + * + * Created: 9 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class Layout { + + @Inject + private Logger log; + + @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) + private String pageTitle; + + @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) + private String contentId; + + /** + * Objet de session représentant l'utilisateur identifié + */ + @SessionState + private User currentUser; + + /** + * vrai si l'utilisateur s'est identifié, faux sinon + */ + @SuppressWarnings("unused") + @Property + private boolean currentUserExists; + + @InjectComponent + private FeedBack connexionFeedback; + + @InjectComponent + private FeedBack contentFeedback; + + @InjectContainer + private SuiviObsmerPage page; + + @Inject + private ServiceUser serviceUser; + + @Inject + private Request request; + + void setupRender() { + if(currentUserExists && !canShowPage()) { + contentFeedback.addError("Vous n'êtes pas autorisé à accéder à cette page !"); + } + } + + public String getContextPath() { + return request.getContextPath(); + } + + /** + * User for connexion form data + */ + @Property + private String login; + + @Property + private String password; + + public String getPageTitle() { + return this.pageTitle; + } + + public String getContentId() { + return this.contentId; + } + + public void setCurrentUser(User user) { + this.currentUser = user; + } + + public User getCurrentUser() { + return this.currentUser; + } + + public FeedBack getFeedBack() { + return this.contentFeedback; + } + + public String getAdminClass() { + return this.currentUser.getAdmin() ? " admin" : ""; + } + + public String getSamplingSelected() { + return this.contentId.equals("so-sampling") ? "selected" : ""; + } + + public String getBoatsSelected() { + return this.contentId.equals("so-boats") ? "selected" : ""; + } + + public String getContactsSelected() { + return this.contentId.equals("so-contacts") ? "selected" : ""; + } + + public String getSynthesisSelected() { + return this.contentId.equals("so-synthesis") ? "selected" : ""; + } + + public String getAdminSelected() { + return this.contentId.equals("so-admin") ? "selected" : ""; + } + + public boolean canShowPage() { + if (!currentUser.getAdmin()) { + return !page.isOnlyForAdmin(); + } + return true; + } + + @Log + Object onSuccessFromConnexionForm() { + try { + User userForm = serviceUser.connect(login, password); + if (userForm != null) { + currentUser = userForm; + } else { + connexionFeedback.addError("Connexion failed (user/password)"); + } + } catch (SuiviObsmerException eee) { + // db error, others, ... + } + return null; + } + + @Log + Object onActionFromExit() { + setCurrentUser(null); + return Index.class; + } + +} 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 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2009-12-23 11:05:36 UTC (rev 149) @@ -646,7 +646,11 @@ return boatInfosZone.getBody(); } - Block onSuccessFromCalculateBoardings() { + Block onSuccessFromCalculateBoardings() throws SuiviObsmerException { + // Reinitialiaze companyId for select (admin only) + if (user.getAdmin()) { + companyId = getCompanyBoatInfos().getCompany().getTopiaId(); + } return boatInfosZone.getBody(); } 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 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2009-12-23 11:05:36 UTC (rev 149) @@ -26,6 +26,7 @@ import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.entity.Company; import fr.ifremer.suiviobsmer.entity.Contact; +import fr.ifremer.suiviobsmer.entity.Program; import fr.ifremer.suiviobsmer.entity.SampleRow; import fr.ifremer.suiviobsmer.entity.User; import fr.ifremer.suiviobsmer.services.ServiceBoat; @@ -47,6 +48,7 @@ import org.apache.tapestry5.Field; import org.apache.tapestry5.annotations.IncludeStylesheet; import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Log; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.annotations.SessionState; @@ -55,6 +57,7 @@ import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.ioc.services.PropertyAccess; import org.apache.tapestry5.services.BeanModelSource; +import org.nuiton.util.DateUtils; import org.slf4j.Logger; /** @@ -101,6 +104,7 @@ void setupRender() throws SuiviObsmerException { contacts = null; getContacts(); + contactsForm.clearErrors(); } /**************************** CONTACT LIST ********************************/ @@ -303,15 +307,6 @@ contact.setState(contactState.toString()); User contactUser = getUserSelectModel().findObject(contactUserId); contact.setUser(contactUser); - contactsForm.clearErrors(); - if (!validateState()) { - if (log.isDebugEnabled()) { - log.debug("Contact can't be saved with errors"); - } - // The contact is not saved, the contact must be editable to show form and correct errors - contactEdited = true; - editableContactId = contact.getTopiaId(); - } } void onSelectedFromCancelEditContact() throws SuiviObsmerException { @@ -338,7 +333,65 @@ @InjectComponent private Field comment; - void onSuccessFromContactsForm() { + @Log + void onValidateFormFromContactsForm() { + contactsForm.clearErrors(); + // Validation for saving contact depends on contactState (only edition form) + if (!contactEdited && contactState != null) { + if (log.isInfoEnabled()) { + log.info("For state : " + contactState); + } + + Date begin = contact.getTideBeginDate(); + Date end = contact.getTideEndDate(); + Program program = contact.getSampleRow().getProgram(); + DateFormat dateFormat = new SimpleDateFormat("MM/yyyy"); + + if (begin != null && !DateUtils.between(begin, program.getPeriodBegin(), program.getPeriodEnd())) { + contactsForm.recordError(beginDate, + "La date de début de la marée doit être comprise dans la période du programme : du " + + dateFormat.format(program.getPeriodBegin()) + " au " + dateFormat.format(program.getPeriodEnd())); + } + + if (end != null && !DateUtils.between(end, program.getPeriodBegin(), program.getPeriodEnd())) { + contactsForm.recordError(endDate, + "La date de fin de la marée doit être comprise dans la période du programme : du " + + dateFormat.format(program.getPeriodBegin()) + " au " + dateFormat.format(program.getPeriodEnd())); + } + + if (begin != null && end != null && end.before(begin)) { + contactsForm.recordError(endDate, "La date de fin de la marée ne peut être antérieure à celle de début"); + } + + // Non abouti, Refus ou Refus Définitif + if (contactState.isUnfinishedState()) { + if (!StringUtils.isEmpty(contact.getComment())) { + // RAZ des champs + contact.setTideBeginDate(null); + contact.setTideEndDate(null); + contact.setNbObservants(0); + contact.setMammalsCapture(false); + contact.setMammalsObservation(false); + } else { + contactsForm.recordError(comment, "Le commentaire est obligatoire pour l'état '" + contactState + "'"); + } + // Embarquement Réalisé + } else if (contactState.equals(ContactState.BOARDING_DONE)) { + if (begin == null) { + contactsForm.recordError(beginDate, "La date de début de marée est obligatoire pour l'état '" + contactState + "'"); + } + if (end == null) { + contactsForm.recordError(endDate, "La date de fin de marée est obligatoire pour l'état '" + contactState + "'"); + } + if (contact.getNbObservants() == 0) { + contactsForm.recordError(nbObservants, "Il ne peut y avoir aucun observateur pour l'état '" + contactState + "'"); + } + } + } + } + + @Log + Object onSuccessFromContactsForm() { if (!contactEdited) { try { if (log.isDebugEnabled()) { @@ -350,44 +403,18 @@ layout.getFeedBack().addError(eee.getMessage()); } } + return this; } - private boolean validateState() { - if (log.isInfoEnabled()) { - log.info("STATE SET : " + contactState); + @Log + Object onFailureFromContactsForm() { + if (log.isDebugEnabled()) { + log.debug("Contact can't be saved with errors"); } - // Non abouti, Refus ou Refus Définitif - if (contactState.isUnfinishedState()) { - if (!StringUtils.isEmpty(contact.getComment())) { - // RAZ des champs - contact.setTideBeginDate(null); - contact.setTideEndDate(null); - contact.setNbObservants(0); - contact.setMammalsCapture(false); - contact.setMammalsObservation(false); - } else { - contactsForm.recordError(comment, "Le commentaire est obligatoire pour l'état '" + contactState + "'"); - } - // Embarquement Réalisé - } else if (contactState.equals(ContactState.BOARDING_DONE)) { - Date begin = contact.getTideBeginDate(); - Date end = contact.getTideEndDate(); - // TODO check program period borns for begin and end ???? - if (begin == null) { - contactsForm.recordError(beginDate, "La date de début de marée est obligatoire pour l'état '" + contactState + "'"); - } - if (end != null) { - if (begin != null && end.before(begin)) { - contactsForm.recordError(endDate, "La date de fin de la marée ne peut être antérieure à celle de début"); - } - } else { - contactsForm.recordError(endDate, "La date de fin de marée est obligatoire pour l'état '" + contactState + "'"); - } - if (contact.getNbObservants() == 0) { - contactsForm.recordError(nbObservants, "Il ne peut y avoir aucun observateur pour l'état '" + contactState + "'"); - } - } - return !contactsForm.getHasErrors(); + // The contact is not saved, the contact must be editable to show form and correct errors + contactEdited = true; + editableContactId = contact.getTopiaId(); + return contactsForm; } public void createNewContact(Boat boat, SampleRow sampleRow) throws SuiviObsmerException { Modified: trunk/suiviobsmer-ui/src/main/webapp/Boats.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/webapp/Boats.tml 2009-12-23 11:05:36 UTC (rev 149) @@ -260,7 +260,9 @@ <img src="${asset:context:}/img/contact-22px.png" title="Créer un nouveau contact pour ce navire et cette ligne du plan"/> </a> <p:else> - <img src="${asset:context:}/img/contact-unavailable-22px.png" title="Création d'un nouveau contact impossible"/> + <t:unless t:test="user.admin"> + <img src="${asset:context:}/img/contact-unavailable-22px.png" title="Création d'un nouveau contact indisponible"/> + </t:unless> </p:else> </t:if> </li> Modified: trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2009-12-23 11:05:36 UTC (rev 149) @@ -3,130 +3,143 @@ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> <!--t:include="creationDate, lastState, boatName, boatImmatriculation, boatDistrictCode, beginTideDate, endTideDate, nbObservants, mammals, editDate, comment, validation"--> - -<form t:type="form" t:id="contactsForm"> - <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" - t:rowsPerPage="20"> - <p:createdByCell> - <t:if t:test="editionMode"> - <input t:type="select" t:model="userSelectModel" t:validate="required" t:value="contactUserId"/> - <p:else>${contact.user.fullName}</p:else> - </t:if> - </p:createdByCell> - <p:sampleRowCell> - <span t:type="ck/Tooltip" title="Infos" t:value="prop:sampleRowDescription" t:effect="appear"> - ${contact.sampleRow.code} - </span> - </p:sampleRowCell> - <p:topiaCreateDateCell> - <t:output value="contact.topiaCreateDate" format="dateFormat" /> - </p:topiaCreateDateCell> - <p:boatCell> - <span t:type="ck/Tooltip" title="Infos" t:value="prop:boatDescription" t:effect="appear"> - ${contact.boat.name} - </span> - </p:boatCell> - <p:stateCell> - <t:if t:test="editionMode"> - <input t:type="select" t:id="contactState" t:validate="required"/> - <p:else>${contact.state}</p:else> - </t:if> - </p:stateCell> - <p:tideBeginDateCell> - <t:if t:test="editionMode"> - <input t:type="datefield" t:id="beginDate" class="date" value="contact.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" /> - <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" /> - <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"/> - <t:label t:for="mammalsObservation"> - <img src="${asset:context:}/img/eye-22px.png" alt="Observations de mammifères" - title="Observations de mammifères" /> - </t:label> - <input t:type="checkbox" t:id="mammalsCapture" value="contact.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" /> - </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" /> - </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" /> - </t:if> - </p:else> - </t:if> - </p:mammalsCell> - <p:validationCell> - <t:booleanImage t:value="contact.validationCompany" t:empty="isEmpty(contact.validationCompany)" - t:emptyTitle="Non validé par la société" - t:trueTitle="Validé par la société" t:falseTitle="Refusé par la société"/> - <t:booleanImage t:value="contact.validationProgram" t:empty="isEmpty(contact.validationProgram)" - t:emptyTitle="Non validé par le programme" - t:trueTitle="Validé par le programme" t:falseTitle="Refusé par le programme"/> - </p:validationCell> - <p:dataInputDateCell> - <t:if t:test="editionMode"> - <input t:type="datefield" t:id="inputDate" class="date" value="contact.dataInputDate" /> - <p:else><t:output value="contact.dataInputDate" format="dateFormat" /></p:else> - </t:if> - </p:dataInputDateCell> - <p:commentCell> - <t:if t:test="editionMode"> - <input t:type="textarea" t:id="comment" cols="15" rows="2" value="contact.comment" /> - <p:else> - ${contact.comment} - </p:else> - </t:if> - </p:commentCell> - <p:actionsCell> - <t:if t:test="hasActions()"> +<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" + t:rowsPerPage="20"> + <p:createdByCell> <t:if t:test="editionMode"> - <input t:type="submit" t:id="cancelEditContact" class="ico22px undo22px" value="Undo" - title="Annuler les modifications" /> - <input t:type="submitContext" t:id="saveContact" class="ico22px save22px" value="Save" - t:context="contact.topiaId" title="Enregistrer le contact" /> + <input t:type="select" t:model="userSelectModel" t:validate="required" t:value="contactUserId"/> + <p:else>${contact.user.fullName}</p:else> + </t:if> + </p:createdByCell> + <p:sampleRowCell> + <span t:type="ck/Tooltip" title="Infos" t:value="prop:sampleRowDescription" t:effect="appear"> + ${contact.sampleRow.code} + </span> + </p:sampleRowCell> + <p:topiaCreateDateCell> + <t:output value="contact.topiaCreateDate" format="dateFormat" /> + </p:topiaCreateDateCell> + <p:boatCell> + <span t:type="ck/Tooltip" title="Infos" t:value="prop:boatDescription" t:effect="appear"> + ${contact.boat.name} + </span> + </p:boatCell> + <p:stateCell> + <t:if t:test="editionMode"> + <input t:type="select" t:id="contactState" t:validate="required"/> + <p:else>${contact.state}</p:else> + </t:if> + </p:stateCell> + <p:tideBeginDateCell> + <t:if t:test="editionMode"> + <input t:type="datefield" t:id="beginDate" class="date" value="contact.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" /> + <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" /> + <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"/> + <t:label t:for="mammalsObservation"> + <img src="${asset:context:}/img/eye-22px.png" alt="Observations de mammifères" + title="Observations de mammifères" /> + </t:label> + <input t:type="checkbox" t:id="mammalsCapture" value="contact.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" /> + </t:label> <p:else> - <input t:type="submitContext" t:id="editContact" class="ico edit" value="Edit" - t:context="contact.topiaId" title="Modifier le contact" /> - <input t:type="submitContext" t:id="deleteContact" class="ico22px delete" value="Delete" - t:context="contact.topiaId" title="Supprimer le contact" - t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement ce contact ?" /> + <!--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" /> + </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" /> + </t:if> </p:else> </t:if> - </t:if> - <t:if t:test="canValidate()"> - <input t:type="submitContext" t:id="acceptContact" class="ico22px accept" value="Accept" - t:context="contact.topiaId" title="Valider le contact" /> - <input t:type="submitContext" t:id="refuseContact" class="ico22px refuse" value="Refuse" - t:context="contact.topiaId" title="Refuser le contact" /> - </t:if> - <t:if t:test="canUnvalidate()"> - <input t:type="submitContext" t:id="unvalidateContact" class="ico22px unvalidate" value="Unvalidate" - t:context="contact.topiaId" title="Enlever la validation du contact" /> - </t:if> - </p:actionsCell> - </div> -</form> + </p:mammalsCell> + <p:validationCell> + <t:booleanImage t:value="contact.validationCompany" t:empty="isEmpty(contact.validationCompany)" + t:emptyTitle="Non validé par la société" + t:trueTitle="Validé par la société" t:falseTitle="Refusé par la société"/> + <t:booleanImage t:value="contact.validationProgram" t:empty="isEmpty(contact.validationProgram)" + t:emptyTitle="Non validé par le programme" + t:trueTitle="Validé par le programme" t:falseTitle="Refusé par le programme"/> + </p:validationCell> + <p:dataInputDateCell> + <t:if t:test="editionMode"> + <input t:type="datefield" t:id="inputDate" class="date" value="contact.dataInputDate" /> + <p:else><t:output value="contact.dataInputDate" format="dateFormat" /></p:else> + </t:if> + </p:dataInputDateCell> + <p:commentCell> + <t:if t:test="editionMode"> + <input t:type="textarea" t:id="comment" cols="15" rows="2" value="contact.comment" /> + <p:else> + ${contact.comment} + </p:else> + </t:if> + </p:commentCell> + <p:actionsCell> + <t:if t:test="hasActions()"> + <t:if t:test="editionMode"> + <input t:type="submit" t:id="cancelEditContact" class="ico22px undo22px" value="Undo" + title="Annuler les modifications" /> + <input t:type="submitContext" t:id="saveContact" class="ico22px save22px" value="Save" + t:context="contact.topiaId" title="Enregistrer le contact" /> + <p:else> + <input t:type="submitContext" t:id="editContact" class="ico edit" value="Edit" + t:context="contact.topiaId" title="Modifier le contact" /> + <input t:type="submitContext" t:id="deleteContact" class="ico22px delete" value="Delete" + t:context="contact.topiaId" title="Supprimer le contact" + t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement ce contact ?" /> + </p:else> + </t:if> + <p:else> + <t:unless t:test="user.admin"> + <img src="${asset:context:}/img/edit-unavailable-22px.png" alt="Edit unavailable" title="Edition du contact indisponible"/> + <img src="${asset:context:}/img/delete-unavailable-22px.png" alt="Delete unavailable" title="Suppression du contact indisponible"/> + </t:unless> + </p:else> + </t:if> + <t:if t:test="canValidate()"> + <input t:type="submitContext" t:id="acceptContact" class="ico22px accept" value="Accept" + t:context="contact.topiaId" title="Valider le contact" /> + <input t:type="submitContext" t:id="refuseContact" class="ico22px refuse" value="Refuse" + t:context="contact.topiaId" title="Refuser le contact" /> + <p:else> + <t:unless t:test="canUnvalidate()"> + <img src="${asset:context:}/img/accept-unavailable-22px.png" alt="Accept unavailable" title="Validation du contact indisponible"/> + <img src="${asset:context:}/img/refuse-unavailable-22px.png" alt="Refuse unavailable" title="Refus du contact indisponible"/> + </t:unless> + </p:else> + </t:if> + <t:if t:test="canUnvalidate()"> + <input t:type="submitContext" t:id="unvalidateContact" class="ico22px unvalidate" value="Unvalidate" + t:context="contact.topiaId" title="Enlever la validation du contact" /> + </t:if> + </p:actionsCell> + </div> + </form> +</t:zone> </t:layout> Modified: trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/webapp/SampleRowForm.tml 2009-12-23 11:05:36 UTC (rev 149) @@ -1,7 +1,14 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <t:layout t:pageTitle="Modification d'une ligne du plan" t:contentId="so-samplerow-form" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - + <h1> + <t:if t:test="createMode"> + Création d'une nouvelle ligne + <p:else> + Modification de la ligne ${sampleRow.code} + </p:else> + </t:if> + </h1> <t:zone t:id="globalZone" t:update="show"> <form t:type="form" t:id="sampleRowForm" t:zone="globalZone"> @@ -30,7 +37,7 @@ </fieldset> <!-- FISHING ZONES --> - <fieldset> + <fieldset id="so-samplerow-form-fishingzone"> <legend>Zone(s) de pêche</legend> <t:if t:test="sampleRow.hasSampleMonthRealTideTime()"> <!-- DISPLAY --> @@ -58,33 +65,34 @@ ${fishingZone.code} </div> </div> - <div class="select"> - <t:label t:for="fishingZonesInfos" /> : - <input t:type="textfield" class="width300" t:id="fishingZonesInfos" value="sampleRow.fishingZonesInfos" /> - </div> </p:else> </t:if> + <div class="t-beaneditor-row"> + <t:label t:for="fishingZonesInfos" /> + <input t:type="textfield" class="width300" t:id="fishingZonesInfos" value="sampleRow.fishingZonesInfos" /> + </div> </fieldset> <!-- PROGRAM and SAMPLE MONTHS --> <fieldset> - <legend>Programme et données des marées par mois</legend> - <div class="select"> - <t:if t:test="sampleRow.hasSampleMonthRealTideTime()"> - <!-- DISPLAY PROGRAM --> - Programme : ${sampleRow.program.name} - <p:else> - <!-- EDITION PROGRAM --> - <div class="select"> - <t:label t:for="program"/>* : - <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" /> - <input t:type="submit" class="ico search" t:id="searchProgram" value="Search" - title="Afficher les détails du programme"/> - ou <input t:type="textfield" t:id="programName" value="programName" /> - </div> - </p:else> - </t:if> - </div> + <legend>Programme et données des marées par mois</legend> + <t:if t:test="sampleRow.hasSampleMonthRealTideTime()"> + <!-- DISPLAY PROGRAM --> + <dl class="t-beandisplay"> + <dt>Programme</dt> + <dd>${sampleRow.program.name}</dd> + </dl> + <p:else> + <!-- EDITION PROGRAM --> + <div class="select"> + <t:label t:for="program"/>* : + <input t:type="select" t:id="program" t:model="programSelectModel" value="programId" /> + <input t:type="submit" class="ico search" t:id="searchProgram" value="Search" + title="Afficher les détails du programme"/> + ou <input t:type="textfield" t:id="programName" value="programName" /> + </div> + </p:else> + </t:if> <!-- EDITION PROGRAM PERIOD --> <div class="select"> <t:label t:for="programPeriodBegin"/>* : @@ -93,8 +101,8 @@ <input t:type="submit" class="ico refresh" t:id="refreshMonths" value="Refresh" title="Rafraîchir les mois"/> </div> <!-- EDITION SAMPLE MONTHS --> - <div class="acenter"> - <table id="so-samplerow-form-months"> + <div id="so-samplerow-form-months" class="acenter"> + <table> <tr class="firstRow"> <td t:type="loop" t:source="months" t:value="month" volatile="true"> <t:output value="month" format="dateFormat" /> Modified: trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/webapp/SamplingPlan.tml 2009-12-23 11:05:36 UTC (rev 149) @@ -155,6 +155,9 @@ t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement la ligne ${row.code} du plan d\'échantillonnage ?"> <img src="${asset:context:}/img/delete2.png" alt="Supprimer" title="Supprimer la ligne"/> </a> + <p:else> + <img src="${asset:context:}/img/delete-unavailable-22px.png" alt="Supprimer indisponible" title="Suppression de la ligne indisponible"/> + </p:else> </t:unless> </t:if> </td> Modified: trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css 2009-12-22 18:09:31 UTC (rev 148) +++ trunk/suiviobsmer-ui/src/main/webapp/css/sampling.css 2009-12-23 11:05:36 UTC (rev 149) @@ -155,8 +155,13 @@ width: 60%; margin-left: auto; margin-right: auto; + margin-top: 20px; } +div#so-samplerow-form h1 { + text-align: center; +} + div#so-samplerow-form div.t-error { margin: 5px auto; font-size: 0.8em; @@ -171,11 +176,6 @@ padding: 8px; } -/*div#so-samplerow-form legend { - font-weight: bold; -}*/ - - div#so-samplerow-form div.select { width: 100%; text-align: center; @@ -183,49 +183,45 @@ color: #007CC2; } +div#so-samplerow-form dl.t-beandisplay dt, div#so-samplerow-form label { color: #007CC2; } +div#so-samplerow-form dl.t-beandisplay, div#so-samplerow-form div.t-beaneditor { background-color: transparent; border: 0px; } -/*div#so-samplerow-form fieldset.user-form { - width: 100%; +fieldset#so-samplerow-form-fishingzone ul { + text-align: center; } - -div#so-samplerow-form dl.t-beandisplay { - background: transparent; - border: 0px; +fieldset#so-samplerow-form-fishingzone ul li { + list-style-type: circle; } -div#so-samplerow-form-fishingzone div.fishingzone-row { - width: 400px; -}*/ - -#so-samplerow-form-months { +div#so-samplerow-form-months { margin: 10px; } -#so-samplerow-form-months tr.firstRow { +div#so-samplerow-form-months table tr.firstRow { background-color: #19A28D; color: white; border: 2px outset blue; font-size: 0.8em; } -#so-samplerow-form-months tr.firstRow td { +div#so-samplerow-form-months table tr.firstRow td { padding: 3px; text-align: center; } -#so-samplerow-form-other input.t-number { +fieldset#so-samplerow-form-other input.t-number { width: 50px; } -#so-samplerow-form-other span.code-missing { +fieldset#so-samplerow-form-other span.code-missing { font-size: 0.8em; color: red; } Added: trunk/suiviobsmer-ui/src/main/webapp/img/accept-unavailable-22px.png =================================================================== (Binary files differ) Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/accept-unavailable-22px.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/suiviobsmer-ui/src/main/webapp/img/delete-unavailable-22px.png =================================================================== (Binary files differ) Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/delete-unavailable-22px.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/suiviobsmer-ui/src/main/webapp/img/edit-unavailable-22px.png =================================================================== (Binary files differ) Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/edit-unavailable-22px.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/suiviobsmer-ui/src/main/webapp/img/refuse-unavailable-22px.png =================================================================== (Binary files differ) Property changes on: trunk/suiviobsmer-ui/src/main/webapp/img/refuse-unavailable-22px.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
participants (1)
-
fdesbois@users.labs.libre-entreprise.org