@@ -, +, @@ * Extends login screen to pass along #hash * Adds JSONP support to C4::Service * Extends humanmsg to allow per-message classes * Adds proper charset to results of svc/bib 1. C4/Auth.pm and .../intranet/.../auth.tt: verify that login/usage works as expected, despite the change to pass on the fragment (...#blah) from the URL. 2. C4/Service.pm and humanmsg.js: verify that editing system preferences (the main user of these modules) works correctly despite updates. 3. svc/bib: verify that records can be correctly downloaded with the change of character set. This can be done in a Firebug/Chrome Devtools console by running `$.get('/cgi-bin/koha/svc/bib/1')` and inspecting the results (possibly replacing 1 with a different valid biblionumber). --- C4/Auth.pm | 2 + C4/Service.pm | 17 ++++++-- .../intranet-tmpl/lib/jquery/plugins/humanmsg.js | 51 ++++++++++++---------- koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css | 15 ++++--- koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 8 ++++ svc/bib | 2 +- 6 files changed, 61 insertions(+), 34 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -362,6 +362,8 @@ sub get_template_and_user { $template->param( dateformat => C4::Context->preference('dateformat') ); } + $template->param(auth_forwarded_hash => $in->{'query'}->param('auth_forwarded_hash')); + # these template parameters are set the same regardless of $in->{'type'} # Set the using_https variable for templates --- a/C4/Service.pm +++ a/C4/Service.pm @@ -55,6 +55,17 @@ BEGIN { our ( $query, $cookie ); +sub _output { + my ( $response, $status ) = @_; + binmode STDOUT, ':encoding(UTF-8)'; + + if ( $query->param( 'callback' ) ) { + output_with_http_headers $query, $cookie, $query->param( 'callback' ) . '(' . $response->output . ');', 'js'; + } else { + output_with_http_headers $query, $cookie, $response->output, 'json', $status; + } +} + =head1 METHODS =head2 init @@ -113,7 +124,7 @@ sub return_error { $response->param( message => $error ) if ( $error ); $response->param( type => $type, %flags ); - output_with_http_headers $query, $cookie, $response->output, 'json', '400 Bad Request'; + _output( $response, '400 Bad Request' ); exit; } @@ -159,7 +170,7 @@ sub return_multi { } $response->param( 'multi' => JSON::true, responses => \@responses_formatted, @flags ); - output_with_http_headers $query, $cookie, $response->output, 'json', '207 Multi-Status'; + _output( $response, '207 Multi-Status' ); } exit; @@ -177,7 +188,7 @@ exit with HTTP status 200. sub return_success { my ( $class, $response ) = @_; - output_with_http_headers $query, $cookie, $response->output, 'json'; + _output( $response ); } =head2 require_params --- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/humanmsg.js +++ a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/humanmsg.js @@ -21,7 +21,7 @@ var humanMsg = { if (msgOpacity != undefined) humanMsg.msgOpacity = parseFloat(msgOpacity); // Inject the message structure - jQuery(appendTo).append('
'+logName+'
'+logName+'
' + msg + '
', options); }, - displayMsg: function(msg, options, is_alert) { + logMsg: function(msg) { + jQuery('#'+humanMsg.logID) + .show().children('ul').prepend('' + msg + '
') : msg) + jQuery('#'+humanMsg.msgID+'-contents').html(msg); // Show message - jQuery('#'+humanMsg.msgID).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { - jQuery('#'+humanMsg.logID) - .show().children('ul').prepend('