{#
## This file is part of Zenodo.
## Copyright (C) 2015, 2016 CERN.
##
## Zenodo is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## Zenodo is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Zenodo. If not, see <http://www.gnu.org/licenses/>.
##
## In applying this licence, CERN does not waive the privileges and immunities
## granted to it by virtue of its status as an Intergovernmental Organization
## or submit itself to any jurisdiction.
#}

{%- extends config.ACCESSREQUESTS_BASE_TEMPLATE %}

{% block title %}{% endblock %}


{% block page_body %}
  {%- from "zenodo_accessrequests/_macro.html" import render_field with context %}

  <div class="container">
    <div class="row">
      <div class="col-md-8">
        <div class="well">
          <form role="form" method="POST">
            <legend>Access request<span class="pull-right"><i class="fa fa-edit"></i></span></legend>


            <div class="row">
              <div class="col-md-8">
                <h5>Record:</h5>
                <p><a href="{{url_for('invenio_records_ui.recid', pid_value=pid.pid_value)}}">{{record.get('title')}}</a> <small class="text-muted">(DOI: {{record.get('doi')}})</small></p>
              </div>
              <div class="col-md-4">
                <h5>Uploaded by:</h5>
                {% for owner in owners: %}
                  {% if owner.profile %}
                    {% if owner.profile.full_name %}
                      <p>{{owner.profile.full_name}}</p>
                    {% else %}
                      <p>{{owner.profile.username}}</p>
                    {% endif %}
                  {% endif %}
                {% endfor %}
              </div>
            </div>


            <h5>Conditions</h5>
            <p>{{record.get('access_conditions')|safe}}</p>

            <hr />
            {%- for field in form %}
            {{ render_field(field) }}
            {%- endfor %}
            <div class="row"><div class="col-md-12">By pressing "Send request", you agree to that we provide above details (<strong>including your email address</strong>) to the owner of the record.<br/><br/></div></div>
            <div class="form-group">
              <div class="">
                <a href="{{url_for('invenio_records_ui.recid', pid_value=pid.pid_value)}}" class="btn btn-default"><i class="fa fa-times"></i> Cancel</a>
                <button type="submit" class="btn btn-primary"><i class="fa fa-check"></i> Send request</button>
              </div>
            </div>
          </form>
        </div>
      </div>
      <div class="col-md-4"><div class="well">
          <small>
            <h5>Instructions</h5>
            <ul>
              <li>Ensure that you fulfil the conditions under which the owner grants access to the upload.</li>
              <li>Fill the form, in particular ensure that you provide a proper justification.</li>
              <li>Next, you will receive an email with a link to confirm the request. Once you have confirmed the request by opening the link, the owner will be notified.</li>
              <li>When the owner either grants/deny access you will receive a notification email. If you are granted access the notification email will contain a secret link that allows you to access the restricted access files.</li>
            </ul>
            <h5>Who grants/deny access?</h5>
            The decision whether to grant/deny access is solely under the responsibility of the record owner. Hence, please note that {{config.THEME_SITENAME}} staff are not involved in this decision.

            <h5>What is the response time?</h5>
            The response time fully depends on the record owner.

            <h5>Can the owner charge me for granting access?</h5>
            No, the owner is not allowed to charge you for granting access to the record hosted on {{config.THEME_SITENAME}}. Please <a href="/contact">notify us</a> if this happens.
          </small>
        </div></div>
    </div>
  </div>
{% endblock %}

