Skip to content

Commit

Permalink
fix broken handling of embedded double quotes in imagemap callbacks, …
Browse files Browse the repository at this point in the history
…which were causing broken images to appear in balloons
  • Loading branch information
Lincoln Stein committed Nov 28, 2011
1 parent 867984c commit 32dba28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -6,6 +6,7 @@
mouse hovers or clicks on the feature. This noticeably speeds up track generation time. Drawback mouse hovers or clicks on the feature. This noticeably speeds up track generation time. Drawback
is that this increases the delay before balloon pops up on the hover operation when run in is that this increases the delay before balloon pops up on the hover operation when run in
cgi-bin mode (still fast in FastCGI mode). Restore original behavior by setting "inline imagemaps" cgi-bin mode (still fast in FastCGI mode). Restore original behavior by setting "inline imagemaps"
(or "inline imagemap").
to true in [TRACK DEFAULTS] or individual track definitions. to true in [TRACK DEFAULTS] or individual track definitions.
* Can now close tracks from main view even when corresponding track checkbox not showing * Can now close tracks from main view even when corresponding track checkbox not showing
in the track listing. in the track listing.
Expand Down
3 changes: 2 additions & 1 deletion lib/Bio/Graphics/Browser2/DataSource.pm
Expand Up @@ -1355,7 +1355,8 @@ the actions are generated by Ajax callbacks
sub use_inline_imagemap { sub use_inline_imagemap {
my $self = shift; my $self = shift;
my ($label,$length) = @_; my ($label,$length) = @_;
my $inline = $self->semantic_fallback_setting($label=>'inline imagemaps',$length); my $inline = $self->semantic_fallback_setting($label=>'inline imagemaps',$length)
||$self->semantic_fallback_setting($label=>'inline imagemap', $length);
return $inline if defined $inline; return $inline if defined $inline;
my $db = $self->open_database($label,$length) or return 1; my $db = $self->open_database($label,$length) or return 1;
return !$db->can('get_feature_by_id'); return !$db->can('get_feature_by_id');
Expand Down
12 changes: 8 additions & 4 deletions lib/Bio/Graphics/Browser2/RenderPanels.pm
Expand Up @@ -1267,9 +1267,9 @@ sub make_imagemap_element_inline {
#retrieve the content of the balloon from configuration files #retrieve the content of the balloon from configuration files
# if it looks like a URL, we treat it as a URL. # if it looks like a URL, we treat it as a URL.
my ($balloon_ht,$balloonhover) = my ($balloon_ht,$balloonhover) =
$self->balloon_tip_setting('balloon hover',$label,$feature,$panel,$track); $self->balloon_tip_setting('balloon hover',$label,$feature,$panel,$track,'inline');
my ($balloon_ct,$balloonclick) = my ($balloon_ct,$balloonclick) =
$self->balloon_tip_setting('balloon click',$label,$feature,$panel,$track); $self->balloon_tip_setting('balloon click',$label,$feature,$panel,$track,'inline');


$balloonhover ||= $title if $use_titles_for_balloons; $balloonhover ||= $title if $use_titles_for_balloons;
$balloon_ht ||= $balloon_style; $balloon_ht ||= $balloon_style;
Expand Down Expand Up @@ -2557,7 +2557,7 @@ sub make_link_target {


sub balloon_tip_setting { sub balloon_tip_setting {
my $self = shift; my $self = shift;
my ($option,$label,$feature,$panel,$track) = @_; my ($option,$label,$feature,$panel,$track,$inline) = @_;
my $length = $self->segment_length($label); my $length = $self->segment_length($label);
$option ||= 'balloon tip'; $option ||= 'balloon tip';
my $source = $self->source; my $source = $self->source;
Expand All @@ -2582,7 +2582,11 @@ sub balloon_tip_setting {
} }
# escape quotes # escape quotes
$val =~ s/'/\\'/g; $val =~ s/'/\\'/g;
$val =~ s/"/"/g; if ($inline) {
$val =~ s/"/"/g;
} else {
$val =~ s/"/\\"/g;
}


return ($balloon_type,$val); return ($balloon_type,$val);
} }
Expand Down

0 comments on commit 32dba28

Please sign in to comment.