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::Log;    # logaction
35
use C4::Log;    # logaction
Lines 1385-1429 sub GetCOinSBiblio { Link Here
1385
        carp 'GetCOinSBiblio called with undefined record';
1386
        carp 'GetCOinSBiblio called with undefined record';
1386
        return;
1387
        return;
1387
    }
1388
    }
1389
1388
    my $pos7 = substr $record->leader(), 7, 1;
1390
    my $pos7 = substr $record->leader(), 7, 1;
1389
    my $pos6 = substr $record->leader(), 6, 1;
1391
    my $pos6 = substr $record->leader(), 6, 1;
1390
    my $mtx;
1392
    my $mtx;
1391
    my $genre;
1393
    my $genre;
1392
    my ( $aulast, $aufirst ) = ( '', '' );
1394
    my ( $aulast, $aufirst ) = ( '', '' );
1393
    my $oauthors  = '';
1395
    my @authors;
1394
    my $title     = '';
1396
    my $title;
1395
    my $subtitle  = '';
1397
    my $hosttitle;
1396
    my $pubyear   = '';
1398
    my $pubyear   = '';
1397
    my $isbn      = '';
1399
    my $isbn      = '';
1398
    my $issn      = '';
1400
    my $issn      = '';
1399
    my $publisher = '';
1401
    my $publisher = '';
1400
    my $pages     = '';
1402
    my $pages     = '';
1401
    my $titletype = 'b';
1403
    my $titletype = '';
1402
1404
1403
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1405
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1404
    # considered the same for UNIMARC and MARC21
1406
    # considered the same for UNIMARC and MARC21
1405
    my $fmts6;
1407
    my $fmts6 = {
1406
    my $fmts7;
1408
        'a' => 'book',
1407
    %$fmts6 = (
1409
        'b' => 'manuscript',
1408
                'a' => 'book',
1410
        'c' => 'book',
1409
                'b' => 'manuscript',
1411
        'd' => 'manuscript',
1410
                'c' => 'book',
1412
        'e' => 'map',
1411
                'd' => 'manuscript',
1413
        'f' => 'map',
1412
                'e' => 'map',
1414
        'g' => 'film',
1413
                'f' => 'map',
1415
        'i' => 'audioRecording',
1414
                'g' => 'film',
1416
        'j' => 'audioRecording',
1415
                'i' => 'audioRecording',
1417
        'k' => 'artwork',
1416
                'j' => 'audioRecording',
1418
        'l' => 'document',
1417
                'k' => 'artwork',
1419
        'm' => 'computerProgram',
1418
                'l' => 'document',
1420
        'o' => 'document',
1419
                'm' => 'computerProgram',
1421
        'r' => 'document',
1420
                'o' => 'document',
1422
    };
1421
                'r' => 'document',
1423
    my $fmts7 = {
1422
            );
1424
        'a' => 'journalArticle',
1423
    %$fmts7 = (
1425
        's' => 'journal',
1424
                    'a' => 'journalArticle',
1426
    };
1425
                    's' => 'journal',
1426
              );
1427
1427
1428
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1428
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1429
1429
Lines 1434-1439 sub GetCOinSBiblio { Link Here
1434
    ##### We must transform mtx to a valable mtx and document type ####
1434
    ##### We must transform mtx to a valable mtx and document type ####
1435
    if ( $genre eq 'book' ) {
1435
    if ( $genre eq 'book' ) {
1436
            $mtx = 'book';
1436
            $mtx = 'book';
1437
            $titletype = 'b';
1437
    } elsif ( $genre eq 'journal' ) {
1438
    } elsif ( $genre eq 'journal' ) {
1438
            $mtx = 'journal';
1439
            $mtx = 'journal';
1439
            $titletype = 'j';
1440
            $titletype = 'j';
Lines 1445-1470 sub GetCOinSBiblio { Link Here
1445
            $mtx = 'dc';
1446
            $mtx = 'dc';
1446
    }
1447
    }
1447
1448
1448
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1449
1450
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1449
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1451
1450
1452
        # Setting datas
1451
        # Setting datas
1453
        $aulast  = $record->subfield( '700', 'a' ) || '';
1452
        $aulast  = $record->subfield( '700', 'a' ) || '';
1454
        $aufirst = $record->subfield( '700', 'b' ) || '';
1453
        $aufirst = $record->subfield( '700', 'b' ) || '';
1455
        $oauthors = "&rft.au=$aufirst $aulast";
1454
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1456
1455
1457
        # others authors
1456
        # others authors
1458
        if ( $record->field('200') ) {
1457
        if ( $record->field('200') ) {
1459
            for my $au ( $record->field('200')->subfield('g') ) {
1458
            for my $au ( $record->field('200')->subfield('g') ) {
1460
                $oauthors .= "&rft.au=$au";
1459
                push @authors, $au;
1461
            }
1460
            }
1462
        }
1461
        }
1463
        $title =
1462
1464
          ( $mtx eq 'dc' )
1463
        $title     = $record->subfield( '200', 'a' );
1465
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1464
        my $subfield_210d = $record->subfield('210', 'd');
1466
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1465
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1467
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1466
            $pubyear = $1;
1467
        }
1468
        $publisher = $record->subfield( '210', 'c' ) || '';
1468
        $publisher = $record->subfield( '210', 'c' ) || '';
1469
        $isbn      = $record->subfield( '010', 'a' ) || '';
1469
        $isbn      = $record->subfield( '010', 'a' ) || '';
1470
        $issn      = $record->subfield( '011', 'a' ) || '';
1470
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1474-1507 sub GetCOinSBiblio { Link Here
1474
1474
1475
        # Setting datas
1475
        # Setting datas
1476
        if ( $record->field('100') ) {
1476
        if ( $record->field('100') ) {
1477
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1477
            push @authors, $record->subfield( '100', 'a' );
1478
        }
1478
        }
1479
1479
1480
        # others authors
1480
        # others authors
1481
        if ( $record->field('700') ) {
1481
        if ( $record->field('700') ) {
1482
            for my $au ( $record->field('700')->subfield('a') ) {
1482
            for my $au ( $record->field('700')->subfield('a') ) {
1483
                $oauthors .= "&rft.au=$au";
1483
                push @authors, $au;
1484
            }
1484
            }
1485
        }
1485
        }
1486
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1486
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1487
        $subtitle = $record->subfield( '245', 'b' ) || '';
1488
        $title .= $subtitle;
1489
        if ($titletype eq 'a') {
1487
        if ($titletype eq 'a') {
1490
            $pubyear   = $record->field('008') || '';
1488
            $pubyear   = $record->field('008') || '';
1491
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1489
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1492
            $isbn      = $record->subfield( '773', 'z' ) || '';
1490
            $isbn      = $record->subfield( '773', 'z' ) || '';
1493
            $issn      = $record->subfield( '773', 'x' ) || '';
1491
            $issn      = $record->subfield( '773', 'x' ) || '';
1494
            if ($mtx eq 'journal') {
1492
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1495
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1493
            my @rels = $record->subfield( '773', 'g' );
1496
            } else {
1494
            $pages = join(', ', @rels);
1497
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1498
            }
1499
            foreach my $rel ($record->subfield( '773', 'g' )) {
1500
                if ($pages) {
1501
                    $pages .= ', ';
1502
                }
1503
                $pages .= $rel;
1504
            }
1505
        } else {
1495
        } else {
1506
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1496
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1507
            $publisher = $record->subfield( '260', 'b' ) || '';
1497
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1510-1521 sub GetCOinSBiblio { Link Here
1510
        }
1500
        }
1511
1501
1512
    }
1502
    }
1513
    my $coins_value =
1514
"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";
1515
    $coins_value =~ s/(\ |&[^a])/\+/g;
1516
    $coins_value =~ s/\"/\&quot\;/g;
1517
1503
1518
#<!-- 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="
1504
    my @params = (
1505
        [ 'ctx_ver', 'Z39.88-2004' ],
1506
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1507
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1508
        [ "rft.${titletype}title", $title ],
1509
    );
1510
1511
    # rft.title is authorized only once, so by checking $titletype
1512
    # we ensure that rft.title is not already in the list.
1513
    if ($hosttitle and $titletype) {
1514
        push @params, [ 'rft.title', $hosttitle ];
1515
    }
1516
1517
    push @params, (
1518
        [ 'rft.isbn', $isbn ],
1519
        [ 'rft.issn', $issn ],
1520
    );
1521
1522
    # If it's a subscription, these informations have no meaning.
1523
    if ($genre ne 'journal') {
1524
        push @params, (
1525
            [ 'rft.aulast', $aulast ],
1526
            [ 'rft.aufirst', $aufirst ],
1527
            (map { [ 'rft.au', $_ ] } @authors),
1528
            [ 'rft.pub', $publisher ],
1529
            [ 'rft.date', $pubyear ],
1530
            [ 'rft.pages', $pages ],
1531
        );
1532
    }
1533
1534
    my $coins_value = join( '&amp;',
1535
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1519
1536
1520
    return $coins_value;
1537
    return $coins_value;
1521
}
1538
}
(-)a/C4/XSLT.pm (-4 / +20 lines)
Lines 171-177 sub get_xslt_sysprefs { Link Here
171
                              OPACItemLocation DisplayIconsXSLT
171
                              OPACItemLocation DisplayIconsXSLT
172
                              AlternateHoldingsField AlternateHoldingsSeparator
172
                              AlternateHoldingsField AlternateHoldingsSeparator
173
                              TrackClicks opacthemes IdRef OpacSuppression
173
                              TrackClicks opacthemes IdRef OpacSuppression
174
                              OPACResultsLibrary / )
174
                              OPACResultsLibrary OPACShowOpenURL
175
                              OpenURLResolverURL OpenURLImageLocation
176
                              OpenURLText / )
175
    {
177
    {
176
        my $sp = C4::Context->preference( $syspref );
178
        my $sp = C4::Context->preference( $syspref );
177
        next unless defined($sp);
179
        next unless defined($sp);
Lines 188-194 sub get_xslt_sysprefs { Link Here
188
}
190
}
189
191
190
sub XSLTParse4Display {
192
sub XSLTParse4Display {
191
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_;
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_;
192
194
193
    $sysxml ||= C4::Context->preference($xslsyspref);
195
    $sysxml ||= C4::Context->preference($xslsyspref);
194
    $xslfilename ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
Lines 243-250 sub XSLTParse4Display { Link Here
243
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
245
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
244
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
246
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
245
247
246
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
248
    $variables ||= {};
247
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
249
    if (C4::Context->preference('OPACShowOpenURL')) {
250
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
251
        my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
252
        if (grep /^$biblio->{itemtype}$/, @itypes) {
253
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
254
        }
255
    }
256
    my $varxml = "<variables>\n";
257
    while (my ($key, $value) = each %$variables) {
258
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
259
    }
260
    $varxml .= "</variables>\n";
261
262
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
263
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
248
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
264
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
249
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
265
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
250
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
266
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
(-)a/installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql (+6 lines)
Line 0 Link Here
1
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES
2
  ('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free'),
3
  ('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free'),
4
  ('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free'),
5
  ('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo'),
6
  ('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
(-)a/installer/data/mysql/sysprefs.sql (+5 lines)
Lines 371-376 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
371
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
371
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
372
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
372
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
373
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
373
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
374
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
375
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
376
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
377
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
378
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
374
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
379
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
375
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
380
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
376
('OverDriveClientSecret','','Client key for OverDrive integration','30','YesNo'),
381
('OverDriveClientSecret','','Client key for OverDrive integration','30','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 500-505 OPAC: Link Here
500
            - pref: OPACISBD
500
            - pref: OPACISBD
501
              type: textarea
501
              type: textarea
502
              class: code
502
              class: code
503
    OpenURL:
504
        -
505
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
506
            - pref: OpenURLResolverURL
507
              class: url
508
        -
509
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
510
            - pref: OpenURLText
511
        -
512
            - 'Location of image for OpenURL links:'
513
            - pref: OpenURLImageLocation
514
              class: url
515
            - '<br />Can be a complete URL starting with <code>http://</code> or'
516
            - '<code>https://</code> or the name of a file in <code>images</code> directory'
517
            - '<br />Examples:'
518
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
519
            - '<br />- <code>OpenURL/OpenURL.png</code> (file is in <code>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</code>)'
520
        -
521
            - pref: OPACShowOpenURL
522
              choices:
523
                  yes: Enable
524
                  no: Disable
525
            - 'display of OpenURL link in OPAC search results and detail page.'
526
        -
527
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
528
            - pref: OPACOpenURLItemTypes
529
            - '<br />'
503
    Policy:
530
    Policy:
504
        -
531
        -
505
            - pref: SearchMyLibraryFirst
532
            - pref: SearchMyLibraryFirst
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+64 lines)
Lines 1229-1234 Link Here
1229
        </xsl:for-each>
1229
        </xsl:for-each>
1230
        </xsl:if>
1230
        </xsl:if>
1231
1231
1232
        <!-- OpenURL -->
1233
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1234
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
1235
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1236
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1237
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
1238
1239
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
1240
          <xsl:variable name="openurltext">
1241
            <xsl:choose>
1242
              <xsl:when test="$OpenURLText != ''">
1243
                <xsl:value-of select="$OpenURLText" />
1244
              </xsl:when>
1245
              <xsl:otherwise>
1246
                <xsl:text>OpenURL</xsl:text>
1247
              </xsl:otherwise>
1248
            </xsl:choose>
1249
          </xsl:variable>
1250
1251
          <xsl:variable name="openurlimagelocation">
1252
            <xsl:choose>
1253
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1254
                <xsl:value-of select="$OpenURLImageLocation" />
1255
              </xsl:when>
1256
              <xsl:when test="$OpenURLImageLocation != ''">
1257
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1258
                <xsl:value-of select="$OpenURLImageLocation" />
1259
              </xsl:when>
1260
            </xsl:choose>
1261
          </xsl:variable>
1262
1263
          <span class="results_summary"><a>
1264
            <xsl:attribute name="href">
1265
              <xsl:value-of select="$OpenURLResolverURL" />
1266
              <xsl:text>?</xsl:text>
1267
              <xsl:value-of select="$COinS" />
1268
            </xsl:attribute>
1269
            <xsl:attribute name="title">
1270
              <xsl:value-of select="$openurltext" />
1271
            </xsl:attribute>
1272
            <xsl:attribute name="class">
1273
              <xsl:text>OpenURL</xsl:text>
1274
            </xsl:attribute>
1275
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1276
              <xsl:attribute name="target">
1277
                <xsl:text>_blank</xsl:text>
1278
              </xsl:attribute>
1279
            </xsl:if>
1280
            <xsl:choose>
1281
              <xsl:when test="$openurlimagelocation != ''">
1282
                <img>
1283
                  <xsl:attribute name="src">
1284
                    <xsl:value-of select="$openurlimagelocation" />
1285
                  </xsl:attribute>
1286
                </img>
1287
              </xsl:when>
1288
              <xsl:otherwise>
1289
                <xsl:value-of select="$openurltext" />
1290
              </xsl:otherwise>
1291
            </xsl:choose>
1292
          </a></span>
1293
        </xsl:if>
1294
        <!-- End of OpenURL -->
1295
1232
    </xsl:element>
1296
    </xsl:element>
1233
    </xsl:template>
1297
    </xsl:template>
1234
1298
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +65 lines)
Lines 443-450 Link Here
443
            </xsl:for-each>
443
            </xsl:for-each>
444
        </xsl:if>
444
        </xsl:if>
445
    </a>
445
    </a>
446
    <p>
447
446
447
    <!-- OpenURL -->
448
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
449
    <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
450
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
451
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
452
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
453
454
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
455
      <xsl:variable name="openurltext">
456
        <xsl:choose>
457
          <xsl:when test="$OpenURLText != ''">
458
            <xsl:value-of select="$OpenURLText" />
459
          </xsl:when>
460
          <xsl:otherwise>
461
            <xsl:text>OpenURL</xsl:text>
462
          </xsl:otherwise>
463
        </xsl:choose>
464
      </xsl:variable>
465
466
      <xsl:variable name="openurlimagelocation">
467
        <xsl:choose>
468
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
469
            <xsl:value-of select="$OpenURLImageLocation" />
470
          </xsl:when>
471
          <xsl:when test="$OpenURLImageLocation != ''">
472
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
473
            <xsl:value-of select="$OpenURLImageLocation" />
474
          </xsl:when>
475
        </xsl:choose>
476
      </xsl:variable>
477
478
      <span class="results_summary"><a>
479
        <xsl:attribute name="href">
480
          <xsl:value-of select="$OpenURLResolverURL" />
481
          <xsl:text>?</xsl:text>
482
          <xsl:value-of select="$COinS" />
483
        </xsl:attribute>
484
        <xsl:attribute name="title">
485
          <xsl:value-of select="$openurltext" />
486
        </xsl:attribute>
487
        <xsl:attribute name="class">
488
          <xsl:text>OpenURL</xsl:text>
489
        </xsl:attribute>
490
        <xsl:if test="$OPACURLOpenInNewWindow='1'">
491
          <xsl:attribute name="target">
492
            <xsl:text>_blank</xsl:text>
493
          </xsl:attribute>
494
        </xsl:if>
495
        <xsl:choose>
496
          <xsl:when test="$openurlimagelocation != ''">
497
            <img>
498
              <xsl:attribute name="src">
499
                <xsl:value-of select="$openurlimagelocation" />
500
              </xsl:attribute>
501
            </img>
502
          </xsl:when>
503
          <xsl:otherwise>
504
            <xsl:value-of select="$openurltext" />
505
          </xsl:otherwise>
506
        </xsl:choose>
507
      </a></span>
508
    </xsl:if>
509
    <!-- End of OpenURL -->
510
511
    <p>
448
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
512
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
449
    <xsl:if test="$display880">
513
    <xsl:if test="$display880">
450
      <xsl:call-template name="m880Select">
514
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl (+65 lines)
Lines 442-447 Link Here
442
      </xsl:for-each>
442
      </xsl:for-each>
443
    </span>
443
    </span>
444
  </xsl:if>
444
  </xsl:if>
445
446
  <!-- OpenURL -->
447
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
448
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
449
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
450
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
451
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
452
453
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
454
    <xsl:variable name="openurltext">
455
      <xsl:choose>
456
        <xsl:when test="$OpenURLText != ''">
457
          <xsl:value-of select="$OpenURLText" />
458
        </xsl:when>
459
        <xsl:otherwise>
460
          <xsl:text>OpenURL</xsl:text>
461
        </xsl:otherwise>
462
      </xsl:choose>
463
    </xsl:variable>
464
465
    <xsl:variable name="openurlimagelocation">
466
      <xsl:choose>
467
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
468
          <xsl:value-of select="$OpenURLImageLocation" />
469
        </xsl:when>
470
        <xsl:when test="$OpenURLImageLocation != ''">
471
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
472
          <xsl:value-of select="$OpenURLImageLocation" />
473
        </xsl:when>
474
      </xsl:choose>
475
    </xsl:variable>
476
477
    <span class="results_summary"><a>
478
      <xsl:attribute name="href">
479
        <xsl:value-of select="$OpenURLResolverURL" />
480
        <xsl:text>?</xsl:text>
481
        <xsl:value-of select="$COinS" />
482
      </xsl:attribute>
483
      <xsl:attribute name="title">
484
        <xsl:value-of select="$openurltext" />
485
      </xsl:attribute>
486
      <xsl:attribute name="class">
487
        <xsl:text>OpenURL</xsl:text>
488
      </xsl:attribute>
489
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
490
        <xsl:attribute name="target">
491
          <xsl:text>_blank</xsl:text>
492
        </xsl:attribute>
493
      </xsl:if>
494
      <xsl:choose>
495
        <xsl:when test="$openurlimagelocation != ''">
496
          <img>
497
            <xsl:attribute name="src">
498
              <xsl:value-of select="$openurlimagelocation" />
499
            </xsl:attribute>
500
          </img>
501
        </xsl:when>
502
        <xsl:otherwise>
503
          <xsl:value-of select="$openurltext" />
504
        </xsl:otherwise>
505
      </xsl:choose>
506
    </a></span>
507
  </xsl:if>
508
  <!-- End of OpenURL -->
509
445
</xsl:template>
510
</xsl:template>
446
511
447
    <xsl:template name="nameABCDQ">
512
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl (+64 lines)
Lines 84-89 Link Here
84
    </xsl:for-each>
84
    </xsl:for-each>
85
  </xsl:if>
85
  </xsl:if>
86
86
87
  <!-- OpenURL -->
88
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
89
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
90
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
91
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
92
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
93
94
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
95
    <xsl:variable name="openurltext">
96
      <xsl:choose>
97
        <xsl:when test="$OpenURLText != ''">
98
          <xsl:value-of select="$OpenURLText" />
99
        </xsl:when>
100
        <xsl:otherwise>
101
          <xsl:text>OpenURL</xsl:text>
102
        </xsl:otherwise>
103
      </xsl:choose>
104
    </xsl:variable>
105
106
    <xsl:variable name="openurlimagelocation">
107
      <xsl:choose>
108
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
109
          <xsl:value-of select="$OpenURLImageLocation" />
110
        </xsl:when>
111
        <xsl:when test="$OpenURLImageLocation != ''">
112
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
113
          <xsl:value-of select="$OpenURLImageLocation" />
114
        </xsl:when>
115
      </xsl:choose>
116
    </xsl:variable>
117
118
    <span class="results_summary"><a>
119
      <xsl:attribute name="href">
120
        <xsl:value-of select="$OpenURLResolverURL" />
121
        <xsl:text>?</xsl:text>
122
        <xsl:value-of select="$COinS" />
123
      </xsl:attribute>
124
      <xsl:attribute name="title">
125
        <xsl:value-of select="$openurltext" />
126
      </xsl:attribute>
127
      <xsl:attribute name="class">
128
        <xsl:text>OpenURL</xsl:text>
129
      </xsl:attribute>
130
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
131
        <xsl:attribute name="target">
132
          <xsl:text>_blank</xsl:text>
133
        </xsl:attribute>
134
      </xsl:if>
135
      <xsl:choose>
136
        <xsl:when test="$openurlimagelocation != ''">
137
          <img>
138
            <xsl:attribute name="src">
139
              <xsl:value-of select="$openurlimagelocation" />
140
            </xsl:attribute>
141
          </img>
142
        </xsl:when>
143
        <xsl:otherwise>
144
          <xsl:value-of select="$openurltext" />
145
        </xsl:otherwise>
146
      </xsl:choose>
147
    </a></span>
148
  </xsl:if>
149
  <!-- End of OpenURL -->
150
87
  <xsl:call-template name="tag_title">
151
  <xsl:call-template name="tag_title">
88
    <xsl:with-param name="tag">454</xsl:with-param>
152
    <xsl:with-param name="tag">454</xsl:with-param>
89
    <xsl:with-param name="label">Translation of</xsl:with-param>
153
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less (+4 lines)
Lines 2503-2506 a.reviewlink:visited { Link Here
2503
    cursor: pointer;
2503
    cursor: pointer;
2504
}
2504
}
2505
2505
2506
a.OpenURL img {
2507
    vertical-align: middle;
2508
}
2509
2506
@import "responsive.less";
2510
@import "responsive.less";
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1155-1158 $template->param( Link Here
1155
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1155
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1156
);
1156
);
1157
1157
1158
# OpenURL
1159
if (C4::Context->preference('OPACShowOpenURL')) {
1160
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1161
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1162
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1163
        $template->param(
1164
            OPACShowOpenURL => 1,
1165
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1166
            OpenURLText => C4::Context->preference('OpenURLText'),
1167
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1168
        );
1169
    }
1170
}
1171
1158
output_html_with_http_headers $query, $cookie, $template->output;
1172
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 586-591 if (C4::Context->preference('OpacSuppression')) { Link Here
586
    }
586
    }
587
}
587
}
588
588
589
# OpenURL
590
my @OpenURL_itypes;
591
if (C4::Context->preference('OPACShowOpenURL')) {
592
    @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
593
    $template->param(
594
        OPACShowOpenURL => 1,
595
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
596
        OpenURLText => C4::Context->preference('OpenURLText'),
597
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
598
    );
599
}
600
589
$template->param ( LIMIT_INPUTS => \@limit_inputs );
601
$template->param ( LIMIT_INPUTS => \@limit_inputs );
590
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
602
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
591
603
Lines 661-667 for (my $i=0;$i<@servers;$i++) { Link Here
661
                $res->{'incart'} = 1;
673
                $res->{'incart'} = 1;
662
            }
674
            }
663
675
664
            if (C4::Context->preference('COinSinOPACResults')) {
676
            if (C4::Context->preference('COinSinOPACResults')
677
            or C4::Context->preference('OPACShowOpenURL')) {
678
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
679
                    $res->{ShowOpenURL} = 1;
680
                }
665
                my $record = GetMarcBiblio($res->{'biblionumber'});
681
                my $record = GetMarcBiblio($res->{'biblionumber'});
666
                $res->{coins} = GetCOinSBiblio($record);
682
                $res->{coins} = GetCOinSBiblio($record);
667
            }
683
            }
668
- 

Return to bug 8995