<%
/**
 * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
%>

<%
boolean readEntry = false;

try {
	AnnouncementsFlagLocalServiceUtil.getFlag(user.getUserId(), entry.getEntryId(), AnnouncementsFlagImpl.READ);

	readEntry = true;
}
catch (NoSuchFlagException nsfe) {
	AnnouncementsFlagLocalServiceUtil.addFlag(user.getUserId(), entry.getEntryId(), AnnouncementsFlagImpl.READ);
}

if (readEntry) {
	className += " read";
}

if (entry.getPriority() > 0) {
	className += " important";
}
%>

<div class="entry<%= className %>" id="<portlet:namespace/><%= entry.getEntryId() %>">
	<h3 class="entry-title">
		<c:choose>
			<c:when test="<%= Validator.isNotNull(entry.getUrl()) %>">
				<a class="entry-url" href="<%= entry.getUrl() %>"><%= entry.getTitle() %></a>
			</c:when>
			<c:when test="<%= Validator.isNull(entry.getUrl()) %>">
				<%= entry.getTitle() %>
			</c:when>
		</c:choose>

		<c:if test='<%= !tabs1.equals("preview") %>'>
			<%@ include file="/html/portlet/announcements/entry_action.jspf" %>
		</c:if>
	</h3>

	<%
	boolean showScopeName = false;
	%>

	<p class="entry-content entry-type-<%= entry.getType() %>">
		<%@ include file="/html/portlet/announcements/entry_scope.jspf" %>

		<%= entry.getContent() %>
	</p>
</div>