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

META-INF.resources.message_boards.edit_message.jsp Maven / Gradle / Ivy

There is a newer version: 5.0.117
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="/message_boards/init.jsp" %>

<%
String redirect = ParamUtil.getString(request, "redirect");

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

MBMessage message = (MBMessage)request.getAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE);

long messageId = BeanParamUtil.getLong(message, request, "messageId");

long categoryId = MBUtil.getCategoryId(request, message);
long threadId = BeanParamUtil.getLong(message, request, "threadId");
long parentMessageId = BeanParamUtil.getLong(message, request, "parentMessageId", MBMessageConstants.DEFAULT_PARENT_MESSAGE_ID);

String subject = BeanParamUtil.getString(message, request, "subject");

MBThread thread = null;

MBMessage curParentMessage = null;
String parentAuthor = null;

if (threadId > 0) {
	try {
		curParentMessage = MBMessageLocalServiceUtil.getMessage(parentMessageId);

		if (Validator.isNull(subject)) {
			if (curParentMessage.getSubject().startsWith("RE: ")) {
				subject = curParentMessage.getSubject();
			}
			else {
				subject = "RE: " + curParentMessage.getSubject();
			}
		}

		parentAuthor = curParentMessage.isAnonymous() ? LanguageUtil.get(request, "anonymous") : HtmlUtil.escape(PortalUtil.getUserName(curParentMessage));
	}
	catch (Exception e) {
	}
}

String body = BeanParamUtil.getString(message, request, "body");
boolean quote = ParamUtil.getBoolean(request, "quote");
boolean splitThread = ParamUtil.getBoolean(request, "splitThread");

List existingAttachmentsFileEntries = new ArrayList();

if (message != null) {
	existingAttachmentsFileEntries = message.getAttachmentsFileEntries();
}

boolean allowPingbacks = PropsValues.MESSAGE_BOARDS_PINGBACK_ENABLED && BeanParamUtil.getBoolean(message, request, "allowPingbacks", true);

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

	viewMessageURL.setParameter("mvcRenderCommandName", "/message_boards/view_message");
	viewMessageURL.setParameter("messageId", String.valueOf(messageId));

	redirect = viewMessageURL.toString();
}

if (curParentMessage != null) {
	MBBreadcrumbUtil.addPortletBreadcrumbEntries(curParentMessage, request, renderResponse);

	if (!layout.isTypeControlPanel()) {
		PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "reply"), currentURL);
	}
}
else if (message != null) {
	MBBreadcrumbUtil.addPortletBreadcrumbEntries(message, request, renderResponse);

	if (!layout.isTypeControlPanel()) {
		PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "edit"), currentURL);
	}
}
else {
	MBBreadcrumbUtil.addPortletBreadcrumbEntries(categoryId, request, renderResponse);

	if (!layout.isTypeControlPanel()) {
		PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "add-message"), currentURL);
	}
}

String headerTitle = LanguageUtil.get(request, "add-message");

if (curParentMessage != null) {
	headerTitle = LanguageUtil.format(request, "reply-to-x", curParentMessage.getSubject(), false);
}
else if (message != null) {
	headerTitle = LanguageUtil.format(request, "edit-x", message.getSubject(), false);
}

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

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

	renderResponse.setTitle(headerTitle);
}
%>

