<%	
	import org.exoplatform.wcm.webui.toolbar.UIAdminToolbarPortlet;
	import org.exoplatform.web.application.JavascriptManager;
	import org.exoplatform.portal.mop.user.UserNavigation;
	import org.exoplatform.services.organization.User;
	import org.exoplatform.services.security.ConversationState;
	import org.exoplatform.web.CacheUserProfileFilter;
		
	def rcontext = _ctx.getRequestContext();
	
	JavascriptManager jsmanager = rcontext.getJavascriptManager();
	jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
	jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
	jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' + uicomponent.id + '");');
	
	String addPageLabel = _ctx.appRes("UIAdminToolbarPortlet.action.AddPage");	
	String editPageLabel = _ctx.appRes("UIAdminToolbarPortlet.action.EditPage");
	String editPortalLabel = _ctx.appRes("UIAdminToolbarPortlet.action.EditPortal");
	String editPageAndNaviLabel = _ctx.appRes("UIAdminToolbarPortlet.action.EditPageAndNavigation");
	String editSiteLayout = _ctx.appRes("UIAdminToolbarPortlet.action.EditSiteLayout");
	String editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action.Editor");
	
	boolean userCouldEditNavigation = uicomponent.hasEditPermissionOnNavigation();
	boolean userCouldEditPage = uicomponent.hasEditPermissionOnPage();
	boolean userCouldEditPortal = uicomponent.hasEditPermissionOnPortal();
	
	UserNavigation selectedNav = uicomponent.getSelectedNavigation();
	if (selectedNav != null) {
		editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action." + selectedNav.getKey().getTypeName() + ".Editor");
	}
	String accountSetting = "javascript:if(document.getElementById('UIMaskWorkspace')) ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'AccountSettings', true));"
%>
<ul class="UIAdminToolbarPortlet UIHorizontalTabs" id="$uicomponent.id" >
	<li class="UITab NormalToolbarTab">
		<a class="EditorIcon TBIcon" href="#">$editorLabel</a>
		<ul class="MenuItemContainer" style="display:none;">
			<% if(userCouldEditNavigation){ %>
				<li class="MenuItem">	
					<a href="javascript:ajaxGet(eXo.env.server.createPortalURL('UIWorkingWorkspace', 'PageCreationWizard', true))" title="" class="ItemIcon AddPageIcon">$addPageLabel</a>
				</li>
			<% } %>
			
			<% if(userCouldEditPage){ %>
				<li class="MenuItem">
					<a href="javascript:ajaxGet(eXo.env.server.createPortalURL('UIWorkingWorkspace', 'EditCurrentPage', true))" title="" class="ItemIcon EditPageIcon">$editPageLabel</a>
				</li>
			<% } %>
			
			<% if(userCouldEditPortal){ %>
				<li class="MenuItem">	
					<a href="javascript:ajaxGet(eXo.env.server.createPortalURL('UIWorkingWorkspace', 'EditInline', true))" title="" class="ItemIcon EditSiteIcon">$editSiteLayout</a>
				</li>
			<% } %>
		</ul>
	</li>
</ul>