##
## Document footer: tags, creation date, modification date
##
##
<div id="xdocFooter">
  #template("documentTags.vm")
  <div id="xdocAuthors">
    <div class="xdocCreation"> ## Creation
      $msg.get('core.footer.creation', [$xwiki.getUserName($doc.creator), $xwiki.formatDate($doc.creationDate)])<br/>
      #if($tdoc.realLanguage != $doc.realLanguage)
        $msg.get('core.footer.translationCreation', [$tdoc.realLanguage, $xwiki.getUserName($tdoc.creator), $xwiki.formatDate($tdoc.creationDate)])<br/>
      #end
    </div>
##    <div class="xdocLastModification"> ## Last modification
##      $msg.get('core.footer.modification', [$xwiki.getUserName($tdoc.author), $xwiki.formatDate($tdoc.date)])
##    </div>
  </div>
</div>
##
##
## More document related data: comments, attachments ...
##
<div id="xwikidata" class="layoutsubsection">
##
## Build the list of documents extras to display, if it does not exist (default).
## List format : ["ExtraAnchor", "ExtraName", "ExtraTabText", ExtraNumberOfItems, "extratemplate.vm", "keyboardShortcut"]
##
#if (!$docextras)
  #set($docextras = $util.arrayList)
  #if ($showcomments)
    $xwiki.jsfx.use('uicomponents/viewers/comments.js', {'forceSkinAction': true, 'language': ${xcontext.language}})
    $xwiki.ssfx.use('uicomponents/viewers/comments.css', true)
    #set ($discard = $docextras.add(["Comments", "comments", $msg.get("docextra.comments"), $doc.getObjects("XWiki.XWikiComments").size(), "commentsinline.vm", $msg.get("core.shortcuts.view.comments")]))
  #end
  #if ($showattachments)
    $xwiki.jsfx.use('js/xwiki/viewers/attachments.js', {'forceSkinAction': true, 'language': ${xcontext.language}})
    $xwiki.ssfx.use('js/xwiki/viewers/attachments.css', true)
    #set ($discard = $docextras.add(["Attachments", "attachments", $msg.get("docextra.attachments"), $doc.getAttachmentList().size(), "attachmentsinline.vm",$msg.get("core.shortcuts.view.attachments")]))
  #end
  #if ($showhistory)
    ## Pagination style
    $xwiki.ssfx.use('uicomponents/pagination/pagination.css', true)##
    #set ($discard = $docextras.add(["History", "history", $msg.get("docextra.history"), -1, "historyinline.vm", $msg.get("core.shortcuts.view.history")]))
  #end
  #if ($showinformation)
    #set ($discard = $docextras.add(["Information", "information", $msg.get("docextra.information"), -1, "informationinline.vm", $msg.get("core.shortcuts.view.information")]))
  #end
#end
##
## Put anchors before the footer, otherwise the top of each section would be hidden by the floating topmenu
##
#if($docextras.size() > 0)
<div id="docextraanchors" class="invisible">
#foreach($docextra in $docextras)<span id="${listtool.get($docextra, 0)}anchor">&nbsp;</span>#end
</div>
#end
##
## Display tabs
##
#if($docextras.size() > 0)
  <div id="xwikidatacontents">
    <div class="floatcontainer" id="docExtraTabs">
      <ul class="xwikitabbar" id="docExtrasTabsUl">
        #foreach($docextra in $docextras)
          #set ($extraAnchor = $listtool.get($docextra, 0))
          #set ($extraName = $listtool.get($docextra, 1))
          #set ($extraTabText = $listtool.get($docextra, 2))
          #set ($extraNbOfItems = $listtool.get($docextra, 3))
          <li id="${extraAnchor}tab">
            #set ($args = "viewer=${extraName}")
            <a id="${extraAnchor}link" href="$doc.getURL('view', $args)">
              $extraTabText #if($extraNbOfItems >= 0) <span class="itemCount">$msg.get("docextra.extranb", [$extraNbOfItems])</span> #end
            </a>
          </li>
        #end
      </ul>
    </div>
    ##
    ## Display panes (AJAX placeholders)
    ##
    <div id="docextrapanes">
      #foreach($docextra in $docextras)
        #set ($extraAnchor = $listtool.get($docextra, 0))
        <div id="${extraAnchor}pane" class="hidden empty"></div>
      #end
    </div>
    ##
    ## JavaScript code generation
    ##
    <script type="text/javascript">
      var hashviewer = self.document.location.hash.substring(1);
      #foreach($docextra in $docextras)
        #set ($extraAnchor = $listtool.get($docextra, 0))
        #set ($extraName = $listtool.get($docextra, 1))
        #set ($extraTemplate = $listtool.get($docextra, 4))
        #set ($extraShortcut = $listtool.get($docextra, 5))
        ##
        ## Set the extra to load
        ##
        #if ($velocityCount == 1)
          var extraInit = function(){ XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", false) };
        #end
        if (hashviewer == "${extraAnchor}") {
          var extraInit = function(){ XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true) };
        }
        ##
        ## Replace tab link
        ##
        if ($("${extraAnchor}link") != null) {
          $("${extraAnchor}link").href="#${extraAnchor}";
          Event.observe($("${extraAnchor}link"), "click", function(){ XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", false); }, false);
        }
        ##
        ## Replace top menu link (if any)
        ##
        if ($("tmShow${extraAnchor}") != null) {
          $("tmShow${extraAnchor}").href="#${extraAnchor}";
          Event.observe($("tmShow${extraAnchor}"), "click", function(){ XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true); }, false);
        }
        ##
        ## Replace shortcut link (if any)
        ##
        if ($("${extraName}shortcut") != null) {
          $("${extraName}shortcut").down('a').href="#${extraName}";
          Event.observe($("${extraName}shortcut"), "click", function(){ XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true); }, false);
        }
        ##
        ## Override keyboard shortcut (if any)
        ##
        #if ($keyboardShortcutsEnabled && "$!extraShortcut" != "")
          shortcut.remove("$extraShortcut");
          shortcut.add("$extraShortcut", function() { XWiki.displayDocExtra("${extraAnchor}", "${extraTemplate}", true); }, { 'type':'keypress', 'propagate':false, 'disable_in_input':true });
        #end
      #end
      document.observe("dom:loaded", extraInit, false);
    </script>
  </div> ## xwikidatacontents
#end
</div>  ## xwikidata
