@@ -, +, @@ ccl.properties: Identifier-standard 1=1007 4=6 ident Identifier-standard melm 009 Identifier-standard:w,Number-standard:n Fill a 7..$3 field with a ppn (032581270 for example). Fill the 009 field with an integer --- C4/Biblio.pm | 6 ++ installer/data/mysql/updatedatabase.pl | 16 ++++ .../en/modules/admin/preferences/web_services.pref | 7 ++ koha-tmpl/opac-tmpl/prog/en/css/datatables.css | 42 ++++----- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 41 +++++++++ koha-tmpl/opac-tmpl/prog/en/includes/greybox.inc | 7 ++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 10 ++- koha-tmpl/opac-tmpl/prog/en/modules/opac-idref.tt | 66 ++++++++++++++ koha-tmpl/opac-tmpl/prog/images/first-disabled.png | Bin 0 -> 843 bytes koha-tmpl/opac-tmpl/prog/images/first.png | Bin 0 -> 720 bytes koha-tmpl/opac-tmpl/prog/images/last-disabled.png | Bin 0 -> 826 bytes koha-tmpl/opac-tmpl/prog/images/last.png | Bin 0 -> 737 bytes koha-tmpl/opac-tmpl/prog/images/next-disabled.png | Bin 0 -> 866 bytes koha-tmpl/opac-tmpl/prog/images/next.png | Bin 0 -> 736 bytes koha-tmpl/opac-tmpl/prog/images/prev-disabled.png | Bin 0 -> 862 bytes koha-tmpl/opac-tmpl/prog/images/prev.png | Bin 0 -> 745 bytes opac/opac-detail.pl | 13 +++ opac/opac-idref.pl | 91 ++++++++++++++++++++ 18 files changed, 277 insertions(+), 22 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/greybox.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-idref.tt create mode 100644 koha-tmpl/opac-tmpl/prog/images/first-disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/first.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/last-disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/last.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/next-disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/next.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/prev-disabled.png create mode 100644 koha-tmpl/opac-tmpl/prog/images/prev.png create mode 100755 opac/opac-idref.pl --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -1834,9 +1834,14 @@ sub GetMarcAuthors { } # other subfields + my $unimarc3; for my $authors_subfield (@subfields) { next if ( $authors_subfield->[0] eq '9' ); + # unimarc3 contains the $3 of the author for UNIMARC. + # For french academic libraries, it's the "ppn", and it's required for idref webservice + $unimarc3 = $authors_subfield->[1] if $marcflavour eq 'UNIMARC' and $authors_subfield->[0] =~ /3/; + # don't load unimarc subfields 3, 5 next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) ); @@ -1872,6 +1877,7 @@ sub GetMarcAuthors { push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop, authoritylink => $subfield9, + unimarc3 => $unimarc3 }; } return \@marcauthors; --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6020,6 +6020,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } + + + +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(qq{ + INSERT INTO systempreferences (variable,value,explanation,options,type) + VALUES('IDREF','0','Disable/enable the IDREF webservice from the OPAC detail page.',NULL,'YesNo') + }); + print "Upgrade to $DBversion done (Add system preference IDREF))\n"; + SetVersion($DBversion); +} + + + + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref @@ -44,3 +44,10 @@ Web services: - pref: SvcMaxReportRows class: integer - rows of a report requested via the reports web service. + IDREF: + - + - pref: IDREF + choices: + yes: Enable + no: Disable + - the IDREF webservice from the opac detail page --- a/koha-tmpl/opac-tmpl/prog/en/css/datatables.css +++ a/koha-tmpl/opac-tmpl/prog/en/css/datatables.css @@ -3,23 +3,23 @@ input.search_init { } .sorting_asc { padding-right: 19px; - background: url("../../img/asc.gif") no-repeat scroll right center #EEEEEE; + background: url("../../images/asc.gif") no-repeat scroll right center #EEEEEE; } .sorting_desc { padding-right: 19px; - background: url("../../img/desc.gif") no-repeat scroll right center #EEEEEE; + background: url("../../images/desc.gif") no-repeat scroll right center #EEEEEE; } .sorting { padding-right: 19px; - background: url("../../img/ascdesc.gif") no-repeat scroll right center #EEEEEE; + background: url("../../images/ascdesc.gif") no-repeat scroll right center #EEEEEE; } .sorting_asc_disabled { padding-right: 19px; - background: url("../../img/datatables/sort_asc_disabled.png") no-repeat scroll right center #EEEEEE; + background: url("../../images/datatables/sort_asc_disabled.png") no-repeat scroll right center #EEEEEE; } .sorting_desc_disabled { padding-right: 19px; - background: url("../../img/datatables/sort_desc_disabled.png") no-repeat scroll right center #EEEEEE; + background: url("../../images/datatables/sort_desc_disabled.png") no-repeat scroll right center #EEEEEE; } .sorting_disabled { padding-right: 19px; @@ -83,25 +83,25 @@ div.dataTables_paginate { color : #0000CC; } .paging_full_numbers span.paginate_button.first { - background-image : url('../../img/first.png'); + background-image : url('../../images/first.png'); background-repeat: no-repeat; background-position : 2px center; padding-left : 2em; } .paging_full_numbers span.paginate_button.previous { - background-image : url('../../img/prev.png'); + background-image : url('../../images/prev.png'); background-repeat: no-repeat; background-position : 2px center; padding-left : 2em; } .paging_full_numbers span.paginate_button.next { - background-image : url('../../img/next.png'); + background-image : url('../../images/next.png'); background-repeat: no-repeat; background-position : right center; padding-right : 2em; } .paging_full_numbers span.paginate_button.last { - background-image : url('../../img/last.png'); + background-image : url('../../images/last.png'); background-repeat: no-repeat; background-position : right center; border-right : 1px solid #686868; @@ -147,31 +147,31 @@ div.dataTables_paginate.paging_four_button { width: 16px; } .paginate_disabled_first { - background-image: url("../../img/first-disabled.png"); + background-image: url("../../images/first-disabled.png"); } .paginate_enabled_first { - background-image: url("../../img/first.png"); + background-image: url("../../images/first.png"); cursor: pointer; } .paginate_disabled_previous { - background-image: url("../../img/prev-disabled.png"); + background-image: url("../../images/prev-disabled.png"); } .paginate_enabled_previous { - background-image: url("../../img/prev.png"); + background-image: url("../../images/prev.png"); cursor: pointer; } .paginate_disabled_next { - background-image: url("../../img/next-disabled.png"); + background-image: url("../../images/next-disabled.png"); } .paginate_enabled_next { - background-image: url("../../img/next.png"); + background-image: url("../../images/next.png"); cursor: pointer; } .paginate_disabled_last { - background-image: url("../../img/last-disabled.png"); + background-image: url("../../images/last-disabled.png"); } .paginate_enabled_last { - background-image: url("../../img/last.png"); + background-image: url("../../images/last.png"); cursor: pointer; } @@ -248,16 +248,16 @@ table.display thead th { width: 19px; } .paginate_disabled_previous { - background-image: url("../../img/datatables/back_disabled.jpg"); + background-image: url("../../images/datatables/back_disabled.jpg"); } .paginate_enabled_previous { - background-image: url("../../img/datatables/back_enabled.jpg"); + background-image: url("../../images/datatables/back_enabled.jpg"); } .paginate_disabled_next { - background-image: url("../../img/datatables/forward_disabled.jpg"); + background-image: url("../../images/datatables/forward_disabled.jpg"); } .paginate_enabled_next { - background-image: url("../../img/datatables/forward_enabled.jpg"); + background-image: url("../../images/datatables/forward_enabled.jpg"); } .spacer { clear: both; --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ a/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2820,3 +2820,44 @@ body#opac-main #opacmainuserblockmobile { .tagweight9 { font-size: 30px; } + +div.pager { + background-color : #E8E8E8; + border : 1px solid #BCBCBC; + -moz-border-radius : 5px; + display : inline-block; + font-size : 85%; + padding : .3em .5em .3em .5em; + margin : .4em 0; +} +div.pager img { + vertical-align : middle; +} +div.pager img.last { + padding-right: 5px; +} +div.pager input.pagedisplay { + border : 0; + background-color : transparent; + font-weight: bold; + text-align : center; +} +a.localimage img { + border : 1px solid #0000CC; + margin : 0 .5em; + padding : .3em; +} +div.pager p { + margin: 0; +} + + +/* IDREF */ +#idref h2.role { + background-color: #DDDEEE; + cursor: pointer; +} + +#idref table { + margin: 0; +} --- a/koha-tmpl/opac-tmpl/prog/en/includes/greybox.inc +++ a/koha-tmpl/opac-tmpl/prog/en/includes/greybox.inc @@ -0,0 +1,7 @@ + + + + + --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -11,6 +11,7 @@ [% END %] [% IF ( OpacStarRatings != 'disable' ) %] [% END %] +[% INCLUDE greybox.inc %] [% IF ( OpacHighlightedWords ) %][% END %] + [% INCLUDE 'datatables-strings.inc' %] + + + + +
+ [% IF error %] + This ppn is not found on the idref service. + [% ELSE %] + [% FOREACH role IN content %] +
+

[% role.role_name %] ([% role.count %])

+
+ + + + + + + + [% FOREACH doc IN role.docs %] + + + + + + [% END %] + +
CitationKohaSudoc
[% doc.citation %]KohaSudoc
+
+
+ [% END %] + [% END %] +
+[% INCLUDE 'opac-bottom.inc' %] + --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -950,6 +950,19 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } +#IDREF +if ( C4::Context->preference("IDREF") ) { + # If the record comes from the SUDOC + if ( $record->field('009') ) { + my $unimarc3 = $record->field("009")->data; + if ( $unimarc3 =~ /^\d+$/ ) { + $template->param( + IDREF => 1, + ); + } + } +} + # We try to select the best default tab to show, according to what # the user wants, and what's available for display my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab'); --- a/opac/opac-idref.pl +++ a/opac/opac-idref.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl + +use Modern::Perl; + +use CGI; +use LWP::UserAgent; +use HTTP::Request::Common; +use JSON; +use Encode; + +use C4::Auth; +use C4::Context; +use C4::Search; +use C4::Output; + +my $cgi = new CGI; +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-idref.tt", + query => $cgi, + type => "opac", + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), + flagsrequired => { borrow => 1 }, + } +); + +my $ua = LWP::UserAgent->new; + +my $base = 'http://www.idref.fr/services/biblio/'; +my $unimarc3 = $cgi->param('unimarc3'); + +my $request = HTTP::Request->new( + 'GET', + $base . $unimarc3 . ".json", +); +$request->protocol('HTTP/1.1'); +my $response = $ua->request($request); +if ( not $response->is_success) { + $template->param(error => $base.$unimarc3.'.json'); + output_html_with_http_headers $cgi, $cookie, $template->output; + exit; +} + +my $content = Encode::decode("utf8", $response->content); +my $json = from_json( $content ); +my $r; +my $role_name; +my @unimarc3; +my @results = ref $json->{sudoc}{result} eq "ARRAY" + ? @{ $json->{sudoc}{result} } + : ($json->{sudoc}{result}); + +for my $role_node ( @results ) { + while ( my ( $k, $v ) = each %$role_node ) { + next unless $k eq "role"; + my $role_name; + my $count = 0; + my $role_data = {}; + my @nodes = ref $v eq "ARRAY" + ? @$v + : ($v); + for my $node ( @nodes ) { + while ( ( $k, $v ) = each %$node ) { + given ( $k ) { + when ( "roleName" ) { + $role_name = $v; + $role_data->{role_name} = $role_name; + } + when ( "count" ) { + $role_data->{count} = $v; + } + when ( "doc" ) { + push @{ $role_data->{docs} }, $v; + } + default { + # unimarcCode and marc21Code + } + } + } + } + push @$r, $role_data; + } +} + +$template->param( + content => $r, + unimarc3 => $unimarc3, +); + +output_html_with_http_headers $cgi, $cookie, $template->output; + --