From 9d692c450a17ac7353d4f7ab7a281916acfa3889 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Wed, 3 Nov 2021 12:57:27 +0100 Subject: [PATCH] integrated captcha --- pom.xml | 4 +- .../portlets/user/moving/CompileForm.java | 34 +++++++-- src/main/webapp/WEB-INF/liferay-portlet.xml | 1 - .../webapp/html/form-compile/form-map.jsp | 76 ++++++++++++++----- src/main/webapp/html/init.jsp | 57 ++------------ 5 files changed, 92 insertions(+), 80 deletions(-) diff --git a/pom.xml b/pom.xml index 042a147..62bb9b8 100644 --- a/pom.xml +++ b/pom.xml @@ -158,8 +158,8 @@ maven-compiler-plugin UTF-8 - 1.8 - 1.8 + ${maven.compiler.source} + ${maven.compiler.target} diff --git a/src/main/java/org/gcube/portlets/user/moving/CompileForm.java b/src/main/java/org/gcube/portlets/user/moving/CompileForm.java index a835c83..fc2d2a3 100644 --- a/src/main/java/org/gcube/portlets/user/moving/CompileForm.java +++ b/src/main/java/org/gcube/portlets/user/moving/CompileForm.java @@ -5,17 +5,21 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletException; +import javax.portlet.ProcessAction; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; +import javax.portlet.ResourceRequest; +import javax.portlet.ResourceResponse; import org.gcube.common.portal.PortalContext; - +import com.liferay.portal.kernel.captcha.CaptchaUtil; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.util.bridges.mvc.MVCPortlet; @@ -49,9 +53,27 @@ public class CompileForm extends MVCPortlet { } super.render(renderRequest, renderResponse); } - - public void addEntry(ActionRequest request, ActionResponse response) { - System.out.println("bao"); + + public void submittedForm(ActionRequest actionRequest, + ActionResponse actionResponse) throws IOException, PortletException { + String name = actionRequest.getParameter("name"); + String surname = actionRequest.getParameter("surname"); + String organisation = actionRequest.getParameter("organisation"); + String emailAddress = actionRequest.getParameter("emailAddress"); + String organisationType = actionRequest.getParameter("organisationType"); + String mainMotivation = actionRequest.getParameter("mainMotivation"); + String[] itemsAreaOfExpertiseSelectValues = actionRequest.getParameterValues("areaOfExpertiseSelect"); + String commitment = actionRequest.getParameter("commitment"); + System.out.println("name:" + name); + System.out.println("surname:" + surname); + System.out.println("organisation:" + organisation); + System.out.println("email:" + emailAddress); + System.out.println(organisationType); + System.out.println(mainMotivation); + for (int i = 0; i < itemsAreaOfExpertiseSelectValues.length; i++) { + System.out.println(itemsAreaOfExpertiseSelectValues[i]); + } + System.out.println(commitment); } private static List getOrganisationTypes(Connection conn) throws Exception { @@ -95,7 +117,7 @@ public class CompileForm extends MVCPortlet { } return toReturn; } - + private static List getDgreesOfParticipation(Connection conn) throws Exception { _log.debug("getting degrees_of_participation "); List toReturn = new ArrayList<>(); @@ -109,4 +131,6 @@ public class CompileForm extends MVCPortlet { } return toReturn; } + + } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml index 7d09247..ef14f19 100644 --- a/src/main/webapp/WEB-INF/liferay-portlet.xml +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -6,7 +6,6 @@ moving-form-compile /icon.png /css/main.css - https://www.google.com/recaptcha/api.js /js/main.js diff --git a/src/main/webapp/html/form-compile/form-map.jsp b/src/main/webapp/html/form-compile/form-map.jsp index 15fca56..1a9f9ee 100644 --- a/src/main/webapp/html/form-compile/form-map.jsp +++ b/src/main/webapp/html/form-compile/form-map.jsp @@ -12,31 +12,41 @@ pageContext.setAttribute("organisation_types", organisation_types); pageContext.setAttribute("main_motivations", main_motivations); pageContext.setAttribute("areas_of_expertise", areas_of_expertise); pageContext.setAttribute("degrees_of_participation", degrees_of_participation); -%> +pageContext.setAttribute("required", "false"); +%> - + + + + + + + +

