
META-INF.resources.blogs.edit_entry.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="/blogs/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
String referringPortletResource = ParamUtil.getString(request, "referringPortletResource");
BlogsEntry entry = (BlogsEntry)request.getAttribute(WebKeys.BLOGS_ENTRY);
long entryId = BeanParamUtil.getLong(entry, request, "entryId");
String title = BeanParamUtil.getString(entry, request, "title");
String subtitle = BeanParamUtil.getString(entry, request, "subtitle");
String content = BeanParamUtil.getString(entry, request, "content");
String description = BeanParamUtil.getString(entry, request, "description");
boolean customAbstract = ParamUtil.getBoolean(request, "customAbstract", (entry != null) && Validator.isNotNull(entry.getDescription()) ? true : false);
if (!customAbstract) {
description = StringUtil.shorten(content, pageAbstractLength);
}
boolean allowPingbacks = PropsValues.BLOGS_PINGBACK_ENABLED && BeanParamUtil.getBoolean(entry, request, "allowPingbacks", true);
boolean allowTrackbacks = PropsValues.BLOGS_TRACKBACK_ENABLED && BeanParamUtil.getBoolean(entry, request, "allowTrackbacks", true);
String coverImageCaption = BeanParamUtil.getString(entry, request, "coverImageCaption");
long coverImageFileEntryId = BeanParamUtil.getLong(entry, request, "coverImageFileEntryId");
long smallImageFileEntryId = BeanParamUtil.getLong(entry, request, "smallImageFileEntryId");
boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(redirect);
renderResponse.setTitle((entry != null) ? entry.getTitle() : LanguageUtil.get(request, "new-blog-entry"));
%>
<%= saveStatus %>
<%
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;
}
%>
<%
BlogsItemSelectorHelper blogsItemSelectorHelper = (BlogsItemSelectorHelper)request.getAttribute(BlogsWebKeys.BLOGS_ITEM_SELECTOR_HELPER);
String[] imageExtensions = PrefsPropsUtil.getStringArray(PropsKeys.BLOGS_IMAGE_EXTENSIONS, StringPool.COMMA);
RequestBackedPortletURLFactory requestBackedPortletURLFactory = RequestBackedPortletURLFactoryUtil.create(liferayPortletRequest);
%>
<%
String coverImageSelectedItemEventName = liferayPortletResponse.getNamespace() + "coverImageSelectedItem";
%>
">
<%= StringUtil.merge(imageExtensions, ", ") %>.
<%
String smallImageSelectedItemEventName = liferayPortletResponse.getNamespace() + "smallImageSelectedItem";
%>
<%
boolean sendEmailEntryUpdated = ParamUtil.getBoolean(request, "sendEmailEntryUpdated");
%>
<%
String emailEntryUpdatedComment = ParamUtil.getString(request, "emailEntryUpdatedComment");
%>
' label="allow-pingbacks" name="allowPingbacks" type="toggle-switch" value="<%= allowPingbacks %>" />
<%
int i = 0;
for (String trackback : StringUtil.split(entry.getTrackbacks())) {
%>
<%
}
%>
<%
boolean pending = false;
if (entry != null) {
pending = entry.isPending();
}
%>
<%
String saveButtonLabel = "save";
if ((entry == null) || entry.isDraft() || entry.isApproved()) {
saveButtonLabel = "save-as-draft";
}
String publishButtonLabel = "publish";
if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(themeDisplay.getCompanyId(), scopeGroupId, BlogsEntry.class.getName())) {
publishButtonLabel = "submit-for-publication";
}
%>
function OnChangeEditor(html) {
var blogs = Liferay.component(' Blogs');
if (blogs) {
blogs.setDescription(html);
}
}
function OnDescriptionEditorInit() {
document.getElementById(' descriptionEditor').setAttribute('contenteditable', false);
}
Liferay.Util.toggleBoxes(' sendEmailEntryUpdated', ' emailEntryUpdatedCommentWrapper');
var blogs = Liferay.component(
' Blogs',
new Liferay.Blogs(
{
constants: {
'ACTION_PUBLISH': '<%= WorkflowConstants.ACTION_PUBLISH %>',
'ACTION_SAVE_DRAFT': '<%= WorkflowConstants.ACTION_SAVE_DRAFT %>',
'ADD': '<%= Constants.ADD %>',
'CMD': '<%= Constants.CMD %>',
'STATUS_DRAFT': '<%= WorkflowConstants.STATUS_DRAFT %>',
'UPDATE': '<%= Constants.UPDATE %>'
},
descriptionLength: '<%= pageAbstractLength %>',
editEntryURL: '<%= editEntryURL %>',
entry: {
content: '<%= UnicodeFormatter.toString(content) %>',
customDescription: <%= customAbstract %>,
description: '<%= UnicodeFormatter.toString(description) %>',
pending: <%= entry.isPending() %>,
status: '<%= entry.getStatus() %>',
subtitle: '<%= UnicodeFormatter.toString(subtitle) %>',
title: '<%= UnicodeFormatter.toString(title) %>',
userId: '<%= entry.getUserId() %>'
},
namespace: ' '
}
)
);
var clearSaveDraftHandle = function(event) {
if (event.portletId === '<%= portletDisplay.getRootPortletId() %>') {
blogs.destroy();
Liferay.detach('destroyPortlet', clearSaveDraftHandle);
}
};
var createAbstractEditor = function() {
var descriptionEditor = window[' descriptionEditor'];
if (!descriptionEditor.instanceReady) {
descriptionEditor.create();
blogs.setDescription(window[' contentEditor'].getText());
}
};
var configurationContentHeader = AUI.$('#configurationContent');
if (configurationContentHeader.hasClass('in')) {
createAbstractEditor();
}
else {
configurationContentHeader.on('show.bs.collapse', createAbstractEditor);
}
Liferay.on('destroyPortlet', clearSaveDraftHandle);
<%
if (entry != null) {
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("mvcRenderCommandName", "/blogs/view_entry");
portletURL.setParameter("entryId", String.valueOf(entry.getEntryId()));
PortalUtil.addPortletBreadcrumbEntry(request, entry.getTitle(), portletURL.toString());
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "edit"), currentURL);
}
else {
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "add-entry"), currentURL);
}
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy