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 ( @groups );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }
#line 6 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
     @groups = exists $pos{'groups'} ? HTML::Mason::Tools::coerce_to_array( $_[ $pos{'groups'} ], '@groups') :  ();
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 1 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 4 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 8 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 9 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"


#print Data::Dumper::Dumper(\@groups);

#line 14 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 15 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp(   '/page/page_title.mas', title=>"BLAST db details"   
); #line 15 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '

<div >This page provides details for each of the BLAST sequence sets available at SGN.</div>

' );
#line 19 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
 foreach my $g (@groups) { 
$m->print( '
' );
#line 21 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp( { content => sub {
#line 21 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '

' );
#line 23 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
   foreach my $d (@{$g->[2]}) { 
$m->print( '
   ' );
#line 25 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"

     my $needs_update ="";
     if ($d->{needs_update}) { $needs_update = $d->{needs_update} ? qq|<span style="background: #c22; padding: 3px; color: white">needs update</span>| : qq|<span style="background: #2c2; padding: 3ppx; color: white">up to date</span>|;
}
     my $source_url = "";
     if (exists($d->{source_url}) && $d->{source_url} =~ m/^http|^ftp/) { 
       $source_url = qq | <a href="$source_url">$source_url</a> |;
     }
   #line 34 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '      
' );
#line 35 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp( { content => sub {
#line 35 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
  ' );
#line 36 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp(   '/page/info_table.mas', data => [
    'Type'    => $d->{sequence_type}, 
    'Seq count'   => $d->{sequence_count},
				    'Current as of'    => $d->{current_as_of},
				    'Updates' => $d->{update_freq},
				    ' '     => $needs_update,
				   ],
    'multicol'=>5   
); #line 43 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
    ' );
#line 44 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp(   '/page/info_table.mas', data => [ 
				      'Source URL'       => $source_url,
				     ],
        
); #line 47 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
      ' );
#line 48 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->comp(   '/page/info_table.mas', data => [
        'Description'      => $d->{description} 
				       ],
					   
); #line 51 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 52 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
} }, '/page/info_section.mas', title=> $d->{title}, is_subsection=>1
 );
#line 52 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '
' );
#line 53 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
   }
$m->print( '
' );
#line 55 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
} }, '/page/info_section.mas', title=>$g->[1]
 );
#line 55 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
$m->print( '

' );
#line 57 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"
}
$m->print( '
' );
#line 59 "/home/production/cxgn/sgn/mason/tools/blast/dbinfo.mas"





#print Data::Dumper::Dumper(\@groups);


# sub info_html {
#  my ($db,$groupname) = @_;

#  my $timestamp = $db->file_modtime
#    or return;

#  my $timestamp_str = strftime('%m-%d-%y %R GMT',gmtime $db->file_modtime);
#  if( $db->needs_update ) {
#    $timestamp_str = qq|<span style="background: #c22; padding: 3px; color: white">$timestamp_str (needs update)</span>|;
#  }
##  my $update_freq = $db->update_freq;

#  return info_section_html( title => $db->title.'<a name="'.$db->file_base.'"></a>',
#			    subtitle => "<b>Category:</b> $groupname",
#			    is_subsection => 0,
#			    contents =>
#			    info_table_html(
#					    'Sequence Type' => $db->type,
#					    'Sequence Count' => commify_number($db->sequences_count),
#					    'Current as of ' => $timestamp_str,
#					    'Update Frequency' => $update_freq,
#					     __multicol => 5,
#					     __border => 0,
#					   )
#			    .info_table_html(
#					     $db->info_url ? ('Source Information' => '<a href="'.$db->info_url.'">'.truncate_string($db->info_url,40).'</a>') : (),
#					     $db->source_url ? ('FASTA Sequences' => '<a href="'.$db->source_url.'">'.truncate_string($db->source_url,40).'</a>') : (),
#					     __multicol => 2,
#					    __border => 0,
#					   )
#			    .info_table_html(
#					     'Description' => $db->description || '<span class="ghosted">Not available</span>',
#					    __border => 0,
#					   ),
#
#			  );
#}
;return;
},
'declared_args' => {
  '@groups' => { default => ' ()' }
},
'load_time' => 1763464179,

)
;