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

(-)a/C4/Biblio.pm (-56 / +94 lines)
Lines 88-93 use MARC::File::USMARC; Link Here
88
use MARC::File::XML;
88
use MARC::File::XML;
89
use POSIX qw(strftime);
89
use POSIX qw(strftime);
90
use Module::Load::Conditional qw(can_load);
90
use Module::Load::Conditional qw(can_load);
91
use URI;
92
use URI::Escape; # GetCOinSBiblio
91
93
92
use C4::Koha;
94
use C4::Koha;
93
use C4::Log;    # logaction
95
use C4::Log;    # logaction
Lines 1246-1290 sub GetCOinSBiblio { Link Here
1246
        carp 'GetCOinSBiblio called with undefined record';
1248
        carp 'GetCOinSBiblio called with undefined record';
1247
        return;
1249
        return;
1248
    }
1250
    }
1251
1249
    my $pos7 = substr $record->leader(), 7, 1;
1252
    my $pos7 = substr $record->leader(), 7, 1;
1250
    my $pos6 = substr $record->leader(), 6, 1;
1253
    my $pos6 = substr $record->leader(), 6, 1;
1251
    my $mtx;
1254
    my $mtx;
1252
    my $genre;
1255
    my $genre;
1253
    my ( $aulast, $aufirst ) = ( '', '' );
1256
    my ( $aulast, $aufirst ) = ( '', '' );
1254
    my $oauthors  = '';
1257
    my @authors;
1255
    my $title     = '';
1258
    my $title;
1256
    my $subtitle  = '';
1259
    my $hosttitle;
1257
    my $pubyear   = '';
1260
    my $pubyear   = '';
1258
    my $isbn      = '';
1261
    my $isbn      = '';
1259
    my $issn      = '';
1262
    my $issn      = '';
1260
    my $publisher = '';
1263
    my $publisher = '';
1261
    my $pages     = '';
1264
    my $pages     = '';
1262
    my $titletype = 'b';
1265
    my $titletype = '';
1263
1266
1264
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1267
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1265
    # considered the same for UNIMARC and MARC21
1268
    # considered the same for UNIMARC and MARC21
1266
    my $fmts6;
1269
    my $fmts6 = {
1267
    my $fmts7;
1270
        'a' => 'book',
1268
    %$fmts6 = (
1271
        'b' => 'manuscript',
1269
                'a' => 'book',
1272
        'c' => 'book',
1270
                'b' => 'manuscript',
1273
        'd' => 'manuscript',
1271
                'c' => 'book',
1274
        'e' => 'map',
1272
                'd' => 'manuscript',
1275
        'f' => 'map',
1273
                'e' => 'map',
1276
        'g' => 'film',
1274
                'f' => 'map',
1277
        'i' => 'audioRecording',
1275
                'g' => 'film',
1278
        'j' => 'audioRecording',
1276
                'i' => 'audioRecording',
1279
        'k' => 'artwork',
1277
                'j' => 'audioRecording',
1280
        'l' => 'document',
1278
                'k' => 'artwork',
1281
        'm' => 'computerProgram',
1279
                'l' => 'document',
1282
        'o' => 'document',
1280
                'm' => 'computerProgram',
1283
        'r' => 'document',
1281
                'o' => 'document',
1284
    };
1282
                'r' => 'document',
1285
    my $fmts7 = {
1283
            );
1286
        'a' => 'journalArticle',
1284
    %$fmts7 = (
1287
        's' => 'journal',
1285
                    'a' => 'journalArticle',
1288
    };
1286
                    's' => 'journal',
1287
              );
1288
1289
1289
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1290
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1290
1291
Lines 1295-1300 sub GetCOinSBiblio { Link Here
1295
    ##### We must transform mtx to a valable mtx and document type ####
1296
    ##### We must transform mtx to a valable mtx and document type ####
1296
    if ( $genre eq 'book' ) {
1297
    if ( $genre eq 'book' ) {
1297
            $mtx = 'book';
1298
            $mtx = 'book';
1299
            $titletype = 'b';
1298
    } elsif ( $genre eq 'journal' ) {
1300
    } elsif ( $genre eq 'journal' ) {
1299
            $mtx = 'journal';
1301
            $mtx = 'journal';
1300
            $titletype = 'j';
1302
            $titletype = 'j';
Lines 1306-1331 sub GetCOinSBiblio { Link Here
1306
            $mtx = 'dc';
1308
            $mtx = 'dc';
1307
    }
1309
    }
1308
1310
1309
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1310
1311
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1311
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1312
1312
1313
        # Setting datas
1313
        # Setting datas
1314
        $aulast  = $record->subfield( '700', 'a' ) || '';
1314
        $aulast  = $record->subfield( '700', 'a' ) || '';
1315
        $aufirst = $record->subfield( '700', 'b' ) || '';
1315
        $aufirst = $record->subfield( '700', 'b' ) || '';
1316
        $oauthors = "&rft.au=$aufirst $aulast";
1316
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1317
1317
1318
        # others authors
1318
        # others authors
1319
        if ( $record->field('200') ) {
1319
        if ( $record->field('200') ) {
1320
            for my $au ( $record->field('200')->subfield('g') ) {
1320
            for my $au ( $record->field('200')->subfield('g') ) {
1321
                $oauthors .= "&rft.au=$au";
1321
                push @authors, $au;
1322
            }
1322
            }
1323
        }
1323
        }
1324
        $title =
1324
1325
          ( $mtx eq 'dc' )
1325
        $title     = $record->subfield( '200', 'a' );
1326
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1326
        my $subfield_210d = $record->subfield('210', 'd');
1327
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1327
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1328
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1328
            $pubyear = $1;
1329
        }
1329
        $publisher = $record->subfield( '210', 'c' ) || '';
1330
        $publisher = $record->subfield( '210', 'c' ) || '';
1330
        $isbn      = $record->subfield( '010', 'a' ) || '';
1331
        $isbn      = $record->subfield( '010', 'a' ) || '';
1331
        $issn      = $record->subfield( '011', 'a' ) || '';
1332
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1335-1368 sub GetCOinSBiblio { Link Here
1335
1336
1336
        # Setting datas
1337
        # Setting datas
1337
        if ( $record->field('100') ) {
1338
        if ( $record->field('100') ) {
1338
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1339
            push @authors, $record->subfield( '100', 'a' );
1339
        }
1340
        }
1340
1341
1341
        # others authors
1342
        # others authors
1342
        if ( $record->field('700') ) {
1343
        if ( $record->field('700') ) {
1343
            for my $au ( $record->field('700')->subfield('a') ) {
1344
            for my $au ( $record->field('700')->subfield('a') ) {
1344
                $oauthors .= "&rft.au=$au";
1345
                push @authors, $au;
1345
            }
1346
            }
1346
        }
1347
        }
1347
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1348
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1348
        $subtitle = $record->subfield( '245', 'b' ) || '';
1349
        $title .= $subtitle;
1350
        if ($titletype eq 'a') {
1349
        if ($titletype eq 'a') {
1351
            $pubyear   = $record->field('008') || '';
1350
            $pubyear   = $record->field('008') || '';
1352
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1351
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1353
            $isbn      = $record->subfield( '773', 'z' ) || '';
1352
            $isbn      = $record->subfield( '773', 'z' ) || '';
1354
            $issn      = $record->subfield( '773', 'x' ) || '';
1353
            $issn      = $record->subfield( '773', 'x' ) || '';
1355
            if ($mtx eq 'journal') {
1354
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{};
1356
                $title    .= "&rft.title=" . ( $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{} );
1355
            my @rels = $record->subfield( '773', 'g' );
1357
            } else {
1356
            $pages = join(', ', @rels);
1358
                $title    .= "&rft.btitle=" . ( $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{} );
1359
            }
1360
            foreach my $rel ($record->subfield( '773', 'g' )) {
1361
                if ($pages) {
1362
                    $pages .= ', ';
1363
                }
1364
                $pages .= $rel;
1365
            }
1366
        } else {
1357
        } else {
1367
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1358
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1368
            $publisher = $record->subfield( '260', 'b' ) || '';
1359
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1371-1386 sub GetCOinSBiblio { Link Here
1371
        }
1362
        }
1372
1363
1373
    }
1364
    }
1374
    my $coins_value =
1375
"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";
1376
    $coins_value =~ s/(\ |&[^a])/\+/g;
1377
    $coins_value =~ s/\"/\&quot\;/g;
1378
1365
1379
#<!-- 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="
1366
    my @params = (
1367
        [ 'ctx_ver', 'Z39.88-2004' ],
1368
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1369
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1370
        [ "rft.${titletype}title", $title ],
1371
    );
1372
1373
    # rft.title is authorized only once, so by checking $titletype
1374
    # we ensure that rft.title is not already in the list.
1375
    if ($hosttitle and $titletype) {
1376
        push @params, [ 'rft.title', $hosttitle ];
1377
    }
1378
1379
    push @params, (
1380
        [ 'rft.isbn', $isbn ],
1381
        [ 'rft.issn', $issn ],
1382
    );
1383
1384
    # If it's a subscription, these informations have no meaning.
1385
    if ($genre ne 'journal') {
1386
        push @params, (
1387
            [ 'rft.aulast', $aulast ],
1388
            [ 'rft.aufirst', $aufirst ],
1389
            (map { [ 'rft.au', $_ ] } @authors),
1390
            [ 'rft.pub', $publisher ],
1391
            [ 'rft.date', $pubyear ],
1392
            [ 'rft.pages', $pages ],
1393
        );
1394
    }
1395
1396
    my $coins_value = join( '&amp;',
1397
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1380
1398
1381
    return $coins_value;
1399
    return $coins_value;
1382
}
1400
}
1383
1401
1402
sub GetOpenURLResolverURL {
1403
    my ($record) = @_;
1404
1405
    my $coins = GetCOinSBiblio($record);
1406
    my $OpenURLResolverURL = C4::Context->preference('OpenURLResolverURL');
1407
1408
    if ($OpenURLResolverURL) {
1409
        my $uri = URI->new($OpenURLResolverURL);
1410
1411
        if (not defined $uri->query) {
1412
            $OpenURLResolverURL .= '?';
1413
        } else {
1414
            $OpenURLResolverURL .= '&amp;';
1415
        }
1416
        $OpenURLResolverURL .= $coins;
1417
    }
1418
1419
    return $OpenURLResolverURL;
1420
}
1421
1384
1422
1385
=head2 GetMarcPrice
1423
=head2 GetMarcPrice
1386
1424
(-)a/C4/XSLT.pm (-4 / +21 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->{OpenURLResolverURL} =
254
              C4::Biblio::GetOpenURLResolverURL($orig_record);
255
        }
256
    }
257
    my $varxml = "<variables>\n";
258
    while (my ($key, $value) = each %$variables) {
259
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
260
    }
261
    $varxml .= "</variables>\n";
262
263
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
264
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
248
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
265
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
249
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
266
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
250
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
267
        $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 437-442 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
437
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
437
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
438
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
438
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
439
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
439
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
440
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
441
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
442
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
443
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
444
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
440
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
445
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
441
('OrderPriceRounding','','|nearest_cent','Local preference for rounding orders before calculations to ensure correct calculations','Choice'),
446
('OrderPriceRounding','','|nearest_cent','Local preference for rounding orders before calculations to ensure correct calculations','Choice'),
442
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
447
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+29 lines)
Lines 120-125 OPAC: Link Here
120
                  yes: Include
120
                  yes: Include
121
                  no: "Don't include"
121
                  no: "Don't include"
122
            - "COinS / OpenURL / Z39.88 in OPAC search results.  <br/>Warning: Enabling this feature will slow OPAC search response times."
122
            - "COinS / OpenURL / Z39.88 in OPAC search results.  <br/>Warning: Enabling this feature will slow OPAC search response times."
123
            - "<br/>If you want to display a link to an OpenURL resolver, look at the following system preferences:"
124
            - "<br/><code>OpenURLResolverURL</code>, <code>OPACShowOpenURL</code>, <code>OPACOpenURLItemTypes</code>, <code>OpenURLText<code>, <code>OpenURLImageLocation</code>"
123
        -
125
        -
124
            - pref: OPACShowUnusedAuthorities
126
            - pref: OPACShowUnusedAuthorities
125
              choices:
127
              choices:
Lines 533-538 OPAC: Link Here
533
              type: textarea
535
              type: textarea
534
              syntax: text/html
536
              syntax: text/html
535
              class: code
537
              class: code
538
    OpenURL:
539
        -
540
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
541
            - pref: OpenURLResolverURL
542
              class: url
543
        -
544
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
545
            - pref: OpenURLText
546
        -
547
            - 'Location of image for OpenURL links:'
548
            - pref: OpenURLImageLocation
549
              class: url
550
            - '<br />Can be an absolute URL starting with <code>http://</code> or'
551
            - '<code>https://</code> or a relative URL'
