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 1346-1390 sub GetCOinSBiblio { Link Here
1346
        carp 'GetCOinSBiblio called with undefined record';
1347
        carp 'GetCOinSBiblio called with undefined record';
1347
        return;
1348
        return;
1348
    }
1349
    }
1350
1349
    my $pos7 = substr $record->leader(), 7, 1;
1351
    my $pos7 = substr $record->leader(), 7, 1;
1350
    my $pos6 = substr $record->leader(), 6, 1;
1352
    my $pos6 = substr $record->leader(), 6, 1;
1351
    my $mtx;
1353
    my $mtx;
1352
    my $genre;
1354
    my $genre;
1353
    my ( $aulast, $aufirst ) = ( '', '' );
1355
    my ( $aulast, $aufirst ) = ( '', '' );
1354
    my $oauthors  = '';
1356
    my @authors;
1355
    my $title     = '';
1357
    my $title;
1356
    my $subtitle  = '';
1358
    my $hosttitle;
1357
    my $pubyear   = '';
1359
    my $pubyear   = '';
1358
    my $isbn      = '';
1360
    my $isbn      = '';
1359
    my $issn      = '';
1361
    my $issn      = '';
1360
    my $publisher = '';
1362
    my $publisher = '';
1361
    my $pages     = '';
1363
    my $pages     = '';
1362
    my $titletype = 'b';
1364
    my $titletype = '';
1363
1365
1364
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1366
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1365
    # considered the same for UNIMARC and MARC21
1367
    # considered the same for UNIMARC and MARC21
1366
    my $fmts6;
1368
    my $fmts6 = {
1367
    my $fmts7;
1369
        'a' => 'book',
1368
    %$fmts6 = (
1370
        'b' => 'manuscript',
1369
                'a' => 'book',
1371
        'c' => 'book',
1370
                'b' => 'manuscript',
1372
        'd' => 'manuscript',
1371
                'c' => 'book',
1373
        'e' => 'map',
1372
                'd' => 'manuscript',
1374
        'f' => 'map',
1373
                'e' => 'map',
1375
        'g' => 'film',
1374
                'f' => 'map',
1376
        'i' => 'audioRecording',
1375
                'g' => 'film',
1377
        'j' => 'audioRecording',
1376
                'i' => 'audioRecording',
1378
        'k' => 'artwork',
1377
                'j' => 'audioRecording',
1379
        'l' => 'document',
1378
                'k' => 'artwork',
1380
        'm' => 'computerProgram',
1379
                'l' => 'document',
1381
        'o' => 'document',
1380
                'm' => 'computerProgram',
1382
        'r' => 'document',
1381
                'o' => 'document',
1383
    };
1382
                'r' => 'document',
1384
    my $fmts7 = {
1383
            );
1385
        'a' => 'journalArticle',
1384
    %$fmts7 = (
1386
        's' => 'journal',
1385
                    'a' => 'journalArticle',
1387
    };
1386
                    's' => 'journal',
1387
              );
1388
1388
1389
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1389
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1390
1390
Lines 1395-1400 sub GetCOinSBiblio { Link Here
1395
    ##### We must transform mtx to a valable mtx and document type ####
1395
    ##### We must transform mtx to a valable mtx and document type ####
1396
    if ( $genre eq 'book' ) {
1396
    if ( $genre eq 'book' ) {
1397
            $mtx = 'book';
1397
            $mtx = 'book';
1398
            $titletype = 'b';
1398
    } elsif ( $genre eq 'journal' ) {
1399
    } elsif ( $genre eq 'journal' ) {
1399
            $mtx = 'journal';
1400
            $mtx = 'journal';
1400
            $titletype = 'j';
1401
            $titletype = 'j';
Lines 1406-1431 sub GetCOinSBiblio { Link Here
1406
            $mtx = 'dc';
1407
            $mtx = 'dc';
1407
    }
1408
    }
1408
1409
1409
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1410
1411
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1410
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1412
1411
1413
        # Setting datas
1412
        # Setting datas
1414
        $aulast  = $record->subfield( '700', 'a' ) || '';
1413
        $aulast  = $record->subfield( '700', 'a' ) || '';
1415
        $aufirst = $record->subfield( '700', 'b' ) || '';
1414
        $aufirst = $record->subfield( '700', 'b' ) || '';
1416
        $oauthors = "&rft.au=$aufirst $aulast";
1415
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1417
1416
1418
        # others authors
1417
        # others authors
1419
        if ( $record->field('200') ) {
1418
        if ( $record->field('200') ) {
1420
            for my $au ( $record->field('200')->subfield('g') ) {
1419
            for my $au ( $record->field('200')->subfield('g') ) {
1421
                $oauthors .= "&rft.au=$au";
1420
                push @authors, $au;
1422
            }
1421
            }
1423
        }
1422
        }
1424
        $title =
1423
1425
          ( $mtx eq 'dc' )
1424
        $title     = $record->subfield( '200', 'a' );
1426
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1425
        my $subfield_210d = $record->subfield('210', 'd');
1427
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1426
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1428
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1427
            $pubyear = $1;
1428
        }
1429
        $publisher = $record->subfield( '210', 'c' ) || '';
1429
        $publisher = $record->subfield( '210', 'c' ) || '';
1430
        $isbn      = $record->subfield( '010', 'a' ) || '';
1430
        $isbn      = $record->subfield( '010', 'a' ) || '';
1431
        $issn      = $record->subfield( '011', 'a' ) || '';
1431
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1435-1468 sub GetCOinSBiblio { Link Here
1435
1435
1436
        # Setting datas
1436
        # Setting datas
1437
        if ( $record->field('100') ) {
1437
        if ( $record->field('100') ) {
1438
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1438
            push @authors, $record->subfield( '100', 'a' );
1439
        }
1439
        }
1440
1440
1441
        # others authors
1441
        # others authors
1442
        if ( $record->field('700') ) {
1442
        if ( $record->field('700') ) {
1443
            for my $au ( $record->field('700')->subfield('a') ) {
1443
            for my $au ( $record->field('700')->subfield('a') ) {
1444
                $oauthors .= "&rft.au=$au";
1444
                push @authors, $au;
1445
            }
1445
            }
1446
        }
1446
        }
1447
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1447
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1448
        $subtitle = $record->subfield( '245', 'b' ) || '';
1449
        $title .= $subtitle;
1450
        if ($titletype eq 'a') {
1448
        if ($titletype eq 'a') {
1451
            $pubyear   = $record->field('008') || '';
1449
            $pubyear   = $record->field('008') || '';
1452
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1450
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1453
            $isbn      = $record->subfield( '773', 'z' ) || '';
1451
            $isbn      = $record->subfield( '773', 'z' ) || '';
1454
            $issn      = $record->subfield( '773', 'x' ) || '';
1452
            $issn      = $record->subfield( '773', 'x' ) || '';
1455
            if ($mtx eq 'journal') {
1453
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1456
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1454
            my @rels = $record->subfield( '773', 'g' );
1457
            } else {
1455
            $pages = join(', ', @rels);
1458
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1459
            }
1460
            foreach my $rel ($record->subfield( '773', 'g' )) {
1461
                if ($pages) {
1462
                    $pages .= ', ';
1463
                }
1464
                $pages .= $rel;
1465
            }
1466
        } else {
1456
        } else {
1467
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1457
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1468
            $publisher = $record->subfield( '260', 'b' ) || '';
1458
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1471-1482 sub GetCOinSBiblio { Link Here
1471
        }
1461
        }
1472
1462
1473
    }
1463
    }
1474
    my $coins_value =
1475
"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";
1476
    $coins_value =~ s/(\ |&[^a])/\+/g;
1477
    $coins_value =~ s/\"/\&quot\;/g;
1478
1464
1479
#<!-- 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="
1465
    my @params = (
1466
        [ 'ctx_ver', 'Z39.88-2004' ],
1467
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1468
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1469
        [ "rft.${titletype}title", $title ],
1470
    );
1471
1472
    # rft.title is authorized only once, so by checking $titletype
1473
    # we ensure that rft.title is not already in the list.
1474
    if ($hosttitle and $titletype) {
1475
        push @params, [ 'rft.title', $hosttitle ];
1476
    }
1477
1478
    push @params, (
1479
        [ 'rft.isbn', $isbn ],
1480
        [ 'rft.issn', $issn ],
1481
    );
1482
1483
    # If it's a subscription, these informations have no meaning.
1484
    if ($genre ne 'journal') {
1485
        push @params, (
1486
            [ 'rft.aulast', $aulast ],
1487
            [ 'rft.aufirst', $aufirst ],
1488
            (map { [ 'rft.au', $_ ] } @authors),
1489
            [ 'rft.pub', $publisher ],
1490
            [ 'rft.date', $pubyear ],
1491
            [ 'rft.pages', $pages ],
1492
        );
1493
    }
1494
1495
    my $coins_value = join( '&amp;',
1496
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1480
1497
1481
    return $coins_value;
1498
    return $coins_value;
1482
}
1499
}
(-)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 opacthemes IdRef / )
209
                              TrackClicks opacthemes IdRef
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('OPACOpenURLItemTypes') );
223
        if (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/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 347-352 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
347
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
347
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
348
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
348
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
349
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
349
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
350
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
351
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
352
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
353
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
354
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
350
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
355
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
351
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
356
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
352
('OverDriveClientSecret','','Client key for OverDrive integration','30','YesNo'),
357
('OverDriveClientSecret','','Client key for OverDrive integration','30','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 483-488 OPAC: Link Here
483
                  yes: Display
483
                  yes: Display
484
                  no: Don't display
484
                  no: Don't display
485
            - the acquisition details on OPAC detail pages.
485
            - the acquisition details on OPAC detail pages.
486
    OpenURL:
487
        -
488
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
489
            - pref: OpenURLResolverURL
490
              class: url
491
        -
492
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
493
            - pref: OpenURLText
494
        -
495
            - 'Location of image for OpenURL links:'
496
            - pref: OpenURLImageLocation
497
              class: url
498
            - '<br />Can be a complete URL starting with <code>http://</code> or'
499
            - '<code>https://</code> or the name of a file in <code>images</code> directory'
500
            - '<br />Examples:'
501
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
502
            - '<br />- <code>OpenURL/OpenURL.png</code> (file is in <code>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</code>)'
503
        -
504
            - pref: OPACShowOpenURL
505
              choices:
506
                  yes: Enable
507
                  no: Disable
508
            - 'display of OpenURL link in OPAC search results and detail page.'
509
        -
510
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
511
            - pref: OPACOpenURLItemTypes
512
            - '<br />'
486
    Policy:
513
    Policy:
487
        -
514
        -
488
            - pref: singleBranchMode
515
            - pref: singleBranchMode
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+64 lines)
Lines 1226-1231 Link Here
1226
        </xsl:for-each>
1226
        </xsl:for-each>
1227
        </xsl:if>
1227
        </xsl:if>
1228
1228
1229
        <!-- OpenURL -->
1230
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1231
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
1232
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1233
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1234
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
1235
1236
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
1237
          <xsl:variable name="openurltext">
1238
            <xsl:choose>
1239
              <xsl:when test="$OpenURLText != ''">
1240
                <xsl:value-of select="$OpenURLText" />
1241
              </xsl:when>
1242
              <xsl:otherwise>
1243
                <xsl:text>OpenURL</xsl:text>
1244
              </xsl:otherwise>
1245
            </xsl:choose>
1246
          </xsl:variable>
1247
1248
          <xsl:variable name="openurlimagelocation">
1249
            <xsl:choose>
1250
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1251
                <xsl:value-of select="$OpenURLImageLocation" />
1252
              </xsl:when>
1253
              <xsl:when test="$OpenURLImageLocation != ''">
1254
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1255
                <xsl:value-of select="$OpenURLImageLocation" />
1256
              </xsl:when>
1257
            </xsl:choose>
1258
          </xsl:variable>
1259
1260
          <span class="results_summary"><a>
1261
            <xsl:attribute name="href">
1262
              <xsl:value-of select="$OpenURLResolverURL" />
1263
              <xsl:text>?</xsl:text>
1264
              <xsl:value-of select="$COinS" />
1265
            </xsl:attribute>
1266
            <xsl:attribute name="title">
1267
              <xsl:value-of select="$openurltext" />
1268
            </xsl:attribute>
1269
            <xsl:attribute name="class">
1270
              <xsl:text>OpenURL</xsl:text>
1271
            </xsl:attribute>
1272
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1273
              <xsl:attribute name="target">
1274
                <xsl:text>_blank</xsl:text>
1275
              </xsl:attribute>
1276
            </xsl:if>
1277
            <xsl:choose>
1278
              <xsl:when test="$openurlimagelocation != ''">
1279
                <img>
1280
                  <xsl:attribute name="src">
1281
                    <xsl:value-of select="$openurlimagelocation" />
1282
                  </xsl:attribute>
1283
                </img>
1284
              </xsl:when>
1285
              <xsl:otherwise>
1286
                <xsl:value-of select="$openurltext" />
1287
              </xsl:otherwise>
1288
            </xsl:choose>
1289
          </a></span>
1290
        </xsl:if>
1291
        <!-- End of OpenURL -->
1292
1229
    </xsl:element>
1293
    </xsl:element>
1230
    </xsl:template>
1294
    </xsl:template>
1231
1295
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +65 lines)
Lines 440-447 Link Here
440
            </xsl:for-each>
440
            </xsl:for-each>
441
        </xsl:if>
441
        </xsl:if>
442
    </a>
442
    </a>
443
    <p>
444
443
444
    <!-- OpenURL -->
445
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
446
    <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
447
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
448
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
449
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
450
451
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
452
      <xsl:variable name="openurltext">
453
        <xsl:choose>
454
          <xsl:when test="$OpenURLText != ''">
455
            <xsl:value-of select="$OpenURLText" />
456
          </xsl:when>
457
          <xsl:otherwise>
458
            <xsl:text>OpenURL</xsl:text>
459
          </xsl:otherwise>
460
        </xsl:choose>
461
      </xsl:variable>
462
463
      <xsl:variable name="openurlimagelocation">
464
        <xsl:choose>
465
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
466
            <xsl:value-of select="$OpenURLImageLocation" />
467
          </xsl:when>
468
          <xsl:when test="$OpenURLImageLocation != ''">
469
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
470
            <xsl:value-of select="$OpenURLImageLocation" />
471
          </xsl:when>
472
        </xsl:choose>
473
      </xsl:variable>
474
475
      <span class="results_summary"><a>
476
        <xsl:attribute name="href">
477
          <xsl:value-of select="$OpenURLResolverURL" />
478
          <xsl:text>?</xsl:text>
479
          <xsl:value-of select="$COinS" />
480
        </xsl:attribute>
481
        <xsl:attribute name="title">
482
          <xsl:value-of select="$openurltext" />
483
        </xsl:attribute>
484
        <xsl:attribute name="class">
485
          <xsl:text>OpenURL</xsl:text>
486
        </xsl:attribute>
487
        <xsl:if test="$OPACURLOpenInNewWindow='1'">
488
          <xsl:attribute name="target">
489
            <xsl:text>_blank</xsl:text>
490
          </xsl:attribute>
491
        </xsl:if>
492
        <xsl:choose>
493
          <xsl:when test="$openurlimagelocation != ''">
494
            <img>
495
              <xsl:attribute name="src">
496
                <xsl:value-of select="$openurlimagelocation" />
497
              </xsl:attribute>
498
            </img>
499
          </xsl:when>
500
          <xsl:otherwise>
501
            <xsl:value-of select="$openurltext" />
502
          </xsl:otherwise>
503
        </xsl:choose>
504
      </a></span>
505
    </xsl:if>
506
    <!-- End of OpenURL -->
507
508
    <p>
445
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
509
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
446
    <xsl:if test="$display880">
510
    <xsl:if test="$display880">
447
      <xsl:call-template name="m880Select">
511
      <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 82-87 Link Here
82
    </xsl:for-each>
82
    </xsl:for-each>
83
  </xsl:if>
83
  </xsl:if>
84
84
85
  <!-- OpenURL -->
86
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
87
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
88
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
89
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
90
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
91
92
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
93
    <xsl:variable name="openurltext">
94
      <xsl:choose>
95
        <xsl:when test="$OpenURLText != ''">
96
          <xsl:value-of select="$OpenURLText" />
97
        </xsl:when>
98
        <xsl:otherwise>
99
          <xsl:text>OpenURL</xsl:text>
100
        </xsl:otherwise>
101
      </xsl:choose>
102
    </xsl:variable>
103
104
    <xsl:variable name="openurlimagelocation">
