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