Move file_option.twig into import.twig

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-11-29 20:47:23 -02:00
parent 3202480c7b
commit 55641774f6
2 changed files with 73 additions and 87 deletions

View File

@ -1,73 +0,0 @@
<div class="importoptions">
<h3>{% trans 'File to import:' %}</h3>
{# We don't have show anything about compression, when no supported #}
{% if compressions is not empty %}
<div class="formelementrow" id="compression_info">
<p>
{{ 'File may be compressed (%s) or uncompressed.'|trans|format(compressions|join(', ')) }}
<br>
{% trans 'A compressed file\'s name must end in <strong>.[format].[compression]</strong>. Example: <strong>.sql.zip</strong>' %}
</p>
</div>
{% endif %}
<div class="formelementrow" id="upload_form">
{% if is_upload and upload_dir is not empty %}
<ul>
<li>
<input type="radio" name="file_location" id="radio_import_file" required="required" />
{{ Util_getBrowseUploadFileBlock(max_upload_size) }}
{% trans 'You may also drag and drop a file on any page.' %}
</li>
<li>
<input type="radio" name="file_location" id="radio_local_import_file"
{%- if timeout_passed_global is not empty and local_import_file is not empty %}
checked="checked"
{%- endif %} />
{{ Util_getSelectUploadFileBlock(
import_list,
upload_dir
) }}
</li>
</ul>
{% elseif is_upload %}
{{ Util_getBrowseUploadFileBlock(max_upload_size) }}
<p>{% trans 'You may also drag and drop a file on any page.' %}</p>
{% elseif not is_upload %}
{{ Message_notice('File uploads are not allowed on this server.'|trans) }}
{% elseif upload_dir is not empty %}
{{ Util_getSelectUploadFileBlock(
import_list,
upload_dir
) }}
{% endif %}
</div>
<div class="formelementrow" id="charaset_of_file">
{# Charset of file #}
<label for="charset_of_file">{% trans 'Character set of the file:' %}</label>
{% if is_encoding_supported %}
<select id="charset_of_file" name="charset_of_file" size="1">
{% for charset in encodings %}
<option value="{{ charset }}"
{% if (import_charset is empty and charset == 'utf-8')
or charset == import_charset %}
selected="selected"
{% endif %}>
{{ charset }}
</option>
{% endfor %}
</select>
{% else %}
{{ Charsets_getCharsetDropdownBox(
dbi,
disable_is,
'charset_of_file',
'charset_of_file',
'utf8',
false
) }}
{% endif %}
</div>
</div>

View File

@ -36,20 +36,79 @@
'table': table
} only %}
{% include 'display/import/file_option.twig' with {
'max_upload_size': max_upload_size,
'import_list': import_list,
'local_import_file': local_import_file,
'is_upload': is_upload,
'upload_dir': upload_dir,
'timeout_passed_global': timeout_passed_global,
'compressions': compressions,
'is_encoding_supported': is_encoding_supported,
'encodings': encodings,
'import_charset': import_charset,
'dbi': dbi,
'disable_is': disable_is
} only %}
<div class="importoptions">
<h3>{% trans 'File to import:' %}</h3>
{# We don't have show anything about compression, when no supported #}
{% if compressions is not empty %}
<div class="formelementrow" id="compression_info">
<p>
{{ 'File may be compressed (%s) or uncompressed.'|trans|format(compressions|join(', ')) }}
<br>
{% trans 'A compressed file\'s name must end in <strong>.[format].[compression]</strong>. Example: <strong>.sql.zip</strong>' %}
</p>
</div>
{% endif %}
<div class="formelementrow" id="upload_form">
{% if is_upload and upload_dir is not empty %}
<ul>
<li>
<input type="radio" name="file_location" id="radio_import_file" required="required" />
{{ Util_getBrowseUploadFileBlock(max_upload_size) }}
{% trans 'You may also drag and drop a file on any page.' %}
</li>
<li>
<input type="radio" name="file_location" id="radio_local_import_file"
{%- if timeout_passed_global is not empty and local_import_file is not empty %}
checked="checked"
{%- endif %} />
{{ Util_getSelectUploadFileBlock(
import_list,
upload_dir
) }}
</li>
</ul>
{% elseif is_upload %}
{{ Util_getBrowseUploadFileBlock(max_upload_size) }}
<p>{% trans 'You may also drag and drop a file on any page.' %}</p>
{% elseif not is_upload %}
{{ Message_notice('File uploads are not allowed on this server.'|trans) }}
{% elseif upload_dir is not empty %}
{{ Util_getSelectUploadFileBlock(
import_list,
upload_dir
) }}
{% endif %}
</div>
<div class="formelementrow" id="charaset_of_file">
{# Charset of file #}
<label for="charset_of_file">{% trans 'Character set of the file:' %}</label>
{% if is_encoding_supported %}
<select id="charset_of_file" name="charset_of_file" size="1">
{% for charset in encodings %}
<option value="{{ charset }}"
{% if (import_charset is empty and charset == 'utf-8')
or charset == import_charset %}
selected="selected"
{% endif %}>
{{ charset }}
</option>
{% endfor %}
</select>
{% else %}
{{ Charsets_getCharsetDropdownBox(
dbi,
disable_is,
'charset_of_file',
'charset_of_file',
'utf8',
false
) }}
{% endif %}
</div>
</div>
<div class="importoptions">
<h3>{% trans 'Partial import:' %}</h3>