Bug 11401: Add support for Norwegian national library card
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / biblio_framework.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; MARC frameworks
3 [% IF ( add_form ) %]
4 &rsaquo; [% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]
5 [% ELSIF ( delete_confirm ) %]
6 &rsaquo; Delete framework for [% frameworktext %] ([% frameworkcode %])?
7 [% END %]
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <script type="text/javascript">
11 /* Import/Export from/to spreadsheet */
12
13     var importing = false;
14
15     $(document).ready(function() {
16         $("body").css("cursor", "auto");
17         $('.import_export_options').hide();
18         $('a.import_export_fw').click(function() {
19             if (!importing) {
20                 $('.import_export_options').hide();
21                 $(this).next().show('slide');
22             }
23             return false;
24         });
25         $('.import_export_close').click(function() {
26             if (!importing) {
27                 $('.import_export_options').fadeOut('fast');
28                 $("body").css("cursor", "auto");
29                 return false;
30             }
31         });
32         $('.input_import').val("");
33
34         var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
35         if (matches && matches.length > 1) {
36             alert(_("Error importing the framework %s").format(decodeURIComponent(matches[1])));
37         }
38
39         $('input.input_import').change( function() {
40             var filename = $(this).val();
41             if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
42                 $(this).css("background-color","yellow");
43                 alert(_("Please select an ods or xml file"));
44                 $(this).val("");
45                 $(this).css("background-color","white");
46             }
47         });
48         $('form.form_export').submit(function() {
49             $('.modal').modal("hide");
50             return true;
51         });
52         $('form.form_import').submit(function() {
53             var id = $(this).attr('id');
54             var obj = $('#' + id + ' input:file');
55             if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
56                 if (confirm(_("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) {
57                     var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
58                     $('#importing_' + frameworkcode).find("span").html(_("Importing to framework: %s. Importing from file: %s").format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
59                     if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
60                         var timestamp = new Date().getTime();
61                         $('#importing_' + frameworkcode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp);
62                     }
63                     $('#importing_' + frameworkcode).css('display', 'block');
64                     if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
65                     importing = true;
66                     $(".modal-footer,.closebtn").hide();
67                     return true;
68                 } else
69                     return false;
70             }
71             obj.css("background-color","yellow");
72             alert(_("Please select an spreadsheet (csv, ods, xml) file"));
73             obj.val("");
74             obj.css("background-color","white");
75             return false;
76         });
77     });
78
79 </script>
80
81 </head>
82 <body id="admin_biblio_framework" class="admin">
83 [% INCLUDE 'header.inc' %]
84 [% INCLUDE 'cat-search.inc' %]
85
86 <div id="breadcrumbs">
87         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
88 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
89 &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
90 [% IF ( add_form ) %]
91 &rsaquo; [% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]
92 [% ELSIF ( delete_confirm ) %]
93 &rsaquo; Delete framework for [% frameworktext %] ([% frameworkcode %])?
94 [% END %]
95 </div>
96
97 <div id="doc3" class="yui-t2">
98   <div id="bd">
99     <div id="yui-main">
100       <div class="yui-b">
101
102 [% IF ( else ) %]
103 <div id="toolbar" class="btn-toolbar">
104     <a class="btn btn-small" id="newframework" href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form"><i class="icon-plus"></i> New framework</a>
105 </div>
106 [% END %]
107
108 [% IF ( add_form ) %]
109     <h1>[% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]</h1>
110     <form action="[% script_name %]" name="Aform" method="post" class="validated">
111         <input type="hidden" name="op" value="add_validate" />
112     <fieldset class="rows">
113     <ol>
114         [% IF ( frameworkcode ) %]
115         <li><span class="label">Framework code: </span><input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode %]" />[% frameworkcode %]
116             <input type="hidden" name="modif" value="1" />
117         </li>
118         [% ELSE %]
119         <li>
120             <label for="frameworkcode" class="required">Framework code: </label>
121             <input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" required="required" class="required" />
122             <span class="required">Required</span>
123     </li>
124         [% END %]
125         <li>
126             <label for="description" class="required">Description: </label>
127             <input type="text" name="frameworktext" id="description" size="40" maxlength="80" value="[% frameworktext |html %]" required="required" class="required" />
128             <span class="required">Required</span>
129         </li>
130     </ol>
131     </fieldset>
132     <fieldset class="action"><input type="submit" value="Submit" class="submit" /></fieldset>
133     </form>
134 [% END %]
135
136 [% IF ( delete_confirm ) %]
137 <div class="dialog alert">
138     <h3>Delete framework for [% frameworktext %] ([% frameworkcode %])?</h3>
139     [% IF ( total ) %]
140        <p><strong>This framework is used [% total %] times</strong>.</p>
141     [% END %]
142     <form class="inline" action="[% script_name %]" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /><input type="submit" class="approve" value="Yes, delete this framework!" />
143     </form>
144     <form class="inline" action="[% script_name %]" method="get"><input type="submit" class="deny" value="No, do not delete!" /></form>
145 </div>
146 [% END %]
147
148 [% IF ( else ) %]
149 <h1>MARC frameworks</h1>
150 <p>Framework name, then go to MARC biblio to set MARC editor parameters</p>
151 <table>
152     <tr>
153         <th>Code</th>
154         <th>Description</th>
155         <th>&nbsp;</th>
156         <th>Edit</th>
157         <th>Delete</th>
158         <th title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)">Export</th>
159         <th title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)">Import</th>
160     </tr>
161     <tr>
162         <td>&nbsp;</td>
163         <td>Default framework</td>
164         <td><a href="marctagstructure.pl?frameworkcode=[% frameworkcode %]">MARC structure</a></td>
165         <td>&nbsp;</td>
166         <td>&nbsp;</td>
167         <td>
168
169             <!-- Button to trigger modal -->
170             <a href="#" data-toggle="modal" data-target="#exportModal_[% frameworkcode %]">Export</a>
171             <!-- Modal -->
172             <div class="modal hide" id="exportModal_[% frameworkcode %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% frameworkcode %]" aria-hidden="true">
173                 <div class="modal-header">
174                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
175                     <h3 id="exportLabelexportModal_[% frameworkcode %]">Export default framework</h3>
176                 </div>
177                 <form action="import_export_framework.pl" name="form_[% frameworkcode %]" method="get" target="_blank"  class="form_export">
178                     <div class="modal-body">
179                         <fieldset>
180                             <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
181                             <p><label for="csv_type_export_[% frameworkcode %]"><input type="radio" name="type_export_[% frameworkcode %]" value="csv" id="csv_type_export_[% frameworkcode %]" checked="checked" /> Export to CSV spreadsheet</label></p>
182                             <p><label for="xml_type_export_[% frameworkcode %]"><input type="radio" name="type_export_[% frameworkcode %]" value="excel" id="xml_type_export_[% frameworkcode %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
183                             <p><label for="ods_type_export_[% frameworkcode %]"><input type="radio" name="type_export_[% frameworkcode %]" value="ods" id="ods_type_export_[% frameworkcode %]" /> Export to OpenDocument spreadsheet format</label></p>
184
185                         </fieldset>
186                     </div>
187                     <div class="modal-footer">
188                         <button type="submit" class="btn">Export</button>
189                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
190                     </div>
191                 </form>
192             </div>
193
194         </td>
195         <td>
196
197             <!-- Button to trigger modal -->
198             <a href="#" data-toggle="modal" data-target="#importModal_[% frameworkcode %][% loop.count %]">Import</a>
199             <!-- Modal -->
200             <div class="modal hide" id="importModal_[% frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% frameworkcode %][% loop.count %]" aria-hidden="true">
201                 <div class="modal-header">
202                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
203                     <h3 id="importLabelexportModal_[% frameworkcode %][% loop.count %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
204                 </div>
205                 <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% frameworkcode %]" id="form_i_[% frameworkcode %]" method="post" enctype="multipart/form-data" class="form_import">
206                     <div class="modal-body">
207                             <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
208                             <input type="hidden" name="action" value="import" />
209                             <p><label for="file_import_[% frameworkcode %]">Upload file:</label> <input type="file" name="file_import_[% frameworkcode %]" id="file_import_[% frameworkcode %]" class="input_import" /></p>
210                             <div id="importing_[% frameworkcode %]" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
211                     </div>
212                     <div class="modal-footer">
213                         <button type="submit" class="btn">Import</button>
214                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
215                     </div>
216                 </form>
217             </div>
218
219         </td>
220     </tr>
221     <!-- note highlight assignment appears backwards because we already have a normal row for Default -->
222     [% FOREACH loo IN loop %]
223         <tr>
224             <td>[% loo.frameworkcode %]</td>
225             <td>[% loo.frameworktext %]</td>
226             <td><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]" >MARC structure</a></td>
227             <td><a href="[% loo.script_name %]?op=add_form&amp;frameworkcode=[% loo.frameworkcode |html %]">Edit</a></td>
228             <td><a href="[% loo.script_name %]?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode |html %]">Delete</a></td>
229             <td>
230
231                 <!-- Button to trigger modal -->
232                 <a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode %][% loop.count %]">Export</a>
233                 <!-- Modal -->
234                 <div class="modal hide" id="exportModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
235                     <div class="modal-header">
236                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
237                         <h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext %] framework</h3>
238                     </div>
239                     <form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank"  class="form_export">
240                         <div class="modal-body">
241                             <fieldset>
242                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
243                                 <p><label for="csv_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="csv" id="csv_type_export_[% loo.frameworkcode %][% loop.count %]" checked="checked" /> Export to CSV spreadsheet</label></p>
244                                 <p><label for="xml_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="excel" id="xml_type_export_[% loo.frameworkcode %][% loop.count %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
245                                 <p><label for="ods_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="ods" id="ods_type_export_[% loo.frameworkcode %][% loop.count %]" /> Export to OpenDocument spreadsheet format</label></p>
246
247                             </fieldset>
248                         </div>
249                         <div class="modal-footer">
250                             <button type="submit" class="btn">Export</button>
251                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
252                         </div>
253                     </form>
254                 </div>
255             </td>
256             <td>
257
258                 <!-- Button to trigger modal -->
259                 <a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode %][% loop.count %]">Import</a>
260                 <!-- Modal -->
261                 <div class="modal hide" id="importModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
262                     <div class="modal-header">
263                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
264                         <h3 id="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Import [% loo.frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
265                     </div>
266                     <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% loo.frameworkcode %]" id="form_i_[% loo.frameworkcode %]" method="post" enctype="multipart/form-data" class="form_import">
267                         <div class="modal-body">
268                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
269                                 <input type="hidden" name="action" value="import" />
270                                 <p><label for="file_import_[% loo.frameworkcode %]">Upload file:</label> <input type="file" name="file_import_[% loo.frameworkcode %]" id="file_import_[% loo.frameworkcode %]" class="input_import" /></p>
271                                 <div id="importing_[% loo.frameworkcode %]" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
272                         </div>
273                         <div class="modal-footer">
274                             <button type="submit" class="btn">Import</button>
275                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
276                         </div>
277                     </form>
278                 </div>
279         </td>
280         </tr>
281     [% END %]
282 </table>
283     [% IF ( previous ) %]<a href="[% previous %]">&lt;&lt; Previous</a>[% END %]
284     [% IF ( next ) %]<a href="[% next %]">Next &gt;&gt;</a>[% END %]
285
286 [% END %]
287     </div>
288   </div>
289 <div class="yui-b">
290 [% INCLUDE 'admin-menu.inc' %]
291   </div>
292 </div>
293 [% INCLUDE 'intranet-bottom.inc' %]