package SGN::View::Mason::Commands;
use strict;
use vars qw($m $c);
HTML::Mason::Component::FileBased->new(
'code' => sub {
use utf8; local $SGN::View::Mason::Commands::m = $HTML::Mason::Commands::m;
HTML::Mason::Exception::Params->throw
    ( error =>
      "Odd number of parameters passed to component expecting name/value pairs"
    ) if @_ % 2;
my ( $trial_id );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( trial_id ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 2 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
    $trial_id = $_[ $pos{'trial_id'} ];
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( '
<p id="trial_jbrowse_check">[loading...]</p>

' );
#line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"


my $jbrowse_path = $c->config->{jbrowse_path};
my @path_parts = split('/', $jbrowse_path);
my $basepath = $path_parts[1];
my $test_url = "/" . $basepath . "/jbrowse.conf";
my $jbrowse_url = $jbrowse_path ."%2Ftrials%2F" . $trial_id ."&tracks=DNA%2CGene%20exons%2C&cat=Diversity/NEXTGEN/Imputed&highlight=";

#line 16 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( '
<script type="text/javascript" defer="defer">
jQuery(document).ready(function () {

	jQuery.ajax({
		url: "' );
#line 21 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print(  $test_url  );
#line 21 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( '",
		success: function(response) {
			if ( response.indexOf("Trial_' );
#line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( $trial_id );
#line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( '") > -1 ) { // if jbrowse instance is found, create and display link
				jQuery(\'#trial_jbrowse_check\').replaceWith(\'<a id="jbrowse_link" href="' );
#line 24 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print(  $jbrowse_url  );
#line 24 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/jbrowse_instance.mas"
$m->print( '">View the dataset for this trial in JBrowse</a>\');
			}
			else { // if not found, display message that jbrowse instance wasn\'t found
				jQuery(\'#trial_jbrowse_check\').html(" <i>This trial does not have a dataset in Jbrowse.</i>");
			}
		},
		error: function() {
			jQuery(\'#trial_jbrowse_check\').html(" <i>Jbrowse has not been set up for this database.</i>");
		}
	});
});
</script>
' );
;return;
},
'declared_args' => {
  '$trial_id' => { default => undef }
},
'load_time' => 1763102299,

)
;