Bug 34913: DataTables upgrade: Update CSS and option names
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / koha2marclinks.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7     [% t("Koha to MARC mapping") | html %] &rsaquo;
8     [% t("Administration") | html %] &rsaquo;
9     [% t("Koha") | html %]
10 [% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 </head>
13
14 <body id="admin_koha2marclinks" class="admin">
15 [% WRAPPER 'header.inc' %]
16     [% INCLUDE 'prefs-admin-search.inc' %]
17 [% END %]
18
19 [% WRAPPER 'sub-header.inc' %]
20     [% WRAPPER breadcrumbs %]
21         [% WRAPPER breadcrumb_item %]
22             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
23         [% END %]
24         [% WRAPPER breadcrumb_item bc_active= 1 %]
25             <span>Koha to MARC mapping</span>
26         [% END %]
27     [% END #/ WRAPPER breadcrumbs %]
28 [% END #/ WRAPPER sub-header.inc %]
29
30 <div class="main container-fluid">
31     <div class="row">
32         <div class="col-sm-10 col-sm-push-2">
33             <main>
34
35 <h1>Koha to MARC mapping</h1>
36
37 <div class="dialog message">If you make any change to the mappings, you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</div>
38 <form action="/cgi-bin/koha/admin/koha2marclinks.pl" method="post" id="koha2marc">
39
40 [% IF error_add %]
41     <div class="dialog alert">Failed to add mapping for [% error_info | html %]</div>
42 [% END %]
43
44 <div class="page-section">
45 <table id="kohafields">
46 <thead><tr>
47     <th>Koha field</th>
48     <th>Tag</th>
49     <th>Subfield</th>
50     <th>Lib</th>
51     <th>&nbsp;</th>
52 </tr></thead>
53 <tbody>
54 [% FOREACH loo IN loop %]
55 <tr>
56     <td>[% loo.kohafield | html %]</td>
57     <td>[% loo.tagfield | html %]</td>
58     <td>[% loo.tagsubfield | html %]</td>
59     <td>[% loo.liblibrarian | html %]</td>
60     <td class="actions">
61         [% IF !loo.readonly %]
62             <a href="#" data-kohafield="[% loo.kohafield | html %]" class="addfld btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</a>
63             [% IF loo.tagfield %]
64                 <a href="#" data-tagfield="[% loo.tagfield | html %]" data-tagsubfield="[% loo.tagsubfield | html %]" class="remfld btn btn-default btn-xs"><i class="fa fa-trash-can"></i> Remove</a>
65             [% END %]
66         [% END %]
67     </td>
68     </td>
69 </tr>
70 [% END %]
71 </tbody>
72 </table>
73 </div> <!-- /.page-section -->
74 <input id="remove_field" name="remove_field" type="hidden" value=""/>
75 <input id="add_field" name="add_field" type="hidden" value=""/>
76
77 </form>
78
79             </main>
80         </div> <!-- /.col-sm-10.col-sm-push-2 -->
81
82         <div class="col-sm-2 col-sm-pull-10">
83             <aside>
84                 [% INCLUDE 'admin-menu.inc' %]
85             </aside>
86         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
87      </div> <!-- /.row -->
88
89 [% MACRO jsinclude BLOCK %]
90     [% INCLUDE 'datatables.inc' %]
91     [% Asset.js("js/admin-menu.js") | $raw %]
92     <script>
93         function AddFld(kohafield) {
94             var fieldstr = prompt( _("Adding a mapping for: %s.").format(kohafield) + "\n" + _("Please enter field tag and subfield code, separated by a comma. (For control fields: add '@' as subfield code.)") + "\n" + _("The change will be applied immediately.") );
95             if( fieldstr ){
96                 var temp = fieldstr.split(',');
97                 if( temp.length == 2 ) {
98                     $('#add_field').val( kohafield+','+fieldstr );
99                     $('#koha2marc').submit();
100                 } else {
101                     alert( _("Invalid input. Enter something like: 245,a") );
102                 }
103             }
104         }
105
106         function RemFld(tagfield, subfield ) {
107             if( confirm( _("Mapping will be removed for: %s.").format(tagfield + subfield) + "\n" + _("The change will be applied immediately." ))) {
108                 $('#remove_field').val(tagfield+','+subfield);
109                 $('#koha2marc').submit();
110             }
111         }
112         $(document).ready(function() {
113             $("#kohafields").dataTable($.extend(true, {}, dataTablesDefaults, {
114                 "columnDefs": [
115                     { "targets": [ -1 ], "orderable": false, "searchable":  false },
116                 ],
117                 "paging":   false
118             } ));
119
120             $(".addfld").on("click", function(e){
121                 e.preventDefault();
122                 const kohafield = $(this).data("kohafield");
123                 AddFld( kohafield );
124             });
125
126             $(".remfld").on("click", function(e){
127                 e.preventDefault();
128                 const tagfield = $(this).data("tagfield");
129                 const tagsubfield = $(this).data("tagsubfield");
130                 RemFld( tagfield, tagsubfield );
131             });
132          });
133     </script>
134 [% END %]
135 [% INCLUDE 'intranet-bottom.inc' %]