Bug 15846: Move MARC Framework JavaScript into separate file
[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 op == 'add_form' %]
4 &rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
5 [% ELSIF op == 'delete_confirm' %]
6 &rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
7 [% END %]
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
11 [% INCLUDE 'datatables.inc' %]
12 <script type="text/javascript">
13     /* Set some variable needed in biblio_framework.js */
14     var MSG_IMPORT_ERROR = _("Error importing the framework");
15     var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.");
16     var MSG_OVERWRITE_WARNING = _("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");
17     var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s.");
18     var template_path = "[% interface %]/[% theme %]";
19 </script>
20 <script type="text/javascript" src="[% themelang %]/js/biblio_framework.js"></script>
21
22 </head>
23 <body id="admin_biblio_framework" class="admin">
24 [% INCLUDE 'header.inc' %]
25 [% INCLUDE 'cat-search.inc' %]
26
27 <div id="breadcrumbs">
28         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
29 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
30 &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
31 [% IF op == 'add_form' %]
32 &rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
33 [% ELSIF op == 'delete_confirm' %]
34 &rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
35 [% END %]
36 </div>
37
38 <div id="doc3" class="yui-t2">
39   <div id="bd">
40     <div id="yui-main">
41       <div class="yui-b">
42
43 [% FOR m IN messages %]
44     <div class="dialog [% m.type %]">
45         [% SWITCH m.code %]
46         [% CASE 'error_on_update' %]
47             An error occurred when updating this framework. Perhaps it already exists.
48         [% CASE 'error_on_insert' %]
49             An error occurred when adding this framework. The framework might already exist.
50         [% CASE 'error_on_delete' %]
51             An error occurred when deleting this framework. Check the logs.
52         [% CASE 'success_on_update' %]
53             Framework updated successfully.
54         [% CASE 'success_on_insert' %]
55             Framework added successfully.
56         [% CASE 'success_on_delete' %]
57             Framework deleted successfully.
58         [% CASE 'already_exists' %]
59             This framework code already exists.
60         [% CASE %]
61             [% m.code %]
62         [% END %]
63     </div>
64 [% END %]
65
66
67
68 [% IF op == 'list'%]
69     <div id="toolbar" class="btn-toolbar">
70         <a class="btn btn-small" id="newframework" href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form"><i class="fa fa-plus"></i> New framework</a>
71     </div>
72 [% END %]
73
74 [% IF op == 'add_form' %]
75     <h1>[% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]</h1>
76     <form action="/cgi-bin/koha/admin/biblio_framework.pl" name="Aform" method="post" class="validated">
77         <input type="hidden" name="op" value="add_validate" />
78         <fieldset class="rows">
79             <ol>
80                 [% IF framework %]
81                     <li>
82                         <span class="label">Framework code: </span>
83                         <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% framework.frameworkcode %]" />[% framework.frameworkcode %]
84                         <input type="hidden" name="is_a_modif" value="1" />
85                     </li>
86                 [% ELSE %]
87                     <li>
88                         <label for="frameworkcode" class="required">Framework code: </label>
89                         <input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" required="required" class="required" />
90                         <span class="required">Required</span>
91                     </li>
92                 [% END %]
93                 <li>
94                     <label for="description" class="required">Description: </label>
95                     <input type="text" name="frameworktext" id="description" size="40" maxlength="80" value="[% framework.frameworktext |html %]" required="required" class="required" />
96                     <span class="required">Required</span>
97                 </li>
98             </ol>
99         </fieldset>
100         <fieldset class="action">
101             <input type="submit" value="Submit" class="submit" />
102         </fieldset>
103     </form>
104 [% END %]
105
106 [% IF op == 'delete_confirm' %]
107     <div class="dialog alert">
108         [% IF biblios_use_this_framework %]
109             <h3>This framework cannot be deleted</h3>
110             <p><strong><span class="ex">[% framework.frameworktext %] ([% framework.frameworkcode %])</span></strong></p>
111             <p>The framework is used [% biblios_use_this_framework %] times.</p>
112             <form action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
113                 <button type="submit"><i class="fa fa-fw fa-arrow-left"></i> Return to frameworks</button>
114             </form>
115         [% ELSE %]
116             <h3>Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?</h3>
117             <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="post">
118                 <input type="hidden" name="op" value="delete_confirmed" />
119                 <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
120                 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this framework</button>
121             </form>
122             <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
123                 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
124             </form>
125         [% END %]
126     </div>
127 [% END %]
128
129 [% IF op == 'list' %]
130 <h1>MARC frameworks</h1>
131 <p>Framework name, then go to MARC biblio to set MARC editor parameters</p>
132 <table id="table_biblio_frameworks">
133     <thead>
134     <tr>
135         <th>Code</th>
136         <th>Description</th>
137         <th>&nbsp;</th>
138     </tr>
139     </thead>
140     <tbody>
141     <tr>
142         <td>&nbsp;</td>
143         <td>Default framework</td>
144         <td>
145           <div class="dropdown">
146             <a class="btn btn-mini dropdown-toggle" id="frameworkactions[% loo.frameworkcode %]" role="button" data-toggle="dropdown" href="#">
147               Actions <b class="caret"></b>
148             </a>
149             <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="frameworkactions[% loo.frameworkcode %]">
150               <li><a href="marctagstructure.pl?frameworkcode="><i class="fa fa-eye"></i> MARC structure</a></li>
151               <!-- Trigger modal -->
152               <li><a href="#" data-toggle="modal" data-target="#exportModal_default" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li>
153               <!-- Trigger modal -->
154               <li><a href="#" data-toggle="modal" data-target="#importModal_[% framework.frameworkcode %][% frameworks.count %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li>
155             </ul>
156             <!-- Modal to export default framework -->
157             <div class="modal hide" id="exportModal_default" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_default" aria-hidden="true">
158               <div class="modal-header">
159                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
160                 <h3 id="exportLabelexportModal_default">Export default framework</h3>
161               </div>
162               <form action="import_export_framework.pl" name="form_defaul" method="get" target="_blank"  class="form_export">
163                 <div class="modal-body">
164                   <fieldset>
165                     <input type="hidden" name="frameworkcode" value="" />
166                     <p><label for="csv_type_export_default"><input type="radio" name="type_export_default" value="csv" id="csv_type_export_default" checked="checked" /> Export to CSV spreadsheet</label></p>
167                     <p><label for="xml_type_export_default"><input type="radio" name="type_export_default" value="excel" id="xml_type_export_default" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
168                     <p><label for="ods_type_export_default"><input type="radio" name="type_export_default" value="ods" id="ods_type_export_default" /> Export to OpenDocument spreadsheet format</label></p>
169                   </fieldset>
170                 </div>
171                 <div class="modal-footer">
172                   <button type="submit" class="btn">Export</button>
173                   <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
174                 </div>
175               </form>
176             </div>
177
178             <!-- Modal to import default framework -->
179             <div class="modal hide" id="importModal_[% framework.frameworkcode %][% frameworks.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_default[% frameworks.count %]" aria-hidden="true">
180               <div class="modal-header">
181                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
182                 <h3 id="importLabelexportModal_[% framework.frameworkcode %][% frameworks.count %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h>
183               </div>
184               <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
185                 <div class="modal-body">
186                   <input type="hidden" name="frameworkcode" value="default" />
187                   <input type="hidden" name="action" value="import" />
188                   <p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
189                     <div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
190                 </div>
191                 <div class="modal-footer">
192                   <button type="submit" class="btn">Import</button>
193                   <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
194                 </div>
195               </form>
196             </div>
197           </div>
198         </td>
199     </tr>
200
201     [% FOREACH loo IN frameworks %]
202         <tr>
203             <td>[% loo.frameworkcode %]</td>
204             <td>[% loo.frameworktext %]</td>
205             <td>
206               <div class="dropdown">
207                 <a class="btn btn-mini dropdown-toggle" id="frameworkactions[% loo.frameworkcode %]" role="button" data-toggle="dropdown" href="#">
208                   Actions <b class="caret"></b>
209                 </a>
210                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="frameworkactions[% loo.frameworkcode %]">
211                   <li><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]"><i class="fa fa-eye"></i> MARC structure</a></li>
212                   <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&amp;frameworkcode=[% loo.frameworkcode |html %]"><i class="fa fa-pencil"></i> Edit</a></li>
213                   <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode |html %]"><i class="fa fa-trash"></i> Delete</a></li>
214                   <!-- Trigger modal -->
215                   <li><a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode %][% loop.count %]" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li>
216                   <!-- Trigger modal -->
217                   <li><a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode %][% loop.count %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li>
218                 </ul>
219                 <!-- Modal to export other framework -->
220                 <div class="modal hide" id="exportModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
221                   <div class="modal-header">
222                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
223                     <h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext %] framework</h3>
224                   </div>
225                   <form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank"  class="form_export">
226                     <div class="modal-body">
227                       <fieldset>
228                         <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
229                         <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>
230                         <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>
231                         <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>
232                       </fieldset>
233                     </div>
234                     <div class="modal-footer">
235                       <button type="submit" class="btn">Export</button>
236                       <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
237                     </div>
238                   </form>
239                 </div>
240
241                 <!-- Modal to import other framework -->
242                 <div class="modal hide" id="importModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
243                   <div class="modal-header">
244                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
245                     <h3 id="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Import [% loo.frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
246                   </div>
247                   <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">
248                     <div class="modal-body">
249                       <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
250                       <input type="hidden" name="action" value="import" />
251                       <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>
252                       <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>
253                     </div>
254                     <div class="modal-footer">
255                       <button type="submit" class="btn">Import</button>
256                       <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
257                     </div>
258                   </form>
259                 </div>
260               </div>
261             </td>
262         </tr>
263
264     [% END %]
265 </table>
266
267 [% END %]
268     </div>
269   </div>
270 <div class="yui-b">
271 [% INCLUDE 'admin-menu.inc' %]
272   </div>
273 </div>
274 [% INCLUDE 'intranet-bottom.inc' %]