META-INF.resources.configuration.jsp Maven / Gradle / Ivy
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ include file="/init.jsp" %>
<%
QuestionsConfiguration questionsConfiguration = ConfigurationProviderUtil.getPortletInstanceConfiguration(QuestionsConfiguration.class, themeDisplay);
long rootTopicId = questionsConfiguration.rootTopicId();
MBCategory mbCategory = null;
String rootTopicName = StringPool.BLANK;
try {
mbCategory = MBCategoryLocalServiceUtil.getCategory(rootTopicId);
rootTopicName = mbCategory.getName();
}
catch (Exception exception) {
if (_log.isDebugEnabled()) {
_log.debug(exception);
}
}
%>
<%
String taglibRemoveRootTopic = "Liferay.Util.removeEntitySelection('rootTopicId', 'rootTopicName', this, '" + liferayPortletResponse.getNamespace() + "');";
%>
var selectRootTopicButton = document.getElementById(
' selectRootTopicButton'
);
if (selectRootTopicButton) {
selectRootTopicButton.addEventListener('click', (event) => {
Liferay.Util.openSelectionModal({
onSelect: function (event) {
var form = document. fm;
Liferay.Util.setFormValues(form, {
rootTopicName: Liferay.Util.unescape(event.resourcename),
rootTopicId: event.resourceid,
});
var removeRootTopicButton = document.getElementById(
' removeRootTopicButton'
);
if (removeRootTopicButton) {
Liferay.Util.toggleDisabled(removeRootTopicButton, false);
}
},
selectEventName: ' selectCategory',
title: ' ',
<%
PortletURL selectMBCategoryURL = PortletURLBuilder.create(
PortletProviderUtil.getPortletURL(request, MBCategory.class.getName(), PortletProvider.Action.EDIT)
).setMVCRenderCommandName(
"/message_boards/select_category"
).setParameter(
"mbCategoryId", rootTopicId
).setWindowState(
LiferayWindowState.POP_UP
).buildPortletURL();
%>
url: '<%= selectMBCategoryURL.toString() %>',
});
});
}
<%!
private static final Log _log = LogFactoryUtil.getLog("com_liferay_questions_web.configuarion_jsp");
%>