196 |
|
|
197 |
my $s; |
my $s; |
198 |
if ($s_el > 0) { |
if ($s_el > 0) { |
199 |
$s = $item->{'search'}->[$i] || die "can't find value $i for type search in field $search"; |
$s = $item->{'search'}->[$i]; |
200 |
|
die "can't find value $i for type search in field $search" unless (defined($s)); |
201 |
} else { |
} else { |
202 |
$s = $item->{'search'}->[0]; |
$s = $item->{'search'}->[0]; |
203 |
} |
} |
204 |
#$s =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg; |
#$s =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg; |
205 |
$s = __quotemeta( $s ); |
$s = __quotemeta( $s ); |
206 |
|
|
207 |
my $d = $item->{'display'}->[$i] || die "can't find value $i for type display in field $display"; |
my $d = $item->{'display'}->[$i]; |
208 |
|
die "can't find value $i for type display in field $display" unless (defined($d)); |
209 |
|
|
210 |
my $template_arg = ''; |
my $template_arg = ''; |
211 |
$template_arg = qq{,'$template'} if ($template); |
$template_arg = qq{,'$template'} if ($template); |
212 |
|
|
213 |
push @html, qq{<a href="#" onclick="return search_via_link('$search','$s'${template_arg})">$d</a>}; |
if ($s && ! $d) { |
214 |
|
$d = $s; |
215 |
|
} elsif (! $s && $d) { |
216 |
|
$s = $d; |
217 |
|
} |
218 |
|
|
219 |
|
push @html, qq{<a href="#" onclick="return search_via_link('$search','$s'${template_arg})">$d</a>} if ($s && $d); |
220 |
} |
} |
221 |
|
|
222 |
return join($delimiter, @html); |
return join($delimiter, @html); |