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
master
Massimiliano Assante 6 years ago
parent ba4f570582
commit d2c18da294

@ -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";
}
}

@ -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 {
}

@ -9,4 +9,7 @@
<portlet id="upload-dataset"></portlet>
<portlet id="collaborate-with-us"></portlet>
</category>
<category name="gCube Applications">
<portlet id="access-exploratory"></portlet>
</category>
</display>

@ -24,6 +24,19 @@
collaborate-with-us-portlet
</css-class-wrapper>
</portlet>
<portlet>
<portlet-name>access-exploratory</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>org.gcube.portlets.user.sbdportlets.AccessConfigurationAction</configuration-action-class>
<header-portlet-css>/css/main.css</header-portlet-css>
<header-portlet-javascript>
/js/main.js
</header-portlet-javascript>
<css-class-wrapper>
access-exploratory-portlet
</css-class-wrapper>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>

@ -67,4 +67,42 @@
<role-name>user</role-name>
</security-role-ref>
</portlet>
<portlet>
<portlet-name>access-exploratory</portlet-name>
<display-name>Access Exploratory</display-name>
<portlet-class>
org.gcube.portlets.user.sbdportlets.AccessExploratory
</portlet-class>
<init-param>
<name>view-template</name>
<value>/html/accessexploratory/view.jsp</value>
</init-param>
<init-param>
<name>config-template</name>
<value>/html/accessexploratory/config.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>config</portlet-mode>
</supports>
<portlet-info>
<title>Access Exploratory</title>
<short-title>Access Exploratory</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>

@ -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;
}

@ -0,0 +1,123 @@
<%@include file="init.jsp"%>
<liferay-portlet:actionURL portletConfiguration="true"
var="configurationURL" />
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 = "";
%>
<aui:form action="<%=configurationURL%>" method="post" name="fm">
<aui:input name="<%=Constants.CMD%>" type="hidden"
value="<%=Constants.UPDATE%>" />
<aui:input name="preferences--icondocURL--" type="text"
cssClass="text long-field" showRequiredLabel="true" label="Icon docId"
inlineField="true" inlineLabel="left" placeholder="Relative URL of the image"
helpMessage="Relative URL of the image taken from Liferay CMS of the icons"
value="<%=icondocURL%>" required="false">
</aui:input>
<p>Enter the Exploratory in the following:</p>
<!-- Application URL -->
<aui:field-wrapper cssClass="field-group">
<table>
<tr>
<td><aui:input name="preferences--exploratoryName1-Title--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Name 1" inlineField="true" inlineLabel="left"
placeholder="Exploratory"
helpMessage="Display Name of the Exploratory"
value="<%=exploratoryName1Title%>" required="false" /></td>
<td><aui:input
name="preferences--exploratoryName1-DocumentId--" type="text"
cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Document Id 1" inlineField="true"
inlineLabel="left" placeholder="ID"
helpMessage="ID taken from Liferay CMS in this Site"
value="<%=exploratoryName1DocumentId%>" required="false">
<aui:validator name="digits"></aui:validator>
</aui:input></td>
<td><aui:input name="preferences--exploratory1-Url--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="URL of the VRE 1" inlineField="true" inlineLabel="left"
placeholder="url" helpMessage="URL" value="<%=exploratory1Url%>"
required="false">
</aui:input></td>
</tr>
</table>
</aui:field-wrapper>
<aui:field-wrapper cssClass="field-group">
<table>
<tr>
<td><aui:input name="preferences--exploratoryName2-Title--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Name 2" inlineField="true" inlineLabel="left"
placeholder="Exploratory"
helpMessage="Display Name of the Exploratory"
value="<%=exploratoryName2Title%>" required="false" /></td>
<td><aui:input
name="preferences--exploratoryName2-DocumentId--" type="text"
cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Document Id 2" inlineField="true"
inlineLabel="left" placeholder="ID"
helpMessage="ID taken from Liferay CMS in this Site"
value="<%=exploratoryName2DocumentId%>" required="false">
<aui:validator name="digits"></aui:validator>
</aui:input></td>
<td><aui:input name="preferences--exploratory2-Url--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="URL of the VRE 2" inlineField="true" inlineLabel="left"
placeholder="url" helpMessage="URL" value="<%=exploratory2Url%>"
required="false">
</aui:input></td>
</tr>
</table>
</aui:field-wrapper>
<aui:field-wrapper cssClass="field-group">
<table>
<tr>
<td><aui:input name="preferences--exploratoryName3-Title--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Name 3" inlineField="true" inlineLabel="left"
placeholder="Exploratory"
helpMessage="Display Name of the Exploratory"
value="<%=exploratoryName3Title%>" required="false" /></td>
<td><aui:input
name="preferences--exploratoryName3-DocumentId--" type="text"
cssClass="text long-field" showRequiredLabel="true"
label="Exploratory Document Id 3" inlineField="true"
inlineLabel="left" placeholder="ID"
helpMessage="ID taken from Liferay CMS in this Site"
value="<%=exploratoryName3DocumentId%>" required="false">
<aui:validator name="digits"></aui:validator>
</aui:input></td>
<td><aui:input name="preferences--exploratory3-Url--"
type="text" cssClass="text long-field" showRequiredLabel="true"
label="URL of the VRE 3" inlineField="true" inlineLabel="left"
placeholder="url" helpMessage="URL" value="<%=exploratory3Url%>"
required="false">
</aui:input></td>
</tr>
</table>
</aui:field-wrapper>
<aui:button-row>
<aui:button type="submit" />
</aui:button-row>
</aui:form>

