<%
	/**
	 * Created by The eXo Platform SARL
	 * Author : Tran The Trong
	 *          trongtt@gmail.com
	 * July 25, 2006
	 * version: $Id$	 
	 */
%>
<%
  import org.exoplatform.ecm.webui.component.explorer.sidebar.UISideBar ;
  import org.exoplatform.ecm.webui.component.explorer.sidebar.UITreeExplorer;
  import org.exoplatform.ecm.webui.component.explorer.UIDocumentWorkspace ;
  import org.exoplatform.ecm.webui.component.explorer.UIDrivesArea ;
  import org.exoplatform.webui.core.UIRightClickPopupMenu ;
  import org.exoplatform.ecm.jcr.model.Preference;
  import org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer;
  
  def rcontext = _ctx.getRequestContext() ;
  UITreeExplorer uiTreeExplorer = uicomponent.findFirstComponentOfType(UITreeExplorer.class);
  def focusNode = uiTreeExplorer.getEncodeCurrentPath();
  def expandNode = uiTreeExplorer.getEncodeExpandPath();
  def isExpand = uiTreeExplorer.getIsExpand();
  def uiExplorer = uicomponent.getAncestorOfType(UIJCRExplorer.class);
  def pref = uiExplorer.getPreference();
  def enableDragAndDrop = pref.isEnableDragAndDrop();
  
  String componentId = uicomponent.getId();
  rcontext.getJavascriptManager().addJavascript("eXo.ecm.UIListView.initDragDropForTreeEvent('$componentId', '$enableDragAndDrop');");
  if(!isExpand && focusNode != null)
  	rcontext.getJavascriptManager().addJavascript("eXo.ecm.ECMUtils.loadEffectedSideBar('$focusNode');") ;
  else if(isExpand && expandNode != null)
  	rcontext.getJavascriptManager().addJavascript("eXo.ecm.ECMUtils.loadEffectedSideBar('$expandNode');") ;
  rcontext.getJavascriptManager().addOnLoadJavascript('eXo.ecm.ECMUtils.loadEffectedItemsInSideBar');
  rcontext.getJavascriptManager().addOnLoadJavascript("eXo.ecm.UIListView.setHeight");
  rcontext.getJavascriptManager().addOnResizeJavascript("eXo.ecm.UIListView.setHeight");
%>

<div class="UIWorkingArea ClearFix" id="UIWorkingArea">
  <%
	  uicomponent.renderChild(UIRightClickPopupMenu.class) ;
	  String className = "" ;

	  if( uicomponent.isShowSideBar() ) {
	    className = "RightContainer"
	    println "<div class=\"LeftCotainer\" id=\"LeftContainer\">" ;
	  	uicomponent.renderChild(UISideBar.class) ; 
	  	println "</div>" ;
	  }
	%>
	
	<% if( uicomponent.isShowSideBar() ) {%>
		<div class="ResizeSideBar" style="" onmousedown="eXo.ecm.ECMUtils.resizeSideBar(event)">
			<div class="ResizeButton" style=" top:250px;"  onclick="eXo.ecm.ECMUtils.showHideSideBar(this)"><span></span></div>
		</div>
	<% } %>
	
  <div class="$className">
		<% 
		  uicomponent.renderChild(UIDocumentWorkspace.class) ;
		  uicomponent.renderChild(UIDrivesArea.class);
		%>
		
	</div>
	<div style="height: 0px;" class="ClearLeft"><span></span></div>
</div>
