<%
	/**
	 * Created by The eXo Platform SAS
	 * Author : eXoPlatform
	 *          Le Thanh Hai from ECMS
	 * Mar 29, 2012  
	 */ 

import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.ExoContainerContext;
import java.util.Map;
import java.util.HashMap;
	
def portalRequestContext = Util.getPortalRequestContext();
def userName = portalRequestContext.getRemoteUser();

def loginURL = new StringBuilder().append('/').append(((PortalContainer)ExoContainerContext.getCurrentContainer()).getName()).append('/private/').append(portalRequestContext.getSiteName()).toString();
def enLangURL = new StringBuilder().append('/').append(((PortalContainer)ExoContainerContext.getCurrentContainer()).getName()).append('/en/').append(portalRequestContext.getSiteName()).toString();
def frLangURL = new StringBuilder().append('/').append(((PortalContainer)ExoContainerContext.getCurrentContainer()).getName()).append('/fr/').append(portalRequestContext.getSiteName()).toString();

%>

<div class="UIWCMLoginPortlet" id="UIWCMLoginPortlet">
  <%
    if (userName != null && userName.length() > 0) {
  %>
      <span class="Welcome"><%=_ctx.appRes("Signin.welcome") + ": "%></span><span class="LoggedUser">$userName</span> <a class="LogoutIcon" href="#" onclick="eXo.portal.logout();"><%=_ctx.appRes("Signin.logout")%></a> | <a class="LanguageFlag" href="$enLangURL"><img src="/ecm-template-waiportal/skin/resources/Flag_en.jpg" alt="<%=_ctx.appRes("Signin.language.en")%>"></img></a> <a class="LanguageFlag" href="$frLangURL"><img src="/ecm-template-waiportal/skin/resources/Flag_fr.jpg" alt="<%=_ctx.appRes("Signin.language.fr")%>"></img></a>
  <%
    } else {
  %>
      <a class="LoginIcon" href="$loginURL"><%=_ctx.appRes("Signin.login")%></a> | <a class="LanguageFlag" href="$enLangURL"><img src="/ecm-template-waiportal/skin/resources/Flag_en.jpg" alt="<%=_ctx.appRes("Signin.language.en")%>"></img></a> <a class="LanguageFlag" href="$frLangURL"><img src="/ecm-template-waiportal/skin/resources/Flag_fr.jpg" alt="<%=_ctx.appRes("Signin.language.fr")%>"></img></a>
  <%
    }
  %>

</div>
