diff --git a/src/main/java/org/gcube/portlets/user/sbdportlets/AccessConfigurationAction.java b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessConfigurationAction.java new file mode 100644 index 0000000..48b948c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessConfigurationAction.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 AccessConfigurationAction extends DefaultConfigurationAction { + private static Log _log = LogFactoryUtil.getLog(AccessConfigurationAction.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 exploratoryName1Title = prefs.getValue("exploratoryName1-Title", ""); + _log.info("exploratoryName1-Title = " + exploratoryName1Title + " in ConfigurationAction.processAction() saved correctly"); + String exploratoryName2Title = prefs.getValue("exploratoryName2-Title", ""); + _log.info("exploratoryName2-Title = " + exploratoryName2Title + " in ConfigurationAction.processAction() saved correctly"); + String exploratoryName3Title = prefs.getValue("exploratoryName3-Title", ""); + _log.info("exploratoryName3-Title = " + exploratoryName3Title + " in ConfigurationAction.processAction() saved correctly"); + + long exploratoryName1DocumentId = Long.parseLong(prefs.getValue("exploratoryName1-DocumentId", "0")); + _log.info("exploratoryName1-DocumentId = " + exploratoryName1DocumentId + " in ConfigurationAction.processAction() saved correctly"); + long exploratoryName2DocumentId = Long.parseLong(prefs.getValue("exploratoryName2-DocumentId", "0")); + _log.info("exploratoryName2-DocumentId = " + exploratoryName2DocumentId + " in ConfigurationAction.processAction() saved correctly"); + long exploratoryName3DocumentId = Long.parseLong(prefs.getValue("exploratoryName3-DocumentId", "0")); + _log.info("exploratoryName3-DocumentId = " + exploratoryName3DocumentId + " in ConfigurationAction.processAction() saved correctly"); + + String exploratory1Url = prefs.getValue("exploratory1-Url", ""); + _log.info("exploratory1-Url = " + exploratory1Url + " in ConfigurationAction.processAction() saved correctly"); + String exploratory2Url = prefs.getValue("exploratory2-Url", ""); + _log.info("exploratory2-Url = " + exploratory2Url + " in ConfigurationAction.processAction() saved correctly"); + String exploratory3Url = prefs.getValue("exploratory3-Url", ""); + _log.info("exploratory3-Url = " + exploratory3Url + " in ConfigurationAction.processAction() saved correctly"); + + + } + + @Override + public String render(PortletConfig portletConfig, + RenderRequest renderRequest, RenderResponse renderResponse) + throws Exception { + return "/html/accessexploratory/config.jsp"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/sbdportlets/AccessExploratory.java b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessExploratory.java new file mode 100644 index 0000000..daee872 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/sbdportlets/AccessExploratory.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.sbdportlets; + +import com.liferay.util.bridges.mvc.MVCPortlet; + +/** + * Portlet implementation class AccessExploratory + */ +public class AccessExploratory extends MVCPortlet { + + +} diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml index fbec142..5840053 100644 --- a/src/main/webapp/WEB-INF/liferay-display.xml +++ b/src/main/webapp/WEB-INF/liferay-display.xml @@ -9,4 +9,7 @@ + + + \ 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 a024f46..bee6d47 100644 --- a/src/main/webapp/WEB-INF/liferay-portlet.xml +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -24,6 +24,19 @@ collaborate-with-us-portlet + + access-exploratory + /icon.png + org.gcube.portlets.user.sbdportlets.AccessConfigurationAction + /css/main.css + + /js/main.js + + + access-exploratory-portlet + + + administrator Administrator diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml index 95b6d47..415ae18 100644 --- a/src/main/webapp/WEB-INF/portlet.xml +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -67,4 +67,42 @@ user + + access-exploratory + Access Exploratory + + org.gcube.portlets.user.sbdportlets.AccessExploratory + + + view-template + /html/accessexploratory/view.jsp + + + config-template + /html/accessexploratory/config.jsp + + 0 + + text/html + view + config + + + Access Exploratory + Access Exploratory + + + + administrator + + + guest + + + power-user + + + user + + \ No newline at end of file diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index e69de29..2f16e82 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -0,0 +1,11 @@ +.access-exploratory-portlet .asset-title { + border-bottom: 1px solid #DDD; + margin-right: 8px; + padding-bottom: 1px; +} + +.access-exploratory-portlet .asset-summary { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 20px; +} \ No newline at end of file diff --git a/src/main/webapp/html/accessexploratory/config.jsp b/src/main/webapp/html/accessexploratory/config.jsp new file mode 100644 index 0000000..500470e --- /dev/null +++ b/src/main/webapp/html/accessexploratory/config.jsp @@ -0,0 +1,123 @@ +<%@include file="init.jsp"%> + + + +Here you can customise the icon to show besides the Exploratory name + +<% + String icondocURL = GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK)); + + String exploratoryName1Title = GetterUtil.getString(portletPreferences.getValue("exploratoryName1-Title", StringPool.BLANK)); + String exploratoryName2Title = GetterUtil.getString(portletPreferences.getValue("exploratoryName2-Title", StringPool.BLANK)); + String exploratoryName3Title = GetterUtil.getString(portletPreferences.getValue("exploratoryName3-Title", StringPool.BLANK)); + + long exploratoryName1DocumentId = GetterUtil.getLong(portletPreferences.getValue("exploratoryName1-DocumentId", StringPool.BLANK)); + long exploratoryName2DocumentId = GetterUtil.getLong(portletPreferences.getValue("exploratoryName2-DocumentId", StringPool.BLANK)); + long exploratoryName3DocumentId = GetterUtil.getLong(portletPreferences.getValue("exploratoryName3-DocumentId", StringPool.BLANK)); + + String exploratory1Url = GetterUtil.getString(portletPreferences.getValue("exploratory1-Url", StringPool.BLANK)); + String exploratory2Url = GetterUtil.getString(portletPreferences.getValue("exploratory2-Url", StringPool.BLANK)); + String exploratory3Url = GetterUtil.getString(portletPreferences.getValue("exploratory3-Url", StringPool.BLANK)); + + + String displayName_cfg = ""; +%> + + + + + + +

Enter the Exploratory in the following:

+ + + + + + + + +
+ + +
+
+ + + + + + + +
+ + +
+
+ + + + + + + +
+ + +
+
+ + + +
\ No newline at end of file diff --git a/src/main/webapp/html/accessexploratory/init.jsp b/src/main/webapp/html/accessexploratory/init.jsp new file mode 100644 index 0000000..1440bc8 --- /dev/null +++ b/src/main/webapp/html/accessexploratory/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/accessexploratory/view.jsp b/src/main/webapp/html/accessexploratory/view.jsp new file mode 100644 index 0000000..cff4428 --- /dev/null +++ b/src/main/webapp/html/accessexploratory/view.jsp @@ -0,0 +1,131 @@ +<%@include file="init.jsp"%> +<% + long groupId = themeDisplay.getLayout().getGroupId(); + pageContext.setAttribute("icondocURL", + GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK))); + + pageContext.setAttribute("exploratoryName1Title", + GetterUtil.getString(portletPreferences.getValue("exploratoryName1-Title", StringPool.BLANK))); + pageContext.setAttribute("exploratoryName2Title", + GetterUtil.getString(portletPreferences.getValue("exploratoryName2-Title", StringPool.BLANK))); + pageContext.setAttribute("exploratoryName3Title", + GetterUtil.getString(portletPreferences.getValue("exploratoryName3-Title", StringPool.BLANK))); + + long exploratoryName1DocumentId = GetterUtil + .getLong(portletPreferences.getValue("exploratoryName1-DocumentId", StringPool.BLANK)); + long exploratoryName2DocumentId = GetterUtil + .getLong(portletPreferences.getValue("exploratoryName2-DocumentId", StringPool.BLANK)); + long exploratoryName3DocumentId = GetterUtil + .getLong(portletPreferences.getValue("exploratoryName3-DocumentId", StringPool.BLANK)); + + pageContext.setAttribute("exploratory1Url", + GetterUtil.getString(portletPreferences.getValue("exploratory1-Url", StringPool.BLANK))); + pageContext.setAttribute("exploratory2Url", + GetterUtil.getString(portletPreferences.getValue("exploratory2-Url", StringPool.BLANK))); + pageContext.setAttribute("exploratory3Url", + GetterUtil.getString(portletPreferences.getValue("exploratory3-Url", StringPool.BLANK))); + + String content1 = ""; + if (exploratoryName1DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + exploratoryName1DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content1 = node.getText(); + } + + String content2 = ""; + if (exploratoryName2DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + exploratoryName2DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content2 = node.getText(); + } + + String content3 = ""; + if (exploratoryName3DocumentId > 0) { + JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, + "" + exploratoryName3DocumentId); + Document document = SAXReaderUtil.read(article.getContent()); + Node node = document.selectSingleNode("/root/static-content"); + content3 = node.getText(); + } +%> +
+

+ + ${exploratoryName1Title} +

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

+ + ${exploratoryName2Title} +

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

+ + ${exploratoryName3Title} +

+
+
+ <% + if (content3.length() > 225) + out.println(HtmlUtil.stripHtml(content3.substring(0, 222) + " ...")); + %> + + +
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/main/webapp/images/sbd-app.png b/src/main/webapp/images/sbd-app.png new file mode 100644 index 0000000..b59674d Binary files /dev/null and b/src/main/webapp/images/sbd-app.png differ diff --git a/src/main/webapp/images/sbd-exp.png b/src/main/webapp/images/sbd-exp.png new file mode 100644 index 0000000..ec088d2 Binary files /dev/null and b/src/main/webapp/images/sbd-exp.png differ diff --git a/src/main/webapp/js/main.js b/src/main/webapp/js/main.js index 234340a..1aa1b76 100644 --- a/src/main/webapp/js/main.js +++ b/src/main/webapp/js/main.js @@ -31,4 +31,9 @@ Liferay.on('getSelectedItem', function(event) { function removeFromParent(el) { $(el).parent().remove(); +} + +function switchView(hideel, showel) { + $(hideel).hide(); + $(showel).show(); } \ No newline at end of file