From d2c18da2947bfab6381aea6552f0b6b07ed590bb Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Sun, 11 Feb 2018 17:44:54 +0000 Subject: [PATCH] Access Exploratory done git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/sbd-uploadshare-portlet@163173 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../AccessConfigurationAction.java | 53 +++++++ .../user/sbdportlets/AccessExploratory.java | 11 ++ src/main/webapp/WEB-INF/liferay-display.xml | 3 + src/main/webapp/WEB-INF/liferay-portlet.xml | 13 ++ src/main/webapp/WEB-INF/portlet.xml | 38 +++++ src/main/webapp/css/main.css | 11 ++ .../webapp/html/accessexploratory/config.jsp | 123 ++++++++++++++++ .../webapp/html/accessexploratory/init.jsp | 19 +++ .../webapp/html/accessexploratory/view.jsp | 131 ++++++++++++++++++ src/main/webapp/images/sbd-app.png | Bin 0 -> 879 bytes src/main/webapp/images/sbd-exp.png | Bin 0 -> 1375 bytes src/main/webapp/js/main.js | 5 + 12 files changed, 407 insertions(+) create mode 100644 src/main/java/org/gcube/portlets/user/sbdportlets/AccessConfigurationAction.java create mode 100644 src/main/java/org/gcube/portlets/user/sbdportlets/AccessExploratory.java create mode 100644 src/main/webapp/html/accessexploratory/config.jsp create mode 100644 src/main/webapp/html/accessexploratory/init.jsp create mode 100644 src/main/webapp/html/accessexploratory/view.jsp create mode 100644 src/main/webapp/images/sbd-app.png create mode 100644 src/main/webapp/images/sbd-exp.png 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 0000000000000000000000000000000000000000..b59674d0ce1f5298099ea7999d381e98d0c483e3 GIT binary patch literal 879 zcmV-#1CacQP)peLqP>g0&Wzch&7Gb_zzgOK}Dz{6rmIo zp)r{xlQ;9;ynBv|HzUO=H75aoXy6;Hc`i;ho_=XG}n^K}(l zmE2c`!{Cy9^HcjMR*n{uk1t&IJpa^%I%Z%2+;A80Zf-_!TZ_!*M!x>#`@V!eITsHRS*FSSlWh=jlqy8!0c>vvQk&fw{0rbi00l^{y?t3>#?v;o(*XB=qdi8fwK1eTfWU0y{c}?Q z;@8g)w33m(-ST>Pv<@Pa-uVDI`%)oKdL7E4Jb&;fa`y*72pj8Imi|-Q%$|>1X>A&% zZadq>&?Q2iJ4fY}*H3KlzrB=G0IFzp6mM*t**#sFj6pBr0ZW?u(@MX+!RDO>1TBo{ znIYOWNYOOeC)dF$p|JtZrP$0Sq?2{K(?Z@v) z|93W$v>2EagOl#r%eU_T!LtBnSaTcTVQn*87J%g1Thku=J5LjAd#mqy^j{mnwzu%K zMX>PR*sXiZ3NSSP<85~qr96Pv#tuBU6T%JKY2aB3_|36f_m-jiIRFel7`o!HD5Wyd z$SI^$=}+vAcT&P`qickJG17W*u6KR>gS~oTDwusHVrNeJV9oP~;yzdV>euCi_`cfg zqc8U}fi7AzZCsS=07?_nZLn2Bde0{8v^Ko2Tt~skz|cV7z)0WFNY~KZ%Gk)tz(4^Clz_GsrKDK}xwt{?0`hE?GD=Dctn~HE z%ggo3jrH=2()A53EiFN27#ZmTRp=I1=9MH?=;jqG!%T2VElw`VEGWs$&r<-In3$Ab zT4JjNbScCOxdpzyaD(%Tp#cR9GX09g0)0b01O41wkiWpHi%Wu15zfG>x;Uh=AXPso zwK%`DC>aHC8V9$)&lec_p4Mwn{(|y_C!pD+^Ntb2nobXIEEO zBSS-1b0;@P6Bi>VBNKB=BU4uwbC_PwyyB9?yyR4v-b{pEC%k&CoQqNuOY)0C^7C_G zu@{h$Uy@&(kzb(T9BiuKo0y!L2jYW*7V6T}qRg_?6t|-MTm^90SY@Kw4|2PKp@o5= zp}C2HxsidHg`uI7fw8%pqqD22xtWo(p`)1+RBs9ve-qTJ4|I$^C}NQ!8YToxJs>7L z*#bH6grAxROzlO$WG$8AwUU8>@v^6jV@SoVBf$}C@4j6>Q~d1Q zU0Ii>54i4sI#^>ZFaQ2*O|$=P>DlY~w!iy*sC|!{Ra5ro-tzwIa(7b{C(Yg4oBnpO z`1hJfU6Yx94}$i7Yzqns6#pfV5Rk){$THDKNU)>vX@-epiDN>PR05AfpjSo*gN*X} z`<4I7nWigq&)C?}==lHFr&$JNDZ--GvpCaLGHq(U9aPdk%4M^xNm-bi@4zC723?zD z?+?p&|4k|2W8C^!FDvBj)okwhy7rP^#o7zs+bC%**M3-iRnO>iPP)KbyL`2|+shq( z1zI}GJZinlzg+rk`?P&_8MYa+`}aprJg6{ziPh?u$cUS2zpm};nL9n(A3_#VnCFqmm#61%ZQa zEPwoGGwFTtKJ)5jNslSF_JuVYnJ`^+HedgL#qHDE=iQ0ewJ-D1syXXiJQAlnq?=hh z`!x6QhM1}O_3MhB-FVcW-jF`suCx1f?&Nl*&J~LUUTOcfa4olIm0&PGzMZXA|7|0v O$n$jdb6Mw<&;$UBYVEoJ literal 0 HcmV?d00001 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