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