
META-INF.resources.notifications.view.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="/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
String backURL = ParamUtil.getString(request, "backURL", redirect);
String navigation = ParamUtil.getString(request, "navigation", "all");
boolean actionRequired = ParamUtil.getBoolean(request, "actionRequired");
if (actionRequired) {
navigation = "unread";
}
SearchContainer notificationsSearchContainer = new SearchContainer(renderRequest, currentURLObj, null, actionRequired ? "you-do-not-have-any-requests" : "you-do-not-have-any-notifications");
String searchContainerId = "userNotificationEvents";
if (actionRequired) {
searchContainerId = "actionableUserNotificationEvents";
}
notificationsSearchContainer.setId(searchContainerId);
NotificationsManagementToolbarDisplayContext notificationsManagementToolbarDisplayContext = new NotificationsManagementToolbarDisplayContext(request, liferayPortletRequest, liferayPortletResponse, currentURLObj);
NotificationsUtil.populateResults(themeDisplay.getUserId(), actionRequired, navigation, notificationsManagementToolbarDisplayContext.getOrderByType(), notificationsSearchContainer);
if (Validator.isNotNull(backURL)) {
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(backURL);
}
%>
<%@ include file="/notifications/view-ext-pre.jsp" %>
<%
UserNotificationFeedEntry userNotificationFeedEntry = UserNotificationManagerUtil.interpret(StringPool.BLANK, userNotificationEvent, ServiceContextFactory.getInstance(request));
row.setData(
HashMapBuilder.put(
"actions", StringUtil.merge(notificationsManagementToolbarDisplayContext.getAvailableActions(userNotificationEvent, userNotificationFeedEntry))
).put(
"userNotificationFeedEntry", userNotificationFeedEntry
).build());
%>
<%@ include file="/notifications/user_notification_entry.jspf" %>
var form = A.one('# fm');
form.delegate(
'click',
(event) => {
event.preventDefault();
var currentTarget = event.currentTarget;
Liferay.Util.fetch(currentTarget.attr('href'), {
method: 'POST',
})
.then((response) => {
return response.json();
})
.then((response) => {
if (response.success) {
var notificationContainer =
currentTarget.ancestor('li.list-group-item');
if (notificationContainer) {
var markAsReadURL = notificationContainer
.one('a')
.attr('href');
form.attr('method', 'post');
submitForm(form, markAsReadURL);
notificationContainer.remove();
}
if (currentTarget.siblings()) {
currentTarget.siblings().remove();
}
currentTarget.remove();
}
else {
Liferay.Util.openToast({
message:
' ',
toastProps: {
autoClose: 5000,
},
type: 'warning',
});
}
});
},
'.user-notification-action'
);
<%@ include file="/notifications/view-ext-post.jsp" %>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy