diff --git a/modules/apps/portal-portlet-bridge/portal-portlet-bridge-soy-impl/src/main/java/com/liferay/portal/portlet/bridge/soy/internal/util/SoyTemplateResourcesProviderUtil.java b/modules/apps/portal-portlet-bridge/portal-portlet-bridge-soy-impl/src/main/java/com/liferay/portal/portlet/bridge/soy/internal/util/SoyTemplateResourcesProviderUtil.java index 041d5aad1416e4..0ee5cadd91d10b 100644 --- a/modules/apps/portal-portlet-bridge/portal-portlet-bridge-soy-impl/src/main/java/com/liferay/portal/portlet/bridge/soy/internal/util/SoyTemplateResourcesProviderUtil.java +++ b/modules/apps/portal-portlet-bridge/portal-portlet-bridge-soy-impl/src/main/java/com/liferay/portal/portlet/bridge/soy/internal/util/SoyTemplateResourcesProviderUtil.java @@ -32,8 +32,7 @@ public class SoyTemplateResourcesProviderUtil { public static List getBundleTemplateResources( Bundle bundle, String templatePath) { - return _soyTemplateResourcesProvider.getBundleTemplateResources( - bundle, templatePath); + return _soyTemplateResourcesProvider.getAllTemplateResources(); } @Reference(unbind = "-") diff --git a/modules/apps/sharing/sharing-api/src/main/java/com/liferay/sharing/interpreter/SharingEntryInterpreter.java b/modules/apps/sharing/sharing-api/src/main/java/com/liferay/sharing/interpreter/SharingEntryInterpreter.java index 83261d47c87605..110a1528dae8d8 100644 --- a/modules/apps/sharing/sharing-api/src/main/java/com/liferay/sharing/interpreter/SharingEntryInterpreter.java +++ b/modules/apps/sharing/sharing-api/src/main/java/com/liferay/sharing/interpreter/SharingEntryInterpreter.java @@ -35,4 +35,6 @@ public String getAssetTypeTitle(SharingEntry sharingEntry, Locale locale) public String getTitle(SharingEntry sharingEntry); + public boolean isVisible(SharingEntry sharingEntry) throws PortalException; + } \ No newline at end of file diff --git a/modules/apps/sharing/sharing-document-library/src/main/java/com/liferay/sharing/document/library/internal/servlet/taglib/ui/FileEntrySharingEntryMenuItemContributor.java b/modules/apps/sharing/sharing-document-library/src/main/java/com/liferay/sharing/document/library/internal/servlet/taglib/ui/FileEntrySharingEntryMenuItemContributor.java index 2b45a54b94c952..7a2aa3fb946dda 100644 --- a/modules/apps/sharing/sharing-document-library/src/main/java/com/liferay/sharing/document/library/internal/servlet/taglib/ui/FileEntrySharingEntryMenuItemContributor.java +++ b/modules/apps/sharing/sharing-document-library/src/main/java/com/liferay/sharing/document/library/internal/servlet/taglib/ui/FileEntrySharingEntryMenuItemContributor.java @@ -15,8 +15,10 @@ package com.liferay.sharing.document.library.internal.servlet.taglib.ui; import com.liferay.asset.kernel.AssetRendererFactoryRegistryUtil; +import com.liferay.asset.kernel.model.AssetEntry; import com.liferay.asset.kernel.model.AssetRenderer; import com.liferay.asset.kernel.model.AssetRendererFactory; +import com.liferay.asset.kernel.service.AssetEntryLocalService; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.language.LanguageUtil; import com.liferay.portal.kernel.log.Log; @@ -63,6 +65,10 @@ public Collection getSharingEntryMenuItems( return Collections.emptyList(); } + if (!_isVisible(sharingEntry)) { + return Collections.emptyList(); + } + return Collections.singleton( _createDownloadMenuItem(sharingEntry, themeDisplay)); } @@ -101,9 +107,23 @@ private AssetRenderer _getAssetEntryRenderer(SharingEntry sharingEntry) return assetRendererFactory.getAssetRenderer(sharingEntry.getClassPK()); } + private boolean _isVisible(SharingEntry sharingEntry) { + AssetEntry assetEntry = _assetEntryLocalService.fetchEntry( + sharingEntry.getClassNameId(), sharingEntry.getClassPK()); + + if ((assetEntry != null) && assetEntry.isVisible()) { + return true; + } + + return false; + } + private static final Log _log = LogFactoryUtil.getLog( FileEntrySharingEntryMenuItemContributor.class); + @Reference + private AssetEntryLocalService _assetEntryLocalService; + @Reference private SharingPermission _sharingPermission; diff --git a/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/display/context/SharedAssetsViewDisplayContext.java b/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/display/context/SharedAssetsViewDisplayContext.java index c835fdcb952d31..52b01d0bfe97cf 100644 --- a/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/display/context/SharedAssetsViewDisplayContext.java +++ b/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/display/context/SharedAssetsViewDisplayContext.java @@ -272,6 +272,21 @@ public boolean hasEditPermission(long classNameId, long classPK) { return false; } + public boolean isVisible(SharingEntry sharingEntry) throws PortalException { + SharingEntryInterpreter sharingEntryInterpreter = + _sharingEntryInterpreterFunction.apply(sharingEntry); + + if (sharingEntryInterpreter == null) { + return false; + } + + if (sharingEntryInterpreter.isVisible(sharingEntry)) { + return true; + } + + return false; + } + public void populateResults(SearchContainer searchContainer) { long classNameId = 0; diff --git a/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/interpreter/AssetRendererSharingEntryInterpreter.java b/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/interpreter/AssetRendererSharingEntryInterpreter.java index 9b99d52074c04e..f047047aa687b3 100644 --- a/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/interpreter/AssetRendererSharingEntryInterpreter.java +++ b/modules/apps/sharing/sharing-web/src/main/java/com/liferay/sharing/web/internal/interpreter/AssetRendererSharingEntryInterpreter.java @@ -17,6 +17,7 @@ import com.liferay.asset.kernel.model.AssetEntry; import com.liferay.asset.kernel.model.AssetRenderer; import com.liferay.asset.kernel.model.AssetRendererFactory; +import com.liferay.asset.kernel.service.AssetEntryLocalService; import com.liferay.petra.string.StringPool; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.log.Log; @@ -91,6 +92,25 @@ public String getTitle(SharingEntry sharingEntry) { return StringPool.BLANK; } + @Override + public boolean isVisible(SharingEntry sharingEntry) throws PortalException { + AssetRenderer assetRenderer = AssetRendererSharingUtil.getAssetRenderer( + sharingEntry); + + if (!assetRenderer.isDisplayable()) { + return false; + } + + AssetEntry assetEntry = _assetEntryLocalService.fetchEntry( + sharingEntry.getClassNameId(), sharingEntry.getClassPK()); + + if ((assetEntry == null) || !assetEntry.isVisible()) { + return false; + } + + return true; + } + @Activate protected void activate() { _assetRendererSharingEntryEditRenderer = @@ -102,6 +122,9 @@ protected void activate() { private static final Log _log = LogFactoryUtil.getLog( AssetRendererSharingEntryInterpreter.class); + @Reference + private AssetEntryLocalService _assetEntryLocalService; + private AssetRendererSharingEntryEditRenderer _assetRendererSharingEntryEditRenderer; private AssetRendererSharingEntryViewRenderer diff --git a/modules/apps/sharing/sharing-web/src/main/resources/META-INF/resources/shared_assets/view.jsp b/modules/apps/sharing/sharing-web/src/main/resources/META-INF/resources/shared_assets/view.jsp index 89873c53d4f2dd..ffb33ac7edc344 100644 --- a/modules/apps/sharing/sharing-web/src/main/resources/META-INF/resources/shared_assets/view.jsp +++ b/modules/apps/sharing/sharing-web/src/main/resources/META-INF/resources/shared_assets/view.jsp @@ -62,7 +62,7 @@ sharedAssetsViewDisplayContext.populateResults(sharingEntriesSearchContainer); + + + + <%= sharedAssetsViewDisplayContext.isVisible(sharingEntry) ? LanguageUtil.get(request, "visible") : LanguageUtil.get(request, "not-visible") %> + + + +