Bug 7475: Teach matching rules to handle authorities
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / matching-rules.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Record matching rules
3 [% IF ( matching_rule_form ) %]
4   [% IF ( edit_matching_rule ) %]
5     &rsaquo; Modify record matching rule
6   [% ELSE %]
7     &rsaquo; Add record matching rule
8   [% END %]
9 [% END %]
10 [% IF ( delete_matching_rule_form ) %]
11   &rsaquo; Confirm deletion of record matching rule &quot;[% code %]&quot;
12 [% END %]
13 </title>
14 [% INCLUDE 'doc-head-close.inc' %]
15
16 <script type="text/javascript">
17 //<![CDATA[
18
19 var maxMatchPoint = [% max_matchpoint %];
20 var maxMatchCheck = [% max_matchcheck %];
21
22 function InsertMatchpoint(loc, index) {
23     var original= $("#"+index);
24     var clone = original.clone();
25     clone.show();
26
27     // update IDs and form names
28     maxMatchPoint++;
29     clone.attr('id', 'mp_' + maxMatchPoint);
30     $("span.counter",clone).html(maxMatchPoint);
31     $("label",clone).each(function(){
32       var s = $(this).attr("for");
33         if (s.match(/mp_num/)) {
34             $(this).attr("for",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
35         }
36     });
37
38     $("div",clone).each(function(){
39       var s = $(this).attr("id");
40         if (s.match(/mp_num/)) {
41             $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
42         }
43     });
44     $("input",clone).each(function(){
45         var s = $(this).attr("id");
46         if(s.match(/mp_num/)){
47           $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
48         }
49
50         var s = $(this).attr("name");
51         if(s.match(/mp_num/)){
52           $(this).attr("name",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
53         }
54     });
55     $("#match_points").append(clone);
56 }
57
58 function InsertMatchcheck(loc, index) {
59     var original= $("#"+index);
60     var clone = original.clone();
61     clone.show();
62
63     // update IDs and form names
64     maxMatchCheck++;
65     clone.attr('id', 'mc_' + maxMatchCheck);
66     $("span.counter",clone).html(maxMatchCheck);
67     $("label",clone).each(function(){
68       var s = $(this).attr("for");
69         if (s.match(/mc_num/)) {
70             $(this).attr("for",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
71         }
72     });
73
74     $("div",clone).each(function(){
75       var s = $(this).attr("id");
76         if (s.match(/mc_num/)) {
77             $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
78         }
79     });
80     $("input",clone).each(function(){
81         var s = $(this).attr("id");
82         if(s.match(/mc_num/)){
83           $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
84         }
85
86         var s = $(this).attr("name");
87         if(s.match(/mc_num/)){
88           $(this).attr("name",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
89         }
90     });
91     $("#match_checks").append(clone);
92 }
93
94 function DeleteMatchpoint(loc) {
95     $(loc).parent().parent().parent().remove();
96     if($(".matchgroup",$("#match_points")).length == 0){
97       maxMatchPoint = 0;
98       $("#addMatchPoint").show();
99     }
100 }
101
102 function DeleteMatchcheck(loc) {
103     $(loc).parent().parent().parent().remove();
104     if($(".matchgroup",$("#match_checks")).length == 0){
105       maxMatchCheck = 0;
106       $("#addMatchCheck").show();
107     }
108 }
109
110 function DoCancel(f) {
111   f.op.value='';
112   document.Aform.submit();
113 }
114
115 function CheckMatchingRuleForm(f) {
116     var ok=1;
117     var _alertString="";
118     var alertString2;
119     if (f.code.value.length==0) {
120         _alertString += "\n- " + _("Matching rule code missing");
121     }
122     if (f.description.value.length==0) {
123         _alertString += "\n- " + _("Description missing");
124     }
125     if (f.threshold.value.length==0) {
126         _alertString += "\n- " + _("Threshold missing");
127     }
128     if (_alertString.length==0) {
129         document.Aform.submit();
130     } else {
131         alertString2  = _("Form not submitted because of the following problem(s)");
132         alertString2 += "\n------------------------------------------------------------------------------------\n";
133         alertString2 += _alertString;
134         alert(alertString2);
135     }
136 }
137
138 function CheckRuleForm(f) {
139     var ok=1;
140     var _alertString="";
141     var alertString2;
142     if (f.sort_rule.value.length==0) {
143         _alertString += "\n- " + _("Filing rule code missing");
144     }
145     if (f.description.value.length==0) {
146         _alertString += "\n- " + _("Description missing");
147     }
148     if (f.sort_routine.value.length==0) {
149         _alertString += "\n- " + _("Sort routine missing");
150     }
151     if (_alertString.length==0) {
152         document.Aform.submit();
153     } else {
154         alertString2  = _("Form not submitted because of the following problem(s)");
155         alertString2 += "\n------------------------------------------------------------------------------------\n";
156         alertString2 += _alertString;
157         alert(alertString2);
158     }
159 }
160
161 //]]>
162 </script>
163 <style type="text/css">
164   fieldset.rows fieldset.rows { border-width : 0; }
165   fieldset.rows fieldset.rows fieldset.rows { border-width : 1px; }
166   fieldset, fieldset.rows { width : 90%; padding: .3em .6em .3em .6em; }
167         fieldset.rows fieldset {font-size:100%;}
168   div.matchgroup { border:1px solid #DDD; border-left-width: 15px; padding:.4em; margin-bottom:.6em;}
169 </style>
170 </head>
171 <body id="admin_matching-rules" class="admin">
172 [% INCLUDE 'header.inc' %]
173 [% INCLUDE 'cat-search.inc' %]
174
175 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( display_list ) %]Record matching rules[% ELSE %]<a href="/cgi-bin/koha/admin/matching-rules.pl">Record matching rules</a>[% END %]
176 [% IF ( matching_rule_form ) %]
177   [% IF ( edit_matching_rule ) %]
178     &rsaquo; Modify record matching rule
179   [% ELSE %]
180     &rsaquo; Add record matching rule
181   [% END %]
182 [% END %]
183 [% IF ( delete_matching_rule_form ) %]
184   &rsaquo; Confirm deletion of record matching rule &quot;[% code %]&quot;
185 [% END %]
186 </div>
187
188 <div id="doc3" class="yui-t2">
189
190    <div id="bd">
191     <div id="yui-main">
192     <div class="yui-b">
193
194 [% IF ( matching_rule_form ) %]
195   [% IF ( edit_matching_rule ) %]
196 <h2>Modify record matching rule</h2>
197   [% ELSE %]
198 <h2>Add record matching rule</h2>
199   [% END %]
200 <form action="[% script_name %]" name="Aform" method="post">
201   <input type="hidden" name="op" value="[% confirm_op %]" />
202   <fieldset class="rows">
203     <ol>
204       <li>
205           [% IF ( edit_matching_rule ) %]
206                   <span class="label">Matching rule code: </span>
207             <input type="hidden" name="matcher_id" value="[% matcher_id %]" />
208             <input type="hidden" name="code" value="[% code %]" />
209             [% code %]
210           [% ELSE %]
211                   <label for="code" class="required">Matching rule code: </label>
212             <input type="text" id="code" name="code"  size="10" maxlength="10" /> <span class="required">Required</span>
213           [% END %]
214        </li>
215        <li><label for="description" class="required">Description: </label>
216            <input type="text" id="description" name="description" size="50" maxlength="250" 
217                   value="[% description |html %]" /> <span class="required">Required</span>
218        </li>
219        <li><label for="threshold" class="required">Match threshold: </label>
220            <input type="text" id="threshold" name="threshold" size="5" maxlength="5" 
221                   value="[% threshold |html %]" /> <span class="required">Required</span>
222        </li>
223        <li><label for="record_type" class="required">Record type: </label>
224            <select id="record_type" name="record_type">
225                [% IF ( record_type == "authority" ) %]
226                    <option value="biblio">Bibliographic record</option>
227                    <option value="authority" selected="selected">Authority record</option>
228                [% ELSE %]
229                    <option value="biblio" selected="selected">Bibliographic record</option>
230                    <option value="authority">Authority record</option>
231                [% END %]
232            </select><span class="required">Required</span>
233        </li>
234     </ol>
235   </fieldset>
236
237   <fieldset class="rows" id="match_points">
238   <h4>Match points</h4>
239   [% IF ( edit_matching_rule ) %]
240   [% IF ( matchpoints ) %]<p id="addMatchPoint" style="display:none;">[% ELSE %]<p id="addMatchPoint">[% END %]<a href="#" class="button" onclick="InsertMatchpoint('mp_1', 'mp_template'); return false;">Add match point</a></p>
241   [% ELSE %]<p id="addMatchPoint" style="display:none;"><a href="#" class="button" onclick="InsertMatchpoint('mp_1', 'mp_template'); return false;">Add match point</a></p>[% END %]
242   [% IF ( edit_matching_rule ) %]
243   [% FOREACH matchpoint IN matchpoints %]
244   <div id="mp_[% matchpoint.mp_num %]" class="matchgroup">
245   <fieldset class="rows">
246     <legend>Match point [% matchpoint.mp_num %] | <a href="#" class="button" onclick="InsertMatchpoint('mp_[% matchpoint.mp_num %]', 'mp_template'); return false;">Add match point</a> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;">Remove this match point</a></legend>
247     <ol>
248       <li>
249         <label for="mp_[% matchpoint.mp_num %]_search_index">Search index: </label>
250         <input type ="text" id="mp_[% matchpoint.mp_num %]_search_index" 
251                name="mp_[% matchpoint.mp_num %]_search_index" size="20" 
252                value="[% matchpoint.index |html %]"
253           maxlength="30" />
254       </li>
255       <li>
256         <label for="mp_[% matchpoint.mp_num %]_score">Score: </label>
257         <input type ="text" id="mp_[% matchpoint.mp_num %]_score" 
258                name="mp_[% matchpoint.mp_num %]_score" size="5"
259                value="[% matchpoint.score |html %]" 
260                maxlength="5" />
261       </li>
262       </ol>
263       [% FOREACH component IN matchpoint.components %]
264       <fieldset class="rows" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]">
265       <legend>Matchpoint components</legend>
266         <ol>
267           <li>
268             <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_tag">Tag: </label>
269             <input type="text" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_tag" 
270                    name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_tag" 
271                    value="[% component.tag |html %]"
272                    size="3" maxlength="3" />
273           </li>
274           <li>
275             <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_subfields">Subfields: </label>
276             <input type="text" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_subfields" 
277                    name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_subfields" 
278                    value="[% component.subfields |html %]"
279                    size="10" maxlength="40" />
280           </li>
281           <li>
282             <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_offset">Offset: </label>
283             <input type="text" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_offset" 
284                    name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_offset" 
285                    value="[% component.offset |html %]"
286                    size="5" maxlength="5" />
287           </li>
288           <li>
289             <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_length">Length: </label>
290             <input type="text" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_length" 
291                    name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_length" 
292                    value="[% component.length |html %]"
293                    size="5" maxlength="5" />
294           </li>
295               [% FOREACH norm IN component.norms %]
296               <li id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]">
297                 <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm">Normalization rule: </label>
298                 <input type="text" id="mp_[% norm.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm" 
299                        name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]_norm" 
300                        value="[% norm.norm |html %]"
301                        size="20" maxlength="50" />
302               </li>
303               [% END %]
304         </ol>
305       </fieldset>
306       [% END %]
307       </fieldset>
308       <br style="clear:both;" />
309       </div>
310   </fieldset>
311
312   [% END %]
313   [% ELSE %]
314   <div id="mp_1" class="matchgroup">
315   <fieldset class="rows">
316     <legend>Match point 1 | <a href="#" class="button" onclick="InsertMatchpoint('mp_1', 'mp_template'); return false;">Add match point</a> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;">Remove this match point</a></legend>
317     <ol>
318       <li>
319         <label for="mp_1_search_index">Search index: </label>
320         <input type ="text" id="mp_1_search_index" name="mp_1_search_index" size="20" 
321           maxlength="30" />
322       </li>
323       <li>
324         <label for="mp_1_score">Score: </label>
325         <input type ="text" id="mp_1_score" name="mp_1_score" size="5" maxlength="5" />
326       </li>
327     </ol>
328     <fieldset class="rows" id="mp_1_c_1">
329       <legend>Matchpoint components</legend>
330         <ol>
331           <li>
332             <label for="mp_1_c_1_tag">Tag: </label>
333             <input type="text" id="mp_1_c_1_tag" name="mp_1_c_1_tag" size="3" maxlength="3" />
334           </li>
335           <li>
336             <label for="mp_1_c_1_subfields">Subfields: </label>
337             <input type="text" id="mp_1_c_1_subfields" name="mp_1_c_1_subfields" size="10" maxlength="40" />
338           </li>
339           <li>
340             <label for="mp_1_c_1_offset">Offset: </label>
341             <input type="text" id="mp_1_c_1_offset" name="mp_1_c_1_offset" size="5" maxlength="5" />
342           </li>
343           <li>
344             <label for="mp_1_c_1_length">Length: </label>
345             <input type="text" id="mp_1_c_1_length" name="mp_1_c_1_length" size="5" maxlength="5" />
346           </li>
347             <li id="mp_1_c_1_n_1">
348               <label for="mp_1_c_1_n_1_norm">Normalization rule: </label>
349               <input type="text" id="mp_1_c_1_n_1_norm" name="mp_1_c_1_n_1_norm" size="20" maxlength="50" />
350             </li>
351         </ol>
352     </fieldset>
353     </fieldset>
354       <br style="clear:both;" />
355       </div>
356
357   </fieldset>
358   [% END %]
359
360   <fieldset class="rows" id="match_checks">
361   <h4>Required match checks</h4>
362   [% IF ( edit_matching_rule ) %]
363   [% IF ( matchchecks ) %]<p id="addMatchCheck" style="display:none;">[% ELSE %]<p id="addMatchCheck">[% END %]<a href="#" class="button" onclick="InsertMatchcheck('mc_1', 'mc_template'); return false;">Add match check</a></p>
364   [% ELSE %]<p id="addMatchCheck" style="display:none;"><a href="#" class="button" onclick="InsertMatchcheck('mc_1', 'mc_template'); return false;">Add match check</a></p>[% END %]
365   [% IF ( edit_matching_rule ) %]
366   [% FOREACH matchcheck IN matchchecks %]
367   <fieldset class="rows" id="mc_[% matchcheck.mc_num %]">
368     <legend>Match check [% matchcheck.mc_num %]<a href="#" class="button" onclick="InsertMatchcheck('mc_[% matchcheck.mc_num %]', 'mc_template'); return false;">Add match check</a> | <a href="#" class="button" onclick="DeleteMatchcheck(this); return false;">Remove this match check</a></legend>
369     <input type="hidden" id="mc_[% matchcheck.mc_num %]_id" name="mc_[% matchcheck.mc_num %]_id" value="1" />
370       [% FOREACH src_component IN matchcheck.src_components %]
371       <fieldset class="rows" id="mc_[% src_component.mc_num %]_src_c_[% src_component.comp_num %]">
372         <legend>Source (incoming) record check field</legend>
373         <ol>
374           <li>
375             <label for="mc_[% src_component.mc_num %]_src_c_[% src_component.comp_num %]_tag">Tag: </label>
376             <input type="text" id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_tag" 
377                    name="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_tag" 
378                    value="[% src_component.tag |html %]"
379                    size="3" maxlength="3" />
380           </li>
381           <li>
382             <label for="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_subfields">Subfields: </label>
383             <input type="text" id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_subfields" 
384                    name="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_subfields" 
385                    value="[% src_component.subfields |html %]"
386                    size="10" maxlength="40" />
387           </li>
388           <li>
389             <label for="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_offset">Offset: </label>
390             <input type="text" id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_offset" 
391                    name="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_offset" 
392                    value="[% src_component.offset |html %]"
393                    size="5" maxlength="5" />
394           </li>
395           <li>
396             <label for="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_length">Length: </label>
397             <input type="text" id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_length" 
398                    name="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_length" 
399                    value="[% src_component.length |html %]"
400                    size="5" maxlength="5" />
401           </li>
402           [% FOREACH norm IN src_component.norms %]
403             <li id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_n_[% norm.norm_num %]">
404               <label for="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_n_[% norm.norm_num %]_norm">Normalization rule: </label>
405               <input type="text" id="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_n_[% norm.norm_num %]_norm" 
406                      name="mc_[% matchcheck.mc_num %]_src_c_[% src_component.comp_num %]_n_[% norm.norm_num %]_norm" 
407                     value="[% norm.norm |html %]"
408                     size="20" maxlength="50" />
409             </li>
410           [% END %]
411         </ol>
412       </fieldset>
413       [% END %]
414       [% FOREACH tgt_component IN matchcheck.tgt_components %]
415       <fieldset class="rows" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]">
416         <legend>Target (database) record check field</legend>
417         <ol>
418           <li>
419             <label for="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_tag">Tag: </label>
420             <input type="text" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_tag" 
421                    name="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_tag" 
422                    value="[% tgt_component.tag |html %]"
423                    size="3" maxlength="3" />
424           </li>
425           <li>
426             <label for="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_subfields">Subfields: </label>
427             <input type="text" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_subfields" 
428                    name="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_subfields" 
429                    value="[% tgt_component.subfields |html %]"
430                    size="10" maxlength="40" />
431           </li>
432           <li>
433             <label for="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_offset">Offset: </label>
434             <input type="text" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_offset" 
435                    name="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_offset" 
436                    value="[% tgt_component.offset |html %]"
437                    size="5" maxlength="5" />
438           </li>
439           <li>
440             <label for="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_length">Length: </label>
441             <input type="text" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_length" 
442                    name="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_length" 
443                    value="[% tgt_component.length |html %]"
444                    size="5" maxlength="5" />
445           </li>
446           [% FOREACH norm IN tgt_component.norms %]
447             <li id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_n_[% norm.norm_num %]">
448               <label for="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_n_[% norm.norm_num %]_norm">Normalization rule: </label>
449               <input type="text" id="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_n_[% norm.norm_num %]_norm" 
450                      name="mc_[% matchcheck.mc_num %]_tgt_c_[% tgt_component.comp_num %]_n_[% norm.norm_num %]_norm" 
451                     value="[% norm.norm |html %]"
452                     size="20" maxlength="50" />
453             </li>
454           [% END %]
455         </ol>
456       </fieldset>
457       [% END %]
458   </fieldset>
459   [% END %]
460   [% ELSE %]
461   <div id="mc_1" class="matchgroup">
462   <fieldset class="rows">
463     <legend>Match check 1 | <a href="#" class="button" onclick="InsertMatchcheck('mc_1', 'mc_template'); return false;">Add match check</a> | <a href="#" class="button" onclick="DeleteMatchcheck(this); return false;">Remove this match check</a></legend>
464     <input type="hidden" id="mc_1_id" name="mc_1_id" value="1" />
465       <fieldset class="rows" id="mc_1_src_c_1">
466         <legend>Source (incoming) record check field</legend>
467         <ol>
468           <li>
469             <label for="mc_1_src_c_1_tag">Tag: </label>
470             <input type="text" id="mc_1_src_c_1_tag" name="mc_1_src_c_1_tag" size="3" maxlength="3" />
471           </li>
472           <li>
473             <label for="mc_1_src_c_1_subfields">Subfields: </label>
474             <input type="text" id="mc_1_src_c_1_subfields" name="mc_1_src_c_1_subfields" size="10" maxlength="40" />
475           </li>
476           <li>
477             <label for="mc_1_src_c_1_offset">Offset: </label>
478             <input type="text" id="mc_1_src_c_1_offset" name="mc_1_src_c_1_offset" size="5" maxlength="5" />
479           </li>
480           <li>
481             <label for="mc_1_src_c_1_length">Length: </label>
482             <input type="text" id="mc_1_src_c_1_length" name="mc_1_src_c_1_length" size="5" maxlength="5" />
483           </li>
484             <li id="mc_1_src_c_1_n_1">
485               <label for="mc_1_src_c_1_n_1_norm">Normalization rule: </label>
486               <input type="text" id="mc_1_src_c_1_n_1_norm" name="mc_1_src_c_1_n_1_norm" size="20" maxlength="50" />
487             </li>
488         </ol>
489       </fieldset>
490
491       <fieldset class="rows" id="mc_1_tgt_c_1">
492         <legend>Target (database) record check field</legend>
493         <ol>
494           <li>
495             <label for="mc_1_tgt_c_1_tag">Tag: </label>
496             <input type="text" id="mc_1_tgt_c_1_tag" name="mc_1_tgt_c_1_tag" size="3" maxlength="3" />
497           </li>
498           <li>
499             <label for="mc_1_tgt_c_1_subfields">Subfields: </label>
500             <input type="text" id="mc_1_tgt_c_1_subfields" name="mc_1_tgt_c_1_subfields" size="10" maxlength="40" />
501           </li>
502           <li>
503             <label for="mc_1_tgt_c_1_offset">Offset: </label>
504             <input type="text" id="mc_1_tgt_c_1_offset" name="mc_1_tgt_c_1_offset" size="5" maxlength="5" />
505           </li>
506           <li>
507             <label for="mc_1_tgt_c_1_length">Length: </label>
508             <input type="text" id="mc_1_tgt_c_1_length" name="mc_1_tgt_c_1_length" size="5" maxlength="5" />
509           </li>
510             <li id="mc_1_tgt_c_1_n_1">
511               <label for="mc_1_tgt_c_1_n_1_norm">Normalization rule: </label>
512               <input type="text" id="mc_1_tgt_c_1_n_1_norm" name="mc_1_tgt_c_1_n_1_norm" size="20" maxlength="50" />
513             </li>
514         </ol>
515       </fieldset>
516   </fieldset>
517   <br style="clear:both;" />
518   </div>
519   [% END %]
520   </fieldset>
521   <fieldset class="action">
522     [% IF ( edit_matching_rule ) %]
523     <input type="button" value="Save"
524            onclick="CheckMatchingRuleForm(this.form)" />
525     [% ELSE %]
526     <input type="button" value="Save"
527            onclick="CheckMatchingRuleForm(this.form)" />
528     [% END %]
529     <a class="cancel" href="/cgi-bin/koha/admin/matching-rules.pl">Cancel</a>
530   </fieldset>
531 </form>
532 [% END %]
533
534 [% IF ( delete_matching_rule_form ) %]
535 <div class="dialog alert"><h3>Confirm deletion of record matching rule <span class="ex">'[% code %]' ([% description %])</span>?</h3>
536 <form action="[% script_name %]" name="Aform" method="post">
537   <input type="hidden" name="op" value="[% confirm_op %]" />
538   <input type="hidden" name="matcher_id" value="[% matcher_id %]" />
539     <input type="submit" value="Delete record matching rule" class="approve" /></form>
540         <form action="[% script_name %]" method="get">
541     <input type="submit" value="No, Do Not Delete" class="deny" />
542 </form></div>
543 [% END %]
544
545 [% IF ( display_list ) %]
546
547 <div id="toolbar">
548         <script type="text/javascript">
549         //<![CDATA[
550         // prepare DOM for YUI Toolbar
551          $(document).ready(function() {
552             yuiToolbar();
553          });
554         // YUI Toolbar Functions
555         function yuiToolbar() {
556             new YAHOO.widget.Button("newrule");
557         }       //]]>
558         </script>
559         <ul class="toolbar">
560     <li><a id="newrule" href="[% script_name %]?op=add_matching_rule">New record matching rule</a></li>
561 </ul></div>
562
563 <h2>Record matching rules</h2>
564 [% IF ( added_matching_rule ) %]
565 <div class="dialog message">Added record matching rule &quot;[% added_matching_rule %]&quot;</div>
566 [% END %]
567 [% IF ( edited_matching_rule ) %]
568 <div class="dialog message">Modified record matching rule &quot;[% edited_matching_rule %]&quot;</div>
569 [% END %]
570 [% IF ( deleted_matching_rule ) %]
571 <div class="dialog message">Deleted record matching rule &quot;[% deleted_matching_rule %]&quot;</div>
572 [% END %]
573 [% IF ( available_matching_rules ) %]<table>
574   <tr>
575     <th>#</th>
576     <th>Code</th>
577     <th>Description</th>
578     <th>Actions</th>
579   </tr>
580   [% FOREACH available_matching_rule IN available_matching_rules %]
581   <tr>
582     <td>[% available_matching_rule.matcher_id %]</td>
583     <td>[% available_matching_rule.code %]</td>
584     <td>[% available_matching_rule.description %]</td>
585     <td>
586       <a href="[% available_matching_rule.script_name %]?op=edit_matching_rule&amp;matcher_id=[% available_matching_rule.matcher_id |html %]">Edit</a>
587       <a href="[% available_matching_rule.script_name %]?op=delete_matching_rule&amp;matcher_id=[% available_matching_rule.matcher_id |html %]">Delete</a>
588     </td>
589   </tr>
590   [% END %]
591 </table>[% ELSE %]<p>There are no saved matching rules.</p>[% END %]
592
593 <div class="pages">[% pagination_bar %]</div>
594
595 [% END %]
596  [% IF ( matching_rule_form ) %]
597 <div id="mp_template" class="matchgroup" style="display:none;">
598   <fieldset class="rows">
599     <legend>Match point <span class="counter"></span> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;">Remove this match point</a></legend>
600     <ol>
601       <li>
602         <label for="mp_num_search_index">Search index: </label>
603         <input type ="text" id="mp_num_search_index" name="mp_num_search_index" size="20" 
604           maxlength="30" />
605       </li>
606       <li>
607         <label for="mp_num_score">Score: </label>
608         <input type ="text" id="mp_num_score" name="mp_num_score" size="5" maxlength="5" />
609       </li>
610     </ol>
611       <fieldset id="mp_num_c_1" class="rows">
612       <legend>Matchpoint components</legend>
613         <ol>
614           <li>
615             <label for="mp_num_c_1_tag">Tag: </label>
616             <input type="text" id="mp_num_c_1_tag" name="mp_num_c_1_tag" size="3" maxlength="3" />
617           </li>
618           <li>
619             <label for="mp_num_c_1_subfields">Subfields: </label>
620             <input type="text" id="mp_num_c_1_subfields" name="mp_num_c_1_subfields" size="10" maxlength="40" />
621           </li>
622           <li>
623             <label for="mp_num_c_1_offset">Offset: </label>
624             <input type="text" id="mp_num_c_1_offset" name="mp_num_c_1_offset" size="5" maxlength="5" />
625           </li>
626           <li>
627             <label for="mp_num_c_1_length">Length: </label>
628             <input type="text" id="mp_num_c_1_length" name="mp_num_c_1_length" size="5" maxlength="5" />
629           </li>
630             <li id="mp_num_c_1_n_1">
631               <label for="mp_num_c_1_n_1_norm">Normalization rule: </label>
632               <input type="text" id="mp_num_c_1_n_1_norm" name="mp_num_c_1_n_1_norm" size="20" maxlength="50" />
633             </li>
634         </ol>
635       </fieldset>
636   </fieldset>
637       <br style="clear:both;" />
638       </div>
639
640 <div id="mc_template" class="matchgroup" style="display:none">
641 <fieldset class="rows">
642   <legend>Match check <span class="counter"></span> | <a href="#" class="button" onclick="DeleteMatchcheck(this); return false;">Remove this match check</a></legend>
643   <input type="hidden" id="mc_num_id" name="mc_num_id" value="1" />
644     <fieldset class="rows" id="mc_num_src_c_1">
645       <legend>Source (incoming) record check field</legend>
646       <ol>
647         <li>
648           <label for="mc_num_src_c_1_tag">Tag: </label>
649           <input type="text" id="mc_num_src_c_1_tag" name="mc_num_src_c_1_tag" size="3" maxlength="3" />
650         </li>
651         <li>
652           <label for="mc_num_src_c_1_subfields">Subfields: </label>
653           <input type="text" id="mc_num_src_c_1_subfields" name="mc_num_src_c_1_subfields" size="10" maxlength="40" />
654         </li>
655         <li>
656           <label for="mc_num_src_c_1_offset">Offset: </label>
657           <input type="text" id="mc_num_src_c_1_offset" name="mc_num_src_c_1_offset" size="5" maxlength="5" />
658         </li>
659         <li>
660           <label for="mc_num_src_c_1_length">Length: </label>
661           <input type="text" id="mc_num_src_c_1_length" name="mc_num_src_c_1_length" size="5" maxlength="5" />
662         </li>
663           <li id="mc_num_src_c_1_n_1">
664             <label for="mc_num_src_c_1_n_1_norm">Normalization rule: </label>
665             <input type="text" id="mc_num_src_c_1_n_1_norm" name="mc_num_src_c_1_n_1_norm" size="20" maxlength="50" />
666           </li>
667       </ol>
668     </fieldset>
669     <fieldset class="rows" id="mc_num_tgt_c_1">
670       <legend>Target (database) record check field</legend>
671       <ol>
672         <li>
673           <label for="mc_num_tgt_c_1_tag">Tag: </label>
674           <input type="text" id="mc_num_tgt_c_1_tag" name="mc_num_tgt_c_1_tag" size="3" maxlength="3" />
675         </li>
676         <li>
677           <label for="mc_num_tgt_c_1_subfields">Subfields: </label>
678           <input type="text" id="mc_num_tgt_c_1_subfields" name="mc_num_tgt_c_1_subfields" size="10" maxlength="40" />
679         </li>
680         <li>
681           <label for="mc_num_tgt_c_1_offset">Offset: </label>
682           <input type="text" id="mc_num_tgt_c_1_offset" name="mc_num_tgt_c_1_offset" size="5" maxlength="5" />
683         </li>
684         <li>
685           <label for="mc_num_tgt_c_1_length">Length: </label>
686           <input type="text" id="mc_num_tgt_c_1_length" name="mc_num_tgt_c_1_length" size="5" maxlength="5" />
687         </li>
688           <li id="mc_num_tgt_c_1_n_1">
689             <label for="mc_num_tgt_c_1_n_1_norm">Normalization rule: </label>
690             <input type="text" id="mc_num_tgt_c_1_n_1_norm" name="mc_num_tgt_c_1_n_1_norm" size="20" maxlength="50" />
691           </li>
692       </ol>
693     </fieldset>
694 </fieldset>
695 <br style="clear:both;" />
696 </div>
697 [% END %]
698
699 </div>
700 </div>
701 <div class="yui-b">
702 [% INCLUDE 'admin-menu.inc' %]
703 </div>
704 </div>
705 [% INCLUDE 'intranet-bottom.inc' %]