From e930da122799b24b4ef9cb1cf3ea42f12a20e041 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Sun, 11 Feb 2018 18:53:37 +0000 Subject: [PATCH] Access Applications done git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/sbd-uploadshare-portlet@163174 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/sbdportlets/AccessApplication.java | 11 ++ .../sbdportlets/AccessApplicationAction.java | 53 +++++++ src/main/webapp/WEB-INF/liferay-display.xml | 1 + src/main/webapp/WEB-INF/liferay-portlet.xml | 12 ++ src/main/webapp/WEB-INF/portlet.xml | 42 +++++- .../webapp/html/accessapplication/config.jsp | 123 ++++++++++++++++ .../webapp/html/accessapplication/init.jsp | 19 +++ .../webapp/html/accessapplication/view.jsp | 137 ++++++++++++++++++ .../webapp/html/collaboratewithus/view.jsp | 25 +++- src/main/webapp/html/uploaddataset/view.jsp | 22 ++- 10 files changed, 434 insertions(+), 11 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplication.java create mode 100644 src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplicationAction.java create mode 100644 src/main/webapp/html/accessapplication/config.jsp create mode 100644 src/main/webapp/html/accessapplication/init.jsp create mode 100644 src/main/webapp/html/accessapplication/view.jsp diff --git a/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplication.java b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplication.java new file mode 100644 index 0000000..318d00c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplication.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.sbdportlets; + +import com.liferay.util.bridges.mvc.MVCPortlet; + +/** + * Portlet implementation class AccessApplication + */ +public class AccessApplication extends MVCPortlet { + + +} diff --git a/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplicationAction.java b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplicationAction.java new file mode 100644 index 0000000..3237d3a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessApplicationAction.java @@ -0,0 +1,53 @@ +package org.gcube.portlets.user.sbdportlets; +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.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.portlet.DefaultConfigurationAction; + +public class AccessApplicationAction extends DefaultConfigurationAction { + private static Log _log = LogFactoryUtil.getLog(AccessApplicationAction.class); + @Override + public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { + super.processAction(portletConfig, actionRequest, actionResponse); + PortletPreferences prefs = actionRequest.getPreferences(); + String icondocURL = prefs.getValue("icondocURL", "0"); + _log.info("icondocURL = " + icondocURL + " in ConfigurationAction.processAction() saved correctly"); + + String applicationName1Title = prefs.getValue("applicationName1-Title", ""); + _log.info("applicationName1-Title = " + applicationName1Title + " in ConfigurationAction.processAction() saved correctly"); + String applicationName2Title = prefs.getValue("applicationName2-Title", ""); + _log.info("applicationName2-Title = " + applicationName2Title + " in ConfigurationAction.processAction() saved correctly"); + String applicationName3Title = prefs.getValue("applicationName3-Title", ""); + _log.info("applicationName3-Title = " + applicationName3Title + " in ConfigurationAction.processAction() saved correctly"); + + long applicationName1DocumentId = Long.parseLong(prefs.getValue("applicationName1-DocumentId", "0")); + _log.info("applicationName1-DocumentId = " + applicationName1DocumentId + " in ConfigurationAction.processAction() saved correctly"); + long applicationName2DocumentId = Long.parseLong(prefs.getValue("applicationName2-DocumentId", "0")); + _log.info("applicationName2-DocumentId = " + applicationName2DocumentId + " in ConfigurationAction.processAction() saved correctly"); + long applicationName3DocumentId = Long.parseLong(prefs.getValue("applicationName3-DocumentId", "0")); + _log.info("applicationName3-DocumentId = " + applicationName3DocumentId + " in ConfigurationAction.processAction() saved correctly"); + + String application1Url = prefs.getValue("application1-Url", ""); + _log.info("application1-Url = " + application1Url + " in ConfigurationAction.processAction() saved correctly"); + String application2Url = prefs.getValue("application2-Url", ""); + _log.info("application2-Url = " + application2Url + " in ConfigurationAction.processAction() saved correctly"); + String application3Url = prefs.getValue("application3-Url", ""); + _log.info("application3-Url = " + application3Url + " in ConfigurationAction.processAction() saved correctly"); + + + } + + @Override + public String render(PortletConfig portletConfig, + RenderRequest renderRequest, RenderResponse renderResponse) + throws Exception { + return "/html/accessapplication/config.jsp"; + } + +} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml index 5840053..0d252a3 100644 --- a/src/main/webapp/WEB-INF/liferay-display.xml +++ b/src/main/webapp/WEB-INF/liferay-display.xml @@ -11,5 +11,6 @@ + \ 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 bee6d47..4d32656 100644 --- a/src/main/webapp/WEB-INF/liferay-portlet.xml +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -37,6 +37,18 @@ + + access-application + /icon.png + org.gcube.portlets.user.sbdportlets.AccessApplicationAction + /css/main.css + + /js/main.js + + + access-application-portlet + + administrator Administrator diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml index 415ae18..a61ec91 100644 --- a/src/main/webapp/WEB-INF/portlet.xml +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -50,7 +50,7 @@ view - Collaborate with us on your Research Idea + Submit your Idea Collaborate With Us @@ -88,7 +88,7 @@ config - Access Exploratory + Exploratories Access Exploratory @@ -105,4 +105,42 @@ user + + access-application + Access Application + + org.gcube.portlets.user.sbdportlets.AccessApplication + + + view-template + /html/accessapplication/view.jsp + + + config-template + /html/accessapplication/config.jsp + + 0 + + text/html + view + config + + + Applications + Access Application + + + + administrator + + + guest + + + power-user + + + user + + \ No newline at end of file diff --git a/src/main/webapp/html/accessapplication/config.jsp b/src/main/webapp/html/accessapplication/config.jsp new file mode 100644 index 0000000..e848e24 --- /dev/null +++ b/src/main/webapp/html/accessapplication/config.jsp @@ -0,0 +1,123 @@ +<%@include file="init.jsp"%> + + + +Here you can customise the icon to show besides the application name + +<% + String icondocURL = GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK)); + + String applicationName1Title = GetterUtil.getString(portletPreferences.getValue("applicationName1-Title", StringPool.BLANK)); + String applicationName2Title = GetterUtil.getString(portletPreferences.getValue("applicationName2-Title", StringPool.BLANK)); + String applicationName3Title = GetterUtil.getString(portletPreferences.getValue("applicationName3-Title", StringPool.BLANK)); + + long applicationName1DocumentId = GetterUtil.getLong(portletPreferences.getValue("applicationName1-DocumentId", StringPool.BLANK)); + long applicationName2DocumentId = GetterUtil.getLong(portletPreferences.getValue("applicationName2-DocumentId", StringPool.BLANK)); + long applicationName3DocumentId = GetterUtil.getLong(portletPreferences.getValue("applicationName3-DocumentId", StringPool.BLANK)); + + String application1Url = GetterUtil.getString(portletPreferences.getValue("application1-Url", StringPool.BLANK)); + String application2Url = GetterUtil.getString(portletPreferences.getValue("application2-Url", StringPool.BLANK)); + String application3Url = GetterUtil.getString(portletPreferences.getValue("application3-Url", StringPool.BLANK)); + + + String displayName_cfg = ""; +%> + + + + + + +

Enter the application in the following:

+ + + + + + + + +
+ + +
+
+ + + + + + + +
+ + +
+
+ + + + + + + +
+ + +
+
+ + + +
\ No newline at end of file diff --git a/src/main/webapp/html/accessapplication/init.jsp b/src/main/webapp/html/accessapplication/init.jsp new file mode 100644 index 0000000..1440bc8 --- /dev/null +++ b/src/main/webapp/html/accessapplication/init.jsp @@ -0,0 +1,19 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + +<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %> +<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> +<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> + +<%@ page import="com.liferay.portal.kernel.util.Constants" %> +<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %> +<%@ page import="com.liferay.portal.kernel.util.StringPool" %> +<%@ page import="com.liferay.portlet.journal.model.JournalArticle" %> +<%@ page import="com.liferay.portlet.journal.service.JournalArticleLocalServiceUtil" %> +<%@ page import="com.liferay.portal.kernel.xml.Document" %> +<%@ page import="com.liferay.portal.kernel.xml.Node" %> +<%@ page import="com.liferay.portal.kernel.xml.SAXReaderUtil" %> +<%@ page import="com.liferay.portal.kernel.util.HtmlUtil" %> +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> + + + \ No newline at end of file diff --git a/src/main/webapp/html/accessapplication/view.jsp b/src/main/webapp/html/accessapplication/view.jsp new file mode 100644 index 0000000..7948ff9 --- /dev/null +++ b/src/main/webapp/html/accessapplication/view.jsp @@ -0,0 +1,137 @@ +<%@include file="init.jsp"%> +<% + long groupId = themeDisplay.getLayout().getGroupId(); + pageContext.setAttribute("icondocURL", + GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK))); + + pageContext.setAttribute("applicationName1Title", + GetterUtil.getString(portletPreferences.getValue("applicationName1-Title", StringPool.BLANK))); + pageContext.setAttribute("applicationName2Title", + GetterUtil.getString(portletPreferences.getValue("applicationName2-Title", StringPool.BLANK))); + pageContext.setAttribute("applicationName3Title", + GetterUtil.getString(portletPreferences.getValue("applicationName3-Title", StringPool.BLANK))); + + long applicationName1DocumentId = GetterUtil + .getLong(portletPreferences.getValue("applicationName1-DocumentId", StringPool.BLANK)); + long applicationName2DocumentId = GetterUtil + .getLong(portletPreferences.getValue("applicationName2-DocumentId", StringPool.BLANK)); + long applicationName3DocumentId = GetterUtil + .getLong(portletPreferences.getValue("applicationName3-DocumentId", StringPool.BLANK)); + + pageContext.setAttribute("application1Url", + GetterUtil.getString(portletPreferences.getValue("application1-Url", StringPool.BLANK))); + pageContext.setAttribute("application2Url", + GetterUtil.getString(portletPreferences.getValue("application2-Url", StringPool.BLANK))); + pageContext.setAttribute("application3Url", + GetterUtil.getString(portletPreferences.getValue("application3-Url", StringPool.BLANK))); + + String content1 = ""; + if (applicationName1DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + applicationName1DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content1 = node.getText(); + } + + String content2 = ""; + if (applicationName2DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + applicationName2DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content2 = node.getText(); + } + + String content3 = ""; + if (applicationName3DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + applicationName3DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content3 = node.getText(); + } +%> + +
+

+ + ${applicationName1Title} +

+
+
+ <% + if (content1.length() > 225) + out.println(HtmlUtil.stripHtml(content1.substring(0, 222) + " ...")); + %> + + +
+ +
+
+ +
+
+
+ + +
+

+ + ${applicationName2Title} +

+
+
+ <% + if (content2.length() > 225) + out.println(HtmlUtil.stripHtml(content2.substring(0, 222) + " ...")); + %> + + +
+ +
+
+ +
+
+
+ + +
+

+ + ${applicationName3Title} +

+
+
+ <% + if (content3.length() > 225) + out.println(HtmlUtil.stripHtml(content3.substring(0, 222) + " ...")); + %> + + +
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/src/main/webapp/html/collaboratewithus/view.jsp b/src/main/webapp/html/collaboratewithus/view.jsp index 6aaa2e6..92f36ec 100644 --- a/src/main/webapp/html/collaboratewithus/view.jsp +++ b/src/main/webapp/html/collaboratewithus/view.jsp @@ -9,11 +9,17 @@ -<% if(SessionErrors.contains(renderRequest.getPortletSession(),"experiment-form-error")){%> - -<%} %> +<% + if (SessionErrors.contains(renderRequest.getPortletSession(), "experiment-form-error")) { +%> + +<% + } +%> - +  Back (Cancel) +

Please give us a description about the + dataset/method you want to insert in the catalogue. The SoBigData + research, technical and ethical boards will evaluate your application + before the actual upload. In particular, in case of datasets, please + visit also our + First aid for Responsible data Scientists: we + provide resources and information to understand and check possible + ethical issues for your dataset.

@@ -50,7 +64,8 @@ - Cancel + + Cancel diff --git a/src/main/webapp/html/uploaddataset/view.jsp b/src/main/webapp/html/uploaddataset/view.jsp index ff75d25..7a9b6f3 100644 --- a/src/main/webapp/html/uploaddataset/view.jsp +++ b/src/main/webapp/html/uploaddataset/view.jsp @@ -46,13 +46,24 @@
+  Back (Cancel) +

+ Please give us a description about the dataset/method you want to + insert in the catalogue. The SoBigData research, technical and + ethical boards will evaluate your application before the actual + upload. In particular, in case of datasets, please visit also our First aid for + Responsible data Scientists: we provide resources and information to + understand and check possible ethical issues for your dataset. +

- + + Additional Material: Select file to attach + href="javascript:showWPPopup('<%=wpExplorerPopupURL%>');" + style="margin: 10px 0;"> + Select file to attach
@@ -72,7 +85,8 @@ Cancel -

Please note: depending on the number of attachments it could take some time (seconds) to submit the request.

+

Please note: depending on the number of attachments it could + take some time (seconds) to submit the request.