Files
Phraseanet/templates/web/admin/user/import/file.html.twig
Romain Neutron ec11550eab Update templates
2012-10-04 15:42:53 +02:00

74 lines
2.7 KiB
Twig
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<h1>{% trans 'Upload a "csv" file for users creation' %}</h1>
</div>
{% if app['request'].query.get('error') is not none %}
{% set error = app['request'].query.get('error') %}
<div class="alert alert-error">
<button class="close" data-dismiss="alert" type="button">×</button>
{% if error == 'file-invalid' %}
{% trans 'An error occured while upload the file. Please retry' %}
{% elseif error == 'row-login' %}
{% trans 'Row "login" is missing, script has stopped' %}
{% elseif error == 'row-pwd' %}
{% trans 'Row "password" is missing, script has stopped' %}
{% elseif error == 'no-user' %}
{% trans 'The file does not contains any user to add' %}
{% endif %}
</div>
{% endif %}
{% if errors is defined and errors is not none and errors|length > 0 %}
<div class="alert alert-error">
<button class="close" data-dismiss="alert" type="button">×</button>
<ul class="unstyled">
{% for error in errors %}
<li>{{ error }}</li>
{% endfor%}
</ul>
</div>
{% endif %}
<div>
<div class="well well-small">
<a href="/admin/users/import/example/csv/"> <i class="icon-share"></i> {% trans 'You can download an example by clicking here' %}</a>
</div>
<div class="well well-small">
<a href="/admin/users/import/example/rtf/"> <i class="icon-share"></i> {% trans 'You can download the documentation here' %}</a>
</div>
<span class="label" style="display:inline-block;" >
<i class="icon-plus icon-white"></i>
<span>{% trans 'Select a file' %}</span>
<input id="fileupload" type="file" name="files" data-url="/admin/users/import/file/" accept="text/csv, text/rtf">
</span>
<a href="/admin/users/search/" class="btn ajax">{% trans 'boutton::retour' %}</a>
</div>
<script>
$(function () {
$('#fileupload').fileupload({
dataType: 'html',
add: function(e, data) {
if( ! /(\.|\/)(csv|rtf)$/i.test(data.files[0].type)) {
{% set supported_file_types = ['csv', 'rtf']|join(' | ') %}
alert("{% trans %} Invalid file type, only ({{ supported_file_types }}) file formats are supported {% endtrans %}");
return false;
}
data.submit();
},
submit: function(e, data) {
$('#right-ajax').empty().addClass('loading');
},
done: function (e, data) {
$('#right-ajax').removeClass('loading').html(data.result);
enableForms($('#right-ajax form:not(.no-ajax)'));
$.each($('#right-ajax a'),function(i, el){
enableLink($(el));
});
}
});
});
</script>