<% 
	import javax.jcr.Node;
	import org.exoplatform.web.application.Parameter;
	import org.exoplatform.wcm.webui.reader.ContentReader;
	
	def rcontext = _ctx.getRequestContext() ;
	def String htmlWYSIWYGFormId = "htmlData" + uicomponent.hashCode();
	def String cssFormId = "ContentCSS[" + uicomponent.hashCode() + "]";
	def String jsFormId = "ContentJS[" + uicomponent.hashCode() + "]";
	def jsManager = rcontext.getJavascriptManager();
	jsManager.require("SHARED/wcm-utils", "util").
  addScripts("util.CKEditor.insertCSS('" + htmlWYSIWYGFormId + "', '" + cssFormId + "');");
	private String getDisplayTab(String selectedTab) {
		if ((uicomponent.getSelectedTab() == null && selectedTab.equals("mainWebcontent"))
				|| selectedTab.equals(uicomponent.getSelectedTab())) {
			return "display:block";	
		}
		return "display:none";
	}
	
	private String getSelectedTab(String selectedTab) {
		if (getDisplayTab(selectedTab).equals("display:block")) {
			return "SelectedTab";
		}
		return "NormalTab";
	}

	
	Node webContentNode = uicomponent.getNode();
%>
<div class="UITabPane uiTabNormal uiTabInPage">
<%uiform.begin()%>
  <% if (uiform.isShowActionsOnTop()) {
            uiform.processRenderAction()
          }
  %>

 <div class="HorizontalLayout">

   <table class="UIFormGrid">
     <tr>
       <%
         String[] fieldProperty; 
       %>
       <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Name")%></td>
       <td class="FieldComponent">
       <%
         String[] fieldName = ["jcrPath=/node", "editable=if-null", "validate=empty"];
         uicomponent.addTextField("name", fieldName);
       %>
       </td>
     </tr>

     <tr>
     <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.URL")%></td>
     <td class="FieldComponent">
   <%
       fieldProperty = ["jcrPath=/node/exo:url", "validate=empty"];
       uicomponent.addTextField("/node/exo_url", fieldProperty);
   %> 
     </td>
   </tr>
     <tr>
       <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Title")%></td>
       <td class="FieldComponent">
     <%
         fieldProperty = ["jcrPath=/node/exo:title"];
         uicomponent.addTextField("/node/exo_title", fieldProperty);
     %>
       </td>
     </tr>
     <tr>
     <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Subtitle")%></td>
     <td class="FieldComponent">
   <%
       fieldProperty = ["jcrPath=/node/exo:subtitle"];
       uicomponent.addTextField("/node/exo_subtitle", fieldProperty);
   %>
     </td>
   </tr>
        <tr>
       <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Description")%></td>
       <td class="FieldComponent">
     <%
         fieldProperty = ["jcrPath=/node/exo:summary"];
         uicomponent.addTextField("/node/exo_summary", fieldProperty);
     %>
       </td>
     </tr>
     <tr>
     <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Width")%></td>
     <td class="FieldComponent">
   <%
       fieldProperty = ["jcrPath=/node/exo:width" ];
       uicomponent.addTextField("/node/exo_width", fieldProperty);
   %>
     </td>
     <tr>
     <td class="FieldLabel"><%=_ctx.appRes("GlobexVideo.label.Height")%></td>
     <td class="FieldComponent">
   <%
       fieldProperty = ["jcrPath=/node/exo:height" ];
       uicomponent.addTextField("/node/exo_height", fieldProperty);
   %>
     </td>
   </tr>
   </table>
 </div>
  <% if (!uiform.isShowActionsOnTop()) { %>

    <%
     for(action in uicomponent.getActions()) {
      String actionLabel = _ctx.appRes(uicomponent.getName() + ".action." + action) ;
      String link = uicomponent.event(action);                  %>
            <button type="button" href="javascript:void(0);" onclick="$link" class="btn">$actionLabel</button>
     <% }  %>

  <% } %>
</div>

	<%uiform.end()%>						 
</div>  <!-- End of UITabPane -->
