Bug 21672: Switch templates to Bootstrap grid: Various
[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>Koha &rsaquo; Cataloging &rsaquo; Merging records</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 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'authorities-search.inc' %]
18 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>  &rsaquo; Merging records</div>
19
20 <div class="main container-fluid">
21     <div class="row">
22         <div class="col-md-8 col-md-offset-2">
23             <main>
24
25 <h1>Merging records</h1>
26
27 [% IF ( errors ) %]
28
29     [% FOREACH error IN errors %]
30         <div class="dialog alert">
31             [% IF error.code == 'WRONG_COUNT' %]
32                 Number of records provided for merging: [% error.value | html %]. Currently only 2 records can be merged at a time.
33             [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
34                 You cannot merge a record with itself. Please select two different authorities.
35             [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
36                 The Default framework cannot be used, or the framework does not exist. Please select another framework for merging.
37             [% ELSIF error.code == 'EMPTY_MARC' %]
38                 Sorry, but we did not find any MARC tags in the reference record.
39             [% ELSIF error.code == 'MISSING_RECORD' %]
40                 Sorry, but we did not find a record for number: [% error.value | html %].
41             [% ELSE %]
42                 [% error | html %]
43             [% END %]
44         </div>
45     [% END %]
46
47 [% ELSIF ( result ) %]
48
49     <script>window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]";</script>
50     <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]">Click here to see the merged record.</a></p>
51
52 [% ELSIF ( choosereference ) %]
53
54 <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>
55 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
56     <fieldset class="rows">
57     <legend>Merge reference</legend>
58     <ol>
59     <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.subfield | 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>
60     <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.subfield | 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>
61
62     [% IF frameworkselect %]
63           <li><label for="frameworkcode">Using framework:</label>
64                       <select name="frameworkcode" id="frameworkcode">
65                                       [% FOREACH frameworkcodeloo IN frameworkselect %]
66                                           [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
67                                               <option value="[% frameworkcodeloo.authtypecode | html %]" selected="selected">
68                                           [% ELSE %]
69                                               <option value="[% frameworkcodeloo.authtypecode | html %]">
70                                           [% END %]
71                                            [% frameworkcodeloo.authtypetext | html %]
72                                            </option>
73                                       [% END %]
74                       </select></li>
75     [% END %]
76 </ol>
77
78     <input type="hidden" name="authid" value="[% recordid1 | html %]" />
79     <input type="hidden" name="authid" value="[% recordid2 | html %]" />
80     <fieldset class="action"><input type="submit" value="Next" /></fieldset>
81     </fieldset>
82 </form>
83
84 [% ELSE %]
85
86 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
87
88     <div class="row">
89         <div class="col-sm-6">
90 [% PROCESS mergesource sourcerecords=records %]
91 </div>
92         <div class="col-sm-6">
93 [% PROCESS mergetarget %]
94 </div>
95 </div>
96
97 <input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
98 <input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
99 <input type="hidden" name="mergereference" value="[% mergereference | html %]" />
100 <input type="hidden" name="frameworkcode" value="[% framework | html %]" />
101
102 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
103 </form>
104
105 [% END %]
106
107         </main>
108     </div> <!-- /.col-md-8 col-md-offset-2 -->
109 </div> <!-- /.row -->
110
111 [% MACRO jsinclude BLOCK %]
112     [% INCLUDE 'merge-record-strings.inc' %]
113     [% INCLUDE 'authorities_js.inc' %]
114     [% Asset.js("js/merge-record.js") | $raw %]
115     <script>
116
117         // When submiting the form
118         function mergeformsubmit() {
119             $('#tabs').remove();
120         }
121
122     $(document).ready(function(){
123         // Getting marc structure via ajax
124         tagslib = [];
125         $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
126             tagslib = json;
127             rebuild_target($("#tabs"), $("#resultul"));
128         });
129
130         $('.preview-merge-reference').click(function (ev) {
131             ev.preventDefault();
132             newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
133         });
134
135         // Creating tabs
136         $("#tabs").tabs();
137     });
138
139
140     function changeFramework(fw) {
141         $("#Frameworks").val(fw);
142     }
143
144     </script>
145 [% END %]
146
147 [% INCLUDE 'intranet-bottom.inc' %]