<%
	
	import javax.jcr.Node;
	import java.util.List;
	import org.exoplatform.services.cms.taxonomy.TaxonomyService;
	import org.exoplatform.services.cms.folksonomy.NewFolksonomyService;
	import org.exoplatform.services.wcm.core.NodeLocation;
	import org.exoplatform.services.wcm.skin.XSkinService;
	import org.exoplatform.services.wcm.javascript.XJavascriptService;
		
	public boolean getPortletPreference(String name) {
    String value = _ctx.getRequestContext().getRequest().getPreferences().getValue(name, null);
    if(value != null) return Boolean.parseBoolean(value);
    return false;
  }
  
  	def currentNode = uicomponent.getNode() ; 
    def html = currentNode.getNode("default.html/jcr:content").getProperty("jcr:data").getString();
  	def css = currentNode.getNode("css/default.css/jcr:content").getProperty("jcr:data").getString();
  	def js = currentNode.getNode("js/default.js/jcr:content").getProperty("jcr:data").getString();  
  	// NOTE : You can use services if you're adding external css or js thru WebDAV. If not, direct access to the node is more efficient.
  	//def css = uicomponent.getApplicationComponent(XSkinService.class).getActiveStylesheet(currentNode);
  	//def js =  uicomponent.getApplicationComponent(XJavascriptService.class).getActiveJavaScript(currentNode);
  
	boolean isShowCategories = getPortletPreference("ShowCategories");
	boolean isShowTags = getPortletPreference("ShowTags");
	
	if((css != null) && (css.length() > 0)) {
		%>
			<style type="text/css">
				/* <![CDATA[ */			
					<%=css%>
				/* ]]> */
				</style>
		<%
	}

	if((js != null) && (js.length() > 0)) {
		%>
			<script type="text/javascript">
			/* <![CDATA[ */	
				<%=js%>
			/* ]]> */		
			</script>
		<% 
	}
%>

<div id="content" class="content">
	      
	<div id="$uicomponent.id">
		<div class="PORTLET-FRAGMENT"  style="width: null;height: null;">
			<div id="UIBrowseContentPortlet" style="min-width:300px" class="UIBrowseContentPortlet">
				<span class="UICBPopupAction" id="UICBPopupAction"></span>
				<div class="UIBrowseContainer" id="UIBrowseContainer">
					<%= currentNode.getName() %>
					<br/>
					<%=html%>
					
				</div>          		
			</div>
		</div>
	</div>

</div>  
