Bug 30475: Convert tools pages tabs to Bootstrap (part 2)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / export.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Export data &rsaquo; Tools &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>
9     fieldset.rows fieldset.rows {
10         width: 90%;
11     }
12 </style>
13 </head>
14
15 <body id="tools_export" class="tools">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'cat-search.inc' %]
18
19 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20     <ol>
21         <li>
22             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23         </li>
24         <li>
25             <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
26         </li>
27         <li>
28             <a href="#" aria-current="page">
29                 Export data
30             </a>
31         </li>
32     </ol>
33 </nav>
34
35 <div class="main container-fluid">
36     <div class="row">
37         <div class="col-sm-10 col-sm-push-2">
38             <main>
39
40                 <h1>Export data</h1>
41
42 [% FOR m IN messages %]
43     <div class="dialog [% m.type | html %]">
44         [% SWITCH m.code %]
45         [% CASE 'invalid_mimetype' %]<span>The file used does not have a valid format. Only csv and txt are allowed.</span>
46         [% CASE %][% m.code | html %]
47         [% END %]
48     </div>
49 [% END %]
50
51 <div id="exporttype" class="toptabs">
52     <ul class="nav nav-tabs" role="tablist">
53         <li role="presentation" class="active">
54             <a href="#bibs" aria-controls="bibs" role="tab" data-toggle="tab">Export bibliographic records</a>
55         </li>
56         <li role="presentation">
57             <a href="#auths" aria-controls="auths" role="tab" data-toggle="tab">Export authority records</a>
58         </li>
59         [% IF ( allow_db_export ) %]
60             <li role="presentation">
61                 <a href="#db" aria-controls="db" role="tab" data-toggle="tab">Export database</a>
62             </li>
63         [% END %]
64         [% IF ( allow_conf_export ) %]
65             <li role="presentation">
66                 <a href="#conf" aria-controls="conf" role="tab" data-toggle="tab">Export configuration</a>
67             </li>
68         [% END %]
69     </ul>
70     <div class="tab-content">
71         <div id="bibs" role="tabpanel" class="tab-pane active">
72         <p>
73             <strong>Note : The items are exported by this tool unless specified.</strong>
74         </p>
75
76         <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
77             <fieldset class="rows">
78             <legend> Select records to export </legend>
79                 <ol>
80                 <li>
81                     <label for="start">From biblionumber: </label>
82                     <input id="start" type="text" name="StartingBiblionumber" size="5" />
83                 </li>
84                 <li>
85                     <label for="end">To biblionumber: </label>
86                     <input id="end" type="text" name="EndingBiblionumber" size="5" />
87                 </li>
88
89                 <li>
90                     <label for="itemtype">Item type: </label>
91                     <select name="itemtype" id="itemtype">
92                         <option value="">-- All --</option>
93                         [% FOREACH itemtype IN itemtypes %]
94                             <option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
95                         [% END %]
96                     </select>
97                 </li>
98
99                 <li>
100                     <label>With items owned by the following libraries: </label>
101                     [% INCLUDE 'branch-selector.inc' branches = libraries %]
102                 </li>
103             </ol>
104
105             <fieldset class="rows">
106                 <legend>Call number range</legend>
107                 <ol>
108                     <li>
109                         <label for="startcn">From item call number: </label>
110                         <input id="startcn" type="text" name="start_callnumber" size="15" />
111                     </li>
112                     <li>
113                         <label for="endcn">To item call number: </label>
114                         <input id="endcn" type="text" name="end_callnumber" size="15" />
115                     </li>
116                 </ol>
117             </fieldset>
118
119             <fieldset class="rows">
120                 <legend>Accession date (inclusive)</legend>
121                 <ol>
122                     <li>
123                             <label for="from">Start date:</label>
124                             <input type="text" size="10" id="from" name="start_accession" value="[% from | html %]" class="flatpickr" data-date_to="to" />
125                     </li>
126                     <li>
127                         <label for="to">End date:</label>
128                         <input size="10" id="to" name="end_accession" value="[% end_accession | html %]" type="text" class="flatpickr" />
129                     </li>
130                 </ol>
131             </fieldset>
132
133             </fieldset>
134             <fieldset class="rows">
135             <legend>
136                 Use a file
137             </legend>
138                 <ol>
139                 <li>File containing a list of biblionumbers with one biblionumber per line. This list works as a filter: it is compatible with other parameters. (File types accepted: .csv and .txt)</li>
140                 <li><label for="id_list_file">File: </label> <input type="file" id="id_list_file" name="id_list_file" /></li>
141                 </ol>
142             </fieldset>
143             <fieldset class="rows">
144             <legend> Options</legend>
145         <ol>        <li>
146                 <label for="dont_export_item">Don't export items:</label>
147                 <input id="dont_export_item" type="checkbox" name="dont_export_item" />
148                 </li>
149                 <li>
150                 <label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label>
151                 <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" />
152                 </li>
153                 <li>
154                 <label for="export_remove_fields">Don't export fields:</label>
155                 <input id="export_remove_fields" type="text" name="export_remove_fields" value="[% export_remove_fields | html %]" />
156                 separate by a blank. (e.g., 100a 200 606)
157                 </li></ol>
158             </fieldset>
159             <fieldset class="rows">
160             <legend>
161                 Output format
162             </legend>
163                 <ol><li>
164                     <label for="output_format">File format: </label>
165                     <select id="output_format" name="output_format">
166                         <option value="iso2709">MARC</option>
167                         <option value="xml">XML</option>
168                         [% IF csv_profiles %]
169                             <option value="csv">CSV</option>
170                         [% ELSE %]
171                             <option value="csv" disabled data-toggle="tooltip" data-placement="left" title="You must create a CSV profile for MARC exports to use this option.">CSV</option>
172                         [% END %]
173                     </select>
174                 </li>
175                 <li class="csv_profiles">
176                     <label for="bibs_csv_profile">CSV profile: </label>
177                     <select id="bibs_csv_profile" name="csv_profile_id">
178                         [% FOR csv_profile IN csv_profiles %]
179                             <option value="[% csv_profile.export_format_id | html %]">[% csv_profile.profile | html %]</option>
180                         [% END %]
181                     </select>
182                 </li>
183                 <li>
184                 <label for="filename">File name:</label><input id="filename" type="text" name="filename" value="koha.mrc" />
185                 </li></ol>
186             </fieldset>
187             <input type="hidden" name="op" value="export" />
188             <input type="hidden" name="record_type" value="bibs" />
189
190             <fieldset class="action"><input type="submit" value="Export bibliographic records" class="button" /></fieldset>
191         </form>
192         </div>
193
194         <div id="auths" role="tabpanel" class="tab-pane">
195         <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/export.pl">
196             <fieldset class="rows">
197             <legend> Select records to export </legend>
198                 <ol><li>
199                     <label for="start">From authid: </label>
200                     <input id="start" type="text" name="starting_authid" size="6" />
201                 </li>
202                 <li>
203                     <label for="end">To authid: </label>
204                     <input id="end" type="text" name="ending_authid" size="6" />
205                 </li>
206                 <li>
207                     <label for="authtype">Authority type: </label>
208                     <select name="authtype" id="authtype">
209                         <option value="">-- All --</option>
210                         [% FOREACH authority_type IN authority_types %]
211                             <option value="[% authority_type.authtypecode | html %]">[% authority_type.authtypetext | html %]</option>
212                         [% END %]
213                     </select>
214                 </li>
215                 </ol>
216             </fieldset>
217             <fieldset class="rows">
218             <legend>
219                 Use a file
220             </legend>
221                 <ol>
222                 <li>File containing a list of authids with one authid per line. This list works as a filter: it is compatible with other parameters. (File types accepted: .csv and .txt)</li>
223                 <li><label for="id_list_file">File:</label> <input type="file" id="id_list_file" name="id_list_file" /></li>
224                 </ol>
225             </fieldset>
226             <fieldset class="rows">
227             <legend>Options</legend>
228                 <ol>
229                 <li>
230                     <label for="export_remove_fields">Don't export fields:</label>
231                     <input id="export_remove_fields" type="text" name="export_remove_fields" />
232                     separate by a blank. (e.g., 100a 200 606)
233                 </li></ol>
234             </fieldset>
235             <fieldset class="rows">
236             <legend>Output format</legend>
237                 <ol><li>
238                     <label for="output_format">File format: </label>
239                     <select id="output_format_auth" name="output_format">
240                         <option value="marc">MARC</option>
241                         <option value="xml">XML</option>
242                     </select>
243                 </li>
244                 <li>
245                 <label for="filename_auth">File name:</label><input id="filename_auth" type="text" name="filename_auth" value="koha.mrc" />
246                 </li></ol>
247             </fieldset>
248             <input type="hidden" name="op" value="export" />
249             <input type="hidden" name="record_type" value="auths" />
250
251             <fieldset class="action"><input type="submit" value="Export authority records" class="button" /></fieldset>
252         </form>
253         </div>
254
255         [% IF ( allow_db_export ) %]
256         <div id="db" role="tabpanel" class="tab-pane">
257         <form method="post" action="/cgi-bin/koha/tools/export.pl">
258             <p><strong>Note : This export file will be very large, and is generated nightly.</strong></p>
259             <fieldset class="rows">
260             <legend> Choose a file </legend>
261             [% IF ( dbfiles && (dbfiles.size > 0) ) %]
262                 <ul>
263                 [% FOREACH dbfile IN dbfiles %]
264                     <li><input type="radio" name="filename" value="[% dbfile | html %]">[% dbfile | html %]</input></li>
265                 [% END %]
266                 </ul>
267             [% ELSE %]
268                 <p>Unfortunately, no backups are available.</p>
269             [% END %]
270             </fieldset>
271
272             [% IF ( dbfiles && (dbfiles.size > 0) ) %]
273                 <input type="hidden" name="op" value="export" />
274                 <input type="hidden" name="record_type" value="db" />
275                 <fieldset class="action"><input type="submit" value="Download database" class="button" /></fieldset>
276             [% END %]
277         </form>
278         </div>
279         [% END %]
280
281         [% IF ( allow_conf_export ) %]
282         <div id="conf" role="tabpanel" class="tab-pane">
283         <form method="post" action="/cgi-bin/koha/tools/export.pl">
284             <p><strong>Note : This export file will be very large, and is generated nightly.</strong></p>
285             <fieldset class="rows">
286             <legend> Choose a file </legend>
287             [% IF ( conffiles && (conffiles.size > 0) ) %]
288                 <ul>
289                 [% FOREACH conffile IN conffiles %]
290                     <li><input type="radio" name="filename" value="[% conffile | html %]">[% conffile | html %]</input></li>
291                 [% END %]
292                 </ul>
293             [% ELSE %]
294                 <p>Unfortunately, no backups are available.</p>
295             [% END %]
296             </fieldset>
297
298             [% IF ( conffiles && (conffiles.size > 0) ) %]
299                 <input type="hidden" name="op" value="export" />
300                 <input type="hidden" name="record_type" value="conf" />
301                 <fieldset class="action"><input type="submit" value="Download configuration" class="button" /></fieldset>
302             [% END %]
303         </form>
304         </div>
305         [% END %]
306     </div> <!-- /.tab-content -->
307 </div>
308
309             </main>
310         </div> <!-- /.col-sm-10.col-sm-push-2 -->
311
312         <div class="col-sm-2 col-sm-pull-10">
313             <aside>
314                 [% INCLUDE 'tools-menu.inc' %]
315             </aside>
316         </div> <!-- .col-sm-2.col-sm-pull-10 -->
317      </div> <!-- /.row -->
318
319 [% MACRO jsinclude BLOCK %]
320     [% Asset.js("js/tools-menu.js") | $raw %]
321     [% INCLUDE 'calendar.inc' %]
322     <script>
323         $(document).ready(function() {
324
325             $("li.csv_profiles").hide();
326
327             $("#bibs select[name='output_format']").on('change', function(){
328                 var format = $(this).val();
329                 if ( format == 'csv' ) {
330                     $("#bibs li.csv_profiles").show();
331                 } else {
332                     $("#bibs li.csv_profiles").hide();
333                 }
334             });
335             $("#checkall").on("click",function(e){
336                 e.preventDefault();
337                 $(".branch_select").prop("checked",1);
338             });
339             $("#checknone").on("click",function(e){
340                 e.preventDefault();
341                 $(".branch_select").prop("checked",0);
342             });
343
344             $('#output_format').change(function(){
345                 var filename = $('#filename').val();
346                 var file_name = filename.split(".");
347                 var extension = $(this).val();
348                 if (extension == "iso2709") {
349                     extension = "mrc";
350                 }
351                 $('#filename').val(file_name[0] + "." + extension);
352             });
353             $('#output_format_auth').change(function(){
354                 var filename_auth = $('#filename_auth').val();
355                 var file_name_auth = filename_auth.split(".");
356                 var extension = $(this).val();
357                 if (extension == "marc") {
358                     extension = "mrc";
359                 }
360                 $('#filename_auth').val(file_name_auth[0] + "." + extension);
361             });
362         });
363     </script>
364 [% END %]
365
366 [% INCLUDE 'intranet-bottom.inc' %]