diff --git a/.gitignore b/.gitignore
index 18bc2be1e..f3265bf6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,4 +22,5 @@ rebel.xml
/web/nbactions.xml
/forms/.rebel.xml.bak
/derby.log
-/LOG_DIR_IS_UNDEFINED/
\ No newline at end of file
+/LOG_DIR_IS_UNDEFINED/
+/ehcache-diskstore/
\ No newline at end of file
diff --git a/README.md b/README.md
index 85186bef5..4fa35266e 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
## Presentation
-OCE is a project that allows importing the Vietnam public procurement data, available in the common MS Excel format, into a native [Open Contracting Data Standard (OCDS)](http://standard.open-contracting.org/) NoSQL storage, and then run visual data analytics (display a *live* dashboard with charts, maps and data tables as well as custom comparison charts). Since the data is natively stored in the OCDS format, it can be readily exported in this format without any transformation required, and with great throughput.
+OCE is a project that allows importing the public procurement data, available in the common MS Excel format, into a native [Open Contracting Data Standard (OCDS)](http://standard.open-contracting.org/) NoSQL storage, and then run visual data analytics (display a *live* dashboard with charts, maps and data tables as well as custom comparison charts). Since the data is natively stored in the OCDS format, it can be readily exported in this format without any transformation required, and with great throughput.
## Visual Identity
SVG and raster version of the logo and favicon can be found in the [`docs/images`](./docs/images/) directory.
diff --git a/checkstyle.xml b/checkstyle.xml
index 41e92e6e7..d90aa6ce9 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -47,7 +47,9 @@
-
+
+
+
diff --git a/forms/.gitignore b/forms/.gitignore
index 5741bc597..1fc9006bf 100644
--- a/forms/.gitignore
+++ b/forms/.gitignore
@@ -5,3 +5,4 @@
.project
/.springBeans
/.checkstyle
+/ehcache-diskstore/
\ No newline at end of file
diff --git a/forms/pom.xml b/forms/pom.xml
index a9ce600bd..ded400db2 100644
--- a/forms/pom.xml
+++ b/forms/pom.xml
@@ -29,10 +29,10 @@
UTF-81.8
- 7.7.0
- 0.10.14
- 1.11
- 0.5.5
+ 7.9.0
+ 0.10.16
+ 1.12
+ 0.5.6v20160822
@@ -124,13 +124,13 @@
cglib3.1
-
+
- com.google.javascript
- closure-compiler
- ${closure.compiler.version}
-
-
+ com.google.javascript
+ closure-compiler
+ ${closure.compiler.version}
+
+
de.agilecoders.wicket.webjars
@@ -218,14 +218,13 @@
- javax.mail
- mail
- 1.4.7
+ org.springframework.boot
+ spring-boot-starter-mailorg.apache.poipoi
- ${pentaho.poi.version}
+ ${poi.version}
@@ -355,11 +354,11 @@
org.hibernate
- hibernate-entitymanager
+ hibernate-entitymanagerorg.hibernate
- hibernate-envers
+ hibernate-envers
diff --git a/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.html b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.html
new file mode 100644
index 000000000..eb8bec1d8
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.html
@@ -0,0 +1,14 @@
+
+
+
+
+EditUserDashboardPage
+
+
+
+
+
+
+
+
+
diff --git a/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.java b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.java
new file mode 100644
index 000000000..422bdc644
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Development Gateway, Inc and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the MIT License (MIT)
+ * which accompanies this distribution, and is available at
+ * https://opensource.org/licenses/MIT
+ *
+ * Contributors:
+ * Development Gateway - initial API and implementation
+ *******************************************************************************/
+package org.devgateway.ocds.forms.wicket.page.edit;
+
+import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.markup.html.form.validation.AbstractFormValidator;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.devgateway.ocds.forms.wicket.page.list.ListAllColorIndicatorPage;
+import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
+import org.devgateway.ocds.persistence.mongo.flags.FlagsConstants;
+import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
+import org.devgateway.toolkit.forms.wicket.components.form.ColorPickerBootstrapFormComponent;
+import org.devgateway.toolkit.forms.wicket.components.form.Select2ChoiceBootstrapFormComponent;
+import org.devgateway.toolkit.forms.wicket.page.edit.AbstractEditPage;
+import org.devgateway.toolkit.forms.wicket.providers.GenericChoiceProvider;
+import org.devgateway.toolkit.persistence.repository.PersonRepository;
+import org.devgateway.toolkit.web.security.SecurityConstants;
+import org.wicketstuff.annotation.mount.MountPath;
+
+@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
+@MountPath("/editColorIndicatorPairPage")
+public class EditColorIndicatorPairPage extends AbstractEditPage {
+
+ private static final long serialVersionUID = -6069250112046118104L;
+
+ @Override
+ protected ColorIndicatorPair newInstance() {
+ return new ColorIndicatorPair();
+ }
+
+ @SpringBean
+ private ColorIndicatorPairRepository colorIndicatorPairRepository;
+
+ @SpringBean
+ private PersonRepository personRepository;
+
+ private Select2ChoiceBootstrapFormComponent firstIndicator;
+
+ private Select2ChoiceBootstrapFormComponent secondIndicator;
+
+ public EditColorIndicatorPairPage(final PageParameters parameters) {
+ super(parameters);
+ this.jpaRepository = colorIndicatorPairRepository;
+ this.listPageClass = ListAllColorIndicatorPage.class;
+
+ }
+
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ firstIndicator =
+ new Select2ChoiceBootstrapFormComponent("firstIndicator",
+ new GenericChoiceProvider(FlagsConstants.FLAGS_LIST));
+ firstIndicator.required();
+ editForm.add(firstIndicator);
+
+ secondIndicator =
+ new Select2ChoiceBootstrapFormComponent("secondIndicator",
+ new GenericChoiceProvider(FlagsConstants.FLAGS_LIST));
+ secondIndicator.required();
+ editForm.add(secondIndicator);
+
+ ColorPickerBootstrapFormComponent color = new ColorPickerBootstrapFormComponent("color");
+ color.required();
+ editForm.add(color);
+ editForm.add(new ColorIndicatorDistinctFormValidator());
+ editForm.add(new ColorIndicatorUniquePairFormValidator(compoundModel));
+
+ }
+
+
+ private class ColorIndicatorDistinctFormValidator extends AbstractFormValidator {
+
+ @Override
+ public FormComponent>[] getDependentFormComponents() {
+ return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
+ }
+
+ @Override
+ public void validate(Form> form) {
+ if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null
+ && firstIndicator.getField().getValue().equals(secondIndicator.getField().getValue())) {
+ error(firstIndicator.getField());
+ error(secondIndicator.getField());
+ }
+ }
+ }
+
+
+ private class ColorIndicatorUniquePairFormValidator extends AbstractFormValidator {
+
+ private final IModel masterModel;
+
+ ColorIndicatorUniquePairFormValidator(IModel masterModel) {
+ this.masterModel = masterModel;
+ }
+
+ @Override
+ public FormComponent>[] getDependentFormComponents() {
+ return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
+ }
+
+ @Override
+ public void validate(Form> form) {
+ if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null) {
+ ColorIndicatorPair indicator = colorIndicatorPairRepository.
+ findByFirstIndicatorAndSecondIndicator(firstIndicator.getField().getValue(),
+ secondIndicator.getField().getValue());
+
+ if ((masterModel.getObject().isNew() && indicator != null)
+ || (!masterModel.getObject().isNew() && indicator != null
+ && !indicator.getId().equals(masterModel.getObject().getId()))) {
+ error(firstIndicator.getField());
+ error(secondIndicator.getField());
+ }
+ }
+ }
+ }
+}
diff --git a/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.properties b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.properties
new file mode 100644
index 000000000..35fb0cdfc
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/edit/EditColorIndicatorPairPage.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2015 Development Gateway, Inc and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the MIT License (MIT)
+# which accompanies this distribution, and is available at
+# https://opensource.org/licenses/MIT
+#
+# Contributors:
+# Development Gateway - initial API and implementation
+###############################################################################
+page.title=Edit Color Indicator Pair
+firstIndicator.label=First Indicator
+secondIndicator.label=Second Indicator
+color.label=Color
+ColorIndicatorDistinctFormValidator=Please select two distinct indicators
+ColorIndicatorUniquePairFormValidator=A similar pair of indicators was already saved with a color. You can add only distinct pairs.
\ No newline at end of file
diff --git a/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.java b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.java
new file mode 100644
index 000000000..b8ae91a18
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Development Gateway, Inc and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the MIT License (MIT)
+ * which accompanies this distribution, and is available at
+ * https://opensource.org/licenses/MIT
+ *
+ * Contributors:
+ * Development Gateway - initial API and implementation
+ *******************************************************************************/
+package org.devgateway.ocds.forms.wicket.page.list;
+
+import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.devgateway.ocds.forms.wicket.page.edit.EditColorIndicatorPairPage;
+import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
+import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
+import org.devgateway.toolkit.forms.wicket.page.lists.AbstractListPage;
+import org.devgateway.toolkit.web.security.SecurityConstants;
+import org.wicketstuff.annotation.mount.MountPath;
+
+@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
+@MountPath(value = "/listColorIndicators")
+public class ListAllColorIndicatorPage extends AbstractListPage {
+
+ @SpringBean
+ protected ColorIndicatorPairRepository colorIndicatorPairRepository;
+
+
+
+ public ListAllColorIndicatorPage(final PageParameters pageParameters) {
+ super(pageParameters);
+ this.jpaRepository = colorIndicatorPairRepository;
+ this.editPageClass = EditColorIndicatorPairPage.class;
+ columns.add(new PropertyColumn(new Model("First Indicator"),
+ "firstIndicator", "firstIndicator"));
+
+ columns.add(new PropertyColumn(new Model("Second Indicator"),
+ "secondIndicator", "secondIndicator"));
+
+ columns.add(new PropertyColumn(new Model("Color"),
+ "color", "color"));
+
+ }
+
+}
diff --git a/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.properties b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.properties
new file mode 100644
index 000000000..ed3f01ed0
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/ocds/forms/wicket/page/list/ListAllColorIndicatorPage.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2015 Development Gateway, Inc and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the MIT License (MIT)
+# which accompanies this distribution, and is available at
+# https://opensource.org/licenses/MIT
+#
+# Contributors:
+# Development Gateway - initial API and implementation
+###############################################################################
+page.title=All Color Indicator Pairs
+defaultDashboardUsers=Default Dashboard For Users
+users=Users
+view=View
\ No newline at end of file
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/util/MarkupCacheService.java b/forms/src/main/java/org/devgateway/toolkit/forms/util/MarkupCacheService.java
index 5bcc5129f..2ba6345ce 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/util/MarkupCacheService.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/util/MarkupCacheService.java
@@ -153,6 +153,13 @@ public void clearReportsApiCache() {
if (cache != null) {
cache.removeAll();
}
+
+ // get the reports cache "excelExportCache", declared in ehcache.xml
+ Cache excelExportCache = cm.getCache("excelExportCache");
+
+ if (excelExportCache != null) {
+ excelExportCache.removeAll();
+ }
}
private String createCacheKey(final String outputType, final String reportName, final String parameters) {
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/FormsWebApplication.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/FormsWebApplication.java
index 1a379673b..a952a8331 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/FormsWebApplication.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/FormsWebApplication.java
@@ -64,7 +64,6 @@
* method.
*
* @author Stefan Kloe, mpostelnicu
- *
*/
@EnableScheduling
@SpringBootApplication
@@ -84,16 +83,15 @@ public class FormsWebApplication extends AuthenticatedWebApplication {
private SessionFinderService sessionFinderService;
-
public static void main(final String[] args) {
SpringApplication.run(FormsWebApplication.class, args);
}
/**
* @see org.apache.wicket.Application#newConverterLocator() This adds the
- * {@link NonNumericFilteredBigDecimalConverter} as the standard
- * {@link BigDecimal} converter for ALL fields using this type accross
- * the application
+ * {@link NonNumericFilteredBigDecimalConverter} as the standard
+ * {@link BigDecimal} converter for ALL fields using this type accross
+ * the application
**/
@Override
protected IConverterLocator newConverterLocator() {
@@ -111,8 +109,10 @@ private void configureSummernote() {
SummernoteConfig.addStorage(new SummernoteFileStorage(STORAGE_ID, folder));
// mount the resource reference responsible for image uploads
- mountResource(SummernoteStoredImageResourceReference.SUMMERNOTE_MOUNT_PATH,
- new SummernoteStoredImageResourceReference(STORAGE_ID));
+ mountResource(
+ SummernoteStoredImageResourceReference.SUMMERNOTE_MOUNT_PATH,
+ new SummernoteStoredImageResourceReference(STORAGE_ID)
+ );
}
/**
@@ -160,8 +160,10 @@ private void optimizeForWebPerformance() {
// -Dwicket.configuration=deployment
// The default is Development, so this code is not used
if (usesDeploymentConfig()) {
- getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy("-v-",
- new CachingResourceVersion(new Adler32ResourceVersion())));
+ getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(
+ "-v-",
+ new CachingResourceVersion(new Adler32ResourceVersion())
+ ));
getResourceSettings().setJavaScriptCompressor(
new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Layout.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Layout.java
index 699a896c8..6e48b0bec 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Layout.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Layout.java
@@ -22,6 +22,8 @@ public final class Layout implements Serializable {
private final Boolean showlegend;
+ private final Legend legend;
+
private final Xaxis xaxis;
private final Yaxis yaxis;
@@ -36,6 +38,7 @@ public Layout(final LayoutBuilder layoutBuilder) {
this.annotations = layoutBuilder.annotations;
this.font = layoutBuilder.font;
this.showlegend = layoutBuilder.showlegend;
+ this.legend = layoutBuilder.legend;
this.xaxis = layoutBuilder.xaxis;
this.yaxis = layoutBuilder.yaxis;
this.bargap = layoutBuilder.bargap;
@@ -56,6 +59,8 @@ public static class LayoutBuilder {
private Boolean showlegend;
+ private Legend legend;
+
private Xaxis xaxis;
private Yaxis yaxis;
@@ -97,6 +102,11 @@ public LayoutBuilder setShowlegend(final Boolean showlegend) {
return this;
}
+ public LayoutBuilder setLegend(final Legend legend) {
+ this.legend = legend;
+ return this;
+ }
+
public LayoutBuilder setXaxis(final Xaxis xaxis) {
this.xaxis = xaxis;
return this;
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Legend.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Legend.java
new file mode 100644
index 000000000..af372dbb7
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/Legend.java
@@ -0,0 +1,28 @@
+package org.devgateway.toolkit.forms.wicket.components.charts;
+
+import java.io.Serializable;
+
+/**
+ * @author idobre
+ * @since 29/10/2017
+ */
+public class Legend implements Serializable {
+ private final String orientation;
+
+ public Legend(final LegendBuilder legendBuilder) {
+ this.orientation = legendBuilder.orientation;
+ }
+
+ public static class LegendBuilder {
+ private String orientation;
+
+ public LegendBuilder setOrientation(final String orientation) {
+ this.orientation = orientation;
+ return this;
+ }
+
+ public Legend build() {
+ return new Legend(this);
+ }
+ }
+}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/PlotlyChart.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/PlotlyChart.java
index f7a3dd567..5f40773b9 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/PlotlyChart.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/PlotlyChart.java
@@ -13,10 +13,12 @@
/**
* @author idobre
* @since 4/19/17
+ *
+ * Component that renders a chart using Plot.ly JS library.
*/
public final class PlotlyChart extends Panel {
private static final String JS_FILE = "plotlyChart.js";
- private static final String INIT_FUNCTION = "init";
+ private static final String INIT_FUNCTION = "initChart";
public static final String CHART_TYPE_PIE = "pie";
public static final String CHART_TYPE_BAR = "bar";
@@ -37,6 +39,9 @@ public final class PlotlyChart extends Panel {
public static final String AXIS_TYPE_CATEGORY = "category";
+ public static final String LEGEND_ORIENTATION_H = "h";
+ public static final String LEGEND_ORIENTATION_V = "v";
+
private final WebMarkupContainer chart;
private final ChartParameters parameters;
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/plotlyChart.js b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/plotlyChart.js
index 37f23efd9..5b992e0db 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/plotlyChart.js
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/charts/plotlyChart.js
@@ -1,13 +1,27 @@
/**
* init function that is called from the Wicket Component
*/
-var init = function (parameters) {
+var initChart = function (parameters) {
'use strict';
+ if (parameters === undefined) {
+ return;
+ }
+
+ // check if we have the 'colors' property for a marker and copy it to 'color' property as well.
+ for(var i = 0; i < parameters.data.length; i++) {
+ if (parameters.data[i].marker !== undefined && parameters.data[i].marker.colors !== undefined) {
+ parameters.data[i].marker.color = parameters.data[i].marker.colors;
+ }
+ }
+
var chart = new PlotlyChart(parameters);
chart.render();
};
+// run 'initChart' function to avoid being removed by the javascript optimizer.
+initChart();
+
/**
* Object.assign for ES5
*/
@@ -39,7 +53,7 @@ if (typeof Object.assign != 'function') {
PlotlyChart.prototype.defaultProps = {
chartId: 'chartId',
layout: {
- showlegend: true,
+ showlegend: true
}
};
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/AJAXDownload.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/AJAXDownload.java
new file mode 100644
index 000000000..9f89f97af
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/AJAXDownload.java
@@ -0,0 +1,45 @@
+package org.devgateway.toolkit.forms.wicket.components.form;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.behavior.AbstractAjaxBehavior;
+import org.apache.wicket.request.IRequestHandler;
+
+/**
+ * AJAX update and file download.
+ *
+ * https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
+ */
+public abstract class AJAXDownload extends AbstractAjaxBehavior {
+ private boolean addAntiCache;
+
+ public AJAXDownload() {
+ this(true);
+ }
+
+ public AJAXDownload(final boolean addAntiCache) {
+ super();
+ this.addAntiCache = addAntiCache;
+ }
+
+ /**
+ * Call this method to initiate the download.
+ */
+ public void initiate(final AjaxRequestTarget target) {
+ String url = getCallbackUrl().toString();
+
+ if (addAntiCache) {
+ url = url + (url.contains("?") ? "&" : "?");
+ url = url + "antiCache=" + System.currentTimeMillis();
+ }
+
+ // the timeout is needed to let Wicket release the channel
+ target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\", 100);");
+ }
+
+ @Override
+ public void onRequest() {
+ getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(getHandler());
+ }
+
+ protected abstract IRequestHandler getHandler();
+}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.html b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.html
new file mode 100644
index 000000000..dcc4a01c3
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.html
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.java
new file mode 100644
index 000000000..24b5b094e
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/ColorPickerBootstrapFormComponent.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Development Gateway, Inc and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the MIT License (MIT)
+ * which accompanies this distribution, and is available at
+ * https://opensource.org/licenses/MIT
+ *
+ * Contributors:
+ * Development Gateway - initial API and implementation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.devgateway.toolkit.forms.wicket.components.form;
+
+import de.agilecoders.wicket.core.util.Attributes;
+import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.ColorPickerTextField;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.model.IModel;
+
+/**
+ * @author mpostelnicu
+ *
+ */
+public class ColorPickerBootstrapFormComponent extends GenericBootstrapFormComponent {
+
+ private Boolean isFloatedInput = false;
+
+ public ColorPickerBootstrapFormComponent(final String id, final IModel labelModel,
+ final IModel model) {
+ super(id, labelModel, model);
+ }
+
+ public ColorPickerBootstrapFormComponent(final String id, final IModel model) {
+ super(id, model);
+ }
+
+ /**
+ * @param id
+ */
+ public ColorPickerBootstrapFormComponent(final String id) {
+ super(id);
+ }
+
+ @Override
+ protected ColorPickerTextField inputField(final String id, final IModel model) {
+ return new ColorPickerTextField(id, initFieldModel());
+ }
+
+ @Override
+ protected void onComponentTag(final ComponentTag tag) {
+ super.onComponentTag(tag);
+
+ if (getIsFloatedInput()) {
+ Attributes.addClass(tag, "floated-input");
+ }
+ }
+
+
+ public Boolean getIsFloatedInput() {
+ return isFloatedInput;
+ }
+
+ public void setIsFloatedInput(final Boolean isFloatedInput) {
+ this.isFloatedInput = isFloatedInput;
+ }
+
+}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/GenericBootstrapFormComponent.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/GenericBootstrapFormComponent.java
index 93817b35b..6526ac9b4 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/GenericBootstrapFormComponent.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/GenericBootstrapFormComponent.java
@@ -113,6 +113,9 @@ protected FormComponent updatingBehaviorComponent() {
}
protected void getAjaxFormComponentUpdatingBehavior() {
+ if (getUpdateEvent() == null) {
+ return;
+ }
updatingBehaviorComponent().add(new AjaxFormComponentUpdatingBehavior(getUpdateEvent()) {
private static final long serialVersionUID = -2696538086634114609L;
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/DateFilteredBootstrapPropertyColumn.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/DateFilteredBootstrapPropertyColumn.java
new file mode 100644
index 000000000..1ef18fcc7
--- /dev/null
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/DateFilteredBootstrapPropertyColumn.java
@@ -0,0 +1,36 @@
+package org.devgateway.toolkit.forms.wicket.components.table;
+
+import java.util.Date;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterForm;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.filter.TextFilteredPropertyColumn;
+import org.apache.wicket.model.IModel;
+import org.devgateway.toolkit.forms.wicket.components.form.DateFieldBootstrapFormComponent;
+
+/**
+ * A TextFilteredPropertyColumn that uses DateFieldBootstrapFormComponent as a
+ * filter.
+ *
+ * Created by mpostelnicu
+ */
+public class DateFilteredBootstrapPropertyColumn extends TextFilteredPropertyColumn {
+
+ public DateFilteredBootstrapPropertyColumn(final IModel displayModel, final S sortProperty,
+ final String propertyExpression) {
+ super(displayModel, sortProperty, propertyExpression);
+ }
+
+ public DateFilteredBootstrapPropertyColumn(final IModel displayModel, final String propertyExpression) {
+ super(displayModel, propertyExpression);
+ }
+
+ @Override
+ public Component getFilter(final String componentId, final FilterForm> form) {
+ final DateFieldBootstrapFormComponent dateField =
+ new DateFieldBootstrapFormComponent(componentId, getFilterModel(form));
+ dateField.hideLabel();
+ dateField.getField().add(AttributeModifier.replace("onchange", "this.form.submit();"));
+ return dateField;
+ }
+}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/JpaFilterState.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/JpaFilterState.java
index b7fc390ac..88d1311a6 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/JpaFilterState.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/table/JpaFilterState.java
@@ -1,5 +1,6 @@
package org.devgateway.toolkit.forms.wicket.components.table;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.data.jpa.domain.Specification;
import java.io.Serializable;
@@ -11,6 +12,7 @@ public class JpaFilterState implements Serializable {
private static final long serialVersionUID = 2241550275925712593L;
+ @JsonIgnore
public Specification getSpecification() {
return (root, query, cb) -> cb.and();
}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.java
index 3e0b29814..885c6330a 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.java
@@ -47,6 +47,7 @@
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.resource.JQueryResourceReference;
import org.apache.wicket.util.string.StringValue;
+import org.devgateway.ocds.forms.wicket.page.list.ListAllColorIndicatorPage;
import org.devgateway.ocds.forms.wicket.page.list.ListAllDashboardsPage;
import org.devgateway.ocds.forms.wicket.page.list.ListMyDashboardsPage;
import org.devgateway.toolkit.forms.WebConstants;
@@ -284,6 +285,11 @@ protected List newSubMenuButtons(final String arg0) {
list.add(new MenuBookmarkablePageLink(ListUserPage.class, null,
new StringResourceModel("navbar.users", this, null)).setIconType(FontAwesomeIconType.users));
+ list.add(new MenuBookmarkablePageLink(ListAllColorIndicatorPage.class, null,
+ new StringResourceModel("navbar.colorindicators", this, null))
+ .setIconType(FontAwesomeIconType.paint_brush));
+
+
list.add(new MenuBookmarkablePageLink(SpringEndpointsPage.class, null,
new StringResourceModel("navbar.springendpoints", this, null))
.setIconType(FontAwesomeIconType.anchor));
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.properties b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.properties
index affdef1c6..42185791c 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.properties
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/BasePage.properties
@@ -23,4 +23,5 @@ home=Home
navbar.lang=Language
navbar.jminix=JMX Console
navbar.allDashboard=All Saved Dashboards
-mydashboards=My Dashboards
\ No newline at end of file
+mydashboards=My Dashboards
+navbar.colorindicators=Color Indicator Pairs
\ No newline at end of file
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.html b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.html
index 5b08a747d..445d69f49 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.html
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.html
@@ -31,6 +31,10 @@
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.java
index ba7bb04ee..b7f8c3fa2 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.java
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.java
@@ -1,17 +1,21 @@
package org.devgateway.toolkit.forms.wicket.page;
+
+import org.springframework.cache.CacheManager;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxFallbackLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.validation.validator.RangeValidator;
-import org.devgateway.toolkit.web.security.SecurityConstants;
import org.devgateway.toolkit.forms.wicket.components.form.CheckBoxToggleBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.TextFieldBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.page.edit.AbstractEditPage;
import org.devgateway.toolkit.persistence.dao.AdminSettings;
import org.devgateway.toolkit.persistence.repository.AdminSettingsRepository;
+import org.devgateway.toolkit.web.security.SecurityConstants;
import org.wicketstuff.annotation.mount.MountPath;
import java.util.List;
@@ -32,6 +36,15 @@ public class EditAdminSettingsPage extends AbstractEditPage {
private CheckBoxToggleBootstrapFormComponent disableApiSecurity;
+ private TextFieldBootstrapFormComponent adminEmail;
+
+ private CheckBoxToggleBootstrapFormComponent enableDailyAutomatedImport;
+
+ private TextFieldBootstrapFormComponent importFilesPath;
+
+ @SpringBean
+ private CacheManager cacheManager;
+
@SpringBean
protected AdminSettingsRepository adminSettingsRepository;
@@ -72,8 +85,31 @@ protected void onInitialize() {
// rebootServer = new CheckBoxToggleBootstrapFormComponent("rebootServer");
// editForm.add(rebootServer);
-
disableApiSecurity = new CheckBoxToggleBootstrapFormComponent("disableApiSecurity");
editForm.add(disableApiSecurity);
+
+ enableDailyAutomatedImport = new CheckBoxToggleBootstrapFormComponent("enableDailyAutomatedImport");
+ editForm.add(enableDailyAutomatedImport);
+
+
+ adminEmail = new TextFieldBootstrapFormComponent<>("adminEmail");
+ editForm.add(adminEmail);
+
+ importFilesPath = new TextFieldBootstrapFormComponent<>("importFilesPath");
+ editForm.add(importFilesPath);
+
+ addCacheClearLink();
+
+ }
+
+ private void addCacheClearLink() {
+ IndicatingAjaxFallbackLink link = new IndicatingAjaxFallbackLink("clearCache") {
+
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ cacheManager.getCacheNames().forEach(c -> cacheManager.getCache(c).clear());
+ }
+ };
+ editForm.add(link);
}
}
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.properties b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.properties
index 8c2858f17..d4b85289c 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.properties
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditAdminSettingsPage.properties
@@ -6,4 +6,11 @@ rebootServer.label=Enable server reboot warning (just an example)
disableApiSecurity.label=Disable API Security for /api/ endpoints (REQUIRES SERVER REBOOT)
disableApiSecurity.help=This option will disable API security for any endpoint that starts with /api/. This should \
only be used for demo purposes, where full access to the data through the /api/ endpoints is not a problem. The \
- default option on new installations for this setting is OFF.
\ No newline at end of file
+ default option on new installations for this setting is OFF.
+adminEmail.label=Admin Notification Email
+adminEmail.help=The email where notifications about scheduled activities can be sent
+enableDailyAutomatedImport.label=Enable Daily Automated Import
+enableDailyAutomatedImport.help=This will enable daily automated import and transformation of data from third party \
+ sources
+importFilesPath.label=Import Files Path
+importFilesPath.help=The directory on the server where the automated import files are uploaded
\ No newline at end of file
diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditTestFormPage.html b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditTestFormPage.html
index 10e527d6d..6187932b4 100644
--- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditTestFormPage.html
+++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/EditTestFormPage.html
@@ -18,6 +18,7 @@
+