META-INF.resources.edit_folder.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="/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
JournalFolder folder = journalDisplayContext.getFolder();
long folderId = BeanParamUtil.getLong(folder, request, "folderId");
long parentFolderId = BeanParamUtil.getLong(folder, request, "parentFolderId", JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID);
boolean rootFolder = ParamUtil.getBoolean(request, "rootFolder");
boolean workflowEnabled = WorkflowEngineManagerUtil.isDeployed() && (WorkflowHandlerRegistryUtil.getWorkflowHandler(JournalArticle.class.getName()) != null);
List workflowDefinitions = null;
if (workflowEnabled) {
workflowDefinitions = WorkflowDefinitionManagerUtil.getActiveWorkflowDefinitions(company.getCompanyId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
String languageId = LocaleUtil.toLanguageId(locale);
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(redirect);
String title = StringPool.BLANK;
if (rootFolder) {
title = LanguageUtil.get(request, "home");
}
else {
if (folder == null) {
title = LanguageUtil.get(request, "new-folder");
}
else {
title = folder.getName();
}
}
renderResponse.setTitle(title);
%>
<%
String parentFolderName = LanguageUtil.get(request, "home");
JournalFolder parentFolder = JournalFolderServiceUtil.fetchFolder(parentFolderId);
if (parentFolder != null) {
parentFolderName = parentFolder.getName();
}
%>
var selectFolderButton = document.getElementById(
' selectFolderButton'
);
selectFolderButton.addEventListener('click', function (event) {
Liferay.Util.openSelectionModal({
onSelect: function (selectedItem) {
if (selectedItem) {
var folderData = {
idString: 'parentFolderId',
idValue: selectedItem.folderId,
nameString: 'parentFolderName',
nameValue: selectedItem.folderName,
};
Liferay.Util.selectFolder(folderData, ' ');
}
},
selectEventName: ' selectFolder',
title: ' ',
url: '<%= selectFolderURL.toString() %>',
});
});
<%
String taglibRemoveFolder = "Liferay.Util.removeEntitySelection('parentFolderId', 'parentFolderName', this, '" + liferayPortletResponse.getNamespace() + "');";
%>
<%
List ddmStructures = journalDisplayContext.getDDMStructures(JournalFolderConstants.RESTRICTION_TYPE_DDM_STRUCTURES_AND_WORKFLOW);
String headerNames = null;
if (workflowEnabled) {
headerNames = "name,workflow,null";
}
else {
headerNames = "name,null";
}
%>
<%
JournalFolder parentFolder = JournalFolderLocalServiceUtil.fetchFolder(folder.getParentFolderId());
String parentFolderName = LanguageUtil.get(request, "home");
if (parentFolder != null) {
parentFolderName = parentFolder.getName();
}
%>
" id=" restrictionTypeDefinedDiv">
<%
WorkflowDefinitionLink workflowDefinitionLink = WorkflowDefinitionLinkLocalServiceUtil.fetchWorkflowDefinitionLink(company.getCompanyId(), scopeGroupId, JournalFolder.class.getName(), folderId, ddmStructure.getStructureId(), true);
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
boolean selected = false;
if ((workflowDefinitionLink != null) && Objects.equals(workflowDefinitionLink.getWorkflowDefinitionName(), workflowDefinition.getName()) && (workflowDefinitionLink.getWorkflowDefinitionVersion() == workflowDefinition.getVersion())) {
selected = true;
}
%>
<%
}
%>
<%= removeDDMStructureIcon %>
" id=" restrictionTypeWorkflowDiv">
<%
WorkflowDefinitionLink workflowDefinitionLink = WorkflowDefinitionLinkLocalServiceUtil.fetchWorkflowDefinitionLink(company.getCompanyId(), scopeGroupId, JournalFolder.class.getName(), folderId, JournalArticleConstants.DDM_STRUCTURE_ID_ALL, true);
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
boolean selected = false;
if ((workflowDefinitionLink != null) && Objects.equals(workflowDefinitionLink.getWorkflowDefinitionName(), workflowDefinition.getName()) && (workflowDefinitionLink.getWorkflowDefinitionVersion() == workflowDefinition.getVersion())) {
selected = true;
}
%>
<%
}
%>
<%
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
%>
<%
}
%>
var searchContainer = Liferay.SearchContainer.get(
' ddmStructuresSearchContainer'
);
var selectDDMStructureButton = document.getElementById(
' selectDDMStructure'
);
if (selectDDMStructureButton) {
selectDDMStructureButton.addEventListener('click', function (event) {
Liferay.Util.openSelectionModal({
onSelect: function (selectedItem) {
var ddmStructureLink =
'<%= UnicodeFormatter.toString(removeDDMStructureIcon) %>';
var workflowDefinitions =
'<%= UnicodeFormatter.toString(workflowDefinitionsBuffer) %>';
workflowDefinitions = workflowDefinitions.replace(
/LIFERAY_WORKFLOW_DEFINITION_DDM_STRUCTURE/g,
'workflowDefinition' + selectedItem.ddmstructureid
);
searchContainer.addRow(
[selectedItem.name, workflowDefinitions, ddmStructureLink],
selectedItem.ddmstructureid
);
searchContainer.addRow(
[selectedItem.name, ddmStructureLink],
selectedItem.ddmstructureid
);
searchContainer.updateDataStore();
},
selectEventName: ' selectDDMStructure',
title: '<%= UnicodeLanguageUtil.get(request, "structures") %>',
url:
' ',
});
});
}
searchContainer.get('contentBox').delegate(
'click',
function (event) {
var link = event.currentTarget;
var tr = link.ancestor('tr');
searchContainer.deleteRow(tr, link.attr('data-rowId'));
},
'.modify-link'
);
Liferay.Util.toggleRadio(' restrictionTypeInherit', '', [
' restrictionTypeDefinedDiv',
' restrictionTypeWorkflowDiv',
]);
Liferay.Util.toggleRadio(
' restrictionTypeDefined',
' restrictionTypeDefinedDiv',
' restrictionTypeWorkflowDiv'
);
Liferay.Util.toggleRadio(
' restrictionTypeWorkflow',
' restrictionTypeWorkflowDiv',
' restrictionTypeDefinedDiv'
);