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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt (-4 / +31 lines)
Lines 43-68 function onActionChange(selectObj) { Link Here
43
            show('field_number_block');
43
            show('field_number_block');
44
            hide('with_value_block');
44
            hide('with_value_block');
45
            hide('to_field_block');
45
            hide('to_field_block');
46
            show('from_field_inputs');
47
            hide('xslt_file_block');
46
            break;
48
            break;
47
49
48
        case 'update_field':
50
        case 'update_field':
49
            hide('field_number_block');
51
            hide('field_number_block');
50
            show('with_value_block');
52
            show('with_value_block');
51
            hide('to_field_block');
53
            hide('to_field_block');
54
            show('from_field_inputs');
55
            hide('xslt_file_block');
52
            break;
56
            break;
53
57
54
        case 'move_field':
58
        case 'move_field':
55
            show('field_number_block');
59
            show('field_number_block');
56
            hide('with_value_block');
60
            hide('with_value_block');
57
            show('to_field_block');
61
            show('to_field_block');
62
            show('from_field_inputs');
63
            hide('xslt_file_block');
58
            break;
64
            break;
59
65
60
        case 'copy_field':
66
        case 'copy_field':
61
            show('field_number_block');
67
            show('field_number_block');
62
            hide('with_value_block');
68
            hide('with_value_block');
63
            show('to_field_block');
69
            show('to_field_block');
70
            show('from_field_inputs');
71
            hide('xslt_file_block');
64
            break;
72
            break;
65
73
74
        case 'run_xslt':
75
            hide('field_number_block');
76
            hide('with_value_block');
77
            hide('to_field_block');
78
            hide('from_field_inputs');
79
            show('xslt_file_block');
80
            break;
66
    }
81
    }
67
}
82
}
68
83
Lines 165-171 var action_submit_value; Link Here
165
180
166
function editAction( mmta_id, ordering, action, field_number, from_field, from_subfield, field_value, to_field,
181
function editAction( mmta_id, ordering, action, field_number, from_field, from_subfield, field_value, to_field,
167
    to_subfield, to_regex_search, to_regex_replace, to_regex_modifiers, conditional, conditional_field, conditional_subfield,
182
    to_subfield, to_regex_search, to_regex_replace, to_regex_modifiers, conditional, conditional_field, conditional_subfield,
168
    conditional_comparison, conditional_value, conditional_regex, description
183
    conditional_comparison, conditional_value, conditional_regex, description, run_xslt
169
) {
184
) {
170
    document.getElementById('mmta_id').value = mmta_id;
185
    document.getElementById('mmta_id').value = mmta_id;
171
186
Lines 200-205 function editAction( mmta_id, ordering, action, field_number, from_field, from_s Link Here
200
    document.getElementById('conditional_regex').checked = parseInt( conditional_regex );
215
    document.getElementById('conditional_regex').checked = parseInt( conditional_regex );
201
216
202
    document.getElementById('description').value = description;
217
    document.getElementById('description').value = description;
218
    document.getElementById('run_xslt').value = run_xslt;
203
219
204
    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
220
    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
205
    document.getElementById('modaction_legend').innerHTML = _("Edit action %s").format(ordering);
221
    document.getElementById('modaction_legend').innerHTML = _("Edit action %s").format(ordering);
Lines 244-249 function cancelEditAction() { Link Here
244
    document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml;
260
    document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml;
245
    document.getElementById('action_submit').value = window.action_submit_value;
261
    document.getElementById('action_submit').value = window.action_submit_value;
246
262
263
    $("#description").val("");
264
247
    hide('cancel_edit');
265
    hide('cancel_edit');
248
}
266
}
249
267
Lines 349-355 function setSelectByValue( selectId, value ) { Link Here
349
                                        [% END %]
367
                                        [% END %]
350
                                    [% END %]
368
                                    [% END %]
351
369
352
                                    field
370
                                    [% IF ActionsLoo.run_xslt %]
371
                                        Run [% ActionsLoo.run_xslt %]
372
                                    [% ELSE %]
373
                                        field
374
                                    [% END %]
353
375
354
                                    [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %]
376
                                    [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %]
355
377
Lines 401-407 function setSelectByValue( selectId, value ) { Link Here
401
                                                    "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
423
                                                    "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
402
                                                    "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
424
                                                    "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
403
                                                    "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
425
                                                    "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
404
                                                    "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
426
                                                    "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
427
                                                    "[% ActionsLoo.run_xslt %]"
405
                                                )'>Edit</a></td>
428
                                                )'>Edit</a></td>
406
                                <td><a href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id %]">Delete</a></td>
429
                                <td><a href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id %]">Delete</a></td>
