<%
/**
 * Copyright (c) 2000-2011 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.
 */
%>

<%
for (int j = 0; j < fileEntryColumns.length; j++) {
	String fileEntryColumn = fileEntryColumns[j];
%>

	<c:choose>
		<c:when test='<%= fileEntryColumn.equals("action") %>'>

			<%
			String align = SearchEntry.DEFAULT_ALIGN;

			if ((j + 1) == fileEntryColumns.length) {
				align = "right";
			}
			%>

			<liferay-ui:search-container-column-jsp
				align="<%= align %>"
				index="<%= j %>"
				path="/html/portlet/document_library/file_entry_action.jsp"
			/>

		</c:when>
		<c:when test='<%= fileEntryColumn.equals("downloads") %>'>
			<liferay-ui:search-container-column-text
				href="<%= rowHREF %>"
				index="<%= j %>"
				name="<%= fileEntryColumn %>"
				value="<%= String.valueOf(fileEntry.getReadCount()) %>"
			/>
		</c:when>
		<c:when test='<%= fileEntryColumn.equals("locked") %>'>

			<%
			boolean isLocked = LockLocalServiceUtil.isLocked(DLFileEntry.class.getName(), DLUtil.getLockId(fileEntry.getGroupId(), fileEntry.getFolderId(), HtmlUtil.unescape(fileEntry.getName())));
			%>

			<liferay-ui:search-container-column-text
				href="<%= rowHREF %>"
				index="<%= j %>"
				name="<%= fileEntryColumn %>"
				value='<%= LanguageUtil.get(pageContext, isLocked ? "yes" : "no") %>'
			/>
		</c:when>
		<c:when test='<%= fileEntryColumn.equals("name") %>'>
			<liferay-ui:search-container-column-text
				href="<%= rowHREF %>"
				index="<%= j %>"
				name="<%= fileEntryColumn %>"
			>
				<liferay-ui:icon
					image='<%= "../file_system/small/" + fileEntry.getIcon() %>'
					label="<%= true %>"
					message="<%= fileEntry.getTitle() %>"
				/>

				<c:if test="<%= fileEntry.getFileVersion().isPending() %>">
					<div class="workflow-status-pending">
						(<liferay-ui:message key="pending" />)
					</div>
				</c:if>

				<c:if test="<%= Validator.isNotNull(fileEntry.getDescription()) %>">
					<div class="file-entry-list-description">
						<%= fileEntry.getDescription() %>
					</div>
				</c:if>
			</liferay-ui:search-container-column-text>
		</c:when>
		<c:when test='<%= fileEntryColumn.equals("size") %>'>
			<liferay-ui:search-container-column-text
				href="<%= rowHREF %>"
				index="<%= j %>"
				name="<%= fileEntryColumn %>"
				value='<%= TextFormatter.formatKB(fileEntry.getSize(), locale) + "k" %>'
			/>
		</c:when>
		<c:when test='<%= fileEntryColumn.equals("tags") %>'>

			<%
			List<AssetTag> assetTags = AssetTagLocalServiceUtil.getTags(DLFileEntry.class.getName(), fileEntry.getFileEntryId());

			AssetUtil.addLayoutTags(request, assetTags);
			%>

			<liferay-ui:search-container-column-text
				href="<%= rowHREF %>"
				index="<%= j %>"
				name="<%= fileEntryColumn %>"
				value='<%= ListUtil.toString(assetTags, "name", StringPool.COMMA_AND_SPACE) %>'
			/>
		</c:when>
	</c:choose>

<%
}
%>