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

Diff of /FigWebServices/cv.cgi

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

revision 1.6, Fri Oct 21 22:27:40 2005 UTC revision 1.7, Sat Oct 22 18:38:21 2005 UTC
# Line 76  Line 76 
76  my $ids;  my $ids;
77  my $tag_to_id;  my $tag_to_id;
78  my $inputs;  my $inputs;
 print STDERR "REQ: ", $cgi->param('request'), "\n";  
79    
80  if ($cgi->param('request') eq "Delete Checked Terms")  if ($cgi->param('request') eq "Delete Checked Terms")
81  {  {
82      print STDERR "HERE Delete Clicked\n";      if (!$cgi->param('user'))
83        {
84                my(@html);
85                push(@html, $cgi->p("You must be logged in as a user to edit controlled vocabulary terms."));
86                &HTML::show_page($cgi, \@html, 1);
87                exit;
88        }
89        else
90        {
91      my %id_term_to_source;      my %id_term_to_source;
92      my @checked;      my @checked;
93      my @param_list = $cgi->param();      my @param_list = $cgi->param();
# Line 93  Line 100 
100               if($cgi->param($p))               if($cgi->param($p))
101               {               {
102                   $value = $cgi->param($p);                   $value = $cgi->param($p);
                  print STDERR "delete_checked_value:$value\n";  
103                   push(@checked,$value)                   push(@checked,$value)
104               }               }
105            }            }
# Line 101  Line 107 
107    
108          for my $c (@checked)          for my $c (@checked)
109          {          {
            print STDERR "checked_for_deletion:$c\n";  
110             @temp = split('split_here',$c);             @temp = split('split_here',$c);
111             $id_term_to_source{$temp[1]} = $temp[0];             $id_term_to_source{$temp[1]} = $temp[0];
112          }          }
113      }      }
114      &delete_terms($fig,$cgi,$html,$peg,\%id_term_to_source);      &delete_terms($fig,$cgi,$html,$peg,\%id_term_to_source);
115  }  }
116    }
117  elsif ($cgi->param('request') eq "Search Selected Controlled Vocabulary")  elsif ($cgi->param('request') eq "Search Selected Controlled Vocabulary")
118  {  {
119      if ( $cgi->param('search_term') && $cgi->param('select_cv') ) {      if ( $cgi->param('search_term') && $cgi->param('select_cv') ) {
# Line 118  Line 124 
124  }  }
125  elsif ($cgi->param('request') eq "Add New Terms")  elsif ($cgi->param('request') eq "Add New Terms")
126  {  {
127        if (!$cgi->param('user'))
128        {
129                my(@html);
130                push(@html, $cgi->p("You must be logged in as a user to edit controlled vocabulary terms."));
131                &HTML::show_page($cgi, \@html, 1);
132                exit;
133        }
134        else
135        {
136      my %id_term_to_source;      my %id_term_to_source;
137      my @checked;      my @checked;
138      my @param_list = $cgi->param();      my @param_list = $cgi->param();
# Line 127  Line 142 
142          {          {
143            if ( $p=~/add_checked/)            if ( $p=~/add_checked/)
144            {            {
               print STDERR "checked_param:$p\n";  
145               if($cgi->param($p))               if($cgi->param($p))
146               {               {
147                   $value = $cgi->param($p);                   $value = $cgi->param($p);
# Line 142  Line 156 
156             $source = $temp[0];             $source = $temp[0];
157             $id_term = $temp[1];             $id_term = $temp[1];
158             $id_term_to_source{$id_term} =$source ;             $id_term_to_source{$id_term} =$source ;
            print STDERR "checked_source:$source\n";  
            print STDERR "checked_value:$c\n";  
159          }          }
160      }      }
161      &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);      &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);
162    
163  }  }
164    }
165    
166  elsif ($cgi->param('request') eq "Add Manual Term")  elsif ($cgi->param('request') eq "Add Manual Term")
167  {  {
168        if (!$cgi->param('user'))
169        {
170                my(@html);
171                push(@html, $cgi->p("You must be logged in as a user to edit controlled vocabulary terms."));
172                &HTML::show_page($cgi, \@html, 1);
173                exit;
174        }
175        else
176        {
177      my %id_term_to_source;      my %id_term_to_source;
178      my $id_term;      my $id_term;
179      if ( $cgi->param('manual_source') && $cgi->param('manual_id') && $cgi->param('manual_term') ) {      if ( $cgi->param('manual_source') && $cgi->param('manual_id') && $cgi->param('manual_term') ) {
# Line 161  Line 183 
183          $id_term = $manual_id.": ".$manual_term;          $id_term = $manual_id.": ".$manual_term;
184          $id_term_to_source{$id_term} = $manual_source;          $id_term_to_source{$id_term} = $manual_source;
185          &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);          &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);
186      } else {          }
187            else
188            {
189          $error_message = "Error in 'Add Terms Manually': supply all three items correctly.";          $error_message = "Error in 'Add Terms Manually': supply all three items correctly.";
190      }      }
191  }  }
192    }
193  else  else
194  {  {
195      #no op.  Initial page display      #no op.  Initial page display
# Line 180  Line 205 
205     my @id_term = keys(%{$id_term_to_source});     my @id_term = keys(%{$id_term_to_source});
206     foreach my $it (@id_term)     foreach my $it (@id_term)
207     {     {
          print STDERR "key:$it\n";  
          print STDERR "value:$id_term_to_source->{$it}\n";  
208           $fig->delete_attribute($peg,$id_term_to_source->{$it},$it)           $fig->delete_attribute($peg,$id_term_to_source->{$it},$it)
209      }      }
210  }  }
# Line 196  Line 219 
219      }      }
220      my @lines = <LOOKUP>;      my @lines = <LOOKUP>;
221      my @grep_results = grep(/$search_term/i,@lines);      my @grep_results = grep(/$search_term/i,@lines);
     print STDERR "$grep_results[0]\n";  
