[Bio] / FigKernelPackages / HTML.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/HTML.pm

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

revision 1.105, Tue Oct 17 12:32:12 2006 UTC revision 1.106, Fri Nov 3 16:58:50 2006 UTC
# Line 1550  Line 1550 
1550    return $java_script;    return $java_script;
1551  }  }
1552    
1553    =head3 sub_link
1554    
1555    C<< my $htmlText = HTML::sub_link($cgi, $sub); >>
1556    
1557    Create a subsystem link. The link will be to the display page if there is no
1558    user or we are in SPROUT mode; otherwise it will be to the edit page.
1559    
1560    =over 4
1561    
1562    =item cgi
1563    
1564    CGI query object for the current web session. The parameters of special interest
1565    are C<SPROUT> and C<user>. If the user is non-blank and SPROUT mode is 0, then
1566    the subsystem's edit page will be shown rather than its display page.
1567    
1568    =item sub
1569    
1570    Name of the desired subsystem. It will be cleaned of underscores before the
1571    hyperlink is applied.
1572    
1573    =back
1574    
1575    =cut
1576    
1577  sub sub_link {  sub sub_link {
1578        # Allow call as an instance in addition to the authorized method.
1579      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1580        # Get the parameters.
1581      my($cgi,$sub) = @_;      my($cgi,$sub) = @_;
1582      my($sub_link);      # Declare the return variable.
1583        my $retVal;
1584      my $user = $cgi->param('user');      # Clean the subsystem name for display purposes. This is a very
1585      my $esc_sub = uri_escape( $sub );      # different thing from URL-escaping.
1586      $sub =~ s/\_/ /g;      my $cleaned = CGI::escapeHtml($sub);
1587      if ($user)      $cleaned =~ s/_/ /g;
1588      {      # URL-escape the subsystem name for use in the link.
1589          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";      my $linkable = uri_escape($sub);
1590      }      # Determine the mode. Note we use the little OR trick to insure that
1591      else      # we have the correct value for plugging into the output link.
1592      {      my $user = $cgi->param('user') || "";
1593          $sub_link = "<a href=\"display_subsys.cgi?ssa_name=$esc_sub&request=show_ssa&sort=by_phylo\">$sub</a>";      my $sproutMode = $cgi->param('SPROUT') || 0;
1594        if ($user && ! $sproutMode) {
1595            # A SEED user is calling, so we go to the edit page.
1596            $retVal = "<a href=\"subsys.cgi?ssa_name=$linkable&request=show_ssa&user=$user\">$cleaned</a>";
1597        } else {
1598            # A visitor or SPROUT user is calling, so we go to the display page.
1599            $retVal = "<a href=\"display_subsys.cgi?ssa_name=$linkable;request=show_ssa;sort=by_phylo;SPROUT=$sproutMode\">$cleaned</a>";
1600      }      }
1601      return $sub_link;      # Return the result.
1602        return $retVal;
1603  }  }
1604    
1605    
1606  sub reaction_link {  sub reaction_link {
1607      my($reaction) = @_;      my($reaction) = @_;
1608      if ($reaction =~ /^(\*)?(R\d+)/)      if ($reaction =~ /^(\*)?(R\d+)/)

Legend:
Removed from v.1.105  
changed lines
  Added in v.1.106

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3