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

META-INF.resources.admin.common.edit_article.jsp Maven / Gradle / Ivy

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

<%
KBArticle kbArticle = (KBArticle)request.getAttribute(KBWebKeys.KNOWLEDGE_BASE_KB_ARTICLE);

KBTemplate kbTemplate = (KBTemplate)request.getAttribute(KBWebKeys.KNOWLEDGE_BASE_KB_TEMPLATE);

resourcePrimKey = BeanParamUtil.getLong(kbArticle, request, "resourcePrimKey");

kbFolderClassNameId = PortalUtil.getClassNameId(KBFolderConstants.getClassName());

long parentResourceClassNameId = BeanParamUtil.getLong(kbArticle, request, "parentResourceClassNameId", kbFolderClassNameId);

long parentResourcePrimKey = BeanParamUtil.getLong(kbArticle, request, "parentResourcePrimKey", KBFolderConstants.DEFAULT_PARENT_FOLDER_ID);

String title = BeanParamUtil.getString(kbArticle, request, "title", BeanPropertiesUtil.getString(kbTemplate, "title"));
String urlTitle = BeanParamUtil.getString(kbArticle, request, "urlTitle");
String content = BeanParamUtil.getString(kbArticle, request, "content", BeanPropertiesUtil.getString(kbTemplate, "content"));

String[] sections = AdminUtil.unescapeSections(BeanPropertiesUtil.getString(kbArticle, "sections", StringUtil.merge(kbSectionPortletInstanceConfiguration.adminKBArticleSectionsDefault())));

String headerTitle = LanguageUtil.get(request, "new-article");

if (kbArticle != null) {
	headerTitle = kbArticle.getTitle();
}

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

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

	renderResponse.setTitle(headerTitle);
}
%>


	
		
	



	
		<%= kbArticleStatus %>
	



	


>
<%= kbArticleStatus %>
<% 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; } fileMaxSize /= 1024; %> <% int friendlyURLMaxLength = ModelHintsUtil.getMaxLength(KBArticle.class.getName(), "urlTitle"); %>

<% Map fileBrowserParams = new HashMap(); if (kbArticle != null) { fileBrowserParams.put("resourcePrimKey", String.valueOf(kbArticle.getResourcePrimKey())); } %>
<% Map sectionsMap = new TreeMap(); for (String section : kbSectionPortletInstanceConfiguration.adminKBArticleSections()) { sectionsMap.put(LanguageUtil.get(request, section), section); } for (Map.Entry entry : sectionsMap.entrySet()) { %> <% } %>
<% boolean pending = false; if (kbArticle != null) { pending = kbArticle.isPending(); } String saveButtonLabel = "save"; if ((kbArticle == null) || kbArticle.isDraft() || kbArticle.isApproved()) { saveButtonLabel = "save-as-draft"; } String publishButtonLabel = "publish"; if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(themeDisplay.getCompanyId(), scopeGroupId, KBArticle.class.getName())) { publishButtonLabel = "submit-for-publication"; } %>
var urlTitleInput = document.getElementById('urlTitle'); function OnChangeEditor(html) { var customUrl = urlTitleInput.getAttribute('data-customUrl'); if (customUrl === 'false') { html = html.replace(/[^a-zA-Z0-9_-]/g, '-'); if (html[0] === '-') { html = html.replace(/^-+/, ''); } html = html.replace(/--+/g, '-'); urlTitleInput.value = html.toLowerCase(); } } var form = A.one('#fm'); var urlTitleInput = form.one('#urlTitle'); urlTitleInput.on( 'input', function(event) { event.currentTarget.setAttribute('data-customUrl', urlTitleInput.val() != ''); } ); var publishButton = form.one('#publishButton'); publishButton.on( 'click', function() { var workflowActionInput = form.one('#workflowAction'); if (workflowActionInput) { workflowActionInput.val('<%= WorkflowConstants.ACTION_PUBLISH %>'); } } ); form.on( 'submit', function() { form.one('#content').val(window.contentEditor.getHTML()); form.one('#title').val(window.titleEditor.getText()); updateMultipleKBArticleAttachments(); } ); var updateMultipleKBArticleAttachments = function() { var Lang = A.Lang; var selectedFileNameContainer = A.one('#selectedFileNameContainer'); var TPL_INPUT = ''; var values = A.all('input[name=selectUploadedFile]:checked').val(); var buffer = []; for (var i = 0; i < values.length; i++) { buffer[i] = Lang.sub( TPL_INPUT, { id: i, value: values[i] } ); } selectedFileNameContainer.html(buffer.join('')); }; <%! private String _getFriendlyURLPrefix(long parentResourceClassNameId, long parentResourcePrimKey) throws PortalException { StringBundler sb = new StringBundler(); sb.append("/-/"); Portlet portlet = PortletLocalServiceUtil.getPortletById(KBPortletKeys.KNOWLEDGE_BASE_DISPLAY); sb.append(portlet.getFriendlyURLMapping()); long kbFolderId = KnowledgeBaseUtil.getKBFolderId(parentResourceClassNameId, parentResourcePrimKey); if (kbFolderId != KBFolderConstants.DEFAULT_PARENT_FOLDER_ID) { KBFolder kbFolder = KBFolderLocalServiceUtil.getKBFolder(kbFolderId); sb.append(StringPool.SLASH); sb.append(kbFolder.getUrlTitle()); } return StringUtil.shorten(sb.toString(), 40) + StringPool.SLASH; } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy