Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / merge.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'merge-record.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Merging records &rsaquo; Cataloging &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>
9 div.record ul, div.record li { float:none; display:block; }
10 div#result { margin-top: 1em; }
11 /* We use this style "against" the li ui-tabs-nav style automatically applied */
12 </style>
13 </head>
14
15 <body id="auth_merge" class="cat">
16 [% WRAPPER 'header.inc' %]
17     [% INCLUDE 'authorities-search.inc' %]
18 [% END %]
19
20 [% WRAPPER 'sub-header.inc' %]
21 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22     <ol>
23         <li>
24             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
28         </li>
29         <li>
30             <a href="#" aria-current="page">
31                 Merging records
32             </a>
33         </li>
34     </ol>
35 </nav>
36 [% END %]
37
38 <div class="main container-fluid">
39     <div class="row">
40         <div class="col-md-8 col-md-offset-2">
41             <main>
42
43 <h1>Merging records</h1>
44
45 [% IF ( errors ) %]
46
47     [% FOREACH error IN errors %]
48         <div class="dialog alert">
49             [% IF error.code == 'WRONG_COUNT' %]
50                 <span>Number of records provided for merging: [% error.value | html %]. Currently only 2 records can be merged at a time.</span>
51             [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
52                 <span>You cannot merge a record with itself. Please select two different authorities.</span>
53             [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
54                 <span>The default framework cannot be used, or the framework does not exist. Please select another framework for merging.</span>
55             [% ELSIF error.code == 'EMPTY_MARC' %]
56                 <span>Sorry, but we did not find any MARC tags in the reference record.</span>
57             [% ELSIF error.code == 'MISSING_RECORD' %]
58                 <span>Sorry, but we did not find a record for number: [% error.value | html %].</span>
59             [% ELSE %]
60                 [% error | html %]
61             [% END %]
62         </div>
63     [% END %]
64
65 [% ELSIF ( result ) %]
66
67     <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]">View the merged record.</a></p>
68
69 [% ELSIF ( choosereference ) %]
70
71 <p>Please choose which record will be the reference for the merge. The record chosen as reference will be kept, and the other will be deleted.</p>
72 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
73     <fieldset class="rows">
74     <legend>Merge reference</legend>
75     <ol>
76     <li class="radio"><input type="radio" value="[% recordid1 | uri %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 | html %]')" /><label for="mergereference1">[% title1 | html %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 | html %][% IF frameworklabel1 %] &mdash; [% frameworklabel1 | html %][% END %]</a>)</label></li>
77     <li class="radio"><input type="radio" value="[% recordid2 | uri %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 | html %]')" /><label for="mergereference2">[% title2 | html %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 | html %][% IF frameworklabel2 %] &mdash; [% frameworklabel2 | html %][% END %]</a>)</label></li>
78
79     [% IF frameworkselect %]
80           <li><label for="frameworkcode">Using framework:</label>
81                       <select name="frameworkcode" id="frameworkcode">
82                                       [% FOREACH frameworkcodeloo IN frameworkselect %]
83                                           [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
84                                               <option value="[% frameworkcodeloo.authtypecode | html %]" selected="selected">
85                                           [% ELSE %]
86                                               <option value="[% frameworkcodeloo.authtypecode | html %]">
87                                           [% END %]
88                                            [% frameworkcodeloo.authtypetext | html %]
89                                            </option>
90                                       [% END %]
91                       </select></li>
92     [% END %]
93 </ol>
94
95     <input type="hidden" name="authid" value="[% recordid1 | html %]" />
96     <input type="hidden" name="authid" value="[% recordid2 | html %]" />
97     <fieldset class="action"><input type="submit" value="Next" /></fieldset>
98     </fieldset>
99 </form>
100
101 [% ELSE %]
102
103 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
104
105     <div class="row">
106         <div class="col-sm-6">
107 [% PROCESS mergesource sourcerecords=records %]
108 </div>
109         <div class="col-sm-6">
110 [% PROCESS mergetarget %]
111 </div>
112 </div>
113
114 <input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
115 <input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
116 <input type="hidden" name="mergereference" value="[% mergereference | html %]" />
117 <input type="hidden" name="frameworkcode" value="[% framework | html %]" />
118
119 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
120 </form>
121
122 [% END %]
123
124         </main>
125     </div> <!-- /.col-md-8 col-md-offset-2 -->
126 </div> <!-- /.row -->
127
128 [% MACRO jsinclude BLOCK %]
129     [% INCLUDE 'authorities_js.inc' %]
130     [% Asset.js("js/merge-record.js") | $raw %]
131     <script>
132
133         // When submiting the form
134         function mergeformsubmit() {
135             $('#tabs').remove();
136         }
137
138     $(document).ready(function(){
139         // Getting marc structure via ajax
140         tagslib = [];
141         $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
142             tagslib = json;
143             rebuild_target($("#tabs"), $("#resultul"));
144         });
145
146         $('.preview-merge-reference').click(function (ev) {
147             ev.preventDefault();
148             newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
149         });
150         if( $(".tab-pane.active").length < 1 ){
151             $("#tabs a:first").tab("show");
152         }
153     });
154
155
156     function changeFramework(fw) {
157         $("#Frameworks").val(fw);
158     }
159
160     </script>
161 [% END %]
162
163 [% INCLUDE 'intranet-bottom.inc' %]