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