All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.object_entries.object_entry.relationship.jsp Maven / Gradle / Ivy

The newest version!
<%--
/**
 * 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" %>

<%
ObjectEntryDisplayContext objectEntryDisplayContext = (ObjectEntryDisplayContext)request.getAttribute(WebKeys.PORTLET_DISPLAY_CONTEXT);

ObjectDefinition objectDefinition2 = objectEntryDisplayContext.getObjectDefinition2();
ObjectEntry objectEntry = objectEntryDisplayContext.getObjectEntry();
ObjectRelationship objectRelationship = objectEntryDisplayContext.getObjectRelationship();

portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(objectEntryDisplayContext.getBackURL());
%>




	
	
	
	
	

	
		
			
		
		
			
		
	



	
		Liferay.Util.openToast({
			autoClose: 5000,
			message:
				'',
			title: ':',
			type: 'danger',
		});
	



	
		const eventHandlers = [];

		const selectRelatedModelHandler = Liferay.on(
			'selectRelatedModel',
			() => {
				Liferay.Util.openSelectionModal({
					multiple: false,
					onSelect: (selectedItem) => {
						const objectEntry = JSON.parse(selectedItem.value);

						const objectRelationshipPrimaryKey2Input =
							document.getElementById(
								'objectRelationshipPrimaryKey2'
							);

						objectRelationshipPrimaryKey2Input.value = objectEntry.classPK;

						const form = document.getElementById('fm');

						if (form) {
							submitForm(form);
						}
					},
					selectEventName: 'selectRelatedModalEntry',
					title: '',
					url: '<%= objectEntryDisplayContext.getRelatedObjectEntryItemSelectorURL(objectRelationship) %>',
				});
			}
		);

		eventHandlers.push(selectRelatedModelHandler);

		Liferay.on('destroyPortlet', () => {
			eventHandlers.forEach((eventHandler) => {
				eventHandler.detach();
			});
		});
	




© 2015 - 2025 Weber Informatics LLC | Privacy Policy