META-INF.resources.message_boards.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="/message_boards/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName", "/message_boards/view");
MBCategory category = (MBCategory)request.getAttribute(WebKeys.MESSAGE_BOARDS_CATEGORY);
long categoryId = MBUtil.getCategoryId(request, category);
Set categorySubscriptionClassPKs = null;
Set threadSubscriptionClassPKs = null;
if (themeDisplay.isSignedIn()) {
categorySubscriptionClassPKs = MBUtil.getCategorySubscriptionClassPKs(user.getUserId());
threadSubscriptionClassPKs = MBUtil.getThreadSubscriptionClassPKs(user.getUserId());
}
long groupThreadsUserId = ParamUtil.getLong(request, "groupThreadsUserId");
String assetTagName = ParamUtil.getString(request, "tag");
boolean useAssetEntryQuery = Validator.isNotNull(assetTagName);
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcRenderCommandName", mvcRenderCommandName);
portletURL.setParameter("mbCategoryId", String.valueOf(categoryId));
String keywords = ParamUtil.getString(request, "keywords");
if (Validator.isNotNull(keywords)) {
portletURL.setParameter("keywords", keywords);
}
String orderByCol = ParamUtil.getString(request, "orderByCol", "modified-date");
boolean orderByAsc = false;
String orderByType = ParamUtil.getString(request, "orderByType", "desc");
if (orderByType.equals("asc")) {
orderByAsc = true;
}
OrderByComparator orderByComparator = null;
if (orderByCol.equals("modified-date")) {
orderByComparator = new ThreadModifiedDateComparator(orderByAsc);
}
MBListDisplayContext mbListDisplayContext = mbDisplayContextProvider.getMbListDisplayContext(request, response, categoryId);
request.setAttribute("view.jsp-categorySubscriptionClassPKs", categorySubscriptionClassPKs);
request.setAttribute("view.jsp-threadSubscriptionClassPKs", threadSubscriptionClassPKs);
request.setAttribute("view.jsp-categoryId", categoryId);
request.setAttribute("view.jsp-portletURL", portletURL);
request.setAttribute("view.jsp-viewCategory", Boolean.TRUE.toString());
%>
<%@ include file="/message_boards/view_threads.jspf" %>
<%
SearchContainer entriesSearchContainer = new SearchContainer(renderRequest, null, null, "cur1", 0, SearchContainer.DEFAULT_DELTA, portletURL, null, "there-are-no-threads-nor-categories");
entriesSearchContainer.setId("mbEntries");
entriesSearchContainer.setOrderByCol(orderByCol);
entriesSearchContainer.setOrderByComparator(orderByComparator);
entriesSearchContainer.setOrderByType(orderByType);
mbListDisplayContext.populateResultsAndTotal(entriesSearchContainer);
%>
<%
boolean showAddCategoryButton = MBCategoryPermission.contains(permissionChecker, scopeGroupId, categoryId, ActionKeys.ADD_CATEGORY);
boolean showAddMessageButton = MBCategoryPermission.contains(permissionChecker, scopeGroupId, categoryId, ActionKeys.ADD_MESSAGE);
boolean showPermissionsButton = MBPermission.contains(permissionChecker, scopeGroupId, ActionKeys.PERMISSIONS);
if (showAddMessageButton && !themeDisplay.isSignedIn()) {
if (!allowAnonymousPosting) {
showAddMessageButton = false;
}
}
%>
<%
String modelResource = "com.liferay.message.boards";
String modelResourceDescription = themeDisplay.getScopeGroupName();
String resourcePrimKey = String.valueOf(scopeGroupId);
if (category != null) {
modelResource = MBCategory.class.getName();
modelResourceDescription = category.getName();
resourcePrimKey = String.valueOf(category.getCategoryId());
}
%>
<%@ include file="/message_boards/category_subscriptions.jspf" %>
<%
long parentCategoryId = category.getParentCategoryId();
String parentCategoryName = LanguageUtil.get(request, "message-boards-home");
if (!category.isRoot()) {
MBCategory parentCategory = MBCategoryLocalServiceUtil.getCategory(parentCategoryId);
parentCategoryId = parentCategory.getCategoryId();
parentCategoryName = parentCategory.getName();
}
%>
<%
request.setAttribute("view.jsp-displayStyle", "descriptive");
request.setAttribute("view.jsp-entriesSearchContainer", entriesSearchContainer);
%>
<%
if (category != null) {
PortalUtil.setPageSubtitle(category.getName(), request);
PortalUtil.setPageDescription(category.getDescription(), request);
}
%>
<%
if (mbListDisplayContext.isShowMyPosts() && themeDisplay.isSignedIn()) {
groupThreadsUserId = user.getUserId();
}
if (groupThreadsUserId > 0) {
portletURL.setParameter("groupThreadsUserId", String.valueOf(groupThreadsUserId));
}
%>
: <%= HtmlUtil.escape(PortalUtil.getUserName(groupThreadsUserId, StringPool.BLANK)) %>
<%
request.setAttribute("view.jsp-displayStyle", "descriptive");
request.setAttribute("view.jsp-entriesSearchContainer", entriesSearchContainer);
%>
<%
String pageSubtitle = null;
if (mbListDisplayContext.isShowMyPosts()) {
pageSubtitle = "my-posts";
}
else if (mbListDisplayContext.isShowRecentPosts()) {
pageSubtitle = "recent-posts";
}
PortalUtil.setPageSubtitle(LanguageUtil.get(request, StringUtil.replace(pageSubtitle, CharPool.UNDERLINE, CharPool.DASH)), request);
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, TextFormatter.format(pageSubtitle, TextFormatter.O)), portletURL.toString());
%>
<%
if (themeDisplay.isSignedIn()) {
groupThreadsUserId = user.getUserId();
}
if (groupThreadsUserId > 0) {
portletURL.setParameter("groupThreadsUserId", String.valueOf(groupThreadsUserId));
}
MBCategoryDisplay categoryDisplay = new MBCategoryDisplayImpl(scopeGroupId, categoryId);
%>
<%@ include file="/message_boards/subscribed_category_columns.jspf" %>
<%@ include file="/message_boards/view_threads.jspf" %>
<%
PortalUtil.setPageSubtitle(LanguageUtil.get(request, StringUtil.replace("my-subscriptions", CharPool.UNDERLINE, CharPool.DASH)), request);
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, TextFormatter.format("my-subscriptions", TextFormatter.O)), portletURL.toString());
%>
<%!
private static Log _log = LogFactoryUtil.getLog("com_liferay_message_boards_web.message_boards.view_jsp");
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy