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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt (-17 / +88 lines)
Lines 16-37 Link Here
16
	[% END %]
16
	[% END %]
17
</title>
17
</title>
18
[% INCLUDE 'doc-head-close.inc' %]
18
[% INCLUDE 'doc-head-close.inc' %]
19
<style>
19
[% Asset.css("css/humanmsg.css") | $raw %]
20
fieldset.rows label.viewlog {
20
[% FILTER collapse %]
21
    float: none;
21
    <style>
22
    font-weight: normal;
22
        fieldset.rows label.viewlog {
23
    margin: 0;
23
            float: none;
24
    min-width: 9em;
24
            font-weight: normal;
25
    padding: .5em;
25
            margin: 0;
26
    text-align: left;
26
            min-width: 9em;
27
    white-space: nowrap;
27
            padding: .5em;
28
    width: auto;
28
            text-align: left;
29
}
29
            white-space: nowrap;
30
.log_modules {
30
            width: auto;
31
    display: flex;
31
        }
32
    flex-wrap: wrap;
32
        .log_modules {
33
}
33
            display: flex;
34
</style>
34
            flex-wrap: wrap;
35
        }
36
        .compare_info {
37
            background-color: #E6F0F2;
38
            margin: .5em -.5em -.5em -.5em;
39
            padding: .5em;
40
            text-align: right;
41
        }
42
        .modal-dialog {
43
            width : 90%;
44
        }
45
        /* jsdiff styles */
46
        ins {
47
            background-color: #e6ffe6;
48
        }
49
        del {
50
            background-color: #ffe6e6;
51
        }
52
        #col1 ins,
53
        #col2 del {
54
            display: none;
55
        }
56
        pre {
57
            overflow: scroll;
58
            padding: 10px;
59
        }
60
    </style>
