<%--
/**
 * 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.
 *
 *
 *
 */
--%>

<c:if test="<%= BlogsEntryPermission.contains(permissionChecker, entry, ActionKeys.VIEW) %>">
	<div class="entry">

		<%
		PortletURL showErrorMessageURL = renderResponse.createRenderURL();

		showErrorMessageURL.setParameter("mvcRenderCommandName", "/blogs_aggregator/view");
		showErrorMessageURL.setParameter("blogsPortletFound", Boolean.FALSE.toString());

		StringBundler sb = new StringBundler(5);

		sb.append(themeDisplay.getPathMain());
		sb.append("/blogs/find_entry?p_l_id=");
		sb.append(themeDisplay.getPlid());
		sb.append("&noSuchEntryRedirect=");
		sb.append(URLCodec.encodeURL(showErrorMessageURL.toString()));
		sb.append("&entryId=");
		sb.append(entry.getEntryId());

		String viewEntryURL = sb.toString();
		%>

		<c:if test='<%= !displayStyle.endsWith("-without-title") %>'>
			<div class="entry-body">
				<c:choose>
					<c:when test='<%= displayStyle.endsWith("image") %>'>
						<liferay-ui:user-portrait
							userId="<%= entry.getUserId() %>"
						/>

						<div class="entry-info text-muted">
							<small>
								<strong><%= HtmlUtil.escape(entry.getUserName()) %></strong>

								<span> - </span>
								<span class="hide-accessible"><liferay-ui:message key="published-date" /></span>
								<%= dateFormatDate.format(entry.getDisplayDate()) %>
							</small>
						</div>
					</c:when>
					<c:otherwise>
						<div class="entry-info text-muted">
							<small>
								<strong><%= HtmlUtil.escape(entry.getUserName()) %></strong>

								<span> - </span>
								<span class="hide-accessible"><liferay-ui:message key="published-date" /></span>
								<%= dateFormatDate.format(entry.getDisplayDate()) %>
							</small>
						</div>
					</c:otherwise>
				</c:choose>

				<div class="entry-title">
					<h2>
						<aui:a href="<%= viewEntryURL %>">
							<%= HtmlUtil.escape(entry.getTitle()) %>
						</aui:a>
					</h2>
				</div>
			</div>
		</c:if>

		<c:if test='<%= !displayStyle.equals("title") %>'>
			<div class="entry-body">
				<c:choose>
					<c:when test='<%= displayStyle.startsWith("abstract") %>'>

						<%
						String smallImageURL = HtmlUtil.escape(entry.getSmallImageURL(themeDisplay));
						%>

						<c:if test="<%= Validator.isNotNull(smallImageURL) %>">
							<div class="asset-small-image">
								<img alt="" class="asset-small-image" src="<%= smallImageURL %>" width="150" />
							</div>
						</c:if>

						<%
						String summary = entry.getDescription();

						if (Validator.isNull(summary)) {
							summary = entry.getContent();
						}
						%>

						<p>
							<%= StringUtil.shorten(HtmlUtil.stripHtml(summary), 200) %>
						</p>
					</c:when>
					<c:when test='<%= displayStyle.startsWith("quote") %>'>
						<span class="quote">
							<a href="<%= viewEntryURL %>">
								&quot;<%= StringUtil.shorten(StringUtil.trim(HtmlUtil.stripHtml(entry.getContent())), 100, StringPool.BLANK) + StringPool.TRIPLE_PERIOD %> &quot;
							</a>
						</span>
					</c:when>
					<c:otherwise>
						<%= entry.getContent() %>
					</c:otherwise>
				</c:choose>
			</div>

			<%
			int commentsCount = BlogsUtil.getCommentsCount(entry);
			%>

			<div class="entry-footer">
				<div class="entry-social">
					<div class="comments">
						<a href="<%= viewEntryURL %>">
							<liferay-ui:icon
								icon="comments"
								markupView="lexicon"
							/>

							<span><%= String.valueOf(commentsCount) %></span>
						</a>
					</div>
				</div>
			</div>
		</c:if>

		<c:if test='<%= !displayStyle.endsWith("-without-title") %>'>
			<liferay-asset:asset-categories-available
				className="<%= BlogsEntry.class.getName() %>"
				classPK="<%= entry.getEntryId() %>"
			>
				<span class="entry-categories">
					<liferay-asset:asset-categories-summary
						className="<%= BlogsEntry.class.getName() %>"
						classPK="<%= entry.getEntryId() %>"
					/>
				</span>
			</liferay-asset:asset-categories-available>

			<c:if test="<%= showTags %>">
				<liferay-asset:asset-tags-available
					className="<%= BlogsEntry.class.getName() %>"
					classPK="<%= entry.getEntryId() %>"
				>
					<span class="entry-tags">
						<liferay-asset:asset-tags-summary
							className="<%= BlogsEntry.class.getName() %>"
							classPK="<%= entry.getEntryId() %>"
						/>
					</span>
				</liferay-asset:asset-tags-available>
			</c:if>
		</c:if>
	</div>

	<div class="separator"><!-- --></div>
</c:if>