From 809e834a37c4ea05dea172cbc05e848d70a94a81 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Tue, 25 Jun 2013 08:44:19 -0400 Subject: [PATCH] Bug 10240 QA follow-up Address the following issues: 1/ Address minor qa issues with the templates: FAIL koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt FAIL forbidden patterns forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 24) [etc.] OK tt_valid OK valid_template FAIL koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt FAIL forbidden patterns forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 509) [etc.] FAIL tt_valid lines 5, 5 2/ Run perltidy on new scripts 3/ download.pl returns data.finished = 1 if number of returned data < 5000 (avoids 1 ajax call) 4/ Replace qq{} around sql queries with q{} Also, a race condition existed that resulted in pending transactions only getting deleted from the local database in certain circumstances (fast connections under Chrome, mostly). This patch fixes that so that successfully-uploaded transactions are always deleted. This patch also addresses Jonathan's suggestion: 3/ add a message on check in (currently the input becomes empty but the user is not informed). ... and Magnus's suggestion about moving the Synchronize link to the right on the homepage. Finally, this patch adds a link to the Pending offline operations page on the synchronize page for easier navigation. --- circ/offline-mf.pl | 21 ++-- circ/offline.pl | 25 +++-- koha-tmpl/intranet-tmpl/prog/en/js/offlinecirc.js | 6 +- .../prog/en/modules/circ/offline-mf.tt | 60 ++++++------ .../intranet-tmpl/prog/en/modules/circ/offline.tt | 100 +++++++++++++------- offline_circ/download.pl | 53 ++++++----- 6 files changed, 154 insertions(+), 111 deletions(-) diff --git a/circ/offline-mf.pl b/circ/offline-mf.pl index 010c86a..87bc67f 100755 --- a/circ/offline-mf.pl +++ b/circ/offline-mf.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl +# Copyright 2013 C & P Bibliography Services # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later +# Foundation; either version 3 of the License, or (at your option) any later # version. # # Koha is distributed in the hope that it will be useful, but WITHOUT ANY @@ -21,14 +22,16 @@ use CGI; use C4::Auth; my $query = new CGI; -my ($template, $loggedinuser, $cookie, $flags) -= get_template_and_user({template_name => "circ/offline-mf.tt", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => {circulate => "circulate_remaining_permissions"}, - }); +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/offline-mf.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + } +); $template->{'VARS'}->{'cookie'} = $cookie; -print $query->header(-type => 'text/cache-manifest', cookie => $cookie); +print $query->header( -type => 'text/cache-manifest', cookie => $cookie ); print $template->output; diff --git a/circ/offline.pl b/circ/offline.pl index b33dc5e..ebc161b 100755 --- a/circ/offline.pl +++ b/circ/offline.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl +# Copyright 2013 C & P Bibliography Services # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later +# Foundation; either version 3 of the License, or (at your option) any later # version. # # Koha is distributed in the hope that it will be useful, but WITHOUT ANY @@ -23,14 +24,18 @@ use C4::Output; use C4::Context; my $query = new CGI; -my ($template, $loggedinuser, $cookie, $flags) -= get_template_and_user({template_name => "circ/offline.tt", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => {circulate => "circulate_remaining_permissions"}, - }); +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/offline.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + } +); -$template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation'); -$template->{'VARS'}->{'maxoutstanding'} = C4::Context->preference('maxoutstanding') || 0; +$template->{'VARS'}->{'AllowOfflineCirculation'} = + C4::Context->preference('AllowOfflineCirculation'); +$template->{'VARS'}->{'maxoutstanding'} = + C4::Context->preference('maxoutstanding') || 0; output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/offlinecirc.js b/koha-tmpl/intranet-tmpl/prog/en/js/offlinecirc.js index 4645d17..ae45c2a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/offlinecirc.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/offlinecirc.js @@ -52,6 +52,9 @@ kohadb.loadSetting = function (key, callback) { $.indexedDB("koha").transaction(["offline_settings"]).then(function(){ }, function(err, e){ + if (typeof callback === 'function') { + callback(key, undefined); + } }, function(transaction){ var settings = transaction.objectStore("offline_settings"); settings.get(key).done(function (item, error) { @@ -80,9 +83,10 @@ }, function(dbtransaction) { var transactions = dbtransaction.objectStore("transactions"); transactions.put(newtrans); + kohadb.saveSetting('dirty', true); }); }; -}( window.kohadb = window.bndb || {}, jQuery )); +}( window.kohadb = window.kohadb || {}, jQuery )); if ( !Date.prototype.toMySQLString ) { ( function() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt index 93a0259..9d71f5a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt @@ -4,40 +4,38 @@ CACHE MANIFEST # Explicitly cached 'master entries'. CACHE: /cgi-bin/koha/circ/offline.pl -/intranet-tmpl/lib/bootstrap/bootstrap.min.css -/intranet-tmpl/lib/bootstrap/bootstrap.min.js -/intranet-tmpl/lib/jquery/jquery-ui.css -/intranet-tmpl/lib/jquery/jquery-ui.js -/intranet-tmpl/lib/jquery/jquery.js -/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js -/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js -/intranet-tmpl/lib/jquery/plugins/jquery.hotkeys.min.js -/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js -/intranet-tmpl/lib/jquery/plugins/jquery.validate.min.js -/intranet-tmpl/prog/en/css/print.css -/intranet-tmpl/prog/en/css/staff-global.css -/intranet-tmpl/prog/en/js/basket.js -/intranet-tmpl/prog/en/js/offlinecirc.js -/intranet-tmpl/prog/en/js/staff-global.js -/intranet-tmpl/prog/en/lib/jquery/plugins/jquery-ui-timepicker-addon.js -/intranet-tmpl/prog/en/lib/yui/button/button-min.js -/intranet-tmpl/prog/en/lib/yui/container/container_core-min.js -/intranet-tmpl/prog/en/lib/yui/menu/menu-min.js -/intranet-tmpl/prog/en/lib/yui/reset-fonts-grids.css -/intranet-tmpl/prog/en/lib/yui/skin.css -/intranet-tmpl/prog/en/lib/yui/utilities/utilities.js -/intranet-tmpl/prog/img/cart-small.gif -/intranet-tmpl/prog/img/glyphicons-halflings-koha.png -/intranet-tmpl/prog/img/koha-logo-medium.gif -/intranet-tmpl/prog/img/loading.gif -/intranet-tmpl/prog/sound/beep.ogg -/intranet-tmpl/prog/sound/critical.ogg +[% interface %]/lib/bootstrap/bootstrap.min.css +[% interface %]/lib/bootstrap/bootstrap.min.js +[% interface %]/lib/jquery/jquery-ui.css +[% interface %]/lib/jquery/jquery-ui.js +[% interface %]/lib/jquery/jquery.js +[% interface %]/lib/jquery/plugins/jquery.cookie.min.js +[% interface %]/lib/jquery/plugins/jquery.highlight-3.js +[% interface %]/lib/jquery/plugins/jquery.hotkeys.min.js +[% interface %]/lib/jquery/plugins/jquery.indexeddb.js +[% interface %]/lib/jquery/plugins/jquery.validate.min.js +[% themelang %]/css/print.css +[% themelang %]/css/staff-global.css +[% themelang %]/js/basket.js +[% themelang %]/js/offlinecirc.js +[% themelang %]/js/staff-global.js +[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js +[% themelang %]/lib/yui/button/button-min.js +[% themelang %]/lib/yui/container/container_core-min.js +[% themelang %]/lib/yui/menu/menu-min.js +[% themelang %]/lib/yui/reset-fonts-grids.css +[% themelang %]/lib/yui/skin.css +[% themelang %]/lib/yui/utilities/utilities.js +[% interface %]/prog/img/cart-small.gif +[% interface %]/prog/img/glyphicons-halflings-koha.png +[% interface %]/prog/img/koha-logo-medium.gif +[% interface %]/prog/img/loading.gif +[% interface %]/prog/sound/beep.ogg +[% interface %]/prog/sound/critical.ogg # Resources that require the user to be online. NETWORK: * -# static.html will be served if main.py is inaccessible -# offline.jpg will be served in place of all images in images/large/ -# offline.html will be served in place of all other .html files +# Resources that can be substituted if the user is offline FALLBACK: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt index 772d9db..16fc332 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt @@ -2,22 +2,26 @@ [% IF (AllowOfflineCirculation) %] [% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %] [% END %] -[% IF ( bidi ) %][% ELSE %][% END %] +[% IF ( bidi && AllowOfflineCirculation ) %] +[% ELSIF ( bidi ) %] +[% ELSIF ( AllowOfflineCirculation ) %] +[% ELSE %][% END %] Koha › Circulation [% INCLUDE 'doc-head-close.inc' %] - - + +