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 (-3 / +19 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 207-220 sub XSLTParse4Display { Link Here
207
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
207
                              UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
208
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
208
                              singleBranchMode OPACItemLocation DisplayIconsXSLT
209
                              AlternateHoldingsField AlternateHoldingsSeparator
209
                              AlternateHoldingsField AlternateHoldingsSeparator
210
                              TrackClicks / )
210
                              TrackClicks
211
                              OPACShowOpenURL OpenURLResolverURL
212
                              OpenURLImageLocation OpenURLText / )
211
    {
213
    {
212
        my $sp = C4::Context->preference( $syspref );
214
        my $sp = C4::Context->preference( $syspref );
213
        next unless defined($sp);
215
        next unless defined($sp);
214
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
216
        $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n";
215
    }
217
    }
216
    $sysxml .= "</sysprefs>\n";
218
    $sysxml .= "</sysprefs>\n";
217
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml\<\/record\>/;
219
220
    $variables ||= {};
221
    if (C4::Context->preference('OPACShowOpenURL')) {
222
        my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
223
        my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
224
        if (not grep /^$biblio->{itemtype}$/, @itypes) {
225
            $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record);
226
        }
227
    }
228
    my $varxml = "<variables>\n";
229
    while (my ($key, $value) = each %$variables) {
230
        $varxml .= "<variable name=\"$key\">$value</variable>\n";
231
    }
232
    $varxml .= "</variables>\n";
233
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
218
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
234
    if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs
219
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
235
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
220
    }
236
    }
(-)a/installer/data/mysql/sysprefs.sql (+5 lines)
Lines 425-428 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
425
('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'),
425
('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'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
426
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
427
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
428
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free')
429
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
430
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
431
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
432
('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free')
428
;
433
;
(-)a/installer/data/mysql/updatedatabase.pl (+27 lines)
Lines 7843-7848 if(CheckVersion($DBversion)) { Link Here
7843
    SetVersion($DBversion);
7843
    SetVersion($DBversion);
7844
}
7844
}
7845
7845
7846
$DBversion = "XXX";
7847
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7848
    $dbh->do("
7849
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7850
        VALUES('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free')
7851
    ");
7852
    $dbh->do("
7853
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7854
        VALUES('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free');
7855
    ");
7856
    $dbh->do("
7857
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7858
        VALUES('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free');
7859
    ");
7860
    $dbh->do("
7861
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7862
        VALUES('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo');
7863
    ");
7864
    $dbh->do("
7865
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7866
        VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free');
7867
    ");
7868
    print "Upgrade to $DBversion done (Add sysprefs for OpenURL)\n";
7869
    SetVersion($DBversion);
7870
}
7871
7872
7846
=head1 FUNCTIONS
7873
=head1 FUNCTIONS
7847
7874
7848
=head2 TableExists($table)
7875
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+27 lines)
Lines 280-285 OPAC: Link Here
280
                homebranch: 'home library'
280
                homebranch: 'home library'
281
                holdingbranch: 'holding library'
281
                holdingbranch: 'holding library'
282
            - "is the logged in user's library. The second tab will contain all other items."
282
            - "is the logged in user's library. The second tab will contain all other items."
283
        -
284
            - 'Complete URL of OpenURL resolver (starting with <tt>http://</tt> or <tt>https://</tt>):'
285
            - pref: OpenURLResolverURL
286
              class: url
287
        -
288
            - 'Text of OpenURL links (or image title if OpenURLImageLocation is defined):'
289
            - pref: OpenURLText
290
        -
291
            - 'Location of image for OpenURL links:'
292
            - pref: OpenURLImageLocation
293
              class: url
294
            - '<br />Can be a complete URL starting with <tt>http://</tt> or'
295
            - '<tt>https://</tt> or the name of a file in <tt>images</tt> directory'
296
            - '<br />Examples:'
297
            - '<br />- <tt>http://www.example.com/img/openurl.png</tt>'
298
            - '<br />- <tt>OpenURL/OpenURL.png</tt> (file is in <tt>opac-tmpl/&lt;opacthemes&gt;/images/OpenURL/OpenURL.png</tt>)'
299
        -
300
            - pref: OPACShowOpenURL
301
              choices:
302
                  yes: Enable
303
                  no: Disable
304
            - 'display of OpenURL link in OPAC search results and detail page.'
305
        -
306
            - 'List of item type codes (separated by spaces) for those you do not want to show the OpenURL link:'
307
            - pref: OPACHideOpenURLForItemTypes
308
            - '<br />'
309
            - '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.'
283
    Features:
310
    Features:
284
        -
311
        -
285
            - pref: opacuserlogin
312
            - 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 3080-3082 padding: 0.1em 0; Link Here
3080
.copiesrow {
3079
.copiesrow {
3081
    clear : both;
3080
    clear : both;
3082
}
3081
}
3082
3083
a.OpenURL img {
3084
    vertical-align: middle;
3085
}
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+22 lines)
Lines 768-773 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
768
            [% END %]</ul>
768
            [% END %]</ul>
769
    </div>
769
    </div>
770
    [% END %]
770
    [% END %]
771
772
    [% IF (OPACShowOpenURL && OpenURLResolverURL && ocoins) %]
773
        [%# Build OpenURL image location %]
774
        [% IF (OpenURLImageLocation && !OpenURLImageLocation.match('^https?://')) %]
775
            [% openurlimagelocation = "$interface/$theme/images/$OpenURLImageLocation" %]
776
        [% ELSE %]
777
            [% openurlimagelocation = "$OpenURLImageLocation" %]
778
        [% END %]
779
780
        <span class="results_summary">
781
            <a class="OpenURL" href="[% OpenURLResolverURL %]?[% ocoins %]" title="[% OpenURLText %]">
782
            [% IF openurlimagelocation %]
783
                <img src="[% openurlimagelocation %]" />
784
            [% ELSIF OpenURLText %]
785
                [% OpenURLText %]
786
            [% ELSE %]
787
                OpenURL
788
            [% END %]
789
            </a>
790
        </span>
791
    [% END %]
792
771
[% END %]
793
[% END %]
772
        [% IF ( AuthorisedValueImages ) %]
794
        [% IF ( AuthorisedValueImages ) %]
773
        [% IF ( authorised_value_images ) %]
795
        [% 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 981-986 Link Here
981
        </xsl:for-each>
981
        </xsl:for-each>
982
        </xsl:if>
982
        </xsl:if>
983
983
984
        <!-- OpenURL -->
985
        <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" />
986
        <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" />
987
        <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" />
988
        <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" />
989
        <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" />
990
991
        <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''">
992
          <xsl:variable name="openurltext">
993
            <xsl:choose>
994
              <xsl:when test="$OpenURLText != ''">
995
                <xsl:value-of select="$OpenURLText" />
996
              </xsl:when>
997
              <xsl:otherwise>
998
                <xsl:text>OpenURL</xsl:text>
999
              </xsl:otherwise>
1000
            </xsl:choose>
1001
          </xsl:variable>
1002
1003
          <xsl:variable name="openurlimagelocation">
1004
            <xsl:choose>
1005
              <xsl:when test="starts-with($OpenURLImageLocation, 'http://') or starts-with($OpenURLImageLocation, 'https://')">
1006
                <xsl:value-of select="$OpenURLImageLocation" />
1007
              </xsl:when>
1008
              <xsl:when test="$OpenURLImageLocation != ''">
1009
                <xsl:text>/opac-tmpl/prog/images/</xsl:text>
1010
                <xsl:value-of select="$OpenURLImageLocation" />
1011
              </xsl:when>
1012
            </xsl:choose>
1013
          </xsl:variable>
1014
1015
          <span class="results_summary"><a>
1016
            <xsl:attribute name="href">
1017
              <xsl:value-of select="$OpenURLResolverURL" />
1018
              <xsl:text>?</xsl:text>
1019
              <xsl:value-of select="$COinS" />
1020
            </xsl:attribute>
1021
            <xsl:attribute name="title">
1022
              <xsl:value-of select="$openurltext" />
1023
            </xsl:attribute>
1024
            <xsl:attribute name="class">
1025
              <xsl:text>OpenURL</xsl:text>
1026
            </xsl:attribute>
1027
            <xsl:choose>
1028
              <xsl:when test="$openurlimagelocation != ''">
1029
                <img>
1030
                  <xsl:attribute name="src">
1031
                    <xsl:value-of select="$openurlimagelocation" />
1032
                  </xsl:attribute>
1033
                </img>
1034
              </xsl:when>
1035
              <xsl:otherwise>
1036
                <xsl:value-of select="$openurltext" />
1037
              </xsl:otherwise>
1038
            </xsl:choose>
1039
          </a></span>
1040
        </xsl:if>
1041
        <!-- End of OpenURL -->
1042
984
    </xsl:element>
1043
    </xsl:element>
985
    </xsl:template>
1044
    </xsl:template>
986
1045
(-)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 1069-1072 if ( C4::Context->preference('UseCourseReserves') ) { Link Here
1069
    }
1069
    }
1070
}
1070
}
1071
1071
1072
# OpenURL
1073
if (C4::Context->preference('OPACShowOpenURL')) {
1074
    my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber);
1075
    my @itypes = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
1076
    if (not grep /^$biblio->{itemtype}$/, @itypes) {
1077
        $template->param(
1078
            OPACShowOpenURL => 1,
1079
            OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
1080
            OpenURLText => C4::Context->preference('OpenURLText'),
1081
            OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
1082
        );
1083
    }
1084
}
1085
1072
output_html_with_http_headers $query, $cookie, $template->output;
1086
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-search.pl (-2 / +17 lines)
Lines 486-491 if (C4::Context->preference('OpacSuppression')) { Link Here
486
    }
