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 225-230 fieldset.rows label.viewlog { Link Here
225
                [% IF ( do_it ) %]
252
                [% IF ( do_it ) %]
226
                    [% IF ( total ) %]
253
                    [% IF ( total ) %]
227
                        <h3>Log entries</h3>
254
                        <h3>Log entries</h3>
255
                        <div id="toolbar" class="btn-toolbar">
256
                            <a href="#" id="select_none" class="btn btn-link disabled"><i class="fa fa-remove"></i> Check none</a>
257
                            <button class="btn btn-link disabled compare_link"><i class="fa fa-columns"></i> Compare selected</button>
258
                        </div>
228
                        <table id="logst">
259
                        <table id="logst">
229
                            <thead>
260
                            <thead>
230
                                <tr>
261
                                <tr>
Lines 284-290 fieldset.rows label.viewlog { Link Here
284
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
315
                                        [% IF ( loopro.module == 'CIRCULATION' ) %]
285
                                            <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>
316
                                            <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>
286
                                        [% ELSE %]
317
                                        [% ELSE %]
287
                                            [% loopro.info | html %]
318
                                            [% IF loopro.module == "SYSTEMPREFERENCE" %]
319
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">
320
                                                    [% loopro.info | html %]
321
                                                </div>
322
                                                <div class="compare_info" id="compare_info[% loopro.action_id | html %]">
323
                                                    <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>
324
                                                </div>
325
                                            [% ELSE %]
326
                                                <div class="loginfo" id="loginfo[% loopro.action_id | html %]">
327
                                                    [% loopro.info | html %]
328
                                                </div>
329
                                            [% END %]
288
                                        [% END %]
330
                                        [% END %]
289
                                    </td>
331
                                    </td>
290
                                    <td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td>
332
                                    <td>[% PROCESS translate_log_interface log_interface=loopro.interface %]</td>
Lines 325-339 fieldset.rows label.viewlog { Link Here
325
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
367
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
326
     </div> <!-- /.row -->
368
     </div> <!-- /.row -->
327
369
370
<div class="modal" id="compareInfo" tabindex="-1" role="dialog" aria-labelledby="compareInfoLabel">
371
    <div class="modal-dialog modal-lg" role="document">
372
        <div class="modal-content">
373
            <div class="modal-header">
374
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
375
                <h4 class="modal-title" id="compareInfoLabel">Compare preference values</h4>
376
            </div>
377
            <div class="modal-body">
378
                <div class="row">
379
                    <div class="compare_pane col-sm-6" id="col1">
380
                        <h5>Older version</h5>
381
                        <pre></pre>
382
                    </div>
383
                    <div class="compare_pane col-sm-6" id="col2">
384
                        <h5>Newer version</h5>
385
                        <pre></pre>
386
                    </div>
387
                </div>
388
            </div> <!-- /.modal-body -->
389
            <div class="modal-footer">
390
                <button type="button" class="btn btn-default deny" data-dismiss="modal">Close</button>
391
            </div>
392
        </div> <!-- /.modal-content -->
393
    </div> <!-- /.modal-dialog -->
394
</div> <!-- /#compareInfo -->
395
328
[% MACRO jsinclude BLOCK %]
396
[% MACRO jsinclude BLOCK %]
329
    [% INCLUDE 'calendar.inc' %]
397
    [% INCLUDE 'calendar.inc' %]
330
    [% INCLUDE 'datatables.inc' %]
398
    [% INCLUDE 'datatables.inc' %]
331
    [% INCLUDE 'columns_settings.inc' %]
399
    [% INCLUDE 'columns_settings.inc' %]
400
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
332
    [% Asset.js("js/tools-menu.js") | $raw %]
401
    [% Asset.js("js/tools-menu.js") | $raw %]
402
    [% Asset.js("lib/hc-sticky.js") | $raw %]
333
    [% IF ( circulation ) %]
403
    [% IF ( circulation ) %]
334
        [% INCLUDE 'str/members-menu.inc' %]
404
        [% INCLUDE 'str/members-menu.inc' %]
335
        [% Asset.js("js/members-menu.js") | $raw %]
405
        [% Asset.js("js/members-menu.js") | $raw %]
336
    [% END %]
406
    [% END %]
407
    [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
337
    <script>
408
    <script>
338
        var columns_settings = [% TablesSettings.GetColumns('tools', 'logviewer', 'logst', 'json') | $raw %];
409
        var columns_settings = [% TablesSettings.GetColumns('tools', 'logviewer', 'logst', 'json') | $raw %];
339
    </script>
410
    </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