Sravan Kumar Chalvadi 7 Years Ago Followed the article for liferay 7 set-up on my machine. Looks like set($dlFileEntryLocalService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService")) is not fetching/loading the service. Please sign in to reply. Reply as... Cancel Sravan Kumar Chalvadi Sravan Kumar Chalvadi 7 Years Ago In brief , uploaded files using "Document and Media" portlet and viewing in "Asset Publisher" portlet. Created vm file (https://github.com/javeedchida/temperateprogrammer/blob/master/velocity-document-download-links/adt-document-downloads.vm) and applied to "Asset Publisher" portlet.Click on entries results in location not found http://localhost:8080/documents/$fileEntry.getGroupId()/$fileEntry.getFolderId()/$httpUtil.encodeURL($htmlUtil.unescape($fileEntry.getTitle()))/$fileEntry.getUuid()?version=$version.getVersion() Please sign in to reply. Reply as... Cancel Sravan Kumar Chalvadi Sravan Kumar Chalvadi 7 Years Ago RESOLVED "serviceLocator" access issue in ADT.On Liferay 7, changed/remove "Restricted Variable" value to empty or some X from "serviceLocator". To do so, go to "Control Panel"-->"Configuration"-->"System Settings"-->"Foundation" tab-->"Velocity Engine" (Edit). Please sign in to reply. Reply as... Cancel
Sravan Kumar Chalvadi Sravan Kumar Chalvadi 7 Years Ago In brief , uploaded files using "Document and Media" portlet and viewing in "Asset Publisher" portlet. Created vm file (https://github.com/javeedchida/temperateprogrammer/blob/master/velocity-document-download-links/adt-document-downloads.vm) and applied to "Asset Publisher" portlet.Click on entries results in location not found http://localhost:8080/documents/$fileEntry.getGroupId()/$fileEntry.getFolderId()/$httpUtil.encodeURL($htmlUtil.unescape($fileEntry.getTitle()))/$fileEntry.getUuid()?version=$version.getVersion() Please sign in to reply. Reply as... Cancel Sravan Kumar Chalvadi Sravan Kumar Chalvadi 7 Years Ago RESOLVED "serviceLocator" access issue in ADT.On Liferay 7, changed/remove "Restricted Variable" value to empty or some X from "serviceLocator". To do so, go to "Control Panel"-->"Configuration"-->"System Settings"-->"Foundation" tab-->"Velocity Engine" (Edit). Please sign in to reply. Reply as... Cancel
Sravan Kumar Chalvadi Sravan Kumar Chalvadi 7 Years Ago RESOLVED "serviceLocator" access issue in ADT.On Liferay 7, changed/remove "Restricted Variable" value to empty or some X from "serviceLocator". To do so, go to "Control Panel"-->"Configuration"-->"System Settings"-->"Foundation" tab-->"Velocity Engine" (Edit). Please sign in to reply. Reply as... Cancel
Geert van der Ploeg 5 Years Ago Like you say, parts of your solution can be found on the forums etc.But they have one thing in common: they all require serviceLocator/staticUtil to be exposed to velocity/freemarker.We see this as a security issue, so I am not happy with it.In the end however, it turns out to be a lot easier than messing around with DLEntry's, file versions, etc.:On the AssetRenderer-interface, there's a method getURLDownload(ThemeDisplay), which exactly does what we want:https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portlet/asset/model/AssetRenderer.html#getURLDownload(com.liferay.portal.theme.ThemeDisplay)So you can just use it like this (freemarker): <div> <#list entries as entry> <div> <a href="${entry.getAssetRenderer().getURLDownload(themeDisplay)}" target="_blank">${entry.getTitle()}</a> </div> </#list> </div>Hope this helps... Please sign in to reply. Reply as... Cancel Javeed Chida Geert van der Ploeg 5 Years Ago That's very cool. I'll give it a try using velocity. Thanks for sharing! Please sign in to reply. Reply as... Cancel
Javeed Chida Geert van der Ploeg 5 Years Ago That's very cool. I'll give it a try using velocity. Thanks for sharing! Please sign in to reply. Reply as... Cancel