<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip="True">
  <py:match path="jsglobals" once="true">
    <script type="text/javascript">
      if (typeof(fedora) == 'undefined') {
        fedora = {};
      }
      fedora.identity = {anonymous: true};
      /* Remove token and trailing slash */
      fedora.baseurl = "${tg.url('/')}".replace(/\/?(\?[^?]+)?$/, '');
    </script>
    <script type="text/javascript" py:if="request.identity">
      fedora.identity = {userid: "${request.identity['user'].user_id}",
        username: "${request.identity['user'].user_name}",
        display_name: "${request.identity['user'].display_name}",
        <py:span py:if="'CSRF_TOKEN' in request.environ" py:strip="True">
          token: "${tg.identity.csrf_token}",
        </py:span>
        anonymous: false
      };
    </script>
  </py:match>
</html>
