{% extends "base.html" %}

{% block title %}{{ _('Export Data') }} — {{ service_name }}{% endblock %}

{% block content %}
  <h1>{{ _('Export to Dataverse') }}</h1>
  <p>{{ _('%(service_name)s can export the metadata and files of this object to %(dataverse_name)s. It will create a draft dataset, which you can then review and publish. To be able to create this dataset for you, %(service_name)s can use the Dataverse API using an API Token associated with your %(dataverse_name)s account. To learn more about API Tokens, see the <a href="https://guides.dataverse.org/en/latest/user/account.html#api-token">Dataverse User Guide</a>.', service_name=service_name, dataverse_name=config['DATAVERSE_NAME']) }}</p>
  <p>{{ _('To access your API token, visit <a href="%(dataverse_url)s/dataverseuser.xhtml?selectTab=apiTokenTab">%(dataverse_name)s</a>', dataverse_name=config['DATAVERSE_NAME'], dataverse_url=config['DATAVERSE_URL']) }}.</p>
  <form method="post">
    {{ dataverse_api_token_form.hidden_tag() }}
    <div class="form-group{% if had_invalid_api_token %} has-error{% endif %}">
      <label>{{ _('API Token') }}
        <input type="text" autocomplete="off" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" class="form-control" required="required" style="width: 21em" name="{{ dataverse_api_token_form.api_token.name }}"/>
      </label>
      {% if had_invalid_api_token %}
      <div class="help-block">{{ _('The API token you entered was invalid.') }}</div>
      {% endif %}
    </div>
    <div class="form-group">
    <label style="font-weight: normal">
      <input type="checkbox" {% if dataverse_api_token_form.store_api_token.data %}checked="checked"{% endif %} name="{{ dataverse_api_token_form.store_api_token.name }}" /> {{ _('Store this API token in %(service_name)s', service_name=service_name) }} <span data-toggle="tooltip" data-placement="top" title="{{ _('You can delete a stored Dataverse API token at any time by editing your preferences.') }}"><i class="fa fa-question-circle" aria-hidden="true"></i></span>
    </label>
    </div>
    <div class="form-group">
      <a href="{{ url_for('.object', object_id=object_id) }}" class="btn btn-default" style="width:8em">{{ _('Cancel') }}</a>
      <input type="submit" value="{{ _('Continue') }}" class="btn btn-primary" style="width:8em">
    </div>
  </form>
{% endblock %}
