Access Applications done
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/sbd-uploadshare-portlet@163174 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
parent
d2c18da294
commit
e930da1227
@ -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 {
|
||||
|
||||
|
||||
}
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
@ -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 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 = "";
|
||||
%>
|
||||
|
||||
<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 application in the following:</p>
|
||||
<!-- Application URL -->
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<table>
|
||||
<tr>
|
||||
<td><aui:input name="preferences--applicationName1-Title--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Name 1" inlineField="true" inlineLabel="left"
|
||||
placeholder="application"
|
||||
helpMessage="Display Name of the application"
|
||||
value="<%=applicationName1Title%>" required="false" /></td>
|
||||
<td><aui:input
|
||||
name="preferences--applicationName1-DocumentId--" type="text"
|
||||
cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Document Id 1" inlineField="true"
|
||||
inlineLabel="left" placeholder="ID"
|
||||
helpMessage="ID taken from Liferay CMS in this Site"
|
||||
value="<%=applicationName1DocumentId%>" required="false">
|
||||
<aui:validator name="digits"></aui:validator>
|
||||
</aui:input></td>
|
||||
<td><aui:input name="preferences--application1-Url--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="URL of the VRE 1" inlineField="true" inlineLabel="left"
|
||||
placeholder="url" helpMessage="URL" value="<%=application1Url%>"
|
||||
required="false">
|
||||
</aui:input></td>
|
||||
</tr>
|
||||
</table>
|
||||
</aui:field-wrapper>
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<table>
|
||||
<tr>
|
||||
<td><aui:input name="preferences--applicationName2-Title--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Name 2" inlineField="true" inlineLabel="left"
|
||||
placeholder="application"
|
||||
helpMessage="Display Name of the application"
|
||||
value="<%=applicationName2Title%>" required="false" /></td>
|
||||
<td><aui:input
|
||||
name="preferences--applicationName2-DocumentId--" type="text"
|
||||
cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Document Id 2" inlineField="true"
|
||||
inlineLabel="left" placeholder="ID"
|
||||
helpMessage="ID taken from Liferay CMS in this Site"
|
||||
value="<%=applicationName2DocumentId%>" required="false">
|
||||
<aui:validator name="digits"></aui:validator>
|
||||
</aui:input></td>
|
||||
<td><aui:input name="preferences--application2-Url--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="URL of the VRE 2" inlineField="true" inlineLabel="left"
|
||||
placeholder="url" helpMessage="URL" value="<%=application2Url%>"
|
||||
required="false">
|
||||
</aui:input></td>
|
||||
</tr>
|
||||
</table>
|
||||
</aui:field-wrapper>
|
||||
<aui:field-wrapper cssClass="field-group">
|
||||
<table>
|
||||
<tr>
|
||||
<td><aui:input name="preferences--applicationName3-Title--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Name 3" inlineField="true" inlineLabel="left"
|
||||
placeholder="application"
|
||||
helpMessage="Display Name of the application"
|
||||
value="<%=applicationName3Title%>" required="false" /></td>
|
||||
<td><aui:input
|
||||
name="preferences--applicationName3-DocumentId--" type="text"
|
||||
cssClass="text long-field" showRequiredLabel="true"
|
||||
label="application Document Id 3" inlineField="true"
|
||||
inlineLabel="left" placeholder="ID"
|
||||
helpMessage="ID taken from Liferay CMS in this Site"
|
||||
value="<%=applicationName3DocumentId%>" required="false">
|
||||
<aui:validator name="digits"></aui:validator>
|
||||
</aui:input></td>
|
||||
<td><aui:input name="preferences--application3-Url--"
|
||||
type="text" cssClass="text long-field" showRequiredLabel="true"
|
||||
label="URL of the VRE 3" inlineField="true" inlineLabel="left"
|
||||
placeholder="url" helpMessage="URL" value="<%=application3Url%>"
|
||||
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,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();
|
||||
}
|
||||
%>
|
||||
<c:if test="${not empty applicationName1Title}">
|
||||
<div class="asset-abstract">
|
||||
<h3 class="asset-title">
|
||||
<a href="${application1Url}"><img alt="" src="${icondocURL}">
|
||||
${applicationName1Title}</a>
|
||||
</h3>
|
||||
<div class="asset-content">
|
||||
<div class="asset-summary" style="margin-left: 25px;">
|
||||
<span id="asset-app-summarypre1"> <%
|
||||
if (content1.length() > 225)
|
||||
out.println(HtmlUtil.stripHtml(content1.substring(0, 222) + " ..."));
|
||||
%>
|
||||
<div>
|
||||
<a
|
||||
href="javascript:switchView('#asset-app-summarypre1', '#asset-app-summary-1');">Read
|
||||
More » </a>
|
||||
</div>
|
||||
</span>
|
||||
<div class="asset-more">
|
||||
<div id="asset-app-summary-1" class="asset-summary"
|
||||
style="display: none;"><%=content1%></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="asset-metadata"></div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${not empty applicationName2Title}">
|
||||
<!-- SECOND -->
|
||||
<div class="asset-abstract">
|
||||
<h3 class="asset-title">
|
||||
<a href="${application2Url}"><img alt="" src="${icondocURL}">
|
||||
${applicationName2Title}</a>
|
||||
</h3>
|
||||
<div class="asset-content">
|
||||
<div class="asset-summary" style="margin-left: 25px;">
|
||||
<span id="asset-app-summarypre2"> <%
|
||||
if (content2.length() > 225)
|
||||
out.println(HtmlUtil.stripHtml(content2.substring(0, 222) + " ..."));
|
||||
%>
|
||||
<div>
|
||||
<a
|
||||
href="javascript:switchView('#asset-app-summarypre2', '#asset-app-summary-2');">Read
|
||||
More » </a>
|
||||
</div>
|
||||
</span>
|
||||
<div class="asset-more">
|
||||
<div id="asset-app-summary-2" class="asset-summary"
|
||||
style="display: none;"><%=content2%></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="asset-metadata"></div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${not empty applicationName3Title}">
|
||||
<!-- THIRD -->
|
||||
<div class="asset-abstract">
|
||||
<h3 class="asset-title">
|
||||
<a href="${application3Url}"><img alt="" src="${icondocURL}">
|
||||
${applicationName3Title}</a>
|
||||
</h3>
|
||||
<div class="asset-content">
|
||||
<div class="asset-summary" style="margin-left: 25px;">
|
||||
<span id="asset-app-summarypre3"> <%
|
||||
if (content3.length() > 225)
|
||||
out.println(HtmlUtil.stripHtml(content3.substring(0, 222) + " ..."));
|
||||
%>
|
||||
<div>
|
||||
<a
|
||||
href="javascript:switchView('#asset-app-summarypre3', '#asset-app-summary-3');">Read
|
||||
More » </a>
|
||||
</div>
|
||||
</span>
|
||||
<div class="asset-more">
|
||||
<div id="asset-app-summary-3" class="asset-summary"
|
||||
style="display: none;"><%=content3%></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="asset-metadata"></div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
Loading…
Reference in New Issue