Expression of Interest for the EU Multi-Actor Platform

- + - - + + required="${required}" style="width:300px;" /> + required="${required}" showEmptyOption="${required}" + style="width:800px;"> ${type} - + - + ${type} @@ -62,8 +72,8 @@ pageContext.setAttribute("degrees_of_participation", degrees_of_participation); --> + name="areaOfExpertiseSelect" required="${required}" + style="width:800px;" multiple="${required}"> ${type} @@ -73,9 +83,12 @@ pageContext.setAttribute("degrees_of_participation", degrees_of_participation); label="Please elaborate on the relevant experience you can bring to mountain value chains and the resilience of these areas, so that we have more detailed information to be able to form a dynamic and relevant community." name="textareaExperience" type="textarea" style="width:800px;" placeholder="Free text 150 words" /> + ${type} @@ -96,16 +109,37 @@ pageContext.setAttribute("degrees_of_participation", degrees_of_participation); .

+ name="privacyPolicyAgree" label="I Agree" required="${required}" />
-
-
- +
+
+ + +
+ + diff --git a/src/main/webapp/html/init.jsp b/src/main/webapp/html/init.jsp index 16f7b85..e17b847 100644 --- a/src/main/webapp/html/init.jsp +++ b/src/main/webapp/html/init.jsp @@ -1,60 +1,15 @@ -<%@page import="com.liferay.portal.model.Layout"%> <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - -<%@ taglib uri="http://alloy.liferay.com/tld/aui" prefix="aui" %> -<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> -<%@ taglib uri="http://liferay.com/tld/security" prefix="liferay-security" %> +<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %> +<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> <%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> -<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> -<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %> - -<%@page import="com.liferay.util.portlet.PortletRequestUtil"%> -<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%> -<%@ page import="com.liferay.portal.util.PortalUtil" %> -<%@ page import="com.liferay.portal.kernel.util.StringUtil" %> -<%@ page import="com.liferay.portal.kernel.util.Validator"%> -<%@ page import="com.liferay.portal.kernel.util.StringPool" %> -<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %> -<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %> -<%@ page import="com.liferay.portal.kernel.util.ListUtil" %> -<%@ page import="com.liferay.portal.kernel.util.Validator" %> -<%@ page import="com.liferay.portal.kernel.util.WebKeys" %> -<%@ page import="com.liferay.portal.kernel.bean.BeanParamUtil" %> -<%@ page import="com.liferay.portal.kernel.language.LanguageUtil"%> -<%@page import="com.liferay.portal.kernel.util.GetterUtil"%> -<%@ page import="com.liferay.portal.service.permission.PortalPermissionUtil" %> -<%@ page import="com.liferay.portal.service.permission.PortletPermissionUtil" %> -<%@ page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> -<%@ page import="com.liferay.portal.kernel.portlet.LiferayPortletMode"%> <%@ page import="javax.portlet.PortletURL" %> <%@ page import="java.util.List" %> -<%@ page import="java.net.URLEncoder" %> <%@ page import="java.util.ArrayList" %> -<%@ page import="java.util.Map" %> -<%@ page import="java.util.LinkedHashMap" %> -<%@page import="com.liferay.portal.kernel.dao.search.RowChecker"%> -<%@ page import="java.util.Calendar" %> -<%@ page import="java.util.Collections" %> -<%@page import="java.util.Date"%> -<%@page import="java.util.Base64"%> -<%@ page import="java.text.SimpleDateFormat"%> -<%@ page import="java.text.DateFormat"%> -<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%> -<%@page import="com.liferay.portlet.journal.model.JournalArticle"%> -<%@page import="com.liferay.portlet.dynamicdatamapping.model.DDMTemplate"%> -<%@page import="com.liferay.portlet.dynamicdatamapping.model.DDMStructure"%> -<%@page import="com.liferay.portal.security.permission.ActionKeys"%> -<%@page import="javax.portlet.PortletSession"%> -<%@page import="com.liferay.portal.model.Team"%> -<%@page import="com.liferay.portal.model.Group"%> -<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%> -<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%> - - + - + + +