{#-
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
-#}
{% extends g.theme.master %}

{% block title %}
{{c.project.name}} / {{importer.source}} {{importer.tool_label}} Importer
{% endblock %}

{% block header %}
{{importer.source}} {{importer.tool_label}} Importer
{% endblock %}

{% block extra_css %}
  <style type="text/css">
    #content_base form {
      padding: 0 20px 20px 20px;
    }
    #content_base form label {
      display: inline-block;
      width: 30%;
      vertical-align: top;
    }
    #content_base form > div {
      margin-bottom: 10px;
    }
    #content_base form > div input {
      width: 30%;
      vertical-align: top;
    }
    #content_base form > div input[type="checkbox"] {
      -moz-box-shadow: none;
      -webkit-box-shadow: none;
      -o-box-shadow: none;
      box-shadow: none;
      width: 1em;
    }
    #content_base form .error {
      display: inline-block;
      color: #f00;
      background: none;
      border: none;
      margin: 0;
      width: 30%;
    }
  </style>
{% endblock %}

{%- macro error(field_name) %}
  {% if request.validation.errors[field_name] %}
  <div class="error">{{request.validation.errors[field_name]}}</div>
  {% endif %}
{%- endmacro %}

{% block content %}
<form action="create" method="post" enctype="multipart/form-data">
  {% block importer_fields %}
  {% endblock %}
  {% if not show_mount_fields is defined or show_mount_fields %}
  <div>
    <label for="mount_label">Label</label>
    <input name="mount_label" value="{{ request.validation.values['mount_label'] or target_app.default_mount_label }}" />
      {{ error('mount_label') }}
  </div>
  <div>
    <label for="mount_point">Mount Point</label>
    <input name="mount_point" value="{{ request.validation.values['mount_point'] or target_app.default_mount_point }}" />
      {{ error('mount_point') }}
  </div>
  {% endif %}

  <div>
    You'll receive an email when the import is finished.
    Import time varies depending on the amount of data being imported.
    {% if config['doc.url.importers.{}'.format(importer.source)] %}
        <br/><br/>
        For more information on what will be imported and post-import configuration,
        please see the <a href="{{ config['doc.url.importers.{}'.format(importer.source)] }}">{{importer.source}} import documentation</a>.
    {% endif %}
  </div>

  <input type="submit" value="Import"/>
  {{lib.csrf_token()}}
</form>
{% endblock %}
