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

(-)a/C4/Biblio.pm (-56 / +73 lines)
Lines 29-34 use MARC::File::USMARC; Link Here
29
use MARC::File::XML;
29
use MARC::File::XML;
30
use POSIX qw(strftime);
30
use POSIX qw(strftime);
31
use Module::Load::Conditional qw(can_load);
31
use Module::Load::Conditional qw(can_load);
32
use URI::Escape; # GetCOinSBiblio
32
33
33
use C4::Koha;
34
use C4::Koha;
34
use C4::Dates qw/format_date/;
35
use C4::Dates qw/format_date/;
Lines 1317-1361 sub GetCOinSBiblio { Link Here
1317
        carp 'GetCOinSBiblio called with undefined record';
1318
        carp 'GetCOinSBiblio called with undefined record';
1318
        return;
1319
        return;
1319
    }
1320
    }
1321
1320
    my $pos7 = substr $record->leader(), 7, 1;
1322
    my $pos7 = substr $record->leader(), 7, 1;
1321
    my $pos6 = substr $record->leader(), 6, 1;
1323
    my $pos6 = substr $record->leader(), 6, 1;
1322
    my $mtx;
1324
    my $mtx;
1323
    my $genre;
1325
    my $genre;
1324
    my ( $aulast, $aufirst ) = ( '', '' );
1326
    my ( $aulast, $aufirst ) = ( '', '' );
1325
    my $oauthors  = '';
1327
    my @authors;
1326
    my $title     = '';
1328
    my $title;
1327
    my $subtitle  = '';
1329
    my $hosttitle;
1328
    my $pubyear   = '';
1330
    my $pubyear   = '';
1329
    my $isbn      = '';
1331
    my $isbn      = '';
1330
    my $issn      = '';
1332
    my $issn      = '';
1331
    my $publisher = '';
1333
    my $publisher = '';
1332
    my $pages     = '';
1334
    my $pages     = '';
1333
    my $titletype = 'b';
1335
    my $titletype = '';
1334
1336
1335
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1337
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1336
    # considered the same for UNIMARC and MARC21
1338
    # considered the same for UNIMARC and MARC21
1337
    my $fmts6;
1339
    my $fmts6 = {
1338
    my $fmts7;
1340
        'a' => 'book',
1339
    %$fmts6 = (
1341
        'b' => 'manuscript',
1340
                'a' => 'book',
1342
        'c' => 'book',
1341
                'b' => 'manuscript',
1343
        'd' => 'manuscript',
1342
                'c' => 'book',
1344
        'e' => 'map',
1343
                'd' => 'manuscript',
1345
        'f' => 'map',
1344
                'e' => 'map',
1346
        'g' => 'film',
1345
                'f' => 'map',
1347
        'i' => 'audioRecording',
1346
                'g' => 'film',
1348
        'j' => 'audioRecording',
1347
                'i' => 'audioRecording',
1349
        'k' => 'artwork',
1348
                'j' => 'audioRecording',
1350
        'l' => 'document',
1349
                'k' => 'artwork',
1351
        'm' => 'computerProgram',
1350
                'l' => 'document',
1352
        'o' => 'document',
1351
                'm' => 'computerProgram',
1353
        'r' => 'document',
1352
                'o' => 'document',
1354
    };
1353
                'r' => 'document',
1355
    my $fmts7 = {
1354
            );
1356
        'a' => 'journalArticle',
1355
    %$fmts7 = (
1357
        's' => 'journal',
1356
                    'a' => 'journalArticle',
1358
    };
1357
                    's' => 'journal',
1358
              );
