META-INF.resources.wiki_display.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="/wiki_display/init.jsp" %>
<%
nodeId = ParamUtil.getLong(request, "nodeId", nodeId);
List nodes = WikiNodeServiceUtil.getNodes(scopeGroupId);
boolean nodeInGroup = false;
%>
<%
for (WikiNode node : nodes) {
int pagesCount = WikiPageLocalServiceUtil.getPagesCount(node.getNodeId(), true);
if (pagesCount == 0) {
continue;
}
node = node.toEscapedModel();
if (nodeId == node.getNodeId()) {
nodeInGroup = true;
}
%>
<%
}
%>
<%
int total = WikiPageLocalServiceUtil.getPagesCount(nodeId, true);
List pages = WikiPageLocalServiceUtil.getPages(nodeId, true, 0, total);
for (int i = 0; i < pages.size(); i++) {
WikiPage wikiPage = pages.get(i);
%>
<%
}
%>
var nodeIdSelect = document.getElementById(' nodeId');
var pageSelectorContainer = document.getElementById(
' pageSelectorContainer'
);
if (nodeIdSelect) {
var nodeId = nodeIdSelect.value;
nodeIdSelect.addEventListener('change', () => {
if (pageSelectorContainer) {
if (nodeIdSelect.value === nodeId) {
pageSelectorContainer.classList.remove('hide');
}
else {
pageSelectorContainer.classList.add('hide');
}
}
if (nodeIdSelect.value && nodeIdSelect.value !== nodeId) {
var renderURL = Liferay.Util.PortletURL.createRenderURL(
'<%= configurationRenderURL %>',
{
nodeId: nodeIdSelect.value,
}
);
document. fm.action = renderURL;
document. fm.submit();
}
});
}