[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.101, Mon Sep 25 19:34:14 2006 UTC revision 1.108, Sun Nov 19 15:11:40 2006 UTC
# Line 57  Line 57 
57    
58      my @parts = split(/\//, $ENV{SCRIPT_NAME});      my @parts = split(/\//, $ENV{SCRIPT_NAME});
59      my $top;      my $top;
60      if ($parts[-2] eq 'FIG')      if (defined $parts[-2] && $parts[-2] eq 'FIG')
61      {      {
62          $top = '.';          $top = '.';
63  #       warn "toplevel @parts\n";  #       warn "toplevel @parts\n";
64      }      }
65      elsif ($parts[-3] eq 'FIG')      elsif (defined $parts[-3] && $parts[-3] eq 'FIG')
66      {      {
67          $top = '..';          $top = '..';
68  #       warn "subdir @parts\n";  #       warn "subdir @parts\n";
# Line 539  Line 539 
539      my(@tab);      my(@tab);
540    
541      my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";      my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";
542      my $width = defined $options{width} ? "width=\"$options{width}\"" : undef;      my $width = defined $options{width} ? "width=\"$options{width}\"" : "";
543      my $class = defined $options{class} ? "class=\"$options{class}\"" : undef;      my $class = defined $options{class} ? "class=\"$options{class}\"" : "";
544      push( @tab, "\n<table $border $width $class>\n",      push( @tab, "\n<table $border $width $class>\n",
545                  "\t<caption><b>$title</b></caption>\n",                  "\t<caption><b>$title</b></caption>\n",
546                  "\t<tr>\n\t\t"                  "\t<tr>\n\t\t"
# Line 808  Line 808 
808      return "<a href=$link>$role</a>";      return "<a href=$link>$role</a>";
809  }  }
810    
811  #  =head2 fid_link
812  # Local means to eliminate the fig|org.peg from the  
813  # text of the link.  Get a link to a fid.
814  #  
815    use: my $html=&HTML::fid_link($cgi, $fid, Local, Just_URL, Full_Path);
816    
817    Local is a boolean means to eliminate the fig|org.peg from the text of the link.
818    
819    Just_URL will only return the URL and not the HTML code. The default is to return the full code.
820    
821    Full_Path is a boolean that will get the full path to the URL not just a relative path. This is required in pages where the base href changes (e.g. if an image is imported like on the metabolic pages).
822    
823    =cut
824    
825    
826  sub fid_link {  sub fid_link {
827      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
828      my($cgi,$fid,$local,$just_url) = @_;      my($cgi,$fid,$local,$just_url,$fullpath) = @_;
829        Trace("Creating link for feature $fid.") if T(4);
830        my $err=join(" ", $cgi,$fid,$local,$just_url,$fullpath);
831    
832      my($n);      my($n);
833    
834      my $top = top_link();      my $top = top_link();
835        if ($fullpath) {$top=$FIG_Config::cgi_url}
836    
837      if ($fid =~ /^fig\|\d+\.\d+\.([a-z]+)\.(\d+)/)      if ($fid =~ /^fig\|\d+\.\d+\.([a-z]+)\.(\d+)/)
838      {      {
# Line 841  Line 856 
856          my $new_framework = $cgi->param('new_framework') ? 1 : 0;          my $new_framework = $cgi->param('new_framework') ? 1 : 0;
857          #added to format prophage and path island links to feature.cgi          #added to format prophage and path island links to feature.cgi
858          my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";          my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";
859            Trace("Sprout mode is \"$sprout\".") if T(4);
860          if ($1 ne "peg" && ! $sprout)          if ($1 ne "peg" && ! $sprout)
861          {          {
862               Trace("Creating feature link for $fid.") if T(4);
863             my $user = $cgi->param('user');             my $user = $cgi->param('user');
864             if (! $user) { $user = "" }             if (! $user) { $user = "" }
865             $link = "$top/feature.cgi?feature=$fid&user=$user$sprout";             $link = "$top/feature.cgi?feature=$fid&user=$user$sprout";
# Line 850  Line 867 
867          }          }
868          else          else
869          {          {
870                Trace("Creating protein link for $fid.") if T(4);
871              my $user = $cgi->param('user');              my $user = $cgi->param('user');
872              if (! $user) { $user = "" }              if (! $user) { $user = "" }
873              my $trans = $cgi->param('translate') ? "&translate=1" : "";              my $trans = $cgi->param('translate') ? "&translate=1" : "";
# Line 887  Line 905 
905      return $family;      return $family;
906  }  }
907    
908    =head2 evidence_codes_explain
909    
910    Given an evidence code, returns a string that explains this eveidence code.
911    
912    =cut
913    
914    sub evidence_codes_explain {
915     my($ec)=@_;
916     return unless ($ec);
917    
918     $ec=uc($ec);
919     return "IDA: Inferred from Direct Assay" if ($ec =~ /IDA/);
920     return "IGI: Inferred from Genetic Interaction" if ($ec =~ /IGI/);
921     return "TAS: Traceable Author Statement" if ($ec =~ /TAS/);
922     return "ISU: in subsystem unique" if ($ec =~ /ISU/);
923     return "$ec: in subsystem duplicates" if ($ec =~ /IDU/);
924     return "$ec: in cluster with" if ($ec =~ /ICW/);
925     return "$ec: unknown!";
926     return "FF: in FIGfam" if ($ec =~ /FF/);
927     return "CWN: clustered with nonhypothetical" if ($ec =~ /CWN/);
928     return "CWH: clustered, but only with hypotheticals" if ($ec =~ /CWH/);
929     return "DLIT: literature references to this gene exist" if ($ec =~ /DLIT/);
930     return "ILIT: no references to this gene exist, but they do to other genes with the same functional role" if ($ec =~ /ILIT/);
931    }
932    
933  sub get_html {  sub get_html {
934      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
# Line 1532  Line 1574 
1574    return $java_script;    return $java_script;
1575  }  }
1576    
1577    =head3 sub_link
1578    
1579    C<< my $htmlText = HTML::sub_link($cgi, $sub); >>
1580    
1581    Create a subsystem link. The link will be to the display page if there is no
1582    user or we are in SPROUT mode; otherwise it will be to the edit page.
1583    
1584    =over 4
1585    
1586    =item cgi
1587    
1588    CGI query object for the current web session. The parameters of special interest
1589    are C<SPROUT> and C<user>. If the user is non-blank and SPROUT mode is 0, then
1590    the subsystem's edit page will be shown rather than its display page.
1591    
1592    =item sub
1593    
1594    Name of the desired subsystem. It will be cleaned of underscores before the
1595    hyperlink is applied.
1596    
1597    =back
1598    
1599    =cut
1600    
1601  sub sub_link {  sub sub_link {
1602        # Allow call as an instance in addition to the authorized method.
1603      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1604        # Get the parameters.
1605      my($cgi,$sub) = @_;      my($cgi,$sub) = @_;
1606      my($sub_link);      # Declare the return variable.
1607        my $retVal;
1608      my $user = $cgi->param('user');      # Clean the subsystem name for display purposes. This is a very
1609      my $esc_sub = uri_escape( $sub );      # different thing from URL-escaping.
1610      $sub =~ s/\_/ /g;      my $cleaned = CGI::escapeHTML($sub);
1611      if ($user)      $cleaned =~ s/_/ /g;
1612      {      # URL-escape the subsystem name for use in the link.
1613          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";      my $linkable = uri_escape($sub);
1614      }      # Determine the mode. Note we use the little OR trick to insure that
1615      else      # we have the correct value for plugging into the output link.
1616      {      my $user = $cgi->param('user') || "";
1617          $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;
1618        if ($user && ! $sproutMode) {
1619            # A SEED user is calling, so we go to the edit page.
1620            $retVal = "<a href=\"subsys.cgi?ssa_name=$linkable&request=show_ssa&user=$user\">$cleaned</a>";
1621        } else {
1622            # A visitor or SPROUT user is calling, so we go to the display page.
1623            $retVal = "<a href=\"display_subsys.cgi?ssa_name=$linkable;request=show_ssa;sort=by_phylo;SPROUT=$sproutMode\">$cleaned</a>";
1624      }      }
1625      return $sub_link;      # Return the result.
1626        return $retVal;
1627  }  }
1628    
1629    
1630  sub reaction_link {  sub reaction_link {
1631      my($reaction) = @_;      my($reaction) = @_;
1632      if ($reaction =~ /^(\*)?(R\d+)/)      if ($reaction =~ /^(\*)?(R\d+)/)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3