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 ( $identifier, $text, $format, $trial_id, $trial_name );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( identifier ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 27 "/home/production/cxgn/sgn/mason/util/barcode.mas"
    $identifier = $_[ $pos{'identifier'} ];
#line 28 "/home/production/cxgn/sgn/mason/util/barcode.mas"
     $text = exists $pos{'text'} ? $_[ $pos{'text'} ] :  '';
#line 29 "/home/production/cxgn/sgn/mason/util/barcode.mas"
     $format = exists $pos{'format'} ? $_[ $pos{'format'} ] :  '';
#line 30 "/home/production/cxgn/sgn/mason/util/barcode.mas"
     $trial_id = exists $pos{'trial_id'} ? $_[ $pos{'trial_id'} ] :  '';
#line 31 "/home/production/cxgn/sgn/mason/util/barcode.mas"
     $trial_name = exists $pos{'trial_name'} ? $_[ $pos{'trial_name'} ] :  '';
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 1 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( '
' );
#line 25 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( '
' );
#line 33 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( '
' );
#line 34 "/home/production/cxgn/sgn/mason/util/barcode.mas"


our %urlencode;
use Tie::UrlEncoder;
use URI::Encode;
my $uri     = URI::Encode->new( { encode_reserved => 0 } );


my $encoded_id = $urlencode{$identifier};
my $encoded_text = $urlencode{$text};
my $link;
my $barcode_name;

if ($format eq "code128") {
  $link = "/barcode/code128png/$encoded_id/$encoded_text";
}
if ($format eq "trial_qrcode"){
  $link = "/barcode/trial/$trial_id/$format";
  $barcode_name = $trial_name." ".$identifier;
}
if ($format eq "stock_qrcode") {
    my $encoded = $uri->encode($encoded_text);
    $link = "/barcode/trial/$encoded/$format";
    #$link = "/barcode/trial/$encoded_text/$format";
    $barcode_name = $text;
}
if ($format eq "qrcode") {
  $link = "/barcode/trial/$trial_id";
  #my $info = "http://solgenomics.net/stock/$identifier/view";
  #$link = "/barcode/qrcodepng/$info/$encoded_text";
  #$link = "/barcode/qrcodepng/$identifier/$encoded_text";
}


#line 69 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( '

 <center><img src="' );
#line 71 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print(  $link  );
#line 71 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( '" /> </br>' );
#line 71 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print(  $barcode_name );
#line 71 "/home/production/cxgn/sgn/mason/util/barcode.mas"
$m->print( ' </center>
' );
;return;
},
'declared_args' => {
  '$format' => { default => ' \'\'' },
  '$identifier' => { default => undef },
  '$text' => { default => ' \'\'' },
  '$trial_id' => { default => ' \'\'' },
  '$trial_name' => { default => ' \'\'' }
},
'load_time' => 1763089219,

)
;