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

<%
String entryClassName = entry.getClassName();
long entryClassPK = entry.getClassPK();

String scopeName = StringPool.BLANK;
String scopeClassName = StringPool.BLANK;

if (entryClassName.equals(Group.class.getName())) {
	Group group = GroupLocalServiceUtil.getGroup(entryClassPK);

	scopeName = group.getDescriptiveName(locale);

	scopeClassName = "site";
}
else if (entryClassName.equals(Organization.class.getName())) {
	Organization organization = OrganizationLocalServiceUtil.getOrganization(entryClassPK);

	scopeName = organization.getName();

	scopeClassName = "organization";
}
else if (entryClassName.equals(Role.class.getName())) {
	Role role = RoleLocalServiceUtil.getRole(entryClassPK);

	scopeName = role.getTitle(locale);

	scopeClassName = "role";
}
else if (entryClassName.equals(User.class.getName())) {
	User curUser = UserLocalServiceUtil.getUser(entryClassPK);

	scopeName = curUser.getFullName();

	scopeClassName = "personal";
}
else if (entryClassName.equals(UserGroup.class.getName())) {
	UserGroup userGroup = UserGroupLocalServiceUtil.getUserGroup(entryClassPK);

	scopeName = userGroup.getName();

	scopeClassName = "user-group";
}
else {
	scopeName = LanguageUtil.get(request, "general");

	scopeClassName = scopeName;
}

scopeName = HtmlUtil.escape(scopeName);
%>

<c:choose>
	<c:when test="<%= announcementsDisplayContext.isShowScopeName() %>">
		<c:choose>
			<c:when test="<%= scopeName.equals(scopeClassName) %>">
				<%= scopeName %>
			</c:when>
			<c:otherwise>
				<liferay-ui:message key="<%= scopeClassName %>" /> &raquo; <%= scopeName %>
			</c:otherwise>
		</c:choose>
	</c:when>
	<c:otherwise>
		<h5 class="text-default" title="<%= scopeName %>">
			<%= scopeName %>
		</h5>
	</c:otherwise>
</c:choose>