[Bio] / FigWebServices / protein.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/protein.cgi

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

revision 1.98, Fri Mar 11 01:04:32 2005 UTC revision 1.99, Fri Mar 11 03:04:32 2005 UTC
# Line 360  Line 360 
360          &print_graphics_context($beg,$end,$genes,$html->{context_graphic});          &print_graphics_context($beg,$end,$genes,$html->{context_graphic});
361    
362          &print_assignments($fig_or_sprout,$cgi,$html->{assign_for_equiv_prots},$peg);          &print_assignments($fig_or_sprout,$cgi,$html->{assign_for_equiv_prots},$peg);
363          &print_kv_pairs($fig_or_sprout,$cgi,$html->{kv_pairs},$peg);          &print_kv_pairs($is_sprout, $fig_or_sprout,$cgi,$html->{kv_pairs},$peg);
364          &print_subsys_connections($fig_or_sprout,$cgi,$html->{subsys_connections},$peg,$user);          &print_subsys_connections($fig_or_sprout,$cgi,$html->{subsys_connections},$peg,$user);
365          &print_links($fig_or_sprout,$cgi,$html->{links},$peg);          &print_links($fig_or_sprout,$cgi,$html->{links},$peg);
366    
# Line 592  Line 592 
592  }  }
593    
594  sub print_kv_pairs {  sub print_kv_pairs {
595      my($fig_or_sprout,$cgi,$html,$peg) = @_;      my($is_sprout, $fig_or_sprout,$cgi,$html,$peg) = @_;
596      return;  
597        # we don't want to do this for SPROUT
598        return if ($is_sprout);
599    
600      # RAE: modified this to allow the users to edit the key/value pairs.      # RAE: modified this to allow the users to edit the key/value pairs.
601      # there will be two choices: when the "Edit Attributes" button is pressed      # there will be two choices: when the "Edit Attributes" button is pressed
# Line 602  Line 604 
604      # If the Add Changes button is pressed we will save the changes      # If the Add Changes button is pressed we will save the changes
605      # we will do this first before displaying the results      # we will do this first before displaying the results
606    
607      my @attr=$fig_or_sprout->get_attributes($peg);      my @attr=&get_attributes($fig_or_sprout,$peg);
     my $prot=$cgi->param('prot');  
 print STDERR "PROTEIN IS $prot\n";  
608      if ($cgi->param('Add Changes')) {      if ($cgi->param('Add Changes')) {
609        my ($deleted, $added, $changed)=(undef, undef, undef);        my ($deleted, $added, $changed)=(undef, undef, undef);
610    
611        foreach my $key (@attr) {        foreach my $key (@attr) {
612           unless ($cgi->param("key.".$key->[0])) {           unless ($cgi->param("key.".$key->[0])) {
613              $fig_or_sprout->delete_attribute($prot, $key->[0]);              if (&delete_attribute($fig_or_sprout, $peg, $key->[0])) {
614              push @$deleted, [@$key, ["deleted", "td colspan=2 style=\"text-align: center\""]];              push @$deleted, [@$key, ["deleted", "td colspan=2 style=\"text-align: center\""]];
615           }           }
616             }
617           if (($cgi->param("value.".$key->[0]) ne $key->[1]) || ($cgi->param("url.".$key->[0]) ne $key->[2])) {           if (($cgi->param("value.".$key->[0]) ne $key->[1]) || ($cgi->param("url.".$key->[0]) ne $key->[2])) {
618              $fig_or_sprout->change_attribute($prot, $key->[0], $cgi->param("value.".$key->[0]), $cgi->param("url.".$key->[0]));              if (&change_attribute($fig_or_sprout,$peg, $key->[0], $cgi->param("value.".$key->[0]), $cgi->param("url.".$key->[0]))) {
619              push @$changed, [@$key, $cgi->param("value.".$key->[0]), $cgi->param("url.".$key->[0])];              push @$changed, [@$key, $cgi->param("value.".$key->[0]), $cgi->param("url.".$key->[0])];
620           }           }
621        }        }
622          }
623        for (my $i=0; $i<=5; $i++) {        for (my $i=0; $i<=5; $i++) {
624           if ($cgi->param("key.$i")) {           if ($cgi->param("key.$i")) {
625              $fig_or_sprout->add_attribute($prot, $cgi->param("key.$i"), $cgi->param("value.$i"), $cgi->param("url.$i"));              if (&add_attribute($fig_or_sprout,$peg, $cgi->param("key.$i"), $cgi->param("value.$i"), $cgi->param("url.$i"))) {
626              push @$added, [$cgi->param("key.$i"), ["added", "td colspan=2 style=\"text-align: center\""], $cgi->param("value.$i"), $cgi->param("url.$i")];              push @$added, [$cgi->param("key.$i"), ["added", "td colspan=2 style=\"text-align: center\""], $cgi->param("value.$i"), $cgi->param("url.$i")];
627           }           }
628                else {
629                 print STDERR $peg, " and ", $cgi->param("key.$i"), " not added\n";
630                }
631             }
632        }        }
633    
634        my $tab = [];        my $tab = [];
# Line 634  Line 640 
640        push(@$html,&HTML::make_table($col_hdrs,$tab,"Changed Data"));        push(@$html,&HTML::make_table($col_hdrs,$tab,"Changed Data"));
641      }      }
642    
643      my @attr=$fig_or_sprout->get_attributes($peg);      my @attr=&get_attributes($fig_or_sprout, $peg);
644      my $col_hdrs=["Key","Value"];      my $col_hdrs=["Key","Value"];
645    
646      my $tab = [];      my $tab = [];
# Line 657  Line 663 
663              ];              ];
664         }         }
665      }      }
666      else {      #RAE we need to check that this is a scalar
667        elsif (ref($attr[0]) eq "ARRAY") {
668         foreach $_ (sort {$a->[0] cmp $b->[0]} @attr) {         foreach $_ (sort {$a->[0] cmp $b->[0]} @attr) {
669             my($tag,$val,$url) = @$_;             my($tag,$val,$url) = @$_;
670             next unless ($url =~ /^http/);             next unless ($url =~ /^http/);
# Line 2791  Line 2798 
2798    
2799      return &FIG::abbrev($genome_name);      return &FIG::abbrev($genome_name);
2800  }  }
2801    
2802    sub change_attribute {
2803     my($fig_or_sprout, $prot, $tag, $value, $url)=@_;
2804    
2805     return $fig_or_sprout->change_attribute($prot, $tag, $value, $url);
2806    
2807    }
2808    
2809    sub add_attribute {
2810     my($fig_or_sprout, $prot, $tag, $value, $url)=@_;
2811    
2812     return $fig_or_sprout->add_attribute($prot, $tag, $value, $url);
2813    }
2814    
2815    sub delete_attribute {
2816     my($fig_or_sprout, $prot, $tag)=@_;
2817    
2818     return $fig_or_sprout->delete_attribute($prot, $tag);
2819    }
2820    
2821    sub get_attributes {
2822     my($fig_or_sprout, $prot)=@_;
2823    
2824     return $fig_or_sprout->get_attributes($prot);
2825    }

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.99

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3