diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
index 85090b3ccb..525a590755 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt
@@ -16,22 +16,49 @@
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
-
+[% Asset.css("css/humanmsg.css") | $raw %]
+[% FILTER collapse %]
+
+[% END %]
@@ -225,6 +252,10 @@ fieldset.rows label.viewlog {
[% IF ( do_it ) %]
[% IF ( total ) %]
Log entries
+
@@ -284,7 +315,18 @@ fieldset.rows label.viewlog {
[% IF ( loopro.module == 'CIRCULATION' ) %]
Item [% loopro.barcode | html %]
[% ELSE %]
- [% loopro.info | html %]
+ [% IF loopro.module == "SYSTEMPREFERENCE" %]
+
+ [% loopro.info | html %]
+
+
+
+
+ [% ELSE %]
+
+ [% loopro.info | html %]
+
+ [% END %]
[% END %]
[% PROCESS translate_log_interface log_interface=loopro.interface %] |
@@ -325,15 +367,44 @@ fieldset.rows label.viewlog {
+
+
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
+ [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
[% Asset.js("js/tools-menu.js") | $raw %]
+ [% Asset.js("lib/hc-sticky.js") | $raw %]
[% IF ( circulation ) %]
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
+ [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %]
diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js
index 1354c95e0a..04eb6c7b2f 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js
@@ -1,3 +1,5 @@
+var Sticky;
+
function tickAll(section){
$("input[type='checkbox'][name='" + section + "']").prop("checked", true);
$("#" + section.slice(0,-1) + "ALL").prop("checked", true);
@@ -10,7 +12,52 @@ function untickAll(section){
$("input[type='checkbox'][name='" + section + "']").prop("disabled", false);
}
+function limitCheckboxes() {
+ var checkboxes = $(".compare");
+ var limit = 2;
+ var compare_link = ' ' + __("View comparison") + '';
+ checkboxes.each(function(){
+ $(this).on("change", function(){
+ var checked = [];
+ checkboxes.each(function () {
+ if( $(this).prop("checked") ){
+ checked.push( $(this).data("actionid") );
+ }
+ });
+ if (checked.length > 0) {
+ $("#select_none").removeClass("disabled");
+ } else {
+ $("#select_none").addClass("disabled");
+ $("#logst").DataTable().search("").draw();
+ }
+ if( checked.length == 1 ){
+ $("#logst").DataTable().search($(this).data("filter")).draw();
+ humanMsg.displayAlert( __("Showing results for %s").format( $(this).data("filter") ) );
+ }
+ if( checked.length == 2 ){
+ $("#compare_info" + checked[0]).prepend( compare_link );
+ $("#compare_info" + checked[1]).prepend( compare_link );
+ $("button.compare_link").removeClass("disabled");
+ } else if (checked.length > limit) {
+ humanMsg.displayAlert( __("You can select maximum of two checkboxes") );
+ $(this).prop("checked", false );
+ } else if (checked.length < limit) {
+ $("a.compare_link").remove();
+ $("button.compare_link").addClass("disabled");
+ }
+ });
+ });
+}
+
$(document).ready(function(){
+ limitCheckboxes();
+ if ($('#toolbar').length) {
+ Sticky = $("#toolbar");
+ Sticky.hcSticky({
+ stickTo: "main",
+ stickyClass: "floating"
+ });
+ }
if ( $('input[type="checkbox"][name="modules"]:checked').length == 0 ) {
tickAll('modules');
@@ -67,4 +114,27 @@ $(document).ready(function(){
"order": [[0, "desc"]],
"pagingType" : "full"
}, columns_settings);
+
+ $("body").on("click", ".compare_link", function(e){
+ e.preventDefault();
+ if( $(this).hasClass('disabled') ){
+ humanMsg.displayAlert( __("You must select two entries to compare") );
+ } else {
+ var firstid = $(".compare:checked").eq(0).data("actionid");
+ var secondid = $(".compare:checked").eq(1).data("actionid");
+ var firstvalue = $("#loginfo" + firstid).text();
+ var secondvalue = $("#loginfo" + secondid).text();
+ var diffs = diffString(secondvalue, firstvalue);
+ $("#col1 pre,#col2 pre").html(diffs);
+ $("#compareInfo").modal("show");
+ }
+ });
+ $("#compareInfo").on("hidden.bs.modal", function(){
+ $("#col1 pre,#col2 pre").html("");
+ });
+
+ $("#select_none").on("click", function(e){
+ e.preventDefault();
+ $(".compare:checked").prop("checked", false).change();
+ });
});