View | Details | Raw Unified | Return to bug 16763
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt (-76 / +43 lines)
Lines 106-163 function DeleteMatchcheck(loc) { Link Here
106
      $("#addMatchCheck").show();
106
      $("#addMatchCheck").show();
107
    }
107
    }
108
}
108
}
109
109
$(document).ready(function(){
110
function DoCancel(f) {
110
    $("body").on("click",".insert_match_point",function(e){
111
  f.op.value='';
111
        e.preventDefault();
112
  document.Aform.submit();
112
        var loc = $(this).data("loc");
113
}
113
        var index = $(this).data("index");
114
114
        InsertMatchpoint( loc, index );
115
function CheckMatchingRuleForm(f) {
115
    });
116
    var ok=1;
116
    $("body").on("click",".insert_match_check",function(e){
117
    var _alertString="";
117
        e.preventDefault();
118
    var alertString2;
118
        var loc = $(this).data("loc");
119
    if (f.code.value.length==0) {
119
        var index = $(this).data("index");
120
        _alertString += "\n- " + _("Matching rule code missing");
120
        InsertMatchcheck( loc, index );
121
    }
121
    });
122
    if (f.description.value.length==0) {
122
    $("body").on("click",".delete_match_check",function(e){
123
        _alertString += "\n- " + _("Description missing");
123
        e.preventDefault();
124
    }
124
        DeleteMatchcheck( this );
125
    if (f.threshold.value.length==0) {
125
    })
126
        _alertString += "\n- " + _("Threshold missing");
126
})
127
    }
128
    if (_alertString.length==0) {
129
        document.Aform.submit();
130
    } else {
131
        alertString2  = _("Form not submitted because of the following problem(s)");
132
        alertString2 += "\n------------------------------------------------------------------------------------\n";
133
        alertString2 += _alertString;
134
        alert(alertString2);
135
    }
136
}
137
138
function CheckRuleForm(f) {
139
    var ok=1;
140
    var _alertString="";
141
    var alertString2;
142
    if (f.sort_rule.value.length==0) {
143
        _alertString += "\n- " + _("Filing rule code missing");
144
    }
145
    if (f.description.value.length==0) {
146
        _alertString += "\n- " + _("Description missing");
147
    }
148
    if (f.sort_routine.value.length==0) {
149
        _alertString += "\n- " + _("Sort routine missing");
150
    }
151
    if (_alertString.length==0) {
152
        document.Aform.submit();
153
    } else {
154
        alertString2  = _("Form not submitted because of the following problem(s)");
155
        alertString2 += "\n------------------------------------------------------------------------------------\n";
156
        alertString2 += _alertString;
157
        alert(alertString2);
158
    }
159
}
160
161
//]]>
127
//]]>
162
</script>
128
</script>
163
<style type="text/css">
129
<style type="text/css">
Lines 197-203 function CheckRuleForm(f) { Link Here
197
  [% ELSE %]
163
  [% ELSE %]
198
<h2>Add record matching rule</h2>
164
<h2>Add record matching rule</h2>
199
  [% END %]
165
  [% END %]
200
<form action="[% script_name %]" name="Aform" method="post">
166
<form action="[% script_name %]" name="Aform" method="post" class="validated">
201
  <input type="hidden" name="op" value="[% confirm_op %]" />
167
  <input type="hidden" name="op" value="[% confirm_op %]" />
202
  <fieldset class="rows">
168
  <fieldset class="rows">
203
    <ol>
169
    <ol>
Lines 209-227 function CheckRuleForm(f) { Link Here
209
            [% code %]
175
            [% code %]
210
          [% ELSE %]
176
          [% ELSE %]
211
		  <label for="code" class="required">Matching rule code: </label>
177
		  <label for="code" class="required">Matching rule code: </label>
212
            <input type="text" id="code" name="code"  size="10" maxlength="10" /> <span class="required">Required</span>
178
            <input type="text" id="code" name="code"  size="10" maxlength="10" class="required" required="required" /> <span class="required">Required</span>
213
          [% END %]
179
          [% END %]
214
       </li>
180
       </li>
215
       <li><label for="description" class="required">Description: </label>
181
       <li><label for="description" class="required">Description: </label>
216
           <input type="text" id="description" name="description" size="50" maxlength="250" 
182
           <input type="text" id="description" name="description" size="50" maxlength="250" 
217
                  value="[% description |html %]" /> <span class="required">Required</span>
183
                  value="[% description |html %]" class="required" required="required" /> <span class="required">Required</span>
218
       </li>
184
       </li>
219
       <li><label for="threshold" class="required">Match threshold: </label>
185
       <li><label for="threshold" class="required">Match threshold: </label>
220
           <input type="text" id="threshold" name="threshold" size="5" maxlength="5" 
186
           <input type="text" id="threshold" name="threshold" size="5" maxlength="5" 
221
                  value="[% threshold |html %]" /> <span class="required">Required</span>
187
                  value="[% threshold |html %]" class="required" required="required" /> <span class="required">Required</span>
222
       </li>
188
       </li>
223
       <li><label for="record_type" class="required">Record type: </label>
189
       <li><label for="record_type" class="required">Record type: </label>
224
           <select id="record_type" name="record_type">
190
           <select id="record_type" name="record_type" class="required" required="required" >
225
               [% IF ( record_type == "authority" ) %]
191
               [% IF ( record_type == "authority" ) %]
226
                   <option value="biblio">Bibliographic record</option>
192
                   <option value="biblio">Bibliographic record</option>
227
                   <option value="authority" selected="selected">Authority record</option>
193
                   <option value="authority" selected="selected">Authority record</option>
Lines 237-249 function CheckRuleForm(f) { Link Here
237
  <fieldset class="rows" id="match_points">
203
  <fieldset class="rows" id="match_points">
238
  <h4>Match points</h4>
204
  <h4>Match points</h4>
239
  [% IF ( edit_matching_rule ) %]
205
  [% IF ( edit_matching_rule ) %]
240
  [% IF ( matchpoints ) %]<p id="addMatchPoint" style="display:none;">[% ELSE %]<p id="addMatchPoint">[% END %]<a href="#" class="button" onclick="InsertMatchpoint('mp_1', 'mp_template'); return false;">Add match point</a></p>
206
    [% IF ( matchpoints ) %]
241
  [% ELSE %]<p id="addMatchPoint" style="display:none;"><a href="#" class="button" onclick="InsertMatchpoint('mp_1', 'mp_template'); return false;">Add match point</a></p>[% END %]
207
        <p id="addMatchPoint" style="display:none;">
208
    [% ELSE %]
209
        <p id="addMatchPoint">
210
    [% END %]
211
        <a href="#" class="insert_match_point button" data-loc="mp_1" data-index="mp_template"><i class="fa fa-plus"></i> Add match point</a></p>
212
  [% ELSE %]
213
    <p id="addMatchPoint" style="display:none;"><a href="#" class="insert_match_point button" data-loc="mp_1" data-index="mp_template"><i class="fa fa-plus"></i> Add match point</a></p>
214
  [% END %]
242
  [% IF ( edit_matching_rule ) %]
215
  [% IF ( edit_matching_rule ) %]
243
  [% FOREACH matchpoint IN matchpoints %]
216
  [% FOREACH matchpoint IN matchpoints %]
244
  <div id="mp_[% matchpoint.mp_num %]" class="matchgroup">
217
  <div id="mp_[% matchpoint.mp_num %]" class="matchgroup">
245
  <fieldset class="rows">
218
  <fieldset class="rows">
246
    <legend>Match point [% matchpoint.mp_num %] | <a href="#" class="button" onclick="InsertMatchpoint('mp_[% matchpoint.mp_num %]', 'mp_template'); return false;">Add match point</a> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;">Remove this match point</a></legend>
219
    <legend>Match point [% matchpoint.mp_num %] | <a href="#" class="insert_match_point button" data-loc="mp_[% matchpoint.mp_num %]" data-index="mp_template"><i class="fa fa-plus"></i> Add match point</a> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;"><i class="fa fa-trash"></i> Remove this match point</a></legend>
247
    <ol>
220
    <ol>
248
      <li>
221
      <li>
249
        <label for="mp_[% matchpoint.mp_num %]_search_index">Search index: </label>
222
        <label for="mp_[% matchpoint.mp_num %]_search_index">Search index: </label>
Lines 295-301 function CheckRuleForm(f) { Link Here
295
              [% FOREACH norm IN component.norms %]
268
              [% FOREACH norm IN component.norms %]
296
              <li id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]">
269
              <li id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]">
297
                <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm">Normalization rule: </label>
270
                <label for="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm">Normalization rule: </label>
298
                <input type="text" id="mp_[% norm.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm" 
271
                <input type="text" id="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n__[% norm.norm_num %]_norm"
299
                       name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]_norm" 
272
                       name="mp_[% matchpoint.mp_num %]_c_[% component.comp_num %]_n_[% norm.norm_num %]_norm" 
300
                       value="[% norm.norm |html %]"
273
                       value="[% norm.norm |html %]"
301
                       size="20" maxlength="50" />
274
                       size="20" maxlength="50" />
Lines 313-319 function CheckRuleForm(f) { Link Here
313
  [% ELSE %]
286
  [% ELSE %]
314
  <div id="mp_1" class="matchgroup">
287
  <div id="mp_1" class="matchgroup">
315
  <fieldset class="rows">
288
  <fieldset class="rows">
316
    <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>
289
    <legend>Match point 1 | <a href="#" class="insert_match_point button" data-loc="mp_1" data-index="mp_template"><i class="fa fa-plus"></i> Add match point</a> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;"><i class="fa fa-trash"></i> Remove this match point</a></legend>
317
    <ol>
290
    <ol>
318
      <li>
291
      <li>
319
        <label for="mp_1_search_index">Search index: </label>
292
        <label for="mp_1_search_index">Search index: </label>
Lines 360-372 function CheckRuleForm(f) { Link Here
360
  <fieldset class="rows" id="match_checks">
333
  <fieldset class="rows" id="match_checks">
361
  <h4>Required match checks</h4>
334
  <h4>Required match checks</h4>
362
  [% IF ( edit_matching_rule ) %]
335
  [% IF ( edit_matching_rule ) %]
363
  [% IF ( matchchecks ) %]<p id="addMatchCheck" style="display:none;">[% ELSE %]<p id="addMatchCheck">[% END %]<a href="#" class="button" onclick="InsertMatchcheck('mc_1', 'mc_template'); return false;">Add match check</a></p>
336
  [% IF ( matchchecks ) %]<p id="addMatchCheck" style="display:none;">[% ELSE %]<p id="addMatchCheck">[% END %]<a href="#" class="insert_match_check button" data-loc="mc_1" data-index="mc_template"><i class="fa fa-plus"></i> Add match check</a></p>
364
  [% ELSE %]<p id="addMatchCheck" style="display:none;"><a href="#" class="button" onclick="InsertMatchcheck('mc_1', 'mc_template'); return false;">Add match check</a></p>[% END %]
337
  [% ELSE %]<p id="addMatchCheck" style="display:none;"><a href="#" class="insert_match_check button" data-loc="mc_1" data-index="mc_template"><i class="fa fa-plus"></i> Add match check</a></p>[% END %]
365
  [% IF ( edit_matching_rule ) %]
338
  [% IF ( edit_matching_rule ) %]
366
  [% FOREACH matchcheck IN matchchecks %]
339
  [% FOREACH matchcheck IN matchchecks %]
367
  <div id="mc_[% matchcheck.mc_num %]" class="matchgroup">
340
  <div id="mc_[% matchcheck.mc_num %]" class="matchgroup">
368
  <fieldset class="rows">
341
  <fieldset class="rows">
369
    <legend>Match check [% matchcheck.mc_num %]<a href="#" class="button" onclick="InsertMatchcheck('mc_[% matchcheck.mc_num %]', 'mc_template'); return false;">Add match check</a> | <a href="#" class="button" onclick="DeleteMatchcheck(this); return false;">Remove this match check</a></legend>
342
    <legend>Match check [% matchcheck.mc_num %] | <a href="#" class="insert_match_check button" data-loc="mc_[% matchcheck.mc_num %]" data-index="mc_template"><i class="fa fa-plus"></i> Add match check</a> | <a href="#" class="delete_match_check button"><i class="fa fa-trash"></i> Remove this match check</a></legend>
370
    <input type="hidden" id="mc_[% matchcheck.mc_num %]_id" name="mc_[% matchcheck.mc_num %]_id" value="1" />
343
    <input type="hidden" id="mc_[% matchcheck.mc_num %]_id" name="mc_[% matchcheck.mc_num %]_id" value="1" />
371
      [% FOREACH src_component IN matchcheck.src_components %]
344
      [% FOREACH src_component IN matchcheck.src_components %]
372
      <fieldset class="rows" id="mc_[% src_component.mc_num %]_src_c_[% src_component.comp_num %]">
345
      <fieldset class="rows" id="mc_[% src_component.mc_num %]_src_c_[% src_component.comp_num %]">
Lines 463-469 function CheckRuleForm(f) { Link Here
463
  [% ELSE %]
436
  [% ELSE %]
464
  <div id="mc_1" class="matchgroup">
437
  <div id="mc_1" class="matchgroup">
465
  <fieldset class="rows">
438
  <fieldset class="rows">
466
    <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>
439
    <legend>Match check 1 | <a href="#" class="insert_match_check button" data-loc="mc_1" data-index="mc_template"><i class="fa fa-plus"></i> Add match check</a> | <a href="#" class="delete_match_check button"><i class="fa fa-trash"></i> Remove this match check</a></legend>
467
    <input type="hidden" id="mc_1_id" name="mc_1_id" value="1" />
440
    <input type="hidden" id="mc_1_id" name="mc_1_id" value="1" />
468
      <fieldset class="rows" id="mc_1_src_c_1">
441
      <fieldset class="rows" id="mc_1_src_c_1">
469
        <legend>Source (incoming) record check field</legend>
442
        <legend>Source (incoming) record check field</legend>
Lines 522-534 function CheckRuleForm(f) { Link Here
522
  [% END %]
495
  [% END %]
523
  </fieldset>
496
  </fieldset>
524
  <fieldset class="action">
497
  <fieldset class="action">
525
    [% IF ( edit_matching_rule ) %]
498
    <input type="submit" value="Save" />
526
    <input type="button" value="Save"
499
527
           onclick="CheckMatchingRuleForm(this.form)" />
528
    [% ELSE %]
529
    <input type="button" value="Save"
530
           onclick="CheckMatchingRuleForm(this.form)" />
531
    [% END %]
532
    <a class="cancel" href="/cgi-bin/koha/admin/matching-rules.pl">Cancel</a>
500
    <a class="cancel" href="/cgi-bin/koha/admin/matching-rules.pl">Cancel</a>
533
  </fieldset>
501
  </fieldset>
534
</form>
502
</form>
Lines 590-596 function CheckRuleForm(f) { Link Here
590
 [% IF ( matching_rule_form ) %]
558
 [% IF ( matching_rule_form ) %]
591
<div id="mp_template" class="matchgroup" style="display:none;">
559
<div id="mp_template" class="matchgroup" style="display:none;">
592
  <fieldset class="rows">
560
  <fieldset class="rows">
593
    <legend>Match point <span class="counter"></span> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;">Remove this match point</a></legend>
561
    <legend>Match point <span class="counter"></span> | <a href="#" class="button" onclick="DeleteMatchpoint(this); return false;"><i class="fa fa-trash"></i> Remove this match point</a></legend>
594
    <ol>
562
    <ol>
595
      <li>
563
      <li>
596
        <label for="mp_num_search_index">Search index: </label>
564
        <label for="mp_num_search_index">Search index: </label>
Lines 633-639 function CheckRuleForm(f) { Link Here
633
601
634
<div id="mc_template" class="matchgroup" style="display:none">
602
<div id="mc_template" class="matchgroup" style="display:none">
635
<fieldset class="rows">
603
<fieldset class="rows">
636
  <legend>Match check <span class="counter"></span> | <a href="#" class="button" onclick="DeleteMatchcheck(this); return false;">Remove this match check</a></legend>
604
  <legend>Match check <span class="counter"></span> | <a href="#" class="delete_match_check button"><i class="fa fa-trash"></i> Remove this match check</a></legend>
637
  <input type="hidden" id="mc_num_id" name="mc_num_id" value="1" />
605
  <input type="hidden" id="mc_num_id" name="mc_num_id" value="1" />
638
    <fieldset class="rows" id="mc_num_src_c_1">
606
    <fieldset class="rows" id="mc_num_src_c_1">
639
      <legend>Source (incoming) record check field</legend>
607
      <legend>Source (incoming) record check field</legend>
640
- 

Return to bug 16763