407
                            </tr>
430
                            </tr>
Lines 422-429 function setSelectByValue( selectId, value ) { Link Here
422
                            <option value="update_field">Add/Update</option>
445
                            <option value="update_field">Add/Update</option>
423
                            <option value="move_field">Move</option>
446
                            <option value="move_field">Move</option>
424
                            <option value="copy_field">Copy</option>
447
                            <option value="copy_field">Copy</option>
448
                            <option value="run_xslt">Run XSLT</option>
425
                        </select>
449
                        </select>
426
450
451
                        <span id="xslt_file_block">
452
                            <input type="text" name="run_xslt" id="run_xslt" size="100"/>
453
                        </span>
427
                        <span id="field_number_block">
454
                        <span id="field_number_block">
428
                            <select name="field_number" id="field_number">
455
                            <select name="field_number" id="field_number">
429
                                <option value="0">All</option>
456
                                <option value="0">All</option>
Lines 431-437 function setSelectByValue( selectId, value ) { Link Here
431
                            </select>
458
                            </select>
432
                        </span>
459
                        </span>
433
460
434
                        field(s) <input type="text" name="from_field" id="from_field" size="3" maxlength="3" /> <input type="text" name="from_subfield" id="from_subfield" size="1" maxlength="1" />
461
                        <span id="from_field_inputs">field(s) <input type="text" name="from_field" id="from_field" size="3" maxlength="3" /> <input type="text" name="from_subfield" id="from_subfield" size="1" maxlength="1" /></span>
435
462
436
                        <span name="with_value_block" id="with_value_block" style="display:none;">
463
                        <span name="with_value_block" id="with_value_block" style="display:none;">
437
                            with value <input type="text" name="field_value" id="field_value" />
464
                            with value <input type="text" name="field_value" id="field_value" />
(-)a/tools/marc_modification_templates.pl (-6 / +7 lines)
Lines 69-76 if ( $op eq "create_template" ) { Link Here
69
  my $conditional_value = $cgi->param('conditional_value');
69
  my $conditional_value = $cgi->param('conditional_value');
70
  my $conditional_regex = ( $cgi->param('conditional_regex') eq 'on' ) ? 1 : 0;
70
  my $conditional_regex = ( $cgi->param('conditional_regex') eq 'on' ) ? 1 : 0;
71
  my $description = $cgi->param('description');
71
  my $description = $cgi->param('description');
72
  my $run_xslt = $cgi->param('run_xslt');
72
73
73
    if ($from_field) {
74
    if ( $from_field || $run_xslt ) {
74
        unless ($mmta_id) {
75
        unless ($mmta_id) {
75
            AddModificationTemplateAction(
76
            AddModificationTemplateAction(
76
                $template_id,            $action,
77
                $template_id,            $action,
Lines 81-87 if ( $op eq "create_template" ) { Link Here
81
                $to_regex_modifiers,     $conditional,
82
                $to_regex_modifiers,     $conditional,
82
                $conditional_field,      $conditional_subfield,
83
                $conditional_field,      $conditional_subfield,
83
                $conditional_comparison, $conditional_value,
84
                $conditional_comparison, $conditional_value,
84
                $conditional_regex,      $description
85
                $conditional_regex,      $description,
86
                $run_xslt,
85
            );
87
            );
86
        }
88
        }
87
        else {
89
        else {
Lines 94-104 if ( $op eq "create_template" ) { Link Here
94
                $to_regex_modifiers,     $conditional,
96
                $to_regex_modifiers,     $conditional,
95
                $conditional_field,      $conditional_subfield,
97
                $conditional_field,      $conditional_subfield,
96
                $conditional_comparison, $conditional_value,
98
                $conditional_comparison, $conditional_value,
97
                $conditional_regex,      $description
99
                $conditional_regex,      $description,
100
                $run_xslt,
98
            );
101
            );
99
        }
102
        }
100
    }
103
    } else {
101
    else {
102
        $template->param( error => 'no_from_field' );
104
        $template->param( error => 'no_from_field' );
103
    }
105
    }
104
106
105
- 

Return to bug 12754