META-INF.resources.message_boards_admin.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");
MBCategory category = (MBCategory)request.getAttribute(WebKeys.MESSAGE_BOARDS_CATEGORY);
long categoryId = MBUtil.getCategoryId(request, category);
PortletURL portletURL = renderResponse.createRenderURL();
if (categoryId == MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) {
portletURL.setParameter("mvcRenderCommandName", "/message_boards/view");
}
else {
portletURL.setParameter("mvcRenderCommandName", "/message_boards/view_category");
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");
String orderByType = ParamUtil.getString(request, "orderByType");
if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
portalPreferences.setValue(MBPortletKeys.MESSAGE_BOARDS_ADMIN, "order-by-col", orderByCol);
portalPreferences.setValue(MBPortletKeys.MESSAGE_BOARDS_ADMIN, "order-by-type", orderByType);
}
else {
orderByCol = portalPreferences.getValue(MBPortletKeys.MESSAGE_BOARDS_ADMIN, "order-by-col", "modified-date");
orderByType = portalPreferences.getValue(MBPortletKeys.MESSAGE_BOARDS_ADMIN, "order-by-type", "desc");
}
boolean orderByAsc = false;
if (orderByType.equals("asc")) {
orderByAsc = true;
}
OrderByComparator orderByComparator = null;
if (orderByCol.equals("modified-date")) {
orderByComparator = new ThreadModifiedDateComparator(orderByAsc);
}
else if (orderByCol.equals("title")) {
orderByComparator = new CategoryTitleComparator(orderByAsc);
}
request.setAttribute("view.jsp-categoryId", categoryId);
request.setAttribute("view.jsp-categorySubscriptionClassPKs", MBUtil.getCategorySubscriptionClassPKs(user.getUserId()));
request.setAttribute("view.jsp-portletURL", portletURL);
request.setAttribute("view.jsp-threadSubscriptionClassPKs", MBUtil.getThreadSubscriptionClassPKs(user.getUserId()));
request.setAttribute("view.jsp-viewCategory", Boolean.TRUE.toString());
%>
<%
MBListDisplayContext mbListDisplayContext = mbDisplayContextProvider.getMbListDisplayContext(request, response, categoryId);
%>
<%
SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, "cur1", 0, SearchContainer.DEFAULT_DELTA, portletURL, null, "there-are-no-threads-nor-categories");
searchContainer.setId("mbEntries");
searchContainer.setOrderByCol(orderByCol);
searchContainer.setOrderByComparator(orderByComparator);
searchContainer.setOrderByType(orderByType);
EntriesChecker entriesChecker = new EntriesChecker(liferayPortletRequest, liferayPortletResponse);
searchContainer.setRowChecker(entriesChecker);
if (categoryId == 0) {
entriesChecker.setRememberCheckBoxStateURLRegex("mvcRenderCommandName=/message_boards/view(&.|$)");
}
else {
entriesChecker.setRememberCheckBoxStateURLRegex("mbCategoryId=" + categoryId);
}
mbListDisplayContext.populateResultsAndTotal(searchContainer);
%>
<%
PortletURL navigationPortletURL = renderResponse.createRenderURL();
navigationPortletURL.setParameter("categoryId", String.valueOf(MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID));
%>
<%
request.setAttribute("view.jsp-displayStyle", "descriptive");
request.setAttribute("view.jsp-entriesSearchContainer", searchContainer);
%>
<%
long groupThreadsUserId = ParamUtil.getLong(request, "groupThreadsUserId");
if (groupThreadsUserId > 0) {
portletURL.setParameter("groupThreadsUserId", String.valueOf(groupThreadsUserId));
}
%>
: <%= HtmlUtil.escape(PortalUtil.getUserName(groupThreadsUserId, StringPool.BLANK)) %>
<%
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(redirect);
renderResponse.setTitle(LanguageUtil.get(request, "recent-posts"));
PortalUtil.setPageSubtitle(LanguageUtil.get(request, StringUtil.replace("recent-posts", CharPool.UNDERLINE, CharPool.DASH)), request);
%>
<%
if (category != null) {
PortalUtil.setPageSubtitle(category.getName(), request);
PortalUtil.setPageDescription(category.getDescription(), request);
}
%>
function deleteEntries() {
if (<%= TrashUtil.isTrashEnabled(scopeGroupId) %> || confirm('<%= UnicodeLanguageUtil.get(request, TrashUtil.isTrashEnabled(scopeGroupId) ? "are-you-sure-you-want-to-move-the-selected-entries-to-the-recycle-bin" : "are-you-sure-you-want-to-delete-the-selected-entries") %>')) {
var form = AUI.$(document. fm);
form.attr('method', 'post');
form.fm('<%= Constants.CMD %>').val('<%= TrashUtil.isTrashEnabled(scopeGroupId) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>');
submitForm(form, ' ');
}
}
function lockEntries() {
var form = AUI.$(document. fm);
form.attr('method', 'post');
form.fm('<%= Constants.CMD %>').val('<%= Constants.LOCK %>');
submitForm(form, ' ');
}
function unlockEntries() {
var form = AUI.$(document. fm);
form.attr('method', 'post');
form.fm('<%= Constants.CMD %>').val('<%= Constants.UNLOCK %>');
submitForm(form, ' ');
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy