Browse files

some databases working

  • Loading branch information...
1 parent ddcedac commit 0405e249dc4c8eaa090f3a21608796b318c32378 @lstein lstein committed Nov 2, 2011
Showing with 34 additions and 4 deletions.
  1. +17 −2 htdocs/js/controller.js
  2. +14 −0 lib/Bio/Graphics/Browser2/Action.pm
  3. +3 −2 lib/Bio/Graphics/Browser2/RenderPanels.pm
View
19 htdocs/js/controller.js
@@ -1360,8 +1360,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);
+ }
+ });
}
});
View
14 lib/Bio/Graphics/Browser2/Action.pm
@@ -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();
View
5 lib/Bio/Graphics/Browser2/RenderPanels.pm
@@ -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';

0 comments on commit 0405e24

Please sign in to comment.