<%
  import org.exoplatform.wiki.mow.api.Page;
  import org.exoplatform.web.application.JavascriptManager;
  import org.exoplatform.container.ExoContainerContext;
  import org.exoplatform.wiki.service.WikiService;
  import org.exoplatform.wiki.service.WikiPageParams;
  import org.exoplatform.wiki.commons.Utils;

  WikiService wikiService = ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(WikiService.class);
  Page currentPage = Utils.getCurrentWikiPage();
  def relatedPages = wikiService.getRelatedPagesOfPage(currentPage);

  def rcontext = _ctx.getRequestContext();
  def requireJs = rcontext.getJavascriptManager().getRequireJS();
  requireJs.require("SHARED/UIRelated", "UIRelated");
  requireJs.addScripts("UIRelated.initMacros();");
%>
<div id="$uicomponent.id" class="Related uiRelatePages">
	<% if (relatedPages.size() > 0) { %>
	<div class="wikiBox">
	  <h6 class="titleWikiBox"><%= _ctx.appRes("UIWikiMiddleArea.label.related-pages") %></h6>
	  <div class="relateContent">
		<%= Utils.renderMacroToXHtml(uicomponent, "{{related}}", org.xwiki.rendering.syntax.Syntax.XWIKI_2_0.toIdString()); %>
	  </div>
	</div>
	<% } %>
</div>

<!--div class="relateContent">
  <a href="#" class="relateItem"><i class="uiIconFile"></i>Product road map</a>
  <a href="#" class="relateItem"><i class="uiIconFile"></i>nothing special</a>
  <a href="#" class="relateItem"><i class="uiIconFile"></i>nothing special</a>
</div-->
