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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt (-21 / +3 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE JSON.Escape %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
Lines 162-188 Link Here
162
                                        </td>
163
                                        </td>
163
                                        <td>[% ActionsLoo.description | html %]</td>
164
                                        <td>[% ActionsLoo.description | html %]</td>
164
                                        <td>
165
                                        <td>
165
                                            <a class="btn btn-default btn-xs" href="#modaction" onclick='editAction(
166
                                            <a class="btn btn-default btn-xs edit_action" href="#modaction" data-mmta_id="[% ActionsLoo.mmta_id %]"><i class="fa fa-pencil"></i> Edit</a>
166
                                                            "[% ActionsLoo.mmta_id |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
167
                                                            "[% ActionsLoo.ordering |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
168
                                                            "[% ActionsLoo.action |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
169
                                                            "[% ActionsLoo.field_number |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
170
                                                            "[% ActionsLoo.from_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
171
                                                            "[% ActionsLoo.from_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
172
                                                            "[% ActionsLoo.field_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
173
                                                            "[% ActionsLoo.to_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
174
                                                            "[% ActionsLoo.to_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
175
                                                            "[% ActionsLoo.to_regex_search |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
176
                                                            "[% ActionsLoo.to_regex_replace |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
177
                                                            "[% ActionsLoo.to_regex_modifiers |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
178
                                                            "[% ActionsLoo.conditional |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
179
                                                            "[% ActionsLoo.conditional_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
180
                                                            "[% ActionsLoo.conditional_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
181
                                                            "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
182
                                                            "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
183
                                                            "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
184
                                                            "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"
185
                                                        );updateAllEvery();'><i class="fa fa-pencil"></i> Edit</a>
186
                                        </td>
167
                                        </td>
187
                                        <td>
168
                                        <td>
188
                                            <a class="btn btn-default btn-xs" href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id | html %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id | html %]" onclick="return confirmDeleteAction();"><i class="fa fa-trash"></i> Delete</a>
169
                                            <a class="btn btn-default btn-xs" href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id | html %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id | html %]" onclick="return confirmDeleteAction();"><i class="fa fa-trash"></i> Delete</a>
Lines 358-363 Link Here
358
        var MSG_MMT_CONDITIONAL_COMPARISON_REQUIRED = _("The conditional comparison operator should be filled.");
339
        var MSG_MMT_CONDITIONAL_COMPARISON_REQUIRED = _("The conditional comparison operator should be filled.");
359
        var MSG_MMT_CONDITIONAL_VALUE_REQUIRED = _("The conditional value should be filled.");
340
        var MSG_MMT_CONDITIONAL_VALUE_REQUIRED = _("The conditional value should be filled.");
360
        var MSG_MMT_CONDITIONAL_VALUE_REGEX_REQUIRED = _("The conditional regular expression should be filled.");
341
        var MSG_MMT_CONDITIONAL_VALUE_REGEX_REQUIRED = _("The conditional regular expression should be filled.");
342
        var mmtas = [% ActionsLoop.json %]
361
    </script>
343
    </script>
362
    [% Asset.js("js/marc_modification_templates.js") | $raw %]
344
    [% Asset.js("js/marc_modification_templates.js") | $raw %]
363
[% END %]
345
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js (-25 / +29 lines)
Lines 99-104 $(document).ready(function() { Link Here
99
        return confirmDelete();
99
        return confirmDelete();
100
    });
100
    });
101
101
102
    $(".edit_action").on("click", function(){
103
        var mmta_id = $(this).data("mmta_id");
104
        var mmta = $.grep(mmtas, function(elt, id) {
105
            return elt['mmta_id'] == mmta_id;
106
        });
107
        editAction( mmta[0] );
108
        updateAllEvery();
109
    });
102
});
110
});
103
111
104
function updateAllEvery(){
112
function updateAllEvery(){
Lines 258-307 function confirmDelete() { Link Here
258
var modaction_legend_innerhtml;
266
var modaction_legend_innerhtml;
259
var action_submit_value;
267
var action_submit_value;
260
268
261
function editAction( mmta_id, ordering, action, field_number, from_field, from_subfield, field_value, to_field,
269
function editAction( mmta ) {
262
    to_subfield, to_regex_search, to_regex_replace, to_regex_modifiers, conditional, conditional_field, conditional_subfield,
263
    conditional_comparison, conditional_value, conditional_regex, description
264
) {
265
    $("#add_action").show();
270
    $("#add_action").show();
266
    document.getElementById('mmta_id').value = mmta_id;
271
    document.getElementById('mmta_id').value = mmta['mmta_id'];
267
272
268
    setSelectByValue( 'action', action );
273
    setSelectByValue( 'action', mmta['action'] );
269
    $('#action').change();
274
    $('#action').change();
270
275
271
    setSelectByValue( 'field_number', field_number );
276
    setSelectByValue( 'field_number', mmta['field_number'] );
272
277
273
    document.getElementById('from_field').value = from_field;
278
    document.getElementById('from_field').value = mmta['from_field'];
274
    document.getElementById('from_subfield').value = from_subfield;
279
    document.getElementById('from_subfield').value = mmta['from_subfield'];
275
    document.getElementById('field_value').value = field_value;
280
    document.getElementById('field_value').value = mmta['field_value'];
276
    document.getElementById('to_field').value = to_field;
281
    document.getElementById('to_field').value = mmta['to_field'];
277
    document.getElementById('to_subfield').value = to_subfield;
282
    document.getElementById('to_subfield').value = mmta['to_subfield'];
278
    if ( to_regex_search == '' && to_regex_replace == '' && to_regex_modifiers == '' ) {
283
    if ( mmta['regex_search'] == '' && mmta['to_regex_replace'] == '' && mmta['to_regex_modifiers'] == '' ) {
279
        $('#to_field_regex').prop('checked', false).change();
284
        $('#to_field_regex').prop('checked', false).change();
280
    } else {
285
    } else {
281
        $('#to_field_regex').prop('checked', true).change();
286
        $('#to_field_regex').prop('checked', true).change();
282
        $("#to_regex_search").val(to_regex_search);
287
        $("#to_regex_search").val(mmta['to_regex_search']);
283
        $("#to_regex_replace").val(to_regex_replace);
288
        $("#to_regex_replace").val(mmta['to_regex_replace']);
284
        $("#to_regex_modifiers").val(to_regex_modifiers);
289
        $("#to_regex_modifiers").val(mmta['to_regex_modifiers']);
285
    }
290
    }
286
291
287
    setSelectByValue( 'conditional', conditional );
292
    setSelectByValue( 'conditional', mmta['conditional'] );
288
    $('#conditional').change();
293
    $('#conditional').change();
289
294
290
    document.getElementById('conditional_field').value = conditional_field;
295
    document.getElementById('conditional_field').value = mmta['conditional_field'];
291
    document.getElementById('conditional_subfield').value = conditional_subfield;
296
    document.getElementById('conditional_subfield').value = mmta['conditional_subfield'];
292
297
293
    setSelectByValue( 'conditional_comparison', conditional_comparison );
298
    setSelectByValue( 'conditional_comparison', mmta['conditional_comparison'] );
294
    $('#conditional_comparison').change();
299
    $('#conditional_comparison').change();
295
300
296
    document.getElementById('conditional_value').value = conditional_value;
301
    document.getElementById('conditional_value').value = mmta['conditional_value'];
297
302
298
    document.getElementById('conditional_regex').checked = parseInt( conditional_regex );
303
    document.getElementById('conditional_regex').checked = parseInt( mmta['conditional_regex'] );
299
    $('#conditional_regex').change();
304
    $('#conditional_regex').change();
300
305
301
    document.getElementById('description').value = description;
306
    document.getElementById('description').value = mmta['description'];
302
307
303
    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
308
    window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
304
    document.getElementById('modaction_legend').innerHTML = MSG_MMT_EDIT_ACTION.format(ordering);
309
    document.getElementById('modaction_legend').innerHTML = MSG_MMT_EDIT_ACTION.format(mmta['ordering']);
305
310
306
    window.action_submit_value = document.getElementById('action_submit').value;
311
    window.action_submit_value = document.getElementById('action_submit').value;
307
    document.getElementById('action_submit').value = MSG_MMT_UPDATE_ACTION;
312
    document.getElementById('action_submit').value = MSG_MMT_UPDATE_ACTION;
308
- 

Return to bug 15814