61
[% END %]
35
</head>
62
</head>
36
63
37
<body id="tools_viewlog" class="tools">
64
<body id="tools_viewlog" class="tools">
Lines 224-229 fieldset.rows label.viewlog { Link Here
224
                [% IF ( do_it ) %]
251
                [% IF ( do_it ) %]
225
                    [% IF ( total ) %]
252
                    [% IF ( total ) %]
226
                        <h3>Log entries</h3>
253
                        <h3>Log entries</h3>
254
                        <div id="toolbar" class="btn-toolbar">
255
                            <a href="#" id="select_none" class="btn btn-link disabled"><i class="fa fa-remove"></i> Check none</a>
256
                            <button class="btn btn-link disabled compare_link"><i class="fa fa-columns"></i> Compare selected</button>
257
                        </div>
227
                        <table id="logst">
258
                        <table id="logst">
228
                            <thead>
259
                            <thead>
229
                                <tr>
260
                                <tr>
Lines 283-289 fieldset.rows label.viewlog { Link Here
283
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
314
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
284
                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a>
315
                                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&amp;biblionumber=[% loopro.biblionumber | uri %]&amp;bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" title="Display detail for this item">Item [% loopro.barcode | html %]</a>
285
                                        [% ELSE %]
316
                                        [% ELSE %]
286
                                            [% loopro.info | html %]
317
                                            [% IF loopro.module == "SYSTEMPREFERENCE" %]
318
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">
319
                                                    [% loopro.info | html %]
320
                                                </div>
321
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
322
                                                    <label><input type="checkbox" name="diff" id="action_id[% loopro.action_id | html %]" data-actionid="[% loopro.action_id | html %]" data-filter="[% FOREACH info IN loopro.info.split(' \| ') %][% IF loop.first %][% info | html %][% END %][% END %]" class="compare" /> Compare</label>
323
                                                </div>
324
                                            [% ELSE %]
325
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">
326
                                                    [% loopro.info | html %]
327
                                                </div>
328
                                            [% END %]
287
                                        [% END %]
329
                                        [% END %]
288
                                    </td>
330
                                    </td>
289
                                    <td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td>
331
                                    <td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td>
Lines 324-338 fieldset.rows label.viewlog { Link Here
324
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
366
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
325
     </div> <!-- /.row -->
367
     </div> <!-- /.row -->
326
368
369
<div class="modal" id="compareInfo" tabindex="-1" role="dialog" aria-labelledby="compareInfoLabel">
370
    <div class="modal-dialog modal-lg" role="document">
371
        <div class="modal-content">
372
            <div class="modal-header">
373
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
374
                <h4 class="modal-title" id="compareInfoLabel">Compare preference values</h4>
375
            </div>
376
            <div class="modal-body">
377
                <div class="row">
378
                    <div class="compare_pane col-sm-6" id="col1">
379
                        <h5>Older version</h5>
380
                        <pre></pre>
381
                    </div>
382
                    <div class="compare_pane col-sm-6" id="col2">
383
                        <h5>Newer version</h5>
384
                        <pre></pre>
385
                    </div>
386
                </div>
387
            </div> <!-- /.modal-body -->
388
            <div class="modal-footer">
389
                <button type="button" class="btn btn-default deny" data-dismiss="modal">Close</button>
390
            </div>
391
        </div> <!-- /.modal-content -->
392
    </div> <!-- /.modal-dialog -->
393
</div> <!-- /#compareInfo -->
394
327
[% MACRO jsinclude BLOCK %]
395
[% MACRO jsinclude BLOCK %]
328
    [% INCLUDE 'calendar.inc' %]
396
    [% INCLUDE 'calendar.inc' %]
329
    [% INCLUDE 'datatables.inc' %]
397
    [% INCLUDE 'datatables.inc' %]
330
    [% INCLUDE 'columns_settings.inc' %]
398
    [% INCLUDE 'columns_settings.inc' %]
399
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
331
    [% Asset.js("js/tools-menu.js") | $raw %]
400
    [% Asset.js("js/tools-menu.js") | $raw %]
401
    [% Asset.js("lib/hc-sticky.js") | $raw %]
332
    [% IF ( circulation ) %]
402
    [% IF ( circulation ) %]
333
        [% INCLUDE 'str/members-menu.inc' %]
403
        [% INCLUDE 'str/members-menu.inc' %]
334
        [% Asset.js("js/members-menu.js") | $raw %]
404
        [% Asset.js("js/members-menu.js") | $raw %]
335
    [% END %]
405
    [% END %]
406
    [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
336
    <script>
407
    <script>
337
        var columns_settings = [% TablesSettings.GetColumns('tools', 'logviewer', 'logst', 'json') | $raw %];
408
        var columns_settings = [% TablesSettings.GetColumns('tools', 'logviewer', 'logst', 'json') | $raw %];
338
    </script>
409
    </script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js (-1 / +70 lines)
Lines 1-3 Link Here
1
var Sticky;
2
1
function tickAll(section){
3
function tickAll(section){
2
    $("input[type='checkbox'][name='" + section + "']").prop("checked", true);
4
    $("input[type='checkbox'][name='" + section + "']").prop("checked", true);
3
    $("#" + section.slice(0,-1) + "ALL").prop("checked", true);
5
    $("#" + section.slice(0,-1) + "ALL").prop("checked", true);
Lines 10-16 function untickAll(section){ Link Here
10
    $("input[type='checkbox'][name='" + section + "']").prop("disabled", false);
12
    $("input[type='checkbox'][name='" + section + "']").prop("disabled", false);
11
}
13
}
12
14
15
function limitCheckboxes() {
16
    var checkboxes = $(".compare");
17
    var limit = 2;
18
    var compare_link = '<a href="#" class="btn btn-link compare_link"><i class="fa fa-columns"></i> ' + __("View comparison") + '</a>';
19
    checkboxes.each(function(){
20
        $(this).on("change", function(){
21
            var checked = [];
22
            checkboxes.each(function () {
23
                if( $(this).prop("checked") ){
24
                    checked.push( $(this).data("actionid") );
25
                }
26
            });
27
            if (checked.length > 0) {
28
                $("#select_none").removeClass("disabled");
29
            } else {
30
                $("#select_none").addClass("disabled");
31
                $("#logst").DataTable().search("").draw();
32
            }
33
            if( checked.length == 1 ){
34
                $("#logst").DataTable().search($(this).data("filter")).draw();
35
                humanMsg.displayAlert( __("Showing results for %s").format( $(this).data("filter") ) );
36
            }
37
            if( checked.length == 2 ){
38
                $("#compare_info" + checked[0]).prepend( compare_link );
39
                $("#compare_info" + checked[1]).prepend( compare_link );
40
                $("button.compare_link").removeClass("disabled");
41
            } else if (checked.length > limit) {
42
                humanMsg.displayAlert( __("You can select maximum of two checkboxes") );
43
                $(this).prop("checked", false );
44
            } else if (checked.length < limit) {
45
                $("a.compare_link").remove();
46
                $("button.compare_link").addClass("disabled");
47
            }
48
        });
49
    });
50
}
51
13
$(document).ready(function(){
52
$(document).ready(function(){
53
    limitCheckboxes();
54
    if ($('#toolbar').length) {
55
        Sticky = $("#toolbar");
56
        Sticky.hcSticky({
57
            stickTo: "main",
58
            stickyClass: "floating"
59
        });
60
    }
14
61
15
    if ( $('input[type="checkbox"][name="modules"]:checked').length == 0 ) {
62
    if ( $('input[type="checkbox"][name="modules"]:checked').length == 0 ) {
16
        tickAll('modules');
63
        tickAll('modules');
Lines 67-70 $(document).ready(function(){ Link Here
67
        "order": [[0, "desc"]],
114
        "order": [[0, "desc"]],
68
        "pagingType" : "full"
115
        "pagingType" : "full"
69
    }, columns_settings);
116
    }, columns_settings);
117
118
    $("body").on("click", ".compare_link", function(e){
119
        e.preventDefault();
120
        if( $(this).hasClass('disabled') ){
121
            humanMsg.displayAlert( __("You must select two entries to compare") );
122
        } else {
123
            var firstid = $(".compare:checked").eq(0).data("actionid");
124
            var secondid = $(".compare:checked").eq(1).data("actionid");
125
            var firstvalue = $("#loginfo" + firstid).text();
126
            var secondvalue = $("#loginfo" + secondid).text();
127
            var diffs = diffString(secondvalue, firstvalue);
128
            $("#col1 pre,#col2 pre").html(diffs);
129
            $("#compareInfo").modal("show");
130
        }
131
    });
132
    $("#compareInfo").on("hidden.bs.modal", function(){
133
        $("#col1 pre,#col2 pre").html("");
134
    });
135
136
    $("#select_none").on("click", function(e){
137
        e.preventDefault();
138
        $(".compare:checked").prop("checked", false).change();
139
    });
70
});
140
});
71
- 

Return to bug 26207