> <% AntivirusScannerException ase = (AntivirusScannerException)errorException; %> <%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA), StringPool.COMMA_AND_SPACE) %>. <% long uploadServletRequestImplMaxSize = PrefsPropsUtil.getLong(PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_MAX_SIZE); %> <% long fileMaxSize = PrefsPropsUtil.getLong(PropsKeys.DL_FILE_MAX_SIZE); if (fileMaxSize == 0) { fileMaxSize = uploadServletRequestImplMaxSize; } %>
: <% request.setAttribute("edit-message.jsp-showDeletedAttachmentsFileEntries", Boolean.TRUE); request.setAttribute("edit-message.jsp-showPermanentLink", Boolean.TRUE); request.setAttribute("edit-message.jsp-showRecentPosts", Boolean.TRUE); request.setAttribute("edit_message.jsp-category", null); request.setAttribute("edit_message.jsp-editable", Boolean.FALSE); request.setAttribute("edit_message.jsp-message", curParentMessage); request.setAttribute("edit_message.jsp-thread", thread); %>
<%@ include file="/message_boards/bbcode_editor.jspf" %> <%@ include file="/message_boards/html_editor.jspf" %>
    <% for (int i = 0; i < existingAttachmentsFileEntries.size(); i++) { FileEntry fileEntry = existingAttachmentsFileEntries.get(i); String taglibDeleteAttachment = "javascript:" + renderResponse.getNamespace() + "trashAttachment(" + (i + 1) + ", '" + Constants.MOVE_TO_TRASH + "');"; if (!TrashUtil.isTrashEnabled(scopeGroupId)) { taglibDeleteAttachment = "javascript:" + renderResponse.getNamespace() + "deleteAttachment(" + (i + 1) + ");"; } %>
  • <% AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(DLFileEntry.class.getName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(fileEntry.getFileEntryId()); %> <% StringBundler sb = new StringBundler(7); sb.append("javascript:"); sb.append(renderResponse.getNamespace()); sb.append("trashAttachment("); sb.append(i + 1); sb.append(", '"); sb.append(Constants.RESTORE); sb.append("');"); %> ()
  • <% } %>
<% for (int i = existingAttachmentsFileEntries.size() + 1; i <= 5; i++) { %>
<% } %>
<% boolean disabled = false; boolean question = threadAsQuestionByDefault; if (message != null) { thread = MBThreadLocalServiceUtil.getThread(threadId); if (thread.isQuestion() || message.isAnswer()) { question = true; } } else { MBCategory category = MBCategoryLocalServiceUtil.getCategory(categoryId); if ((category != null) && category.getDisplayStyle().equals("question")) { disabled = true; question = true; } } %> <% double threadPriority = BeanParamUtil.getDouble(message, request, "priority"); %> <% for (int i = 0; i < priorities.length; i++) { String[] priority = StringUtil.split(priorities[i], StringPool.PIPE); try { String priorityName = priority[0]; String priorityImage = priority[1]; double priorityValue = GetterUtil.getDouble(priority[2]); if (priorityValue > 0) { %> <% } } catch (Exception e) { } } %>
<% boolean pending = false; if (message != null) { pending = message.isPending(); } %>
<% String saveButtonLabel = "save"; if ((message == null) || message.isDraft() || message.isApproved()) { saveButtonLabel = "save-as-draft"; } String publishButtonLabel = "publish"; if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(themeDisplay.getCompanyId(), scopeGroupId, MBMessage.class.getName())) { publishButtonLabel = "submit-for-publication"; } %>
function saveMessage(draft) { var form = AUI.$(document.fm); form.fm('<%= Constants.CMD %>').val('<%= (message == null) ? Constants.ADD : Constants.UPDATE %>'); form.fm('body').val(getHTML()); if (!draft) { form.fm('workflowAction').val(<%= WorkflowConstants.ACTION_PUBLISH %>); } submitForm(form); } function trashAttachment(index, action) { var $ = AUI.$; var existingPath = $('#existingPath' + index); var removeExisting = $('#removeExisting' + index); var undoFile = $('#undoFile' + index); if (action == '<%= Constants.MOVE_TO_TRASH %>') { removeExisting.addClass('hide'); undoFile.removeClass('hide'); existingPath.val(''); } else { removeExisting.removeClass('hide'); undoFile.addClass('hide'); var undoPath = $('#undoPath' + index); existingPath.val(undoPath.val()); } } function deleteAttachment(index) { var $ = AUI.$; $('#removeExisting' + index).remove(); $('#existingFile' + index).remove(); var file = $('#msgFile' + index); file.removeClass('hide'); file.closest('li').addClass('deleted-input'); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy