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