Bug 13618: Add html filters to all the variables
[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' | html %]
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 type="text/css">
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 id="doc3" class="yui-t2">
78
79    <div id="bd">
80     <div id="yui-main">
81     <div class="yui-b">
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 btn-sm" id="newrule" href="[% script_name | html %]?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>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 | html %]?op=edit_matching_rule&amp;matcher_id=[% available_matching_rule.matcher_id | html %]"><i class="fa fa-pencil"></i> Edit</a>
464       <a class="btn btn-default btn-xs" href="[% available_matching_rule.script_name | html %]?op=delete_matching_rule&amp;matcher_id=[% available_matching_rule.matcher_id | html %]"><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 </div>
577 </div>
578 <div class="yui-b">
579 [% INCLUDE 'admin-menu.inc' %]
580 </div>
581 </div>
582
583 [% MACRO jsinclude BLOCK %]
584     [% Asset.js("js/admin-menu.js") | $raw %]
585     <script type="text/javascript">
586         var maxMatchPoint = [% max_matchpoint | html %];
587         var maxMatchCheck = [% max_matchcheck | html %];
588
589         function InsertMatchpoint(loc, index) {
590             var original= $("#"+index);
591             var clone = original.clone();
592             clone.show();
593
594             // update IDs and form names
595             maxMatchPoint++;
596             clone.attr('id', 'mp_' + maxMatchPoint);
597             $("span.counter",clone).html(maxMatchPoint);
598             $("label",clone).each(function(){
599               var s = $(this).attr("for");
600                 if (s.match(/mp_num/)) {
601                     $(this).attr("for",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
602                 }
603             });
604
605             $("div",clone).each(function(){
606               var s = $(this).attr("id");
607                 if (s.match(/mp_num/)) {
608                     $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
609                 }
610             });
611             $("input",clone).each(function(){
612                 var s = $(this).attr("id");
613                 if(s.match(/mp_num/)){
614                   $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
615                 }
616
617                 var s = $(this).attr("name");
618                 if(s.match(/mp_num/)){
619                   $(this).attr("name",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
620                 }
621             });
622             $("#match_points").append(clone);
623         }
624
625         function InsertMatchcheck(loc, index) {
626             var original= $("#"+index);
627             var clone = original.clone();
628             clone.show();
629
630             // update IDs and form names
631             maxMatchCheck++;
632             clone.attr('id', 'mc_' + maxMatchCheck);
633             $("span.counter",clone).html(maxMatchCheck);
634             $("label",clone).each(function(){
635               var s = $(this).attr("for");
636                 if (s.match(/mc_num/)) {
637                     $(this).attr("for",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
638                 }
639             });
640
641             $("div",clone).each(function(){
642               var s = $(this).attr("id");
643                 if (s.match(/mc_num/)) {
644                     $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
645                 }
646             });
647             $("input",clone).each(function(){
648                 var s = $(this).attr("id");
649                 if(s.match(/mc_num/)){
650                   $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
651                 }
652
653                 var s = $(this).attr("name");
654                 if(s.match(/mc_num/)){
655                   $(this).attr("name",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
656                 }
657             });
658             $("#match_checks").append(clone);
659         }
660
661         function DeleteMatchpoint(loc) {
662             $(loc).parent().parent().parent().remove();
663             if($(".matchgroup",$("#match_points")).length == 0){
664               maxMatchPoint = 0;
665               $("#addMatchPoint").show();
666             }
667         }
668
669         function DeleteMatchcheck(loc) {
670             $(loc).parent().parent().parent().remove();
671             if($(".matchgroup",$("#match_checks")).length == 0){
672               maxMatchCheck = 0;
673               $("#addMatchCheck").show();
674             }
675         }
676
677         function DoCancel(f) {
678           f.op.value='';
679           document.Aform.submit();
680         }
681
682         function CheckMatchingRuleForm(f) {
683             var ok=1;
684             var _alertString="";
685             var alertString2;
686             if (f.code.value.length==0) {
687                 _alertString += "\n- " + _("Matching rule code missing");
688             }
689             if (f.description.value.length==0) {
690                 _alertString += "\n- " + _("Description missing");
691             }
692             if (f.threshold.value.length==0) {
693                 _alertString += "\n- " + _("Threshold missing");
694             }
695             if (_alertString.length==0) {
696                 document.Aform.submit();
697             } else {
698                 alertString2  = _("Form not submitted because of the following problem(s)");
699                 alertString2 += "\n------------------------------------------------------------------------------------\n";
700                 alertString2 += _alertString;
701                 alert(alertString2);
702             }
703         }
704
705         function CheckRuleForm(f) {
706             var ok=1;
707             var _alertString="";
708             var alertString2;
709             if (f.sort_rule.value.length==0) {
710                 _alertString += "\n- " + _("Filing rule code missing");
711             }
712             if (f.description.value.length==0) {
713                 _alertString += "\n- " + _("Description missing");
714             }
715             if (f.sort_routine.value.length==0) {
716                 _alertString += "\n- " + _("Sort routine missing");
717             }
718             if (_alertString.length==0) {
719                 document.Aform.submit();
720             } else {
721                 alertString2  = _("Form not submitted because of the following problem(s)");
722                 alertString2 += "\n------------------------------------------------------------------------------------\n";
723                 alertString2 += _alertString;
724                 alert(alertString2);
725             }
726         }
727     </script>
728 [% END %]
729 [% INCLUDE 'intranet-bottom.inc' %]