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 ( $object_id, $object_name, $cvterm_autocomplete_uri, $cvterm_add_uri, $relationships_uri, $evidence_uri, $evidence_description_uri, $reference_uri, $evidence_with_uri, $show_form, $div_id, $ontology_url, $trait_db_name );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( object_id object_name cvterm_add_uri ontology_url ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 63 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
    $object_id = $_[ $pos{'object_id'} ];
#line 64 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
    $object_name = $_[ $pos{'object_name'} ];
#line 65 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $cvterm_autocomplete_uri = exists $pos{'cvterm_autocomplete_uri'} ? $_[ $pos{'cvterm_autocomplete_uri'} ] :  '/ajax/cvterm/autocomplete';
#line 66 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
    $cvterm_add_uri = $_[ $pos{'cvterm_add_uri'} ];
#line 67 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $relationships_uri = exists $pos{'relationships_uri'} ? $_[ $pos{'relationships_uri'} ] :  '/ajax/cvterm/relationships';
#line 68 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $evidence_uri = exists $pos{'evidence_uri'} ? $_[ $pos{'evidence_uri'} ] :  '/ajax/cvterm/evidence';
#line 69 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $evidence_description_uri = exists $pos{'evidence_description_uri'} ? $_[ $pos{'evidence_description_uri'} ] :  '/ajax/cvterm/evidence_description';
#line 70 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $reference_uri = exists $pos{'reference_uri'} ? $_[ $pos{'reference_uri'} ] :  undef;
#line 71 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $evidence_with_uri = exists $pos{'evidence_with_uri'} ? $_[ $pos{'evidence_with_uri'} ] :  undef;
#line 72 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $show_form = exists $pos{'show_form'} ? $_[ $pos{'show_form'} ] :  0;
#line 73 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $div_id = exists $pos{'div_id'} ? $_[ $pos{'div_id'} ] :  'ontology_terms';
#line 74 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
    $ontology_url = $_[ $pos{'ontology_url'} ];
#line 75 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
     $trait_db_name = exists $pos{'trait_db_name'} ? $_[ $pos{'trait_db_name'} ] :  'SP';
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 60 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '
' );
#line 78 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '
<style>
  #ontology .evidence {
    margin: 1em 0 0 4em;
    width: 50%;
    border: 1px dotted gray;
    padding: 10px;
  }
  #ontology_show_details {
    text-align: right;
    margin-bottom: -2em;
  }
  #ontology_show_details label {
    font-weight: bold;
  }
  .active#ontology_show_details {
    background: white;
  }
</style>

<script language="javascript">
  jQuery(document).ready(function() {
       var db_name = jQuery(\'#db_name option:selected\').attr("value");
       jQuery("#term_name").autocomplete({
             source: \'' );
#line 102 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $cvterm_autocomplete_uri  );
#line 102 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\' + "?db_name=" + db_name,
             //delay: 1000,
             autoFocus: true,
             minLength: 3,
             select: function(event, ui) { Ontology.populateEvidence(\'relationship_select\', \'/ajax/cvterm/relationships\'); }
          });

       jQuery("#db_name").change(function(){
            db_name = jQuery(\'#db_name option:selected\').attr("value");
             jQuery("#term_name").autocomplete(\'option\', \'source\', \'' );
#line 111 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $cvterm_autocomplete_uri  );
#line 111 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\' + "?db_name=" + db_name);
       });

  });





</script>

' );
#line 122 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->comp(   '/util/import_javascript.mas', classes=>[qw[ jqueryui popup CXGN.AJAX.Ontology] ]  
); #line 122 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '


' );
#line 125 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
 if ($show_form) {
$m->print( '<div id="associate_cvterm_form" style="display: none">
  <form name="cvterm_form" >
    <div id="cvterm_search"  >
      <table width="100%">
        <tr><td width = "30%"><b>Select ontology</b><br />
            <select id = "db_name" onchange = "jQuery(\'#term_name\').val(\'\');" >
              <option value="GO">GO (gene ontology)</option>
              <option value="PO">PO (plant ontology)</option>
              <option value="' );
#line 134 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $trait_db_name  );
#line 134 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '">' );
#line 134 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $trait_db_name  );
#line 134 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '  phenotype ontology</option>
            </select>
            </td>
          <td><b>Type a term name</b><br /><input type="text" size ="60"  id="term_name" name="term_name" />
            <input type="hidden" id="object_id" name="object_id" value="' );
#line 138 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $object_id  );
#line 138 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '" />
        </td></tr>
        <tr><td colspan="2">
            <b>Relationship type:</b>
            <select id="relationship_select" style="width: 100%"
	            onchange="Ontology.populateEvidence(\'evidence_code_select\', \'' );
#line 143 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $evidence_uri  );
#line 143 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\' )">
            </select>
        </td></tr>
        <tr><td colspan="2">
            <b>Evidence code:</b>
            <select id="evidence_code_select" style="width: 100%"
	            onchange="jQuery(\'#associate_ontology_button\').removeAttr(\'disabled\');Ontology.populateEvidence(\'evidence_description_select\', \'' );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $evidence_description_uri  );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\' + \'?evidence_code_id=\' + jQuery(\'#evidence_code_select\').val() );Ontology.populateEvidence(\'evidence_with_select\', \'' );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $evidence_with_uri  );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\');Ontology.populateEvidence(\'reference_select\', \'' );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $reference_uri  );
#line 149 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\')">
            </select>
        </td></tr>
        <tr><td colspan = "2">
            <b>Evidence description:</b>
            <select id="evidence_description_select" style="width: 100%">
            </select>
        </td></tr>
        <tr><td colspan = "2">
            <b>Evidence with:</b>
            <select id="evidence_with_select" style="width: 100%">
            </select>
        </td></tr>
        <tr><td colspan = "2">
            <b>Reference:</b>
            <select id="reference_select" style="width: 100%">
            </select>
        </td></tr>
        <tr><td colspan = "2">
            <div id="ontology_select_button">
              <input type="button"
                     id="associate_ontology_button"
                     value="associate term"
                     disabled="true"
                     onclick="javascript:Ontology.submitCvtermForm(\'' );
#line 173 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $cvterm_add_uri  );
#line 173 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\', \'' );
#line 173 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $ontology_url  );
#line 173 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '\');this.disabled=true;" />
            </div>
        </td></tr>
      </table>
    </div>
  </form>
</div>

' );
#line 181 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
 }
$m->print( '


<div id="ontology_show_details" style="display: none">
  <form> <input type="checkbox" id="show_details" disabled="true" />
    <label for="show_details">Show complete details</label>
  </form>
</div>

<div id="ontology" >[loading...] </div>

<script language="javascript">
  
  jQuery(document).ready( function() { 
    Ontology.displayOntologies("ontology" , "' );
#line 196 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print(  $ontology_url  );
#line 196 "/home/production/cxgn/sgn/mason/ontology/associate_ontology.mas"
$m->print( '");
  });

</script>
' );
;return;
},
'declared_args' => {
  '$cvterm_add_uri' => { default => undef },
  '$cvterm_autocomplete_uri' => { default => ' \'/ajax/cvterm/autocomplete\'' },
  '$div_id' => { default => ' \'ontology_terms\'' },
  '$evidence_description_uri' => { default => ' \'/ajax/cvterm/evidence_description\'' },
  '$evidence_uri' => { default => ' \'/ajax/cvterm/evidence\'' },
  '$evidence_with_uri' => { default => ' undef' },
  '$object_id' => { default => undef },
  '$object_name' => { default => undef },
  '$ontology_url' => { default => undef },
  '$reference_uri' => { default => ' undef' },
  '$relationships_uri' => { default => ' \'/ajax/cvterm/relationships\'' },
  '$show_form' => { default => ' 0' },
  '$trait_db_name' => { default => ' \'SP\'' }
},
'load_time' => 1763448495,

)
;