From 90689245fe8464f05fb1cf2e0c61042cfea6b7da Mon Sep 17 00:00:00 2001
From: Jesse Weaver
Date: Tue, 11 Mar 2014 11:13:51 +0100
Subject: [PATCH] Bug 11559 - Supporting changes for Rancor
* 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
---
C4/Auth.pm | 2 ++
C4/Service.pm | 16 +++++++++---
.../intranet-tmpl/lib/jquery/plugins/humanmsg.js | 29 +++++++++++-----------
koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css | 15 ++++++-----
.../intranet-tmpl/prog/en/css/staff-global.css | 11 +++++---
koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 8 ++++++
svc/bib | 2 +-
7 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 0e1b03f..ae952df 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -359,6 +359,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
diff --git a/C4/Service.pm b/C4/Service.pm
index 14d0ddd..d2e1643 100644
--- a/C4/Service.pm
+++ b/C4/Service.pm
@@ -55,6 +55,16 @@ BEGIN {
our ( $query, $cookie );
+sub _output {
+ my ( $response, $status ) = @_;
+
+ 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 +123,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 +169,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 +187,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
diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/humanmsg.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/humanmsg.js
index 4a2d62c..6b3be81 100644
--- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/humanmsg.js
+++ b/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(' ')
+ jQuery(appendTo).append(' ');
jQuery('#'+humanMsg.logID+' p').click(
function() { jQuery(this).siblings('ul').slideToggle() }
@@ -29,28 +29,29 @@ var humanMsg = {
},
displayAlert: function(msg, options) {
- humanMsg.displayMsg(msg, options, true);
+ humanMsg.displayMsg('' + msg + '
', $.extend({log: false}, options), true);
},
- displayMsg: function(msg, options, is_alert) {
+ displayMsg: function(msg, options) {
if (msg == '')
return;
- if (options != undefined) {
- delay = 'delay' in options ? parseInt(options.delay) * 1000 : 1000
- life = 'life' in options ? parseInt(options.life) * 1000 : Infinity
- } else {
- delay = 1000
- life = Infinity
- }
+ options = $.extend({
+ delay: 1000,
+ life: Infinity,
+ log: true,
+ className: '',
+ }, options);
+ clearTimeout(humanMsg.t1);
clearTimeout(humanMsg.t2);
// Inject message
- jQuery('#'+humanMsg.msgID+'-contents').html(is_alert ? ('' + msg + '
') : msg)
+ jQuery('#'+humanMsg.msgID+'-contents').html(msg);
// Show message
- jQuery('#'+humanMsg.msgID).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() {
+ jQuery('#'+humanMsg.msgID).attr('class', 'humanMsg ' + options.className).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() {
+ if ( !options.log ) return true;
jQuery('#'+humanMsg.logID)
.show().children('ul').prepend(''+msg+'') // Prepend message to log
.children('li:first').slideDown(200) // Slide it down
@@ -64,9 +65,9 @@ var humanMsg = {
})
// Watch for mouse & keyboard in `delay`
- humanMsg.t1 = setTimeout("humanMsg.bindEvents()", delay)
+ humanMsg.t1 = setTimeout("humanMsg.bindEvents()", options.delay)
// Remove message after `life`
- humanMsg.t2 = setTimeout("humanMsg.removeMsg()", life)
+ humanMsg.t2 = setTimeout("humanMsg.removeMsg()", options.life)
},
bindEvents: function() {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css b/koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css
index 47eb2e6..f9b0071 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/humanmsg.css
@@ -9,6 +9,7 @@ html, body {
}
.humanMsg {
+ border-radius: 5px;
font: normal 20px/50px Helvetica, Arial, Sans-Serif;
letter-spacing: -1px;
position: fixed;
@@ -23,6 +24,14 @@ html, body {
z-index: 100000;
}
+.humanError {
+ background-color: #400;
+}
+
+.humanSuccess {
+ background-color: #040;
+}
+
.humanMsg h3 {
margin: 0.3em;
margin-top: 0;
@@ -30,12 +39,6 @@ html, body {
font-weight: bold;
}
-.humanMsg .round {
- border-left: solid 2px white;
- border-right: solid 2px white;
- font-size: 1px; height: 2px;
- }
-
.humanMsg p {
margin: 0.3em;
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 588333d..e90fdbf 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -418,13 +418,18 @@ dd {
font-weight : normal;
}
-div#toolbar {
+.btn-toolbar {
background-color : #EDF4F6;
padding: 5px 5px 5px 5px;
border-radius: 5px 5px 0 0;
border: 1px solid #E6F0F2;
}
+.btn-toolbar .yui-menu-button button,
+.btn-toolbar .yui-button-button button {
+ line-height : 1.7em;
+}
+
ul.toolbar {
padding-left : 0;
}
@@ -2415,8 +2420,8 @@ video {
background-position:-48px -166px;
}
-#toolbar .btn,
-#toolbar .dropdown-menu {
+.btn-toolbar .btn,
+.btn-toolbar .dropdown-menu {
font-size: 13px;
}
a.btn:link,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
index 9ae147e..d6379fe 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
@@ -103,4 +103,12 @@ please choose against which one you would like to authenticate:
+
+
[% INCLUDE 'intranet-bottom.inc' %]
diff --git a/svc/bib b/svc/bib
index 231734e..40c0792 100755
--- a/svc/bib
+++ b/svc/bib
@@ -68,7 +68,7 @@ sub fetch_bib {
my $biblionumber = shift;
my $record = GetMarcBiblio( $biblionumber, $query->url_param('items') );
if (defined $record) {
- print $query->header(-type => 'text/xml',-charset => 'utf-8',);
+ print $query->header(-type => 'text/xml', -charset => 'utf-8');
print $record->as_xml_record();
} else {
print $query->header(-type => 'text/xml', -status => '404 Not Found');
--
2.1.0