Author: bleny Date: 2010-11-03 16:51:31 +0000 (Wed, 03 Nov 2010) New Revision: 734 Log: merge changes from branches 1.5.4 : will bring bugfixes into 1.6 Added: trunk/src/announcement/release-email-1.5.4.txt trunk/wao-ui/src/main/webapp/js/administration.js trunk/wao-ui/src/main/webapp/js/news.js Removed: trunk/wao-ui/src/main/webapp/js/AdminUserSelect.js trunk/wao-ui/src/main/webapp/js/NewsHider.js Modified: trunk/ trunk/changelog.txt trunk/src/site/rst/index.rst trunk/wao-business/ trunk/wao-business/pom.xml trunk/wao-business/src/main/filters/Wao.properties trunk/wao-business/src/main/java/fr/ifremer/wao/ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java trunk/wao-business/src/main/java/fr/ifremer/wao/WaoBusinessException.java trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/CompanyBoatInfosImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java trunk/wao-business/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ trunk/wao-business/src/main/xmi/wao.properties trunk/wao-business/src/main/xmi/wao.zargo trunk/wao-business/src/test/java/fr/ifremer/wao/ trunk/wao-business/src/test/java/fr/ifremer/wao/TestManager.java trunk/wao-business/src/test/java/fr/ifremer/wao/WaoUtilsTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/io/ImportHelperTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ActivityCalendarImportTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceReferentialImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java trunk/wao-business/src/test/resources/WaoTest.properties trunk/wao-business/src/test/resources/import/echantillonnage.csv trunk/wao-business/src/test/resources/import/navires.csv trunk/wao-business/src/test/resources/import/zonesPeche.csv trunk/wao-ui/ trunk/wao-ui/src/main/java/fr/ifremer/wao/ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/WaoPropertyChangeListener.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Index.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/WaoManager.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ trunk/wao-ui/src/main/webapp/Contacts.tml trunk/wao-ui/src/main/webapp/js/contacts.js Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo + /branches/wao-1.5.x:679-733 Modified: trunk/changelog.txt =================================================================== --- trunk/changelog.txt 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/changelog.txt 2010-11-03 16:51:31 UTC (rev 734) @@ -3,6 +3,16 @@ Historique des versions +1.5.4 +----- + +Anomalies ++++++++++ + +- [fdesbois] Ano #2526 : Mail automatique non fonctionnel sous IE. +- [fdesbois] Ano #2540 : La validation programme ne fonctionne plus sur un + contact avec l'état "refus", "refus définitif" ou "non abouti. + 1.5.3 ----- Copied: trunk/src/announcement/release-email-1.5.4.txt (from rev 733, branches/wao-1.5.x/src/announcement/release-email-1.5.4.txt) =================================================================== --- trunk/src/announcement/release-email-1.5.4.txt (rev 0) +++ trunk/src/announcement/release-email-1.5.4.txt 2010-11-03 16:51:31 UTC (rev 734) @@ -0,0 +1,21 @@ + +Un correctif 1.5.4 pour la version 1.5 de Wao est disponible. + +Résolution d'anomalies : + +- Mail automatique non fonctionnel sous IE. [fdesbois-Ano #2526] +- La validation programme ne fonctionne plus sur un contact refusé. + [fdesbois-Ano #2540] + +Documentation : + +http://suiviobsmer.labs.libre-entreprise.org/wao/ + +Téléchargement : + +https://labs.libre-entreprise.org/frs/?group_id=154 + +Cordialement, + +L'équipe Wao + Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/src/site/rst/index.rst 2010-11-03 16:51:31 UTC (rev 734) @@ -26,3 +26,8 @@ .. - Application permettant le suivi des embarquements effectués sur des navires de pêche dans le cadre d'observations scientifiques. + +Cette application n'est pas complètement supporté par le navigateur Microsoft Internet Explorer. Il est préférable d'utiliser un +autre navigateur Internet comme `Mozilla Firefox`_ . + +.. _Mozilla Firefox: http://www.mozilla-europe.org/fr/firefox/ Property changes on: trunk/wao-business ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/wao-business/pom.xml =================================================================== --- trunk/wao-business/pom.xml 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-business/pom.xml 2010-11-03 16:51:31 UTC (rev 734) @@ -205,9 +205,9 @@ <scm> <url>http://labs.libre-entreprise.org/scm/viewvc.php/trunk/wao-business/?root=suiviobsmer</url> - <connection>scm:svn:svn://anonymous at labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-business</connection> - <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-business</developerConnection> - </scm> + <connection>scm:svn:svn://anonymous at labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-business</connection> + <developerConnection>scm:svn:svn+ssh://${username}@labs.libre-entreprise.org/svnroot/suiviobsmer/trunk/wao-business</developerConnection> + </scm> <!--<repositories>--> <!--<repository>--> Property changes on: trunk/wao-business/src/main/filters/Wao.properties ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoBusinessException.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/CompanyBoatInfosImpl.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SynthesisId.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/java/fr/ifremer/wao/service ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/xmi/wao.properties ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/main/xmi/wao.zargo ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/TestManager.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/WaoUtilsTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/io/ImportHelperTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ActivityCalendarImportTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceBoatImplTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceContactInternalTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceReferentialImplTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSamplingImplTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/service/ServiceSynthesisImplTest.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/resources/WaoTest.properties ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/resources/import/echantillonnage.csv ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/resources/import/navires.csv ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-business/src/test/resources/import/zonesPeche.csv ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-ui ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-ui/src/main/java/fr/ifremer/wao ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/data/WaoPropertyChangeListener.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-11-03 16:51:31 UTC (rev 734) @@ -92,7 +92,7 @@ */ @RequiresAuthentication(value = {UserRole.ADMIN, UserRole.COORDINATOR}, readOnlyAllowed = false) @IncludeStylesheet("context:css/administration.css") - at IncludeJavaScriptLibrary("context:js/AdminUserSelect.js") + at IncludeJavaScriptLibrary("context:js/administration.js") public class Administration { @InjectComponent Property changes on: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Contacts.java ___________________________________________________________________ Deleted: svn:mergeinfo - Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Index.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Index.java 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Index.java 2010-11-03 16:51:31 UTC (rev 734) @@ -56,7 +56,7 @@ */ @RequiresAuthentication @IncludeStylesheet("context:css/news.css") - at IncludeJavaScriptLibrary("context:js/NewsHider.js") + at IncludeJavaScriptLibrary("context:js/news.js") public class Index { @Inject Property changes on: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/services/WaoManager.java ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-ui/src/main/resources/fr/ifremer/wao ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: trunk/wao-ui/src/main/webapp/Contacts.tml ___________________________________________________________________ Deleted: svn:mergeinfo - Deleted: trunk/wao-ui/src/main/webapp/js/AdminUserSelect.js =================================================================== --- trunk/wao-ui/src/main/webapp/js/AdminUserSelect.js 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-ui/src/main/webapp/js/AdminUserSelect.js 2010-11-03 16:51:31 UTC (rev 734) @@ -1,53 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * %% - * Copyright (C) 2009 - 2010 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -/** - * This class is used to manage manually user select on Administration page. - * Options need style depends on inactivity of users. So we use javascript to - * manage dynamic states of the select. Initialization if needed (the correct - * option to select) then use a hidden field 'hiddenUserId' to keep userId - * context (ids are values of options). - * This hidden field will be interpreted by Tapestry when form will be submit. - */ -AdminUserSelect = Class.create({ - initialize: function() { - this.hiddenUserId = $('userActionsForm').hiddenUserId; - this.userSelect = $('userActionsForm').users; - this.userSelect.observe('change', this.updateUserId.bind(this)); - - var userId = $F(this.hiddenUserId); - - // Initialize selected option - if (userId) { - var options = this.userSelect.select('option'); - for (i = 0; i < options.length; i++) { - if (options[i].value == userId) { - options[i].selected = true; - break; - } - } - } - //Tapestry.debug('Initialized !'); - }, - updateUserId: function(event) { - //Tapestry.debug('select value : ' + $F(this.userSelect)); - this.hiddenUserId.setValue($F(this.userSelect)); - } -}); Deleted: trunk/wao-ui/src/main/webapp/js/NewsHider.js =================================================================== --- trunk/wao-ui/src/main/webapp/js/NewsHider.js 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-ui/src/main/webapp/js/NewsHider.js 2010-11-03 16:51:31 UTC (rev 734) @@ -1,100 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * %% - * Copyright (C) 2009 - 2010 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -/** - * This class is used to hide news details depends on an anchor. This anchor - * must be called 'details' and be surrounded by a paragraph block (<p>) in - * the news content. The anchor will be transformed in a clickable link, then - * the rest of the news will be hidden using NewsDetails object. - */ -NewsHider = Class.create({ - initialize: function() { - this.allNews = $('so-news').select('div.news-content'); - this.anchorPattern = 'a[name="details"]'; - }, - /** - * Method to call to hide all news that contains the anchor 'details' - */ - hideAllNewsDetails: function() { - for (j = 0; j < this.allNews.length; j++) { - this.hideNewsDetails(this.allNews[j]); - } - }, - /** - * Hide a {news} if contains an anchor called 'details'. A NewsDetails object - * will be instantiate to transform the anchor found and hide the rest of - * the news in a hiddenBlock. - */ - hideNewsDetails: function(news) { - // Select all paragraphs in the news - var paragraphs = news.select('p'); - //Tapestry.debug('nb paragraphs in news : ' + paragraphs.length); - - for (i = 0; i < paragraphs.length; i++) { - var paragraph = paragraphs[i]; - - // Check the firstDescendant in the paragraph, we take only anchor called 'details' - if (paragraph.firstDescendant() && paragraph.firstDescendant().match(this.anchorPattern)) { - var anchor = paragraph.firstDescendant(); - - //Tapestry.debug('Find anchor !'); - - // paragraphs to hide are the next siblings of current paragraph - var paragraphsToHide = paragraph.nextSiblings(); - - var details = new NewsDetails(anchor, paragraphsToHide); - - // append the hidden block to the news - news.appendChild(details.hiddenBlock); - break; - } - } - } -}); - -/** - * This class is used to transform an {anchor} in clickable link to display a - * hidden block as news details. The {paragraphsToHide} will be wrapped into - * a div hidden element. When user will click on the {anchor}, the hidden - * block will be toggled to be displayed or not. - */ -NewsDetails = Class.create({ - initialize: function(anchor, paragraphsToHide) { - - //Tapestry.debug('create NewsDetails'); - - // Update params of the anchor to be clickable - anchor.update('Lire la suite...'); - anchor.addClassName('news-details-link'); - // Bind the click on the anchor with the toggle on hiddenBlock - anchor.observe('click', this.toggleDetails.bind(this)); - - // Create hidden block - this.hiddenBlock = document.createElement('div'); - this.hiddenBlock.addClassName('hidden'); - - for (i = 0; i < paragraphsToHide.length; i++) { - this.hiddenBlock.appendChild(paragraphsToHide[i]); - } - }, - toggleDetails: function(event) { - this.hiddenBlock.toggleClassName('hidden'); - } -}); Copied: trunk/wao-ui/src/main/webapp/js/administration.js (from rev 733, branches/wao-1.5.x/wao-ui/src/main/webapp/js/administration.js) =================================================================== --- trunk/wao-ui/src/main/webapp/js/administration.js (rev 0) +++ trunk/wao-ui/src/main/webapp/js/administration.js 2010-11-03 16:51:31 UTC (rev 734) @@ -0,0 +1,53 @@ +/* + * #%L + * Wao :: Web Interface + * %% + * Copyright (C) 2009 - 2010 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +/** + * This class is used to manage manually user select on Administration page. + * Options need style depends on inactivity of users. So we use javascript to + * manage dynamic states of the select. Initialization if needed (the correct + * option to select) then use a hidden field 'hiddenUserId' to keep userId + * context (ids are values of options). + * This hidden field will be interpreted by Tapestry when form will be submit. + */ +AdminUserSelect = Class.create({ + initialize: function() { + this.hiddenUserId = $('userActionsForm').hiddenUserId; + this.userSelect = $('userActionsForm').users; + this.userSelect.observe('change', this.updateUserId.bind(this)); + + var userId = $F(this.hiddenUserId); + + // Initialize selected option + if (userId) { + var options = this.userSelect.select('option'); + for (i = 0; i < options.length; i++) { + if (options[i].value == userId) { + options[i].selected = true; + break; + } + } + } + //Tapestry.debug('Initialized !'); + }, + updateUserId: function(event) { + //Tapestry.debug('select value : ' + $F(this.userSelect)); + this.hiddenUserId.setValue($F(this.userSelect)); + } +}); Modified: trunk/wao-ui/src/main/webapp/js/contacts.js =================================================================== --- trunk/wao-ui/src/main/webapp/js/contacts.js 2010-11-03 13:37:52 UTC (rev 733) +++ trunk/wao-ui/src/main/webapp/js/contacts.js 2010-11-03 16:51:31 UTC (rev 734) @@ -142,7 +142,8 @@ initialize: function(message, contactState) { this.contactState = contactState; this.message = message; - $('contactsForm').saveContact.observe('click', this.doConfirm.bind(this)); + + $('saveContact').observe('click', this.doConfirm.bind(this)); }, doConfirm: function(event) { Copied: trunk/wao-ui/src/main/webapp/js/news.js (from rev 733, branches/wao-1.5.x/wao-ui/src/main/webapp/js/news.js) =================================================================== --- trunk/wao-ui/src/main/webapp/js/news.js (rev 0) +++ trunk/wao-ui/src/main/webapp/js/news.js 2010-11-03 16:51:31 UTC (rev 734) @@ -0,0 +1,100 @@ +/* + * #%L + * Wao :: Web Interface + * %% + * Copyright (C) 2009 - 2010 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +/** + * This class is used to hide news details depends on an anchor. This anchor + * must be called 'details' and be surrounded by a paragraph block (<p>) in + * the news content. The anchor will be transformed in a clickable link, then + * the rest of the news will be hidden using NewsDetails object. + */ +NewsHider = Class.create({ + initialize: function() { + this.allNews = $('so-news').select('div.news-content'); + this.anchorPattern = 'a[name="details"]'; + }, + /** + * Method to call to hide all news that contains the anchor 'details' + */ + hideAllNewsDetails: function() { + for (j = 0; j < this.allNews.length; j++) { + this.hideNewsDetails(this.allNews[j]); + } + }, + /** + * Hide a {news} if contains an anchor called 'details'. A NewsDetails object + * will be instantiate to transform the anchor found and hide the rest of + * the news in a hiddenBlock. + */ + hideNewsDetails: function(news) { + // Select all paragraphs in the news + var paragraphs = news.select('p'); + //Tapestry.debug('nb paragraphs in news : ' + paragraphs.length); + + for (i = 0; i < paragraphs.length; i++) { + var paragraph = paragraphs[i]; + + // Check the firstDescendant in the paragraph, we take only anchor called 'details' + if (paragraph.firstDescendant() && paragraph.firstDescendant().match(this.anchorPattern)) { + var anchor = paragraph.firstDescendant(); + + //Tapestry.debug('Find anchor !'); + + // paragraphs to hide are the next siblings of current paragraph + var paragraphsToHide = paragraph.nextSiblings(); + + var details = new NewsDetails(anchor, paragraphsToHide); + + // append the hidden block to the news + news.appendChild(details.hiddenBlock); + break; + } + } + } +}); + +/** + * This class is used to transform an {anchor} in clickable link to display a + * hidden block as news details. The {paragraphsToHide} will be wrapped into + * a div hidden element. When user will click on the {anchor}, the hidden + * block will be toggled to be displayed or not. + */ +NewsDetails = Class.create({ + initialize: function(anchor, paragraphsToHide) { + + //Tapestry.debug('create NewsDetails'); + + // Update params of the anchor to be clickable + anchor.update('Lire la suite...'); + anchor.addClassName('news-details-link'); + // Bind the click on the anchor with the toggle on hiddenBlock + anchor.observe('click', this.toggleDetails.bind(this)); + + // Create hidden block + this.hiddenBlock = new Element('div'); + this.hiddenBlock.addClassName('hidden'); + + for (i = 0; i < paragraphsToHide.length; i++) { + this.hiddenBlock.appendChild(paragraphsToHide[i]); + } + }, + toggleDetails: function(event) { + this.hiddenBlock.toggleClassName('hidden'); + } +});