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