<html>
  <head>
    <link rel="stylesheet" href="globals/base.css" />
    <title>Message from system</title>
  </head>
  <body>
    <div class="margins" tal: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="feedback" tal:condition="python:options['message_type'] == 'error'">
        <span class="error" tal:content="structure python:options['message']" />
      </div>
    </div>

    <div class="margins" tal:condition="python: (options['error_type'] == 'Unauthorized' and here.service_members.allow_subscription())">
      <h2>Membership System</h2>
      <p class="readable">
        This page is only available to visitors with the right credentials.
      </p>
      <div class="readable" 
        tal:condition="here/service_members/get_subscription_url">
        <p>
          You're welcome to apply for membership (and the form has only three fields). 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_subscription_url}?last_url=${here/absolute_url}">
        Become a visitor to the site
        </a><br /></span>
        As a visitor, you can view certain objects that unauthenticated users are not allowed to see.<br /><br />
      </div>
      <h3>Visitor options</h3>
      <span class="subhead"><a tal:attributes="href string:public/request_roles?last_url=${here/absolute_url}">Request a role which allows access to this location
      </a><br /></span>
      Note that you must already 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>
      <br /><br />
    </div>

    <div class="margins" tal:condition="python: (options['error_type'] == 'Unauthorized' and not here.service_members.allow_subscription())">
      <h2>Unauthorized access, login required</h2>
      <p>
      Sorry, this page is only available to visitors with the right credentials.  
      <br /><br />
      <span class="subhead"><a href="#" onclick="document.location = document.location">Try logging in again</a>
      <br /><br />
    </div>
    <div class="margins" tal: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 noshade />
        <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 />

    </div>
  </body>
</html>
