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

(-)a/C4/Biblio.pm (-56 / +73 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::Escape; # GetCOinSBiblio
91
92
92
use C4::Koha;
93
use C4::Koha;
93
use C4::Log;    # logaction
94
use C4::Log;    # logaction
Lines 1244-1288 sub GetCOinSBiblio { Link Here
1244
        carp 'GetCOinSBiblio called with undefined record';
1245
        carp 'GetCOinSBiblio called with undefined record';
1245
        return;
1246
        return;
1246
    }
1247
    }
1248
1247
    my $pos7 = substr $record->leader(), 7, 1;
1249
    my $pos7 = substr $record->leader(), 7, 1;
1248
    my $pos6 = substr $record->leader(), 6, 1;
1250
    my $pos6 = substr $record->leader(), 6, 1;
1249
    my $mtx;
1251
    my $mtx;
1250
    my $genre;
1252
    my $genre;
1251
    my ( $aulast, $aufirst ) = ( '', '' );
1253
    my ( $aulast, $aufirst ) = ( '', '' );
1252
    my $oauthors  = '';
1254
    my @authors;
1253
    my $title     = '';
1255
    my $title;
1254
    my $subtitle  = '';
1256
    my $hosttitle;
1255
    my $pubyear   = '';
1257
    my $pubyear   = '';
1256
    my $isbn      = '';
1258
    my $isbn      = '';
1257
    my $issn      = '';
1259
    my $issn      = '';
1258
    my $publisher = '';
1260
    my $publisher = '';
1259
    my $pages     = '';
1261
    my $pages     = '';
1260
    my $titletype = 'b';
1262
    my $titletype = '';
1261
1263
1262
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1264
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1263
    # considered the same for UNIMARC and MARC21
1265
    # considered the same for UNIMARC and MARC21
1264
    my $fmts6;
1266
    my $fmts6 = {
1265
    my $fmts7;
1267
        'a' => 'book',
1266
    %$fmts6 = (
1268
        'b' => 'manuscript',
1267
                'a' => 'book',
1269
        'c' => 'book',
1268
                'b' => 'manuscript',
1270
        'd' => 'manuscript',
1269
                'c' => 'book',
1271
        'e' => 'map',
1270
                'd' => 'manuscript',
1272
        'f' => 'map',
1271
                'e' => 'map',
1273
        'g' => 'film',
1272
                'f' => 'map',
1274
        'i' => 'audioRecording',
1273
                'g' => 'film',
1275
        'j' => 'audioRecording',
1274
                'i' => 'audioRecording',
1276
        'k' => 'artwork',
1275
                'j' => 'audioRecording',
1277
        'l' => 'document',
1276
                'k' => 'artwork',
1278
        'm' => 'computerProgram',
1277
                'l' => 'document',
1279
        'o' => 'document',
1278
                'm' => 'computerProgram',
1280
        'r' => 'document',
1279
                'o' => 'document',
1281
    };
1280
                'r' => 'document',
1282
    my $fmts7 = {
1281
            );
1283
        'a' => 'journalArticle',
1282
    %$fmts7 = (
1284
        's' => 'journal',
1283
                    'a' => 'journalArticle',
1285
    };
1284
                    's' => 'journal',
1285
              );
