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