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

Diff of /FigWebServices/subsys.cgi

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

revision 1.107, Thu Aug 4 22:25:12 2005 UTC revision 1.108, Sat Aug 6 15:30:29 2005 UTC
# Line 312  Line 312 
312      {      {
313          &new_ssa($fig,$cgi,$html);          &new_ssa($fig,$cgi,$html);
314      }      }
315    #RAE: undelete these 5 commented out line for the new interface
316    #    elsif ($request eq "manage_ss")
317      else      else
318      {      {
319          &show_initial($fig,$cgi,$html);          &manage_subsystems($fig,$cgi,$html);
320      }      }
321    #    else
322    #    {
323    #       &show_initial($fig,$cgi,$html);
324    #    }
325  }  }
326    
327  &HTML::show_page($cgi,$html);  &HTML::show_page($cgi,$html);
328  exit;  exit;
329    
   
330  sub show_initial {  sub show_initial {
331        # a new first page written by Rob
332        my($fig,$cgi,$html) = @_;
333    
334        my $user = $cgi->param('user');
335        my $sort = $cgi->param('sortby'); unless ($sort) {$sort="Classification"}
336    
337        my @ssa = map {
338         my $ss=$_;
339         my ($version, $curator, $pedigree, $roles)=$fig->subsystem_info($ss->[0]);
340         push @$ss, scalar(@$roles), scalar(@{$fig->subsystem_genomes($ss->[0], 1)}), $version;
341         unshift @$ss, @{$fig->subsystem_classification($ss->[0])};
342         $ss->[2]=&ssa_link($fig, $ss->[2], $user);
343         if ($ss->[3] eq $user) {$ss->[3] = [$ss->[3], "td style='background-color: #BA55D3'"]}
344         $_=$ss;
345        }
346        &existing_subsystem_annotations($fig);
347    
348    
349        # sort the cells
350        if ($sort eq "Classification")     {@ssa=sort {$a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] || $a->[2] cmp $b->[2]} @ssa}
351        elsif ($sort eq "Subsystem")       {@ssa=sort {$a->[2] cmp $b->[2]} @ssa}
352        elsif ($sort eq "Curator")         {@ssa=sort {$a->[3] cmp $b->[3]} @ssa}
353        elsif ($sort eq "Number of Roles") {@ssa=sort {$a->[4] <=> $b->[4]} @ssa}
354        elsif ($sort eq "Version")         {@ssa=sort {$a->[5] <=> $b->[5]} @ssa}
355    
356        my $col_hdrs=[["Classification", "th colspan=2 style='text-align: center'"], "Subsystem", "Curator", "Number of Roles", "Number of Genomes", "Version"];
357        my $tab=HTML->merge_table_rows(\@ssa);
358        my $url = &FIG::cgi_url . "/subsys.cgi?user=$user&request=manage_ss";
359        my $target = "window$$";
360    
361        push(@$html,
362         $cgi->start_form,
363         "<div class='ssinstructions'>\n",
364         "Please choose one of the subsystems from this list, or begin working on your own by entering a name in the box at the bottom of the page. ",
365         "We suggest that you take some time to look at the subsystems others have developed before working on your own.",
366         "<ul><li>Please do not ever edit someone else's spreadsheet</li>\n<li>Please do not open multiple windows to process the same spreadsheet.</li>",
367         "<li>Feel free to open a subsystem spreadsheet and then open multiple other SEED windows to access data and modify annotations.</li>",
368         "<li>You can access someone else's subsystem spreadsheet using your ID</li>",
369         "<li>You can <a href='$url&manage=mine'>manage your subsystems</a></li>",
370         "<li>You can <a href='$url'>manage all subsystems</a></li>",
371         "</ul></div>",
372         "<div class='page_settings' style='width: 75%; margin-left: auto; margin-right: auto'>Please enter your username: ", $cgi->textfield(-name=>"user"), "\n",
373         "<table border=1>\n",
374         "<tr><th>Settings for this page</th><th>Settings for the links to the next page.<br>Change these and click Update Table View.</th></tr>\n",
375         "<tr><td>",
376            "<table><tr>",
377            "<td valign=center>Sort table by</td><td valign=center>",
378            $cgi->popup_menu(-name=>'sortby', -values=>['Classification', 'Subsystem', 'Curator', 'Number of Roles', 'Version']), "</td></tr></table\n",
379         "</td>\n<td>",
380            "<table><tr>",
381            "<td valign=center>Show clusters</td><td valign=center>", $cgi->checkbox(-name=>'show_clusters', -label=>''), "</td>\n",
382            "<td valign=center>Default Spreadsheet view</td><td valign=center>",
383            $cgi->scrolling_list(-name => 'sort', -value => ['unsorted','alphabetic','by_pattern', 'by_phylo','by_tax_id','by_variant']),
384            "</td></tr></table>\n",
385         "</td></tr></table>\n",
386         $cgi->submit('Update Table View'), $cgi->reset, $cgi->p,
387         "</div>\n",
388         &HTML::make_table($col_hdrs,$tab,"Subsystems"),
389         $cgi->end_form(),
390    
391    
392    #    $cgi->h3('To start a new subsystem'), $cgi->p("Please enter the name of the subsystem that you would like to start. You will be provided with a blank",
393    #    " form that you can fill in with the roles and genomes to create a subsystem like those above."),
394    #    $cgi->start_form(-action => "subsys.cgi",
395    #                                 -target => $target,
396    #                                 -method => 'post'),
397    #    $cgi->hidden(-name => 'user', -value => $user, -override => 1),
398    #    $cgi->hidden(-name => 'request', -value => 'new_ssa', -override => 1),
399    #    "Name of New Subsystem: ",
400    #    $cgi->textfield(-name => "ssa_name", -size => 50),
401    #    $cgi->hidden(-name => 'can_alter', -value => 1, -override => 1),
402    #    $cgi->br,
403    #
404    #    $cgi->submit('start new subsystem'),
405        $cgi->end_form,
406     );
407    }
408    
409    
410    
411    
412    
413    sub manage_subsystems {
414      my($fig,$cgi,$html) = @_;      my($fig,$cgi,$html) = @_;
415      my($set,$when,$comment);      my($set,$when,$comment);
416    
417      my $user = $cgi->param('user');      my $user = $cgi->param('user');
418        my $ss_to_manage=$cgi->param('manage');  # we will only display a subset of subsystems on the old SS page
419        if ($ss_to_manage eq "mine") {$ss_to_manage=$user}
420    
421      my @ssa = &existing_subsystem_annotations($fig);      my @ssa = &existing_subsystem_annotations($fig);
422        #$ss_to_manage && (@ssa=grep {$_->[1] eq $ss_to_manage} @ssa); # limit the set if we want to
423    
424      if (@ssa > 0)      if (@ssa > 0)
425      {      {
# Line 354  Line 446 
446                   $cgi->textfield(-name => "copy_from2", -size => 50),                   $cgi->textfield(-name => "copy_from2", -size => 50),
447                   $cgi->br,                   $cgi->br,
448    
449                   "Move from (leave blank to start from scratch): ",                   "Rename an existing subsystem: ",
450                   $cgi->textfield(-name => "move_from", -size => 50),                   $cgi->textfield(-name => "move_from", -size => 50),
451                   $cgi->br,                   $cgi->br,
452    
# Line 636  Line 728 
728          {          {
729              $subsystem->set_notes($notes);              $subsystem->set_notes($notes);
730          }          }
731          if ($cgi->param('classif1') || $cgi->param('classif2'))          if ($cgi->param('classif1t') || $cgi->param('classif2t'))
732          {          {
733           my $class;           $subsystem->set_classification([$cgi->param('classif1t'), $cgi->param('classif2t')]);
734           @$class=($cgi->param('classif1'), $cgi->param('classif2'));          }
735           $subsystem->set_classification($class);          elsif ($cgi->param('classif1') || $cgi->param('classif2'))
736            {
737             $subsystem->set_classification([$cgi->param('classif1'), $cgi->param('classif2')]);
738          }          }
739    
740          my(@param,$param,$genome,$val);          my(@param,$param,$genome,$val);
# Line 1001  Line 1095 
1095      my $class=$subsystem->get_classification();      my $class=$subsystem->get_classification();
1096      if ($can_alter)      if ($can_alter)
1097      {      {
1098         push(@$html, $cgi->hr, "CLASSIFICATION:\n", $cgi->textfield(-name=>"classif1", -value=>$$class[0], -size=>40),         my $menu1; my $menu2; # the two menus for the classification of subsystems
1099          $cgi->textfield(-name=>"classif2", -value=>$$class[1], -size=>40));         # make sure we have empty blanks
1100           $menu1->{''}=$menu2->{''}=1;
1101           map {$menu1->{$_->[0]}=1; $menu2->{$_->[1]}=1} $fig->all_subsystem_classifications();
1102    
1103           push(@$html, $cgi->hr, "<table><tr><th colspan=2 style='text-align: center'>Subsystem Classification</th></tr>\n",
1104            "<tr><td>Please use ours:</td><td>", $cgi->popup_menu(-name=>"classif1", -values=>[sort {$a cmp $b} keys %$menu1], -default=>$$class[0]), "</td><td>",
1105            $cgi->popup_menu(-name=>"classif2", -values=>[sort {$a cmp $b} keys %$menu2], -default=>$$class[1]), "</td></tr>\n<tr><td>Or make your own:</td><td>",
1106            $cgi->textfield(-name=>"classif1t", -size=>50), "</td><td>", $cgi->textfield(-name=>"classif2t", -size=>50), "</td></tr></table>\n"
1107            );
1108      }      }
1109      elsif ($class)      elsif ($class)
1110      {      {
# Line 2176  Line 2278 
2278    
2279      my $check;      my $check;
2280      my $can_alter = $check = $fig->subsystem_curator($ssa) eq $user;      my $can_alter = $check = $fig->subsystem_curator($ssa) eq $user;
2281        my $sort=$cgi->param('sort');
2282        my $show_clusters=$cgi->param('show_clusters');
2283    
2284      my $esc_ssa = uri_escape($ssa);      my $esc_ssa = uri_escape($ssa);
2285      my $url = &FIG::cgi_url . "/subsys.cgi?user=$user&ssa_name=$esc_ssa&request=show_ssa&can_alter=$can_alter&check=$check&sort=by_phylo&show_clusters=1";      my $url = &FIG::cgi_url . "/subsys.cgi?user=$user&ssa_name=$esc_ssa&request=show_ssa&can_alter=$can_alter&check=$check&sort=$sort&show_clusters=$show_clusters";
2286      return "<a href=$url target=$target>$name</a>";      return "<a href=$url target=$target>$name</a>";
2287  }  }
2288    

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.108

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3