
<% 
import org.exoplatform.wiki.commons.Utils;
 %>

<%
  def rcontext = _ctx.getRequestContext();
  String titleId = uicomponent.getEditableFieldId();
  String parentId = uicomponent.getParent().getId();
  String inputId=  uicomponent.FIELD_TITLEINPUT;
  
  String showInputAction= uicomponent.event(uicomponent.CHANGE_TITLEMODE,'true'); 
  String hideInputAction= uicomponent.event(uicomponent.CHANGE_TITLEMODE,'false');   
  String submitAction= uicomponent.url(uicomponent.SAVE);  
  //rcontext.getJavascriptManager().addJavascript("eXo.wiki.UIFieldEditableForm.init('"+ uicomponent.id + "', '" +parentId + "', '" +titleId +"', '" + inputId +"');");
  def requireJs = rcontext.getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIFieldEditableForm", "UIFieldEditableForm");
  requireJs.addScripts("UIFieldEditableForm.init('"+ uicomponent.id + "', '" +parentId + "', '" +titleId +"', '" + inputId +"');");
  
	%>

<div class="uiFieldEditableForm">
<% uiform.begin();%>
 <%	List children = uicomponent.getChildren() ;
    for(component in children) {
      if(component.isRendered()){
        uicomponent.renderChild(component.getClass()) ;
      }
    }
	%>
  <div class="linkContainer">
    <a onclick="$showInputAction" class="showInput" style="display:none;">&nbsp;</a>
    <a onclick="$submitAction" class="submitLink" style="display:none;">&nbsp;</a>
    <a onclick="$hideInputAction" class="hideInput" style="display:none;">&nbsp;</a>
  </div>
<% uiform.end();%>
</div>