[Bio] / SubsystemEditor / WebPage / ShowVariants.pm Repository:
ViewVC logotype

Diff of /SubsystemEditor/WebPage/ShowVariants.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7, Mon May 5 20:06:46 2008 UTC revision 1.8, Wed May 7 19:19:18 2008 UTC
# Line 22  Line 22 
22    $self->application->register_component(  'Table', 'ShowVariantsTable'  );    $self->application->register_component(  'Table', 'ShowVariantsTable'  );
23    $self->application->register_component(  'Table', 'FRTable'  );    $self->application->register_component(  'Table', 'FRTable'  );
24    $self->application->register_component(  'Table', 'VarDescTable'  );    $self->application->register_component(  'Table', 'VarDescTable'  );
25      $self->application->register_component( 'Info', 'CommentInfo');
26  }  }
27    
28  sub require_javascript {  sub require_javascript {
# Line 44  Line 45 
45    
46    my $name = $cgi->param( 'subsystem' );    my $name = $cgi->param( 'subsystem' );
47    my $ssname = $name;    my $ssname = $name;
48      $name = uri_unescape( $name );
49    $ssname =~ s/\_/ /g;    $ssname =~ s/\_/ /g;
50    
51    my $esc_name = uri_escape($name);    my $esc_name = uri_escape($name);
# Line 149  Line 151 
151      $subsystem->write_subsystem();      $subsystem->write_subsystem();
152    }    }
153    
154      if ( defined( $comment ) && $comment ne '' ) {
155        my $info_component = $application->component( 'CommentInfo' );
156    
157        $info_component->content( $comment );
158        $info_component->default( 0 );
159        $content .= $info_component->output();
160      }
161    
162    $content .= show_variants( $self, $cgi, $fig, $name, $subsystem, $can_alter, $datahash );    $content .= show_variants( $self, $cgi, $fig, $name, $subsystem, $can_alter, $datahash );
163    
164    ###############################    ###############################
# Line 158  Line 168 
168    if ( defined( $error ) && $error ne '' ) {    if ( defined( $error ) && $error ne '' ) {
169      $self->application->add_message( 'warning', $error );      $self->application->add_message( 'warning', $error );
170    }    }
   if ( defined( $comment ) && $comment ne '' ) {  
     $self->application->add_message( 'info', $comment );  
   }  
