Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Munish Sharma
how to access document and media folder through velocity
September 3, 2012 12:00 AM
Answer

Munish Sharma

Rank: New Member

Posts: 11

Join Date: July 13, 2012

Recent Posts

Hi All,

I want to access the image_gallery of liferay through velocity. I created a "symbol-images" inside liferay.
I am using liferay-portal-6.1.1-ce-ga2.
I tried to do it by velocity template, this way I create new .vm file and add it inside the portal_normal.vm file through #parse()

1) I used the following code in new VM file to show my folders images on portal :
#set ( $IGFolderLocalService=$serviceLocator.findService("com.liferay.portlet.imagegallery.service.IGFolderLocalService"))
#set ( $IGImageLocalService=$serviceLocator.findService("com.liferay.portlet.imagegallery.service.IGImageLocalService"))
#set ($symbolsFolder = $IGFolderLocalService.getFolder($getterUtil.getLong($groupId),0,"symbol-images"))

#if($symbolsFolder)
Folder name is: $symbolsFolder.getName()
<br/>
Folder Id is: $symbolsFolder.getFolderId()
<br/>
#set ($symbolImages = $IGImageLocalService.getImages($getterUtil.getLong($groupId),$getterUtil.getLong($symbolsFolder.getFolderId())) )

#foreach( $symbol in $symbolImages )
<tr><td><img src="/image/image_gallery?uuid=$symbol.Uuid&groupId=$groupId" /></td></tr>
#end
#else
No images in folder "symbol-images"
#end



what I did'nt get expected result, it only showing me :
No images in folder "propco-images"

2) Secondly I add the following line inside portal-ext.properties :

journal.template.velocity.restricted.variables=
What should I need to assign in above line so that I can get the template work?

Do I need any further amendment ? plz help ASAP.

Again thanks in advance,
Munish Sharma
Mika Koivisto
RE: how to access document and media folder through velocity
September 1, 2012 12:14 AM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1512

Join Date: August 7, 2006

Recent Posts

You might have noticed that Image Gallery was merged with Document Library and the new portlet is called Documents and Media. The API also changed so that we can support mounted remote repositories. Now you have to access the files using DLAppService instead of IGxxxLocalService or DLxxxLocalService.
Munish Sharma
RE: how to access document and media folder through velocity
September 3, 2012 5:07 AM
Answer

Munish Sharma

Rank: New Member

Posts: 11

Join Date: July 13, 2012

Recent Posts

Hi,

As you suggested :
Mika Koivisto:
You might have noticed that Image Gallery was merged with Document Library and the new portlet is called Documents and Media. The API also changed so that we can support mounted remote repositories. Now you have to access the files using DLAppService instead of IGxxxLocalService or DLxxxLocalService.


I tried to implement following code :
#set ($scopeGroupId = $getterUtil.getLong($request.theme-display.scope-group-id))
test- $scopeGroupId

#set ($DLAppServiceUtil = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLAppServiceUtil"))
Folder - $getterUtil.getLong($DLAppServiceUtil.getFolder(12080))


But i got the following exception:
No bean named 'com.liferay.portlet.documentlibrary.service.DLAppServiceUtil' is defined

Can you please help me to resolve it, how to provide the bean lib?
I'll be very grateful if any one could please help me on this.


Thanks,
Munish Sharma
Mika Koivisto
RE: how to access document and media folder through velocity
September 4, 2012 4:04 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1512

Join Date: August 7, 2006

Recent Posts

Try looking up com.liferay.portlet.documentlibrary.service.DLAppService instead of com.liferay.portlet.documentlibrary.service.DLAppServiceUtil