social-dockbar-hook/src/main/webapp/custom_jsps/html/portlet/dockbar/view_user_account.portal.jspf

176 lines
6.9 KiB
Plaintext

<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
/**
* Modified for custom myProfile URL
*/
--%>
<%@page import="org.gcube.common.portal.GCubePortalConstants"%>
<liferay-util:buffer var="userName">
<c:if test="<%= themeDisplay.isImpersonated() %>">
<b class="alert-icon icon-warning-sign"></b>
</c:if>
<img alt="<liferay-ui:message key="my-account" />" class="user-avatar-image" src="<%= HtmlUtil.escape(user.getPortraitURL(themeDisplay)) %>" />
<span class="user-full-name">
<%= HtmlUtil.escape(user.getFullName()) %>
</span>
</liferay-util:buffer>
<c:choose>
<c:when test="<%= themeDisplay.isSignedIn() %>">
<aui:nav-item anchorCssClass="user-avatar-link" cssClass='<%= themeDisplay.isImpersonated() ? "user-avatar impersonating-user" : "user-avatar" %>' dropdown="<%= true %>" id="userAvatar" label="<%= userName %>">
<c:if test="<%= themeDisplay.isImpersonated() %>">
<%
String impersonatingUserLabel = "you-are-impersonating-the-guest-user";
if (themeDisplay.isSignedIn()) {
impersonatingUserLabel = LanguageUtil.format(pageContext, "you-are-impersonating-x", new Object[] {HtmlUtil.escape(user.getFullName())});
}
%>
<div class="alert alert-info"><%= impersonatingUserLabel %></div>
<liferay-util:buffer var="leaveImpersonationLabel">
<liferay-ui:message key="be-yourself-again" /> (<%= HtmlUtil.escape(realUser.getFullName()) %>)
</liferay-util:buffer>
<aui:nav-item href="<%= PortalUtil.getLayoutURL(layout, themeDisplay, false) %>" label="<%= leaveImpersonationLabel %>" />
<%
Locale realUserLocale = realUser.getLocale();
Locale userLocale = user.getLocale();
%>
<c:if test="<%= !realUserLocale.equals(userLocale) %>">
<%
String doAsUserLanguageId = null;
String changeLanguageMessage = null;
if (locale.getLanguage().equals(realUserLocale.getLanguage()) && locale.getCountry().equals(realUserLocale.getCountry())) {
doAsUserLanguageId = userLocale.getLanguage() + "_" + userLocale.getCountry();
changeLanguageMessage = LanguageUtil.format(realUserLocale, "use-x's-preferred-language-(x)", new String[] {HtmlUtil.escape(user.getFullName()), userLocale.getDisplayLanguage(realUserLocale)});
}
else {
doAsUserLanguageId = realUserLocale.getLanguage() + "_" + realUserLocale.getCountry();
changeLanguageMessage = LanguageUtil.format(realUserLocale, "use-your-preferred-language-(x)", realUserLocale.getDisplayLanguage(realUserLocale));
}
%>
<aui:nav-item cssClass="current-user-language" href='<%= HttpUtil.setParameter(PortalUtil.getCurrentURL(request), "doAsUserLanguageId", doAsUserLanguageId) %>' label="<%= changeLanguageMessage %>" />
</c:if>
</c:if>
<c:if test="<%= userSetupComplete && Validator.isNotNull(themeDisplay.getURLMyAccount()) %>">
<%
List<Group> mySiteGroups = user.getMySiteGroups(new String[] {User.class.getName()}, false, QueryUtil.ALL_POS);
for (Group mySiteGroup : mySiteGroups) {
%>
<c:if test="<%= mySiteGroup.getPublicLayoutsPageCount() > 0 %>">
<%
PortletURL myProfileURL = new PortletURLImpl(request, PortletKeys.SITE_REDIRECTOR, plid, PortletRequest.ACTION_PHASE);
myProfileURL.setParameter("struts_action", "/my_sites/view");
myProfileURL.setParameter("groupId", String.valueOf(mySiteGroup.getGroupId()));
myProfileURL.setParameter("privateLayout", Boolean.FALSE.toString());
myProfileURL.setPortletMode(PortletMode.VIEW);
myProfileURL.setWindowState(WindowState.NORMAL);
%>
<li class="my-sites-menu public-site">
<a href="<%= myProfileURL.toString() %>" role="menuitem">
<span class="site-name"><liferay-ui:message key="my-profile" /></span>
<span class="badge site-type"><liferay-ui:message key="public" /></span>
</a>
</li>
</c:if>
<c:if test="<%= mySiteGroup.getPrivateLayoutsPageCount() > 0 %>">
<%
PortletURL myDashboardURL = new PortletURLImpl(request, PortletKeys.SITE_REDIRECTOR, plid, PortletRequest.ACTION_PHASE);
myDashboardURL.setParameter("struts_action", "/my_sites/view");
myDashboardURL.setParameter("groupId", String.valueOf(mySiteGroup.getGroupId()));
myDashboardURL.setParameter("privateLayout", Boolean.TRUE.toString());
myDashboardURL.setPortletMode(PortletMode.VIEW);
myDashboardURL.setWindowState(WindowState.NORMAL);
%>
<li class="my-sites-menu private-site">
<a href="<%= myDashboardURL %>" role="menuitem">
<span class="site-name"><liferay-ui:message key="my-dashboard" /></span>
<span class="badge site-type"><liferay-ui:message key="private" /></span>
</a>
</li>
</c:if>
<%
}
%>
<%//Patch for myProfile URL s
PortalContext context = PortalContext.getConfiguration();
String mySiteURL = context.getSiteLandingPagePath(request);
String myProfileURL = mySiteURL + GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
%>
<li class="my-sites-menu private-site">
<a href="<%= myProfileURL %>" role="menuitem">
<span class="site-name"><liferay-ui:message key="my-profile" /></span>
<span class="badge site-type"><liferay-ui:message key="private" /></span>
</a>
</li>
<%//End Patch for myProfile URL
//start patch for myAccount URL
//String myAccountURL = themeDisplay.getURLMyAccount().toString();
//myAccountURL = HttpUtil.setParameter(myAccountURL, "controlPanelCategory", PortletCategoryKeys.MY);
String myAccountURL = PrefsPropsUtil.getString(themeDisplay.getCompany().getCompanyId(), "d4science.oidc-user_account_url");
%>
<!-- <liferay-portlet:actionURL portletName="keycloaklogout_WAR_PortletTestingAPI100SNAPSHOT" var="kcCallURL" /> -->
<aui:nav-item href="/c/portal/logout?edit-account=true" iconCssClass="icon-user" label="my-account" title="my-account" />
</c:if>
<c:if test="<%= themeDisplay.isShowSignOutIcon() %>">
<aui:nav-item cssClass="sign-out" href="<%= themeDisplay.getURLSignOut() %>" iconCssClass="icon-off" label="sign-out" />
</c:if>
</aui:nav-item>
</c:when>
<c:otherwise>
<%
Map<String, String> anchorData = new HashMap<String, String>();
anchorData.put("redirect", String.valueOf(PortalUtil.isLoginRedirectRequired(request)));
%>
<aui:nav-item anchorData="<%= anchorData %>" cssClass="sign-in" href="<%= themeDisplay.getURLSignIn() %>" iconCssClass="icon-user" label="sign-in" />
</c:otherwise>
</c:choose>