552
            - '<br />Examples:'
553
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
554
            - '<br />- <code>/opac-tmpl/bootstrap/images/OpenURL.png</code>'
555
        -
556
            - pref: OPACShowOpenURL
557
              choices:
558
                  yes: Enable
559
                  no: Disable
560
            - 'display of OpenURL link in OPAC search results and detail page.'
561
        -
562
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
563
            - pref: OPACOpenURLItemTypes
564
            - '<br />'
536
    Policy:
565
    Policy:
537
        -
566
        -
538
            - pref: SearchMyLibraryFirst
567
            - pref: SearchMyLibraryFirst
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+4 lines)
Lines 110-115 a { Link Here
110
        text-decoration: none;
110
        text-decoration: none;
111
    }
111
    }
112
112
113
    &.OpenURL img {
114
        vertical-align: middle;
115
    }
116
113
    &.addtocart {
117
    &.addtocart {
114
        @extend %initial_icon;
118
        @extend %initial_icon;
115
        background-position: -5px -262px; /* Cart */
119
        background-position: -5px -262px; /* Cart */
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+49 lines)
Lines 1355-1360 Link Here
1355
        </xsl:for-each>
1355
        </xsl:for-each>
1356
        </xsl:if>
1356
        </xsl:if>
1357
1357
1358
        <!-- OpenURL -->
1359
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1360
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1361
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1362
        <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
1363
1364
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
1365
          <xsl:variable name="openurltext">
1366
            <xsl:choose>
1367
              <xsl:when test="$OpenURLText != ''">
1368
                <xsl:value-of select="$OpenURLText" />
1369
              </xsl:when>
1370
              <xsl:otherwise>
1371
                <xsl:text>OpenURL</xsl:text>
1372
              </xsl:otherwise>
1373
            </xsl:choose>
1374
          </xsl:variable>
1375
1376
          <span class="results_summary"><a>
1377
            <xsl:attribute name="href">
1378
              <xsl:value-of select="$OpenURLResolverURL" />
1379
            </xsl:attribute>
1380
            <xsl:attribute name="title">
1381
              <xsl:value-of select="$openurltext" />
1382
            </xsl:attribute>
1383
            <xsl:attribute name="class">
1384
              <xsl:text>OpenURL</xsl:text>
1385
            </xsl:attribute>
1386
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1387
              <xsl:attribute name="target">
1388
                <xsl:text>_blank</xsl:text>
1389
              </xsl:attribute>
1390
            </xsl:if>
1391
            <xsl:choose>
1392
              <xsl:when test="$OpenURLImageLocation != ''">
1393
                <img>
1394
                  <xsl:attribute name="src">
1395
                    <xsl:value-of select="$OpenURLImageLocation" />
1396
                  </xsl:attribute>
1397
                </img>
1398
              </xsl:when>
1399
              <xsl:otherwise>
1400
                <xsl:value-of select="$openurltext" />
1401
              </xsl:otherwise>
1402
            </xsl:choose>
1403
          </a></span>
1404
        </xsl:if>
1405
        <!-- End of OpenURL -->
1406
1358
    </xsl:element>
1407
    </xsl:element>
1359
    </xsl:template>
1408
    </xsl:template>
1360
1409
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +50 lines)
Lines 444-451 Link Here
444
            </xsl:for-each>
444
            </xsl:for-each>
445
        </xsl:if>
445
        </xsl:if>
446
    </a>
446
    </a>
447
    <p>
448
447
448
    <!-- OpenURL -->
449
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
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="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
453
454
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
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
      <span class="results_summary"><a>
467
        <xsl:attribute name="href">
468
          <xsl:value-of select="$OpenURLResolverURL" />
469
        </xsl:attribute>
470
        <xsl:attribute name="title">
471
          <xsl:value-of select="$openurltext" />
472
        </xsl:attribute>
473
        <xsl:attribute name="class">
474
          <xsl:text>OpenURL</xsl:text>
475
        </xsl:attribute>
476
        <xsl:if test="$OPACURLOpenInNewWindow='1'">
477
          <xsl:attribute name="target">
478
            <xsl:text>_blank</xsl:text>
479
          </xsl:attribute>
480
        </xsl:if>
481
        <xsl:choose>
482
          <xsl:when test="$OpenURLImageLocation != ''">
483
            <img>
484
              <xsl:attribute name="src">