171    return $content;    return $content;
172  }  }
173    
# Line 265  Line 272 
272    $cont .= $frtable;    $cont .= $frtable;
273    $cont .= $self->start_form();    $cont .= $self->start_form();
274    
275    # create table from parsed data    my $thistable = create_table( $self, $fig, \%has_filled, $col_hdrs, $tab );
276    my $table = $application->component( 'ShowVariantsTable' );  
277    $table->columns( $col_hdrs );  #  # create table from parsed data
278    $table->data( $tab );  #  my $table = $application->component( 'ShowVariantsTable' );
279    #  $table->columns( $col_hdrs );
280    #  $table->data( $tab );
281    
282    ############################################    ############################################
283    # Variant Descriptions from the Notes file #    # Variant Descriptions from the Notes file #
# Line 278  Line 287 
287    
288    my $infotable = '';    my $infotable = '';
289    if ( $can_alter ) {    if ( $can_alter ) {
290      $infotable .= "<TABLE><TR><TH>Variant</TH><TH>Description</TH></TR>";      $infotable .= "<TABLE class='table_table'><TR><TD class='table_first_row'>Variant</TD><TD class='table_first_row'>Description</TD></TR>";
291      foreach my $kv ( sort keys %$variants ) {      foreach my $kv ( sort keys %$variants ) {
292        $infotable .= "<TR><TD><INPUT TYPE=TEXT NAME='VARIANT' ID='VARIANT".$kv."' VALUE='$kv'></TD><TD><INPUT TYPE=TEXT NAME='VARIANTDESC' ID='VARIANTDESC".$kv."' VALUE='".$variants->{ $kv }."' STYLE='width: 500px;'></TD></TR>";        $infotable .= "<TR><TD class='table_odd_row'><INPUT TYPE=TEXT NAME='VARIANT' ID='VARIANT".$kv."' VALUE='$kv'></TD><TD class='table_odd_row'><INPUT TYPE=TEXT NAME='VARIANTDESC' ID='VARIANTDESC".$kv."' VALUE='".$variants->{ $kv }."' STYLE='width: 500px;'></TD></TR>";
293      }      }
294      $infotable .= "<TR><TD><INPUT TYPE=TEXT NAME='NEWVARIANT' ID='NEWVARIANT'></TD><TD><INPUT TYPE=TEXT NAME='NEWVARIANTDESC' ID='NEWVARIANTDESC' STYLE='width: 500px;'></TD></TR>";      $infotable .= "<TR><TD class='table_odd_row'><INPUT TYPE=TEXT NAME='NEWVARIANT' ID='NEWVARIANT'></TD><TD class='table_odd_row'><INPUT TYPE=TEXT NAME='NEWVARIANTDESC' ID='NEWVARIANTDESC' STYLE='width: 500px;'></TD></TR>";
295      $infotable .= "<TR><TD>";      $infotable .= "<TR><TD>";
296      $infotable .= $cgi->submit( -name => "addsave_variants", -value => "Add/Save Variants" );      $infotable .= $cgi->submit( -name => "addsave_variants", -value => "Add/Save Variants" );
297      $infotable .= "</TD></TR></TABLE>";      $infotable .= "</TD></TR></TABLE>";
# Line 304  Line 313 
313    my $esc_name = uri_escape($name);    my $esc_name = uri_escape($name);
314    
315    $cont .= "<H2>Variant groups</H2>\n";    $cont .= "<H2>Variant groups</H2>\n";
316    $cont .= $application->component( 'ShowVariantsTable' )->output();  #  $cont .= $application->component( 'ShowVariantsTable' )->output();
317      $cont .= $thistable;
318    
319    $cont .= $cgi->hidden(-name => 'request', -value => 'set_variants', -override => 1);    $cont .= $cgi->hidden(-name => 'request', -value => 'set_variants', -override => 1);
320    $cont .= $cgi->hidden(-name => 'subsystem', -value => $esc_name, -override => 1);    $cont .= $cgi->hidden(-name => 'subsystem', -value => $name, -override => 1);
321    if ( $can_alter ) {    if ( $can_alter ) {
322      $cont .= $cgi->br;      $cont .= $cgi->br;
323    }    }
# Line 420  Line 430 
430      return $comment;      return $comment;
431  }  }
432    
433    sub create_table {
434      my ($self, $fig, $has_filled, $col_hdrs, $tab ) = @_;
435    
436      my $in;
437      my $tabl = "<TABLE class='table_table'><TR>";
438    
439      foreach my $ch ( @$col_hdrs ) {
440        $tabl .= "<TD class='table_first_row'>";
441        $tabl .= $ch->{ name };
442        $tabl .= "</TD>";
443      }
444    
445      foreach my $r ( @$tab ) {
446        $tabl .= "<TR>";
447    
448        my $num = scalar( keys %{ $has_filled->{ $r->[0] } } );
449        my $pat = $r->[0];
450        if ( $num > 1 ) {
451          if ( !$in->{ $pat } ) {
452            $tabl .= "<TD rowspan=$num class='table_odd_row' STYLE='vertical-align: middle;'>".$r->[0]."</TD>";
453            $in->{ $pat } = 1;
454          }
455        }
456        else {
457          $tabl .= "<TD class='table_odd_row'>".$r->[0]."</TD>";
458        }
459        my $next = 0;
460        foreach my $cell ( @$r ) {
461          if ( $next == 0 ) {
462            $next = 1;
463            next;
464          }
465          else {
466            $tabl .= "<TD class='table_odd_row'>".$cell."</TD>";
467          }
468        }
469        $tabl .= "</TR>";
470      }
471    
472      $tabl .= "</TABLE>";
473    
474      return $tabl;
475    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3