META-INF.resources.toolbar.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 searchContainerId = ParamUtil.getString(request, "searchContainerId");
%>
var deleteEntries = function() {
if (<%= trashHelper.isTrashEnabled(scopeGroupId) %> || confirm(' <%= UnicodeLanguageUtil.get(request, "are-you-sure-you-want-to-delete-the-selected-entries") %>')) {
Liferay.fire(
'<%= renderResponse.getNamespace() %>editEntry',
{
action: '<%= trashHelper.isTrashEnabled(scopeGroupId) ? "moveEntriesToTrash" : "deleteEntries" %>'
}
);
}
}
var expireEntries = function() {
Liferay.fire(
' editEntry',
{
action: 'expireEntries'
}
);
};
var moveEntries = function() {
Liferay.fire(
' editEntry',
{
action: 'moveEntries'
}
);
};
var openStructuresSelector = function() {
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
modal: true
},
eventName: ' selectStructure',
title: '<%= UnicodeLanguageUtil.get(request, "structures") %>',
uri: ' '
},
function(event) {
var uri = '<%= viewDDMStructureArticlesURL %>';
uri = Liferay.Util.addParams(' ddmStructureKey=' + event.ddmstructurekey, uri);
location.href = uri;
}
);
}
var openViewMoreStructuresSelector = function() {
Liferay.Util.openWindow(
{
dialog: {
destroyOnHide: true,
modal: true
},
id: ' selectAddMenuItem',
title: ' ',
uri: '<%= viewMoreURL %>'
}
);
}
var ACTIONS = {
'deleteEntries': deleteEntries,
'expireEntries': expireEntries,
'moveEntries': moveEntries,
'openStructuresSelector': openStructuresSelector,
'openViewMoreStructuresSelector': openViewMoreStructuresSelector
};
Liferay.componentReady('journalWebManagementToolbar').then(
function(managementToolbar) {
managementToolbar.on(
['actionItemClicked', 'filterItemClicked'],
function(event) {
var itemData = event.data.item.data;
if (itemData && itemData.action && ACTIONS[itemData.action]) {
ACTIONS[itemData.action]();
}
}
);
managementToolbar.on('creationMenuMoreButtonClicked', openViewMoreStructuresSelector);
}
);