<%
  import java.util.Locale;
  import java.text.DateFormat;
  import org.exoplatform.portal.webui.util.Util;
  import org.exoplatform.wiki.webui.UIWikiPortlet;
  
  Locale currentLocale = Util.getPortalRequestContext().getLocale();
  DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, currentLocale);
  
  currentWikiPage = uicomponent.getCurrentWikiPage();
  String creator = currentWikiPage.getOwner();
  creator = (creator != null) ? creator : _ctx.appRes("UIWikiPortlet.label.Anonymous");
  String author = currentWikiPage.getAuthor();
  author = (author != null) ? author : _ctx.appRes("UIWikiPortlet.label.Anonymous");
  def createdDate = df.format(currentWikiPage.getCreatedDate());
  def updatedDate = df.format(currentWikiPage.getUpdatedDate());
  int attachmentsTotal =  currentWikiPage.getAttachmentsExcludeContent().size();
  int versionsTotal = currentWikiPage.getVersionableMixin().getVersionHistory().getChildren().size() -1 ;
  
  String viewChangeSufix = "/changes";
  String viewChangeAnchor = "#" + uicomponent.COMPARE_REVISION +viewChangeSufix;
  
  String viewChangeActionId = UIWikiPortlet.WIKI_PORTLET_ACTION_PREFIX + uicomponent.COMPARE_REVISION + viewChangeSufix;
  String togglelink= uicomponent.event(uicomponent.TOGGLE_ATTACHMENTS_ACTION);
  
  String addedByLabel = _ctx.appRes("UIWikiPageInfoArea.label.AddedBy").replace("{0}", "<a class=\"Link\" href=\"\">" + creator + "</a>").replace("{1}", createdDate);
  String lastModifiedByLabel = _ctx.appRes("UIWikiPageInfoArea.label.LastModifiedBy").replace("{0}", "<a class=\"Link\" href=\"\">" + author + "</a>").replace("{1}", updatedDate);
  String totalAttachmentsLabel = _ctx.appRes("UIWikiPageInfoArea.label.TotalAttachments").replace("{0}", "<div class=\"TxtFeed\"><b>" + attachmentsTotal + "</b><a class=\"Link\" href=\"" + togglelink + "\">");
  %>
<div class="UIWikiPageInfoArea">
	<div class="TxtFeed">
	  ${addedByLabel}&nbsp;-&nbsp;$lastModifiedByLabel
	  <% if (versionsTotal>1) { %>
	  <a class="Link" href="javascript:eXo.wiki.UIWikiAjaxRequest.makeNewHash('$viewChangeAnchor');"><%= "(" + _ctx.appRes("UIWikiPageInfoArea.label.ViewChange") + ")"; %></a>
	  <a onclick="<%=uicomponent.event(uicomponent.COMPARE_REVISION);%>" id="$viewChangeActionId" style="display:none;">&nbsp;</a>
	  <% }%>
	</div>
	<%= totalAttachmentsLabel %></a>&nbsp;-&nbsp;<b>$versionsTotal</b><a class="Link" href="<%=uicomponent.event(uicomponent.SHOW_REVISION);%>">&nbsp;<%=_ctx.appRes("UIWikiPageInfoArea.label.TotalRevisions")%></a></div>
</div>
