<html>
  <head>
    <link rel="stylesheet" href="globals/base.css"
      tal:attributes="href here/globals/base.css/absolute_url | nothing" />
    <title>Message from server</title>
  </head>
  <body>
    <tal:block condition="python:options.has_key('message_type')">
      <div class="feedback"
        tal:condition="python:options['message_type'] == 'feedback'">
        <span tal:replace="structure python:options['message']" />&nbsp;&nbsp;<span tal:replace="string:(${here/service_utils/backend_now_to_str})">datetime</span>
      </div>
      <div class="alert" tal:condition="python:options['message_type'] == 'error'">
        <span class="error" tal:content="structure python:options['message']" />
      </div>
    </tal:block>

    <div class="info"
      tal:condition="python: (options['error_type'] == 'Unauthorized' and here.service_members.allow_authentication_requests())">
      <h2>Membership system</h2>
      <p class="readable">
        Sorry, this page is only available to visitors with proper credentials.
      </p>
      <div class="readable" 
        tal:condition="here/service_members/get_authentication_requests_url">
        <p>
          You're welcome to apply for membership (it's a three field form). Your request will be sent to the responsible person who will grant (or possibly deny) access. Then you'll be informed via email.
        </p>
        <span class="subhead">
          <a href="become_visitor"
            tal:attributes="href string:service_resources/${here/service_members/get_authentication_requests_url}?last_url=${here/absolute_url}">
          Become a visitor to the site
          </a><br /></span>
          As a visitor, you can view certain items that anonymous users are not allowed to see.<br /><br />
      </div>
      <h3>Visitor options</h3>
      <span class="subhead"><a tal:attributes="href string:${here/REQUEST/model/absolute_url}/public/request_roles?last_url=${here/absolute_url}">Request a role which allows access to this location</a>
      <br /></span>
      Note that you must first have visitor rights to apply for roles.
      <br /><br />
      <span class="subhead">
        <a href="#" onclick="document.location = document.location; return false">Try logging in again....</a>
      </span>
    </div>

    <div class="info"
      tal:condition="python: (options['error_type'] == 'Unauthorized' and not here.service_members.allow_authentication_requests())">
      <h2>Login required</h2>
      <p>
      Sorry, this page is only available to visitors with proper credentials.  
      <br /><br />
      <span class="subhead">
        <a href="#" onclick="document.location = document.location">Try logging in again....</a>
      <br /><br />
    </div>

  <tal:condition condition="python: options['error_type'] != 'Unauthorized'">

      <h2>System problem</h2>
      <p>Something went wrong. If you're testing, the information below is important. <br />
        <span class="error">Please note what you were doing when this error occured.</span></p>
        <p>In any case, you can use your back button to return to the previous page.</p>
        <p>Sorry for the irritation.</p>

        <hr class="netscape4" size="" />
        <h4>Error Type: <span class="error" tal:content="structure options/error_type|string:unknwon">error_type</span></h4>
        <h4>Error Value: <span class="error" tal:content="structure options/error_value|string:unknown"></span></h4>
        <h4>Error info:</h4>
        Path: <span class="error" tal:content="request/PATH_INFO|string:unknown">error</span> <br />
        URL: <span class="error" tal:content="request/SERVER_URL|string:unknown" /><span class="error" tal:content="request/PATH_INFO|string:unknown" /><span tal:replace="request/QUERY_STRING|string:unknown" />
        <br />

        <h4>Client:</h4>
        Browser: <span class="error" tal:content="request/HTTP_USER_AGENT|string:unknown">error</span><br />
        Remote address: <span class="error" tal:content="request/REMOTE_ADDR|string:unknown">error</span><br />
        Remote identity: <span class="error" tal:content="request/REMOTE_IDENT|string:unknown">error</span><br />

        <h4>Linked from:</h4>
        <span class="error" tal:content="request/HTTP_REFERER|string:unknown">error</span>
        <br />

  </tal:condition>
  </body>
</html>
