34 |
# Application Constants |
# Application Constants |
35 |
# |
# |
36 |
|
|
|
require "../config.pl"; |
|
|
|
|
37 |
#-------------------------------------------------------------------------- |
#-------------------------------------------------------------------------- |
38 |
# |
# |
39 |
# Function: DocumentParser() |
# Function: DocumentParser() |
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; |
142 |
|
|
143 |
sub html_enc { |
sub html_enc { |
144 |
my $tmp = $_[0]; |
my $tmp = $_[0]; |
145 |
$tmp =~ s/&/∧/g; |
$tmp =~ s/&/&/g; |
146 |
$tmp =~ s/</</g; |
$tmp =~ s/</</g; |
147 |
$tmp =~ s/>/>/g; |
$tmp =~ s/>/>/g; |
148 |
# fix some tags |
# fix some tags |
150 |
return $tmp; |
return $tmp; |
151 |
} |
} |
152 |
|
|
153 |
$Document{$FieldTag} = html_enc($Document{$FieldTag}); |
# format URI |
154 |
|
if ( $FieldTag eq "856" ) { |
155 |
# Print the field data, marking up if needed |
my $alt = $Document{$FieldTag}; |
156 |
if ( $FieldTag eq "A" || $FieldTag eq "E" ) { |
if (length $alt > $default::max_display_url_len ) { |
157 |
$CommaFlag = 0; |
$alt = substr($alt,0,$default::max_display_url_len)."..."; |
|
@Authors = split(/;/, $Document{$FieldTag}); |
|
|
foreach $Author ( @Authors ) { |
|
|
if ( $CommaFlag ) { |
|
|
$DocumentFinal .= ", "; |
|
|
} |
|
|
$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>"; |
|
|
} |
|
|
} |
|
|
elsif ( $FieldTag eq "K" ) { |
|
|
$CommaFlag = 0; |
|
|
@Keywords = split(/,/, $Document{$FieldTag}); |
|
|
foreach $Keyword ( @Keywords ) { |
|
|
if ( $CommaFlag ) { |
|
|
$DocumentFinal .= ", "; |
|
|
} |
|
|
$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 |
} |
my $url = $Document{$FieldTag}; |
160 |
elsif ( $FieldTag eq "W" ) { |
$url =~ s/"/%22/g; # save " from URLs |
161 |
$DocumentFinal .= "<A HREF=\"$Document{$FieldTag}\" TARGET=\"BlankWindow\"> $Document{$FieldTag} </A>"; |
$DocumentFinal .= "<A HREF=\"$url\" TARGET=\"BlankWindow\">$alt</A>"; |
162 |
} |
|
163 |
elsif ( $FieldTag eq "Y" ) { |
} else { |
164 |
$DocumentFinal .= "<PRE>$Document{$FieldTag}</PRE>"; |
$DocumentFinal .= html_enc($Document{$FieldTag}); |
|
} |
|
|
else { |
|
|
$DocumentFinal .= "$Document{$FieldTag}"; |
|
165 |
} |
} |
166 |
|
|
167 |
$DocumentFinal .= "</TD></TR> \n"; |
$DocumentFinal .= "</TD></TR> \n"; |