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

(-)a/C4/Biblio.pm (-56 / +73 lines)
Lines 28-33 use MARC::File::USMARC; Link Here
28
use MARC::File::XML;
28
use MARC::File::XML;
29
use POSIX qw(strftime);
29
use POSIX qw(strftime);
30
use Module::Load::Conditional qw(can_load);
30
use Module::Load::Conditional qw(can_load);
31
use URI::Escape; # GetCOinSBiblio
31
32
32
use C4::Koha;
33
use C4::Koha;
33
use C4::Log;    # logaction
34
use C4::Log;    # logaction
Lines 1318-1362 sub GetCOinSBiblio { Link Here
1318
        carp 'GetCOinSBiblio called with undefined record';
1319
        carp 'GetCOinSBiblio called with undefined record';
1319
        return;
1320
        return;
1320
    }
1321
    }
1322
1321
    my $pos7 = substr $record->leader(), 7, 1;
1323
    my $pos7 = substr $record->leader(), 7, 1;
1322
    my $pos6 = substr $record->leader(), 6, 1;
1324
    my $pos6 = substr $record->leader(), 6, 1;
1323
    my $mtx;
1325
    my $mtx;
1324
    my $genre;
1326
    my $genre;
1325
    my ( $aulast, $aufirst ) = ( '', '' );
1327
    my ( $aulast, $aufirst ) = ( '', '' );
1326
    my $oauthors  = '';
1328
    my @authors;
1327
    my $title     = '';
1329
    my $title;
1328
    my $subtitle  = '';
1330
    my $hosttitle;
1329
    my $pubyear   = '';
1331
    my $pubyear   = '';
1330
    my $isbn      = '';
1332
    my $isbn      = '';
1331
    my $issn      = '';
1333
    my $issn      = '';
1332
    my $publisher = '';
1334
    my $publisher = '';
1333
    my $pages     = '';
1335
    my $pages     = '';
1334
    my $titletype = 'b';
1336
    my $titletype = '';
1335
1337
1336
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1338
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1337
    # considered the same for UNIMARC and MARC21
1339
    # considered the same for UNIMARC and MARC21
1338
    my $fmts6;
1340
    my $fmts6 = {
1339
    my $fmts7;
1341
        'a' => 'book',
1340
    %$fmts6 = (
1342
        'b' => 'manuscript',
1341
                'a' => 'book',
1343
        'c' => 'book',
1342
                'b' => 'manuscript',
1344
        'd' => 'manuscript',
1343
                'c' => 'book',
1345
        'e' => 'map',
1344
                'd' => 'manuscript',
1346
        'f' => 'map',
1345
                'e' => 'map',
1347
        'g' => 'film',
1346
                'f' => 'map',
1348
        'i' => 'audioRecording',
1347
                'g' => 'film',
1349
        'j' => 'audioRecording',
1348
                'i' => 'audioRecording',
1350
        'k' => 'artwork',
1349
                'j' => 'audioRecording',
1351
        'l' => 'document',
1350
                'k' => 'artwork',
1352
        'm' => 'computerProgram',
1351
                'l' => 'document',
1353
        'o' => 'document',
1352
                'm' => 'computerProgram',
1354
        'r' => 'document',
1353
                'o' => 'document',
1355
    };
1354
                'r' => 'document',
1356
    my $fmts7 = {
1355
            );
1357
        'a' => 'journalArticle',
1356
    %$fmts7 = (
1358
        's' => 'journal',
1357
                    'a' => 'journalArticle',
1359
    };
1358
                    's' => 'journal',
1359
              );
1360
1360
1361
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1361
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1362
1362
Lines 1367-1372 sub GetCOinSBiblio { Link Here
1367
    ##### We must transform mtx to a valable mtx and document type ####
1367
    ##### We must transform mtx to a valable mtx and document type ####
1368
    if ( $genre eq 'book' ) {
1368
    if ( $genre eq 'book' ) {
1369
            $mtx = 'book';
1369
            $mtx = 'book';
1370
            $titletype = 'b';
1370
    } elsif ( $genre eq 'journal' ) {
1371
    } elsif ( $genre eq 'journal' ) {
1371
            $mtx = 'journal';
1372
            $mtx = 'journal';
1372
            $titletype = 'j';
1373
            $titletype = 'j';
Lines 1378-1403 sub GetCOinSBiblio { Link Here
1378
            $mtx = 'dc';
1379
            $mtx = 'dc';
1379
    }
1380
    }
1380
1381
1381
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1382
1383
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1382
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1384
1383
1385
        # Setting datas
1384
        # Setting datas
1386
        $aulast  = $record->subfield( '700', 'a' ) || '';
1385
        $aulast  = $record->subfield( '700', 'a' ) || '';
1387
        $aufirst = $record->subfield( '700', 'b' ) || '';
1386
        $aufirst = $record->subfield( '700', 'b' ) || '';
1388
        $oauthors = "&rft.au=$aufirst $aulast";
1387
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1389
1388
1390
        # others authors
1389
        # others authors
1391
        if ( $record->field('200') ) {
1390
        if ( $record->field('200') ) {
1392
            for my $au ( $record->field('200')->subfield('g') ) {
1391
            for my $au ( $record->field('200')->subfield('g') ) {
1393
                $oauthors .= "&rft.au=$au";
1392
                push @authors, $au;
1394
            }
1393
            }
1395
        }
1394
        }
1396
        $title =
1395
1397
          ( $mtx eq 'dc' )
1396
        $title     = $record->subfield( '200', 'a' );
1398
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1397
        my $subfield_210d = $record->subfield('210', 'd');
1399
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1398
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1400
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1399
            $pubyear = $1;
1400
        }
1401
        $publisher = $record->subfield( '210', 'c' ) || '';
1401
        $publisher = $record->subfield( '210', 'c' ) || '';
1402
        $isbn      = $record->subfield( '010', 'a' ) || '';
1402
        $isbn      = $record->subfield( '010', 'a' ) || '';
1403
        $issn      = $record->subfield( '011', 'a' ) || '';
1403
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1407-1440 sub GetCOinSBiblio { Link Here
1407
1407
1408
        # Setting datas
1408
        # Setting datas
1409
        if ( $record->field('100') ) {
1409
        if ( $record->field('100') ) {
1410
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1410
            push @authors, $record->subfield( '100', 'a' );
1411
        }
1411
        }
1412
1412
1413
        # others authors
1413
        # others authors
1414
        if ( $record->field('700') ) {
1414
        if ( $record->field('700') ) {
1415
            for my $au ( $record->field('700')->subfield('a') ) {
1415
            for my $au ( $record->field('700')->subfield('a') ) {
1416
                $oauthors .= "&rft.au=$au";
1416
                push @authors, $au;
1417
            }
1417
            }
1418
        }
1418
        }
1419
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1419
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1420
        $subtitle = $record->subfield( '245', 'b' ) || '';
1421
        $title .= $subtitle;
1422
        if ($titletype eq 'a') {
1420
        if ($titletype eq 'a') {
1423
            $pubyear   = $record->field('008') || '';
1421
            $pubyear   = $record->field('008') || '';
1424
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1422
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1425
            $isbn      = $record->subfield( '773', 'z' ) || '';
1423
            $isbn      = $record->subfield( '773', 'z' ) || '';
1426
            $issn      = $record->subfield( '773', 'x' ) || '';
1424
            $issn      = $record->subfield( '773', 'x' ) || '';
1427
            if ($mtx eq 'journal') {
1425
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1428
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1426
            my @rels = $record->subfield( '773', 'g' );
1429
            } else {
1427
            $pages = join(', ', @rels);
1430
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1431
            }
1432
            foreach my $rel ($record->subfield( '773', 'g' )) {
1433
                if ($pages) {
1434
                    $pages .= ', ';
1435
                }
1436
                $pages .= $rel;
1437
            }
1438
        } else {
1428
        } else {
1439
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1429
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1440
            $publisher = $record->subfield( '260', 'b' ) || '';
1430
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1443-1454 sub GetCOinSBiblio { Link Here
1443
        }
1433
        }
1444
1434
1445
    }
1435
    }
1446
    my $coins_value =
1447
"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";
1448
    $coins_value =~ s/(\ |&[^a])/\+/g;
1449
    $coins_value =~ s/\"/\&quot\;/g;
1450
1436
1451
#<!-- 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="
1437
    my @params = (
1438
        [ 'ctx_ver', 'Z39.88-2004' ],
1439
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1440
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1441
        [ "rft.${titletype}title", $title ],
1442
    );
1443
1444
    # rft.title is authorized only once, so by checking $titletype
1445
    # we ensure that rft.title is not already in the list.
1446
    if ($hosttitle and $titletype) {
1447
        push @params, [ 'rft.title', $hosttitle ];
1448
    }
1449
1450
    push @params, (
1451
        [ 'rft.isbn', $isbn ],
1452
        [ 'rft.issn', $issn ],
1453
    );
1454
1455
    # If it's a subscription, these informations have no meaning.
1456
    if ($genre ne 'journal') {
1457
        push @params, (
1458
            [ 'rft.aulast', $aulast ],
1459
            [ 'rft.aufirst', $aufirst ],
1460
            (map { [ 'rft.au', $_ ] } @authors),
1461
            [ 'rft.pub', $publisher ],
1462
            [ 'rft.date', $pubyear ],
1463
            [ 'rft.pages', $pages ],
1464
        );
1465
    }
1466
1467
    my $coins_value = join( '&amp;',
1468
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1452
1469
1453
    return $coins_value;
1470
    return $coins_value;
1454
}
1471
}
(-)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 397-402 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
397
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
397
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
398
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
398
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
399
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
399
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
400
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
401
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
402
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
403
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
404
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
400
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
405
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
401
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
406
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
402
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
407
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 514-519 OPAC: Link Here
514
            - pref: OPACISBD
514
            - pref: OPACISBD
515
              type: textarea
515
              type: textarea
516
              class: code
516
              class: code
517
    OpenURL:
518
        -
519
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
520
            - pref: OpenURLResolverURL
521
              class: url
522
        -
523
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
524
            - pref: OpenURLText
525
        -
526
            - 'Location of image for OpenURL links:'
527
            - pref: OpenURLImageLocation
528
              class: url
529
            - '<br />Can be a complete URL starting with <code>http://</code> or'
530
            - '<code>https://</code> or the name of a file in <code>images</code> directory'
531
            - '<br />Examples:'
532
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
533
            - '<br />- <code>OpenURL/OpenURL.png</code> (file is in <code>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</code>)'
534
        -
535
            - pref: OPACShowOpenURL
536
              choices:
537
                  yes: Enable
538
                  no: Disable
539
            - 'display of OpenURL link in OPAC search results and detail page.'
540
        -
541
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
542
            - pref: OPACOpenURLItemTypes
543
            - '<br />'
517
    Policy:
544
    Policy:
518
        -
545
        -
519
            - pref: SearchMyLibraryFirst
546
            - pref: SearchMyLibraryFirst
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+64 lines)
Lines 1247-1252 Link Here
1247
        </xsl:for-each>
1247
        </xsl:for-each>
1248
        </xsl:if>
1248
        </xsl:if>
1249
1249
1250
        <!-- OpenURL -->
1251
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1252
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
1253
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1254
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1255
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
1256
1257
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
1258
          <xsl:variable name="openurltext">
1259
            <xsl:choose>
1260
              <xsl:when test="$OpenURLText != ''">
1261
                <xsl:value-of select="$OpenURLText" />
1262
              </xsl:when>
1263
              <xsl:otherwise>
1264
                <xsl:text>OpenURL</xsl:text>
1265
              </xsl:otherwise>
1266
            </xsl:choose>
1267
          </xsl:variable>
1268
1269
          <xsl:variable name="openurlimagelocation">
1270
            <xsl:choose>
1271
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1272
                <xsl:value-of select="$OpenURLImageLocation" />
1273
              </xsl:when>
1274
              <xsl:when test="$OpenURLImageLocation != ''">
1275
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1276
                <xsl:value-of select="$OpenURLImageLocation" />
1277
              </xsl:when>
1278
            </xsl:choose>
1279
          </xsl:variable>
1280
1281
          <span class="results_summary"><a>
1282
            <xsl:attribute name="href">
1283
              <xsl:value-of select="$OpenURLResolverURL" />
1284
              <xsl:text>?</xsl:text>
1285
              <xsl:value-of select="$COinS" />
1286
            </xsl:attribute>
1287
            <xsl:attribute name="title">
1288
              <xsl:value-of select="$openurltext" />
1289
            </xsl:attribute>
1290
            <xsl:attribute name="class">
1291
              <xsl:text>OpenURL</xsl:text>
1292
            </xsl:attribute>
1293
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1294
              <xsl:attribute name="target">
1295
                <xsl:text>_blank</xsl:text>
1296
              </xsl:attribute>
1297
            </xsl:if>
1298
            <xsl:choose>
1299
              <xsl:when test="$openurlimagelocation != ''">
1300
                <img>
1301
                  <xsl:attribute name="src">
1302
                    <xsl:value-of select="$openurlimagelocation" />
1303
                  </xsl:attribute>
1304
                </img>
1305
              </xsl:when>
1306
              <xsl:otherwise>
1307
                <xsl:value-of select="$openurltext" />
1308
              </xsl:otherwise>
1309
            </xsl:choose>
1310
          </a></span>
1311
        </xsl:if>
1312
        <!-- End of OpenURL -->
1313
1250
    </xsl:element>
1314
    </xsl:element>
1251
    </xsl:template>
1315
    </xsl:template>
1252
1316
(-)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 2526-2529 a.reviewlink:visited { Link Here
2526
    color: white !important;
2526
    color: white !important;
2527
}
2527
}
2528
2528
2529
a.OpenURL img {
2530
    vertical-align: middle;
2531
}
2532
2529
@import "responsive.less";
2533
@import "responsive.less";
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1191-1194 $template->param( Link Here
1191
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1191
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1192
);
1192
);
1193
1193
1194
# OpenURL
1195
if (C4::Context->preference('OPACShowOpenURL')) {
1196
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1197
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1198
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1199
        $template->param(
1200
            OPACShowOpenURL => 1,
1201
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1202
            OpenURLText => C4::Context->preference('OpenURLText'),
1203
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1204
        );
1205
    }
1206
}
1207
1194
output_html_with_http_headers $query, $cookie, $template->output;
1208
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 581-586 if (C4::Context->preference('OpacSuppression')) { Link Here
581
    }
581
    }
582
}
582
}
583
583
584
# OpenURL
585
my @OpenURL_itypes;
586
if (C4::Context->preference('OPACShowOpenURL')) {
587
    @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
588
    $template->param(
589
        OPACShowOpenURL => 1,
590
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
591
        OpenURLText => C4::Context->preference('OpenURLText'),
592
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
593
    );
594
}
595
584
$template->param ( LIMIT_INPUTS => \@limit_inputs );
596
$template->param ( LIMIT_INPUTS => \@limit_inputs );
585
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
597
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
586
598
Lines 656-662 for (my $i=0;$i<@servers;$i++) { Link Here
656
                $res->{'incart'} = 1;
668
                $res->{'incart'} = 1;
657
            }
669
            }
658
670
659
            if (C4::Context->preference('COinSinOPACResults')) {
671
            if (C4::Context->preference('COinSinOPACResults')
672
            or C4::Context->preference('OPACShowOpenURL')) {
673
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
674
                    $res->{ShowOpenURL} = 1;
675
                }
660
                my $record = GetMarcBiblio($res->{'biblionumber'});
676
                my $record = GetMarcBiblio($res->{'biblionumber'});
661
                $res->{coins} = GetCOinSBiblio($record);
677
                $res->{coins} = GetCOinSBiblio($record);
662
            }
678
            }
663
- 

Return to bug 8995