[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.3, Thu Oct 20 00:26:29 2005 UTC revision 1.4, Thu Oct 20 00:44:11 2005 UTC
# Line 34  Line 34 
34    
35  my $search_results= [];  my $search_results= [];
36    
37  my $custom_term_error = "";  my $error_message = "";
38    
39    
40  my $user = "";  my $user = "";
# Line 141  Line 141 
141    
142  }  }
143    
144  elsif ($cgi->param('request') eq "Add Custom Term")  elsif ($cgi->param('request') eq "Add Manual Term")
145  {  {
146      my %id_term_to_source;      my %id_term_to_source;
147      my $id_term;      my $id_term;
148      if ( $cgi->param('custom_source') && $cgi->param('custom_id') && $cgi->param('custom_term') ) {      if ( $cgi->param('manual_source') && $cgi->param('manual_id') && $cgi->param('manual_term') ) {
149          $custom_source=$cgi->param('custom_source');          $manual_source=$cgi->param('manual_source');
150          $custom_id=$cgi->param('custom_id');          $manual_id=$cgi->param('manual_id');
151          $custom_term=$cgi->param('custom_term');          $manual_term=$cgi->param('manual_term');
152          $id_term = $custom_id.": ".$custom_term;          $id_term = $manual_id.": ".$manual_term;
153          $id_term_to_source{$id_term} = $custom_source;          $id_term_to_source{$id_term} = $manual_source;
154          &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);          &add_terms($fig,$cgi,$html,$peg,\%id_term_to_source);
155      } else {      } else {
156          $custom_term_error = "Error: supply all three items correctly.";          $error_message = "Error in 'Add Terms Manually': supply all three items correctly.";
157      }      }
158  }  }
159  else  else
# Line 178  Line 178 
178  sub search  sub search
179  {  {
180      my ($fig,$cgi,$html,$peg,$cv,$search_term) =@_;      my ($fig,$cgi,$html,$peg,$cv,$search_term) =@_;
181      $file = $FIG_Config::global."/".$cv."_lookup.txt";      $file = $FIG_Config::global."/cv_search_".$cv.".txt";
182      open(LOOKUP,"$file");      if (! open(LOOKUP,"$file") ) {
183            $error_message="Search could not find vocabulary file, $file";
184            return;
185        }
186      my @lines = <LOOKUP>;      my @lines = <LOOKUP>;
187      my @grep_results = grep(/$search_term/i,@lines);      my @grep_results = grep(/$search_term/i,@lines);
188      print STDERR "$grep_results[0]\n";      print STDERR "$grep_results[0]\n";
# Line 278  Line 281 
281      $cgi->br,      $cgi->br,
282      "<h2>Controlled Vocabulary Workbench for $peg</h2>",      "<h2>Controlled Vocabulary Workbench for $peg</h2>",
283      $cgi->hr,      $cgi->hr,
284        "<h1>$error_message</h1>",
285        $cgi->hr,
286      "<h4>Current Terms Assigned To $peg </h4>\n",      "<h4>Current Terms Assigned To $peg </h4>\n",
287      &HTML::make_table($delete_col_hdrs,$delete_table_rows),      &HTML::make_table($delete_col_hdrs,$delete_table_rows),
288      $cgi->br,      $cgi->br,
# Line 308  Line 313 
313      $cgi->hidden(-name=>'prot', -value=>'$peg'),      $cgi->hidden(-name=>'prot', -value=>'$peg'),
314      $cgi->hidden(-name=>'user', -value=>'$user'),      $cgi->hidden(-name=>'user', -value=>'$user'),
315      $cgi->hr,      $cgi->hr,
316      "<h4>Add Custom Terms (WARNING: This is strongly discouraged to avoid data entry errors.)</h5>",      "<h4>Add Terms Manually (WARNING: This is strongly discouraged to avoid data entry errors.)</h5>",
     "<h3>$custom_term_error</h3>",  
317      "<h5>Vocabulary Name (single word, no spaces or punctuation), e.g., MyVocab </h5>\n",      "<h5>Vocabulary Name (single word, no spaces or punctuation), e.g., MyVocab </h5>\n",
318      $cgi->textfield(-name => 'custom_source', -size => 48, -default=>'', -override=>1 ),      $cgi->textfield(-name => 'manual_source', -size => 48, -default=>'', -override=>1 ),
319      "<h5>Term ID (single word, no spaces or punctuation), e.g., A147</h5>\n",      "<h5>Term ID (single word, no spaces or punctuation), e.g., A147</h5>\n",
320      $cgi->textfield(-name => 'custom_id', -size => 32, -default=>'', -override=>1),      $cgi->textfield(-name => 'manual_id', -size => 32, -default=>'', -override=>1),
321      "<h5>Term text, e.g., catalytic activity</h5>\n",      "<h5>Term text, e.g., catalytic activity</h5>\n",
322      $cgi->textfield(-name => 'custom_term', -size => 70, -default=>'', -override=>1 ),      $cgi->textfield(-name => 'manual_term', -size => 70, -default=>'', -override=>1 ),
323      $cgi->br,$cgi->br,      $cgi->br,$cgi->br,
324      $cgi->submit(-name=>'request', -value=>'Add Custom Term'),      $cgi->submit(-name=>'request', -value=>'Add Manual Term'),
325      $cgi->br,      $cgi->br,
326      $cgi->hr,      $cgi->hr,
327      $cgi->end_form;      $cgi->end_form;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3