public static void addPortletBreadcrumbEntries( MBMessage message, HttpServletRequest request, RenderResponse renderResponse) throws Exception { if (message.getCategoryId() == MBCategoryConstants.DISCUSSION_CATEGORY_ID) { return; } MBCategory category = null; if (message.getCategoryId() != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { category = message.getCategory(); } addPortletBreadcrumbEntries(category, request, renderResponse); PortletURL portletURL = renderResponse.createRenderURL(); portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_message"); portletURL.setParameter("messageId", String.valueOf(message.getMessageId())); PortalUtil.addPortletBreadcrumbEntry(request, message.getSubject(), portletURL.toString()); }
public static void addPortletBreadcrumbEntries( MBCategory category, HttpServletRequest request, RenderResponse renderResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName"); PortletURL portletURL = renderResponse.createRenderURL(); if (mvcRenderCommandName.equals("/message_boards/select_category")) { portletURL.setParameter("mvcRenderCommandName", "/message_boards/select_category"); portletURL.setWindowState(LiferayWindowState.POP_UP); PortalUtil.addPortletBreadcrumbEntry( request, themeDisplay.translate("categories"), portletURL.toString()); } else { portletURL.setParameter("mvcRenderCommandName", "/message_boards/view"); } PortalUtil.addPortletBreadcrumbEntry( request, themeDisplay.translate("home"), portletURL.toString()); if (category == null) { return; } if (!mvcRenderCommandName.equals("/message_boards/select_category")) { portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_category"); } List<MBCategory> ancestorCategories = category.getAncestors(); Collections.reverse(ancestorCategories); for (MBCategory curCategory : ancestorCategories) { portletURL.setParameter("mbCategoryId", String.valueOf(curCategory.getCategoryId())); PortalUtil.addPortletBreadcrumbEntry(request, curCategory.getName(), portletURL.toString()); } portletURL.setParameter("mbCategoryId", String.valueOf(category.getCategoryId())); PortalUtil.addPortletBreadcrumbEntry(request, category.getName(), portletURL.toString()); }