
META-INF.resources.image_gallery_display.view.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/image_gallery_display/init.jsp" %>
<%
Folder folder = (Folder)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER);
long folderId = BeanParamUtil.getLong(folder, request, "folderId", rootFolderId);
boolean defaultFolderView = false;
if ((folder == null) && (rootFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {
defaultFolderView = true;
}
if (defaultFolderView) {
try {
folder = DLAppLocalServiceUtil.getFolder(folderId);
}
catch (NoSuchFolderException nsfe) {
folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
}
}
long repositoryId = scopeGroupId;
if (folder != null) {
repositoryId = folder.getRepositoryId();
}
int status = WorkflowConstants.STATUS_APPROVED;
if (permissionChecker.isContentReviewer(user.getCompanyId(), scopeGroupId)) {
status = WorkflowConstants.STATUS_ANY;
}
Map contextObjects = new HashMap();
contextObjects.put("dlPortletInstanceSettings", dlPortletInstanceSettings);
DLPortletInstanceSettingsHelper dlPortletInstanceSettingsHelper = new DLPortletInstanceSettingsHelper(igRequestHelper);
String[] mediaGalleryMimeTypes = dlPortletInstanceSettings.getMimeTypes();
List fileEntries = DLAppServiceUtil.getGroupFileEntries(scopeGroupId, 0, folderId, mediaGalleryMimeTypes, status, 0, SearchContainer.MAX_DELTA, null);
%>
<%
String topLink = ParamUtil.getString(request, "topLink", "home");
long assetCategoryId = ParamUtil.getLong(request, "categoryId");
String assetTagName = ParamUtil.getString(request, "tag");
boolean useAssetEntryQuery = (assetCategoryId > 0) || Validator.isNotNull(assetTagName);
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcRenderCommandName", "/image_gallery_display/view");
portletURL.setParameter("topLink", topLink);
portletURL.setParameter("folderId", String.valueOf(folderId));
request.setAttribute("view.jsp-folder", folder);
request.setAttribute("view.jsp-rootFolderId", String.valueOf(rootFolderId));
request.setAttribute("view.jsp-folderId", String.valueOf(folderId));
request.setAttribute("view.jsp-repositoryId", String.valueOf(repositoryId));
request.setAttribute("view.jsp-viewFolder", Boolean.TRUE.toString());
request.setAttribute("view.jsp-useAssetEntryQuery", String.valueOf(useAssetEntryQuery));
request.setAttribute("view.jsp-portletURL", portletURL);
%>
<%
SearchContainer igSearchContainer = new SearchContainer(renderRequest, null, null, "cur2", SearchContainer.DEFAULT_DELTA, portletURL, null, null);
long[] classNameIds = {PortalUtil.getClassNameId(DLFileEntryConstants.getClassName()), PortalUtil.getClassNameId(DLFileShortcutConstants.getClassName())};
AssetEntryQuery assetEntryQuery = new AssetEntryQuery(classNameIds, igSearchContainer);
assetEntryQuery.setEnablePermissions(true);
assetEntryQuery.setExcludeZeroViewCount(false);
int total = AssetEntryServiceUtil.getEntriesCount(assetEntryQuery);
igSearchContainer.setTotal(total);
List results = AssetEntryServiceUtil.getEntries(assetEntryQuery);
igSearchContainer.setResults(results);
mediaGalleryMimeTypes = null;
request.setAttribute("view.jsp-igSearchContainer", igSearchContainer);
request.setAttribute("view.jsp-mediaGalleryMimeTypes", mediaGalleryMimeTypes);
%>
<%
SearchContainer igSearchContainer = new SearchContainer(renderRequest, null, null, "cur2", SearchContainer.DEFAULT_DELTA, portletURL, null, null);
int foldersCount = DLAppServiceUtil.getFoldersCount(repositoryId, folderId, true);
int total = DLAppServiceUtil.getFoldersAndFileEntriesAndFileShortcutsCount(repositoryId, folderId, status, mediaGalleryMimeTypes, true);
int imagesCount = total - foldersCount;
igSearchContainer.setTotal(total);
List results = DLAppServiceUtil.getFoldersAndFileEntriesAndFileShortcuts(repositoryId, folderId, status, mediaGalleryMimeTypes, true, igSearchContainer.getStart(), igSearchContainer.getEnd(), igSearchContainer.getOrderByComparator());
igSearchContainer.setResults(results);
request.setAttribute("view.jsp-igSearchContainer", igSearchContainer);
request.setAttribute("view.jsp-mediaGalleryMimeTypes", mediaGalleryMimeTypes);
%>
<%= HtmlUtil.escape(folder.getDescription()) %>
<%
if (folder != null) {
IGUtil.addPortletBreadcrumbEntries(folder, request, renderResponse);
if (!defaultFolderView && portletName.equals(DLPortletKeys.MEDIA_GALLERY_DISPLAY)) {
PortalUtil.setPageSubtitle(folder.getName(), request);
PortalUtil.setPageDescription(folder.getDescription(), request);
}
}
%>
<%
long groupImagesUserId = 0;
if (topLink.equals("mine") && themeDisplay.isSignedIn()) {
groupImagesUserId = user.getUserId();
}
SearchContainer igSearchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, null, null);
int total = DLAppServiceUtil.getGroupFileEntriesCount(repositoryId, groupImagesUserId, rootFolderId, mediaGalleryMimeTypes, status);
igSearchContainer.setTotal(total);
List results = DLAppServiceUtil.getGroupFileEntries(repositoryId, groupImagesUserId, rootFolderId, mediaGalleryMimeTypes, status, igSearchContainer.getStart(), igSearchContainer.getEnd(), igSearchContainer.getOrderByComparator());
igSearchContainer.setResults(results);
request.setAttribute("view.jsp-igSearchContainer", igSearchContainer);
request.setAttribute("view.jsp-mediaGalleryMimeTypes", mediaGalleryMimeTypes);
%>
<%
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, topLink), currentURL);
PortalUtil.setPageSubtitle(LanguageUtil.get(request, topLink), request);
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy