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

META-INF.resources.item.selector.select_articles.jsp Maven / Gradle / Ivy

There is a newer version: 5.0.181
Show 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="/item/selector/init.jsp" %>

<%
JournalArticleItemSelectorViewDisplayContext journalArticleItemSelectorViewDisplayContext = (JournalArticleItemSelectorViewDisplayContext)request.getAttribute(JournalWebConstants.JOURNAL_ARTICLE_ITEM_SELECTOR_VIEW_DISPLAY_CONTEXT);
%>




	
		
	

	
		

			<%
			JournalArticle curArticle = null;
			JournalFolder curFolder = null;

			Object result = row.getObject();

			if (result instanceof JournalFolder) {
				curFolder = (JournalFolder)result;
			}
			else {
				curArticle = journalArticleItemSelectorViewDisplayContext.getLatestArticle((JournalArticle)result);
			}
			%>

			
				

					<%
					row.setCssClass("articles " + row.getCssClass());
					row.setCssClass("selector-button " + row.getCssClass());

					row.setData(
						HashMapBuilder.put(
							"value", journalArticleItemSelectorViewDisplayContext.getPayload(curArticle)
						).build());
					row.setPrimaryKey(curArticle.getArticleId());
					%>

					
						

							<%
							row.setCssClass("item-preview " + row.getCssClass());
							%>

							
								
							

							

								<%
								Date createDate = curArticle.getModifiedDate();

								String modifiedDateDescription = LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - createDate.getTime(), true);
								%>

								
									
								

								

<%= HtmlUtil.escape(curArticle.getTitle(locale, true)) %>

: <%= journalArticleItemSelectorViewDisplayContext.getGroupLabel(curArticle.getGroupId(), locale) %>
<% row.setCssClass("card-page-item card-page-item-directory entry " + row.getCssClass()); %> <% row.setCssClass("item-preview " + row.getCssClass()); %> <%= HtmlUtil.escape(curArticle.getTitle(locale, true)) %> <%= journalArticleItemSelectorViewDisplayContext.getGroupLabel(curArticle.getGroupId(), locale) %> <% DDMStructure ddmStructure = curArticle.getDDMStructure(); %>
<% PortletURL rowURL = PortletURLBuilder.create( journalArticleItemSelectorViewDisplayContext.getPortletURL() ).setParameter( "folderId", curFolder.getFolderId() ).setParameter( "groupId", curFolder.getGroupId() ).buildPortletURL(); %> <% Date createDate = curFolder.getCreateDate(); String createDateDescription = LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - createDate.getTime(), true); %>

<%= HtmlUtil.escape(curFolder.getName()) %>

: <%= journalArticleItemSelectorViewDisplayContext.getGroupLabel(curFolder.getGroupId(), locale) %>
<% row.setCssClass("card-page-item card-page-item-directory " + row.getCssClass()); %>
<%= HtmlUtil.escape(curFolder.getName()) %> <%= journalArticleItemSelectorViewDisplayContext.getGroupLabel(curFolder.getGroupId(), locale) %>
<%= journalArticleItemSelectorViewDisplayContext.getGroupLabel(curFolder.getGroupId(), locale) %>
var searchContainer = Liferay.SearchContainer.get( 'articles' ); searchContainer.on('rowToggled', (event) => { var searchContainerItems = event.elements.allSelectedElements; var arr = []; searchContainerItems.each(function () { var domElement = this.ancestor('li'); if (domElement == null) { domElement = this.ancestor('tr'); } if (domElement == null) { domElement = this.ancestor('dd'); } if (domElement != null) { var itemValue = domElement.getDOM().dataset.value; arr.push(itemValue); } }); Liferay.Util.getOpener().Liferay.fire( '<%= journalArticleItemSelectorViewDisplayContext.getItemSelectedEventName() %>', { data: { returnType: '<%= journalArticleItemSelectorViewDisplayContext.getReturnType() %>', value: arr, }, } ); }); var selectItemHandler = Liferay.Util.delegate( document.querySelector('#articlesContainer'), 'click', '.entry', (event) => { var activeCards = document.querySelectorAll('.form-check-card.active'); if (activeCards.length) { activeCards.forEach((card) => { card.classList.remove('active'); }); } var target = event.delegateTarget; var newSelectedCard = target.closest('.form-check-card'); if (newSelectedCard) { newSelectedCard.classList.add('active'); } var domElement = target.closest('li'); if (domElement == null) { domElement = target.closest('tr'); } if (domElement == null) { domElement = target.closest('dd'); } var itemValue = ''; if (domElement != null) { itemValue = domElement.dataset.value; } Liferay.Util.getOpener().Liferay.fire( '<%= journalArticleItemSelectorViewDisplayContext.getItemSelectedEventName() %>', { data: { returnType: '<%= journalArticleItemSelectorViewDisplayContext.getReturnType() %>', value: itemValue, }, } ); } ); Liferay.on('destroyPortlet', function removeListener() { selectItemHandler.dispose(); Liferay.detach('destroyPortlet', removeListener); });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy