All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.blogs_admin.view_images.jsp Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
<%--
/**
 * 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="/blogs_admin/init.jsp" %>

<%
Folder attachmentsFolder = BlogsEntryLocalServiceUtil.addAttachmentsFolder(themeDisplay.getUserId(), scopeGroupId);

String displayStyle = ParamUtil.getString(request, "displayStyle");

if (Validator.isNull(displayStyle)) {
	displayStyle = portalPreferences.getValue(BlogsPortletKeys.BLOGS_ADMIN, "images-display-style", "icon");
}
else {
	portalPreferences.setValue(BlogsPortletKeys.BLOGS_ADMIN, "images-display-style", displayStyle);

	request.setAttribute(WebKeys.SINGLE_PAGE_APPLICATION_CLEAR_CACHE, Boolean.TRUE);
}

int cur = ParamUtil.getInteger(request, SearchContainer.DEFAULT_CUR_PARAM);
int delta = ParamUtil.getInteger(request, SearchContainer.DEFAULT_DELTA_PARAM);
String orderByCol = ParamUtil.getString(request, "orderByCol", "title");
String orderByType = ParamUtil.getString(request, "orderByType", "asc");

DLMimeTypeDisplayContext dlMimeTypeDisplayContext = (DLMimeTypeDisplayContext)request.getAttribute(BlogsWebKeys.DL_MIME_TYPE_DISPLAY_CONTEXT);

PortletURL portletURL = renderResponse.createRenderURL();

portletURL.setParameter("mvcRenderCommandName", "/blogs/view");
portletURL.setParameter("navigation", "images");

if (delta > 0) {
	portletURL.setParameter("delta", String.valueOf(delta));
}

PortletURL sortURL = PortletURLUtil.clone(portletURL, liferayPortletResponse);

portletURL.setParameter("orderBycol", orderByCol);
portletURL.setParameter("orderByType", orderByType);

request.setAttribute("view_images.jsp-portletURL", portletURL);

PortletURL displayStyleURL = PortletURLUtil.clone(portletURL, liferayPortletResponse);

if (cur > 0) {
	displayStyleURL.setParameter("cur", String.valueOf(cur));
}

String keywords = ParamUtil.getString(request, "keywords");
%>


	
		
			
		

		
			
		
	

	
		
	


<% List results = null; if (Validator.isNull(keywords)) { total = PortletFileRepositoryUtil.getPortletFileEntriesCount(scopeGroupId, attachmentsFolder.getFolderId()); results = PortletFileRepositoryUtil.getPortletFileEntries(scopeGroupId, attachmentsFolder.getFolderId(), WorkflowConstants.STATUS_APPROVED, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator()); } else { SearchContext searchContext = SearchContextFactory.getInstance(request); searchContext.setEnd(searchContainer.getEnd()); searchContext.setFolderIds(new long[] {attachmentsFolder.getFolderId()}); searchContext.setStart(searchContainer.getStart()); Folder folder = DLAppLocalServiceUtil.getFolder(attachmentsFolder.getFolderId()); Hits hits = PortletFileRepositoryUtil.searchPortletFileEntries(folder.getRepositoryId(), searchContext); total = hits.getLength(); Document[] docs = hits.getDocs(); results = new ArrayList(); for (Document doc : docs) { long fileEntryId = GetterUtil.getLong(doc.get(Field.ENTRY_CLASS_PK)); FileEntry fileEntry = null; try { fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId); results.add(fileEntry); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Documents and Media search index is stale and contains file entry {" + fileEntryId + "}"); } continue; } } } searchContainer.setTotal(total); searchContainer.setResults(results); %> <%@ include file="/blogs_admin/image_search_columns.jspf" %>
function deleteImages() { if (confirm('<%= UnicodeLanguageUtil.get(request, "are-you-sure-you-want-to-delete-the-selected-images") %>')) { var form = AUI.$(document.fm); form.fm('<%= Constants.CMD %>').val('<%= Constants.DELETE %>'); form.fm('deleteFileEntryIds').val(Liferay.Util.listCheckedExcept(form, 'allRowIds')); submitForm(form); } } <%! private static Log _log = LogFactoryUtil.getLog("com_liferay_blogs_web.blogs_admin.view_images_jsp"); %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy