[Suiviobsmer-commits] r256 - in trunk/suiviobsmer-ui/src/main: java/fr/ifremer/suiviobsmer/ui/pages resources/fr/ifremer/suiviobsmer/ui/pages webapp webapp/css
Author: fdesbois Date: 2010-01-22 07:37:49 +0000 (Fri, 22 Jan 2010) New Revision: 256 Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css Log: Evol #1959 : Add popup for comment using chenilleKit Window component + Js directly in tml page. 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-21 12:23:50 UTC (rev 255) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-01-22 07:37:49 UTC (rev 256) @@ -113,10 +113,16 @@ @Persist(PersistenceConstants.FLASH) private String editableContactId; + @Log void setupRender() throws SuiviObsmerException { - initSelectFilters(true ,true); - contacts = null; - getContacts(); + if (StringUtils.isEmpty(editableContactId)) { + if (log.isDebugEnabled()) { + log.debug("RESET DATA"); + } + initSelectFilters(true ,true); + contacts = null; + getContacts(); + } contactsForm.clearErrors(); } @@ -328,6 +334,13 @@ this.contactState = contactState; } + public String getCommentDisplayed() { + if (contact.getComment() != null && contact.getComment().length() > 20) { + return contact.getComment().substring(0, 20) + "..."; + } + return contact.getComment(); + } + public String getSampleRowDescription() { return BusinessUtils.getTooltipSampleRow(contact.getSampleRow()); } @@ -369,6 +382,9 @@ private boolean contactDeleted; + @Persist + private String oldComment; + public boolean hasActions() { return !user.getAdmin() && contact.getValidationCompany() == null; } @@ -425,7 +441,8 @@ } contact.setValidationProgram(null); } else { - // For company unvalidate from previous accepted validation, removeRealTideTime + // For company unvalidate from previous accepted validation, + // removeRealTideTime if (BooleanUtils.isTrue(contact.getValidationCompany())) { contact.getSampleRow().removeRealTideTime(contact); } @@ -438,6 +455,7 @@ contactUserId = contact.getUser().getTopiaId(); editableContactId = contactId; contactSelectedId = contactId; + oldComment = contact.getComment(); contactEdited = true; } @@ -451,6 +469,10 @@ contact.setState(contactState.toString()); User contactUser = getUserSelectModel().findObject(contactUserId); contact.setUser(contactUser); + + if (log.isDebugEnabled()) { + log.debug("Comment : " + contact.getComment()); + } } void onSelectedFromCancelEditContact() throws SuiviObsmerException { @@ -483,8 +505,8 @@ @InjectComponent private Field nbObservants; - @InjectComponent - private Field comment; +// @InjectComponent +// private Field comment; @InjectComponent private Field inputDate; @@ -492,7 +514,8 @@ @Log void onValidateFormFromContactsForm() { contactsForm.clearErrors(); - // Validation for saving contact depends on contactState (only edition form) + // Validation for saving contact depends on contactState (only edition + // form) if (!contactEdited && contactState != null) { if (log.isInfoEnabled()) { log.info("For state : " + contactState); @@ -509,12 +532,6 @@ "La date de début de la marée doit correspondre à un mois valide (non vide) de la ligne " + row.getCode()); } -// if (end != null && !DateUtils.between(end, row.getPeriodBegin(), row.getPeriodEnd())) { -// contactsForm.recordError(endDate, -// "La date de fin de la marée doit être comprise dans la période de la ligne : du " + -// dateFormat.format(row.getPeriodBegin()) + " au " + dateFormat.format(row.getPeriodEnd())); -// } - if (begin != null && end != null && end.before(begin)) { contactsForm.recordError(endDate, "La date de fin de la marée ne peut pas être antérieure à celle de début"); } @@ -535,7 +552,7 @@ // Non abouti, Refus ou Refus Définitif if (contactState.isUnfinishedState()) { - if (!StringUtils.isEmpty(contact.getComment())) { + if (oldComment != null && StringUtils.isNotEmpty(contact.getComment()) && !oldComment.equals(contact.getComment())) { // RAZ des champs contact.setTideBeginDate(null); contact.setTideEndDate(null); @@ -544,7 +561,7 @@ contact.setMammalsObservation(false); contact.setDataInputDate(null); } else { - contactsForm.recordError(comment, "Le commentaire est obligatoire pour l'état '" + contactState + "'"); + contactsForm.recordError("Vous devez ajouter un commentaire pour l'état '" + contactState + "'"); } // Embarquement Réalisé } else if (contactState.equals(ContactState.BOARDING_DONE)) { @@ -570,6 +587,7 @@ } serviceContact.saveContact(contact, contactDeleted); contactSelectedId = contact.getTopiaId(); + oldComment = null; } catch (SuiviObsmerException eee) { layout.getFeedBack().addError(eee.getMessage()); } @@ -582,7 +600,8 @@ 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 + // The contact is not saved, the contact must be editable to show form + // and correct errors contactEdited = true; editableContactId = contact.getTopiaId(); return contactsForm; 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-21 12:23:50 UTC (rev 255) +++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/pages/Contacts.properties 2010-01-22 07:37:49 UTC (rev 256) @@ -8,6 +8,8 @@ createdBy-label: Observateur company-label: Soci\u00E9t\u00E9 sampleRow-label: M\u00E9tier +boat-label: Navire +state-label: Etat topiaCreateDate-label: Cr\u00E9ation tideBeginDate-label: D\u00E9but de la mar\u00E9e tideEndDate-label: Fin de la mar\u00E9e @@ -19,7 +21,7 @@ boatDistrictCode-label: CQ mammals-label: Observations et captures accidentelles dataInputDate-label: Saisie des donn\u00E9es dans Allegro -comment-label: Commentaire +comment-label: Com. # 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/webapp/Contacts.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-21 12:23:50 UTC (rev 255) +++ trunk/suiviobsmer-ui/src/main/webapp/Contacts.tml 2010-01-22 07:37:49 UTC (rev 256) @@ -208,20 +208,32 @@ <input t:type="textarea" t:id="comment" cols="5" rows="3" value="contact.comment" /> </t:form> </t:block>--> - <input t:type="textarea" t:id="comment" cols="10" rows="1" value="contact.comment" /> -<!-- <a href="#" onclick="window1.showCenter(true)"><img src="${asset:context:}/img/comment-22px.png" alt="Add comment" /></a> + <!--<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" /> + </a> + </span> + <textarea t:type="textarea" t:id="comment" class="hidden-textarea" cols="0" rows="0" value="contact.comment" /> - <div t:type="ck/Window" t:id="window1" style="bluelighting" show="false" modal="true" title="literal:Window 1"> - <h3>Test Window</h3> + <div t:type="ck/Window" t:id="windowComment" show="false" modal="true" + title="literal:Ajouter un commentaire" width="488" height="210"> <p> - <input t:type="textarea" t:id="comment" cols="20" rows="6" value="contact.comment" /> - <input t:type="submit" t:id="saveComment" class="ico22px save22px" value="Save" - t:context="contact.topiaId" title="Enregistrer le commentaire" /> + <textarea id="commentPopup" cols="50" rows="7" /> </p> - </div>--> + <p> </p> + <p class="aright"> + <a onclick="$('comment').setValue($F('commentPopup')); windowComment.close()" class="save"> + <img src="${asset:context:}/img/save-22px.png" alt="Save comment" title="Enregistrer le commentaire"/> + </a> + </p> + </div> <p:else> - ${contact.comment} + <span t:type="ck/Tooltip" title="Commentaire" t:value="prop:contact.comment" t:effect="appear"> + ${commentDisplayed} + </span> </p:else> </t:if> </p:commentCell> Modified: trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css 2010-01-21 12:23:50 UTC (rev 255) +++ trunk/suiviobsmer-ui/src/main/webapp/css/contacts.css 2010-01-22 07:37:49 UTC (rev 256) @@ -129,6 +129,16 @@ white-space: nowrap; } +div#so-contacts table.t-data-grid tbody tr td.comment { + white-space: normal; + width: 100px; + text-align: center; +} + +a.save { + cursor: pointer; +} + td.validation, td.mammals, /* TEMP */ div#so-contacts table.t-data-grid tbody td.validation, div#so-contacts table.t-data-grid tbody td.mammals { @@ -158,3 +168,9 @@ input.nbObservants { width: 18px; } + +textarea.hidden-textarea { + border: 0; + width: 0; + height: 0; +}
participants (1)
-
fdesbois@users.labs.libre-entreprise.org