486
    }
487
}
487
}
488
488
489
# OpenURL
490
my @OpenURL_itypes_to_hide;
491
if (C4::Context->preference('OPACShowOpenURL')) {
492
    @OpenURL_itypes_to_hide = split( /\s/, C4::Context->preference('OPACHideOpenURLForItemTypes') );
493
    $template->param(
494
        OPACShowOpenURL => 1,
495
        OpenURLResolverURL => C4::Context->preference('OpenURLResolverURL'),
496
        OpenURLText => C4::Context->preference('OpenURLText'),
497
        OpenURLImageLocation => C4::Context->preference('OpenURLImageLocation')
498
    );
499
}
500
489
$template->param ( LIMIT_INPUTS => \@limit_inputs );
501
$template->param ( LIMIT_INPUTS => \@limit_inputs );
490
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
502
$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
491
503
Lines 567-573 for (my $i=0;$i<@servers;$i++) { Link Here
567
                $res->{'incart'} = 1;
579
                $res->{'incart'} = 1;
568
            }
580
            }
569
581
570
            if (C4::Context->preference('COinSinOPACResults')) {
582
            if (C4::Context->preference('COinSinOPACResults')
583
            or C4::Context->preference('OPACShowOpenURL')) {
584
                if (not grep /^$res->{itemtype}$/, @OpenURL_itypes_to_hide) {
585
                    $res->{ShowOpenURL} = 1;
586
                }
571
                my $record = GetMarcBiblio($res->{'biblionumber'});
587
                my $record = GetMarcBiblio($res->{'biblionumber'});
572
                $res->{coins} = GetCOinSBiblio($record);
588
                $res->{coins} = GetCOinSBiblio($record);
573
            }
589
            }
574
- 

Return to bug 8995