<%	
	import org.exoplatform.platform.component.UIAddPagePlatformToolbarPortlet;
	import org.exoplatform.web.application.JavascriptManager;
	import org.exoplatform.portal.config.model.PageNavigation;
	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("UIAddPagePlatformToolbarPortlet.action.AddPage");	
	String editPageLabel = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action.EditPage");
	String editPortalLabel = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action.EditPortal");
	String editPageAndNaviLabel = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action.EditPageAndNavigation");
	String editSiteLayout = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action.EditSiteLayout");
	String editorLabel = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action.Editor");
	
	boolean userCouldEditNavigation = uicomponent.hasEditPermissionOnNavigation();
	boolean userCouldEditPage = uicomponent.hasEditPermissionOnPage();
	boolean userCouldEditPortal = uicomponent.hasEditPermissionOnPortal();
	
	PageNavigation selectedNav = uicomponent.getSelectedNavigation();
	if (selectedNav != null) {
		editorLabel = _ctx.appRes("UIAddPagePlatformToolbarPortlet.action." + selectedNav.getOwnerType() + ".Editor");
	}
	String accountSetting = "javascript:if(document.getElementById('UIMaskWorkspace')) ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'AccountSettings', true));"
%>
<div class="UIAddPagePlatformToolbarPortlet" id="$uicomponent.id" >
	<div class="UIHorizontalTabs">
		<div class="TabsContainer" >
			<div class="UITab NormalToolbarTab">
			<% if(userCouldEditPage){ %>
				<div class="">
					<a class="TBIcon" href="javascript:ajaxGet(eXo.env.server.createPortalURL('UIWorkingWorkspace', 'PageCreationWizard', true))" title="" class="ItemIcon AddPageIcon">Add Page</a>
				</div>
				<% } %>
				
			</div>
		</div>
	</div>
</div>