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

META-INF.resources.message_boards.view_message_content.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 backURL = redirect;

MBMessageDisplay messageDisplay = (MBMessageDisplay)request.getAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE_DISPLAY);

MBMessage message = messageDisplay.getMessage();

MBCategory category = messageDisplay.getCategory();

MBThread thread = messageDisplay.getThread();

if (Validator.isNull(redirect)) {
	PortletURL backPortletURL = renderResponse.createRenderURL();

	if ((category == null) || (category.getCategoryId() == MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID)) {
		backPortletURL.setParameter("mvcRenderCommandName", "/message_boards/view");
	}
	else {
		backPortletURL.setParameter("mvcRenderCommandName", "/message_boards/view_category");
		backPortletURL.setParameter("mbCategoryId", String.valueOf(category.getCategoryId()));
	}

	backURL = backPortletURL.toString();
}

boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));

if (portletTitleBasedNavigation) {
	portletDisplay.setShowBackIcon(true);
	portletDisplay.setURLBack(backURL);

	renderResponse.setTitle(message.getSubject());
}
%>


	



	
<% MBMessage rootMessage = null; if (message.isRoot()) { rootMessage = message; } else { rootMessage = MBMessageLocalServiceUtil.getMessage(message.getRootMessageId()); } %>
<% MBTreeWalker treeWalker = messageDisplay.getTreeWalker(); AssetUtil.addLayoutTags(request, AssetTagLocalServiceUtil.getTags(MBMessage.class.getName(), thread.getRootMessageId())); %>
<% boolean viewableThread = false; request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER, treeWalker); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_CATEGORY, category); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_CUR_MESSAGE, treeWalker.getRoot()); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_DEPTH, Integer.valueOf(0)); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_LAST_NODE, Boolean.valueOf(false)); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_SEL_MESSAGE, message); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_THREAD, thread); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_VIEWABLE_THREAD, Boolean.FALSE.toString()); %> <% int index = 0; int rootIndexPage = 0; boolean moreMessagesPagination = false; List messages = treeWalker.getMessages(); int[] range = treeWalker.getChildrenRange(treeWalker.getRoot()); MBMessageIterator mbMessageIterator = new MBMessageIteratorImpl(messages, range[0], range[1]); while (mbMessageIterator.hasNext()) { boolean messageFound = GetterUtil.getBoolean(request.getAttribute("view_thread_tree.jsp-messageFound")); index = GetterUtil.getInteger(request.getAttribute(WebKeys.MESSAGE_BOARDS_TREE_INDEX), 1); rootIndexPage = mbMessageIterator.getIndexPage(); if (messageFound && ((index + 1) > PropsValues.DISCUSSION_COMMENTS_DELTA_VALUE)) { moreMessagesPagination = true; break; } request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER, treeWalker); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_CATEGORY, category); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_CUR_MESSAGE, mbMessageIterator.next()); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_DEPTH, Integer.valueOf(0)); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_LAST_NODE, Boolean.valueOf(false)); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_SEL_MESSAGE, message); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_THREAD, thread); request.setAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_VIEWABLE_THREAD, Boolean.FALSE.toString()); %>
<% } %>
<% MBMessage rootMessage = treeWalker.getRoot(); %>
<% viewableThread = GetterUtil.getBoolean((String)request.getAttribute(WebKeys.MESSAGE_BOARDS_TREE_WALKER_VIEWABLE_THREAD)); %>
$('#moreMessages').on( 'click', function(event) { var form = $('#fm'); var data = Liferay.Util.ns( '', { index: form.fm('index').val(), rootIndexPage: form.fm('rootIndexPage').val() } ); $.ajax( '<%= getMessagesURL.toString() %>', { data: data, success: function(data) { $('#messageContainer').append(data); } } ); } );




© 2015 - 2025 Weber Informatics LLC | Privacy Policy