&GetMarcBiblio
&GetMarcAuthors
&GetMarcSeries
+ GetMarcUrls
&GetUsedMarcStructure
&GetItemsInfo
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
<!-- 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" -->
<!-- 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" -->
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, );