<%
  String permalink = uiform.getPermanlink();
  boolean isCurrentPagePublic = uiform.isCurrentPagePublic();
  boolean canModifyPagePermission = uiform.canModifyPagePermission();
  boolean canPublicAndRetrictPage = uiform.canPublicAndRetrictPage();
  
  String pageInfoNotify = "";
  String pageInfoCss = "";
  if (isCurrentPagePublic) {
    pageInfoNotify = _ctx.appRes("UIWikiPermalinkForm.label.public-page");
    pageInfoCss = "uiIconUnlockMini";
  } else {
    pageInfoNotify = _ctx.appRes("UIWikiPermalinkForm.label.restrict-page");
    pageInfoCss = "uiIconLockMini";
  }
  
  def requireJs = _ctx.getRequestContext().getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIWikiPermalinkForm", "UIWikiPermalinkForm");
  requireJs.addScripts("UIWikiPermalinkForm.init('" + uicomponent.id + "');");
  requireJs.require("SHARED/jquery", "gj")
           .addScripts("gj(document).ready(function() { gj(\"*[rel='tooltip']\").tooltip();});");  
%>
<%uiform.begin();%>
<div id="$uicomponent.id" class="uiWikiPermalinkForm">
  <div class="permalLinkShare"><i class="uiIconPermalink"></i>&nbsp;&nbsp;<%=_ctx.appRes("UIWikiPermalinkForm.label.link-to-share");%></div>
  <div class="permalinkWapperInput"><input id="PermalinkText" class="input-xxxlarge" type="text" onclick="this.focus();this.select()" readonly="readonly" value="$permalink"/></div>
  <div class="permalinkNotify"><i class="$pageInfoCss"></i>&nbsp;&nbsp;$pageInfoNotify</div>
  <div class="uiAction">
    <%if (canPublicAndRetrictPage) {%>
      <%if (isCurrentPagePublic) {%>
        <button type="button" onclick="<%=uicomponent.event(uiform.RESTRICT_ACTION);%>" class="btn btn-primary"><%=_ctx.appRes('UIWikiPermalinkForm.action.Restrict')%></button>
      <%} else { %>
        <button type="button" onclick="<%=uicomponent.event(uiform.MAKE_PUBLIC_ACTION);%>" class="btn btn-primary"><%=_ctx.appRes('UIWikiPermalinkForm.action.MakePublic')%></button>
      <%}%>
    <%}%>
    
    <%if (canModifyPagePermission) {%>
      <button type="button" onclick="<%=uicomponent.event(uiform.MANAGE_PERMISSION_ACTION);%>" class="btn"><%=_ctx.appRes('UIWikiPermalinkForm.action.ManagePermission')%></button>
    <%}%>
  </div>
</div>
<%uiform.end();%>