<%
	import java.text.SimpleDateFormat ;
	import org.exoplatform.webui.core.UIPopupWindow;
	import org.exoplatform.web.application.Parameter;
	import org.exoplatform.services.wcm.publication.WCMComposer;
	import org.exoplatform.services.jcr.util.Text;
	
	UIPopupWindow uiPopupWindow = uicomponent.getAncestorOfType(UIPopupWindow.class);
  def resizeBlock = "class=\"UIResizableBlock\"";
  if(uiPopupWindow != null) resizeBlock = ""; 
  
	def node = uicomponent.getNode() ;
	String pattern = "MMMMM dd yyyy" ;
	SimpleDateFormat dateFormat = new SimpleDateFormat() ;
  dateFormat.applyPattern(pattern) ;
  def originalNode = uicomponent.getOriginalNode();  
%>
<style>
  <% _ctx.include(uicomponent.getTemplateSkin("exo:podcast", "Stylesheet")); %>
</style>
<div $resizeBlock id="$uicomponent.id">
	<div style="padding: 8px">
		<div class="ContentPodcast">
		  <table><tr>
			 <td class="text"><%=_ctx.appRes("Podcast.view.label.podcast")%>: </td>
			 <td class="TextDetail"><%=Text.unescapeIllegalJcrChars(originalNode.getName())%></td>
			</tr></table>
		</div>
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.title")%>: </td>
  			<td class="TextDetail">
  				<% print uicomponent.getInlineEditingField(node, "exo:title", "", "TEXT", "TdGtmplTitle", "TdGtmplTitle", true); %>
  			</td>
			</tr></table>
		</div>
		<div class="ContentPodcast">
		  <table><tr>
			<td class="text"><%=_ctx.appRes("Podcast.view.label.link")%>: </td>
			<td class="TextDetail">
				<%if(node.hasProperty("exo:link")) {%>
					<%=node.getProperty("exo:link").getString()%>
				<%}%>
			</td>
			</tr></table>
		</div>
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.author")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:author")) {%>
  					<%=node.getProperty("exo:author").getString()%>
  				<%}%>
  			</td>
  	 </tr></table>
		</div>
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.explicit")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:explicit")) {%>
  					<%=node.getProperty("exo:explicit").getString()%>
  				<%}%>
  			</td>
  		</tr></table>
		</div>	
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.category")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:podcastCategory")) {%>
  					<%=node.getProperty("exo:podcastCategory").getString()%>
  				<%}%>
  			</td>
  		</tr></table>
		</div>		
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.keyword")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:keywords")) {%>
  					<%=node.getProperty("exo:keywords").getString()%>
  				<%}%>
  			</td>
  		</tr></table>
		</div>
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.publish-date")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:publishedDate")) {%>
  					<%=dateFormat.format(node.getProperty("exo:publishedDate").getDate().getTime())%>
  				<%}%>
  			</td>
  		</tr></table>
		</div>		
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.mime-type")%>:</td>
  			<td class="TextDetail">
    			<%if(node.hasNode("jcr:content")) {
    					def contentNode = node.getNode("jcr:content") ;
    					if(contentNode.hasProperty("jcr:mimeType")) {%>				
    						<%=contentNode.getProperty("jcr:mimeType").getString()%>
    			<%	}
  				}%>
  			</td>
			</tr></table>
		</div>		
		<div class="ContentPodcast">
		  <table><tr>
  			<td class="text"><%=_ctx.appRes("Podcast.view.label.length")%>:</td>
  			<td class="TextDetail">
  				<%if(node.hasProperty("exo:length")) {%>
  					<%=node.getProperty("exo:length").getString()%>
  				<%}%>
  			</td>
  	   </tr></table>
		</div>				
		<!-- div for  Description -->
		<div style="margin-top: 10px; border: 1px solid #bdbdbd;">
			<div class="TitleBG">
				<span class="text"><%=_ctx.appRes("Podcast.view.label.description")%>:</span>
			</div>
			<div class="summary" >
			<%
        def strTmpDescription = "";				
        if(node.hasProperty("exo:description")) {
           strTmpDescription = node.getProperty("exo:description").getString() ;
        }
        if (org.exoplatform.wcm.webui.Utils.getCurrentMode().equals(WCMComposer.MODE_LIVE)) {
          print strTmpDescription;
        }else {
          print uicomponent.getInlineEditingField(node, "exo:description", strTmpDescription, "TEXTAREA", "Description", "Content", true);
        }
      %>
			</div>
		</div>
	  <!-- End div for  Description -->	
	  <div><% _ctx.include(uicomponent.getViewTemplate("mix:votable", "view1")); %></div>
	  <div><% _ctx.include(uicomponent.getViewTemplate("exo:comments", "view1")); %></div>
	</div>

</div>