<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
FragmentCollectionResourcesDisplayContext fragmentCollectionResourcesDisplayContext = new FragmentCollectionResourcesDisplayContext(request, renderRequest, renderResponse, fragmentDisplayContext);
%>

<c:choose>
	<c:when test="<%= fragmentCollectionResourcesDisplayContext.isShowRepositoryBrowser() %>">
		<liferay-document-library:repository-browser
			folderId="<%= fragmentCollectionResourcesDisplayContext.getFolderId() %>"
			repositoryId="<%= fragmentCollectionResourcesDisplayContext.getRepositoryId() %>"
		/>
	</c:when>
	<c:otherwise>
		<clay:management-toolbar
			managementToolbarDisplayContext="<%= new FragmentCollectionResourcesManagementToolbarDisplayContext(request, liferayPortletRequest, liferayPortletResponse, fragmentCollectionResourcesDisplayContext) %>"
			propsTransformer="js/FragmentCollectionResourcesManagementToolbarPropsTransformer"
		/>

		<portlet:actionURL name="/fragment/delete_fragment_collection_resources" var="deleteFragmentCollectionResourcesURL">
			<portlet:param name="redirect" value="<%= currentURL %>" />
		</portlet:actionURL>

		<portlet:actionURL name="/fragment/add_fragment_collection_resource" var="addFragmentCollectionResourceURL">
			<portlet:param name="redirect" value="<%= currentURL %>" />
		</portlet:actionURL>

		<aui:form action="<%= addFragmentCollectionResourceURL %>" name="fragmentCollectionResourceFm">
			<aui:input name="fragmentCollectionId" type="hidden" value="<%= String.valueOf(fragmentDisplayContext.getFragmentCollectionId()) %>" />
			<aui:input name="fileEntryId" type="hidden" />
		</aui:form>

		<aui:form name="fm">
			<liferay-ui:search-container
				searchContainer="<%= fragmentCollectionResourcesDisplayContext.getSearchContainer() %>"
			>
				<liferay-ui:search-container-row
					className="com.liferay.portal.kernel.repository.model.FileEntry"
					keyProperty="fileEntryId"
					modelVar="fileEntry"
				>
					<liferay-ui:search-container-column-text>
						<clay:vertical-card
							propsTransformer="js/FragmentCollectionResourceDropdownPropsTransformer"
							verticalCard="<%= new FragmentCollectionResourceVerticalCard(fileEntry, renderRequest, renderResponse, searchContainer.getRowChecker()) %>"
						/>
					</liferay-ui:search-container-column-text>
				</liferay-ui:search-container-row>

				<liferay-ui:search-iterator
					displayStyle="icon"
					markupView="lexicon"
				/>
			</liferay-ui:search-container>
		</aui:form>
	</c:otherwise>
</c:choose>