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