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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-34 / +40 lines)
Lines 65-80 Link Here
65
                    <a class="select-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a>
65
                    <a class="select-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-check"></i> Select all</a>
66
                    |
66
                    |
67
                    <a class="clear-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-remove"></i> Clear all</a>
67
                    <a class="clear-all" href="#" data-tab="[% tab | html %]"><i class="fa fa-remove"></i> Clear all</a>
68
                    <span class="itemselection_actions">
68
                    <span class="itemselection_actions [% tab | html %]">
69
                        | Actions:
69
                        | Actions:
70
                        <a class="itemselection_action_modify"><i class="fa fa-pencil"></i> Edit selected serials</a>
70
                        <a href="#" data-tab="[% tab | html %]" class="itemselection_action_modify"><i class="fa fa-pencil"></i> Edit selected serials</a>
71
                    </span>
71
                    </span>
72
                </div>
72
                </div>
73
            [% END %]
73
            [% END %]
74
            <table>
74
            <table>
75
                <thead>
75
                <thead>
76
                    <tr>
76
                    <tr>
77
                        <th></th>
77
                        <th class="NoSort noExport"></th>
78
                        <th>ISSN</th>
78
                        <th>ISSN</th>
79
                        <th class="anti-the">Title</th>
79
                        <th class="anti-the">Title</th>
80
                        <th>Notes</th>
80
                        <th>Notes</th>
Lines 96-102 Link Here
96
                            <tr>
96
                            <tr>
97
                                <td>
97
                                <td>
98
                                    [% UNLESS subscription.cannotedit %]
98
                                    [% UNLESS subscription.cannotedit %]
99
                                        <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" />
99
                                        <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" class="[% tab | html %]" />
100
                                    [% ELSE %]
100
                                    [% ELSE %]
101
                                        <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" disabled="disabled" title="You cannot edit this subscription" />
101
                                        <input type="checkbox" name="subscriptionid" value="[% subscription.subscriptionid | html %]" disabled="disabled" title="You cannot edit this subscription" />
102
                                    [% END %]
102
                                    [% END %]
Lines 322-351 Link Here
322
    [% Asset.js("js/serials-toolbar.js") | $raw %]
322
    [% Asset.js("js/serials-toolbar.js") | $raw %]
323
    <script>
323
    <script>
324
324
325
            function itemSelectionBuildEditLink(div) {
325
        function itemSelectionBuildEditLink( tab ) {
326
                var subscription_ids = new Array();
326
            var subscription_ids = new Array();
327
                $("input[name='subscriptionid'][type='checkbox']:checked", div).each(function() {
327
            $( "input:checkbox." + tab + ":checked" ).each(function() {
328
                    subscription_ids.push($(this).val());
328
                subscription_ids.push( $(this).val() );
329
                });
329
            });
330
                if (subscription_ids.length > 0) {
331
                    var url = "[% edit_action_link | html %]";
332
                    url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
333
                    $('a.itemselection_action_modify').attr('href', url);
334
                } else {
335
                    return false;
336
                }
337
                return true;
338
            }
339
330
340
            function itemSelectionBuildActionLinks(tab) {
331
            if (subscription_ids.length > 0) {
341
                var div = $("#" + tab);
332
                var url = "[% edit_action_link | html %]";
342
                var modify_link_ok = itemSelectionBuildEditLink(div);
333
                url += '&subscriptionid=' + subscription_ids.join('&subscriptionid=');
343
                if (modify_link_ok) {
334
                location.href = url;
344
                    $('.itemselection_actions', div).show();
335
            } else {
345
                } else {
336
                return false;
346
                    $('.itemselection_actions', div).hide();
347
                }
348
            }
337
            }
338
        }
339
340
        function enableCheckboxActions( tab ){
341
            // Enable/disable controls if checkboxes are checked
342
            var checked_count = $("input:checkbox." + tab + ":checked").length;
343
            if( checked_count > 0 ){
344
                $(".itemselection_actions." + tab ).show();
345
            } else {
346
                $(".itemselection_actions." + tab ).hide();
347
            }
348
        }
349
349
350
        $(document).ready(function() {
350
        $(document).ready(function() {
351
            var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
351
            var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, {
Lines 385-401 Link Here
385
385
386
            $('.select-all, .clear-all').on('click', function(e) {
386
            $('.select-all, .clear-all').on('click', function(e) {
387
                e.preventDefault();
387
                e.preventDefault();
388
                var checkboxes = $(this).parents('form').find('input[type="checkbox"]');
389
                checkboxes.prop('checked', $(this).hasClass('select-all'));
390
                var tab = $(this).data("tab");
388
                var tab = $(this).data("tab");
391
                itemSelectionBuildActionLinks(tab);
389
                var checkboxes = $("input:checkbox." + tab );
390
                checkboxes.prop('checked', $(this).hasClass('select-all')).change();
391
                enableCheckboxActions(tab);
392
            });
392
            });
393
393
394
            itemSelectionBuildActionLinks("opened");
394
            enableCheckboxActions("opened");
395
            itemSelectionBuildActionLinks("closed");
395
            enableCheckboxActions("closed");
396
396
            $("input[name='subscriptionid'][type='checkbox']").change(function() {
397
            $("input[name='subscriptionid'][type='checkbox']").change(function() {
397
                var div = $(this).parents('form').parent().attr("id");
398
                var tab = $(this).attr("class");
398
                itemSelectionBuildActionLinks(div);
399
                enableCheckboxActions( tab );
400
            });
401
402
            $(".itemselection_action_modify").on("click", function(e){
403
                e.preventDefault();
404
                var tab = $(this).data("tab");
405
                itemSelectionBuildEditLink( tab );
399
            });
406
            });
400
407
401
            [% IF ( mana ) %]
408
            [% IF ( mana ) %]
402
- 

Return to bug 33560