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
March 2014
- 3 participants
- 90 discussions
r1784 - trunk/wao-web/src/main/webapp/WEB-INF/decorators
by tchemit@users.forge.codelutin.com 31 Mar '14
by tchemit@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: tchemit
Date: 2014-03-31 18:34:14 +0200 (Mon, 31 Mar 2014)
New Revision: 1784
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1784
Log:
use loadAtOnce jquery struts2 directive instead of loadFromGoogle
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 15:52:19 UTC (rev 1783)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 16:34:14 UTC (rev 1784)
@@ -28,7 +28,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><decorator:title default="Wao"/> - Wao</title>
- <sj:head locale="fr" loadFromGoogle="true" jqueryui="true" />
+ <sj:head locale="fr" jqueryui="true" loadAtOnce="true"/>
<sb:head />
<script type="text/javascript" src="<s:url value="/moment-js-2.5.1/moment-with-langs.js" />"></script>
<script type="text/javascript" src="<s:url value="/select2-3.4.5/select2.min.js" />"></script>
1
0
r1783 - trunk/wao-web/src/main/java/fr/ifremer/wao/web/action
by tchemit@users.forge.codelutin.com 31 Mar '14
by tchemit@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: tchemit
Date: 2014-03-31 17:52:19 +0200 (Mon, 31 Mar 2014)
New Revision: 1783
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1783
Log:
refs #4483 fix locale change
Modified:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java 2014-03-31 15:36:31 UTC (rev 1782)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java 2014-03-31 15:52:19 UTC (rev 1783)
@@ -58,16 +58,20 @@
Locale locale = (Locale) map.get(ActionContext.LOCALE);
Preconditions.checkNotNull(locale, "No locale found in ActionContext");
- try {
- parsedValue = WaoUtils.parseMonth(locale, string);
- } catch (ParseException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not format parse date " + string, e);
+
+ parsedValue = parseDate(locale, string, strings, true);
+
+ if (parsedValue == null) {
+
+ //FIXME If action is changing language, then date are not in good format
+ //FIXME Let's try why other locale...
+ if (Locale.FRENCH.equals(locale)) {
+ locale = Locale.ENGLISH;
+ } else {
+ locale = Locale.FRENCH;
}
- //FIXME Find out why we don't see the error
- throw new TypeConversionException("strings=" + Arrays.toString(strings));
+ parsedValue = parseDate(locale, string, strings, false);
}
-
}
return parsedValue;
@@ -75,7 +79,22 @@
} else {
throw new TypeConversionException("strings=" + Arrays.toString(strings));
}
+ }
+ protected Date parseDate(Locale locale, String string, String[] strings, boolean swallonError) {
+ Preconditions.checkNotNull(locale);
+ try {
+ return WaoUtils.parseMonth(locale, string);
+ } catch (ParseException e) {
+ if (swallonError) {
+ return null;
+ }
+ //FIXME See why we don't see the error
+ if (log.isErrorEnabled()) {
+ log.error("Could not format parse date " + string, e);
+ }
+ throw new TypeConversionException("strings=" + Arrays.toString(strings));
+ }
}
@Override
1
0
r1782 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-persistence/src/main/resources/i18n wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web wao-web/src/main/java/fr/ifremer/wao/web/action wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer wao-web/src/main/webapp/WEB-INF/decorators
by tchemit@users.forge.codelutin.com 31 Mar '14
by tchemit@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: tchemit
Date: 2014-03-31 17:36:31 +0200 (Mon, 31 Mar 2014)
New Revision: 1782
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1782
Log:
refs #4483 fix I18n + date month parser - format
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -32,8 +32,11 @@
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.regex.Pattern;
+import static org.nuiton.i18n.I18n.l;
+
public class WaoUtils {
protected static final String MONTH_PATTERN = "MM/yyyy";
@@ -65,8 +68,13 @@
return dateFormat.format(date);
}
- public static Date parseMonth(String monthYear) throws ParseException {
- DateFormat dateFormat = new SimpleDateFormat(MONTH_PATTERN);
+ public static String formatMonth(Locale locale, Date date) {
+ return l(locale, "wao.month.formatter", date);
+ }
+
+ public static Date parseMonth(Locale locale, String monthYear) throws ParseException {
+ String pattern = l(locale, "wao.month.pattern");
+ DateFormat dateFormat = new SimpleDateFormat(pattern);
return dateFormat.parse(monthYear);
}
@@ -82,15 +90,6 @@
return ordinals;
}
- //TODO use I18n
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
-
- public static boolean isCurrentMonth(Date month) {
- String currentStr = dateFormat.format(new Date());
- String monthStr = dateFormat.format(month);
- return currentStr.equals(monthStr);
- }
-
public static Date getEndOfMonth(Date month) {
return DateUtils.addMilliseconds(
DateUtils.addMonths(month, 1), -1);
Modified: trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-03-31 15:36:31 UTC (rev 1782)
@@ -138,3 +138,5 @@
fr.ifremer.wao.entity.TerrestrialDivision=Terrestrial divisions
fr.ifremer.wao.entity.TerrestrialLocation=Terrestrial locations
wao.business.other=
+wao.month.formatter=%1$tm-%1$tY
+wao.month.pattern=MM-yyyy
Modified: trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-persistence/src/main/resources/i18n/wao-persistence_fr_FR.properties 2014-03-31 15:36:31 UTC (rev 1782)
@@ -137,3 +137,5 @@
fr.ifremer.wao.entity.TerrestrialDivision=Stratification géographique
fr.ifremer.wao.entity.TerrestrialLocation=Lieux terrestres
wao.business.other=
+wao.month.formatter=%1$tm/%1$tY
+wao.month.pattern=MM/yyyy
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -21,7 +21,6 @@
* #L%
*/
-import com.google.common.collect.Range;
import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingZone;
@@ -30,7 +29,6 @@
import fr.ifremer.wao.entity.SampleRowLog;
import fr.ifremer.wao.entity.TerrestrialLocation;
import org.apache.commons.collections4.CollectionUtils;
-import org.nuiton.util.DateUtil;
import java.io.Serializable;
import java.text.NumberFormat;
@@ -39,8 +37,11 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import static org.nuiton.i18n.I18n.l;
+
public class ObsMerSamplingPlan implements Iterable<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart>, Serializable {
private static final long serialVersionUID = 1L;
@@ -342,16 +343,22 @@
protected Date latestSampleLogCreateDate;
/**
- * Sample month range (from the first sample month to the last one).
+ * First sample month date.
*/
- protected Range<Date> sampleRowMonthPeriod;
+ protected Date firstSampleMonthDate;
/**
+ * Last sample month date.
+ */
+ protected Date lastSampleMonthDate;
+
+ /**
* Last sample month end of month.
*/
protected Date lastSampleMonthEndOfMonth;
- public ObsMerSamplingPlanSampleRowPart(Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth,
+ public ObsMerSamplingPlanSampleRowPart(Locale locale,
+ Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth,
SampleRow sampleRow,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
@@ -409,9 +416,9 @@
dcf5CodesAndDescriptions = new LinkedHashMap<>();
for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
String key = dcf5Code.getCode();
- String description = dcf5Code.getFishingGearCode() + " - " + dcf5Code.getFishingGearDCF().getI18nKey();
+ String description = dcf5Code.getFishingGearCode() + " - " + l(locale, dcf5Code.getFishingGearDCF().getI18nKey());
if (dcf5Code.getTargetSpeciesCode() != null) {
- description += " ; " + dcf5Code.getTargetSpeciesCode() + " - " + dcf5Code.getTargetSpeciesDCF().getI18nKey();
+ description += " ; " + dcf5Code.getTargetSpeciesCode() + " - " + l(locale, dcf5Code.getTargetSpeciesDCF().getI18nKey());
}
dcf5CodesAndDescriptions.put(key, description);
}
@@ -440,11 +447,10 @@
// compute sampleRowPeriod
List<SampleMonth> sampleMonth = sampleRow.getSampleMonth();
- Date dateFrom = sampleMonth.get(0).getPeriodDate();
- Date dateTo = sampleMonth.get(sampleMonth.size() - 1).getPeriodDate();
- sampleRowMonthPeriod = Range.closed(dateFrom, dateTo);
+ firstSampleMonthDate = sampleMonth.get(0).getPeriodDate();
+ lastSampleMonthDate = sampleMonth.get(sampleMonth.size() - 1).getPeriodDate();
- lastSampleMonthEndOfMonth = WaoUtils.getEndOfMonth(dateTo);
+ lastSampleMonthEndOfMonth = WaoUtils.getEndOfMonth(lastSampleMonthDate);
}
public String getSamplingStrategy() {
@@ -455,10 +461,22 @@
return sampleRowId;
}
- public Range<Date> getSampleRowMonthPeriod() {
- return sampleRowMonthPeriod;
+ public Date getLatestSampleLogCreateDate() {
+ return latestSampleLogCreateDate;
}
+ public Date getFirstSampleMonthDate() {
+ return firstSampleMonthDate;
+ }
+
+ public Date getLastSampleMonthDate() {
+ return lastSampleMonthDate;
+ }
+
+ public Date getLastSampleMonthEndOfMonth() {
+ return lastSampleMonthEndOfMonth;
+ }
+
public int getNbObservants() {
return nbObservants;
}
@@ -600,27 +618,17 @@
return observationTimesInDaysEstimated;
}
- public boolean hasNbTidesReal(Date month) {
- Date current = new Date();
- boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
- return validMonth && getNbTidesReal(month) != null;
- }
-
- public boolean hasNbTidesEstimated(Date month) {
- Date current = new Date();
- boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
- return validMonth && getNbTidesEstimated(month) != null;
- }
-
- public boolean isRecentlyUpdated() {
- boolean isRecentlyUpdated = DateUtil.getDifferenceInDays(latestSampleLogCreateDate, new Date()) <= 2 * 7;
- return isRecentlyUpdated;
- }
-
- public boolean isNewContactCreatable() {
- boolean isNewContactCreatable = new Date().before(lastSampleMonthEndOfMonth);
- return isNewContactCreatable;
- }
+// public boolean hasNbTidesReal(Date month) {
+// Date current = new Date();
+// boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
+// return validMonth && getNbTidesReal(month) != null;
+// }
+//
+// public boolean hasNbTidesEstimated(Date month) {
+// Date current = new Date();
+// boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
+// return validMonth && getNbTidesEstimated(month) != null;
+// }
}
public static class ObsMerSamplingPlanStatistics implements Serializable {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -133,7 +133,8 @@
*/
protected Map<Date, MutableInt> totalRealForMonths;
- public ObsMerSamplingPlanBuilder(Locale locale, SampleRowsFilter sampleRowsFilter) {
+ public ObsMerSamplingPlanBuilder(Locale locale,
+ SampleRowsFilter sampleRowsFilter) {
this.sampleRowsFilter = sampleRowsFilter;
this.sampleRowsFilterValues = new SampleRowsFilterValues(locale);
this.facadeMap = new TreeMap<>();
@@ -173,7 +174,8 @@
Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> nbTidesPerMonth = computeNbTidesPerMonth(sampleRow);
// add sample row
- sectorPart.addSampleRow(sampleRow,
+ sectorPart.addSampleRow(sampleRowsFilterValues.getLocale(),
+ sampleRow,
nbTidesPerMonth,
observationTimesInDaysExpected,
observationTimesInDaysReal,
@@ -324,14 +326,16 @@
this.rows = new ArrayList<>();
}
- protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row,
+ protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(Locale locale,
+ SampleRow row,
Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> nbTidesPerMonth,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
Long observationTimesInDaysEstimated) {
ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart rowPart =
- new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(nbTidesPerMonth,
+ new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(locale,
+ nbTidesPerMonth,
row,
observationTimesInDaysExpected,
observationTimesInDaysReal,
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -21,6 +21,7 @@
* #L%
*/
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.services.AuthenticatedWaoUser;
@@ -63,7 +64,7 @@
}
public String formatMonth(Date date) {
- return t("wao.ui.misc.month", date);
+ return WaoUtils.formatMonth(getLocale(), date);
}
public boolean isGoogleAnalyticsEnabled() {
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/MonthConverter.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -21,18 +21,26 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.conversion.TypeConversionException;
import fr.ifremer.wao.WaoUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.struts2.util.StrutsTypeConverter;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
public class MonthConverter extends StrutsTypeConverter {
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(MonthConverter.class);
+
@Override
public Date convertFromString(Map map, String[] strings, Class aClass) {
@@ -48,9 +56,15 @@
} else {
+ Locale locale = (Locale) map.get(ActionContext.LOCALE);
+ Preconditions.checkNotNull(locale, "No locale found in ActionContext");
try {
- parsedValue = WaoUtils.parseMonth(string);
+ parsedValue = WaoUtils.parseMonth(locale, string);
} catch (ParseException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not format parse date " + string, e);
+ }
+ //FIXME Find out why we don't see the error
throw new TypeConversionException("strings=" + Arrays.toString(strings));
}
@@ -79,8 +93,9 @@
Date date = (Date) o;
- str = WaoUtils.formatMonth(date);
-
+ Locale locale = (Locale) map.get(ActionContext.LOCALE);
+ Preconditions.checkNotNull(locale, "No locale found in ActionContext");
+ str = WaoUtils.formatMonth(locale, date);
} else {
throw new UnsupportedOperationException("cannot convert to month " + o);
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-31 15:36:31 UTC (rev 1782)
@@ -27,7 +27,11 @@
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.services.service.SampleRowsFilterValues;
import fr.ifremer.wao.web.WaoJspActionSupport;
+import org.apache.commons.lang3.time.DateUtils;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
public class SamplingPlanAction extends WaoJspActionSupport implements Preparable {
private static final long serialVersionUID = 1L;
@@ -38,6 +42,8 @@
protected ObsMerSamplingPlan samplingPlan;
+ private Date now;
+
public void setService(ObsMerSamplingPlanService service) {
this.service = service;
}
@@ -52,6 +58,7 @@
@Override
public void prepare() {
+ now = new Date();
filter = service.newSampleRowsFilter(getAuthenticatedWaoUser());
}
@@ -81,4 +88,23 @@
boolean fullView = getAuthenticatedWaoUser().isAdmin() || getAuthenticatedWaoUser().isProfessional();
return fullView;
}
+
+ protected SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+
+ public boolean isCurrentMonth(Date month) {
+
+ String currentStr = dateFormat.format(now);
+ String monthStr = dateFormat.format(month);
+ return currentStr.equals(monthStr);
+ }
+
+ public String getFilterPeriodFromPlaceholder() {
+ String placeholder = formatMonth(DateUtils.addMonths(now, 1));
+ return placeholder;
+ }
+
+ public String getFilterPeriodToPlaceholder() {
+ String placeholder = formatMonth(DateUtils.addYears(now, 1));
+ return placeholder;
+ }
}
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-31 15:36:31 UTC (rev 1782)
@@ -80,6 +80,7 @@
wao.ui.action.viewIndicatorsHistory=View indicators historic
wao.ui.action.viewReal=View real observation effort
wao.ui.action.viewSampleRowLog=View sample row log
+wao.ui.action.zoomOnSampleRowPeriod=Use as filter dates the one of this sample row
wao.ui.actions=Actions
wao.ui.boatList=List of %s boats
wao.ui.boatinfo.title=Infos about %s
@@ -344,7 +345,6 @@
wao.ui.misc.information=Information
wao.ui.misc.infosAbout=Infos about %s
wao.ui.misc.logFile.description=Show log file for %s
-wao.ui.misc.month=%1$tm-%1$tY
wao.ui.misc.no=no
wao.ui.misc.noComment=no comment
wao.ui.misc.notValidated=Not validated
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-31 15:36:31 UTC (rev 1782)
@@ -80,6 +80,7 @@
wao.ui.action.viewIndicatorsHistory=Voir l'historique des modifications des indicateurs
wao.ui.action.viewReal=Voir l'effort d'observation réalisé
wao.ui.action.viewSampleRowLog=Consulter l'historique de cette ligne
+wao.ui.action.zoomOnSampleRowPeriod=Changer les dates de la période par rapport à celles de la ligne
wao.ui.actions=Actions
wao.ui.boatList=Liste de %s navires
wao.ui.boatinfo.title=Informations sur %s
@@ -344,7 +345,6 @@
wao.ui.misc.information=Informations
wao.ui.misc.infosAbout=Informations sur %s
wao.ui.misc.logFile.description=Afficher le fichier de log de %s
-wao.ui.misc.month=%1$tm/%1$tY
wao.ui.misc.no=Non
wao.ui.misc.noComment=aucun commentaire
wao.ui.misc.notValidated=Non validé
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:36:31 UTC (rev 1782)
@@ -37,8 +37,6 @@
var sampleRowsFilterController = new SampleRowsFilterController(SAMPLE_ROWS_FILTER_VALUES_JSON_URL, $('#sampling-plan-filters-form'));
sampleRowsFilterController.init();
- var fullView = <s:property value="fullView" />;
-
$('#switch-estimated-real').click(function () {
$('#switch-estimated-real').toggleClass('show-estimated').toggleClass('show-real');
$('table.sampling-plan').toggleClass('show-estimated').toggleClass('show-real');
@@ -64,12 +62,12 @@
<s:textfield name="filter.periodFrom"
label="%{getText('wao.ui.form.periodFrom')}"
- placeholder="04/2014"
+ placeholder="%{getFilterPeriodFromPlaceholder()}"
cssClass="input-small" />
<s:textfield name="filter.periodTo"
label="%{getText('wao.ui.form.period.to')}"
- placeholder="03/2015"
+ placeholder="%{getFilterPeriodToPlaceholder()}"
cssClass="input-small" />
</fieldset>
@@ -253,7 +251,7 @@
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
- <th class="effort <s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> now</s:if>">
+ <th class="effort <s:if test="isCurrentMonth(#month)"> now</s:if>">
<s:property value="%{formatMonth(#month)}"/>
</th>
</s:iterator>
@@ -353,7 +351,7 @@
<s:set var="expected" value="%{getNbTidesExpected(#month)}"/>
<s:set var="estimated" value="%{getNbTidesEstimated(#month)}"/>
<s:set var="real" value="%{getNbTidesReal(#month)}"/>
- <td class="effort <s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> now</s:if><s:if test="#estimated != #real"> estimated-differ-from-real</s:if>">
+ <td class="effort <s:if test="isCurrentMonth(#month)"> now</s:if><s:if test="#estimated != #real"> estimated-differ-from-real</s:if>">
<s:if test="#expected != null">
<s:if test="authenticatedWaoUser.authorizedToViewSamplingPlanReal">
<span class="estimated<s:if test="#estimated < #expected"> lower-than-expected</s:if><s:if test="#estimated > #expected"> higher-than-expected</s:if>">
@@ -434,7 +432,7 @@
</li>
<li>
<s:url action="delete-sample-row" id="deleteSampleRowUrl">
- <s:param name="companyId" value="sampleRowId" />
+ <s:param name="sampleRowId" value="sampleRowId" />
</s:url>
<s:a href="%{deleteSampleRowUrl}">
<i class="icon-trash"></i> <s:text name="wao.ui.action.delete" />
@@ -450,6 +448,22 @@
</s:a>
</li>
<li>
+ <s:url action="sampling-plan" id="sampleRowZoomUrl">
+ <s:param name="filter.periodFrom" value="%{formatMonth(firstSampleMonthDate)}"/>
+ <s:param name="filter.periodTo" value="%{formatMonth(lastSampleMonthDate)}"/>
+ <s:param name="filter.companyIds" value="%{filter.companyIds}"/>
+ <s:param name="filter.programNames" value="%{filter.programNames}"/>
+ <s:param name="filter.sampleRowCodes" value="%{filter.sampleRowCodes}"/>
+ <s:param name="filter.fishingZoneFacadeNames" value="%{filter.targetSpeciesDcfIds}"/>
+ <s:param name="filter.fishingZoneSectorNames" value="%{filter.targetSpeciesDcfIds}"/>
+ <s:param name="filter.fishingGearDcfIds" value="%{filter.targetSpeciesDcfIds}"/>
+ <s:param name="filter.targetSpeciesDcfIds" value="%{filter.targetSpeciesDcfIds}"/>
+ </s:url>
+ <s:a href="%{sampleRowZoomUrl}">
+ <!--i class="icon-time"></i--> <s:text name="wao.ui.action.zoomOnSampleRowPeriod" />
+ </s:a>
+ </li>
+ <li>
<s:url action="boats" id="viewElligibleBoatsUrl">
<s:param name="sampleRowIds" value="sampleRowId" />
</s:url>
@@ -496,7 +510,7 @@
</th>
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
- <td class="effort<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> now</s:if>">
+ <td class="effort<s:if test="isCurrentMonth(#month)"> now</s:if>">
<s:set var="expected" value="%{samplingPlan.getTotalExpected(#month)}"/>
<s:set var="estimated" value="%{samplingPlan.getTotalEstimated(#month)}"/>
<s:set var="real" value="%{samplingPlan.getTotalReal(#month)}"/>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 15:20:49 UTC (rev 1781)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 15:36:31 UTC (rev 1782)
@@ -131,7 +131,7 @@
</a>
<ul class="dropdown-menu">
<li>
- <s:url id="changeLocaleUrl">
+ <s:url id="changeLocaleUrl" includeParams="get">
<s:param name="request_locale">
<s:if test="\"fr\".equals(locale.toLanguageTag())">
en
1
0
r1781 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 31 Mar '14
by bleny@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: bleny
Date: 2014-03-31 17:20:49 +0200 (Mon, 31 Mar 2014)
New Revision: 1781
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1781
Log:
refs #4483 show link to create contact only when it's possible: fix icon
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:17:20 UTC (rev 1780)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:20:49 UTC (rev 1781)
@@ -471,7 +471,7 @@
<s:param name="sampleRowIds" value="sampleRowId" />
</s:url>
<s:a href="%{createAssociatedContactUrl}">
- <i class="icon-add"></i> <s:text name="wao.ui.action.createAssociatedContact" />
+ <i class="icon-plus"></i> <s:text name="wao.ui.action.createAssociatedContact" />
</s:a>
</li>
</s:if>
1
0
r1780 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 31 Mar '14
by bleny@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: bleny
Date: 2014-03-31 17:17:20 +0200 (Mon, 31 Mar 2014)
New Revision: 1780
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1780
Log:
refs #4483 show link to create contact only when it's possible
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:11:56 UTC (rev 1779)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:17:20 UTC (rev 1780)
@@ -465,7 +465,7 @@
<s:text name="wao.ui.action.viewAssociatedContacts" />
</s:a>
</li>
- <s:if test="authenticatedWaoUser.authorizedToCreateContact && isNewContactCreatable">
+ <s:if test="authenticatedWaoUser.authorizedToCreateContact && newContactCreatable">
<li>
<s:url action="contacts" id="createAssociatedContactUrl">
<s:param name="sampleRowIds" value="sampleRowId" />
1
0
r1779 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/resources/i18n wao-web/src/main/webapp wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 31 Mar '14
by bleny@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: bleny
Date: 2014-03-31 17:11:56 +0200 (Mon, 31 Mar 2014)
New Revision: 1779
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1779
Log:
refs #4483 highligh recently modified sample row allow user to change company in filters only if authorized
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/wao.css
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-03-31 15:11:56 UTC (rev 1779)
@@ -216,4 +216,8 @@
return ! userProfile.isGuest();
}
+ public boolean isAuthorizedToViewOtherCompanies() {
+ return ! userProfile.isCoordinatorOrObserver();
+ }
+
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 15:11:56 UTC (rev 1779)
@@ -30,6 +30,7 @@
import fr.ifremer.wao.entity.SampleRowLog;
import fr.ifremer.wao.entity.TerrestrialLocation;
import org.apache.commons.collections4.CollectionUtils;
+import org.nuiton.util.DateUtil;
import java.io.Serializable;
import java.text.NumberFormat;
@@ -454,18 +455,10 @@
return sampleRowId;
}
- public Date getLatestSampleLogCreateDate() {
- return latestSampleLogCreateDate;
- }
-
public Range<Date> getSampleRowMonthPeriod() {
return sampleRowMonthPeriod;
}
- public Date getLastSampleMonthEndOfMonth() {
- return lastSampleMonthEndOfMonth;
- }
-
public int getNbObservants() {
return nbObservants;
}
@@ -618,6 +611,16 @@
boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
return validMonth && getNbTidesEstimated(month) != null;
}
+
+ public boolean isRecentlyUpdated() {
+ boolean isRecentlyUpdated = DateUtil.getDifferenceInDays(latestSampleLogCreateDate, new Date()) <= 2 * 7;
+ return isRecentlyUpdated;
+ }
+
+ public boolean isNewContactCreatable() {
+ boolean isNewContactCreatable = new Date().before(lastSampleMonthEndOfMonth);
+ return isNewContactCreatable;
+ }
}
public static class ObsMerSamplingPlanStatistics implements Serializable {
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-31 15:11:56 UTC (rev 1779)
@@ -357,6 +357,7 @@
wao.ui.misc.other=Other
wao.ui.misc.otherInfos=Others information
wao.ui.misc.others=Others
+wao.ui.misc.recentUpdate=Recent update
wao.ui.misc.refused=Refused
wao.ui.misc.since=since
wao.ui.misc.total=Total
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-31 15:11:56 UTC (rev 1779)
@@ -357,6 +357,7 @@
wao.ui.misc.other=Autre
wao.ui.misc.otherInfos=Autre information
wao.ui.misc.others=Autres
+wao.ui.misc.recentUpdate=MàJ récente
wao.ui.misc.refused=Réfusé
wao.ui.misc.since=depuis le
wao.ui.misc.total=Total
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 15:11:56 UTC (rev 1779)
@@ -76,14 +76,18 @@
<fieldset>
- <s:select name="filter.companyIds"
- label="%{getText('wao.ui.entity.Company')}"
- list="filterValues.companies"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="companies" />
+ <s:if test="authenticatedWaoUser.authorizedToViewOtherCompanies">
+ <s:select name="filter.companyIds"
+ label="%{getText('wao.ui.entity.Company')}"
+ list="filterValues.companies"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="companies" />
+
+ </s:if>
+
<s:select name="filter.programNames"
label="%{getText('wao.ui.field.SampleRow.programName')}"
list="filterValues.programNames"
@@ -186,7 +190,12 @@
<s:set var="fullView" value="%{fullView}" />
<s:set var="displayTidesReal" value="true" />
-<s:set var="nbColumnsForProfessionInFullView" value="13" />
+<s:if test="authenticatedWaoUser.authorizedToViewOtherCompanies">
+ <s:set var="nbColumnsForProfessionInFullView" value="13" />
+</s:if>
+<s:else>
+ <s:set var="nbColumnsForProfessionInFullView" value="12" />
+</s:else>
<s:set var="nbColumnsForProfessionInCompactView" value="5" />
<s:set var="nbColumnsForMonths" value="%{samplingPlan.months.size() + 1}" />
<s:set var="nbColumnsForOther" value="6" />
@@ -224,7 +233,11 @@
<!-- Profession columns -->
<th><s:text name="wao.ui.field.SampleRow.code"/></th>
<th><s:text name="wao.ui.samplingPlan.program"/></th>
- <th class="only-in-full-view"><s:text name="wao.ui.entity.Company"/></th>
+ <s:if test="authenticatedWaoUser.authorizedToViewOtherCompanies">
+ <th class="only-in-full-view">
+ <s:text name="wao.ui.entity.Company"/>
+ </th>
+ </s:if>
<th><s:text name="wao.ui.entity.FishingZone"/></th>
<th class="only-in-full-view"><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></th>
<th class="only-in-full-view"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dcf5Code"/></th>
@@ -289,19 +302,32 @@
</tr>
<%--Iterate on SampleRows --%>
<s:iterator value="samplingPlanSector" var="samplingPlanRow">
- <tr class="sample-row-row<s:if test="sampleRowToHighlightId.equals(topiaId)"> highlight</s:if>">
+ <tr class="sample-row-row<s:if test="sampleRowId.equals(sampleRowToHighlightId)"> highlight</s:if>">
<th>
<s:property value="code" />
+ <s:if test="recentlyUpdated">
+ <span class="label label-important">
+ <s:text name="wao.ui.misc.recentUpdate" />
+ </span>
+ </s:if>
</th>
<td><s:property value="programName" /></td>
- <td class="only-in-full-view"><s:property value="companyName" /></td>
+ <s:if test="authenticatedWaoUser.authorizedToViewOtherCompanies">
+ <td class="only-in-full-view">
+ <s:property value="companyName" />
+ </td>
+ </s:if>
<td class="only-in-full-view"><s:property value="fishingZones" /></td>
<td class="only-in-compact-view">
<s:property value="fishingZones" />
- (<s:property value="fishingZonesInfos" />)
+ <s:if test=" ! fishingZonesInfos.empty">
+ (<s:property value="fishingZonesInfos" />)
+ </s:if>
</td>
- <td class="only-in-full-view"><s:property value="fishingZonesInfos" /></td>
<td class="only-in-full-view">
+ <s:property value="fishingZonesInfos" />
+ </td>
+ <td class="only-in-full-view">
<s:iterator value="dcf5CodesAndDescriptions">
<abbr title="<s:property value="value"/>"><s:property value="key"/></abbr>
</s:iterator>
@@ -348,7 +374,7 @@
<s:property value="totalTidesEstimated" />
</span>
<span class="real<s:if test="totalTidesReal < totalTidesExpected"> lower-than-expected</s:if><s:if test="totalTidesReal > totalTidesExpected"> higher-than-expected</s:if>">
- <s:property value="totalTidesReal" /> (Total sur la période du ... au ...)
+ <s:property value="totalTidesReal" />
</span>
/
</s:if>
@@ -439,7 +465,7 @@
<s:text name="wao.ui.action.viewAssociatedContacts" />
</s:a>
</li>
- <s:if test="authenticatedWaoUser.authorizedToCreateContact">
+ <s:if test="authenticatedWaoUser.authorizedToCreateContact && isNewContactCreatable">
<li>
<s:url action="contacts" id="createAssociatedContactUrl">
<s:param name="sampleRowIds" value="sampleRowId" />
Modified: trunk/wao-web/src/main/webapp/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css 2014-03-31 13:27:37 UTC (rev 1778)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-03-31 15:11:56 UTC (rev 1779)
@@ -243,6 +243,10 @@
background-color: #e6e6e6;
}
+table.sampling-plan tbody tr.sample-row-row.highlight {
+ background-color: #ffff99;
+}
+
table.sampling-plan tbody tr.sample-row-row:hover {
background-color: tan;
background-color: antiquewhite;
1
0
r1778 - trunk/wao-persistence/src/main/java/fr/ifremer/wao
by tchemit@users.forge.codelutin.com 31 Mar '14
by tchemit@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: tchemit
Date: 2014-03-31 15:27:37 +0200 (Mon, 31 Mar 2014)
New Revision: 1778
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1778
Log:
fix WaoUtils dates
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 13:14:09 UTC (rev 1777)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 13:27:37 UTC (rev 1778)
@@ -82,6 +82,7 @@
return ordinals;
}
+ //TODO use I18n
protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
public static boolean isCurrentMonth(Date month) {
@@ -90,8 +91,9 @@
return currentStr.equals(monthStr);
}
- public static Date getEndOfMonth(Date month) {
- return DateUtils.addMilliseconds(DateUtils.setMonths(month, 1), -1);
+ public static Date getEndOfMonth(Date month) {
+ return DateUtils.addMilliseconds(
+ DateUtils.addMonths(month, 1), -1);
}
/**
1
0
r1777 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer
by tchemit@users.forge.codelutin.com 31 Mar '14
by tchemit@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: tchemit
Date: 2014-03-31 15:14:09 +0200 (Mon, 31 Mar 2014)
New Revision: 1777
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1777
Log:
refs #4483 add I18n on filters + new dates on SampleRowPart + fix contacts filter dateTo
Removed:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/FilterOption.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -23,6 +23,7 @@
import fr.ifremer.wao.entity.ObsProgram;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.time.DateUtils;
import java.text.DateFormat;
import java.text.ParseException;
@@ -89,6 +90,10 @@
return currentStr.equals(monthStr);
}
+ public static Date getEndOfMonth(Date month) {
+ return DateUtils.addMilliseconds(DateUtils.setMonths(month, 1), -1);
+ }
+
/**
* Wrapper on {@link org.apache.commons.collections4.CollectionUtils#isEqualCollection(java.util.Collection, java.util.Collection)}
* that handles null values.
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/FilterOption.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/FilterOption.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/FilterOption.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -3,8 +3,12 @@
import com.google.common.collect.Ordering;
import fr.ifremer.wao.entity.I18nAble;
-public class FilterOption implements Comparable<FilterOption> {
+import java.io.Serializable;
+public class FilterOption implements Comparable<FilterOption>, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
protected String value;
protected String label;
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -21,10 +21,13 @@
* #L%
*/
+import com.google.common.collect.Range;
import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingZone;
+import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SampleRowLog;
import fr.ifremer.wao.entity.TerrestrialLocation;
import org.apache.commons.collections4.CollectionUtils;
@@ -35,7 +38,6 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
public class ObsMerSamplingPlan implements Iterable<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart>, Serializable {
@@ -43,11 +45,6 @@
private static final long serialVersionUID = 1L;
/**
- * Locale used by this sampling plan. Need to be here as part of future cache index.
- */
- protected Locale locale;
-
- /**
* All facades of the sampling plan.
*/
protected Collection<ObsMerSamplingPlanFacadePart> facades;
@@ -64,21 +61,21 @@
/**
* Total of observation times in days expected.
- *
+ * <p/>
* <strong>Note:</strong> can be null.
*/
protected Double observationTimesInDaysTotalExpected;
/**
* Total of observation times in days real.
- *
+ * <p/>
* <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysTotalReal;
/**
* Total of observation times in days estimated.
- *
+ * <p/>
* <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysTotalEstimated;
@@ -88,6 +85,9 @@
*/
protected List<Date> months;
+ /**
+ * Universe of filter values.
+ */
protected SampleRowsFilterValues filterValues;
public ObsMerSamplingPlan(List<Date> months,
@@ -335,6 +335,21 @@
protected String sampleRowId;
+ /**
+ * Date of the latest sample log.
+ */
+ protected Date latestSampleLogCreateDate;
+
+ /**
+ * Sample month range (from the first sample month to the last one).
+ */
+ protected Range<Date> sampleRowMonthPeriod;
+
+ /**
+ * Last sample month end of month.
+ */
+ protected Date lastSampleMonthEndOfMonth;
+
public ObsMerSamplingPlanSampleRowPart(Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth,
SampleRow sampleRow,
Double observationTimesInDaysExpected,
@@ -411,6 +426,24 @@
professionDescriptionWithoutDCF5 = sampleRow.getProfessionDescriptionWithoutDCF5();
samplingStrategy = "";//TODO sampleRow.getSamplingStrategy().getI18nKey();
sampleRowId = sampleRow.getTopiaId();
+
+ // compute lastSampleLogCreateDate
+ if (sampleRow.isSampleRowLogNotEmpty()) {
+ for (SampleRowLog sampleRowLog : sampleRow.getSampleRowLog()) {
+ if (latestSampleLogCreateDate == null ||
+ sampleRowLog.getCreateDate().after(latestSampleLogCreateDate)) {
+ latestSampleLogCreateDate = sampleRowLog.getCreateDate();
+ }
+ }
+ }
+
+ // compute sampleRowPeriod
+ List<SampleMonth> sampleMonth = sampleRow.getSampleMonth();
+ Date dateFrom = sampleMonth.get(0).getPeriodDate();
+ Date dateTo = sampleMonth.get(sampleMonth.size() - 1).getPeriodDate();
+ sampleRowMonthPeriod = Range.closed(dateFrom, dateTo);
+
+ lastSampleMonthEndOfMonth = WaoUtils.getEndOfMonth(dateTo);
}
public String getSamplingStrategy() {
@@ -421,6 +454,18 @@
return sampleRowId;
}
+ public Date getLatestSampleLogCreateDate() {
+ return latestSampleLogCreateDate;
+ }
+
+ public Range<Date> getSampleRowMonthPeriod() {
+ return sampleRowMonthPeriod;
+ }
+
+ public Date getLastSampleMonthEndOfMonth() {
+ return lastSampleMonthEndOfMonth;
+ }
+
public int getNbObservants() {
return nbObservants;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -35,6 +35,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
@@ -72,21 +73,21 @@
/**
* To compute the high total expected.
*
- * @see ObsMerSamplingPlan#highTotalExpected
+ * @see ObsMerSamplingPlan#highTotals
*/
protected int highTotalExpected;
/**
* To compute the high total real.
*
- * @see ObsMerSamplingPlan#highTotalReal
+ * @see ObsMerSamplingPlan#highTotals
*/
protected int highTotalReal;
/**
* To compute the high total estimated.
*
- * @see ObsMerSamplingPlan#highTotalEstimated
+ * @see ObsMerSamplingPlan#highTotals
*/
protected int highTotalEstimated;
@@ -132,9 +133,9 @@
*/
protected Map<Date, MutableInt> totalRealForMonths;
- public ObsMerSamplingPlanBuilder(SampleRowsFilter sampleRowsFilter) {
+ public ObsMerSamplingPlanBuilder(Locale locale, SampleRowsFilter sampleRowsFilter) {
this.sampleRowsFilter = sampleRowsFilter;
- this.sampleRowsFilterValues = new SampleRowsFilterValues();
+ this.sampleRowsFilterValues = new SampleRowsFilterValues(locale);
this.facadeMap = new TreeMap<>();
this.observationTimesInDaysTotalExpected = new MutableDouble();
this.observationTimesInDaysTotalReal = new MutableLong();
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -33,6 +33,7 @@
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.WaoTechnicalException;
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Boats;
import fr.ifremer.wao.entity.Company;
@@ -380,10 +381,13 @@
List<SampleRow> sampleRows = dao.findAll(sampleRowsFilter);
// creation du plan d'echantillonnage
- ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(sampleRowsFilter);
+ ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(serviceContext.getLocale(),
+ sampleRowsFilter);
+ // begin of month
Date periodFrom = sampleRowsFilter.getPeriodFrom();
- Date periodTo = sampleRowsFilter.getPeriodTo();
+ // end of month
+ Date periodTo = WaoUtils.getEndOfMonth(sampleRowsFilter.getPeriodTo());
for (SampleRow sampleRow : sampleRows) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -1,14 +1,19 @@
package fr.ifremer.wao.services.service;
import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.FishingGearDCF;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.TargetSpeciesDCF;
import fr.ifremer.wao.entity.TerrestrialLocation;
import java.io.Serializable;
+import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
+import static org.nuiton.i18n.I18n.l;
+
/**
* Bean to hold all values that user can select to fill {@link fr.ifremer.wao.SampleRowsFilter}.
*/
@@ -16,6 +21,11 @@
private static final long serialVersionUID = 1L;
+ /**
+ * Locale used by this sampling plan. Need to be here as part of future cache index.
+ */
+ protected Locale locale;
+
protected SortedSet<FilterOption> fishingZoneFacadeNames = new TreeSet<>();
protected SortedSet<FilterOption> fishingZoneSectorNames = new TreeSet<>();
@@ -36,6 +46,10 @@
/** Values are the code and the label i18n key. */
protected SortedSet<FilterOption> targetSpeciesDcfs = new TreeSet<>();
+ public SampleRowsFilterValues(Locale locale) {
+ this.locale=locale;
+ }
+
public void addSampleRow(SampleRow sampleRow) {
for (FishingZone fishingZone : sampleRow.getFishingZone()) {
fishingZoneFacadeNames.add(FilterOption.forString(fishingZone.getFacadeName()));
@@ -53,15 +67,21 @@
terrestrialDistrict.getDescription()));
}
for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
+ FishingGearDCF fishingGearDCF = dcf5Code.getFishingGearDCF();
+ String fishingGearLabel = fishingGearDCF.getCode() + " - " + l(locale, fishingGearDCF.getI18nKey());
fishingGearDcfs.add(
FilterOption.forValueAndLabel(
- dcf5Code.getFishingGearDCF().getTopiaId(),
- dcf5Code.getFishingGearDCF().getI18nKey()));
- if (dcf5Code.getTargetSpeciesDCF() != null) {
+ fishingGearDCF.getTopiaId(),
+ fishingGearLabel)
+ );
+ TargetSpeciesDCF targetSpeciesDCF = dcf5Code.getTargetSpeciesDCF();
+ if (targetSpeciesDCF != null) {
+ String targetspeciesLabel = targetSpeciesDCF.getCode() + " - " + l(locale, targetSpeciesDCF.getI18nKey());
targetSpeciesDcfs.add(
FilterOption.forValueAndLabel(
- dcf5Code.getTargetSpeciesDCF().getTopiaId(),
- dcf5Code.getTargetSpeciesDCF().getI18nKey()));
+ targetSpeciesDCF.getTopiaId(),
+ targetspeciesLabel)
+ );
}
}
}
@@ -101,4 +121,8 @@
public SortedSet<FilterOption> getTargetSpeciesDcfs() {
return targetSpeciesDcfs;
}
+
+ public Locale getLocale() {
+ return locale;
+ }
}
Deleted: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -1,61 +0,0 @@
-package fr.ifremer.wao.web.action.obsmer;
-
-import fr.ifremer.wao.entity.SampleRow;
-import fr.ifremer.wao.services.WaoCacheElement;
-import fr.ifremer.wao.services.service.FilterOption;
-import fr.ifremer.wao.services.service.SampleRowsFilterValues;
-
-import java.util.Locale;
-import java.util.SortedSet;
-
-public class LocalizedSampleRowsFilterValues implements WaoCacheElement {
-
- protected Locale locale;
-
- protected SampleRowsFilterValues decorated;
-
- public LocalizedSampleRowsFilterValues(Locale locale, SampleRowsFilterValues decorated) {
- this.locale = locale;
- this.decorated = decorated;
- }
-
- public void addSampleRow(SampleRow sampleRow) {
- decorated.addSampleRow(sampleRow);
- }
-
- public SortedSet<FilterOption> getTargetSpeciesDcfs() {
- return decorated.getTargetSpeciesDcfs();
- }
-
- public SortedSet<FilterOption> getTerrestrialDistricts() {
- return decorated.getTerrestrialDistricts();
- }
-
- public SortedSet<FilterOption> getSampleRowCodes() {
- return decorated.getSampleRowCodes();
- }
-
- public SortedSet<FilterOption> getFishingZoneSectorNames() {
- return decorated.getFishingZoneSectorNames();
- }
-
- public SortedSet<FilterOption> getCompanies() {
- return decorated.getCompanies();
- }
-
- public SortedSet<FilterOption> getProgramNames() {
- return decorated.getProgramNames();
- }
-
- public SortedSet<FilterOption> getSamplingStrategies() {
- return decorated.getSamplingStrategies();
- }
-
- public SortedSet<FilterOption> getFishingZoneFacadeNames() {
- return decorated.getFishingZoneFacadeNames();
- }
-
- public SortedSet<FilterOption> getFishingGearDcfs() {
- return decorated.getFishingGearDcfs();
- }
-}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -13,9 +13,9 @@
protected transient ObsMerSamplingPlanService service;
- protected transient SampleRowsFilter filter;
+ protected SampleRowsFilter filter;
- protected LocalizedSampleRowsFilterValues filterValues;
+ protected SampleRowsFilterValues filterValues;
public void setService(ObsMerSamplingPlanService service) {
this.service = service;
@@ -40,14 +40,12 @@
ObsMerSamplingPlan samplingPlan = service.getSamplingPlan(filter);
- SampleRowsFilterValues filterValues = samplingPlan.getFilterValues();
+ filterValues = samplingPlan.getFilterValues();
- this.filterValues = new LocalizedSampleRowsFilterValues(getLocale(), filterValues);
-
return SUCCESS;
}
- public LocalizedSampleRowsFilterValues getFilterValues() {
+ public SampleRowsFilterValues getFilterValues() {
return filterValues;
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-31 12:41:30 UTC (rev 1776)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-31 13:14:09 UTC (rev 1777)
@@ -25,6 +25,7 @@
import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.services.service.ObsMerSamplingPlan;
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
+import fr.ifremer.wao.services.service.SampleRowsFilterValues;
import fr.ifremer.wao.web.WaoJspActionSupport;
public class SamplingPlanAction extends WaoJspActionSupport implements Preparable {
@@ -71,11 +72,8 @@
return getSession().getSampleRowToHighlightId();
}
- public LocalizedSampleRowsFilterValues getFilterValues() {
- LocalizedSampleRowsFilterValues filterValues =
- new LocalizedSampleRowsFilterValues(
- getLocale(),
- getSamplingPlan().getFilterValues());
+ public SampleRowsFilterValues getFilterValues() {
+ SampleRowsFilterValues filterValues = getSamplingPlan().getFilterValues();
return filterValues;
}
1
0
r1776 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-web/src/main/java/fr/ifremer/wao/web wao-web/src/main/webapp wao-web/src/main/webapp/WEB-INF/content/obsmer wao-web/src/main/webapp/WEB-INF/decorators wao-web/src/main/webapp/bootstrap-2.3.1
by bleny@users.forge.codelutin.com 31 Mar '14
by bleny@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: bleny
Date: 2014-03-31 14:41:30 +0200 (Mon, 31 Mar 2014)
New Revision: 1776
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1776
Log:
refs #4483 add bootstrap-popover review layout for dcf5 codes
Added:
trunk/wao-web/src/main/webapp/bootstrap-2.3.1/
trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-popover.js
trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-tooltip.js
trunk/wao-web/src/main/webapp/moment-js-2.5.1/
trunk/wao-web/src/main/webapp/select2-3.4.5/
trunk/wao-web/src/main/webapp/wao.css
trunk/wao-web/src/main/webapp/wao.js
Removed:
trunk/wao-web/src/main/webapp/css/
trunk/wao-web/src/main/webapp/js/
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfig.java 2014-03-31 12:41:30 UTC (rev 1776)
@@ -114,4 +114,8 @@
public File getLogConfigurationFile() {
return applicationConfig.getOptionAsFile(WaoApplicationConfigOption.LOG_CONFIGURATION_FILE.key);
}
+
+ public boolean isGoogleAnalyticsEnabled() {
+ return applicationConfig.getOptionAsBoolean(WaoApplicationConfigOption.GOOGLE_ANALYTICS_ENABLED.key);
+ }
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoApplicationConfigOption.java 2014-03-31 12:41:30 UTC (rev 1776)
@@ -59,8 +59,14 @@
"logConfigurationFile",
"Chemin vers le fichier de configuration des journaux",
null,
- String.class);
+ String.class),
+ GOOGLE_ANALYTICS_ENABLED(
+ "googleAnalyticsEnabled",
+ "S'il faut activer les statistitques Google Analytics",
+ "false",
+ Boolean.class);
+
protected final String key;
protected final String description;
protected final Class<?> type;
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-31 12:41:30 UTC (rev 1776)
@@ -66,4 +66,8 @@
return t("wao.ui.misc.month", date);
}
+ public boolean isGoogleAnalyticsEnabled() {
+ return applicationConfig.isGoogleAnalyticsEnabled();
+ }
+
}
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 12:41:30 UTC (rev 1776)
@@ -303,9 +303,7 @@
<td class="only-in-full-view"><s:property value="fishingZonesInfos" /></td>
<td class="only-in-full-view">
<s:iterator value="dcf5CodesAndDescriptions">
- <span>
- <s:property value="key"/> (<s:property value="value"/>)
- </span>
+ <abbr title="<s:property value="value"/>"><s:property value="key"/></abbr>
</s:iterator>
</td>
<td class="only-in-full-view"><s:property value="professionMeshSize" /></td>
@@ -317,9 +315,7 @@
<td class="only-in-full-view"><s:property value="%{formatMonth(periodEnd)}" /></td>
<td class="only-in-compact-view">
<s:iterator value="dcf5CodesAndDescriptions">
- <span>
- <s:property value="key"/> (<s:property value="value"/>)
- </span>
+ <abbr title="<s:property value="value"/>"><s:property value="key"/></abbr>
</s:iterator>
<s:property value="professionDescriptionWithoutDCF5" />
</td>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp 2014-03-31 12:41:30 UTC (rev 1776)
@@ -30,12 +30,9 @@
<title><decorator:title default="Wao"/> - Wao</title>
<sj:head locale="fr" jqueryui="true" loadAtOnce="true" jquerytheme="start" />
<sb:head />
- <script type="text/javascript" src="<s:url value='/js/select2/select2.min.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/select2/select2_locale_fr.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/wao.js' />"></script>
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/select2/select2.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/wao.css' />" media="all" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/wao-screen.css' />" media="screen">
+ <script type="text/javascript" src="<s:url value='/wao.js' />"></script>
+ <link rel="stylesheet" type="text/css" href="<s:url value='/wao.css' />" media="all" />
+ <link rel="stylesheet" type="text/css" href="<s:url value='/wao-screen.css' />" media="screen">
<decorator:head />
</head>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 11:12:10 UTC (rev 1775)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-31 12:41:30 UTC (rev 1776)
@@ -30,14 +30,16 @@
<title><decorator:title default="Wao"/> - Wao</title>
<sj:head locale="fr" loadFromGoogle="true" jqueryui="true" />
<sb:head />
- <script type="text/javascript" src="<s:url value='/js/moment-js-2.5.1/moment-with-langs.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/select2-3.4.5/select2.min.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/select2-3.4.5/select2_locale_fr.js' />"></script>
- <script type="text/javascript" src="<s:url value='/js/wao.js' />"></script>
- <link rel="stylesheet" type="text/css" href="<s:url value='/js/select2-3.4.5/select2.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/js/select2-3.4.5/select2-bootstrap.css' />" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/wao.css' />" media="all" />
- <link rel="stylesheet" type="text/css" href="<s:url value='/css/wao-screen.css' />" media="screen">
+ <script type="text/javascript" src="<s:url value="/moment-js-2.5.1/moment-with-langs.js" />"></script>
+ <script type="text/javascript" src="<s:url value="/select2-3.4.5/select2.min.js" />"></script>
+ <script type="text/javascript" src="<s:url value="/select2-3.4.5/select2_locale_fr.js" />"></script>
+ <script type="text/javascript" src="<s:url value="/bootstrap-2.3.1/bootstrap-tooltip.js" />"></script>
+ <script type="text/javascript" src="<s:url value="/bootstrap-2.3.1/bootstrap-popover.js" />"></script>
+ <script type="text/javascript" src="<s:url value="/wao.js" />"></script>
+ <link rel="stylesheet" type="text/css" href="<s:url value="/select2-3.4.5/select2.css" />" />
+ <link rel="stylesheet" type="text/css" href="<s:url value="/select2-3.4.5/select2-bootstrap.css" />" />
+ <link rel="stylesheet" type="text/css" href="<s:url value="/wao.css" />" media="all" />
+ <link rel="stylesheet" type="text/css" href="<s:url value="/wao-screen.css" />" media="screen">
<decorator:head />
</head>
@@ -225,5 +227,22 @@
</div>
</s:if>
+ <s:if test="googleAnalyticsEnabled">
+ <!-- Script for Google Analytics -->
+ <script>
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-12982015-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
+ </s:if>
+
</body>
</html>
Added: trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-popover.js
===================================================================
--- trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-popover.js (rev 0)
+++ trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-popover.js 2014-03-31 12:41:30 UTC (rev 1776)
@@ -0,0 +1,114 @@
+/* ===========================================================
+ * bootstrap-popover.js v2.3.1
+ * http://twitter.github.com/bootstrap/javascript.html#popovers
+ * ===========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * =========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* POPOVER PUBLIC CLASS DEFINITION
+ * =============================== */
+
+ var Popover = function (element, options) {
+ this.init('popover', element, options)
+ }
+
+
+ /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
+ ========================================== */
+
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
+
+ constructor: Popover
+
+ , setContent: function () {
+ var $tip = this.tip()
+ , title = this.getTitle()
+ , content = this.getContent()
+
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+ $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
+
+ $tip.removeClass('fade top bottom left right in')
+ }
+
+ , hasContent: function () {
+ return this.getTitle() || this.getContent()
+ }
+
+ , getContent: function () {
+ var content
+ , $e = this.$element
+ , o = this.options
+
+ content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
+ || $e.attr('data-content')
+
+ return content
+ }
+
+ , tip: function () {
+ if (!this.$tip) {
+ this.$tip = $(this.options.template)
+ }
+ return this.$tip
+ }
+
+ , destroy: function () {
+ this.hide().$element.off('.' + this.type).removeData(this.type)
+ }
+
+ })
+
+
+ /* POPOVER PLUGIN DEFINITION
+ * ======================= */
+
+ var old = $.fn.popover
+
+ $.fn.popover = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('popover')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('popover', (data = new Popover(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.popover.Constructor = Popover
+
+ $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
+ placement: 'right'
+ , trigger: 'click'
+ , content: ''
+ , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
+ })
+
+
+ /* POPOVER NO CONFLICT
+ * =================== */
+
+ $.fn.popover.noConflict = function () {
+ $.fn.popover = old
+ return this
+ }
+
+}(window.jQuery);
Added: trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-tooltip.js
===================================================================
--- trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-tooltip.js (rev 0)
+++ trunk/wao-web/src/main/webapp/bootstrap-2.3.1/bootstrap-tooltip.js 2014-03-31 12:41:30 UTC (rev 1776)
@@ -0,0 +1,361 @@
+/* ===========================================================
+ * bootstrap-tooltip.js v2.3.1
+ * http://twitter.github.com/bootstrap/javascript.html#tooltips
+ * Inspired by the original jQuery.tipsy by Jason Frame
+ * ===========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* TOOLTIP PUBLIC CLASS DEFINITION
+ * =============================== */
+
+ var Tooltip = function (element, options) {
+ this.init('tooltip', element, options)
+ }
+
+ Tooltip.prototype = {
+
+ constructor: Tooltip
+
+ , init: function (type, element, options) {
+ var eventIn
+ , eventOut
+ , triggers
+ , trigger
+ , i
+
+ this.type = type
+ this.$element = $(element)
+ this.options = this.getOptions(options)
+ this.enabled = true
+
+ triggers = this.options.trigger.split(' ')
+
+ for (i = triggers.length; i--;) {
+ trigger = triggers[i]
+ if (trigger == 'click') {
+ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
+ } else if (trigger != 'manual') {
+ eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
+ eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
+ this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
+ this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
+ }
+ }
+
+ this.options.selector ?
+ (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
+ this.fixTitle()
+ }
+
+ , getOptions: function (options) {
+ options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
+
+ if (options.delay && typeof options.delay == 'number') {
+ options.delay = {
+ show: options.delay
+ , hide: options.delay
+ }
+ }
+
+ return options
+ }
+
+ , enter: function (e) {
+ var defaults = $.fn[this.type].defaults
+ , options = {}
+ , self
+
+ this._options && $.each(this._options, function (key, value) {
+ if (defaults[key] != value) options[key] = value
+ }, this)
+
+ self = $(e.currentTarget)[this.type](options).data(this.type)
+
+ if (!self.options.delay || !self.options.delay.show) return self.show()
+
+ clearTimeout(this.timeout)
+ self.hoverState = 'in'
+ this.timeout = setTimeout(function() {
+ if (self.hoverState == 'in') self.show()
+ }, self.options.delay.show)
+ }
+
+ , leave: function (e) {
+ var self = $(e.currentTarget)[this.type](this._options).data(this.type)
+
+ if (this.timeout) clearTimeout(this.timeout)
+ if (!self.options.delay || !self.options.delay.hide) return self.hide()
+
+ self.hoverState = 'out'
+ this.timeout = setTimeout(function() {
+ if (self.hoverState == 'out') self.hide()
+ }, self.options.delay.hide)
+ }
+
+ , show: function () {
+ var $tip
+ , pos
+ , actualWidth
+ , actualHeight
+ , placement
+ , tp
+ , e = $.Event('show')
+
+ if (this.hasContent() && this.enabled) {
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+ $tip = this.tip()
+ this.setContent()
+
+ if (this.options.animation) {
+ $tip.addClass('fade')
+ }
+
+ placement = typeof this.options.placement == 'function' ?
+ this.options.placement.call(this, $tip[0], this.$element[0]) :
+ this.options.placement
+
+ $tip
+ .detach()
+ .css({ top: 0, left: 0, display: 'block' })
+
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
+
+ pos = this.getPosition()
+
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+
+ switch (placement) {
+ case 'bottom':
+ tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
+ break
+ case 'top':
+ tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
+ break
+ case 'left':
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
+ break
+ case 'right':
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
+ break
+ }
+
+ this.applyPlacement(tp, placement)
+ this.$element.trigger('shown')
+ }
+ }
+
+ , applyPlacement: function(offset, placement){
+ var $tip = this.tip()
+ , width = $tip[0].offsetWidth
+ , height = $tip[0].offsetHeight
+ , actualWidth
+ , actualHeight
+ , delta
+ , replace
+
+ $tip
+ .offset(offset)
+ .addClass(placement)
+ .addClass('in')
+
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+
+ if (placement == 'top' && actualHeight != height) {
+ offset.top = offset.top + height - actualHeight
+ replace = true
+ }
+
+ if (placement == 'bottom' || placement == 'top') {
+ delta = 0
+
+ if (offset.left < 0){
+ delta = offset.left * -2
+ offset.left = 0
+ $tip.offset(offset)
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+ }
+
+ this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
+ } else {
+ this.replaceArrow(actualHeight - height, actualHeight, 'top')
+ }
+
+ if (replace) $tip.offset(offset)
+ }
+
+ , replaceArrow: function(delta, dimension, position){
+ this
+ .arrow()
+ .css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
+ }
+
+ , setContent: function () {
+ var $tip = this.tip()
+ , title = this.getTitle()
+
+ $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
+ $tip.removeClass('fade in top bottom left right')
+ }
+
+ , hide: function () {
+ var that = this
+ , $tip = this.tip()
+ , e = $.Event('hide')
+
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+
+ $tip.removeClass('in')
+
+ function removeWithAnimation() {
+ var timeout = setTimeout(function () {
+ $tip.off($.support.transition.end).detach()
+ }, 500)
+
+ $tip.one($.support.transition.end, function () {
+ clearTimeout(timeout)
+ $tip.detach()
+ })
+ }
+
+ $.support.transition && this.$tip.hasClass('fade') ?
+ removeWithAnimation() :
+ $tip.detach()
+
+ this.$element.trigger('hidden')
+
+ return this
+ }
+
+ , fixTitle: function () {
+ var $e = this.$element
+ if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
+ $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
+ }
+ }
+
+ , hasContent: function () {
+ return this.getTitle()
+ }
+
+ , getPosition: function () {
+ var el = this.$element[0]
+ return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
+ width: el.offsetWidth
+ , height: el.offsetHeight
+ }, this.$element.offset())
+ }
+
+ , getTitle: function () {
+ var title
+ , $e = this.$element
+ , o = this.options
+
+ title = $e.attr('data-original-title')
+ || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
+
+ return title
+ }
+
+ , tip: function () {
+ return this.$tip = this.$tip || $(this.options.template)
+ }
+
+ , arrow: function(){
+ return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
+ }
+
+ , validate: function () {
+ if (!this.$element[0].parentNode) {
+ this.hide()
+ this.$element = null
+ this.options = null
+ }
+ }
+
+ , enable: function () {
+ this.enabled = true
+ }
+
+ , disable: function () {
+ this.enabled = false
+ }
+
+ , toggleEnabled: function () {
+ this.enabled = !this.enabled
+ }
+
+ , toggle: function (e) {
+ var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
+ self.tip().hasClass('in') ? self.hide() : self.show()
+ }
+
+ , destroy: function () {
+ this.hide().$element.off('.' + this.type).removeData(this.type)
+ }
+
+ }
+
+
+ /* TOOLTIP PLUGIN DEFINITION
+ * ========================= */
+
+ var old = $.fn.tooltip
+
+ $.fn.tooltip = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('tooltip')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.tooltip.Constructor = Tooltip
+
+ $.fn.tooltip.defaults = {
+ animation: true
+ , placement: 'top'
+ , selector: false
+ , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
+ , trigger: 'hover focus'
+ , title: ''
+ , delay: 0
+ , html: false
+ , container: false
+ }
+
+
+ /* TOOLTIP NO CONFLICT
+ * =================== */
+
+ $.fn.tooltip.noConflict = function () {
+ $.fn.tooltip = old
+ return this
+ }
+
+}(window.jQuery);
Copied: trunk/wao-web/src/main/webapp/wao.css (from rev 1775, trunk/wao-web/src/main/webapp/css/wao.css)
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css (rev 0)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-03-31 12:41:30 UTC (rev 1776)
@@ -0,0 +1,262 @@
+/*
+ * #%L
+ * Wao :: Web
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+/******************************************************************************
+ * Personnalisation de Bootstrap
+ *****************************************************************************/
+
+/* On surcharge left: 0px par left: 0% car ça pose problème pour Firefox qui place le menu complètement à gauche de la fenêtre et pas en dessous du bouton */
+.dropdown-menu {
+ left: 0%;
+}
+
+legend+.control-group {
+ margin-top: 0px;
+}
+
+/******************************************************************************
+ * Des classes à usage transverse
+ *****************************************************************************/
+
+.highlight {
+ background-color: #ffff99;
+}
+
+/* pour représenter qu'on est à l'instant présent */
+.now {
+ background-color: #ffff99;
+}
+
+/* pour représente qu'une entité (société, utilisateur) est inactive */
+.inactive {
+ text-decoration: line-through;
+}
+
+/**
+ * Class permettant de faire faire une rotation à un élément de 90° sur la gauche.
+ * Ça peut par exemeple servir pour un th, afin de gagner de la largeur
+ *
+ * voir http://stackoverflow.com/questions/15806925/how-to-rotate-text-left-90-degr…
+ */
+.rotate {
+ display: block;
+ -moz-transform: rotate(-90.0deg); /* FF3.5+ */
+ -o-transform: rotate(-90.0deg); /* Opera 10.5 */
+ -webkit-transform: rotate(-90.0deg); /* Saf3.1+, Chrome */
+ -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)"; /* IE8 */
+
+}
+
+td.ellipsis {
+ max-width: 100px;
+}
+
+.ellipsis {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+td.ellipsis:hover {
+ overflow: visible;
+ white-space: normal;
+ text-overflow: initial;
+}
+
+.compact-view .only-in-full-view,
+.full-view .only-in-compact-view,
+.show-estimated .real,
+.show-real .estimated {
+ display: none;
+}
+
+.lower-than-expected {
+ color : red;
+}
+
+.higher-than-expected {
+ color : green;
+}
+
+
+/******************************************************************************
+ * Styles globaux à l'application
+ *****************************************************************************/
+
+/**
+ * Le style du layout
+ */
+
+footer {
+ text-align: center;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+footer ul {
+ list-style-type: none;
+}
+
+footer ul li {
+ display: inline;
+ margin-left: 20px;
+}
+
+main {
+ max-width: 800px;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+main.large {
+ width: 100%;
+ max-width: 100%;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+/**
+ * Le style général des formulaires
+ */
+
+.form-actions {
+ margin-top: 75px;
+}
+
+textarea {
+ width: 100%;
+ min-height: 150px;
+}
+
+.form-actions button[type="submit"] {
+ float: right;
+}
+
+th.actions, td.actions {
+ white-space: nowrap;
+}
+
+.large-table, .large-table thead th {
+ border: solid 1px #aaaaaa;
+}
+
+.large-table li {
+ list-style-type: none;
+}
+
+.large-table tbody th, .large-table td {
+ border: solid 1px #aaaaaa;
+ border-left-style: dashed;
+ border-right-style: dashed;
+ padding: 2px;
+}
+
+/**
+ * Les filtres
+ */
+
+form.filters-form {
+ width: auto;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+form.filters-form .control-group {
+ float: left;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+form.filters-form .form-actions {
+ clear: both;
+ margin-top: 0px;
+ border: none;
+ background-color: white;
+}
+
+/******************************************************************************
+ * Styles spécifiques pour certaines pages de l'appli
+ *****************************************************************************/
+
+#expectedObservationsByMonthsTable th {
+ white-space: nowrap;
+}
+
+#expectedObservationsByMonthsTable input {
+ width: 40px;
+ text-align: right;
+}
+
+form#login button[type="submit"] {
+ margin-left: 180px;
+}
+
+#cgu {
+ overflow-y: auto;
+ max-height: 300px;
+ padding: 5px;
+ border: solid 5px #f2f2f2;
+ margin-bottom: 20px;
+}
+
+table.sampling-plan tr.facade-row {
+ color: white;
+ background-color: seagreen;
+ background-color: darkslategrey;
+ font-size: 150%;
+ line-height: 150%;
+}
+
+table.sampling-plan tr.sector-row {
+ color: white;
+ background-color: darkcyan;
+ background-color: darkseagreen;
+ font-size: 120%;
+ line-height: 120%;
+}
+
+table.sampling-plan tr.facade-row th,
+table.sampling-plan tr.sector-row th {
+ text-align: left;
+ padding: 10px;
+}
+
+table.sampling-plan tbody tr.sample-row-row:nth-child(2n) {
+ background-color: #e6e6e6;
+}
+
+table.sampling-plan tbody tr.sample-row-row:hover {
+ background-color: tan;
+ background-color: antiquewhite;
+ background-color: palegoldenrod;
+ background-color: papayawhip;
+ background-color: wheat;
+ background-color: beige;
+}
+
+table.sampling-plan td.effort {
+ text-align: center;
+}
+
+table.sampling-plan .actions .dropdown-menu {
+ left: -200px
+}
+
Copied: trunk/wao-web/src/main/webapp/wao.js (from rev 1774, trunk/wao-web/src/main/webapp/js/wao.js)
===================================================================
--- trunk/wao-web/src/main/webapp/wao.js (rev 0)
+++ trunk/wao-web/src/main/webapp/wao.js 2014-03-31 12:41:30 UTC (rev 1776)
@@ -0,0 +1,129 @@
+/*
+ * #%L
+ * Wao :: Web
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+var SampleRowsFilterModel = function (filterValuesUrl) {
+
+ var self = this;
+
+ this.filterValues = {};
+ this.filterValuesUrl = filterValuesUrl;
+
+ this.setFilterValues = function (filterValues) {
+ this.filterValues = filterValues;
+ $(this).trigger('updated');
+ };
+
+ this.updateFilterValues = function(filter) {
+ var successCallback = function (data) {
+ self.setFilterValues(data.filterValues)
+ };
+ $.get(this.filterValuesUrl, filter, successCallback);
+ }
+
+};
+
+var SampleRowsFilterView = function (sampleRowsFilterModel, $filtersForm) {
+
+ var self = this;
+
+ this.model = sampleRowsFilterModel;
+ this.$filtersForm = $filtersForm;
+ this.$selects = $filtersForm.find('select');
+ this.$inputs = $filtersForm.find('input[type=text]');
+
+ this.getFilter = function () {
+ var filter = {};
+ this.$selects.each(function (index, select) {
+ var $select = $(select);
+ var parameterName = $select.prop('name');
+ var parameterValues = [];
+ $select.find('option:selected').each(function (index, option) {
+ parameterValues.push($(option).prop('value'));
+ });
+ filter[parameterName] = parameterValues;
+ });
+ this.$inputs.each(function (index, input) {
+ var $input = $(input);
+ var parameterName = $(input).prop('name');
+ var parameterValue = $(input).prop('value');
+ filter[parameterName] = parameterValue;
+ });
+ return filter;
+ };
+
+ this.refreshFilterValues = function() {
+ // store options selected by user to re-select them after update
+ var filter = this.getFilter();
+ var filterValues = this.model.filterValues;
+ this.$selects.each(function (index, select) {
+ var $select = $(select).empty();
+ var name = $select.prop('name');
+ // FIXME brendan 26/03/14 should be data-binding but freemarker break the template :-(
+ var binding = $select.attr('databinding');
+ var options = filterValues[binding];
+ $.each(options, function (index, option) {
+ var optionHtml = '<option value="' + option.value + '">' + option.label + '</option>';
+ $select.append(optionHtml);
+ });
+ var selectedOptions = filter[name];
+ $.each(selectedOptions, function (index, selectedOption) {
+ $select.find('option[value="' + selectedOption + '"]').prop('selected', 'selected');
+ });
+ });
+ this.$filtersForm.effect( "highlight", "slow" );
+ }
+
+ $(this.model).on('updated', function () {
+ self.refreshFilterValues();
+ });
+
+};
+
+var SampleRowsFilterController = function (filterValuesUrl, $filtersForm) {
+
+ var self = this;
+
+ this.model = new SampleRowsFilterModel(filterValuesUrl);
+ this.view = new SampleRowsFilterView(this.model, $filtersForm);
+
+ this.onFilterChange = function () {
+ var filter = this.view.getFilter();
+ this.model.updateFilterValues(filter);
+ };
+
+ this.init = function () {
+ this.view.$selects.blur(function () {
+ self.onFilterChange();
+ });
+ this.view.$inputs.blur(function () {
+ self.onFilterChange();
+ });
+ }
+
+};
+
+$(document).ready(function () {
+
+ // $('select').select2();
+
+ $('a[data-toggle="popover"]').popover();
+
+});
\ No newline at end of file
1
0
r1775 - in trunk/wao-web/src/main: java/fr/ifremer/wao/web webapp/WEB-INF/content/obsmer webapp/css
by bleny@users.forge.codelutin.com 31 Mar '14
by bleny@users.forge.codelutin.com 31 Mar '14
31 Mar '14
Author: bleny
Date: 2014-03-31 13:12:10 +0200 (Mon, 31 Mar 2014)
New Revision: 1775
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1775
Log:
refs #4483 some styles
Modified:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/css/wao.css
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-03-31 09:16:40 UTC (rev 1774)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-03-31 11:12:10 UTC (rev 1775)
@@ -80,7 +80,7 @@
if (waoSession.getAuthenticatedWaoUser() == null) {
- boolean loginCheat = true;
+ boolean loginCheat = getWaoApplicationContext(invocation).getApplicationConfig().isDevMode();
if (loginCheat) {
// login à l'arrache
WaoUser admin = serviceContext.getPersistenceContext().getWaoUserDao().forLoginEquals("admin").findUnique();
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 09:16:40 UTC (rev 1774)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-31 11:12:10 UTC (rev 1775)
@@ -76,63 +76,67 @@
<fieldset>
- <s:select name="filter.companyIds"
- label="%{getText('wao.ui.entity.Company')}"
- list="filterValues.companies"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="companies" />
+ <s:select name="filter.companyIds"
+ label="%{getText('wao.ui.entity.Company')}"
+ list="filterValues.companies"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="companies" />
- <s:select name="filter.programNames"
- label="%{getText('wao.ui.field.SampleRow.programName')}"
- list="filterValues.programNames"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="programNames" />
+ <s:select name="filter.programNames"
+ label="%{getText('wao.ui.field.SampleRow.programName')}"
+ list="filterValues.programNames"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="programNames" />
- <s:select name="filter.fishingZoneFacadeNames"
- label="%{getText('wao.ui.field.FishingZone.facadeName')}"
- list="filterValues.fishingZoneFacadeNames"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="fishingZoneFacadeNames" />
+ <s:select name="filter.sampleRowCodes"
+ label="%{getText('wao.ui.field.SampleRow.code')}"
+ list="filterValues.sampleRowCodes"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="sampleRowCodes" />
- <s:select name="filter.fishingZoneSectorNames"
- label="%{getText('wao.ui.field.FishingZone.sectorName')}"
- list="filterValues.fishingZoneSectorNames"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="fishingZoneSectorNames" />
+ </fieldset>
- <s:select name="filter.sampleRowCodes"
- label="%{getText('wao.ui.field.SampleRow.code')}"
- list="filterValues.sampleRowCodes"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="sampleRowCodes" />
+ <fieldset>
- <s:select name="filter.fishingGearDcfIds"
- label="%{getText('wao.ui.entity.fishingGearDCF')}"
- list="filterValues.fishingGearDcfs"
- listKey="value"
- listValue="label"
- value="%getText(#value)"
- multiple="true"
- dataBinding="fishingGearDcfs" />
+ <s:select name="filter.fishingZoneFacadeNames"
+ label="%{getText('wao.ui.field.FishingZone.facadeName')}"
+ list="filterValues.fishingZoneFacadeNames"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="fishingZoneFacadeNames" />
- <s:select name="filter.targetSpeciesDcfIds"
- label="%{getText('wao.ui.entity.targetSpeciesDCF')}"
- list="filterValues.targetSpeciesDcfs"
- listKey="value"
- listValue="label"
- multiple="true"
- dataBinding="targetSpeciesDcfs" />
+ <s:select name="filter.fishingZoneSectorNames"
+ label="%{getText('wao.ui.field.FishingZone.sectorName')}"
+ list="filterValues.fishingZoneSectorNames"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="fishingZoneSectorNames" />
+ <s:select name="filter.fishingGearDcfIds"
+ label="%{getText('wao.ui.entity.fishingGearDCF')}"
+ list="filterValues.fishingGearDcfs"
+ listKey="value"
+ listValue="label"
+ value="%getText(#value)"
+ multiple="true"
+ dataBinding="fishingGearDcfs" />
+
+ <s:select name="filter.targetSpeciesDcfIds"
+ label="%{getText('wao.ui.entity.targetSpeciesDCF')}"
+ list="filterValues.targetSpeciesDcfs"
+ listKey="value"
+ listValue="label"
+ multiple="true"
+ dataBinding="targetSpeciesDcfs" />
+
</fieldset>
<div class="form-actions">
Modified: trunk/wao-web/src/main/webapp/css/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/css/wao.css 2014-03-31 09:16:40 UTC (rev 1774)
+++ trunk/wao-web/src/main/webapp/css/wao.css 2014-03-31 11:12:10 UTC (rev 1775)
@@ -36,7 +36,6 @@
* Des classes à usage transverse
*****************************************************************************/
-/* pour représente qu'une entité (société, utilisateur) est inactive */
.highlight {
background-color: #ffff99;
}
@@ -46,6 +45,7 @@
background-color: #ffff99;
}
+/* pour représente qu'une entité (société, utilisateur) est inactive */
.inactive {
text-decoration: line-through;
}
@@ -88,11 +88,11 @@
display: none;
}
-.effort .lower-than-expected {
+.lower-than-expected {
color : red;
}
-.effort .higher-than-expected {
+.higher-than-expected {
color : green;
}
1
0