<%  
  import org.apache.commons.lang.StringEscapeUtils;

  String link = uicomponent.getActionLink(); 
  String titleMessage = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.Confirmation"));
  String addMessage = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.ConfirmAdd"));
  String untitledMessage = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIWikiPageTitleControlArea.label.Untitled"));
  String confirmLabel = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.Confirm"));
  String cancelLabel = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.Cancel"));
  
  String invalidCharacter = StringEscapeUtils.escapeJavaScript(_ctx.appRes("WikiPageNameValidator.msg.Invalid-char"));
  String titleWarning = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.Warning"));
  String okLabel = StringEscapeUtils.escapeJavaScript(_ctx.appRes("UIConfirmBox.label.Ok"));
  
  boolean isNewMode = uicomponent.isNewMode();
  String pageTitleInputId= uicomponent.getPageTitleInputId();
  def rcontext = _ctx.getRequestContext() ;  
  def requireJs = rcontext.getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIWikiSavePage", "UIWikiSavePage");
  requireJs.require("SHARED/UIConfirmBox", "UIConfirmBox");
  requireJs.require("SHARED/UIForm", "UIForm");
  requireJs.require("SHARED/UIWikiPageEditForm", "UIWikiPageEditForm");
%>
<a style="display:none" id="link_$uicomponent.id" href="$link"></a>
<button type="button" id="$uicomponent.id" onclick="eXo.wiki.UIWikiPageEditForm.setPageSaved();if(eXo.wiki.UIWikiSavePage.confirm('$uicomponent.id', $isNewMode, '$pageTitleInputId', '$untitledMessage','$titleMessage', '$addMessage', 'SavePage Icon', '$confirmLabel', '$cancelLabel', '$titleWarning', '$invalidCharacter', '$okLabel')) $link;" class="btn btn-primary saveWikiPage">
    <%=_ctx.appRes("UISubmitToolBar.action.SavePage");%>
</button>
