META-INF.resources.wiki.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/init.jsp" %>
<%
Set currentVisibleNodes = new HashSet(wikiPortletInstanceSettingsHelper.getAllNodeNames());
// Left list
List leftList = new ArrayList();
String[] visibleNodeNames = wikiPortletInstanceSettingsHelper.getVisibleNodeNames();
for (String folderColumn : visibleNodeNames) {
if (currentVisibleNodes.contains(folderColumn)) {
leftList.add(new KeyValuePair(folderColumn, HtmlUtil.escape(LanguageUtil.get(request, folderColumn))));
}
}
Arrays.sort(visibleNodeNames);
String[] hiddenNodes = wikiPortletInstanceSettingsHelper.getHiddenNodes();
Arrays.sort(hiddenNodes);
for (String folderColumn : currentVisibleNodes) {
if ((Arrays.binarySearch(hiddenNodes, folderColumn) < 0) && (Arrays.binarySearch(visibleNodeNames, folderColumn) < 0)) {
leftList.add(new KeyValuePair(folderColumn, HtmlUtil.escape(LanguageUtil.get(request, folderColumn))));
}
}
// Right list
List rightList = new ArrayList();
for (String folderColumn : hiddenNodes) {
if (currentVisibleNodes.contains(folderColumn) && (Arrays.binarySearch(visibleNodeNames, folderColumn) < 0)) {
rightList.add(new KeyValuePair(folderColumn, HtmlUtil.escape(LanguageUtil.get(request, folderColumn))));
}
}
rightList = ListUtil.sort(rightList, new KeyValuePairComparator(false, true));
%>
function saveConfiguration() {
var form = document. fm;
var availableVisibleNodes = Liferay.Util.getFormElement(
form,
'availableVisibleNodes'
);
var currentVisibleNodes = Liferay.Util.getFormElement(
form,
'currentVisibleNodes'
);
if (availableVisibleNodes && currentVisibleNodes) {
Liferay.Util.postForm(form, {
data: {
hiddenNodes: Liferay.Util.getSelectedOptionValues(
availableVisibleNodes
),
visibleNodes:
Liferay.Util.getSelectedOptionValues(currentVisibleNodes),
},
});
}
}