added possibility to choose the width of the icons

This commit is contained in:
Massimiliano Assante 2023-07-21 16:34:15 +02:00
parent d334e60154
commit ae8ab24186
3 changed files with 26 additions and 10 deletions

View File

@ -18,6 +18,8 @@ public class VLabsDisplayConfigurationAction extends DefaultConfigurationAction
PortletPreferences prefs = actionRequest.getPreferences();
String icondocURL = prefs.getValue("icondocURL", "0");
_log.info("icondocURL = " + icondocURL + " in ConfigurationAction.processAction() saved correctly");
String icondocURLWidthPx = prefs.getValue("icondocURLWidthPx", "0");
_log.info("icondocURLWidthPx = " + icondocURLWidthPx + " in ConfigurationAction.processAction() saved correctly");
String vlabName1Icon = prefs.getValue("vlabName1-Icon", "");
_log.info("vlabName1-Icon = " + vlabName1Icon + " in ConfigurationAction.processAction() saved correctly");

View File

@ -7,6 +7,7 @@ Here you can customise the icon to show besides the vlab name
<%
String icondocURL = GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK));
String icondocURLWidthPx = GetterUtil.getString(portletPreferences.getValue("icondocURLWidthPx", StringPool.BLANK));
String vlabName1Icon = GetterUtil.getString(portletPreferences.getValue("vlabName1-Icon", StringPool.BLANK));
String vlabName2Icon = GetterUtil.getString(portletPreferences.getValue("vlabName2-Icon", StringPool.BLANK));
@ -65,8 +66,16 @@ Here you can customise the icon to show besides the vlab name
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>
<aui:input name="preferences--icondocURLWidthPx--" type="text"
cssClass="text long-field" showRequiredLabel="true" label="Icon size in px (default 32px)"
inlineField="true" inlineLabel="left"
placeholder="Width in px of the image"
helpMessage="width in pixel of the icon"
value="<%=icondocURLWidthPx%>" required="false">
</aui:input>
<p>Enter the vlab in the following:</p>
<!-- vlab URL -->
<aui:field-wrapper cssClass="field-group">

View File

@ -12,6 +12,11 @@
String icondocURL = GetterUtil.getString(portletPreferences.getValue("icondocURL", StringPool.BLANK));
pageContext.setAttribute("icondocURL",icondocURL);
String icondocURLWidthPx = GetterUtil.getString(portletPreferences.getValue("icondocURLWidthPx", StringPool.BLANK));
if (icondocURLWidthPx == null || icondocURLWidthPx.compareTo(StringPool.BLANK) == 0) {
icondocURLWidthPx = "32";
}
pageContext.setAttribute("icondocURLWidthPx",icondocURLWidthPx);
String vlabName1Icon = GetterUtil.getString(portletPreferences.getValue("vlabName1-Icon", StringPool.BLANK));
pageContext.setAttribute("vlabName1Icon",vlabName1Icon);
@ -214,7 +219,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab1Url}"><img alt="" src="${pickedIcon1URL}">
<a href="${vlab1Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon1URL}">
${vlabName1Title}</a><span
class="access-policy ${ap1}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap1}.png" />&nbsp;&nbsp;${ap1}</span>
@ -255,7 +260,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab2Url}"><img alt="" src="${pickedIcon2URL}">
<a href="${vlab2Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon2URL}">
${vlabName2Title}</a><span
class="access-policy ${ap2}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap2}.png" />&nbsp;&nbsp;${ap2}</span>
@ -296,7 +301,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab3Url}"><img alt="" src="${pickedIcon3URL}">
<a href="${vlab3Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon3URL}">
${vlabName3Title}</a><span
class="access-policy ${ap3}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap3}.png" />&nbsp;&nbsp;${ap3}</span>
@ -338,7 +343,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab4Url}"><img alt="" src="${pickedIcon4URL}">
<a href="${vlab4Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon4URL}">
${vlabName4Title}</a><span
class="access-policy ${ap4}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap4}.png" />&nbsp;&nbsp;${ap4}</span>
@ -380,7 +385,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab5Url}"><img alt="" src="${pickedIcon5URL}">
<a href="${vlab5Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon5URL}">
${vlabName5Title}</a><span
class="access-policy ${ap5}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap5}.png" />&nbsp;&nbsp;${ap5}</span>
@ -422,7 +427,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab6Url}"><img alt="" src="${pickedIcon6URL}">
<a href="${vlab6Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon6URL}">
${vlabName6Title}</a><span
class="access-policy ${ap6}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap6}.png" />&nbsp;&nbsp;${ap6}</span>
@ -464,7 +469,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab7Url}"><img alt="" src="${pickedIcon7URL}">
<a href="${vlab7Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon7URL}">
${vlabName7Title}</a><span
class="access-policy ${ap7}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap7}.png" />&nbsp;&nbsp;${ap7}</span>
@ -507,7 +512,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab8Url}"><img alt="" src="${pickedIcon8URL}">
<a href="${vlab8Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon8URL}">
${vlabName8Title}</a><span
class="access-policy ${ap8}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap8}.png" />&nbsp;&nbsp;${ap8}</span>
@ -550,7 +555,7 @@
%>
<div class="asset-abstract">
<h3 class="asset-title">
<a href="${vlab9Url}"><img alt="" src="${pickedIcon9URL}">
<a href="${vlab9Url}"><img alt="" style="width: ${icondocURLWidthPx}px; margin: 5px;" src="${pickedIcon9URL}">
${vlabName9Title}</a><span
class="access-policy ${ap9}-color"><img
src="<%=renderRequest.getContextPath()%>/images/${ap9}.png" />&nbsp;&nbsp;${ap9}</span>