105
      <xsl:choose>
106
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
107
          <xsl:value-of select="$OpenURLImageLocation" />
108
        </xsl:when>
109
        <xsl:when test="$OpenURLImageLocation != ''">
110
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
111
          <xsl:value-of select="$OpenURLImageLocation" />
112
        </xsl:when>
113
      </xsl:choose>
114
    </xsl:variable>
115
116
    <span class="results_summary"><a>
117
      <xsl:attribute name="href">
118
        <xsl:value-of select="$OpenURLResolverURL" />
119
        <xsl:text>?</xsl:text>
120
        <xsl:value-of select="$COinS" />
121
      </xsl:attribute>
122
      <xsl:attribute name="title">
123
        <xsl:value-of select="$openurltext" />
124
      </xsl:attribute>
125
      <xsl:attribute name="class">
126
        <xsl:text>OpenURL</xsl:text>
127
      </xsl:attribute>
128
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
129
        <xsl:attribute name="target">
130
          <xsl:text>_blank</xsl:text>
131
        </xsl:attribute>
132
      </xsl:if>
133
      <xsl:choose>
134
        <xsl:when test="$openurlimagelocation != ''">
135
          <img>
136
            <xsl:attribute name="src">
137
              <xsl:value-of select="$openurlimagelocation" />
138
            </xsl:attribute>
139
          </img>
140
        </xsl:when>
141
        <xsl:otherwise>
142
          <xsl:value-of select="$openurltext" />
143
        </xsl:otherwise>
144
      </xsl:choose>
145
    </a></span>
146
  </xsl:if>
147
  <!-- End of OpenURL -->
148
85
  <xsl:call-template name="tag_title">
149
  <xsl:call-template name="tag_title">
86
    <xsl:with-param name="tag">454</xsl:with-param>
150
    <xsl:with-param name="tag">454</xsl:with-param>
87
    <xsl:with-param name="label">Translation of</xsl:with-param>
151
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less (+4 lines)
Lines 2508-2511 a.reviewlink:visited { Link Here
2508
    cursor: pointer;
2508
    cursor: pointer;
2509
}
2509
}
2510
2510
2511
a.OpenURL img {
2512
    vertical-align: middle;
2513
}
2514
2511
@import "responsive.less";
2515
@import "responsive.less";
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1160-1163 $template->param( Link Here
1160
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1160
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1161
);
1161
);
1162
1162
1163
# OpenURL
1164
if (C4::Context->preference('OPACShowOpenURL')) {
1165
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1166
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1167
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1168
        $template->param(
1169
            OPACShowOpenURL => 1,
1170
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1171
            OpenURLText => C4::Context->preference('OpenURLText'),
1172
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1173
        );
1174
    }
1175
}
1176
1163
output_html_with_http_headers $query, $cookie, $template->output;
1177
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 575-580 if (C4::Context->preference('OpacSuppression')) { Link Here
575
    }
575
    }
576
}
576
}
577
577
578
# OpenURL
579
my @OpenURL_itypes;
580
if (C4::Context->preference('OPACShowOpenURL')) {
581
    @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
582
    $template->param(
583
        OPACShowOpenURL => 1,
584
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
585
        OpenURLText => C4::Context->preference('OpenURLText'),
586
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
587
    );
588
}
589
578
$template->param ( LIMIT_INPUTS => \@limit_inputs );
590
$template->param ( LIMIT_INPUTS => \@limit_inputs );
579
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
591
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
580
592
Lines 657-663 for (my $i=0;$i<@servers;$i++) { Link Here
657
                $res->{'incart'} = 1;
669
                $res->{'incart'} = 1;
658
            }
670
            }
659
671
660
            if (C4::Context->preference('COinSinOPACResults')) {
672
            if (C4::Context->preference('COinSinOPACResults')
673
            or C4::Context->preference('OPACShowOpenURL')) {
674
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
675
                    $res->{ShowOpenURL} = 1;
676
                }
661
                my $record = GetMarcBiblio($res->{'biblionumber'});
677
                my $record = GetMarcBiblio($res->{'biblionumber'});
662
                $res->{coins} = GetCOinSBiblio($record);
678
                $res->{coins} = GetCOinSBiblio($record);
663
            }
679
            }
664
- 

Return to bug 8995