
META-INF.resources.message_boards.view.jsp Maven / Gradle / Ivy
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ 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 = MBSubscriptionUtil.getCategorySubscriptionClassPKs(user.getUserId());
threadSubscriptionClassPKs = MBSubscriptionUtil.getThreadSubscriptionClassPKs(user.getUserId());
}
long groupThreadsUserId = ParamUtil.getLong(request, "groupThreadsUserId");
String assetTagName = ParamUtil.getString(request, "tag");
boolean useAssetEntryQuery = Validator.isNotNull(assetTagName);
PortletURL portletURL = PortletURLBuilder.createRenderURL(
renderResponse
).setMVCRenderCommandName(
mvcRenderCommandName
).buildPortletURL();
int cur1 = ParamUtil.getInteger(request, "cur1");
if (cur1 > 0) {
portletURL.setParameter("cur1", String.valueOf(cur1));
}
int cur2 = ParamUtil.getInteger(request, "cur2");
if (cur2 > 0) {
portletURL.setParameter("cur2", String.valueOf(cur2));
}
portletURL.setParameter("mbCategoryId", String.valueOf(categoryId));
String searchCategoryId = ParamUtil.getString(request, "searchCategoryId");
if (Validator.isNotNull(searchCategoryId)) {
portletURL.setParameter("searchCategoryId", searchCategoryId);
}
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 threadOrderByComparator = null;
if (orderByCol.equals("modified-date")) {
threadOrderByComparator = ThreadModifiedDateComparator.getInstance(orderByAsc);
}
MBListDisplayContext mbListDisplayContext = MBDisplayContextUtil.getMBListDisplayContext(request, response, categoryId, mvcRenderCommandName);
request.setAttribute("view.jsp-categorySubscriptionClassPKs", categorySubscriptionClassPKs);
request.setAttribute("view.jsp-threadSubscriptionClassPKs", threadSubscriptionClassPKs);
request.setAttribute("view.jsp-viewCategory", Boolean.TRUE.toString());
%>
<%@ include file="/message_boards/nav.jspf" %>
<%
if (themeDisplay.isSignedIn()) {
groupThreadsUserId = user.getUserId();
}
if (groupThreadsUserId > 0) {
portletURL.setParameter("groupThreadsUserId", String.valueOf(groupThreadsUserId));
}
MBCategoryDisplay categoryDisplay = new MBCategoryDisplay(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());
%>
<%@ include file="/message_boards/view_threads.jspf" %>
<%
boolean showAddCategoryButton = MBCategoryPermission.contains(permissionChecker, scopeGroupId, categoryId, ActionKeys.ADD_CATEGORY);
boolean showAddMessageButton = MBCategoryPermission.contains(permissionChecker, scopeGroupId, categoryId, ActionKeys.ADD_MESSAGE);
boolean showPermissionsButton = MBResourcePermission.contains(permissionChecker, scopeGroupId, ActionKeys.PERMISSIONS);
if (showAddMessageButton && !themeDisplay.isSignedIn() && !allowAnonymousPosting) {
showAddMessageButton = false;
}
%>
<%
MBBreadcrumbUtil.addPortletBreadcrumbEntries(categoryId, request, renderResponse);
%>
<%= HtmlUtil.escape(category.getName()) %>
<%
MBBreadcrumbUtil.addPortletBreadcrumbEntries(categoryId, request, renderResponse);
%>
<%
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());
}
%>
<%
SearchContainer categoryEntriesSearchContainer = new SearchContainer(renderRequest, null, null, "cur1", 0, mbListDisplayContext.getCategoryEntriesDelta(), PortletURLUtil.clone(portletURL, renderResponse), null, "there-are-no-threads-or-categories");
mbListDisplayContext.setCategoryEntriesDelta(categoryEntriesSearchContainer);
categoryEntriesSearchContainer.setOrderByCol(orderByCol);
categoryEntriesSearchContainer.setOrderByComparator(CategoryTitleComparator.getInstance(true));
categoryEntriesSearchContainer.setOrderByType(orderByType);
mbListDisplayContext.populateCategoriesResultsAndTotal(categoryEntriesSearchContainer);
request.setAttribute("view.jsp-categoryEntriesSearchContainer", categoryEntriesSearchContainer);
%>
<%@ include file="/message_boards/view_category_entries.jspf" %>
<%
SearchContainer threadEntriesSearchContainer = new SearchContainer(renderRequest, null, null, "cur2", 0, mbListDisplayContext.getThreadEntriesDelta(), PortletURLUtil.clone(portletURL, renderResponse), null, "there-are-no-threads-or-categories");
mbListDisplayContext.setThreadEntriesDelta(threadEntriesSearchContainer);
threadEntriesSearchContainer.setOrderByCol(orderByCol);
threadEntriesSearchContainer.setOrderByComparator(threadOrderByComparator);
threadEntriesSearchContainer.setOrderByType(orderByType);
mbListDisplayContext.populateThreadsResultsAndTotal(threadEntriesSearchContainer);
%>
<%@ include file="/message_boards/view_thread_entries.jspf" %>
<%
if (category != null) {
PortalUtil.setPageSubtitle(category.getName(), request);
PortalUtil.setPageDescription(category.getDescription(), request);
}
%>
: <%= HtmlUtil.escape(PortalUtil.getUserName(groupThreadsUserId, StringPool.BLANK)) %>
<%
if (themeDisplay.isSignedIn()) {
groupThreadsUserId = user.getUserId();
}
%>
<%
if (groupThreadsUserId > 0) {
portletURL.setParameter("groupThreadsUserId", String.valueOf(groupThreadsUserId));
}
SearchContainer threadEntriesSearchContainer = new SearchContainer(renderRequest, null, null, "cur1", 0, mbListDisplayContext.getThreadEntriesDelta(), portletURL, null, "there-are-no-threads");
mbListDisplayContext.setThreadEntriesDelta(threadEntriesSearchContainer);
threadEntriesSearchContainer.setOrderByCol(orderByCol);
threadEntriesSearchContainer.setOrderByComparator(threadOrderByComparator);
threadEntriesSearchContainer.setOrderByType(orderByType);
mbListDisplayContext.populateThreadsResultsAndTotal(threadEntriesSearchContainer);
%>
<%@ include file="/message_boards/view_thread_entries.jspf" %>
<%
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());
%>
<%!
private static final Log _log = LogFactoryUtil.getLog("com_liferay_message_boards_web.message_boards.view_jsp");
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy