View | Details | Raw Unified | Return to bug 8995
Collapse All | Expand All

(-)a/C4/Biblio.pm (-56 / +73 lines)
Lines 29-34 use MARC::File::USMARC; Link Here
29
use MARC::File::XML;
29
use MARC::File::XML;
30
use POSIX qw(strftime);
30
use POSIX qw(strftime);
31
use Module::Load::Conditional qw(can_load);
31
use Module::Load::Conditional qw(can_load);
32
use URI::Escape; # GetCOinSBiblio
32
33
33
use C4::Koha;
34
use C4::Koha;
34
use C4::Dates qw/format_date/;
35
use C4::Dates qw/format_date/;
Lines 1332-1376 sub GetCOinSBiblio { Link Here
1332
        carp 'GetCOinSBiblio called with undefined record';
1333
        carp 'GetCOinSBiblio called with undefined record';
1333
        return;
1334
        return;
1334
    }
1335
    }
1336
1335
    my $pos7 = substr $record->leader(), 7, 1;
1337
    my $pos7 = substr $record->leader(), 7, 1;
1336
    my $pos6 = substr $record->leader(), 6, 1;
1338
    my $pos6 = substr $record->leader(), 6, 1;
1337
    my $mtx;
1339
    my $mtx;
1338
    my $genre;
1340
    my $genre;
1339
    my ( $aulast, $aufirst ) = ( '', '' );
1341
    my ( $aulast, $aufirst ) = ( '', '' );
1340
    my $oauthors  = '';
1342
    my @authors;
1341
    my $title     = '';
1343
    my $title;
1342
    my $subtitle  = '';
1344
    my $hosttitle;
1343
    my $pubyear   = '';
1345
    my $pubyear   = '';
1344
    my $isbn      = '';
1346
    my $isbn      = '';
1345
    my $issn      = '';
1347
    my $issn      = '';
1346
    my $publisher = '';
1348
    my $publisher = '';
1347
    my $pages     = '';
1349
    my $pages     = '';
1348
    my $titletype = 'b';
1350
    my $titletype = '';
1349
1351
1350
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1352
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1351
    # considered the same for UNIMARC and MARC21
1353
    # considered the same for UNIMARC and MARC21
1352
    my $fmts6;
1354
    my $fmts6 = {
1353
    my $fmts7;
1355
        'a' => 'book',
1354
    %$fmts6 = (
1356
        'b' => 'manuscript',
1355
                'a' => 'book',
1357
        'c' => 'book',
1356
                'b' => 'manuscript',
1358
        'd' => 'manuscript',
1357
                'c' => 'book',
1359
        'e' => 'map',
1358
                'd' => 'manuscript',
1360
        'f' => 'map',
1359
                'e' => 'map',
1361
        'g' => 'film',
1360
                'f' => 'map',
1362
        'i' => 'audioRecording',
1361
                'g' => 'film',
1363
        'j' => 'audioRecording',
1362
                'i' => 'audioRecording',
1364
        'k' => 'artwork',
1363
                'j' => 'audioRecording',
1365
        'l' => 'document',
1364
                'k' => 'artwork',
1366
        'm' => 'computerProgram',
1365
                'l' => 'document',
1367
        'o' => 'document',
1366
                'm' => 'computerProgram',
1368
        'r' => 'document',
1367
                'o' => 'document',
1369
    };
1368
                'r' => 'document',
1370
    my $fmts7 = {
1369
            );
1371
        'a' => 'journalArticle',
1370
    %$fmts7 = (
1372
        's' => 'journal',
1371
                    'a' => 'journalArticle',
1373
    };
1372
                    's' => 'journal',
1373
              );
1374
1374
1375
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1375
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1376
1376
Lines 1381-1386 sub GetCOinSBiblio { Link Here
1381
    ##### We must transform mtx to a valable mtx and document type ####
1381
    ##### We must transform mtx to a valable mtx and document type ####
1382
    if ( $genre eq 'book' ) {
1382
    if ( $genre eq 'book' ) {
1383
            $mtx = 'book';
1383
            $mtx = 'book';
1384
            $titletype = 'b';
1384
    } elsif ( $genre eq 'journal' ) {
1385
    } elsif ( $genre eq 'journal' ) {
1385
            $mtx = 'journal';
1386
            $mtx = 'journal';
1386
            $titletype = 'j';
1387
            $titletype = 'j';
Lines 1392-1417 sub GetCOinSBiblio { Link Here
1392
            $mtx = 'dc';
1393
            $mtx = 'dc';
1393
    }
1394
    }
1394
1395
1395
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1396
1397
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1396
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1398
1397
1399
        # Setting datas
1398
        # Setting datas
1400
        $aulast  = $record->subfield( '700', 'a' ) || '';
1399
        $aulast  = $record->subfield( '700', 'a' ) || '';
1401
        $aufirst = $record->subfield( '700', 'b' ) || '';
1400
        $aufirst = $record->subfield( '700', 'b' ) || '';
1402
        $oauthors = "&rft.au=$aufirst $aulast";
1401
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1403
1402
1404
        # others authors
1403
        # others authors
1405
        if ( $record->field('200') ) {
1404
        if ( $record->field('200') ) {
1406
            for my $au ( $record->field('200')->subfield('g') ) {
1405
            for my $au ( $record->field('200')->subfield('g') ) {
1407
                $oauthors .= "&rft.au=$au";
1406
                push @authors, $au;
1408
            }
1407
            }
1409
        }
1408
        }
1410
        $title =
1409
1411
          ( $mtx eq 'dc' )
1410
        $title     = $record->subfield( '200', 'a' );
1412
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1411
        my $subfield_210d = $record->subfield('210', 'd');
1413
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1412
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1414
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1413
            $pubyear = $1;
1414
        }
1415
        $publisher = $record->subfield( '210', 'c' ) || '';
1415
        $publisher = $record->subfield( '210', 'c' ) || '';
1416
        $isbn      = $record->subfield( '010', 'a' ) || '';
1416
        $isbn      = $record->subfield( '010', 'a' ) || '';
1417
        $issn      = $record->subfield( '011', 'a' ) || '';
1417
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1421-1454 sub GetCOinSBiblio { Link Here
1421
1421
1422
        # Setting datas
1422
        # Setting datas
1423
        if ( $record->field('100') ) {
1423
        if ( $record->field('100') ) {
1424
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1424
            push @authors, $record->subfield( '100', 'a' );
1425
        }
1425
        }
1426
1426
1427
        # others authors
1427
        # others authors
1428
        if ( $record->field('700') ) {
1428
        if ( $record->field('700') ) {
1429
            for my $au ( $record->field('700')->subfield('a') ) {
1429
            for my $au ( $record->field('700')->subfield('a') ) {
1430
                $oauthors .= "&rft.au=$au";
1430
                push @authors, $au;
1431
            }
1431
            }
1432
        }
1432
        }
1433
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1433
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1434
        $subtitle = $record->subfield( '245', 'b' ) || '';
1435
        $title .= $subtitle;
1436
        if ($titletype eq 'a') {
1434
        if ($titletype eq 'a') {
1437
            $pubyear   = $record->field('008') || '';
1435
            $pubyear   = $record->field('008') || '';
1438
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1436
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1439
            $isbn      = $record->subfield( '773', 'z' ) || '';
1437
            $isbn      = $record->subfield( '773', 'z' ) || '';
1440
            $issn      = $record->subfield( '773', 'x' ) || '';
1438
            $issn      = $record->subfield( '773', 'x' ) || '';
1441
            if ($mtx eq 'journal') {
1439
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1442
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1440
            my @rels = $record->subfield( '773', 'g' );
1443
            } else {
1441
            $pages = join(', ', @rels);
1444
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1445
            }
1446
            foreach my $rel ($record->subfield( '773', 'g' )) {
1447
                if ($pages) {
1448
                    $pages .= ', ';
1449
                }
1450
                $pages .= $rel;
1451
            }
1452
        } else {
1442
        } else {
1453
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1443
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1454
            $publisher = $record->subfield( '260', 'b' ) || '';
1444
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1457-1468 sub GetCOinSBiblio { Link Here
1457
        }
1447
        }
1458
1448
1459
    }
1449
    }
1460
    my $coins_value =
1461
"ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3A$mtx$genre$title&rft.isbn=$isbn&rft.issn=$issn&rft.aulast=$aulast&rft.aufirst=$aufirst$oauthors&rft.pub=$publisher&rft.date=$pubyear&rft.pages=$pages";
1462
    $coins_value =~ s/(\ |&[^a])/\+/g;
1463
    $coins_value =~ s/\"/\&quot\;/g;
1464
1450
1465
#<!-- TMPL_VAR NAME="ocoins_format" -->&amp;rft.au=<!-- TMPL_VAR NAME="author" -->&amp;rft.btitle=<!-- TMPL_VAR NAME="title" -->&amp;rft.date=<!-- TMPL_VAR NAME="publicationyear" -->&amp;rft.pages=<!-- TMPL_VAR NAME="pages" -->&amp;rft.isbn=<!-- TMPL_VAR NAME=amazonisbn -->&amp;rft.aucorp=&amp;rft.place=<!-- TMPL_VAR NAME="place" -->&amp;rft.pub=<!-- TMPL_VAR NAME="publishercode" -->&amp;rft.edition=<!-- TMPL_VAR NAME="edition" -->&amp;rft.series=<!-- TMPL_VAR NAME="series" -->&amp;rft.genre="
1451
    my @params = (
1452
        [ 'ctx_ver', 'Z39.88-2004' ],
1453
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1454
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1455
        [ "rft.${titletype}title", $title ],
1456
    );
1457
1458
    # rft.title is authorized only once, so by checking $titletype
1459
    # we ensure that rft.title is not already in the list.
1460
    if ($hosttitle and $titletype) {
1461
        push @params, [ 'rft.title', $hosttitle ];
1462
    }
1463
1464
    push @params, (
1465
        [ 'rft.isbn', $isbn ],
1466
        [ 'rft.issn', $issn ],
1467
    );
1468
1469
    # If it's a subscription, these informations have no meaning.
1470
    if ($genre ne 'journal') {
1471
        push @params, (
1472
            [ 'rft.aulast', $aulast ],
1473
            [ 'rft.aufirst', $aufirst ],
1474
            (map { [ 'rft.au', $_ ] } @authors),
1475
            [ 'rft.pub', $publisher ],
1476
            [ 'rft.date', $pubyear ],
1477
            [ 'rft.pages', $pages ],
1478
        );
1479
    }
1480
1481
    my $coins_value = join( '&amp;',
1482
        map { $$_[1] ? $$_[0] . '=' . uri_escape( $$_[1] ) : () } @params );
1466
1483
1467
    return $coins_value;
1484
    return $coins_value;
1468
}
1485
}
(-)a/C4/XSLT.pm (-4 / +20 lines)
Lines 157-163 sub _get_best_default_xslt_filename { Link Here
157
}
157
}
158
158
159
sub XSLTParse4Display {
159
sub XSLTParse4Display {
160
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
160
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $variables ) = @_;
161
    my $xslfilename = C4::Context->preference($xslsyspref);
161
    my $xslfilename = C4::Context->preference($xslsyspref);
162
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
162
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
163
        my $htdocs;
163
        my $htdocs;
Lines 206-220 sub XSLTParse4Display { Link Here
206
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
206
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
207
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
207
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
208
                              AlternateHoldingsField AlternateHoldingsSeparator
208
                              AlternateHoldingsField AlternateHoldingsSeparator
209
                              TrackClicks / )
209
                              TrackClicks
210
                              OPACShowOpenURL OpenURLResolverURL
211
                              OpenURLImageLocation OpenURLText / )
210
    {
212
    {
211
        my $sp = C4::Context->preference( $syspref );
213
        my $sp = C4::Context->preference( $syspref );
212
        next unless defined($sp);
214
        next unless defined($sp);
213
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
215
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
214
    }
216
    }
215
    $sysxml .= "</sysprefs>\n";
217
    $sysxml .= "</sysprefs>\n";
216
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
218
217
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
219
    $variables ||= {};
220
    if (C4::Context->preference('OPACShowOpenURL')) {
221
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
222
        my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
223
        if (not grep /^$biblio->{itemtype}$/, @itypes) {
224
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
225
        }
226
    }
227
    my $varxml = "<variables>\n";
228
    while (my ($key, $value) = each %$variables) {
229
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
230
    }
231
    $varxml .= "</variables>\n";
232
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
233
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
218
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
234
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
219
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
235
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
220
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
236
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
(-)a/installer/data/mysql/sysprefs.sql (+5 lines)
Lines 443-446 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
443
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
443
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
444
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
444
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
445
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
445
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
446
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free')
447
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
448
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
449
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
450
('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free')
446
;
451
;
(-)a/installer/data/mysql/updatedatabase.pl (+27 lines)
Lines 8589-8594 if ( CheckVersion($DBversion) ) { Link Here
8589
    SetVersion ($DBversion);
8589
    SetVersion ($DBversion);
8590
}
8590
}
8591
8591
8592
$DBversion = "3.17.00.XXX";
8593
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
8594
    $dbh->do("
8595
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8596
        VALUES('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free')
8597
    ");
8598
    $dbh->do("
8599
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8600
        VALUES('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free');
8601
    ");
8602
    $dbh->do("
8603
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8604
        VALUES('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free');
8605
    ");
8606
    $dbh->do("
8607
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8608
        VALUES('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo');
8609
    ");
8610
    $dbh->do("
8611
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8612
        VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free');
8613
    ");
8614
    print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n";
8615
    SetVersion($DBversion);
8616
}
8617
8618
8592
=head1 FUNCTIONS
8619
=head1 FUNCTIONS
8593
8620
8594
=head2 TableExists($table)
8621
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+28 lines)
Lines 311-316 OPAC: Link Here
311
            - pref: NoLoginInstructions
311
            - pref: NoLoginInstructions
312
              type: textarea
312
              type: textarea
313
              class: code
313
              class: code
314
315
        -
316
            - 'Complete URL of OpenURL resolver (starting with <tt>http://</tt> or <tt>https://</tt>):'
317
            - pref: OpenURLResolverURL
318
              class: url
319
        -
320
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
321
            - pref: OpenURLText
322
        -
323
            - 'Location of image for OpenURL links:'
324
            - pref: OpenURLImageLocation
325
              class: url
326
            - '<br />Can be a complete URL starting with <tt>http://</tt> or'
327
            - '<tt>https://</tt> or the name of a file in <tt>images</tt> directory'
328
            - '<br />Examples:'
329
            - '<br />- <tt>http://www.example.com/img/openurl.png</tt>'
330
            - '<br />- <tt>OpenURL/OpenURL.png</tt> (file is in <tt>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</tt>)'
331
        -
332
            - pref: OPACShowOpenURL
333
              choices:
334
                  yes: Enable
335
                  no: Disable
336
            - 'display of OpenURL link in OPAC search results and detail page.'
337
        -
338
            - 'List of item type codes (separated by spaces) for those you do not want to show the OpenURL link:'
339
            - pref: OPACHideOpenURLForItemTypes
340
            - '<br />'
341
            - 'It uses biblioitems.itemtype field, so if you map a MARC field to it, and link this MARC field to a list of authorised values (for example CCODE), you can use these values for system preference value.'
314
    Features:
342
    Features:
315
        -
343
        -
316
            - pref: opacuserlogin
344
            - pref: opacuserlogin
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.css (-1 / +4 lines)
Lines 1-6 Link Here
1
@import url("/opac-tmpl/lib/yui/reset-fonts-grids.css");
1
@import url("/opac-tmpl/lib/yui/reset-fonts-grids.css");
2
@import url("/opac-tmpl/lib/yui/skin.css");
2
@import url("/opac-tmpl/lib/yui/skin.css");
3
4
a {
3
a {
5
	font-weight : bold;
4
	font-weight : bold;
6
}
5
}
Lines 3078-3080 padding: 0.1em 0; Link Here
3078
    width: 35%;
3077
    width: 35%;
3079
    font-size: 111%;
3078
    font-size: 111%;
3080
}
3079
}
3080
3081
a.OpenURL img {
3082
    vertical-align: middle;
3083
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+22 lines)
Lines 790-795 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
790
            [% END %]</ul>
790
            [% END %]</ul>
791
    </div>
791
    </div>
792
    [% END %]
792
    [% END %]
793
794
    [% IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
795
        [%# Build OpenURL image location %]
796
        [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
797
            [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
798
        [% ELSE %]
799
            [% openurlimagelocation = "$OpenURLImageLocation" %]
800
        [% END %]
801
802
        <span class="results_summary">
803
            <a class="OpenURL" href="[% OpenURLResolverURL %]?[% ocoins %]" title="[% OpenURLText %]">
804
            [% IF openurlimagelocation %]
805
                <img src="[% openurlimagelocation %]" />
806
            [% ELSIF OpenURLText %]
807
                [% OpenURLText %]
808
            [% ELSE %]
809
                OpenURL
810
            [% END %]
811
            </a>
812
        </span>
813
    [% END %]
814
793
[% END %]
815
[% END %]
794
        [% IF ( AuthorisedValueImages ) %]
816
        [% IF ( AuthorisedValueImages ) %]
795
        [% IF ( authorised_value_images ) %]
817
        [% IF ( authorised_value_images ) %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+18 lines)
Lines 485-490 $(document).ready(function(){ Link Here
485
        </div>
485
        </div>
486
486
487
        </td></tr>
487
        </td></tr>
488
            [%# Build OpenURL image location %]
489
            [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
490
                [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
491
            [% ELSE %]
492
                [% openurlimagelocation = "$OpenURLImageLocation" %]
493
            [% END %]
494
488
            <!-- Actual Search Results -->
495
            <!-- Actual Search Results -->
489
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
496
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
490
            [% UNLESS ( loop.odd ) %]
497
            [% UNLESS ( loop.odd ) %]
Lines 542-547 $(document).ready(function(){ Link Here
542
                                [% IF ( SEARCH_RESULT.author ) %]by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% SEARCH_RESULT.author |url %]" title="Search for works by this author" class="author">[% SEARCH_RESULT.author %]</a>
549
                                [% IF ( SEARCH_RESULT.author ) %]by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% SEARCH_RESULT.author |url %]" title="Search for works by this author" class="author">[% SEARCH_RESULT.author %]</a>
543
                                [% ELSE %]&nbsp;
550
                                [% ELSE %]&nbsp;
544
                                [% END %]
551
                                [% END %]
552
                [% IF (SEARCH_RESULT.ShowOpenURL && OpenURLResolverURL && SEARCH_RESULT.coins) %]
553
                    <a class="OpenURL" href="[% OpenURLResolverURL %]?[% SEARCH_RESULT.coins %]" title="[% OpenURLText %]">
554
                    [% IF openurlimagelocation %]
555
                        <img src="[% openurlimagelocation %]" />
556
                    [% ELSIF OpenURLText %]
557
                        [% OpenURLText %]
558
                    [% ELSE %]
559
                        OpenURL
560
                    [% END %]
561
                    </a>
562
                [% END %]
545
                <span class="results_summary publisher"><span class="label">Publication:</span>
563
                <span class="results_summary publisher"><span class="label">Publication:</span>
546
                        [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode|html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear %]
564
                        [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode|html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear %]
547
                    [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate %][% END %][% END %]
565
                    [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate %][% END %][% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl (+59 lines)
Lines 982-987 Link Here
982
        </xsl:for-each>
982
        </xsl:for-each>
983
        </xsl:if>
983
        </xsl:if>
984
984
985
        <!-- OpenURL -->
986
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
987
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
988
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
989
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
990
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
991
992
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
993
          <xsl:variable name="openurltext">
994
            <xsl:choose>
995
              <xsl:when test="$OpenURLText != ''">
996
                <xsl:value-of select="$OpenURLText" />
997
              </xsl:when>
998
              <xsl:otherwise>
999
                <xsl:text>OpenURL</xsl:text>
1000
              </xsl:otherwise>
1001
            </xsl:choose>
1002
          </xsl:variable>
1003
1004
          <xsl:variable name="openurlimagelocation">
1005
            <xsl:choose>
1006
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1007
                <xsl:value-of select="$OpenURLImageLocation" />
1008
              </xsl:when>
1009
              <xsl:when test="$OpenURLImageLocation != ''">
1010
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1011
                <xsl:value-of select="$OpenURLImageLocation" />
1012
              </xsl:when>
1013
            </xsl:choose>
1014
          </xsl:variable>
1015
1016
          <span class="results_summary"><a>
1017
            <xsl:attribute name="href">
1018
              <xsl:value-of select="$OpenURLResolverURL" />
1019
              <xsl:text>?</xsl:text>
1020
              <xsl:value-of select="$COinS" />
1021
            </xsl:attribute>
1022
            <xsl:attribute name="title">
1023
              <xsl:value-of select="$openurltext" />
1024
            </xsl:attribute>
1025
            <xsl:attribute name="class">
1026
              <xsl:text>OpenURL</xsl:text>
1027
            </xsl:attribute>
1028
            <xsl:choose>
1029
              <xsl:when test="$openurlimagelocation != ''">
1030
                <img>
1031
                  <xsl:attribute name="src">
1032
                    <xsl:value-of select="$openurlimagelocation" />
1033
                  </xsl:attribute>
1034
                </img>
1035
              </xsl:when>
1036
              <xsl:otherwise>
1037
                <xsl:value-of select="$openurltext" />
1038
              </xsl:otherwise>
1039
            </xsl:choose>
1040
          </a></span>
1041
        </xsl:if>
1042
        <!-- End of OpenURL -->
1043
985
    </xsl:element>
1044
    </xsl:element>
986
    </xsl:template>
1045
    </xsl:template>
987
1046
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl (-1 / +60 lines)
Lines 438-445 Link Here
438
        </xsl:for-each>
438
        </xsl:for-each>
439
        </xsl:if>
439
        </xsl:if>
440
    </a>
440
    </a>
441
    <p>
442
441
442
    <!-- OpenURL -->
443
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
444
    <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
445
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
446
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
447
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
448
449
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
450
      <xsl:variable name="openurltext">
451
        <xsl:choose>
452
          <xsl:when test="$OpenURLText != ''">
453
            <xsl:value-of select="$OpenURLText" />
454
          </xsl:when>
455
          <xsl:otherwise>
456
            <xsl:text>OpenURL</xsl:text>
457
          </xsl:otherwise>
458
        </xsl:choose>
459
      </xsl:variable>
460
461
      <xsl:variable name="openurlimagelocation">
462
        <xsl:choose>
463
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
464
            <xsl:value-of select="$OpenURLImageLocation" />
465
          </xsl:when>
466
          <xsl:when test="$OpenURLImageLocation != ''">
467
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
468
            <xsl:value-of select="$OpenURLImageLocation" />
469
          </xsl:when>
470
        </xsl:choose>
471
      </xsl:variable>
472
473
      &nbsp;<a>
474
        <xsl:attribute name="href">
475
          <xsl:value-of select="$OpenURLResolverURL" />
476
          <xsl:text>?</xsl:text>
477
          <xsl:value-of select="$COinS" />
478
        </xsl:attribute>
479
        <xsl:attribute name="title">
480
          <xsl:value-of select="$openurltext" />
481
        </xsl:attribute>
482
        <xsl:attribute name="class">
483
          <xsl:text>OpenURL</xsl:text>
484
        </xsl:attribute>
485
        <xsl:choose>
486
          <xsl:when test="$openurlimagelocation != ''">
487
            <img>
488
              <xsl:attribute name="src">
489
                <xsl:value-of select="$openurlimagelocation" />
490
              </xsl:attribute>
491
            </img>
492
          </xsl:when>
493
          <xsl:otherwise>
494
            <xsl:value-of select="$openurltext" />
495
          </xsl:otherwise>
496
        </xsl:choose>
497
      </a>
498
    </xsl:if>
499
    <!-- End of OpenURL -->
500
501
    <p>
443
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
502
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
444
    <xsl:if test="$display880">
503
    <xsl:if test="$display880">
445
      <xsl:call-template name="m880Select">
504
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACDetail.xsl (+60 lines)
Lines 438-443 Link Here
438
      </xsl:for-each>
438
      </xsl:for-each>
439
    </span>
439
    </span>
440
  </xsl:if>
440
  </xsl:if>
441
442
  <!-- OpenURL -->
443
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
444
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
445
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
446
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
447
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
448
449
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
450
    <xsl:variable name="openurltext">
451
      <xsl:choose>
452
        <xsl:when test="$OpenURLText != ''">
453
          <xsl:value-of select="$OpenURLText" />
454
        </xsl:when>
455
        <xsl:otherwise>
456
          <xsl:text>OpenURL</xsl:text>
457
        </xsl:otherwise>
458
      </xsl:choose>
459
    </xsl:variable>
460
461
    <xsl:variable name="openurlimagelocation">
462
      <xsl:choose>
463
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
464
          <xsl:value-of select="$OpenURLImageLocation" />
465
        </xsl:when>
466
        <xsl:when test="$OpenURLImageLocation != ''">
467
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
468
          <xsl:value-of select="$OpenURLImageLocation" />
469
        </xsl:when>
470
      </xsl:choose>
471
    </xsl:variable>
472
473
    <span class="results_summary"><a>
474
      <xsl:attribute name="href">
475
        <xsl:value-of select="$OpenURLResolverURL" />
476
        <xsl:text>?</xsl:text>
477
        <xsl:value-of select="$COinS" />
478
      </xsl:attribute>
479
      <xsl:attribute name="title">
480
        <xsl:value-of select="$openurltext" />
481
      </xsl:attribute>
482
      <xsl:attribute name="class">
483
        <xsl:text>OpenURL</xsl:text>
484
      </xsl:attribute>
485
      <xsl:choose>
486
        <xsl:when test="$openurlimagelocation != ''">
487
          <img>
488
            <xsl:attribute name="src">
489
              <xsl:value-of select="$openurlimagelocation" />
490
            </xsl:attribute>
491
          </img>
492
        </xsl:when>
493
        <xsl:otherwise>
494
          <xsl:value-of select="$openurltext" />
495
        </xsl:otherwise>
496
      </xsl:choose>
497
    </a></span>
498
  </xsl:if>
499
  <!-- End of OpenURL -->
500
441
</xsl:template>
501
</xsl:template>
442
502
443
    <xsl:template name="nameABCDQ">
503
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl (+59 lines)
Lines 77-82 Link Here
77
    </xsl:for-each>
77
    </xsl:for-each>
78
  </xsl:if>
78
  </xsl:if>
79
79
80
  <!-- OpenURL -->
81
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
82
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
83
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
84
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
85
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
86
87
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
88
    <xsl:variable name="openurltext">
89
      <xsl:choose>
90
        <xsl:when test="$OpenURLText != ''">
91
          <xsl:value-of select="$OpenURLText" />
92
        </xsl:when>
93
        <xsl:otherwise>
94
          <xsl:text>OpenURL</xsl:text>
95
        </xsl:otherwise>
96
      </xsl:choose>
97
    </xsl:variable>
98
99
    <xsl:variable name="openurlimagelocation">
100
      <xsl:choose>
101
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
102
          <xsl:value-of select="$OpenURLImageLocation" />
103
        </xsl:when>
104
        <xsl:when test="$OpenURLImageLocation != ''">
105
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
106
          <xsl:value-of select="$OpenURLImageLocation" />
107
        </xsl:when>
108
      </xsl:choose>
109
    </xsl:variable>
110
111
    &nbsp;<a>
112
      <xsl:attribute name="href">
113
        <xsl:value-of select="$OpenURLResolverURL" />
114
        <xsl:text>?</xsl:text>
115
        <xsl:value-of select="$COinS" />
116
      </xsl:attribute>
117
      <xsl:attribute name="title">
118
        <xsl:value-of select="$openurltext" />
119
      </xsl:attribute>
120
      <xsl:attribute name="class">
121
        <xsl:text>OpenURL</xsl:text>
122
      </xsl:attribute>
123
      <xsl:choose>
124
        <xsl:when test="$openurlimagelocation != ''">
125
          <img>
126
            <xsl:attribute name="src">
127
              <xsl:value-of select="$openurlimagelocation" />
128
            </xsl:attribute>
129
          </img>
130
        </xsl:when>
131
        <xsl:otherwise>
132
          <xsl:value-of select="$openurltext" />
133
        </xsl:otherwise>
134
      </xsl:choose>
135
    </a>
136
  </xsl:if>
137
  <!-- End of OpenURL -->
138
80
  <xsl:call-template name="tag_title">
139
  <xsl:call-template name="tag_title">
81
    <xsl:with-param name="tag">454</xsl:with-param>
140
    <xsl:with-param name="tag">454</xsl:with-param>
82
    <xsl:with-param name="label">Translation of</xsl:with-param>
141
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1136-1139 $template->param( Link Here
1136
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1136
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1137
);
1137
);
1138
1138
1139
# OpenURL
1140
if (C4::Context->preference('OPACShowOpenURL')) {
1141
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1142
    my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
1143
    if (not grep /^$biblio->{itemtype}$/, @itypes) {
1144
        $template->param(
1145
            OPACShowOpenURL => 1,
1146
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1147
            OpenURLText => C4::Context->preference('OpenURLText'),
1148
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1149
        );
1150
    }
1151
}
1152
1139
output_html_with_http_headers $query, $cookie, $template->output;
1153
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 489-494 if (C4::Context->preference('OpacSuppression')) { Link Here
489
    }
489
    }
490
}
490
}
491
491
492
# OpenURL
493
my @OpenURL_itypes_to_hide;
494
if (C4::Context->preference('OPACShowOpenURL')) {
495
    @OpenURL_itypes_to_hide = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
496
    $template->param(
497
        OPACShowOpenURL => 1,
498
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
499
        OpenURLText => C4::Context->preference('OpenURLText'),
500
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
501
    );
502
}
503
492
$template->param ( LIMIT_INPUTS => \@limit_inputs );
504
$template->param ( LIMIT_INPUTS => \@limit_inputs );
493
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
505
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
494
506
Lines 571-577 for (my $i=0;$i<@servers;$i++) { Link Here
571
                $res->{'incart'} = 1;
583
                $res->{'incart'} = 1;
572
            }
584
            }
573
585
574
            if (C4::Context->preference('COinSinOPACResults')) {
586
            if (C4::Context->preference('COinSinOPACResults')
587
            or C4::Context->preference('OPACShowOpenURL')) {
588
                if (not grep /^$res->{itemtype}$/, @OpenURL_itypes_to_hide) {
589
                    $res->{ShowOpenURL} = 1;
590
                }
575
                my $record = GetMarcBiblio($res->{'biblionumber'});
591
                my $record = GetMarcBiblio($res->{'biblionumber'});
576
                $res->{coins} = GetCOinSBiblio($record);
592
                $res->{coins} = GetCOinSBiblio($record);
577
            }
593
            }
578
- 

Return to bug 8995