Skip to content

Commit

Permalink
some databases working
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein authored and Lincoln Stein committed Nov 28, 2011
1 parent ede1186 commit 454f8f0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
19 changes: 17 additions & 2 deletions htdocs/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1347,8 +1347,23 @@ show_info_message:
},

callback:
function(element,fid) {
alert('element = '+element+' id= '+fid);
function(element,dbid,fid) {
// find track information
var track_element = element.up(1).id;
var track = track_element.sub(/^track_/,'');
new Ajax.Request(Controller.url, {
method: 'post',
parameters:{
action: 'get_feature_info',
track: track,
dbid: dbid,
feature_id: fid,
},
onSuccess: function(transport) {
var data = transport.responseText;
alert(data);
}
});
}

});
Expand Down
14 changes: 14 additions & 0 deletions lib/Bio/Graphics/Browser2/Action.pm
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,20 @@ sub ACTION_autocomplete_user_search {
return (200,'text/html',$autocomplete);
}

sub ACTION_get_feature_info {
my $self = shift;
my $q = shift;
my $track = CGI::unescape($q->param('track')) or croak;
my $dbid = CGI::unescape($q->param('dbid')) or croak;
my $fid = CGI::unescape($q->param('feature_id')) or croak;
my $state = $self->state;
local $state->{dbid} = $dbid;
my $search = $self->render->get_search_object();
my $features = $search->search_features({-name=>"id:$fid"});
warn "dbid=$dbid, fid=$fid", scalar @$features;
return (200,'text/plain',"@$features");
}

sub ACTION_reset_dsn {
my $self = shift;
$self->data_source->clear_cached_config();
Expand Down
5 changes: 3 additions & 2 deletions lib/Bio/Graphics/Browser2/RenderPanels.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1190,10 +1190,11 @@ sub make_map {
foreach my $box (@$boxes){
my $feature = $box->[0];
next unless $feature->can('primary_tag');
my $id = eval {CGI::escape($feature->primary_id)} or next;
my $id = eval {CGI::escape($feature->primary_id)} or next;
my $dbid = eval {CGI::escape($feature->gbrowse_dbid)};
my %attributes = (
# onmouseover => "Controller.callback(this,'$id')",
onmousedown => "Controller.callback(this,'$id')",
onmousedown => "Controller.callback(this,'$dbid','$id')",
style => 'cursor:pointer'
);
my $fname = eval {$feature->display_name} || eval{$box->[0]->name} || 'unnamed';
Expand Down

0 comments on commit 454f8f0

Please sign in to comment.