<%@ tag body-content="empty" pageEncoding="UTF-8" description="Link for opening of user"%>
<%@ include file="/WEB-INF/jspf/taglibs.jsp"%>

<%@ attribute name="id" description="User ID" required="true" type="java.lang.Integer"%>
<%@ attribute name="text" description="Text instead of user title"%>

<ui:when type="user">
	<c:choose>
		<c:when test="${id gt 0 and ctxUser.checkPerm('/user/profile:null')}"><%--
			--%><a href="/user/profile#${id}" onclick="$$.shell.followLink(this.href, event)" title="ID: ${id}">${not empty text ? text : ctxUserMap[id].title}</a><%--
	--%></c:when>
		<c:otherwise>${ctxUserMap[id].title}</c:otherwise>
	</c:choose>
</ui:when>
<ui:when type="open">
	<c:set var="config" value="${ctxSetup.getConfig('org.bgerp.action.open.ProfileAction$Config')}"/>
	<c:choose>
		<c:when test="${config.isOpen(id)}"><%--
		--%><a href="/open/profile/${id}">${ctxUserMap[id].title}</a><%--
	--%></c:when>
		<c:otherwise>User ${u.getDigest(ctxUserMap[id].title).substring(20)}</c:otherwise>
	</c:choose>
</ui:when>
