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 1329-1373 sub GetCOinSBiblio { Link Here
1329
        carp 'GetCOinSBiblio called with undefined record';
1330
        carp 'GetCOinSBiblio called with undefined record';
1330
        return;
1331
        return;
1331
    }
1332
    }
1333
1332
    my $pos7 = substr $record->leader(), 7, 1;
1334
    my $pos7 = substr $record->leader(), 7, 1;
1333
    my $pos6 = substr $record->leader(), 6, 1;
1335
    my $pos6 = substr $record->leader(), 6, 1;
1334
    my $mtx;
1336
    my $mtx;
1335
    my $genre;
1337
    my $genre;
1336
    my ( $aulast, $aufirst ) = ( '', '' );
1338
    my ( $aulast, $aufirst ) = ( '', '' );
1337
    my $oauthors  = '';
1339
    my @authors;
1338
    my $title     = '';
1340
    my $title;
1339
    my $subtitle  = '';
1341
    my $hosttitle;
1340
    my $pubyear   = '';
1342
    my $pubyear   = '';
1341
    my $isbn      = '';
1343
    my $isbn      = '';
1342
    my $issn      = '';
1344
    my $issn      = '';
1343
    my $publisher = '';
1345
    my $publisher = '';
1344
    my $pages     = '';
1346
    my $pages     = '';
1345
    my $titletype = 'b';
1347
    my $titletype = '';
1346
1348
1347
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1349
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1348
    # considered the same for UNIMARC and MARC21
1350
    # considered the same for UNIMARC and MARC21
1349
    my $fmts6;
1351
    my $fmts6 = {
1350
    my $fmts7;
1352
        'a' => 'book',
1351
    %$fmts6 = (
1353
        'b' => 'manuscript',
1352
                'a' => 'book',
1354
        'c' => 'book',
1353
                'b' => 'manuscript',
1355
        'd' => 'manuscript',
1354
                'c' => 'book',
1356
        'e' => 'map',
1355
                'd' => 'manuscript',
1357
        'f' => 'map',
1356
                'e' => 'map',
1358
        'g' => 'film',
1357
                'f' => 'map',
1359
        'i' => 'audioRecording',
1358
                'g' => 'film',
1360
        'j' => 'audioRecording',
1359
                'i' => 'audioRecording',
1361
        'k' => 'artwork',
1360
                'j' => 'audioRecording',
1362
        'l' => 'document',
1361
                'k' => 'artwork',
1363
        'm' => 'computerProgram',
1362
                'l' => 'document',
1364
        'o' => 'document',
1363
                'm' => 'computerProgram',
1365
        'r' => 'document',
1364
                'o' => 'document',
1366
    };
1365
                'r' => 'document',
1367
    my $fmts7 = {
1366
            );
1368
        'a' => 'journalArticle',
1367
    %$fmts7 = (
1369
        's' => 'journal',
1368
                    'a' => 'journalArticle',
1370
    };
1369
                    's' => 'journal',
1370
              );
1371
1371
1372
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1372
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1373
1373
Lines 1378-1383 sub GetCOinSBiblio { Link Here
1378
    ##### We must transform mtx to a valable mtx and document type ####
1378
    ##### We must transform mtx to a valable mtx and document type ####
1379
    if ( $genre eq 'book' ) {
1379
    if ( $genre eq 'book' ) {
1380
            $mtx = 'book';
1380
            $mtx = 'book';
1381
            $titletype = 'b';
1381
    } elsif ( $genre eq 'journal' ) {
1382
    } elsif ( $genre eq 'journal' ) {
1382
            $mtx = 'journal';
1383
            $mtx = 'journal';
1383
            $titletype = 'j';
1384
            $titletype = 'j';
Lines 1389-1414 sub GetCOinSBiblio { Link Here
1389
            $mtx = 'dc';
1390
            $mtx = 'dc';
1390
    }
1391
    }
1391
1392
1392
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1393
1394
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1393
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1395
1394
1396
        # Setting datas
1395
        # Setting datas
1397
        $aulast  = $record->subfield( '700', 'a' ) || '';
1396
        $aulast  = $record->subfield( '700', 'a' ) || '';
1398
        $aufirst = $record->subfield( '700', 'b' ) || '';
1397
        $aufirst = $record->subfield( '700', 'b' ) || '';
1399
        $oauthors = "&rft.au=$aufirst $aulast";
1398
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1400
1399
1401
        # others authors
1400
        # others authors
1402
        if ( $record->field('200') ) {
1401
        if ( $record->field('200') ) {
1403
            for my $au ( $record->field('200')->subfield('g') ) {
1402
            for my $au ( $record->field('200')->subfield('g') ) {
1404
                $oauthors .= "&rft.au=$au";
1403
                push @authors, $au;
1405
            }
1404
            }
1406
        }
1405
        }
1407
        $title =
1406
1408
          ( $mtx eq 'dc' )
1407
        $title     = $record->subfield( '200', 'a' );
1409
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1408
        my $subfield_210d = $record->subfield('210', 'd');
1410
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1409
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1411
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1410
            $pubyear = $1;
1411
        }
1412
        $publisher = $record->subfield( '210', 'c' ) || '';
1412
        $publisher = $record->subfield( '210', 'c' ) || '';
1413
        $isbn      = $record->subfield( '010', 'a' ) || '';
1413
        $isbn      = $record->subfield( '010', 'a' ) || '';
1414
        $issn      = $record->subfield( '011', 'a' ) || '';
1414
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1418-1451 sub GetCOinSBiblio { Link Here
1418
1418
1419
        # Setting datas
1419
        # Setting datas
1420
        if ( $record->field('100') ) {
1420
        if ( $record->field('100') ) {
1421
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1421
            push @authors, $record->subfield( '100', 'a' );
1422
        }
1422
        }
1423
1423
1424
        # others authors
1424
        # others authors
1425
        if ( $record->field('700') ) {
1425
        if ( $record->field('700') ) {
1426
            for my $au ( $record->field('700')->subfield('a') ) {
1426
            for my $au ( $record->field('700')->subfield('a') ) {
1427
                $oauthors .= "&rft.au=$au";
1427
                push @authors, $au;
1428
            }
1428
            }
1429
        }
1429
        }
1430
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1430
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1431
        $subtitle = $record->subfield( '245', 'b' ) || '';
1432
        $title .= $subtitle;
1433
        if ($titletype eq 'a') {
1431
        if ($titletype eq 'a') {
1434
            $pubyear   = $record->field('008') || '';
1432
            $pubyear   = $record->field('008') || '';
1435
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1433
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1436
            $isbn      = $record->subfield( '773', 'z' ) || '';
1434
            $isbn      = $record->subfield( '773', 'z' ) || '';
1437
            $issn      = $record->subfield( '773', 'x' ) || '';
1435
            $issn      = $record->subfield( '773', 'x' ) || '';
1438
            if ($mtx eq 'journal') {
1436
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1439
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1437
            my @rels = $record->subfield( '773', 'g' );
1440
            } else {
1438
            $pages = join(', ', @rels);
1441
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1442
            }
1443
            foreach my $rel ($record->subfield( '773', 'g' )) {
1444
                if ($pages) {
1445
                    $pages .= ', ';
1446
                }
1447
                $pages .= $rel;
1448
            }
1449
        } else {
1439
        } else {
1450
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1440
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1451
            $publisher = $record->subfield( '260', 'b' ) || '';
1441
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1454-1465 sub GetCOinSBiblio { Link Here
1454
        }
1444
        }
1455
1445
1456
    }
1446
    }
1457
    my $coins_value =
1458
"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";
1459
    $coins_value =~ s/(\ |&[^a])/\+/g;
1460
    $coins_value =~ s/\"/\&quot\;/g;
1461
1447
1462
#<!-- 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="
1448
    my @params = (
1449
        [ 'ctx_ver', 'Z39.88-2004' ],
1450
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1451
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1452
        [ "rft.${titletype}title", $title ],
1453
    );
1454
1455
    # rft.title is authorized only once, so by checking $titletype
1456
    # we ensure that rft.title is not already in the list.
1457
    if ($hosttitle and $titletype) {
1458
        push @params, [ 'rft.title', $hosttitle ];
1459
    }
1460
1461
    push @params, (
1462
        [ 'rft.isbn', $isbn ],
1463
        [ 'rft.issn', $issn ],
1464
    );
1465
1466
    # If it's a subscription, these informations have no meaning.
1467
    if ($genre ne 'journal') {
1468
        push @params, (
1469
            [ 'rft.aulast', $aulast ],
1470
            [ 'rft.aufirst', $aufirst ],
1471
            (map { [ 'rft.au', $_ ] } @authors),
1472
            [ 'rft.pub', $publisher ],
1473
            [ 'rft.date', $pubyear ],
1474
            [ 'rft.pages', $pages ],
1475
        );
1476
    }
1477
1478
    my $coins_value = join( '&amp;',
1479
        map { $$_[1] ? $$_[0] . '=' . uri_escape( $$_[1] ) : () } @params );
1463
1480
1464
    return $coins_value;
1481
    return $coins_value;
1465
}
1482
}
(-)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 / )
209
                              TrackClicks
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('OPACHideOpenURLForItemTypes') );
223
        if (not 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 445-448 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
445
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
445
('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
446
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
446
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
447
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
447
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
448
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free')
449
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
450
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
451
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
452
('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free')
448
;
453
;
(-)a/installer/data/mysql/updatedatabase.pl (+27 lines)
Lines 8560-8565 if ( CheckVersion($DBversion) ) { Link Here
8560
    SetVersion($DBversion);
8560
    SetVersion($DBversion);
8561
}
8561
}
8562
8562
8563
$DBversion = "3.17.00.XXX";
8564
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
8565
    $dbh->do("
8566
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8567
        VALUES('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free')
8568
    ");
8569
    $dbh->do("
8570
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8571
        VALUES('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free');
8572
    ");
8573
    $dbh->do("
8574
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8575
        VALUES('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free');
8576
    ");
8577
    $dbh->do("
8578
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8579
        VALUES('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo');
8580
    ");
8581
    $dbh->do("
8582
        INSERT INTO systempreferences (variable,value,explanation,options,type)
8583
        VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free');
8584
    ");
8585
    print "Upgrade to $DBversion done (Bug 8995 - Add sysprefs for OpenURL)\n";
8586
    SetVersion($DBversion);
8587
}
8588
8589
8563
=head1 FUNCTIONS
8590
=head1 FUNCTIONS
8564
8591
8565
=head2 TableExists($table)
8592
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+28 lines)
Lines 316-321 OPAC: Link Here
316
            - pref: NoLoginInstructions
316
            - pref: NoLoginInstructions
317
              type: textarea
317
              type: textarea
318
              class: code
318
              class: code
319
320
        -
321
            - 'Complete URL of OpenURL resolver (starting with <tt>http://</tt> or <tt>https://</tt>):'
322
            - pref: OpenURLResolverURL
323
              class: url
324
        -
325
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
326
            - pref: OpenURLText
327
        -
328
            - 'Location of image for OpenURL links:'
329
            - pref: OpenURLImageLocation
330
              class: url
331
            - '<br />Can be a complete URL starting with <tt>http://</tt> or'
332
            - '<tt>https://</tt> or the name of a file in <tt>images</tt> directory'
333
            - '<br />Examples:'
334
            - '<br />- <tt>http://www.example.com/img/openurl.png</tt>'
335
            - '<br />- <tt>OpenURL/OpenURL.png</tt> (file is in <tt>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</tt>)'
336
        -
337
            - pref: OPACShowOpenURL
338
              choices:
339
                  yes: Enable
340
                  no: Disable
341
            - 'display of OpenURL link in OPAC search results and detail page.'
342
        -
343
            - 'List of item type codes (separated by spaces) for those you do not want to show the OpenURL link:'
344
            - pref: OPACHideOpenURLForItemTypes
345
            - '<br />'
346
            - '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:
347
    Features:
320
        -
348
        -
321
            - pref: opacuserlogin
349
            - pref: opacuserlogin
(-)a/koha-tmpl/opac-tmpl/prog/en/css/opac.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 3078-3080 padding: 0.1em 0; Link Here
3078
    width: 35%;
3077
    width: 35%;
3079
    font-size: 111%;
3078
    font-size: 111%;
3080
}
3079
}
3080
3081
a.OpenURL img {
3082
    vertical-align: middle;
3083
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+22 lines)
Lines 790-795 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
790
            [% END %]</ul>
790
            [% END %]</ul>
791
    </div>
791
    </div>
792
    [% END %]
792
    [% END %]
793
794
    [% IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
795
        [%# Build OpenURL image location %]
796
        [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
797
            [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
798
        [% ELSE %]
799
            [% openurlimagelocation = "$OpenURLImageLocation" %]
800
        [% END %]
801
802
        <span class="results_summary">
803
            <a class="OpenURL" href="[% OpenURLResolverURL %]?[% ocoins %]" title="[% OpenURLText %]">
804
            [% IF openurlimagelocation %]
805
                <img src="[% openurlimagelocation %]" />
806
            [% ELSIF OpenURLText %]
807
                [% OpenURLText %]
808
            [% ELSE %]
809
                OpenURL
810
            [% END %]
811
            </a>
812
        </span>
813
    [% END %]
814
793
[% END %]
815
[% END %]
794
        [% IF ( AuthorisedValueImages ) %]
816
        [% IF ( AuthorisedValueImages ) %]
795
        [% IF ( authorised_value_images ) %]
817
        [% IF ( authorised_value_images ) %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt (+18 lines)
Lines 485-490 $(document).ready(function(){ Link Here
485
        </div>
485
        </div>
486
486
487
        </td></tr>
487
        </td></tr>
488
            [%# Build OpenURL image location %]
489
            [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
490
                [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
491
            [% ELSE %]
492
                [% openurlimagelocation = "$OpenURLImageLocation" %]
493
            [% END %]
494
488
            <!-- Actual Search Results -->
495
            <!-- Actual Search Results -->
489
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
496
            [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
490
            [% UNLESS ( loop.odd ) %]
497
            [% UNLESS ( loop.odd ) %]
Lines 542-547 $(document).ready(function(){ Link Here
542
                                [% IF ( SEARCH_RESULT.author ) %]by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% SEARCH_RESULT.author |url %]" title="Search for works by this author" class="author">[% SEARCH_RESULT.author %]</a>
549
                                [% IF ( SEARCH_RESULT.author ) %]by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% SEARCH_RESULT.author |url %]" title="Search for works by this author" class="author">[% SEARCH_RESULT.author %]</a>
543
                                [% ELSE %]&nbsp;
550
                                [% ELSE %]&nbsp;
544
                                [% END %]
551
                                [% END %]
552
                [% IF (SEARCH_RESULT.ShowOpenURL && OpenURLResolverURL && SEARCH_RESULT.coins) %]
553
                    <a class="OpenURL" href="[% OpenURLResolverURL %]?[% SEARCH_RESULT.coins %]" title="[% OpenURLText %]">
554
                    [% IF openurlimagelocation %]
555
                        <img src="[% openurlimagelocation %]" />
556
                    [% ELSIF OpenURLText %]
557
                        [% OpenURLText %]
558
                    [% ELSE %]
559
                        OpenURL
560
                    [% END %]
561
                    </a>
562
                [% END %]
545
                <span class="results_summary publisher"><span class="label">Publication:</span>
563
                <span class="results_summary publisher"><span class="label">Publication:</span>
546
                        [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode|html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear %]
564
                        [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode|html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear %]
547
                    [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate %][% END %][% END %]
565
                    [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate %][% END %][% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl (+59 lines)
Lines 982-987 Link Here
982
        </xsl:for-each>
982
        </xsl:for-each>
983
        </xsl:if>
983
        </xsl:if>
984
984
985
        <!-- OpenURL -->
986
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
987
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
988
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
989
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
990
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
991
992
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
993
          <xsl:variable name="openurltext">
994
            <xsl:choose>
995
              <xsl:when test="$OpenURLText != ''">
996
                <xsl:value-of select="$OpenURLText" />
997
              </xsl:when>
998
              <xsl:otherwise>
999
                <xsl:text>OpenURL</xsl:text>
1000
              </xsl:otherwise>
1001
            </xsl:choose>
1002
          </xsl:variable>
1003
1004
          <xsl:variable name="openurlimagelocation">
1005
            <xsl:choose>
1006
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1007
                <xsl:value-of select="$OpenURLImageLocation" />
1008
              </xsl:when>
1009
              <xsl:when test="$OpenURLImageLocation != ''">
1010
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1011
                <xsl:value-of select="$OpenURLImageLocation" />
1012
              </xsl:when>
1013
            </xsl:choose>
1014
          </xsl:variable>
1015
1016
          <span class="results_summary"><a>
1017
            <xsl:attribute name="href">
1018
              <xsl:value-of select="$OpenURLResolverURL" />
1019
              <xsl:text>?</xsl:text>
1020
              <xsl:value-of select="$COinS" />
1021
            </xsl:attribute>
1022
            <xsl:attribute name="title">
1023
              <xsl:value-of select="$openurltext" />
1024
            </xsl:attribute>
1025
            <xsl:attribute name="class">
1026
              <xsl:text>OpenURL</xsl:text>
1027
            </xsl:attribute>
1028
            <xsl:choose>
1029
              <xsl:when test="$openurlimagelocation != ''">
1030
                <img>
1031
                  <xsl:attribute name="src">
1032
                    <xsl:value-of select="$openurlimagelocation" />
1033
                  </xsl:attribute>
1034
                </img>
1035
              </xsl:when>
1036
              <xsl:otherwise>
1037
                <xsl:value-of select="$openurltext" />
1038
              </xsl:otherwise>
1039
            </xsl:choose>
1040
          </a></span>
1041
        </xsl:if>
1042
        <!-- End of OpenURL -->
1043
985
    </xsl:element>
1044
    </xsl:element>
986
    </xsl:template>
1045
    </xsl:template>
987
1046
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl (-1 / +60 lines)
Lines 438-445 Link Here
438
        </xsl:for-each>
438
        </xsl:for-each>
439
        </xsl:if>
439
        </xsl:if>
440
    </a>
440
    </a>
441
    <p>
442
441
442
    <!-- OpenURL -->
443
    <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
444
    <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
445
    <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
446
    <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
447
    <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
448
449
    <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
450
      <xsl:variable name="openurltext">
451
        <xsl:choose>
452
          <xsl:when test="$OpenURLText != ''">
453
            <xsl:value-of select="$OpenURLText" />
454
          </xsl:when>
455
          <xsl:otherwise>
456
            <xsl:text>OpenURL</xsl:text>
457
          </xsl:otherwise>
458
        </xsl:choose>
459
      </xsl:variable>
460
461
      <xsl:variable name="openurlimagelocation">
462
        <xsl:choose>
463
          <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
464
            <xsl:value-of select="$OpenURLImageLocation" />
465
          </xsl:when>
466
          <xsl:when test="$OpenURLImageLocation != ''">
467
            <xsl:text>/opac-tmpl/prog/images/</xsl:text>
468
            <xsl:value-of select="$OpenURLImageLocation" />
469
          </xsl:when>
470
        </xsl:choose>
471
      </xsl:variable>
472
473
      &nbsp;<a>
474
        <xsl:attribute name="href">
475
          <xsl:value-of select="$OpenURLResolverURL" />
476
          <xsl:text>?</xsl:text>
477
          <xsl:value-of select="$COinS" />
478
        </xsl:attribute>
479
        <xsl:attribute name="title">
480
          <xsl:value-of select="$openurltext" />
481
        </xsl:attribute>
482
        <xsl:attribute name="class">
483
          <xsl:text>OpenURL</xsl:text>
484
        </xsl:attribute>
485
        <xsl:choose>
486
          <xsl:when test="$openurlimagelocation != ''">
487
            <img>
488
              <xsl:attribute name="src">
489
                <xsl:value-of select="$openurlimagelocation" />
490
              </xsl:attribute>
491
            </img>
492
          </xsl:when>
493
          <xsl:otherwise>
494
            <xsl:value-of select="$openurltext" />
495
          </xsl:otherwise>
496
        </xsl:choose>
497
      </a>
498
    </xsl:if>
499
    <!-- End of OpenURL -->
500
501
    <p>
443
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
502
    <!-- Author Statement: Alternate Graphic Representation (MARC 880) -->
444
    <xsl:if test="$display880">
503
    <xsl:if test="$display880">
445
      <xsl:call-template name="m880Select">
504
      <xsl:call-template name="m880Select">
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACDetail.xsl (+60 lines)
Lines 438-443 Link Here
438
      </xsl:for-each>
438
      </xsl:for-each>
439
    </span>
439
    </span>
440
  </xsl:if>
440
  </xsl:if>
441
442
  <!-- OpenURL -->
443
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
444
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
445
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
446
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
447
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
448
449
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
450
    <xsl:variable name="openurltext">
451
      <xsl:choose>
452
        <xsl:when test="$OpenURLText != ''">
453
          <xsl:value-of select="$OpenURLText" />
454
        </xsl:when>
455
        <xsl:otherwise>
456
          <xsl:text>OpenURL</xsl:text>
457
        </xsl:otherwise>
458
      </xsl:choose>
459
    </xsl:variable>
460
461
    <xsl:variable name="openurlimagelocation">
462
      <xsl:choose>
463
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
464
          <xsl:value-of select="$OpenURLImageLocation" />
465
        </xsl:when>
466
        <xsl:when test="$OpenURLImageLocation != ''">
467
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
468
          <xsl:value-of select="$OpenURLImageLocation" />
469
        </xsl:when>
470
      </xsl:choose>
471
    </xsl:variable>
472
473
    <span class="results_summary"><a>
474
      <xsl:attribute name="href">
475
        <xsl:value-of select="$OpenURLResolverURL" />
476
        <xsl:text>?</xsl:text>
477
        <xsl:value-of select="$COinS" />
478
      </xsl:attribute>
479
      <xsl:attribute name="title">
480
        <xsl:value-of select="$openurltext" />
481
      </xsl:attribute>
482
      <xsl:attribute name="class">
483
        <xsl:text>OpenURL</xsl:text>
484
      </xsl:attribute>
485
      <xsl:choose>
486
        <xsl:when test="$openurlimagelocation != ''">
487
          <img>
488
            <xsl:attribute name="src">
489
              <xsl:value-of select="$openurlimagelocation" />
490
            </xsl:attribute>
491
          </img>
492
        </xsl:when>
493
        <xsl:otherwise>
494
          <xsl:value-of select="$openurltext" />
495
        </xsl:otherwise>
496
      </xsl:choose>
497
    </a></span>
498
  </xsl:if>
499
  <!-- End of OpenURL -->
500
441
</xsl:template>
501
</xsl:template>
442
502
443
    <xsl:template name="nameABCDQ">
503
    <xsl:template name="nameABCDQ">
(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl (+59 lines)
Lines 77-82 Link Here
77
    </xsl:for-each>
77
    </xsl:for-each>
78
  </xsl:if>
78
  </xsl:if>
79
79
80
  <!-- OpenURL -->
81
  <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
82
  <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
83
  <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
84
  <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
85
  <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
86
87
  <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
88
    <xsl:variable name="openurltext">
89
      <xsl:choose>
90
        <xsl:when test="$OpenURLText != ''">
91
          <xsl:value-of select="$OpenURLText" />
92
        </xsl:when>
93
        <xsl:otherwise>
94
          <xsl:text>OpenURL</xsl:text>
95
        </xsl:otherwise>
96
      </xsl:choose>
97
    </xsl:variable>
98
99
    <xsl:variable name="openurlimagelocation">
100
      <xsl:choose>
101
        <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
102
          <xsl:value-of select="$OpenURLImageLocation" />
103
        </xsl:when>
104
        <xsl:when test="$OpenURLImageLocation != ''">
105
          <xsl:text>/opac-tmpl/prog/images/</xsl:text>
106
          <xsl:value-of select="$OpenURLImageLocation" />
107
        </xsl:when>
108
      </xsl:choose>
109
    </xsl:variable>
110
111
    &nbsp;<a>
112
      <xsl:attribute name="href">
113
        <xsl:value-of select="$OpenURLResolverURL" />
114
        <xsl:text>?</xsl:text>
115
        <xsl:value-of select="$COinS" />
116
      </xsl:attribute>
117
      <xsl:attribute name="title">
118
        <xsl:value-of select="$openurltext" />
119
      </xsl:attribute>
120
      <xsl:attribute name="class">
121
        <xsl:text>OpenURL</xsl:text>
122
      </xsl:attribute>
123
      <xsl:choose>
124
        <xsl:when test="$openurlimagelocation != ''">
125
          <img>
126
            <xsl:attribute name="src">
127
              <xsl:value-of select="$openurlimagelocation" />
128
            </xsl:attribute>
129
          </img>
130
        </xsl:when>
131
        <xsl:otherwise>
132
          <xsl:value-of select="$openurltext" />
133
        </xsl:otherwise>
134
      </xsl:choose>
135
    </a>
136
  </xsl:if>
137
  <!-- End of OpenURL -->
138
80
  <xsl:call-template name="tag_title">
139
  <xsl:call-template name="tag_title">
81
    <xsl:with-param name="tag">454</xsl:with-param>
140
    <xsl:with-param name="tag">454</xsl:with-param>
82
    <xsl:with-param name="label">Translation of</xsl:with-param>
141
    <xsl:with-param name="label">Translation of</xsl:with-param>
(-)a/opac/opac-detail.pl (+14 lines)
Lines 1136-1139 $template->param( Link Here
1136
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1136
    'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1137
);
1137
);
1138
1138
1139
# OpenURL
1140
if (C4::Context->preference('OPACShowOpenURL')) {
1141
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1142
    my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
1143
    if (not grep /^$biblio->{itemtype}$/, @itypes) {
1144
        $template->param(
1145
            OPACShowOpenURL => 1,
1146
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1147
            OpenURLText => C4::Context->preference('OpenURLText'),
1148
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1149
        );
1150
    }
1151
}
1152
1139
output_html_with_http_headers $query, $cookie, $template->output;
1153
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 492-497 if (C4::Context->preference('OpacSuppression')) { Link Here
492
    }
492
    }
493
}
493
}
494
494
495
# OpenURL
496
my @OpenURL_itypes_to_hide;
497
if (C4::Context->preference('OPACShowOpenURL')) {
498
    @OpenURL_itypes_to_hide = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
499
    $template->param(
500
        OPACShowOpenURL => 1,
501
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
502
        OpenURLText => C4::Context->preference('OpenURLText'),
503
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
504
    );
505
}
506
495
$template->param ( LIMIT_INPUTS => \@limit_inputs );
507
$template->param ( LIMIT_INPUTS => \@limit_inputs );
496
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
508
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
497
509
Lines 574-580 for (my $i=0;$i<@servers;$i++) { Link Here
574
                $res->{'incart'} = 1;
586
                $res->{'incart'} = 1;
575
            }
587
            }
576
588
577
            if (C4::Context->preference('COinSinOPACResults')) {
589
            if (C4::Context->preference('COinSinOPACResults')
590
            or C4::Context->preference('OPACShowOpenURL')) {
591
                if (not grep /^$res->{itemtype}$/, @OpenURL_itypes_to_hide) {
592
                    $res->{ShowOpenURL} = 1;
593
                }
578
                my $record = GetMarcBiblio($res->{'biblionumber'});
594
                my $record = GetMarcBiblio($res->{'biblionumber'});
579
                $res->{coins} = GetCOinSBiblio($record);
595
                $res->{coins} = GetCOinSBiblio($record);
580
            }
596
            }
581
- 

Return to bug 8995