Added configuration of the portlet for the admin. This possibility is actually hidden. Refs #3284
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@113642 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a0352057c4
commit
5873e5a9fd
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
%>
|
||||
|
||||
<portlet:defineObjects />
|
||||
|
||||
<form action="<liferay-portlet:actionURL portletConfiguration="true" />" method="post" name="<portlet:namespace />fm">
|
||||
|
||||
<textarea rows="10" name="<portlet:namespace /><%= JoinVREConfigurationActionImpl.PROPERTIES %>">
|
||||
<%= properties %>
|
||||
</textarea>
|
||||
|
||||
<input type="button" value="Save" onClick="submitForm(document.<portlet:namespace />fm);" />
|
||||
|
||||
</form>
|
|
@ -4,10 +4,15 @@
|
|||
<liferay-portlet-app>
|
||||
<portlet>
|
||||
<portlet-name>joinvre</portlet-name>
|
||||
<!--
|
||||
<configuration-action-class>
|
||||
org.gcube.portlets.user.joinvre.server.portlet.JoinVREConfigurationActionImpl
|
||||
</configuration-action-class>
|
||||
-->
|
||||
<layout-cacheable>false</layout-cacheable>
|
||||
<instanceable>false</instanceable>
|
||||
<ajaxable>false</ajaxable>
|
||||
<!-- LOCATION CSS HERE -->
|
||||
<header-portlet-css>/JoinVRE.css</header-portlet-css>
|
||||
<header-portlet-css>/JoinVRE.css</header-portlet-css>
|
||||
</portlet>
|
||||
</liferay-portlet-app>
|
||||
|
|
Loading…
Reference in New Issue