<%--
/**
 * 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="/admin/init.jsp" %>

<%
KBArticle kbArticle = (KBArticle)request.getAttribute("info_panel.jsp-kbArticle");
%>

<c:if test="<%= (kbArticle.isApproved() || !kbArticle.isFirstVersion()) && KBArticlePermission.contains(permissionChecker, kbArticle, KBActionKeys.SUBSCRIBE) %>">
	<c:choose>
		<c:when test="<%= SubscriptionLocalServiceUtil.isSubscribed(user.getCompanyId(), user.getUserId(), KBArticle.class.getName(), kbArticle.getResourcePrimKey()) %>">
			<liferay-portlet:actionURL name="unsubscribeKBArticle" var="unsubscribeKBArticleURL">
				<portlet:param name="redirect" value="<%= currentURL %>" />
				<portlet:param name="resourcePrimKey" value="<%= String.valueOf(kbArticle.getResourcePrimKey()) %>" />
			</liferay-portlet:actionURL>

			<liferay-ui:icon
				icon="star"
				linkCssClass="icon-monospaced"
				markupView="lexicon"
				message="unsubscribe"
				url="<%= unsubscribeKBArticleURL %>"
			/>
		</c:when>
		<c:otherwise>
			<liferay-portlet:actionURL name="subscribeKBArticle" var="subscribeKBArticleURL">
				<portlet:param name="redirect" value="<%= currentURL %>" />
				<portlet:param name="resourcePrimKey" value="<%= String.valueOf(kbArticle.getResourcePrimKey()) %>" />
			</liferay-portlet:actionURL>

			<liferay-ui:icon
				icon="star-o"
				linkCssClass="icon-monospaced"
				markupView="lexicon"
				message="subscribe"
				url="<%= subscribeKBArticleURL %>"
			/>
		</c:otherwise>
	</c:choose>
</c:if>