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

(-)a/C4/Biblio.pm (-59 / +74 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 1301-1348 sub GetCOinSBiblio { Link Here
1301
    my $record = shift;
1302
    my $record = shift;
1302
1303
1303
    # get the coin format
1304
    # get the coin format
1304
    if ( ! $record ) {
1305
    return unless ( $record );
1305
	return;
1306
1306
    }
1307
    my $pos7 = substr $record->leader(), 7, 1;
1307
    my $pos7 = substr $record->leader(), 7, 1;
1308
    my $pos6 = substr $record->leader(), 6, 1;
1308
    my $pos6 = substr $record->leader(), 6, 1;
1309
    my $mtx;
1309
    my $mtx;
1310
    my $genre;
1310
    my $genre;
1311
    my ( $aulast, $aufirst ) = ( '', '' );
1311
    my ( $aulast, $aufirst ) = ( '', '' );
1312
    my $oauthors  = '';
1312
    my @authors;
1313
    my $title     = '';
1313
    my $title;
1314
    my $subtitle  = '';
1314
    my $hosttitle;
1315
    my $pubyear   = '';
1315
    my $pubyear   = '';
1316
    my $isbn      = '';
1316
    my $isbn      = '';
1317
    my $issn      = '';
1317
    my $issn      = '';
1318
    my $publisher = '';
1318
    my $publisher = '';
1319
    my $pages     = '';
1319
    my $pages     = '';
1320
    my $titletype = 'b';
1320
    my $titletype = '';
1321
1321
1322
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1322
    # For the purposes of generating COinS metadata, LDR/06-07 can be
1323
    # considered the same for UNIMARC and MARC21
1323
    # considered the same for UNIMARC and MARC21
1324
    my $fmts6;
1324
    my $fmts6 = {
1325
    my $fmts7;
1325
        'a' => 'book',
1326
    %$fmts6 = (
1326
        'b' => 'manuscript',
1327
                'a' => 'book',
1327
        'c' => 'book',
1328
                'b' => 'manuscript',
1328
        'd' => 'manuscript',
1329
                'c' => 'book',
1329
        'e' => 'map',
1330
                'd' => 'manuscript',
1330
        'f' => 'map',
1331
                'e' => 'map',
1331
        'g' => 'film',
1332
                'f' => 'map',
1332
        'i' => 'audioRecording',
1333
                'g' => 'film',
1333
        'j' => 'audioRecording',
1334
                'i' => 'audioRecording',
1334
        'k' => 'artwork',
1335
                'j' => 'audioRecording',
1335
        'l' => 'document',
1336
                'k' => 'artwork',
1336
        'm' => 'computerProgram',
1337
                'l' => 'document',
1337
        'o' => 'document',
1338
                'm' => 'computerProgram',
1338
        'r' => 'document',
1339
                'o' => 'document',
1339
    };
1340
                'r' => 'document',
1340
    my $fmts7 = {
1341
            );
1341
        'a' => 'journalArticle',
1342
    %$fmts7 = (
1342
        's' => 'journal',
1343
                    'a' => 'journalArticle',
1343
    };
1344
                    's' => 'journal',
1345
              );
1346
1344
1347
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1345
    $genre = $fmts6->{$pos6} ? $fmts6->{$pos6} : 'book';
1348
1346
Lines 1353-1358 sub GetCOinSBiblio { Link Here
1353
    ##### We must transform mtx to a valable mtx and document type ####
1351
    ##### We must transform mtx to a valable mtx and document type ####
1354
    if ( $genre eq 'book' ) {
1352
    if ( $genre eq 'book' ) {
1355
            $mtx = 'book';
1353
            $mtx = 'book';
1354
            $titletype = 'b';
1356
    } elsif ( $genre eq 'journal' ) {
1355
    } elsif ( $genre eq 'journal' ) {
1357
            $mtx = 'journal';
1356
            $mtx = 'journal';
1358
            $titletype = 'j';
1357
            $titletype = 'j';
Lines 1364-1389 sub GetCOinSBiblio { Link Here
1364
            $mtx = 'dc';
1363
            $mtx = 'dc';
1365
    }
1364
    }
1366
1365
1367
    $genre = ( $mtx eq 'dc' ) ? "&rft.type=$genre" : "&rft.genre=$genre";
1368
1369
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1366
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1370
1367
1371
        # Setting datas
1368
        # Setting datas
1372
        $aulast  = $record->subfield( '700', 'a' ) || '';
1369
        $aulast  = $record->subfield( '700', 'a' ) || '';
1373
        $aufirst = $record->subfield( '700', 'b' ) || '';
1370
        $aufirst = $record->subfield( '700', 'b' ) || '';
1374
        $oauthors = "&rft.au=$aufirst $aulast";
1371
        push @authors, "$aufirst $aulast" if ($aufirst or $aulast);
1375
1372
1376
        # others authors
1373
        # others authors
1377
        if ( $record->field('200') ) {
1374
        if ( $record->field('200') ) {
1378
            for my $au ( $record->field('200')->subfield('g') ) {
1375
            for my $au ( $record->field('200')->subfield('g') ) {
1379
                $oauthors .= "&rft.au=$au";
1376
                push @authors, $au;
1380
            }
1377
            }
1381
        }
1378
        }
1382
        $title =
1379
1383
          ( $mtx eq 'dc' )
1380
        $title     = $record->subfield( '200', 'a' );
1384
          ? "&rft.title=" . $record->subfield( '200', 'a' )
1381
        my $subfield_210d = $record->subfield('210', 'd');
1385
          : "&rft.title=" . $record->subfield( '200', 'a' ) . "&rft.btitle=" . $record->subfield( '200', 'a' );
1382
        if ($subfield_210d and $subfield_210d =~ /(\d{4})/) {
1386
        $pubyear   = $record->subfield( '210', 'd' ) || '';
1383
            $pubyear = $1;
1384
        }
1387
        $publisher = $record->subfield( '210', 'c' ) || '';
1385
        $publisher = $record->subfield( '210', 'c' ) || '';
1388
        $isbn      = $record->subfield( '010', 'a' ) || '';
1386
        $isbn      = $record->subfield( '010', 'a' ) || '';
1389
        $issn      = $record->subfield( '011', 'a' ) || '';
1387
        $issn      = $record->subfield( '011', 'a' ) || '';
Lines 1393-1426 sub GetCOinSBiblio { Link Here
1393
1391
1394
        # Setting datas
1392
        # Setting datas
1395
        if ( $record->field('100') ) {
1393
        if ( $record->field('100') ) {
1396
            $oauthors .= "&rft.au=" . $record->subfield( '100', 'a' );
1394
            push @authors, $record->subfield( '100', 'a' );
1397
        }
1395
        }
1398
1396
1399
        # others authors
1397
        # others authors
1400
        if ( $record->field('700') ) {
1398
        if ( $record->field('700') ) {
1401
            for my $au ( $record->field('700')->subfield('a') ) {
1399
            for my $au ( $record->field('700')->subfield('a') ) {
1402
                $oauthors .= "&rft.au=$au";
1400
                push @authors, $au;
1403
            }
1401
            }
1404
        }
1402
        }
1405
        $title = "&rft." . $titletype . "title=" . $record->subfield( '245', 'a' );
1403
        $title = $record->subfield( '245', 'a' ) . $record->subfield( '245', 'b' );
1406
        $subtitle = $record->subfield( '245', 'b' ) || '';
1407
        $title .= $subtitle;
1408
        if ($titletype eq 'a') {
1404
        if ($titletype eq 'a') {
1409
            $pubyear   = $record->field('008') || '';
1405
            $pubyear   = $record->field('008') || '';
1410
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1406
            $pubyear   = substr($pubyear->data(), 7, 4) if $pubyear;
1411
            $isbn      = $record->subfield( '773', 'z' ) || '';
1407
            $isbn      = $record->subfield( '773', 'z' ) || '';
1412
            $issn      = $record->subfield( '773', 'x' ) || '';
1408
            $issn      = $record->subfield( '773', 'x' ) || '';
1413
            if ($mtx eq 'journal') {
1409
            $hosttitle = $record->subfield( '773', 't' ) || $record->subfield( '773', 'a');
1414
                $title    .= "&rft.title=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')));
1410
            my @rels = $record->subfield( '773', 'g' );
1415
            } else {
1411
            $pages = join(', ', @rels);
1416
                $title    .= "&rft.btitle=" . (($record->subfield( '773', 't' ) || $record->subfield( '773', 'a')) || '');
1417
            }
1418
            foreach my $rel ($record->subfield( '773', 'g' )) {
1419
                if ($pages) {
1420
                    $pages .= ', ';
1421
                }
1422
                $pages .= $rel;
1423
            }
1424
        } else {
1412
        } else {
1425
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1413
            $pubyear   = $record->subfield( '260', 'c' ) || '';
1426
            $publisher = $record->subfield( '260', 'b' ) || '';
1414
            $publisher = $record->subfield( '260', 'b' ) || '';
Lines 1429-1440 sub GetCOinSBiblio { Link Here
1429
        }
1417
        }
1430
1418
1431
    }
1419
    }
1432
    my $coins_value =
1433
"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";
1434
    $coins_value =~ s/(\ |&[^a])/\+/g;
1435
    $coins_value =~ s/\"/\&quot\;/g;
1436
1420
1437
#<!-- 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="
1421
    my @params = (
1422
        [ 'ctx_ver', 'Z39.88-2004' ],
1423
        [ 'rft_val_fmt', "info:ofi/fmt:kev:mtx:$mtx" ],
1424
        [ ($mtx eq 'dc' ? 'rft.type' : 'rft.genre'), $genre ],
1425
        [ "rft.${titletype}title", $title ],
1426
    );
1427
1428
    # rft.title is authorized only once, so by checking $titletype
1429
    # we ensure that rft.title is not already in the list.
1430
    if ($hosttitle and $titletype) {
1431
        push @params, [ 'rft.title', $hosttitle ];
1432
    }
1433
1434
    push @params, (
1435
        [ 'rft.isbn', $isbn ],
1436
        [ 'rft.issn', $issn ],
1437
    );
1438
1439
    # If it's a subscription, these informations have no meaning.
1440
    if ($genre ne 'journal') {
1441
        push @params, (
1442
            [ 'rft.aulast', $aulast ],
1443
            [ 'rft.aufirst', $aufirst ],
1444
            (map { [ 'rft.au', $_ ] } @authors),
1445
            [ 'rft.pub', $publisher ],
1446
            [ 'rft.date', $pubyear ],
1447
            [ 'rft.pages', $pages ],
1448
        );
1449
    }
1450
1451
    my $coins_value = join( '&amp;',
1452
        map { $$_[1] ? $$_[0] . '=' . uri_escape( $$_[1] ) : () } @params );
1438
1453
1439
    return $coins_value;
1454
    return $coins_value;
1440
}
1455
}
(-)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 423-426 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
423
('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'),
423
('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'),
424
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
424
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
425
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
425
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
426
('OpenURLResolverURL', '', NULL, 'URL of OpenURL Resolver', 'Free')
427
('OpenURLText', '', NULL, 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', 'Free')
428
('OpenURLImageLocation', '', NULL, 'Location of image for OpenURL links', 'Free')
429
('OPACShowOpenURL', '', NULL, 'Enable display of OpenURL links in OPAC search results and detail page', 'YesNo')
430
('OPACHideOpenURLForItemTypes', '', NULL, 'Allow hiding the OpenURL link for some item types', 'Free')
426
;
431
;
(-)a/installer/data/mysql/updatedatabase.pl (+27 lines)
Lines 7743-7748 if(CheckVersion($DBversion)) { Link Here
7743
    SetVersion($DBversion);
7743
    SetVersion($DBversion);
7744
}
7744
}
7745
7745
7746
$DBversion = "XXX";
7747
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7748
    $dbh->do("
7749
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7750
        VALUES('OpenURLResolverURL', '', 'URL of OpenURL Resolver', NULL, 'Free')
7751
    ");
7752
    $dbh->do("
7753
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7754
        VALUES('OpenURLText', '', 'Text of OpenURL links (or image title if OpenURLImageLocation is defined)', NULL, 'Free');
7755
    ");
7756
    $dbh->do("
7757
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7758
        VALUES('OpenURLImageLocation', '', 'Location of image for OpenURL links', NULL, 'Free');
7759
    ");
7760
    $dbh->do("
7761
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7762
        VALUES('OPACShowOpenURL', '', 'Enable display of OpenURL links in OPAC search results and detail page', NULL, 'YesNo');
7763
    ");
7764
    $dbh->do("
7765
        INSERT INTO systempreferences (variable,value,explanation,options,type)
7766
        VALUES('OPACHideOpenURLForItemTypes', '', 'Allow hiding the OpenURL link for some item types', NULL, 'Free');
7767
    ");
7768
    print "Upgrade to $DBversion done (Add sysprefs for OpenURL)\n";
7769
    SetVersion($DBversion);
7770
}
7771
7772
7746
=head1 FUNCTIONS
7773
=head1 FUNCTIONS
7747
7774
7748
=head2 TableExists($table)
7775
=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