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