@ -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"%>
<liferay-theme:defineObjects />
<portlet:defineObjects />

@ -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();
}
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${exploratory1Url}"><img alt="" src="${icondocURL}">
${exploratoryName1Title}</a>
</h3>
<div class="asset-content">
<div class="asset-summary" style="margin-left: 25px;">
<span id="asset-summarypre1"> <%
if (content1.length() > 225)
out.println(HtmlUtil.stripHtml(content1.substring(0, 222) + " ..."));
%>
<div>
<a
href="javascript:switchView('#asset-summarypre1', '#asset-summary-1');">Read
More » </a>
</div>
</span>
<div class="asset-more">
<div id="asset-summary-1" class="asset-summary"
style="display: none;"><%=content1%></div>
</div>
</div>
<div class="asset-metadata"></div>
</div>
</div>
<!-- SECOND -->
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${exploratory2Url}"><img alt="" src="${icondocURL}">
${exploratoryName2Title}</a>
</h3>
<div class="asset-content">
<div class="asset-summary" style="margin-left: 25px;">
<span id="asset-summarypre2"> <%
if (content2.length() > 225)
out.println(HtmlUtil.stripHtml(content2.substring(0, 222) + " ..."));
%>
<div>
<a
href="javascript:switchView('#asset-summarypre2', '#asset-summary-2');">Read
More » </a>
</div>
</span>
<div class="asset-more">
<div id="asset-summary-2" class="asset-summary"
style="display: none;"><%=content2%></div>
</div>
</div>
<div class="asset-metadata"></div>
</div>
</div>
<!-- THIRD -->
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${exploratory3Url}"><img alt="" src="${icondocURL}">
${exploratoryName3Title}</a>
</h3>
<div class="asset-content">
<div class="asset-summary" style="margin-left: 25px;">
<span id="asset-summarypre3"> <%
if (content3.length() > 225)
out.println(HtmlUtil.stripHtml(content3.substring(0, 222) + " ..."));
%>
<div>
<a
href="javascript:switchView('#asset-summarypre3', '#asset-summary-3');">Read
More » </a>
</div>
</span>
<div class="asset-more">
<div id="asset-summary-3" class="asset-summary"
style="display: none;"><%=content3%></div>
</div>
</div>
<div class="asset-metadata"></div>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -31,4 +31,9 @@ Liferay.on('getSelectedItem', function(event) {
function removeFromParent(el) {
$(el).parent().remove();
}
function switchView(hideel, showel) {
$(hideel).hide();
$(showel).show();
}
Loading…
Cancel
Save