222      return [@grep_results];      return [@grep_results];
223      #my $search_results = [@grep_results];      #my $search_results = [@grep_results];
224      #&show_search_results($fig,$cgi,$html,$peg,$cv,$search_results);      #&show_search_results($fig,$cgi,$html,$peg,$cv,$search_results);
# Line 208  Line 230 
230      my @id_term = keys(%{$id_term_to_source});      my @id_term = keys(%{$id_term_to_source});
231      foreach my $it (@id_term)      foreach my $it (@id_term)
232      {      {
         print STDERR "added_source:$id_term_to_source->{$it}\n";  
         print STDERR "added_value:$it\n";  
   
233          $fig->add_attribute($peg,$id_term_to_source->{$it},$it);          $fig->add_attribute($peg,$id_term_to_source->{$it},$it);
234    
235      }      }
# Line 237  Line 256 
256          $cv=$cgi->param('select_cv');          $cv=$cgi->param('select_cv');
257          $source = $cv;          $source = $cv;
258          $id= $temp[1];          $id= $temp[1];
         print STDERR "id:$id\n";  
259          $term = $temp[2];          $term = $temp[2];
         print STDERR "term:$term\n";  
260          $id_and_term = $id.": ".$term;          $id_and_term = $id.": ".$term;
261          $cb_value = $cv."split_here".$id."; ".$term;          $cb_value = $cv."split_here".$id."; ".$term;
         print STDERR "iandt:$id_and_term\n";  
262          $cb ="<input type=checkbox name=add_checked_$counter value='$cb_value'>" ;          $cb ="<input type=checkbox name=add_checked_$counter value='$cb_value'>" ;
263          push(@$row,$cb);          push(@$row,$cb);
264          push(@$row,$source);          push(@$row,$source);
# Line 260  Line 276 
276    
277      my $delete_col_hdrs = ["Delete","Source","ID: Term"];      my $delete_col_hdrs = ["Delete","Source","ID: Term"];
278      my @results = $fig->get_attributes($peg);      my @results = $fig->get_attributes($peg);
     print STDERR "@results\n";  
     print STDERR "peg:$peg\n";  
279      my $delete_table_rows;      my $delete_table_rows;
280      my $counter =0;      my $counter =0;
281      for my $r (@results)      for my $r (@results)
282      {      {
283          $row = [];          $row = [];
284          $source = $r->[1];          $source = $r->[1];
         print STDERR "deleted_checked_source:$source\n";  
285          $id_and_term = $r->[2];          $id_and_term = $r->[2];
         print STDERR "deleted_id_and_term:$id_and_term\n";  
286          $value = $source."split_here".$id_and_term;          $value = $source."split_here".$id_and_term;
287          $cb ="<input type=checkbox name='delete_checked_$counter' value='$value'>" ;          $cb ="<input type=checkbox name='delete_checked_$counter' value='$value'>" ;
288          push(@$row,$cb);          push(@$row,$cb);

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3