1359
1359
1360
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1360
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1361
1361
Lines 1366-1371 sub GetCOinSBiblio { Link Here
1366
    ##### We must transform mtx to a valable mtx and document type ####
1366
    ##### We must transform mtx to a valable mtx and document type ####
1367
    if ( $genre eq 'book' ) {
1367
    if ( $genre eq 'book' ) {
1368
            $mtx = 'book';
1368
            $mtx = 'book';
1369
            $titletype = 'b';
1369
    } elsif ( $genre eq 'journal' ) {
1370
    } elsif ( $genre eq 'journal' ) {
1370
            $mtx = 'journal';
1371
            $mtx = 'journal';
1371
            $titletype = 'j';
1372
            $titletype = 'j';
Lines 1377-1402 sub GetCOinSBiblio { Link Here
1377
            $mtx = 'dc';
1378
            $mtx = 'dc';
1378
    }
1379
    }
1379
1380
1380
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1381
1382
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1381
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1383
1382
1384
        # Setting datas
1383
        # Setting datas
1385
        $aulast  = $record->subfield( '700', 'a' ) || '';
1384
        $aulast  = $record->subfield( '700', 'a' ) || '';
1386
        $aufirst = $record->subfield( '700', 'b' ) || '';
1385
        $aufirst = $record->subfield( '700', 'b' ) || '';
1387
        $oauthors = "&rft.au=$aufirst $aulast";
1386
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1388
1387
1389
        # others authors
1388
        # others authors
1390
        if ( $record->field('200') ) {
1389
        if ( $record->field('200') ) {
1391
            for my $au ( $record->field('200')->subfield('g') ) {
1390
            for my $au ( $record->field('200')->subfield('g') ) {
1392
                $oauthors .= "&rft.au=$au";
1391
                push @authors, $au;
1393
            }
1392
            }
1394
        }
1393
        }
1395
        $title =
1394
1396
          ( $mtx eq 'dc' )
1395
        $title     = $record->subfield( '200', 'a' );
1397
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1396
        my $subfield_210d = $record->subfield('210', 'd');
1398
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1397
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1399
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1398
            $pubyear = $1;
1399
        }
1400
        $publisher = $record->subfield( '210', 'c' ) || '';
1400
        $publisher = $record->subfield( '210', 'c' ) || '';
1401
        $isbn      = $record->subfield( '010', 'a' ) || '';
1401
        $isbn      = $record->subfield( '010', 'a' ) || '';
1402
        $issn      = $record->subfield( '011', 'a' ) || '';
1402
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1406-1439 sub GetCOinSBiblio { Link Here
1406
1406
1407
        # Setting datas
1407
        # Setting datas
1408
        if ( $record->field('100') ) {
1408
        if ( $record->field('100') ) {
1409
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1409
            push @authors, $record->subfield( '100', 'a' );
1410
        }
1410
        }
1411
1411
1412
        # others authors
1412
        # others authors
1413
        if ( $record->field('700') ) {
1413
        if ( $record->field('700') ) {
1414
            for my $au ( $record->field('700')->subfield('a') ) {
1414
            for my $au ( $record->field('700')->subfield('a') ) {
1415
                $oauthors .= "&rft.au=$au";
1415
                push @authors, $au;
1416
            }
1416
            }
1417
        }
1417
        }
1418
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1418
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1419
        $subtitle = $record->subfield( '245', 'b' ) || '';
1420
        $title .= $subtitle;
1421
        if ($titletype eq 'a') {
1419
        if ($titletype eq 'a') {
1422
            $pubyear   = $record->field('008') || '';
1420
            $pubyear   = $record->field('008') || '';
1423
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1421
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1424
            $isbn      = $record->subfield( '773', 'z' ) || '';
1422
            $isbn      = $record->subfield( '773', 'z' ) || '';
1425
            $issn      = $record->subfield( '773', 'x' ) || '';
1423
            $issn      = $record->subfield( '773', 'x' ) || '';
1426
            if ($mtx eq 'journal') {
1424
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1427
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1425
            my @rels = $record->subfield( '773', 'g' );
1428
            } else {
1426
            $pages = join(', ', @rels);
1429
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1430
            }
1431
            foreach my $rel ($record->subfield( '773', 'g' )) {
1432
                if ($pages) {
1433
                    $pages .= ', ';
1434
                }
1435
                $pages .= $rel;
1436
            }
1437
        } else {
1427
        } else {
1438
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1428
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1439
            $publisher = $record->subfield( '260', 'b' ) || '';
1429
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1442-1453 sub GetCOinSBiblio { Link Here
1442
        }
1432
        }
1443
1433
1444
    }
1434
    }
1445
    my $coins_value =
1446
"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";
1447
    $coins_value =~ s/(\ |&[^a])/\+/g;
1448
    $coins_value =~ s/\"/\&quot\;/g;
1449
1435
1450
#<!-- 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="
1436
    my @params = (
1437
        [ 'ctx_ver', 'Z39.88-2004' ],
1438
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1439
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1440
        [ "rft.${titletype}title", $title ],
1441
    );
1442
1443
    # rft.title is authorized only once, so by checking $titletype
1444
    # we ensure that rft.title is not already in the list.
1445
    if ($hosttitle and $titletype) {
1446
        push @params, [ 'rft.title', $hosttitle ];
1447
    }
1448
1449
    push @params, (
1450
        [ 'rft.isbn', $isbn ],
1451
        [ 'rft.issn', $issn ],
1452
    );
1453
1454
    # If it's a subscription, these informations have no meaning.
1455
    if ($genre ne 'journal') {
1456
        push @params, (
1457
            [ 'rft.aulast', $aulast ],
1458
            [ 'rft.aufirst', $aufirst ],
1459
            (map { [ 'rft.au', $_ ] } @authors),
1460
            [ 'rft.pub', $publisher ],
1461
            [ 'rft.date', $pubyear ],
1462
            [ 'rft.pages', $pages ],
1463
        );
1464
    }
1465
1466
    my $coins_value = join( '&amp;',
1467
        map { $$_[1] ? $$_[0] . '=' . uri_escape_utf8( $$_[1] ) : () } @params );
1451
1468
1452
    return $coins_value;
1469
    return $coins_value;
1453
}
1470
}
(-)a/C4/XSLT.pm (-4 / +20 lines)
Lines 157-163 sub _get_best_default_xslt_filename { Link Here
157
}
157
}
158
158
159
sub XSLTParse4Display {
159
sub XSLTParse4Display {
160
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items ) = @_;
160
    my ( $biblionumber, $orig_record, $xslsyspref, $fixamps, $hidden_items, $variables ) = @_;
161
    my $xslfilename = C4::Context->preference($xslsyspref);
161
    my $xslfilename = C4::Context->preference($xslsyspref);
162
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
162
    if ( $xslfilename =~ /^\s*"?default"?\s*$/i ) {
163
        my $htdocs;
163
        my $htdocs;
Lines 206-220 sub XSLTParse4Display { Link Here
206
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
206
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
207
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
207
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
208
                              AlternateHoldingsField AlternateHoldingsSeparator
208
                              AlternateHoldingsField AlternateHoldingsSeparator
209
                              TrackClicks opacthemes / )
209
                              TrackClicks opacthemes
210
                              OPACShowOpenURL OpenURLResolverURL
211
                              OpenURLImageLocation OpenURLText / )
210
    {
212
    {
211
        my $sp = C4::Context->preference( $syspref );
213
        my $sp = C4::Context->preference( $syspref );
212
        next unless defined($sp);
214
        next unless defined($sp);
213
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
215
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
214
    }
216
    }
215
    $sysxml .= "</sysprefs>\n";
217
    $sysxml .= "</sysprefs>\n";
216
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
218
217
    if ($fixamps) { # We need to correct the HTML entities that Zebra outputs
219
    $variables ||= {};
220
    if (C4::Context->preference('OPACShowOpenURL')) {
221
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
222
        my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
223
        if (grep /^$biblio->{itemtype}$/, @itypes) {
224
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
225
        }
226
    }
227
    my $varxml = "<variables>\n";
228
    while (my ($key, $value) = each %$variables) {
229
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
230
    }
231
    $varxml .= "</variables>\n";
232
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
233
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
218
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
234
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
219
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
235
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
220
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
236
        $xmlrecord =~ s/\&amp\;gt\;/\&gt\;/g;
(-)a/installer/data/mysql/sysprefs.sql (+5 lines)
Lines 473-476 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
473
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
473
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
474
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
474
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
475
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
475
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
476
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free')
477
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
478
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
479
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
480
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free')
476
;
481
;
(-)a/installer/data/mysql/updatedatabase.pl (+27 lines)
Lines 9732-9737 if ( CheckVersion($DBversion) ) { Link Here
9732
    SetVersion($DBversion);
9732
    SetVersion($DBversion);
9733
}
9733
}
9734
9734
9735
$DBversion = "3.17.00.XXX";
9736
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
9737
    $dbh->do("
9738
        INSERT INTO systempreferences (variable,value,explanation,options,type)
9739
        VALUES('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free')
9740
    ");
9741
    $dbh->do("
9742
        INSERT INTO systempreferences (variable,value,explanation,options,type)
9743
        VALUES('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free');
9744
    ");
9745
    $dbh->do("
9746
        INSERT INTO systempreferences (variable,value,explanation,options,type)
9747
        VALUES('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free');
9748
    ");
9749
    $dbh->do("
9750
        INSERT INTO systempreferences (variable,value,explanation,options,type)
9751
        VALUES('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo');
9752
    ");
9753
    $dbh->do("
9754
        INSERT INTO systempreferences (variable,value,explanation,options,type)
9755
        VALUES('OPACOpenURLItemTypes', '', 'Show the OpenURL link only for these item types', NULL, 'Free');
9756
    ");
9757
    print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n";
9758
    SetVersion($DBversion);
9759
}
9760
9761
9735
=head1 FUNCTIONS
9762
=head1 FUNCTIONS
9736
9763
9737
=head2 TableExists($table)
9764
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 316-321 OPAC: Link Here
316
            - pref: OpacCustomSearch
316
            - pref: OpacCustomSearch
317
              type: textarea
317
              type: textarea
318
              class: code
318
              class: code
319
        -
320
            - 'Complete URL of OpenURL resolver (starting with <tt>http://</tt> or <tt>https://</tt>):'
321
            - pref: OpenURLResolverURL
322
              class: url
323
        -
324
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
325
            - pref: OpenURLText
326
        -
327
            - 'Location of image for OpenURL links:'
328
            - pref: OpenURLImageLocation
329
              class: url
330
            - '<br />Can be a complete URL starting with <tt>http://</tt> or'
331
            - '<tt>https://</tt> or the name of a file in <tt>images</tt> directory'
332
            - '<br />Examples:'
333
            - '<br />- <tt>http://www.example.com/img/openurl.png</tt>'
334
            - '<br />- <tt>OpenURL/OpenURL.png</tt> (file is in <tt>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</tt>)'
335
        -
336
            - pref: OPACShowOpenURL
337
              choices:
338
                  yes: Enable
339
                  no: Disable
340
            - 'display of OpenURL link in OPAC search results and detail page.'
341
        -
342
            - 'List of item type codes (separated by spaces) for those you want to show the OpenURL link:'
343
            - pref: OPACOpenURLItemTypes
344
            - '<br />'
345
            - 'It uses biblioitems.itemtype field, so if you map a MARC field to it, and link this MARC field to a list of authorised values (for example CCODE), you can use these values for system preference value.'
319
    Features:
346
    Features:
320
        -
347
        -
321
            - pref: opacuserlogin
348
            - pref: opacuserlogin
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/opac-old.css (-1 / +4 lines)
Lines 1-6 Link Here
1
@import url("/opac-tmpl/lib/yui/reset-fonts-grids.css");
1
@import url("/opac-tmpl/lib/yui/reset-fonts-grids.css");
2
@import url("/opac-tmpl/lib/yui/skin.css");
2
@import url("/opac-tmpl/lib/yui/skin.css");
3
4
a {
3
a {
5
	font-weight : bold;
4
	font-weight : bold;
6
}
5
}
Lines 2860-2862 padding: 0.1em 0; Link Here
2860
    padding: 3px;
2859
    padding: 3px;
2861
    text-align: center;
2860
    text-align: center;
2862
}
2861
}
2862
2863
a.OpenURL img {
2864
    vertical-align: middle;
2865
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+25 lines)
Lines 352-357 Link Here
352
                                </ul>
352
                                </ul>
353
                            </div>
353
                            </div>
354
                        [% END # / IF MARCURLS %]
354
                        [% END # / IF MARCURLS %]
355
356
                        [% IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
357
                            [%# Build OpenURL image location %]
358
                            [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
359
                                [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
360
                            [% ELSE %]
361
                                [% openurlimagelocation = "$OpenURLImageLocation" %]
362
                            [% END %]
363
364
                            <span class="results_summary">
365
                                [% OpenURLTarget = '_self' %]
366
                                [% IF ( OPACURLOpenInNewWindow ) %]
367
                                    [% OpenURLTarget = '_blank' %]
368
                                [% END %]
369
                                <a class="OpenURL" href="[% OpenURLResolverURL %]?[% ocoins %]" title="[% OpenURLText %]" target="[% OpenURLTarget %]">
370
                                [% IF openurlimagelocation %]
371
                                    <img src="[% openurlimagelocation %]" />
372
                                [% ELSIF OpenURLText %]
373
                                    [% OpenURLText %]
374
                                [% ELSE %]
375
                                    OpenURL
376
                                [% END %]
377
                                </a>
378
                            </span>
379
                        [% END # / IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
355
                    [% END # / IF OPACXSLTDetailsDisplay %]
380
                    [% END # / IF OPACXSLTDetailsDisplay %]
356
381
357
                    [% IF ( AuthorisedValueImages && authorised_value_images ) %]
382
                    [% IF ( AuthorisedValueImages && authorised_value_images ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+21 lines)
Lines 167-172 Link Here
167
167
168
                                <!-- TABLE RESULTS START -->
168
                                <!-- TABLE RESULTS START -->
169
                                <table class="table table-striped">
169
                                <table class="table table-striped">
170
                                    [%# Build OpenURL image location %]
171
                                    [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
172
                                        [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
173
                                    [% ELSE %]
174
                                        [% openurlimagelocation = "$OpenURLImageLocation" %]
175
                                    [% END %]
176
                                    [% OpenURLTarget = '_self' %]
177
                                    [% IF ( OPACURLOpenInNewWindow ) %]
178
                                        [% OpenURLTarget = '_blank' %]
179
                                    [% END %]
170
180
171
                                    <!-- Actual Search Results -->
181
                                    <!-- Actual Search Results -->
172
                                    [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
182
                                    [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
Lines 318-323 Link Here
318
                                                    [% ELSE %]
328
                                                    [% ELSE %]
319
                                                        &nbsp;
329
                                                        &nbsp;
320
                                                    [% END %]
330
                                                    [% END %]
331
                                                    [% IF (SEARCH_RESULT.ShowOpenURL && OpenURLResolverURL && SEARCH_RESULT.coins) %]
332
                                                        <a class="OpenURL" href="[% OpenURLResolverURL %]?[% SEARCH_RESULT.coins %]" title="[% OpenURLText %]" target="[% OpenURLTarget %]">
333
                                                        [% IF openurlimagelocation %]
334
                                                            <img src="[% openurlimagelocation %]" />
335
                                                        [% ELSIF OpenURLText %]
336
                                                            [% OpenURLText %]
337
                                                        [% ELSE %]
338
                                                            OpenURL
339
                                                        [% END %]
340
                                                        </a>
341
                                                    [% END %]
321
342
322
                                                    <span class="results_summary publisher">
343
                                                    <span class="results_summary publisher">
323
                                                        <span class="label">Publication:</span>
344
                                                        <span class="label">Publication:</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (+64 lines)
Lines 1017-1022 Link Here
1017
        </xsl:for-each>
1017
        </xsl:for-each>
1018
        </xsl:if>
1018
        </xsl:if>
1019
1019
1020
        <!-- OpenURL -->
1021
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
1022
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
1023
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
1024
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
1025
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
1026
1027
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
1028
          <xsl:variable name="openurltext">
1029
            <xsl:choose>
1030
              <xsl:when test="$OpenURLText != ''">
1031
                <xsl:value-of select="$OpenURLText" />
1032
              </xsl:when>
1033
              <xsl:otherwise>
1034
                <xsl:text>OpenURL</xsl:text>
1035
              </xsl:otherwise>
1036
            </xsl:choose>
1037
          </xsl:variable>
1038
1039
          <xsl:variable name="openurlimagelocation">
1040
            <xsl:choose>
1041
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1042
                <xsl:value-of select="$OpenURLImageLocation" />
1043
              </xsl:when>
1044
              <xsl:when test="$OpenURLImageLocation != ''">
1045
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1046
                <xsl:value-of select="$OpenURLImageLocation" />
1047
              </xsl:when>
1048
            </xsl:choose>
1049
          </xsl:variable>
1050
1051
          <span class="results_summary"><a>
1052
            <xsl:attribute name="href">
1053
              <xsl:value-of select="$OpenURLResolverURL" />
1054
              <xsl:text>?</xsl:text>
1055
              <xsl:value-of select="$COinS" />
1056
            </xsl:attribute>
1057
            <xsl:attribute name="title">
1058
              <xsl:value-of select="$openurltext" />
1059
            </xsl:attribute>
1060
            <xsl:attribute name="class">
1061
              <xsl:text>OpenURL</xsl:text>
1062
            </xsl:attribute>
1063
            <xsl:if test="$OPACURLOpenInNewWindow='1'">
1064
              <xsl:attribute name="target">
1065
                <xsl:text>_blank</xsl:text>
1066
              </xsl:attribute>
1067
            </xsl:if>
1068
            <xsl:choose>
1069
              <xsl:when test="$openurlimagelocation != ''">
1070
                <img>
1071
                  <xsl:attribute name="src">
1072
                    <xsl:value-of select="$openurlimagelocation" />
1073
                  </xsl:attribute>
1074
                </img>
1075
              </xsl:when>
1076
              <xsl:otherwise>
1077
                <xsl:value-of select="$openurltext" />
1078
              </xsl:otherwise>
1079
            </xsl:choose>
1080
          </a></span>
1081
        </xsl:if>
1082
        <!-- End of OpenURL -->
1083
1020
    </xsl:element>
1084
    </xsl:element>
1021
    </xsl:template>
1085
    </xsl:template>
1022
1086
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +65 lines)
Lines 448-455 Link Here
448
        </xsl:for-each>
448
        </xsl:for-each>
449
        </xsl:if>
449
        </xsl:if>
450
    </a>
450
    </a>
451
    <p>
452
451
452
    <!-- OpenURL -->
453
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
454
    <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
455
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
456
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
457
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
458
459
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
460
      <xsl:variable name="openurltext">
461
        <xsl:choose>
462
          <xsl:when test="$OpenURLText != ''">
463
            <xsl:value-of select="$OpenURLText" />
464
          </xsl:when>
465
          <xsl:otherwise>
466
            <xsl:text>OpenURL</xsl:text>
467
          </xsl:otherwise>
468
        </xsl:choose>
469
      </xsl:variable>
470
471
      <xsl:variable name="openurlimagelocation">
472
        <xsl:choose>
473
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
474
            <xsl:value-of select="$OpenURLImageLocation" />
475
          </xsl:when>
476
          <xsl:when test="$OpenURLImageLocation != ''">
477
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
478
            <xsl:value-of select="$OpenURLImageLocation" />
479
          </xsl:when>
480
        </xsl:choose>
481
      </xsl:variable>
482
483
      <span class="results_summary"><a>
484
        <xsl:attribute name="href">
485
          <xsl:value-of select="$OpenURLResolverURL" />
486
          <xsl:text>?</xsl:text>
487
          <xsl:value-of select="$COinS" />
488
        </xsl:attribute>
489
        <xsl:attribute name="title">
490
          <xsl:value-of select="$openurltext" />
491
        </xsl:attribute>
492
        <xsl:attribute name="class">
493
          <xsl:text>OpenURL</xsl:text>
494
        </xsl:attribute>
495
        <xsl:if test="$OPACURLOpenInNewWindow='1'">
496
          <xsl:attribute name="target">
497
            <xsl:text>_blank</xsl:text>
498
          </xsl:attribute>
499
        </xsl:if>
500
        <xsl:choose>
501
          <xsl:when test="$openurlimagelocation != ''">
502
            <img>
503
              <xsl:attribute name="src">
504
                <xsl:value-of select="$openurlimagelocation" />
505
              </xsl:attribute>
506
            </img>
507
          </xsl:when>
508
          <xsl:otherwise>
509
            <xsl:value-of select="$openurltext" />
510
          </xsl:otherwise>
511
        </xsl:choose>
512
      </a></span>
513
    </xsl:if>
514
    <!-- End of OpenURL -->
515
516
    <p>
453
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
517
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
454
    <xsl:if test="$display880">
518
    <xsl:if test="$display880">
455
      <xsl:call-template name="m880Select">
519
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl (+65 lines)
Lines 442-447 Link Here
442
      </xsl:for-each>
442
      </xsl:for-each>
443
    </span>
443
    </span>
444
  </xsl:if>
444
  </xsl:if>
445
446
  <!-- OpenURL -->
447
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
448
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
449
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
450
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
451
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
452
453
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
454
    <xsl:variable name="openurltext">
455
      <xsl:choose>
456
        <xsl:when test="$OpenURLText != ''">
457
          <xsl:value-of select="$OpenURLText" />
458
        </xsl:when>
459
        <xsl:otherwise>
460
          <xsl:text>OpenURL</xsl:text>
461
        </xsl:otherwise>
462
      </xsl:choose>
463
    </xsl:variable>
464
465
    <xsl:variable name="openurlimagelocation">
466
      <xsl:choose>
467
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
468
          <xsl:value-of select="$OpenURLImageLocation" />
469
        </xsl:when>
470
        <xsl:when test="$OpenURLImageLocation != ''">
471
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
472
          <xsl:value-of select="$OpenURLImageLocation" />
473
        </xsl:when>
474
      </xsl:choose>
475
    </xsl:variable>
476
477
    <span class="results_summary"><a>
478
      <xsl:attribute name="href">
479
        <xsl:value-of select="$OpenURLResolverURL" />
480
        <xsl:text>?</xsl:text>
481
        <xsl:value-of select="$COinS" />
482
      </xsl:attribute>
483
      <xsl:attribute name="title">
484
        <xsl:value-of select="$openurltext" />
485
      </xsl:attribute>
486
      <xsl:attribute name="class">
487
        <xsl:text>OpenURL</xsl:text>
488
      </xsl:attribute>
489
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
490
        <xsl:attribute name="target">
491
          <xsl:text>_blank</xsl:text>
492
        </xsl:attribute>
493
      </xsl:if>
494
      <xsl:choose>
495
        <xsl:when test="$openurlimagelocation != ''">
496
          <img>
497
            <xsl:attribute name="src">
498
              <xsl:value-of select="$openurlimagelocation" />
499
            </xsl:attribute>
500
          </img>
501
        </xsl:when>
502
        <xsl:otherwise>
503
          <xsl:value-of select="$openurltext" />
504
        </xsl:otherwise>
505
      </xsl:choose>
506
    </a></span>
507
  </xsl:if>
508
  <!-- End of OpenURL -->
509
445
</xsl:template>
510
</xsl:template>
446
511
447
    <xsl:template name="nameABCDQ">
512
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl (+64 lines)
Lines 82-87 Link Here
82
    </xsl:for-each>
82
    </xsl:for-each>
83
  </xsl:if>
83
  </xsl:if>
84
84
85
  <!-- OpenURL -->
86
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
87
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
88
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
89
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
90
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
91
92
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
93
    <xsl:variable name="openurltext">
94
      <xsl:choose>
95
        <xsl:when test="$OpenURLText != ''">
96
          <xsl:value-of select="$OpenURLText" />
97
        </xsl:when>
98
        <xsl:otherwise>
99
          <xsl:text>OpenURL</xsl:text>
100
        </xsl:otherwise>
101
      </xsl:choose>
102
    </xsl:variable>
103
104
    <xsl:variable name="openurlimagelocation">
105
      <xsl:choose>
106
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
107
          <xsl:value-of select="$OpenURLImageLocation" />
108
        </xsl:when>
109
        <xsl:when test="$OpenURLImageLocation != ''">
110
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
111
          <xsl:value-of select="$OpenURLImageLocation" />
112
        </xsl:when>
113
      </xsl:choose>
114
    </xsl:variable>
115
116
    <span class="results_summary"><a>
117
      <xsl:attribute name="href">
118
        <xsl:value-of select="$OpenURLResolverURL" />
119
        <xsl:text>?</xsl:text>
120
        <xsl:value-of select="$COinS" />
121
      </xsl:attribute>
122
      <xsl:attribute name="title">
123
        <xsl:value-of select="$openurltext" />
124
      </xsl:attribute>
125
      <xsl:attribute name="class">
126
        <xsl:text>OpenURL</xsl:text>
127
      </xsl:attribute>
128
      <xsl:if test="$OPACURLOpenInNewWindow='1'">
129
        <xsl:attribute name="target">
130
          <xsl:text>_blank</xsl:text>
131
        </xsl:attribute>
132
      </xsl:if>
133
      <xsl:choose>
134
        <xsl:when test="$openurlimagelocation != ''">
135
          <img>
136
            <xsl:attribute name="src">
137
              <xsl:value-of select="$openurlimagelocation" />
138
            </xsl:attribute>
139
          </img>
140
        </xsl:when>
141
        <xsl:otherwise>
142
          <xsl:value-of select="$openurltext" />
143
        </xsl:otherwise>
144
      </xsl:choose>
145
    </a></span>
146
  </xsl:if>
147
  <!-- End of OpenURL -->
148
85
  <xsl:call-template name="tag_title">
149
  <xsl:call-template name="tag_title">
86
    <xsl:with-param name="tag">454</xsl:with-param>
150
    <xsl:with-param name="tag">454</xsl:with-param>
87
    <xsl:with-param name="label">Translation of</xsl:with-param>
151
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/koha-tmpl/opac-tmpl/bootstrap/less/opac.less (+4 lines)
Lines 2464-2467 a.reviewlink:visited { Link Here
2464
    padding-left:20px;
2464
    padding-left:20px;
2465
}
2465
}
2466
2466
2467
a.OpenURL img {
2468
    vertical-align: middle;
2469
}
2470
2467
@import "responsive.less";
2471
@import "responsive.less";
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1133-1136 $template->param( Link Here
1133
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1133
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1134
);
1134
);
1135
1135
1136
# OpenURL
1137
if (C4::Context->preference('OPACShowOpenURL')) {
1138
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1139
    my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
1140
    if (grep /^$biblio->{itemtype}$/, @itypes) {
1141
        $template->param(
1142
            OPACShowOpenURL => 1,
1143
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1144
            OpenURLText => C4::Context->preference('OpenURLText'),
1145
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1146
        );
1147
    }
1148
}
1149
1136
output_html_with_http_headers $query, $cookie, $template->output;
1150
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 519-524 if (C4::Context->preference('OpacSuppression')) { Link Here
519
    }
519
    }
520
}
520
}
521
521
522
# OpenURL
523
my @OpenURL_itypes;
524
if (C4::Context->preference('OPACShowOpenURL')) {
525
    @OpenURL_itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') );
526
    $template->param(
527
        OPACShowOpenURL => 1,
528
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
529
        OpenURLText => C4::Context->preference('OpenURLText'),
530
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
531
    );
532
}
533
522
$template->param ( LIMIT_INPUTS => \@limit_inputs );
534
$template->param ( LIMIT_INPUTS => \@limit_inputs );
523
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
535
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
524
536
Lines 601-607 for (my $i=0;$i<@servers;$i++) { Link Here
601
                $res->{'incart'} = 1;
613
                $res->{'incart'} = 1;
602
            }
614
            }
603
615
604
            if (C4::Context->preference('COinSinOPACResults')) {
616
            if (C4::Context->preference('COinSinOPACResults')
617
            or C4::Context->preference('OPACShowOpenURL')) {
618
                if (grep /^$res->{itemtype}$/, @OpenURL_itypes) {
619
                    $res->{ShowOpenURL} = 1;
620
                }
605
                my $record = GetMarcBiblio($res->{'biblionumber'});
621
                my $record = GetMarcBiblio($res->{'biblionumber'});
606
                $res->{coins} = GetCOinSBiblio($record);
622
                $res->{coins} = GetCOinSBiblio($record);
607
            }
623
            }
608
- 

Return to bug 8995