<tal:block metal:use-macro="python:here.getFormsTool().getForm('site_admin_template').macros['page']">

<h1 metal:fill-slot="title" i18n:translate="">Portal statistics</h1>



<tal:block metal:fill-slot="section">
  <div class="tabbedmenu">
    <ul>
      <li><a tal:attributes="href string:${here/absolute_url}/admin_stats" i18n:translate="">Statistics</a></li>
      <li class="currenttab"><a tal:attributes="href string:${here/absolute_url}/admin_account" i18n:translate="">Settings</a></li>
      <li><a tal:attributes="href string:${here/absolute_url}/admin_verify" i18n:translate="">Google Snippets</a></li>
    </ul>
  </div>

<tal:block condition="options/is_configured">
  <p i18n:translate="">
    Please get an access code for your Google Analytics account
    and paste it below.
  </p>

  <button id="google-account-get-authorisation">Get code</button><br />

  <form tal:attributes="action string:${here/absolute_url}/saveAuthorizationCode">
    <label for="google-account-code-input" i18n:translate="">
      Google Authorization code:
    </label>
    <input name="code" size="40" id="google-account-code-input" />
    <button type="submit">save</button>
  </form>

  <script tal:content="structure python:'window.NAAYA_GOOGLE_AUTH_URL = %s;'
          % here.rstk['json_dumps'](here.generateAuthUrl())"></script>
  <script>
      $('#google-account-get-authorisation').click(function(evt) {
          evt.preventDefault();
          var url = window.NAAYA_GOOGLE_AUTH_URL;
          var title = "authenticate with google";
          var options = ("height=400,width=500,status=no," +
                         "toolbar=no,menubar=no,location=no,scrollbars=yes");
          var login_window = window.open(url, title, options);
      });
  </script>
</tal:block>
<p tal:condition="not:options/is_configured">
  Google API keys are not configured for this portal.
</p>

</tal:block>
</tal:block>
