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 1244-1288 sub GetCOinSBiblio { Link Here
1244
        carp 'GetCOinSBiblio called with undefined record';
1246
        carp 'GetCOinSBiblio called with undefined record';
1245
        return;
1247
        return;
1246
    }
1248
    }
1249
1247
    my $pos7 = substr $record->leader(), 7, 1;
1250
    my $pos7 = substr $record->leader(), 7, 1;
1248
    my $pos6 = substr $record->leader(), 6, 1;
1251
    my $pos6 = substr $record->leader(), 6, 1;
1249
    my $mtx;
1252
    my $mtx;
1250
    my $genre;
1253
    my $genre;
1251
    my ( $aulast, $aufirst ) = ( '', '' );
1254
    my ( $aulast, $aufirst ) = ( '', '' );
1252
    my $oauthors  = '';
1255
    my @authors;
1253
    my $title     = '';
1256
    my $title;
1254
    my $subtitle  = '';
1257
    my $hosttitle;
1255
    my $pubyear   = '';
1258
    my $pubyear   = '';
1256
    my $isbn      = '';
1259
    my $isbn      = '';
1257
    my $issn      = '';
1260
    my $issn      = '';
1258
    my $publisher = '';
1261
    my $publisher = '';
1259
    my $pages     = '';
1262
    my $pages     = '';
1260
    my $titletype = 'b';
1263
    my $titletype = '';
1261
1264
1262
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1265
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1263
    # considered the same for UNIMARC and MARC21
1266
    # considered the same for UNIMARC and MARC21
1264
    my $fmts6;
1267
    my $fmts6 = {
1265
    my $fmts7;
1268
        'a' => 'book',
1266
    %$fmts6 = (
1269
        'b' => 'manuscript',
1267
                'a' => 'book',
1270
        'c' => 'book',
1268
                'b' => 'manuscript',
1271
        'd' => 'manuscript',
1269
                'c' => 'book',
1272
        'e' => 'map',
1270
                'd' => 'manuscript',
1273
        'f' => 'map',
1271
                'e' => 'map',
1274
        'g' => 'film',
1272
                'f' => 'map',
1275
        'i' => 'audioRecording',
1273
                'g' => 'film',
1276
        'j' => 'audioRecording',
1274
                'i' => 'audioRecording',
1277
        'k' => 'artwork',
1275
                'j' => 'audioRecording',
1278
        'l' => 'document',
1276
                'k' => 'artwork',
1279
        'm' => 'computerProgram',
1277
                'l' => 'document',
1280
        'o' => 'document',
1278
                'm' => 'computerProgram',
1281
        'r' => 'document',
1279
                'o' => 'document',
1282
    };
1280
                'r' => 'document',
1283
    my $fmts7 = {
1281
            );
1284
        'a' => 'journalArticle',
1282
    %$fmts7 = (
1285
        's' => 'journal',
1283
                    'a' => 'journalArticle',
1286
    };
1284
                    's' => 'journal',
1285
              );