1286
1286
1287
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1287
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1288
1288
Lines 1293-1298 sub GetCOinSBiblio { Link Here
1293
    ##### We must transform mtx to a valable mtx and document type ####
1293
    ##### We must transform mtx to a valable mtx and document type ####
1294
    if ( $genre eq 'book' ) {
1294
    if ( $genre eq 'book' ) {
1295
            $mtx = 'book';
1295
            $mtx = 'book';
1296
            $titletype = 'b';
1296
    } elsif ( $genre eq 'journal' ) {
1297
    } elsif ( $genre eq 'journal' ) {
1297
            $mtx = 'journal';
1298
            $mtx = 'journal';
1298
            $titletype = 'j';
1299
            $titletype = 'j';
Lines 1304-1329 sub GetCOinSBiblio { Link Here
1304
            $mtx = 'dc';
1305
            $mtx = 'dc';
1305
    }
1306
    }
1306
1307
1307
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1308
1309
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1308
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1310
1309
1311
        # Setting datas
1310
        # Setting datas
1312
        $aulast  = $record->subfield( '700', 'a' ) || '';
1311
        $aulast  = $record->subfield( '700', 'a' ) || '';
1313
        $aufirst = $record->subfield( '700', 'b' ) || '';
1312
        $aufirst = $record->subfield( '700', 'b' ) || '';
1314
        $oauthors = "&rft.au=$aufirst $aulast";
1313
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1315
1314
1316
        # others authors
1315
        # others authors
1317
        if ( $record->field('200') ) {
1316
        if ( $record->field('200') ) {
1318
            for my $au ( $record->field('200')->subfield('g') ) {
1317
            for my $au ( $record->field('200')->subfield('g') ) {
1319
                $oauthors .= "&rft.au=$au";
1318
                push @authors, $au;
1320
            }
1319
            }
1321
        }
1320
        }
1322
        $title =
1321
1323
          ( $mtx eq 'dc' )
1322
        $title     = $record->subfield( '200', 'a' );
1324
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1323
        my $subfield_210d = $record->subfield('210', 'd');
1325
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1324
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1326
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1325
            $pubyear = $1;
1326
        }
1327
        $publisher = $record->subfield( '210', 'c' ) || '';
1327
        $publisher = $record->subfield( '210', 'c' ) || '';
1328
        $isbn      = $record->subfield( '010', 'a' ) || '';
1328
        $isbn      = $record->subfield( '010', 'a' ) || '';
1329
        $issn      = $record->subfield( '011', 'a' ) || '';
1329
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1333-1366 sub GetCOinSBiblio { Link Here
1333
1333
1334
        # Setting datas
1334
        # Setting datas
1335
        if ( $record->field('100') ) {
1335
        if ( $record->field('100') ) {
1336
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1336
            push @authors, $record->subfield( '100', 'a' );
1337
        }
1337
        }
1338
1338
1339
        # others authors
1339
        # others authors
1340
        if ( $record->field('700') ) {
1340
        if ( $record->field('700') ) {
1341
            for my $au ( $record->field('700')->subfield('a') ) {
1341
            for my $au ( $record->field('700')->subfield('a') ) {
1342
                $oauthors .= "&rft.au=$au";
1342
                push @authors, $au;
1343
            }
1343
            }
1344
        }
1344
        }
1345
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1345
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1346
        $subtitle = $record->subfield( '245', 'b' ) || '';
1347
        $title .= $subtitle;
1348
        if ($titletype eq 'a') {
1346
        if ($titletype eq 'a') {
1349
            $pubyear   = $record->field('008') || '';
1347
            $pubyear   = $record->field('008') || '';
1350
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1348
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1351
            $isbn      = $record->subfield( '773', 'z' ) || '';
1349
            $isbn      = $record->subfield( '773', 'z' ) || '';
1352
            $issn      = $record->subfield( '773', 'x' ) || '';
1350
            $issn      = $record->subfield( '773', 'x' ) || '';
1353
            if ($mtx eq 'journal') {
1351
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{};
1354
                $title    .= "&rft.title=" . ( $record->subfield( '773', 't' ) || $record->subfield( '773', 'a') || q{} );
1352
            my @rels = $record->subfield( '773', 'g' );
1355
            } else {
1353
            $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 {
1354
        } else {
1365
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1355
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1366
            $publisher = $record->subfield( '260', 'b' ) || '';
1356
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1369-1380 sub GetCOinSBiblio { Link Here
1369
        }
1359
        }
1370
1360
1371
    }
1361
    }
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
1362
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="
1363
    my @params = (
1364
        [ 'ctx_ver', 'Z39.88-2004' ],
1365
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1366
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1367
        [ "rft.${titletype}title", $title ],
1368
    );
1369
1370
    # rft.title is authorized only once, so by checking $titletype
1371
    # we ensure that rft.title is not already in the list.
1372
    if ($hosttitle and $titletype) {
1373
        push @params, [ 'rft.title', $hosttitle ];
1374
    }
1375
1376
    push @params, (
1377
        [ 'rft.isbn', $isbn ],
1378
        [ 'rft.issn', $issn ],
1379
    );
1380
1381
    # If it's a subscription, these informations have no meaning.
1382
    if ($genre ne 'journal') {
1383
        push @params, (
1384
            [ 'rft.aulast', $aulast ],
1385
            [ 'rft.aufirst', $aufirst ],
1386
            (map { [ 'rft.au', $_ ] } @authors),
1387
            [ 'rft.pub', $publisher ],
1388
            [ 'rft.date', $pubyear ],
1389
            [ 'rft.pages', $pages ],
1390
        );
1391
    }
1392
1393
    my $coins_value = join( '&amp;',
1394
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1378
1395
1379
    return $coins_value;
1396
    return $coins_value;
1380
}
1397
}
(-)a/C4/XSLT.pm (-4 / +20 lines)
Lines 171-177 sub get_xslt_sysprefs { Link Here
171
                              OPACItemLocation DisplayIconsXSLT
171
                              OPACItemLocation DisplayIconsXSLT
172
                              AlternateHoldingsField AlternateHoldingsSeparator
172
                              AlternateHoldingsField AlternateHoldingsSeparator
173
                              TrackClicks opacthemes IdRef OpacSuppression
173
                              TrackClicks opacthemes IdRef OpacSuppression
174
                              OPACResultsLibrary / )
174
                              OPACResultsLibrary OPACShowOpenURL
175
                              OpenURLResolverURL OpenURLImageLocation
176
                              OpenURLText / )
175
    {
177
    {
176
        my $sp = C4::Context->preference( $syspref );
178
        my $sp = C4::Context->preference( $syspref );
177
        next unless defined($sp);
179
        next unless defined($sp);
Lines 188-194 sub get_xslt_sysprefs { Link Here
188
}
190
}
189
191
190
sub XSLTParse4Display {
192
sub XSLTParse4Display {
191
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang ) = @_;
193
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $sysxml, $xslfilename, $lang, $variables ) = @_;
192
194
193
    $sysxml ||= C4::Context->preference($xslsyspref);
195
    $sysxml ||= C4::Context->preference($xslsyspref);
194
    $xslfilename ||= C4::Context->preference($xslsyspref);
196
    $xslfilename ||= C4::Context->preference($xslsyspref);
Lines 243-250 sub XSLTParse4Display { Link Here
243
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
245
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
244
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
246
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
245
247
246
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
248
    $variables ||= {};
247
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
249
    if (C4::Context->preference('OPACShowOpenURL')) {
250
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
251
        my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
252
        if (grep /^$biblio->{itemtype}$/, @itypes) {
253
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
254
        }
255
    }
256
    my $varxml = "<variables>\n";
257
    while (my ($key, $value) = each %$variables) {
258
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
259
    }
260
    $varxml .= "</variables>\n";
261
262
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
263
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
248
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
264
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
249
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
265
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
250
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
266
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
(-)a/installer/data/mysql/atomicupdate/8995_OpenURL_sysprefs.sql (+6 lines)
Line 0 Link Here
1
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES
2
  ('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free'),
3
  ('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free'),
4
  ('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free'),
5
  ('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo'),
6
  ('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
(-)a/installer/data/mysql/sysprefs.sql (+5 lines)
Lines 430-435 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
430
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
430
('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'),
431
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
431
('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'),
432
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
432
('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'),
433
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free'),
434
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free'),
435
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free'),
436
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo'),
437
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
433
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
438
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
434
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
439
('OverDriveCirculation','0','Enable client to see their OverDrive account','','YesNo'),
435
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
440
('OverDriveClientKey','','Client key for OverDrive integration','30','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 517-522 OPAC: Link Here
517
            - pref: OPACISBD
517
            - pref: OPACISBD
518
              type: textarea
518
              type: textarea
519
              class: code
519
              class: code
520
    OpenURL:
521
        -
522
            - 'Complete URL of OpenURL resolver (starting with <code>http://</code> or <code>https://</code>):'
523
            - pref: OpenURLResolverURL
524
              class: url
525
        -
526
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
527
            - pref: OpenURLText
528
        -
529
            - 'Location of image for OpenURL links:'
530
            - pref: OpenURLImageLocation
531
              class: url
532
            - '<br />Can be a complete URL starting with <code>http://</code> or'
533
            - '<code>https://</code> or the name of a file in <code>images</code> directory'
534
            - '<br />Examples:'
535
            - '<br />- <code>http://www.example.com/img/openurl.png</code>'
536
            - '<br />- <code>OpenURL/OpenURL.png</code> (file is in <code>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</code>)'
537
        -
538
            - pref: OPACShowOpenURL
539
              choices:
540
                  yes: Enable
541
                  no: Disable
542
            - 'display of OpenURL link in OPAC search results and detail page.'
543
        -
544
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
545
            - pref: OPACOpenURLItemTypes
546
            - '<br />'
520
    Policy:
547
    Policy:
521
        -
548
        -
522
            - pref: SearchMyLibraryFirst
549
            - 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 (+64 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="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
1319
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1320
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1321
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
1322
1323
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
1324
          <xsl:variable name="openurltext">
1325
            <xsl:choose>
1326
              <xsl:when test="$OpenURLText != ''">
1327
                <xsl:value-of select="$OpenURLText" />
1328
              </xsl:when>
1329
              <xsl:otherwise>
1330
                <xsl:text>OpenURL</xsl:text>
1331
              </xsl:otherwise>
1332
            </xsl:choose>
1333
          </xsl:variable>
1334
1335
          <xsl:variable name="openurlimagelocation">
1336
            <xsl:choose>
1337
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1338
                <xsl:value-of select="$OpenURLImageLocation" />
1339
              </xsl:when>
1340
              <xsl:when test="$OpenURLImageLocation != ''">
1341
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1342
                <xsl:value-of select="$OpenURLImageLocation" />
1343
              </xsl:when>
1344
            </xsl:choose>
1345
          </xsl:variable>
1346
1347
          <span class="results_summary"><a>
1348
            <xsl:attribute name="href">
1349
              <xsl:value-of select="$OpenURLResolverURL" />
1350
              <xsl:text>?</xsl:text>
1351
              <xsl:value-of select="$COinS" />
1352
            </xsl:attribute>
1353
            <xsl:attribute name="title">
1354
              <xsl:value-of select="$openurltext" />
1355
            </xsl:attribute>
1356
            <xsl:attribute name="class">
1357
              <xsl:text>OpenURL</xsl:text>
1358
            </xsl:attribute>
1359
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1360
              <xsl:attribute name="target">
1361
                <xsl:text>_blank</xsl:text>
1362
              </xsl:attribute>
1363
            </xsl:if>
1364
            <xsl:choose>
1365
              <xsl:when test="$openurlimagelocation != ''">
1366
                <img>
1367
                  <xsl:attribute name="src">
1368
                    <xsl:value-of select="$openurlimagelocation" />
1369
                  </xsl:attribute>
1370
                </img>
1371
              </xsl:when>
1372
              <xsl:otherwise>
1373
                <xsl:value-of select="$openurltext" />
1374
              </xsl:otherwise>
1375
            </xsl:choose>
1376
          </a></span>
1377
        </xsl:if>
1378
        <!-- End of OpenURL -->
1379
1316
    </xsl:element>
1380
    </xsl:element>
1317
    </xsl:template>
1381
    </xsl:template>
1318
1382
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +65 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="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
451
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
452
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
453
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
454
455
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
456
      <xsl:variable name="openurltext">
457
        <xsl:choose>
458
          <xsl:when test="$OpenURLText != ''">
459
            <xsl:value-of select="$OpenURLText" />
460
          </xsl:when>
461
          <xsl:otherwise>
462
            <xsl:text>OpenURL</xsl:text>
463
          </xsl:otherwise>
464
        </xsl:choose>
465
      </xsl:variable>
466
467
      <xsl:variable name="openurlimagelocation">
468
        <xsl:choose>
469
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
470
            <xsl:value-of select="$OpenURLImageLocation" />
471
          </xsl:when>
472
          <xsl:when test="$OpenURLImageLocation != ''">
473
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
474
            <xsl:value-of select="$OpenURLImageLocation" />
475
          </xsl:when>
476
        </xsl:choose>
477
      </xsl:variable>
478
479
      <span class="results_summary"><a>
480
        <xsl:attribute name="href">
481
          <xsl:value-of select="$OpenURLResolverURL" />
482
          <xsl:text>?</xsl:text>
483
          <xsl:value-of select="$COinS" />
484
        </xsl:attribute>
485
        <xsl:attribute name="title">
486
          <xsl:value-of select="$openurltext" />
487
        </xsl:attribute>
488
        <xsl:attribute name="class">
489
          <xsl:text>OpenURL</xsl:text>
490
        </xsl:attribute>
491
        <xsl:if test="$OPACURLOpenInNewWindow='1'">
492
          <xsl:attribute name="target">
493
            <xsl:text>_blank</xsl:text>
494
          </xsl:attribute>
495
        </xsl:if>
496
        <xsl:choose>
497
          <xsl:when test="$openurlimagelocation != ''">
498
            <img>
499
              <xsl:attribute name="src">
500
                <xsl:value-of select="$openurlimagelocation" />
501
              </xsl:attribute>
502
            </img>
503
          </xsl:when>
504
          <xsl:otherwise>
505
            <xsl:value-of select="$openurltext" />
506
          </xsl:otherwise>
507
        </xsl:choose>
508
      </a></span>
509
    </xsl:if>
510
    <!-- End of OpenURL -->
511
512
    <p>
449
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
513
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
450
    <xsl:if test="$display880">
514
    <xsl:if test="$display880">
451
      <xsl:call-template name="m880Select">
515
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl (+65 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="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
450
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
451
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
452
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
453
454
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
455
    <xsl:variable name="openurltext">
456
      <xsl:choose>
457
        <xsl:when test="$OpenURLText != ''">
458
          <xsl:value-of select="$OpenURLText" />
459
        </xsl:when>
460
        <xsl:otherwise>
461
          <xsl:text>OpenURL</xsl:text>
462
        </xsl:otherwise>
463
      </xsl:choose>
464
    </xsl:variable>
465
466
    <xsl:variable name="openurlimagelocation">
467
      <xsl:choose>
468
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
469
          <xsl:value-of select="$OpenURLImageLocation" />
470
        </xsl:when>
471
        <xsl:when test="$OpenURLImageLocation != ''">
472
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
473
          <xsl:value-of select="$OpenURLImageLocation" />
474
        </xsl:when>
475
      </xsl:choose>
476
    </xsl:variable>
477
478
    <span class="results_summary"><a>
479
      <xsl:attribute name="href">
480
        <xsl:value-of select="$OpenURLResolverURL" />
481
        <xsl:text>?</xsl:text>
482
        <xsl:value-of select="$COinS" />
483
      </xsl:attribute>
484
      <xsl:attribute name="title">
485
        <xsl:value-of select="$openurltext" />
486
      </xsl:attribute>
487
      <xsl:attribute name="class">
488
        <xsl:text>OpenURL</xsl:text>
489
      </xsl:attribute>
490
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
491
        <xsl:attribute name="target">
492
          <xsl:text>_blank</xsl:text>
493
        </xsl:attribute>
494
      </xsl:if>
495
      <xsl:choose>
496
        <xsl:when test="$openurlimagelocation != ''">
497
          <img>
498
            <xsl:attribute name="src">
499
              <xsl:value-of select="$openurlimagelocation" />
500
            </xsl:attribute>
501
          </img>
502
        </xsl:when>
503
        <xsl:otherwise>
504
          <xsl:value-of select="$openurltext" />
505
        </xsl:otherwise>
506
      </xsl:choose>
507
    </a></span>
508
  </xsl:if>
509
  <!-- End of OpenURL -->
510
446
</xsl:template>
511
</xsl:template>
447
512
448
    <xsl:template name="nameABCDQ">
513
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl (+64 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="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
91
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
92
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
93
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
94
95
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
96
    <xsl:variable name="openurltext">
97
      <xsl:choose>
98
        <xsl:when test="$OpenURLText != ''">
99
          <xsl:value-of select="$OpenURLText" />
100
        </xsl:when>
101
        <xsl:otherwise>
102
          <xsl:text>OpenURL</xsl:text>
103
        </xsl:otherwise>
104
      </xsl:choose>
105
    </xsl:variable>
106
107
    <xsl:variable name="openurlimagelocation">
108
      <xsl:choose>
109
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
110
          <xsl:value-of select="$OpenURLImageLocation" />
111
        </xsl:when>
112
        <xsl:when test="$OpenURLImageLocation != ''">
113
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
114
          <xsl:value-of select="$OpenURLImageLocation" />
115
        </xsl:when>
116
      </xsl:choose>
117
    </xsl:variable>
118
119
    <span class="results_summary"><a>
120
      <xsl:attribute name="href">
121
        <xsl:value-of select="$OpenURLResolverURL" />
122
        <xsl:text>?</xsl:text>
123
        <xsl:value-of select="$COinS" />
124
      </xsl:attribute>
125
      <xsl:attribute name="title">
126
        <xsl:value-of select="$openurltext" />
127
      </xsl:attribute>
128
      <xsl:attribute name="class">
129
        <xsl:text>OpenURL</xsl:text>
130
      </xsl:attribute>
131
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
132
        <xsl:attribute name="target">
133
          <xsl:text>_blank</xsl:text>
134
        </xsl:attribute>
135
      </xsl:if>
136
      <xsl:choose>
137
        <xsl:when test="$openurlimagelocation != ''">
138
          <img>
139
            <xsl:attribute name="src">
140
              <xsl:value-of select="$openurlimagelocation" />
141
            </xsl:attribute>
142
          </img>
143
        </xsl:when>
144
        <xsl:otherwise>
145
          <xsl:value-of select="$openurltext" />
146
        </xsl:otherwise>
147
      </xsl:choose>
148
    </a></span>
149
  </xsl:if>
150
  <!-- End of OpenURL -->
151
88
  <xsl:call-template name="tag_title">
152
  <xsl:call-template name="tag_title">
89
    <xsl:with-param name="tag">454</xsl:with-param>
153
    <xsl:with-param name="tag">454</xsl:with-param>
90
    <xsl:with-param name="label">Translation of</xsl:with-param>
154
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1222-1225 $template->param( Link Here
1222
    'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay'),
1222
    'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay'),
1223
);
1223
);
1224
1224
1225
# OpenURL
1226
if (C4::Context->preference('OPACShowOpenURL')) {
1227
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1228
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1229
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1230
        $template->param(
1231
            OPACShowOpenURL => 1,
1232
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1233
            OpenURLText => C4::Context->preference('OpenURLText'),
1234
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1235
        );
1236
    }
1237
}
1238
1225
output_html_with_http_headers $query, $cookie, $template->output;
1239
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 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
Lines 669-675 for (my $i=0;$i<@servers;$i++) { Link Here
669
                $res->{'incart'} = 1;
681
                $res->{'incart'} = 1;
670
            }
682
            }
671
683
672
            if (C4::Context->preference('COinSinOPACResults')) {
684
            if (C4::Context->preference('COinSinOPACResults')
685
            or C4::Context->preference('OPACShowOpenURL')) {
686
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
687
                    $res->{ShowOpenURL} = 1;
688
                }
673
                my $record = GetMarcBiblio({ biblionumber => $res->{'biblionumber'} });
689
                my $record = GetMarcBiblio({ biblionumber => $res->{'biblionumber'} });
674
                $res->{coins} = GetCOinSBiblio($record);
690
                $res->{coins} = GetCOinSBiblio($record);
675
            }
691
            }
676
- 

Return to bug 8995