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