1286
1287
1287
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1288
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1288
1289
Lines 1293-1298 sub GetCOinSBiblio { Link Here
1293
    ##### We must transform mtx to a valable mtx and document type ####
1294
    ##### We must transform mtx to a valable mtx and document type ####
1294
    if ( $genre eq 'book' ) {
1295
    if ( $genre eq 'book' ) {
1295
            $mtx = 'book';
1296
            $mtx = 'book';
1297
            $titletype = 'b';
1296
    } elsif ( $genre eq 'journal' ) {
1298
    } elsif ( $genre eq 'journal' ) {
1297
            $mtx = 'journal';
1299
            $mtx = 'journal';
1298
            $titletype = 'j';
1300
            $titletype = 'j';
Lines 1304-1329 sub GetCOinSBiblio { Link Here
1304
            $mtx = 'dc';
1306
            $mtx = 'dc';
1305
    }
1307
    }
1306
1308
1307
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1308
1309
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1309
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1310
1310
1311
        # Setting datas
1311
        # Setting datas
1312
        $aulast  = $record->subfield( '700', 'a' ) || '';
1312
        $aulast  = $record->subfield( '700', 'a' ) || '';
1313
        $aufirst = $record->subfield( '700', 'b' ) || '';
1313
        $aufirst = $record->subfield( '700', 'b' ) || '';
1314
        $oauthors = "&rft.au=$aufirst $aulast";
1314
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1315
1315
1316
        # others authors
1316
        # others authors
1317
        if ( $record->field('200') ) {
1317
        if ( $record->field('200') ) {
1318
            for my $au ( $record->field('200')->subfield('g') ) {
1318
            for my $au ( $record->field('200')->subfield('g') ) {
1319
                $oauthors .= "&rft.au=$au";
1319
                push @authors, $au;
1320
            }
1320
            }
1321
        }
1321
        }
1322
        $title =
1322
1323
          ( $mtx eq 'dc' )
1323
        $title     = $record->subfield( '200', 'a' );
1324
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1324
        my $subfield_210d = $record->subfield('210', 'd');
1325
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1325
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1326
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1326
            $pubyear = $1;
1327
        }
1327
        $publisher = $record->subfield( '210', 'c' ) || '';
1328
        $publisher = $record->subfield( '210', 'c' ) || '';
1328
        $isbn      = $record->subfield( '010', 'a' ) || '';
1329
        $isbn      = $record->subfield( '010', 'a' ) || '';
1329
        $issn      = $record->subfield( '011', 'a' ) || '';
1330
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1333-1366 sub GetCOinSBiblio { Link Here
1333
1334
1334
        # Setting datas
1335
        # Setting datas
1335
        if ( $record->field('100') ) {
1336
        if ( $record->field('100') ) {
1336
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1337
            push @authors, $record->subfield( '100', 'a' );
1337
        }
1338
        }
1338
1339
1339
        # others authors
1340
        # others authors
1340
        if ( $record->field('700') ) {
1341
        if ( $record->field('700') ) {
1341
            for my $au ( $record->field('700')->subfield('a') ) {
1342
            for my $au ( $record->field('700')->subfield('a') ) {
1342
                $oauthors .= "&rft.au=$au";
1343
                push @authors, $au;
1343
            }
1344
            }
1344
        }
1345
        }
1345
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1346
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1346
        $subtitle = $record->subfield( '245', 'b' ) || '';
1347
        $title .= $subtitle;
1348
        if ($titletype eq 'a') {
1347
        if ($titletype eq 'a') {
1349
            $pubyear   = $record->field('008') || '';
1348
            $pubyear   = $record->field('008') || '';
1350
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1349
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1351
            $isbn      = $record->subfield( '773', 'z' ) || '';
1350
            $isbn      = $record->subfield( '773', 'z' ) || '';
1352
            $issn      = $record->subfield( '773', 'x' ) || '';
1351
            $issn      = $record->subfield( '773', 'x' ) || '';
1353
            if ($mtx eq 'journal') {
1352
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{};
1354
                $title    .= "&rft.title=" . ( $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{} );
1353
            my @rels = $record->subfield( '773', 'g' );
1355
            } else {
1354
            $pages = join(', ', @rels);
1356
                $title    .= "&rft.btitle=" . ( $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{} );
1357
            }
1358
            foreach my $rel ($record->subfield( '773', 'g' )) {
1359
                if ($pages) {
1360
                    $pages .= ', ';
1361
                }
1362
                $pages .= $rel;
1363
            }
1364
        } else {
1355
        } else {
1365
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1356
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1366
            $publisher = $record->subfield( '260', 'b' ) || '';
1357
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1369-1384 sub GetCOinSBiblio { Link Here
1369
        }
1360
        }
1370
1361
1371
    }
1362
    }
1372
    my $coins_value =
1373
"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";
1374
    $coins_value =~ s/(\ |&[^a])/\+/g;
1375
    $coins_value =~ s/\"/\&quot\;/g;
1376
1363
1377
#<!-- 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="
1364
    my @params = (
1365
        [ 'ctx_ver', 'Z39.88-2004' ],
1366
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1367
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1368
        [ "rft.${titletype}title", $title ],
1369
    );
1370
1371
    # rft.title is authorized only once, so by checking $titletype
1372
    # we ensure that rft.title is not already in the list.
1373
    if ($hosttitle and $titletype) {
1374
        push @params, [ 'rft.title', $hosttitle ];
1375
    }
1376
1377
    push @params, (
1378
        [ 'rft.isbn', $isbn ],
1379
        [ 'rft.issn', $issn ],
1380
    );
1381
1382
    # If it's a subscription, these informations have no meaning.
1383
    if ($genre ne 'journal') {
1384
        push @params, (
1385
            [ 'rft.aulast', $aulast ],
1386
            [ 'rft.aufirst', $aufirst ],
1387
            (map { [ 'rft.au', $_ ] } @authors),
1388
            [ 'rft.pub', $publisher ],
1389
            [ 'rft.date', $pubyear ],
1390
            [ 'rft.pages', $pages ],
1391
        );
1392
    }
1393
1394
    my $coins_value = join( '&amp;',
1395
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1378
1396
1379
    return $coins_value;
1397
    return $coins_value;
1380
}
1398
}
1381
1399
1400
sub GetOpenURLResolverURL {
1401
    my ($record) = @_;
1402
1403
    my $coins = GetCOinSBiblio($record);
1404
    my $OpenURLResolverURL = C4::Context->preference('OpenURLResolverURL');
1405
1406
    if ($OpenURLResolverURL) {
1407
        my $uri = URI->new($OpenURLResolverURL);
1408
1409
        if (not defined $uri->query) {
1410
            $OpenURLResolverURL .= '?';
1411
        } else {
1412
            $OpenURLResolverURL .= '&amp;';
1413
        }
1414
        $OpenURLResolverURL .= $coins;
1415
    }
1416
1417
    return $OpenURLResolverURL;
1418
}
1419
1382
1420
1383
=head2 GetMarcPrice
1421
=head2 GetMarcPrice
1384
1422
(-)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 429-434 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
429
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
429
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
430
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
430
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
431
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
431
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
432
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
433
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
434
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
435
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
436
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
432
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
437
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
433
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
438
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
434
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
439
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+29 lines)
Lines 119-124 OPAC: Link Here
119
                  yes: Include
119
                  yes: Include
120
                  no: "Don't include"
120
                  no: "Don't include"
121
            - "COinS / OpenURL / Z39.88 in OPAC search results.  <br/>Warning: Enabling this feature will slow OPAC search response times."
121
            - "COinS / OpenURL / Z39.88 in OPAC search results.  <br/>Warning: Enabling this feature will slow OPAC search response times."
122
            - "<br/>If you want to display a link to an OpenURL resolver, look at the following system preferences:"
123
            - "<br/><code>OpenURLResolverURL</code>, <code>OPACShowOpenURL</code>, <code>OPACOpenURLItemTypes</code>, <code>OpenURLText<code>, <code>OpenURLImageLocation</code>"
122
        -
124
        -
123
            - pref: OPACShowUnusedAuthorities
125
            - pref: OPACShowUnusedAuthorities
124
              choices:
126
              choices:
Lines 517-522 OPAC: Link Here
517
            - pref: OPACISBD
519
            - pref: OPACISBD
518
              type: textarea
520
              type: textarea
519
              class: code
521
              class: code
522
    OpenURL:
523
        -
524
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
525
            - pref: OpenURLResolverURL
526
              class: url
527
        -
528
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
529
            - pref: OpenURLText
530
        -
531
            - 'Location of image for OpenURL links:'
532
            - pref: OpenURLImageLocation
533
              class: url
534
            - '<br />Can be an absolute URL starting with <code>http://</code> or'
535
            - '<code>https://</code> or a relative URL'
536
            - '<br />Examples:'
537
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
538
            - '<br />- <code>/opac-tmpl/bootstrap/images/OpenURL.png</code>'
539
        -
540
            - pref: OPACShowOpenURL
541
              choices:
542
                  yes: Enable
543
                  no: Disable
544
            - 'display of OpenURL link in OPAC search results and detail page.'
545
        -
546
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
547
            - pref: OPACOpenURLItemTypes
548
            - '<br />'
520
    Policy:
549
    Policy:
521
        -
550
        -
522
            - pref: SearchMyLibraryFirst
551
            - pref: SearchMyLibraryFirst
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+4 lines)
Lines 183-188 a { Link Here
183
        text-decoration: none;
183
        text-decoration: none;
184
    }
184
    }
185
185
186
    &.OpenURL img {
187
        vertical-align: middle;
188
    }
189
186
    &.addtocart {
190
    &.addtocart {
187
        @extend %initial_icon;
191
        @extend %initial_icon;
188
        background-position: -5px -262px; /* Cart */
192
        background-position: -5px -262px; /* Cart */
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+49 lines)
Lines 1313-1318 Link Here
1313
        </xsl:for-each>
1313
        </xsl:for-each>
1314
        </xsl:if>
1314
        </xsl:if>
1315
1315
1316
        <!-- OpenURL -->
1317
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1318
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1319
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1320
        <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" />
1321
1322
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''">
1323
          <xsl:variable name="openurltext">
1324
            <xsl:choose>
1325
              <xsl:when test="$OpenURLText != ''">
1326
                <xsl:value-of select="$OpenURLText" />
1327
              </xsl:when>
1328
              <xsl:otherwise>
1329
                <xsl:text>OpenURL</xsl:text>
1330
              </xsl:otherwise>
1331
            </xsl:choose>
1332
          </xsl:variable>
1333
1334
          <span class="results_summary"><a>
1335
            <xsl:attribute name="href">
1336
              <xsl:value-of select="$OpenURLResolverURL" />
1337
            </xsl:attribute>
1338
            <xsl:attribute name="title">
1339
              <xsl:value-of select="$openurltext" />
1340
            </xsl:attribute>
1341
            <xsl:attribute name="class">
1342
              <xsl:text>OpenURL</xsl:text>
1343
            </xsl:attribute>
1344
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1345
              <xsl:attribute name="target">
1346
                <xsl:text>_blank</xsl:text>
1347
              </xsl:attribute>
1348
            </xsl:if>
1349
            <xsl:choose>
1350
              <xsl:when test="$OpenURLImageLocation != ''">
1351
                <img>
1352
                  <xsl:attribute name="src">
1353
                    <xsl:value-of select="$OpenURLImageLocation" />
1354
                  </xsl:attribute>
1355
                </img>
1356
              </xsl:when>
1357
              <xsl:otherwise>
1358
                <xsl:value-of select="$openurltext" />
1359
              </xsl:otherwise>
1360
            </xsl:choose>
1361
          </a></span>
1362
        </xsl:if>
1363
        <!-- End of OpenURL -->
1364
1316
    </xsl:element>
1365
    </xsl:element>
1317
    </xsl:template>
1366
    </xsl:template>
1318
1367
(-)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