Feature #24736
This commit is contained in:
parent
2fed7bccf5
commit
4eda3604bc
|
@ -3,7 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
<wb-module deploy-name="catalogue-badge-portlet">
|
<wb-module deploy-name="catalogue-badge-portlet">
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
<property name="java-output-path" value="/Catalogue-badge-portlet/target/classes"/>
|
<property name="java-output-path" value="/Catalogue-badge-portlet/target/classes"/>
|
||||||
|
|
||||||
<property name="context-root" value="catalogue-badge-portlet"/>
|
<property name="context-root" value="catalogue-badge-portlet"/>
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.1.2-SNAPSHOT] - 2023-02-13
|
||||||
|
|
||||||
|
- bug fix
|
||||||
|
|
||||||
## [v1.1.1] - 2021-10-13
|
## [v1.1.1] - 2021-10-13
|
||||||
|
|
||||||
- Feature #22177, Modify Catalogue widget portlet to display the types and the number when in root VO
|
- Feature #22177, Modify Catalogue widget portlet to display the types and the number when in root VO
|
||||||
|
|
13
pom.xml
13
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<artifactId>catalogue-badge-portlet</artifactId>
|
<artifactId>catalogue-badge-portlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>Catalogue-badge-portlet Portlet</name>
|
<name>Catalogue-badge-portlet Portlet</name>
|
||||||
<version>1.1.1</version>
|
<version>1.1.2-SNAPSHOT</version>
|
||||||
<description>
|
<description>
|
||||||
Catalogue badge portlet displays a synoptic view of the catalogue content
|
Catalogue badge portlet displays a synoptic view of the catalogue content
|
||||||
</description>
|
</description>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.4-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -51,14 +51,13 @@
|
||||||
<version>[2.4.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
<version>[2.4.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.dvos</groupId>
|
|
||||||
<artifactId>usermanagement-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common.portal</groupId>
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
<artifactId>portal-manager</artifactId>
|
<artifactId>portal-manager</artifactId>
|
||||||
<scope>provided</scope>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.dvos</groupId>
|
||||||
|
<artifactId>usermanagement-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class CatalogueBadgeConfigurationAction extends DefaultConfigurationActio
|
||||||
|
|
||||||
PortletPreferences prefs = actionRequest.getPreferences();
|
PortletPreferences prefs = actionRequest.getPreferences();
|
||||||
String catalogueURL = prefs.getValue("catalogueURL", "true");
|
String catalogueURL = prefs.getValue("catalogueURL", "true");
|
||||||
|
|
||||||
|
|
||||||
_log.debug("catalogueURL = " + catalogueURL + " in CatalogueBadgeConfigurationAction.processAction().");
|
_log.debug("catalogueURL = " + catalogueURL + " in CatalogueBadgeConfigurationAction.processAction().");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,3 @@
|
||||||
/**
|
|
||||||
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
||||||
* details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.gcube.portlets.user.cataloguebadge;
|
package org.gcube.portlets.user.cataloguebadge;
|
||||||
|
|
||||||
|
@ -56,7 +43,7 @@ import com.liferay.portal.util.PortalUtil;
|
||||||
@RequestMapping("VIEW")
|
@RequestMapping("VIEW")
|
||||||
public class PortletViewController {
|
public class PortletViewController {
|
||||||
private static Log _log = LogFactoryUtil.getLog(PortletViewController.class);
|
private static Log _log = LogFactoryUtil.getLog(PortletViewController.class);
|
||||||
private static final String IMAGES_BASE_URL = "https://catalogue.d4science.org/";
|
// private static final String IMAGES_BASE_URL = "https://catalogue.d4science.org/";
|
||||||
private static final long K = 1000;
|
private static final long K = 1000;
|
||||||
private static final long M = K * K;
|
private static final long M = K * K;
|
||||||
private static final long G = M * K;
|
private static final long G = M * K;
|
||||||
|
@ -68,7 +55,18 @@ public class PortletViewController {
|
||||||
model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo());
|
model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo());
|
||||||
PortletPreferences prefs = request.getPreferences();
|
PortletPreferences prefs = request.getPreferences();
|
||||||
String catalogueBaseURL = GetterUtil.getString(prefs.getValue("catalogueURL", StringPool.BLANK));
|
String catalogueBaseURL = GetterUtil.getString(prefs.getValue("catalogueURL", StringPool.BLANK));
|
||||||
|
String catalogueTypes2Show = GetterUtil.getString(prefs.getValue("catalogueTypes2ShowNo", StringPool.BLANK));
|
||||||
|
int typesNo = 5;
|
||||||
|
if (catalogueTypes2Show != null && !catalogueTypes2Show.equals(StringPool.BLANK)) {
|
||||||
|
try{
|
||||||
|
typesNo = Integer.parseInt(catalogueTypes2Show);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
typesNo = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
model.addAttribute("catalogueActualURL", catalogueBaseURL);
|
model.addAttribute("catalogueActualURL", catalogueBaseURL);
|
||||||
|
|
||||||
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);
|
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(request);
|
||||||
long groupId = -1;
|
long groupId = -1;
|
||||||
boolean isRootVO = false;
|
boolean isRootVO = false;
|
||||||
|
@ -83,10 +81,13 @@ public class PortletViewController {
|
||||||
model.addAttribute("isRootVO", isRootVO);
|
model.addAttribute("isRootVO", isRootVO);
|
||||||
if (catalogueBaseURL != null && catalogueBaseURL.compareTo("") != 0) { //if the config textbox with catalogueURL is filled in we show the types
|
if (catalogueBaseURL != null && catalogueBaseURL.compareTo("") != 0) { //if the config textbox with catalogueURL is filled in we show the types
|
||||||
try {
|
try {
|
||||||
List<CatalogueType> theTypes = parseTypes(catalogueBaseURL+"/type", catalogueURL);
|
List<CatalogueType> theTypes = parseTypes(catalogueBaseURL+"/type", catalogueURL, catalogueBaseURL);
|
||||||
Collections.sort(theTypes, Collections.reverseOrder());
|
Collections.sort(theTypes, Collections.reverseOrder());
|
||||||
List<CatalogueType> theFiveTypes = new ArrayList<>();
|
List<CatalogueType> theFiveTypes = new ArrayList<>();
|
||||||
for (int i = 0; i < 6; i++) {
|
int limit = typesNo-1;
|
||||||
|
if (theTypes.size() <= limit)
|
||||||
|
limit = theTypes.size()-1;
|
||||||
|
for (int i = 0; i <= limit; i++) {
|
||||||
theFiveTypes.add(theTypes.get(i));
|
theFiveTypes.add(theTypes.get(i));
|
||||||
}
|
}
|
||||||
model.addAttribute("catalogueTypes", theFiveTypes);
|
model.addAttribute("catalogueTypes", theFiveTypes);
|
||||||
|
@ -135,7 +136,7 @@ public class PortletViewController {
|
||||||
return "Catalogue-badge-portlet/view";
|
return "Catalogue-badge-portlet/view";
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CatalogueType> parseTypes(String url, String catalogueURL) throws Exception {
|
private List<CatalogueType> parseTypes(String url, String catalogueURL, String catalogueBaseURL) throws Exception {
|
||||||
List<CatalogueType> toReturn = new ArrayList<>();
|
List<CatalogueType> toReturn = new ArrayList<>();
|
||||||
Document doc = Jsoup.connect(url)
|
Document doc = Jsoup.connect(url)
|
||||||
.userAgent("Mozilla")
|
.userAgent("Mozilla")
|
||||||
|
@ -165,7 +166,7 @@ public class PortletViewController {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("Could not find occurrence in string "+ nameAndOccurrence);
|
_log.error("Could not find occurrence in string "+ nameAndOccurrence);
|
||||||
}
|
}
|
||||||
toReturn.add(new CatalogueType(name, IMAGES_BASE_URL+imgUrl, hrefPortlet, occurrence));
|
toReturn.add(new CatalogueType(name, catalogueBaseURL+imgUrl, hrefPortlet, occurrence));
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("catalogueURL", StringPool.BLANK));
|
String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("catalogueURL", StringPool.BLANK));
|
||||||
|
|
||||||
|
String types2Show_cfg = GetterUtil.getString(portletPreferences.getValue("catalogueTypes2ShowNo", StringPool.BLANK));
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<aui:form action="<%=configurationURL%>" method="post" name="fm">
|
<aui:form action="<%=configurationURL%>" method="post" name="fm">
|
||||||
|
@ -32,6 +34,14 @@ String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("catalogueU
|
||||||
placeholder="Enter Catalogue URL (e.g. https://ckan-sobigdata.d4science.org)"
|
placeholder="Enter Catalogue URL (e.g. https://ckan-sobigdata.d4science.org)"
|
||||||
helpMessage="Actual endpoint of the ckan instance (e.g. https://ckan-sobigdata.d4science.org)"
|
helpMessage="Actual endpoint of the ckan instance (e.g. https://ckan-sobigdata.d4science.org)"
|
||||||
value="<%=appURL_cfg%>" required="false" />
|
value="<%=appURL_cfg%>" required="false" />
|
||||||
|
|
||||||
|
|
||||||
|
<aui:input style="width: 30%;" name="preferences--catalogueTypes2ShowNo--"
|
||||||
|
type="text" cssClass="text long-field" showRequiredLabel="false"
|
||||||
|
label="Number of types to show" inlineField="true" inlineLabel="left"
|
||||||
|
placeholder="Enter the number of items to show"
|
||||||
|
helpMessage="Enter the number of items to show (default is 5)"
|
||||||
|
value="<%=types2Show_cfg%>" required="false" />
|
||||||
</aui:field-wrapper>
|
</aui:field-wrapper>
|
||||||
|
|
||||||
<aui:button-row>
|
<aui:button-row>
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
|
<%@ page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
|
||||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
<%@ 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/aui" prefix="aui"%>
|
||||||
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
|
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%>
|
||||||
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
|
<%@ 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.Constants"%>
|
||||||
<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %>
|
<%@ page import="com.liferay.portal.kernel.util.GetterUtil"%>
|
||||||
<%@ page import="com.liferay.portal.kernel.util.StringPool" %>
|
<%@ page import="com.liferay.portal.kernel.util.StringPool"%>
|
||||||
<%@ page import="com.liferay.portal.util.PortalUtil" %>
|
<%@ page import="com.liferay.portal.util.PortalUtil"%>
|
||||||
|
|
||||||
|
|
||||||
<!-- show the types only when the ckan instance is specified in the config portlet part -->
|
<!-- show the types only when the ckan instance is specified in the config portlet part -->
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${not empty catalogueActualURL}">
|
<c:when test="${not empty catalogueActualURL}">
|
||||||
<input type="hidden" value="${catalogueURL}" id="catalogueURL">
|
<input type="hidden" value="${catalogueURL}" id="catalogueURL">
|
||||||
<table class="catalogue-container">
|
<div class="container-fluid">
|
||||||
<tr class="catalogue-table-row">
|
<div class="row-fluid">
|
||||||
<td class="catalogue-table-cell">
|
<div class="span6">
|
||||||
<div class="input-append input-catalogue">
|
<div class="input-append input-catalogue .hidden-phone">
|
||||||
<input type="text" class="input-large" name="q" value=""
|
<input type="text" class="input-large" name="q" value=""
|
||||||
autocomplete="off" placeholder="Insert keywords here"
|
autocomplete="off" placeholder="Insert keywords here"
|
||||||
id="inputQueryCatalogue">
|
id="inputQueryCatalogue">
|
||||||
|
@ -32,26 +32,23 @@
|
||||||
href="${catalogueURL}?path=/types" style="float: right;">See
|
href="${catalogueURL}?path=/types" style="float: right;">See
|
||||||
All Types</a>
|
All Types</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</div>
|
||||||
<td class="catalogue-table-cell-max">
|
<div class="span6">
|
||||||
<table>
|
<c:forEach var="type" items="${catalogueTypes}">
|
||||||
<tr>
|
<div class="media-item-homepage">
|
||||||
<c:forEach var="type" items="${catalogueTypes}">
|
<a href="${type.link}" title="View ${type.name}"> <img
|
||||||
<td class="media-item-homepage"><a href="${type.link}"
|
class="logo-homepage" src="${type.img}" alt="${type.name}"
|
||||||
title="View ${type.name}"> <img class="logo-homepage"
|
title="${type.name} group">
|
||||||
src="${type.img}" alt="${type.name}"
|
</a>
|
||||||
title="${type.name} group">
|
<p class="media-heading-homepage">
|
||||||
</a>
|
<a href="${type.link}" title="View ${type.name}">
|
||||||
<p class="media-heading-homepage">
|
${type.name} (${type.occurrence}) </a>
|
||||||
<a href="${type.link}" title="View ${type.name}">
|
</p>
|
||||||
${type.name} (${type.occurrence}) </a>
|
</div>
|
||||||
</p></td>
|
</c:forEach>
|
||||||
</c:forEach>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<div id="catalogueDiv">
|
<div id="catalogueDiv">
|
||||||
|
|
Loading…
Reference in New Issue