From a1161ced1d977d872ab4238fc38ae30440978204 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 17 Jun 2019 18:24:04 +0100 Subject: [PATCH] Bug 23075: Report if mana-kb server is not found This patch adds a status check into the mana configuration page and prompts the user to ask an adminstrator to check the configured mana service url. Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- admin/share_content.pl | 16 +++++++++++----- .../prog/en/modules/admin/share_content.tt | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/admin/share_content.pl b/admin/share_content.pl index 46f270e9e3..7bfa3c82ad 100755 --- a/admin/share_content.pl +++ b/admin/share_content.pl @@ -39,6 +39,14 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $op = $query->param('op') || q{}; +my $mana_base = C4::Context->config('mana_config') || ''; +# Check the mana server actually exists at the other end +my $bad_url; +if ($mana_base) { + my $request = HTTP::Request->new( GET => $mana_base ); + my $result = Koha::SharedContent::process_request($request); + $bad_url = 1 unless (exists($result->{version})); +} if ( $op eq 'save' ) { my $auto_share = $query->param('autosharewithmana') || q{}; @@ -64,8 +72,7 @@ if ( $op eq 'send' ) { my $content = to_json({name => $name, email => $email}); - my $mana_ip = C4::Context->config('mana_config'); - my $url = "$mana_ip/getsecuritytoken"; + my $url = "$mana_base/getsecuritytoken"; my $request = HTTP::Request->new( POST => $url ); $request->content($content); my $result = Koha::SharedContent::process_request($request); @@ -78,10 +85,9 @@ if ( $op eq 'send' ) { } -my $mana_url = C4::Context->config('mana_config') || q{}; - $template->param( - mana_url => $mana_url, + mana_url => $mana_base, + bad_url => $bad_url, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt index 1a3bcd8efd..d441b06dc6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt @@ -33,6 +33,10 @@ + [% ELSIF (bad_url) %] + [% END %]

Share content with the Koha community using Mana KB

-- 2.39.5