485
                <xsl:value-of select="$OpenURLImageLocation" />
486
              </xsl:attribute>
487
            </img>
488
          </xsl:when>
489
          <xsl:otherwise>
490
            <xsl:value-of select="$openurltext" />
491
          </xsl:otherwise>
492
        </xsl:choose>
493
      </a></span>
494
    </xsl:if>
495
    <!-- End of OpenURL -->
496
497
    <p>
449
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
498
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
450
    <xsl:if test="$display880">
499
    <xsl:if test="$display880">
451
      <xsl:call-template name="m880Select">
500
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl (+50 lines)
Lines 443-448 Link Here
443
      </xsl:for-each>
443
      </xsl:for-each>
444
    </span>
444
    </span>
445
  </xsl:if>
445
  </xsl:if>
446
447
  <!-- OpenURL -->
448
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
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="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
452
453
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
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
    <span class="results_summary"><a>
466
      <xsl:attribute name="href">
467
        <xsl:value-of select="$OpenURLResolverURL" />
468
      </xsl:attribute>
469
      <xsl:attribute name="title">
470
        <xsl:value-of select="$openurltext" />
471
      </xsl:attribute>
472
      <xsl:attribute name="class">
473
        <xsl:text>OpenURL</xsl:text>
474
      </xsl:attribute>
475
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
476
        <xsl:attribute name="target">
477
          <xsl:text>_blank</xsl:text>
478
        </xsl:attribute>
479
      </xsl:if>
480
      <xsl:choose>
481
        <xsl:when test="$OpenURLImageLocation != ''">
482
          <img>
483
            <xsl:attribute name="src">
484
              <xsl:value-of select="$OpenURLImageLocation" />
485
            </xsl:attribute>
486
          </img>
487
        </xsl:when>
488
        <xsl:otherwise>
489
          <xsl:value-of select="$openurltext" />
490
        </xsl:otherwise>
491
      </xsl:choose>
492
    </a></span>
493
  </xsl:if>
494
  <!-- End of OpenURL -->
495
446
</xsl:template>
496
</xsl:template>
447
497
448
    <xsl:template name="nameABCDQ">
498
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl (+49 lines)
Lines 85-90 Link Here
85
    </xsl:for-each>
85
    </xsl:for-each>
86
  </xsl:if>
86
  </xsl:if>
87
87
88
  <!-- OpenURL -->
89
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
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="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
93
94
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
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
    <span class="results_summary"><a>
107
      <xsl:attribute name="href">
108
        <xsl:value-of select="$OpenURLResolverURL" />
109
      </xsl:attribute>
110
      <xsl:attribute name="title">
111
        <xsl:value-of select="$openurltext" />
112
      </xsl:attribute>
113
      <xsl:attribute name="class">
114
        <xsl:text>OpenURL</xsl:text>
115
      </xsl:attribute>
116
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
117
        <xsl:attribute name="target">
118
          <xsl:text>_blank</xsl:text>
119
        </xsl:attribute>
120
      </xsl:if>
121
      <xsl:choose>
122
        <xsl:when test="$OpenURLImageLocation != ''">
123
          <img>
124
            <xsl:attribute name="src">
125
              <xsl:value-of select="$OpenURLImageLocation" />
126
            </xsl:attribute>
127
          </img>
128
        </xsl:when>
129
        <xsl:otherwise>
130
          <xsl:value-of select="$openurltext" />
131
        </xsl:otherwise>
132
      </xsl:choose>
133
    </a></span>
134
  </xsl:if>
135
  <!-- End of OpenURL -->
136
88
  <xsl:call-template name="tag_title">
137
  <xsl:call-template name="tag_title">
89
    <xsl:with-param name="tag">454</xsl:with-param>
138
    <xsl:with-param name="tag">454</xsl:with-param>
90
    <xsl:with-param name="label">Translation of</xsl:with-param>
139
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/opac/opac-search.pl (-1 / +12 lines)
Lines 581-586 $template->param ( QUERY_INPUTS => \@query_inputs ); Link Here
581
## parse the limit_cgi string and put it into a form suitable for <input>s
581
## parse the limit_cgi string and put it into a form suitable for <input>s
582
my @limit_inputs = $limit_cgi ? _input_cgi_parse($limit_cgi) : ();
582
my @limit_inputs = $limit_cgi ? _input_cgi_parse($limit_cgi) : ();
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
587
- 

Return to bug 8995