@@ -, +, @@
- add a class SharedContent.pm to communicate with mana server
- add a link in serials-menu.inc to serials_search.pl to open
- modify the research form in serials-search.tt to show the right fields
- create datatable in mana-subscription-search-result.inc to show
- modify serials-search.pl to manage research on mana
---
Koha/SharedContent.pm | 56 ++++++++++
.../includes/mana-subscription-search-result.inc | 40 +++++++
.../prog/en/includes/serials-menu.inc | 3 +
.../prog/en/modules/serials/serials-home.tt | 1 +
.../prog/en/modules/serials/serials-search.tt | 49 +++++++--
serials/serials-search.pl | 121 +++++++++++++++------
6 files changed, 227 insertions(+), 43 deletions(-)
create mode 100644 Koha/SharedContent.pm
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc
--- a/Koha/SharedContent.pm
+++ a/Koha/SharedContent.pm
@@ -0,0 +1,56 @@
+package Koha::SharedContent;
+
+# Copyright 2016 BibLibre Morgane Alonso
+#
+# 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 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
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+use JSON;
+use HTTP::Request;
+use LWP::UserAgent;
+
+our $MANA_IP = "http://10.25.159.107:5000";
+
+sub manaRequest {
+ my $mana_request = shift;
+ my $result;
+
+ $mana_request->content_type('application/json');
+ my $userAgent = LWP::UserAgent->new;
+ my $response = $userAgent->request($mana_request);
+
+ if ( $response->code ne "204" ) {
+ $result = from_json( $response->decoded_content );
+ }
+ $result->{code} = $response->code;
+
+ return $result if ( $response->code =~ /^2..$/ );
+}
+
+sub manaGetRequest {
+ my $resource = shift;
+ my $parameters = shift;
+
+ $parameters = join '&',
+ map { defined $parameters->{$_} ? $_ . "=" . $parameters->{$_} : () }
+ keys %$parameters;
+ my $url = "$MANA_IP/$resource.json?$parameters";
+ my $request = HTTP::Request->new( GET => $url );
+
+ return manaRequest($request);
+}
+
+1;
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/mana-subscription-search-result.inc
@@ -0,0 +1,40 @@
+[% USE KohaDates %]
+
+ [% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
@@ -1,5 +1,6 @@
[% INCLUDE 'doc-head-open.inc' %]
[% USE KohaDates %]
+[% USE Koha %]
Koha › Serials [% biblionumber %]
[% INCLUDE 'doc-head-close.inc' %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt
@@ -1,6 +1,7 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
[% USE KohaDates %]
+[% USE Koha %]
[% USE AuthorisedValues %]
Koha › Serials [% biblionumber %]
[% INCLUDE 'doc-head-close.inc' %]
@@ -10,6 +11,14 @@
@@ -123,6 +144,7 @@
[% END %]
+ [% IF ( mana ) %][% END %]
@@ -130,13 +152,22 @@
[% END %]
- [% IF ( done_searched ) %]
- [% IF ( total ) %]
-