掲示板

Announcements from within a velocity template?

14年前 に Fredrik Huldtgren によって更新されました。

Announcements from within a velocity template?

New Member 投稿: 1 参加年月日: 10/04/22 最新の投稿
Hi,

I would like to be able to inform certain users of events from my velocity template. Is there anyway I can call an announcements service? (say, in the same way as I call the RoleService: $serviceLocator.findService("com.liferay.portal.service.RoleService"))

If that is not possible, what is the easiest way to, from within a velocity template, inform users? (The means is not so important, e-mail, announcement, alert, either one will do just fine).

As a side-note, is there any overview of which services that are available to me via the $serviceLocator.findService() function?

With kind regards,
Fredrik
thumbnail
14年前 に Shagul Khaja によって更新されました。

RE: Announcements from within a velocity template?

Liferay Master 投稿: 758 参加年月日: 07/09/27 最新の投稿
All the Liferay services are available using the serviceLocator.

You may also be able to call your custom services in plugins using the below syntax.


$serviceLocator.findService("my-services-portlet","com.mycompany.service.MyLocalService")


There is an issue that was fixed that affects where the service jar needs to be copied over in tomcat.

http://www.liferay.com/community/forums/-/message_boards/message/4686465

You may want to look into the announcements portlet code/jsp to see how the announcements are retrieved for a user. If it is not easy to provide all that needed for the "AnnouncementsEntryLocalService", you may consider writing a simple service that just takes a userId and returns the desired result and keep all the business logic in that service rather than the velocity or JSP.

Best,
Shagul