1 {extends file="page.tpl"}
6 href="{path_for name="importModel"}"
9 <i class="fas fa-cogs" aria-hidden="true"></i>
10 {_T string="Configure import model"}
13 <form class="form" action="{path_for name="doImport"}" method="post">
15 <legend class="ui-state-active ui-corner-top">{_T string="Existing files"}</legend>
16 <div class="warningbox">
17 {_T string="Warning: Don't forget to backup your current database."}
20 {if $existing|@count gt 0}
21 <p>{_T string="The following files seems ready to import on the disk:"}</p>
22 <table class="listing">
25 <th>{_T string="Name"}</th>
26 <th>{_T string="Date"}</th>
27 <th>{_T string="Size"}</th>
28 <th class="actions_row"></th>
32 {foreach item=import from=$existing name=existing_list}
33 <tr class="{if $smarty.foreach.existing_list.iteration % 2 eq 0}even{else}odd{/if}">
35 <input type="radio" name="import_file" id="file{$smarty.foreach.existing_list.iteration}" value="{$import.name}"{if isset($import_file) and $import_file eq $import.name} checked="checked"{/if}/>
36 <label for="file{$smarty.foreach.existing_list.iteration}">{$import.name}</label> (<a href="{path_for name="getCsv" data=["type" => "import", "file" => $import.name]}">{_T string="see"}</a>)
38 <td data-title="{_T string="Date"}">
41 <td data-title="{_T string="Size"}">
44 <td class="actions_row">
46 href="{path_for name="removeCsv" data=["type" => "import", "file" => $import.name]}"
47 class="delete tooltip"
49 <i class="fas fa-trash"></i>
50 <span class="sr-only">{_T string="Remove '%file' from disk" pattern="/%file/" replace=$import.name}</span>
57 <div class="button-container">
58 <label for="dryrun" title="{_T string="Run the import process, but do *not* store anything in the database"}">{_T string="Dry run"}</label>
59 <input type="checkbox" name="dryrun" id="dryrun" value="1"{if isset($dryrun) and $dryrun eq true} checked="checked"{/if}/>
60 <button type="submit" name="import" id="import">
61 <i class="fas fa-file-import"></i>
64 {include file="forms_types/csrf.tpl"}
67 <p>{_T string="No import file actually exists."}<br/>{_T string="Use upload form below to send a new file on server, or copy it directly in the imports directory."}</p>
72 <form class="form" action="{path_for name="uploadImportFile"}" method="post" enctype="multipart/form-data">
74 <legend class="ui-state-active ui-corner-top">{_T string="Upload new file"}</legend>
77 <label for="new_file">{_T string="Select a file:"}</label>
78 <input class="labelalign" type="file" name="new_file" accept="text/csv" id="new_file"/>
80 <div class="button-container">
81 <button type="submit" name="upload" id="upload">
82 <i class="fas fa-upload" aria-hidd="true"></i>
83 {_T string="Upload file"}
85 {include file="forms_types/csrf.tpl"}
92 {block name="javascripts"}
93 <script type="text/javascript">
95 _collapsibleFieldsets();
96 //bind import click to check if one is selected
97 $('#import').on('click', function(){
98 if ( $('input[name=import_file]:checked').length > 0 ) {
101 var _el = $('<div id="pleaseselect" title="{_T string="No file selected" escape="js"}">{_T string="Please make sure to select one file to import." escape="js"}</div>');
102 _el.appendTo('body').dialog({
106 $(this).dialog( "close" );
109 close: function(event, ui){
117 $('#upload').click(function(){
118 var _selected = $('#new_file')[0].files.length;
119 if ( _selected == 0 ) {
120 var _el = $('<div id="pleaseupload" title="{_T string="No file to upload" escape="js"}">{_T string="Please make sure to select one file to upload." escape="js"}</div>');
121 _el.appendTo('body').dialog({
125 $(this).dialog( "close" );
128 close: function(event, ui){
138 {include file="js_removal.tpl"}