Fórum
How to get Calender Event URL in Custom Portlet
Akash Patil, modificado 11 Anos atrás.
How to get Calender Event URL in Custom Portlet
Junior Member Postagens: 75 Data de Entrada: 13/12/10 Postagens Recentes
Hi Friends,
Inshort I need url for calevent in custom portlet.
I have created one custom portlet to show the upcoming events.
Here i fetched all the Calendar Events list by using CalEventLocalServiceUtil.getEvents() and sorted to upcoming.
Now i am able to show the list of all Events on Portlet, But my Problem is i am not getting how to add url to that events which redirects it to the Corresponding CalEvent.
Tried all possible things. please Help me to solve this problem.
Thanks,
Akash Patil .
Inshort I need url for calevent in custom portlet.
I have created one custom portlet to show the upcoming events.
Here i fetched all the Calendar Events list by using CalEventLocalServiceUtil.getEvents() and sorted to upcoming.
Now i am able to show the list of all Events on Portlet, But my Problem is i am not getting how to add url to that events which redirects it to the Corresponding CalEvent.
Tried all possible things. please Help me to solve this problem.
Thanks,
Akash Patil .
Tejas Kanani, modificado 11 Anos atrás.
RE: How to get Calender Event URL in Custom Portlet (Resposta)
Liferay Master Postagens: 654 Data de Entrada: 06/01/09 Postagens Recentes
Hi Akash,
We've done similar thing in one of our project.
Try below funtion,
Where,
"/calevent" is the friendly url of the page where calendar portlet is already exist.
I hope this will be helpful.
Thanks,
TK
We've done similar thing in one of our project.
Try below funtion,
private String getEventRenderURL(final CalEvent calEvent, final RenderRequest renderRequest)
{
String eventRenderURL = StringPool.BLANK;
final ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest
.getAttribute(WebKeys.THEME_DISPLAY);
Layout previewPageLayout = null;
try
{
previewPageLayout = LayoutLocalServiceUtil.getFriendlyURLLayout(themeDisplay
.getScopeGroup().getGroupId(), false, [b]"/calevent"[/b]);
} catch (final Exception e)
{
LOG.error(e.getMessage());
}
if (previewPageLayout == null)
{
eventRenderURL = themeDisplay.getScopeGroup().getFriendlyURL();
} else
{
final PortletURL calEventURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(renderRequest), "8",
previewPageLayout.getPlid(), "RENDER_PHASE");
calEventURL.setParameter("struts_action", "/calendar/view_event");
calEventURL.setParameter("eventId", String.valueOf(calEvent.getEventId()));
eventRenderURL = calEventURL.toString();
}
return eventRenderURL;
}
Where,
"/calevent" is the friendly url of the page where calendar portlet is already exist.
I hope this will be helpful.
Thanks,
TK
Akash Patil, modificado 11 Anos atrás.
RE: How to get Calender Event URL in Custom Portlet
Junior Member Postagens: 75 Data de Entrada: 13/12/10 Postagens Recentes
Hi Tejas Kanani,
The code u given worked properly. really it's a big help., Thanks yar
Thanks,
Akash Patil
The code u given worked properly. really it's a big help., Thanks yar
Thanks,
Akash Patil