diff --git a/src/main/java/org/gcube/portlets/user/joinvre/server/portlet/JoinVREConfigurationActionImpl.java b/src/main/java/org/gcube/portlets/user/joinvre/server/portlet/JoinVREConfigurationActionImpl.java new file mode 100644 index 0000000..e93d688 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/joinvre/server/portlet/JoinVREConfigurationActionImpl.java @@ -0,0 +1,51 @@ +/** + * + */ +package org.gcube.portlets.user.joinvre.server.portlet; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.PortletConfig; +import javax.portlet.PortletPreferences; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import com.liferay.portal.kernel.portlet.ConfigurationAction; +import com.liferay.portal.kernel.servlet.SessionMessages; +import com.liferay.portal.kernel.util.ParamUtil; +import com.liferay.portlet.PortletPreferencesFactoryUtil; + +/** + * @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/ + */ +public class JoinVREConfigurationActionImpl implements ConfigurationAction { + + public static final String PORTLET_RESOURCE = "portletResource"; + + public static final String PROPERTIES = "properties"; + + /** {@inheritDoc} */ + @Override + public void processAction(PortletConfig portletConfig, + ActionRequest actionRequest, ActionResponse actionResponse) + throws Exception { + + PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, PORTLET_RESOURCE); + + String properties = ParamUtil.getString(actionRequest, PROPERTIES); + preferences.setValue(PROPERTIES, properties); + + preferences.store(); + + SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure"); + } + + /** {@inheritDoc} */ + @Override + public String render(PortletConfig portletConfig, + RenderRequest renderRequest, RenderResponse renderResponse) + throws Exception { + return "/WEB-INF/jsp/JoinVRE_config.jsp"; + } + +} diff --git a/src/main/webapp/WEB-INF/jsp/JoinVRE_config.jsp b/src/main/webapp/WEB-INF/jsp/JoinVRE_config.jsp new file mode 100644 index 0000000..85fd7a4 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/JoinVRE_config.jsp @@ -0,0 +1,25 @@ +<%@page import="com.liferay.portal.kernel.util.ParamUtil"%> +<%@page import="com.liferay.portal.kernel.util.StringPool"%> +<%@page import="com.liferay.portlet.PortletPreferencesFactoryUtil"%> + +<%@page import="javax.portlet.PortletPreferences"%> + +<%@page import="org.gcube.portlets.user.joinvre.server.portlet.JoinVREConfigurationActionImpl"%> + +<% +String portletResource = ParamUtil.getString(request, JoinVREConfigurationActionImpl.PORTLET_RESOURCE); +PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource); +String properties = preferences.getValue(JoinVREConfigurationActionImpl.PROPERTIES, StringPool.BLANK); +%> + + + +
" method="post" name="fm"> + + + + + + \ 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 f5392d4..bae710f 100644 --- a/src/main/webapp/WEB-INF/liferay-portlet.xml +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -4,10 +4,15 @@ joinvre + false false false - /JoinVRE.css + /JoinVRE.css