Browse Source

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 <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 5 years ago
parent
commit
a1161ced1d
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 16
      admin/share_content.pl
  2. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt

16
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;

4
koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt

@ -33,6 +33,10 @@
<div class="dialog alert" role="alert">
Mana configuration is currently empty. This feature will not work. Please contact your site administrator.
</div>
[% ELSIF (bad_url) %]
<div class="dialog alert" role="alert">
Cannot detect mana server at <strong>[% mana_url | url %]</strong>, please ask an administrator to check your configuration.
</div>
[% END %]
<h1>Share content with the Koha community using Mana KB</h1>

Loading…
Cancel
Save