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 mergeWithParentFolderDisabled = ParamUtil.getBoolean(request, "mergeWithParentFolderDisabled");
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();
}
%>
$('# selectFolderButton').on(
'click',
function(event) {
event.preventDefault();
var itemSelectorDialog = new A.LiferayItemSelectorDialog(
{
eventName: ' selectFolder',
on: {
selectedItemChange: function(event) {
var selectedItem = event.newVal;
if (selectedItem) {
var folderData = {
idString: 'parentFolderId',
idValue: selectedItem.folderId,
nameString: 'parentFolderName',
nameValue: selectedItem.folderName
};
Liferay.Util.selectFolder(folderData, ' ');
}
}
},
'strings.add': ' ',
title: ' ',
url: '<%= selectFolderURL.toString() %>'
}
);
itemSelectorDialog.open();
}
);
<%
String taglibRemoveFolder = "Liferay.Util.removeEntitySelection('parentFolderId', 'parentFolderName', this, '" + renderResponse.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 = null;
try {
workflowDefinitionLink = WorkflowDefinitionLinkLocalServiceUtil.getWorkflowDefinitionLink(company.getCompanyId(), scopeGroupId, JournalFolder.class.getName(), folderId, ddmStructure.getStructureId(), true);
}
catch (NoSuchWorkflowDefinitionLinkException nswdle) {
}
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
boolean selected = false;
if ((workflowDefinitionLink != null) && workflowDefinitionLink.getWorkflowDefinitionName().equals(workflowDefinition.getName()) && (workflowDefinitionLink.getWorkflowDefinitionVersion() == workflowDefinition.getVersion())) {
selected = true;
}
%>
<%
}
%>
<%= removeDDMStructureIcon %>
" id=" restrictionTypeWorkflowDiv">
<%
WorkflowDefinitionLink workflowDefinitionLink = null;
try {
workflowDefinitionLink = WorkflowDefinitionLinkLocalServiceUtil.getWorkflowDefinitionLink(company.getCompanyId(), scopeGroupId, JournalFolder.class.getName(), folderId, JournalArticleConstants.DDM_STRUCTURE_ID_ALL, true);
}
catch (NoSuchWorkflowDefinitionLinkException nswdle) {
}
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
boolean selected = false;
if ((workflowDefinitionLink != null) && workflowDefinitionLink.getWorkflowDefinitionName().equals(workflowDefinition.getName()) && (workflowDefinitionLink.getWorkflowDefinitionVersion() == workflowDefinition.getVersion())) {
selected = true;
}
%>
<%
}
%>
<%
for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
%>
<%
}
%>
function openDDMStructureSelector() {
Liferay.Util.openDDMPortlet(
{
basePortletURL: '<%= PortletURLFactoryUtil.create(request, PortletProviderUtil.getPortletId(DDMStructure.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE) %>',
dialog: {
destroyOnHide: true
},
eventName: ' selectStructure',
groupId: <%= scopeGroupId %>,
mvcPath: '/select_structure.jsp',
navigationStartsOn: '<%= DDMNavigationHelper.SELECT_STRUCTURE %>',
refererPortletName: '<%= JournalPortletKeys.JOURNAL + ".selectStructureRestriction" %>',
showAncestorScopes: true,
title: '<%= UnicodeLanguageUtil.get(request, "structures") %>'
},
function(event) {
selectStructure(event.ddmstructureid, event.name);
}
);
}
Liferay.provide(
window,
' selectStructure',
function(ddmStructureId, ddmStructureName) {
var searchContainer = Liferay.SearchContainer.get(' ddmStructuresSearchContainer');
var ddmStructureLink = '<%= UnicodeFormatter.toString(removeDDMStructureIcon) %>';
var workflowDefinitions = '<%= UnicodeFormatter.toString(workflowDefinitionsBuffer) %>';
workflowDefinitions = workflowDefinitions.replace(/LIFERAY_WORKFLOW_DEFINITION_DDM_STRUCTURE/g, 'workflowDefinition' + ddmStructureId);
searchContainer.addRow([ddmStructureName, workflowDefinitions, ddmStructureLink], ddmStructureId);
searchContainer.addRow([ddmStructureName, ddmStructureLink], ddmStructureId);
searchContainer.updateDataStore();
},
['liferay-search-container']
);
Liferay.Util.toggleRadio(' restrictionTypeInherit', '', [' restrictionTypeDefinedDiv', ' restrictionTypeWorkflowDiv']);
Liferay.Util.toggleRadio(' restrictionTypeDefined', ' restrictionTypeDefinedDiv', ' restrictionTypeWorkflowDiv');
Liferay.Util.toggleRadio(' restrictionTypeWorkflow', ' restrictionTypeWorkflowDiv', ' restrictionTypeDefinedDiv');
var searchContainer = Liferay.SearchContainer.get(' ddmStructuresSearchContainer');
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'
);
<%
if (folder != null) {
JournalPortletUtil.addPortletBreadcrumbEntries(folderId, request, journalDisplayContext.getPortletURL());
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "edit"), currentURL);
}
else {
if (parentFolderId > 0) {
JournalPortletUtil.addPortletBreadcrumbEntries(parentFolderId, request, journalDisplayContext.getPortletURL());
}
PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "add-folder"), currentURL);
}
%>