493bcbd3e7ccb1d8ecaf1bc16b2b795de9ae2cfe
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / authorities / merge.tt
1 [% PROCESS 'merge-record.inc' %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Cataloging &rsaquo; Merging records</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript" src="[% interface %]/[% theme %]/js/merge-record.js"></script>
6 [% INCLUDE 'merge-record-strings.inc' %]
7 <style type="text/css">
8 div.record ul, div.record li { float:none; display:block; }
9 div#result { margin-top: 1em; }
10 /* We use this style "against" the li ui-tabs-nav style automatically applied */
11 </style>
12 <script type="text/javascript">
13 //<![CDATA[
14
15     // When submiting the form
16     function mergeformsubmit() {
17         $('#tabs').remove();
18     }
19
20 $(document).ready(function(){
21     // Getting marc structure via ajax
22     tagslib = [];
23     $.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) {
24         tagslib = json;
25         rebuild_target($("#tabs"), $("#resultul"));
26     });
27
28     $('.preview-merge-reference').click(function (ev) {
29         ev.preventDefault();
30         newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
31     });
32
33     // Creating tabs
34     $("#tabs").tabs();
35 });
36
37
38 function changeFramework(fw) {
39     $("#Frameworks").val(fw);
40 }
41
42 //]]>
43 </script>
44 </head>
45 <body id="auth_merge" class="cat">
46 [% INCLUDE 'header.inc' %]
47 [% INCLUDE 'authorities-search.inc' %]
48 <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>
49
50 <div id="doc" class="yui-t7">
51
52 <div id="bd">
53         <div id="yui-main">
54
55
56 <h1>Merging records</h1>
57
58 [% IF ( errors ) %]
59
60     [% FOREACH error IN errors %]
61         <div class="dialog alert">
62             [% IF error.code == 'WRONG_COUNT' %]
63                 Number of records provided for merging: [% error.value %]. Currently only 2 records can be merged at a time.
64             [% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
65                 You cannot merge a record with itself. Please select two different authorities.
66             [% ELSIF error.code == 'WRONG_FRAMEWORK' %]
67                 The Default framework cannot be used, or the framework does not exist. Please select another framework for merging.
68             [% ELSIF error.code == 'EMPTY_MARC' %]
69                 Sorry, but we did not find any MARC tags in the reference record.
70             [% ELSE %]
71                 [% error %]
72             [% END %]
73         </div>
74     [% END %]
75
76 [% ELSIF ( result ) %]
77
78         <script type="text/javascript">window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]"</script>
79         <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]">Click here to see the merged record.</a></p>
80
81 [% ELSIF ( choosereference ) %]
82
83 <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>
84 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
85     <fieldset class="rows">
86     <legend>Merge reference</legend>
87     <ol>
88     <li class="radio"><input type="radio" value="[% recordid1 %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 %]')" /><label for="mergereference1">[% title1 %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1.subfield %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 %][% IF frameworklabel1 %] &mdash; [% frameworklabel1 %][% END %]</a>)</label></li>
89     <li class="radio"><input type="radio" value="[% recordid2 %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 %]')" /><label for="mergereference2">[% title2 %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2.subfield %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 %][% IF frameworklabel2 %] &mdash; [% frameworklabel2 %][% END %]</a>)</label></li>
90
91     [% IF frameworkselect %]
92           <li><label for="frameworkcode">Using framework:</label>
93                       <select name="frameworkcode" id="frameworkcode">
94                                       [% FOREACH frameworkcodeloo IN frameworkselect %]
95                                           [% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
96                                               <option value="[% frameworkcodeloo.authtypecode %]" selected="selected">
97                                           [% ELSE %]
98                                               <option value="[% frameworkcodeloo.authtypecode %]">
99                                           [% END %]
100                                            [% frameworkcodeloo.authtypetext %]
101                                            </option>
102                                       [% END %]
103                       </select></li>
104     [% END %]
105 </ol>
106
107     <input type="hidden" name="authid" value="[% recordid1 %]" />
108     <input type="hidden" name="authid" value="[% recordid2 %]" />
109     <fieldset class="action"><input type="submit" value="Next" /></fieldset>
110     </fieldset>
111 </form>
112
113 [% ELSE %]
114
115 <form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
116
117 <div class="yui-g">
118 <div class="yui-u first">
119 [% PROCESS mergesource sourcerecords=records %]
120 </div>
121 <div class="yui-u">
122 [% PROCESS mergetarget %]
123 </div> <!-- .yui-u -->
124
125 <input type="hidden" name="recordid1" value="[% recordid1 %]" />
126 <input type="hidden" name="recordid2" value="[% recordid2 %]" />
127 <input type="hidden" name="mergereference" value="[% mergereference %]" />
128 <input type="hidden" name="frameworkcode" value="[% framework %]" />
129
130 <fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
131 </div>
132 </form>
133
134 [% END %]
135
136 </div>
137 </div>
138 </div>
139
140 [% INCLUDE 'intranet-bottom.inc' %]