Skip to content

Commit

Permalink
added fmini's, small refresh fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu Lall committed Apr 1, 2011
1 parent 5c20fdc commit a6f7474
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 20 deletions.
4 changes: 2 additions & 2 deletions bin/gbrowse_create_account.pl
Expand Up @@ -79,10 +79,10 @@ END
unless ($uid) {
# this creates a new session for the admin user
my $session = $globals->session;
my $favoritetable = $globals->favorites;

my $sessionid = $session->id;
my $uploadsid = $session->uploadsid;
my @favorites_list = $favoritetable->favorites;

$session->flush();

my ($status,undef,$message) =
Expand Down
51 changes: 51 additions & 0 deletions htdocs/js/controller.js
Expand Up @@ -1141,6 +1141,57 @@ var GBrowseController = Class.create({
}
},

saveSession:
function(/*settings_json*/){
// var settings = settings_json.evalJSON();


alert('hello');


new Ajax.Request(document.URL, {
method: 'POST',
asynchronous:true,
parameters: {
action: 'save_session',
name: 'snapshot_test',

}});

/*
for (var o in settings){
alert(o+" : "+settings[o]);
}*/
},


setSession:
function(/*settings_json*/){
// var settings = settings_json.evalJSON();



alert('hello');


new Ajax.Request(document.URL, {
method: 'POST',
asynchronous:true,
parameters: {
action: 'set_session',
name: 'hello',

}});




/*
for (var o in settings){
alert(o+" : "+settings[o]);
}*/
},

wait_for_initialization:
function (html, callback) {
$('main').setOpacity(0.2);
Expand Down
16 changes: 10 additions & 6 deletions htdocs/js/toggle.js
Expand Up @@ -237,7 +237,11 @@ function togglestars(event,imgID, txtID, favorites,cellid)
var fileNameMainSpilt = fileName.split("_"); // check for a spilt on '_'
var imgName ='';
var show;

var miniID = 'fav_'+imgID;

var browserstarTag = document.getElementById(miniID);
var blank_min_src =fullFilePath+"fmini.png";
var coloured_min_src = fullFilePath+"fmini_2.png";


var stars = getElementsByClassName("star");
Expand Down Expand Up @@ -302,10 +306,7 @@ function togglestars(event,imgID, txtID, favorites,cellid)
label: imgID,
favorite:show,
}});
var miniID = 'fav_'+imgID;
var browserstarTag = $(miniID);
var blank_min_src =fullFilePath+"fmini.png";
var coloured_min_src = fullFilePath+"fmini_2.png";


