show the types when instance is specified in the config portlet part

This commit is contained in:
Massimiliano Assante 2021-10-13 08:58:31 +02:00
parent e2da661c1c
commit 5447c142e3
2 changed files with 20 additions and 7 deletions

View File

@ -80,7 +80,7 @@ public class PortletViewController {
e1.printStackTrace(); e1.printStackTrace();
} }
model.addAttribute("isRootVO", isRootVO); model.addAttribute("isRootVO", isRootVO);
if (isRootVO) { 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);
Collections.sort(theTypes, Collections.reverseOrder()); Collections.sort(theTypes, Collections.reverseOrder());
@ -100,7 +100,7 @@ public class PortletViewController {
String context = pContext.getCurrentScope(""+groupId); String context = pContext.getCurrentScope(""+groupId);
DataCatalogueImpl utils = null; DataCatalogueImpl utils = null;
if (gm.isRootVO(groupId)) { if (isRootVO) {
String gatewaySiteURL = pContext.getGatewayURL(httpServletRequest); String gatewaySiteURL = pContext.getGatewayURL(httpServletRequest);
if (!gatewaySiteURL.startsWith("https")) if (!gatewaySiteURL.startsWith("https"))
gatewaySiteURL = gatewaySiteURL.replaceAll("http:", "https:"); gatewaySiteURL = gatewaySiteURL.replaceAll("http:", "https:");

View File

@ -1,10 +1,23 @@
<%@ page contentType="text/html" pageEncoding="UTF-8"%> <%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ 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.portal.util.PortalUtil" %>
<%
String catalogueActualURL = GetterUtil.getString(portletPreferences.getValue("catalogueURL", StringPool.BLANK));
pageContext.setAttribute("catalogueActualURL", catalogueActualURL);
%>
<!-- show the types only when the ckan instance is specified in the config portlet part -->
<c:choose> <c:choose>
<c:when test="${isRootVO}"> <c:when test="${not empty catalogueActualURL}">
<input type="hidden" value="${catalogueURL}" id="catalogueURL"> <input type="hidden" value="${catalogueURL}" id="catalogueURL">
<table class="catalogue-container"> <table class="catalogue-container">
<tr class="catalogue-table-row"> <tr class="catalogue-table-row">
@ -20,8 +33,8 @@
</div> </div>
<div> <div>
<a href="${catalogueURL}?path=/dataset">See All Items</a> <a <a href="${catalogueURL}?path=/dataset">See All Items</a> <a
href="${catalogueURL}?path=/tags" style="float: right;">See href="${catalogueURL}?path=/types" style="float: right;">See
All Tags</a> All Types</a>
</div> </div>
</td> </td>
<td class="catalogue-table-cell-max"> <td class="catalogue-table-cell-max">