/[webpac-proto]/search/filters/default.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /search/filters/default.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Thu Jun 13 17:25:53 2002 UTC revision 1.5 by dpavlin, Thu Oct 24 18:25:22 2002 UTC
# Line 34  package default; Line 34  package default;
34  # Application Constants  # Application Constants
35  #  #
36    
 # Field Names  
 %default::FieldNames = (          
         '700+', 'Autor(i)',  
         '200',  'Naslov',  
         '205',  'Izdanje',  
         '210',  'Izdavanje',  
         '215',  'Materijalni opis',  
         '225',  'Nakladnička cjelina',  
         '300+', 'Napomena',  
         '330',  'Sadržaj',  
         '423',  'Prikriveni radovi',  
         '464',  'Analitički radovi',  
         '610',  'Ključne riječi',  
         '675+', 'Klasifik. oznaka',  
         '990',  'Signatura',  
         '991',  'Inventarni broj',  
         'ISBN', 'ISBN',  
         'MFN',  'MFN',  
         '994a', 'Knjižnica',  
   
   
         'A',    'Author(s)',  
         'B',    'Book',  
         'C',    'City',  
         'D',    'Date',  
         'E',    'Editor',  
         'F',    'Footnote',  
         'G',    'Order Info',  
         'H',    'Commentary',  
         'I',    'Publisher',  
         'J',    'Journal',  
         'K',    'Keyword',  
         'L',    'Label',  
         'M',    'Bell',  
         'N',    'Issue',  
         'O',    'Other',  
         'P',    'Page',  
         'Q',    'Corporate',  
         'R',    'Report',  
         'S',    'Series',  
         'T',    'Title',  
         'U',    'Annotation',  
         'V',    'Volume',  
         'W',    'URL',  
         'X',    'Abstract',  
         'Y',    'Table of Contents',  
         'Z',    'Reference',  
         '$',    'Price',  
         '*',    'Copyright',  
         '^',    'Parts',  
 );  
   
   
   
 # Field Display Order  
 @default::FieldDisplayOrder = (  
         'ISBN',  
         '700+',  
         '200',  
         '205',  
         '210',  
         '215',  
         '225',  
         '300+',  
         '330',  
         '423',  
         '464',  
         '610',  
         '675+',  
         '990',  
         '991',  
         'MFN',  
         '994a',  
   
         'M',  
         'L',  
         'T',  
         'S',  
         'E',  
         'Q',  
         'A',  
         'J',  
         'B',  
         'D',  
         'V',  
         'N',  
         'P',  
         'C',  
         'I',  
         'G',  
         '$',  
         'K',  
         '*',  
         'W',  
         'O',  
         'Y',  
         'X',  
         'R',  
         '.',  
         'F',  
         'H',  
         'U',  
         'Z',  
         '^'  
 );  
   
 # separators  
 %default::Separator = (  
         '700+', ', ',  
         '990',  ' ',  
         '991', ', ',  
         '300+', '.- ',  
         '225', ', ',  
         '610', ' * ',  
   
           
 );  
   
37  #--------------------------------------------------------------------------  #--------------------------------------------------------------------------
38  #  #
39  #       Function:       DocumentParser()  #       Function:       DocumentParser()
# Line 247  sub DocumentFilter { Line 129  sub DocumentFilter {
129          # Loop over each line in the document list          # Loop over each line in the document list
130          foreach $FieldTag ( @default::FieldDisplayOrder ) {          foreach $FieldTag ( @default::FieldDisplayOrder ) {
131    
132    #               print "-- $FieldTag = $Document{$FieldTag} --";
133    
134                  # Skip empty slots                  # Skip empty slots
135                  if ( !(defined($Document{$FieldTag}) && ($Document{$FieldTag} ne "")) ) {                  if ( !(defined($Document{$FieldTag}) && ($Document{$FieldTag} ne "")) ) {
136                          next;                          next;
# Line 256  sub DocumentFilter { Line 140  sub DocumentFilter {
140                  # Print the row start                  # Print the row start
141                  $DocumentFinal .= "<TR><TD VALIGN=TOP ALIGN=RIGHT BGCOLOR=\"#EEEEEE\" WIDTH=\"130\"> $default::FieldNames{$FieldTag}: </TD><TD VALIGN=TOP ALIGN=LEFT> ";                  $DocumentFinal .= "<TR><TD VALIGN=TOP ALIGN=RIGHT BGCOLOR=\"#EEEEEE\" WIDTH=\"130\"> $default::FieldNames{$FieldTag}: </TD><TD VALIGN=TOP ALIGN=LEFT> ";
142    
143                  # Print the field data, marking up if needed                  sub html_enc {
144                  if ( $FieldTag eq "A" || $FieldTag eq "E" ) {                          my $tmp = $_[0];
145                          $CommaFlag = 0;                          $tmp =~ s/&/&and;/g;
146                          @Authors = split(/;/, $Document{$FieldTag});                          $tmp =~ s/</&lt;/g;
147                          foreach $Author ( @Authors ) {                          $tmp =~ s/>/&gt;/g;
148                                  if ( $CommaFlag ) {                          # fix some tags
149                                          $DocumentFinal .= ", ";                          $tmp =~ s/&lt;br&gt;/<br>/gi;
150                                  }                          return $tmp;
                                 $CommaFlag = 1;  
                                 $SearchTerm = $Author;  
                                 $SearchTerm =~ s/,//g;  
                                 @AuthorNames = split(/ /, $SearchTerm);  
                                 $SearchTerm = "";  
                                 foreach $AuthorName ( @AuthorNames ) {  
                                         if ( ! ($AuthorName =~ /^\w+\.$/) ) {  
                                                 if ( $AuthorName ne "" ) {  
                                                         $AuthorName .= " ";  
                                                 }  
                                                 $SearchTerm .= $AuthorName;  
                                         }  
                                 }  
                                 $SearchTerm =~ s/ /+/g;  
                                 $DocumentFinal .= "<A HREF=\"$ENV{'SCRIPT_NAME'}/GetSearchResults?Database=$Database&FieldName1=author&FieldContent1=%22$SearchTerm%22\"> $Author </A>";  
                         }  
151                  }                  }
152                  elsif ( $FieldTag eq "K" ) {  
153                          $CommaFlag = 0;                  # format URI
154                          @Keywords = split(/,/, $Document{$FieldTag});                  if ( $FieldTag eq "856" ) {
155                          foreach $Keyword ( @Keywords ) {                          my $alt = $Document{$FieldTag};
156                                  if ( $CommaFlag ) {                          if (length $alt > $default::max_display_url_len ) {
157                                          $DocumentFinal .= ", ";                                  $alt = substr($alt,0,$default::max_display_url_len)."...";
                                 }  
                                 $CommaFlag = 1;  
                                 $SearchTerm = $Keyword;  
                                 $SearchTerm =~ s/ /+/g;  
                                 $DocumentFinal .= "<A HREF=\"$ENV{'SCRIPT_NAME'}/GetSearchResults?Database=$Database&FieldName1=keyword&FieldContent1=%22$SearchTerm%22\"> $Keyword </A>";  
158                          }                          }
159                  }                          $DocumentFinal .= "<A HREF=\"$Document{$FieldTag}\" TARGET=\"BlankWindow\">$alt</A>";
160                  elsif ( $FieldTag eq "W" ) {  
161                          $DocumentFinal .= "<A HREF=\"$Document{$FieldTag}\" TARGET=\"BlankWindow\"> $Document{$FieldTag} </A>";                  } else {
162                  }                          $DocumentFinal .= html_enc($Document{$FieldTag});
                 elsif ( $FieldTag eq "Y" ) {  
                         $DocumentFinal .= "<PRE>$Document{$FieldTag}</PRE>";  
                 }  
                 else {  
                         $DocumentFinal .= "$Document{$FieldTag}";  
163                  }                  }
164    
165                  $DocumentFinal .= "</TD></TR> \n";                  $DocumentFinal .= "</TD></TR> \n";

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.26