[Koha-devel] Pretty OPAC biblio record : patch

Rob Levandowski robl at macwhiz.com
Wed Aug 7 20:02:02 CEST 2002


When I started playing around with Koha 1.2.2, I found that the biblio 
record display in the OPAC catalogue search detail wasn't pretty or 
functional enough for me.

Below are diffs for the changes I made to detail.pl.  They make the 
following changes:

* the Author becomes a link to search.pl with the appropriate argument.
* the Additional Author field becomes an unordered list, with each name 
as a link to search.pl.  A substitution removes any trailing qualifiers 
commonly used by the Library of Congress for motion picture 
authorship -- that is, if "BROOKS, MEL, DIRECTION, PRODUCTION, CAST" is 
an additional author on a movie, the titles are removed so the search is 
for "BROOKS, MEL."
* the Subject field becomes an ordered list, with each subject as a link 
to search.pl.  I'll probably modify this some more to recognize " -- " 
and the em dash (%97) as hierarchical separators, and divide up the 
link, so that "PROGRAMMING -- LANGUAGES" has two links: the word 
"programming" as a search for that word, and the word "languages" as a 
search for "programming -- languages."

These diffs are against the version in intranet-cgi.  That version can, 
of course, be used in the opac-cgi location too.


10a11
 > use URI::Escape;
120a122,146
 >  }
 >  if ($dat->{'author'} ne ''){
 >   print "<B>Author:</B> <A HREF=\"search.pl?author=";
 >   my $autlink=$dat->{'author'};
 >   $autlink =~ s/(, DIRECTION|, WRITING|, CAST|, PRODUCTION)//ig;
 >   my $htautlink = uri_escape($autlink);
 >   print "$htautlink\&type=opac\">$dat->{'author'}</A><BR>";
 >  }
 >  #Additional Author: <br>
 >  if ($additional ne ''){
 >   my $adstr = $additional;
 >   my @adar = split /\s*\|/, $adstr;
 >   print "<B>Additional Author";
 >   if(scalar @adar > 1){ print "s"; }
 >   print ": </B><UL>";
 >   my $autitem;
 >   foreach $autitem (@adar) {
 >       print "<LI>";
 >       print "<A HREF=\"search.pl?author=";
 >       my $autlink = $autitem;
 >       $autlink =~ s/(, DIRECTION|, WRITING|, CAST|, PRODUCTION)//ig;
 >       my $htitem = uri_escape($autlink);
 >       print "$htitem\&type=opac\">$autitem</A>";
 >   }
 >   print "</UL>";
122,125c148
< if ($dat->{'author'} ne ''){
<   print "<b>Author:</b> $dat->{'author'}<br>";
< }
< #Additional Author: <br>
---
 > print "\n";
130c153,166
<   print "<b>Subject:</b> $dat->{'subject'}<br>";
---
 >   my $subj = $dat->{'subject'};
 >   $subj =~ s/^\s*\|\s*//;
 >   my @subar = split /\|\s+/, $subj;
 >   print "<B>Subject:</B> <OL>";
 >   my $subitem;
 >   SUBLOOP: foreach $subitem (@subar) {
 >       print "<LI>";
 >       print "<A HREF=\"subjectsearch.pl?subject=";
 >       $subitem =~ s/\s*$//;
 >       my $htitem = uri_escape($subitem);
 >       print "$htitem\&type=opac\">$subitem</A>";
 >   }
 >   print "</OL>\n";
 >



--
Rob Levandowski
robl at macwhiz.com





More information about the Koha-devel mailing list