<style>
  a {behavior: url(#default#AnchorClick);} 

  .FileContent {  
    padding: 10px;
    color: #0e396c;
  }
  
  .FileContent .NavigationContainer {  
    padding-bottom: 5px;
    background: url('/ecmexplorer/skin/images/file/TitleBG1x21.gif') repeat-x top;
    border: 1px solid #cbcbcb;
  }
  
  .FileContent .TopTitle {  
    padding-left: 10px;
    height: 21px; line-height: 21px;
    color: #058ee6; font-weight: bold; 
    overflow: hidden;
  }
  
  .FileContent .ECMIframe {
    border: 1px solid #cbcbcb; 
    height: 100% ;
    overflow: auto;
    width: 93.9%;
    margin: 5px;
    background: white;
  }
  
  .FileContent .Content {  
    white-space: normal;
    overflow: auto;
    padding: 0px 10px;
    height: 300px;
  }
  
   .FileContent .Content .TextContent {  
    margin: auto;
  }
  
  .FileContent .ContentDetail {  
    text-align: center;
    overflow: visible;
    padding: 15px 0px;
  }      
</style>
<%
		import org.exoplatform.ecm.webui.utils.Utils;
		import org.exoplatform.services.jcr.RepositoryService;
  def originalNode = uicomponent.getOriginalNode();
  def currentNode = uicomponent.getNode() ; 
  def contentNode = currentNode.getNode("jcr:content") ;
  def mimeType = contentNode.getProperty("jcr:mimeType").getString() ;
  
  RepositoryService rService = uicomponent.getApplicationComponent(RepositoryService.class);
  String repository = rService.getCurrentRepository().getConfiguration().getName();  
  
  public String formatNodeName(String text) {
    return text.replaceAll("'", "\\\\'") ;
  }
  String restContextName = Utils.getRestContextName(uicomponent.getPortalName());  
%>
<div class="FileContent"> 
  <div class="NavigationContainer">       
    <div class="TopTitle">$originalNode.name</div>
    <div class="Content">
      <div class="TextContent">
        <% println "<pre>" + uicomponent.encodeHTML(contentNode.getProperty("jcr:data").getString()) + "</pre>"; %>     
       </div>
    </div>  
  </div> 
  <div class="UIAction">                                          
      <a href="javascript:eXo.ecm.ECMUtils.generateWebDAVLink('','<%=uicomponent.getPortalName()%>','<%=restContextName%>','${repository}','<%=uicomponent.getWorkspaceName()%>','<%=formatNodeName(originalNode.getPath())%>','<%=mimeType%>')" class="ActionButton LightBlueStyle">
          <%=_ctx.appRes("File.view.label.webDAV")%>
      </a>
      <a href="<%=uicomponent.getDownloadLink(currentNode)%>" title="<%=_ctx.appRes("File.view.label.download")%>" class="ActionButton LightBlueStyle">
          <%=_ctx.appRes("File.view.label.download")%>
      </a>
  </div>  
</div>
