Correct a bug that prevents selectionning an entry with a quote

This commit is contained in:
doxulting 2005-08-26 12:18:59 +00:00
parent df266c45cc
commit 07dfffb799
2 changed files with 25 additions and 4 deletions

View file

@ -107,8 +107,8 @@ a.catalogue:hover {
<!-- TMPL_ELSE -->
<td>
<!-- /TMPL_IF -->
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="mainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,0)" class="button catalogue">select</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="mainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,1)" class="button catalogue">sel&amp;close</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="jamainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,0)" class="button catalogue">select</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="jamainentry" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,1)" class="button catalogue">sel&amp;close</a>
</td>
</tr>
<!-- /TMPL_LOOP -->
@ -151,8 +151,8 @@ a.catalogue:hover {
<!-- TMPL_VAR NAME="count" --> biblio(s)
</td>
<td <!-- TMPL_IF NAME="even" -->class="hilighted"<!-- /TMPL_IF -->>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,0)" class="button catalogue">Select</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="value" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,1)" class="button catalogue">Sel&amp;close</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="javalue" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,0)" class="button catalogue">Select</a>
<a href="javascript:SelectEntry('<!-- TMPL_VAR NAME="javalue" ESCAPE="URL" -->',<!-- TMPL_VAR NAME="anindex" ESCAPE="URL" -->,1)" class="button catalogue">Sel&amp;close</a>
</td>
</tr>
<!-- /TMPL_LOOP -->

View file

@ -116,9 +116,17 @@ if ($op eq "do_search") {
$sth->execute($value);
my $total;
my @catresults;
my $javalue;
while (my ($value,$ctresults)=$sth->fetchrow) {
# warn "countresults : ".$ctresults;
# This $javalue is used for the javascript selectentry function (javalue for javascript value !)
$javalue = $value;
$javalue =~s/'/\\'/g;
push @catresults,{value=> $value,
javalue=> $javalue,
even=>($total-$startfrom*$resultsperpage)%2,
count=>$ctresults
} if (($total>=$startfrom*$resultsperpage) and ($total<($startfrom+1)*$resultsperpage));
@ -130,6 +138,9 @@ if ($op eq "do_search") {
foreach my $listtags (@tags){
my @taglist=split /,/,$listtags;
foreach my $curtag (@taglist){
# regexp used to prevent errors if user puts spaces in "search also" of the framework description.
$curtag =~s/\s+//;
$strsth.="(tagfield='".substr($curtag,1,3)."' AND tagsubfield='".substr($curtag,4,1)."') OR";
}
}
@ -148,6 +159,16 @@ if ($op eq "do_search") {
while ((my $authtypecode) = $sth->fetchrow) {
my ($curauthresults,$nbresults) = authoritysearch($dbh,[''],[''],[''],['contains'],
\@search,$startfrom*$resultsperpage, $resultsperpage,$authtypecode);
if (defined(@$curauthresults)) {
my $taille = @$curauthresults;
for (my $i = 0; $i < @$curauthresults ;$i++) {
@$curauthresults[$i]->{jamainentry} = @$curauthresults[$i]->{mainentry};
@$curauthresults[$i]->{jamainentry} =~ s/'/\\'/g;
}
}
push @authresults, @$curauthresults;
$authnbresults+=$nbresults;
# warn "auth : $authtypecode nbauthresults : $nbresults";