adding GetMarcUrls() fcn to display 856's - adding also output to opac-detail.
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
c3e0cf6b42
commit
1c2adfe7ff
42
C4/Biblio.pm
42
C4/Biblio.pm
|
|
@ -65,6 +65,7 @@ push @EXPORT, qw(
|
|||
&GetMarcBiblio
|
||||
&GetMarcAuthors
|
||||
&GetMarcSeries
|
||||
GetMarcUrls
|
||||
&GetUsedMarcStructure
|
||||
|
||||
&GetItemsInfo
|
||||
|
|
@ -1922,11 +1923,50 @@ sub GetMarcAuthors {
|
|||
return \@marcauthors;
|
||||
}
|
||||
|
||||
=head2 GetMarcUrls
|
||||
|
||||
=over 4
|
||||
|
||||
$marcurls = GetMarcUrls($record,$marcflavour);
|
||||
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
|
||||
Assumes web resources (not uncommon in MARC21 to omit resource type ind)
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetMarcUrls {
|
||||
my ($record, $marcflavour) = @_;
|
||||
my @marcurls;
|
||||
my $marcurl;
|
||||
for my $field ($record->field('856')) {
|
||||
my $url = $field->subfield('u');
|
||||
my @notes;
|
||||
for my $note ( $field->subfield('z')) {
|
||||
push @notes , {note => $note};
|
||||
}
|
||||
$marcurl = { MARCURL => $url,
|
||||
notes => \@notes,
|
||||
};
|
||||
if($marcflavour eq 'MARC21') {
|
||||
my $s3 = $field->subfield('3');
|
||||
my $link = $field->subfield('y');
|
||||
$marcurl->{'linktext'} = $link || $s3 || $url ;;
|
||||
$marcurl->{'part'} = $s3 if($link);
|
||||
$marcurl->{'toc'} = 1 if($s3 =~ /^[Tt]able/) ;
|
||||
} else {
|
||||
$marcurl->{'linktext'} = $url;
|
||||
}
|
||||
push @marcurls, $marcurl;
|
||||
}
|
||||
return \@marcurls;
|
||||
} #end GetMarcUrls
|
||||
|
||||
=head2 GetMarcSeries
|
||||
|
||||
=over 4
|
||||
|
||||
$marcseriessarray = GetMarcSeries($record,$marcflavour);
|
||||
$marcseriesarray = GetMarcSeries($record,$marcflavour);
|
||||
Get all series from the MARC record and returns them in an array.
|
||||
The series are stored in differents places depending on MARC flavour
|
||||
|
||||
|
|
|
|||
|
|
@ -148,13 +148,6 @@
|
|||
<!-- TMPL_IF name="dewey" -->
|
||||
<p><label><b>Dewey:</b></label><!-- TMPL_VAR name="dewey" --></p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF name="URLS" -->
|
||||
<p><label><b>URL: </b></label>
|
||||
<!-- TMPL_LOOP name="URLS" -->
|
||||
<a href="<!-- TMPL_VAR name="url" -->"><!-- TMPL_VAR NAME="url" --></a> |
|
||||
<!-- /TMPL_LOOP -->
|
||||
</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<p><label><b>Item type : </b></label>
|
||||
<!-- TMPL_IF name="description" -->
|
||||
<!-- TMPL_VAR name="description" -->
|
||||
|
|
@ -162,6 +155,19 @@
|
|||
<!-- TMPL_VAR NAME="itemtype" -->
|
||||
<!-- /TMPL_IF -->
|
||||
</p>
|
||||
<!-- TMPL_IF name="MARCURLS" -->
|
||||
<!-- TMPL_IF NAME="count" -->
|
||||
<p><label><b>Online Resources:</b></label>
|
||||
<ul> <!-- TMPL_LOOP name="MARCURLS" -->
|
||||
<li><!-- TMPL_IF NAME="part" --><!-- TMPL_VAR NAME="part" -->
|
||||
<br /><!-- /TMPL_IF -->
|
||||
<!-- here you might do a tmpl_if name="toc" and use greybox or equivalent for table of contents -->
|
||||
<a href="<!-- TMPL_VAR NAME="MARCURL" -->"><!-- TMPL_VAR NAME="linktext" --></a>
|
||||
<!-- TMPL_IF NAME="notes" --><ul><!-- TMPL_LOOP NAME="notes" --><li><!-- TMPL_VAR NAME="note" --></li><!-- /TMPL_LOOP --></ul><!-- /TMPL_IF --></li>
|
||||
<!-- /TMPL_LOOP --></ul>
|
||||
</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
|
||||
<!-- TMPL_IF name="count" -->
|
||||
|
|
|
|||
|
|
@ -99,12 +99,14 @@ $template->param( norequests => $norequests, RequestOnOpac=>$RequestOnOpac );
|
|||
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
|
||||
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
|
||||
my $marcseriesarray = GetMarcSeries($record,$marcflavour);
|
||||
my $marcurlsarray = GetMarcUrls($record,$marcflavour);
|
||||
|
||||
$template->param(
|
||||
MARCNOTES => $marcnotesarray,
|
||||
MARCSUBJCTS => $marcsubjctsarray,
|
||||
MARCAUTHORS => $marcauthorsarray,
|
||||
MARCSERIES => $marcseriesarray
|
||||
MARCSERIES => $marcseriesarray,
|
||||
MARCURLS => $marcurlsarray,
|
||||
);
|
||||
|
||||
my @results = ( $dat, );
|
||||
|
|
|
|||
Loading…
Reference in New Issue