@Override public String getAbsolutePath(PortletRequest portletRequest, long folderId) throws PortalException, SystemException { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); if (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return themeDisplay.translate("home"); } Folder folder = DLAppLocalServiceUtil.getFolder(folderId); List<Folder> folders = folder.getAncestors(); Collections.reverse(folders); StringBundler sb = new StringBundler((folders.size() * 3) + 5); sb.append(themeDisplay.translate("home")); sb.append(StringPool.SPACE); for (Folder curFolder : folders) { sb.append(StringPool.RAQUO); sb.append(StringPool.SPACE); sb.append(curFolder.getName()); } sb.append(StringPool.RAQUO); sb.append(StringPool.SPACE); sb.append(folder.getName()); return sb.toString(); }
public static void addPortletBreadcrumbEntries( Folder folder, HttpServletRequest request, PortletURL portletURL) throws Exception { long defaultFolderId = _getDefaultFolderId(request); List<Folder> ancestorFolders = Collections.emptyList(); if ((folder != null) && (folder.getFolderId() != defaultFolderId)) { ancestorFolders = folder.getAncestors(); int indexOfRootFolder = -1; for (int i = 0; i < ancestorFolders.size(); i++) { Folder ancestorFolder = ancestorFolders.get(i); if (defaultFolderId == ancestorFolder.getFolderId()) { indexOfRootFolder = i; } } if (indexOfRootFolder > -1) { ancestorFolders = ancestorFolders.subList(0, indexOfRootFolder); } } Collections.reverse(ancestorFolders); for (Folder ancestorFolder : ancestorFolders) { portletURL.setParameter("folderId", String.valueOf(ancestorFolder.getFolderId())); Map<String, Object> data = new HashMap<String, Object>(); data.put("folder-id", ancestorFolder.getFolderId()); PortalUtil.addPortletBreadcrumbEntry( request, ancestorFolder.getName(), portletURL.toString(), data); } long folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; if (folder != null) { folderId = folder.getFolderId(); } portletURL.setParameter("folderId", String.valueOf(folderId)); if ((folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) && (folderId != defaultFolderId)) { Map<String, Object> data = new HashMap<String, Object>(); data.put("folder-id", folderId); PortalUtil.addPortletBreadcrumbEntry(request, folder.getName(), portletURL.toString(), data); } }
public static void addPortletBreadcrumbEntries( Folder folder, HttpServletRequest request, RenderResponse renderResponse) throws Exception { String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName"); PortletURL portletURL = renderResponse.createRenderURL(); if (mvcRenderCommandName.equals("/document_library/select_folder")) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); portletURL.setParameter("mvcRenderCommandName", mvcRenderCommandName); portletURL.setWindowState(LiferayWindowState.POP_UP); PortalUtil.addPortletBreadcrumbEntry( request, themeDisplay.translate("home"), portletURL.toString()); } else { portletURL.setParameter("mvcRenderCommandName", "/image_gallery_display/view"); } long defaultFolderId = getDefaultFolderId(request); List<Folder> ancestorFolders = Collections.emptyList(); if ((folder != null) && (folder.getFolderId() != defaultFolderId)) { ancestorFolders = folder.getAncestors(); int indexOfRootFolder = -1; for (int i = 0; i < ancestorFolders.size(); i++) { Folder ancestorFolder = ancestorFolders.get(i); if (defaultFolderId == ancestorFolder.getFolderId()) { indexOfRootFolder = i; } } if (indexOfRootFolder > -1) { ancestorFolders = ancestorFolders.subList(0, indexOfRootFolder); } } Collections.reverse(ancestorFolders); for (Folder ancestorFolder : ancestorFolders) { portletURL.setParameter("folderId", String.valueOf(ancestorFolder.getFolderId())); PortalUtil.addPortletBreadcrumbEntry( request, ancestorFolder.getName(), portletURL.toString()); } portletURL.setParameter("folderId", String.valueOf(folder.getFolderId())); PortalUtil.addPortletBreadcrumbEntry(request, folder.getName(), portletURL.toString()); }