aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/import.html.jinja
blob: afeb5a2fe4e9381936e1b0309eb470a8b7b54a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{#
SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0

Proxy web UI item loading page.

This file is part of Hydrilla&Haketilo.

Copyright (C) 2022 Wojtek Kosior

Dual licensed under
* GNU General Public License v3.0 or later and
* Creative Commons Attribution Share Alike 4.0 International.

You can choose to use either of these licenses or both.


I, Wojtek Kosior, thereby promise not to sue for violation of this
file's licenses. Although I request that you do not make use of this
code in a proprietary work, I am not going to enforce this in court.
#}
{% extends "hkt_mitm_it_base.html.jinja" %}

{% block title %} {{ _('web_ui.import.title') }} {% endblock %}

{% block style %}
  {{ super() }}

  input[type="file"]::-webkit-file-selector-button,
  input[type="file"]::file-selector-button {
      display: none;
  }

  input[type="file"] {
      display: block;
      font-size: inherit;
      font-style: inherit;
  }
{% endblock %}

{% block main %}
  <h3>{{ _('web_ui.import.heading') }}</h3>

  <h4>{{ _('web_ui.import.heading_import_from_file') }}</h4>

  <form method="POST" enctype="multipart/form-data">
    <input name="action" type="hidden" value="import_from_file">

    {% if uploaded_file_not_zip is defined %}
      {{ error_note(_('web_ui.err.uploaded_file_not_zip')) }}
    {% endif %}

    {% if invalid_uploaded_malcontent is defined %}
      {{ error_note(_('web_ui.err.invalid_uploaded_malcontent')) }}
    {% endif %}

    <input id="items_zipfile" name="items_zipfile" type="file"
           accept=".zip,application/zip" required=""
           class="block-with-bottom-margin">

    <label class="green-button block-with-bottom-margin" for="items_zipfile">
      {{ _('web_ui.import.choose_zipfile_button') }}
    </label>

    <div class="horizontal-separator"></div>

    <div class="flex-row">
      <button class="green-button">
        {{ _('web_ui.import.install_from_file_button') }}
      </button>
    </div>
  </form>

  <div class="horizontal-separator"></div>

  <h4>{{ _('web_ui.import.heading_import_ad_hoc') }}</h4>

  {% if invalid_ad_hoc_package is defined %}
    {{ error_note(_('web_ui.err.invalid_ad_hoc_package')) }}
  {% endif %}

  <form method="POST">
    <input name="action" type="hidden" value="import_ad_hoc">

    {{ label(_('web_ui.import.identifier_field_label'), 'identifier') }}
    {% if invalid_ad_hoc_identifier is defined %}
      {{ error_note(_('web_ui.err.invalid_ad_hoc_identifier')) }}
    {% endif %}
    {{ form_field('identifier') }}

    {{ label(_('web_ui.import.long_name_field_label'), 'long_name') }}
    {{ form_field('long_name', required=false) }}

    {{ label(_('web_ui.import.version_field_label'), 'version') }}
    {% if invalid_ad_hoc_version is defined %}
      {{ error_note(_('web_ui.err.invalid_ad_hoc_version')) }}
    {% endif %}
    {{ form_field('version', required=false) }}

    {{ label(_('web_ui.import.description_field_label'), 'description') }}
    {{ form_field('description', required=false, height=3) }}

    {% call label(_('web_ui.import.patterns_field_label'), 'patterns') %}
      {{ hkt_doc_link('url_patterns') }}
    {% endcall %}
    {% if invalid_ad_hoc_patterns is defined %}
      {{ error_note(_('web_ui.err.invalid_ad_hoc_patterns')) }}
    {% endif %}
    {{ form_field('patterns', height=3, initial_value=pattern|default(none)) }}

    {{ label(_('web_ui.import.script_text_field_label'), 'script_text') }}
    {{ form_field('script_text', required=false, height=15) }}

    {{ label(_('web_ui.import.lic_text_field_label'), 'license_text') }}
    {{ form_field('license_text', required=false, height=10) }}

    <div class="flex-row">
      <button class="green-button">
        {{ _('web_ui.import.install_ad_hoc_button') }}
      </button>
    </div>
  </form>
{% endblock %}