if (event.shiftKey) {

Expand Down Expand Up @@ -352,9 +353,11 @@ new Ajax.Request(document.URL, {
}
}


// (favorite == true) ? fullFilePath+'fmini_2.png' : fullFilePath+'fmini.png';
if(browserstarTag){
browserstarTag.src = (favorite == true) ? coloured_min_src : blank_min_src;
};
// alert(browserstarTag.src);
// alert(blank_min_src);
// alert(coloured_min_src);
Expand Down Expand Up @@ -662,6 +665,7 @@ new Ajax.Request(

e.show();

Controller.update_sections(new Array(track_listing_id),'',1,false)



Expand Down
3 changes: 2 additions & 1 deletion htdocs/js/track.js
Expand Up @@ -23,7 +23,7 @@ var GBrowseTrack = Class.create({
this.track_image_id = track_id + "_image";
this.last_update_key = 0;
this.expired_count = 0;

// alert(track_section);
if (track_type == 'scale_bar') {
this.standard_track = false;
}
Expand All @@ -36,6 +36,7 @@ var GBrowseTrack = Class.create({
set_last_update_key:
function (time_key) {
this.last_update_key = time_key;

},

get_last_update_key:
Expand Down
36 changes: 36 additions & 0 deletions lib/Bio/Graphics/Browser2/Action.pm
Expand Up @@ -299,6 +299,8 @@ sub ACTION_set_favorite {
}




#
# parameters:
# method: 'post',
Expand Down Expand Up @@ -330,6 +332,40 @@ sub ACTION_clear_favorites {
return (204,'text/plain',undef);
}


# sub ACTION_set_session {
#
# }


sub ACTION_save_session {
my $self = shift;
my $q = shift;
my $name = $q->param('name');
my $settings = $self->state;
#
#
# %snapshot = %$settings;
# delete(%snapshot{snapshots});
#
#
# $settings->{snapshots}->{$name} = %snapshot;
# # warn "settings = $settings";
# # warn "$self";
#
#
# my %temsess = %{$settings->{snapshots}};
# while ( (my $key, my $value) = each %temsess)
# {
# warn "key: $key, value: $temsess{$key}\n";
# };


$self->session->flush;
return (204,'text/plain',undef);
}


sub ACTION_reconfigure_plugin {
my $self = shift;
my $q = shift;
Expand Down
6 changes: 4 additions & 2 deletions lib/Bio/Graphics/Browser2/Render.pm
Expand Up @@ -100,13 +100,15 @@ sub session {
my $self = shift;
my $d = $self->{session};
$self->{session} = shift if @_;
warn "d= $d" if DEBUG;
warn "self->session= $self->{session}" if DEBUG;
$d;
}

sub state {
my $self = shift;
my $d = $self->{state};
$STATE = $self->{state} = shift if @_;
$STATE = $self->{state}= shift if @_;
$d;
}

Expand Down Expand Up @@ -2047,7 +2049,7 @@ sub track_visible {
sub update_state_from_cgi {
my $self = shift;
my $state = $self->state;
warn "state = $state";
warn "state = $state" if DEBUG;
$self->update_options($state);
$self->update_coordinates($state);
$self->update_region($state);
Expand Down
51 changes: 47 additions & 4 deletions lib/Bio/Graphics/Browser2/Render/HTML.pm
Expand Up @@ -179,7 +179,10 @@ sub render_navbar {
my $source_form = div({-id=>'source_form'},$self->source_form());

my $sliderform = div({-id=>'slider_form'},$self->sliderform($segment));


# my $sessionButton = div({-id=>'sessionbutton'},$self->render_select_saveSession());
#
# my $setSession = div({-id=>'sessionbutton'},$self->render_select_setSession());
return $self->toggle('Search',
div({-class=>'searchbody'},
table({-border=>0,-width=>'100%'},
Expand All @@ -189,7 +192,14 @@ sub render_navbar {
),
td({-align=>'left'},
$sliderform || ' '
)
),
# td({-align=>'left'},
# $sessionButton || ' '
# ),
# ,
# td({-align=>'left'},
# $setSession || ' '
# )
)
),
$self->html_frag('html3',$self->state)
Expand Down Expand Up @@ -975,7 +985,7 @@ my $checkid = "notselectedcheck_${label}";

my $showicon;
my $name = $self->{$category_table_labels}->{label};
warn "section = $name";
warn "section = $name" if DEBUG;
#if the track has already been favorited, the image source is made into the yellow star
if($settings->{favorites}{$label}){

Expand Down Expand Up @@ -1516,6 +1526,40 @@ sub render_select_favorites_link {
}


sub render_select_saveSession {
my $self = shift;
my $title = 'Save Session';

return button({-name=>$title,
-onClick => "Controller.saveSession()",

# "Controller.update_section('range');"
},

);
}

sub render_select_setSession {
my $self = shift;
my $title = 'Set Session';

return button({-name=>$title,
-onClick => "Controller.setSession()",

# "Controller.update_section('range');"
},

);
}


# sub save_session{
# my $self = shift;
# warn "self = $self";
# warn "hello";
# }


# Render Select Browser Link - Returns the HTML for the "Back to Browser" button/link.
sub render_select_browser_link {
my $self = shift;
Expand Down Expand Up @@ -3576,4 +3620,3 @@ sub format_upload_autocomplete {
return $html;
}
1;

19 changes: 16 additions & 3 deletions lib/Bio/Graphics/Browser2/RenderPanels.pm
Expand Up @@ -13,6 +13,7 @@ use Bio::Graphics::Browser2::Util qw[shellwords url_label];
use Bio::Graphics::Browser2::Render::Slave::Status;
use IO::File;
use Time::HiRes 'sleep','time';
use Data::Dumper;
use POSIX 'WNOHANG','setsid';
use CGI qw(:standard param escape unescape);

Expand Down Expand Up @@ -269,6 +270,7 @@ sub make_requests {

my $format_option = $settings->{features}{$label}{options};


my $filter = $settings->{features}{$label}{filter};
@filter_args = %{$filter->{values}} if $filter->{values};
@subtrack_args = @{$settings->{subtracks}{$label}}
Expand All @@ -293,6 +295,7 @@ sub make_requests {
$format_option,
$label ],
);

my $msg = eval {$args->{remotes}->error($track)};
$cache_object->flag_error($msg || "Could not fetch data for $track");
$d{$track} = $cache_object;
Expand Down Expand Up @@ -323,7 +326,7 @@ sub make_requests {
$label ],
-cache_time => $cache_time
);

# warn "object= $format_option";
$d{$label} = $cache_object;
}

Expand Down Expand Up @@ -391,6 +394,7 @@ sub render_tracks {
}

return \%result;

}

# Returns the HMTL to show a track with controls, title, arrows, etc.
Expand Down Expand Up @@ -582,7 +586,7 @@ sub wrap_rendered_track {
);


use Data::Dumper;

my $ipad_collapse = $collapsed ? 'Expand':'Collapse';

my $cancel_ipad = 'Turn off';
Expand All @@ -594,7 +598,7 @@ use Data::Dumper;

# $settings->{favorites} = {};
# print Dumper($settings->{favorites}{$label});
my $bookmark;
my $bookmark = 'Favorite';
# = ($HTMLPAGE->{favorites}{$label}) ? 'Favorite' : 'Unfavorite';
my $menuicon = img ({-src => $menu,
-style => 'padding-right:15px;',},),
Expand Down Expand Up @@ -2086,6 +2090,15 @@ sub create_track_args {
my $is_summary = $source->show_summary($label,$self->vis_length,$self->settings);

my $state = $self->settings;

# my %temp = %$state;
#
# foreach my $k (keys %temp) {
# warn "$k: $temp{$k}\n";
# }



my ($semantic_override) = sort {$b<=>$a} grep {$_ < $length}
keys %{$state->{features}{$label}{semantic_override}};
$semantic_override ||= 0;
Expand Down

0 comments on commit a6f7474

Please sign in to comment.